From eeab420c7059f9e77af8300abfe6774f5e772e45 Mon Sep 17 00:00:00 2001 From: Chenlei Hu <chenlei.hu@mail.utoronto.ca> Date: Mon, 6 Jan 2025 18:42:45 -0500 Subject: [PATCH 01/47] Update frontend to v1.6.18 (#6368) --- ...EJhGbv.js => BaseViewTemplate-BNGF4K22.js} | 4 +- ...P1MIWYX.js => DownloadGitView-DeC7MBzG.js} | 6 +- ...CxijYN47.js => ExtensionPanel-D4Phn0Zr.js} | 10 ++-- ...View-DswvqURL.js => GraphView-HVeNbkaW.js} | 14 ++--- ...ew-AV2llYNm.js => InstallView-CAcYt0HL.js} | 6 +- ...xaJ1IiJ.js => KeybindingPanel-Dc3C4lG1.js} | 12 ++-- ...js => ManualConfigurationView-Bi_qHE-n.js} | 10 ++-- ...aD8u74.js => NotSupportedView-Drz3x2d-.js} | 6 +- ...4HMGK.js => ServerConfigPanel-Be4StJmv.js} | 6 +- ...iO_acWT.js => ServerStartView-CIDTUh4x.js} | 6 +- ...2l9Kbchu.js => UserSelectView-B3jYchWu.js} | 6 +- ...ew-CB7Th_kO.js => WelcomeView-N0ZXLjdi.js} | 6 +- .../{index-B7ycxfFq.js => index-5HFeZax4.js} | 4 +- .../{index-lMQBwSDj.js => index-B-aVupP5.js} | 4 +- .../{index-CK0rrCYF.js => index-B5F0uxTQ.js} | 8 +-- .../{index-5Sv744Dr.js => index-Bordpmzt.js} | 4 +- .../{index-C4Fk50Nx.js => index-DjNHn37O.js} | 60 +++++++++++-------- .../{index-hdfnBvYs.js => index-jXPKy3pP.js} | 6 +- ...{index-DmMtlpqz.css => index-t-sFBuUC.css} | 2 +- ...fkLBy.js => keybindingService-Bx7YdkXn.js} | 8 +-- ...YAb1j.js => serverConfigStore-CvyKFVuP.js} | 4 +- web/index.html | 4 +- 22 files changed, 104 insertions(+), 92 deletions(-) rename web/assets/{BaseViewTemplate-CsEJhGbv.js => BaseViewTemplate-BNGF4K22.js} (84%) rename web/assets/{DownloadGitView-DP1MIWYX.js => DownloadGitView-DeC7MBzG.js} (94%) rename web/assets/{ExtensionPanel-CxijYN47.js => ExtensionPanel-D4Phn0Zr.js} (96%) rename web/assets/{GraphView-DswvqURL.js => GraphView-HVeNbkaW.js} (99%) rename web/assets/{InstallView-AV2llYNm.js => InstallView-CAcYt0HL.js} (99%) rename web/assets/{KeybindingPanel-CxaJ1IiJ.js => KeybindingPanel-Dc3C4lG1.js} (97%) rename web/assets/{ManualConfigurationView-BA4Vtud8.js => ManualConfigurationView-Bi_qHE-n.js} (94%) rename web/assets/{NotSupportedView-CRaD8u74.js => NotSupportedView-Drz3x2d-.js} (95%) rename web/assets/{ServerConfigPanel-TLv4HMGK.js => ServerConfigPanel-Be4StJmv.js} (97%) rename web/assets/{ServerStartView-CiO_acWT.js => ServerStartView-CIDTUh4x.js} (95%) rename web/assets/{UserSelectView-2l9Kbchu.js => UserSelectView-B3jYchWu.js} (97%) rename web/assets/{WelcomeView-CB7Th_kO.js => WelcomeView-N0ZXLjdi.js} (90%) rename web/assets/{index-B7ycxfFq.js => index-5HFeZax4.js} (93%) rename web/assets/{index-lMQBwSDj.js => index-B-aVupP5.js} (94%) rename web/assets/{index-CK0rrCYF.js => index-B5F0uxTQ.js} (99%) rename web/assets/{index-5Sv744Dr.js => index-Bordpmzt.js} (99%) rename web/assets/{index-C4Fk50Nx.js => index-DjNHn37O.js} (99%) rename web/assets/{index-hdfnBvYs.js => index-jXPKy3pP.js} (97%) rename web/assets/{index-DmMtlpqz.css => index-t-sFBuUC.css} (99%) rename web/assets/{keybindingService-D48fkLBy.js => keybindingService-Bx7YdkXn.js} (96%) rename web/assets/{serverConfigStore-BawYAb1j.js => serverConfigStore-CvyKFVuP.js} (97%) diff --git a/web/assets/BaseViewTemplate-CsEJhGbv.js b/web/assets/BaseViewTemplate-BNGF4K22.js similarity index 84% rename from web/assets/BaseViewTemplate-CsEJhGbv.js rename to web/assets/BaseViewTemplate-BNGF4K22.js index d254b402..b0395614 100644 --- a/web/assets/BaseViewTemplate-CsEJhGbv.js +++ b/web/assets/BaseViewTemplate-BNGF4K22.js @@ -1,4 +1,4 @@ -import { d as defineComponent, o as openBlock, f as createElementBlock, J as renderSlot, T as normalizeClass } from "./index-C4Fk50Nx.js"; +import { d as defineComponent, o as openBlock, f as createElementBlock, J as renderSlot, T as normalizeClass } from "./index-DjNHn37O.js"; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "BaseViewTemplate", props: { @@ -20,4 +20,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as _ }; -//# sourceMappingURL=BaseViewTemplate-CsEJhGbv.js.map +//# sourceMappingURL=BaseViewTemplate-BNGF4K22.js.map diff --git a/web/assets/DownloadGitView-DP1MIWYX.js b/web/assets/DownloadGitView-DeC7MBzG.js similarity index 94% rename from web/assets/DownloadGitView-DP1MIWYX.js rename to web/assets/DownloadGitView-DeC7MBzG.js index fff3e743..6f00b364 100644 --- a/web/assets/DownloadGitView-DP1MIWYX.js +++ b/web/assets/DownloadGitView-DeC7MBzG.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, o as openBlock, k as createBlock, M as withCtx, H as createBaseVNode, X as toDisplayString, N as createVNode, j as unref, l as script, bW as useRouter } from "./index-C4Fk50Nx.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-CsEJhGbv.js"; +import { d as defineComponent, o as openBlock, k as createBlock, M as withCtx, H as createBaseVNode, X as toDisplayString, N as createVNode, j as unref, l as script, bW as useRouter } from "./index-DjNHn37O.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-BNGF4K22.js"; const _hoisted_1 = { class: "max-w-screen-sm flex flex-col gap-8 p-8 bg-[url('/assets/images/Git-Logo-White.svg')] bg-no-repeat bg-right-top bg-origin-padding" }; const _hoisted_2 = { class: "mt-24 text-4xl font-bold text-red-500" }; const _hoisted_3 = { class: "space-y-4" }; @@ -55,4 +55,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=DownloadGitView-DP1MIWYX.js.map +//# sourceMappingURL=DownloadGitView-DeC7MBzG.js.map diff --git a/web/assets/ExtensionPanel-CxijYN47.js b/web/assets/ExtensionPanel-D4Phn0Zr.js similarity index 96% rename from web/assets/ExtensionPanel-CxijYN47.js rename to web/assets/ExtensionPanel-D4Phn0Zr.js index 6cf7706c..02baf6e1 100644 --- a/web/assets/ExtensionPanel-CxijYN47.js +++ b/web/assets/ExtensionPanel-D4Phn0Zr.js @@ -1,9 +1,9 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, ab as ref, cn as FilterMatchMode, cs as useExtensionStore, a as useSettingStore, m as onMounted, c as computed, o as openBlock, k as createBlock, M as withCtx, N as createVNode, co as SearchBox, j as unref, bZ as script, H as createBaseVNode, f as createElementBlock, E as renderList, X as toDisplayString, aE as createTextVNode, F as Fragment, l as script$1, I as createCommentVNode, aI as script$3, bO as script$4, c4 as script$5, cp as _sfc_main$1 } from "./index-C4Fk50Nx.js"; -import { s as script$2, a as script$6 } from "./index-CK0rrCYF.js"; -import "./index-lMQBwSDj.js"; -import "./index-B7ycxfFq.js"; +import { d as defineComponent, ab as ref, cn as FilterMatchMode, cs as useExtensionStore, a as useSettingStore, m as onMounted, c as computed, o as openBlock, k as createBlock, M as withCtx, N as createVNode, co as SearchBox, j as unref, bZ as script, H as createBaseVNode, f as createElementBlock, E as renderList, X as toDisplayString, aE as createTextVNode, F as Fragment, l as script$1, I as createCommentVNode, aI as script$3, bO as script$4, c4 as script$5, cp as _sfc_main$1 } from "./index-DjNHn37O.js"; +import { s as script$2, a as script$6 } from "./index-B5F0uxTQ.js"; +import "./index-B-aVupP5.js"; +import "./index-5HFeZax4.js"; const _hoisted_1 = { class: "flex justify-end" }; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "ExtensionPanel", @@ -180,4 +180,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=ExtensionPanel-CxijYN47.js.map +//# sourceMappingURL=ExtensionPanel-D4Phn0Zr.js.map diff --git a/web/assets/GraphView-DswvqURL.js b/web/assets/GraphView-HVeNbkaW.js similarity index 99% rename from web/assets/GraphView-DswvqURL.js rename to web/assets/GraphView-HVeNbkaW.js index 14d9f192..648d3aab 100644 --- a/web/assets/GraphView-DswvqURL.js +++ b/web/assets/GraphView-HVeNbkaW.js @@ -1,11 +1,11 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, u as useExecutionStore, c as computed, a as useSettingStore, b as useWorkflowStore, e as useTitle, o as openBlock, f as createElementBlock, g as useWorkspaceStore, w as watchEffect, h as app, r as resolveDirective, i as withDirectives, v as vShow, j as unref, k as createBlock, n as normalizeStyle, s as showNativeMenu, l as script$d, _ as _export_sfc, m as onMounted, p as onBeforeUnmount, B as BaseStyle, q as script$e, t as getWidth, x as getHeight, y as getOuterWidth, z as getOuterHeight, A as getVNodeProp, C as isArray, D as mergeProps, F as Fragment, E as renderList, G as resolveDynamicComponent, H as createBaseVNode, I as createCommentVNode, J as renderSlot, K as useSidebarTabStore, L as useBottomPanelStore, M as withCtx, N as createVNode, O as getAttribute, P as findSingle, Q as focus, R as equals, S as Ripple, T as normalizeClass, U as getOffset, V as script$f, W as script$g, X as toDisplayString, Y as script$h, Z as markRaw, $ as defineStore, a0 as shallowRef, a1 as useI18n, a2 as useCommandStore, a3 as LiteGraph, a4 as useColorPaletteStore, a5 as watch, a6 as useNodeDefStore, a7 as BadgePosition, a8 as LGraphBadge, a9 as _, aa as NodeBadgeMode, ab as ref, ac as useEventListener, ad as nextTick, ae as st, af as normalizeI18nKey, ag as LGraphGroup, ah as LGraphNode, ai as EditableText, aj as isNotEmpty, ak as UniqueComponentId, al as ZIndex, am as resolveFieldData, an as OverlayEventBus, ao as isEmpty, ap as addStyle, aq as relativePosition, ar as absolutePosition, as as ConnectedOverlayScrollHandler, at as isTouchDevice, au as findLastIndex, av as script$i, aw as script$j, ax as script$k, ay as script$l, az as script$m, aA as script$n, aB as resolveComponent, aC as Transition, aD as createSlots, aE as createTextVNode, aF as useNodeFrequencyStore, aG as useNodeBookmarkStore, aH as highlightQuery, aI as script$o, aJ as formatNumberWithSuffix, aK as NodeSourceType, aL as pushScopeId, aM as popScopeId, aN as NodePreview, aO as NodeSearchFilter, aP as script$p, aQ as SearchFilterChip, aR as useLitegraphService, aS as storeToRefs, aT as isRef, aU as toRaw, aV as LinkReleaseTriggerAction, aW as script$q, aX as useUserStore, aY as useDialogStore, aZ as SettingDialogHeader, a_ as SettingDialogContent, a$ as useKeybindingStore, b0 as Teleport, b1 as LinkMarkerShape, b2 as useModelToNodeStore, b3 as CanvasPointer, b4 as IS_CONTROL_WIDGET, b5 as updateControlWidgetLabel, b6 as useColorPaletteService, b7 as setStorageValue, b8 as api, b9 as usePragmaticDroppable, ba as LGraph, bb as LLink, bc as DragAndScale, bd as LGraphCanvas, be as ContextMenu, bf as ChangeTracker, bg as useWorkflowService, bh as ComfyNodeDefImpl, bi as ComfyModelDef, bj as script$r, bk as script$s, bl as script$t, bm as script$u, bn as script$v, bo as normalizeProps, bp as ToastEventBus, bq as setAttribute, br as TransitionGroup, bs as useToast, bt as useToastStore, bu as resolve, bv as nestedPosition, bw as script$w, bx as isPrintableCharacter, by as useQueueSettingsStore, bz as script$x, bA as useQueuePendingTaskCountStore, bB as useLocalStorage, bC as useDraggable, bD as watchDebounced, bE as inject, bF as useElementBounding, bG as lodashExports, bH as useEventBus, bI as script$z, bJ as guardReactiveProps, bK as useMenuItemStore, bL as usePragmaticDraggable, bM as withModifiers, bN as script$B, bO as script$C, bP as provide, bQ as script$D, bR as useDialogService, bS as LGraphEventMode, bT as useQueueStore, bU as i18n, bV as useModelStore } from "./index-C4Fk50Nx.js"; -import { s as script$y } from "./index-hdfnBvYs.js"; -import { s as script$A } from "./index-lMQBwSDj.js"; -import { u as useKeybindingService } from "./keybindingService-D48fkLBy.js"; -import { u as useServerConfigStore } from "./serverConfigStore-BawYAb1j.js"; -import "./index-B7ycxfFq.js"; +import { d as defineComponent, u as useExecutionStore, c as computed, a as useSettingStore, b as useWorkflowStore, e as useTitle, o as openBlock, f as createElementBlock, g as useWorkspaceStore, w as watchEffect, h as app, r as resolveDirective, i as withDirectives, v as vShow, j as unref, k as createBlock, n as normalizeStyle, s as showNativeMenu, l as script$d, _ as _export_sfc, m as onMounted, p as onBeforeUnmount, B as BaseStyle, q as script$e, t as getWidth, x as getHeight, y as getOuterWidth, z as getOuterHeight, A as getVNodeProp, C as isArray, D as mergeProps, F as Fragment, E as renderList, G as resolveDynamicComponent, H as createBaseVNode, I as createCommentVNode, J as renderSlot, K as useSidebarTabStore, L as useBottomPanelStore, M as withCtx, N as createVNode, O as getAttribute, P as findSingle, Q as focus, R as equals, S as Ripple, T as normalizeClass, U as getOffset, V as script$f, W as script$g, X as toDisplayString, Y as script$h, Z as markRaw, $ as defineStore, a0 as shallowRef, a1 as useI18n, a2 as useCommandStore, a3 as LiteGraph, a4 as useColorPaletteStore, a5 as watch, a6 as useNodeDefStore, a7 as BadgePosition, a8 as LGraphBadge, a9 as _, aa as NodeBadgeMode, ab as ref, ac as useEventListener, ad as nextTick, ae as st, af as normalizeI18nKey, ag as LGraphGroup, ah as LGraphNode, ai as EditableText, aj as isNotEmpty, ak as UniqueComponentId, al as ZIndex, am as resolveFieldData, an as OverlayEventBus, ao as isEmpty, ap as addStyle, aq as relativePosition, ar as absolutePosition, as as ConnectedOverlayScrollHandler, at as isTouchDevice, au as findLastIndex, av as script$i, aw as script$j, ax as script$k, ay as script$l, az as script$m, aA as script$n, aB as resolveComponent, aC as Transition, aD as createSlots, aE as createTextVNode, aF as useNodeFrequencyStore, aG as useNodeBookmarkStore, aH as highlightQuery, aI as script$o, aJ as formatNumberWithSuffix, aK as NodeSourceType, aL as pushScopeId, aM as popScopeId, aN as NodePreview, aO as NodeSearchFilter, aP as script$p, aQ as SearchFilterChip, aR as useLitegraphService, aS as storeToRefs, aT as isRef, aU as toRaw, aV as LinkReleaseTriggerAction, aW as script$q, aX as useUserStore, aY as useDialogStore, aZ as SettingDialogHeader, a_ as SettingDialogContent, a$ as useKeybindingStore, b0 as Teleport, b1 as LinkMarkerShape, b2 as useModelToNodeStore, b3 as CanvasPointer, b4 as IS_CONTROL_WIDGET, b5 as updateControlWidgetLabel, b6 as useColorPaletteService, b7 as setStorageValue, b8 as api, b9 as usePragmaticDroppable, ba as LGraph, bb as LLink, bc as DragAndScale, bd as LGraphCanvas, be as ContextMenu, bf as ChangeTracker, bg as useWorkflowService, bh as ComfyNodeDefImpl, bi as ComfyModelDef, bj as script$r, bk as script$s, bl as script$t, bm as script$u, bn as script$v, bo as normalizeProps, bp as ToastEventBus, bq as setAttribute, br as TransitionGroup, bs as useToast, bt as useToastStore, bu as resolve, bv as nestedPosition, bw as script$w, bx as isPrintableCharacter, by as useQueueSettingsStore, bz as script$x, bA as useQueuePendingTaskCountStore, bB as useLocalStorage, bC as useDraggable, bD as watchDebounced, bE as inject, bF as useElementBounding, bG as lodashExports, bH as useEventBus, bI as script$z, bJ as guardReactiveProps, bK as useMenuItemStore, bL as usePragmaticDraggable, bM as withModifiers, bN as script$B, bO as script$C, bP as provide, bQ as script$D, bR as useDialogService, bS as LGraphEventMode, bT as useQueueStore, bU as i18n, bV as useModelStore } from "./index-DjNHn37O.js"; +import { s as script$y } from "./index-jXPKy3pP.js"; +import { s as script$A } from "./index-B-aVupP5.js"; +import { u as useKeybindingService } from "./keybindingService-Bx7YdkXn.js"; +import { u as useServerConfigStore } from "./serverConfigStore-CvyKFVuP.js"; +import "./index-5HFeZax4.js"; const DEFAULT_TITLE = "ComfyUI"; const TITLE_SUFFIX = " - ComfyUI"; const _sfc_main$t = /* @__PURE__ */ defineComponent({ @@ -9891,4 +9891,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=GraphView-DswvqURL.js.map +//# sourceMappingURL=GraphView-HVeNbkaW.js.map diff --git a/web/assets/InstallView-AV2llYNm.js b/web/assets/InstallView-CAcYt0HL.js similarity index 99% rename from web/assets/InstallView-AV2llYNm.js rename to web/assets/InstallView-CAcYt0HL.js index 0b455d93..2cf9e7f1 100644 --- a/web/assets/InstallView-AV2llYNm.js +++ b/web/assets/InstallView-CAcYt0HL.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value2) => __defProp(target, "name", { value: value2, configurable: true }); -import { B as BaseStyle, q as script$6, o as openBlock, f as createElementBlock, D as mergeProps, c1 as findIndexInList, c2 as find, aB as resolveComponent, k as createBlock, G as resolveDynamicComponent, M as withCtx, H as createBaseVNode, X as toDisplayString, J as renderSlot, I as createCommentVNode, T as normalizeClass, P as findSingle, F as Fragment, aC as Transition, i as withDirectives, v as vShow, ak as UniqueComponentId, d as defineComponent, ab as ref, c3 as useModel, N as createVNode, j as unref, c4 as script$7, bQ as script$8, bM as withModifiers, aP as script$9, a1 as useI18n, c as computed, aI as script$a, aE as createTextVNode, c0 as electronAPI, m as onMounted, r as resolveDirective, av as script$b, c5 as script$c, c6 as script$d, l as script$e, bZ as script$f, c7 as MigrationItems, w as watchEffect, E as renderList, c8 as script$g, bW as useRouter, aL as pushScopeId, aM as popScopeId, aU as toRaw, _ as _export_sfc } from "./index-C4Fk50Nx.js"; -import { _ as _sfc_main$5 } from "./BaseViewTemplate-CsEJhGbv.js"; +import { B as BaseStyle, q as script$6, o as openBlock, f as createElementBlock, D as mergeProps, c1 as findIndexInList, c2 as find, aB as resolveComponent, k as createBlock, G as resolveDynamicComponent, M as withCtx, H as createBaseVNode, X as toDisplayString, J as renderSlot, I as createCommentVNode, T as normalizeClass, P as findSingle, F as Fragment, aC as Transition, i as withDirectives, v as vShow, ak as UniqueComponentId, d as defineComponent, ab as ref, c3 as useModel, N as createVNode, j as unref, c4 as script$7, bQ as script$8, bM as withModifiers, aP as script$9, a1 as useI18n, c as computed, aI as script$a, aE as createTextVNode, c0 as electronAPI, m as onMounted, r as resolveDirective, av as script$b, c5 as script$c, c6 as script$d, l as script$e, bZ as script$f, c7 as MigrationItems, w as watchEffect, E as renderList, c8 as script$g, bW as useRouter, aL as pushScopeId, aM as popScopeId, aU as toRaw, _ as _export_sfc } from "./index-DjNHn37O.js"; +import { _ as _sfc_main$5 } from "./BaseViewTemplate-BNGF4K22.js"; var classes$4 = { root: /* @__PURE__ */ __name(function root(_ref) { var instance = _ref.instance; @@ -1285,4 +1285,4 @@ const InstallView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data- export { InstallView as default }; -//# sourceMappingURL=InstallView-AV2llYNm.js.map +//# sourceMappingURL=InstallView-CAcYt0HL.js.map diff --git a/web/assets/KeybindingPanel-CxaJ1IiJ.js b/web/assets/KeybindingPanel-Dc3C4lG1.js similarity index 97% rename from web/assets/KeybindingPanel-CxaJ1IiJ.js rename to web/assets/KeybindingPanel-Dc3C4lG1.js index f165f9a5..6cf204dd 100644 --- a/web/assets/KeybindingPanel-CxaJ1IiJ.js +++ b/web/assets/KeybindingPanel-Dc3C4lG1.js @@ -1,10 +1,10 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, c as computed, o as openBlock, f as createElementBlock, F as Fragment, E as renderList, N as createVNode, M as withCtx, aE as createTextVNode, X as toDisplayString, j as unref, aI as script, I as createCommentVNode, ab as ref, cn as FilterMatchMode, a$ as useKeybindingStore, a2 as useCommandStore, a1 as useI18n, af as normalizeI18nKey, w as watchEffect, bs as useToast, r as resolveDirective, k as createBlock, co as SearchBox, H as createBaseVNode, l as script$2, av as script$4, bM as withModifiers, bZ as script$5, aP as script$6, i as withDirectives, cp as _sfc_main$2, aL as pushScopeId, aM as popScopeId, cq as KeyComboImpl, cr as KeybindingImpl, _ as _export_sfc } from "./index-C4Fk50Nx.js"; -import { s as script$1, a as script$3 } from "./index-CK0rrCYF.js"; -import { u as useKeybindingService } from "./keybindingService-D48fkLBy.js"; -import "./index-lMQBwSDj.js"; -import "./index-B7ycxfFq.js"; +import { d as defineComponent, c as computed, o as openBlock, f as createElementBlock, F as Fragment, E as renderList, N as createVNode, M as withCtx, aE as createTextVNode, X as toDisplayString, j as unref, aI as script, I as createCommentVNode, ab as ref, cn as FilterMatchMode, a$ as useKeybindingStore, a2 as useCommandStore, a1 as useI18n, af as normalizeI18nKey, w as watchEffect, bs as useToast, r as resolveDirective, k as createBlock, co as SearchBox, H as createBaseVNode, l as script$2, av as script$4, bM as withModifiers, bZ as script$5, aP as script$6, i as withDirectives, cp as _sfc_main$2, aL as pushScopeId, aM as popScopeId, cq as KeyComboImpl, cr as KeybindingImpl, _ as _export_sfc } from "./index-DjNHn37O.js"; +import { s as script$1, a as script$3 } from "./index-B5F0uxTQ.js"; +import { u as useKeybindingService } from "./keybindingService-Bx7YdkXn.js"; +import "./index-B-aVupP5.js"; +import "./index-5HFeZax4.js"; const _hoisted_1$1 = { key: 0, class: "px-2" @@ -281,4 +281,4 @@ const KeybindingPanel = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "d export { KeybindingPanel as default }; -//# sourceMappingURL=KeybindingPanel-CxaJ1IiJ.js.map +//# sourceMappingURL=KeybindingPanel-Dc3C4lG1.js.map diff --git a/web/assets/ManualConfigurationView-BA4Vtud8.js b/web/assets/ManualConfigurationView-Bi_qHE-n.js similarity index 94% rename from web/assets/ManualConfigurationView-BA4Vtud8.js rename to web/assets/ManualConfigurationView-Bi_qHE-n.js index 122da4e9..233f20fa 100644 --- a/web/assets/ManualConfigurationView-BA4Vtud8.js +++ b/web/assets/ManualConfigurationView-Bi_qHE-n.js @@ -1,9 +1,9 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, a1 as useI18n, ab as ref, m as onMounted, o as openBlock, k as createBlock, M as withCtx, H as createBaseVNode, X as toDisplayString, N as createVNode, j as unref, aI as script, l as script$2, c0 as electronAPI } from "./index-C4Fk50Nx.js"; -import { s as script$1 } from "./index-hdfnBvYs.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-CsEJhGbv.js"; -import "./index-B7ycxfFq.js"; +import { d as defineComponent, a1 as useI18n, ab as ref, m as onMounted, o as openBlock, k as createBlock, M as withCtx, H as createBaseVNode, X as toDisplayString, N as createVNode, j as unref, aI as script, l as script$2, c0 as electronAPI } from "./index-DjNHn37O.js"; +import { s as script$1 } from "./index-jXPKy3pP.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-BNGF4K22.js"; +import "./index-5HFeZax4.js"; const _hoisted_1 = { class: "comfy-installer grow flex flex-col gap-4 text-neutral-300 max-w-110" }; const _hoisted_2 = { class: "text-2xl font-semibold text-neutral-100" }; const _hoisted_3 = { class: "m-1 text-neutral-300" }; @@ -72,4 +72,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=ManualConfigurationView-BA4Vtud8.js.map +//# sourceMappingURL=ManualConfigurationView-Bi_qHE-n.js.map diff --git a/web/assets/NotSupportedView-CRaD8u74.js b/web/assets/NotSupportedView-Drz3x2d-.js similarity index 95% rename from web/assets/NotSupportedView-CRaD8u74.js rename to web/assets/NotSupportedView-Drz3x2d-.js index 07e3eca6..a24af84a 100644 --- a/web/assets/NotSupportedView-CRaD8u74.js +++ b/web/assets/NotSupportedView-Drz3x2d-.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, bW as useRouter, r as resolveDirective, o as openBlock, k as createBlock, M as withCtx, H as createBaseVNode, X as toDisplayString, N as createVNode, j as unref, l as script, i as withDirectives } from "./index-C4Fk50Nx.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-CsEJhGbv.js"; +import { d as defineComponent, bW as useRouter, r as resolveDirective, o as openBlock, k as createBlock, M as withCtx, H as createBaseVNode, X as toDisplayString, N as createVNode, j as unref, l as script, i as withDirectives } from "./index-DjNHn37O.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-BNGF4K22.js"; const _imports_0 = "" + new URL("images/sad_girl.png", import.meta.url).href; const _hoisted_1 = { class: "sad-container" }; const _hoisted_2 = /* @__PURE__ */ createBaseVNode("img", { @@ -83,4 +83,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=NotSupportedView-CRaD8u74.js.map +//# sourceMappingURL=NotSupportedView-Drz3x2d-.js.map diff --git a/web/assets/ServerConfigPanel-TLv4HMGK.js b/web/assets/ServerConfigPanel-Be4StJmv.js similarity index 97% rename from web/assets/ServerConfigPanel-TLv4HMGK.js rename to web/assets/ServerConfigPanel-Be4StJmv.js index 6489eb66..e84d2d43 100644 --- a/web/assets/ServerConfigPanel-TLv4HMGK.js +++ b/web/assets/ServerConfigPanel-Be4StJmv.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { H as createBaseVNode, o as openBlock, f as createElementBlock, Z as markRaw, d as defineComponent, a as useSettingStore, aS as storeToRefs, a5 as watch, cO as useCopyToClipboard, a1 as useI18n, k as createBlock, M as withCtx, j as unref, bZ as script, X as toDisplayString, E as renderList, F as Fragment, N as createVNode, l as script$1, I as createCommentVNode, bQ as script$2, cP as FormItem, cp as _sfc_main$1, c0 as electronAPI } from "./index-C4Fk50Nx.js"; -import { u as useServerConfigStore } from "./serverConfigStore-BawYAb1j.js"; +import { H as createBaseVNode, o as openBlock, f as createElementBlock, Z as markRaw, d as defineComponent, a as useSettingStore, aS as storeToRefs, a5 as watch, cO as useCopyToClipboard, a1 as useI18n, k as createBlock, M as withCtx, j as unref, bZ as script, X as toDisplayString, E as renderList, F as Fragment, N as createVNode, l as script$1, I as createCommentVNode, bQ as script$2, cP as FormItem, cp as _sfc_main$1, c0 as electronAPI } from "./index-DjNHn37O.js"; +import { u as useServerConfigStore } from "./serverConfigStore-CvyKFVuP.js"; const _hoisted_1$1 = { viewBox: "0 0 24 24", width: "1.2em", @@ -155,4 +155,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=ServerConfigPanel-TLv4HMGK.js.map +//# sourceMappingURL=ServerConfigPanel-Be4StJmv.js.map diff --git a/web/assets/ServerStartView-CiO_acWT.js b/web/assets/ServerStartView-CIDTUh4x.js similarity index 95% rename from web/assets/ServerStartView-CiO_acWT.js rename to web/assets/ServerStartView-CIDTUh4x.js index 1abcb36a..6567eea2 100644 --- a/web/assets/ServerStartView-CiO_acWT.js +++ b/web/assets/ServerStartView-CIDTUh4x.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, a1 as useI18n, ab as ref, b_ as ProgressStatus, m as onMounted, o as openBlock, k as createBlock, M as withCtx, H as createBaseVNode, aE as createTextVNode, X as toDisplayString, j as unref, f as createElementBlock, I as createCommentVNode, N as createVNode, l as script, i as withDirectives, v as vShow, b$ as BaseTerminal, aL as pushScopeId, aM as popScopeId, c0 as electronAPI, _ as _export_sfc } from "./index-C4Fk50Nx.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-CsEJhGbv.js"; +import { d as defineComponent, a1 as useI18n, ab as ref, b_ as ProgressStatus, m as onMounted, o as openBlock, k as createBlock, M as withCtx, H as createBaseVNode, aE as createTextVNode, X as toDisplayString, j as unref, f as createElementBlock, I as createCommentVNode, N as createVNode, l as script, i as withDirectives, v as vShow, b$ as BaseTerminal, aL as pushScopeId, aM as popScopeId, c0 as electronAPI, _ as _export_sfc } from "./index-DjNHn37O.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-BNGF4K22.js"; const _withScopeId = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-42c1131d"), n = n(), popScopeId(), n), "_withScopeId"); const _hoisted_1 = { class: "text-2xl font-bold" }; const _hoisted_2 = { key: 0 }; @@ -95,4 +95,4 @@ const ServerStartView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "d export { ServerStartView as default }; -//# sourceMappingURL=ServerStartView-CiO_acWT.js.map +//# sourceMappingURL=ServerStartView-CIDTUh4x.js.map diff --git a/web/assets/UserSelectView-2l9Kbchu.js b/web/assets/UserSelectView-B3jYchWu.js similarity index 97% rename from web/assets/UserSelectView-2l9Kbchu.js rename to web/assets/UserSelectView-B3jYchWu.js index 554218e5..9d2dda86 100644 --- a/web/assets/UserSelectView-2l9Kbchu.js +++ b/web/assets/UserSelectView-B3jYchWu.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, aX as useUserStore, bW as useRouter, ab as ref, c as computed, m as onMounted, o as openBlock, k as createBlock, M as withCtx, H as createBaseVNode, X as toDisplayString, N as createVNode, bX as withKeys, j as unref, av as script, bQ as script$1, bY as script$2, bZ as script$3, aE as createTextVNode, I as createCommentVNode, l as script$4 } from "./index-C4Fk50Nx.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-CsEJhGbv.js"; +import { d as defineComponent, aX as useUserStore, bW as useRouter, ab as ref, c as computed, m as onMounted, o as openBlock, k as createBlock, M as withCtx, H as createBaseVNode, X as toDisplayString, N as createVNode, bX as withKeys, j as unref, av as script, bQ as script$1, bY as script$2, bZ as script$3, aE as createTextVNode, I as createCommentVNode, l as script$4 } from "./index-DjNHn37O.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-BNGF4K22.js"; const _hoisted_1 = { id: "comfy-user-selection", class: "min-w-84 relative rounded-lg bg-[var(--comfy-menu-bg)] p-5 px-10 shadow-lg" @@ -99,4 +99,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=UserSelectView-2l9Kbchu.js.map +//# sourceMappingURL=UserSelectView-B3jYchWu.js.map diff --git a/web/assets/WelcomeView-CB7Th_kO.js b/web/assets/WelcomeView-N0ZXLjdi.js similarity index 90% rename from web/assets/WelcomeView-CB7Th_kO.js rename to web/assets/WelcomeView-N0ZXLjdi.js index d5adbd55..bec1292e 100644 --- a/web/assets/WelcomeView-CB7Th_kO.js +++ b/web/assets/WelcomeView-N0ZXLjdi.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, bW as useRouter, o as openBlock, k as createBlock, M as withCtx, H as createBaseVNode, X as toDisplayString, N as createVNode, j as unref, l as script, aL as pushScopeId, aM as popScopeId, _ as _export_sfc } from "./index-C4Fk50Nx.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-CsEJhGbv.js"; +import { d as defineComponent, bW as useRouter, o as openBlock, k as createBlock, M as withCtx, H as createBaseVNode, X as toDisplayString, N as createVNode, j as unref, l as script, aL as pushScopeId, aM as popScopeId, _ as _export_sfc } from "./index-DjNHn37O.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-BNGF4K22.js"; const _withScopeId = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-7dfaf74c"), n = n(), popScopeId(), n), "_withScopeId"); const _hoisted_1 = { class: "flex flex-col items-center justify-center gap-8 p-8" }; const _hoisted_2 = { class: "animated-gradient-text text-glow select-none" }; @@ -37,4 +37,4 @@ const WelcomeView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data- export { WelcomeView as default }; -//# sourceMappingURL=WelcomeView-CB7Th_kO.js.map +//# sourceMappingURL=WelcomeView-N0ZXLjdi.js.map diff --git a/web/assets/index-B7ycxfFq.js b/web/assets/index-5HFeZax4.js similarity index 93% rename from web/assets/index-B7ycxfFq.js rename to web/assets/index-5HFeZax4.js index 2cfff2fa..b4bc111e 100644 --- a/web/assets/index-B7ycxfFq.js +++ b/web/assets/index-5HFeZax4.js @@ -1,6 +1,6 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { ct as script$1, H as createBaseVNode, o as openBlock, f as createElementBlock, D as mergeProps } from "./index-C4Fk50Nx.js"; +import { ct as script$1, H as createBaseVNode, o as openBlock, f as createElementBlock, D as mergeProps } from "./index-DjNHn37O.js"; var script = { name: "PlusIcon", "extends": script$1 @@ -24,4 +24,4 @@ script.render = render; export { script as s }; -//# sourceMappingURL=index-B7ycxfFq.js.map +//# sourceMappingURL=index-5HFeZax4.js.map diff --git a/web/assets/index-lMQBwSDj.js b/web/assets/index-B-aVupP5.js similarity index 94% rename from web/assets/index-lMQBwSDj.js rename to web/assets/index-B-aVupP5.js index c10ea2de..2f4957c2 100644 --- a/web/assets/index-lMQBwSDj.js +++ b/web/assets/index-B-aVupP5.js @@ -1,6 +1,6 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { ct as script$1, H as createBaseVNode, o as openBlock, f as createElementBlock, D as mergeProps } from "./index-C4Fk50Nx.js"; +import { ct as script$1, H as createBaseVNode, o as openBlock, f as createElementBlock, D as mergeProps } from "./index-DjNHn37O.js"; var script = { name: "BarsIcon", "extends": script$1 @@ -26,4 +26,4 @@ script.render = render; export { script as s }; -//# sourceMappingURL=index-lMQBwSDj.js.map +//# sourceMappingURL=index-B-aVupP5.js.map diff --git a/web/assets/index-CK0rrCYF.js b/web/assets/index-B5F0uxTQ.js similarity index 99% rename from web/assets/index-CK0rrCYF.js rename to web/assets/index-B5F0uxTQ.js index a483ee10..78222d18 100644 --- a/web/assets/index-CK0rrCYF.js +++ b/web/assets/index-B5F0uxTQ.js @@ -1,8 +1,8 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { B as BaseStyle, q as script$s, ct as script$t, H as createBaseVNode, o as openBlock, f as createElementBlock, D as mergeProps, X as toDisplayString, S as Ripple, r as resolveDirective, i as withDirectives, k as createBlock, G as resolveDynamicComponent, bY as script$u, aB as resolveComponent, T as normalizeClass, aD as createSlots, M as withCtx, bz as script$v, bw as script$w, F as Fragment, E as renderList, aE as createTextVNode, bq as setAttribute, ak as UniqueComponentId, bo as normalizeProps, J as renderSlot, I as createCommentVNode, R as equals, bk as script$x, c8 as script$y, cu as getFirstFocusableElement, an as OverlayEventBus, A as getVNodeProp, am as resolveFieldData, cv as invokeElementMethod, O as getAttribute, cw as getNextElementSibling, y as getOuterWidth, cx as getPreviousElementSibling, l as script$z, ay as script$A, W as script$B, bn as script$D, aj as isNotEmpty, bM as withModifiers, z as getOuterHeight, cy as _default, al as ZIndex, Q as focus, ap as addStyle, ar as absolutePosition, as as ConnectedOverlayScrollHandler, at as isTouchDevice, cz as FilterOperator, ax as script$E, cA as FocusTrap, N as createVNode, aC as Transition, bX as withKeys, cB as getIndex, aW as script$G, cC as isClickable, cD as clearSelection, cE as localeComparator, cF as sort, cG as FilterService, cn as FilterMatchMode, P as findSingle, c1 as findIndexInList, c2 as find, cH as exportCSV, U as getOffset, cI as getHiddenElementOuterWidth, cJ as getHiddenElementOuterHeight, cK as reorderArray, cL as getWindowScrollTop, cM as removeClass, cN as addClass, ao as isEmpty, aw as script$H, az as script$I } from "./index-C4Fk50Nx.js"; -import { s as script$C } from "./index-lMQBwSDj.js"; -import { s as script$F } from "./index-B7ycxfFq.js"; +import { B as BaseStyle, q as script$s, ct as script$t, H as createBaseVNode, o as openBlock, f as createElementBlock, D as mergeProps, X as toDisplayString, S as Ripple, r as resolveDirective, i as withDirectives, k as createBlock, G as resolveDynamicComponent, bY as script$u, aB as resolveComponent, T as normalizeClass, aD as createSlots, M as withCtx, bz as script$v, bw as script$w, F as Fragment, E as renderList, aE as createTextVNode, bq as setAttribute, ak as UniqueComponentId, bo as normalizeProps, J as renderSlot, I as createCommentVNode, R as equals, bk as script$x, c8 as script$y, cu as getFirstFocusableElement, an as OverlayEventBus, A as getVNodeProp, am as resolveFieldData, cv as invokeElementMethod, O as getAttribute, cw as getNextElementSibling, y as getOuterWidth, cx as getPreviousElementSibling, l as script$z, ay as script$A, W as script$B, bn as script$D, aj as isNotEmpty, bM as withModifiers, z as getOuterHeight, cy as _default, al as ZIndex, Q as focus, ap as addStyle, ar as absolutePosition, as as ConnectedOverlayScrollHandler, at as isTouchDevice, cz as FilterOperator, ax as script$E, cA as FocusTrap, N as createVNode, aC as Transition, bX as withKeys, cB as getIndex, aW as script$G, cC as isClickable, cD as clearSelection, cE as localeComparator, cF as sort, cG as FilterService, cn as FilterMatchMode, P as findSingle, c1 as findIndexInList, c2 as find, cH as exportCSV, U as getOffset, cI as getHiddenElementOuterWidth, cJ as getHiddenElementOuterHeight, cK as reorderArray, cL as getWindowScrollTop, cM as removeClass, cN as addClass, ao as isEmpty, aw as script$H, az as script$I } from "./index-DjNHn37O.js"; +import { s as script$C } from "./index-B-aVupP5.js"; +import { s as script$F } from "./index-5HFeZax4.js"; var ColumnStyle = BaseStyle.extend({ name: "column" }); @@ -8783,4 +8783,4 @@ export { script as a, script$r as s }; -//# sourceMappingURL=index-CK0rrCYF.js.map +//# sourceMappingURL=index-B5F0uxTQ.js.map diff --git a/web/assets/index-5Sv744Dr.js b/web/assets/index-Bordpmzt.js similarity index 99% rename from web/assets/index-5Sv744Dr.js rename to web/assets/index-Bordpmzt.js index 5ec1cf8e..85a75572 100644 --- a/web/assets/index-5Sv744Dr.js +++ b/web/assets/index-Bordpmzt.js @@ -1,6 +1,6 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { ca as ComfyDialog, cb as $el, cc as ComfyApp, h as app, a3 as LiteGraph, bd as LGraphCanvas, cd as useExtensionService, ce as processDynamicPrompt, cf as isElectron, c0 as electronAPI, bR as useDialogService, cg as t, ch as DraggableList, bt as useToastStore, ah as LGraphNode, ci as applyTextReplacements, cj as ComfyWidgets, ck as addValueControlWidgets, a6 as useNodeDefStore, cl as serialise, cm as deserialiseAndCreate, b8 as api, a as useSettingStore, ag as LGraphGroup, ad as nextTick } from "./index-C4Fk50Nx.js"; +import { ca as ComfyDialog, cb as $el, cc as ComfyApp, h as app, a3 as LiteGraph, bd as LGraphCanvas, cd as useExtensionService, ce as processDynamicPrompt, cf as isElectron, c0 as electronAPI, bR as useDialogService, cg as t, ch as DraggableList, bt as useToastStore, ah as LGraphNode, ci as applyTextReplacements, cj as ComfyWidgets, ck as addValueControlWidgets, a6 as useNodeDefStore, cl as serialise, cm as deserialiseAndCreate, b8 as api, a as useSettingStore, ag as LGraphGroup, ad as nextTick } from "./index-DjNHn37O.js"; class ClipspaceDialog extends ComfyDialog { static { __name(this, "ClipspaceDialog"); @@ -53211,4 +53211,4 @@ app.registerExtension({ }); } }); -//# sourceMappingURL=index-5Sv744Dr.js.map +//# sourceMappingURL=index-Bordpmzt.js.map diff --git a/web/assets/index-C4Fk50Nx.js b/web/assets/index-DjNHn37O.js similarity index 99% rename from web/assets/index-C4Fk50Nx.js rename to web/assets/index-DjNHn37O.js index 0da0e4c9..fff8484b 100644 --- a/web/assets/index-C4Fk50Nx.js +++ b/web/assets/index-DjNHn37O.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./GraphView-DswvqURL.js","./index-hdfnBvYs.js","./index-B7ycxfFq.js","./index-lMQBwSDj.js","./keybindingService-D48fkLBy.js","./serverConfigStore-BawYAb1j.js","./GraphView-CIRWBKTm.css","./UserSelectView-2l9Kbchu.js","./BaseViewTemplate-CsEJhGbv.js","./ServerStartView-CiO_acWT.js","./ServerStartView-CnyN4Ib6.css","./InstallView-AV2llYNm.js","./InstallView-CwQdoH-C.css","./WelcomeView-CB7Th_kO.js","./WelcomeView-Brz3-luE.css","./NotSupportedView-CRaD8u74.js","./NotSupportedView-bFzHmqNj.css","./DownloadGitView-DP1MIWYX.js","./ManualConfigurationView-BA4Vtud8.js","./ManualConfigurationView-B6ecEClB.css","./KeybindingPanel-CxaJ1IiJ.js","./index-CK0rrCYF.js","./KeybindingPanel-DvrUYZ4S.css","./ExtensionPanel-CxijYN47.js","./ServerConfigPanel-TLv4HMGK.js","./index-5Sv744Dr.js","./index-BRhY6FpL.css"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./GraphView-HVeNbkaW.js","./index-jXPKy3pP.js","./index-5HFeZax4.js","./index-B-aVupP5.js","./keybindingService-Bx7YdkXn.js","./serverConfigStore-CvyKFVuP.js","./GraphView-CIRWBKTm.css","./UserSelectView-B3jYchWu.js","./BaseViewTemplate-BNGF4K22.js","./ServerStartView-CIDTUh4x.js","./ServerStartView-CnyN4Ib6.css","./InstallView-CAcYt0HL.js","./InstallView-CwQdoH-C.css","./WelcomeView-N0ZXLjdi.js","./WelcomeView-Brz3-luE.css","./NotSupportedView-Drz3x2d-.js","./NotSupportedView-bFzHmqNj.css","./DownloadGitView-DeC7MBzG.js","./ManualConfigurationView-Bi_qHE-n.js","./ManualConfigurationView-B6ecEClB.css","./KeybindingPanel-Dc3C4lG1.js","./index-B5F0uxTQ.js","./KeybindingPanel-DvrUYZ4S.css","./ExtensionPanel-D4Phn0Zr.js","./ServerConfigPanel-Be4StJmv.js","./index-Bordpmzt.js","./index-BRhY6FpL.css"])))=>i.map(i=>d[i]); var __defProp2 = Object.defineProperty; var __name = (target, value4) => __defProp2(target, "name", { value: value4, configurable: true }); (/* @__PURE__ */ __name(function polyfill() { @@ -38279,7 +38279,7 @@ class LGraphCanvas { } else if (e2.type == "keyup") { if (e2.keyCode == 32) { this.read_only = false; - this.dragging_canvas = this._previously_dragging_canvas ?? false; + this.dragging_canvas = (this._previously_dragging_canvas ?? false) && this.pointer.isDown; this._previously_dragging_canvas = null; } if (this.selected_nodes) { @@ -46123,7 +46123,7 @@ const router = createRouter({ { path: "", name: "GraphView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./GraphView-DswvqURL.js"), true ? __vite__mapDeps([0,1,2,3,4,5,6]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./GraphView-HVeNbkaW.js"), true ? __vite__mapDeps([0,1,2,3,4,5,6]) : void 0, import.meta.url), "component"), beforeEnter: /* @__PURE__ */ __name(async (to, from2, next2) => { const userStore = useUserStore(); await userStore.initialize(); @@ -46137,42 +46137,42 @@ const router = createRouter({ { path: "user-select", name: "UserSelectView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./UserSelectView-2l9Kbchu.js"), true ? __vite__mapDeps([7,8]) : void 0, import.meta.url), "component") + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./UserSelectView-B3jYchWu.js"), true ? __vite__mapDeps([7,8]) : void 0, import.meta.url), "component") }, { path: "server-start", name: "ServerStartView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./ServerStartView-CiO_acWT.js"), true ? __vite__mapDeps([9,8,10]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./ServerStartView-CIDTUh4x.js"), true ? __vite__mapDeps([9,8,10]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "install", name: "InstallView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./InstallView-AV2llYNm.js"), true ? __vite__mapDeps([11,8,12]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./InstallView-CAcYt0HL.js"), true ? __vite__mapDeps([11,8,12]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "welcome", name: "WelcomeView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./WelcomeView-CB7Th_kO.js"), true ? __vite__mapDeps([13,8,14]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./WelcomeView-N0ZXLjdi.js"), true ? __vite__mapDeps([13,8,14]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "not-supported", name: "NotSupportedView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./NotSupportedView-CRaD8u74.js"), true ? __vite__mapDeps([15,8,16]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./NotSupportedView-Drz3x2d-.js"), true ? __vite__mapDeps([15,8,16]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "download-git", name: "DownloadGitView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./DownloadGitView-DP1MIWYX.js"), true ? __vite__mapDeps([17,8]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./DownloadGitView-DeC7MBzG.js"), true ? __vite__mapDeps([17,8]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "manual-configuration", name: "ManualConfigurationView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./ManualConfigurationView-BA4Vtud8.js"), true ? __vite__mapDeps([18,1,2,8,19]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./ManualConfigurationView-Bi_qHE-n.js"), true ? __vite__mapDeps([18,1,2,8,19]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess } ] @@ -58027,7 +58027,7 @@ const _sfc_main$Z = /* @__PURE__ */ defineComponent({ }); const config$1 = { app_title: "ComfyUI", - app_version: "1.6.17" + app_version: "1.6.18" }; /*! * shared v9.13.1 @@ -116940,7 +116940,11 @@ const useSettingStore = /* @__PURE__ */ defineStore("setting", () => { } __name(exists, "exists"); async function set3(key, value4) { - const newValue2 = tryMigrateDeprecatedValue(settingsById.value[key], value4); + const clonedValue = _.cloneDeep(value4); + const newValue2 = tryMigrateDeprecatedValue( + settingsById.value[key], + clonedValue + ); const oldValue2 = get3(key); if (newValue2 === oldValue2) return; onChange(settingsById.value[key], newValue2, oldValue2); @@ -116949,7 +116953,7 @@ const useSettingStore = /* @__PURE__ */ defineStore("setting", () => { } __name(set3, "set"); function get3(key) { - return settingValues.value[key] ?? getDefaultValue(key); + return _.cloneDeep(settingValues.value[key] ?? getDefaultValue(key)); } __name(get3, "get"); function getDefaultValue(key) { @@ -117954,7 +117958,7 @@ const useSystemStatsStore = /* @__PURE__ */ defineStore("systemStats", () => { }; }); const useAboutPanelStore = /* @__PURE__ */ defineStore("aboutPanel", () => { - const frontendVersion = "1.6.17"; + const frontendVersion = "1.6.18"; const extensionStore = useExtensionStore(); const systemStatsStore = useSystemStatsStore(); const coreVersion = computed( @@ -123467,13 +123471,13 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({ setup(__props) { const props = __props; const KeybindingPanel = /* @__PURE__ */ defineAsyncComponent( - () => __vitePreload(() => import("./KeybindingPanel-CxaJ1IiJ.js"), true ? __vite__mapDeps([20,21,3,2,4,22]) : void 0, import.meta.url) + () => __vitePreload(() => import("./KeybindingPanel-Dc3C4lG1.js"), true ? __vite__mapDeps([20,21,3,2,4,22]) : void 0, import.meta.url) ); const ExtensionPanel = /* @__PURE__ */ defineAsyncComponent( - () => __vitePreload(() => import("./ExtensionPanel-CxijYN47.js"), true ? __vite__mapDeps([23,21,3,2]) : void 0, import.meta.url) + () => __vitePreload(() => import("./ExtensionPanel-D4Phn0Zr.js"), true ? __vite__mapDeps([23,21,3,2]) : void 0, import.meta.url) ); const ServerConfigPanel = /* @__PURE__ */ defineAsyncComponent( - () => __vitePreload(() => import("./ServerConfigPanel-TLv4HMGK.js"), true ? __vite__mapDeps([24,5]) : void 0, import.meta.url) + () => __vitePreload(() => import("./ServerConfigPanel-Be4StJmv.js"), true ? __vite__mapDeps([24,5]) : void 0, import.meta.url) ); const aboutPanelNode = { key: "about", @@ -124637,7 +124641,7 @@ const useWorkflowTemplatesStore = /* @__PURE__ */ defineStore( }; } ); -const _withScopeId$e = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-2d616ed7"), n = n(), popScopeId(), n), "_withScopeId$e"); +const _withScopeId$e = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-fc26284b"), n = n(), popScopeId(), n), "_withScopeId$e"); const _hoisted_1$w = { class: "flex h-96", "data-testid": "template-workflows-content" @@ -124694,7 +124698,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({ workflowLoading.value = id3; let json; if (selectedTab.value.moduleName === "default") { - json = await fetch(api.fileURL(`templates/${id3}.json`)).then( + json = await fetch(api.fileURL(`/templates/${id3}.json`)).then( (r) => r.json() ); } else { @@ -124751,7 +124755,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({ }; } }); -const TemplateWorkflowsContent = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__scopeId", "data-v-2d616ed7"]]); +const TemplateWorkflowsContent = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__scopeId", "data-v-fc26284b"]]); const useDialogService = /* @__PURE__ */ __name(() => { const dialogStore = useDialogStore(); function showLoadWorkflowWarning(props) { @@ -124946,6 +124950,14 @@ const useKeybindingStore = /* @__PURE__ */ defineStore("keybinding", () => { const defaultKeybindings = ref({}); const userKeybindings = ref({}); const userUnsetKeybindings = ref({}); + function getUserKeybindings() { + return userKeybindings.value; + } + __name(getUserKeybindings, "getUserKeybindings"); + function getUserUnsetKeybindings() { + return userUnsetKeybindings.value; + } + __name(getUserUnsetKeybindings, "getUserUnsetKeybindings"); const keybindingByKeyCombo = computed(() => { const result = { ...defaultKeybindings.value @@ -125065,8 +125077,8 @@ const useKeybindingStore = /* @__PURE__ */ defineStore("keybinding", () => { __name(isCommandKeybindingModified, "isCommandKeybindingModified"); return { keybindings, - userKeybindings, - userUnsetKeybindings, + getUserKeybindings, + getUserUnsetKeybindings, getKeybinding, getKeybindingsByCommandId, getKeybindingByCommandId, @@ -164042,7 +164054,7 @@ const useExtensionService = /* @__PURE__ */ __name(() => { settingStore.get("Comfy.Extension.Disabled") ); const extensions = await api.getExtensions(); - await __vitePreload(() => import("./index-5Sv744Dr.js"), true ? __vite__mapDeps([25,26]) : void 0, import.meta.url); + await __vitePreload(() => import("./index-Bordpmzt.js"), true ? __vite__mapDeps([25,26]) : void 0, import.meta.url); extensionStore.captureCoreExtensions(); await Promise.all( extensions.filter((extension) => !extension.includes("extensions/core")).map(async (ext) => { @@ -184710,4 +184722,4 @@ export { getOuterWidth as y, getOuterHeight as z }; -//# sourceMappingURL=index-C4Fk50Nx.js.map +//# sourceMappingURL=index-DjNHn37O.js.map diff --git a/web/assets/index-hdfnBvYs.js b/web/assets/index-jXPKy3pP.js similarity index 97% rename from web/assets/index-hdfnBvYs.js rename to web/assets/index-jXPKy3pP.js index 6208586b..1efdf332 100644 --- a/web/assets/index-hdfnBvYs.js +++ b/web/assets/index-jXPKy3pP.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { B as BaseStyle, q as script$2, ak as UniqueComponentId, c9 as script$4, l as script$5, S as Ripple, aB as resolveComponent, o as openBlock, f as createElementBlock, D as mergeProps, H as createBaseVNode, J as renderSlot, T as normalizeClass, X as toDisplayString, I as createCommentVNode, k as createBlock, M as withCtx, G as resolveDynamicComponent, N as createVNode, aC as Transition, i as withDirectives, v as vShow } from "./index-C4Fk50Nx.js"; -import { s as script$3 } from "./index-B7ycxfFq.js"; +import { B as BaseStyle, q as script$2, ak as UniqueComponentId, c9 as script$4, l as script$5, S as Ripple, aB as resolveComponent, o as openBlock, f as createElementBlock, D as mergeProps, H as createBaseVNode, J as renderSlot, T as normalizeClass, X as toDisplayString, I as createCommentVNode, k as createBlock, M as withCtx, G as resolveDynamicComponent, N as createVNode, aC as Transition, i as withDirectives, v as vShow } from "./index-DjNHn37O.js"; +import { s as script$3 } from "./index-5HFeZax4.js"; var theme = /* @__PURE__ */ __name(function theme2(_ref) { var dt = _ref.dt; return "\n.p-panel {\n border: 1px solid ".concat(dt("panel.border.color"), ";\n border-radius: ").concat(dt("panel.border.radius"), ";\n background: ").concat(dt("panel.background"), ";\n color: ").concat(dt("panel.color"), ";\n}\n\n.p-panel-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: ").concat(dt("panel.header.padding"), ";\n background: ").concat(dt("panel.header.background"), ";\n color: ").concat(dt("panel.header.color"), ";\n border-style: solid;\n border-width: ").concat(dt("panel.header.border.width"), ";\n border-color: ").concat(dt("panel.header.border.color"), ";\n border-radius: ").concat(dt("panel.header.border.radius"), ";\n}\n\n.p-panel-toggleable .p-panel-header {\n padding: ").concat(dt("panel.toggleable.header.padding"), ";\n}\n\n.p-panel-title {\n line-height: 1;\n font-weight: ").concat(dt("panel.title.font.weight"), ";\n}\n\n.p-panel-content {\n padding: ").concat(dt("panel.content.padding"), ";\n}\n\n.p-panel-footer {\n padding: ").concat(dt("panel.footer.padding"), ";\n}\n"); @@ -170,4 +170,4 @@ script.render = render; export { script as s }; -//# sourceMappingURL=index-hdfnBvYs.js.map +//# sourceMappingURL=index-jXPKy3pP.js.map diff --git a/web/assets/index-DmMtlpqz.css b/web/assets/index-t-sFBuUC.css similarity index 99% rename from web/assets/index-DmMtlpqz.css rename to web/assets/index-t-sFBuUC.css index dbcdad37..f588a35c 100644 --- a/web/assets/index-DmMtlpqz.css +++ b/web/assets/index-t-sFBuUC.css @@ -3886,7 +3886,7 @@ audio.comfy-audio.empty-audio-widget { text-align: center; } -.carousel[data-v-2d616ed7] { +.carousel[data-v-fc26284b] { width: 66vw; } /** diff --git a/web/assets/keybindingService-D48fkLBy.js b/web/assets/keybindingService-Bx7YdkXn.js similarity index 96% rename from web/assets/keybindingService-D48fkLBy.js rename to web/assets/keybindingService-Bx7YdkXn.js index 7ceae65c..37b5d01c 100644 --- a/web/assets/keybindingService-D48fkLBy.js +++ b/web/assets/keybindingService-Bx7YdkXn.js @@ -1,6 +1,6 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { a$ as useKeybindingStore, a2 as useCommandStore, a as useSettingStore, cq as KeyComboImpl, cr as KeybindingImpl } from "./index-C4Fk50Nx.js"; +import { a$ as useKeybindingStore, a2 as useCommandStore, a as useSettingStore, cq as KeyComboImpl, cr as KeybindingImpl } from "./index-DjNHn37O.js"; const CORE_KEYBINDINGS = [ { combo: { @@ -229,11 +229,11 @@ const useKeybindingService = /* @__PURE__ */ __name(() => { async function persistUserKeybindings() { await settingStore.set( "Comfy.Keybinding.NewBindings", - Object.values(keybindingStore.userKeybindings.value) + Object.values(keybindingStore.getUserKeybindings()) ); await settingStore.set( "Comfy.Keybinding.UnsetBindings", - Object.values(keybindingStore.userUnsetKeybindings.value) + Object.values(keybindingStore.getUserUnsetKeybindings()) ); } __name(persistUserKeybindings, "persistUserKeybindings"); @@ -247,4 +247,4 @@ const useKeybindingService = /* @__PURE__ */ __name(() => { export { useKeybindingService as u }; -//# sourceMappingURL=keybindingService-D48fkLBy.js.map +//# sourceMappingURL=keybindingService-Bx7YdkXn.js.map diff --git a/web/assets/serverConfigStore-BawYAb1j.js b/web/assets/serverConfigStore-CvyKFVuP.js similarity index 97% rename from web/assets/serverConfigStore-BawYAb1j.js rename to web/assets/serverConfigStore-CvyKFVuP.js index 90b3fe9a..65cc6b7f 100644 --- a/web/assets/serverConfigStore-BawYAb1j.js +++ b/web/assets/serverConfigStore-CvyKFVuP.js @@ -1,6 +1,6 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { $ as defineStore, ab as ref, c as computed } from "./index-C4Fk50Nx.js"; +import { $ as defineStore, ab as ref, c as computed } from "./index-DjNHn37O.js"; const useServerConfigStore = defineStore("serverConfig", () => { const serverConfigById = ref({}); const serverConfigs = computed(() => { @@ -87,4 +87,4 @@ const useServerConfigStore = defineStore("serverConfig", () => { export { useServerConfigStore as u }; -//# sourceMappingURL=serverConfigStore-BawYAb1j.js.map +//# sourceMappingURL=serverConfigStore-CvyKFVuP.js.map diff --git a/web/index.html b/web/index.html index ecf50f28..a79b584c 100644 --- a/web/index.html +++ b/web/index.html @@ -6,8 +6,8 @@ <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> <link rel="stylesheet" type="text/css" href="user.css" /> <link rel="stylesheet" type="text/css" href="materialdesignicons.min.css" /> - <script type="module" crossorigin src="./assets/index-C4Fk50Nx.js"></script> - <link rel="stylesheet" crossorigin href="./assets/index-DmMtlpqz.css"> + <script type="module" crossorigin src="./assets/index-DjNHn37O.js"></script> + <link rel="stylesheet" crossorigin href="./assets/index-t-sFBuUC.css"> </head> <body class="litegraph grid"> <div id="vue-app"></div> From d055325783ef30956d5af8a2b0add775c37caa6d Mon Sep 17 00:00:00 2001 From: Chenlei Hu <chenlei.hu@mail.utoronto.ca> Date: Mon, 6 Jan 2025 20:12:22 -0500 Subject: [PATCH 02/47] Document get_attr and get_model_object (#6357) * Document get_attr and get_model_object * Update model_patcher.py * Update model_patcher.py * Update model_patcher.py --- comfy/model_patcher.py | 15 ++++++++++++++- comfy/utils.py | 20 +++++++++++++++++++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/comfy/model_patcher.py b/comfy/model_patcher.py index 4597ce11..e886bdbb 100644 --- a/comfy/model_patcher.py +++ b/comfy/model_patcher.py @@ -402,7 +402,20 @@ class ModelPatcher: def add_object_patch(self, name, obj): self.object_patches[name] = obj - def get_model_object(self, name): + def get_model_object(self, name: str) -> torch.nn.Module: + """Retrieves a nested attribute from an object using dot notation considering + object patches. + + Args: + name (str): The attribute path using dot notation (e.g. "model.layer.weight") + + Returns: + The value of the requested attribute + + Example: + patcher = ModelPatcher() + weight = patcher.get_model_object("layer1.conv.weight") + """ if name in self.object_patches: return self.object_patches[name] else: diff --git a/comfy/utils.py b/comfy/utils.py index ea666ae5..b486b2de 100644 --- a/comfy/utils.py +++ b/comfy/utils.py @@ -693,7 +693,25 @@ def copy_to_param(obj, attr, value): prev = getattr(obj, attrs[-1]) prev.data.copy_(value) -def get_attr(obj, attr): +def get_attr(obj, attr: str): + """Retrieves a nested attribute from an object using dot notation. + + Args: + obj: The object to get the attribute from + attr (str): The attribute path using dot notation (e.g. "model.layer.weight") + + Returns: + The value of the requested attribute + + Example: + model = MyModel() + weight = get_attr(model, "layer1.conv.weight") + # Equivalent to: model.layer1.conv.weight + + Important: + Always prefer `comfy.model_patcher.ModelPatcher.get_model_object` when + accessing nested model objects under `ModelPatcher.model`. + """ attrs = attr.split(".") for name in attrs: obj = getattr(obj, name) From 4209edf48dcb72ff73580b7fb19b72b9b8ebba01 Mon Sep 17 00:00:00 2001 From: comfyanonymous <comfyanonymous@protonmail.com> Date: Tue, 7 Jan 2025 02:12:12 -0500 Subject: [PATCH 03/47] Make a few more samplers deterministic. --- comfy/k_diffusion/sampling.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/comfy/k_diffusion/sampling.py b/comfy/k_diffusion/sampling.py index d37d7dd9..413ad5aa 100644 --- a/comfy/k_diffusion/sampling.py +++ b/comfy/k_diffusion/sampling.py @@ -475,7 +475,7 @@ class DPMSolver(nn.Module): return x_3, eps_cache def dpm_solver_fast(self, x, t_start, t_end, nfe, eta=0., s_noise=1., noise_sampler=None): - noise_sampler = default_noise_sampler(x) if noise_sampler is None else noise_sampler + noise_sampler = default_noise_sampler(x, seed=self.extra_args.get("seed", None)) if noise_sampler is None else noise_sampler if not t_end > t_start and eta: raise ValueError('eta must be 0 for reverse sampling') @@ -514,7 +514,7 @@ class DPMSolver(nn.Module): return x def dpm_solver_adaptive(self, x, t_start, t_end, order=3, rtol=0.05, atol=0.0078, h_init=0.05, pcoeff=0., icoeff=1., dcoeff=0., accept_safety=0.81, eta=0., s_noise=1., noise_sampler=None): - noise_sampler = default_noise_sampler(x) if noise_sampler is None else noise_sampler + noise_sampler = default_noise_sampler(x, seed=self.extra_args.get("seed", None)) if noise_sampler is None else noise_sampler if order not in {2, 3}: raise ValueError('order should be 2 or 3') forward = t_end > t_start @@ -894,7 +894,8 @@ def DDPMSampler_step(x, sigma, sigma_prev, noise, noise_sampler): def generic_step_sampler(model, x, sigmas, extra_args=None, callback=None, disable=None, noise_sampler=None, step_function=None): extra_args = {} if extra_args is None else extra_args - noise_sampler = default_noise_sampler(x) if noise_sampler is None else noise_sampler + seed = extra_args.get("seed", None) + noise_sampler = default_noise_sampler(x, seed=seed) if noise_sampler is None else noise_sampler s_in = x.new_ones([x.shape[0]]) for i in trange(len(sigmas) - 1, disable=disable): @@ -914,7 +915,8 @@ def sample_ddpm(model, x, sigmas, extra_args=None, callback=None, disable=None, @torch.no_grad() def sample_lcm(model, x, sigmas, extra_args=None, callback=None, disable=None, noise_sampler=None): extra_args = {} if extra_args is None else extra_args - noise_sampler = default_noise_sampler(x) if noise_sampler is None else noise_sampler + seed = extra_args.get("seed", None) + noise_sampler = default_noise_sampler(x, seed=seed) if noise_sampler is None else noise_sampler s_in = x.new_ones([x.shape[0]]) for i in trange(len(sigmas) - 1, disable=disable): denoised = model(x, sigmas[i] * s_in, **extra_args) From c515bdf3710e77233e5b4baa24e038de8e86f56e Mon Sep 17 00:00:00 2001 From: "Dr.Lt.Data" <128333288+ltdrdata@users.noreply.github.com> Date: Wed, 8 Jan 2025 06:03:56 +0900 Subject: [PATCH 04/47] fixed: robust loading `comfy.settings.json` (#6383) https://github.com/comfyanonymous/ComfyUI/issues/6371 --- app/app_settings.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/app_settings.py b/app/app_settings.py index efe87adb..a545df92 100644 --- a/app/app_settings.py +++ b/app/app_settings.py @@ -1,6 +1,7 @@ import os import json from aiohttp import web +import logging class AppSettings(): @@ -11,8 +12,12 @@ class AppSettings(): file = self.user_manager.get_request_user_filepath( request, "comfy.settings.json") if os.path.isfile(file): - with open(file) as f: - return json.load(f) + try: + with open(file) as f: + return json.load(f) + except: + logging.error(f"The user settings file is corrupted: {file}") + return {} else: return {} From d0f3752e332ad9b2d8ee6f9c4317868aa685a62e Mon Sep 17 00:00:00 2001 From: comfyanonymous <comfyanonymous@protonmail.com> Date: Tue, 7 Jan 2025 17:32:29 -0500 Subject: [PATCH 05/47] Properly calculate inner dim for t5 model. This is required to support some different types of t5 models. --- comfy/text_encoders/t5.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/comfy/text_encoders/t5.py b/comfy/text_encoders/t5.py index 38d8d523..7405528e 100644 --- a/comfy/text_encoders/t5.py +++ b/comfy/text_encoders/t5.py @@ -227,8 +227,9 @@ class T5(torch.nn.Module): super().__init__() self.num_layers = config_dict["num_layers"] model_dim = config_dict["d_model"] + inner_dim = config_dict["d_kv"] * config_dict["num_heads"] - self.encoder = T5Stack(self.num_layers, model_dim, model_dim, config_dict["d_ff"], config_dict["dense_act_fn"], config_dict["is_gated_act"], config_dict["num_heads"], config_dict["model_type"] != "umt5", dtype, device, operations) + self.encoder = T5Stack(self.num_layers, model_dim, inner_dim, config_dict["d_ff"], config_dict["dense_act_fn"], config_dict["is_gated_act"], config_dict["num_heads"], config_dict["model_type"] != "umt5", dtype, device, operations) self.dtype = dtype self.shared = operations.Embedding(config_dict["vocab_size"], model_dim, device=device, dtype=dtype) From 2307ff6746177cd84c5cf84dc0a97e967e9012e3 Mon Sep 17 00:00:00 2001 From: comfyanonymous <comfyanonymous@protonmail.com> Date: Wed, 8 Jan 2025 19:05:22 -0500 Subject: [PATCH 06/47] Improve some logging messages. --- comfy/sd.py | 4 ++-- ruff.toml | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/comfy/sd.py b/comfy/sd.py index c6d6236b..f3c65f9e 100644 --- a/comfy/sd.py +++ b/comfy/sd.py @@ -111,7 +111,7 @@ class CLIP: model_management.load_models_gpu([self.patcher], force_full_load=True) self.layer_idx = None self.use_clip_schedule = False - logging.info("CLIP model load device: {}, offload device: {}, current: {}, dtype: {}".format(load_device, offload_device, params['device'], dtype)) + logging.info("CLIP/text encoder model load device: {}, offload device: {}, current: {}, dtype: {}".format(load_device, offload_device, params['device'], dtype)) def clone(self): n = CLIP(no_init=True) @@ -898,7 +898,7 @@ def load_state_dict_guess_config(sd, output_vae=True, output_clip=True, output_c if output_model: model_patcher = comfy.model_patcher.ModelPatcher(model, load_device=load_device, offload_device=model_management.unet_offload_device()) if inital_load_device != torch.device("cpu"): - logging.info("loaded straight to GPU") + logging.info("loaded diffusion model directly to GPU") model_management.load_models_gpu([model_patcher], force_full_load=True) return (model_patcher, clip, vae, clipvision) diff --git a/ruff.toml b/ruff.toml index 660831f2..808a2ad0 100644 --- a/ruff.toml +++ b/ruff.toml @@ -4,7 +4,8 @@ lint.ignore = ["ALL"] # Enable specific rules lint.select = [ "S307", # suspicious-eval-usage - "T201", # print-usage + "S102", # exec + "T", # print-usage "W", # The "F" series in Ruff stands for "Pyflakes" rules, which catch various Python syntax errors and undefined names. # See all rules here: https://docs.astral.sh/ruff/rules/#pyflakes-f From ff838657fac787a0e7aef6bbbf92ea4411bdbd15 Mon Sep 17 00:00:00 2001 From: comfyanonymous <comfyanonymous@protonmail.com> Date: Thu, 9 Jan 2025 07:12:03 -0500 Subject: [PATCH 07/47] Cleaner handling of attention mask in ltxv model code. --- comfy/ldm/lightricks/model.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/comfy/ldm/lightricks/model.py b/comfy/ldm/lightricks/model.py index eeeeaea0..2a02acd6 100644 --- a/comfy/ldm/lightricks/model.py +++ b/comfy/ldm/lightricks/model.py @@ -456,9 +456,8 @@ class LTXVModel(torch.nn.Module): x = self.patchify_proj(x) timestep = timestep * 1000.0 - attention_mask = 1.0 - attention_mask.to(x.dtype).reshape((attention_mask.shape[0], 1, -1, attention_mask.shape[-1])) - attention_mask = attention_mask.masked_fill(attention_mask.to(torch.bool), float("-inf")) # not sure about this - # attention_mask = (context != 0).any(dim=2).to(dtype=x.dtype) + if attention_mask is not None and not torch.is_floating_point(attention_mask): + attention_mask = (attention_mask - 1).to(x.dtype).reshape((attention_mask.shape[0], 1, -1, attention_mask.shape[-1])) * torch.finfo(x.dtype).max pe = precompute_freqs_cis(indices_grid, dim=self.inner_dim, out_dtype=x.dtype) From 129d8908f7e21c09c9f47954ab6d0539473fa982 Mon Sep 17 00:00:00 2001 From: comfyanonymous <comfyanonymous@protonmail.com> Date: Fri, 10 Jan 2025 06:27:37 -0500 Subject: [PATCH 08/47] Add argument to skip the output reshaping in the attention functions. --- comfy/ldm/modules/attention.py | 83 ++++++++++++++++++++++------------ 1 file changed, 53 insertions(+), 30 deletions(-) diff --git a/comfy/ldm/modules/attention.py b/comfy/ldm/modules/attention.py index 0d54e6be..44aec59a 100644 --- a/comfy/ldm/modules/attention.py +++ b/comfy/ldm/modules/attention.py @@ -89,7 +89,7 @@ class FeedForward(nn.Module): def Normalize(in_channels, dtype=None, device=None): return torch.nn.GroupNorm(num_groups=32, num_channels=in_channels, eps=1e-6, affine=True, dtype=dtype, device=device) -def attention_basic(q, k, v, heads, mask=None, attn_precision=None, skip_reshape=False): +def attention_basic(q, k, v, heads, mask=None, attn_precision=None, skip_reshape=False, skip_output_reshape=False): attn_precision = get_attn_precision(attn_precision) if skip_reshape: @@ -142,16 +142,23 @@ def attention_basic(q, k, v, heads, mask=None, attn_precision=None, skip_reshape sim = sim.softmax(dim=-1) out = einsum('b i j, b j d -> b i d', sim.to(v.dtype), v) - out = ( - out.unsqueeze(0) - .reshape(b, heads, -1, dim_head) - .permute(0, 2, 1, 3) - .reshape(b, -1, heads * dim_head) - ) + + if skip_output_reshape: + out = ( + out.unsqueeze(0) + .reshape(b, heads, -1, dim_head) + ) + else: + out = ( + out.unsqueeze(0) + .reshape(b, heads, -1, dim_head) + .permute(0, 2, 1, 3) + .reshape(b, -1, heads * dim_head) + ) return out -def attention_sub_quad(query, key, value, heads, mask=None, attn_precision=None, skip_reshape=False): +def attention_sub_quad(query, key, value, heads, mask=None, attn_precision=None, skip_reshape=False, skip_output_reshape=False): attn_precision = get_attn_precision(attn_precision) if skip_reshape: @@ -215,11 +222,13 @@ def attention_sub_quad(query, key, value, heads, mask=None, attn_precision=None, ) hidden_states = hidden_states.to(dtype) - - hidden_states = hidden_states.unflatten(0, (-1, heads)).transpose(1,2).flatten(start_dim=2) + if skip_output_reshape: + hidden_states = hidden_states.unflatten(0, (-1, heads)) + else: + hidden_states = hidden_states.unflatten(0, (-1, heads)).transpose(1,2).flatten(start_dim=2) return hidden_states -def attention_split(q, k, v, heads, mask=None, attn_precision=None, skip_reshape=False): +def attention_split(q, k, v, heads, mask=None, attn_precision=None, skip_reshape=False, skip_output_reshape=False): attn_precision = get_attn_precision(attn_precision) if skip_reshape: @@ -326,12 +335,18 @@ def attention_split(q, k, v, heads, mask=None, attn_precision=None, skip_reshape del q, k, v - r1 = ( - r1.unsqueeze(0) - .reshape(b, heads, -1, dim_head) - .permute(0, 2, 1, 3) - .reshape(b, -1, heads * dim_head) - ) + if skip_output_reshape: + r1 = ( + r1.unsqueeze(0) + .reshape(b, heads, -1, dim_head) + ) + else: + r1 = ( + r1.unsqueeze(0) + .reshape(b, heads, -1, dim_head) + .permute(0, 2, 1, 3) + .reshape(b, -1, heads * dim_head) + ) return r1 BROKEN_XFORMERS = False @@ -342,7 +357,7 @@ try: except: pass -def attention_xformers(q, k, v, heads, mask=None, attn_precision=None, skip_reshape=False): +def attention_xformers(q, k, v, heads, mask=None, attn_precision=None, skip_reshape=False, skip_output_reshape=False): b = q.shape[0] dim_head = q.shape[-1] # check to make sure xformers isn't broken @@ -395,9 +410,12 @@ def attention_xformers(q, k, v, heads, mask=None, attn_precision=None, skip_resh out = xformers.ops.memory_efficient_attention(q, k, v, attn_bias=mask) - out = ( - out.reshape(b, -1, heads * dim_head) - ) + if skip_output_reshape: + out = out.permute(0, 2, 1, 3) + else: + out = ( + out.reshape(b, -1, heads * dim_head) + ) return out @@ -408,7 +426,7 @@ else: SDP_BATCH_LIMIT = 2**31 -def attention_pytorch(q, k, v, heads, mask=None, attn_precision=None, skip_reshape=False): +def attention_pytorch(q, k, v, heads, mask=None, attn_precision=None, skip_reshape=False, skip_output_reshape=False): if skip_reshape: b, _, _, dim_head = q.shape else: @@ -429,9 +447,10 @@ def attention_pytorch(q, k, v, heads, mask=None, attn_precision=None, skip_resha if SDP_BATCH_LIMIT >= b: out = torch.nn.functional.scaled_dot_product_attention(q, k, v, attn_mask=mask, dropout_p=0.0, is_causal=False) - out = ( - out.transpose(1, 2).reshape(b, -1, heads * dim_head) - ) + if not skip_output_reshape: + out = ( + out.transpose(1, 2).reshape(b, -1, heads * dim_head) + ) else: out = torch.empty((b, q.shape[2], heads * dim_head), dtype=q.dtype, layout=q.layout, device=q.device) for i in range(0, b, SDP_BATCH_LIMIT): @@ -450,7 +469,7 @@ def attention_pytorch(q, k, v, heads, mask=None, attn_precision=None, skip_resha return out -def attention_sage(q, k, v, heads, mask=None, attn_precision=None, skip_reshape=False): +def attention_sage(q, k, v, heads, mask=None, attn_precision=None, skip_reshape=False, skip_output_reshape=False): if skip_reshape: b, _, _, dim_head = q.shape tensor_layout="HND" @@ -473,11 +492,15 @@ def attention_sage(q, k, v, heads, mask=None, attn_precision=None, skip_reshape= out = sageattn(q, k, v, attn_mask=mask, is_causal=False, tensor_layout=tensor_layout) if tensor_layout == "HND": - out = ( - out.transpose(1, 2).reshape(b, -1, heads * dim_head) - ) + if not skip_output_reshape: + out = ( + out.transpose(1, 2).reshape(b, -1, heads * dim_head) + ) else: - out = out.reshape(b, -1, heads * dim_head) + if skip_output_reshape: + out = out.transpose(1, 2) + else: + out = out.reshape(b, -1, heads * dim_head) return out From 2ff3104f70767a897e5468a0fe632fbd5a432b40 Mon Sep 17 00:00:00 2001 From: comfyanonymous <comfyanonymous@protonmail.com> Date: Fri, 10 Jan 2025 09:11:57 -0500 Subject: [PATCH 09/47] WIP support for Nvidia Cosmos 7B and 14B text to world (video) models. --- comfy/latent_formats.py | 4 + comfy/ldm/cosmos/blocks.py | 804 +++++++++++++ comfy/ldm/cosmos/cosmos_tokenizer/layers3d.py | 1050 +++++++++++++++++ comfy/ldm/cosmos/cosmos_tokenizer/patching.py | 355 ++++++ comfy/ldm/cosmos/cosmos_tokenizer/utils.py | 120 ++ comfy/ldm/cosmos/model.py | 510 ++++++++ comfy/ldm/cosmos/position_embedding.py | 207 ++++ comfy/ldm/cosmos/vae.py | 124 ++ comfy/model_base.py | 17 + comfy/model_detection.py | 45 + comfy/sd.py | 25 +- comfy/supported_models.py | 34 +- comfy/text_encoders/cosmos.py | 42 + comfy/text_encoders/t5_old_config_xxl.json | 22 + comfy_extras/nodes_cosmos.py | 23 + nodes.py | 5 +- 16 files changed, 3383 insertions(+), 4 deletions(-) create mode 100644 comfy/ldm/cosmos/blocks.py create mode 100644 comfy/ldm/cosmos/cosmos_tokenizer/layers3d.py create mode 100644 comfy/ldm/cosmos/cosmos_tokenizer/patching.py create mode 100644 comfy/ldm/cosmos/cosmos_tokenizer/utils.py create mode 100644 comfy/ldm/cosmos/model.py create mode 100644 comfy/ldm/cosmos/position_embedding.py create mode 100644 comfy/ldm/cosmos/vae.py create mode 100644 comfy/text_encoders/cosmos.py create mode 100644 comfy/text_encoders/t5_old_config_xxl.json create mode 100644 comfy_extras/nodes_cosmos.py diff --git a/comfy/latent_formats.py b/comfy/latent_formats.py index a50a70ae..9e6dfc17 100644 --- a/comfy/latent_formats.py +++ b/comfy/latent_formats.py @@ -382,3 +382,7 @@ class HunyuanVideo(LatentFormat): ] latent_rgb_factors_bias = [ 0.0259, -0.0192, -0.0761] + +class Cosmos1CV8x8x8(LatentFormat): + latent_channels = 16 + latent_dimensions = 3 diff --git a/comfy/ldm/cosmos/blocks.py b/comfy/ldm/cosmos/blocks.py new file mode 100644 index 00000000..3e9c6497 --- /dev/null +++ b/comfy/ldm/cosmos/blocks.py @@ -0,0 +1,804 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import math +from typing import Optional +import logging + +import numpy as np +import torch +from einops import rearrange, repeat +from einops.layers.torch import Rearrange +from torch import nn + +from comfy.ldm.modules.diffusionmodules.mmdit import RMSNorm +from comfy.ldm.modules.attention import optimized_attention + + +def apply_rotary_pos_emb( + t: torch.Tensor, + freqs: torch.Tensor, +) -> torch.Tensor: + t_ = t.reshape(*t.shape[:-1], 2, -1).movedim(-2, -1).unsqueeze(-2).float() + t_out = freqs[..., 0] * t_[..., 0] + freqs[..., 1] * t_[..., 1] + t_out = t_out.movedim(-1, -2).reshape(*t.shape).type_as(t) + return t_out + + +def get_normalization(name: str, channels: int, weight_args={}): + if name == "I": + return nn.Identity() + elif name == "R": + return RMSNorm(channels, elementwise_affine=True, eps=1e-6, **weight_args) + else: + raise ValueError(f"Normalization {name} not found") + + +class BaseAttentionOp(nn.Module): + def __init__(self): + super().__init__() + + +class Attention(nn.Module): + """ + Generalized attention impl. + + Allowing for both self-attention and cross-attention configurations depending on whether a `context_dim` is provided. + If `context_dim` is None, self-attention is assumed. + + Parameters: + query_dim (int): Dimension of each query vector. + context_dim (int, optional): Dimension of each context vector. If None, self-attention is assumed. + heads (int, optional): Number of attention heads. Defaults to 8. + dim_head (int, optional): Dimension of each head. Defaults to 64. + dropout (float, optional): Dropout rate applied to the output of the attention block. Defaults to 0.0. + attn_op (BaseAttentionOp, optional): Custom attention operation to be used instead of the default. + qkv_bias (bool, optional): If True, adds a learnable bias to query, key, and value projections. Defaults to False. + out_bias (bool, optional): If True, adds a learnable bias to the output projection. Defaults to False. + qkv_norm (str, optional): A string representing normalization strategies for query, key, and value projections. + Defaults to "SSI". + qkv_norm_mode (str, optional): A string representing normalization mode for query, key, and value projections. + Defaults to 'per_head'. Only support 'per_head'. + + Examples: + >>> attn = Attention(query_dim=128, context_dim=256, heads=4, dim_head=32, dropout=0.1) + >>> query = torch.randn(10, 128) # Batch size of 10 + >>> context = torch.randn(10, 256) # Batch size of 10 + >>> output = attn(query, context) # Perform the attention operation + + Note: + https://github.com/MatthieuTPHR/diffusers/blob/d80b531ff8060ec1ea982b65a1b8df70f73aa67c/src/diffusers/models/attention.py#L223 + """ + + def __init__( + self, + query_dim: int, + context_dim=None, + heads=8, + dim_head=64, + dropout=0.0, + attn_op: Optional[BaseAttentionOp] = None, + qkv_bias: bool = False, + out_bias: bool = False, + qkv_norm: str = "SSI", + qkv_norm_mode: str = "per_head", + backend: str = "transformer_engine", + qkv_format: str = "bshd", + weight_args={}, + operations=None, + ) -> None: + super().__init__() + + self.is_selfattn = context_dim is None # self attention + + inner_dim = dim_head * heads + context_dim = query_dim if context_dim is None else context_dim + + self.heads = heads + self.dim_head = dim_head + self.qkv_norm_mode = qkv_norm_mode + self.qkv_format = qkv_format + + if self.qkv_norm_mode == "per_head": + norm_dim = dim_head + else: + raise ValueError(f"Normalization mode {self.qkv_norm_mode} not found, only support 'per_head'") + + self.backend = backend + + self.to_q = nn.Sequential( + operations.Linear(query_dim, inner_dim, bias=qkv_bias, **weight_args), + get_normalization(qkv_norm[0], norm_dim), + ) + self.to_k = nn.Sequential( + operations.Linear(context_dim, inner_dim, bias=qkv_bias, **weight_args), + get_normalization(qkv_norm[1], norm_dim), + ) + self.to_v = nn.Sequential( + operations.Linear(context_dim, inner_dim, bias=qkv_bias, **weight_args), + get_normalization(qkv_norm[2], norm_dim), + ) + + self.to_out = nn.Sequential( + operations.Linear(inner_dim, query_dim, bias=out_bias, **weight_args), + nn.Dropout(dropout), + ) + + def cal_qkv( + self, x, context=None, mask=None, rope_emb=None, **kwargs + ) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]: + del kwargs + + + """ + self.to_q, self.to_k, self.to_v are nn.Sequential with projection + normalization layers. + Before 07/24/2024, these modules normalize across all heads. + After 07/24/2024, to support tensor parallelism and follow the common practice in the community, + we support to normalize per head. + To keep the checkpoint copatibility with the previous code, + we keep the nn.Sequential but call the projection and the normalization layers separately. + We use a flag `self.qkv_norm_mode` to control the normalization behavior. + The default value of `self.qkv_norm_mode` is "per_head", which means we normalize per head. + """ + if self.qkv_norm_mode == "per_head": + q = self.to_q[0](x) + context = x if context is None else context + k = self.to_k[0](context) + v = self.to_v[0](context) + q, k, v = map( + lambda t: rearrange(t, "s b (n c) -> b n s c", n=self.heads, c=self.dim_head), + (q, k, v), + ) + else: + raise ValueError(f"Normalization mode {self.qkv_norm_mode} not found, only support 'per_head'") + + q = self.to_q[1](q) + k = self.to_k[1](k) + v = self.to_v[1](v) + if self.is_selfattn and rope_emb is not None: # only apply to self-attention! + q = apply_rotary_pos_emb(q, rope_emb) + k = apply_rotary_pos_emb(k, rope_emb) + return q, k, v + + def cal_attn(self, q, k, v, mask=None): + out = optimized_attention(q, k, v, self.heads, skip_reshape=True, mask=mask, skip_output_reshape=True) + out = rearrange(out, " b n s c -> s b (n c)") + return self.to_out(out) + + def forward( + self, + x, + context=None, + mask=None, + rope_emb=None, + **kwargs, + ): + """ + Args: + x (Tensor): The query tensor of shape [B, Mq, K] + context (Optional[Tensor]): The key tensor of shape [B, Mk, K] or use x as context [self attention] if None + """ + q, k, v = self.cal_qkv(x, context, mask, rope_emb=rope_emb, **kwargs) + return self.cal_attn(q, k, v, mask) + + +class FeedForward(nn.Module): + """ + Transformer FFN with optional gating + + Parameters: + d_model (int): Dimensionality of input features. + d_ff (int): Dimensionality of the hidden layer. + dropout (float, optional): Dropout rate applied after the activation function. Defaults to 0.1. + activation (callable, optional): The activation function applied after the first linear layer. + Defaults to nn.ReLU(). + is_gated (bool, optional): If set to True, incorporates gating mechanism to the feed-forward layer. + Defaults to False. + bias (bool, optional): If set to True, adds a bias to the linear layers. Defaults to True. + + Example: + >>> ff = FeedForward(d_model=512, d_ff=2048) + >>> x = torch.randn(64, 10, 512) # Example input tensor + >>> output = ff(x) + >>> print(output.shape) # Expected shape: (64, 10, 512) + """ + + def __init__( + self, + d_model: int, + d_ff: int, + dropout: float = 0.1, + activation=nn.ReLU(), + is_gated: bool = False, + bias: bool = False, + weight_args={}, + operations=None, + ) -> None: + super().__init__() + + self.layer1 = operations.Linear(d_model, d_ff, bias=bias, **weight_args) + self.layer2 = operations.Linear(d_ff, d_model, bias=bias, **weight_args) + + self.dropout = nn.Dropout(dropout) + self.activation = activation + self.is_gated = is_gated + if is_gated: + self.linear_gate = operations.Linear(d_model, d_ff, bias=False, **weight_args) + + def forward(self, x: torch.Tensor): + g = self.activation(self.layer1(x)) + if self.is_gated: + x = g * self.linear_gate(x) + else: + x = g + assert self.dropout.p == 0.0, "we skip dropout" + return self.layer2(x) + + +class GPT2FeedForward(FeedForward): + def __init__(self, d_model: int, d_ff: int, dropout: float = 0.1, bias: bool = False, weight_args={}, operations=None): + super().__init__( + d_model=d_model, + d_ff=d_ff, + dropout=dropout, + activation=nn.GELU(), + is_gated=False, + bias=bias, + weight_args=weight_args, + operations=operations, + ) + + def forward(self, x: torch.Tensor): + assert self.dropout.p == 0.0, "we skip dropout" + + x = self.layer1(x) + x = self.activation(x) + x = self.layer2(x) + + return x + + +def modulate(x, shift, scale): + return x * (1 + scale.unsqueeze(1)) + shift.unsqueeze(1) + + +class Timesteps(nn.Module): + def __init__(self, num_channels): + super().__init__() + self.num_channels = num_channels + + def forward(self, timesteps): + half_dim = self.num_channels // 2 + exponent = -math.log(10000) * torch.arange(half_dim, dtype=torch.float32, device=timesteps.device) + exponent = exponent / (half_dim - 0.0) + + emb = torch.exp(exponent) + emb = timesteps[:, None].float() * emb[None, :] + + sin_emb = torch.sin(emb) + cos_emb = torch.cos(emb) + emb = torch.cat([cos_emb, sin_emb], dim=-1) + + return emb + + +class TimestepEmbedding(nn.Module): + def __init__(self, in_features: int, out_features: int, use_adaln_lora: bool = False, weight_args={}, operations=None): + super().__init__() + logging.debug( + f"Using AdaLN LoRA Flag: {use_adaln_lora}. We enable bias if no AdaLN LoRA for backward compatibility." + ) + self.linear_1 = operations.Linear(in_features, out_features, bias=not use_adaln_lora, **weight_args) + self.activation = nn.SiLU() + self.use_adaln_lora = use_adaln_lora + if use_adaln_lora: + self.linear_2 = operations.Linear(out_features, 3 * out_features, bias=False, **weight_args) + else: + self.linear_2 = operations.Linear(out_features, out_features, bias=True, **weight_args) + + def forward(self, sample: torch.Tensor) -> torch.Tensor: + emb = self.linear_1(sample) + emb = self.activation(emb) + emb = self.linear_2(emb) + + if self.use_adaln_lora: + adaln_lora_B_3D = emb + emb_B_D = sample + else: + emb_B_D = emb + adaln_lora_B_3D = None + + return emb_B_D, adaln_lora_B_3D + + +class FourierFeatures(nn.Module): + """ + Implements a layer that generates Fourier features from input tensors, based on randomly sampled + frequencies and phases. This can help in learning high-frequency functions in low-dimensional problems. + + [B] -> [B, D] + + Parameters: + num_channels (int): The number of Fourier features to generate. + bandwidth (float, optional): The scaling factor for the frequency of the Fourier features. Defaults to 1. + normalize (bool, optional): If set to True, the outputs are scaled by sqrt(2), usually to normalize + the variance of the features. Defaults to False. + + Example: + >>> layer = FourierFeatures(num_channels=256, bandwidth=0.5, normalize=True) + >>> x = torch.randn(10, 256) # Example input tensor + >>> output = layer(x) + >>> print(output.shape) # Expected shape: (10, 256) + """ + + def __init__(self, num_channels, bandwidth=1, normalize=False): + super().__init__() + self.register_buffer("freqs", 2 * np.pi * bandwidth * torch.randn(num_channels), persistent=True) + self.register_buffer("phases", 2 * np.pi * torch.rand(num_channels), persistent=True) + self.gain = np.sqrt(2) if normalize else 1 + + def forward(self, x, gain: float = 1.0): + """ + Apply the Fourier feature transformation to the input tensor. + + Args: + x (torch.Tensor): The input tensor. + gain (float, optional): An additional gain factor applied during the forward pass. Defaults to 1. + + Returns: + torch.Tensor: The transformed tensor, with Fourier features applied. + """ + in_dtype = x.dtype + x = x.to(torch.float32).ger(self.freqs.to(torch.float32)).add(self.phases.to(torch.float32)) + x = x.cos().mul(self.gain * gain).to(in_dtype) + return x + + +class PatchEmbed(nn.Module): + """ + PatchEmbed is a module for embedding patches from an input tensor by applying either 3D or 2D convolutional layers, + depending on the . This module can process inputs with temporal (video) and spatial (image) dimensions, + making it suitable for video and image processing tasks. It supports dividing the input into patches + and embedding each patch into a vector of size `out_channels`. + + Parameters: + - spatial_patch_size (int): The size of each spatial patch. + - temporal_patch_size (int): The size of each temporal patch. + - in_channels (int): Number of input channels. Default: 3. + - out_channels (int): The dimension of the embedding vector for each patch. Default: 768. + - bias (bool): If True, adds a learnable bias to the output of the convolutional layers. Default: True. + """ + + def __init__( + self, + spatial_patch_size, + temporal_patch_size, + in_channels=3, + out_channels=768, + bias=True, + weight_args={}, + operations=None, + ): + super().__init__() + self.spatial_patch_size = spatial_patch_size + self.temporal_patch_size = temporal_patch_size + + self.proj = nn.Sequential( + Rearrange( + "b c (t r) (h m) (w n) -> b t h w (c r m n)", + r=temporal_patch_size, + m=spatial_patch_size, + n=spatial_patch_size, + ), + operations.Linear( + in_channels * spatial_patch_size * spatial_patch_size * temporal_patch_size, out_channels, bias=bias, **weight_args + ), + ) + self.out = nn.Identity() + + def forward(self, x): + """ + Forward pass of the PatchEmbed module. + + Parameters: + - x (torch.Tensor): The input tensor of shape (B, C, T, H, W) where + B is the batch size, + C is the number of channels, + T is the temporal dimension, + H is the height, and + W is the width of the input. + + Returns: + - torch.Tensor: The embedded patches as a tensor, with shape b t h w c. + """ + assert x.dim() == 5 + _, _, T, H, W = x.shape + assert H % self.spatial_patch_size == 0 and W % self.spatial_patch_size == 0 + assert T % self.temporal_patch_size == 0 + x = self.proj(x) + return self.out(x) + + +class FinalLayer(nn.Module): + """ + The final layer of video DiT. + """ + + def __init__( + self, + hidden_size, + spatial_patch_size, + temporal_patch_size, + out_channels, + use_adaln_lora: bool = False, + adaln_lora_dim: int = 256, + weight_args={}, + operations=None, + ): + super().__init__() + self.norm_final = operations.LayerNorm(hidden_size, elementwise_affine=False, eps=1e-6, **weight_args) + self.linear = operations.Linear( + hidden_size, spatial_patch_size * spatial_patch_size * temporal_patch_size * out_channels, bias=False, **weight_args + ) + self.hidden_size = hidden_size + self.n_adaln_chunks = 2 + self.use_adaln_lora = use_adaln_lora + if use_adaln_lora: + self.adaLN_modulation = nn.Sequential( + nn.SiLU(), + operations.Linear(hidden_size, adaln_lora_dim, bias=False, **weight_args), + operations.Linear(adaln_lora_dim, self.n_adaln_chunks * hidden_size, bias=False, **weight_args), + ) + else: + self.adaLN_modulation = nn.Sequential( + nn.SiLU(), operations.Linear(hidden_size, self.n_adaln_chunks * hidden_size, bias=False, **weight_args) + ) + + def forward( + self, + x_BT_HW_D, + emb_B_D, + adaln_lora_B_3D: Optional[torch.Tensor] = None, + ): + if self.use_adaln_lora: + assert adaln_lora_B_3D is not None + shift_B_D, scale_B_D = (self.adaLN_modulation(emb_B_D) + adaln_lora_B_3D[:, : 2 * self.hidden_size]).chunk( + 2, dim=1 + ) + else: + shift_B_D, scale_B_D = self.adaLN_modulation(emb_B_D).chunk(2, dim=1) + + B = emb_B_D.shape[0] + T = x_BT_HW_D.shape[0] // B + shift_BT_D, scale_BT_D = repeat(shift_B_D, "b d -> (b t) d", t=T), repeat(scale_B_D, "b d -> (b t) d", t=T) + x_BT_HW_D = modulate(self.norm_final(x_BT_HW_D), shift_BT_D, scale_BT_D) + + x_BT_HW_D = self.linear(x_BT_HW_D) + return x_BT_HW_D + + +class VideoAttn(nn.Module): + """ + Implements video attention with optional cross-attention capabilities. + + This module processes video features while maintaining their spatio-temporal structure. It can perform + self-attention within the video features or cross-attention with external context features. + + Parameters: + x_dim (int): Dimension of input feature vectors + context_dim (Optional[int]): Dimension of context features for cross-attention. None for self-attention + num_heads (int): Number of attention heads + bias (bool): Whether to include bias in attention projections. Default: False + qkv_norm_mode (str): Normalization mode for query/key/value projections. Must be "per_head". Default: "per_head" + x_format (str): Format of input tensor. Must be "BTHWD". Default: "BTHWD" + + Input shape: + - x: (T, H, W, B, D) video features + - context (optional): (M, B, D) context features for cross-attention + where: + T: temporal dimension + H: height + W: width + B: batch size + D: feature dimension + M: context sequence length + """ + + def __init__( + self, + x_dim: int, + context_dim: Optional[int], + num_heads: int, + bias: bool = False, + qkv_norm_mode: str = "per_head", + x_format: str = "BTHWD", + weight_args={}, + operations=None, + ) -> None: + super().__init__() + self.x_format = x_format + + self.attn = Attention( + x_dim, + context_dim, + num_heads, + x_dim // num_heads, + qkv_bias=bias, + qkv_norm="RRI", + out_bias=bias, + qkv_norm_mode=qkv_norm_mode, + qkv_format="sbhd", + weight_args=weight_args, + operations=operations, + ) + + def forward( + self, + x: torch.Tensor, + context: Optional[torch.Tensor] = None, + crossattn_mask: Optional[torch.Tensor] = None, + rope_emb_L_1_1_D: Optional[torch.Tensor] = None, + ) -> torch.Tensor: + """ + Forward pass for video attention. + + Args: + x (Tensor): Input tensor of shape (B, T, H, W, D) or (T, H, W, B, D) representing batches of video data. + context (Tensor): Context tensor of shape (B, M, D) or (M, B, D), + where M is the sequence length of the context. + crossattn_mask (Optional[Tensor]): An optional mask for cross-attention mechanisms. + rope_emb_L_1_1_D (Optional[Tensor]): + Rotary positional embedding tensor of shape (L, 1, 1, D). L == THW for current video training. + + Returns: + Tensor: The output tensor with applied attention, maintaining the input shape. + """ + + x_T_H_W_B_D = x + context_M_B_D = context + T, H, W, B, D = x_T_H_W_B_D.shape + x_THW_B_D = rearrange(x_T_H_W_B_D, "t h w b d -> (t h w) b d") + x_THW_B_D = self.attn( + x_THW_B_D, + context_M_B_D, + crossattn_mask, + rope_emb=rope_emb_L_1_1_D, + ) + x_T_H_W_B_D = rearrange(x_THW_B_D, "(t h w) b d -> t h w b d", h=H, w=W) + return x_T_H_W_B_D + + +def adaln_norm_state(norm_state, x, scale, shift): + normalized = norm_state(x) + return normalized * (1 + scale) + shift + + +class DITBuildingBlock(nn.Module): + """ + A building block for the DiT (Diffusion Transformer) architecture that supports different types of + attention and MLP operations with adaptive layer normalization. + + Parameters: + block_type (str): Type of block - one of: + - "cross_attn"/"ca": Cross-attention + - "full_attn"/"fa": Full self-attention + - "mlp"/"ff": MLP/feedforward block + x_dim (int): Dimension of input features + context_dim (Optional[int]): Dimension of context features for cross-attention + num_heads (int): Number of attention heads + mlp_ratio (float): MLP hidden dimension multiplier. Default: 4.0 + bias (bool): Whether to use bias in layers. Default: False + mlp_dropout (float): Dropout rate for MLP. Default: 0.0 + qkv_norm_mode (str): QKV normalization mode. Default: "per_head" + x_format (str): Input tensor format. Default: "BTHWD" + use_adaln_lora (bool): Whether to use AdaLN-LoRA. Default: False + adaln_lora_dim (int): Dimension for AdaLN-LoRA. Default: 256 + """ + + def __init__( + self, + block_type: str, + x_dim: int, + context_dim: Optional[int], + num_heads: int, + mlp_ratio: float = 4.0, + bias: bool = False, + mlp_dropout: float = 0.0, + qkv_norm_mode: str = "per_head", + x_format: str = "BTHWD", + use_adaln_lora: bool = False, + adaln_lora_dim: int = 256, + weight_args={}, + operations=None + ) -> None: + block_type = block_type.lower() + + super().__init__() + self.x_format = x_format + if block_type in ["cross_attn", "ca"]: + self.block = VideoAttn( + x_dim, + context_dim, + num_heads, + bias=bias, + qkv_norm_mode=qkv_norm_mode, + x_format=self.x_format, + weight_args=weight_args, + operations=operations, + ) + elif block_type in ["full_attn", "fa"]: + self.block = VideoAttn( + x_dim, None, num_heads, bias=bias, qkv_norm_mode=qkv_norm_mode, x_format=self.x_format, weight_args=weight_args, operations=operations + ) + elif block_type in ["mlp", "ff"]: + self.block = GPT2FeedForward(x_dim, int(x_dim * mlp_ratio), dropout=mlp_dropout, bias=bias, weight_args=weight_args, operations=operations) + else: + raise ValueError(f"Unknown block type: {block_type}") + + self.block_type = block_type + self.use_adaln_lora = use_adaln_lora + + self.norm_state = nn.LayerNorm(x_dim, elementwise_affine=False, eps=1e-6) + self.n_adaln_chunks = 3 + if use_adaln_lora: + self.adaLN_modulation = nn.Sequential( + nn.SiLU(), + operations.Linear(x_dim, adaln_lora_dim, bias=False, **weight_args), + operations.Linear(adaln_lora_dim, self.n_adaln_chunks * x_dim, bias=False, **weight_args), + ) + else: + self.adaLN_modulation = nn.Sequential(nn.SiLU(), operations.Linear(x_dim, self.n_adaln_chunks * x_dim, bias=False, **weight_args)) + + def forward( + self, + x: torch.Tensor, + emb_B_D: torch.Tensor, + crossattn_emb: torch.Tensor, + crossattn_mask: Optional[torch.Tensor] = None, + rope_emb_L_1_1_D: Optional[torch.Tensor] = None, + adaln_lora_B_3D: Optional[torch.Tensor] = None, + ) -> torch.Tensor: + """ + Forward pass for dynamically configured blocks with adaptive normalization. + + Args: + x (Tensor): Input tensor of shape (B, T, H, W, D) or (T, H, W, B, D). + emb_B_D (Tensor): Embedding tensor for adaptive layer normalization modulation. + crossattn_emb (Tensor): Tensor for cross-attention blocks. + crossattn_mask (Optional[Tensor]): Optional mask for cross-attention. + rope_emb_L_1_1_D (Optional[Tensor]): + Rotary positional embedding tensor of shape (L, 1, 1, D). L == THW for current video training. + + Returns: + Tensor: The output tensor after processing through the configured block and adaptive normalization. + """ + if self.use_adaln_lora: + shift_B_D, scale_B_D, gate_B_D = (self.adaLN_modulation(emb_B_D) + adaln_lora_B_3D).chunk( + self.n_adaln_chunks, dim=1 + ) + else: + shift_B_D, scale_B_D, gate_B_D = self.adaLN_modulation(emb_B_D).chunk(self.n_adaln_chunks, dim=1) + + shift_1_1_1_B_D, scale_1_1_1_B_D, gate_1_1_1_B_D = ( + shift_B_D.unsqueeze(0).unsqueeze(0).unsqueeze(0), + scale_B_D.unsqueeze(0).unsqueeze(0).unsqueeze(0), + gate_B_D.unsqueeze(0).unsqueeze(0).unsqueeze(0), + ) + + if self.block_type in ["mlp", "ff"]: + x = x + gate_1_1_1_B_D * self.block( + adaln_norm_state(self.norm_state, x, scale_1_1_1_B_D, shift_1_1_1_B_D), + ) + elif self.block_type in ["full_attn", "fa"]: + x = x + gate_1_1_1_B_D * self.block( + adaln_norm_state(self.norm_state, x, scale_1_1_1_B_D, shift_1_1_1_B_D), + context=None, + rope_emb_L_1_1_D=rope_emb_L_1_1_D, + ) + elif self.block_type in ["cross_attn", "ca"]: + x = x + gate_1_1_1_B_D * self.block( + adaln_norm_state(self.norm_state, x, scale_1_1_1_B_D, shift_1_1_1_B_D), + context=crossattn_emb, + crossattn_mask=crossattn_mask, + rope_emb_L_1_1_D=rope_emb_L_1_1_D, + ) + else: + raise ValueError(f"Unknown block type: {self.block_type}") + + return x + + +class GeneralDITTransformerBlock(nn.Module): + """ + A wrapper module that manages a sequence of DITBuildingBlocks to form a complete transformer layer. + Each block in the sequence is specified by a block configuration string. + + Parameters: + x_dim (int): Dimension of input features + context_dim (int): Dimension of context features for cross-attention blocks + num_heads (int): Number of attention heads + block_config (str): String specifying block sequence (e.g. "ca-fa-mlp" for cross-attention, + full-attention, then MLP) + mlp_ratio (float): MLP hidden dimension multiplier. Default: 4.0 + x_format (str): Input tensor format. Default: "BTHWD" + use_adaln_lora (bool): Whether to use AdaLN-LoRA. Default: False + adaln_lora_dim (int): Dimension for AdaLN-LoRA. Default: 256 + + The block_config string uses "-" to separate block types: + - "ca"/"cross_attn": Cross-attention block + - "fa"/"full_attn": Full self-attention block + - "mlp"/"ff": MLP/feedforward block + + Example: + block_config = "ca-fa-mlp" creates a sequence of: + 1. Cross-attention block + 2. Full self-attention block + 3. MLP block + """ + + def __init__( + self, + x_dim: int, + context_dim: int, + num_heads: int, + block_config: str, + mlp_ratio: float = 4.0, + x_format: str = "BTHWD", + use_adaln_lora: bool = False, + adaln_lora_dim: int = 256, + weight_args={}, + operations=None + ): + super().__init__() + self.blocks = nn.ModuleList() + self.x_format = x_format + for block_type in block_config.split("-"): + self.blocks.append( + DITBuildingBlock( + block_type, + x_dim, + context_dim, + num_heads, + mlp_ratio, + x_format=self.x_format, + use_adaln_lora=use_adaln_lora, + adaln_lora_dim=adaln_lora_dim, + weight_args=weight_args, + operations=operations, + ) + ) + + def forward( + self, + x: torch.Tensor, + emb_B_D: torch.Tensor, + crossattn_emb: torch.Tensor, + crossattn_mask: Optional[torch.Tensor] = None, + rope_emb_L_1_1_D: Optional[torch.Tensor] = None, + adaln_lora_B_3D: Optional[torch.Tensor] = None, + extra_per_block_pos_emb: Optional[torch.Tensor] = None, + ) -> torch.Tensor: + if extra_per_block_pos_emb is not None: + x = x + extra_per_block_pos_emb + for block in self.blocks: + x = block( + x, + emb_B_D, + crossattn_emb, + crossattn_mask, + rope_emb_L_1_1_D=rope_emb_L_1_1_D, + adaln_lora_B_3D=adaln_lora_B_3D, + ) + return x diff --git a/comfy/ldm/cosmos/cosmos_tokenizer/layers3d.py b/comfy/ldm/cosmos/cosmos_tokenizer/layers3d.py new file mode 100644 index 00000000..6149e53e --- /dev/null +++ b/comfy/ldm/cosmos/cosmos_tokenizer/layers3d.py @@ -0,0 +1,1050 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""The model definition for 3D layers + +Adapted from: https://github.com/lucidrains/magvit2-pytorch/blob/ +9f49074179c912736e617d61b32be367eb5f993a/magvit2_pytorch/magvit2_pytorch.py#L889 + +[MIT License Copyright (c) 2023 Phil Wang] +https://github.com/lucidrains/magvit2-pytorch/blob/ +9f49074179c912736e617d61b32be367eb5f993a/LICENSE +""" +import math +from typing import Tuple, Union + +import numpy as np +import torch +import torch.nn as nn +import torch.nn.functional as F +import logging + +from .patching import ( + Patcher, + Patcher3D, + UnPatcher, + UnPatcher3D, +) +from .utils import ( + CausalNormalize, + batch2space, + batch2time, + cast_tuple, + is_odd, + nonlinearity, + replication_pad, + space2batch, + time2batch, +) + +import comfy.ops +ops = comfy.ops.disable_weight_init + +_LEGACY_NUM_GROUPS = 32 + + +class CausalConv3d(nn.Module): + def __init__( + self, + chan_in: int = 1, + chan_out: int = 1, + kernel_size: Union[int, Tuple[int, int, int]] = 3, + pad_mode: str = "constant", + **kwargs, + ): + super().__init__() + kernel_size = cast_tuple(kernel_size, 3) + + time_kernel_size, height_kernel_size, width_kernel_size = kernel_size + + assert is_odd(height_kernel_size) and is_odd(width_kernel_size) + + dilation = kwargs.pop("dilation", 1) + stride = kwargs.pop("stride", 1) + time_stride = kwargs.pop("time_stride", 1) + time_dilation = kwargs.pop("time_dilation", 1) + padding = kwargs.pop("padding", 1) + + self.pad_mode = pad_mode + time_pad = time_dilation * (time_kernel_size - 1) + (1 - time_stride) + self.time_pad = time_pad + + self.spatial_pad = (padding, padding, padding, padding) + + stride = (time_stride, stride, stride) + dilation = (time_dilation, dilation, dilation) + self.conv3d = ops.Conv3d( + chan_in, + chan_out, + kernel_size, + stride=stride, + dilation=dilation, + **kwargs, + ) + + def _replication_pad(self, x: torch.Tensor) -> torch.Tensor: + x_prev = x[:, :, :1, ...].repeat(1, 1, self.time_pad, 1, 1) + x = torch.cat([x_prev, x], dim=2) + padding = self.spatial_pad + (0, 0) + return F.pad(x, padding, mode=self.pad_mode, value=0.0) + + def forward(self, x: torch.Tensor) -> torch.Tensor: + x = self._replication_pad(x) + return self.conv3d(x) + + +class CausalUpsample3d(nn.Module): + def __init__(self, in_channels: int) -> None: + super().__init__() + self.conv = CausalConv3d( + in_channels, in_channels, kernel_size=3, stride=1, padding=1 + ) + + def forward(self, x: torch.Tensor) -> torch.Tensor: + x = x.repeat_interleave(2, dim=3).repeat_interleave(2, dim=4) + time_factor = 1.0 + 1.0 * (x.shape[2] > 1) + if isinstance(time_factor, torch.Tensor): + time_factor = time_factor.item() + x = x.repeat_interleave(int(time_factor), dim=2) + # TODO(freda): Check if this causes temporal inconsistency. + # Shoule reverse the order of the following two ops, + # better perf and better temporal smoothness. + x = self.conv(x) + return x[..., int(time_factor - 1) :, :, :] + + +class CausalDownsample3d(nn.Module): + def __init__(self, in_channels: int) -> None: + super().__init__() + self.conv = CausalConv3d( + in_channels, + in_channels, + kernel_size=3, + stride=2, + time_stride=2, + padding=0, + ) + + def forward(self, x: torch.Tensor) -> torch.Tensor: + pad = (0, 1, 0, 1, 0, 0) + x = F.pad(x, pad, mode="constant", value=0) + x = replication_pad(x) + x = self.conv(x) + return x + + +class CausalHybridUpsample3d(nn.Module): + def __init__( + self, + in_channels: int, + spatial_up: bool = True, + temporal_up: bool = True, + **kwargs, + ) -> None: + super().__init__() + self.spatial_up = spatial_up + self.temporal_up = temporal_up + if not self.spatial_up and not self.temporal_up: + return + + self.conv1 = CausalConv3d( + in_channels, + in_channels, + kernel_size=(3, 1, 1), + stride=1, + time_stride=1, + padding=0, + ) + self.conv2 = CausalConv3d( + in_channels, + in_channels, + kernel_size=(1, 3, 3), + stride=1, + time_stride=1, + padding=1, + ) + self.conv3 = CausalConv3d( + in_channels, + in_channels, + kernel_size=1, + stride=1, + time_stride=1, + padding=0, + ) + + def forward(self, x: torch.Tensor) -> torch.Tensor: + if not self.spatial_up and not self.temporal_up: + return x + + # hybrid upsample temporally. + if self.temporal_up: + time_factor = 1.0 + 1.0 * (x.shape[2] > 1) + if isinstance(time_factor, torch.Tensor): + time_factor = time_factor.item() + x = x.repeat_interleave(int(time_factor), dim=2) + x = x[..., int(time_factor - 1) :, :, :] + x = self.conv1(x) + x + + # hybrid upsample spatially. + if self.spatial_up: + x = x.repeat_interleave(2, dim=3).repeat_interleave(2, dim=4) + x = self.conv2(x) + x + + # final 1x1x1 conv. + x = self.conv3(x) + return x + + +class CausalHybridDownsample3d(nn.Module): + def __init__( + self, + in_channels: int, + spatial_down: bool = True, + temporal_down: bool = True, + **kwargs, + ) -> None: + super().__init__() + self.spatial_down = spatial_down + self.temporal_down = temporal_down + if not self.spatial_down and not self.temporal_down: + return + + self.conv1 = CausalConv3d( + in_channels, + in_channels, + kernel_size=(1, 3, 3), + stride=2, + time_stride=1, + padding=0, + ) + self.conv2 = CausalConv3d( + in_channels, + in_channels, + kernel_size=(3, 1, 1), + stride=1, + time_stride=2, + padding=0, + ) + self.conv3 = CausalConv3d( + in_channels, + in_channels, + kernel_size=1, + stride=1, + time_stride=1, + padding=0, + ) + + + def forward(self, x: torch.Tensor) -> torch.Tensor: + if not self.spatial_down and not self.temporal_down: + return x + + # hybrid downsample spatially. + if self.spatial_down: + pad = (0, 1, 0, 1, 0, 0) + x = F.pad(x, pad, mode="constant", value=0) + x1 = self.conv1(x) + x2 = F.avg_pool3d(x, kernel_size=(1, 2, 2), stride=(1, 2, 2)) + x = x1 + x2 + + # hybrid downsample temporally. + if self.temporal_down: + x = replication_pad(x) + x1 = self.conv2(x) + x2 = F.avg_pool3d(x, kernel_size=(2, 1, 1), stride=(2, 1, 1)) + x = x1 + x2 + + # final 1x1x1 conv. + x = self.conv3(x) + return x + + +class CausalResnetBlock3d(nn.Module): + def __init__( + self, + *, + in_channels: int, + out_channels: int = None, + dropout: float, + num_groups: int, + ) -> None: + super().__init__() + self.in_channels = in_channels + out_channels = in_channels if out_channels is None else out_channels + + self.norm1 = CausalNormalize(in_channels, num_groups=num_groups) + self.conv1 = CausalConv3d( + in_channels, out_channels, kernel_size=3, stride=1, padding=1 + ) + self.norm2 = CausalNormalize(out_channels, num_groups=num_groups) + self.dropout = torch.nn.Dropout(dropout) + self.conv2 = CausalConv3d( + out_channels, out_channels, kernel_size=3, stride=1, padding=1 + ) + self.nin_shortcut = ( + CausalConv3d(in_channels, out_channels, kernel_size=1, stride=1, padding=0) + if in_channels != out_channels + else nn.Identity() + ) + + def forward(self, x: torch.Tensor) -> torch.Tensor: + h = x + h = self.norm1(h) + h = nonlinearity(h) + h = self.conv1(h) + + h = self.norm2(h) + h = nonlinearity(h) + h = self.dropout(h) + h = self.conv2(h) + x = self.nin_shortcut(x) + + return x + h + + +class CausalResnetBlockFactorized3d(nn.Module): + def __init__( + self, + *, + in_channels: int, + out_channels: int = None, + dropout: float, + num_groups: int, + ) -> None: + super().__init__() + self.in_channels = in_channels + out_channels = in_channels if out_channels is None else out_channels + + self.norm1 = CausalNormalize(in_channels, num_groups=1) + self.conv1 = nn.Sequential( + CausalConv3d( + in_channels, + out_channels, + kernel_size=(1, 3, 3), + stride=1, + padding=1, + ), + CausalConv3d( + out_channels, + out_channels, + kernel_size=(3, 1, 1), + stride=1, + padding=0, + ), + ) + self.norm2 = CausalNormalize(out_channels, num_groups=num_groups) + self.dropout = torch.nn.Dropout(dropout) + self.conv2 = nn.Sequential( + CausalConv3d( + out_channels, + out_channels, + kernel_size=(1, 3, 3), + stride=1, + padding=1, + ), + CausalConv3d( + out_channels, + out_channels, + kernel_size=(3, 1, 1), + stride=1, + padding=0, + ), + ) + self.nin_shortcut = ( + CausalConv3d(in_channels, out_channels, kernel_size=1, stride=1, padding=0) + if in_channels != out_channels + else nn.Identity() + ) + + def forward(self, x: torch.Tensor) -> torch.Tensor: + h = x + h = self.norm1(h) + h = nonlinearity(h) + h = self.conv1(h) + + h = self.norm2(h) + h = nonlinearity(h) + h = self.dropout(h) + h = self.conv2(h) + x = self.nin_shortcut(x) + + return x + h + + +class CausalAttnBlock(nn.Module): + def __init__(self, in_channels: int, num_groups: int) -> None: + super().__init__() + + self.norm = CausalNormalize(in_channels, num_groups=num_groups) + self.q = CausalConv3d( + in_channels, in_channels, kernel_size=1, stride=1, padding=0 + ) + self.k = CausalConv3d( + in_channels, in_channels, kernel_size=1, stride=1, padding=0 + ) + self.v = CausalConv3d( + in_channels, in_channels, kernel_size=1, stride=1, padding=0 + ) + self.proj_out = CausalConv3d( + in_channels, in_channels, kernel_size=1, stride=1, padding=0 + ) + + def forward(self, x: torch.Tensor) -> torch.Tensor: + h_ = x + h_ = self.norm(h_) + q = self.q(h_) + k = self.k(h_) + v = self.v(h_) + + # compute attention + q, batch_size = time2batch(q) + k, batch_size = time2batch(k) + v, batch_size = time2batch(v) + + b, c, h, w = q.shape + q = q.reshape(b, c, h * w) + q = q.permute(0, 2, 1) + k = k.reshape(b, c, h * w) + w_ = torch.bmm(q, k) + w_ = w_ * (int(c) ** (-0.5)) + w_ = F.softmax(w_, dim=2) + + # attend to values + v = v.reshape(b, c, h * w) + w_ = w_.permute(0, 2, 1) + h_ = torch.bmm(v, w_) + h_ = h_.reshape(b, c, h, w) + + h_ = batch2time(h_, batch_size) + h_ = self.proj_out(h_) + return x + h_ + + +class CausalTemporalAttnBlock(nn.Module): + def __init__(self, in_channels: int, num_groups: int) -> None: + super().__init__() + + self.norm = CausalNormalize(in_channels, num_groups=num_groups) + self.q = CausalConv3d( + in_channels, in_channels, kernel_size=1, stride=1, padding=0 + ) + self.k = CausalConv3d( + in_channels, in_channels, kernel_size=1, stride=1, padding=0 + ) + self.v = CausalConv3d( + in_channels, in_channels, kernel_size=1, stride=1, padding=0 + ) + self.proj_out = CausalConv3d( + in_channels, in_channels, kernel_size=1, stride=1, padding=0 + ) + + def forward(self, x: torch.Tensor) -> torch.Tensor: + h_ = x + h_ = self.norm(h_) + q = self.q(h_) + k = self.k(h_) + v = self.v(h_) + + # compute attention + q, batch_size, height = space2batch(q) + k, _, _ = space2batch(k) + v, _, _ = space2batch(v) + + bhw, c, t = q.shape + q = q.permute(0, 2, 1) # (bhw, t, c) + k = k.permute(0, 2, 1) # (bhw, t, c) + v = v.permute(0, 2, 1) # (bhw, t, c) + + w_ = torch.bmm(q, k.permute(0, 2, 1)) # (bhw, t, t) + w_ = w_ * (int(c) ** (-0.5)) + + # Apply causal mask + mask = torch.tril(torch.ones_like(w_)) + w_ = w_.masked_fill(mask == 0, float("-inf")) + w_ = F.softmax(w_, dim=2) + + # attend to values + h_ = torch.bmm(w_, v) # (bhw, t, c) + h_ = h_.permute(0, 2, 1).reshape(bhw, c, t) # (bhw, c, t) + + h_ = batch2space(h_, batch_size, height) + h_ = self.proj_out(h_) + return x + h_ + + +class EncoderBase(nn.Module): + def __init__( + self, + in_channels: int, + channels: int, + channels_mult: list[int], + num_res_blocks: int, + attn_resolutions: list[int], + dropout: float, + resolution: int, + z_channels: int, + **ignore_kwargs, + ) -> None: + super().__init__() + self.num_resolutions = len(channels_mult) + self.num_res_blocks = num_res_blocks + + # Patcher. + patch_size = ignore_kwargs.get("patch_size", 1) + self.patcher = Patcher( + patch_size, ignore_kwargs.get("patch_method", "rearrange") + ) + in_channels = in_channels * patch_size * patch_size + + # downsampling + self.conv_in = CausalConv3d( + in_channels, channels, kernel_size=3, stride=1, padding=1 + ) + + # num of groups for GroupNorm, num_groups=1 for LayerNorm. + num_groups = ignore_kwargs.get("num_groups", _LEGACY_NUM_GROUPS) + curr_res = resolution // patch_size + in_ch_mult = (1,) + tuple(channels_mult) + self.in_ch_mult = in_ch_mult + self.down = nn.ModuleList() + for i_level in range(self.num_resolutions): + block = nn.ModuleList() + attn = nn.ModuleList() + block_in = channels * in_ch_mult[i_level] + block_out = channels * channels_mult[i_level] + for _ in range(self.num_res_blocks): + block.append( + CausalResnetBlock3d( + in_channels=block_in, + out_channels=block_out, + dropout=dropout, + num_groups=num_groups, + ) + ) + block_in = block_out + if curr_res in attn_resolutions: + attn.append(CausalAttnBlock(block_in, num_groups=num_groups)) + down = nn.Module() + down.block = block + down.attn = attn + if i_level != self.num_resolutions - 1: + down.downsample = CausalDownsample3d(block_in) + curr_res = curr_res // 2 + self.down.append(down) + + # middle + self.mid = nn.Module() + self.mid.block_1 = CausalResnetBlock3d( + in_channels=block_in, + out_channels=block_in, + dropout=dropout, + num_groups=num_groups, + ) + self.mid.attn_1 = CausalAttnBlock(block_in, num_groups=num_groups) + self.mid.block_2 = CausalResnetBlock3d( + in_channels=block_in, + out_channels=block_in, + dropout=dropout, + num_groups=num_groups, + ) + + # end + self.norm_out = CausalNormalize(block_in, num_groups=num_groups) + self.conv_out = CausalConv3d( + block_in, z_channels, kernel_size=3, stride=1, padding=1 + ) + + def patcher3d(self, x: torch.Tensor) -> torch.Tensor: + x, batch_size = time2batch(x) + x = self.patcher(x) + x = batch2time(x, batch_size) + return x + + def forward(self, x: torch.Tensor) -> torch.Tensor: + x = self.patcher3d(x) + + # downsampling + hs = [self.conv_in(x)] + for i_level in range(self.num_resolutions): + for i_block in range(self.num_res_blocks): + h = self.down[i_level].block[i_block](hs[-1]) + if len(self.down[i_level].attn) > 0: + h = self.down[i_level].attn[i_block](h) + hs.append(h) + if i_level != self.num_resolutions - 1: + hs.append(self.down[i_level].downsample(hs[-1])) + else: + # temporal downsample (last level) + time_factor = 1 + 1 * (hs[-1].shape[2] > 1) + if isinstance(time_factor, torch.Tensor): + time_factor = time_factor.item() + hs[-1] = replication_pad(hs[-1]) + hs.append( + F.avg_pool3d( + hs[-1], + kernel_size=[time_factor, 1, 1], + stride=[2, 1, 1], + ) + ) + + # middle + h = hs[-1] + h = self.mid.block_1(h) + h = self.mid.attn_1(h) + h = self.mid.block_2(h) + + # end + h = self.norm_out(h) + h = nonlinearity(h) + h = self.conv_out(h) + return h + + +class DecoderBase(nn.Module): + def __init__( + self, + out_channels: int, + channels: int, + channels_mult: list[int], + num_res_blocks: int, + attn_resolutions: list[int], + dropout: float, + resolution: int, + z_channels: int, + **ignore_kwargs, + ): + super().__init__() + self.num_resolutions = len(channels_mult) + self.num_res_blocks = num_res_blocks + + # UnPatcher. + patch_size = ignore_kwargs.get("patch_size", 1) + self.unpatcher = UnPatcher( + patch_size, ignore_kwargs.get("patch_method", "rearrange") + ) + out_ch = out_channels * patch_size * patch_size + + block_in = channels * channels_mult[self.num_resolutions - 1] + curr_res = (resolution // patch_size) // 2 ** (self.num_resolutions - 1) + self.z_shape = (1, z_channels, curr_res, curr_res) + logging.debug( + "Working with z of shape {} = {} dimensions.".format( + self.z_shape, np.prod(self.z_shape) + ) + ) + + # z to block_in + self.conv_in = CausalConv3d( + z_channels, block_in, kernel_size=3, stride=1, padding=1 + ) + + # num of groups for GroupNorm, num_groups=1 for LayerNorm. + num_groups = ignore_kwargs.get("num_groups", _LEGACY_NUM_GROUPS) + + # middle + self.mid = nn.Module() + self.mid.block_1 = CausalResnetBlock3d( + in_channels=block_in, + out_channels=block_in, + dropout=dropout, + num_groups=num_groups, + ) + self.mid.attn_1 = CausalAttnBlock(block_in, num_groups=num_groups) + self.mid.block_2 = CausalResnetBlock3d( + in_channels=block_in, + out_channels=block_in, + dropout=dropout, + num_groups=num_groups, + ) + + # upsampling + self.up = nn.ModuleList() + for i_level in reversed(range(self.num_resolutions)): + block = nn.ModuleList() + attn = nn.ModuleList() + block_out = channels * channels_mult[i_level] + for _ in range(self.num_res_blocks + 1): + block.append( + CausalResnetBlock3d( + in_channels=block_in, + out_channels=block_out, + dropout=dropout, + num_groups=num_groups, + ) + ) + block_in = block_out + if curr_res in attn_resolutions: + attn.append(CausalAttnBlock(block_in, num_groups=num_groups)) + up = nn.Module() + up.block = block + up.attn = attn + if i_level != 0: + up.upsample = CausalUpsample3d(block_in) + curr_res = curr_res * 2 + self.up.insert(0, up) # prepend to get consistent order + + # end + self.norm_out = CausalNormalize(block_in, num_groups=num_groups) + self.conv_out = CausalConv3d( + block_in, out_ch, kernel_size=3, stride=1, padding=1 + ) + + def unpatcher3d(self, x: torch.Tensor) -> torch.Tensor: + x, batch_size = time2batch(x) + x = self.unpatcher(x) + x = batch2time(x, batch_size) + + return x + + def forward(self, z): + h = self.conv_in(z) + + # middle block. + h = self.mid.block_1(h) + h = self.mid.attn_1(h) + h = self.mid.block_2(h) + + # decoder blocks. + for i_level in reversed(range(self.num_resolutions)): + for i_block in range(self.num_res_blocks + 1): + h = self.up[i_level].block[i_block](h) + if len(self.up[i_level].attn) > 0: + h = self.up[i_level].attn[i_block](h) + if i_level != 0: + h = self.up[i_level].upsample(h) + else: + # temporal upsample (last level) + time_factor = 1.0 + 1.0 * (h.shape[2] > 1) + if isinstance(time_factor, torch.Tensor): + time_factor = time_factor.item() + h = h.repeat_interleave(int(time_factor), dim=2) + h = h[..., int(time_factor - 1) :, :, :] + + h = self.norm_out(h) + h = nonlinearity(h) + h = self.conv_out(h) + h = self.unpatcher3d(h) + return h + + +class EncoderFactorized(nn.Module): + def __init__( + self, + in_channels: int, + channels: int, + channels_mult: list[int], + num_res_blocks: int, + attn_resolutions: list[int], + dropout: float, + resolution: int, + z_channels: int, + spatial_compression: int = 8, + temporal_compression: int = 8, + **ignore_kwargs, + ) -> None: + super().__init__() + self.num_resolutions = len(channels_mult) + self.num_res_blocks = num_res_blocks + + # Patcher. + patch_size = ignore_kwargs.get("patch_size", 1) + self.patcher3d = Patcher3D( + patch_size, ignore_kwargs.get("patch_method", "haar") + ) + in_channels = in_channels * patch_size * patch_size * patch_size + + # calculate the number of downsample operations + self.num_spatial_downs = int(math.log2(spatial_compression)) - int( + math.log2(patch_size) + ) + assert ( + self.num_spatial_downs <= self.num_resolutions + ), f"Spatially downsample {self.num_resolutions} times at most" + + self.num_temporal_downs = int(math.log2(temporal_compression)) - int( + math.log2(patch_size) + ) + assert ( + self.num_temporal_downs <= self.num_resolutions + ), f"Temporally downsample {self.num_resolutions} times at most" + + # downsampling + self.conv_in = nn.Sequential( + CausalConv3d( + in_channels, + channels, + kernel_size=(1, 3, 3), + stride=1, + padding=1, + ), + CausalConv3d( + channels, channels, kernel_size=(3, 1, 1), stride=1, padding=0 + ), + ) + + curr_res = resolution // patch_size + in_ch_mult = (1,) + tuple(channels_mult) + self.in_ch_mult = in_ch_mult + self.down = nn.ModuleList() + for i_level in range(self.num_resolutions): + block = nn.ModuleList() + attn = nn.ModuleList() + block_in = channels * in_ch_mult[i_level] + block_out = channels * channels_mult[i_level] + for _ in range(self.num_res_blocks): + block.append( + CausalResnetBlockFactorized3d( + in_channels=block_in, + out_channels=block_out, + dropout=dropout, + num_groups=1, + ) + ) + block_in = block_out + if curr_res in attn_resolutions: + attn.append( + nn.Sequential( + CausalAttnBlock(block_in, num_groups=1), + CausalTemporalAttnBlock(block_in, num_groups=1), + ) + ) + down = nn.Module() + down.block = block + down.attn = attn + if i_level != self.num_resolutions - 1: + spatial_down = i_level < self.num_spatial_downs + temporal_down = i_level < self.num_temporal_downs + down.downsample = CausalHybridDownsample3d( + block_in, + spatial_down=spatial_down, + temporal_down=temporal_down, + ) + curr_res = curr_res // 2 + self.down.append(down) + + # middle + self.mid = nn.Module() + self.mid.block_1 = CausalResnetBlockFactorized3d( + in_channels=block_in, + out_channels=block_in, + dropout=dropout, + num_groups=1, + ) + self.mid.attn_1 = nn.Sequential( + CausalAttnBlock(block_in, num_groups=1), + CausalTemporalAttnBlock(block_in, num_groups=1), + ) + self.mid.block_2 = CausalResnetBlockFactorized3d( + in_channels=block_in, + out_channels=block_in, + dropout=dropout, + num_groups=1, + ) + + # end + self.norm_out = CausalNormalize(block_in, num_groups=1) + self.conv_out = nn.Sequential( + CausalConv3d( + block_in, z_channels, kernel_size=(1, 3, 3), stride=1, padding=1 + ), + CausalConv3d( + z_channels, + z_channels, + kernel_size=(3, 1, 1), + stride=1, + padding=0, + ), + ) + + def forward(self, x: torch.Tensor) -> torch.Tensor: + x = self.patcher3d(x) + + # downsampling + hs = [self.conv_in(x)] + for i_level in range(self.num_resolutions): + for i_block in range(self.num_res_blocks): + h = self.down[i_level].block[i_block](hs[-1]) + if len(self.down[i_level].attn) > 0: + h = self.down[i_level].attn[i_block](h) + hs.append(h) + if i_level != self.num_resolutions - 1: + hs.append(self.down[i_level].downsample(hs[-1])) + + # middle + h = hs[-1] + h = self.mid.block_1(h) + h = self.mid.attn_1(h) + h = self.mid.block_2(h) + + # end + h = self.norm_out(h) + h = nonlinearity(h) + h = self.conv_out(h) + return h + + +class DecoderFactorized(nn.Module): + def __init__( + self, + out_channels: int, + channels: int, + channels_mult: list[int], + num_res_blocks: int, + attn_resolutions: list[int], + dropout: float, + resolution: int, + z_channels: int, + spatial_compression: int = 8, + temporal_compression: int = 8, + **ignore_kwargs, + ): + super().__init__() + self.num_resolutions = len(channels_mult) + self.num_res_blocks = num_res_blocks + + # UnPatcher. + patch_size = ignore_kwargs.get("patch_size", 1) + self.unpatcher3d = UnPatcher3D( + patch_size, ignore_kwargs.get("patch_method", "haar") + ) + out_ch = out_channels * patch_size * patch_size * patch_size + + # calculate the number of upsample operations + self.num_spatial_ups = int(math.log2(spatial_compression)) - int( + math.log2(patch_size) + ) + assert ( + self.num_spatial_ups <= self.num_resolutions + ), f"Spatially upsample {self.num_resolutions} times at most" + self.num_temporal_ups = int(math.log2(temporal_compression)) - int( + math.log2(patch_size) + ) + assert ( + self.num_temporal_ups <= self.num_resolutions + ), f"Temporally upsample {self.num_resolutions} times at most" + + block_in = channels * channels_mult[self.num_resolutions - 1] + curr_res = (resolution // patch_size) // 2 ** (self.num_resolutions - 1) + self.z_shape = (1, z_channels, curr_res, curr_res) + logging.debug( + "Working with z of shape {} = {} dimensions.".format( + self.z_shape, np.prod(self.z_shape) + ) + ) + + # z to block_in + self.conv_in = nn.Sequential( + CausalConv3d( + z_channels, block_in, kernel_size=(1, 3, 3), stride=1, padding=1 + ), + CausalConv3d( + block_in, block_in, kernel_size=(3, 1, 1), stride=1, padding=0 + ), + ) + + # middle + self.mid = nn.Module() + self.mid.block_1 = CausalResnetBlockFactorized3d( + in_channels=block_in, + out_channels=block_in, + dropout=dropout, + num_groups=1, + ) + self.mid.attn_1 = nn.Sequential( + CausalAttnBlock(block_in, num_groups=1), + CausalTemporalAttnBlock(block_in, num_groups=1), + ) + self.mid.block_2 = CausalResnetBlockFactorized3d( + in_channels=block_in, + out_channels=block_in, + dropout=dropout, + num_groups=1, + ) + + legacy_mode = ignore_kwargs.get("legacy_mode", False) + # upsampling + self.up = nn.ModuleList() + for i_level in reversed(range(self.num_resolutions)): + block = nn.ModuleList() + attn = nn.ModuleList() + block_out = channels * channels_mult[i_level] + for _ in range(self.num_res_blocks + 1): + block.append( + CausalResnetBlockFactorized3d( + in_channels=block_in, + out_channels=block_out, + dropout=dropout, + num_groups=1, + ) + ) + block_in = block_out + if curr_res in attn_resolutions: + attn.append( + nn.Sequential( + CausalAttnBlock(block_in, num_groups=1), + CausalTemporalAttnBlock(block_in, num_groups=1), + ) + ) + up = nn.Module() + up.block = block + up.attn = attn + if i_level != 0: + # The layer index for temporal/spatial downsampling performed + # in the encoder should correspond to the layer index in + # reverse order where upsampling is performed in the decoder. + # If you've a pre-trained model, you can simply finetune. + i_level_reverse = self.num_resolutions - i_level - 1 + if legacy_mode: + temporal_up = i_level_reverse < self.num_temporal_ups + else: + temporal_up = 0 < i_level_reverse < self.num_temporal_ups + 1 + spatial_up = temporal_up or ( + i_level_reverse < self.num_spatial_ups + and self.num_spatial_ups > self.num_temporal_ups + ) + up.upsample = CausalHybridUpsample3d( + block_in, spatial_up=spatial_up, temporal_up=temporal_up + ) + curr_res = curr_res * 2 + self.up.insert(0, up) # prepend to get consistent order + + # end + self.norm_out = CausalNormalize(block_in, num_groups=1) + self.conv_out = nn.Sequential( + CausalConv3d(block_in, out_ch, kernel_size=(1, 3, 3), stride=1, padding=1), + CausalConv3d(out_ch, out_ch, kernel_size=(3, 1, 1), stride=1, padding=0), + ) + + def forward(self, z): + h = self.conv_in(z) + + # middle block. + h = self.mid.block_1(h) + h = self.mid.attn_1(h) + h = self.mid.block_2(h) + + # decoder blocks. + for i_level in reversed(range(self.num_resolutions)): + for i_block in range(self.num_res_blocks + 1): + h = self.up[i_level].block[i_block](h) + if len(self.up[i_level].attn) > 0: + h = self.up[i_level].attn[i_block](h) + if i_level != 0: + h = self.up[i_level].upsample(h) + + h = self.norm_out(h) + h = nonlinearity(h) + h = self.conv_out(h) + h = self.unpatcher3d(h) + return h diff --git a/comfy/ldm/cosmos/cosmos_tokenizer/patching.py b/comfy/ldm/cosmos/cosmos_tokenizer/patching.py new file mode 100644 index 00000000..793f0da8 --- /dev/null +++ b/comfy/ldm/cosmos/cosmos_tokenizer/patching.py @@ -0,0 +1,355 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""The patcher and unpatcher implementation for 2D and 3D data. + +The idea of Haar wavelet is to compute LL, LH, HL, HH component as two 1D convolutions. +One on the rows and one on the columns. +For example, in 1D signal, we have [a, b], then the low-freq compoenent is [a + b] / 2 and high-freq is [a - b] / 2. +We can use a 1D convolution with kernel [1, 1] and stride 2 to represent the L component. +For H component, we can use a 1D convolution with kernel [1, -1] and stride 2. +Although in principle, we typically only do additional Haar wavelet over the LL component. But here we do it for all + as we need to support downsampling for more than 2x. +For example, 4x downsampling can be done by 2x Haar and additional 2x Haar, and the shape would be. + [3, 256, 256] -> [12, 128, 128] -> [48, 64, 64] +""" + +import torch +import torch.nn.functional as F +from einops import rearrange + +_WAVELETS = { + "haar": torch.tensor([0.7071067811865476, 0.7071067811865476]), + "rearrange": torch.tensor([1.0, 1.0]), +} +_PERSISTENT = False + + +class Patcher(torch.nn.Module): + """A module to convert image tensors into patches using torch operations. + + The main difference from `class Patching` is that this module implements + all operations using torch, rather than python or numpy, for efficiency purpose. + + It's bit-wise identical to the Patching module outputs, with the added + benefit of being torch.jit scriptable. + """ + + def __init__(self, patch_size=1, patch_method="haar"): + super().__init__() + self.patch_size = patch_size + self.patch_method = patch_method + self.register_buffer( + "wavelets", _WAVELETS[patch_method], persistent=_PERSISTENT + ) + self.range = range(int(torch.log2(torch.tensor(self.patch_size)).item())) + self.register_buffer( + "_arange", + torch.arange(_WAVELETS[patch_method].shape[0]), + persistent=_PERSISTENT, + ) + for param in self.parameters(): + param.requires_grad = False + + def forward(self, x): + if self.patch_method == "haar": + return self._haar(x) + elif self.patch_method == "rearrange": + return self._arrange(x) + else: + raise ValueError("Unknown patch method: " + self.patch_method) + + def _dwt(self, x, mode="reflect", rescale=False): + dtype = x.dtype + h = self.wavelets.to(device=x.device) + + n = h.shape[0] + g = x.shape[1] + hl = h.flip(0).reshape(1, 1, -1).repeat(g, 1, 1) + hh = (h * ((-1) ** self._arange.to(device=x.device))).reshape(1, 1, -1).repeat(g, 1, 1) + hh = hh.to(dtype=dtype) + hl = hl.to(dtype=dtype) + + x = F.pad(x, pad=(n - 2, n - 1, n - 2, n - 1), mode=mode).to(dtype) + xl = F.conv2d(x, hl.unsqueeze(2), groups=g, stride=(1, 2)) + xh = F.conv2d(x, hh.unsqueeze(2), groups=g, stride=(1, 2)) + xll = F.conv2d(xl, hl.unsqueeze(3), groups=g, stride=(2, 1)) + xlh = F.conv2d(xl, hh.unsqueeze(3), groups=g, stride=(2, 1)) + xhl = F.conv2d(xh, hl.unsqueeze(3), groups=g, stride=(2, 1)) + xhh = F.conv2d(xh, hh.unsqueeze(3), groups=g, stride=(2, 1)) + + out = torch.cat([xll, xlh, xhl, xhh], dim=1) + if rescale: + out = out / 2 + return out + + def _haar(self, x): + for _ in self.range: + x = self._dwt(x, rescale=True) + return x + + def _arrange(self, x): + x = rearrange( + x, + "b c (h p1) (w p2) -> b (c p1 p2) h w", + p1=self.patch_size, + p2=self.patch_size, + ).contiguous() + return x + + +class Patcher3D(Patcher): + """A 3D discrete wavelet transform for video data, expects 5D tensor, i.e. a batch of videos.""" + + def __init__(self, patch_size=1, patch_method="haar"): + super().__init__(patch_method=patch_method, patch_size=patch_size) + self.register_buffer( + "patch_size_buffer", + patch_size * torch.ones([1], dtype=torch.int32), + persistent=_PERSISTENT, + ) + + def _dwt(self, x, wavelet, mode="reflect", rescale=False): + dtype = x.dtype + h = self.wavelets.to(device=x.device) + + n = h.shape[0] + g = x.shape[1] + hl = h.flip(0).reshape(1, 1, -1).repeat(g, 1, 1) + hh = (h * ((-1) ** self._arange.to(device=x.device))).reshape(1, 1, -1).repeat(g, 1, 1) + hh = hh.to(dtype=dtype) + hl = hl.to(dtype=dtype) + + # Handles temporal axis. + x = F.pad( + x, pad=(max(0, n - 2), n - 1, n - 2, n - 1, n - 2, n - 1), mode=mode + ).to(dtype) + xl = F.conv3d(x, hl.unsqueeze(3).unsqueeze(4), groups=g, stride=(2, 1, 1)) + xh = F.conv3d(x, hh.unsqueeze(3).unsqueeze(4), groups=g, stride=(2, 1, 1)) + + # Handles spatial axes. + xll = F.conv3d(xl, hl.unsqueeze(2).unsqueeze(4), groups=g, stride=(1, 2, 1)) + xlh = F.conv3d(xl, hh.unsqueeze(2).unsqueeze(4), groups=g, stride=(1, 2, 1)) + xhl = F.conv3d(xh, hl.unsqueeze(2).unsqueeze(4), groups=g, stride=(1, 2, 1)) + xhh = F.conv3d(xh, hh.unsqueeze(2).unsqueeze(4), groups=g, stride=(1, 2, 1)) + + xlll = F.conv3d(xll, hl.unsqueeze(2).unsqueeze(3), groups=g, stride=(1, 1, 2)) + xllh = F.conv3d(xll, hh.unsqueeze(2).unsqueeze(3), groups=g, stride=(1, 1, 2)) + xlhl = F.conv3d(xlh, hl.unsqueeze(2).unsqueeze(3), groups=g, stride=(1, 1, 2)) + xlhh = F.conv3d(xlh, hh.unsqueeze(2).unsqueeze(3), groups=g, stride=(1, 1, 2)) + xhll = F.conv3d(xhl, hl.unsqueeze(2).unsqueeze(3), groups=g, stride=(1, 1, 2)) + xhlh = F.conv3d(xhl, hh.unsqueeze(2).unsqueeze(3), groups=g, stride=(1, 1, 2)) + xhhl = F.conv3d(xhh, hl.unsqueeze(2).unsqueeze(3), groups=g, stride=(1, 1, 2)) + xhhh = F.conv3d(xhh, hh.unsqueeze(2).unsqueeze(3), groups=g, stride=(1, 1, 2)) + + out = torch.cat([xlll, xllh, xlhl, xlhh, xhll, xhlh, xhhl, xhhh], dim=1) + if rescale: + out = out / (2 * torch.sqrt(torch.tensor(2.0))) + return out + + def _haar(self, x): + xi, xv = torch.split(x, [1, x.shape[2] - 1], dim=2) + x = torch.cat([xi.repeat_interleave(self.patch_size, dim=2), xv], dim=2) + for _ in self.range: + x = self._dwt(x, "haar", rescale=True) + return x + + def _arrange(self, x): + xi, xv = torch.split(x, [1, x.shape[2] - 1], dim=2) + x = torch.cat([xi.repeat_interleave(self.patch_size, dim=2), xv], dim=2) + x = rearrange( + x, + "b c (t p1) (h p2) (w p3) -> b (c p1 p2 p3) t h w", + p1=self.patch_size, + p2=self.patch_size, + p3=self.patch_size, + ).contiguous() + return x + + +class UnPatcher(torch.nn.Module): + """A module to convert patches into image tensorsusing torch operations. + + The main difference from `class Unpatching` is that this module implements + all operations using torch, rather than python or numpy, for efficiency purpose. + + It's bit-wise identical to the Unpatching module outputs, with the added + benefit of being torch.jit scriptable. + """ + + def __init__(self, patch_size=1, patch_method="haar"): + super().__init__() + self.patch_size = patch_size + self.patch_method = patch_method + self.register_buffer( + "wavelets", _WAVELETS[patch_method], persistent=_PERSISTENT + ) + self.range = range(int(torch.log2(torch.tensor(self.patch_size)).item())) + self.register_buffer( + "_arange", + torch.arange(_WAVELETS[patch_method].shape[0]), + persistent=_PERSISTENT, + ) + for param in self.parameters(): + param.requires_grad = False + + def forward(self, x): + if self.patch_method == "haar": + return self._ihaar(x) + elif self.patch_method == "rearrange": + return self._iarrange(x) + else: + raise ValueError("Unknown patch method: " + self.patch_method) + + def _idwt(self, x, wavelet="haar", mode="reflect", rescale=False): + dtype = x.dtype + h = self.wavelets.to(device=x.device) + n = h.shape[0] + + g = x.shape[1] // 4 + hl = h.flip([0]).reshape(1, 1, -1).repeat([g, 1, 1]) + hh = (h * ((-1) ** self._arange.to(device=x.device))).reshape(1, 1, -1).repeat(g, 1, 1) + hh = hh.to(dtype=dtype) + hl = hl.to(dtype=dtype) + + xll, xlh, xhl, xhh = torch.chunk(x.to(dtype), 4, dim=1) + + # Inverse transform. + yl = torch.nn.functional.conv_transpose2d( + xll, hl.unsqueeze(3), groups=g, stride=(2, 1), padding=(n - 2, 0) + ) + yl += torch.nn.functional.conv_transpose2d( + xlh, hh.unsqueeze(3), groups=g, stride=(2, 1), padding=(n - 2, 0) + ) + yh = torch.nn.functional.conv_transpose2d( + xhl, hl.unsqueeze(3), groups=g, stride=(2, 1), padding=(n - 2, 0) + ) + yh += torch.nn.functional.conv_transpose2d( + xhh, hh.unsqueeze(3), groups=g, stride=(2, 1), padding=(n - 2, 0) + ) + y = torch.nn.functional.conv_transpose2d( + yl, hl.unsqueeze(2), groups=g, stride=(1, 2), padding=(0, n - 2) + ) + y += torch.nn.functional.conv_transpose2d( + yh, hh.unsqueeze(2), groups=g, stride=(1, 2), padding=(0, n - 2) + ) + + if rescale: + y = y * 2 + return y + + def _ihaar(self, x): + for _ in self.range: + x = self._idwt(x, "haar", rescale=True) + return x + + def _iarrange(self, x): + x = rearrange( + x, + "b (c p1 p2) h w -> b c (h p1) (w p2)", + p1=self.patch_size, + p2=self.patch_size, + ) + return x + + +class UnPatcher3D(UnPatcher): + """A 3D inverse discrete wavelet transform for video wavelet decompositions.""" + + def __init__(self, patch_size=1, patch_method="haar"): + super().__init__(patch_method=patch_method, patch_size=patch_size) + + def _idwt(self, x, wavelet="haar", mode="reflect", rescale=False): + dtype = x.dtype + h = self.wavelets.to(device=x.device) + + g = x.shape[1] // 8 # split into 8 spatio-temporal filtered tesnors. + hl = h.flip([0]).reshape(1, 1, -1).repeat([g, 1, 1]) + hh = (h * ((-1) ** self._arange.to(device=x.device))).reshape(1, 1, -1).repeat(g, 1, 1) + hl = hl.to(dtype=dtype) + hh = hh.to(dtype=dtype) + + xlll, xllh, xlhl, xlhh, xhll, xhlh, xhhl, xhhh = torch.chunk(x, 8, dim=1) + + # Height height transposed convolutions. + xll = F.conv_transpose3d( + xlll, hl.unsqueeze(2).unsqueeze(3), groups=g, stride=(1, 1, 2) + ) + xll += F.conv_transpose3d( + xllh, hh.unsqueeze(2).unsqueeze(3), groups=g, stride=(1, 1, 2) + ) + + xlh = F.conv_transpose3d( + xlhl, hl.unsqueeze(2).unsqueeze(3), groups=g, stride=(1, 1, 2) + ) + xlh += F.conv_transpose3d( + xlhh, hh.unsqueeze(2).unsqueeze(3), groups=g, stride=(1, 1, 2) + ) + + xhl = F.conv_transpose3d( + xhll, hl.unsqueeze(2).unsqueeze(3), groups=g, stride=(1, 1, 2) + ) + xhl += F.conv_transpose3d( + xhlh, hh.unsqueeze(2).unsqueeze(3), groups=g, stride=(1, 1, 2) + ) + + xhh = F.conv_transpose3d( + xhhl, hl.unsqueeze(2).unsqueeze(3), groups=g, stride=(1, 1, 2) + ) + xhh += F.conv_transpose3d( + xhhh, hh.unsqueeze(2).unsqueeze(3), groups=g, stride=(1, 1, 2) + ) + + # Handles width transposed convolutions. + xl = F.conv_transpose3d( + xll, hl.unsqueeze(2).unsqueeze(4), groups=g, stride=(1, 2, 1) + ) + xl += F.conv_transpose3d( + xlh, hh.unsqueeze(2).unsqueeze(4), groups=g, stride=(1, 2, 1) + ) + xh = F.conv_transpose3d( + xhl, hl.unsqueeze(2).unsqueeze(4), groups=g, stride=(1, 2, 1) + ) + xh += F.conv_transpose3d( + xhh, hh.unsqueeze(2).unsqueeze(4), groups=g, stride=(1, 2, 1) + ) + + # Handles time axis transposed convolutions. + x = F.conv_transpose3d( + xl, hl.unsqueeze(3).unsqueeze(4), groups=g, stride=(2, 1, 1) + ) + x += F.conv_transpose3d( + xh, hh.unsqueeze(3).unsqueeze(4), groups=g, stride=(2, 1, 1) + ) + + if rescale: + x = x * (2 * torch.sqrt(torch.tensor(2.0))) + return x + + def _ihaar(self, x): + for _ in self.range: + x = self._idwt(x, "haar", rescale=True) + x = x[:, :, self.patch_size - 1 :, ...] + return x + + def _iarrange(self, x): + x = rearrange( + x, + "b (c p1 p2 p3) t h w -> b c (t p1) (h p2) (w p3)", + p1=self.patch_size, + p2=self.patch_size, + p3=self.patch_size, + ) + x = x[:, :, self.patch_size - 1 :, ...] + return x diff --git a/comfy/ldm/cosmos/cosmos_tokenizer/utils.py b/comfy/ldm/cosmos/cosmos_tokenizer/utils.py new file mode 100644 index 00000000..64dd5e28 --- /dev/null +++ b/comfy/ldm/cosmos/cosmos_tokenizer/utils.py @@ -0,0 +1,120 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Shared utilities for the networks module.""" + +from typing import Any + +import torch +from einops import pack, rearrange, unpack + + +import comfy.ops +ops = comfy.ops.disable_weight_init + +def time2batch(x: torch.Tensor) -> tuple[torch.Tensor, int]: + batch_size = x.shape[0] + return rearrange(x, "b c t h w -> (b t) c h w"), batch_size + + +def batch2time(x: torch.Tensor, batch_size: int) -> torch.Tensor: + return rearrange(x, "(b t) c h w -> b c t h w", b=batch_size) + + +def space2batch(x: torch.Tensor) -> tuple[torch.Tensor, int]: + batch_size, height = x.shape[0], x.shape[-2] + return rearrange(x, "b c t h w -> (b h w) c t"), batch_size, height + + +def batch2space(x: torch.Tensor, batch_size: int, height: int) -> torch.Tensor: + return rearrange(x, "(b h w) c t -> b c t h w", b=batch_size, h=height) + + +def cast_tuple(t: Any, length: int = 1) -> Any: + return t if isinstance(t, tuple) else ((t,) * length) + + +def replication_pad(x): + return torch.cat([x[:, :, :1, ...], x], dim=2) + + +def divisible_by(num: int, den: int) -> bool: + return (num % den) == 0 + + +def is_odd(n: int) -> bool: + return not divisible_by(n, 2) + + +def nonlinearity(x): + return x * torch.sigmoid(x) + + +def Normalize(in_channels, num_groups=32): + return ops.GroupNorm( + num_groups=num_groups, num_channels=in_channels, eps=1e-6, affine=True + ) + + +class CausalNormalize(torch.nn.Module): + def __init__(self, in_channels, num_groups=1): + super().__init__() + self.norm = ops.GroupNorm( + num_groups=num_groups, + num_channels=in_channels, + eps=1e-6, + affine=True, + ) + self.num_groups = num_groups + + def forward(self, x): + # if num_groups !=1, we apply a spatio-temporal groupnorm for backward compatibility purpose. + # All new models should use num_groups=1, otherwise causality is not guaranteed. + if self.num_groups == 1: + x, batch_size = time2batch(x) + return batch2time(self.norm(x), batch_size) + return self.norm(x) + + +def exists(v): + return v is not None + + +def default(*args): + for arg in args: + if exists(arg): + return arg + return None + + +def pack_one(t, pattern): + return pack([t], pattern) + + +def unpack_one(t, ps, pattern): + return unpack(t, ps, pattern)[0] + + +def round_ste(z: torch.Tensor) -> torch.Tensor: + """Round with straight through gradients.""" + zhat = z.round() + return z + (zhat - z).detach() + + +def log(t, eps=1e-5): + return t.clamp(min=eps).log() + + +def entropy(prob): + return (-prob * log(prob)).sum(dim=-1) diff --git a/comfy/ldm/cosmos/model.py b/comfy/ldm/cosmos/model.py new file mode 100644 index 00000000..05dd3846 --- /dev/null +++ b/comfy/ldm/cosmos/model.py @@ -0,0 +1,510 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +""" +A general implementation of adaln-modulated VIT-like~(DiT) transformer for video processing. +""" + +from typing import Optional, Tuple + +import torch +from einops import rearrange +from torch import nn +from torchvision import transforms + +from enum import Enum +import logging + +from comfy.ldm.modules.diffusionmodules.mmdit import RMSNorm + +from .blocks import ( + FinalLayer, + GeneralDITTransformerBlock, + PatchEmbed, + TimestepEmbedding, + Timesteps, +) + +from .position_embedding import LearnablePosEmbAxis, VideoRopePosition3DEmb + + +class DataType(Enum): + IMAGE = "image" + VIDEO = "video" + + +class GeneralDIT(nn.Module): + """ + A general implementation of adaln-modulated VIT-like~(DiT) transformer for video processing. + + Args: + max_img_h (int): Maximum height of the input images. + max_img_w (int): Maximum width of the input images. + max_frames (int): Maximum number of frames in the video sequence. + in_channels (int): Number of input channels (e.g., RGB channels for color images). + out_channels (int): Number of output channels. + patch_spatial (tuple): Spatial resolution of patches for input processing. + patch_temporal (int): Temporal resolution of patches for input processing. + concat_padding_mask (bool): If True, includes a mask channel in the input to handle padding. + block_config (str): Configuration of the transformer block. See Notes for supported block types. + model_channels (int): Base number of channels used throughout the model. + num_blocks (int): Number of transformer blocks. + num_heads (int): Number of heads in the multi-head attention layers. + mlp_ratio (float): Expansion ratio for MLP blocks. + block_x_format (str): Format of input tensor for transformer blocks ('BTHWD' or 'THWBD'). + crossattn_emb_channels (int): Number of embedding channels for cross-attention. + use_cross_attn_mask (bool): Whether to use mask in cross-attention. + pos_emb_cls (str): Type of positional embeddings. + pos_emb_learnable (bool): Whether positional embeddings are learnable. + pos_emb_interpolation (str): Method for interpolating positional embeddings. + affline_emb_norm (bool): Whether to normalize affine embeddings. + use_adaln_lora (bool): Whether to use AdaLN-LoRA. + adaln_lora_dim (int): Dimension for AdaLN-LoRA. + rope_h_extrapolation_ratio (float): Height extrapolation ratio for RoPE. + rope_w_extrapolation_ratio (float): Width extrapolation ratio for RoPE. + rope_t_extrapolation_ratio (float): Temporal extrapolation ratio for RoPE. + extra_per_block_abs_pos_emb (bool): Whether to use extra per-block absolute positional embeddings. + extra_per_block_abs_pos_emb_type (str): Type of extra per-block positional embeddings. + extra_h_extrapolation_ratio (float): Height extrapolation ratio for extra embeddings. + extra_w_extrapolation_ratio (float): Width extrapolation ratio for extra embeddings. + extra_t_extrapolation_ratio (float): Temporal extrapolation ratio for extra embeddings. + + Notes: + Supported block types in block_config: + * cross_attn, ca: Cross attention + * full_attn: Full attention on all flattened tokens + * mlp, ff: Feed forward block + """ + + def __init__( + self, + max_img_h: int, + max_img_w: int, + max_frames: int, + in_channels: int, + out_channels: int, + patch_spatial: tuple, + patch_temporal: int, + concat_padding_mask: bool = True, + # attention settings + block_config: str = "FA-CA-MLP", + model_channels: int = 768, + num_blocks: int = 10, + num_heads: int = 16, + mlp_ratio: float = 4.0, + block_x_format: str = "BTHWD", + # cross attention settings + crossattn_emb_channels: int = 1024, + use_cross_attn_mask: bool = False, + # positional embedding settings + pos_emb_cls: str = "sincos", + pos_emb_learnable: bool = False, + pos_emb_interpolation: str = "crop", + affline_emb_norm: bool = False, # whether or not to normalize the affine embedding + use_adaln_lora: bool = False, + adaln_lora_dim: int = 256, + rope_h_extrapolation_ratio: float = 1.0, + rope_w_extrapolation_ratio: float = 1.0, + rope_t_extrapolation_ratio: float = 1.0, + extra_per_block_abs_pos_emb: bool = False, + extra_per_block_abs_pos_emb_type: str = "sincos", + extra_h_extrapolation_ratio: float = 1.0, + extra_w_extrapolation_ratio: float = 1.0, + extra_t_extrapolation_ratio: float = 1.0, + image_model=None, + device=None, + dtype=None, + operations=None, + ) -> None: + super().__init__() + self.max_img_h = max_img_h + self.max_img_w = max_img_w + self.max_frames = max_frames + self.in_channels = in_channels + self.out_channels = out_channels + self.patch_spatial = patch_spatial + self.patch_temporal = patch_temporal + self.num_heads = num_heads + self.num_blocks = num_blocks + self.model_channels = model_channels + self.use_cross_attn_mask = use_cross_attn_mask + self.concat_padding_mask = concat_padding_mask + # positional embedding settings + self.pos_emb_cls = pos_emb_cls + self.pos_emb_learnable = pos_emb_learnable + self.pos_emb_interpolation = pos_emb_interpolation + self.affline_emb_norm = affline_emb_norm + self.rope_h_extrapolation_ratio = rope_h_extrapolation_ratio + self.rope_w_extrapolation_ratio = rope_w_extrapolation_ratio + self.rope_t_extrapolation_ratio = rope_t_extrapolation_ratio + self.extra_per_block_abs_pos_emb = extra_per_block_abs_pos_emb + self.extra_per_block_abs_pos_emb_type = extra_per_block_abs_pos_emb_type.lower() + self.extra_h_extrapolation_ratio = extra_h_extrapolation_ratio + self.extra_w_extrapolation_ratio = extra_w_extrapolation_ratio + self.extra_t_extrapolation_ratio = extra_t_extrapolation_ratio + self.dtype = dtype + weight_args = {"device": device, "dtype": dtype} + + in_channels = in_channels + 1 if concat_padding_mask else in_channels + self.x_embedder = PatchEmbed( + spatial_patch_size=patch_spatial, + temporal_patch_size=patch_temporal, + in_channels=in_channels, + out_channels=model_channels, + bias=False, + weight_args=weight_args, + operations=operations, + ) + + self.build_pos_embed(device=device) + self.block_x_format = block_x_format + self.use_adaln_lora = use_adaln_lora + self.adaln_lora_dim = adaln_lora_dim + self.t_embedder = nn.ModuleList( + [Timesteps(model_channels), + TimestepEmbedding(model_channels, model_channels, use_adaln_lora=use_adaln_lora, weight_args=weight_args, operations=operations),] + ) + + self.blocks = nn.ModuleDict() + + for idx in range(num_blocks): + self.blocks[f"block{idx}"] = GeneralDITTransformerBlock( + x_dim=model_channels, + context_dim=crossattn_emb_channels, + num_heads=num_heads, + block_config=block_config, + mlp_ratio=mlp_ratio, + x_format=self.block_x_format, + use_adaln_lora=use_adaln_lora, + adaln_lora_dim=adaln_lora_dim, + weight_args=weight_args, + operations=operations, + ) + + if self.affline_emb_norm: + logging.debug("Building affine embedding normalization layer") + self.affline_norm = RMSNorm(model_channels, elementwise_affine=True, eps=1e-6) + else: + self.affline_norm = nn.Identity() + + self.final_layer = FinalLayer( + hidden_size=self.model_channels, + spatial_patch_size=self.patch_spatial, + temporal_patch_size=self.patch_temporal, + out_channels=self.out_channels, + use_adaln_lora=self.use_adaln_lora, + adaln_lora_dim=self.adaln_lora_dim, + weight_args=weight_args, + operations=operations, + ) + + def build_pos_embed(self, device=None): + if self.pos_emb_cls == "rope3d": + cls_type = VideoRopePosition3DEmb + else: + raise ValueError(f"Unknown pos_emb_cls {self.pos_emb_cls}") + + logging.debug(f"Building positional embedding with {self.pos_emb_cls} class, impl {cls_type}") + kwargs = dict( + model_channels=self.model_channels, + len_h=self.max_img_h // self.patch_spatial, + len_w=self.max_img_w // self.patch_spatial, + len_t=self.max_frames // self.patch_temporal, + is_learnable=self.pos_emb_learnable, + interpolation=self.pos_emb_interpolation, + head_dim=self.model_channels // self.num_heads, + h_extrapolation_ratio=self.rope_h_extrapolation_ratio, + w_extrapolation_ratio=self.rope_w_extrapolation_ratio, + t_extrapolation_ratio=self.rope_t_extrapolation_ratio, + device=device, + ) + self.pos_embedder = cls_type( + **kwargs, + ) + + if self.extra_per_block_abs_pos_emb: + assert self.extra_per_block_abs_pos_emb_type in [ + "learnable", + ], f"Unknown extra_per_block_abs_pos_emb_type {self.extra_per_block_abs_pos_emb_type}" + kwargs["h_extrapolation_ratio"] = self.extra_h_extrapolation_ratio + kwargs["w_extrapolation_ratio"] = self.extra_w_extrapolation_ratio + kwargs["t_extrapolation_ratio"] = self.extra_t_extrapolation_ratio + kwargs["device"] = device + self.extra_pos_embedder = LearnablePosEmbAxis( + **kwargs, + ) + + def prepare_embedded_sequence( + self, + x_B_C_T_H_W: torch.Tensor, + fps: Optional[torch.Tensor] = None, + padding_mask: Optional[torch.Tensor] = None, + latent_condition: Optional[torch.Tensor] = None, + latent_condition_sigma: Optional[torch.Tensor] = None, + ) -> Tuple[torch.Tensor, Optional[torch.Tensor]]: + """ + Prepares an embedded sequence tensor by applying positional embeddings and handling padding masks. + + Args: + x_B_C_T_H_W (torch.Tensor): video + fps (Optional[torch.Tensor]): Frames per second tensor to be used for positional embedding when required. + If None, a default value (`self.base_fps`) will be used. + padding_mask (Optional[torch.Tensor]): current it is not used + + Returns: + Tuple[torch.Tensor, Optional[torch.Tensor]]: + - A tensor of shape (B, T, H, W, D) with the embedded sequence. + - An optional positional embedding tensor, returned only if the positional embedding class + (`self.pos_emb_cls`) includes 'rope'. Otherwise, None. + + Notes: + - If `self.concat_padding_mask` is True, a padding mask channel is concatenated to the input tensor. + - The method of applying positional embeddings depends on the value of `self.pos_emb_cls`. + - If 'rope' is in `self.pos_emb_cls` (case insensitive), the positional embeddings are generated using + the `self.pos_embedder` with the shape [T, H, W]. + - If "fps_aware" is in `self.pos_emb_cls`, the positional embeddings are generated using the + `self.pos_embedder` with the fps tensor. + - Otherwise, the positional embeddings are generated without considering fps. + """ + if self.concat_padding_mask: + if padding_mask is not None: + padding_mask = transforms.functional.resize( + padding_mask, list(x_B_C_T_H_W.shape[-2:]), interpolation=transforms.InterpolationMode.NEAREST + ) + else: + padding_mask = torch.zeros((x_B_C_T_H_W.shape[0], 1, x_B_C_T_H_W.shape[-2], x_B_C_T_H_W.shape[-1]), dtype=x_B_C_T_H_W.dtype, device=x_B_C_T_H_W.device) + + x_B_C_T_H_W = torch.cat( + [x_B_C_T_H_W, padding_mask.unsqueeze(1).repeat(1, 1, x_B_C_T_H_W.shape[2], 1, 1)], dim=1 + ) + x_B_T_H_W_D = self.x_embedder(x_B_C_T_H_W) + + if self.extra_per_block_abs_pos_emb: + extra_pos_emb = self.extra_pos_embedder(x_B_T_H_W_D, fps=fps, device=x_B_C_T_H_W.device) + else: + extra_pos_emb = None + + if "rope" in self.pos_emb_cls.lower(): + return x_B_T_H_W_D, self.pos_embedder(x_B_T_H_W_D, fps=fps, device=x_B_C_T_H_W.device), extra_pos_emb + + if "fps_aware" in self.pos_emb_cls: + x_B_T_H_W_D = x_B_T_H_W_D + self.pos_embedder(x_B_T_H_W_D, fps=fps, device=x_B_C_T_H_W.device) # [B, T, H, W, D] + else: + x_B_T_H_W_D = x_B_T_H_W_D + self.pos_embedder(x_B_T_H_W_D, device=x_B_C_T_H_W.device) # [B, T, H, W, D] + + return x_B_T_H_W_D, None, extra_pos_emb + + def decoder_head( + self, + x_B_T_H_W_D: torch.Tensor, + emb_B_D: torch.Tensor, + crossattn_emb: torch.Tensor, + origin_shape: Tuple[int, int, int, int, int], # [B, C, T, H, W] + crossattn_mask: Optional[torch.Tensor] = None, + adaln_lora_B_3D: Optional[torch.Tensor] = None, + ) -> torch.Tensor: + del crossattn_emb, crossattn_mask + B, C, T_before_patchify, H_before_patchify, W_before_patchify = origin_shape + x_BT_HW_D = rearrange(x_B_T_H_W_D, "B T H W D -> (B T) (H W) D") + x_BT_HW_D = self.final_layer(x_BT_HW_D, emb_B_D, adaln_lora_B_3D=adaln_lora_B_3D) + # This is to ensure x_BT_HW_D has the correct shape because + # when we merge T, H, W into one dimension, x_BT_HW_D has shape (B * T * H * W, 1*1, D). + x_BT_HW_D = x_BT_HW_D.view( + B * T_before_patchify // self.patch_temporal, + H_before_patchify // self.patch_spatial * W_before_patchify // self.patch_spatial, + -1, + ) + x_B_D_T_H_W = rearrange( + x_BT_HW_D, + "(B T) (H W) (p1 p2 t C) -> B C (T t) (H p1) (W p2)", + p1=self.patch_spatial, + p2=self.patch_spatial, + H=H_before_patchify // self.patch_spatial, + W=W_before_patchify // self.patch_spatial, + t=self.patch_temporal, + B=B, + ) + return x_B_D_T_H_W + + def forward_before_blocks( + self, + x: torch.Tensor, + timesteps: torch.Tensor, + crossattn_emb: torch.Tensor, + crossattn_mask: Optional[torch.Tensor] = None, + fps: Optional[torch.Tensor] = None, + image_size: Optional[torch.Tensor] = None, + padding_mask: Optional[torch.Tensor] = None, + scalar_feature: Optional[torch.Tensor] = None, + data_type: Optional[DataType] = DataType.VIDEO, + latent_condition: Optional[torch.Tensor] = None, + latent_condition_sigma: Optional[torch.Tensor] = None, + **kwargs, + ) -> torch.Tensor: + """ + Args: + x: (B, C, T, H, W) tensor of spatial-temp inputs + timesteps: (B, ) tensor of timesteps + crossattn_emb: (B, N, D) tensor of cross-attention embeddings + crossattn_mask: (B, N) tensor of cross-attention masks + """ + del kwargs + assert isinstance( + data_type, DataType + ), f"Expected DataType, got {type(data_type)}. We need discuss this flag later." + original_shape = x.shape + x_B_T_H_W_D, rope_emb_L_1_1_D, extra_pos_emb_B_T_H_W_D_or_T_H_W_B_D = self.prepare_embedded_sequence( + x, + fps=fps, + padding_mask=padding_mask, + latent_condition=latent_condition, + latent_condition_sigma=latent_condition_sigma, + ) + # logging affline scale information + affline_scale_log_info = {} + + timesteps_B_D, adaln_lora_B_3D = self.t_embedder[1](self.t_embedder[0](timesteps.flatten()).to(x.dtype)) + affline_emb_B_D = timesteps_B_D + affline_scale_log_info["timesteps_B_D"] = timesteps_B_D.detach() + + if scalar_feature is not None: + raise NotImplementedError("Scalar feature is not implemented yet.") + + affline_scale_log_info["affline_emb_B_D"] = affline_emb_B_D.detach() + affline_emb_B_D = self.affline_norm(affline_emb_B_D) + + if self.use_cross_attn_mask: + if crossattn_mask is not None and not torch.is_floating_point(crossattn_mask): + crossattn_mask = (crossattn_mask - 1).to(x.dtype) * torch.finfo(x.dtype).max + crossattn_mask = crossattn_mask[:, None, None, :] # .to(dtype=torch.bool) # [B, 1, 1, length] + else: + crossattn_mask = None + + if self.blocks["block0"].x_format == "THWBD": + x = rearrange(x_B_T_H_W_D, "B T H W D -> T H W B D") + if extra_pos_emb_B_T_H_W_D_or_T_H_W_B_D is not None: + extra_pos_emb_B_T_H_W_D_or_T_H_W_B_D = rearrange( + extra_pos_emb_B_T_H_W_D_or_T_H_W_B_D, "B T H W D -> T H W B D" + ) + crossattn_emb = rearrange(crossattn_emb, "B M D -> M B D") + + if crossattn_mask: + crossattn_mask = rearrange(crossattn_mask, "B M -> M B") + + elif self.blocks["block0"].x_format == "BTHWD": + x = x_B_T_H_W_D + else: + raise ValueError(f"Unknown x_format {self.blocks[0].x_format}") + output = { + "x": x, + "affline_emb_B_D": affline_emb_B_D, + "crossattn_emb": crossattn_emb, + "crossattn_mask": crossattn_mask, + "rope_emb_L_1_1_D": rope_emb_L_1_1_D, + "adaln_lora_B_3D": adaln_lora_B_3D, + "original_shape": original_shape, + "extra_pos_emb_B_T_H_W_D_or_T_H_W_B_D": extra_pos_emb_B_T_H_W_D_or_T_H_W_B_D, + } + return output + + def forward( + self, + x: torch.Tensor, + timesteps: torch.Tensor, + context: torch.Tensor, + attention_mask: Optional[torch.Tensor] = None, + # crossattn_emb: torch.Tensor, + # crossattn_mask: Optional[torch.Tensor] = None, + fps: Optional[torch.Tensor] = None, + image_size: Optional[torch.Tensor] = None, + padding_mask: Optional[torch.Tensor] = None, + scalar_feature: Optional[torch.Tensor] = None, + data_type: Optional[DataType] = DataType.VIDEO, + latent_condition: Optional[torch.Tensor] = None, + latent_condition_sigma: Optional[torch.Tensor] = None, + condition_video_augment_sigma: Optional[torch.Tensor] = None, + **kwargs, + ): + """ + Args: + x: (B, C, T, H, W) tensor of spatial-temp inputs + timesteps: (B, ) tensor of timesteps + crossattn_emb: (B, N, D) tensor of cross-attention embeddings + crossattn_mask: (B, N) tensor of cross-attention masks + condition_video_augment_sigma: (B,) used in lvg(long video generation), we add noise with this sigma to + augment condition input, the lvg model will condition on the condition_video_augment_sigma value; + we need forward_before_blocks pass to the forward_before_blocks function. + """ + + crossattn_emb = context + crossattn_mask = attention_mask + + inputs = self.forward_before_blocks( + x=x, + timesteps=timesteps, + crossattn_emb=crossattn_emb, + crossattn_mask=crossattn_mask, + fps=fps, + image_size=image_size, + padding_mask=padding_mask, + scalar_feature=scalar_feature, + data_type=data_type, + latent_condition=latent_condition, + latent_condition_sigma=latent_condition_sigma, + condition_video_augment_sigma=condition_video_augment_sigma, + **kwargs, + ) + x, affline_emb_B_D, crossattn_emb, crossattn_mask, rope_emb_L_1_1_D, adaln_lora_B_3D, original_shape = ( + inputs["x"], + inputs["affline_emb_B_D"], + inputs["crossattn_emb"], + inputs["crossattn_mask"], + inputs["rope_emb_L_1_1_D"], + inputs["adaln_lora_B_3D"], + inputs["original_shape"], + ) + extra_pos_emb_B_T_H_W_D_or_T_H_W_B_D = inputs["extra_pos_emb_B_T_H_W_D_or_T_H_W_B_D"].to(x.dtype) + if extra_pos_emb_B_T_H_W_D_or_T_H_W_B_D is not None: + assert ( + x.shape == extra_pos_emb_B_T_H_W_D_or_T_H_W_B_D.shape + ), f"{x.shape} != {extra_pos_emb_B_T_H_W_D_or_T_H_W_B_D.shape} {original_shape}" + + for _, block in self.blocks.items(): + assert ( + self.blocks["block0"].x_format == block.x_format + ), f"First block has x_format {self.blocks[0].x_format}, got {block.x_format}" + + x = block( + x, + affline_emb_B_D, + crossattn_emb, + crossattn_mask, + rope_emb_L_1_1_D=rope_emb_L_1_1_D, + adaln_lora_B_3D=adaln_lora_B_3D, + extra_per_block_pos_emb=extra_pos_emb_B_T_H_W_D_or_T_H_W_B_D, + ) + + x_B_T_H_W_D = rearrange(x, "T H W B D -> B T H W D") + + x_B_D_T_H_W = self.decoder_head( + x_B_T_H_W_D=x_B_T_H_W_D, + emb_B_D=affline_emb_B_D, + crossattn_emb=None, + origin_shape=original_shape, + crossattn_mask=None, + adaln_lora_B_3D=adaln_lora_B_3D, + ) + + return x_B_D_T_H_W diff --git a/comfy/ldm/cosmos/position_embedding.py b/comfy/ldm/cosmos/position_embedding.py new file mode 100644 index 00000000..dda752cb --- /dev/null +++ b/comfy/ldm/cosmos/position_embedding.py @@ -0,0 +1,207 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from typing import List, Optional + +import torch +from einops import rearrange, repeat +from torch import nn +import math + + +def normalize(x: torch.Tensor, dim: Optional[List[int]] = None, eps: float = 0) -> torch.Tensor: + """ + Normalizes the input tensor along specified dimensions such that the average square norm of elements is adjusted. + + Args: + x (torch.Tensor): The input tensor to normalize. + dim (list, optional): The dimensions over which to normalize. If None, normalizes over all dimensions except the first. + eps (float, optional): A small constant to ensure numerical stability during division. + + Returns: + torch.Tensor: The normalized tensor. + """ + if dim is None: + dim = list(range(1, x.ndim)) + norm = torch.linalg.vector_norm(x, dim=dim, keepdim=True, dtype=torch.float32) + norm = torch.add(eps, norm, alpha=math.sqrt(norm.numel() / x.numel())) + return x / norm.to(x.dtype) + + +class VideoPositionEmb(nn.Module): + def forward(self, x_B_T_H_W_C: torch.Tensor, fps=Optional[torch.Tensor], device=None) -> torch.Tensor: + """ + It delegates the embedding generation to generate_embeddings function. + """ + B_T_H_W_C = x_B_T_H_W_C.shape + embeddings = self.generate_embeddings(B_T_H_W_C, fps=fps, device=device) + + return embeddings + + def generate_embeddings(self, B_T_H_W_C: torch.Size, fps=Optional[torch.Tensor], device=None): + raise NotImplementedError + + +class VideoRopePosition3DEmb(VideoPositionEmb): + def __init__( + self, + *, # enforce keyword arguments + head_dim: int, + len_h: int, + len_w: int, + len_t: int, + base_fps: int = 24, + h_extrapolation_ratio: float = 1.0, + w_extrapolation_ratio: float = 1.0, + t_extrapolation_ratio: float = 1.0, + device=None, + **kwargs, # used for compatibility with other positional embeddings; unused in this class + ): + del kwargs + super().__init__() + self.register_buffer("seq", torch.arange(max(len_h, len_w, len_t), dtype=torch.float, device=device)) + self.base_fps = base_fps + self.max_h = len_h + self.max_w = len_w + + dim = head_dim + dim_h = dim // 6 * 2 + dim_w = dim_h + dim_t = dim - 2 * dim_h + assert dim == dim_h + dim_w + dim_t, f"bad dim: {dim} != {dim_h} + {dim_w} + {dim_t}" + self.register_buffer( + "dim_spatial_range", + torch.arange(0, dim_h, 2, device=device)[: (dim_h // 2)].float() / dim_h, + persistent=False, + ) + self.register_buffer( + "dim_temporal_range", + torch.arange(0, dim_t, 2, device=device)[: (dim_t // 2)].float() / dim_t, + persistent=False, + ) + + self.h_ntk_factor = h_extrapolation_ratio ** (dim_h / (dim_h - 2)) + self.w_ntk_factor = w_extrapolation_ratio ** (dim_w / (dim_w - 2)) + self.t_ntk_factor = t_extrapolation_ratio ** (dim_t / (dim_t - 2)) + + def generate_embeddings( + self, + B_T_H_W_C: torch.Size, + fps: Optional[torch.Tensor] = None, + h_ntk_factor: Optional[float] = None, + w_ntk_factor: Optional[float] = None, + t_ntk_factor: Optional[float] = None, + device=None, + ): + """ + Generate embeddings for the given input size. + + Args: + B_T_H_W_C (torch.Size): Input tensor size (Batch, Time, Height, Width, Channels). + fps (Optional[torch.Tensor], optional): Frames per second. Defaults to None. + h_ntk_factor (Optional[float], optional): Height NTK factor. If None, uses self.h_ntk_factor. + w_ntk_factor (Optional[float], optional): Width NTK factor. If None, uses self.w_ntk_factor. + t_ntk_factor (Optional[float], optional): Time NTK factor. If None, uses self.t_ntk_factor. + + Returns: + Not specified in the original code snippet. + """ + h_ntk_factor = h_ntk_factor if h_ntk_factor is not None else self.h_ntk_factor + w_ntk_factor = w_ntk_factor if w_ntk_factor is not None else self.w_ntk_factor + t_ntk_factor = t_ntk_factor if t_ntk_factor is not None else self.t_ntk_factor + + h_theta = 10000.0 * h_ntk_factor + w_theta = 10000.0 * w_ntk_factor + t_theta = 10000.0 * t_ntk_factor + + h_spatial_freqs = 1.0 / (h_theta**self.dim_spatial_range.to(device=device)) + w_spatial_freqs = 1.0 / (w_theta**self.dim_spatial_range.to(device=device)) + temporal_freqs = 1.0 / (t_theta**self.dim_temporal_range.to(device=device)) + + B, T, H, W, _ = B_T_H_W_C + uniform_fps = (fps is None) or isinstance(fps, (int, float)) or (fps.min() == fps.max()) + assert ( + uniform_fps or B == 1 or T == 1 + ), "For video batch, batch size should be 1 for non-uniform fps. For image batch, T should be 1" + assert ( + H <= self.max_h and W <= self.max_w + ), f"Input dimensions (H={H}, W={W}) exceed the maximum dimensions (max_h={self.max_h}, max_w={self.max_w})" + half_emb_h = torch.outer(self.seq[:H].to(device=device), h_spatial_freqs) + half_emb_w = torch.outer(self.seq[:W].to(device=device), w_spatial_freqs) + + # apply sequence scaling in temporal dimension + if fps is None: # image case + half_emb_t = torch.outer(self.seq[:T].to(device=device), temporal_freqs) + else: + half_emb_t = torch.outer(self.seq[:T].to(device=device) / fps * self.base_fps, temporal_freqs) + + half_emb_h = torch.stack([torch.cos(half_emb_h), -torch.sin(half_emb_h), torch.sin(half_emb_h), torch.cos(half_emb_h)], dim=-1) + half_emb_w = torch.stack([torch.cos(half_emb_w), -torch.sin(half_emb_w), torch.sin(half_emb_w), torch.cos(half_emb_w)], dim=-1) + half_emb_t = torch.stack([torch.cos(half_emb_t), -torch.sin(half_emb_t), torch.sin(half_emb_t), torch.cos(half_emb_t)], dim=-1) + + em_T_H_W_D = torch.cat( + [ + repeat(half_emb_t, "t d x -> t h w d x", h=H, w=W), + repeat(half_emb_h, "h d x -> t h w d x", t=T, w=W), + repeat(half_emb_w, "w d x -> t h w d x", t=T, h=H), + ] + , dim=-2, + ) + + return rearrange(em_T_H_W_D, "t h w d (i j) -> (t h w) d i j", i=2, j=2).float() + + +class LearnablePosEmbAxis(VideoPositionEmb): + def __init__( + self, + *, # enforce keyword arguments + interpolation: str, + model_channels: int, + len_h: int, + len_w: int, + len_t: int, + device=None, + **kwargs, + ): + """ + Args: + interpolation (str): we curretly only support "crop", ideally when we need extrapolation capacity, we should adjust frequency or other more advanced methods. they are not implemented yet. + """ + del kwargs # unused + super().__init__() + self.interpolation = interpolation + assert self.interpolation in ["crop"], f"Unknown interpolation method {self.interpolation}" + + self.pos_emb_h = nn.Parameter(torch.empty(len_h, model_channels, device=device)) + self.pos_emb_w = nn.Parameter(torch.empty(len_w, model_channels, device=device)) + self.pos_emb_t = nn.Parameter(torch.empty(len_t, model_channels, device=device)) + + + def generate_embeddings(self, B_T_H_W_C: torch.Size, fps=Optional[torch.Tensor], device=None) -> torch.Tensor: + B, T, H, W, _ = B_T_H_W_C + if self.interpolation == "crop": + emb_h_H = self.pos_emb_h[:H].to(device=device) + emb_w_W = self.pos_emb_w[:W].to(device=device) + emb_t_T = self.pos_emb_t[:T].to(device=device) + emb = ( + repeat(emb_t_T, "t d-> b t h w d", b=B, h=H, w=W) + + repeat(emb_h_H, "h d-> b t h w d", b=B, t=T, w=W) + + repeat(emb_w_W, "w d-> b t h w d", b=B, t=T, h=H) + ) + assert list(emb.shape)[:4] == [B, T, H, W], f"bad shape: {list(emb.shape)[:4]} != {B, T, H, W}" + else: + raise ValueError(f"Unknown interpolation method {self.interpolation}") + + return normalize(emb, dim=-1, eps=1e-6) diff --git a/comfy/ldm/cosmos/vae.py b/comfy/ldm/cosmos/vae.py new file mode 100644 index 00000000..94fcc54c --- /dev/null +++ b/comfy/ldm/cosmos/vae.py @@ -0,0 +1,124 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""The causal continuous video tokenizer with VAE or AE formulation for 3D data..""" + +import logging +import torch +from torch import nn +from enum import Enum + +from .cosmos_tokenizer.layers3d import ( + EncoderFactorized, + DecoderFactorized, + CausalConv3d, +) + + +class IdentityDistribution(torch.nn.Module): + def __init__(self): + super().__init__() + + def forward(self, parameters): + return parameters, (torch.tensor([0.0]), torch.tensor([0.0])) + + +class GaussianDistribution(torch.nn.Module): + def __init__(self, min_logvar: float = -30.0, max_logvar: float = 20.0): + super().__init__() + self.min_logvar = min_logvar + self.max_logvar = max_logvar + + def sample(self, mean, logvar): + std = torch.exp(0.5 * logvar) + return mean + std * torch.randn_like(mean) + + def forward(self, parameters): + mean, logvar = torch.chunk(parameters, 2, dim=1) + logvar = torch.clamp(logvar, self.min_logvar, self.max_logvar) + return self.sample(mean, logvar), (mean, logvar) + + +class ContinuousFormulation(Enum): + VAE = GaussianDistribution + AE = IdentityDistribution + + +class CausalContinuousVideoTokenizer(nn.Module): + def __init__( + self, z_channels: int, z_factor: int, latent_channels: int, **kwargs + ) -> None: + super().__init__() + self.name = kwargs.get("name", "CausalContinuousVideoTokenizer") + self.latent_channels = latent_channels + self.sigma_data = 0.5 + + # encoder_name = kwargs.get("encoder", Encoder3DType.BASE.name) + self.encoder = EncoderFactorized( + z_channels=z_factor * z_channels, **kwargs + ) + if kwargs.get("temporal_compression", 4) == 4: + kwargs["channels_mult"] = [2, 4] + # decoder_name = kwargs.get("decoder", Decoder3DType.BASE.name) + self.decoder = DecoderFactorized( + z_channels=z_channels, **kwargs + ) + + self.quant_conv = CausalConv3d( + z_factor * z_channels, + z_factor * latent_channels, + kernel_size=1, + padding=0, + ) + self.post_quant_conv = CausalConv3d( + latent_channels, z_channels, kernel_size=1, padding=0 + ) + + # formulation_name = kwargs.get("formulation", ContinuousFormulation.AE.name) + self.distribution = IdentityDistribution() # ContinuousFormulation[formulation_name].value() + + num_parameters = sum(param.numel() for param in self.parameters()) + logging.info(f"model={self.name}, num_parameters={num_parameters:,}") + logging.info( + f"z_channels={z_channels}, latent_channels={self.latent_channels}." + ) + + latent_temporal_chunk = 16 + self.latent_mean = nn.Parameter(torch.zeros([self.latent_channels * latent_temporal_chunk], dtype=torch.float32)) + self.latent_std = nn.Parameter(torch.ones([self.latent_channels * latent_temporal_chunk], dtype=torch.float32)) + + + def encode(self, x): + h = self.encoder(x) + moments = self.quant_conv(h) + z, posteriors = self.distribution(moments) + latent_ch = z.shape[1] + latent_t = z.shape[2] + dtype = z.dtype + mean = self.latent_mean.view(latent_ch, -1)[:, : latent_t].reshape([1, latent_ch, -1, 1, 1]).to(dtype=dtype, device=z.device) + std = self.latent_std.view(latent_ch, -1)[:, : latent_t].reshape([1, latent_ch, -1, 1, 1]).to(dtype=dtype, device=z.device) + return ((z - mean) / std) * self.sigma_data + + def decode(self, z): + in_dtype = z.dtype + latent_ch = z.shape[1] + latent_t = z.shape[2] + mean = self.latent_mean.view(latent_ch, -1)[:, : latent_t].reshape([1, latent_ch, -1, 1, 1]).to(dtype=in_dtype, device=z.device) + std = self.latent_std.view(latent_ch, -1)[:, : latent_t].reshape([1, latent_ch, -1, 1, 1]).to(dtype=in_dtype, device=z.device) + + z = z / self.sigma_data + z = z * std + mean + z = self.post_quant_conv(z) + return self.decoder(z) + diff --git a/comfy/model_base.py b/comfy/model_base.py index 141f3f40..a67504cb 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -33,6 +33,7 @@ import comfy.ldm.audio.embedders import comfy.ldm.flux.model import comfy.ldm.lightricks.model import comfy.ldm.hunyuan_video.model +import comfy.ldm.cosmos.model import comfy.model_management import comfy.patcher_extension @@ -856,3 +857,19 @@ class HunyuanVideo(BaseModel): out['c_crossattn'] = comfy.conds.CONDRegular(cross_attn) out['guidance'] = comfy.conds.CONDRegular(torch.FloatTensor([kwargs.get("guidance", 6.0)])) return out + +class CosmosVideo(BaseModel): + def __init__(self, model_config, model_type=ModelType.EDM, device=None): + super().__init__(model_config, model_type, device=device, unet_model=comfy.ldm.cosmos.model.GeneralDIT) + + def extra_conds(self, **kwargs): + out = super().extra_conds(**kwargs) + attention_mask = kwargs.get("attention_mask", None) + if attention_mask is not None: + out['attention_mask'] = comfy.conds.CONDRegular(attention_mask) + cross_attn = kwargs.get("cross_attn", None) + if cross_attn is not None: + out['c_crossattn'] = comfy.conds.CONDRegular(cross_attn) + + out['fps'] = comfy.conds.CONDConstant(kwargs.get("frame_rate", None)) + return out diff --git a/comfy/model_detection.py b/comfy/model_detection.py index f5a33cd9..20cd6bb8 100644 --- a/comfy/model_detection.py +++ b/comfy/model_detection.py @@ -239,6 +239,50 @@ def detect_unet_config(state_dict, key_prefix): dit_config["micro_condition"] = False return dit_config + if '{}blocks.block0.blocks.0.block.attn.to_q.0.weight'.format(key_prefix) in state_dict_keys: + dit_config = {} + dit_config["image_model"] = "cosmos" + dit_config["max_img_h"] = 240 + dit_config["max_img_w"] = 240 + dit_config["max_frames"] = 128 + dit_config["in_channels"] = 16 + dit_config["out_channels"] = 16 + dit_config["patch_spatial"] = 2 + dit_config["patch_temporal"] = 1 + dit_config["model_channels"] = state_dict['{}blocks.block0.blocks.0.block.attn.to_q.0.weight'.format(key_prefix)].shape[0] + dit_config["block_config"] = "FA-CA-MLP" + dit_config["concat_padding_mask"] = True + dit_config["pos_emb_cls"] = "rope3d" + dit_config["pos_emb_learnable"] = False + dit_config["pos_emb_interpolation"] = "crop" + dit_config["block_x_format"] = "THWBD" + dit_config["affline_emb_norm"] = True + dit_config["use_adaln_lora"] = True + dit_config["adaln_lora_dim"] = 256 + + if dit_config["model_channels"] == 4096: + # 7B + dit_config["num_blocks"] = 28 + dit_config["num_heads"] = 32 + dit_config["extra_per_block_abs_pos_emb"] = True + dit_config["rope_h_extrapolation_ratio"] = 1.0 + dit_config["rope_w_extrapolation_ratio"] = 1.0 + dit_config["rope_t_extrapolation_ratio"] = 2.0 + dit_config["extra_per_block_abs_pos_emb_type"] = "learnable" + else: # 5120 + # 14B + dit_config["num_blocks"] = 36 + dit_config["num_heads"] = 40 + dit_config["extra_per_block_abs_pos_emb"] = True + dit_config["rope_h_extrapolation_ratio"] = 2.0 + dit_config["rope_w_extrapolation_ratio"] = 2.0 + dit_config["rope_t_extrapolation_ratio"] = 2.0 + dit_config["extra_h_extrapolation_ratio"] = 2.0 + dit_config["extra_w_extrapolation_ratio"] = 2.0 + dit_config["extra_t_extrapolation_ratio"] = 2.0 + dit_config["extra_per_block_abs_pos_emb_type"] = "learnable" + return dit_config + if '{}input_blocks.0.0.weight'.format(key_prefix) not in state_dict_keys: return None @@ -393,6 +437,7 @@ def model_config_from_unet(state_dict, unet_key_prefix, use_base_if_no_match=Fal def unet_prefix_from_state_dict(state_dict): candidates = ["model.diffusion_model.", #ldm/sgm models "model.model.", #audio models + "net.", #cosmos ] counts = {k: 0 for k in candidates} for k in state_dict: diff --git a/comfy/sd.py b/comfy/sd.py index f3c65f9e..7db1c2d6 100644 --- a/comfy/sd.py +++ b/comfy/sd.py @@ -11,6 +11,7 @@ from .ldm.cascade.stage_c_coder import StageC_coder from .ldm.audio.autoencoder import AudioOobleckVAE import comfy.ldm.genmo.vae.model import comfy.ldm.lightricks.vae.causal_video_autoencoder +import comfy.ldm.cosmos.vae import yaml import math @@ -34,6 +35,7 @@ import comfy.text_encoders.long_clipl import comfy.text_encoders.genmo import comfy.text_encoders.lt import comfy.text_encoders.hunyuan_video +import comfy.text_encoders.cosmos import comfy.model_patcher import comfy.lora @@ -376,6 +378,19 @@ class VAE: self.memory_used_decode = lambda shape, dtype: (1500 * shape[2] * shape[3] * shape[4] * (4 * 8 * 8)) * model_management.dtype_size(dtype) self.memory_used_encode = lambda shape, dtype: (900 * max(shape[2], 2) * shape[3] * shape[4]) * model_management.dtype_size(dtype) self.working_dtypes = [torch.bfloat16, torch.float16, torch.float32] + elif "decoder.unpatcher3d.wavelets" in sd: + self.upscale_ratio = (lambda a: max(0, a * 8 - 7), 8, 8) + self.upscale_index_formula = (8, 8, 8) + self.downscale_ratio = (lambda a: max(0, math.floor((a + 7) / 8)), 8, 8) + self.downscale_index_formula = (8, 8, 8) + self.latent_dim = 3 + self.latent_channels = 16 + ddconfig = {'z_channels': 16, 'latent_channels': self.latent_channels, 'z_factor': 1, 'resolution': 1024, 'in_channels': 3, 'out_channels': 3, 'channels': 128, 'channels_mult': [2, 4, 4], 'num_res_blocks': 2, 'attn_resolutions': [32], 'dropout': 0.0, 'patch_size': 4, 'num_groups': 1, 'temporal_compression': 8, 'spacial_compression': 8} + self.first_stage_model = comfy.ldm.cosmos.vae.CausalContinuousVideoTokenizer(**ddconfig) + #TODO: these values are a bit off because this is not a standard VAE + self.memory_used_decode = lambda shape, dtype: (220 * shape[2] * shape[3] * shape[4] * (8 * 8 * 8)) * model_management.dtype_size(dtype) + self.memory_used_encode = lambda shape, dtype: (500 * max(shape[2], 2) * shape[3] * shape[4]) * model_management.dtype_size(dtype) + self.working_dtypes = [torch.bfloat16, torch.float32] else: logging.warning("WARNING: No VAE weights detected, VAE not initalized.") self.first_stage_model = None @@ -641,6 +656,7 @@ class CLIPType(Enum): LTXV = 8 HUNYUAN_VIDEO = 9 PIXART = 10 + COSMOS = 11 def load_clip(ckpt_paths, embedding_directory=None, clip_type=CLIPType.STABLE_DIFFUSION, model_options={}): @@ -658,6 +674,7 @@ class TEModel(Enum): T5_XL = 5 T5_BASE = 6 LLAMA3_8 = 7 + T5_XXL_OLD = 8 def detect_te_model(sd): if "text_model.encoder.layers.30.mlp.fc1.weight" in sd: @@ -672,6 +689,8 @@ def detect_te_model(sd): return TEModel.T5_XXL elif weight.shape[-1] == 2048: return TEModel.T5_XL + if 'encoder.block.23.layer.1.DenseReluDense.wi.weight' in sd: + return TEModel.T5_XXL_OLD if "encoder.block.0.layer.0.SelfAttention.k.weight" in sd: return TEModel.T5_BASE if "model.layers.0.post_attention_layernorm.weight" in sd: @@ -681,9 +700,10 @@ def detect_te_model(sd): def t5xxl_detect(clip_data): weight_name = "encoder.block.23.layer.1.DenseReluDense.wi_1.weight" + weight_name_old = "encoder.block.23.layer.1.DenseReluDense.wi.weight" for sd in clip_data: - if weight_name in sd: + if weight_name in sd or weight_name_old in sd: return comfy.text_encoders.sd3_clip.t5_xxl_detect(sd) return {} @@ -740,6 +760,9 @@ def load_text_encoder_state_dicts(state_dicts=[], embedding_directory=None, clip else: #CLIPType.MOCHI clip_target.clip = comfy.text_encoders.genmo.mochi_te(**t5xxl_detect(clip_data)) clip_target.tokenizer = comfy.text_encoders.genmo.MochiT5Tokenizer + elif te_model == TEModel.T5_XXL_OLD: + clip_target.clip = comfy.text_encoders.cosmos.te(**t5xxl_detect(clip_data)) + clip_target.tokenizer = comfy.text_encoders.cosmos.CosmosT5Tokenizer elif te_model == TEModel.T5_XL: clip_target.clip = comfy.text_encoders.aura_t5.AuraT5Model clip_target.tokenizer = comfy.text_encoders.aura_t5.AuraT5Tokenizer diff --git a/comfy/supported_models.py b/comfy/supported_models.py index 6a2cc75a..31de1ae9 100644 --- a/comfy/supported_models.py +++ b/comfy/supported_models.py @@ -14,6 +14,7 @@ import comfy.text_encoders.flux import comfy.text_encoders.genmo import comfy.text_encoders.lt import comfy.text_encoders.hunyuan_video +import comfy.text_encoders.cosmos from . import supported_models_base from . import latent_formats @@ -823,6 +824,37 @@ class HunyuanVideo(supported_models_base.BASE): hunyuan_detect = comfy.text_encoders.hunyuan_video.llama_detect(state_dict, "{}llama.transformer.".format(pref)) return supported_models_base.ClipTarget(comfy.text_encoders.hunyuan_video.HunyuanVideoTokenizer, comfy.text_encoders.hunyuan_video.hunyuan_video_clip(**hunyuan_detect)) -models = [Stable_Zero123, SD15_instructpix2pix, SD15, SD20, SD21UnclipL, SD21UnclipH, SDXL_instructpix2pix, SDXLRefiner, SDXL, SSD1B, KOALA_700M, KOALA_1B, Segmind_Vega, SD_X4Upscaler, Stable_Cascade_C, Stable_Cascade_B, SV3D_u, SV3D_p, SD3, StableAudio, AuraFlow, PixArtAlpha, PixArtSigma, HunyuanDiT, HunyuanDiT1, FluxInpaint, Flux, FluxSchnell, GenmoMochi, LTXV, HunyuanVideo] +class Cosmos(supported_models_base.BASE): + unet_config = { + "image_model": "cosmos", + } + + sampling_settings = { + "sigma_data": 0.5, + "sigma_max": 80.0, + "sigma_min": 0.002, + } + + unet_extra_config = {} + latent_format = latent_formats.Cosmos1CV8x8x8 + + memory_usage_factor = 2.4 #TODO + + supported_inference_dtypes = [torch.bfloat16, torch.float16, torch.float32] #TODO + + vae_key_prefix = ["vae."] + text_encoder_key_prefix = ["text_encoders."] + + def get_model(self, state_dict, prefix="", device=None): + out = model_base.CosmosVideo(self, device=device) + return out + + def clip_target(self, state_dict={}): + pref = self.text_encoder_key_prefix[0] + t5_detect = comfy.text_encoders.sd3_clip.t5_xxl_detect(state_dict, "{}t5xxl.transformer.".format(pref)) + return supported_models_base.ClipTarget(comfy.text_encoders.cosmos.CosmosT5Tokenizer, comfy.text_encoders.cosmos.te(**t5_detect)) + + +models = [Stable_Zero123, SD15_instructpix2pix, SD15, SD20, SD21UnclipL, SD21UnclipH, SDXL_instructpix2pix, SDXLRefiner, SDXL, SSD1B, KOALA_700M, KOALA_1B, Segmind_Vega, SD_X4Upscaler, Stable_Cascade_C, Stable_Cascade_B, SV3D_u, SV3D_p, SD3, StableAudio, AuraFlow, PixArtAlpha, PixArtSigma, HunyuanDiT, HunyuanDiT1, FluxInpaint, Flux, FluxSchnell, GenmoMochi, LTXV, HunyuanVideo, Cosmos] models += [SVD_img2vid] diff --git a/comfy/text_encoders/cosmos.py b/comfy/text_encoders/cosmos.py new file mode 100644 index 00000000..5441c895 --- /dev/null +++ b/comfy/text_encoders/cosmos.py @@ -0,0 +1,42 @@ +from comfy import sd1_clip +import comfy.text_encoders.t5 +import os +from transformers import T5TokenizerFast + + +class T5XXLModel(sd1_clip.SDClipModel): + def __init__(self, device="cpu", layer="last", layer_idx=None, dtype=None, attention_mask=True, model_options={}): + textmodel_json_config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "t5_old_config_xxl.json") + t5xxl_scaled_fp8 = model_options.get("t5xxl_scaled_fp8", None) + if t5xxl_scaled_fp8 is not None: + model_options = model_options.copy() + model_options["scaled_fp8"] = t5xxl_scaled_fp8 + + super().__init__(device=device, layer=layer, layer_idx=layer_idx, textmodel_json_config=textmodel_json_config, dtype=dtype, special_tokens={"end": 1, "pad": 0}, model_class=comfy.text_encoders.t5.T5, enable_attention_masks=attention_mask, return_attention_masks=attention_mask, zero_out_masked=attention_mask, model_options=model_options) + +class CosmosT5XXL(sd1_clip.SD1ClipModel): + def __init__(self, device="cpu", dtype=None, model_options={}): + super().__init__(device=device, dtype=dtype, name="t5xxl", clip_model=T5XXLModel, model_options=model_options) + + +class T5XXLTokenizer(sd1_clip.SDTokenizer): + def __init__(self, embedding_directory=None, tokenizer_data={}): + tokenizer_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "t5_tokenizer") + super().__init__(tokenizer_path, embedding_directory=embedding_directory, pad_with_end=False, embedding_size=1024, embedding_key='t5xxl', tokenizer_class=T5TokenizerFast, has_start_token=False, pad_to_max_length=False, max_length=99999999, min_length=512) + + +class CosmosT5Tokenizer(sd1_clip.SD1Tokenizer): + def __init__(self, embedding_directory=None, tokenizer_data={}): + super().__init__(embedding_directory=embedding_directory, tokenizer_data=tokenizer_data, clip_name="t5xxl", tokenizer=T5XXLTokenizer) + + +def te(dtype_t5=None, t5xxl_scaled_fp8=None): + class CosmosTEModel_(CosmosT5XXL): + def __init__(self, device="cpu", dtype=None, model_options={}): + if t5xxl_scaled_fp8 is not None and "t5xxl_scaled_fp8" not in model_options: + model_options = model_options.copy() + model_options["t5xxl_scaled_fp8"] = t5xxl_scaled_fp8 + if dtype is None: + dtype = dtype_t5 + super().__init__(device=device, dtype=dtype, model_options=model_options) + return CosmosTEModel_ diff --git a/comfy/text_encoders/t5_old_config_xxl.json b/comfy/text_encoders/t5_old_config_xxl.json new file mode 100644 index 00000000..c9fdd778 --- /dev/null +++ b/comfy/text_encoders/t5_old_config_xxl.json @@ -0,0 +1,22 @@ +{ + "d_ff": 65536, + "d_kv": 128, + "d_model": 1024, + "decoder_start_token_id": 0, + "dropout_rate": 0.1, + "eos_token_id": 1, + "dense_act_fn": "relu", + "initializer_factor": 1.0, + "is_encoder_decoder": true, + "is_gated_act": false, + "layer_norm_epsilon": 1e-06, + "model_type": "t5", + "num_decoder_layers": 24, + "num_heads": 128, + "num_layers": 24, + "output_past": true, + "pad_token_id": 0, + "relative_attention_num_buckets": 32, + "tie_word_embeddings": false, + "vocab_size": 32128 +} diff --git a/comfy_extras/nodes_cosmos.py b/comfy_extras/nodes_cosmos.py new file mode 100644 index 00000000..d88773e2 --- /dev/null +++ b/comfy_extras/nodes_cosmos.py @@ -0,0 +1,23 @@ +import nodes +import torch +import comfy.model_management + +class EmptyCosmosLatentVideo: + @classmethod + def INPUT_TYPES(s): + return {"required": { "width": ("INT", {"default": 1280, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}), + "height": ("INT", {"default": 704, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}), + "length": ("INT", {"default": 121, "min": 1, "max": nodes.MAX_RESOLUTION, "step": 8}), + "batch_size": ("INT", {"default": 1, "min": 1, "max": 4096})}} + RETURN_TYPES = ("LATENT",) + FUNCTION = "generate" + + CATEGORY = "latent/video" + + def generate(self, width, height, length, batch_size=1): + latent = torch.zeros([batch_size, 16, ((length - 1) // 8) + 1, height // 8, width // 8], device=comfy.model_management.intermediate_device()) + return ({"samples":latent}, ) + +NODE_CLASS_MAPPINGS = { + "EmptyCosmosLatentVideo": EmptyCosmosLatentVideo, +} diff --git a/nodes.py b/nodes.py index 1b796ced..cfd7dd8a 100644 --- a/nodes.py +++ b/nodes.py @@ -912,7 +912,7 @@ class CLIPLoader: @classmethod def INPUT_TYPES(s): return {"required": { "clip_name": (folder_paths.get_filename_list("text_encoders"), ), - "type": (["stable_diffusion", "stable_cascade", "sd3", "stable_audio", "mochi", "ltxv", "pixart"], ), + "type": (["stable_diffusion", "stable_cascade", "sd3", "stable_audio", "mochi", "ltxv", "pixart", "cosmos"], ), }, "optional": { "device": (["default", "cpu"], {"advanced": True}), @@ -922,7 +922,7 @@ class CLIPLoader: CATEGORY = "advanced/loaders" - DESCRIPTION = "[Recipes]\n\nstable_diffusion: clip-l\nstable_cascade: clip-g\nsd3: t5 / clip-g / clip-l\nstable_audio: t5\nmochi: t5" + DESCRIPTION = "[Recipes]\n\nstable_diffusion: clip-l\nstable_cascade: clip-g\nsd3: t5 / clip-g / clip-l\nstable_audio: t5\nmochi: t5\ncosmos: old t5 xxl" def load_clip(self, clip_name, type="stable_diffusion", device="default"): if type == "stable_cascade": @@ -2225,6 +2225,7 @@ def init_builtin_extra_nodes(): "nodes_lt.py", "nodes_hooks.py", "nodes_load_3d.py", + "nodes_cosmos.py", ] import_failed = [] From adea2beb5c6d0dd1c96d4a7c3de0d391c2c94220 Mon Sep 17 00:00:00 2001 From: comfyanonymous <comfyanonymous@protonmail.com> Date: Sat, 11 Jan 2025 02:18:42 -0500 Subject: [PATCH 10/47] Add edm option to ModelSamplingContinuousEDM for Cosmos. You can now use this node with "edm" selected to control the sigma_max and sigma_min of the Cosmos model sampling. --- comfy_extras/nodes_model_advanced.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/comfy_extras/nodes_model_advanced.py b/comfy_extras/nodes_model_advanced.py index 285dbf53..33f3face 100644 --- a/comfy_extras/nodes_model_advanced.py +++ b/comfy_extras/nodes_model_advanced.py @@ -189,7 +189,7 @@ class ModelSamplingContinuousEDM: @classmethod def INPUT_TYPES(s): return {"required": { "model": ("MODEL",), - "sampling": (["v_prediction", "edm_playground_v2.5", "eps"],), + "sampling": (["v_prediction", "edm", "edm_playground_v2.5", "eps"],), "sigma_max": ("FLOAT", {"default": 120.0, "min": 0.0, "max": 1000.0, "step":0.001, "round": False}), "sigma_min": ("FLOAT", {"default": 0.002, "min": 0.0, "max": 1000.0, "step":0.001, "round": False}), }} @@ -206,6 +206,9 @@ class ModelSamplingContinuousEDM: sigma_data = 1.0 if sampling == "eps": sampling_type = comfy.model_sampling.EPS + elif sampling == "edm": + sampling_type = comfy.model_sampling.EDM + sigma_data = 0.5 elif sampling == "v_prediction": sampling_type = comfy.model_sampling.V_PREDICTION elif sampling == "edm_playground_v2.5": From 9c773a241b446c7abb0cfabe1d292746251fed73 Mon Sep 17 00:00:00 2001 From: Chenlei Hu <chenlei.hu@mail.utoronto.ca> Date: Sat, 11 Jan 2025 03:09:25 -0500 Subject: [PATCH 11/47] Add pyproject.toml (#6386) * Add pyproject.toml * doc * Static version file * Add github action to sync version.py * Change trigger to PR * Fix commit * Grant pr write permission * nit * nit * Don't run on fork PRs * Rename version.py to comfyui_version.py --- .github/workflows/update-version.yml | 58 ++++++++++++++++++++++++++++ comfyui_version.py | 3 ++ pyproject.toml | 11 ++++++ server.py | 18 +-------- 4 files changed, 74 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/update-version.yml create mode 100644 comfyui_version.py create mode 100644 pyproject.toml diff --git a/.github/workflows/update-version.yml b/.github/workflows/update-version.yml new file mode 100644 index 00000000..d9d48897 --- /dev/null +++ b/.github/workflows/update-version.yml @@ -0,0 +1,58 @@ +name: Update Version File + +on: + pull_request: + paths: + - "pyproject.toml" + branches: + - master + +jobs: + update-version: + runs-on: ubuntu-latest + # Don't run on fork PRs + if: github.event.pull_request.head.repo.full_name == github.repository + permissions: + pull-requests: write + contents: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.11" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + + - name: Update comfyui_version.py + run: | + # Read version from pyproject.toml and update comfyui_version.py + python -c ' + import tomllib + + # Read version from pyproject.toml + with open("pyproject.toml", "rb") as f: + config = tomllib.load(f) + version = config["project"]["version"] + + # Write version to comfyui_version.py + with open("comfyui_version.py", "w") as f: + f.write("# This file is automatically generated by the build process when version is\n") + f.write("# updated in pyproject.toml.\n") + f.write(f"__version__ = \"{version}\"\n") + ' + + - name: Commit changes + run: | + git config --local user.name "github-actions" + git config --local user.email "github-actions@github.com" + git fetch origin ${{ github.head_ref }} + git checkout -B ${{ github.head_ref }} origin/${{ github.head_ref }} + git add comfyui_version.py + git diff --quiet && git diff --staged --quiet || git commit -m "chore: Update comfyui_version.py to match pyproject.toml" + git push origin HEAD:${{ github.head_ref }} diff --git a/comfyui_version.py b/comfyui_version.py new file mode 100644 index 00000000..7cccc753 --- /dev/null +++ b/comfyui_version.py @@ -0,0 +1,3 @@ +# This file is automatically generated by the build process when version is +# updated in pyproject.toml. +__version__ = "0.3.10" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..1d9d7b3f --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,11 @@ +[project] +name = "ComfyUI" +version = "0.3.10" +readme = "README.md" +license = { file = "LICENSE" } +requires-python = ">=3.9" + +[project.urls] +homepage = "https://www.comfy.org/" +repository = "https://github.com/comfyanonymous/ComfyUI" +documentation = "https://docs.comfy.org/" diff --git a/server.py b/server.py index ceb5e83b..bae898ef 100644 --- a/server.py +++ b/server.py @@ -27,6 +27,7 @@ from comfy.cli_args import args import comfy.utils import comfy.model_management import node_helpers +from comfyui_version import __version__ from app.frontend_management import FrontendManager from app.user_manager import UserManager from app.model_manager import ModelFileManager @@ -44,21 +45,6 @@ async def send_socket_catch_exception(function, message): except (aiohttp.ClientError, aiohttp.ClientPayloadError, ConnectionResetError, BrokenPipeError, ConnectionError) as err: logging.warning("send error: {}".format(err)) -def get_comfyui_version(): - comfyui_version = "unknown" - repo_path = os.path.dirname(os.path.realpath(__file__)) - try: - import pygit2 - repo = pygit2.Repository(repo_path) - comfyui_version = repo.describe(describe_strategy=pygit2.GIT_DESCRIBE_TAGS) - except Exception: - try: - import subprocess - comfyui_version = subprocess.check_output(["git", "describe", "--tags"], cwd=repo_path).decode('utf-8') - except Exception as e: - logging.warning(f"Failed to get ComfyUI version: {e}") - return comfyui_version.strip() - @web.middleware async def cache_control(request: web.Request, handler): response: web.Response = await handler(request) @@ -518,7 +504,7 @@ class PromptServer(): "os": os.name, "ram_total": ram_total, "ram_free": ram_free, - "comfyui_version": get_comfyui_version(), + "comfyui_version": __version__, "python_version": sys.version, "pytorch_version": comfy.model_management.torch_version, "embedded_python": os.path.split(os.path.split(sys.executable)[0])[1] == "python_embeded", From ee8a7ab69d28b86285acd1b3779dd533e5b8cf6d Mon Sep 17 00:00:00 2001 From: comfyanonymous <comfyanonymous@protonmail.com> Date: Sat, 11 Jan 2025 04:40:45 -0500 Subject: [PATCH 12/47] Fast latent preview for Cosmos. --- comfy/latent_formats.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/comfy/latent_formats.py b/comfy/latent_formats.py index 9e6dfc17..e98982c9 100644 --- a/comfy/latent_formats.py +++ b/comfy/latent_formats.py @@ -386,3 +386,24 @@ class HunyuanVideo(LatentFormat): class Cosmos1CV8x8x8(LatentFormat): latent_channels = 16 latent_dimensions = 3 + + latent_rgb_factors = [ + [ 0.1817, 0.2284, 0.2423], + [-0.0586, -0.0862, -0.3108], + [-0.4703, -0.4255, -0.3995], + [ 0.0803, 0.1963, 0.1001], + [-0.0820, -0.1050, 0.0400], + [ 0.2511, 0.3098, 0.2787], + [-0.1830, -0.2117, -0.0040], + [-0.0621, -0.2187, -0.0939], + [ 0.3619, 0.1082, 0.1455], + [ 0.3164, 0.3922, 0.2575], + [ 0.1152, 0.0231, -0.0462], + [-0.1434, -0.3609, -0.3665], + [ 0.0635, 0.1471, 0.1680], + [-0.3635, -0.1963, -0.3248], + [-0.1865, 0.0365, 0.2346], + [ 0.0447, 0.0994, 0.0881] + ] + + latent_rgb_factors_bias = [-0.1223, -0.1889, -0.1976] From 6c9bd11fa3445ed78381cea8ad48ffc95ea49d72 Mon Sep 17 00:00:00 2001 From: Jedrzej Kosinski <kosinkadink1@gmail.com> Date: Sat, 11 Jan 2025 11:20:23 -0600 Subject: [PATCH 13/47] Hooks Part 2 - TransformerOptionsHook and AdditionalModelsHook (#6377) * Add 'sigmas' to transformer_options so that downstream code can know about the full scope of current sampling run, fix Hook Keyframes' guarantee_steps=1 inconsistent behavior with sampling split across different Sampling nodes/sampling runs by referencing 'sigmas' * Cleaned up hooks.py, refactored Hook.should_register and add_hook_patches to use target_dict instead of target so that more information can be provided about the current execution environment if needed * Refactor WrapperHook into TransformerOptionsHook, as there is no need to separate out Wrappers/Callbacks/Patches into different hook types (all affect transformer_options) * Refactored HookGroup to also store a dictionary of hooks separated by hook_type, modified necessary code to no longer need to manually separate out hooks by hook_type * In inner_sample, change "sigmas" to "sampler_sigmas" in transformer_options to not conflict with the "sigmas" that will overwrite "sigmas" in _calc_cond_batch * Refactored 'registered' to be HookGroup instead of a list of Hooks, made AddModelsHook operational and compliant with should_register result, moved TransformerOptionsHook handling out of ModelPatcher.register_all_hook_patches, support patches in TransformerOptionsHook properly by casting any patches/wrappers/hooks to proper device at sample time * Made hook clone code sane, made clear ObjectPatchHook and SetInjectionsHook are not yet operational * Fix performance of hooks when hooks are appended via Cond Pair Set Props nodes by properly caching between positive and negative conds, make hook_patches_backup behave as intended (in the case that something pre-registers WeightHooks on the ModelPatcher instead of registering it at sample time) * Filter only registered hooks on self.conds in CFGGuider.sample * Make hook_scope functional for TransformerOptionsHook * removed 4 whitespace lines to satisfy Ruff, * Add a get_injections function to ModelPatcher * Made TransformerOptionsHook contribute to registered hooks properly, added some doc strings and removed a so-far unused variable * Rename AddModelsHooks to AdditionalModelsHook, rename SetInjectionsHook to InjectionsHook (not yet implemented, but at least getting the naming figured out) * Clean up a typehint --- comfy/hooks.py | 395 ++++++++++++++++++++++-------------- comfy/model_patcher.py | 34 ++-- comfy/sampler_helpers.py | 60 ++++-- comfy/samplers.py | 85 +++++++- comfy_extras/nodes_hooks.py | 4 +- 5 files changed, 385 insertions(+), 193 deletions(-) diff --git a/comfy/hooks.py b/comfy/hooks.py index 3cb0f396..9d073107 100644 --- a/comfy/hooks.py +++ b/comfy/hooks.py @@ -16,91 +16,132 @@ import comfy.model_management import comfy.patcher_extension from node_helpers import conditioning_set_values +# ####################################################################################################### +# Hooks explanation +# ------------------- +# The purpose of hooks is to allow conds to influence sampling without the need for ComfyUI core code to +# make explicit special cases like it does for ControlNet and GLIGEN. +# +# This is necessary for nodes/features that are intended for use with masked or scheduled conds, or those +# that should run special code when a 'marked' cond is used in sampling. +# ####################################################################################################### + class EnumHookMode(enum.Enum): + ''' + Priority of hook memory optimization vs. speed, mostly related to WeightHooks. + + MinVram: No caching will occur for any operations related to hooks. + MaxSpeed: Excess VRAM (and RAM, once VRAM is sufficiently depleted) will be used to cache hook weights when switching hook groups. + ''' MinVram = "minvram" MaxSpeed = "maxspeed" class EnumHookType(enum.Enum): + ''' + Hook types, each of which has different expected behavior. + ''' Weight = "weight" - Patch = "patch" ObjectPatch = "object_patch" - AddModels = "add_models" - Callbacks = "callbacks" - Wrappers = "wrappers" - SetInjections = "add_injections" + AdditionalModels = "add_models" + TransformerOptions = "transformer_options" + Injections = "add_injections" class EnumWeightTarget(enum.Enum): Model = "model" Clip = "clip" +class EnumHookScope(enum.Enum): + ''' + Determines if hook should be limited in its influence over sampling. + + AllConditioning: hook will affect all conds used in sampling. + HookedOnly: hook will only affect the conds it was attached to. + ''' + AllConditioning = "all_conditioning" + HookedOnly = "hooked_only" + + class _HookRef: pass -# NOTE: this is an example of how the should_register function should look -def default_should_register(hook: 'Hook', model: 'ModelPatcher', model_options: dict, target: EnumWeightTarget, registered: list[Hook]): + +def default_should_register(hook: Hook, model: ModelPatcher, model_options: dict, target_dict: dict[str], registered: HookGroup): + '''Example for how custom_should_register function can look like.''' return True +def create_target_dict(target: EnumWeightTarget=None, **kwargs) -> dict[str]: + '''Creates base dictionary for use with Hooks' target param.''' + d = {} + if target is not None: + d['target'] = target + d.update(kwargs) + return d + + class Hook: def __init__(self, hook_type: EnumHookType=None, hook_ref: _HookRef=None, hook_id: str=None, - hook_keyframe: 'HookKeyframeGroup'=None): + hook_keyframe: HookKeyframeGroup=None, hook_scope=EnumHookScope.AllConditioning): self.hook_type = hook_type + '''Enum identifying the general class of this hook.''' self.hook_ref = hook_ref if hook_ref else _HookRef() + '''Reference shared between hook clones that have the same value. Should NOT be modified.''' self.hook_id = hook_id + '''Optional string ID to identify hook; useful if need to consolidate duplicates at registration time.''' self.hook_keyframe = hook_keyframe if hook_keyframe else HookKeyframeGroup() + '''Keyframe storage that can be referenced to get strength for current sampling step.''' + self.hook_scope = hook_scope + '''Scope of where this hook should apply in terms of the conds used in sampling run.''' self.custom_should_register = default_should_register - self.auto_apply_to_nonpositive = False + '''Can be overriden with a compatible function to decide if this hook should be registered without the need to override .should_register''' @property def strength(self): return self.hook_keyframe.strength - def initialize_timesteps(self, model: 'BaseModel'): + def initialize_timesteps(self, model: BaseModel): self.reset() self.hook_keyframe.initialize_timesteps(model) def reset(self): self.hook_keyframe.reset() - def clone(self, subtype: Callable=None): - if subtype is None: - subtype = type(self) - c: Hook = subtype() + def clone(self): + c: Hook = self.__class__() c.hook_type = self.hook_type c.hook_ref = self.hook_ref c.hook_id = self.hook_id c.hook_keyframe = self.hook_keyframe + c.hook_scope = self.hook_scope c.custom_should_register = self.custom_should_register - # TODO: make this do something - c.auto_apply_to_nonpositive = self.auto_apply_to_nonpositive return c - def should_register(self, model: 'ModelPatcher', model_options: dict, target: EnumWeightTarget, registered: list[Hook]): - return self.custom_should_register(self, model, model_options, target, registered) + def should_register(self, model: ModelPatcher, model_options: dict, target_dict: dict[str], registered: HookGroup): + return self.custom_should_register(self, model, model_options, target_dict, registered) - def add_hook_patches(self, model: 'ModelPatcher', model_options: dict, target: EnumWeightTarget, registered: list[Hook]): + def add_hook_patches(self, model: ModelPatcher, model_options: dict, target_dict: dict[str], registered: HookGroup): raise NotImplementedError("add_hook_patches should be defined for Hook subclasses") - def on_apply(self, model: 'ModelPatcher', transformer_options: dict[str]): - pass - - def on_unapply(self, model: 'ModelPatcher', transformer_options: dict[str]): - pass - - def __eq__(self, other: 'Hook'): + def __eq__(self, other: Hook): return self.__class__ == other.__class__ and self.hook_ref == other.hook_ref def __hash__(self): return hash(self.hook_ref) class WeightHook(Hook): + ''' + Hook responsible for tracking weights to be applied to some model/clip. + + Note, value of hook_scope is ignored and is treated as HookedOnly. + ''' def __init__(self, strength_model=1.0, strength_clip=1.0): - super().__init__(hook_type=EnumHookType.Weight) + super().__init__(hook_type=EnumHookType.Weight, hook_scope=EnumHookScope.HookedOnly) self.weights: dict = None self.weights_clip: dict = None self.need_weight_init = True self._strength_model = strength_model self._strength_clip = strength_clip + self.hook_scope = EnumHookScope.HookedOnly # this value does not matter for WeightHooks, just for docs @property def strength_model(self): @@ -110,36 +151,36 @@ class WeightHook(Hook): def strength_clip(self): return self._strength_clip * self.strength - def add_hook_patches(self, model: 'ModelPatcher', model_options: dict, target: EnumWeightTarget, registered: list[Hook]): - if not self.should_register(model, model_options, target, registered): + def add_hook_patches(self, model: ModelPatcher, model_options: dict, target_dict: dict[str], registered: HookGroup): + if not self.should_register(model, model_options, target_dict, registered): return False weights = None - if target == EnumWeightTarget.Model: - strength = self._strength_model - else: + + target = target_dict.get('target', None) + if target == EnumWeightTarget.Clip: strength = self._strength_clip + else: + strength = self._strength_model if self.need_weight_init: key_map = {} - if target == EnumWeightTarget.Model: - key_map = comfy.lora.model_lora_keys_unet(model.model, key_map) - else: + if target == EnumWeightTarget.Clip: key_map = comfy.lora.model_lora_keys_clip(model.model, key_map) + else: + key_map = comfy.lora.model_lora_keys_unet(model.model, key_map) weights = comfy.lora.load_lora(self.weights, key_map, log_missing=False) else: - if target == EnumWeightTarget.Model: - weights = self.weights - else: + if target == EnumWeightTarget.Clip: weights = self.weights_clip + else: + weights = self.weights model.add_hook_patches(hook=self, patches=weights, strength_patch=strength) - registered.append(self) + registered.add(self) return True # TODO: add logs about any keys that were not applied - def clone(self, subtype: Callable=None): - if subtype is None: - subtype = type(self) - c: WeightHook = super().clone(subtype) + def clone(self): + c: WeightHook = super().clone() c.weights = self.weights c.weights_clip = self.weights_clip c.need_weight_init = self.need_weight_init @@ -147,127 +188,158 @@ class WeightHook(Hook): c._strength_clip = self._strength_clip return c -class PatchHook(Hook): - def __init__(self): - super().__init__(hook_type=EnumHookType.Patch) - self.patches: dict = None - - def clone(self, subtype: Callable=None): - if subtype is None: - subtype = type(self) - c: PatchHook = super().clone(subtype) - c.patches = self.patches - return c - # TODO: add functionality - class ObjectPatchHook(Hook): - def __init__(self): + def __init__(self, object_patches: dict[str]=None, + hook_scope=EnumHookScope.AllConditioning): super().__init__(hook_type=EnumHookType.ObjectPatch) - self.object_patches: dict = None + self.object_patches = object_patches + self.hook_scope = hook_scope - def clone(self, subtype: Callable=None): - if subtype is None: - subtype = type(self) - c: ObjectPatchHook = super().clone(subtype) + def clone(self): + c: ObjectPatchHook = super().clone() c.object_patches = self.object_patches return c - # TODO: add functionality -class AddModelsHook(Hook): - def __init__(self, key: str=None, models: list['ModelPatcher']=None): - super().__init__(hook_type=EnumHookType.AddModels) - self.key = key + def add_hook_patches(self, model: ModelPatcher, model_options: dict, target_dict: dict[str], registered: HookGroup): + raise NotImplementedError("ObjectPatchHook is not supported yet in ComfyUI.") + +class AdditionalModelsHook(Hook): + ''' + Hook responsible for telling model management any additional models that should be loaded. + + Note, value of hook_scope is ignored and is treated as AllConditioning. + ''' + def __init__(self, models: list[ModelPatcher]=None, key: str=None): + super().__init__(hook_type=EnumHookType.AdditionalModels) self.models = models - self.append_when_same = True - - def clone(self, subtype: Callable=None): - if subtype is None: - subtype = type(self) - c: AddModelsHook = super().clone(subtype) - c.key = self.key - c.models = self.models.copy() if self.models else self.models - c.append_when_same = self.append_when_same - return c - # TODO: add functionality - -class CallbackHook(Hook): - def __init__(self, key: str=None, callback: Callable=None): - super().__init__(hook_type=EnumHookType.Callbacks) self.key = key - self.callback = callback - def clone(self, subtype: Callable=None): - if subtype is None: - subtype = type(self) - c: CallbackHook = super().clone(subtype) + def clone(self): + c: AdditionalModelsHook = super().clone() + c.models = self.models.copy() if self.models else self.models c.key = self.key - c.callback = self.callback - return c - # TODO: add functionality - -class WrapperHook(Hook): - def __init__(self, wrappers_dict: dict[str, dict[str, dict[str, list[Callable]]]]=None): - super().__init__(hook_type=EnumHookType.Wrappers) - self.wrappers_dict = wrappers_dict - - def clone(self, subtype: Callable=None): - if subtype is None: - subtype = type(self) - c: WrapperHook = super().clone(subtype) - c.wrappers_dict = self.wrappers_dict return c - def add_hook_patches(self, model: 'ModelPatcher', model_options: dict, target: EnumWeightTarget, registered: list[Hook]): - if not self.should_register(model, model_options, target, registered): + def add_hook_patches(self, model: ModelPatcher, model_options: dict, target_dict: dict[str], registered: HookGroup): + if not self.should_register(model, model_options, target_dict, registered): return False - add_model_options = {"transformer_options": self.wrappers_dict} - comfy.patcher_extension.merge_nested_dicts(model_options, add_model_options, copy_dict1=False) - registered.append(self) + registered.add(self) return True -class SetInjectionsHook(Hook): - def __init__(self, key: str=None, injections: list['PatcherInjection']=None): - super().__init__(hook_type=EnumHookType.SetInjections) +class TransformerOptionsHook(Hook): + ''' + Hook responsible for adding wrappers, callbacks, patches, or anything else related to transformer_options. + ''' + def __init__(self, transformers_dict: dict[str, dict[str, dict[str, list[Callable]]]]=None, + hook_scope=EnumHookScope.AllConditioning): + super().__init__(hook_type=EnumHookType.TransformerOptions) + self.transformers_dict = transformers_dict + self.hook_scope = hook_scope + self._skip_adding = False + '''Internal value used to avoid double load of transformer_options when hook_scope is AllConditioning.''' + + def clone(self): + c: TransformerOptionsHook = super().clone() + c.transformers_dict = self.transformers_dict + c._skip_adding = self._skip_adding + return c + + def add_hook_patches(self, model: ModelPatcher, model_options: dict, target_dict: dict[str], registered: HookGroup): + if not self.should_register(model, model_options, target_dict, registered): + return False + # NOTE: to_load_options will be used to manually load patches/wrappers/callbacks from hooks + self._skip_adding = False + if self.hook_scope == EnumHookScope.AllConditioning: + add_model_options = {"transformer_options": self.transformers_dict, + "to_load_options": self.transformers_dict} + # skip_adding if included in AllConditioning to avoid double loading + self._skip_adding = True + else: + add_model_options = {"to_load_options": self.transformers_dict} + registered.add(self) + comfy.patcher_extension.merge_nested_dicts(model_options, add_model_options, copy_dict1=False) + return True + + def on_apply_hooks(self, model: ModelPatcher, transformer_options: dict[str]): + if not self._skip_adding: + comfy.patcher_extension.merge_nested_dicts(transformer_options, self.transformers_dict, copy_dict1=False) + +WrapperHook = TransformerOptionsHook +'''Only here for backwards compatibility, WrapperHook is identical to TransformerOptionsHook.''' + +class InjectionsHook(Hook): + def __init__(self, key: str=None, injections: list[PatcherInjection]=None, + hook_scope=EnumHookScope.AllConditioning): + super().__init__(hook_type=EnumHookType.Injections) self.key = key self.injections = injections + self.hook_scope = hook_scope - def clone(self, subtype: Callable=None): - if subtype is None: - subtype = type(self) - c: SetInjectionsHook = super().clone(subtype) + def clone(self): + c: InjectionsHook = super().clone() c.key = self.key c.injections = self.injections.copy() if self.injections else self.injections return c - def add_hook_injections(self, model: 'ModelPatcher'): - # TODO: add functionality - pass + def add_hook_patches(self, model: ModelPatcher, model_options: dict, target_dict: dict[str], registered: HookGroup): + raise NotImplementedError("InjectionsHook is not supported yet in ComfyUI.") class HookGroup: + ''' + Stores groups of hooks, and allows them to be queried by type. + + To prevent breaking their functionality, never modify the underlying self.hooks or self._hook_dict vars directly; + always use the provided functions on HookGroup. + ''' def __init__(self): self.hooks: list[Hook] = [] + self._hook_dict: dict[EnumHookType, list[Hook]] = {} + + def __len__(self): + return len(self.hooks) def add(self, hook: Hook): if hook not in self.hooks: self.hooks.append(hook) + self._hook_dict.setdefault(hook.hook_type, []).append(hook) + + def remove(self, hook: Hook): + if hook in self.hooks: + self.hooks.remove(hook) + self._hook_dict[hook.hook_type].remove(hook) + + def get_type(self, hook_type: EnumHookType): + return self._hook_dict.get(hook_type, []) def contains(self, hook: Hook): return hook in self.hooks + def is_subset_of(self, other: HookGroup): + self_hooks = set(self.hooks) + other_hooks = set(other.hooks) + return self_hooks.issubset(other_hooks) + + def new_with_common_hooks(self, other: HookGroup): + c = HookGroup() + for hook in self.hooks: + if other.contains(hook): + c.add(hook.clone()) + return c + def clone(self): c = HookGroup() for hook in self.hooks: c.add(hook.clone()) return c - def clone_and_combine(self, other: 'HookGroup'): + def clone_and_combine(self, other: HookGroup): c = self.clone() if other is not None: for hook in other.hooks: c.add(hook.clone()) return c - def set_keyframes_on_hooks(self, hook_kf: 'HookKeyframeGroup'): + def set_keyframes_on_hooks(self, hook_kf: HookKeyframeGroup): if hook_kf is None: hook_kf = HookKeyframeGroup() else: @@ -275,36 +347,29 @@ class HookGroup: for hook in self.hooks: hook.hook_keyframe = hook_kf - def get_dict_repr(self): - d: dict[EnumHookType, dict[Hook, None]] = {} - for hook in self.hooks: - with_type = d.setdefault(hook.hook_type, {}) - with_type[hook] = None - return d - def get_hooks_for_clip_schedule(self): scheduled_hooks: dict[WeightHook, list[tuple[tuple[float,float], HookKeyframe]]] = {} - for hook in self.hooks: - # only care about WeightHooks, for now - if hook.hook_type == EnumHookType.Weight: - hook_schedule = [] - # if no hook keyframes, assign default value - if len(hook.hook_keyframe.keyframes) == 0: - hook_schedule.append(((0.0, 1.0), None)) - scheduled_hooks[hook] = hook_schedule - continue - # find ranges of values - prev_keyframe = hook.hook_keyframe.keyframes[0] - for keyframe in hook.hook_keyframe.keyframes: - if keyframe.start_percent > prev_keyframe.start_percent and not math.isclose(keyframe.strength, prev_keyframe.strength): - hook_schedule.append(((prev_keyframe.start_percent, keyframe.start_percent), prev_keyframe)) - prev_keyframe = keyframe - elif keyframe.start_percent == prev_keyframe.start_percent: - prev_keyframe = keyframe - # create final range, assuming last start_percent was not 1.0 - if not math.isclose(prev_keyframe.start_percent, 1.0): - hook_schedule.append(((prev_keyframe.start_percent, 1.0), prev_keyframe)) + # only care about WeightHooks, for now + for hook in self.get_type(EnumHookType.Weight): + hook: WeightHook + hook_schedule = [] + # if no hook keyframes, assign default value + if len(hook.hook_keyframe.keyframes) == 0: + hook_schedule.append(((0.0, 1.0), None)) scheduled_hooks[hook] = hook_schedule + continue + # find ranges of values + prev_keyframe = hook.hook_keyframe.keyframes[0] + for keyframe in hook.hook_keyframe.keyframes: + if keyframe.start_percent > prev_keyframe.start_percent and not math.isclose(keyframe.strength, prev_keyframe.strength): + hook_schedule.append(((prev_keyframe.start_percent, keyframe.start_percent), prev_keyframe)) + prev_keyframe = keyframe + elif keyframe.start_percent == prev_keyframe.start_percent: + prev_keyframe = keyframe + # create final range, assuming last start_percent was not 1.0 + if not math.isclose(prev_keyframe.start_percent, 1.0): + hook_schedule.append(((prev_keyframe.start_percent, 1.0), prev_keyframe)) + scheduled_hooks[hook] = hook_schedule # hooks should not have their schedules in a list of tuples all_ranges: list[tuple[float, float]] = [] for range_kfs in scheduled_hooks.values(): @@ -336,7 +401,7 @@ class HookGroup: hook.reset() @staticmethod - def combine_all_hooks(hooks_list: list['HookGroup'], require_count=0) -> 'HookGroup': + def combine_all_hooks(hooks_list: list[HookGroup], require_count=0) -> HookGroup: actual: list[HookGroup] = [] for group in hooks_list: if group is not None: @@ -433,7 +498,7 @@ class HookKeyframeGroup: c._set_first_as_current() return c - def initialize_timesteps(self, model: 'BaseModel'): + def initialize_timesteps(self, model: BaseModel): for keyframe in self.keyframes: keyframe.start_t = model.model_sampling.percent_to_sigma(keyframe.start_percent) @@ -522,6 +587,17 @@ def get_sorted_list_via_attr(objects: list, attr: str) -> list: sorted_list.extend(object_list) return sorted_list +def create_transformer_options_from_hooks(model: ModelPatcher, hooks: HookGroup, transformer_options: dict[str]=None): + # if no hooks or is not a ModelPatcher for sampling, return empty dict + if hooks is None or model.is_clip: + return {} + if transformer_options is None: + transformer_options = {} + for hook in hooks.get_type(EnumHookType.TransformerOptions): + hook: TransformerOptionsHook + hook.on_apply_hooks(model, transformer_options) + return transformer_options + def create_hook_lora(lora: dict[str, torch.Tensor], strength_model: float, strength_clip: float): hook_group = HookGroup() hook = WeightHook(strength_model=strength_model, strength_clip=strength_clip) @@ -548,7 +624,7 @@ def create_hook_model_as_lora(weights_model, weights_clip, strength_model: float hook.need_weight_init = False return hook_group -def get_patch_weights_from_model(model: 'ModelPatcher', discard_model_sampling=True): +def get_patch_weights_from_model(model: ModelPatcher, discard_model_sampling=True): if model is None: return None patches_model: dict[str, torch.Tensor] = model.model.state_dict() @@ -560,7 +636,7 @@ def get_patch_weights_from_model(model: 'ModelPatcher', discard_model_sampling=T return patches_model # NOTE: this function shows how to register weight hooks directly on the ModelPatchers -def load_hook_lora_for_models(model: 'ModelPatcher', clip: 'CLIP', lora: dict[str, torch.Tensor], +def load_hook_lora_for_models(model: ModelPatcher, clip: CLIP, lora: dict[str, torch.Tensor], strength_model: float, strength_clip: float): key_map = {} if model is not None: @@ -612,24 +688,26 @@ def _combine_hooks_from_values(c_dict: dict[str, HookGroup], values: dict[str, H else: c_dict[hooks_key] = cache[hooks_tuple] -def conditioning_set_values_with_hooks(conditioning, values={}, append_hooks=True): +def conditioning_set_values_with_hooks(conditioning, values={}, append_hooks=True, + cache: dict[tuple[HookGroup, HookGroup], HookGroup]=None): c = [] - hooks_combine_cache: dict[tuple[HookGroup, HookGroup], HookGroup] = {} + if cache is None: + cache = {} for t in conditioning: n = [t[0], t[1].copy()] for k in values: if append_hooks and k == 'hooks': - _combine_hooks_from_values(n[1], values, hooks_combine_cache) + _combine_hooks_from_values(n[1], values, cache) else: n[1][k] = values[k] c.append(n) return c -def set_hooks_for_conditioning(cond, hooks: HookGroup, append_hooks=True): +def set_hooks_for_conditioning(cond, hooks: HookGroup, append_hooks=True, cache: dict[tuple[HookGroup, HookGroup], HookGroup]=None): if hooks is None: return cond - return conditioning_set_values_with_hooks(cond, {'hooks': hooks}, append_hooks=append_hooks) + return conditioning_set_values_with_hooks(cond, {'hooks': hooks}, append_hooks=append_hooks, cache=cache) def set_timesteps_for_conditioning(cond, timestep_range: tuple[float,float]): if timestep_range is None: @@ -664,9 +742,10 @@ def combine_with_new_conds(conds: list, new_conds: list): def set_conds_props(conds: list, strength: float, set_cond_area: str, mask: torch.Tensor=None, hooks: HookGroup=None, timesteps_range: tuple[float,float]=None, append_hooks=True): final_conds = [] + cache = {} for c in conds: # first, apply lora_hook to conditioning, if provided - c = set_hooks_for_conditioning(c, hooks, append_hooks=append_hooks) + c = set_hooks_for_conditioning(c, hooks, append_hooks=append_hooks, cache=cache) # next, apply mask to conditioning c = set_mask_for_conditioning(cond=c, mask=mask, strength=strength, set_cond_area=set_cond_area) # apply timesteps, if present @@ -678,9 +757,10 @@ def set_conds_props(conds: list, strength: float, set_cond_area: str, def set_conds_props_and_combine(conds: list, new_conds: list, strength: float=1.0, set_cond_area: str="default", mask: torch.Tensor=None, hooks: HookGroup=None, timesteps_range: tuple[float,float]=None, append_hooks=True): combined_conds = [] + cache = {} for c, masked_c in zip(conds, new_conds): # first, apply lora_hook to new conditioning, if provided - masked_c = set_hooks_for_conditioning(masked_c, hooks, append_hooks=append_hooks) + masked_c = set_hooks_for_conditioning(masked_c, hooks, append_hooks=append_hooks, cache=cache) # next, apply mask to new conditioning, if provided masked_c = set_mask_for_conditioning(cond=masked_c, mask=mask, set_cond_area=set_cond_area, strength=strength) # apply timesteps, if present @@ -692,9 +772,10 @@ def set_conds_props_and_combine(conds: list, new_conds: list, strength: float=1. def set_default_conds_and_combine(conds: list, new_conds: list, hooks: HookGroup=None, timesteps_range: tuple[float,float]=None, append_hooks=True): combined_conds = [] + cache = {} for c, new_c in zip(conds, new_conds): # first, apply lora_hook to new conditioning, if provided - new_c = set_hooks_for_conditioning(new_c, hooks, append_hooks=append_hooks) + new_c = set_hooks_for_conditioning(new_c, hooks, append_hooks=append_hooks, cache=cache) # next, add default_cond key to cond so that during sampling, it can be identified new_c = conditioning_set_values(new_c, {'default': True}) # apply timesteps, if present diff --git a/comfy/model_patcher.py b/comfy/model_patcher.py index e886bdbb..0501f7b3 100644 --- a/comfy/model_patcher.py +++ b/comfy/model_patcher.py @@ -210,7 +210,7 @@ class ModelPatcher: self.injections: dict[str, list[PatcherInjection]] = {} self.hook_patches: dict[comfy.hooks._HookRef] = {} - self.hook_patches_backup: dict[comfy.hooks._HookRef] = {} + self.hook_patches_backup: dict[comfy.hooks._HookRef] = None self.hook_backup: dict[str, tuple[torch.Tensor, torch.device]] = {} self.cached_hook_patches: dict[comfy.hooks.HookGroup, dict[str, torch.Tensor]] = {} self.current_hooks: Optional[comfy.hooks.HookGroup] = None @@ -282,7 +282,7 @@ class ModelPatcher: n.injections[k] = i.copy() # hooks n.hook_patches = create_hook_patches_clone(self.hook_patches) - n.hook_patches_backup = create_hook_patches_clone(self.hook_patches_backup) + n.hook_patches_backup = create_hook_patches_clone(self.hook_patches_backup) if self.hook_patches_backup else self.hook_patches_backup for group in self.cached_hook_patches: n.cached_hook_patches[group] = {} for k in self.cached_hook_patches[group]: @@ -855,6 +855,9 @@ class ModelPatcher: if key in self.injections: self.injections.pop(key) + def get_injections(self, key: str): + return self.injections.get(key, None) + def set_additional_models(self, key: str, models: list['ModelPatcher']): self.additional_models[key] = models @@ -925,9 +928,9 @@ class ModelPatcher: callback(self, timestep) def restore_hook_patches(self): - if len(self.hook_patches_backup) > 0: + if self.hook_patches_backup is not None: self.hook_patches = self.hook_patches_backup - self.hook_patches_backup = {} + self.hook_patches_backup = None def set_hook_mode(self, hook_mode: comfy.hooks.EnumHookMode): self.hook_mode = hook_mode @@ -953,25 +956,26 @@ class ModelPatcher: if reset_current_hooks: self.patch_hooks(None) - def register_all_hook_patches(self, hooks_dict: dict[comfy.hooks.EnumHookType, dict[comfy.hooks.Hook, None]], target: comfy.hooks.EnumWeightTarget, model_options: dict=None): + def register_all_hook_patches(self, hooks: comfy.hooks.HookGroup, target_dict: dict[str], model_options: dict=None, + registered: comfy.hooks.HookGroup = None): self.restore_hook_patches() - registered_hooks: list[comfy.hooks.Hook] = [] - # handle WrapperHooks, if model_options provided - if model_options is not None: - for hook in hooks_dict.get(comfy.hooks.EnumHookType.Wrappers, {}): - hook.add_hook_patches(self, model_options, target, registered_hooks) + if registered is None: + registered = comfy.hooks.HookGroup() # handle WeightHooks weight_hooks_to_register: list[comfy.hooks.WeightHook] = [] - for hook in hooks_dict.get(comfy.hooks.EnumHookType.Weight, {}): + for hook in hooks.get_type(comfy.hooks.EnumHookType.Weight): if hook.hook_ref not in self.hook_patches: weight_hooks_to_register.append(hook) + else: + registered.add(hook) if len(weight_hooks_to_register) > 0: # clone hook_patches to become backup so that any non-dynamic hooks will return to their original state self.hook_patches_backup = create_hook_patches_clone(self.hook_patches) for hook in weight_hooks_to_register: - hook.add_hook_patches(self, model_options, target, registered_hooks) + hook.add_hook_patches(self, model_options, target_dict, registered) for callback in self.get_all_callbacks(CallbacksMP.ON_REGISTER_ALL_HOOK_PATCHES): - callback(self, hooks_dict, target) + callback(self, hooks, target_dict, model_options, registered) + return registered def add_hook_patches(self, hook: comfy.hooks.WeightHook, patches, strength_patch=1.0, strength_model=1.0): with self.use_ejected(): @@ -1022,11 +1026,11 @@ class ModelPatcher: def apply_hooks(self, hooks: comfy.hooks.HookGroup, transformer_options: dict=None, force_apply=False): # TODO: return transformer_options dict with any additions from hooks if self.current_hooks == hooks and (not force_apply or (not self.is_clip and hooks is None)): - return {} + return comfy.hooks.create_transformer_options_from_hooks(self, hooks, transformer_options) self.patch_hooks(hooks=hooks) for callback in self.get_all_callbacks(CallbacksMP.ON_APPLY_HOOKS): callback(self, hooks) - return {} + return comfy.hooks.create_transformer_options_from_hooks(self, hooks, transformer_options) def patch_hooks(self, hooks: comfy.hooks.HookGroup): with self.use_ejected(): diff --git a/comfy/sampler_helpers.py b/comfy/sampler_helpers.py index ac973536..b70e5e63 100644 --- a/comfy/sampler_helpers.py +++ b/comfy/sampler_helpers.py @@ -24,15 +24,13 @@ def get_models_from_cond(cond, model_type): models += [c[model_type]] return models -def get_hooks_from_cond(cond, hooks_dict: dict[comfy.hooks.EnumHookType, dict[comfy.hooks.Hook, None]]): +def get_hooks_from_cond(cond, full_hooks: comfy.hooks.HookGroup): # get hooks from conds, and collect cnets so they can be checked for extra_hooks cnets: list[ControlBase] = [] for c in cond: if 'hooks' in c: for hook in c['hooks'].hooks: - hook: comfy.hooks.Hook - with_type = hooks_dict.setdefault(hook.hook_type, {}) - with_type[hook] = None + full_hooks.add(hook) if 'control' in c: cnets.append(c['control']) @@ -50,10 +48,9 @@ def get_hooks_from_cond(cond, hooks_dict: dict[comfy.hooks.EnumHookType, dict[co extra_hooks = comfy.hooks.HookGroup.combine_all_hooks(hooks_list) if extra_hooks is not None: for hook in extra_hooks.hooks: - with_type = hooks_dict.setdefault(hook.hook_type, {}) - with_type[hook] = None + full_hooks.add(hook) - return hooks_dict + return full_hooks def convert_cond(cond): out = [] @@ -73,13 +70,11 @@ def get_additional_models(conds, dtype): cnets: list[ControlBase] = [] gligen = [] add_models = [] - hooks: dict[comfy.hooks.EnumHookType, dict[comfy.hooks.Hook, None]] = {} for k in conds: cnets += get_models_from_cond(conds[k], "control") gligen += get_models_from_cond(conds[k], "gligen") add_models += get_models_from_cond(conds[k], "additional_models") - get_hooks_from_cond(conds[k], hooks) control_nets = set(cnets) @@ -90,11 +85,20 @@ def get_additional_models(conds, dtype): inference_memory += m.inference_memory_requirements(dtype) gligen = [x[1] for x in gligen] - hook_models = [x.model for x in hooks.get(comfy.hooks.EnumHookType.AddModels, {}).keys()] - models = control_models + gligen + add_models + hook_models + models = control_models + gligen + add_models return models, inference_memory +def get_additional_models_from_model_options(model_options: dict[str]=None): + """loads additional models from registered AddModels hooks""" + models = [] + if model_options is not None and "registered_hooks" in model_options: + registered: comfy.hooks.HookGroup = model_options["registered_hooks"] + for hook in registered.get_type(comfy.hooks.EnumHookType.AdditionalModels): + hook: comfy.hooks.AdditionalModelsHook + models.extend(hook.models) + return models + def cleanup_additional_models(models): """cleanup additional models that were loaded""" for m in models: @@ -102,9 +106,10 @@ def cleanup_additional_models(models): m.cleanup() -def prepare_sampling(model: 'ModelPatcher', noise_shape, conds): - real_model: 'BaseModel' = None +def prepare_sampling(model: ModelPatcher, noise_shape, conds, model_options=None): + real_model: BaseModel = None models, inference_memory = get_additional_models(conds, model.model_dtype()) + models += get_additional_models_from_model_options(model_options) models += model.get_nested_additional_models() # TODO: does this require inference_memory update? memory_required = model.memory_required([noise_shape[0] * 2] + list(noise_shape[1:])) + inference_memory minimum_memory_required = model.memory_required([noise_shape[0]] + list(noise_shape[1:])) + inference_memory @@ -123,12 +128,35 @@ def cleanup_models(conds, models): cleanup_additional_models(set(control_cleanup)) def prepare_model_patcher(model: 'ModelPatcher', conds, model_options: dict): + ''' + Registers hooks from conds. + ''' # check for hooks in conds - if not registered, see if can be applied - hooks = {} + hooks = comfy.hooks.HookGroup() for k in conds: get_hooks_from_cond(conds[k], hooks) # add wrappers and callbacks from ModelPatcher to transformer_options model_options["transformer_options"]["wrappers"] = comfy.patcher_extension.copy_nested_dicts(model.wrappers) model_options["transformer_options"]["callbacks"] = comfy.patcher_extension.copy_nested_dicts(model.callbacks) - # register hooks on model/model_options - model.register_all_hook_patches(hooks, comfy.hooks.EnumWeightTarget.Model, model_options) + # begin registering hooks + registered = comfy.hooks.HookGroup() + target_dict = comfy.hooks.create_target_dict(comfy.hooks.EnumWeightTarget.Model) + # handle all TransformerOptionsHooks + for hook in hooks.get_type(comfy.hooks.EnumHookType.TransformerOptions): + hook: comfy.hooks.TransformerOptionsHook + hook.add_hook_patches(model, model_options, target_dict, registered) + # handle all AddModelsHooks + for hook in hooks.get_type(comfy.hooks.EnumHookType.AdditionalModels): + hook: comfy.hooks.AdditionalModelsHook + hook.add_hook_patches(model, model_options, target_dict, registered) + # handle all WeightHooks by registering on ModelPatcher + model.register_all_hook_patches(hooks, target_dict, model_options, registered) + # add registered_hooks onto model_options for further reference + if len(registered) > 0: + model_options["registered_hooks"] = registered + # merge original wrappers and callbacks with hooked wrappers and callbacks + to_load_options: dict[str] = model_options.setdefault("to_load_options", {}) + for wc_name in ["wrappers", "callbacks"]: + comfy.patcher_extension.merge_nested_dicts(to_load_options.setdefault(wc_name, {}), model_options["transformer_options"][wc_name], + copy_dict1=False) + return to_load_options diff --git a/comfy/samplers.py b/comfy/samplers.py index af2b8e11..5cc33a7d 100644 --- a/comfy/samplers.py +++ b/comfy/samplers.py @@ -810,6 +810,33 @@ def preprocess_conds_hooks(conds: dict[str, list[dict[str]]]): for cond in conds_to_modify: cond['hooks'] = hooks +def filter_registered_hooks_on_conds(conds: dict[str, list[dict[str]]], model_options: dict[str]): + '''Modify 'hooks' on conds so that only hooks that were registered remain. Properly accounts for + HookGroups that have the same reference.''' + registered: comfy.hooks.HookGroup = model_options.get('registered_hooks', None) + # if None were registered, make sure all hooks are cleaned from conds + if registered is None: + for k in conds: + for kk in conds[k]: + kk.pop('hooks', None) + return + # find conds that contain hooks to be replaced - group by common HookGroup refs + hook_replacement: dict[comfy.hooks.HookGroup, list[dict]] = {} + for k in conds: + for kk in conds[k]: + hooks: comfy.hooks.HookGroup = kk.get('hooks', None) + if hooks is not None: + if not hooks.is_subset_of(registered): + to_replace = hook_replacement.setdefault(hooks, []) + to_replace.append(kk) + # for each hook to replace, create a new proper HookGroup and assign to all common conds + for hooks, conds_to_modify in hook_replacement.items(): + new_hooks = hooks.new_with_common_hooks(registered) + if len(new_hooks) == 0: + new_hooks = None + for kk in conds_to_modify: + kk['hooks'] = new_hooks + def get_total_hook_groups_in_conds(conds: dict[str, list[dict[str]]]): hooks_set = set() @@ -819,9 +846,58 @@ def get_total_hook_groups_in_conds(conds: dict[str, list[dict[str]]]): return len(hooks_set) +def cast_to_load_options(model_options: dict[str], device=None, dtype=None): + ''' + If any patches from hooks, wrappers, or callbacks have .to to be called, call it. + ''' + if model_options is None: + return + to_load_options = model_options.get("to_load_options", None) + if to_load_options is None: + return + + casts = [] + if device is not None: + casts.append(device) + if dtype is not None: + casts.append(dtype) + # if nothing to apply, do nothing + if len(casts) == 0: + return + + # try to call .to on patches + if "patches" in to_load_options: + patches = to_load_options["patches"] + for name in patches: + patch_list = patches[name] + for i in range(len(patch_list)): + if hasattr(patch_list[i], "to"): + for cast in casts: + patch_list[i] = patch_list[i].to(cast) + if "patches_replace" in to_load_options: + patches = to_load_options["patches_replace"] + for name in patches: + patch_list = patches[name] + for k in patch_list: + if hasattr(patch_list[k], "to"): + for cast in casts: + patch_list[k] = patch_list[k].to(cast) + # try to call .to on any wrappers/callbacks + wrappers_and_callbacks = ["wrappers", "callbacks"] + for wc_name in wrappers_and_callbacks: + if wc_name in to_load_options: + wc: dict[str, list] = to_load_options[wc_name] + for wc_dict in wc.values(): + for wc_list in wc_dict.values(): + for i in range(len(wc_list)): + if hasattr(wc_list[i], "to"): + for cast in casts: + wc_list[i] = wc_list[i].to(cast) + + class CFGGuider: - def __init__(self, model_patcher): - self.model_patcher: 'ModelPatcher' = model_patcher + def __init__(self, model_patcher: ModelPatcher): + self.model_patcher = model_patcher self.model_options = model_patcher.model_options self.original_conds = {} self.cfg = 1.0 @@ -861,7 +937,7 @@ class CFGGuider: return self.inner_model.process_latent_out(samples.to(torch.float32)) def outer_sample(self, noise, latent_image, sampler, sigmas, denoise_mask=None, callback=None, disable_pbar=False, seed=None): - self.inner_model, self.conds, self.loaded_models = comfy.sampler_helpers.prepare_sampling(self.model_patcher, noise.shape, self.conds) + self.inner_model, self.conds, self.loaded_models = comfy.sampler_helpers.prepare_sampling(self.model_patcher, noise.shape, self.conds, self.model_options) device = self.model_patcher.load_device if denoise_mask is not None: @@ -870,6 +946,7 @@ class CFGGuider: noise = noise.to(device) latent_image = latent_image.to(device) sigmas = sigmas.to(device) + cast_to_load_options(self.model_options, device=device, dtype=self.model_patcher.model_dtype()) try: self.model_patcher.pre_run() @@ -899,6 +976,7 @@ class CFGGuider: if get_total_hook_groups_in_conds(self.conds) <= 1: self.model_patcher.hook_mode = comfy.hooks.EnumHookMode.MinVram comfy.sampler_helpers.prepare_model_patcher(self.model_patcher, self.conds, self.model_options) + filter_registered_hooks_on_conds(self.conds, self.model_options) executor = comfy.patcher_extension.WrapperExecutor.new_class_executor( self.outer_sample, self, @@ -906,6 +984,7 @@ class CFGGuider: ) output = executor.execute(noise, latent_image, sampler, sigmas, denoise_mask, callback, disable_pbar, seed) finally: + cast_to_load_options(self.model_options, device=self.model_patcher.offload_device) self.model_options = orig_model_options self.model_patcher.hook_mode = orig_hook_mode self.model_patcher.restore_hook_patches() diff --git a/comfy_extras/nodes_hooks.py b/comfy_extras/nodes_hooks.py index 9d9d4837..1edc06f3 100644 --- a/comfy_extras/nodes_hooks.py +++ b/comfy_extras/nodes_hooks.py @@ -246,7 +246,7 @@ class SetClipHooks: CATEGORY = "advanced/hooks/clip" FUNCTION = "apply_hooks" - def apply_hooks(self, clip: 'CLIP', schedule_clip: bool, apply_to_conds: bool, hooks: comfy.hooks.HookGroup=None): + def apply_hooks(self, clip: CLIP, schedule_clip: bool, apply_to_conds: bool, hooks: comfy.hooks.HookGroup=None): if hooks is not None: clip = clip.clone() if apply_to_conds: @@ -255,7 +255,7 @@ class SetClipHooks: clip.use_clip_schedule = schedule_clip if not clip.use_clip_schedule: clip.patcher.forced_hooks.set_keyframes_on_hooks(None) - clip.patcher.register_all_hook_patches(hooks.get_dict_repr(), comfy.hooks.EnumWeightTarget.Clip) + clip.patcher.register_all_hook_patches(hooks, comfy.hooks.create_target_dict(comfy.hooks.EnumWeightTarget.Clip)) return (clip,) class ConditioningTimestepsRange: From 42086af123554020278f2c68f06776295530198a Mon Sep 17 00:00:00 2001 From: Chenlei Hu <chenlei.hu@mail.utoronto.ca> Date: Sat, 11 Jan 2025 12:52:46 -0500 Subject: [PATCH 14/47] Merge ruff.toml into pyproject.toml (#6431) --- pyproject.toml | 12 ++++++++++++ ruff.toml | 15 --------------- 2 files changed, 12 insertions(+), 15 deletions(-) delete mode 100644 ruff.toml diff --git a/pyproject.toml b/pyproject.toml index 1d9d7b3f..b747d6ef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,3 +9,15 @@ requires-python = ">=3.9" homepage = "https://www.comfy.org/" repository = "https://github.com/comfyanonymous/ComfyUI" documentation = "https://docs.comfy.org/" + +[tool.ruff] +lint.select = [ + "S307", # suspicious-eval-usage + "S102", # exec + "T", # print-usage + "W", + # The "F" series in Ruff stands for "Pyflakes" rules, which catch various Python syntax errors and undefined names. + # See all rules here: https://docs.astral.sh/ruff/rules/#pyflakes-f + "F", +] +exclude = ["*.ipynb"] diff --git a/ruff.toml b/ruff.toml deleted file mode 100644 index 808a2ad0..00000000 --- a/ruff.toml +++ /dev/null @@ -1,15 +0,0 @@ -# Disable all rules by default -lint.ignore = ["ALL"] - -# Enable specific rules -lint.select = [ - "S307", # suspicious-eval-usage - "S102", # exec - "T", # print-usage - "W", - # The "F" series in Ruff stands for "Pyflakes" rules, which catch various Python syntax errors and undefined names. - # See all rules here: https://docs.astral.sh/ruff/rules/#pyflakes-f - "F", -] - -exclude = ["*.ipynb"] From b9d9bcba1418711f13d7e432605f85303d900723 Mon Sep 17 00:00:00 2001 From: Alexander Piskun <13381981+bigcat88@users.noreply.github.com> Date: Sun, 12 Jan 2025 03:19:51 +0300 Subject: [PATCH 15/47] fixed a bug where a relative path was not converted to a full path (#6395) Signed-off-by: bigcat88 <bigcat88@icloud.com> --- tests-unit/utils/extra_config_test.py | 181 +++++++++++++++++++++++++- utils/extra_config.py | 6 +- 2 files changed, 183 insertions(+), 4 deletions(-) diff --git a/tests-unit/utils/extra_config_test.py b/tests-unit/utils/extra_config_test.py index 143e1f2e..b23f5bd0 100644 --- a/tests-unit/utils/extra_config_test.py +++ b/tests-unit/utils/extra_config_test.py @@ -1,11 +1,22 @@ import pytest import yaml import os +import sys from unittest.mock import Mock, patch, mock_open from utils.extra_config import load_extra_path_config import folder_paths + +@pytest.fixture() +def clear_folder_paths(): + # Clear the global dictionary before each test to ensure isolation + original = folder_paths.folder_names_and_paths.copy() + folder_paths.folder_names_and_paths.clear() + yield + folder_paths.folder_names_and_paths = original + + @pytest.fixture def mock_yaml_content(): return { @@ -15,10 +26,12 @@ def mock_yaml_content(): } } + @pytest.fixture def mock_expanded_home(): return '/home/user' + @pytest.fixture def yaml_config_with_appdata(): return """ @@ -27,20 +40,33 @@ def yaml_config_with_appdata(): checkpoints: 'models/checkpoints' """ + @pytest.fixture def mock_yaml_content_appdata(yaml_config_with_appdata): return yaml.safe_load(yaml_config_with_appdata) + @pytest.fixture def mock_expandvars_appdata(): mock = Mock() - mock.side_effect = lambda path: path.replace('%APPDATA%', 'C:/Users/TestUser/AppData/Roaming') + + def expandvars(path): + if '%APPDATA%' in path: + if sys.platform == 'win32': + return path.replace('%APPDATA%', 'C:/Users/TestUser/AppData/Roaming') + else: + return path.replace('%APPDATA%', '/Users/TestUser/AppData/Roaming') + return path + + mock.side_effect = expandvars return mock + @pytest.fixture def mock_add_model_folder_path(): return Mock() + @pytest.fixture def mock_expanduser(mock_expanded_home): def _expanduser(path): @@ -49,10 +75,12 @@ def mock_expanduser(mock_expanded_home): return path return _expanduser + @pytest.fixture def mock_yaml_safe_load(mock_yaml_content): return Mock(return_value=mock_yaml_content) + @patch('builtins.open', new_callable=mock_open, read_data="dummy file content") def test_load_extra_model_paths_expands_userpath( mock_file, @@ -88,6 +116,7 @@ def test_load_extra_model_paths_expands_userpath( # Check if open was called with the correct file path mock_file.assert_called_once_with(dummy_yaml_file_name, 'r') + @patch('builtins.open', new_callable=mock_open) def test_load_extra_model_paths_expands_appdata( mock_file, @@ -111,7 +140,10 @@ def test_load_extra_model_paths_expands_appdata( dummy_yaml_file_name = 'dummy_path.yaml' load_extra_path_config(dummy_yaml_file_name) - expected_base_path = 'C:/Users/TestUser/AppData/Roaming/ComfyUI' + if sys.platform == "win32": + expected_base_path = 'C:/Users/TestUser/AppData/Roaming/ComfyUI' + else: + expected_base_path = '/Users/TestUser/AppData/Roaming/ComfyUI' expected_calls = [ ('checkpoints', os.path.join(expected_base_path, 'models/checkpoints'), False), ] @@ -124,3 +156,148 @@ def test_load_extra_model_paths_expands_appdata( # Verify that expandvars was called assert mock_expandvars_appdata.called + + +@patch("builtins.open", new_callable=mock_open, read_data="dummy yaml content") +@patch("yaml.safe_load") +def test_load_extra_path_config_relative_base_path( + mock_yaml_load, _mock_file, clear_folder_paths, monkeypatch, tmp_path +): + """ + Test that when 'base_path' is a relative path in the YAML, it is joined to the YAML file directory, and then + the items in the config are correctly converted to absolute paths. + """ + sub_folder = "./my_rel_base" + config_data = { + "some_model_folder": { + "base_path": sub_folder, + "is_default": True, + "checkpoints": "checkpoints", + "some_key": "some_value" + } + } + mock_yaml_load.return_value = config_data + + dummy_yaml_name = "dummy_file.yaml" + + def fake_abspath(path): + if path == dummy_yaml_name: + # If it's the YAML path, treat it like it lives in tmp_path + return os.path.join(str(tmp_path), dummy_yaml_name) + return os.path.join(str(tmp_path), path) # Otherwise, do a normal join relative to tmp_path + + def fake_dirname(path): + # We expect path to be the result of fake_abspath(dummy_yaml_name) + if path.endswith(dummy_yaml_name): + return str(tmp_path) + return os.path.dirname(path) + + monkeypatch.setattr(os.path, "abspath", fake_abspath) + monkeypatch.setattr(os.path, "dirname", fake_dirname) + + load_extra_path_config(dummy_yaml_name) + + expected_checkpoints = os.path.abspath(os.path.join(str(tmp_path), sub_folder, "checkpoints")) + expected_some_value = os.path.abspath(os.path.join(str(tmp_path), sub_folder, "some_value")) + + actual_paths = folder_paths.folder_names_and_paths["checkpoints"][0] + assert len(actual_paths) == 1, "Should have one path added for 'checkpoints'." + assert actual_paths[0] == expected_checkpoints + + actual_paths = folder_paths.folder_names_and_paths["some_key"][0] + assert len(actual_paths) == 1, "Should have one path added for 'some_key'." + assert actual_paths[0] == expected_some_value + + +@patch("builtins.open", new_callable=mock_open, read_data="dummy yaml content") +@patch("yaml.safe_load") +def test_load_extra_path_config_absolute_base_path( + mock_yaml_load, _mock_file, clear_folder_paths, monkeypatch, tmp_path +): + """ + Test that when 'base_path' is an absolute path, each subdirectory is joined with that absolute path, + rather than being relative to the YAML's directory. + """ + abs_base = os.path.join(str(tmp_path), "abs_base") + config_data = { + "some_absolute_folder": { + "base_path": abs_base, # <-- absolute + "is_default": True, + "loras": "loras_folder", + "embeddings": "embeddings_folder" + } + } + mock_yaml_load.return_value = config_data + + dummy_yaml_name = "dummy_abs.yaml" + + def fake_abspath(path): + if path == dummy_yaml_name: + # If it's the YAML path, treat it like it is in tmp_path + return os.path.join(str(tmp_path), dummy_yaml_name) + return path # For absolute base, we just return path directly + + def fake_dirname(path): + return str(tmp_path) if path.endswith(dummy_yaml_name) else os.path.dirname(path) + + monkeypatch.setattr(os.path, "abspath", fake_abspath) + monkeypatch.setattr(os.path, "dirname", fake_dirname) + + load_extra_path_config(dummy_yaml_name) + + # Expect the final paths to be <abs_base>/loras_folder and <abs_base>/embeddings_folder + expected_loras = os.path.join(abs_base, "loras_folder") + expected_embeddings = os.path.join(abs_base, "embeddings_folder") + + actual_loras = folder_paths.folder_names_and_paths["loras"][0] + assert len(actual_loras) == 1, "Should have one path for 'loras'." + assert actual_loras[0] == os.path.abspath(expected_loras) + + actual_embeddings = folder_paths.folder_names_and_paths["embeddings"][0] + assert len(actual_embeddings) == 1, "Should have one path for 'embeddings'." + assert actual_embeddings[0] == os.path.abspath(expected_embeddings) + + +@patch("builtins.open", new_callable=mock_open, read_data="dummy yaml content") +@patch("yaml.safe_load") +def test_load_extra_path_config_no_base_path( + mock_yaml_load, _mock_file, clear_folder_paths, monkeypatch, tmp_path +): + """ + Test that if 'base_path' is not present, each path is joined + with the directory of the YAML file (unless it's already absolute). + """ + config_data = { + "some_folder_without_base": { + "is_default": True, + "text_encoders": "clip", + "diffusion_models": "unet" + } + } + mock_yaml_load.return_value = config_data + + dummy_yaml_name = "dummy_no_base.yaml" + + def fake_abspath(path): + if path == dummy_yaml_name: + return os.path.join(str(tmp_path), dummy_yaml_name) + return os.path.join(str(tmp_path), path) + + def fake_dirname(path): + return str(tmp_path) if path.endswith(dummy_yaml_name) else os.path.dirname(path) + + monkeypatch.setattr(os.path, "abspath", fake_abspath) + monkeypatch.setattr(os.path, "dirname", fake_dirname) + + load_extra_path_config(dummy_yaml_name) + + expected_clip = os.path.join(str(tmp_path), "clip") + expected_unet = os.path.join(str(tmp_path), "unet") + + actual_text_encoders = folder_paths.folder_names_and_paths["text_encoders"][0] + assert len(actual_text_encoders) == 1, "Should have one path for 'text_encoders'." + assert actual_text_encoders[0] == os.path.abspath(expected_clip) + + actual_diffusion = folder_paths.folder_names_and_paths["diffusion_models"][0] + assert len(actual_diffusion) == 1, "Should have one path for 'diffusion_models'." + assert actual_diffusion[0] == os.path.abspath(expected_unet) diff --git a/utils/extra_config.py b/utils/extra_config.py index 415db042..d7b59285 100644 --- a/utils/extra_config.py +++ b/utils/extra_config.py @@ -6,6 +6,7 @@ import logging def load_extra_path_config(yaml_path): with open(yaml_path, 'r') as stream: config = yaml.safe_load(stream) + yaml_dir = os.path.dirname(os.path.abspath(yaml_path)) for c in config: conf = config[c] if conf is None: @@ -14,6 +15,8 @@ def load_extra_path_config(yaml_path): if "base_path" in conf: base_path = conf.pop("base_path") base_path = os.path.expandvars(os.path.expanduser(base_path)) + if not os.path.isabs(base_path): + base_path = os.path.abspath(os.path.join(yaml_dir, base_path)) is_default = False if "is_default" in conf: is_default = conf.pop("is_default") @@ -22,10 +25,9 @@ def load_extra_path_config(yaml_path): if len(y) == 0: continue full_path = y - if base_path is not None: + if base_path: full_path = os.path.join(base_path, full_path) elif not os.path.isabs(full_path): - yaml_dir = os.path.dirname(os.path.abspath(yaml_path)) full_path = os.path.abspath(os.path.join(yaml_dir, y)) logging.info("Adding extra search path {} {}".format(x, full_path)) folder_paths.add_model_folder_path(x, full_path, is_default) From 90f349f93df3083a507854d7fc7c3e1bb9014e24 Mon Sep 17 00:00:00 2001 From: comfyanonymous <comfyanonymous@protonmail.com> Date: Sun, 12 Jan 2025 03:09:20 -0500 Subject: [PATCH 16/47] Add res_multistep sampler from the cosmos code. This sampler should work with all models. --- comfy/k_diffusion/res.py | 258 ++++++++++++++++++++++++++++++++++ comfy/k_diffusion/sampling.py | 18 +++ comfy/samplers.py | 2 +- 3 files changed, 277 insertions(+), 1 deletion(-) create mode 100644 comfy/k_diffusion/res.py diff --git a/comfy/k_diffusion/res.py b/comfy/k_diffusion/res.py new file mode 100644 index 00000000..6caedec3 --- /dev/null +++ b/comfy/k_diffusion/res.py @@ -0,0 +1,258 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Copied from Nvidia Cosmos code. + +import torch +from torch import Tensor +from typing import Callable, List, Tuple, Optional, Any +import math +from tqdm.auto import trange + + +def common_broadcast(x: Tensor, y: Tensor) -> tuple[Tensor, Tensor]: + ndims1 = x.ndim + ndims2 = y.ndim + + if ndims1 < ndims2: + x = x.reshape(x.shape + (1,) * (ndims2 - ndims1)) + elif ndims2 < ndims1: + y = y.reshape(y.shape + (1,) * (ndims1 - ndims2)) + + return x, y + + +def batch_mul(x: Tensor, y: Tensor) -> Tensor: + x, y = common_broadcast(x, y) + return x * y + + +def phi1(t: torch.Tensor) -> torch.Tensor: + """ + Compute the first order phi function: (exp(t) - 1) / t. + + Args: + t: Input tensor. + + Returns: + Tensor: Result of phi1 function. + """ + input_dtype = t.dtype + t = t.to(dtype=torch.float32) + return (torch.expm1(t) / t).to(dtype=input_dtype) + + +def phi2(t: torch.Tensor) -> torch.Tensor: + """ + Compute the second order phi function: (phi1(t) - 1) / t. + + Args: + t: Input tensor. + + Returns: + Tensor: Result of phi2 function. + """ + input_dtype = t.dtype + t = t.to(dtype=torch.float32) + return ((phi1(t) - 1.0) / t).to(dtype=input_dtype) + + +def res_x0_rk2_step( + x_s: torch.Tensor, + t: torch.Tensor, + s: torch.Tensor, + x0_s: torch.Tensor, + s1: torch.Tensor, + x0_s1: torch.Tensor, +) -> torch.Tensor: + """ + Perform a residual-based 2nd order Runge-Kutta step. + + Args: + x_s: Current state tensor. + t: Target time tensor. + s: Current time tensor. + x0_s: Prediction at current time. + s1: Intermediate time tensor. + x0_s1: Prediction at intermediate time. + + Returns: + Tensor: Updated state tensor. + + Raises: + AssertionError: If step size is too small. + """ + s = -torch.log(s) + t = -torch.log(t) + m = -torch.log(s1) + + dt = t - s + assert not torch.any(torch.isclose(dt, torch.zeros_like(dt), atol=1e-6)), "Step size is too small" + assert not torch.any(torch.isclose(m - s, torch.zeros_like(dt), atol=1e-6)), "Step size is too small" + + c2 = (m - s) / dt + phi1_val, phi2_val = phi1(-dt), phi2(-dt) + + # Handle edge case where t = s = m + b1 = torch.nan_to_num(phi1_val - 1.0 / c2 * phi2_val, nan=0.0) + b2 = torch.nan_to_num(1.0 / c2 * phi2_val, nan=0.0) + + return batch_mul(torch.exp(-dt), x_s) + batch_mul(dt, batch_mul(b1, x0_s) + batch_mul(b2, x0_s1)) + + +def reg_x0_euler_step( + x_s: torch.Tensor, + s: torch.Tensor, + t: torch.Tensor, + x0_s: torch.Tensor, +) -> Tuple[torch.Tensor, torch.Tensor]: + """ + Perform a regularized Euler step based on x0 prediction. + + Args: + x_s: Current state tensor. + s: Current time tensor. + t: Target time tensor. + x0_s: Prediction at current time. + + Returns: + Tuple[Tensor, Tensor]: Updated state tensor and current prediction. + """ + coef_x0 = (s - t) / s + coef_xs = t / s + return batch_mul(coef_x0, x0_s) + batch_mul(coef_xs, x_s), x0_s + + +def order2_fn( + x_s: torch.Tensor, s: torch.Tensor, t: torch.Tensor, x0_s: torch.Tensor, x0_preds: torch.Tensor +) -> Tuple[torch.Tensor, List[torch.Tensor]]: + """ + impl the second order multistep method in https://arxiv.org/pdf/2308.02157 + Adams Bashforth approach! + """ + if x0_preds: + x0_s1, s1 = x0_preds[0] + x_t = res_x0_rk2_step(x_s, t, s, x0_s, s1, x0_s1) + else: + x_t = reg_x0_euler_step(x_s, s, t, x0_s)[0] + return x_t, [(x0_s, s)] + + +class SolverConfig: + is_multi: bool = True + rk: str = "2mid" + multistep: str = "2ab" + s_churn: float = 0.0 + s_t_max: float = float("inf") + s_t_min: float = 0.0 + s_noise: float = 1.0 + + +def fori_loop(lower: int, upper: int, body_fun: Callable[[int, Any], Any], init_val: Any, disable=None) -> Any: + """ + Implements a for loop with a function. + + Args: + lower: Lower bound of the loop (inclusive). + upper: Upper bound of the loop (exclusive). + body_fun: Function to be applied in each iteration. + init_val: Initial value for the loop. + + Returns: + The final result after all iterations. + """ + val = init_val + for i in trange(lower, upper, disable=disable): + val = body_fun(i, val) + return val + + +def differential_equation_solver( + x0_fn: Callable[[torch.Tensor, torch.Tensor], torch.Tensor], + sigmas_L: torch.Tensor, + solver_cfg: SolverConfig, + noise_sampler, + callback=None, + disable=None, +) -> Callable[[torch.Tensor], torch.Tensor]: + """ + Creates a differential equation solver function. + + Args: + x0_fn: Function to compute x0 prediction. + sigmas_L: Tensor of sigma values with shape [L,]. + solver_cfg: Configuration for the solver. + + Returns: + A function that solves the differential equation. + """ + num_step = len(sigmas_L) - 1 + + # if solver_cfg.is_multi: + # update_step_fn = get_multi_step_fn(solver_cfg.multistep) + # else: + # update_step_fn = get_runge_kutta_fn(solver_cfg.rk) + update_step_fn = order2_fn + + eta = min(solver_cfg.s_churn / (num_step + 1), math.sqrt(1.2) - 1) + + def sample_fn(input_xT_B_StateShape: torch.Tensor) -> torch.Tensor: + """ + Samples from the differential equation. + + Args: + input_xT_B_StateShape: Input tensor with shape [B, StateShape]. + + Returns: + Output tensor with shape [B, StateShape]. + """ + ones_B = torch.ones(input_xT_B_StateShape.size(0), device=input_xT_B_StateShape.device, dtype=torch.float32) + + def step_fn( + i_th: int, state: Tuple[torch.Tensor, Optional[List[torch.Tensor]]] + ) -> Tuple[torch.Tensor, Optional[List[torch.Tensor]]]: + input_x_B_StateShape, x0_preds = state + sigma_cur_0, sigma_next_0 = sigmas_L[i_th], sigmas_L[i_th + 1] + + if sigma_next_0 == 0: + output_x_B_StateShape = x0_pred_B_StateShape = x0_fn(input_x_B_StateShape, sigma_cur_0 * ones_B) + else: + # algorithm 2: line 4-6 + if solver_cfg.s_t_min < sigma_cur_0 < solver_cfg.s_t_max and eta > 0: + hat_sigma_cur_0 = sigma_cur_0 + eta * sigma_cur_0 + input_x_B_StateShape = input_x_B_StateShape + ( + hat_sigma_cur_0**2 - sigma_cur_0**2 + ).sqrt() * solver_cfg.s_noise * noise_sampler(sigma_cur_0, sigma_next_0) # torch.randn_like(input_x_B_StateShape) + sigma_cur_0 = hat_sigma_cur_0 + + if solver_cfg.is_multi: + x0_pred_B_StateShape = x0_fn(input_x_B_StateShape, sigma_cur_0 * ones_B) + output_x_B_StateShape, x0_preds = update_step_fn( + input_x_B_StateShape, sigma_cur_0 * ones_B, sigma_next_0 * ones_B, x0_pred_B_StateShape, x0_preds + ) + else: + output_x_B_StateShape, x0_preds = update_step_fn( + input_x_B_StateShape, sigma_cur_0 * ones_B, sigma_next_0 * ones_B, x0_fn + ) + + if callback is not None: + callback({'x': input_x_B_StateShape, 'i': i_th, 'sigma': sigma_cur_0, 'sigma_hat': sigma_cur_0, 'denoised': x0_pred_B_StateShape}) + + return output_x_B_StateShape, x0_preds + + x_at_eps, _ = fori_loop(0, num_step, step_fn, [input_xT_B_StateShape, None], disable=disable) + return x_at_eps + + return sample_fn diff --git a/comfy/k_diffusion/sampling.py b/comfy/k_diffusion/sampling.py index 413ad5aa..3a98e6a7 100644 --- a/comfy/k_diffusion/sampling.py +++ b/comfy/k_diffusion/sampling.py @@ -8,6 +8,7 @@ from tqdm.auto import trange, tqdm from . import utils from . import deis +from . import res import comfy.model_patcher import comfy.model_sampling @@ -1265,3 +1266,20 @@ def sample_dpmpp_2m_cfg_pp(model, x, sigmas, extra_args=None, callback=None, dis x = denoised + denoised_mix + torch.exp(-h) * x old_uncond_denoised = uncond_denoised return x + +@torch.no_grad() +def sample_res_multistep(model, x, sigmas, extra_args=None, callback=None, disable=None, s_churn=0., s_tmin=0., s_tmax=float('inf'), s_noise=1., noise_sampler=None): + extra_args = {} if extra_args is None else extra_args + seed = extra_args.get("seed", None) + noise_sampler = default_noise_sampler(x, seed=seed) if noise_sampler is None else noise_sampler + + x0_func = lambda x, sigma: model(x, sigma, **extra_args) + + solver_cfg = res.SolverConfig() + solver_cfg.s_churn = s_churn + solver_cfg.s_t_max = s_tmax + solver_cfg.s_t_min = s_tmin + solver_cfg.s_noise = s_noise + + x = res.differential_equation_solver(x0_func, sigmas, solver_cfg, noise_sampler, callback=callback, disable=disable)(x) + return x diff --git a/comfy/samplers.py b/comfy/samplers.py index 5cc33a7d..fa176c6d 100644 --- a/comfy/samplers.py +++ b/comfy/samplers.py @@ -687,7 +687,7 @@ class Sampler: KSAMPLER_NAMES = ["euler", "euler_cfg_pp", "euler_ancestral", "euler_ancestral_cfg_pp", "heun", "heunpp2","dpm_2", "dpm_2_ancestral", "lms", "dpm_fast", "dpm_adaptive", "dpmpp_2s_ancestral", "dpmpp_2s_ancestral_cfg_pp", "dpmpp_sde", "dpmpp_sde_gpu", "dpmpp_2m", "dpmpp_2m_cfg_pp", "dpmpp_2m_sde", "dpmpp_2m_sde_gpu", "dpmpp_3m_sde", "dpmpp_3m_sde_gpu", "ddpm", "lcm", - "ipndm", "ipndm_v", "deis"] + "ipndm", "ipndm_v", "deis", "res_multistep"] class KSAMPLER(Sampler): def __init__(self, sampler_function, extra_options={}, inpaint_options={}): From 1f1c7b7b5673fac3d3d38a1291ed1171f6cdc3eb Mon Sep 17 00:00:00 2001 From: comfyanonymous <comfyanonymous@protonmail.com> Date: Mon, 13 Jan 2025 03:52:37 -0500 Subject: [PATCH 17/47] Remove useless code. --- comfy/ldm/cosmos/cosmos_tokenizer/utils.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/comfy/ldm/cosmos/cosmos_tokenizer/utils.py b/comfy/ldm/cosmos/cosmos_tokenizer/utils.py index 64dd5e28..3af8d0d0 100644 --- a/comfy/ldm/cosmos/cosmos_tokenizer/utils.py +++ b/comfy/ldm/cosmos/cosmos_tokenizer/utils.py @@ -17,7 +17,7 @@ from typing import Any import torch -from einops import pack, rearrange, unpack +from einops import rearrange import comfy.ops @@ -98,14 +98,6 @@ def default(*args): return None -def pack_one(t, pattern): - return pack([t], pattern) - - -def unpack_one(t, ps, pattern): - return unpack(t, ps, pattern)[0] - - def round_ste(z: torch.Tensor) -> torch.Tensor: """Round with straight through gradients.""" zhat = z.round() From 3aaabb12d422eb35cd0314a09582c0a47d505a37 Mon Sep 17 00:00:00 2001 From: comfyanonymous <comfyanonymous@protonmail.com> Date: Tue, 14 Jan 2025 05:14:10 -0500 Subject: [PATCH 18/47] Implement Cosmos Image/Video to World (Video) diffusion models. Use CosmosImageToVideoLatent to set the input image/video. --- comfy/model_base.py | 29 ++++++++++++++++++++---- comfy/model_detection.py | 5 ++-- comfy/samplers.py | 2 +- comfy/sd.py | 2 +- comfy/supported_models.py | 14 ++++++++++-- comfy_extras/nodes_cosmos.py | 44 +++++++++++++++++++++++++++++++++++- 6 files changed, 84 insertions(+), 12 deletions(-) diff --git a/comfy/model_base.py b/comfy/model_base.py index a67504cb..7625b712 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -189,9 +189,10 @@ class BaseModel(torch.nn.Module): if denoise_mask is not None: if len(denoise_mask.shape) == len(noise.shape): - denoise_mask = denoise_mask[:,:1] + denoise_mask = denoise_mask[:, :1] - denoise_mask = denoise_mask.reshape((-1, 1, denoise_mask.shape[-2], denoise_mask.shape[-1])) + num_dim = noise.ndim - 2 + denoise_mask = denoise_mask.reshape((-1, 1) + tuple(denoise_mask.shape[-num_dim:])) if denoise_mask.shape[-2:] != noise.shape[-2:]: denoise_mask = utils.common_upscale(denoise_mask, noise.shape[-1], noise.shape[-2], "bilinear", "center") denoise_mask = utils.resize_to_batch_size(denoise_mask.round(), noise.shape[0]) @@ -201,12 +202,16 @@ class BaseModel(torch.nn.Module): if ck == "mask": cond_concat.append(denoise_mask.to(device)) elif ck == "masked_image": - cond_concat.append(concat_latent_image.to(device)) #NOTE: the latent_image should be masked by the mask in pixel space + cond_concat.append(concat_latent_image.to(device)) # NOTE: the latent_image should be masked by the mask in pixel space + elif ck == "mask_inverted": + cond_concat.append(1.0 - denoise_mask.to(device)) else: if ck == "mask": - cond_concat.append(torch.ones_like(noise)[:,:1]) + cond_concat.append(torch.ones_like(noise)[:, :1]) elif ck == "masked_image": cond_concat.append(self.blank_inpaint_image_like(noise)) + elif ck == "mask_inverted": + cond_concat.append(torch.zeros_like(noise)[:, :1]) data = torch.cat(cond_concat, dim=1) return data return None @@ -294,6 +299,9 @@ class BaseModel(torch.nn.Module): return blank_image self.blank_inpaint_image_like = blank_inpaint_image_like + def scale_latent_inpaint(self, sigma, noise, latent_image, **kwargs): + return self.model_sampling.noise_scaling(sigma.reshape([sigma.shape[0]] + [1] * (len(noise.shape) - 1)), noise, latent_image) + def memory_required(self, input_shape): if comfy.model_management.xformers_enabled() or comfy.model_management.pytorch_attention_flash_attention(): dtype = self.get_dtype() @@ -859,8 +867,11 @@ class HunyuanVideo(BaseModel): return out class CosmosVideo(BaseModel): - def __init__(self, model_config, model_type=ModelType.EDM, device=None): + def __init__(self, model_config, model_type=ModelType.EDM, image_to_video=False, device=None): super().__init__(model_config, model_type, device=device, unet_model=comfy.ldm.cosmos.model.GeneralDIT) + self.image_to_video = image_to_video + if self.image_to_video: + self.concat_keys = ("mask_inverted",) def extra_conds(self, **kwargs): out = super().extra_conds(**kwargs) @@ -873,3 +884,11 @@ class CosmosVideo(BaseModel): out['fps'] = comfy.conds.CONDConstant(kwargs.get("frame_rate", None)) return out + + def scale_latent_inpaint(self, sigma, noise, latent_image, **kwargs): + sigma = sigma.reshape([sigma.shape[0]] + [1] * (len(noise.shape) - 1)) + sigma_noise_augmentation = 0 #TODO + if sigma_noise_augmentation != 0: + latent_image = latent_image + noise + latent_image = self.model_sampling.calculate_input(torch.tensor([sigma_noise_augmentation], device=latent_image.device, dtype=latent_image.dtype), latent_image) + return latent_image * ((sigma ** 2 + self.model_sampling.sigma_data ** 2) ** 0.5) diff --git a/comfy/model_detection.py b/comfy/model_detection.py index 20cd6bb8..ba96ebe8 100644 --- a/comfy/model_detection.py +++ b/comfy/model_detection.py @@ -245,13 +245,14 @@ def detect_unet_config(state_dict, key_prefix): dit_config["max_img_h"] = 240 dit_config["max_img_w"] = 240 dit_config["max_frames"] = 128 - dit_config["in_channels"] = 16 + concat_padding_mask = True + dit_config["in_channels"] = (state_dict['{}x_embedder.proj.1.weight'.format(key_prefix)].shape[1] // 4) - int(concat_padding_mask) dit_config["out_channels"] = 16 dit_config["patch_spatial"] = 2 dit_config["patch_temporal"] = 1 dit_config["model_channels"] = state_dict['{}blocks.block0.blocks.0.block.attn.to_q.0.weight'.format(key_prefix)].shape[0] dit_config["block_config"] = "FA-CA-MLP" - dit_config["concat_padding_mask"] = True + dit_config["concat_padding_mask"] = concat_padding_mask dit_config["pos_emb_cls"] = "rope3d" dit_config["pos_emb_learnable"] = False dit_config["pos_emb_interpolation"] = "crop" diff --git a/comfy/samplers.py b/comfy/samplers.py index fa176c6d..8f25935d 100644 --- a/comfy/samplers.py +++ b/comfy/samplers.py @@ -376,7 +376,7 @@ class KSamplerX0Inpaint: if "denoise_mask_function" in model_options: denoise_mask = model_options["denoise_mask_function"](sigma, denoise_mask, extra_options={"model": self.inner_model, "sigmas": self.sigmas}) latent_mask = 1. - denoise_mask - x = x * denoise_mask + self.inner_model.inner_model.model_sampling.noise_scaling(sigma.reshape([sigma.shape[0]] + [1] * (len(self.noise.shape) - 1)), self.noise, self.latent_image) * latent_mask + x = x * denoise_mask + self.inner_model.inner_model.scale_latent_inpaint(x=x, sigma=sigma, noise=self.noise, latent_image=self.latent_image) * latent_mask out = self.inner_model(x, sigma, model_options=model_options, seed=seed) if denoise_mask is not None: out = out * denoise_mask + self.latent_image * latent_mask diff --git a/comfy/sd.py b/comfy/sd.py index 7db1c2d6..6ba6af47 100644 --- a/comfy/sd.py +++ b/comfy/sd.py @@ -534,7 +534,7 @@ class VAE: def encode(self, pixel_samples): pixel_samples = self.vae_encode_crop_pixels(pixel_samples) pixel_samples = pixel_samples.movedim(-1, 1) - if self.latent_dim == 3: + if self.latent_dim == 3 and pixel_samples.ndim < 5: pixel_samples = pixel_samples.movedim(1, 0).unsqueeze(0) try: memory_used = self.memory_used_encode(pixel_samples.shape, self.vae_dtype) diff --git a/comfy/supported_models.py b/comfy/supported_models.py index 31de1ae9..ff3f1432 100644 --- a/comfy/supported_models.py +++ b/comfy/supported_models.py @@ -824,9 +824,10 @@ class HunyuanVideo(supported_models_base.BASE): hunyuan_detect = comfy.text_encoders.hunyuan_video.llama_detect(state_dict, "{}llama.transformer.".format(pref)) return supported_models_base.ClipTarget(comfy.text_encoders.hunyuan_video.HunyuanVideoTokenizer, comfy.text_encoders.hunyuan_video.hunyuan_video_clip(**hunyuan_detect)) -class Cosmos(supported_models_base.BASE): +class CosmosT2V(supported_models_base.BASE): unet_config = { "image_model": "cosmos", + "in_channels": 16, } sampling_settings = { @@ -854,7 +855,16 @@ class Cosmos(supported_models_base.BASE): t5_detect = comfy.text_encoders.sd3_clip.t5_xxl_detect(state_dict, "{}t5xxl.transformer.".format(pref)) return supported_models_base.ClipTarget(comfy.text_encoders.cosmos.CosmosT5Tokenizer, comfy.text_encoders.cosmos.te(**t5_detect)) +class CosmosI2V(CosmosT2V): + unet_config = { + "image_model": "cosmos", + "in_channels": 17, + } -models = [Stable_Zero123, SD15_instructpix2pix, SD15, SD20, SD21UnclipL, SD21UnclipH, SDXL_instructpix2pix, SDXLRefiner, SDXL, SSD1B, KOALA_700M, KOALA_1B, Segmind_Vega, SD_X4Upscaler, Stable_Cascade_C, Stable_Cascade_B, SV3D_u, SV3D_p, SD3, StableAudio, AuraFlow, PixArtAlpha, PixArtSigma, HunyuanDiT, HunyuanDiT1, FluxInpaint, Flux, FluxSchnell, GenmoMochi, LTXV, HunyuanVideo, Cosmos] + def get_model(self, state_dict, prefix="", device=None): + out = model_base.CosmosVideo(self, image_to_video=True, device=device) + return out + +models = [Stable_Zero123, SD15_instructpix2pix, SD15, SD20, SD21UnclipL, SD21UnclipH, SDXL_instructpix2pix, SDXLRefiner, SDXL, SSD1B, KOALA_700M, KOALA_1B, Segmind_Vega, SD_X4Upscaler, Stable_Cascade_C, Stable_Cascade_B, SV3D_u, SV3D_p, SD3, StableAudio, AuraFlow, PixArtAlpha, PixArtSigma, HunyuanDiT, HunyuanDiT1, FluxInpaint, Flux, FluxSchnell, GenmoMochi, LTXV, HunyuanVideo, CosmosT2V, CosmosI2V] models += [SVD_img2vid] diff --git a/comfy_extras/nodes_cosmos.py b/comfy_extras/nodes_cosmos.py index d88773e2..5fbabb9a 100644 --- a/comfy_extras/nodes_cosmos.py +++ b/comfy_extras/nodes_cosmos.py @@ -1,6 +1,8 @@ import nodes import torch import comfy.model_management +import comfy.utils + class EmptyCosmosLatentVideo: @classmethod @@ -16,8 +18,48 @@ class EmptyCosmosLatentVideo: def generate(self, width, height, length, batch_size=1): latent = torch.zeros([batch_size, 16, ((length - 1) // 8) + 1, height // 8, width // 8], device=comfy.model_management.intermediate_device()) - return ({"samples":latent}, ) + return ({"samples": latent}, ) + + +class CosmosImageToVideoLatent: + @classmethod + def INPUT_TYPES(s): + return {"required": {"vae": ("VAE", ), + "image": ("IMAGE", ), + "width": ("INT", {"default": 1280, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}), + "height": ("INT", {"default": 704, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}), + "length": ("INT", {"default": 121, "min": 1, "max": nodes.MAX_RESOLUTION, "step": 8}), + "batch_size": ("INT", {"default": 1, "min": 1, "max": 4096}), + }} + + RETURN_TYPES = ("LATENT",) + FUNCTION = "encode" + + CATEGORY = "conditioning/inpaint" + + def encode(self, vae, image, width, height, length, batch_size): + pixels = comfy.utils.common_upscale(image[..., :3].movedim(-1, 1), width, height, "bilinear", "center").movedim(1, -1) + pixel_len = min(pixels.shape[0], length) + padded_length = min(length, (((pixel_len - 1) // 8) + 2) * 8 - 7) + padded_pixels = torch.ones((padded_length, height, width, 3)) * 0.5 + padded_pixels[:pixel_len] = pixels[:pixel_len] + + latent_temp = vae.encode(padded_pixels) + + latent = torch.zeros([1, latent_temp.shape[1], ((length - 1) // 8) + 1, latent_temp.shape[-2], latent_temp.shape[-1]], device=comfy.model_management.intermediate_device()) + latent_len = ((pixel_len - 1) // 8) + 1 + latent[:, :, :latent_len] = latent_temp[:, :, :latent_len] + + mask = torch.ones([latent.shape[0], 1, ((length - 1) // 8) + 1, latent.shape[-2], latent.shape[-1]], device=comfy.model_management.intermediate_device()) + mask[:, :, :latent_len] *= 0.0 + + out_latent = {} + out_latent["samples"] = latent + out_latent["noise_mask"] = mask + return (out_latent,) + NODE_CLASS_MAPPINGS = { "EmptyCosmosLatentVideo": EmptyCosmosLatentVideo, + "CosmosImageToVideoLatent": CosmosImageToVideoLatent, } From c78a45685d2664e03927b8b57bc2f950c47d6ad3 Mon Sep 17 00:00:00 2001 From: Pam <42671363+pamparamm@users.noreply.github.com> Date: Wed, 15 Jan 2025 04:20:06 +0500 Subject: [PATCH 19/47] Rewrite res_multistep sampler and implement res_multistep_cfg_pp sampler. (#6462) --- comfy/k_diffusion/res.py | 258 ---------------------------------- comfy/k_diffusion/sampling.py | 71 ++++++++-- comfy/samplers.py | 2 +- 3 files changed, 63 insertions(+), 268 deletions(-) delete mode 100644 comfy/k_diffusion/res.py diff --git a/comfy/k_diffusion/res.py b/comfy/k_diffusion/res.py deleted file mode 100644 index 6caedec3..00000000 --- a/comfy/k_diffusion/res.py +++ /dev/null @@ -1,258 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Copied from Nvidia Cosmos code. - -import torch -from torch import Tensor -from typing import Callable, List, Tuple, Optional, Any -import math -from tqdm.auto import trange - - -def common_broadcast(x: Tensor, y: Tensor) -> tuple[Tensor, Tensor]: - ndims1 = x.ndim - ndims2 = y.ndim - - if ndims1 < ndims2: - x = x.reshape(x.shape + (1,) * (ndims2 - ndims1)) - elif ndims2 < ndims1: - y = y.reshape(y.shape + (1,) * (ndims1 - ndims2)) - - return x, y - - -def batch_mul(x: Tensor, y: Tensor) -> Tensor: - x, y = common_broadcast(x, y) - return x * y - - -def phi1(t: torch.Tensor) -> torch.Tensor: - """ - Compute the first order phi function: (exp(t) - 1) / t. - - Args: - t: Input tensor. - - Returns: - Tensor: Result of phi1 function. - """ - input_dtype = t.dtype - t = t.to(dtype=torch.float32) - return (torch.expm1(t) / t).to(dtype=input_dtype) - - -def phi2(t: torch.Tensor) -> torch.Tensor: - """ - Compute the second order phi function: (phi1(t) - 1) / t. - - Args: - t: Input tensor. - - Returns: - Tensor: Result of phi2 function. - """ - input_dtype = t.dtype - t = t.to(dtype=torch.float32) - return ((phi1(t) - 1.0) / t).to(dtype=input_dtype) - - -def res_x0_rk2_step( - x_s: torch.Tensor, - t: torch.Tensor, - s: torch.Tensor, - x0_s: torch.Tensor, - s1: torch.Tensor, - x0_s1: torch.Tensor, -) -> torch.Tensor: - """ - Perform a residual-based 2nd order Runge-Kutta step. - - Args: - x_s: Current state tensor. - t: Target time tensor. - s: Current time tensor. - x0_s: Prediction at current time. - s1: Intermediate time tensor. - x0_s1: Prediction at intermediate time. - - Returns: - Tensor: Updated state tensor. - - Raises: - AssertionError: If step size is too small. - """ - s = -torch.log(s) - t = -torch.log(t) - m = -torch.log(s1) - - dt = t - s - assert not torch.any(torch.isclose(dt, torch.zeros_like(dt), atol=1e-6)), "Step size is too small" - assert not torch.any(torch.isclose(m - s, torch.zeros_like(dt), atol=1e-6)), "Step size is too small" - - c2 = (m - s) / dt - phi1_val, phi2_val = phi1(-dt), phi2(-dt) - - # Handle edge case where t = s = m - b1 = torch.nan_to_num(phi1_val - 1.0 / c2 * phi2_val, nan=0.0) - b2 = torch.nan_to_num(1.0 / c2 * phi2_val, nan=0.0) - - return batch_mul(torch.exp(-dt), x_s) + batch_mul(dt, batch_mul(b1, x0_s) + batch_mul(b2, x0_s1)) - - -def reg_x0_euler_step( - x_s: torch.Tensor, - s: torch.Tensor, - t: torch.Tensor, - x0_s: torch.Tensor, -) -> Tuple[torch.Tensor, torch.Tensor]: - """ - Perform a regularized Euler step based on x0 prediction. - - Args: - x_s: Current state tensor. - s: Current time tensor. - t: Target time tensor. - x0_s: Prediction at current time. - - Returns: - Tuple[Tensor, Tensor]: Updated state tensor and current prediction. - """ - coef_x0 = (s - t) / s - coef_xs = t / s - return batch_mul(coef_x0, x0_s) + batch_mul(coef_xs, x_s), x0_s - - -def order2_fn( - x_s: torch.Tensor, s: torch.Tensor, t: torch.Tensor, x0_s: torch.Tensor, x0_preds: torch.Tensor -) -> Tuple[torch.Tensor, List[torch.Tensor]]: - """ - impl the second order multistep method in https://arxiv.org/pdf/2308.02157 - Adams Bashforth approach! - """ - if x0_preds: - x0_s1, s1 = x0_preds[0] - x_t = res_x0_rk2_step(x_s, t, s, x0_s, s1, x0_s1) - else: - x_t = reg_x0_euler_step(x_s, s, t, x0_s)[0] - return x_t, [(x0_s, s)] - - -class SolverConfig: - is_multi: bool = True - rk: str = "2mid" - multistep: str = "2ab" - s_churn: float = 0.0 - s_t_max: float = float("inf") - s_t_min: float = 0.0 - s_noise: float = 1.0 - - -def fori_loop(lower: int, upper: int, body_fun: Callable[[int, Any], Any], init_val: Any, disable=None) -> Any: - """ - Implements a for loop with a function. - - Args: - lower: Lower bound of the loop (inclusive). - upper: Upper bound of the loop (exclusive). - body_fun: Function to be applied in each iteration. - init_val: Initial value for the loop. - - Returns: - The final result after all iterations. - """ - val = init_val - for i in trange(lower, upper, disable=disable): - val = body_fun(i, val) - return val - - -def differential_equation_solver( - x0_fn: Callable[[torch.Tensor, torch.Tensor], torch.Tensor], - sigmas_L: torch.Tensor, - solver_cfg: SolverConfig, - noise_sampler, - callback=None, - disable=None, -) -> Callable[[torch.Tensor], torch.Tensor]: - """ - Creates a differential equation solver function. - - Args: - x0_fn: Function to compute x0 prediction. - sigmas_L: Tensor of sigma values with shape [L,]. - solver_cfg: Configuration for the solver. - - Returns: - A function that solves the differential equation. - """ - num_step = len(sigmas_L) - 1 - - # if solver_cfg.is_multi: - # update_step_fn = get_multi_step_fn(solver_cfg.multistep) - # else: - # update_step_fn = get_runge_kutta_fn(solver_cfg.rk) - update_step_fn = order2_fn - - eta = min(solver_cfg.s_churn / (num_step + 1), math.sqrt(1.2) - 1) - - def sample_fn(input_xT_B_StateShape: torch.Tensor) -> torch.Tensor: - """ - Samples from the differential equation. - - Args: - input_xT_B_StateShape: Input tensor with shape [B, StateShape]. - - Returns: - Output tensor with shape [B, StateShape]. - """ - ones_B = torch.ones(input_xT_B_StateShape.size(0), device=input_xT_B_StateShape.device, dtype=torch.float32) - - def step_fn( - i_th: int, state: Tuple[torch.Tensor, Optional[List[torch.Tensor]]] - ) -> Tuple[torch.Tensor, Optional[List[torch.Tensor]]]: - input_x_B_StateShape, x0_preds = state - sigma_cur_0, sigma_next_0 = sigmas_L[i_th], sigmas_L[i_th + 1] - - if sigma_next_0 == 0: - output_x_B_StateShape = x0_pred_B_StateShape = x0_fn(input_x_B_StateShape, sigma_cur_0 * ones_B) - else: - # algorithm 2: line 4-6 - if solver_cfg.s_t_min < sigma_cur_0 < solver_cfg.s_t_max and eta > 0: - hat_sigma_cur_0 = sigma_cur_0 + eta * sigma_cur_0 - input_x_B_StateShape = input_x_B_StateShape + ( - hat_sigma_cur_0**2 - sigma_cur_0**2 - ).sqrt() * solver_cfg.s_noise * noise_sampler(sigma_cur_0, sigma_next_0) # torch.randn_like(input_x_B_StateShape) - sigma_cur_0 = hat_sigma_cur_0 - - if solver_cfg.is_multi: - x0_pred_B_StateShape = x0_fn(input_x_B_StateShape, sigma_cur_0 * ones_B) - output_x_B_StateShape, x0_preds = update_step_fn( - input_x_B_StateShape, sigma_cur_0 * ones_B, sigma_next_0 * ones_B, x0_pred_B_StateShape, x0_preds - ) - else: - output_x_B_StateShape, x0_preds = update_step_fn( - input_x_B_StateShape, sigma_cur_0 * ones_B, sigma_next_0 * ones_B, x0_fn - ) - - if callback is not None: - callback({'x': input_x_B_StateShape, 'i': i_th, 'sigma': sigma_cur_0, 'sigma_hat': sigma_cur_0, 'denoised': x0_pred_B_StateShape}) - - return output_x_B_StateShape, x0_preds - - x_at_eps, _ = fori_loop(0, num_step, step_fn, [input_xT_B_StateShape, None], disable=disable) - return x_at_eps - - return sample_fn diff --git a/comfy/k_diffusion/sampling.py b/comfy/k_diffusion/sampling.py index 3a98e6a7..13ae272f 100644 --- a/comfy/k_diffusion/sampling.py +++ b/comfy/k_diffusion/sampling.py @@ -8,7 +8,6 @@ from tqdm.auto import trange, tqdm from . import utils from . import deis -from . import res import comfy.model_patcher import comfy.model_sampling @@ -1268,18 +1267,72 @@ def sample_dpmpp_2m_cfg_pp(model, x, sigmas, extra_args=None, callback=None, dis return x @torch.no_grad() -def sample_res_multistep(model, x, sigmas, extra_args=None, callback=None, disable=None, s_churn=0., s_tmin=0., s_tmax=float('inf'), s_noise=1., noise_sampler=None): +def res_multistep(model, x, sigmas, extra_args=None, callback=None, disable=None, s_churn=0., s_tmin=0., s_tmax=float('inf'), s_noise=1., noise_sampler=None, cfg_pp=False): extra_args = {} if extra_args is None else extra_args seed = extra_args.get("seed", None) noise_sampler = default_noise_sampler(x, seed=seed) if noise_sampler is None else noise_sampler + s_in = x.new_ones([x.shape[0]]) + sigma_fn = lambda t: t.neg().exp() + t_fn = lambda sigma: sigma.log().neg() + phi1_fn = lambda t: torch.expm1(t) / t + phi2_fn = lambda t: (phi1_fn(t) - 1.0) / t - x0_func = lambda x, sigma: model(x, sigma, **extra_args) + old_denoised = None + uncond_denoised = None + def post_cfg_function(args): + nonlocal uncond_denoised + uncond_denoised = args["uncond_denoised"] + return args["denoised"] - solver_cfg = res.SolverConfig() - solver_cfg.s_churn = s_churn - solver_cfg.s_t_max = s_tmax - solver_cfg.s_t_min = s_tmin - solver_cfg.s_noise = s_noise + if cfg_pp: + model_options = extra_args.get("model_options", {}).copy() + extra_args["model_options"] = comfy.model_patcher.set_model_options_post_cfg_function(model_options, post_cfg_function, disable_cfg1_optimization=True) - x = res.differential_equation_solver(x0_func, sigmas, solver_cfg, noise_sampler, callback=callback, disable=disable)(x) + for i in trange(len(sigmas) - 1, disable=disable): + if s_churn > 0: + gamma = min(s_churn / (len(sigmas) - 1), 2**0.5 - 1) if s_tmin <= sigmas[i] <= s_tmax else 0.0 + sigma_hat = sigmas[i] * (gamma + 1) + else: + gamma = 0 + sigma_hat = sigmas[i] + + if gamma > 0: + eps = torch.randn_like(x) * s_noise + x = x + eps * (sigma_hat**2 - sigmas[i] ** 2) ** 0.5 + denoised = model(x, sigma_hat * s_in, **extra_args) + if callback is not None: + callback({"x": x, "i": i, "sigma": sigmas[i], "sigma_hat": sigma_hat, "denoised": denoised}) + if sigmas[i + 1] == 0 or old_denoised is None: + # Euler method + if cfg_pp: + d = to_d(x, sigma_hat, uncond_denoised) + x = denoised + d * sigmas[i + 1] + else: + d = to_d(x, sigma_hat, denoised) + dt = sigmas[i + 1] - sigma_hat + x = x + d * dt + else: + # Second order multistep method in https://arxiv.org/pdf/2308.02157 + t, t_next, t_prev = t_fn(sigmas[i]), t_fn(sigmas[i + 1]), t_fn(sigmas[i - 1]) + h = t_next - t + c2 = (t_prev - t) / h + + phi1_val, phi2_val = phi1_fn(-h), phi2_fn(-h) + b1 = torch.nan_to_num(phi1_val - 1.0 / c2 * phi2_val, nan=0.0) + b2 = torch.nan_to_num(1.0 / c2 * phi2_val, nan=0.0) + + if cfg_pp: + x = x + (denoised - uncond_denoised) + + x = (sigma_fn(t_next) / sigma_fn(t)) * x + h * (b1 * denoised + b2 * old_denoised) + + old_denoised = denoised return x + +@torch.no_grad() +def sample_res_multistep(model, x, sigmas, extra_args=None, callback=None, disable=None, s_churn=0., s_tmin=0., s_tmax=float('inf'), s_noise=1., noise_sampler=None): + return res_multistep(model, x, sigmas, extra_args=extra_args, callback=callback, disable=disable, s_churn=s_churn, s_tmin=s_tmin, s_tmax=s_tmax, s_noise=s_noise, noise_sampler=noise_sampler, cfg_pp=False) + +@torch.no_grad() +def sample_res_multistep_cfg_pp(model, x, sigmas, extra_args=None, callback=None, disable=None, s_churn=0., s_tmin=0., s_tmax=float('inf'), s_noise=1., noise_sampler=None): + return res_multistep(model, x, sigmas, extra_args=extra_args, callback=callback, disable=disable, s_churn=s_churn, s_tmin=s_tmin, s_tmax=s_tmax, s_noise=s_noise, noise_sampler=noise_sampler, cfg_pp=True) diff --git a/comfy/samplers.py b/comfy/samplers.py index 8f25935d..c508a3a4 100644 --- a/comfy/samplers.py +++ b/comfy/samplers.py @@ -687,7 +687,7 @@ class Sampler: KSAMPLER_NAMES = ["euler", "euler_cfg_pp", "euler_ancestral", "euler_ancestral_cfg_pp", "heun", "heunpp2","dpm_2", "dpm_2_ancestral", "lms", "dpm_fast", "dpm_adaptive", "dpmpp_2s_ancestral", "dpmpp_2s_ancestral_cfg_pp", "dpmpp_sde", "dpmpp_sde_gpu", "dpmpp_2m", "dpmpp_2m_cfg_pp", "dpmpp_2m_sde", "dpmpp_2m_sde_gpu", "dpmpp_3m_sde", "dpmpp_3m_sde_gpu", "ddpm", "lcm", - "ipndm", "ipndm_v", "deis", "res_multistep"] + "ipndm", "ipndm_v", "deis", "res_multistep", "res_multistep_cfg_pp"] class KSAMPLER(Sampler): def __init__(self, sampler_function, extra_options={}, inpaint_options={}): From 2cdbaf5169a631b126542f41432f2484c4f0a608 Mon Sep 17 00:00:00 2001 From: catboxanon <122327233+catboxanon@users.noreply.github.com> Date: Tue, 14 Jan 2025 19:05:45 -0500 Subject: [PATCH 20/47] Add SetFirstSigma node (#6459) Useful for models utilizing ztSNR. See: https://arxiv.org/abs/2409.15997 --- comfy_extras/nodes_custom_sampler.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/comfy_extras/nodes_custom_sampler.py b/comfy_extras/nodes_custom_sampler.py index c7ff9a4d..576fc3b2 100644 --- a/comfy_extras/nodes_custom_sampler.py +++ b/comfy_extras/nodes_custom_sampler.py @@ -231,6 +231,24 @@ class FlipSigmas: sigmas[0] = 0.0001 return (sigmas,) +class SetFirstSigma: + @classmethod + def INPUT_TYPES(s): + return {"required": + {"sigmas": ("SIGMAS", ), + "sigma": ("FLOAT", {"default": 136.0, "min": 0.0, "max": 20000.0, "step": 0.001, "round": False}), + } + } + RETURN_TYPES = ("SIGMAS",) + CATEGORY = "sampling/custom_sampling/sigmas" + + FUNCTION = "set_first_sigma" + + def set_first_sigma(self, sigmas, sigma): + sigmas = sigmas.clone() + sigmas[0] = sigma + return (sigmas, ) + class KSamplerSelect: @classmethod def INPUT_TYPES(s): @@ -710,6 +728,7 @@ NODE_CLASS_MAPPINGS = { "SplitSigmas": SplitSigmas, "SplitSigmasDenoise": SplitSigmasDenoise, "FlipSigmas": FlipSigmas, + "SetFirstSigma": SetFirstSigma, "CFGGuider": CFGGuider, "DualCFGGuider": DualCFGGuider, From 5b657f8c15a2cc437049dcbfc10eb268fb0194d4 Mon Sep 17 00:00:00 2001 From: comfyanonymous <comfyanonymous@protonmail.com> Date: Wed, 15 Jan 2025 00:41:35 -0500 Subject: [PATCH 21/47] Allow setting start and end image in CosmosImageToVideoLatent. --- comfy_extras/nodes_cosmos.py | 47 ++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/comfy_extras/nodes_cosmos.py b/comfy_extras/nodes_cosmos.py index 5fbabb9a..b76ff950 100644 --- a/comfy_extras/nodes_cosmos.py +++ b/comfy_extras/nodes_cosmos.py @@ -21,37 +21,54 @@ class EmptyCosmosLatentVideo: return ({"samples": latent}, ) +def vae_encode_with_padding(vae, image, width, height, length, padding=0): + pixels = comfy.utils.common_upscale(image[..., :3].movedim(-1, 1), width, height, "bilinear", "center").movedim(1, -1) + pixel_len = min(pixels.shape[0], length) + padded_length = min(length, (((pixel_len - 1) // 8) + 1 + padding) * 8 - 7) + padded_pixels = torch.ones((padded_length, height, width, 3)) * 0.5 + padded_pixels[:pixel_len] = pixels[:pixel_len] + latent_len = ((pixel_len - 1) // 8) + 1 + latent_temp = vae.encode(padded_pixels) + return latent_temp[:, :, :latent_len] + + class CosmosImageToVideoLatent: @classmethod def INPUT_TYPES(s): return {"required": {"vae": ("VAE", ), - "image": ("IMAGE", ), "width": ("INT", {"default": 1280, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}), "height": ("INT", {"default": 704, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}), "length": ("INT", {"default": 121, "min": 1, "max": nodes.MAX_RESOLUTION, "step": 8}), "batch_size": ("INT", {"default": 1, "min": 1, "max": 4096}), - }} + }, + "optional": {"start_image": ("IMAGE", ), + "end_image": ("IMAGE", ), + }} + RETURN_TYPES = ("LATENT",) FUNCTION = "encode" CATEGORY = "conditioning/inpaint" - def encode(self, vae, image, width, height, length, batch_size): - pixels = comfy.utils.common_upscale(image[..., :3].movedim(-1, 1), width, height, "bilinear", "center").movedim(1, -1) - pixel_len = min(pixels.shape[0], length) - padded_length = min(length, (((pixel_len - 1) // 8) + 2) * 8 - 7) - padded_pixels = torch.ones((padded_length, height, width, 3)) * 0.5 - padded_pixels[:pixel_len] = pixels[:pixel_len] - - latent_temp = vae.encode(padded_pixels) - - latent = torch.zeros([1, latent_temp.shape[1], ((length - 1) // 8) + 1, latent_temp.shape[-2], latent_temp.shape[-1]], device=comfy.model_management.intermediate_device()) - latent_len = ((pixel_len - 1) // 8) + 1 - latent[:, :, :latent_len] = latent_temp[:, :, :latent_len] + def encode(self, vae, width, height, length, batch_size, start_image=None, end_image=None): + latent = torch.zeros([1, 16, ((length - 1) // 8) + 1, height // 8, width // 8], device=comfy.model_management.intermediate_device()) + if start_image is None and end_image is None: + out_latent = {} + out_latent["samples"] = latent + return (out_latent,) mask = torch.ones([latent.shape[0], 1, ((length - 1) // 8) + 1, latent.shape[-2], latent.shape[-1]], device=comfy.model_management.intermediate_device()) - mask[:, :, :latent_len] *= 0.0 + + if start_image is not None: + latent_temp = vae_encode_with_padding(vae, start_image, width, height, length, padding=1) + latent[:, :, :latent_temp.shape[-3]] = latent_temp + mask[:, :, :latent_temp.shape[-3]] *= 0.0 + + if end_image is not None: + latent_temp = vae_encode_with_padding(vae, end_image, width, height, length, padding=0) + latent[:, :, -latent_temp.shape[-3]:] = latent_temp + mask[:, :, -latent_temp.shape[-3]:] *= 0.0 out_latent = {} out_latent["samples"] = latent From 2feb8d0b77ce80a471ecab84b92d5bbcaa37f8fe Mon Sep 17 00:00:00 2001 From: comfyanonymous <comfyanonymous@protonmail.com> Date: Wed, 15 Jan 2025 03:50:27 -0500 Subject: [PATCH 22/47] Force safe loading of files in torch format on pytorch 2.4+ If this breaks something for you make an issue. --- comfy/utils.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/comfy/utils.py b/comfy/utils.py index b486b2de..bcefa180 100644 --- a/comfy/utils.py +++ b/comfy/utils.py @@ -29,17 +29,29 @@ import itertools from torch.nn.functional import interpolate from einops import rearrange +ALWAYS_SAFE_LOAD = False +if hasattr(torch.serialization, "add_safe_globals"): # TODO: this was added in pytorch 2.4, the unsafe path should be removed once earlier versions are deprecated + class ModelCheckpoint: + pass + ModelCheckpoint.__module__ = "pytorch_lightning.callbacks.model_checkpoint" + + from numpy.core.multiarray import scalar + from numpy import dtype + from numpy.dtypes import Float64DType + from _codecs import encode + + torch.serialization.add_safe_globals([ModelCheckpoint, scalar, dtype, Float64DType, encode]) + ALWAYS_SAFE_LOAD = True + logging.info("Checkpoint files will always be loaded safely.") + + def load_torch_file(ckpt, safe_load=False, device=None): if device is None: device = torch.device("cpu") if ckpt.lower().endswith(".safetensors") or ckpt.lower().endswith(".sft"): sd = safetensors.torch.load_file(ckpt, device=device.type) else: - if safe_load: - if not 'weights_only' in torch.load.__code__.co_varnames: - logging.warning("Warning torch.load doesn't support weights_only on this pytorch version, loading unsafely.") - safe_load = False - if safe_load: + if safe_load or ALWAYS_SAFE_LOAD: pl_sd = torch.load(ckpt, map_location=device, weights_only=True) else: pl_sd = torch.load(ckpt, map_location=device, pickle_module=comfy.checkpoint_pickle) From cba58fff0bfebfc81fbe678bb80491890a3df14a Mon Sep 17 00:00:00 2001 From: comfyanonymous <comfyanonymous@protonmail.com> Date: Wed, 15 Jan 2025 04:32:23 -0500 Subject: [PATCH 23/47] Remove unsafe embedding load for very old pytorch. --- comfy/sd1_clip.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/comfy/sd1_clip.py b/comfy/sd1_clip.py index 95d41c30..85518afd 100644 --- a/comfy/sd1_clip.py +++ b/comfy/sd1_clip.py @@ -388,13 +388,10 @@ def load_embed(embedding_name, embedding_directory, embedding_size, embed_key=No import safetensors.torch embed = safetensors.torch.load_file(embed_path, device="cpu") else: - if 'weights_only' in torch.load.__code__.co_varnames: - try: - embed = torch.load(embed_path, weights_only=True, map_location="cpu") - except: - embed_out = safe_load_embed_zip(embed_path) - else: - embed = torch.load(embed_path, map_location="cpu") + try: + embed = torch.load(embed_path, weights_only=True, map_location="cpu") + except: + embed_out = safe_load_embed_zip(embed_path) except Exception: logging.warning("{}\n\nerror loading embedding, skipping loading: {}".format(traceback.format_exc(), embedding_name)) return None From 1709a8441e7ad88ead87285b802e429b5ab7aebb Mon Sep 17 00:00:00 2001 From: comfyanonymous <comfyanonymous@protonmail.com> Date: Wed, 15 Jan 2025 14:50:40 -0500 Subject: [PATCH 24/47] Use latest python 3.12.8 the portable release. --- .github/workflows/stable-release.yml | 2 +- .github/workflows/windows_release_dependencies.yml | 2 +- .github/workflows/windows_release_package.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/stable-release.yml b/.github/workflows/stable-release.yml index 0bdd5a3b..4a5ba58f 100644 --- a/.github/workflows/stable-release.yml +++ b/.github/workflows/stable-release.yml @@ -22,7 +22,7 @@ on: description: 'Python patch version' required: true type: string - default: "7" + default: "8" jobs: diff --git a/.github/workflows/windows_release_dependencies.yml b/.github/workflows/windows_release_dependencies.yml index 85e6a52f..6c7937ae 100644 --- a/.github/workflows/windows_release_dependencies.yml +++ b/.github/workflows/windows_release_dependencies.yml @@ -29,7 +29,7 @@ on: description: 'python patch version' required: true type: string - default: "7" + default: "8" # push: # branches: # - master diff --git a/.github/workflows/windows_release_package.yml b/.github/workflows/windows_release_package.yml index 11e724ba..24f928ee 100644 --- a/.github/workflows/windows_release_package.yml +++ b/.github/workflows/windows_release_package.yml @@ -19,7 +19,7 @@ on: description: 'python patch version' required: true type: string - default: "7" + default: "8" # push: # branches: # - master From 3baf92d120a91842c84a9907883eda64882e90d6 Mon Sep 17 00:00:00 2001 From: comfyanonymous <comfyanonymous@protonmail.com> Date: Wed, 15 Jan 2025 17:19:59 -0500 Subject: [PATCH 25/47] CosmosImageToVideoLatent batch_size now does something. --- comfy_extras/nodes_cosmos.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/comfy_extras/nodes_cosmos.py b/comfy_extras/nodes_cosmos.py index b76ff950..bd35ddb0 100644 --- a/comfy_extras/nodes_cosmos.py +++ b/comfy_extras/nodes_cosmos.py @@ -71,8 +71,8 @@ class CosmosImageToVideoLatent: mask[:, :, -latent_temp.shape[-3]:] *= 0.0 out_latent = {} - out_latent["samples"] = latent - out_latent["noise_mask"] = mask + out_latent["samples"] = latent.repeat((batch_size, ) + (1,) * (latent.ndim - 1)) + out_latent["noise_mask"] = mask.repeat((batch_size, ) + (1,) * (mask.ndim - 1)) return (out_latent,) From 2e20e399ea6d9fad5f0e40f987d96088f052b74c Mon Sep 17 00:00:00 2001 From: comfyanonymous <comfyanonymous@protonmail.com> Date: Wed, 15 Jan 2025 20:19:56 -0500 Subject: [PATCH 26/47] Add minimum numpy version to requirements.txt --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 4c2c0b2b..3bc945a1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,6 +2,7 @@ torch torchsde torchvision torchaudio +numpy>=1.25.0 einops transformers>=4.28.1 tokenizers>=0.13.3 From 55ade36d01fd4bf3c1ba7238a06a5fa386597124 Mon Sep 17 00:00:00 2001 From: comfyanonymous <comfyanonymous@protonmail.com> Date: Wed, 15 Jan 2025 20:24:55 -0500 Subject: [PATCH 27/47] Remove python 3.8 from test-build workflow. --- .github/workflows/test-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 444d6b25..419873ad 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} @@ -28,4 +28,4 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt \ No newline at end of file + pip install -r requirements.txt From bfd5dfd6111d4133b305b8174c71b224a780b6e3 Mon Sep 17 00:00:00 2001 From: comfyanonymous <comfyanonymous@protonmail.com> Date: Wed, 15 Jan 2025 20:32:44 -0500 Subject: [PATCH 28/47] 3.13 doesn't work yet. --- .github/workflows/test-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 419873ad..865e1ec2 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] + python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} From 008761166fdf90db95f7f757f6f995be8bded508 Mon Sep 17 00:00:00 2001 From: comfyanonymous <comfyanonymous@protonmail.com> Date: Wed, 15 Jan 2025 21:48:46 -0500 Subject: [PATCH 29/47] Optimize first attention block in cosmos VAE. --- comfy/ldm/cosmos/cosmos_tokenizer/layers3d.py | 17 +++++---------- comfy/ldm/modules/diffusionmodules/model.py | 21 +++++++++++-------- 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/comfy/ldm/cosmos/cosmos_tokenizer/layers3d.py b/comfy/ldm/cosmos/cosmos_tokenizer/layers3d.py index 6149e53e..7d864a75 100644 --- a/comfy/ldm/cosmos/cosmos_tokenizer/layers3d.py +++ b/comfy/ldm/cosmos/cosmos_tokenizer/layers3d.py @@ -30,6 +30,8 @@ import torch.nn as nn import torch.nn.functional as F import logging +from comfy.ldm.modules.diffusionmodules.model import vae_attention + from .patching import ( Patcher, Patcher3D, @@ -400,6 +402,8 @@ class CausalAttnBlock(nn.Module): in_channels, in_channels, kernel_size=1, stride=1, padding=0 ) + self.optimized_attention = vae_attention() + def forward(self, x: torch.Tensor) -> torch.Tensor: h_ = x h_ = self.norm(h_) @@ -413,18 +417,7 @@ class CausalAttnBlock(nn.Module): v, batch_size = time2batch(v) b, c, h, w = q.shape - q = q.reshape(b, c, h * w) - q = q.permute(0, 2, 1) - k = k.reshape(b, c, h * w) - w_ = torch.bmm(q, k) - w_ = w_ * (int(c) ** (-0.5)) - w_ = F.softmax(w_, dim=2) - - # attend to values - v = v.reshape(b, c, h * w) - w_ = w_.permute(0, 2, 1) - h_ = torch.bmm(v, w_) - h_ = h_.reshape(b, c, h, w) + h_ = self.optimized_attention(q, k, v) h_ = batch2time(h_, batch_size) h_ = self.proj_out(h_) diff --git a/comfy/ldm/modules/diffusionmodules/model.py b/comfy/ldm/modules/diffusionmodules/model.py index ed1e8821..303147a9 100644 --- a/comfy/ldm/modules/diffusionmodules/model.py +++ b/comfy/ldm/modules/diffusionmodules/model.py @@ -293,6 +293,17 @@ def pytorch_attention(q, k, v): return out +def vae_attention(): + if model_management.xformers_enabled_vae(): + logging.info("Using xformers attention in VAE") + return xformers_attention + elif model_management.pytorch_attention_enabled(): + logging.info("Using pytorch attention in VAE") + return pytorch_attention + else: + logging.info("Using split attention in VAE") + return normal_attention + class AttnBlock(nn.Module): def __init__(self, in_channels, conv_op=ops.Conv2d): super().__init__() @@ -320,15 +331,7 @@ class AttnBlock(nn.Module): stride=1, padding=0) - if model_management.xformers_enabled_vae(): - logging.info("Using xformers attention in VAE") - self.optimized_attention = xformers_attention - elif model_management.pytorch_attention_enabled(): - logging.info("Using pytorch attention in VAE") - self.optimized_attention = pytorch_attention - else: - logging.info("Using split attention in VAE") - self.optimized_attention = normal_attention + self.optimized_attention = vae_attention() def forward(self, x): h_ = x From 4758fb64b9afb31f48a872368b98615004f04e83 Mon Sep 17 00:00:00 2001 From: comfyanonymous <comfyanonymous@protonmail.com> Date: Wed, 15 Jan 2025 22:57:52 -0500 Subject: [PATCH 30/47] Lower cosmos VAE memory usage by a bit. --- comfy/ldm/cosmos/cosmos_tokenizer/layers3d.py | 8 +++---- comfy/ldm/cosmos/cosmos_tokenizer/patching.py | 22 +++++++++++++++++++ 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/comfy/ldm/cosmos/cosmos_tokenizer/layers3d.py b/comfy/ldm/cosmos/cosmos_tokenizer/layers3d.py index 7d864a75..9a3ebed6 100644 --- a/comfy/ldm/cosmos/cosmos_tokenizer/layers3d.py +++ b/comfy/ldm/cosmos/cosmos_tokenizer/layers3d.py @@ -864,18 +864,16 @@ class EncoderFactorized(nn.Module): x = self.patcher3d(x) # downsampling - hs = [self.conv_in(x)] + h = self.conv_in(x) for i_level in range(self.num_resolutions): for i_block in range(self.num_res_blocks): - h = self.down[i_level].block[i_block](hs[-1]) + h = self.down[i_level].block[i_block](h) if len(self.down[i_level].attn) > 0: h = self.down[i_level].attn[i_block](h) - hs.append(h) if i_level != self.num_resolutions - 1: - hs.append(self.down[i_level].downsample(hs[-1])) + h = self.down[i_level].downsample(h) # middle - h = hs[-1] h = self.mid.block_1(h) h = self.mid.attn_1(h) h = self.mid.block_2(h) diff --git a/comfy/ldm/cosmos/cosmos_tokenizer/patching.py b/comfy/ldm/cosmos/cosmos_tokenizer/patching.py index 793f0da8..87a53a1d 100644 --- a/comfy/ldm/cosmos/cosmos_tokenizer/patching.py +++ b/comfy/ldm/cosmos/cosmos_tokenizer/patching.py @@ -281,54 +281,76 @@ class UnPatcher3D(UnPatcher): hh = hh.to(dtype=dtype) xlll, xllh, xlhl, xlhh, xhll, xhlh, xhhl, xhhh = torch.chunk(x, 8, dim=1) + del x # Height height transposed convolutions. xll = F.conv_transpose3d( xlll, hl.unsqueeze(2).unsqueeze(3), groups=g, stride=(1, 1, 2) ) + del xlll + xll += F.conv_transpose3d( xllh, hh.unsqueeze(2).unsqueeze(3), groups=g, stride=(1, 1, 2) ) + del xllh xlh = F.conv_transpose3d( xlhl, hl.unsqueeze(2).unsqueeze(3), groups=g, stride=(1, 1, 2) ) + del xlhl + xlh += F.conv_transpose3d( xlhh, hh.unsqueeze(2).unsqueeze(3), groups=g, stride=(1, 1, 2) ) + del xlhh xhl = F.conv_transpose3d( xhll, hl.unsqueeze(2).unsqueeze(3), groups=g, stride=(1, 1, 2) ) + del xhll + xhl += F.conv_transpose3d( xhlh, hh.unsqueeze(2).unsqueeze(3), groups=g, stride=(1, 1, 2) ) + del xhlh xhh = F.conv_transpose3d( xhhl, hl.unsqueeze(2).unsqueeze(3), groups=g, stride=(1, 1, 2) ) + del xhhl + xhh += F.conv_transpose3d( xhhh, hh.unsqueeze(2).unsqueeze(3), groups=g, stride=(1, 1, 2) ) + del xhhh # Handles width transposed convolutions. xl = F.conv_transpose3d( xll, hl.unsqueeze(2).unsqueeze(4), groups=g, stride=(1, 2, 1) ) + del xll + xl += F.conv_transpose3d( xlh, hh.unsqueeze(2).unsqueeze(4), groups=g, stride=(1, 2, 1) ) + del xlh + xh = F.conv_transpose3d( xhl, hl.unsqueeze(2).unsqueeze(4), groups=g, stride=(1, 2, 1) ) + del xhl + xh += F.conv_transpose3d( xhh, hh.unsqueeze(2).unsqueeze(4), groups=g, stride=(1, 2, 1) ) + del xhh # Handles time axis transposed convolutions. x = F.conv_transpose3d( xl, hl.unsqueeze(3).unsqueeze(4), groups=g, stride=(2, 1, 1) ) + del xl + x += F.conv_transpose3d( xh, hh.unsqueeze(3).unsqueeze(4), groups=g, stride=(2, 1, 1) ) From 25683b5b0269590ba24f96753cf55cc6ad093cd0 Mon Sep 17 00:00:00 2001 From: comfyanonymous <comfyanonymous@protonmail.com> Date: Wed, 15 Jan 2025 23:46:42 -0500 Subject: [PATCH 31/47] Lower cosmos diffusion model memory usage. --- comfy/ldm/cosmos/blocks.py | 26 +++++++++++++++----------- comfy/ldm/cosmos/model.py | 10 +++++++--- comfy/ldm/cosmos/position_embedding.py | 7 ++++--- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/comfy/ldm/cosmos/blocks.py b/comfy/ldm/cosmos/blocks.py index 3e9c6497..84fd6d83 100644 --- a/comfy/ldm/cosmos/blocks.py +++ b/comfy/ldm/cosmos/blocks.py @@ -168,14 +168,18 @@ class Attention(nn.Module): k = self.to_k[1](k) v = self.to_v[1](v) if self.is_selfattn and rope_emb is not None: # only apply to self-attention! - q = apply_rotary_pos_emb(q, rope_emb) - k = apply_rotary_pos_emb(k, rope_emb) - return q, k, v + # apply_rotary_pos_emb inlined + q_shape = q.shape + q = q.reshape(*q.shape[:-1], 2, -1).movedim(-2, -1).unsqueeze(-2) + q = rope_emb[..., 0] * q[..., 0] + rope_emb[..., 1] * q[..., 1] + q = q.movedim(-1, -2).reshape(*q_shape).to(x.dtype) - def cal_attn(self, q, k, v, mask=None): - out = optimized_attention(q, k, v, self.heads, skip_reshape=True, mask=mask, skip_output_reshape=True) - out = rearrange(out, " b n s c -> s b (n c)") - return self.to_out(out) + # apply_rotary_pos_emb inlined + k_shape = k.shape + k = k.reshape(*k.shape[:-1], 2, -1).movedim(-2, -1).unsqueeze(-2) + k = rope_emb[..., 0] * k[..., 0] + rope_emb[..., 1] * k[..., 1] + k = k.movedim(-1, -2).reshape(*k_shape).to(x.dtype) + return q, k, v def forward( self, @@ -191,7 +195,10 @@ class Attention(nn.Module): context (Optional[Tensor]): The key tensor of shape [B, Mk, K] or use x as context [self attention] if None """ q, k, v = self.cal_qkv(x, context, mask, rope_emb=rope_emb, **kwargs) - return self.cal_attn(q, k, v, mask) + out = optimized_attention(q, k, v, self.heads, skip_reshape=True, mask=mask, skip_output_reshape=True) + del q, k, v + out = rearrange(out, " b n s c -> s b (n c)") + return self.to_out(out) class FeedForward(nn.Module): @@ -788,10 +795,7 @@ class GeneralDITTransformerBlock(nn.Module): crossattn_mask: Optional[torch.Tensor] = None, rope_emb_L_1_1_D: Optional[torch.Tensor] = None, adaln_lora_B_3D: Optional[torch.Tensor] = None, - extra_per_block_pos_emb: Optional[torch.Tensor] = None, ) -> torch.Tensor: - if extra_per_block_pos_emb is not None: - x = x + extra_per_block_pos_emb for block in self.blocks: x = block( x, diff --git a/comfy/ldm/cosmos/model.py b/comfy/ldm/cosmos/model.py index 05dd3846..1205838b 100644 --- a/comfy/ldm/cosmos/model.py +++ b/comfy/ldm/cosmos/model.py @@ -168,7 +168,7 @@ class GeneralDIT(nn.Module): operations=operations, ) - self.build_pos_embed(device=device) + self.build_pos_embed(device=device, dtype=dtype) self.block_x_format = block_x_format self.use_adaln_lora = use_adaln_lora self.adaln_lora_dim = adaln_lora_dim @@ -210,7 +210,7 @@ class GeneralDIT(nn.Module): operations=operations, ) - def build_pos_embed(self, device=None): + def build_pos_embed(self, device=None, dtype=None): if self.pos_emb_cls == "rope3d": cls_type = VideoRopePosition3DEmb else: @@ -242,6 +242,7 @@ class GeneralDIT(nn.Module): kwargs["w_extrapolation_ratio"] = self.extra_w_extrapolation_ratio kwargs["t_extrapolation_ratio"] = self.extra_t_extrapolation_ratio kwargs["device"] = device + kwargs["dtype"] = dtype self.extra_pos_embedder = LearnablePosEmbAxis( **kwargs, ) @@ -476,6 +477,8 @@ class GeneralDIT(nn.Module): inputs["original_shape"], ) extra_pos_emb_B_T_H_W_D_or_T_H_W_B_D = inputs["extra_pos_emb_B_T_H_W_D_or_T_H_W_B_D"].to(x.dtype) + del inputs + if extra_pos_emb_B_T_H_W_D_or_T_H_W_B_D is not None: assert ( x.shape == extra_pos_emb_B_T_H_W_D_or_T_H_W_B_D.shape @@ -486,6 +489,8 @@ class GeneralDIT(nn.Module): self.blocks["block0"].x_format == block.x_format ), f"First block has x_format {self.blocks[0].x_format}, got {block.x_format}" + if extra_pos_emb_B_T_H_W_D_or_T_H_W_B_D is not None: + x += extra_pos_emb_B_T_H_W_D_or_T_H_W_B_D x = block( x, affline_emb_B_D, @@ -493,7 +498,6 @@ class GeneralDIT(nn.Module): crossattn_mask, rope_emb_L_1_1_D=rope_emb_L_1_1_D, adaln_lora_B_3D=adaln_lora_B_3D, - extra_per_block_pos_emb=extra_pos_emb_B_T_H_W_D_or_T_H_W_B_D, ) x_B_T_H_W_D = rearrange(x, "T H W B D -> B T H W D") diff --git a/comfy/ldm/cosmos/position_embedding.py b/comfy/ldm/cosmos/position_embedding.py index dda752cb..cf45ab0e 100644 --- a/comfy/ldm/cosmos/position_embedding.py +++ b/comfy/ldm/cosmos/position_embedding.py @@ -173,6 +173,7 @@ class LearnablePosEmbAxis(VideoPositionEmb): len_w: int, len_t: int, device=None, + dtype=None, **kwargs, ): """ @@ -184,9 +185,9 @@ class LearnablePosEmbAxis(VideoPositionEmb): self.interpolation = interpolation assert self.interpolation in ["crop"], f"Unknown interpolation method {self.interpolation}" - self.pos_emb_h = nn.Parameter(torch.empty(len_h, model_channels, device=device)) - self.pos_emb_w = nn.Parameter(torch.empty(len_w, model_channels, device=device)) - self.pos_emb_t = nn.Parameter(torch.empty(len_t, model_channels, device=device)) + self.pos_emb_h = nn.Parameter(torch.empty(len_h, model_channels, device=device, dtype=dtype)) + self.pos_emb_w = nn.Parameter(torch.empty(len_w, model_channels, device=device, dtype=dtype)) + self.pos_emb_t = nn.Parameter(torch.empty(len_t, model_channels, device=device, dtype=dtype)) def generate_embeddings(self, B_T_H_W_C: torch.Size, fps=Optional[torch.Tensor], device=None) -> torch.Tensor: From 6320d0569642b4c28c36c47f80aecb28e5fbc04d Mon Sep 17 00:00:00 2001 From: comfyanonymous <comfyanonymous@protonmail.com> Date: Thu, 16 Jan 2025 00:23:01 -0500 Subject: [PATCH 32/47] Slightly lower hunyuan video memory usage. --- comfy/ldm/flux/math.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/comfy/ldm/flux/math.py b/comfy/ldm/flux/math.py index b6549585..b5960ffd 100644 --- a/comfy/ldm/flux/math.py +++ b/comfy/ldm/flux/math.py @@ -5,8 +5,15 @@ from torch import Tensor from comfy.ldm.modules.attention import optimized_attention import comfy.model_management + def attention(q: Tensor, k: Tensor, v: Tensor, pe: Tensor, mask=None) -> Tensor: - q, k = apply_rope(q, k, pe) + q_shape = q.shape + k_shape = k.shape + + q = q.float().reshape(*q.shape[:-1], -1, 1, 2) + k = k.float().reshape(*k.shape[:-1], -1, 1, 2) + q = (pe[..., 0] * q[..., 0] + pe[..., 1] * q[..., 1]).reshape(*q_shape).type_as(v) + k = (pe[..., 0] * k[..., 0] + pe[..., 1] * k[..., 1]).reshape(*k_shape).type_as(v) heads = q.shape[1] x = optimized_attention(q, k, v, heads, skip_reshape=True, mask=mask) From 9d8b6c1f464e01a730bc4039cce483895dc888a4 Mon Sep 17 00:00:00 2001 From: comfyanonymous <comfyanonymous@protonmail.com> Date: Thu, 16 Jan 2025 03:48:40 -0500 Subject: [PATCH 33/47] More accurate memory estimation for cosmos and hunyuan video. --- comfy/sd.py | 4 ++-- comfy/supported_models.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/comfy/sd.py b/comfy/sd.py index 6ba6af47..d7e89f72 100644 --- a/comfy/sd.py +++ b/comfy/sd.py @@ -388,8 +388,8 @@ class VAE: ddconfig = {'z_channels': 16, 'latent_channels': self.latent_channels, 'z_factor': 1, 'resolution': 1024, 'in_channels': 3, 'out_channels': 3, 'channels': 128, 'channels_mult': [2, 4, 4], 'num_res_blocks': 2, 'attn_resolutions': [32], 'dropout': 0.0, 'patch_size': 4, 'num_groups': 1, 'temporal_compression': 8, 'spacial_compression': 8} self.first_stage_model = comfy.ldm.cosmos.vae.CausalContinuousVideoTokenizer(**ddconfig) #TODO: these values are a bit off because this is not a standard VAE - self.memory_used_decode = lambda shape, dtype: (220 * shape[2] * shape[3] * shape[4] * (8 * 8 * 8)) * model_management.dtype_size(dtype) - self.memory_used_encode = lambda shape, dtype: (500 * max(shape[2], 2) * shape[3] * shape[4]) * model_management.dtype_size(dtype) + self.memory_used_decode = lambda shape, dtype: (50 * shape[2] * shape[3] * shape[4] * (8 * 8 * 8)) * model_management.dtype_size(dtype) + self.memory_used_encode = lambda shape, dtype: (50 * (round((shape[2] + 7) / 8) * 8) * shape[3] * shape[4]) * model_management.dtype_size(dtype) self.working_dtypes = [torch.bfloat16, torch.float32] else: logging.warning("WARNING: No VAE weights detected, VAE not initalized.") diff --git a/comfy/supported_models.py b/comfy/supported_models.py index ff3f1432..87fecde5 100644 --- a/comfy/supported_models.py +++ b/comfy/supported_models.py @@ -788,7 +788,7 @@ class HunyuanVideo(supported_models_base.BASE): unet_extra_config = {} latent_format = latent_formats.HunyuanVideo - memory_usage_factor = 2.0 #TODO + memory_usage_factor = 1.7 #TODO supported_inference_dtypes = [torch.bfloat16, torch.float32] @@ -839,7 +839,7 @@ class CosmosT2V(supported_models_base.BASE): unet_extra_config = {} latent_format = latent_formats.Cosmos1CV8x8x8 - memory_usage_factor = 2.4 #TODO + memory_usage_factor = 1.6 #TODO supported_inference_dtypes = [torch.bfloat16, torch.float16, torch.float32] #TODO From 23289a6a5c23cd548d247bb096c56f3ad328c727 Mon Sep 17 00:00:00 2001 From: comfyanonymous <comfyanonymous@protonmail.com> Date: Thu, 16 Jan 2025 04:24:39 -0500 Subject: [PATCH 34/47] Clean up some debug lines. --- comfy/ldm/cosmos/vae.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/comfy/ldm/cosmos/vae.py b/comfy/ldm/cosmos/vae.py index 94fcc54c..c8db6861 100644 --- a/comfy/ldm/cosmos/vae.py +++ b/comfy/ldm/cosmos/vae.py @@ -89,8 +89,8 @@ class CausalContinuousVideoTokenizer(nn.Module): self.distribution = IdentityDistribution() # ContinuousFormulation[formulation_name].value() num_parameters = sum(param.numel() for param in self.parameters()) - logging.info(f"model={self.name}, num_parameters={num_parameters:,}") - logging.info( + logging.debug(f"model={self.name}, num_parameters={num_parameters:,}") + logging.debug( f"z_channels={z_channels}, latent_channels={self.latent_channels}." ) From 88ceb28e2094e97d837ea86338121ea8f9f7d38e Mon Sep 17 00:00:00 2001 From: comfyanonymous <comfyanonymous@protonmail.com> Date: Thu, 16 Jan 2025 06:31:03 -0500 Subject: [PATCH 35/47] Tweak hunyuan memory usage factor. --- comfy/supported_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/supported_models.py b/comfy/supported_models.py index 87fecde5..ff0bea41 100644 --- a/comfy/supported_models.py +++ b/comfy/supported_models.py @@ -788,7 +788,7 @@ class HunyuanVideo(supported_models_base.BASE): unet_extra_config = {} latent_format = latent_formats.HunyuanVideo - memory_usage_factor = 1.7 #TODO + memory_usage_factor = 1.8 #TODO supported_inference_dtypes = [torch.bfloat16, torch.float32] From 31831e6ef13474b975eee1a94f39078e00b00156 Mon Sep 17 00:00:00 2001 From: comfyanonymous <comfyanonymous@protonmail.com> Date: Thu, 16 Jan 2025 07:23:54 -0500 Subject: [PATCH 36/47] Code refactor. --- comfy/ldm/flux/layers.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/comfy/ldm/flux/layers.py b/comfy/ldm/flux/layers.py index 8e055151..59a62e0d 100644 --- a/comfy/ldm/flux/layers.py +++ b/comfy/ldm/flux/layers.py @@ -230,8 +230,7 @@ class SingleStreamBlock(nn.Module): def forward(self, x: Tensor, vec: Tensor, pe: Tensor, attn_mask=None) -> Tensor: mod, _ = self.modulation(vec) - x_mod = (1 + mod.scale) * self.pre_norm(x) + mod.shift - qkv, mlp = torch.split(self.linear1(x_mod), [3 * self.hidden_size, self.mlp_hidden_dim], dim=-1) + qkv, mlp = torch.split(self.linear1((1 + mod.scale) * self.pre_norm(x) + mod.shift), [3 * self.hidden_size, self.mlp_hidden_dim], dim=-1) q, k, v = qkv.view(qkv.shape[0], qkv.shape[1], 3, self.num_heads, -1).permute(2, 0, 3, 1, 4) q, k = self.norm(q, k, v) From 619b8cde74538a1dc62b85e47e34daa493705c06 Mon Sep 17 00:00:00 2001 From: comfyanonymous <comfyanonymous@protonmail.com> Date: Thu, 16 Jan 2025 14:54:48 -0500 Subject: [PATCH 37/47] Bump ComfyUI version to 0.3.11 --- comfyui_version.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/comfyui_version.py b/comfyui_version.py index 7cccc753..fbe4747a 100644 --- a/comfyui_version.py +++ b/comfyui_version.py @@ -1,3 +1,3 @@ # This file is automatically generated by the build process when version is # updated in pyproject.toml. -__version__ = "0.3.10" +__version__ = "0.3.11" diff --git a/pyproject.toml b/pyproject.toml index b747d6ef..db8967b6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ComfyUI" -version = "0.3.10" +version = "0.3.11" readme = "README.md" license = { file = "LICENSE" } requires-python = ">=3.9" From cca96a85ae753c9a7de722884f43b81e4eb3abff Mon Sep 17 00:00:00 2001 From: comfyanonymous <comfyanonymous@protonmail.com> Date: Thu, 16 Jan 2025 16:30:06 -0500 Subject: [PATCH 38/47] Fix cosmos VAE failing with videos longer than 121 frames. --- comfy/ldm/cosmos/vae.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/comfy/ldm/cosmos/vae.py b/comfy/ldm/cosmos/vae.py index c8db6861..d64f292d 100644 --- a/comfy/ldm/cosmos/vae.py +++ b/comfy/ldm/cosmos/vae.py @@ -18,6 +18,7 @@ import logging import torch from torch import nn from enum import Enum +import math from .cosmos_tokenizer.layers3d import ( EncoderFactorized, @@ -105,17 +106,23 @@ class CausalContinuousVideoTokenizer(nn.Module): z, posteriors = self.distribution(moments) latent_ch = z.shape[1] latent_t = z.shape[2] - dtype = z.dtype - mean = self.latent_mean.view(latent_ch, -1)[:, : latent_t].reshape([1, latent_ch, -1, 1, 1]).to(dtype=dtype, device=z.device) - std = self.latent_std.view(latent_ch, -1)[:, : latent_t].reshape([1, latent_ch, -1, 1, 1]).to(dtype=dtype, device=z.device) + in_dtype = z.dtype + mean = self.latent_mean.view(latent_ch, -1) + std = self.latent_std.view(latent_ch, -1) + + mean = mean.repeat(1, math.ceil(latent_t / mean.shape[-1]))[:, : latent_t].reshape([1, latent_ch, -1, 1, 1]).to(dtype=in_dtype, device=z.device) + std = std.repeat(1, math.ceil(latent_t / std.shape[-1]))[:, : latent_t].reshape([1, latent_ch, -1, 1, 1]).to(dtype=in_dtype, device=z.device) return ((z - mean) / std) * self.sigma_data def decode(self, z): in_dtype = z.dtype latent_ch = z.shape[1] latent_t = z.shape[2] - mean = self.latent_mean.view(latent_ch, -1)[:, : latent_t].reshape([1, latent_ch, -1, 1, 1]).to(dtype=in_dtype, device=z.device) - std = self.latent_std.view(latent_ch, -1)[:, : latent_t].reshape([1, latent_ch, -1, 1, 1]).to(dtype=in_dtype, device=z.device) + mean = self.latent_mean.view(latent_ch, -1) + std = self.latent_std.view(latent_ch, -1) + + mean = mean.repeat(1, math.ceil(latent_t / mean.shape[-1]))[:, : latent_t].reshape([1, latent_ch, -1, 1, 1]).to(dtype=in_dtype, device=z.device) + std = std.repeat(1, math.ceil(latent_t / std.shape[-1]))[:, : latent_t].reshape([1, latent_ch, -1, 1, 1]).to(dtype=in_dtype, device=z.device) z = z / self.sigma_data z = z * std + mean From 0aa2368e462664bb9a00e17660d786e69cc2e25c Mon Sep 17 00:00:00 2001 From: comfyanonymous <comfyanonymous@protonmail.com> Date: Thu, 16 Jan 2025 17:45:37 -0500 Subject: [PATCH 39/47] Fix some cosmos fp8 issues. --- comfy/ldm/cosmos/model.py | 2 +- comfy/ldm/cosmos/position_embedding.py | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/comfy/ldm/cosmos/model.py b/comfy/ldm/cosmos/model.py index 1205838b..06d0baef 100644 --- a/comfy/ldm/cosmos/model.py +++ b/comfy/ldm/cosmos/model.py @@ -293,7 +293,7 @@ class GeneralDIT(nn.Module): x_B_T_H_W_D = self.x_embedder(x_B_C_T_H_W) if self.extra_per_block_abs_pos_emb: - extra_pos_emb = self.extra_pos_embedder(x_B_T_H_W_D, fps=fps, device=x_B_C_T_H_W.device) + extra_pos_emb = self.extra_pos_embedder(x_B_T_H_W_D, fps=fps, device=x_B_C_T_H_W.device, dtype=x_B_C_T_H_W.dtype) else: extra_pos_emb = None diff --git a/comfy/ldm/cosmos/position_embedding.py b/comfy/ldm/cosmos/position_embedding.py index cf45ab0e..4d6a58db 100644 --- a/comfy/ldm/cosmos/position_embedding.py +++ b/comfy/ldm/cosmos/position_embedding.py @@ -41,12 +41,12 @@ def normalize(x: torch.Tensor, dim: Optional[List[int]] = None, eps: float = 0) class VideoPositionEmb(nn.Module): - def forward(self, x_B_T_H_W_C: torch.Tensor, fps=Optional[torch.Tensor], device=None) -> torch.Tensor: + def forward(self, x_B_T_H_W_C: torch.Tensor, fps=Optional[torch.Tensor], device=None, dtype=None) -> torch.Tensor: """ It delegates the embedding generation to generate_embeddings function. """ B_T_H_W_C = x_B_T_H_W_C.shape - embeddings = self.generate_embeddings(B_T_H_W_C, fps=fps, device=device) + embeddings = self.generate_embeddings(B_T_H_W_C, fps=fps, device=device, dtype=dtype) return embeddings @@ -104,6 +104,7 @@ class VideoRopePosition3DEmb(VideoPositionEmb): w_ntk_factor: Optional[float] = None, t_ntk_factor: Optional[float] = None, device=None, + dtype=None, ): """ Generate embeddings for the given input size. @@ -189,13 +190,12 @@ class LearnablePosEmbAxis(VideoPositionEmb): self.pos_emb_w = nn.Parameter(torch.empty(len_w, model_channels, device=device, dtype=dtype)) self.pos_emb_t = nn.Parameter(torch.empty(len_t, model_channels, device=device, dtype=dtype)) - - def generate_embeddings(self, B_T_H_W_C: torch.Size, fps=Optional[torch.Tensor], device=None) -> torch.Tensor: + def generate_embeddings(self, B_T_H_W_C: torch.Size, fps=Optional[torch.Tensor], device=None, dtype=None) -> torch.Tensor: B, T, H, W, _ = B_T_H_W_C if self.interpolation == "crop": - emb_h_H = self.pos_emb_h[:H].to(device=device) - emb_w_W = self.pos_emb_w[:W].to(device=device) - emb_t_T = self.pos_emb_t[:T].to(device=device) + emb_h_H = self.pos_emb_h[:H].to(device=device, dtype=dtype) + emb_w_W = self.pos_emb_w[:W].to(device=device, dtype=dtype) + emb_t_T = self.pos_emb_t[:T].to(device=device, dtype=dtype) emb = ( repeat(emb_t_T, "t d-> b t h w d", b=B, h=H, w=W) + repeat(emb_h_H, "h d-> b t h w d", b=B, t=T, w=W) From 55add502206ed5511a04215db4ab8f1cfa3d99ae Mon Sep 17 00:00:00 2001 From: comfyanonymous <comfyanonymous@protonmail.com> Date: Thu, 16 Jan 2025 18:11:57 -0500 Subject: [PATCH 40/47] Bump ComfyUI version to v0.3.12 --- comfyui_version.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/comfyui_version.py b/comfyui_version.py index fbe4747a..411243f6 100644 --- a/comfyui_version.py +++ b/comfyui_version.py @@ -1,3 +1,3 @@ # This file is automatically generated by the build process when version is # updated in pyproject.toml. -__version__ = "0.3.11" +__version__ = "0.3.12" diff --git a/pyproject.toml b/pyproject.toml index db8967b6..0198d1b0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ComfyUI" -version = "0.3.11" +version = "0.3.12" readme = "README.md" license = { file = "LICENSE" } requires-python = ">=3.9" From 7fc3ccdcc2fb1f20c4b7dd4aca374db952fd66df Mon Sep 17 00:00:00 2001 From: comfyanonymous <comfyanonymous@protonmail.com> Date: Thu, 16 Jan 2025 21:17:18 -0500 Subject: [PATCH 41/47] Add that nvidia cosmos is supported to the README. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 000d7680..fd21f562 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,7 @@ This ui will let you design and execute advanced stable diffusion pipelines usin - [Mochi](https://comfyanonymous.github.io/ComfyUI_examples/mochi/) - [LTX-Video](https://comfyanonymous.github.io/ComfyUI_examples/ltxv/) - [Hunyuan Video](https://comfyanonymous.github.io/ComfyUI_examples/hunyuan_video/) + - [Nvidia Cosmos](https://comfyanonymous.github.io/ComfyUI_examples/cosmos/) - [Stable Audio](https://comfyanonymous.github.io/ComfyUI_examples/audio/) - Asynchronous Queue system - Many optimizations: Only re-executes the parts of the workflow that changes between executions. From 2f3ab40b62b44f874264b8bfae3756546a96ab44 Mon Sep 17 00:00:00 2001 From: comfyanonymous <comfyanonymous@protonmail.com> Date: Fri, 17 Jan 2025 18:47:27 -0500 Subject: [PATCH 42/47] Add warning when using old pytorch versions. --- comfy/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/comfy/utils.py b/comfy/utils.py index bcefa180..b3506282 100644 --- a/comfy/utils.py +++ b/comfy/utils.py @@ -43,7 +43,8 @@ if hasattr(torch.serialization, "add_safe_globals"): # TODO: this was added in torch.serialization.add_safe_globals([ModelCheckpoint, scalar, dtype, Float64DType, encode]) ALWAYS_SAFE_LOAD = True logging.info("Checkpoint files will always be loaded safely.") - +else: + logging.info("Warning, you are using an old pytorch version and some ckpt/pt files might be loaded unsafely. Upgrading to 2.4 or above is recommended.") def load_torch_file(ckpt, safe_load=False, device=None): if device is None: From 507199d9a8902f9dd35a90d4bd2fc3b12cdf54f1 Mon Sep 17 00:00:00 2001 From: comfyanonymous <comfyanonymous@protonmail.com> Date: Sat, 18 Jan 2025 05:27:58 -0500 Subject: [PATCH 43/47] Uni pc sampler now works with audio and video models. --- comfy/extra_samplers/uni_pc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/comfy/extra_samplers/uni_pc.py b/comfy/extra_samplers/uni_pc.py index 5b80a8af..c57e081e 100644 --- a/comfy/extra_samplers/uni_pc.py +++ b/comfy/extra_samplers/uni_pc.py @@ -661,7 +661,7 @@ class UniPC: if x_t is None: if use_predictor: - pred_res = torch.einsum('k,bkchw->bchw', rhos_p, D1s) + pred_res = torch.tensordot(D1s, rhos_p, dims=([1], [0])) # torch.einsum('k,bkchw->bchw', rhos_p, D1s) else: pred_res = 0 x_t = x_t_ - expand_dims(alpha_t * B_h, dims) * pred_res @@ -669,7 +669,7 @@ class UniPC: if use_corrector: model_t = self.model_fn(x_t, t) if D1s is not None: - corr_res = torch.einsum('k,bkchw->bchw', rhos_c[:-1], D1s) + corr_res = torch.tensordot(D1s, rhos_c[:-1], dims=([1], [0])) # torch.einsum('k,bkchw->bchw', rhos_c[:-1], D1s) else: corr_res = 0 D1_t = (model_t - model_prev_0) From 3a3910f91dc14eccde3d991bbd74aa519f3fb95d Mon Sep 17 00:00:00 2001 From: catboxanon <122327233+catboxanon@users.noreply.github.com> Date: Sat, 18 Jan 2025 17:47:33 -0500 Subject: [PATCH 44/47] PromptServer: Return 400 for empty filename param (#6504) --- server.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server.py b/server.py index bae898ef..88c163fc 100644 --- a/server.py +++ b/server.py @@ -329,6 +329,9 @@ class PromptServer(): original_ref = json.loads(post.get("original_ref")) filename, output_dir = folder_paths.annotated_filepath(original_ref['filename']) + if not filename: + return web.Response(status=400) + # validation for security: prevent accessing arbitrary path if filename[0] == '/' or '..' in filename: return web.Response(status=400) @@ -370,6 +373,9 @@ class PromptServer(): filename = request.rel_url.query["filename"] filename,output_dir = folder_paths.annotated_filepath(filename) + if not filename: + return web.Response(status=400) + # validation for security: prevent accessing arbitrary path if filename[0] == '/' or '..' in filename: return web.Response(status=400) From b1a02131c9ca3da0c27743b4727d5055269f300e Mon Sep 17 00:00:00 2001 From: catboxanon <122327233+catboxanon@users.noreply.github.com> Date: Sat, 18 Jan 2025 17:49:51 -0500 Subject: [PATCH 45/47] Remove comfy.samplers self-import (#6506) --- comfy/samplers.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/comfy/samplers.py b/comfy/samplers.py index c508a3a4..d281ecc1 100644 --- a/comfy/samplers.py +++ b/comfy/samplers.py @@ -12,7 +12,6 @@ import collections from comfy import model_management import math import logging -import comfy.samplers import comfy.sampler_helpers import comfy.model_patcher import comfy.patcher_extension @@ -178,7 +177,7 @@ def finalize_default_conds(model: 'BaseModel', hooked_to_run: dict[comfy.hooks.H cond = default_conds[i] for x in cond: # do get_area_and_mult to get all the expected values - p = comfy.samplers.get_area_and_mult(x, x_in, timestep) + p = get_area_and_mult(x, x_in, timestep) if p is None: continue # replace p's mult with calculated mult @@ -215,7 +214,7 @@ def _calc_cond_batch(model: 'BaseModel', conds: list[list[dict]], x_in: torch.Te default_c.append(x) has_default_conds = True continue - p = comfy.samplers.get_area_and_mult(x, x_in, timestep) + p = get_area_and_mult(x, x_in, timestep) if p is None: continue if p.hooks is not None: From b4de04a1c1e90c4183d7880e49ce7e80d82c7c0a Mon Sep 17 00:00:00 2001 From: Comfy Org PR Bot <snomiao+comfy-pr@gmail.com> Date: Sun, 19 Jan 2025 11:43:37 +0900 Subject: [PATCH 46/47] Update frontend to v1.7.14 (#6522) Co-authored-by: huchenlei <20929282+huchenlei@users.noreply.github.com> --- web/assets/BaseViewTemplate-BNGF4K22.js | 23 - web/assets/BaseViewTemplate-BhQMaVFP.js | 54 + web/assets/DesktopStartView-le6AjGZr.js | 22 + ...eC7MBzG.js => DownloadGitView-rPK_vYgU.js} | 6 +- ...D4Phn0Zr.js => ExtensionPanel-3jWrm6Zi.js} | 9 +- ...View-HVeNbkaW.js => GraphView-CDDCHVO0.js} | 1109 +- ...ew-CIRWBKTm.css => GraphView-CqZ3opAX.css} | 157 +- ...ew-CAcYt0HL.js => InstallView-By3hC1fC.js} | 71 +- ...-CwQdoH-C.css => InstallView-CxhfFC8Y.css} | 36 +- ...c3C4lG1.js => KeybindingPanel-D6O16W_1.js} | 11 +- ...s => ManualConfigurationView-CsirlNfV.css} | 4 +- ...js => ManualConfigurationView-enyqGo0M.js} | 12 +- web/assets/MetricsConsentView-lSfLu4nr.js | 86 + ...mqNj.css => NotSupportedView-DQerxQzi.css} | 8 +- ...z3x2d-.js => NotSupportedView-Vc8_xWgH.js} | 14 +- ...StJmv.js => ServerConfigPanel-B-w0HFlz.js} | 6 +- web/assets/ServerStartView-48wfE1MS.js | 101 + web/assets/ServerStartView-CIDTUh4x.js | 98 - ...N4Ib6.css => ServerStartView-CJiwVDQY.css} | 2 +- ...B3jYchWu.js => UserSelectView-CXmVKOeK.js} | 6 +- ...ew-N0ZXLjdi.js => WelcomeView-C8whKl15.js} | 6 +- web/assets/index-5HFeZax4.js | 27 - ...{index-t-sFBuUC.css => index-Cf-n7v0V.css} | 146 +- .../{index-B5F0uxTQ.js => index-DpF-ptbJ.js} | 7 +- .../{index-B-aVupP5.js => index-Q1cQr26V.js} | 4 +- .../{index-DjNHn37O.js => index-QvfM__ze.js} | 68188 +++++++++++----- web/assets/index-jXPKy3pP.js | 173 - .../{index-Bordpmzt.js => index-je62U6DH.js} | 613 +- ...YdkXn.js => keybindingService-Cak1En5n.js} | 24 +- ...KFVuP.js => serverConfigStore-DCme3xlV.js} | 4 +- web/index.html | 4 +- 31 files changed, 49852 insertions(+), 21179 deletions(-) delete mode 100644 web/assets/BaseViewTemplate-BNGF4K22.js create mode 100644 web/assets/BaseViewTemplate-BhQMaVFP.js create mode 100644 web/assets/DesktopStartView-le6AjGZr.js rename web/assets/{DownloadGitView-DeC7MBzG.js => DownloadGitView-rPK_vYgU.js} (87%) rename web/assets/{ExtensionPanel-D4Phn0Zr.js => ExtensionPanel-3jWrm6Zi.js} (91%) rename web/assets/{GraphView-HVeNbkaW.js => GraphView-CDDCHVO0.js} (94%) rename web/assets/{GraphView-CIRWBKTm.css => GraphView-CqZ3opAX.css} (70%) rename web/assets/{InstallView-CAcYt0HL.js => InstallView-By3hC1fC.js} (94%) rename web/assets/{InstallView-CwQdoH-C.css => InstallView-CxhfFC8Y.css} (70%) rename web/assets/{KeybindingPanel-Dc3C4lG1.js => KeybindingPanel-D6O16W_1.js} (92%) rename web/assets/{ManualConfigurationView-B6ecEClB.css => ManualConfigurationView-CsirlNfV.css} (59%) rename web/assets/{ManualConfigurationView-Bi_qHE-n.js => ManualConfigurationView-enyqGo0M.js} (81%) create mode 100644 web/assets/MetricsConsentView-lSfLu4nr.js rename web/assets/{NotSupportedView-bFzHmqNj.css => NotSupportedView-DQerxQzi.css} (63%) rename web/assets/{NotSupportedView-Drz3x2d-.js => NotSupportedView-Vc8_xWgH.js} (81%) rename web/assets/{ServerConfigPanel-Be4StJmv.js => ServerConfigPanel-B-w0HFlz.js} (91%) create mode 100644 web/assets/ServerStartView-48wfE1MS.js delete mode 100644 web/assets/ServerStartView-CIDTUh4x.js rename web/assets/{ServerStartView-CnyN4Ib6.css => ServerStartView-CJiwVDQY.css} (64%) rename web/assets/{UserSelectView-B3jYchWu.js => UserSelectView-CXmVKOeK.js} (89%) rename web/assets/{WelcomeView-N0ZXLjdi.js => WelcomeView-C8whKl15.js} (79%) delete mode 100644 web/assets/index-5HFeZax4.js rename web/assets/{index-t-sFBuUC.css => index-Cf-n7v0V.css} (97%) rename web/assets/{index-B5F0uxTQ.js => index-DpF-ptbJ.js} (99%) rename web/assets/{index-B-aVupP5.js => index-Q1cQr26V.js} (91%) rename web/assets/{index-DjNHn37O.js => index-QvfM__ze.js} (81%) delete mode 100644 web/assets/index-jXPKy3pP.js rename web/assets/{index-Bordpmzt.js => index-je62U6DH.js} (99%) rename web/assets/{keybindingService-Bx7YdkXn.js => keybindingService-Cak1En5n.js} (89%) rename web/assets/{serverConfigStore-CvyKFVuP.js => serverConfigStore-DCme3xlV.js} (95%) diff --git a/web/assets/BaseViewTemplate-BNGF4K22.js b/web/assets/BaseViewTemplate-BNGF4K22.js deleted file mode 100644 index b0395614..00000000 --- a/web/assets/BaseViewTemplate-BNGF4K22.js +++ /dev/null @@ -1,23 +0,0 @@ -import { d as defineComponent, o as openBlock, f as createElementBlock, J as renderSlot, T as normalizeClass } from "./index-DjNHn37O.js"; -const _sfc_main = /* @__PURE__ */ defineComponent({ - __name: "BaseViewTemplate", - props: { - dark: { type: Boolean, default: false } - }, - setup(__props) { - const props = __props; - return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", { - class: normalizeClass(["font-sans w-screen h-screen flex items-center justify-center pointer-events-auto overflow-auto", [ - props.dark ? "text-neutral-300 bg-neutral-900 dark-theme" : "text-neutral-900 bg-neutral-300" - ]]) - }, [ - renderSlot(_ctx.$slots, "default") - ], 2); - }; - } -}); -export { - _sfc_main as _ -}; -//# sourceMappingURL=BaseViewTemplate-BNGF4K22.js.map diff --git a/web/assets/BaseViewTemplate-BhQMaVFP.js b/web/assets/BaseViewTemplate-BhQMaVFP.js new file mode 100644 index 00000000..af2f3028 --- /dev/null +++ b/web/assets/BaseViewTemplate-BhQMaVFP.js @@ -0,0 +1,54 @@ +import { d as defineComponent, ad as ref, t as onMounted, bT as isElectron, bV as electronAPI, af as nextTick, o as openBlock, f as createElementBlock, i as withDirectives, v as vShow, m as createBaseVNode, M as renderSlot, V as normalizeClass } from "./index-QvfM__ze.js"; +const _hoisted_1 = { class: "flex-grow w-full flex items-center justify-center overflow-auto" }; +const _sfc_main = /* @__PURE__ */ defineComponent({ + __name: "BaseViewTemplate", + props: { + dark: { type: Boolean, default: false } + }, + setup(__props) { + const props = __props; + const darkTheme = { + color: "rgba(0, 0, 0, 0)", + symbolColor: "#d4d4d4" + }; + const lightTheme = { + color: "rgba(0, 0, 0, 0)", + symbolColor: "#171717" + }; + const topMenuRef = ref(null); + const isNativeWindow = ref(false); + onMounted(async () => { + if (isElectron()) { + const windowStyle = await electronAPI().Config.getWindowStyle(); + isNativeWindow.value = windowStyle === "custom"; + await nextTick(); + electronAPI().changeTheme({ + ...props.dark ? darkTheme : lightTheme, + height: topMenuRef.value.getBoundingClientRect().height + }); + } + }); + return (_ctx, _cache) => { + return openBlock(), createElementBlock("div", { + class: normalizeClass(["font-sans w-screen h-screen flex flex-col pointer-events-auto", [ + props.dark ? "text-neutral-300 bg-neutral-900 dark-theme" : "text-neutral-900 bg-neutral-300" + ]]) + }, [ + withDirectives(createBaseVNode("div", { + ref_key: "topMenuRef", + ref: topMenuRef, + class: "app-drag w-full h-[var(--comfy-topbar-height)]" + }, null, 512), [ + [vShow, isNativeWindow.value] + ]), + createBaseVNode("div", _hoisted_1, [ + renderSlot(_ctx.$slots, "default") + ]) + ], 2); + }; + } +}); +export { + _sfc_main as _ +}; +//# sourceMappingURL=BaseViewTemplate-BhQMaVFP.js.map diff --git a/web/assets/DesktopStartView-le6AjGZr.js b/web/assets/DesktopStartView-le6AjGZr.js new file mode 100644 index 00000000..41a212f3 --- /dev/null +++ b/web/assets/DesktopStartView-le6AjGZr.js @@ -0,0 +1,22 @@ +import { d as defineComponent, o as openBlock, J as createBlock, P as withCtx, m as createBaseVNode, k as createVNode, j as unref, ch as script } from "./index-QvfM__ze.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-BhQMaVFP.js"; +const _hoisted_1 = { class: "max-w-screen-sm w-screen p-8" }; +const _sfc_main = /* @__PURE__ */ defineComponent({ + __name: "DesktopStartView", + setup(__props) { + return (_ctx, _cache) => { + return openBlock(), createBlock(_sfc_main$1, { dark: "" }, { + default: withCtx(() => [ + createBaseVNode("div", _hoisted_1, [ + createVNode(unref(script), { mode: "indeterminate" }) + ]) + ]), + _: 1 + }); + }; + } +}); +export { + _sfc_main as default +}; +//# sourceMappingURL=DesktopStartView-le6AjGZr.js.map diff --git a/web/assets/DownloadGitView-DeC7MBzG.js b/web/assets/DownloadGitView-rPK_vYgU.js similarity index 87% rename from web/assets/DownloadGitView-DeC7MBzG.js rename to web/assets/DownloadGitView-rPK_vYgU.js index 6f00b364..c286da35 100644 --- a/web/assets/DownloadGitView-DeC7MBzG.js +++ b/web/assets/DownloadGitView-rPK_vYgU.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, o as openBlock, k as createBlock, M as withCtx, H as createBaseVNode, X as toDisplayString, N as createVNode, j as unref, l as script, bW as useRouter } from "./index-DjNHn37O.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-BNGF4K22.js"; +import { d as defineComponent, o as openBlock, J as createBlock, P as withCtx, m as createBaseVNode, Z as toDisplayString, k as createVNode, j as unref, l as script, c2 as useRouter } from "./index-QvfM__ze.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-BhQMaVFP.js"; const _hoisted_1 = { class: "max-w-screen-sm flex flex-col gap-8 p-8 bg-[url('/assets/images/Git-Logo-White.svg')] bg-no-repeat bg-right-top bg-origin-padding" }; const _hoisted_2 = { class: "mt-24 text-4xl font-bold text-red-500" }; const _hoisted_3 = { class: "space-y-4" }; @@ -55,4 +55,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=DownloadGitView-DeC7MBzG.js.map +//# sourceMappingURL=DownloadGitView-rPK_vYgU.js.map diff --git a/web/assets/ExtensionPanel-D4Phn0Zr.js b/web/assets/ExtensionPanel-3jWrm6Zi.js similarity index 91% rename from web/assets/ExtensionPanel-D4Phn0Zr.js rename to web/assets/ExtensionPanel-3jWrm6Zi.js index 02baf6e1..3c580dd1 100644 --- a/web/assets/ExtensionPanel-D4Phn0Zr.js +++ b/web/assets/ExtensionPanel-3jWrm6Zi.js @@ -1,9 +1,8 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, ab as ref, cn as FilterMatchMode, cs as useExtensionStore, a as useSettingStore, m as onMounted, c as computed, o as openBlock, k as createBlock, M as withCtx, N as createVNode, co as SearchBox, j as unref, bZ as script, H as createBaseVNode, f as createElementBlock, E as renderList, X as toDisplayString, aE as createTextVNode, F as Fragment, l as script$1, I as createCommentVNode, aI as script$3, bO as script$4, c4 as script$5, cp as _sfc_main$1 } from "./index-DjNHn37O.js"; -import { s as script$2, a as script$6 } from "./index-B5F0uxTQ.js"; -import "./index-B-aVupP5.js"; -import "./index-5HFeZax4.js"; +import { d as defineComponent, ad as ref, cu as FilterMatchMode, cz as useExtensionStore, a as useSettingStore, t as onMounted, c as computed, o as openBlock, J as createBlock, P as withCtx, k as createVNode, cv as SearchBox, j as unref, c6 as script, m as createBaseVNode, f as createElementBlock, I as renderList, Z as toDisplayString, aG as createTextVNode, H as Fragment, l as script$1, L as createCommentVNode, aK as script$3, b8 as script$4, cc as script$5, cw as _sfc_main$1 } from "./index-QvfM__ze.js"; +import { s as script$2, a as script$6 } from "./index-DpF-ptbJ.js"; +import "./index-Q1cQr26V.js"; const _hoisted_1 = { class: "flex justify-end" }; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "ExtensionPanel", @@ -180,4 +179,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=ExtensionPanel-D4Phn0Zr.js.map +//# sourceMappingURL=ExtensionPanel-3jWrm6Zi.js.map diff --git a/web/assets/GraphView-HVeNbkaW.js b/web/assets/GraphView-CDDCHVO0.js similarity index 94% rename from web/assets/GraphView-HVeNbkaW.js rename to web/assets/GraphView-CDDCHVO0.js index 648d3aab..34b0cd73 100644 --- a/web/assets/GraphView-HVeNbkaW.js +++ b/web/assets/GraphView-CDDCHVO0.js @@ -1,14 +1,12 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, u as useExecutionStore, c as computed, a as useSettingStore, b as useWorkflowStore, e as useTitle, o as openBlock, f as createElementBlock, g as useWorkspaceStore, w as watchEffect, h as app, r as resolveDirective, i as withDirectives, v as vShow, j as unref, k as createBlock, n as normalizeStyle, s as showNativeMenu, l as script$d, _ as _export_sfc, m as onMounted, p as onBeforeUnmount, B as BaseStyle, q as script$e, t as getWidth, x as getHeight, y as getOuterWidth, z as getOuterHeight, A as getVNodeProp, C as isArray, D as mergeProps, F as Fragment, E as renderList, G as resolveDynamicComponent, H as createBaseVNode, I as createCommentVNode, J as renderSlot, K as useSidebarTabStore, L as useBottomPanelStore, M as withCtx, N as createVNode, O as getAttribute, P as findSingle, Q as focus, R as equals, S as Ripple, T as normalizeClass, U as getOffset, V as script$f, W as script$g, X as toDisplayString, Y as script$h, Z as markRaw, $ as defineStore, a0 as shallowRef, a1 as useI18n, a2 as useCommandStore, a3 as LiteGraph, a4 as useColorPaletteStore, a5 as watch, a6 as useNodeDefStore, a7 as BadgePosition, a8 as LGraphBadge, a9 as _, aa as NodeBadgeMode, ab as ref, ac as useEventListener, ad as nextTick, ae as st, af as normalizeI18nKey, ag as LGraphGroup, ah as LGraphNode, ai as EditableText, aj as isNotEmpty, ak as UniqueComponentId, al as ZIndex, am as resolveFieldData, an as OverlayEventBus, ao as isEmpty, ap as addStyle, aq as relativePosition, ar as absolutePosition, as as ConnectedOverlayScrollHandler, at as isTouchDevice, au as findLastIndex, av as script$i, aw as script$j, ax as script$k, ay as script$l, az as script$m, aA as script$n, aB as resolveComponent, aC as Transition, aD as createSlots, aE as createTextVNode, aF as useNodeFrequencyStore, aG as useNodeBookmarkStore, aH as highlightQuery, aI as script$o, aJ as formatNumberWithSuffix, aK as NodeSourceType, aL as pushScopeId, aM as popScopeId, aN as NodePreview, aO as NodeSearchFilter, aP as script$p, aQ as SearchFilterChip, aR as useLitegraphService, aS as storeToRefs, aT as isRef, aU as toRaw, aV as LinkReleaseTriggerAction, aW as script$q, aX as useUserStore, aY as useDialogStore, aZ as SettingDialogHeader, a_ as SettingDialogContent, a$ as useKeybindingStore, b0 as Teleport, b1 as LinkMarkerShape, b2 as useModelToNodeStore, b3 as CanvasPointer, b4 as IS_CONTROL_WIDGET, b5 as updateControlWidgetLabel, b6 as useColorPaletteService, b7 as setStorageValue, b8 as api, b9 as usePragmaticDroppable, ba as LGraph, bb as LLink, bc as DragAndScale, bd as LGraphCanvas, be as ContextMenu, bf as ChangeTracker, bg as useWorkflowService, bh as ComfyNodeDefImpl, bi as ComfyModelDef, bj as script$r, bk as script$s, bl as script$t, bm as script$u, bn as script$v, bo as normalizeProps, bp as ToastEventBus, bq as setAttribute, br as TransitionGroup, bs as useToast, bt as useToastStore, bu as resolve, bv as nestedPosition, bw as script$w, bx as isPrintableCharacter, by as useQueueSettingsStore, bz as script$x, bA as useQueuePendingTaskCountStore, bB as useLocalStorage, bC as useDraggable, bD as watchDebounced, bE as inject, bF as useElementBounding, bG as lodashExports, bH as useEventBus, bI as script$z, bJ as guardReactiveProps, bK as useMenuItemStore, bL as usePragmaticDraggable, bM as withModifiers, bN as script$B, bO as script$C, bP as provide, bQ as script$D, bR as useDialogService, bS as LGraphEventMode, bT as useQueueStore, bU as i18n, bV as useModelStore } from "./index-DjNHn37O.js"; -import { s as script$y } from "./index-jXPKy3pP.js"; -import { s as script$A } from "./index-B-aVupP5.js"; -import { u as useKeybindingService } from "./keybindingService-Bx7YdkXn.js"; -import { u as useServerConfigStore } from "./serverConfigStore-CvyKFVuP.js"; -import "./index-5HFeZax4.js"; +import { d as defineComponent, u as useExecutionStore, c as computed, a as useSettingStore, b as useWorkflowStore, e as useTitle, o as openBlock, f as createElementBlock, g as useWorkspaceStore, w as watchEffect, h as app, r as resolveDirective, i as withDirectives, v as vShow, j as unref, k as createVNode, s as showNativeMenu, l as script$d, m as createBaseVNode, n as normalizeStyle, p as pushScopeId, q as popScopeId, _ as _export_sfc, t as onMounted, x as onBeforeUnmount, B as BaseStyle, y as script$e, z as getWidth, A as getHeight, C as getOuterWidth, D as getOuterHeight, E as getVNodeProp, F as isArray, G as mergeProps, H as Fragment, I as renderList, J as createBlock, K as resolveDynamicComponent, L as createCommentVNode, M as renderSlot, N as useSidebarTabStore, O as useBottomPanelStore, P as withCtx, Q as getAttribute, R as findSingle, S as focus, T as equals, U as Ripple, V as normalizeClass, W as getOffset, X as script$f, Y as script$g, Z as toDisplayString, $ as script$h, a0 as markRaw, a1 as defineStore, a2 as shallowRef, a3 as useI18n, a4 as useCommandStore, a5 as LiteGraph, a6 as useColorPaletteStore, a7 as watch, a8 as useNodeDefStore, a9 as BadgePosition, aa as LGraphBadge, ab as _, ac as NodeBadgeMode, ad as ref, ae as useEventListener, af as nextTick, ag as st, ah as normalizeI18nKey, ai as LGraphGroup, aj as LGraphNode, ak as EditableText, al as isNotEmpty, am as UniqueComponentId, an as ZIndex, ao as resolveFieldData, ap as OverlayEventBus, aq as isEmpty, ar as addStyle, as as relativePosition, at as absolutePosition, au as ConnectedOverlayScrollHandler, av as isTouchDevice, aw as findLastIndex, ax as script$i, ay as script$j, az as script$k, aA as script$l, aB as script$m, aC as script$n, aD as resolveComponent, aE as Transition, aF as createSlots, aG as createTextVNode, aH as useNodeFrequencyStore, aI as useNodeBookmarkStore, aJ as highlightQuery, aK as script$o, aL as formatNumberWithSuffix, aM as NodeSourceType, aN as NodePreview, aO as NodeSearchFilter, aP as script$p, aQ as SearchFilterChip, aR as useLitegraphService, aS as storeToRefs, aT as isRef, aU as toRaw, aV as LinkReleaseTriggerAction, aW as script$q, aX as useUserStore, aY as useDialogStore, aZ as SettingDialogHeader, a_ as SettingDialogContent, a$ as useKeybindingStore, b0 as Teleport, b1 as usePragmaticDraggable, b2 as usePragmaticDroppable, b3 as withModifiers, b4 as useWorkflowService, b5 as useWorkflowBookmarkStore, b6 as script$r, b7 as script$s, b8 as script$t, b9 as LinkMarkerShape, ba as useModelToNodeStore, bb as getStorageValue, bc as CanvasPointer, bd as IS_CONTROL_WIDGET, be as updateControlWidgetLabel, bf as useColorPaletteService, bg as setStorageValue, bh as api, bi as LGraph, bj as LLink, bk as DragAndScale, bl as LGraphCanvas, bm as ContextMenu, bn as ChangeTracker, bo as ComfyNodeDefImpl, bp as ComfyModelDef, bq as script$u, br as script$v, bs as script$w, bt as script$x, bu as script$y, bv as normalizeProps, bw as ToastEventBus, bx as setAttribute, by as TransitionGroup, bz as useToast, bA as useToastStore, bB as resolve, bC as nestedPosition, bD as script$z, bE as isPrintableCharacter, bF as useQueueSettingsStore, bG as script$A, bH as useQueuePendingTaskCountStore, bI as useLocalStorage, bJ as useDraggable, bK as watchDebounced, bL as inject, bM as useElementBounding, bN as script$B, bO as lodashExports, bP as useEventBus, bQ as script$C, bR as guardReactiveProps, bS as useMenuItemStore, bT as isElectron, bU as provide, bV as electronAPI, bW as useDialogService, bX as LGraphEventMode, bY as useQueueStore, bZ as DEFAULT_DARK_COLOR_PALETTE, b_ as DEFAULT_LIGHT_COLOR_PALETTE, b$ as i18n, c0 as useErrorHandling, c1 as useModelStore } from "./index-QvfM__ze.js"; +import { s as script$D } from "./index-Q1cQr26V.js"; +import { u as useKeybindingService } from "./keybindingService-Cak1En5n.js"; +import { u as useServerConfigStore } from "./serverConfigStore-DCme3xlV.js"; const DEFAULT_TITLE = "ComfyUI"; const TITLE_SUFFIX = " - ComfyUI"; -const _sfc_main$t = /* @__PURE__ */ defineComponent({ +const _sfc_main$u = /* @__PURE__ */ defineComponent({ __name: "BrowserTabTitle", setup(__props) { const executionStore = useExecutionStore(); @@ -40,7 +38,9 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({ }; } }); -const _sfc_main$s = /* @__PURE__ */ defineComponent({ +const _withScopeId$9 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-7ed57d1a"), n = n(), popScopeId(), n), "_withScopeId$9"); +const _hoisted_1$q = { class: "window-actions-spacer" }; +const _sfc_main$t = /* @__PURE__ */ defineComponent({ __name: "MenuHamburger", setup(__props) { const workspaceState = useWorkspaceStore(); @@ -68,29 +68,39 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({ ); return (_ctx, _cache) => { const _directive_tooltip = resolveDirective("tooltip"); - return withDirectives((openBlock(), createBlock(unref(script$d), { - class: "comfy-menu-hamburger", - style: normalizeStyle(positionCSS.value), - icon: "pi pi-bars", - severity: "secondary", - text: "", - size: "large", - onClick: exitFocusMode, - onContextmenu: unref(showNativeMenu) - }, null, 8, ["style", "onContextmenu"])), [ - [vShow, unref(workspaceState).focusMode], - [_directive_tooltip, { value: _ctx.$t("menu.showMenu"), showDelay: 300 }] + return withDirectives((openBlock(), createElementBlock("div", { + class: "comfy-menu-hamburger no-drag", + style: normalizeStyle(positionCSS.value) + }, [ + withDirectives(createVNode(unref(script$d), { + icon: "pi pi-bars", + severity: "secondary", + text: "", + size: "large", + "aria-label": _ctx.$t("menu.showMenu"), + "aria-live": "assertive", + onClick: exitFocusMode, + onContextmenu: unref(showNativeMenu) + }, null, 8, ["aria-label", "onContextmenu"]), [ + [_directive_tooltip, { value: _ctx.$t("menu.showMenu"), showDelay: 300 }] + ]), + withDirectives(createBaseVNode("div", _hoisted_1$q, null, 512), [ + [vShow, menuSetting.value !== "Bottom"] + ]) + ], 4)), [ + [vShow, unref(workspaceState).focusMode] ]); }; } }); -const MenuHamburger = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__scopeId", "data-v-5661bed0"]]); -const _sfc_main$r = /* @__PURE__ */ defineComponent({ +const MenuHamburger = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__scopeId", "data-v-7ed57d1a"]]); +const _sfc_main$s = /* @__PURE__ */ defineComponent({ __name: "UnloadWindowConfirmDialog", setup(__props) { const settingStore = useSettingStore(); + const workflowStore = useWorkflowStore(); const handleBeforeUnload = /* @__PURE__ */ __name((event) => { - if (settingStore.get("Comfy.Window.UnloadConfirmation")) { + if (settingStore.get("Comfy.Window.UnloadConfirmation") && workflowStore.modifiedWorkflows.length > 0) { event.preventDefault(); return true; } @@ -542,7 +552,7 @@ var script$c = { }, "getPTOptions") } }; -var _hoisted_1$m = ["onMousedown", "onTouchstart", "onTouchmove", "onTouchend"]; +var _hoisted_1$p = ["onMousedown", "onTouchstart", "onTouchmove", "onTouchend"]; var _hoisted_2$j = ["aria-orientation", "aria-valuenow", "onKeydown"]; function render$j(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("div", mergeProps({ @@ -587,7 +597,7 @@ function render$j(_ctx, _cache, $props, $setup, $data, $options) { return $options.onGutterKeyDown($event, i); }, "onKeydown"), ref_for: true - }, _ctx.ptm("gutterHandle")), null, 16, _hoisted_2$j)], 16, _hoisted_1$m)) : createCommentVNode("", true)], 64); + }, _ctx.ptm("gutterHandle")), null, 16, _hoisted_2$j)], 16, _hoisted_1$p)) : createCommentVNode("", true)], 64); }), 128))], 16); } __name(render$j, "render$j"); @@ -659,7 +669,7 @@ function render$i(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$i, "render$i"); script$b.render = render$i; -const _sfc_main$q = /* @__PURE__ */ defineComponent({ +const _sfc_main$r = /* @__PURE__ */ defineComponent({ __name: "LiteGraphCanvasSplitterOverlay", setup(__props) { const settingStore = useSettingStore(); @@ -746,7 +756,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({ }; } }); -const LiteGraphCanvasSplitterOverlay = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__scopeId", "data-v-e50caa15"]]); +const LiteGraphCanvasSplitterOverlay = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-e50caa15"]]); var classes$8 = { root: /* @__PURE__ */ __name(function root4(_ref) { var instance = _ref.instance, props = _ref.props; @@ -1112,9 +1122,9 @@ var script$9 = { ripple: Ripple } }; -var _hoisted_1$l = ["aria-label", "tabindex"]; +var _hoisted_1$o = ["aria-label", "tabindex"]; var _hoisted_2$i = ["aria-orientation"]; -var _hoisted_3$g = ["aria-label", "tabindex"]; +var _hoisted_3$h = ["aria-label", "tabindex"]; function render$g(_ctx, _cache, $props, $setup, $data, $options) { var _directive_ripple = resolveDirective("ripple"); return openBlock(), createElementBlock("div", mergeProps({ @@ -1133,7 +1143,7 @@ function render$g(_ctx, _cache, $props, $setup, $data, $options) { "data-pc-group-section": "navigator" }), [(openBlock(), createBlock(resolveDynamicComponent($options.templates.previcon || "ChevronLeftIcon"), mergeProps({ "aria-hidden": "true" - }, _ctx.ptm("prevIcon")), null, 16))], 16, _hoisted_1$l)), [[_directive_ripple]]) : createCommentVNode("", true), createBaseVNode("div", mergeProps({ + }, _ctx.ptm("prevIcon")), null, 16))], 16, _hoisted_1$o)), [[_directive_ripple]]) : createCommentVNode("", true), createBaseVNode("div", mergeProps({ ref: "content", "class": _ctx.cx("content"), onScroll: _cache[1] || (_cache[1] = function() { @@ -1162,11 +1172,11 @@ function render$g(_ctx, _cache, $props, $setup, $data, $options) { "data-pc-group-section": "navigator" }), [(openBlock(), createBlock(resolveDynamicComponent($options.templates.nexticon || "ChevronRightIcon"), mergeProps({ "aria-hidden": "true" - }, _ctx.ptm("nextIcon")), null, 16))], 16, _hoisted_3$g)), [[_directive_ripple]]) : createCommentVNode("", true)], 16); + }, _ctx.ptm("nextIcon")), null, 16))], 16, _hoisted_3$h)), [[_directive_ripple]]) : createCommentVNode("", true)], 16); } __name(render$g, "render$g"); script$9.render = render$g; -const _sfc_main$p = /* @__PURE__ */ defineComponent({ +const _sfc_main$q = /* @__PURE__ */ defineComponent({ __name: "ExtensionSlot", props: { extension: {} @@ -1195,17 +1205,17 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({ }; } }); -const _hoisted_1$k = { class: "flex flex-col h-full" }; +const _hoisted_1$n = { class: "flex flex-col h-full" }; const _hoisted_2$h = { class: "w-full flex justify-between" }; -const _hoisted_3$f = { class: "tabs-container" }; -const _hoisted_4$5 = { class: "font-bold" }; +const _hoisted_3$g = { class: "tabs-container" }; +const _hoisted_4$6 = { class: "font-bold" }; const _hoisted_5$4 = { class: "flex-grow h-0" }; -const _sfc_main$o = /* @__PURE__ */ defineComponent({ +const _sfc_main$p = /* @__PURE__ */ defineComponent({ __name: "BottomPanel", setup(__props) { const bottomPanelStore = useBottomPanelStore(); return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1$k, [ + return openBlock(), createElementBlock("div", _hoisted_1$n, [ createVNode(unref(script$h), { value: unref(bottomPanelStore).activeBottomPanelTabId, "onUpdate:value": _cache[1] || (_cache[1] = ($event) => unref(bottomPanelStore).activeBottomPanelTabId = $event) @@ -1214,7 +1224,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({ createVNode(unref(script$9), { "pt:tabList": "border-none" }, { default: withCtx(() => [ createBaseVNode("div", _hoisted_2$h, [ - createBaseVNode("div", _hoisted_3$f, [ + createBaseVNode("div", _hoisted_3$g, [ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(bottomPanelStore).bottomPanelTabs, (tab) => { return openBlock(), createBlock(unref(script$a), { key: tab.id, @@ -1222,7 +1232,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({ class: "p-3 border-none" }, { default: withCtx(() => [ - createBaseVNode("span", _hoisted_4$5, toDisplayString(tab.title.toUpperCase()), 1) + createBaseVNode("span", _hoisted_4$6, toDisplayString(tab.title.toUpperCase()), 1) ]), _: 2 }, 1032, ["value"]); @@ -1244,7 +1254,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({ _: 1 }, 8, ["value"]), createBaseVNode("div", _hoisted_5$4, [ - unref(bottomPanelStore).bottomPanelVisible && unref(bottomPanelStore).activeBottomPanelTab ? (openBlock(), createBlock(_sfc_main$p, { + unref(bottomPanelStore).bottomPanelVisible && unref(bottomPanelStore).activeBottomPanelTab ? (openBlock(), createBlock(_sfc_main$q, { key: 0, extension: unref(bottomPanelStore).activeBottomPanelTab }, null, 8, ["extension"])) : createCommentVNode("", true) @@ -1253,7 +1263,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({ }; } }); -const _hoisted_1$j = { +const _hoisted_1$m = { viewBox: "0 0 1024 1024", width: "1.2em", height: "1.2em" @@ -1262,15 +1272,15 @@ const _hoisted_2$g = /* @__PURE__ */ createBaseVNode("path", { fill: "currentColor", d: "M921.088 103.232L584.832 889.024L465.52 544.512L121.328 440.48zM1004.46.769c-6.096 0-13.52 1.728-22.096 5.36L27.708 411.2c-34.383 14.592-36.56 42.704-4.847 62.464l395.296 123.584l129.36 403.264c9.28 15.184 20.496 22.72 31.263 22.72c11.936 0 23.296-9.152 31.04-27.248l408.272-953.728C1029.148 16.368 1022.86.769 1004.46.769" }, null, -1); -const _hoisted_3$e = [ +const _hoisted_3$f = [ _hoisted_2$g ]; function render$f(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$j, [..._hoisted_3$e]); + return openBlock(), createElementBlock("svg", _hoisted_1$m, [..._hoisted_3$f]); } __name(render$f, "render$f"); const __unplugin_components_1$2 = markRaw({ name: "simple-line-icons-cursor", render: render$f }); -const _hoisted_1$i = { +const _hoisted_1$l = { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em" @@ -1279,11 +1289,11 @@ const _hoisted_2$f = /* @__PURE__ */ createBaseVNode("path", { fill: "currentColor", d: "M10.05 23q-.75 0-1.4-.337T7.575 21.7L1.2 12.375l.6-.575q.475-.475 1.125-.55t1.175.3L7 13.575V4q0-.425.288-.712T8 3t.713.288T9 4v13.425l-3.7-2.6l3.925 5.725q.125.2.35.325t.475.125H17q.825 0 1.413-.587T19 19V5q0-.425.288-.712T20 4t.713.288T21 5v14q0 1.65-1.175 2.825T17 23zM11 12V2q0-.425.288-.712T12 1t.713.288T13 2v10zm4 0V3q0-.425.288-.712T16 2t.713.288T17 3v9zm-2.85 4.5" }, null, -1); -const _hoisted_3$d = [ +const _hoisted_3$e = [ _hoisted_2$f ]; function render$e(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$i, [..._hoisted_3$d]); + return openBlock(), createElementBlock("svg", _hoisted_1$l, [..._hoisted_3$e]); } __name(render$e, "render$e"); const __unplugin_components_0$2 = markRaw({ name: "material-symbols-pan-tool-outline", render: render$e }); @@ -1335,7 +1345,7 @@ const useCanvasStore = defineStore("canvas", () => { canvas }; }); -const _sfc_main$n = /* @__PURE__ */ defineComponent({ +const _sfc_main$o = /* @__PURE__ */ defineComponent({ __name: "GraphCanvasMenu", setup(__props) { const { t } = useI18n(); @@ -1367,9 +1377,10 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({ withDirectives(createVNode(unref(script$d), { severity: "secondary", icon: "pi pi-plus", + "aria-label": _ctx.$t("graphCanvasMenu.zoomIn"), onMousedown: _cache[0] || (_cache[0] = ($event) => repeat2("Comfy.Canvas.ZoomIn")), onMouseup: stopRepeat - }, null, 512), [ + }, null, 8, ["aria-label"]), [ [ _directive_tooltip, unref(t)("graphCanvasMenu.zoomIn"), @@ -1380,9 +1391,10 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({ withDirectives(createVNode(unref(script$d), { severity: "secondary", icon: "pi pi-minus", + "aria-label": _ctx.$t("graphCanvasMenu.zoomOut"), onMousedown: _cache[1] || (_cache[1] = ($event) => repeat2("Comfy.Canvas.ZoomOut")), onMouseup: stopRepeat - }, null, 512), [ + }, null, 8, ["aria-label"]), [ [ _directive_tooltip, unref(t)("graphCanvasMenu.zoomOut"), @@ -1393,8 +1405,9 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({ withDirectives(createVNode(unref(script$d), { severity: "secondary", icon: "pi pi-expand", + "aria-label": _ctx.$t("graphCanvasMenu.fitView"), onClick: _cache[2] || (_cache[2] = () => unref(commandStore).execute("Comfy.Canvas.FitView")) - }, null, 512), [ + }, null, 8, ["aria-label"]), [ [ _directive_tooltip, unref(t)("graphCanvasMenu.fitView"), @@ -1404,13 +1417,16 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({ ]), withDirectives((openBlock(), createBlock(unref(script$d), { severity: "secondary", + "aria-label": unref(t)( + "graphCanvasMenu." + (unref(canvasStore).canvas?.read_only ? "panMode" : "selectMode") + ), onClick: _cache[3] || (_cache[3] = () => unref(commandStore).execute("Comfy.Canvas.ToggleLock")) }, { icon: withCtx(() => [ unref(canvasStore).canvas?.read_only ? (openBlock(), createBlock(_component_i_material_symbols58pan_tool_outline, { key: 0 })) : (openBlock(), createBlock(_component_i_simple_line_icons58cursor, { key: 1 })) ]), _: 1 - })), [ + }, 8, ["aria-label"])), [ [ _directive_tooltip, unref(t)( @@ -1423,9 +1439,10 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({ withDirectives(createVNode(unref(script$d), { severity: "secondary", icon: linkHidden.value ? "pi pi-eye-slash" : "pi pi-eye", + "aria-label": _ctx.$t("graphCanvasMenu.toggleLinkVisibility"), onClick: _cache[4] || (_cache[4] = () => unref(commandStore).execute("Comfy.Canvas.ToggleLinkVisibility")), "data-testid": "toggle-link-visibility-button" - }, null, 8, ["icon"]), [ + }, null, 8, ["icon", "aria-label"]), [ [ _directive_tooltip, unref(t)("graphCanvasMenu.toggleLinkVisibility"), @@ -1439,8 +1456,8 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({ }; } }); -const GraphCanvasMenu = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__scopeId", "data-v-cf40dd39"]]); -const _sfc_main$m = /* @__PURE__ */ defineComponent({ +const GraphCanvasMenu = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-cb8f9a1a"]]); +const _sfc_main$n = /* @__PURE__ */ defineComponent({ __name: "NodeBadge", setup(__props) { const settingStore = useSettingStore(); @@ -1493,7 +1510,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({ }; } }); -const _sfc_main$l = /* @__PURE__ */ defineComponent({ +const _sfc_main$m = /* @__PURE__ */ defineComponent({ __name: "NodeTooltip", setup(__props) { let idleTimeout; @@ -1582,8 +1599,8 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({ }; } }); -const NodeTooltip = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["__scopeId", "data-v-46859edf"]]); -const _sfc_main$k = /* @__PURE__ */ defineComponent({ +const NodeTooltip = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__scopeId", "data-v-46859edf"]]); +const _sfc_main$l = /* @__PURE__ */ defineComponent({ __name: "TitleEditor", setup(__props) { const settingStore = useSettingStore(); @@ -1690,7 +1707,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({ }; } }); -const TitleEditor = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__scopeId", "data-v-12d3fd12"]]); +const TitleEditor = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["__scopeId", "data-v-12d3fd12"]]); const useSearchBoxStore = defineStore("searchBox", () => { const visible = ref(false); function toggleVisible() { @@ -2873,10 +2890,10 @@ function _toPrimitive$4(t, r) { return ("string" === r ? String : Number)(t); } __name(_toPrimitive$4, "_toPrimitive$4"); -var _hoisted_1$h = ["aria-activedescendant"]; +var _hoisted_1$k = ["aria-activedescendant"]; var _hoisted_2$e = ["id", "aria-label", "aria-setsize", "aria-posinset"]; -var _hoisted_3$c = ["id", "placeholder", "tabindex", "disabled", "aria-label", "aria-labelledby", "aria-expanded", "aria-controls", "aria-activedescendant", "aria-invalid"]; -var _hoisted_4$4 = ["disabled", "aria-expanded", "aria-controls"]; +var _hoisted_3$d = ["id", "placeholder", "tabindex", "disabled", "aria-label", "aria-labelledby", "aria-expanded", "aria-controls", "aria-activedescendant", "aria-invalid"]; +var _hoisted_4$5 = ["disabled", "aria-expanded", "aria-controls"]; var _hoisted_5$3 = ["id"]; var _hoisted_6$2 = ["id", "aria-label"]; var _hoisted_7$1 = ["id"]; @@ -3024,7 +3041,7 @@ function render$c(_ctx, _cache, $props, $setup, $data, $options) { onChange: _cache[4] || (_cache[4] = function() { return $options.onChange && $options.onChange.apply($options, arguments); }) - }, _ctx.ptm("input")), null, 16, _hoisted_3$c)], 16)], 16, _hoisted_1$h)) : createCommentVNode("", true), $data.searching || _ctx.loading ? renderSlot(_ctx.$slots, _ctx.$slots.loader ? "loader" : "loadingicon", { + }, _ctx.ptm("input")), null, 16, _hoisted_3$d)], 16)], 16, _hoisted_1$k)) : createCommentVNode("", true), $data.searching || _ctx.loading ? renderSlot(_ctx.$slots, _ctx.$slots.loader ? "loader" : "loadingicon", { key: 2, "class": normalizeClass(_ctx.cx("loader")) }, function() { @@ -3061,7 +3078,7 @@ function render$c(_ctx, _cache, $props, $setup, $data, $options) { return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.dropdownIcon ? "span" : "ChevronDownIcon"), mergeProps({ "class": _ctx.dropdownIcon }, _ctx.ptm("dropdownIcon")), null, 16, ["class"]))]; - })], 16, _hoisted_4$4)) : createCommentVNode("", true)]; + })], 16, _hoisted_4$5)) : createCommentVNode("", true)]; }), createBaseVNode("span", mergeProps({ role: "status", "aria-live": "polite", @@ -3206,7 +3223,7 @@ function render$c(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$c, "render$c"); script$7.render = render$c; -const _sfc_main$j = { +const _sfc_main$k = { name: "AutoCompletePlus", extends: script$7, emits: ["focused-option-changed"], @@ -3222,23 +3239,23 @@ const _sfc_main$j = { ); } }; -const _withScopeId$5 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-5741c9ae"), n = n(), popScopeId(), n), "_withScopeId$5"); -const _hoisted_1$g = { class: "option-container flex justify-between items-center px-2 py-0 cursor-pointer overflow-hidden w-full" }; +const _withScopeId$8 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-fd0a74bd"), n = n(), popScopeId(), n), "_withScopeId$8"); +const _hoisted_1$j = { class: "option-container flex justify-between items-center px-2 py-0 cursor-pointer overflow-hidden w-full" }; const _hoisted_2$d = { class: "option-display-name font-semibold flex flex-col" }; -const _hoisted_3$b = { key: 0 }; -const _hoisted_4$3 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ createBaseVNode("i", { class: "pi pi-bookmark-fill text-sm mr-1" }, null, -1)); +const _hoisted_3$c = { key: 0 }; +const _hoisted_4$4 = /* @__PURE__ */ _withScopeId$8(() => /* @__PURE__ */ createBaseVNode("i", { class: "pi pi-bookmark-fill text-sm mr-1" }, null, -1)); const _hoisted_5$2 = [ - _hoisted_4$3 + _hoisted_4$4 ]; const _hoisted_6$1 = ["innerHTML"]; -const _hoisted_7 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ createBaseVNode("span", null, " ", -1)); +const _hoisted_7 = /* @__PURE__ */ _withScopeId$8(() => /* @__PURE__ */ createBaseVNode("span", null, " ", -1)); const _hoisted_8 = ["innerHTML"]; const _hoisted_9 = { key: 0, - class: "option-category font-light text-sm text-gray-400 overflow-hidden text-ellipsis whitespace-nowrap" + class: "option-category font-light text-sm text-muted overflow-hidden text-ellipsis whitespace-nowrap" }; const _hoisted_10 = { class: "option-badges" }; -const _sfc_main$i = /* @__PURE__ */ defineComponent({ +const _sfc_main$j = /* @__PURE__ */ defineComponent({ __name: "NodeSearchItem", props: { nodeDef: {}, @@ -3265,10 +3282,10 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({ ); const props = __props; return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1$g, [ + return openBlock(), createElementBlock("div", _hoisted_1$j, [ createBaseVNode("div", _hoisted_2$d, [ createBaseVNode("div", null, [ - isBookmarked.value ? (openBlock(), createElementBlock("span", _hoisted_3$b, _hoisted_5$2)) : createCommentVNode("", true), + isBookmarked.value ? (openBlock(), createElementBlock("span", _hoisted_3$c, _hoisted_5$2)) : createCommentVNode("", true), createBaseVNode("span", { innerHTML: unref(highlightQuery)(_ctx.nodeDef.display_name, _ctx.currentQuery) }, null, 8, _hoisted_6$1), @@ -3317,15 +3334,15 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({ }; } }); -const NodeSearchItem = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-5741c9ae"]]); -const _hoisted_1$f = { class: "comfy-vue-node-search-container flex justify-center items-center w-full min-w-96 pointer-events-auto" }; +const NodeSearchItem = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__scopeId", "data-v-fd0a74bd"]]); +const _hoisted_1$i = { class: "comfy-vue-node-search-container flex justify-center items-center w-full min-w-96 pointer-events-auto" }; const _hoisted_2$c = { key: 0, class: "comfy-vue-node-preview-container absolute left-[-350px] top-[50px]" }; -const _hoisted_3$a = /* @__PURE__ */ createBaseVNode("h3", null, "Add node filter condition", -1); -const _hoisted_4$2 = { class: "_dialog-body" }; -const _sfc_main$h = /* @__PURE__ */ defineComponent({ +const _hoisted_3$b = /* @__PURE__ */ createBaseVNode("h3", null, "Add node filter condition", -1); +const _hoisted_4$3 = { class: "_dialog-body" }; +const _sfc_main$i = /* @__PURE__ */ defineComponent({ __name: "NodeSearchBox", props: { filters: {}, @@ -3371,7 +3388,6 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({ const onAddFilter = /* @__PURE__ */ __name((filterAndValue) => { nodeSearchFilterVisible.value = false; emit("addFilter", filterAndValue); - reFocusInput(); }, "onAddFilter"); const onRemoveFilter = /* @__PURE__ */ __name((event, filterAndValue) => { event.stopPropagation(); @@ -3388,7 +3404,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({ hoveredSuggestion.value = value; }, "setHoverSuggestion"); return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1$f, [ + return openBlock(), createElementBlock("div", _hoisted_1$i, [ enableNodePreview.value ? (openBlock(), createElementBlock("div", _hoisted_2$c, [ hoveredSuggestion.value ? (openBlock(), createBlock(NodePreview, { nodeDef: hoveredSuggestion.value, @@ -3404,19 +3420,22 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({ createVNode(unref(script$p), { visible: nodeSearchFilterVisible.value, "onUpdate:visible": _cache[1] || (_cache[1] = ($event) => nodeSearchFilterVisible.value = $event), - class: "min-w-96" + class: "min-w-96", + "dismissable-mask": "", + modal: "", + onHide: reFocusInput }, { header: withCtx(() => [ - _hoisted_3$a + _hoisted_3$b ]), default: withCtx(() => [ - createBaseVNode("div", _hoisted_4$2, [ + createBaseVNode("div", _hoisted_4$3, [ createVNode(NodeSearchFilter, { onAddFilter }) ]) ]), _: 1 }, 8, ["visible"]), - createVNode(_sfc_main$j, { + createVNode(_sfc_main$k, { "model-value": props.filters, class: "comfy-vue-node-search-box z-10 flex-grow", scrollHeight: "40vh", @@ -3457,7 +3476,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({ }; } }); -const _sfc_main$g = /* @__PURE__ */ defineComponent({ +const _sfc_main$h = /* @__PURE__ */ defineComponent({ __name: "NodeSearchBoxPopover", setup(__props) { const settingStore = useSettingStore(); @@ -3638,7 +3657,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({ } }, { container: withCtx(() => [ - createVNode(_sfc_main$h, { + createVNode(_sfc_main$i, { filters: nodeFilters.value, onAddFilter: addFilter, onRemoveFilter: removeFilter, @@ -3692,7 +3711,7 @@ function render$b(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$b, "render$b"); script$6.render = render$b; -const _sfc_main$f = /* @__PURE__ */ defineComponent({ +const _sfc_main$g = /* @__PURE__ */ defineComponent({ __name: "SidebarIcon", props: { icon: String, @@ -3754,8 +3773,8 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({ }; } }); -const SidebarIcon = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-6ab4daa6"]]); -const _sfc_main$e = /* @__PURE__ */ defineComponent({ +const SidebarIcon = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-6ab4daa6"]]); +const _sfc_main$f = /* @__PURE__ */ defineComponent({ __name: "SidebarLogoutIcon", setup(__props) { const { t } = useI18n(); @@ -3776,7 +3795,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({ }; } }); -const _sfc_main$d = /* @__PURE__ */ defineComponent({ +const _sfc_main$e = /* @__PURE__ */ defineComponent({ __name: "SidebarSettingsToggleIcon", setup(__props) { const dialogStore = useDialogStore(); @@ -3797,13 +3816,12 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({ }; } }); -const _sfc_main$c = /* @__PURE__ */ defineComponent({ +const _sfc_main$d = /* @__PURE__ */ defineComponent({ __name: "SidebarThemeToggleIcon", setup(__props) { - const settingStore = useSettingStore(); - const currentTheme = computed(() => settingStore.get("Comfy.ColorPalette")); + const colorPaletteStore = useColorPaletteStore(); const icon = computed( - () => currentTheme.value !== "light" ? "pi pi-moon" : "pi pi-sun" + () => colorPaletteStore.completedActivePalette.light_theme ? "pi pi-sun" : "pi pi-moon" ); const commandStore = useCommandStore(); const toggleTheme = /* @__PURE__ */ __name(() => { @@ -3819,13 +3837,13 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({ }; } }); -const _withScopeId$4 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-37d8d7b4"), n = n(), popScopeId(), n), "_withScopeId$4"); -const _hoisted_1$e = { class: "side-tool-bar-end" }; +const _withScopeId$7 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-33cac83a"), n = n(), popScopeId(), n), "_withScopeId$7"); +const _hoisted_1$h = { class: "side-tool-bar-end" }; const _hoisted_2$b = { key: 0, class: "sidebar-content-container h-full overflow-y-auto overflow-x-hidden" }; -const _sfc_main$b = /* @__PURE__ */ defineComponent({ +const _sfc_main$c = /* @__PURE__ */ defineComponent({ __name: "SideToolbar", setup(__props) { const workspaceStore = useWorkspaceStore(); @@ -3853,7 +3871,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({ return openBlock(), createElementBlock(Fragment, null, [ (openBlock(), createBlock(Teleport, { to: teleportTarget.value }, [ createBaseVNode("nav", { - class: normalizeClass("side-tool-bar-container" + (isSmall.value ? " small-sidebar" : "")) + class: normalizeClass(["side-tool-bar-container", { "small-sidebar": isSmall.value }]) }, [ (openBlock(true), createElementBlock(Fragment, null, renderList(tabs.value, (tab) => { return openBlock(), createBlock(SidebarIcon, { @@ -3866,21 +3884,277 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({ onClick: /* @__PURE__ */ __name(($event) => onTabClick(tab), "onClick") }, null, 8, ["icon", "iconBadge", "tooltip", "selected", "class", "onClick"]); }), 128)), - createBaseVNode("div", _hoisted_1$e, [ - unref(userStore).isMultiUserServer ? (openBlock(), createBlock(_sfc_main$e, { key: 0 })) : createCommentVNode("", true), - createVNode(_sfc_main$c), - createVNode(_sfc_main$d) + createBaseVNode("div", _hoisted_1$h, [ + unref(userStore).isMultiUserServer ? (openBlock(), createBlock(_sfc_main$f, { key: 0 })) : createCommentVNode("", true), + createVNode(_sfc_main$d), + createVNode(_sfc_main$e) ]) ], 2) ], 8, ["to"])), selectedTab.value ? (openBlock(), createElementBlock("div", _hoisted_2$b, [ - createVNode(_sfc_main$p, { extension: selectedTab.value }, null, 8, ["extension"]) + createVNode(_sfc_main$q, { extension: selectedTab.value }, null, 8, ["extension"]) ])) : createCommentVNode("", true) ], 64); }; } }); -const SideToolbar = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-37d8d7b4"]]); +const SideToolbar = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-33cac83a"]]); +const _withScopeId$6 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-8d011a31"), n = n(), popScopeId(), n), "_withScopeId$6"); +const _hoisted_1$g = { class: "workflow-label text-sm max-w-[150px] truncate inline-block" }; +const _hoisted_2$a = { class: "relative" }; +const _hoisted_3$a = { + key: 0, + class: "status-indicator" +}; +const _sfc_main$b = /* @__PURE__ */ defineComponent({ + __name: "WorkflowTab", + props: { + class: {}, + workflowOption: {} + }, + setup(__props) { + const props = __props; + const workspaceStore = useWorkspaceStore(); + const workflowStore = useWorkflowStore(); + const workflowTabRef = ref(null); + const closeWorkflows = /* @__PURE__ */ __name(async (options) => { + for (const opt of options) { + if (!await useWorkflowService().closeWorkflow(opt.workflow, { + warnIfUnsaved: !workspaceStore.shiftDown + })) { + break; + } + } + }, "closeWorkflows"); + const onCloseWorkflow = /* @__PURE__ */ __name((option2) => { + closeWorkflows([option2]); + }, "onCloseWorkflow"); + const tabGetter = /* @__PURE__ */ __name(() => workflowTabRef.value, "tabGetter"); + usePragmaticDraggable(tabGetter, { + getInitialData: /* @__PURE__ */ __name(() => { + return { + workflowKey: props.workflowOption.workflow.key + }; + }, "getInitialData") + }); + usePragmaticDroppable(tabGetter, { + getData: /* @__PURE__ */ __name(() => { + return { + workflowKey: props.workflowOption.workflow.key + }; + }, "getData"), + onDrop: /* @__PURE__ */ __name((e) => { + const fromIndex = workflowStore.openWorkflows.findIndex( + (wf) => wf.key === e.source.data.workflowKey + ); + const toIndex = workflowStore.openWorkflows.findIndex( + (wf) => wf.key === e.location.current.dropTargets[0]?.data.workflowKey + ); + if (fromIndex !== toIndex) { + workflowStore.reorderWorkflows(fromIndex, toIndex); + } + }, "onDrop") + }); + return (_ctx, _cache) => { + const _directive_tooltip = resolveDirective("tooltip"); + return openBlock(), createElementBlock("div", mergeProps({ + class: "flex p-2 gap-2 workflow-tab", + ref_key: "workflowTabRef", + ref: workflowTabRef + }, _ctx.$attrs), [ + withDirectives((openBlock(), createElementBlock("span", _hoisted_1$g, [ + createTextVNode(toDisplayString(_ctx.workflowOption.workflow.filename), 1) + ])), [ + [ + _directive_tooltip, + _ctx.workflowOption.workflow.key, + void 0, + { bottom: true } + ] + ]), + createBaseVNode("div", _hoisted_2$a, [ + !unref(workspaceStore).shiftDown && (_ctx.workflowOption.workflow.isModified || !_ctx.workflowOption.workflow.isPersisted) ? (openBlock(), createElementBlock("span", _hoisted_3$a, "•")) : createCommentVNode("", true), + createVNode(unref(script$d), { + class: "close-button p-0 w-auto", + icon: "pi pi-times", + text: "", + severity: "secondary", + size: "small", + onClick: _cache[0] || (_cache[0] = withModifiers(($event) => onCloseWorkflow(_ctx.workflowOption), ["stop"])) + }) + ]) + ], 16); + }; + } +}); +const WorkflowTab = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-8d011a31"]]); +const _withScopeId$5 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-54fadc45"), n = n(), popScopeId(), n), "_withScopeId$5"); +const _hoisted_1$f = { class: "workflow-tabs-container flex flex-row max-w-full h-full" }; +const _sfc_main$a = /* @__PURE__ */ defineComponent({ + __name: "WorkflowTabs", + props: { + class: {} + }, + setup(__props) { + const props = __props; + const { t } = useI18n(); + const workspaceStore = useWorkspaceStore(); + const workflowStore = useWorkflowStore(); + const workflowService = useWorkflowService(); + const workflowBookmarkStore = useWorkflowBookmarkStore(); + const rightClickedTab = ref(null); + const menu = ref(); + const workflowToOption = /* @__PURE__ */ __name((workflow) => ({ + value: workflow.path, + workflow + }), "workflowToOption"); + const options = computed( + () => workflowStore.openWorkflows.map(workflowToOption) + ); + const selectedWorkflow = computed( + () => workflowStore.activeWorkflow ? workflowToOption(workflowStore.activeWorkflow) : null + ); + const onWorkflowChange = /* @__PURE__ */ __name((option2) => { + if (!option2) { + return; + } + if (selectedWorkflow.value?.value === option2.value) { + return; + } + workflowService.openWorkflow(option2.workflow); + }, "onWorkflowChange"); + const closeWorkflows = /* @__PURE__ */ __name(async (options2) => { + for (const opt of options2) { + if (!await workflowService.closeWorkflow(opt.workflow, { + warnIfUnsaved: !workspaceStore.shiftDown + })) { + break; + } + } + }, "closeWorkflows"); + const onCloseWorkflow = /* @__PURE__ */ __name((option2) => { + closeWorkflows([option2]); + }, "onCloseWorkflow"); + const showContextMenu = /* @__PURE__ */ __name((event, option2) => { + rightClickedTab.value = option2; + menu.value.show(event); + }, "showContextMenu"); + const contextMenuItems = computed(() => { + const tab = rightClickedTab.value; + if (!tab) return []; + const index = options.value.findIndex((v) => v.workflow === tab.workflow); + return [ + { + label: t("tabMenu.duplicateTab"), + command: /* @__PURE__ */ __name(() => { + workflowService.duplicateWorkflow(tab.workflow); + }, "command") + }, + { + separator: true + }, + { + label: t("tabMenu.closeTab"), + command: /* @__PURE__ */ __name(() => onCloseWorkflow(tab), "command") + }, + { + label: t("tabMenu.closeTabsToLeft"), + command: /* @__PURE__ */ __name(() => closeWorkflows(options.value.slice(0, index)), "command"), + disabled: index <= 0 + }, + { + label: t("tabMenu.closeTabsToRight"), + command: /* @__PURE__ */ __name(() => closeWorkflows(options.value.slice(index + 1)), "command"), + disabled: index === options.value.length - 1 + }, + { + label: t("tabMenu.closeOtherTabs"), + command: /* @__PURE__ */ __name(() => closeWorkflows([ + ...options.value.slice(index + 1), + ...options.value.slice(0, index) + ]), "command"), + disabled: options.value.length <= 1 + }, + { + label: workflowBookmarkStore.isBookmarked(tab.workflow.path) ? t("tabMenu.removeFromBookmarks") : t("tabMenu.addToBookmarks"), + command: /* @__PURE__ */ __name(() => workflowBookmarkStore.toggleBookmarked(tab.workflow.path), "command"), + disabled: tab.workflow.isTemporary + } + ]; + }); + const commandStore = useCommandStore(); + const handleWheel = /* @__PURE__ */ __name((event) => { + const scrollElement = event.currentTarget; + const scrollAmount = event.deltaX || event.deltaY; + scrollElement.scroll({ + left: scrollElement.scrollLeft + scrollAmount + }); + }, "handleWheel"); + return (_ctx, _cache) => { + const _directive_tooltip = resolveDirective("tooltip"); + return openBlock(), createElementBlock("div", _hoisted_1$f, [ + createVNode(unref(script$s), { + class: "overflow-hidden no-drag", + "pt:content": { + class: "p-0 w-full", + onwheel: handleWheel + }, + "pt:barX": "h-1" + }, { + default: withCtx(() => [ + createVNode(unref(script$r), { + class: normalizeClass(["workflow-tabs bg-transparent", props.class]), + modelValue: selectedWorkflow.value, + "onUpdate:modelValue": onWorkflowChange, + options: options.value, + optionLabel: "label", + dataKey: "value" + }, { + option: withCtx(({ option: option2 }) => [ + createVNode(WorkflowTab, { + onContextmenu: /* @__PURE__ */ __name(($event) => showContextMenu($event, option2), "onContextmenu"), + onMouseup: withModifiers(($event) => onCloseWorkflow(option2), ["middle"]), + "workflow-option": option2 + }, null, 8, ["onContextmenu", "onMouseup", "workflow-option"]) + ]), + _: 1 + }, 8, ["class", "modelValue", "options"]) + ]), + _: 1 + }, 8, ["pt:content"]), + withDirectives(createVNode(unref(script$d), { + class: "new-blank-workflow-button flex-shrink-0 no-drag", + icon: "pi pi-plus", + text: "", + severity: "secondary", + "aria-label": _ctx.$t("sideToolbar.newBlankWorkflow"), + onClick: _cache[0] || (_cache[0] = () => unref(commandStore).execute("Comfy.NewBlankWorkflow")) + }, null, 8, ["aria-label"]), [ + [_directive_tooltip, { value: _ctx.$t("sideToolbar.newBlankWorkflow"), showDelay: 300 }] + ]), + createVNode(unref(script$t), { + ref_key: "menu", + ref: menu, + model: contextMenuItems.value + }, null, 8, ["model"]) + ]); + }; + } +}); +const WorkflowTabs = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-54fadc45"]]); +const _withScopeId$4 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-38831d8e"), n = n(), popScopeId(), n), "_withScopeId$4"); +const _hoisted_1$e = { class: "absolute top-0 left-0 w-auto max-w-full pointer-events-auto" }; +const _sfc_main$9 = /* @__PURE__ */ defineComponent({ + __name: "SecondRowWorkflowTabs", + setup(__props) { + return (_ctx, _cache) => { + return openBlock(), createElementBlock("div", _hoisted_1$e, [ + createVNode(WorkflowTabs) + ]); + }; + } +}); +const SecondRowWorkflowTabs = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-38831d8e"]]); const CORE_SETTINGS = [ { id: "Comfy.Validation.Workflows", @@ -3959,7 +4233,8 @@ const CORE_SETTINGS = [ name: "Sidebar size", type: "combo", options: ["normal", "small"], - defaultValue: /* @__PURE__ */ __name(() => window.innerWidth < 1600 ? "small" : "normal", "defaultValue") + // Default to small if the window is less than 1536px(2xl) wide. + defaultValue: /* @__PURE__ */ __name(() => window.innerWidth < 1536 ? "small" : "normal", "defaultValue") }, { id: "Comfy.TextareaWidget.FontSize", @@ -4101,7 +4376,8 @@ const CORE_SETTINGS = [ id: "Comfy.Window.UnloadConfirmation", name: "Show confirmation when closing window", type: "boolean", - defaultValue: false + defaultValue: true, + versionModified: "1.7.12" }, { id: "Comfy.TreeExplorer.ItemPadding", @@ -4266,8 +4542,9 @@ const CORE_SETTINGS = [ id: "Comfy.Workflow.WorkflowTabsPosition", name: "Opened workflows position", type: "combo", - options: ["Sidebar", "Topbar"], - defaultValue: "Topbar" + options: ["Sidebar", "Topbar", "Topbar (2nd-row)"], + // Default to topbar (2nd-row) if the window is less than 1536px(2xl) wide. + defaultValue: /* @__PURE__ */ __name(() => window.innerWidth < 1536 ? "Topbar (2nd-row)" : "Topbar", "defaultValue") }, { id: "Comfy.Graph.CanvasMenu", @@ -4289,7 +4566,16 @@ const CORE_SETTINGS = [ name: "Keybindings unset by the user", type: "hidden", defaultValue: [], - versionAdded: "1.3.7" + versionAdded: "1.3.7", + versionModified: "1.7.3", + migrateDeprecatedValue: /* @__PURE__ */ __name((value) => { + return value.map((keybinding) => { + if (keybinding["targetSelector"] === "#graph-canvas") { + keybinding["targetElementId"] = "graph-canvas"; + } + return keybinding; + }); + }, "migrateDeprecatedValue") }, { id: "Comfy.Keybinding.NewBindings", @@ -4550,7 +4836,7 @@ const CORE_SETTINGS = [ versionModified: "1.6.10" } ]; -const _sfc_main$a = /* @__PURE__ */ defineComponent({ +const _sfc_main$8 = /* @__PURE__ */ defineComponent({ __name: "GraphCanvas", emits: ["ready"], setup(__props, { emit: __emit }) { @@ -4565,10 +4851,31 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({ const betaMenuEnabled = computed( () => settingStore.get("Comfy.UseNewMenu") !== "Disabled" ); + const workflowTabsPosition = computed( + () => settingStore.get("Comfy.Workflow.WorkflowTabsPosition") + ); const canvasMenuEnabled = computed( () => settingStore.get("Comfy.Graph.CanvasMenu") ); const tooltipEnabled = computed(() => settingStore.get("Comfy.EnableTooltips")); + const storedWorkflows = JSON.parse( + getStorageValue("Comfy.OpenWorkflowsPaths") || "[]" + ); + const storedActiveIndex = JSON.parse( + getStorageValue("Comfy.ActiveWorkflowIndex") || "-1" + ); + const openWorkflows = computed(() => workspaceStore?.workflow?.openWorkflows); + const activeWorkflow = computed(() => workspaceStore?.workflow?.activeWorkflow); + const restoreState2 = computed(() => { + if (!openWorkflows.value || !activeWorkflow.value) { + return { paths: [], activeIndex: -1 }; + } + const paths = openWorkflows.value.filter((workflow) => workflow?.isPersisted && !workflow.isModified).map((workflow) => workflow.path); + const activeIndex = openWorkflows.value.findIndex( + (workflow) => workflow.path === activeWorkflow.value?.path + ); + return { paths, activeIndex }; + }); watchEffect(() => { const canvasInfoEnabled = settingStore.get("Comfy.Graph.CanvasInfo"); if (canvasStore.canvas) { @@ -4799,6 +5106,16 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({ colorPaletteStore.customPalettes = settingStore.get( "Comfy.CustomColorPalettes" ); + const isRestorable = storedWorkflows?.length > 0 && storedActiveIndex >= 0; + if (isRestorable) + workflowStore.openWorkflowsInBackground({ + left: storedWorkflows.slice(0, storedActiveIndex), + right: storedWorkflows.slice(storedActiveIndex) + }); + watch(restoreState2, ({ paths, activeIndex }) => { + setStorageValue("Comfy.OpenWorkflowsPaths", JSON.stringify(paths)); + setStorageValue("Comfy.ActiveWorkflowIndex", JSON.stringify(activeIndex)); + }); watch( () => settingStore.get("Comfy.Locale"), async () => { @@ -4816,10 +5133,11 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({ createVNode(SideToolbar) ]), "bottom-panel": withCtx(() => [ - createVNode(_sfc_main$o) + createVNode(_sfc_main$p) ]), "graph-canvas-panel": withCtx(() => [ - canvasMenuEnabled.value ? (openBlock(), createBlock(GraphCanvasMenu, { key: 0 })) : createCommentVNode("", true) + workflowTabsPosition.value === "Topbar (2nd-row)" ? (openBlock(), createBlock(SecondRowWorkflowTabs, { key: 0 })) : createCommentVNode("", true), + canvasMenuEnabled.value ? (openBlock(), createBlock(GraphCanvasMenu, { key: 1 })) : createCommentVNode("", true) ]), _: 1 })) : createCommentVNode("", true), @@ -4832,9 +5150,9 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({ tabindex: "1" }, null, 512) ])), - createVNode(_sfc_main$g), + createVNode(_sfc_main$h), tooltipEnabled.value ? (openBlock(), createBlock(NodeTooltip, { key: 0 })) : createCommentVNode("", true), - createVNode(_sfc_main$m) + createVNode(_sfc_main$n) ], 64); }; } @@ -5049,10 +5367,10 @@ var script$1$3 = { computed: { iconComponent: /* @__PURE__ */ __name(function iconComponent() { return { - info: !this.infoIcon && script$r, - success: !this.successIcon && script$s, - warn: !this.warnIcon && script$t, - error: !this.errorIcon && script$u + info: !this.infoIcon && script$u, + success: !this.successIcon && script$v, + warn: !this.warnIcon && script$w, + error: !this.errorIcon && script$x }[this.message.severity]; }, "iconComponent"), closeAriaLabel: /* @__PURE__ */ __name(function closeAriaLabel() { @@ -5060,11 +5378,11 @@ var script$1$3 = { }, "closeAriaLabel") }, components: { - TimesIcon: script$v, - InfoCircleIcon: script$r, - CheckIcon: script$s, - ExclamationTriangleIcon: script$t, - TimesCircleIcon: script$u + TimesIcon: script$y, + InfoCircleIcon: script$u, + CheckIcon: script$v, + ExclamationTriangleIcon: script$w, + TimesCircleIcon: script$x }, directives: { ripple: Ripple @@ -5410,7 +5728,7 @@ function render$a(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$a, "render$a"); script$5.render = render$a; -const _sfc_main$9 = /* @__PURE__ */ defineComponent({ +const _sfc_main$7 = /* @__PURE__ */ defineComponent({ __name: "GlobalToast", setup(__props) { const toast = useToast(); @@ -5489,7 +5807,7 @@ const _hoisted_1$c = { width: "1.2em", height: "1.2em" }; -const _hoisted_2$a = /* @__PURE__ */ createBaseVNode("path", { +const _hoisted_2$9 = /* @__PURE__ */ createBaseVNode("path", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", @@ -5498,7 +5816,7 @@ const _hoisted_2$a = /* @__PURE__ */ createBaseVNode("path", { d: "M6 4v16m4-16l10 8l-10 8z" }, null, -1); const _hoisted_3$9 = [ - _hoisted_2$a + _hoisted_2$9 ]; function render$9(_ctx, _cache) { return openBlock(), createElementBlock("svg", _hoisted_1$c, [..._hoisted_3$9]); @@ -5510,7 +5828,7 @@ const _hoisted_1$b = { width: "1.2em", height: "1.2em" }; -const _hoisted_2$9 = /* @__PURE__ */ createBaseVNode("path", { +const _hoisted_2$8 = /* @__PURE__ */ createBaseVNode("path", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", @@ -5519,7 +5837,7 @@ const _hoisted_2$9 = /* @__PURE__ */ createBaseVNode("path", { d: "m13 19l9-7l-9-7zM2 19l9-7l-9-7z" }, null, -1); const _hoisted_3$8 = [ - _hoisted_2$9 + _hoisted_2$8 ]; function render$8(_ctx, _cache) { return openBlock(), createElementBlock("svg", _hoisted_1$b, [..._hoisted_3$8]); @@ -5531,7 +5849,7 @@ const _hoisted_1$a = { width: "1.2em", height: "1.2em" }; -const _hoisted_2$8 = /* @__PURE__ */ createBaseVNode("path", { +const _hoisted_2$7 = /* @__PURE__ */ createBaseVNode("path", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", @@ -5540,7 +5858,7 @@ const _hoisted_2$8 = /* @__PURE__ */ createBaseVNode("path", { d: "m6 3l14 9l-14 9z" }, null, -1); const _hoisted_3$7 = [ - _hoisted_2$8 + _hoisted_2$7 ]; function render$7(_ctx, _cache) { return openBlock(), createElementBlock("svg", _hoisted_1$a, [..._hoisted_3$7]); @@ -5552,7 +5870,7 @@ const _hoisted_1$9 = { width: "1.2em", height: "1.2em" }; -const _hoisted_2$7 = /* @__PURE__ */ createBaseVNode("g", { +const _hoisted_2$6 = /* @__PURE__ */ createBaseVNode("g", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", @@ -5563,7 +5881,7 @@ const _hoisted_2$7 = /* @__PURE__ */ createBaseVNode("g", { /* @__PURE__ */ createBaseVNode("path", { d: "m16 8l-2-2l2-2" }) ], -1); const _hoisted_3$6 = [ - _hoisted_2$7 + _hoisted_2$6 ]; function render$6(_ctx, _cache) { return openBlock(), createElementBlock("svg", _hoisted_1$9, [..._hoisted_3$6]); @@ -5809,16 +6127,16 @@ var script$1$2 = { }, "containerRef") }, components: { - AngleRightIcon: script$w + AngleRightIcon: script$z }, directives: { ripple: Ripple } }; var _hoisted_1$1$2 = ["tabindex"]; -var _hoisted_2$6 = ["id", "aria-label", "aria-disabled", "aria-expanded", "aria-haspopup", "aria-level", "aria-setsize", "aria-posinset", "data-p-active", "data-p-focused", "data-p-disabled"]; +var _hoisted_2$5 = ["id", "aria-label", "aria-disabled", "aria-expanded", "aria-haspopup", "aria-level", "aria-setsize", "aria-posinset", "data-p-active", "data-p-focused", "data-p-disabled"]; var _hoisted_3$5 = ["onClick", "onMouseenter", "onMousemove"]; -var _hoisted_4$1 = ["href", "target"]; +var _hoisted_4$2 = ["href", "target"]; var _hoisted_5$1 = ["id"]; var _hoisted_6 = ["id"]; function render$1$1(_ctx, _cache, $props, $setup, $data, $options) { @@ -5900,7 +6218,7 @@ function render$1$1(_ctx, _cache, $props, $setup, $data, $options) { key: 1, "class": _ctx.cx("submenuIcon"), ref_for: true - }, $options.getPTOptions(processedItem, index, "submenuIcon")), null, 16, ["class"]))], 64)) : createCommentVNode("", true)], 16, _hoisted_4$1)), [[_directive_ripple]]) : (openBlock(), createBlock(resolveDynamicComponent($props.templates.item), { + }, $options.getPTOptions(processedItem, index, "submenuIcon")), null, 16, ["class"]))], 64)) : createCommentVNode("", true)], 16, _hoisted_4$2)), [[_directive_ripple]]) : (openBlock(), createBlock(resolveDynamicComponent($props.templates.item), { key: 1, item: processedItem.item, hasSubmenu: $options.getItemProp(processedItem, "items"), @@ -5932,7 +6250,7 @@ function render$1$1(_ctx, _cache, $props, $setup, $data, $options) { onItemMousemove: _cache[2] || (_cache[2] = function($event) { return _ctx.$emit("item-mousemove", $event); }) - }, null, 8, ["id", "style", "aria-labelledby", "menuId", "focusedItemId", "items", "templates", "activeItemPath", "level", "visible", "pt", "unstyled"])) : createCommentVNode("", true)], 16, _hoisted_2$6)) : createCommentVNode("", true), $options.isItemVisible(processedItem) && $options.getItemProp(processedItem, "separator") ? (openBlock(), createElementBlock("li", mergeProps({ + }, null, 8, ["id", "style", "aria-labelledby", "menuId", "focusedItemId", "items", "templates", "activeItemPath", "level", "visible", "pt", "unstyled"])) : createCommentVNode("", true)], 16, _hoisted_2$5)) : createCommentVNode("", true), $options.isItemVisible(processedItem) && $options.getItemProp(processedItem, "separator") ? (openBlock(), createElementBlock("li", mergeProps({ key: 1, id: $options.getItemId(processedItem), style: $options.getItemProp(processedItem, "style"), @@ -6910,8 +7228,10 @@ function render$4(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$4, "render$4"); script$3.render = render$4; +const _withScopeId$3 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-26957f1f"), n = n(), popScopeId(), n), "_withScopeId$3"); +const _hoisted_1$6 = ["aria-label"]; const minQueueCount = 1; -const _sfc_main$8 = /* @__PURE__ */ defineComponent({ +const _sfc_main$6 = /* @__PURE__ */ defineComponent({ __name: "BatchCountEdit", props: { class: { default: "" } @@ -6938,9 +7258,10 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({ return (_ctx, _cache) => { const _directive_tooltip = resolveDirective("tooltip"); return withDirectives((openBlock(), createElementBlock("div", { - class: normalizeClass(["batch-count", props.class]) + class: normalizeClass(["batch-count", props.class]), + "aria-label": _ctx.$t("menu.batchCount") }, [ - createVNode(unref(script$x), { + createVNode(unref(script$A), { class: "w-14", modelValue: unref(batchCount), "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(batchCount) ? batchCount.value = $event : null), @@ -6963,7 +7284,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({ } } }, null, 8, ["modelValue", "max", "pt"]) - ], 2)), [ + ], 10, _hoisted_1$6)), [ [ _directive_tooltip, _ctx.$t("menu.batchCount"), @@ -6974,10 +7295,10 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({ }; } }); -const BatchCountEdit = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-b9328350"]]); -const _withScopeId$3 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-7f4f551b"), n = n(), popScopeId(), n), "_withScopeId$3"); -const _hoisted_1$6 = { class: "queue-button-group flex" }; -const _sfc_main$7 = /* @__PURE__ */ defineComponent({ +const BatchCountEdit = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-26957f1f"]]); +const _withScopeId$2 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-e9044686"), n = n(), popScopeId(), n), "_withScopeId$2"); +const _hoisted_1$5 = { class: "queue-button-group flex" }; +const _sfc_main$5 = /* @__PURE__ */ defineComponent({ __name: "ComfyQueueButton", setup(__props) { const workspaceStore = useWorkspaceStore(); @@ -7029,7 +7350,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({ const _component_i_lucide58fast_forward = __unplugin_components_2; const _component_i_lucide58step_forward = __unplugin_components_3; const _directive_tooltip = resolveDirective("tooltip"); - return openBlock(), createElementBlock("div", _hoisted_1$6, [ + return openBlock(), createElementBlock("div", _hoisted_1$5, [ withDirectives((openBlock(), createBlock(unref(script$3), { class: "comfyui-queue-button", label: activeQueueModeMenuItem.value.label, @@ -7070,8 +7391,9 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({ severity: executingPrompt.value ? "danger" : "secondary", disabled: !executingPrompt.value, text: "", + "aria-label": _ctx.$t("menu.interrupt"), onClick: _cache[0] || (_cache[0] = () => unref(commandStore).execute("Comfy.Interrupt")) - }, null, 8, ["severity", "disabled"]), [ + }, null, 8, ["severity", "disabled", "aria-label"]), [ [ _directive_tooltip, _ctx.$t("menu.interrupt"), @@ -7084,8 +7406,9 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({ severity: hasPendingTasks.value ? "danger" : "secondary", disabled: !hasPendingTasks.value, text: "", + "aria-label": _ctx.$t("sideToolbar.queueTab.clearPendingTasks"), onClick: _cache[1] || (_cache[1] = () => unref(commandStore).execute("Comfy.ClearPendingTasks")) - }, null, 8, ["severity", "disabled"]), [ + }, null, 8, ["severity", "disabled", "aria-label"]), [ [ _directive_tooltip, _ctx.$t("sideToolbar.queueTab.clearPendingTasks"), @@ -7100,9 +7423,9 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({ }; } }); -const ComfyQueueButton = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-7f4f551b"]]); +const ComfyQueueButton = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-e9044686"]]); const overlapThreshold = 20; -const _sfc_main$6 = /* @__PURE__ */ defineComponent({ +const _sfc_main$4 = /* @__PURE__ */ defineComponent({ __name: "ComfyActionbar", setup(__props) { const settingsStore = useSettingStore(); @@ -7251,7 +7574,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({ }); }); return (_ctx, _cache) => { - return openBlock(), createBlock(unref(script$y), { + return openBlock(), createBlock(unref(script$B), { class: normalizeClass(["actionbar w-fit", { "is-dragging": unref(isDragging), "is-docked": unref(isDocked) }]), style: normalizeStyle(unref(style)) }, { @@ -7274,42 +7597,42 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({ }; } }); -const Actionbar = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-915e5456"]]); -const _hoisted_1$5 = { - viewBox: "0 0 24 24", - width: "1.2em", - height: "1.2em" -}; -const _hoisted_2$5 = /* @__PURE__ */ createBaseVNode("path", { - fill: "currentColor", - d: "M5 21q-.825 0-1.412-.587T3 19V5q0-.825.588-1.412T5 3h14q.825 0 1.413.588T21 5v14q0 .825-.587 1.413T19 21zm0-5v3h14v-3zm0-2h14V5H5zm0 2v3z" -}, null, -1); -const _hoisted_3$4 = [ - _hoisted_2$5 -]; -function render$3(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$5, [..._hoisted_3$4]); -} -__name(render$3, "render$3"); -const __unplugin_components_1 = markRaw({ name: "material-symbols-dock-to-bottom-outline", render: render$3 }); +const Actionbar = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-915e5456"]]); const _hoisted_1$4 = { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em" }; const _hoisted_2$4 = /* @__PURE__ */ createBaseVNode("path", { + fill: "currentColor", + d: "M5 21q-.825 0-1.412-.587T3 19V5q0-.825.588-1.412T5 3h14q.825 0 1.413.588T21 5v14q0 .825-.587 1.413T19 21zm0-5v3h14v-3zm0-2h14V5H5zm0 2v3z" +}, null, -1); +const _hoisted_3$4 = [ + _hoisted_2$4 +]; +function render$3(_ctx, _cache) { + return openBlock(), createElementBlock("svg", _hoisted_1$4, [..._hoisted_3$4]); +} +__name(render$3, "render$3"); +const __unplugin_components_1 = markRaw({ name: "material-symbols-dock-to-bottom-outline", render: render$3 }); +const _hoisted_1$3 = { + viewBox: "0 0 24 24", + width: "1.2em", + height: "1.2em" +}; +const _hoisted_2$3 = /* @__PURE__ */ createBaseVNode("path", { fill: "currentColor", d: "M5 21q-.825 0-1.412-.587T3 19V5q0-.825.588-1.412T5 3h14q.825 0 1.413.588T21 5v14q0 .825-.587 1.413T19 21zm0-7h14V5H5z" }, null, -1); const _hoisted_3$3 = [ - _hoisted_2$4 + _hoisted_2$3 ]; function render$2(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$4, [..._hoisted_3$3]); + return openBlock(), createElementBlock("svg", _hoisted_1$3, [..._hoisted_3$3]); } __name(render$2, "render$2"); const __unplugin_components_0 = markRaw({ name: "material-symbols-dock-to-bottom", render: render$2 }); -const _sfc_main$5 = /* @__PURE__ */ defineComponent({ +const _sfc_main$3 = /* @__PURE__ */ defineComponent({ __name: "BottomPanelToggleButton", setup(__props) { const bottomPanelStore = useBottomPanelStore(); @@ -7320,13 +7643,14 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({ return withDirectives((openBlock(), createBlock(unref(script$d), { severity: "secondary", text: "", + "aria-label": _ctx.$t("menu.toggleBottomPanel"), onClick: unref(bottomPanelStore).toggleBottomPanel }, { icon: withCtx(() => [ unref(bottomPanelStore).bottomPanelVisible ? (openBlock(), createBlock(_component_i_material_symbols58dock_to_bottom, { key: 0 })) : (openBlock(), createBlock(_component_i_material_symbols58dock_to_bottom_outline, { key: 1 })) ]), _: 1 - }, 8, ["onClick"])), [ + }, 8, ["aria-label", "onClick"])), [ [vShow, unref(bottomPanelStore).bottomPanelTabs.length > 0], [_directive_tooltip, { value: _ctx.$t("menu.toggleBottomPanel"), showDelay: 300 }] ]); @@ -7561,17 +7885,17 @@ var script$1 = { }, "getAriaSetSize") }, components: { - AngleRightIcon: script$w, - AngleDownIcon: script$z + AngleRightIcon: script$z, + AngleDownIcon: script$C }, directives: { ripple: Ripple } }; var _hoisted_1$1$1 = ["id", "aria-label", "aria-disabled", "aria-expanded", "aria-haspopup", "aria-level", "aria-setsize", "aria-posinset", "data-p-active", "data-p-focused", "data-p-disabled"]; -var _hoisted_2$3 = ["onClick", "onMouseenter", "onMousemove"]; +var _hoisted_2$2 = ["onClick", "onMouseenter", "onMousemove"]; var _hoisted_3$2 = ["href", "target"]; -var _hoisted_4 = ["id"]; +var _hoisted_4$1 = ["id"]; var _hoisted_5 = ["id"]; function render$1(_ctx, _cache, $props, $setup, $data, $options) { var _component_MenubarSub = resolveComponent("MenubarSub", true); @@ -7632,7 +7956,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) { id: $options.getItemLabelId(processedItem), "class": _ctx.cx("itemLabel"), ref_for: true - }, $options.getPTOptions(processedItem, index, "itemLabel")), toDisplayString($options.getItemLabel(processedItem)), 17, _hoisted_4), $options.getItemProp(processedItem, "items") ? (openBlock(), createElementBlock(Fragment, { + }, $options.getPTOptions(processedItem, index, "itemLabel")), toDisplayString($options.getItemLabel(processedItem)), 17, _hoisted_4$1), $options.getItemProp(processedItem, "items") ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [$props.templates.submenuicon ? (openBlock(), createBlock(resolveDynamicComponent($props.templates.submenuicon), { key: 0, @@ -7650,7 +7974,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) { hasSubmenu: $options.getItemProp(processedItem, "items"), label: $options.getItemLabel(processedItem), props: $options.getMenuItemProps(processedItem, index) - }, null, 8, ["item", "root", "hasSubmenu", "label", "props"]))], 16, _hoisted_2$3), $options.isItemVisible(processedItem) && $options.isItemGroup(processedItem) ? (openBlock(), createBlock(_component_MenubarSub, { + }, null, 8, ["item", "root", "hasSubmenu", "label", "props"]))], 16, _hoisted_2$2), $options.isItemVisible(processedItem) && $options.isItemGroup(processedItem) ? (openBlock(), createBlock(_component_MenubarSub, { key: 0, id: $options.getItemId(processedItem) + "_list", menuId: $props.menuId, @@ -8293,7 +8617,7 @@ var script = { }, components: { MenubarSub: script$1, - BarsIcon: script$A + BarsIcon: script$D } }; function _typeof(o) { @@ -8348,7 +8672,7 @@ function _toPrimitive(t, r) { return ("string" === r ? String : Number)(t); } __name(_toPrimitive, "_toPrimitive"); -var _hoisted_1$3 = ["aria-haspopup", "aria-expanded", "aria-controls", "aria-label"]; +var _hoisted_1$2 = ["aria-haspopup", "aria-expanded", "aria-controls", "aria-label"]; function render(_ctx, _cache, $props, $setup, $data, $options) { var _component_BarsIcon = resolveComponent("BarsIcon"); var _component_MenubarSub = resolveComponent("MenubarSub"); @@ -8384,7 +8708,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) { }) }, _objectSpread(_objectSpread({}, _ctx.buttonProps), _ctx.ptm("button"))), [renderSlot(_ctx.$slots, _ctx.$slots.buttonicon ? "buttonicon" : "menubuttonicon", {}, function() { return [createVNode(_component_BarsIcon, normalizeProps(guardReactiveProps(_ctx.ptm("buttonicon"))), null, 16)]; - })], 16, _hoisted_1$3)) : createCommentVNode("", true)]; + })], 16, _hoisted_1$2)) : createCommentVNode("", true)]; }), createVNode(_component_MenubarSub, { ref: $options.menubarRef, id: $data.id + "_list", @@ -8416,14 +8740,14 @@ function render(_ctx, _cache, $props, $setup, $data, $options) { } __name(render, "render"); script.render = render; -const _withScopeId$2 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-6fecd137"), n = n(), popScopeId(), n), "_withScopeId$2"); -const _hoisted_1$2 = ["href"]; -const _hoisted_2$2 = { class: "p-menubar-item-label" }; +const _withScopeId$1 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-56df69d2"), n = n(), popScopeId(), n), "_withScopeId$1"); +const _hoisted_1$1 = ["href"]; +const _hoisted_2$1 = { class: "p-menubar-item-label" }; const _hoisted_3$1 = { key: 1, - class: "ml-auto border border-surface rounded text-muted text-xs p-1 keybinding-tag" + class: "ml-auto border border-surface rounded text-muted text-xs text-nowrap p-1 keybinding-tag" }; -const _sfc_main$4 = /* @__PURE__ */ defineComponent({ +const _sfc_main$2 = /* @__PURE__ */ defineComponent({ __name: "CommandMenubar", setup(__props) { const settingStore = useSettingStore(); @@ -8463,231 +8787,21 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({ key: 0, class: normalizeClass(["p-menubar-item-icon", item3.icon]) }, null, 2)) : createCommentVNode("", true), - createBaseVNode("span", _hoisted_2$2, toDisplayString(item3.label), 1), + createBaseVNode("span", _hoisted_2$1, toDisplayString(item3.label), 1), item3?.comfyCommand?.keybinding ? (openBlock(), createElementBlock("span", _hoisted_3$1, toDisplayString(item3.comfyCommand.keybinding.combo.toString()), 1)) : createCommentVNode("", true) - ], 16, _hoisted_1$2) + ], 16, _hoisted_1$1) ]), _: 1 }, 8, ["model", "pt"]); }; } }); -const CommandMenubar = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-6fecd137"]]); -const _withScopeId$1 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-8d011a31"), n = n(), popScopeId(), n), "_withScopeId$1"); -const _hoisted_1$1 = { class: "workflow-label text-sm max-w-[150px] truncate inline-block" }; -const _hoisted_2$1 = { class: "relative" }; -const _hoisted_3 = { - key: 0, - class: "status-indicator" -}; -const _sfc_main$3 = /* @__PURE__ */ defineComponent({ - __name: "WorkflowTab", - props: { - class: {}, - workflowOption: {} - }, - setup(__props) { - const props = __props; - const workspaceStore = useWorkspaceStore(); - const workflowStore = useWorkflowStore(); - const workflowTabRef = ref(null); - const closeWorkflows = /* @__PURE__ */ __name(async (options) => { - for (const opt of options) { - if (!await useWorkflowService().closeWorkflow(opt.workflow, { - warnIfUnsaved: !workspaceStore.shiftDown - })) { - break; - } - } - }, "closeWorkflows"); - const onCloseWorkflow = /* @__PURE__ */ __name((option2) => { - closeWorkflows([option2]); - }, "onCloseWorkflow"); - const tabGetter = /* @__PURE__ */ __name(() => workflowTabRef.value, "tabGetter"); - usePragmaticDraggable(tabGetter, { - getInitialData: /* @__PURE__ */ __name(() => { - return { - workflowKey: props.workflowOption.workflow.key - }; - }, "getInitialData") - }); - usePragmaticDroppable(tabGetter, { - getData: /* @__PURE__ */ __name(() => { - return { - workflowKey: props.workflowOption.workflow.key - }; - }, "getData"), - onDrop: /* @__PURE__ */ __name((e) => { - const fromIndex = workflowStore.openWorkflows.findIndex( - (wf) => wf.key === e.source.data.workflowKey - ); - const toIndex = workflowStore.openWorkflows.findIndex( - (wf) => wf.key === e.location.current.dropTargets[0]?.data.workflowKey - ); - if (fromIndex !== toIndex) { - workflowStore.reorderWorkflows(fromIndex, toIndex); - } - }, "onDrop") - }); - return (_ctx, _cache) => { - const _directive_tooltip = resolveDirective("tooltip"); - return openBlock(), createElementBlock("div", mergeProps({ - class: "flex p-2 gap-2 workflow-tab", - ref_key: "workflowTabRef", - ref: workflowTabRef - }, _ctx.$attrs), [ - withDirectives((openBlock(), createElementBlock("span", _hoisted_1$1, [ - createTextVNode(toDisplayString(_ctx.workflowOption.workflow.filename), 1) - ])), [ - [ - _directive_tooltip, - _ctx.workflowOption.workflow.key, - void 0, - { bottom: true } - ] - ]), - createBaseVNode("div", _hoisted_2$1, [ - !unref(workspaceStore).shiftDown && (_ctx.workflowOption.workflow.isModified || !_ctx.workflowOption.workflow.isPersisted) ? (openBlock(), createElementBlock("span", _hoisted_3, "•")) : createCommentVNode("", true), - createVNode(unref(script$d), { - class: "close-button p-0 w-auto", - icon: "pi pi-times", - text: "", - severity: "secondary", - size: "small", - onClick: _cache[0] || (_cache[0] = withModifiers(($event) => onCloseWorkflow(_ctx.workflowOption), ["stop"])) - }) - ]) - ], 16); - }; - } -}); -const WorkflowTab = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-8d011a31"]]); -const _sfc_main$2 = /* @__PURE__ */ defineComponent({ - __name: "WorkflowTabs", - props: { - class: {} - }, - setup(__props) { - const props = __props; - const { t } = useI18n(); - const workspaceStore = useWorkspaceStore(); - const workflowStore = useWorkflowStore(); - const workflowService = useWorkflowService(); - const rightClickedTab = ref(null); - const menu = ref(); - const workflowToOption = /* @__PURE__ */ __name((workflow) => ({ - value: workflow.path, - workflow - }), "workflowToOption"); - const options = computed( - () => workflowStore.openWorkflows.map(workflowToOption) - ); - const selectedWorkflow = computed( - () => workflowStore.activeWorkflow ? workflowToOption(workflowStore.activeWorkflow) : null - ); - const onWorkflowChange = /* @__PURE__ */ __name((option2) => { - if (!option2) { - return; - } - if (selectedWorkflow.value?.value === option2.value) { - return; - } - workflowService.openWorkflow(option2.workflow); - }, "onWorkflowChange"); - const closeWorkflows = /* @__PURE__ */ __name(async (options2) => { - for (const opt of options2) { - if (!await workflowService.closeWorkflow(opt.workflow, { - warnIfUnsaved: !workspaceStore.shiftDown - })) { - break; - } - } - }, "closeWorkflows"); - const onCloseWorkflow = /* @__PURE__ */ __name((option2) => { - closeWorkflows([option2]); - }, "onCloseWorkflow"); - const showContextMenu = /* @__PURE__ */ __name((event, option2) => { - rightClickedTab.value = option2; - menu.value.show(event); - }, "showContextMenu"); - const contextMenuItems = computed(() => { - const tab = rightClickedTab.value; - if (!tab) return []; - const index = options.value.findIndex((v) => v.workflow === tab.workflow); - return [ - { - label: t("tabMenu.duplicateTab"), - command: /* @__PURE__ */ __name(() => { - workflowService.duplicateWorkflow(tab.workflow); - }, "command") - }, - { - separator: true - }, - { - label: t("tabMenu.closeTab"), - command: /* @__PURE__ */ __name(() => onCloseWorkflow(tab), "command") - }, - { - label: t("tabMenu.closeTabsToLeft"), - command: /* @__PURE__ */ __name(() => closeWorkflows(options.value.slice(0, index)), "command"), - disabled: index <= 0 - }, - { - label: t("tabMenu.closeTabsToRight"), - command: /* @__PURE__ */ __name(() => closeWorkflows(options.value.slice(index + 1)), "command"), - disabled: index === options.value.length - 1 - }, - { - label: t("tabMenu.closeOtherTabs"), - command: /* @__PURE__ */ __name(() => closeWorkflows([ - ...options.value.slice(index + 1), - ...options.value.slice(0, index) - ]), "command"), - disabled: options.value.length <= 1 - } - ]; - }); - const commandStore = useCommandStore(); - return (_ctx, _cache) => { - return openBlock(), createElementBlock(Fragment, null, [ - createVNode(unref(script$B), { - class: normalizeClass(["workflow-tabs bg-transparent inline", props.class]), - modelValue: selectedWorkflow.value, - "onUpdate:modelValue": onWorkflowChange, - options: options.value, - optionLabel: "label", - dataKey: "value" - }, { - option: withCtx(({ option: option2 }) => [ - createVNode(WorkflowTab, { - onContextmenu: /* @__PURE__ */ __name(($event) => showContextMenu($event, option2), "onContextmenu"), - onMouseup: withModifiers(($event) => onCloseWorkflow(option2), ["middle"]), - "workflow-option": option2 - }, null, 8, ["onContextmenu", "onMouseup", "workflow-option"]) - ]), - _: 1 - }, 8, ["class", "modelValue", "options"]), - createVNode(unref(script$d), { - class: "new-blank-workflow-button", - icon: "pi pi-plus", - text: "", - severity: "secondary", - onClick: _cache[0] || (_cache[0] = () => unref(commandStore).execute("Comfy.NewBlankWorkflow")) - }), - createVNode(unref(script$C), { - ref_key: "menu", - ref: menu, - model: contextMenuItems.value - }, null, 8, ["model"]) - ], 64); - }; - } -}); -const WorkflowTabs = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-d485c044"]]); -const _withScopeId = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-878b63b8"), n = n(), popScopeId(), n), "_withScopeId"); -const _hoisted_1 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createBaseVNode("h1", { class: "comfyui-logo mx-2" }, "ComfyUI", -1)); -const _hoisted_2 = { class: "flex-grow" }; +const CommandMenubar = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-56df69d2"]]); +const _withScopeId = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-6e35440f"), n = n(), popScopeId(), n), "_withScopeId"); +const _hoisted_1 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createBaseVNode("h1", { class: "comfyui-logo mx-2 app-drag" }, "ComfyUI", -1)); +const _hoisted_2 = { class: "flex-grow min-w-0 app-drag h-full" }; +const _hoisted_3 = { class: "window-actions-spacer flex-shrink-0" }; +const _hoisted_4 = { class: "fixed top-0 left-0 app-drag w-full h-[var(--comfy-topbar-height)]" }; const _sfc_main$1 = /* @__PURE__ */ defineComponent({ __name: "TopMenubar", setup(__props) { @@ -8696,12 +8810,17 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({ const workflowTabsPosition = computed( () => settingStore.get("Comfy.Workflow.WorkflowTabsPosition") ); - const betaMenuEnabled = computed( - () => settingStore.get("Comfy.UseNewMenu") !== "Disabled" - ); + const menuSetting = computed(() => settingStore.get("Comfy.UseNewMenu")); + const betaMenuEnabled = computed(() => menuSetting.value !== "Disabled"); const teleportTarget = computed( () => settingStore.get("Comfy.UseNewMenu") === "Top" ? ".comfyui-body-top" : ".comfyui-body-bottom" ); + const isNativeWindow = computed( + () => isElectron() && settingStore.get("Comfy-Desktop.WindowStyle") === "custom" + ); + const showTopMenu = computed( + () => betaMenuEnabled.value && !workspaceState.focusMode + ); const menuRight = ref(null); onMounted(() => { if (menuRight.value) { @@ -8719,47 +8838,60 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({ isDroppable.value = payload.isOverlapping && payload.isDragging; } }); + onMounted(() => { + if (isElectron()) { + electronAPI().changeTheme({ + height: topMenuRef.value.getBoundingClientRect().height + }); + } + }); return (_ctx, _cache) => { const _directive_tooltip = resolveDirective("tooltip"); - return openBlock(), createBlock(Teleport, { to: teleportTarget.value }, [ - withDirectives(createBaseVNode("div", { - ref_key: "topMenuRef", - ref: topMenuRef, - class: normalizeClass(["comfyui-menu flex items-center", { dropzone: isDropZone.value, "dropzone-active": isDroppable.value }]) - }, [ - _hoisted_1, - createVNode(CommandMenubar), - createVNode(unref(script$D), { - layout: "vertical", - class: "mx-2" - }), - createBaseVNode("div", _hoisted_2, [ - workflowTabsPosition.value === "Topbar" ? (openBlock(), createBlock(WorkflowTabs, { key: 0 })) : createCommentVNode("", true) - ]), - createBaseVNode("div", { - class: "comfyui-menu-right", - ref_key: "menuRight", - ref: menuRight - }, null, 512), - createVNode(Actionbar), - createVNode(_sfc_main$5), - withDirectives(createVNode(unref(script$d), { - icon: "pi pi-bars", - severity: "secondary", - text: "", - onClick: _cache[0] || (_cache[0] = ($event) => unref(workspaceState).focusMode = true), - onContextmenu: unref(showNativeMenu) - }, null, 8, ["onContextmenu"]), [ - [_directive_tooltip, { value: _ctx.$t("menu.hideMenu"), showDelay: 300 }] + return openBlock(), createElementBlock(Fragment, null, [ + (openBlock(), createBlock(Teleport, { to: teleportTarget.value }, [ + withDirectives(createBaseVNode("div", { + ref_key: "topMenuRef", + ref: topMenuRef, + class: normalizeClass(["comfyui-menu flex items-center", { dropzone: isDropZone.value, "dropzone-active": isDroppable.value }]) + }, [ + _hoisted_1, + createVNode(CommandMenubar), + createBaseVNode("div", _hoisted_2, [ + workflowTabsPosition.value === "Topbar" ? (openBlock(), createBlock(WorkflowTabs, { key: 0 })) : createCommentVNode("", true) + ]), + createBaseVNode("div", { + class: "comfyui-menu-right", + ref_key: "menuRight", + ref: menuRight + }, null, 512), + createVNode(Actionbar), + createVNode(_sfc_main$3, { class: "flex-shrink-0" }), + withDirectives(createVNode(unref(script$d), { + class: "flex-shrink-0", + icon: "pi pi-bars", + severity: "secondary", + text: "", + "aria-label": _ctx.$t("menu.hideMenu"), + onClick: _cache[0] || (_cache[0] = ($event) => unref(workspaceState).focusMode = true), + onContextmenu: unref(showNativeMenu) + }, null, 8, ["aria-label", "onContextmenu"]), [ + [_directive_tooltip, { value: _ctx.$t("menu.hideMenu"), showDelay: 300 }] + ]), + withDirectives(createBaseVNode("div", _hoisted_3, null, 512), [ + [vShow, menuSetting.value !== "Bottom"] + ]) + ], 2), [ + [vShow, showTopMenu.value] ]) - ], 2), [ - [vShow, betaMenuEnabled.value && !unref(workspaceState).focusMode] + ], 8, ["to"])), + withDirectives(createBaseVNode("div", _hoisted_4, null, 512), [ + [vShow, isNativeWindow.value && !showTopMenu.value] ]) - ], 8, ["to"]); + ], 64); }; } }); -const TopMenubar = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-878b63b8"]]); +const TopMenubar = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-6e35440f"]]); var LatentPreviewMethod = /* @__PURE__ */ ((LatentPreviewMethod2) => { LatentPreviewMethod2["NoPreviews"] = "none"; LatentPreviewMethod2["Auto"] = "auto"; @@ -9241,6 +9373,7 @@ function useCoreCommands() { const workflowService = useWorkflowService(); const workflowStore = useWorkflowStore(); const dialogService = useDialogService(); + const colorPaletteStore = useColorPaletteStore(); const getTracker = /* @__PURE__ */ __name(() => workflowStore.activeWorkflow?.changeTracker, "getTracker"); const getSelectedNodes = /* @__PURE__ */ __name(() => { const selectedNodes = app.canvas.selected_nodes; @@ -9613,17 +9746,18 @@ function useCoreCommands() { icon: "pi pi-moon", label: "Toggle Theme (Dark/Light)", versionAdded: "1.3.12", - function: /* @__PURE__ */ (() => { - let previousDarkTheme = "dark"; - const isDarkMode = /* @__PURE__ */ __name((themeId) => themeId !== "light", "isDarkMode"); + function: (() => { + let previousDarkTheme = DEFAULT_DARK_COLOR_PALETTE.id; + let previousLightTheme = DEFAULT_LIGHT_COLOR_PALETTE.id; return () => { const settingStore = useSettingStore(); - const currentTheme = settingStore.get("Comfy.ColorPalette"); - if (isDarkMode(currentTheme)) { - previousDarkTheme = currentTheme; - settingStore.set("Comfy.ColorPalette", "light"); - } else { + const theme10 = colorPaletteStore.completedActivePalette; + if (theme10.light_theme) { + previousLightTheme = theme10.id; settingStore.set("Comfy.ColorPalette", previousDarkTheme); + } else { + previousDarkTheme = theme10.id; + settingStore.set("Comfy.ColorPalette", previousLightTheme); } }; })() @@ -9724,6 +9858,16 @@ function useCoreCommands() { function: /* @__PURE__ */ __name(() => { workflowService.duplicateWorkflow(workflowStore.activeWorkflow); }, "function") + }, + { + id: "Workspace.CloseWorkflow", + icon: "pi pi-times", + label: "Close Current Workflow", + versionAdded: "1.7.3", + function: /* @__PURE__ */ __name(() => { + if (workflowStore.activeWorkflow) + workflowService.closeWorkflow(workflowStore.activeWorkflow); + }, "function") } ]; } @@ -9766,20 +9910,45 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ const toast = useToast(); const settingStore = useSettingStore(); const executionStore = useExecutionStore(); - const theme10 = computed(() => settingStore.get("Comfy.ColorPalette")); + const colorPaletteStore = useColorPaletteStore(); + const queueStore = useQueueStore(); watch( - theme10, + () => colorPaletteStore.completedActivePalette, (newTheme) => { const DARK_THEME_CLASS = "dark-theme"; - const isDarkTheme = newTheme !== "light"; - if (isDarkTheme) { - document.body.classList.add(DARK_THEME_CLASS); - } else { + if (newTheme.light_theme) { document.body.classList.remove(DARK_THEME_CLASS); + } else { + document.body.classList.add(DARK_THEME_CLASS); + } + if (isElectron()) { + electronAPI().changeTheme({ + color: "rgba(0, 0, 0, 0)", + symbolColor: newTheme.colors.comfy_base["input-text"] + }); } }, { immediate: true } ); + if (isElectron()) { + watch( + () => queueStore.tasks, + (newTasks, oldTasks) => { + const oldRunningTaskIds = new Set( + oldTasks.filter((task) => task.isRunning).map((task) => task.promptId) + ); + newTasks.filter( + (task) => oldRunningTaskIds.has(task.promptId) && task.isHistory + ).forEach((task) => { + electronAPI().Events.incrementUserProperty( + `execution:${task.displayStatus.toLowerCase()}`, + 1 + ); + }); + }, + { deep: true } + ); + } watchEffect(() => { const fontSize = settingStore.get("Comfy.TextareaWidget.FontSize"); document.documentElement.style.setProperty( @@ -9810,9 +9979,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ } }); watchEffect(() => { - useQueueStore().maxHistoryItems = settingStore.get( - "Comfy.Queue.MaxHistoryItems" - ); + queueStore.maxHistoryItems = settingStore.get("Comfy.Queue.MaxHistoryItems"); }); const init = /* @__PURE__ */ __name(() => { const coreCommands = useCoreCommands(); @@ -9824,8 +9991,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ app.extensionManager = useWorkspaceStore(); }, "init"); const queuePendingTaskCountStore = useQueuePendingTaskCountStore(); - const onStatus = /* @__PURE__ */ __name((e) => { + const onStatus = /* @__PURE__ */ __name(async (e) => { queuePendingTaskCountStore.update(e); + await queueStore.update(); }, "onStatus"); const reconnectingMessage = { severity: "error", @@ -9861,17 +10029,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ executionStore.unbindExecutionEvents(); }); useEventListener(window, "keydown", useKeybindingService().keybindHandler); + const { wrapWithErrorHandling, wrapWithErrorHandlingAsync } = useErrorHandling(); const onGraphReady = /* @__PURE__ */ __name(() => { requestIdleCallback( () => { - useKeybindingService().registerUserKeybindings(); - useServerConfigStore().loadServerConfig( + wrapWithErrorHandling(useKeybindingService().registerUserKeybindings)(); + wrapWithErrorHandling(useServerConfigStore().loadServerConfig)( SERVER_CONFIG_ITEMS, settingStore.get("Comfy.Server.ServerConfigValues") ); - useModelStore().loadModelFolders(); + wrapWithErrorHandlingAsync(useModelStore().loadModelFolders)(); + wrapWithErrorHandlingAsync(useNodeFrequencyStore().loadNodeFrequencies)(); useNodeDefStore().nodeSearchService.endsWithFilterStartSequence(""); - useNodeFrequencyStore().loadNodeFrequencies(); }, { timeout: 1e3 } ); @@ -9879,10 +10048,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ return (_ctx, _cache) => { return openBlock(), createElementBlock(Fragment, null, [ createVNode(TopMenubar), - createVNode(_sfc_main$a, { onReady: onGraphReady }), - createVNode(_sfc_main$9), - createVNode(_sfc_main$r), - createVNode(_sfc_main$t), + createVNode(_sfc_main$8, { onReady: onGraphReady }), + createVNode(_sfc_main$7), + createVNode(_sfc_main$s), + createVNode(_sfc_main$u), createVNode(MenuHamburger) ], 64); }; @@ -9891,4 +10060,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=GraphView-HVeNbkaW.js.map +//# sourceMappingURL=GraphView-CDDCHVO0.js.map diff --git a/web/assets/GraphView-CIRWBKTm.css b/web/assets/GraphView-CqZ3opAX.css similarity index 70% rename from web/assets/GraphView-CIRWBKTm.css rename to web/assets/GraphView-CqZ3opAX.css index 59d1b3d1..f735c838 100644 --- a/web/assets/GraphView-CIRWBKTm.css +++ b/web/assets/GraphView-CqZ3opAX.css @@ -1,8 +1,10 @@ -.comfy-menu-hamburger[data-v-5661bed0] { - pointer-events: auto; - position: fixed; - z-index: 9999; +.comfy-menu-hamburger[data-v-7ed57d1a] { + pointer-events: auto; + position: fixed; + z-index: 9999; + display: flex; + flex-direction: row } [data-v-e50caa15] .p-splitter-gutter { @@ -39,14 +41,14 @@ z-index: 999; } -.p-buttongroup-vertical[data-v-cf40dd39] { +.p-buttongroup-vertical[data-v-cb8f9a1a] { display: flex; flex-direction: column; border-radius: var(--p-button-border-radius); overflow: hidden; border: 1px solid var(--p-panel-border-color); } -.p-buttongroup-vertical .p-button[data-v-cf40dd39] { +.p-buttongroup-vertical .p-button[data-v-cb8f9a1a] { margin: 0; border-radius: 0; } @@ -82,7 +84,7 @@ font-size: inherit; } -[data-v-5741c9ae] .highlight { +[data-v-fd0a74bd] .highlight { background-color: var(--p-primary-color); color: var(--p-primary-contrast-color); font-weight: bold; @@ -131,16 +133,7 @@ border-right: 4px solid var(--p-button-text-primary-color); } -:root { - --sidebar-width: 64px; - --sidebar-icon-size: 1.5rem; -} -:root .small-sidebar { - --sidebar-width: 40px; - --sidebar-icon-size: 1rem; -} - -.side-tool-bar-container[data-v-37d8d7b4] { +.side-tool-bar-container[data-v-33cac83a] { display: flex; flex-direction: column; align-items: center; @@ -153,18 +146,91 @@ background-color: var(--comfy-menu-secondary-bg); color: var(--fg-color); box-shadow: var(--bar-shadow); + + --sidebar-width: 4rem; + --sidebar-icon-size: 1.5rem; } -.side-tool-bar-end[data-v-37d8d7b4] { +.side-tool-bar-container.small-sidebar[data-v-33cac83a] { + --sidebar-width: 2.5rem; + --sidebar-icon-size: 1rem; +} +.side-tool-bar-end[data-v-33cac83a] { align-self: flex-end; margin-top: auto; } -[data-v-b9328350] .p-inputtext { +.status-indicator[data-v-8d011a31] { + position: absolute; + font-weight: 700; + font-size: 1.5rem; + top: 50%; + left: 50%; + transform: translate(-50%, -50%) +} + +[data-v-54fadc45] .p-togglebutton { + position: relative; + flex-shrink: 0; + border-radius: 0px; + border-width: 0px; + border-right-width: 1px; + border-style: solid; + background-color: transparent; + padding: 0px; + border-right-color: var(--border-color) +} +[data-v-54fadc45] .p-togglebutton::before { + display: none +} +[data-v-54fadc45] .p-togglebutton:first-child { + border-left-width: 1px; + border-style: solid; + border-left-color: var(--border-color) +} +[data-v-54fadc45] .p-togglebutton:not(:first-child) { + border-left-width: 0px +} +[data-v-54fadc45] .p-togglebutton.p-togglebutton-checked { + height: 100%; + border-bottom-width: 1px; + border-style: solid; + border-bottom-color: var(--p-button-text-primary-color) +} +[data-v-54fadc45] .p-togglebutton:not(.p-togglebutton-checked) { + opacity: 0.75 +} +[data-v-54fadc45] .p-togglebutton-checked .close-button,[data-v-54fadc45] .p-togglebutton:hover .close-button { + visibility: visible +} +[data-v-54fadc45] .p-togglebutton:hover .status-indicator { + display: none +} +[data-v-54fadc45] .p-togglebutton .close-button { + visibility: hidden +} +[data-v-54fadc45] .p-scrollpanel-content { + height: 100% +} + +/* Scrollbar half opacity to avoid blocking the active tab bottom border */ +[data-v-54fadc45] .p-scrollpanel:hover .p-scrollpanel-bar,[data-v-54fadc45] .p-scrollpanel:active .p-scrollpanel-bar { + opacity: 0.5 +} +[data-v-54fadc45] .p-selectbutton { + height: 100%; + border-radius: 0px +} + +[data-v-38831d8e] .workflow-tabs { + background-color: var(--comfy-menu-bg); +} + +[data-v-26957f1f] .p-inputtext { border-top-left-radius: 0; border-bottom-left-radius: 0; } -.comfyui-queue-button[data-v-7f4f551b] .p-splitbutton-dropdown { +.comfyui-queue-button[data-v-e9044686] .p-splitbutton-dropdown { border-top-right-radius: 0; border-bottom-right-radius: 0; } @@ -195,55 +261,23 @@ display: none; } -.top-menubar[data-v-6fecd137] .p-menubar-item-link svg { +.top-menubar[data-v-56df69d2] .p-menubar-item-link svg { display: none; } -[data-v-6fecd137] .p-menubar-submenu.dropdown-direction-up { +[data-v-56df69d2] .p-menubar-submenu.dropdown-direction-up { top: auto; bottom: 100%; flex-direction: column-reverse; } -.keybinding-tag[data-v-6fecd137] { +.keybinding-tag[data-v-56df69d2] { background: var(--p-content-hover-background); border-color: var(--p-content-border-color); border-style: solid; } -.status-indicator[data-v-8d011a31] { - position: absolute; - font-weight: 700; - font-size: 1.5rem; - top: 50%; - left: 50%; - transform: translate(-50%, -50%) -} - -[data-v-d485c044] .p-togglebutton::before { - display: none -} -[data-v-d485c044] .p-togglebutton { - position: relative; - flex-shrink: 0; - border-radius: 0px; - background-color: transparent; - padding: 0px -} -[data-v-d485c044] .p-togglebutton.p-togglebutton-checked { - border-bottom-width: 2px; - border-bottom-color: var(--p-button-text-primary-color) -} -[data-v-d485c044] .p-togglebutton-checked .close-button,[data-v-d485c044] .p-togglebutton:hover .close-button { - visibility: visible -} -[data-v-d485c044] .p-togglebutton:hover .status-indicator { - display: none -} -[data-v-d485c044] .p-togglebutton .close-button { - visibility: hidden -} - -.comfyui-menu[data-v-878b63b8] { +.comfyui-menu[data-v-6e35440f] { width: 100vw; + height: var(--comfy-topbar-height); background: var(--comfy-menu-bg); color: var(--fg-color); box-shadow: var(--bar-shadow); @@ -253,18 +287,17 @@ z-index: 1000; order: 0; grid-column: 1/-1; - max-height: 90vh; } -.comfyui-menu.dropzone[data-v-878b63b8] { +.comfyui-menu.dropzone[data-v-6e35440f] { background: var(--p-highlight-background); } -.comfyui-menu.dropzone-active[data-v-878b63b8] { +.comfyui-menu.dropzone-active[data-v-6e35440f] { background: var(--p-highlight-background-focus); } -[data-v-878b63b8] .p-menubar-item-label { +[data-v-6e35440f] .p-menubar-item-label { line-height: revert; } -.comfyui-logo[data-v-878b63b8] { +.comfyui-logo[data-v-6e35440f] { font-size: 1.2em; -webkit-user-select: none; -moz-user-select: none; diff --git a/web/assets/InstallView-CAcYt0HL.js b/web/assets/InstallView-By3hC1fC.js similarity index 94% rename from web/assets/InstallView-CAcYt0HL.js rename to web/assets/InstallView-By3hC1fC.js index 2cf9e7f1..4262b264 100644 --- a/web/assets/InstallView-CAcYt0HL.js +++ b/web/assets/InstallView-By3hC1fC.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value2) => __defProp(target, "name", { value: value2, configurable: true }); -import { B as BaseStyle, q as script$6, o as openBlock, f as createElementBlock, D as mergeProps, c1 as findIndexInList, c2 as find, aB as resolveComponent, k as createBlock, G as resolveDynamicComponent, M as withCtx, H as createBaseVNode, X as toDisplayString, J as renderSlot, I as createCommentVNode, T as normalizeClass, P as findSingle, F as Fragment, aC as Transition, i as withDirectives, v as vShow, ak as UniqueComponentId, d as defineComponent, ab as ref, c3 as useModel, N as createVNode, j as unref, c4 as script$7, bQ as script$8, bM as withModifiers, aP as script$9, a1 as useI18n, c as computed, aI as script$a, aE as createTextVNode, c0 as electronAPI, m as onMounted, r as resolveDirective, av as script$b, c5 as script$c, c6 as script$d, l as script$e, bZ as script$f, c7 as MigrationItems, w as watchEffect, E as renderList, c8 as script$g, bW as useRouter, aL as pushScopeId, aM as popScopeId, aU as toRaw, _ as _export_sfc } from "./index-DjNHn37O.js"; -import { _ as _sfc_main$5 } from "./BaseViewTemplate-BNGF4K22.js"; +import { B as BaseStyle, y as script$6, o as openBlock, f as createElementBlock, G as mergeProps, c9 as findIndexInList, ca as find, aD as resolveComponent, J as createBlock, K as resolveDynamicComponent, P as withCtx, m as createBaseVNode, Z as toDisplayString, M as renderSlot, L as createCommentVNode, V as normalizeClass, R as findSingle, H as Fragment, aE as Transition, i as withDirectives, v as vShow, am as UniqueComponentId, d as defineComponent, ad as ref, cb as useModel, k as createVNode, j as unref, cc as script$7, c4 as script$8, b3 as withModifiers, aP as script$9, a3 as useI18n, c as computed, aK as script$a, aG as createTextVNode, p as pushScopeId, q as popScopeId, bV as electronAPI, _ as _export_sfc, t as onMounted, r as resolveDirective, ax as script$b, cd as script$c, ce as script$d, l as script$e, c6 as script$f, cf as MigrationItems, w as watchEffect, I as renderList, cg as script$g, c2 as useRouter, aU as toRaw } from "./index-QvfM__ze.js"; +import { _ as _sfc_main$5 } from "./BaseViewTemplate-BhQMaVFP.js"; var classes$4 = { root: /* @__PURE__ */ __name(function root(_ref) { var instance = _ref.instance; @@ -548,6 +548,12 @@ const _hoisted_15$2 = { class: "font-medium mb-2" }; const _hoisted_16$2 = { class: "list-disc pl-6 space-y-1" }; const _hoisted_17$2 = { class: "font-medium mt-4 mb-2" }; const _hoisted_18$2 = { class: "list-disc pl-6 space-y-1" }; +const _hoisted_19 = { class: "mt-4" }; +const _hoisted_20 = { + href: "https://comfy.org/privacy", + target: "_blank", + class: "text-blue-400 hover:text-blue-300 underline" +}; const _sfc_main$4 = /* @__PURE__ */ defineComponent({ __name: "DesktopSettingsConfiguration", props: { @@ -608,17 +614,29 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({ createBaseVNode("div", _hoisted_14$2, [ createBaseVNode("h4", _hoisted_15$2, toDisplayString(_ctx.$t("install.settings.dataCollectionDialog.whatWeCollect")), 1), createBaseVNode("ul", _hoisted_16$2, [ - createBaseVNode("li", null, toDisplayString(_ctx.$t("install.settings.dataCollectionDialog.errorReports")), 1), - createBaseVNode("li", null, toDisplayString(_ctx.$t("install.settings.dataCollectionDialog.systemInfo")), 1) + createBaseVNode("li", null, toDisplayString(_ctx.$t("install.settings.dataCollectionDialog.collect.errorReports")), 1), + createBaseVNode("li", null, toDisplayString(_ctx.$t("install.settings.dataCollectionDialog.collect.systemInfo")), 1), + createBaseVNode("li", null, toDisplayString(_ctx.$t( + "install.settings.dataCollectionDialog.collect.userJourneyEvents" + )), 1) ]), createBaseVNode("h4", _hoisted_17$2, toDisplayString(_ctx.$t("install.settings.dataCollectionDialog.whatWeDoNotCollect")), 1), createBaseVNode("ul", _hoisted_18$2, [ - createBaseVNode("li", null, toDisplayString(_ctx.$t("install.settings.dataCollectionDialog.personalInformation")), 1), - createBaseVNode("li", null, toDisplayString(_ctx.$t("install.settings.dataCollectionDialog.workflowContents")), 1), - createBaseVNode("li", null, toDisplayString(_ctx.$t("install.settings.dataCollectionDialog.fileSystemInformation")), 1), createBaseVNode("li", null, toDisplayString(_ctx.$t( - "install.settings.dataCollectionDialog.customNodeConfigurations" + "install.settings.dataCollectionDialog.doNotCollect.personalInformation" + )), 1), + createBaseVNode("li", null, toDisplayString(_ctx.$t( + "install.settings.dataCollectionDialog.doNotCollect.workflowContents" + )), 1), + createBaseVNode("li", null, toDisplayString(_ctx.$t( + "install.settings.dataCollectionDialog.doNotCollect.fileSystemInformation" + )), 1), + createBaseVNode("li", null, toDisplayString(_ctx.$t( + "install.settings.dataCollectionDialog.doNotCollect.customNodeConfigurations" )), 1) + ]), + createBaseVNode("div", _hoisted_19, [ + createBaseVNode("a", _hoisted_20, toDisplayString(_ctx.$t("install.settings.dataCollectionDialog.viewFullPolicy")), 1) ]) ]) ]), @@ -631,36 +649,37 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({ const _imports_0 = "" + new URL("images/nvidia-logo.svg", import.meta.url).href; const _imports_1 = "" + new URL("images/apple-mps-logo.png", import.meta.url).href; const _imports_2 = "" + new URL("images/manual-configuration.svg", import.meta.url).href; +const _withScopeId$1 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-79125ff6"), n = n(), popScopeId(), n), "_withScopeId$1"); const _hoisted_1$3 = { class: "flex flex-col gap-6 w-[600px] h-[30rem] select-none" }; const _hoisted_2$3 = { class: "grow flex flex-col gap-4 text-neutral-300" }; const _hoisted_3$3 = { class: "text-2xl font-semibold text-neutral-100" }; const _hoisted_4$3 = { class: "m-1 text-neutral-400" }; -const _hoisted_5$2 = /* @__PURE__ */ createBaseVNode("img", { +const _hoisted_5$2 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ createBaseVNode("img", { class: "m-12", alt: "NVIDIA logo", width: "196", height: "32", src: _imports_0 -}, null, -1); +}, null, -1)); const _hoisted_6$2 = [ _hoisted_5$2 ]; -const _hoisted_7$2 = /* @__PURE__ */ createBaseVNode("img", { +const _hoisted_7$2 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ createBaseVNode("img", { class: "rounded-lg hover-brighten", alt: "Apple Metal Performance Shaders Logo", width: "292", ratio: "", src: _imports_1 -}, null, -1); +}, null, -1)); const _hoisted_8$2 = [ _hoisted_7$2 ]; -const _hoisted_9$2 = /* @__PURE__ */ createBaseVNode("img", { +const _hoisted_9$2 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ createBaseVNode("img", { class: "m-12", alt: "Manual configuration", width: "196", src: _imports_2 -}, null, -1); +}, null, -1)); const _hoisted_10$2 = [ _hoisted_9$2 ]; @@ -797,6 +816,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({ }; } }); +const GpuPicker = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-79125ff6"]]); const _hoisted_1$2 = { class: "flex flex-col gap-6 w-[600px]" }; const _hoisted_2$2 = { class: "flex flex-col gap-4" }; const _hoisted_3$2 = { class: "text-2xl font-semibold text-neutral-100" }; @@ -1082,7 +1102,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({ }; } }); -const _withScopeId = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-de33872d"), n = n(), popScopeId(), n), "_withScopeId"); +const _withScopeId = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-0a97b0ae"), n = n(), popScopeId(), n), "_withScopeId"); const _hoisted_1 = { class: "flex pt-6 justify-end" }; const _hoisted_2 = { class: "flex pt-6 justify-between" }; const _hoisted_3 = { class: "flex pt-6 justify-between" }; @@ -1098,6 +1118,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ const autoUpdate = ref(true); const allowMetrics = ref(true); const highestStep = ref(0); + const handleStepChange = /* @__PURE__ */ __name((value2) => { + setHighestStep(value2); + electronAPI().Events.trackEvent("install_stepper_change", { + step: value2 + }); + }, "handleStepChange"); const setHighestStep = /* @__PURE__ */ __name((value2) => { const int = typeof value2 === "number" ? value2 : parseInt(value2, 10); if (!isNaN(int) && int > highestStep.value) highestStep.value = int; @@ -1122,8 +1148,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ onMounted(async () => { if (!electron) return; const detectedGpu = await electron.Config.getDetectedGpu(); - if (detectedGpu === "mps" || detectedGpu === "nvidia") + if (detectedGpu === "mps" || detectedGpu === "nvidia") { device.value = detectedGpu; + } + electronAPI().Events.trackEvent("install_stepper_change", { + step: "0", + gpu: detectedGpu + }); }); return (_ctx, _cache) => { return openBlock(), createBlock(_sfc_main$5, { dark: "" }, { @@ -1131,7 +1162,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ createVNode(unref(script), { class: "h-full p-8 2xl:p-16", value: "0", - "onUpdate:value": setHighestStep + "onUpdate:value": handleStepChange }, { default: withCtx(() => [ createVNode(unref(script$4), { class: "select-none" }, { @@ -1176,7 +1207,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ default: withCtx(() => [ createVNode(unref(script$3), { value: "0" }, { default: withCtx(({ activateCallback }) => [ - createVNode(_sfc_main$3, { + createVNode(GpuPicker, { device: device.value, "onUpdate:device": _cache[0] || (_cache[0] = ($event) => device.value = $event) }, null, 8, ["device"]), @@ -1281,8 +1312,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ }; } }); -const InstallView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-de33872d"]]); +const InstallView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-0a97b0ae"]]); export { InstallView as default }; -//# sourceMappingURL=InstallView-CAcYt0HL.js.map +//# sourceMappingURL=InstallView-By3hC1fC.js.map diff --git a/web/assets/InstallView-CwQdoH-C.css b/web/assets/InstallView-CxhfFC8Y.css similarity index 70% rename from web/assets/InstallView-CwQdoH-C.css rename to web/assets/InstallView-CxhfFC8Y.css index df578778..a406c869 100644 --- a/web/assets/InstallView-CwQdoH-C.css +++ b/web/assets/InstallView-CxhfFC8Y.css @@ -1,18 +1,18 @@ -:root { +.p-tag[data-v-79125ff6] { --p-tag-gap: 0.5rem; } -.hover-brighten { +.hover-brighten[data-v-79125ff6] { transition-property: color, background-color, border-color, text-decoration-color, fill, stroke; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; transition-property: filter, box-shadow; -&:hover { +&[data-v-79125ff6]:hover { filter: brightness(107%) contrast(105%); box-shadow: 0 0 0.25rem #ffffff79; } } -.p-accordioncontent-content { +.p-accordioncontent-content[data-v-79125ff6] { border-radius: 0.5rem; --tw-bg-opacity: 1; background-color: rgb(23 23 23 / var(--tw-bg-opacity)); @@ -20,15 +20,15 @@ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; } -div.selected { -.gpu-button:not(.selected) { +div.selected[data-v-79125ff6] { +.gpu-button[data-v-79125ff6]:not(.selected) { opacity: 0.5; } -.gpu-button:not(.selected):hover { +.gpu-button[data-v-79125ff6]:not(.selected):hover { opacity: 1; } } -.gpu-button { +.gpu-button[data-v-79125ff6] { margin: 0px; display: flex; width: 50%; @@ -43,37 +43,37 @@ div.selected { transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; } -.gpu-button:hover { +.gpu-button[data-v-79125ff6]:hover { --tw-bg-opacity: 0.75; } -.gpu-button { -&.selected { +.gpu-button[data-v-79125ff6] { +&.selected[data-v-79125ff6] { --tw-bg-opacity: 1; background-color: rgb(64 64 64 / var(--tw-bg-opacity)); } -&.selected { +&.selected[data-v-79125ff6] { --tw-bg-opacity: 0.5; } -&.selected { +&.selected[data-v-79125ff6] { opacity: 1; } -&.selected:hover { +&.selected[data-v-79125ff6]:hover { --tw-bg-opacity: 0.6; } } -.disabled { +.disabled[data-v-79125ff6] { pointer-events: none; opacity: 0.4; } -.p-card-header { +.p-card-header[data-v-79125ff6] { flex-grow: 1; text-align: center; } -.p-card-body { +.p-card-body[data-v-79125ff6] { padding-top: 0px; text-align: center; } -[data-v-de33872d] .p-steppanel { +[data-v-0a97b0ae] .p-steppanel { background-color: transparent } diff --git a/web/assets/KeybindingPanel-Dc3C4lG1.js b/web/assets/KeybindingPanel-D6O16W_1.js similarity index 92% rename from web/assets/KeybindingPanel-Dc3C4lG1.js rename to web/assets/KeybindingPanel-D6O16W_1.js index 6cf204dd..b0fbfd84 100644 --- a/web/assets/KeybindingPanel-Dc3C4lG1.js +++ b/web/assets/KeybindingPanel-D6O16W_1.js @@ -1,10 +1,9 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, c as computed, o as openBlock, f as createElementBlock, F as Fragment, E as renderList, N as createVNode, M as withCtx, aE as createTextVNode, X as toDisplayString, j as unref, aI as script, I as createCommentVNode, ab as ref, cn as FilterMatchMode, a$ as useKeybindingStore, a2 as useCommandStore, a1 as useI18n, af as normalizeI18nKey, w as watchEffect, bs as useToast, r as resolveDirective, k as createBlock, co as SearchBox, H as createBaseVNode, l as script$2, av as script$4, bM as withModifiers, bZ as script$5, aP as script$6, i as withDirectives, cp as _sfc_main$2, aL as pushScopeId, aM as popScopeId, cq as KeyComboImpl, cr as KeybindingImpl, _ as _export_sfc } from "./index-DjNHn37O.js"; -import { s as script$1, a as script$3 } from "./index-B5F0uxTQ.js"; -import { u as useKeybindingService } from "./keybindingService-Bx7YdkXn.js"; -import "./index-B-aVupP5.js"; -import "./index-5HFeZax4.js"; +import { d as defineComponent, c as computed, o as openBlock, f as createElementBlock, H as Fragment, I as renderList, k as createVNode, P as withCtx, aG as createTextVNode, Z as toDisplayString, j as unref, aK as script, L as createCommentVNode, ad as ref, cu as FilterMatchMode, a$ as useKeybindingStore, a4 as useCommandStore, a3 as useI18n, ah as normalizeI18nKey, w as watchEffect, bz as useToast, r as resolveDirective, J as createBlock, cv as SearchBox, m as createBaseVNode, l as script$2, ax as script$4, b3 as withModifiers, c6 as script$5, aP as script$6, i as withDirectives, cw as _sfc_main$2, p as pushScopeId, q as popScopeId, cx as KeyComboImpl, cy as KeybindingImpl, _ as _export_sfc } from "./index-QvfM__ze.js"; +import { s as script$1, a as script$3 } from "./index-DpF-ptbJ.js"; +import { u as useKeybindingService } from "./keybindingService-Cak1En5n.js"; +import "./index-Q1cQr26V.js"; const _hoisted_1$1 = { key: 0, class: "px-2" @@ -281,4 +280,4 @@ const KeybindingPanel = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "d export { KeybindingPanel as default }; -//# sourceMappingURL=KeybindingPanel-Dc3C4lG1.js.map +//# sourceMappingURL=KeybindingPanel-D6O16W_1.js.map diff --git a/web/assets/ManualConfigurationView-B6ecEClB.css b/web/assets/ManualConfigurationView-CsirlNfV.css similarity index 59% rename from web/assets/ManualConfigurationView-B6ecEClB.css rename to web/assets/ManualConfigurationView-CsirlNfV.css index 06a5cc3e..dba81a0b 100644 --- a/web/assets/ManualConfigurationView-B6ecEClB.css +++ b/web/assets/ManualConfigurationView-CsirlNfV.css @@ -1,7 +1,7 @@ -:root { +.p-tag[data-v-dc169863] { --p-tag-gap: 0.5rem; } -.comfy-installer { +.comfy-installer[data-v-dc169863] { margin-top: max(1rem, max(0px, calc((100vh - 42rem) * 0.5))); } diff --git a/web/assets/ManualConfigurationView-Bi_qHE-n.js b/web/assets/ManualConfigurationView-enyqGo0M.js similarity index 81% rename from web/assets/ManualConfigurationView-Bi_qHE-n.js rename to web/assets/ManualConfigurationView-enyqGo0M.js index 233f20fa..43131f52 100644 --- a/web/assets/ManualConfigurationView-Bi_qHE-n.js +++ b/web/assets/ManualConfigurationView-enyqGo0M.js @@ -1,9 +1,8 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, a1 as useI18n, ab as ref, m as onMounted, o as openBlock, k as createBlock, M as withCtx, H as createBaseVNode, X as toDisplayString, N as createVNode, j as unref, aI as script, l as script$2, c0 as electronAPI } from "./index-DjNHn37O.js"; -import { s as script$1 } from "./index-jXPKy3pP.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-BNGF4K22.js"; -import "./index-5HFeZax4.js"; +import { d as defineComponent, a3 as useI18n, ad as ref, t as onMounted, o as openBlock, J as createBlock, P as withCtx, m as createBaseVNode, Z as toDisplayString, k as createVNode, j as unref, aK as script, bN as script$1, l as script$2, p as pushScopeId, q as popScopeId, bV as electronAPI, _ as _export_sfc } from "./index-QvfM__ze.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-BhQMaVFP.js"; +const _withScopeId = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-dc169863"), n = n(), popScopeId(), n), "_withScopeId"); const _hoisted_1 = { class: "comfy-installer grow flex flex-col gap-4 text-neutral-300 max-w-110" }; const _hoisted_2 = { class: "text-2xl font-semibold text-neutral-100" }; const _hoisted_3 = { class: "m-1 text-neutral-300" }; @@ -69,7 +68,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ }; } }); +const ManualConfigurationView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-dc169863"]]); export { - _sfc_main as default + ManualConfigurationView as default }; -//# sourceMappingURL=ManualConfigurationView-Bi_qHE-n.js.map +//# sourceMappingURL=ManualConfigurationView-enyqGo0M.js.map diff --git a/web/assets/MetricsConsentView-lSfLu4nr.js b/web/assets/MetricsConsentView-lSfLu4nr.js new file mode 100644 index 00000000..a53fdbb9 --- /dev/null +++ b/web/assets/MetricsConsentView-lSfLu4nr.js @@ -0,0 +1,86 @@ +var __defProp = Object.defineProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +import { _ as _sfc_main$1 } from "./BaseViewTemplate-BhQMaVFP.js"; +import { d as defineComponent, bz as useToast, a3 as useI18n, ad as ref, c2 as useRouter, o as openBlock, J as createBlock, P as withCtx, m as createBaseVNode, Z as toDisplayString, aG as createTextVNode, k as createVNode, j as unref, cc as script, l as script$1, bV as electronAPI } from "./index-QvfM__ze.js"; +const _hoisted_1 = { class: "h-full p-8 2xl:p-16 flex flex-col items-center justify-center" }; +const _hoisted_2 = { class: "bg-neutral-800 rounded-lg shadow-lg p-6 w-full max-w-[600px] flex flex-col gap-6" }; +const _hoisted_3 = { class: "text-3xl font-semibold text-neutral-100" }; +const _hoisted_4 = { class: "text-neutral-400" }; +const _hoisted_5 = { class: "text-neutral-400" }; +const _hoisted_6 = { + href: "https://comfy.org/privacy", + target: "_blank", + class: "text-blue-400 hover:text-blue-300 underline" +}; +const _hoisted_7 = { class: "flex items-center gap-4" }; +const _hoisted_8 = { + id: "metricsDescription", + class: "text-neutral-100" +}; +const _hoisted_9 = { class: "flex pt-6 justify-end" }; +const _sfc_main = /* @__PURE__ */ defineComponent({ + __name: "MetricsConsentView", + setup(__props) { + const toast = useToast(); + const { t } = useI18n(); + const allowMetrics = ref(true); + const router = useRouter(); + const isUpdating = ref(false); + const updateConsent = /* @__PURE__ */ __name(async () => { + isUpdating.value = true; + try { + await electronAPI().setMetricsConsent(allowMetrics.value); + } catch (error) { + toast.add({ + severity: "error", + summary: t("install.errorUpdatingConsent"), + detail: t("install.errorUpdatingConsentDetail"), + life: 3e3 + }); + } finally { + isUpdating.value = false; + } + router.push("/"); + }, "updateConsent"); + return (_ctx, _cache) => { + const _component_BaseViewTemplate = _sfc_main$1; + return openBlock(), createBlock(_component_BaseViewTemplate, { dark: "" }, { + default: withCtx(() => [ + createBaseVNode("div", _hoisted_1, [ + createBaseVNode("div", _hoisted_2, [ + createBaseVNode("h2", _hoisted_3, toDisplayString(_ctx.$t("install.helpImprove")), 1), + createBaseVNode("p", _hoisted_4, toDisplayString(_ctx.$t("install.updateConsent")), 1), + createBaseVNode("p", _hoisted_5, [ + createTextVNode(toDisplayString(_ctx.$t("install.moreInfo")) + " ", 1), + createBaseVNode("a", _hoisted_6, toDisplayString(_ctx.$t("install.privacyPolicy")), 1), + createTextVNode(". ") + ]), + createBaseVNode("div", _hoisted_7, [ + createVNode(unref(script), { + modelValue: allowMetrics.value, + "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => allowMetrics.value = $event), + "aria-describedby": "metricsDescription" + }, null, 8, ["modelValue"]), + createBaseVNode("span", _hoisted_8, toDisplayString(allowMetrics.value ? _ctx.$t("install.metricsEnabled") : _ctx.$t("install.metricsDisabled")), 1) + ]), + createBaseVNode("div", _hoisted_9, [ + createVNode(unref(script$1), { + label: _ctx.$t("g.ok"), + icon: "pi pi-check", + loading: isUpdating.value, + iconPos: "right", + onClick: updateConsent + }, null, 8, ["label", "loading"]) + ]) + ]) + ]) + ]), + _: 1 + }); + }; + } +}); +export { + _sfc_main as default +}; +//# sourceMappingURL=MetricsConsentView-lSfLu4nr.js.map diff --git a/web/assets/NotSupportedView-bFzHmqNj.css b/web/assets/NotSupportedView-DQerxQzi.css similarity index 63% rename from web/assets/NotSupportedView-bFzHmqNj.css rename to web/assets/NotSupportedView-DQerxQzi.css index 80ac3298..3b90d279 100644 --- a/web/assets/NotSupportedView-bFzHmqNj.css +++ b/web/assets/NotSupportedView-DQerxQzi.css @@ -1,17 +1,17 @@ -.sad-container { +.sad-container[data-v-ebb20958] { display: grid; align-items: center; justify-content: space-evenly; grid-template-columns: 25rem 1fr; -& > * { +&[data-v-ebb20958] > * { grid-row: 1; } } -.sad-text { +.sad-text[data-v-ebb20958] { grid-column: 1/3; } -.sad-girl { +.sad-girl[data-v-ebb20958] { grid-column: 2/3; width: min(75vw, 100vh); } diff --git a/web/assets/NotSupportedView-Drz3x2d-.js b/web/assets/NotSupportedView-Vc8_xWgH.js similarity index 81% rename from web/assets/NotSupportedView-Drz3x2d-.js rename to web/assets/NotSupportedView-Vc8_xWgH.js index a24af84a..ebc712a4 100644 --- a/web/assets/NotSupportedView-Drz3x2d-.js +++ b/web/assets/NotSupportedView-Vc8_xWgH.js @@ -1,14 +1,15 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, bW as useRouter, r as resolveDirective, o as openBlock, k as createBlock, M as withCtx, H as createBaseVNode, X as toDisplayString, N as createVNode, j as unref, l as script, i as withDirectives } from "./index-DjNHn37O.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-BNGF4K22.js"; +import { d as defineComponent, c2 as useRouter, r as resolveDirective, o as openBlock, J as createBlock, P as withCtx, m as createBaseVNode, Z as toDisplayString, k as createVNode, j as unref, l as script, i as withDirectives, p as pushScopeId, q as popScopeId, _ as _export_sfc } from "./index-QvfM__ze.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-BhQMaVFP.js"; const _imports_0 = "" + new URL("images/sad_girl.png", import.meta.url).href; +const _withScopeId = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-ebb20958"), n = n(), popScopeId(), n), "_withScopeId"); const _hoisted_1 = { class: "sad-container" }; -const _hoisted_2 = /* @__PURE__ */ createBaseVNode("img", { +const _hoisted_2 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createBaseVNode("img", { class: "sad-girl", src: _imports_0, alt: "Sad girl illustration" -}, null, -1); +}, null, -1)); const _hoisted_3 = { class: "no-drag sad-text flex items-center" }; const _hoisted_4 = { class: "flex flex-col gap-8 p-8 min-w-110" }; const _hoisted_5 = { class: "text-4xl font-bold text-red-500" }; @@ -80,7 +81,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ }; } }); +const NotSupportedView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-ebb20958"]]); export { - _sfc_main as default + NotSupportedView as default }; -//# sourceMappingURL=NotSupportedView-Drz3x2d-.js.map +//# sourceMappingURL=NotSupportedView-Vc8_xWgH.js.map diff --git a/web/assets/ServerConfigPanel-Be4StJmv.js b/web/assets/ServerConfigPanel-B-w0HFlz.js similarity index 91% rename from web/assets/ServerConfigPanel-Be4StJmv.js rename to web/assets/ServerConfigPanel-B-w0HFlz.js index e84d2d43..d00cf672 100644 --- a/web/assets/ServerConfigPanel-Be4StJmv.js +++ b/web/assets/ServerConfigPanel-B-w0HFlz.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { H as createBaseVNode, o as openBlock, f as createElementBlock, Z as markRaw, d as defineComponent, a as useSettingStore, aS as storeToRefs, a5 as watch, cO as useCopyToClipboard, a1 as useI18n, k as createBlock, M as withCtx, j as unref, bZ as script, X as toDisplayString, E as renderList, F as Fragment, N as createVNode, l as script$1, I as createCommentVNode, bQ as script$2, cP as FormItem, cp as _sfc_main$1, c0 as electronAPI } from "./index-DjNHn37O.js"; -import { u as useServerConfigStore } from "./serverConfigStore-CvyKFVuP.js"; +import { m as createBaseVNode, o as openBlock, f as createElementBlock, a0 as markRaw, d as defineComponent, a as useSettingStore, aS as storeToRefs, a7 as watch, cW as useCopyToClipboard, a3 as useI18n, J as createBlock, P as withCtx, j as unref, c6 as script, Z as toDisplayString, I as renderList, H as Fragment, k as createVNode, l as script$1, L as createCommentVNode, c4 as script$2, cX as FormItem, cw as _sfc_main$1, bV as electronAPI } from "./index-QvfM__ze.js"; +import { u as useServerConfigStore } from "./serverConfigStore-DCme3xlV.js"; const _hoisted_1$1 = { viewBox: "0 0 24 24", width: "1.2em", @@ -155,4 +155,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=ServerConfigPanel-Be4StJmv.js.map +//# sourceMappingURL=ServerConfigPanel-B-w0HFlz.js.map diff --git a/web/assets/ServerStartView-48wfE1MS.js b/web/assets/ServerStartView-48wfE1MS.js new file mode 100644 index 00000000..4b74f5ad --- /dev/null +++ b/web/assets/ServerStartView-48wfE1MS.js @@ -0,0 +1,101 @@ +var __defProp = Object.defineProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +import { d as defineComponent, a3 as useI18n, ad as ref, c7 as ProgressStatus, t as onMounted, o as openBlock, J as createBlock, P as withCtx, m as createBaseVNode, aG as createTextVNode, Z as toDisplayString, j as unref, f as createElementBlock, L as createCommentVNode, k as createVNode, l as script, i as withDirectives, v as vShow, c8 as BaseTerminal, p as pushScopeId, q as popScopeId, bV as electronAPI, _ as _export_sfc } from "./index-QvfM__ze.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-BhQMaVFP.js"; +const _withScopeId = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-4140d62b"), n = n(), popScopeId(), n), "_withScopeId"); +const _hoisted_1 = { class: "flex flex-col w-full h-full items-center" }; +const _hoisted_2 = { class: "text-2xl font-bold" }; +const _hoisted_3 = { key: 0 }; +const _hoisted_4 = { + key: 0, + class: "flex flex-col items-center gap-4" +}; +const _hoisted_5 = { class: "flex items-center my-4 gap-2" }; +const _sfc_main = /* @__PURE__ */ defineComponent({ + __name: "ServerStartView", + setup(__props) { + const electron = electronAPI(); + const { t } = useI18n(); + const status = ref(ProgressStatus.INITIAL_STATE); + const electronVersion = ref(""); + let xterm; + const terminalVisible = ref(true); + const updateProgress = /* @__PURE__ */ __name(({ status: newStatus }) => { + status.value = newStatus; + if (newStatus === ProgressStatus.ERROR) terminalVisible.value = false; + else xterm?.clear(); + }, "updateProgress"); + const terminalCreated = /* @__PURE__ */ __name(({ terminal, useAutoSize }, root) => { + xterm = terminal; + useAutoSize({ root, autoRows: true, autoCols: true }); + electron.onLogMessage((message) => { + terminal.write(message); + }); + terminal.options.cursorBlink = false; + terminal.options.disableStdin = true; + terminal.options.cursorInactiveStyle = "block"; + }, "terminalCreated"); + const reinstall = /* @__PURE__ */ __name(() => electron.reinstall(), "reinstall"); + const reportIssue = /* @__PURE__ */ __name(() => { + window.open("https://forum.comfy.org/c/v1-feedback/", "_blank"); + }, "reportIssue"); + const openLogs = /* @__PURE__ */ __name(() => electron.openLogsFolder(), "openLogs"); + onMounted(async () => { + electron.sendReady(); + electron.onProgressUpdate(updateProgress); + electronVersion.value = await electron.getElectronVersion(); + }); + return (_ctx, _cache) => { + return openBlock(), createBlock(_sfc_main$1, { + dark: "", + class: "flex-col" + }, { + default: withCtx(() => [ + createBaseVNode("div", _hoisted_1, [ + createBaseVNode("h2", _hoisted_2, [ + createTextVNode(toDisplayString(unref(t)(`serverStart.process.${status.value}`)) + " ", 1), + status.value === unref(ProgressStatus).ERROR ? (openBlock(), createElementBlock("span", _hoisted_3, " v" + toDisplayString(electronVersion.value), 1)) : createCommentVNode("", true) + ]), + status.value === unref(ProgressStatus).ERROR ? (openBlock(), createElementBlock("div", _hoisted_4, [ + createBaseVNode("div", _hoisted_5, [ + createVNode(unref(script), { + icon: "pi pi-flag", + severity: "secondary", + label: unref(t)("serverStart.reportIssue"), + onClick: reportIssue + }, null, 8, ["label"]), + createVNode(unref(script), { + icon: "pi pi-file", + severity: "secondary", + label: unref(t)("serverStart.openLogs"), + onClick: openLogs + }, null, 8, ["label"]), + createVNode(unref(script), { + icon: "pi pi-refresh", + label: unref(t)("serverStart.reinstall"), + onClick: reinstall + }, null, 8, ["label"]) + ]), + !terminalVisible.value ? (openBlock(), createBlock(unref(script), { + key: 0, + icon: "pi pi-search", + severity: "secondary", + label: unref(t)("serverStart.showTerminal"), + onClick: _cache[0] || (_cache[0] = ($event) => terminalVisible.value = true) + }, null, 8, ["label"])) : createCommentVNode("", true) + ])) : createCommentVNode("", true), + withDirectives(createVNode(BaseTerminal, { onCreated: terminalCreated }, null, 512), [ + [vShow, terminalVisible.value] + ]) + ]) + ]), + _: 1 + }); + }; + } +}); +const ServerStartView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-4140d62b"]]); +export { + ServerStartView as default +}; +//# sourceMappingURL=ServerStartView-48wfE1MS.js.map diff --git a/web/assets/ServerStartView-CIDTUh4x.js b/web/assets/ServerStartView-CIDTUh4x.js deleted file mode 100644 index 6567eea2..00000000 --- a/web/assets/ServerStartView-CIDTUh4x.js +++ /dev/null @@ -1,98 +0,0 @@ -var __defProp = Object.defineProperty; -var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, a1 as useI18n, ab as ref, b_ as ProgressStatus, m as onMounted, o as openBlock, k as createBlock, M as withCtx, H as createBaseVNode, aE as createTextVNode, X as toDisplayString, j as unref, f as createElementBlock, I as createCommentVNode, N as createVNode, l as script, i as withDirectives, v as vShow, b$ as BaseTerminal, aL as pushScopeId, aM as popScopeId, c0 as electronAPI, _ as _export_sfc } from "./index-DjNHn37O.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-BNGF4K22.js"; -const _withScopeId = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-42c1131d"), n = n(), popScopeId(), n), "_withScopeId"); -const _hoisted_1 = { class: "text-2xl font-bold" }; -const _hoisted_2 = { key: 0 }; -const _hoisted_3 = { - key: 0, - class: "flex flex-col items-center gap-4" -}; -const _hoisted_4 = { class: "flex items-center my-4 gap-2" }; -const _sfc_main = /* @__PURE__ */ defineComponent({ - __name: "ServerStartView", - setup(__props) { - const electron = electronAPI(); - const { t } = useI18n(); - const status = ref(ProgressStatus.INITIAL_STATE); - const electronVersion = ref(""); - let xterm; - const terminalVisible = ref(true); - const updateProgress = /* @__PURE__ */ __name(({ status: newStatus }) => { - status.value = newStatus; - if (newStatus === ProgressStatus.ERROR) terminalVisible.value = false; - else xterm?.clear(); - }, "updateProgress"); - const terminalCreated = /* @__PURE__ */ __name(({ terminal, useAutoSize }, root) => { - xterm = terminal; - useAutoSize(root, true, true); - electron.onLogMessage((message) => { - terminal.write(message); - }); - terminal.options.cursorBlink = false; - terminal.options.disableStdin = true; - terminal.options.cursorInactiveStyle = "block"; - }, "terminalCreated"); - const reinstall = /* @__PURE__ */ __name(() => electron.reinstall(), "reinstall"); - const reportIssue = /* @__PURE__ */ __name(() => { - window.open("https://forum.comfy.org/c/v1-feedback/", "_blank"); - }, "reportIssue"); - const openLogs = /* @__PURE__ */ __name(() => electron.openLogsFolder(), "openLogs"); - onMounted(async () => { - electron.sendReady(); - electron.onProgressUpdate(updateProgress); - electronVersion.value = await electron.getElectronVersion(); - }); - return (_ctx, _cache) => { - return openBlock(), createBlock(_sfc_main$1, { - dark: "", - class: "flex-col" - }, { - default: withCtx(() => [ - createBaseVNode("h2", _hoisted_1, [ - createTextVNode(toDisplayString(unref(t)(`serverStart.process.${status.value}`)) + " ", 1), - status.value === unref(ProgressStatus).ERROR ? (openBlock(), createElementBlock("span", _hoisted_2, " v" + toDisplayString(electronVersion.value), 1)) : createCommentVNode("", true) - ]), - status.value === unref(ProgressStatus).ERROR ? (openBlock(), createElementBlock("div", _hoisted_3, [ - createBaseVNode("div", _hoisted_4, [ - createVNode(unref(script), { - icon: "pi pi-flag", - severity: "secondary", - label: unref(t)("serverStart.reportIssue"), - onClick: reportIssue - }, null, 8, ["label"]), - createVNode(unref(script), { - icon: "pi pi-file", - severity: "secondary", - label: unref(t)("serverStart.openLogs"), - onClick: openLogs - }, null, 8, ["label"]), - createVNode(unref(script), { - icon: "pi pi-refresh", - label: unref(t)("serverStart.reinstall"), - onClick: reinstall - }, null, 8, ["label"]) - ]), - !terminalVisible.value ? (openBlock(), createBlock(unref(script), { - key: 0, - icon: "pi pi-search", - severity: "secondary", - label: unref(t)("serverStart.showTerminal"), - onClick: _cache[0] || (_cache[0] = ($event) => terminalVisible.value = true) - }, null, 8, ["label"])) : createCommentVNode("", true) - ])) : createCommentVNode("", true), - withDirectives(createVNode(BaseTerminal, { onCreated: terminalCreated }, null, 512), [ - [vShow, terminalVisible.value] - ]) - ]), - _: 1 - }); - }; - } -}); -const ServerStartView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-42c1131d"]]); -export { - ServerStartView as default -}; -//# sourceMappingURL=ServerStartView-CIDTUh4x.js.map diff --git a/web/assets/ServerStartView-CnyN4Ib6.css b/web/assets/ServerStartView-CJiwVDQY.css similarity index 64% rename from web/assets/ServerStartView-CnyN4Ib6.css rename to web/assets/ServerStartView-CJiwVDQY.css index 60a63414..7d53a927 100644 --- a/web/assets/ServerStartView-CnyN4Ib6.css +++ b/web/assets/ServerStartView-CJiwVDQY.css @@ -1,5 +1,5 @@ -[data-v-42c1131d] .xterm-helper-textarea { +[data-v-4140d62b] .xterm-helper-textarea { /* Hide this as it moves all over when uv is running */ display: none; } diff --git a/web/assets/UserSelectView-B3jYchWu.js b/web/assets/UserSelectView-CXmVKOeK.js similarity index 89% rename from web/assets/UserSelectView-B3jYchWu.js rename to web/assets/UserSelectView-CXmVKOeK.js index 9d2dda86..88b4d3f3 100644 --- a/web/assets/UserSelectView-B3jYchWu.js +++ b/web/assets/UserSelectView-CXmVKOeK.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, aX as useUserStore, bW as useRouter, ab as ref, c as computed, m as onMounted, o as openBlock, k as createBlock, M as withCtx, H as createBaseVNode, X as toDisplayString, N as createVNode, bX as withKeys, j as unref, av as script, bQ as script$1, bY as script$2, bZ as script$3, aE as createTextVNode, I as createCommentVNode, l as script$4 } from "./index-DjNHn37O.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-BNGF4K22.js"; +import { d as defineComponent, aX as useUserStore, c2 as useRouter, ad as ref, c as computed, t as onMounted, o as openBlock, J as createBlock, P as withCtx, m as createBaseVNode, Z as toDisplayString, k as createVNode, c3 as withKeys, j as unref, ax as script, c4 as script$1, c5 as script$2, c6 as script$3, aG as createTextVNode, L as createCommentVNode, l as script$4 } from "./index-QvfM__ze.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-BhQMaVFP.js"; const _hoisted_1 = { id: "comfy-user-selection", class: "min-w-84 relative rounded-lg bg-[var(--comfy-menu-bg)] p-5 px-10 shadow-lg" @@ -99,4 +99,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=UserSelectView-B3jYchWu.js.map +//# sourceMappingURL=UserSelectView-CXmVKOeK.js.map diff --git a/web/assets/WelcomeView-N0ZXLjdi.js b/web/assets/WelcomeView-C8whKl15.js similarity index 79% rename from web/assets/WelcomeView-N0ZXLjdi.js rename to web/assets/WelcomeView-C8whKl15.js index bec1292e..7625ec43 100644 --- a/web/assets/WelcomeView-N0ZXLjdi.js +++ b/web/assets/WelcomeView-C8whKl15.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, bW as useRouter, o as openBlock, k as createBlock, M as withCtx, H as createBaseVNode, X as toDisplayString, N as createVNode, j as unref, l as script, aL as pushScopeId, aM as popScopeId, _ as _export_sfc } from "./index-DjNHn37O.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-BNGF4K22.js"; +import { d as defineComponent, c2 as useRouter, o as openBlock, J as createBlock, P as withCtx, m as createBaseVNode, Z as toDisplayString, k as createVNode, j as unref, l as script, p as pushScopeId, q as popScopeId, _ as _export_sfc } from "./index-QvfM__ze.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-BhQMaVFP.js"; const _withScopeId = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-7dfaf74c"), n = n(), popScopeId(), n), "_withScopeId"); const _hoisted_1 = { class: "flex flex-col items-center justify-center gap-8 p-8" }; const _hoisted_2 = { class: "animated-gradient-text text-glow select-none" }; @@ -37,4 +37,4 @@ const WelcomeView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data- export { WelcomeView as default }; -//# sourceMappingURL=WelcomeView-N0ZXLjdi.js.map +//# sourceMappingURL=WelcomeView-C8whKl15.js.map diff --git a/web/assets/index-5HFeZax4.js b/web/assets/index-5HFeZax4.js deleted file mode 100644 index b4bc111e..00000000 --- a/web/assets/index-5HFeZax4.js +++ /dev/null @@ -1,27 +0,0 @@ -var __defProp = Object.defineProperty; -var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { ct as script$1, H as createBaseVNode, o as openBlock, f as createElementBlock, D as mergeProps } from "./index-DjNHn37O.js"; -var script = { - name: "PlusIcon", - "extends": script$1 -}; -var _hoisted_1 = /* @__PURE__ */ createBaseVNode("path", { - d: "M7.67742 6.32258V0.677419C7.67742 0.497757 7.60605 0.325452 7.47901 0.198411C7.35197 0.0713707 7.17966 0 7 0C6.82034 0 6.64803 0.0713707 6.52099 0.198411C6.39395 0.325452 6.32258 0.497757 6.32258 0.677419V6.32258H0.677419C0.497757 6.32258 0.325452 6.39395 0.198411 6.52099C0.0713707 6.64803 0 6.82034 0 7C0 7.17966 0.0713707 7.35197 0.198411 7.47901C0.325452 7.60605 0.497757 7.67742 0.677419 7.67742H6.32258V13.3226C6.32492 13.5015 6.39704 13.6725 6.52358 13.799C6.65012 13.9255 6.82106 13.9977 7 14C7.17966 14 7.35197 13.9286 7.47901 13.8016C7.60605 13.6745 7.67742 13.5022 7.67742 13.3226V7.67742H13.3226C13.5022 7.67742 13.6745 7.60605 13.8016 7.47901C13.9286 7.35197 14 7.17966 14 7C13.9977 6.82106 13.9255 6.65012 13.799 6.52358C13.6725 6.39704 13.5015 6.32492 13.3226 6.32258H7.67742Z", - fill: "currentColor" -}, null, -1); -var _hoisted_2 = [_hoisted_1]; -function render(_ctx, _cache, $props, $setup, $data, $options) { - return openBlock(), createElementBlock("svg", mergeProps({ - width: "14", - height: "14", - viewBox: "0 0 14 14", - fill: "none", - xmlns: "http://www.w3.org/2000/svg" - }, _ctx.pti()), _hoisted_2, 16); -} -__name(render, "render"); -script.render = render; -export { - script as s -}; -//# sourceMappingURL=index-5HFeZax4.js.map diff --git a/web/assets/index-t-sFBuUC.css b/web/assets/index-Cf-n7v0V.css similarity index 97% rename from web/assets/index-t-sFBuUC.css rename to web/assets/index-Cf-n7v0V.css index f588a35c..b8e6a53a 100644 --- a/web/assets/index-t-sFBuUC.css +++ b/web/assets/index-Cf-n7v0V.css @@ -2131,6 +2131,9 @@ .z-\[1000\]{ z-index: 1000; } + .z-\[9999\]{ + z-index: 9999; + } .m-0{ margin: 0px; } @@ -2253,6 +2256,9 @@ .h-0{ height: 0px; } + .h-1{ + height: 0.25rem; + } .h-16{ height: 4rem; } @@ -2271,6 +2277,9 @@ .h-\[30rem\]{ height: 30rem; } + .h-\[var\(--comfy-topbar-height\)\]{ + height: var(--comfy-topbar-height); + } .h-full{ height: 100%; } @@ -2341,6 +2350,9 @@ .w-screen{ width: 100vw; } + .min-w-0{ + min-width: 0px; + } .min-w-110{ min-width: 32rem; } @@ -2359,6 +2371,9 @@ .max-w-\[150px\]{ max-width: 150px; } + .max-w-\[600px\]{ + max-width: 600px; + } .max-w-full{ max-width: 100%; } @@ -2519,6 +2534,9 @@ .text-wrap{ text-wrap: wrap; } + .text-nowrap{ + text-wrap: nowrap; + } .rounded{ border-radius: 0.25rem; } @@ -2528,16 +2546,35 @@ .rounded-none{ border-radius: 0px; } + .rounded-t-lg{ + border-top-left-radius: 0.5rem; + border-top-right-radius: 0.5rem; + } .border{ border-width: 1px; } + .border-0{ + border-width: 0px; + } .border-x-0{ border-left-width: 0px; border-right-width: 0px; } + .border-b{ + border-bottom-width: 1px; + } + .border-l{ + border-left-width: 1px; + } + .border-r{ + border-right-width: 1px; + } .border-t-0{ border-top-width: 0px; } + .border-solid{ + border-style: solid; + } .border-none{ border-style: none; } @@ -2635,6 +2672,9 @@ .p-5{ padding: 1.25rem; } + .p-6{ + padding: 1.5rem; + } .p-8{ padding: 2rem; } @@ -2701,6 +2741,9 @@ .text-2xl{ font-size: 1.5rem; } + .text-3xl{ + font-size: 1.875rem; + } .text-4xl{ font-size: 2.25rem; } @@ -2783,6 +2826,9 @@ --tw-text-opacity: 1; color: rgb(239 68 68 / var(--tw-text-opacity)); } + .underline{ + text-decoration-line: underline; + } .no-underline{ text-decoration-line: none; } @@ -2868,6 +2914,7 @@ --bg-color: #fff; --comfy-menu-bg: #353535; --comfy-menu-secondary-bg: #292929; + --comfy-topbar-height: 2.5rem; --comfy-input-bg: #222; --input-text: #ddd; --descrip-text: #999; @@ -3625,24 +3672,33 @@ audio.comfy-audio.empty-audio-widget { padding: var(--comfy-tree-explorer-item-padding) !important; } +/* [Desktop] Electron window specific styles */ +.app-drag { + app-region: drag; +} + +.no-drag { + app-region: no-drag; +} + +.window-actions-spacer { + width: calc(100vw - env(titlebar-area-width, 100vw)); +} +/* End of [Desktop] Electron window specific styles */ .hover\:bg-neutral-700:hover{ --tw-bg-opacity: 1; background-color: rgb(64 64 64 / var(--tw-bg-opacity)); } - .hover\:bg-opacity-75:hover{ --tw-bg-opacity: 0.75; } - .hover\:text-blue-300:hover{ --tw-text-opacity: 1; color: rgb(144 205 244 / var(--tw-text-opacity)); } - .hover\:opacity-100:hover{ opacity: 1; } - @media (min-width: 768px){ .md\:flex{ @@ -3653,7 +3709,6 @@ audio.comfy-audio.empty-audio-widget { display: none; } } - @media (min-width: 1536px){ .\32xl\:mx-4{ @@ -3689,8 +3744,11 @@ audio.comfy-audio.empty-audio-widget { padding-left: 1rem; padding-right: 1rem; } -} + .\32xl\:text-sm{ + font-size: 0.875rem; + } +} @media (prefers-color-scheme: dark){ .dark\:bg-gray-800{ @@ -3740,17 +3798,17 @@ audio.comfy-audio.empty-audio-widget { margin-bottom: 1rem; } -.comfy-error-report[data-v-ddf3e2da] { +.comfy-error-report[data-v-09b72a20] { display: flex; flex-direction: column; gap: 1rem; } -.action-container[data-v-ddf3e2da] { +.action-container[data-v-09b72a20] { display: flex; gap: 1rem; justify-content: flex-end; } -.wrapper-pre[data-v-ddf3e2da] { +.wrapper-pre[data-v-09b72a20] { white-space: pre-wrap; word-wrap: break-word; } @@ -3834,7 +3892,7 @@ audio.comfy-audio.empty-audio-widget { padding-top: 0px !important; } -.settings-container[data-v-67f71ae9] { +.settings-container[data-v-2e21278f] { display: flex; height: 70vh; width: 60vw; @@ -3842,25 +3900,25 @@ audio.comfy-audio.empty-audio-widget { overflow: hidden; } @media (max-width: 768px) { -.settings-container[data-v-67f71ae9] { +.settings-container[data-v-2e21278f] { flex-direction: column; height: auto; width: 80vw; } -.settings-sidebar[data-v-67f71ae9] { +.settings-sidebar[data-v-2e21278f] { width: 100%; } -.settings-content[data-v-67f71ae9] { +.settings-content[data-v-2e21278f] { height: 350px; } } /* Show a separator line above the Keybinding tab */ /* This indicates the start of custom setting panels */ -.settings-sidebar[data-v-67f71ae9] .p-listbox-option[aria-label='Keybinding'] { +.settings-sidebar[data-v-2e21278f] .p-listbox-option[aria-label='Keybinding'] { position: relative; } -.settings-sidebar[data-v-67f71ae9] .p-listbox-option[aria-label='Keybinding']::before { +.settings-sidebar[data-v-2e21278f] .p-listbox-option[aria-label='Keybinding']::before { position: absolute; top: 0px; left: 0px; @@ -3878,15 +3936,15 @@ audio.comfy-audio.empty-audio-widget { margin-left: 0.5rem; } -.p-card[data-v-d65acb9a] { +.p-card[data-v-ffc83afa] { --p-card-body-padding: 10px 0 0 0; overflow: hidden; } -[data-v-d65acb9a] .p-card-subtitle { +[data-v-ffc83afa] .p-card-subtitle { text-align: center; } -.carousel[data-v-fc26284b] { +.carousel[data-v-d9962275] { width: 66vw; } /** @@ -4123,18 +4181,18 @@ audio.comfy-audio.empty-audio-widget { overflow-y: hidden; } -[data-v-6187144a] .p-terminal .xterm { +[data-v-90a7f075] .p-terminal .xterm { overflow-x: auto; } -[data-v-6187144a] .p-terminal .xterm-screen { +[data-v-90a7f075] .p-terminal .xterm-screen { background-color: black; overflow-y: hidden; } -[data-v-b27b58f4] .p-terminal .xterm { +[data-v-03daf1c8] .p-terminal .xterm { overflow-x: auto; } -[data-v-b27b58f4] .p-terminal .xterm-screen { +[data-v-03daf1c8] .p-terminal .xterm-screen { background-color: black; overflow-y: hidden; } @@ -4494,16 +4552,28 @@ audio.comfy-audio.empty-audio-widget { pointer-events: none; } -[data-v-9159c070] .p-toolbar-end .p-button { +[data-v-5e759e25] .p-toolbar-end .p-button { + padding-top: 0.25rem; + padding-bottom: 0.25rem } @media (min-width: 1536px) { -[data-v-9159c070] .p-toolbar-end .p-button { +[data-v-5e759e25] .p-toolbar-end .p-button { + padding-top: 0.5rem; + padding-bottom: 0.5rem } } +[data-v-5e759e25] .p-toolbar-start { + + min-width: 0px; + + flex: 1 1 0%; + + overflow: hidden +} .model_preview[data-v-32e6c4d9] { background-color: var(--comfy-menu-bg); @@ -4736,18 +4806,18 @@ audio.comfy-audio.empty-audio-widget { width: 100% } -.p-selectbutton .p-button[data-v-4b8adc78] { +.p-selectbutton .p-button[data-v-05364174] { padding: 0.5rem; } -.p-selectbutton .p-button .pi[data-v-4b8adc78] { +.p-selectbutton .p-button .pi[data-v-05364174] { font-size: 1.5rem; } -.field[data-v-4b8adc78] { +.field[data-v-05364174] { display: flex; flex-direction: column; gap: 0.5rem; } -.color-picker-container[data-v-4b8adc78] { +.color-picker-container[data-v-05364174] { display: flex; align-items: center; gap: 0.5rem; @@ -4767,10 +4837,10 @@ audio.comfy-audio.empty-audio-widget { } } -.comfy-image-wrap[data-v-ffe66146] { +.comfy-image-wrap[data-v-a748ccd8] { display: contents; } -.comfy-image-blur[data-v-ffe66146] { +.comfy-image-blur[data-v-a748ccd8] { position: absolute; top: 0; left: 0; @@ -4779,7 +4849,7 @@ audio.comfy-audio.empty-audio-widget { -o-object-fit: cover; object-fit: cover; } -.comfy-image-main[data-v-ffe66146] { +.comfy-image-main[data-v-a748ccd8] { width: 100%; height: 100%; -o-object-fit: cover; @@ -4788,19 +4858,19 @@ audio.comfy-audio.empty-audio-widget { object-position: center; z-index: 1; } -.contain .comfy-image-wrap[data-v-ffe66146] { +.contain .comfy-image-wrap[data-v-a748ccd8] { position: relative; width: 100%; height: 100%; } -.contain .comfy-image-main[data-v-ffe66146] { +.contain .comfy-image-main[data-v-a748ccd8] { -o-object-fit: contain; object-fit: contain; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); position: absolute; } -.broken-image-placeholder[data-v-ffe66146] { +.broken-image-placeholder[data-v-a748ccd8] { display: flex; flex-direction: column; align-items: center; @@ -4809,7 +4879,7 @@ audio.comfy-audio.empty-audio-widget { height: 100%; margin: 2rem; } -.broken-image-placeholder i[data-v-ffe66146] { +.broken-image-placeholder i[data-v-a748ccd8] { font-size: 3rem; margin-bottom: 0.5rem; } @@ -4827,7 +4897,7 @@ img.galleria-image { z-index: 1; } -.result-container[data-v-61515e14] { +.result-container[data-v-2403edc6] { width: 100%; height: 100%; aspect-ratio: 1 / 1; @@ -4837,7 +4907,7 @@ img.galleria-image { justify-content: center; align-items: center; } -.preview-mask[data-v-61515e14] { +.preview-mask[data-v-2403edc6] { position: absolute; left: 50%; top: 50%; @@ -4849,7 +4919,7 @@ img.galleria-image { transition: opacity 0.3s ease; z-index: 1; } -.result-container:hover .preview-mask[data-v-61515e14] { +.result-container:hover .preview-mask[data-v-2403edc6] { opacity: 1; } diff --git a/web/assets/index-B5F0uxTQ.js b/web/assets/index-DpF-ptbJ.js similarity index 99% rename from web/assets/index-B5F0uxTQ.js rename to web/assets/index-DpF-ptbJ.js index 78222d18..792856c6 100644 --- a/web/assets/index-B5F0uxTQ.js +++ b/web/assets/index-DpF-ptbJ.js @@ -1,8 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { B as BaseStyle, q as script$s, ct as script$t, H as createBaseVNode, o as openBlock, f as createElementBlock, D as mergeProps, X as toDisplayString, S as Ripple, r as resolveDirective, i as withDirectives, k as createBlock, G as resolveDynamicComponent, bY as script$u, aB as resolveComponent, T as normalizeClass, aD as createSlots, M as withCtx, bz as script$v, bw as script$w, F as Fragment, E as renderList, aE as createTextVNode, bq as setAttribute, ak as UniqueComponentId, bo as normalizeProps, J as renderSlot, I as createCommentVNode, R as equals, bk as script$x, c8 as script$y, cu as getFirstFocusableElement, an as OverlayEventBus, A as getVNodeProp, am as resolveFieldData, cv as invokeElementMethod, O as getAttribute, cw as getNextElementSibling, y as getOuterWidth, cx as getPreviousElementSibling, l as script$z, ay as script$A, W as script$B, bn as script$D, aj as isNotEmpty, bM as withModifiers, z as getOuterHeight, cy as _default, al as ZIndex, Q as focus, ap as addStyle, ar as absolutePosition, as as ConnectedOverlayScrollHandler, at as isTouchDevice, cz as FilterOperator, ax as script$E, cA as FocusTrap, N as createVNode, aC as Transition, bX as withKeys, cB as getIndex, aW as script$G, cC as isClickable, cD as clearSelection, cE as localeComparator, cF as sort, cG as FilterService, cn as FilterMatchMode, P as findSingle, c1 as findIndexInList, c2 as find, cH as exportCSV, U as getOffset, cI as getHiddenElementOuterWidth, cJ as getHiddenElementOuterHeight, cK as reorderArray, cL as getWindowScrollTop, cM as removeClass, cN as addClass, ao as isEmpty, aw as script$H, az as script$I } from "./index-DjNHn37O.js"; -import { s as script$C } from "./index-B-aVupP5.js"; -import { s as script$F } from "./index-5HFeZax4.js"; +import { B as BaseStyle, y as script$s, cA as script$t, m as createBaseVNode, o as openBlock, f as createElementBlock, G as mergeProps, Z as toDisplayString, U as Ripple, r as resolveDirective, i as withDirectives, J as createBlock, K as resolveDynamicComponent, c5 as script$u, aD as resolveComponent, V as normalizeClass, aF as createSlots, P as withCtx, bG as script$v, bD as script$w, H as Fragment, I as renderList, aG as createTextVNode, bx as setAttribute, am as UniqueComponentId, bv as normalizeProps, M as renderSlot, L as createCommentVNode, T as equals, br as script$x, cg as script$y, cB as getFirstFocusableElement, ap as OverlayEventBus, E as getVNodeProp, ao as resolveFieldData, cC as invokeElementMethod, Q as getAttribute, cD as getNextElementSibling, C as getOuterWidth, cE as getPreviousElementSibling, l as script$z, aA as script$A, Y as script$B, bu as script$D, al as isNotEmpty, b3 as withModifiers, D as getOuterHeight, cF as _default, an as ZIndex, S as focus, ar as addStyle, at as absolutePosition, au as ConnectedOverlayScrollHandler, av as isTouchDevice, cG as FilterOperator, az as script$E, cH as script$F, cI as FocusTrap, k as createVNode, aE as Transition, c3 as withKeys, cJ as getIndex, aW as script$G, cK as isClickable, cL as clearSelection, cM as localeComparator, cN as sort, cO as FilterService, cu as FilterMatchMode, R as findSingle, c9 as findIndexInList, ca as find, cP as exportCSV, W as getOffset, cQ as getHiddenElementOuterWidth, cR as getHiddenElementOuterHeight, cS as reorderArray, cT as getWindowScrollTop, cU as removeClass, cV as addClass, aq as isEmpty, ay as script$H, aB as script$I } from "./index-QvfM__ze.js"; +import { s as script$C } from "./index-Q1cQr26V.js"; var ColumnStyle = BaseStyle.extend({ name: "column" }); @@ -8783,4 +8782,4 @@ export { script as a, script$r as s }; -//# sourceMappingURL=index-B5F0uxTQ.js.map +//# sourceMappingURL=index-DpF-ptbJ.js.map diff --git a/web/assets/index-B-aVupP5.js b/web/assets/index-Q1cQr26V.js similarity index 91% rename from web/assets/index-B-aVupP5.js rename to web/assets/index-Q1cQr26V.js index 2f4957c2..ce20e200 100644 --- a/web/assets/index-B-aVupP5.js +++ b/web/assets/index-Q1cQr26V.js @@ -1,6 +1,6 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { ct as script$1, H as createBaseVNode, o as openBlock, f as createElementBlock, D as mergeProps } from "./index-DjNHn37O.js"; +import { cA as script$1, m as createBaseVNode, o as openBlock, f as createElementBlock, G as mergeProps } from "./index-QvfM__ze.js"; var script = { name: "BarsIcon", "extends": script$1 @@ -26,4 +26,4 @@ script.render = render; export { script as s }; -//# sourceMappingURL=index-B-aVupP5.js.map +//# sourceMappingURL=index-Q1cQr26V.js.map diff --git a/web/assets/index-DjNHn37O.js b/web/assets/index-QvfM__ze.js similarity index 81% rename from web/assets/index-DjNHn37O.js rename to web/assets/index-QvfM__ze.js index fff8484b..dc314376 100644 --- a/web/assets/index-DjNHn37O.js +++ b/web/assets/index-QvfM__ze.js @@ -1,7 +1,7 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./GraphView-HVeNbkaW.js","./index-jXPKy3pP.js","./index-5HFeZax4.js","./index-B-aVupP5.js","./keybindingService-Bx7YdkXn.js","./serverConfigStore-CvyKFVuP.js","./GraphView-CIRWBKTm.css","./UserSelectView-B3jYchWu.js","./BaseViewTemplate-BNGF4K22.js","./ServerStartView-CIDTUh4x.js","./ServerStartView-CnyN4Ib6.css","./InstallView-CAcYt0HL.js","./InstallView-CwQdoH-C.css","./WelcomeView-N0ZXLjdi.js","./WelcomeView-Brz3-luE.css","./NotSupportedView-Drz3x2d-.js","./NotSupportedView-bFzHmqNj.css","./DownloadGitView-DeC7MBzG.js","./ManualConfigurationView-Bi_qHE-n.js","./ManualConfigurationView-B6ecEClB.css","./KeybindingPanel-Dc3C4lG1.js","./index-B5F0uxTQ.js","./KeybindingPanel-DvrUYZ4S.css","./ExtensionPanel-D4Phn0Zr.js","./ServerConfigPanel-Be4StJmv.js","./index-Bordpmzt.js","./index-BRhY6FpL.css"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./GraphView-CDDCHVO0.js","./index-Q1cQr26V.js","./keybindingService-Cak1En5n.js","./serverConfigStore-DCme3xlV.js","./GraphView-CqZ3opAX.css","./UserSelectView-CXmVKOeK.js","./BaseViewTemplate-BhQMaVFP.js","./ServerStartView-48wfE1MS.js","./ServerStartView-CJiwVDQY.css","./InstallView-By3hC1fC.js","./InstallView-CxhfFC8Y.css","./WelcomeView-C8whKl15.js","./WelcomeView-Brz3-luE.css","./NotSupportedView-Vc8_xWgH.js","./NotSupportedView-DQerxQzi.css","./DownloadGitView-rPK_vYgU.js","./ManualConfigurationView-enyqGo0M.js","./ManualConfigurationView-CsirlNfV.css","./MetricsConsentView-lSfLu4nr.js","./DesktopStartView-le6AjGZr.js","./KeybindingPanel-D6O16W_1.js","./index-DpF-ptbJ.js","./KeybindingPanel-DvrUYZ4S.css","./ExtensionPanel-3jWrm6Zi.js","./ServerConfigPanel-B-w0HFlz.js","./index-je62U6DH.js","./index-BRhY6FpL.css"])))=>i.map(i=>d[i]); var __defProp2 = Object.defineProperty; var __name = (target, value4) => __defProp2(target, "name", { value: value4, configurable: true }); -(/* @__PURE__ */ __name(function polyfill() { +(/* @__PURE__ */ __name(function polyfill2() { const relList = document.createElement("link").relList; if (relList && relList.supports && relList.supports("modulepreload")) { return; @@ -45,16 +45,16 @@ var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols; var __hasOwnProp$1 = Object.prototype.hasOwnProperty; var __propIsEnum$1 = Object.prototype.propertyIsEnumerable; var __defNormalProp$2 = /* @__PURE__ */ __name((obj, key, value4) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value: value4 }) : obj[key] = value4, "__defNormalProp$2"); -var __spreadValues$1 = /* @__PURE__ */ __name((a, b) => { - for (var prop2 in b || (b = {})) - if (__hasOwnProp$1.call(b, prop2)) - __defNormalProp$2(a, prop2, b[prop2]); +var __spreadValues$1 = /* @__PURE__ */ __name((a2, b2) => { + for (var prop2 in b2 || (b2 = {})) + if (__hasOwnProp$1.call(b2, prop2)) + __defNormalProp$2(a2, prop2, b2[prop2]); if (__getOwnPropSymbols$1) - for (var prop2 of __getOwnPropSymbols$1(b)) { - if (__propIsEnum$1.call(b, prop2)) - __defNormalProp$2(a, prop2, b[prop2]); + for (var prop2 of __getOwnPropSymbols$1(b2)) { + if (__propIsEnum$1.call(b2, prop2)) + __defNormalProp$2(a2, prop2, b2[prop2]); } - return a; + return a2; }, "__spreadValues$1"); function isEmpty$1(value4) { return value4 === null || value4 === void 0 || value4 === "" || Array.isArray(value4) && value4.length === 0 || !(value4 instanceof Date) && typeof value4 === "object" && Object.keys(value4).length === 0; @@ -102,31 +102,31 @@ function deepEquals(obj1, obj2) { return obj1 !== obj1 && obj2 !== obj2; } __name(deepEquals, "deepEquals"); -function isFunction$5(value4) { +function isFunction$9(value4) { return !!(value4 && value4.constructor && value4.call && value4.apply); } -__name(isFunction$5, "isFunction$5"); +__name(isFunction$9, "isFunction$9"); function isNotEmpty(value4) { return !isEmpty$1(value4); } __name(isNotEmpty, "isNotEmpty"); -function resolveFieldData(data24, field) { - if (!data24 || !field) { +function resolveFieldData(data25, field) { + if (!data25 || !field) { return null; } try { - const value4 = data24[field]; + const value4 = data25[field]; if (isNotEmpty(value4)) return value4; } catch (e2) { } - if (Object.keys(data24).length) { - if (isFunction$5(field)) { - return field(data24); + if (Object.keys(data25).length) { + if (isFunction$9(field)) { + return field(data25); } else if (field.indexOf(".") === -1) { - return data24[field]; + return data25[field]; } else { let fields = field.split("."); - let value4 = data24; + let value4 = data25; for (let i2 = 0, len = fields.length; i2 < len; ++i2) { if (value4 == null) { return null; @@ -205,26 +205,26 @@ function findLastIndex(arr, callback) { return index2; } __name(findLastIndex, "findLastIndex"); -function isObject$7(value4, empty3 = true) { +function isObject$e(value4, empty3 = true) { return value4 instanceof Object && value4.constructor === Object && (empty3 || Object.keys(value4).length !== 0); } -__name(isObject$7, "isObject$7"); -function resolve$1(obj, ...params) { - return isFunction$5(obj) ? obj(...params) : obj; +__name(isObject$e, "isObject$e"); +function resolve$2(obj, ...params) { + return isFunction$9(obj) ? obj(...params) : obj; } -__name(resolve$1, "resolve$1"); -function isString$8(value4, empty3 = true) { +__name(resolve$2, "resolve$2"); +function isString$9(value4, empty3 = true) { return typeof value4 === "string" && (empty3 || value4 !== ""); } -__name(isString$8, "isString$8"); +__name(isString$9, "isString$9"); function toFlatCase(str) { - return isString$8(str) ? str.replace(/(-|_)/g, "").toLowerCase() : str; + return isString$9(str) ? str.replace(/(-|_)/g, "").toLowerCase() : str; } __name(toFlatCase, "toFlatCase"); function getKeyValue(obj, key = "", params = {}) { const fKeys = toFlatCase(key).split("."); const fKey = fKeys.shift(); - return fKey ? isObject$7(obj) ? getKeyValue(resolve$1(obj[Object.keys(obj).find((k) => toFlatCase(k) === fKey) || ""], params), fKeys.join("."), params) : void 0 : resolve$1(obj, params); + return fKey ? isObject$e(obj) ? getKeyValue(resolve$2(obj[Object.keys(obj).find((k2) => toFlatCase(k2) === fKey) || ""], params), fKeys.join("."), params) : void 0 : resolve$2(obj, params); } __name(getKeyValue, "getKeyValue"); function insertIntoOrderedArray(item3, index2, arr, sourceArr) { @@ -246,10 +246,10 @@ function insertIntoOrderedArray(item3, index2, arr, sourceArr) { } } __name(insertIntoOrderedArray, "insertIntoOrderedArray"); -function isArray$5(value4, empty3 = true) { +function isArray$a(value4, empty3 = true) { return Array.isArray(value4) && (empty3 || value4.length !== 0); } -__name(isArray$5, "isArray$5"); +__name(isArray$a, "isArray$a"); function isDate$3(value4) { return value4 instanceof Date && value4.constructor === Date; } @@ -279,7 +279,7 @@ function mergeKeys(...args) { const _mergeKeys = /* @__PURE__ */ __name((target = {}, source = {}) => { const mergedObj = __spreadValues$1({}, target); Object.keys(source).forEach((key) => { - if (isObject$7(source[key]) && key in target && isObject$7(target[key])) { + if (isObject$e(source[key]) && key in target && isObject$e(target[key])) { mergedObj[key] = _mergeKeys(target[key], source[key]); } else { mergedObj[key] = source[key]; @@ -295,10 +295,10 @@ function minifyCSS(css3) { } __name(minifyCSS, "minifyCSS"); function nestedKeys(obj = {}, parentKey = "") { - return Object.entries(obj).reduce((o, [key, value4]) => { + return Object.entries(obj).reduce((o2, [key, value4]) => { const currentKey = parentKey ? `${parentKey}.${key}` : key; - isObject$7(value4) ? o = o.concat(nestedKeys(value4, currentKey)) : o.push(currentKey); - return o; + isObject$e(value4) ? o2 = o2.concat(nestedKeys(value4, currentKey)) : o2.push(currentKey); + return o2; }, []); } __name(nestedKeys, "nestedKeys"); @@ -331,14 +331,14 @@ __name(sort, "sort"); function stringify(value4, indent = 2, currentIndent = 0) { const currentIndentStr = " ".repeat(currentIndent); const nextIndentStr = " ".repeat(currentIndent + indent); - if (isArray$5(value4)) { + if (isArray$a(value4)) { return "[" + value4.map((v2) => stringify(v2, indent, currentIndent + indent)).join(", ") + "]"; } else if (isDate$3(value4)) { return value4.toISOString(); - } else if (isFunction$5(value4)) { + } else if (isFunction$9(value4)) { return value4.toString(); - } else if (isObject$7(value4)) { - return "{\n" + Object.entries(value4).map(([k, v2]) => `${nextIndentStr}${k}: ${stringify(v2, indent, currentIndent + indent)}`).join(",\n") + ` + } else if (isObject$e(value4)) { + return "{\n" + Object.entries(value4).map(([k2, v2]) => `${nextIndentStr}${k2}: ${stringify(v2, indent, currentIndent + indent)}`).join(",\n") + ` ${currentIndentStr}}`; } else { return JSON.stringify(value4); @@ -346,15 +346,15 @@ ${currentIndentStr}}`; } __name(stringify, "stringify"); function toCapitalCase(str) { - return isString$8(str, false) ? str[0].toUpperCase() + str.slice(1) : str; + return isString$9(str, false) ? str[0].toUpperCase() + str.slice(1) : str; } __name(toCapitalCase, "toCapitalCase"); function toKebabCase(str) { - return isString$8(str) ? str.replace(/(_)/g, "-").replace(/[A-Z]/g, (c, i2) => i2 === 0 ? c : "-" + c.toLowerCase()).toLowerCase() : str; + return isString$9(str) ? str.replace(/(_)/g, "-").replace(/[A-Z]/g, (c2, i2) => i2 === 0 ? c2 : "-" + c2.toLowerCase()).toLowerCase() : str; } __name(toKebabCase, "toKebabCase"); function toTokenKey$1(str) { - return isString$8(str) ? str.replace(/[A-Z]/g, (c, i2) => i2 === 0 ? c : "." + c.toLowerCase()).toLowerCase() : str; + return isString$9(str) ? str.replace(/[A-Z]/g, (c2, i2) => i2 === 0 ? c2 : "." + c2.toLowerCase()).toLowerCase() : str; } __name(toTokenKey$1, "toTokenKey$1"); function EventBus() { @@ -395,18 +395,18 @@ var __getOwnPropSymbols = Object.getOwnPropertySymbols; var __hasOwnProp = Object.prototype.hasOwnProperty; var __propIsEnum = Object.prototype.propertyIsEnumerable; var __defNormalProp$1 = /* @__PURE__ */ __name((obj, key, value4) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value: value4 }) : obj[key] = value4, "__defNormalProp$1"); -var __spreadValues = /* @__PURE__ */ __name((a, b) => { - for (var prop2 in b || (b = {})) - if (__hasOwnProp.call(b, prop2)) - __defNormalProp$1(a, prop2, b[prop2]); +var __spreadValues = /* @__PURE__ */ __name((a2, b2) => { + for (var prop2 in b2 || (b2 = {})) + if (__hasOwnProp.call(b2, prop2)) + __defNormalProp$1(a2, prop2, b2[prop2]); if (__getOwnPropSymbols) - for (var prop2 of __getOwnPropSymbols(b)) { - if (__propIsEnum.call(b, prop2)) - __defNormalProp$1(a, prop2, b[prop2]); + for (var prop2 of __getOwnPropSymbols(b2)) { + if (__propIsEnum.call(b2, prop2)) + __defNormalProp$1(a2, prop2, b2[prop2]); } - return a; + return a2; }, "__spreadValues"); -var __spreadProps = /* @__PURE__ */ __name((a, b) => __defProps(a, __getOwnPropDescs(b)), "__spreadProps"); +var __spreadProps = /* @__PURE__ */ __name((a2, b2) => __defProps(a2, __getOwnPropDescs(b2)), "__spreadProps"); var __objRest = /* @__PURE__ */ __name((source, exclude) => { var target = {}; for (var prop2 in source) @@ -426,19 +426,19 @@ __name(definePreset, "definePreset"); var ThemeService = EventBus(); var service_default = ThemeService; function toTokenKey(str) { - return isString$8(str) ? str.replace(/[A-Z]/g, (c, i2) => i2 === 0 ? c : "." + c.toLowerCase()).toLowerCase() : str; + return isString$9(str) ? str.replace(/[A-Z]/g, (c2, i2) => i2 === 0 ? c2 : "." + c2.toLowerCase()).toLowerCase() : str; } __name(toTokenKey, "toTokenKey"); -function merge$1(value1, value22) { - if (isArray$5(value1)) { +function merge$2(value1, value22) { + if (isArray$a(value1)) { value1.push(...value22 || []); - } else if (isObject$7(value1)) { + } else if (isObject$e(value1)) { Object.assign(value1, value22); } } -__name(merge$1, "merge$1"); +__name(merge$2, "merge$2"); function toValue$2(value4) { - return isObject$7(value4) && value4.hasOwnProperty("value") && value4.hasOwnProperty("type") ? value4.value : value4; + return isObject$e(value4) && value4.hasOwnProperty("value") && value4.hasOwnProperty("type") ? value4.value : value4; } __name(toValue$2, "toValue$2"); function toUnit(value4, variable = "") { @@ -456,7 +456,7 @@ function toNormalizePrefix(prefix2) { } __name(toNormalizePrefix, "toNormalizePrefix"); function toNormalizeVariable(prefix2 = "", variable = "") { - return toNormalizePrefix(`${isString$8(prefix2, false) && isString$8(variable, false) ? `${prefix2}-` : prefix2}${variable}`); + return toNormalizePrefix(`${isString$9(prefix2, false) && isString$9(variable, false) ? `${prefix2}-` : prefix2}${variable}`); } __name(toNormalizeVariable, "toNormalizeVariable"); function getVariableName(prefix2 = "", variable = "") { @@ -464,7 +464,7 @@ function getVariableName(prefix2 = "", variable = "") { } __name(getVariableName, "getVariableName"); function getVariableValue(value4, variable = "", prefix2 = "", excludedKeyRegexes = [], fallback) { - if (isString$8(value4)) { + if (isString$9(value4)) { const regex2 = /{([^}]*)}/g; const val = value4.trim(); if (matchRegex(val, regex2)) { @@ -485,7 +485,7 @@ function getVariableValue(value4, variable = "", prefix2 = "", excludedKeyRegexe } __name(getVariableValue, "getVariableValue"); function getComputedValue(obj = {}, value4) { - if (isString$8(value4)) { + if (isString$9(value4)) { const regex2 = /{([^}]*)}/g; const val = value4.trim(); return matchRegex(val, regex2) ? val.replaceAll(regex2, (v2) => getKeyValue(obj, v2.replace(/{|}/g, ""))) : val; @@ -496,7 +496,7 @@ function getComputedValue(obj = {}, value4) { } __name(getComputedValue, "getComputedValue"); function setProperty(properties, key, value4) { - if (isString$8(key, false)) { + if (isString$9(key, false)) { properties.push(`${key}:${value4};`); } } @@ -517,29 +517,29 @@ function normalizeColor(color2) { __name(normalizeColor, "normalizeColor"); function hexToRgb$1(hex) { var bigint = parseInt(hex.substring(1), 16); - var r = bigint >> 16 & 255; + var r2 = bigint >> 16 & 255; var g2 = bigint >> 8 & 255; - var b = bigint & 255; - return { r, g: g2, b }; + var b2 = bigint & 255; + return { r: r2, g: g2, b: b2 }; } __name(hexToRgb$1, "hexToRgb$1"); -function rgbToHex(r, g2, b) { - return `#${r.toString(16).padStart(2, "0")}${g2.toString(16).padStart(2, "0")}${b.toString(16).padStart(2, "0")}`; +function rgbToHex(r2, g2, b2) { + return `#${r2.toString(16).padStart(2, "0")}${g2.toString(16).padStart(2, "0")}${b2.toString(16).padStart(2, "0")}`; } __name(rgbToHex, "rgbToHex"); var mix_default = /* @__PURE__ */ __name((color1, color2, weight) => { color1 = normalizeColor(color1); color2 = normalizeColor(color2); var p2 = weight / 100; - var w = p2 * 2 - 1; - var w1 = (w + 1) / 2; - var w2 = 1 - w1; + var w2 = p2 * 2 - 1; + var w1 = (w2 + 1) / 2; + var w22 = 1 - w1; var rgb1 = hexToRgb$1(color1); var rgb2 = hexToRgb$1(color2); - var r = Math.round(rgb1.r * w1 + rgb2.r * w2); - var g2 = Math.round(rgb1.g * w1 + rgb2.g * w2); - var b = Math.round(rgb1.b * w1 + rgb2.b * w2); - return rgbToHex(r, g2, b); + var r2 = Math.round(rgb1.r * w1 + rgb2.r * w22); + var g2 = Math.round(rgb1.g * w1 + rgb2.g * w22); + var b2 = Math.round(rgb1.b * w1 + rgb2.b * w22); + return rgbToHex(r2, g2, b2); }, "mix_default"); var shade_default = /* @__PURE__ */ __name((color2, percent) => mix_default("#000000", color2, percent), "shade_default"); var tint_default = /* @__PURE__ */ __name((color2, percent) => mix_default("#ffffff", color2, percent), "tint_default"); @@ -553,10 +553,10 @@ var palette_default = /* @__PURE__ */ __name((color2) => { }, "palette_default"); var $dt = /* @__PURE__ */ __name((tokenPath) => { var _a2; - const theme40 = config_default.getTheme(); - const variable = dtwt(theme40, tokenPath, void 0, "variable"); + const theme42 = config_default.getTheme(); + const variable = dtwt(theme42, tokenPath, void 0, "variable"); const name2 = (_a2 = variable.match(/--[\w-]+/g)) == null ? void 0 : _a2[0]; - const value4 = dtwt(theme40, tokenPath, void 0, "value"); + const value4 = dtwt(theme42, tokenPath, void 0, "value"); return { name: name2, variable, @@ -566,10 +566,10 @@ var $dt = /* @__PURE__ */ __name((tokenPath) => { var dt = /* @__PURE__ */ __name((...args) => { return dtwt(config_default.getTheme(), ...args); }, "dt"); -var dtwt = /* @__PURE__ */ __name((theme40 = {}, tokenPath, fallback, type = "variable") => { +var dtwt = /* @__PURE__ */ __name((theme42 = {}, tokenPath, fallback, type = "variable") => { if (tokenPath) { const { variable: VARIABLE, options: OPTIONS } = config_default.defaults || {}; - const { prefix: prefix2, transform: transform2 } = (theme40 == null ? void 0 : theme40.options) || OPTIONS || {}; + const { prefix: prefix2, transform: transform2 } = (theme42 == null ? void 0 : theme42.options) || OPTIONS || {}; const regex2 = /{([^}]*)}/g; const token = matchRegex(tokenPath, regex2) ? tokenPath : `{${tokenPath}}`; const isStrictTransform = type === "value" || transform2 === "strict"; @@ -578,11 +578,11 @@ var dtwt = /* @__PURE__ */ __name((theme40 = {}, tokenPath, fallback, type = "va return ""; }, "dtwt"); function css$2(style2) { - return resolve$1(style2, { dt }); + return resolve$2(style2, { dt }); } __name(css$2, "css$2"); -var $t = /* @__PURE__ */ __name((theme40 = {}) => { - let { preset: _preset, options: _options } = theme40; +var $t = /* @__PURE__ */ __name((theme42 = {}) => { + let { preset: _preset, options: _options } = theme42; return { preset(value4) { _preset = _preset ? mergeKeys(_preset, value4) : value4; @@ -634,7 +634,7 @@ var $t = /* @__PURE__ */ __name((theme40 = {}) => { } }; }, "$t"); -function toVariables_default(theme40, options4 = {}) { +function toVariables_default(theme42, options4 = {}) { const VARIABLE = config_default.defaults.variable; const { prefix: prefix2 = VARIABLE.prefix, selector = VARIABLE.selector, excludedKeyRegex = VARIABLE.excludedKeyRegex } = options4; const _toVariables = /* @__PURE__ */ __name((_theme, _prefix = "") => { @@ -642,10 +642,10 @@ function toVariables_default(theme40, options4 = {}) { (acc, [key, value4]) => { const px = matchRegex(key, excludedKeyRegex) ? toNormalizeVariable(_prefix) : toNormalizeVariable(_prefix, toKebabCase(key)); const v2 = toValue$2(value4); - if (isObject$7(v2)) { + if (isObject$e(v2)) { const { variables: variables2, tokens: tokens2 } = _toVariables(v2, px); - merge$1(acc["tokens"], tokens2); - merge$1(acc["variables"], variables2); + merge$2(acc["tokens"], tokens2); + merge$2(acc["variables"], variables2); } else { acc["tokens"].push((prefix2 ? px.replace(`${prefix2}-`, "") : px).replaceAll("-", ".")); setProperty(acc["variables"], getVariableName(px), getVariableValue(v2, px, prefix2, [excludedKeyRegex])); @@ -655,7 +655,7 @@ function toVariables_default(theme40, options4 = {}) { { variables: [], tokens: [] } ); }, "_toVariables"); - const { variables, tokens } = _toVariables(theme40, prefix2); + const { variables, tokens } = _toVariables(theme42, prefix2); return { value: variables, tokens, @@ -698,19 +698,19 @@ var themeUtils_default = { } }, resolve(value4) { - const rules = Object.keys(this.rules).filter((k) => k !== "custom").map((r) => this.rules[r]); + const rules = Object.keys(this.rules).filter((k2) => k2 !== "custom").map((r2) => this.rules[r2]); return [value4].flat().map((v2) => { var _a2; - return (_a2 = rules.map((r) => r.resolve(v2)).find((rr) => rr.matched)) != null ? _a2 : this.rules.custom.resolve(v2); + return (_a2 = rules.map((r2) => r2.resolve(v2)).find((rr) => rr.matched)) != null ? _a2 : this.rules.custom.resolve(v2); }); } }, - _toVariables(theme40, options4) { - return toVariables_default(theme40, { prefix: options4 == null ? void 0 : options4.prefix }); + _toVariables(theme42, options4) { + return toVariables_default(theme42, { prefix: options4 == null ? void 0 : options4.prefix }); }, - getCommon({ name: name2 = "", theme: theme40 = {}, params, set: set3, defaults: defaults2 }) { + getCommon({ name: name2 = "", theme: theme42 = {}, params, set: set3, defaults: defaults2 }) { var _c, _d, _e, _f; - const { preset, options: options4 } = theme40; + const { preset, options: options4 } = theme42; let primitive_css, primitive_tokens, semantic_css, semantic_tokens; if (isNotEmpty(preset)) { const { primitive, semantic } = preset; @@ -761,16 +761,16 @@ var themeUtils_default = { tokens }; }, - getPresetC({ name: name2 = "", theme: theme40 = {}, params, set: set3, defaults: defaults2 }) { + getPresetC({ name: name2 = "", theme: theme42 = {}, params, set: set3, defaults: defaults2 }) { var _a2; - const { preset, options: options4 } = theme40; + const { preset, options: options4 } = theme42; const cPreset = (_a2 = preset == null ? void 0 : preset.components) == null ? void 0 : _a2[name2]; return this.getPreset({ name: name2, preset: cPreset, options: options4, params, set: set3, defaults: defaults2 }); }, - getPresetD({ name: name2 = "", theme: theme40 = {}, params, set: set3, defaults: defaults2 }) { + getPresetD({ name: name2 = "", theme: theme42 = {}, params, set: set3, defaults: defaults2 }) { var _a2; const dName = name2.replace("-directive", ""); - const { preset, options: options4 } = theme40; + const { preset, options: options4 } = theme42; const dPreset = (_a2 = preset == null ? void 0 : preset.directives) == null ? void 0 : _a2[dName]; return this.getPreset({ name: dName, preset: dPreset, options: options4, params, set: set3, defaults: defaults2 }); }, @@ -781,14 +781,14 @@ var themeUtils_default = { getLayerOrder(name2, options4 = {}, params, defaults2) { const { cssLayer } = options4; if (cssLayer) { - const order = resolve$1(cssLayer.order || "primeui", params); + const order = resolve$2(cssLayer.order || "primeui", params); return `@layer ${order}`; } return ""; }, - getCommonStyleSheet({ name: name2 = "", theme: theme40 = {}, params, props = {}, set: set3, defaults: defaults2 }) { - const common = this.getCommon({ name: name2, theme: theme40, params, set: set3, defaults: defaults2 }); - const _props = Object.entries(props).reduce((acc, [k, v2]) => acc.push(`${k}="${v2}"`) && acc, []).join(" "); + getCommonStyleSheet({ name: name2 = "", theme: theme42 = {}, params, props = {}, set: set3, defaults: defaults2 }) { + const common = this.getCommon({ name: name2, theme: theme42, params, set: set3, defaults: defaults2 }); + const _props = Object.entries(props).reduce((acc, [k2, v2]) => acc.push(`${k2}="${v2}"`) && acc, []).join(" "); return Object.entries(common || {}).reduce((acc, [key, value4]) => { if (value4 == null ? void 0 : value4.css) { const _css = minifyCSS(value4 == null ? void 0 : value4.css); @@ -798,18 +798,18 @@ var themeUtils_default = { return acc; }, []).join(""); }, - getStyleSheet({ name: name2 = "", theme: theme40 = {}, params, props = {}, set: set3, defaults: defaults2 }) { + getStyleSheet({ name: name2 = "", theme: theme42 = {}, params, props = {}, set: set3, defaults: defaults2 }) { var _a2; - const options4 = { name: name2, theme: theme40, params, set: set3, defaults: defaults2 }; + const options4 = { name: name2, theme: theme42, params, set: set3, defaults: defaults2 }; const preset_css = (_a2 = name2.includes("-directive") ? this.getPresetD(options4) : this.getPresetC(options4)) == null ? void 0 : _a2.css; - const _props = Object.entries(props).reduce((acc, [k, v2]) => acc.push(`${k}="${v2}"`) && acc, []).join(" "); + const _props = Object.entries(props).reduce((acc, [k2, v2]) => acc.push(`${k2}="${v2}"`) && acc, []).join(" "); return preset_css ? `<style type="text/css" data-primevue-style-id="${name2}-variables" ${_props}>${minifyCSS(preset_css)}</style>` : ""; }, createTokens(obj = {}, defaults2, parentKey = "", parentPath = "", tokens = {}) { Object.entries(obj).forEach(([key, value4]) => { const currentKey = matchRegex(key, defaults2.variable.excludedKeyRegex) ? parentKey : parentKey ? `${parentKey}.${toTokenKey$1(key)}` : toTokenKey$1(key); const currentPath = parentPath ? `${parentPath}.${key}` : key; - if (isObject$7(value4)) { + if (isObject$e(value4)) { this.createTokens(value4, defaults2, currentKey, currentPath, tokens); } else { tokens[currentKey] || (tokens[currentKey] = { @@ -857,11 +857,11 @@ var themeUtils_default = { }, getTokenValue(tokens, path, defaults2) { var _a2; - const normalizePath = /* @__PURE__ */ __name((str) => { + const normalizePath2 = /* @__PURE__ */ __name((str) => { const strArr = str.split("."); - return strArr.filter((s) => !matchRegex(s.toLowerCase(), defaults2.variable.excludedKeyRegex)).join("."); + return strArr.filter((s2) => !matchRegex(s2.toLowerCase(), defaults2.variable.excludedKeyRegex)).join("."); }, "normalizePath"); - const token = normalizePath(path); + const token = normalizePath2(path); const colorScheme = path.includes("colorScheme.light") ? "light" : path.includes("colorScheme.dark") ? "dark" : void 0; const computedValues = [(_a2 = tokens[token]) == null ? void 0 : _a2.computed(colorScheme)].flat().filter((computed2) => computed2); return computedValues.length === 1 ? computedValues[0].value : computedValues.reduce((acc = {}, computed2) => { @@ -888,7 +888,7 @@ var themeUtils_default = { name: "primeui", order: "primeui" }; - isObject$7(cssLayer) && (layerOptions.name = resolve$1(cssLayer.name, { name: name2, type })); + isObject$e(cssLayer) && (layerOptions.name = resolve$2(cssLayer.name, { name: name2, type })); if (isNotEmpty(layerOptions.name)) { css22 = getRule(`@layer ${layerOptions.name}`, css22); set3 == null ? void 0 : set3.layerNames(layerOptions.name); @@ -918,10 +918,10 @@ var config_default = { _loadingStyles: /* @__PURE__ */ new Set(), _tokens: {}, update(newValues = {}) { - const { theme: theme40 } = newValues; - if (theme40) { - this._theme = __spreadProps(__spreadValues({}, theme40), { - options: __spreadValues(__spreadValues({}, this.defaults.options), theme40.options) + const { theme: theme42 } = newValues; + if (theme42) { + this._theme = __spreadProps(__spreadValues({}, theme42), { + options: __spreadValues(__spreadValues({}, this.defaults.options), theme42.options) }); this._tokens = themeUtils_default.createTokens(this.preset, this.defaults); this.clearLoadedStyleNames(); @@ -1052,8 +1052,8 @@ function usePreset(...presets) { return newPreset; } __name(usePreset, "usePreset"); -function useTheme(theme40) { - return $t(theme40).update({ mergePresets: false }); +function useTheme(theme42) { + return $t(theme42).update({ mergePresets: false }); } __name(useTheme, "useTheme"); var index$1n = { @@ -5973,6 +5973,25391 @@ var index$2 = { ripple: index$u } }; +const DEBUG_BUILD$6 = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__; +const SDK_VERSION = "8.48.0"; +const GLOBAL_OBJ = globalThis; +function getGlobalSingleton(name2, creator, obj) { + const gbl = obj || GLOBAL_OBJ; + const __SENTRY__ = gbl.__SENTRY__ = gbl.__SENTRY__ || {}; + const versionedCarrier = __SENTRY__[SDK_VERSION] = __SENTRY__[SDK_VERSION] || {}; + return versionedCarrier[name2] || (versionedCarrier[name2] = creator()); +} +__name(getGlobalSingleton, "getGlobalSingleton"); +const DEBUG_BUILD$5 = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__; +const PREFIX$2 = "Sentry Logger "; +const CONSOLE_LEVELS$1 = [ + "debug", + "info", + "warn", + "error", + "log", + "assert", + "trace" +]; +const originalConsoleMethods = {}; +function consoleSandbox(callback) { + if (!("console" in GLOBAL_OBJ)) { + return callback(); + } + const console2 = GLOBAL_OBJ.console; + const wrappedFuncs = {}; + const wrappedLevels = Object.keys(originalConsoleMethods); + wrappedLevels.forEach((level) => { + const originalConsoleMethod = originalConsoleMethods[level]; + wrappedFuncs[level] = console2[level]; + console2[level] = originalConsoleMethod; + }); + try { + return callback(); + } finally { + wrappedLevels.forEach((level) => { + console2[level] = wrappedFuncs[level]; + }); + } +} +__name(consoleSandbox, "consoleSandbox"); +function makeLogger() { + let enabled = false; + const logger2 = { + enable: /* @__PURE__ */ __name(() => { + enabled = true; + }, "enable"), + disable: /* @__PURE__ */ __name(() => { + enabled = false; + }, "disable"), + isEnabled: /* @__PURE__ */ __name(() => enabled, "isEnabled") + }; + if (DEBUG_BUILD$5) { + CONSOLE_LEVELS$1.forEach((name2) => { + logger2[name2] = (...args) => { + if (enabled) { + consoleSandbox(() => { + GLOBAL_OBJ.console[name2](`${PREFIX$2}[${name2}]:`, ...args); + }); + } + }; + }); + } else { + CONSOLE_LEVELS$1.forEach((name2) => { + logger2[name2] = () => void 0; + }); + } + return logger2; +} +__name(makeLogger, "makeLogger"); +const logger$2 = getGlobalSingleton("logger", makeLogger); +const STACKTRACE_FRAME_LIMIT = 50; +const UNKNOWN_FUNCTION = "?"; +const WEBPACK_ERROR_REGEXP = /\(error: (.*)\)/; +const STRIP_FRAME_REGEXP = /captureMessage|captureException/; +function createStackParser(...parsers) { + const sortedParsers = parsers.sort((a2, b2) => a2[0] - b2[0]).map((p2) => p2[1]); + return (stack2, skipFirstLines = 0, framesToPop = 0) => { + const frames = []; + const lines = stack2.split("\n"); + for (let i2 = skipFirstLines; i2 < lines.length; i2++) { + const line = lines[i2]; + if (line.length > 1024) { + continue; + } + const cleanedLine = WEBPACK_ERROR_REGEXP.test(line) ? line.replace(WEBPACK_ERROR_REGEXP, "$1") : line; + if (cleanedLine.match(/\S*Error: /)) { + continue; + } + for (const parser of sortedParsers) { + const frame = parser(cleanedLine); + if (frame) { + frames.push(frame); + break; + } + } + if (frames.length >= STACKTRACE_FRAME_LIMIT + framesToPop) { + break; + } + } + return stripSentryFramesAndReverse(frames.slice(framesToPop)); + }; +} +__name(createStackParser, "createStackParser"); +function stackParserFromStackParserOptions(stackParser) { + if (Array.isArray(stackParser)) { + return createStackParser(...stackParser); + } + return stackParser; +} +__name(stackParserFromStackParserOptions, "stackParserFromStackParserOptions"); +function stripSentryFramesAndReverse(stack2) { + if (!stack2.length) { + return []; + } + const localStack = Array.from(stack2); + if (/sentryWrapped/.test(getLastStackFrame(localStack).function || "")) { + localStack.pop(); + } + localStack.reverse(); + if (STRIP_FRAME_REGEXP.test(getLastStackFrame(localStack).function || "")) { + localStack.pop(); + if (STRIP_FRAME_REGEXP.test(getLastStackFrame(localStack).function || "")) { + localStack.pop(); + } + } + return localStack.slice(0, STACKTRACE_FRAME_LIMIT).map((frame) => ({ + ...frame, + filename: frame.filename || getLastStackFrame(localStack).filename, + function: frame.function || UNKNOWN_FUNCTION + })); +} +__name(stripSentryFramesAndReverse, "stripSentryFramesAndReverse"); +function getLastStackFrame(arr) { + return arr[arr.length - 1] || {}; +} +__name(getLastStackFrame, "getLastStackFrame"); +const defaultFunctionName = "<anonymous>"; +function getFunctionName(fn) { + try { + if (!fn || typeof fn !== "function") { + return defaultFunctionName; + } + return fn.name || defaultFunctionName; + } catch (e2) { + return defaultFunctionName; + } +} +__name(getFunctionName, "getFunctionName"); +function getFramesFromEvent(event) { + const exception = event.exception; + if (exception) { + const frames = []; + try { + exception.values.forEach((value4) => { + if (value4.stacktrace.frames) { + frames.push(...value4.stacktrace.frames); + } + }); + return frames; + } catch (_oO) { + return void 0; + } + } + return void 0; +} +__name(getFramesFromEvent, "getFramesFromEvent"); +const handlers$4 = {}; +const instrumented$1 = {}; +function addHandler$1(type, handler6) { + handlers$4[type] = handlers$4[type] || []; + handlers$4[type].push(handler6); +} +__name(addHandler$1, "addHandler$1"); +function resetInstrumentationHandlers() { + Object.keys(handlers$4).forEach((key) => { + handlers$4[key] = void 0; + }); +} +__name(resetInstrumentationHandlers, "resetInstrumentationHandlers"); +function maybeInstrument(type, instrumentFn) { + if (!instrumented$1[type]) { + instrumented$1[type] = true; + try { + instrumentFn(); + } catch (e2) { + DEBUG_BUILD$5 && logger$2.error(`Error while instrumenting ${type}`, e2); + } + } +} +__name(maybeInstrument, "maybeInstrument"); +function triggerHandlers$1(type, data25) { + const typeHandlers = type && handlers$4[type]; + if (!typeHandlers) { + return; + } + for (const handler6 of typeHandlers) { + try { + handler6(data25); + } catch (e2) { + DEBUG_BUILD$5 && logger$2.error( + `Error while triggering instrumentation handler. +Type: ${type} +Name: ${getFunctionName(handler6)} +Error:`, + e2 + ); + } + } +} +__name(triggerHandlers$1, "triggerHandlers$1"); +let _oldOnErrorHandler = null; +function addGlobalErrorInstrumentationHandler(handler6) { + const type = "error"; + addHandler$1(type, handler6); + maybeInstrument(type, instrumentError); +} +__name(addGlobalErrorInstrumentationHandler, "addGlobalErrorInstrumentationHandler"); +function instrumentError() { + _oldOnErrorHandler = GLOBAL_OBJ.onerror; + GLOBAL_OBJ.onerror = function(msg, url, line, column, error2) { + const handlerData = { + column, + error: error2, + line, + msg, + url + }; + triggerHandlers$1("error", handlerData); + if (_oldOnErrorHandler) { + return _oldOnErrorHandler.apply(this, arguments); + } + return false; + }; + GLOBAL_OBJ.onerror.__SENTRY_INSTRUMENTED__ = true; +} +__name(instrumentError, "instrumentError"); +let _oldOnUnhandledRejectionHandler = null; +function addGlobalUnhandledRejectionInstrumentationHandler(handler6) { + const type = "unhandledrejection"; + addHandler$1(type, handler6); + maybeInstrument(type, instrumentUnhandledRejection); +} +__name(addGlobalUnhandledRejectionInstrumentationHandler, "addGlobalUnhandledRejectionInstrumentationHandler"); +function instrumentUnhandledRejection() { + _oldOnUnhandledRejectionHandler = GLOBAL_OBJ.onunhandledrejection; + GLOBAL_OBJ.onunhandledrejection = function(e2) { + const handlerData = e2; + triggerHandlers$1("unhandledrejection", handlerData); + if (_oldOnUnhandledRejectionHandler) { + return _oldOnUnhandledRejectionHandler.apply(this, arguments); + } + return true; + }; + GLOBAL_OBJ.onunhandledrejection.__SENTRY_INSTRUMENTED__ = true; +} +__name(instrumentUnhandledRejection, "instrumentUnhandledRejection"); +function getMainCarrier() { + getSentryCarrier(GLOBAL_OBJ); + return GLOBAL_OBJ; +} +__name(getMainCarrier, "getMainCarrier"); +function getSentryCarrier(carrier) { + const __SENTRY__ = carrier.__SENTRY__ = carrier.__SENTRY__ || {}; + __SENTRY__.version = __SENTRY__.version || SDK_VERSION; + return __SENTRY__[SDK_VERSION] = __SENTRY__[SDK_VERSION] || {}; +} +__name(getSentryCarrier, "getSentryCarrier"); +const objectToString$4 = Object.prototype.toString; +function isError(wat) { + switch (objectToString$4.call(wat)) { + case "[object Error]": + case "[object Exception]": + case "[object DOMException]": + case "[object WebAssembly.Exception]": + return true; + default: + return isInstanceOf(wat, Error); + } +} +__name(isError, "isError"); +function isBuiltin(wat, className) { + return objectToString$4.call(wat) === `[object ${className}]`; +} +__name(isBuiltin, "isBuiltin"); +function isErrorEvent$2(wat) { + return isBuiltin(wat, "ErrorEvent"); +} +__name(isErrorEvent$2, "isErrorEvent$2"); +function isDOMError(wat) { + return isBuiltin(wat, "DOMError"); +} +__name(isDOMError, "isDOMError"); +function isDOMException(wat) { + return isBuiltin(wat, "DOMException"); +} +__name(isDOMException, "isDOMException"); +function isString$8(wat) { + return isBuiltin(wat, "String"); +} +__name(isString$8, "isString$8"); +function isParameterizedString(wat) { + return typeof wat === "object" && wat !== null && "__sentry_template_string__" in wat && "__sentry_template_values__" in wat; +} +__name(isParameterizedString, "isParameterizedString"); +function isPrimitive(wat) { + return wat === null || isParameterizedString(wat) || typeof wat !== "object" && typeof wat !== "function"; +} +__name(isPrimitive, "isPrimitive"); +function isPlainObject$5(wat) { + return isBuiltin(wat, "Object"); +} +__name(isPlainObject$5, "isPlainObject$5"); +function isEvent(wat) { + return typeof Event !== "undefined" && isInstanceOf(wat, Event); +} +__name(isEvent, "isEvent"); +function isElement$3(wat) { + return typeof Element !== "undefined" && isInstanceOf(wat, Element); +} +__name(isElement$3, "isElement$3"); +function isRegExp$5(wat) { + return isBuiltin(wat, "RegExp"); +} +__name(isRegExp$5, "isRegExp$5"); +function isThenable$1(wat) { + return Boolean(wat && wat.then && typeof wat.then === "function"); +} +__name(isThenable$1, "isThenable$1"); +function isSyntheticEvent(wat) { + return isPlainObject$5(wat) && "nativeEvent" in wat && "preventDefault" in wat && "stopPropagation" in wat; +} +__name(isSyntheticEvent, "isSyntheticEvent"); +function isInstanceOf(wat, base2) { + try { + return wat instanceof base2; + } catch (_e) { + return false; + } +} +__name(isInstanceOf, "isInstanceOf"); +function isVueViewModel(wat) { + return !!(typeof wat === "object" && wat !== null && (wat.__isVue || wat._isVue)); +} +__name(isVueViewModel, "isVueViewModel"); +const WINDOW$8 = GLOBAL_OBJ; +const DEFAULT_MAX_STRING_LENGTH = 80; +function htmlTreeAsString(elem, options4 = {}) { + if (!elem) { + return "<unknown>"; + } + try { + let currentElem = elem; + const MAX_TRAVERSE_HEIGHT = 5; + const out = []; + let height = 0; + let len = 0; + const separator = " > "; + const sepLength = separator.length; + let nextStr; + const keyAttrs = Array.isArray(options4) ? options4 : options4.keyAttrs; + const maxStringLength = !Array.isArray(options4) && options4.maxStringLength || DEFAULT_MAX_STRING_LENGTH; + while (currentElem && height++ < MAX_TRAVERSE_HEIGHT) { + nextStr = _htmlElementAsString(currentElem, keyAttrs); + if (nextStr === "html" || height > 1 && len + out.length * sepLength + nextStr.length >= maxStringLength) { + break; + } + out.push(nextStr); + len += nextStr.length; + currentElem = currentElem.parentNode; + } + return out.reverse().join(separator); + } catch (_oO) { + return "<unknown>"; + } +} +__name(htmlTreeAsString, "htmlTreeAsString"); +function _htmlElementAsString(el, keyAttrs) { + const elem = el; + const out = []; + if (!elem || !elem.tagName) { + return ""; + } + if (WINDOW$8.HTMLElement) { + if (elem instanceof HTMLElement && elem.dataset) { + if (elem.dataset["sentryComponent"]) { + return elem.dataset["sentryComponent"]; + } + if (elem.dataset["sentryElement"]) { + return elem.dataset["sentryElement"]; + } + } + } + out.push(elem.tagName.toLowerCase()); + const keyAttrPairs = keyAttrs && keyAttrs.length ? keyAttrs.filter((keyAttr) => elem.getAttribute(keyAttr)).map((keyAttr) => [keyAttr, elem.getAttribute(keyAttr)]) : null; + if (keyAttrPairs && keyAttrPairs.length) { + keyAttrPairs.forEach((keyAttrPair) => { + out.push(`[${keyAttrPair[0]}="${keyAttrPair[1]}"]`); + }); + } else { + if (elem.id) { + out.push(`#${elem.id}`); + } + const className = elem.className; + if (className && isString$8(className)) { + const classes2 = className.split(/\s+/); + for (const c2 of classes2) { + out.push(`.${c2}`); + } + } + } + const allowedAttrs = ["aria-label", "type", "name", "title", "alt"]; + for (const k2 of allowedAttrs) { + const attr = elem.getAttribute(k2); + if (attr) { + out.push(`[${k2}="${attr}"]`); + } + } + return out.join(""); +} +__name(_htmlElementAsString, "_htmlElementAsString"); +function getLocationHref() { + try { + return WINDOW$8.document.location.href; + } catch (oO) { + return ""; + } +} +__name(getLocationHref, "getLocationHref"); +function getDomElement(selector) { + if (WINDOW$8.document && WINDOW$8.document.querySelector) { + return WINDOW$8.document.querySelector(selector); + } + return null; +} +__name(getDomElement, "getDomElement"); +function getComponentName$1(elem) { + if (!WINDOW$8.HTMLElement) { + return null; + } + let currentElem = elem; + const MAX_TRAVERSE_HEIGHT = 5; + for (let i2 = 0; i2 < MAX_TRAVERSE_HEIGHT; i2++) { + if (!currentElem) { + return null; + } + if (currentElem instanceof HTMLElement) { + if (currentElem.dataset["sentryComponent"]) { + return currentElem.dataset["sentryComponent"]; + } + if (currentElem.dataset["sentryElement"]) { + return currentElem.dataset["sentryElement"]; + } + } + currentElem = currentElem.parentNode; + } + return null; +} +__name(getComponentName$1, "getComponentName$1"); +function truncate(str, max = 0) { + if (typeof str !== "string" || max === 0) { + return str; + } + return str.length <= max ? str : `${str.slice(0, max)}...`; +} +__name(truncate, "truncate"); +function snipLine(line, colno) { + let newLine = line; + const lineLength = newLine.length; + if (lineLength <= 150) { + return newLine; + } + if (colno > lineLength) { + colno = lineLength; + } + let start2 = Math.max(colno - 60, 0); + if (start2 < 5) { + start2 = 0; + } + let end = Math.min(start2 + 140, lineLength); + if (end > lineLength - 5) { + end = lineLength; + } + if (end === lineLength) { + start2 = Math.max(end - 140, 0); + } + newLine = newLine.slice(start2, end); + if (start2 > 0) { + newLine = `'{snip} ${newLine}`; + } + if (end < lineLength) { + newLine += " {snip}"; + } + return newLine; +} +__name(snipLine, "snipLine"); +function safeJoin(input, delimiter2) { + if (!Array.isArray(input)) { + return ""; + } + const output = []; + for (let i2 = 0; i2 < input.length; i2++) { + const value4 = input[i2]; + try { + if (isVueViewModel(value4)) { + output.push("[VueViewModel]"); + } else { + output.push(String(value4)); + } + } catch (e2) { + output.push("[value cannot be serialized]"); + } + } + return output.join(delimiter2); +} +__name(safeJoin, "safeJoin"); +function isMatchingPattern(value4, pattern, requireExactStringMatch = false) { + if (!isString$8(value4)) { + return false; + } + if (isRegExp$5(pattern)) { + return pattern.test(value4); + } + if (isString$8(pattern)) { + return requireExactStringMatch ? value4 === pattern : value4.includes(pattern); + } + return false; +} +__name(isMatchingPattern, "isMatchingPattern"); +function stringMatchesSomePattern(testString, patterns = [], requireExactStringMatch = false) { + return patterns.some((pattern) => isMatchingPattern(testString, pattern, requireExactStringMatch)); +} +__name(stringMatchesSomePattern, "stringMatchesSomePattern"); +function fill(source, name2, replacementFactory) { + if (!(name2 in source)) { + return; + } + const original = source[name2]; + const wrapped = replacementFactory(original); + if (typeof wrapped === "function") { + markFunctionWrapped(wrapped, original); + } + try { + source[name2] = wrapped; + } catch (e2) { + DEBUG_BUILD$5 && logger$2.log(`Failed to replace method "${name2}" in object`, source); + } +} +__name(fill, "fill"); +function addNonEnumerableProperty(obj, name2, value4) { + try { + Object.defineProperty(obj, name2, { + // enumerable: false, // the default, so we can save on bundle size by not explicitly setting it + value: value4, + writable: true, + configurable: true + }); + } catch (o_O) { + DEBUG_BUILD$5 && logger$2.log(`Failed to add non-enumerable property "${name2}" to object`, obj); + } +} +__name(addNonEnumerableProperty, "addNonEnumerableProperty"); +function markFunctionWrapped(wrapped, original) { + try { + const proto = original.prototype || {}; + wrapped.prototype = original.prototype = proto; + addNonEnumerableProperty(wrapped, "__sentry_original__", original); + } catch (o_O) { + } +} +__name(markFunctionWrapped, "markFunctionWrapped"); +function getOriginalFunction(func) { + return func.__sentry_original__; +} +__name(getOriginalFunction, "getOriginalFunction"); +function urlEncode(object) { + return Object.entries(object).map(([key, value4]) => `${encodeURIComponent(key)}=${encodeURIComponent(value4)}`).join("&"); +} +__name(urlEncode, "urlEncode"); +function convertToPlainObject(value4) { + if (isError(value4)) { + return { + message: value4.message, + name: value4.name, + stack: value4.stack, + ...getOwnProperties(value4) + }; + } else if (isEvent(value4)) { + const newObj = { + type: value4.type, + target: serializeEventTarget(value4.target), + currentTarget: serializeEventTarget(value4.currentTarget), + ...getOwnProperties(value4) + }; + if (typeof CustomEvent !== "undefined" && isInstanceOf(value4, CustomEvent)) { + newObj.detail = value4.detail; + } + return newObj; + } else { + return value4; + } +} +__name(convertToPlainObject, "convertToPlainObject"); +function serializeEventTarget(target) { + try { + return isElement$3(target) ? htmlTreeAsString(target) : Object.prototype.toString.call(target); + } catch (_oO) { + return "<unknown>"; + } +} +__name(serializeEventTarget, "serializeEventTarget"); +function getOwnProperties(obj) { + if (typeof obj === "object" && obj !== null) { + const extractedProps = {}; + for (const property in obj) { + if (Object.prototype.hasOwnProperty.call(obj, property)) { + extractedProps[property] = obj[property]; + } + } + return extractedProps; + } else { + return {}; + } +} +__name(getOwnProperties, "getOwnProperties"); +function extractExceptionKeysForMessage(exception, maxLength = 40) { + const keys2 = Object.keys(convertToPlainObject(exception)); + keys2.sort(); + const firstKey = keys2[0]; + if (!firstKey) { + return "[object has no keys]"; + } + if (firstKey.length >= maxLength) { + return truncate(firstKey, maxLength); + } + for (let includedKeys = keys2.length; includedKeys > 0; includedKeys--) { + const serialized = keys2.slice(0, includedKeys).join(", "); + if (serialized.length > maxLength) { + continue; + } + if (includedKeys === keys2.length) { + return serialized; + } + return truncate(serialized, maxLength); + } + return ""; +} +__name(extractExceptionKeysForMessage, "extractExceptionKeysForMessage"); +function dropUndefinedKeys(inputValue) { + const memoizationMap = /* @__PURE__ */ new Map(); + return _dropUndefinedKeys(inputValue, memoizationMap); +} +__name(dropUndefinedKeys, "dropUndefinedKeys"); +function _dropUndefinedKeys(inputValue, memoizationMap) { + if (isPojo(inputValue)) { + const memoVal = memoizationMap.get(inputValue); + if (memoVal !== void 0) { + return memoVal; + } + const returnValue = {}; + memoizationMap.set(inputValue, returnValue); + for (const key of Object.getOwnPropertyNames(inputValue)) { + if (typeof inputValue[key] !== "undefined") { + returnValue[key] = _dropUndefinedKeys(inputValue[key], memoizationMap); + } + } + return returnValue; + } + if (Array.isArray(inputValue)) { + const memoVal = memoizationMap.get(inputValue); + if (memoVal !== void 0) { + return memoVal; + } + const returnValue = []; + memoizationMap.set(inputValue, returnValue); + inputValue.forEach((item3) => { + returnValue.push(_dropUndefinedKeys(item3, memoizationMap)); + }); + return returnValue; + } + return inputValue; +} +__name(_dropUndefinedKeys, "_dropUndefinedKeys"); +function isPojo(input) { + if (!isPlainObject$5(input)) { + return false; + } + try { + const name2 = Object.getPrototypeOf(input).constructor.name; + return !name2 || name2 === "Object"; + } catch (e2) { + return true; + } +} +__name(isPojo, "isPojo"); +function objectify(wat) { + let objectified; + switch (true) { + case wat == void 0: + objectified = new String(wat); + break; + case (typeof wat === "symbol" || typeof wat === "bigint"): + objectified = Object(wat); + break; + case isPrimitive(wat): + objectified = new wat.constructor(wat); + break; + default: + objectified = wat; + break; + } + return objectified; +} +__name(objectify, "objectify"); +const ONE_SECOND_IN_MS = 1e3; +function dateTimestampInSeconds() { + return Date.now() / ONE_SECOND_IN_MS; +} +__name(dateTimestampInSeconds, "dateTimestampInSeconds"); +function createUnixTimestampInSecondsFunc() { + const { performance: performance2 } = GLOBAL_OBJ; + if (!performance2 || !performance2.now) { + return dateTimestampInSeconds; + } + const approxStartingTimeOrigin = Date.now() - performance2.now(); + const timeOrigin = performance2.timeOrigin == void 0 ? approxStartingTimeOrigin : performance2.timeOrigin; + return () => { + return (timeOrigin + performance2.now()) / ONE_SECOND_IN_MS; + }; +} +__name(createUnixTimestampInSecondsFunc, "createUnixTimestampInSecondsFunc"); +const timestampInSeconds = createUnixTimestampInSecondsFunc(); +let _browserPerformanceTimeOriginMode; +const browserPerformanceTimeOrigin = (() => { + const { performance: performance2 } = GLOBAL_OBJ; + if (!performance2 || !performance2.now) { + _browserPerformanceTimeOriginMode = "none"; + return void 0; + } + const threshold = 3600 * 1e3; + const performanceNow = performance2.now(); + const dateNow = Date.now(); + const timeOriginDelta = performance2.timeOrigin ? Math.abs(performance2.timeOrigin + performanceNow - dateNow) : threshold; + const timeOriginIsReliable = timeOriginDelta < threshold; + const navigationStart = performance2.timing && performance2.timing.navigationStart; + const hasNavigationStart = typeof navigationStart === "number"; + const navigationStartDelta = hasNavigationStart ? Math.abs(navigationStart + performanceNow - dateNow) : threshold; + const navigationStartIsReliable = navigationStartDelta < threshold; + if (timeOriginIsReliable || navigationStartIsReliable) { + if (timeOriginDelta <= navigationStartDelta) { + _browserPerformanceTimeOriginMode = "timeOrigin"; + return performance2.timeOrigin; + } else { + _browserPerformanceTimeOriginMode = "navigationStart"; + return navigationStart; + } + } + _browserPerformanceTimeOriginMode = "dateNow"; + return dateNow; +})(); +function uuid4() { + const gbl = GLOBAL_OBJ; + const crypto = gbl.crypto || gbl.msCrypto; + let getRandomByte = /* @__PURE__ */ __name(() => Math.random() * 16, "getRandomByte"); + try { + if (crypto && crypto.randomUUID) { + return crypto.randomUUID().replace(/-/g, ""); + } + if (crypto && crypto.getRandomValues) { + getRandomByte = /* @__PURE__ */ __name(() => { + const typedArray = new Uint8Array(1); + crypto.getRandomValues(typedArray); + return typedArray[0]; + }, "getRandomByte"); + } + } catch (_2) { + } + return ("10000000100040008000" + 1e11).replace( + /[018]/g, + (c2) => ( + // eslint-disable-next-line no-bitwise + (c2 ^ (getRandomByte() & 15) >> c2 / 4).toString(16) + ) + ); +} +__name(uuid4, "uuid4"); +function getFirstException(event) { + return event.exception && event.exception.values ? event.exception.values[0] : void 0; +} +__name(getFirstException, "getFirstException"); +function getEventDescription(event) { + const { message: message3, event_id: eventId } = event; + if (message3) { + return message3; + } + const firstException = getFirstException(event); + if (firstException) { + if (firstException.type && firstException.value) { + return `${firstException.type}: ${firstException.value}`; + } + return firstException.type || firstException.value || eventId || "<unknown>"; + } + return eventId || "<unknown>"; +} +__name(getEventDescription, "getEventDescription"); +function addExceptionTypeValue(event, value4, type) { + const exception = event.exception = event.exception || {}; + const values = exception.values = exception.values || []; + const firstException = values[0] = values[0] || {}; + if (!firstException.value) { + firstException.value = value4 || ""; + } + if (!firstException.type) { + firstException.type = type || "Error"; + } +} +__name(addExceptionTypeValue, "addExceptionTypeValue"); +function addExceptionMechanism(event, newMechanism) { + const firstException = getFirstException(event); + if (!firstException) { + return; + } + const defaultMechanism = { type: "generic", handled: true }; + const currentMechanism = firstException.mechanism; + firstException.mechanism = { ...defaultMechanism, ...currentMechanism, ...newMechanism }; + if (newMechanism && "data" in newMechanism) { + const mergedData = { ...currentMechanism && currentMechanism.data, ...newMechanism.data }; + firstException.mechanism.data = mergedData; + } +} +__name(addExceptionMechanism, "addExceptionMechanism"); +const SEMVER_REGEXP = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/; +function _parseInt(input) { + return parseInt(input || "", 10); +} +__name(_parseInt, "_parseInt"); +function parseSemver(input) { + const match2 = input.match(SEMVER_REGEXP) || []; + const major = _parseInt(match2[1]); + const minor = _parseInt(match2[2]); + const patch2 = _parseInt(match2[3]); + return { + buildmetadata: match2[5], + major: isNaN(major) ? void 0 : major, + minor: isNaN(minor) ? void 0 : minor, + patch: isNaN(patch2) ? void 0 : patch2, + prerelease: match2[4] + }; +} +__name(parseSemver, "parseSemver"); +function addContextToFrame(lines, frame, linesOfContext = 5) { + if (frame.lineno === void 0) { + return; + } + const maxLines = lines.length; + const sourceLine = Math.max(Math.min(maxLines - 1, frame.lineno - 1), 0); + frame.pre_context = lines.slice(Math.max(0, sourceLine - linesOfContext), sourceLine).map((line) => snipLine(line, 0)); + const lineIndex = Math.min(maxLines - 1, sourceLine); + frame.context_line = snipLine(lines[lineIndex], frame.colno || 0); + frame.post_context = lines.slice(Math.min(sourceLine + 1, maxLines), sourceLine + 1 + linesOfContext).map((line) => snipLine(line, 0)); +} +__name(addContextToFrame, "addContextToFrame"); +function checkOrSetAlreadyCaught(exception) { + if (isAlreadyCaptured(exception)) { + return true; + } + try { + addNonEnumerableProperty(exception, "__sentry_captured__", true); + } catch (err) { + } + return false; +} +__name(checkOrSetAlreadyCaught, "checkOrSetAlreadyCaught"); +function isAlreadyCaptured(exception) { + try { + return exception.__sentry_captured__; + } catch (e2) { + } +} +__name(isAlreadyCaptured, "isAlreadyCaptured"); +function arrayify(maybeArray) { + return Array.isArray(maybeArray) ? maybeArray : [maybeArray]; +} +__name(arrayify, "arrayify"); +var States; +(function(States2) { + const PENDING = 0; + States2[States2["PENDING"] = PENDING] = "PENDING"; + const RESOLVED = 1; + States2[States2["RESOLVED"] = RESOLVED] = "RESOLVED"; + const REJECTED = 2; + States2[States2["REJECTED"] = REJECTED] = "REJECTED"; +})(States || (States = {})); +function resolvedSyncPromise(value4) { + return new SyncPromise((resolve2) => { + resolve2(value4); + }); +} +__name(resolvedSyncPromise, "resolvedSyncPromise"); +function rejectedSyncPromise(reason) { + return new SyncPromise((_2, reject3) => { + reject3(reason); + }); +} +__name(rejectedSyncPromise, "rejectedSyncPromise"); +class SyncPromise { + static { + __name(this, "SyncPromise"); + } + constructor(executor) { + SyncPromise.prototype.__init.call(this); + SyncPromise.prototype.__init2.call(this); + SyncPromise.prototype.__init3.call(this); + SyncPromise.prototype.__init4.call(this); + this._state = States.PENDING; + this._handlers = []; + try { + executor(this._resolve, this._reject); + } catch (e2) { + this._reject(e2); + } + } + /** JSDoc */ + then(onfulfilled, onrejected) { + return new SyncPromise((resolve2, reject3) => { + this._handlers.push([ + false, + (result) => { + if (!onfulfilled) { + resolve2(result); + } else { + try { + resolve2(onfulfilled(result)); + } catch (e2) { + reject3(e2); + } + } + }, + (reason) => { + if (!onrejected) { + reject3(reason); + } else { + try { + resolve2(onrejected(reason)); + } catch (e2) { + reject3(e2); + } + } + } + ]); + this._executeHandlers(); + }); + } + /** JSDoc */ + catch(onrejected) { + return this.then((val) => val, onrejected); + } + /** JSDoc */ + finally(onfinally) { + return new SyncPromise((resolve2, reject3) => { + let val; + let isRejected; + return this.then( + (value4) => { + isRejected = false; + val = value4; + if (onfinally) { + onfinally(); + } + }, + (reason) => { + isRejected = true; + val = reason; + if (onfinally) { + onfinally(); + } + } + ).then(() => { + if (isRejected) { + reject3(val); + return; + } + resolve2(val); + }); + }); + } + /** JSDoc */ + __init() { + this._resolve = (value4) => { + this._setResult(States.RESOLVED, value4); + }; + } + /** JSDoc */ + __init2() { + this._reject = (reason) => { + this._setResult(States.REJECTED, reason); + }; + } + /** JSDoc */ + __init3() { + this._setResult = (state, value4) => { + if (this._state !== States.PENDING) { + return; + } + if (isThenable$1(value4)) { + void value4.then(this._resolve, this._reject); + return; + } + this._state = state; + this._value = value4; + this._executeHandlers(); + }; + } + /** JSDoc */ + __init4() { + this._executeHandlers = () => { + if (this._state === States.PENDING) { + return; + } + const cachedHandlers = this._handlers.slice(); + this._handlers = []; + cachedHandlers.forEach((handler6) => { + if (handler6[0]) { + return; + } + if (this._state === States.RESOLVED) { + handler6[1](this._value); + } + if (this._state === States.REJECTED) { + handler6[2](this._value); + } + handler6[0] = true; + }); + }; + } +} +function makeSession$1(context) { + const startingTime = timestampInSeconds(); + const session = { + sid: uuid4(), + init: true, + timestamp: startingTime, + started: startingTime, + duration: 0, + status: "ok", + errors: 0, + ignoreDuration: false, + toJSON: /* @__PURE__ */ __name(() => sessionToJSON(session), "toJSON") + }; + if (context) { + updateSession(session, context); + } + return session; +} +__name(makeSession$1, "makeSession$1"); +function updateSession(session, context = {}) { + if (context.user) { + if (!session.ipAddress && context.user.ip_address) { + session.ipAddress = context.user.ip_address; + } + if (!session.did && !context.did) { + session.did = context.user.id || context.user.email || context.user.username; + } + } + session.timestamp = context.timestamp || timestampInSeconds(); + if (context.abnormal_mechanism) { + session.abnormal_mechanism = context.abnormal_mechanism; + } + if (context.ignoreDuration) { + session.ignoreDuration = context.ignoreDuration; + } + if (context.sid) { + session.sid = context.sid.length === 32 ? context.sid : uuid4(); + } + if (context.init !== void 0) { + session.init = context.init; + } + if (!session.did && context.did) { + session.did = `${context.did}`; + } + if (typeof context.started === "number") { + session.started = context.started; + } + if (session.ignoreDuration) { + session.duration = void 0; + } else if (typeof context.duration === "number") { + session.duration = context.duration; + } else { + const duration = session.timestamp - session.started; + session.duration = duration >= 0 ? duration : 0; + } + if (context.release) { + session.release = context.release; + } + if (context.environment) { + session.environment = context.environment; + } + if (!session.ipAddress && context.ipAddress) { + session.ipAddress = context.ipAddress; + } + if (!session.userAgent && context.userAgent) { + session.userAgent = context.userAgent; + } + if (typeof context.errors === "number") { + session.errors = context.errors; + } + if (context.status) { + session.status = context.status; + } +} +__name(updateSession, "updateSession"); +function closeSession(session, status) { + let context = {}; + if (status) { + context = { status }; + } else if (session.status === "ok") { + context = { status: "exited" }; + } + updateSession(session, context); +} +__name(closeSession, "closeSession"); +function sessionToJSON(session) { + return dropUndefinedKeys({ + sid: `${session.sid}`, + init: session.init, + // Make sure that sec is converted to ms for date constructor + started: new Date(session.started * 1e3).toISOString(), + timestamp: new Date(session.timestamp * 1e3).toISOString(), + status: session.status, + errors: session.errors, + did: typeof session.did === "number" || typeof session.did === "string" ? `${session.did}` : void 0, + duration: session.duration, + abnormal_mechanism: session.abnormal_mechanism, + attrs: { + release: session.release, + environment: session.environment, + ip_address: session.ipAddress, + user_agent: session.userAgent + } + }); +} +__name(sessionToJSON, "sessionToJSON"); +function generatePropagationContext() { + return { + traceId: generateTraceId(), + spanId: generateSpanId() + }; +} +__name(generatePropagationContext, "generatePropagationContext"); +function generateTraceId() { + return uuid4(); +} +__name(generateTraceId, "generateTraceId"); +function generateSpanId() { + return uuid4().substring(16); +} +__name(generateSpanId, "generateSpanId"); +function merge$1(initialObj, mergeObj, levels = 2) { + if (!mergeObj || typeof mergeObj !== "object" || levels <= 0) { + return mergeObj; + } + if (initialObj && mergeObj && Object.keys(mergeObj).length === 0) { + return initialObj; + } + const output = { ...initialObj }; + for (const key in mergeObj) { + if (Object.prototype.hasOwnProperty.call(mergeObj, key)) { + output[key] = merge$1(output[key], mergeObj[key], levels - 1); + } + } + return output; +} +__name(merge$1, "merge$1"); +const SCOPE_SPAN_FIELD = "_sentrySpan"; +function _setSpanForScope(scope, span) { + if (span) { + addNonEnumerableProperty(scope, SCOPE_SPAN_FIELD, span); + } else { + delete scope[SCOPE_SPAN_FIELD]; + } +} +__name(_setSpanForScope, "_setSpanForScope"); +function _getSpanForScope(scope) { + return scope[SCOPE_SPAN_FIELD]; +} +__name(_getSpanForScope, "_getSpanForScope"); +const DEFAULT_MAX_BREADCRUMBS = 100; +class ScopeClass { + static { + __name(this, "ScopeClass"); + } + /** Flag if notifying is happening. */ + /** Callback for client to receive scope changes. */ + /** Callback list that will be called during event processing. */ + /** Array of breadcrumbs. */ + /** User */ + /** Tags */ + /** Extra */ + /** Contexts */ + /** Attachments */ + /** Propagation Context for distributed tracing */ + /** + * A place to stash data which is needed at some point in the SDK's event processing pipeline but which shouldn't get + * sent to Sentry + */ + /** Fingerprint */ + /** Severity */ + /** + * Transaction Name + * + * IMPORTANT: The transaction name on the scope has nothing to do with root spans/transaction objects. + * It's purpose is to assign a transaction to the scope that's added to non-transaction events. + */ + /** Session */ + /** Request Mode Session Status */ + // eslint-disable-next-line deprecation/deprecation + /** The client on this scope */ + /** Contains the last event id of a captured event. */ + // NOTE: Any field which gets added here should get added not only to the constructor but also to the `clone` method. + constructor() { + this._notifyingListeners = false; + this._scopeListeners = []; + this._eventProcessors = []; + this._breadcrumbs = []; + this._attachments = []; + this._user = {}; + this._tags = {}; + this._extra = {}; + this._contexts = {}; + this._sdkProcessingMetadata = {}; + this._propagationContext = { + traceId: generateTraceId(), + spanId: generateSpanId() + }; + } + /** + * @inheritDoc + */ + clone() { + const newScope = new ScopeClass(); + newScope._breadcrumbs = [...this._breadcrumbs]; + newScope._tags = { ...this._tags }; + newScope._extra = { ...this._extra }; + newScope._contexts = { ...this._contexts }; + if (this._contexts.flags) { + newScope._contexts.flags = { + values: [...this._contexts.flags.values] + }; + } + newScope._user = this._user; + newScope._level = this._level; + newScope._session = this._session; + newScope._transactionName = this._transactionName; + newScope._fingerprint = this._fingerprint; + newScope._eventProcessors = [...this._eventProcessors]; + newScope._requestSession = this._requestSession; + newScope._attachments = [...this._attachments]; + newScope._sdkProcessingMetadata = { ...this._sdkProcessingMetadata }; + newScope._propagationContext = { ...this._propagationContext }; + newScope._client = this._client; + newScope._lastEventId = this._lastEventId; + _setSpanForScope(newScope, _getSpanForScope(this)); + return newScope; + } + /** + * @inheritDoc + */ + setClient(client) { + this._client = client; + } + /** + * @inheritDoc + */ + setLastEventId(lastEventId2) { + this._lastEventId = lastEventId2; + } + /** + * @inheritDoc + */ + getClient() { + return this._client; + } + /** + * @inheritDoc + */ + lastEventId() { + return this._lastEventId; + } + /** + * @inheritDoc + */ + addScopeListener(callback) { + this._scopeListeners.push(callback); + } + /** + * @inheritDoc + */ + addEventProcessor(callback) { + this._eventProcessors.push(callback); + return this; + } + /** + * @inheritDoc + */ + setUser(user) { + this._user = user || { + email: void 0, + id: void 0, + ip_address: void 0, + username: void 0 + }; + if (this._session) { + updateSession(this._session, { user }); + } + this._notifyScopeListeners(); + return this; + } + /** + * @inheritDoc + */ + getUser() { + return this._user; + } + /** + * @inheritDoc + */ + // eslint-disable-next-line deprecation/deprecation + getRequestSession() { + return this._requestSession; + } + /** + * @inheritDoc + */ + // eslint-disable-next-line deprecation/deprecation + setRequestSession(requestSession) { + this._requestSession = requestSession; + return this; + } + /** + * @inheritDoc + */ + setTags(tags) { + this._tags = { + ...this._tags, + ...tags + }; + this._notifyScopeListeners(); + return this; + } + /** + * @inheritDoc + */ + setTag(key, value4) { + this._tags = { ...this._tags, [key]: value4 }; + this._notifyScopeListeners(); + return this; + } + /** + * @inheritDoc + */ + setExtras(extras) { + this._extra = { + ...this._extra, + ...extras + }; + this._notifyScopeListeners(); + return this; + } + /** + * @inheritDoc + */ + setExtra(key, extra) { + this._extra = { ...this._extra, [key]: extra }; + this._notifyScopeListeners(); + return this; + } + /** + * @inheritDoc + */ + setFingerprint(fingerprint) { + this._fingerprint = fingerprint; + this._notifyScopeListeners(); + return this; + } + /** + * @inheritDoc + */ + setLevel(level) { + this._level = level; + this._notifyScopeListeners(); + return this; + } + /** + * @inheritDoc + */ + setTransactionName(name2) { + this._transactionName = name2; + this._notifyScopeListeners(); + return this; + } + /** + * @inheritDoc + */ + setContext(key, context) { + if (context === null) { + delete this._contexts[key]; + } else { + this._contexts[key] = context; + } + this._notifyScopeListeners(); + return this; + } + /** + * @inheritDoc + */ + setSession(session) { + if (!session) { + delete this._session; + } else { + this._session = session; + } + this._notifyScopeListeners(); + return this; + } + /** + * @inheritDoc + */ + getSession() { + return this._session; + } + /** + * @inheritDoc + */ + update(captureContext) { + if (!captureContext) { + return this; + } + const scopeToMerge = typeof captureContext === "function" ? captureContext(this) : captureContext; + const [scopeInstance, requestSession] = scopeToMerge instanceof Scope ? ( + // eslint-disable-next-line deprecation/deprecation + [scopeToMerge.getScopeData(), scopeToMerge.getRequestSession()] + ) : isPlainObject$5(scopeToMerge) ? [captureContext, captureContext.requestSession] : []; + const { tags, extra, user, contexts, level, fingerprint = [], propagationContext } = scopeInstance || {}; + this._tags = { ...this._tags, ...tags }; + this._extra = { ...this._extra, ...extra }; + this._contexts = { ...this._contexts, ...contexts }; + if (user && Object.keys(user).length) { + this._user = user; + } + if (level) { + this._level = level; + } + if (fingerprint.length) { + this._fingerprint = fingerprint; + } + if (propagationContext) { + this._propagationContext = propagationContext; + } + if (requestSession) { + this._requestSession = requestSession; + } + return this; + } + /** + * @inheritDoc + */ + clear() { + this._breadcrumbs = []; + this._tags = {}; + this._extra = {}; + this._user = {}; + this._contexts = {}; + this._level = void 0; + this._transactionName = void 0; + this._fingerprint = void 0; + this._requestSession = void 0; + this._session = void 0; + _setSpanForScope(this, void 0); + this._attachments = []; + this.setPropagationContext({ traceId: generateTraceId() }); + this._notifyScopeListeners(); + return this; + } + /** + * @inheritDoc + */ + addBreadcrumb(breadcrumb, maxBreadcrumbs) { + const maxCrumbs = typeof maxBreadcrumbs === "number" ? maxBreadcrumbs : DEFAULT_MAX_BREADCRUMBS; + if (maxCrumbs <= 0) { + return this; + } + const mergedBreadcrumb = { + timestamp: dateTimestampInSeconds(), + ...breadcrumb + }; + const breadcrumbs = this._breadcrumbs; + breadcrumbs.push(mergedBreadcrumb); + this._breadcrumbs = breadcrumbs.length > maxCrumbs ? breadcrumbs.slice(-maxCrumbs) : breadcrumbs; + this._notifyScopeListeners(); + return this; + } + /** + * @inheritDoc + */ + getLastBreadcrumb() { + return this._breadcrumbs[this._breadcrumbs.length - 1]; + } + /** + * @inheritDoc + */ + clearBreadcrumbs() { + this._breadcrumbs = []; + this._notifyScopeListeners(); + return this; + } + /** + * @inheritDoc + */ + addAttachment(attachment) { + this._attachments.push(attachment); + return this; + } + /** + * @inheritDoc + */ + clearAttachments() { + this._attachments = []; + return this; + } + /** @inheritDoc */ + getScopeData() { + return { + breadcrumbs: this._breadcrumbs, + attachments: this._attachments, + contexts: this._contexts, + tags: this._tags, + extra: this._extra, + user: this._user, + level: this._level, + fingerprint: this._fingerprint || [], + eventProcessors: this._eventProcessors, + propagationContext: this._propagationContext, + sdkProcessingMetadata: this._sdkProcessingMetadata, + transactionName: this._transactionName, + span: _getSpanForScope(this) + }; + } + /** + * @inheritDoc + */ + setSDKProcessingMetadata(newData) { + this._sdkProcessingMetadata = merge$1(this._sdkProcessingMetadata, newData, 2); + return this; + } + /** + * @inheritDoc + */ + setPropagationContext(context) { + this._propagationContext = { + // eslint-disable-next-line deprecation/deprecation + spanId: generateSpanId(), + ...context + }; + return this; + } + /** + * @inheritDoc + */ + getPropagationContext() { + return this._propagationContext; + } + /** + * @inheritDoc + */ + captureException(exception, hint) { + const eventId = hint && hint.event_id ? hint.event_id : uuid4(); + if (!this._client) { + logger$2.warn("No client configured on scope - will not capture exception!"); + return eventId; + } + const syntheticException = new Error("Sentry syntheticException"); + this._client.captureException( + exception, + { + originalException: exception, + syntheticException, + ...hint, + event_id: eventId + }, + this + ); + return eventId; + } + /** + * @inheritDoc + */ + captureMessage(message3, level, hint) { + const eventId = hint && hint.event_id ? hint.event_id : uuid4(); + if (!this._client) { + logger$2.warn("No client configured on scope - will not capture message!"); + return eventId; + } + const syntheticException = new Error(message3); + this._client.captureMessage( + message3, + level, + { + originalException: message3, + syntheticException, + ...hint, + event_id: eventId + }, + this + ); + return eventId; + } + /** + * @inheritDoc + */ + captureEvent(event, hint) { + const eventId = hint && hint.event_id ? hint.event_id : uuid4(); + if (!this._client) { + logger$2.warn("No client configured on scope - will not capture event!"); + return eventId; + } + this._client.captureEvent(event, { ...hint, event_id: eventId }, this); + return eventId; + } + /** + * This will be called on every set call. + */ + _notifyScopeListeners() { + if (!this._notifyingListeners) { + this._notifyingListeners = true; + this._scopeListeners.forEach((callback) => { + callback(this); + }); + this._notifyingListeners = false; + } + } +} +const Scope = ScopeClass; +function getDefaultCurrentScope() { + return getGlobalSingleton("defaultCurrentScope", () => new Scope()); +} +__name(getDefaultCurrentScope, "getDefaultCurrentScope"); +function getDefaultIsolationScope() { + return getGlobalSingleton("defaultIsolationScope", () => new Scope()); +} +__name(getDefaultIsolationScope, "getDefaultIsolationScope"); +class AsyncContextStack { + static { + __name(this, "AsyncContextStack"); + } + constructor(scope, isolationScope) { + let assignedScope; + if (!scope) { + assignedScope = new Scope(); + } else { + assignedScope = scope; + } + let assignedIsolationScope; + if (!isolationScope) { + assignedIsolationScope = new Scope(); + } else { + assignedIsolationScope = isolationScope; + } + this._stack = [{ scope: assignedScope }]; + this._isolationScope = assignedIsolationScope; + } + /** + * Fork a scope for the stack. + */ + withScope(callback) { + const scope = this._pushScope(); + let maybePromiseResult; + try { + maybePromiseResult = callback(scope); + } catch (e2) { + this._popScope(); + throw e2; + } + if (isThenable$1(maybePromiseResult)) { + return maybePromiseResult.then( + (res) => { + this._popScope(); + return res; + }, + (e2) => { + this._popScope(); + throw e2; + } + ); + } + this._popScope(); + return maybePromiseResult; + } + /** + * Get the client of the stack. + */ + getClient() { + return this.getStackTop().client; + } + /** + * Returns the scope of the top stack. + */ + getScope() { + return this.getStackTop().scope; + } + /** + * Get the isolation scope for the stack. + */ + getIsolationScope() { + return this._isolationScope; + } + /** + * Returns the topmost scope layer in the order domain > local > process. + */ + getStackTop() { + return this._stack[this._stack.length - 1]; + } + /** + * Push a scope to the stack. + */ + _pushScope() { + const scope = this.getScope().clone(); + this._stack.push({ + client: this.getClient(), + scope + }); + return scope; + } + /** + * Pop a scope from the stack. + */ + _popScope() { + if (this._stack.length <= 1) return false; + return !!this._stack.pop(); + } +} +function getAsyncContextStack() { + const registry = getMainCarrier(); + const sentry = getSentryCarrier(registry); + return sentry.stack = sentry.stack || new AsyncContextStack(getDefaultCurrentScope(), getDefaultIsolationScope()); +} +__name(getAsyncContextStack, "getAsyncContextStack"); +function withScope$1(callback) { + return getAsyncContextStack().withScope(callback); +} +__name(withScope$1, "withScope$1"); +function withSetScope(scope, callback) { + const stack2 = getAsyncContextStack(); + return stack2.withScope(() => { + stack2.getStackTop().scope = scope; + return callback(scope); + }); +} +__name(withSetScope, "withSetScope"); +function withIsolationScope$1(callback) { + return getAsyncContextStack().withScope(() => { + return callback(getAsyncContextStack().getIsolationScope()); + }); +} +__name(withIsolationScope$1, "withIsolationScope$1"); +function getStackAsyncContextStrategy() { + return { + withIsolationScope: withIsolationScope$1, + withScope: withScope$1, + withSetScope, + withSetIsolationScope: /* @__PURE__ */ __name((_isolationScope, callback) => { + return withIsolationScope$1(callback); + }, "withSetIsolationScope"), + getCurrentScope: /* @__PURE__ */ __name(() => getAsyncContextStack().getScope(), "getCurrentScope"), + getIsolationScope: /* @__PURE__ */ __name(() => getAsyncContextStack().getIsolationScope(), "getIsolationScope") + }; +} +__name(getStackAsyncContextStrategy, "getStackAsyncContextStrategy"); +function setAsyncContextStrategy(strategy) { + const registry = getMainCarrier(); + const sentry = getSentryCarrier(registry); + sentry.acs = strategy; +} +__name(setAsyncContextStrategy, "setAsyncContextStrategy"); +function getAsyncContextStrategy(carrier) { + const sentry = getSentryCarrier(carrier); + if (sentry.acs) { + return sentry.acs; + } + return getStackAsyncContextStrategy(); +} +__name(getAsyncContextStrategy, "getAsyncContextStrategy"); +function getCurrentScope$1() { + const carrier = getMainCarrier(); + const acs = getAsyncContextStrategy(carrier); + return acs.getCurrentScope(); +} +__name(getCurrentScope$1, "getCurrentScope$1"); +function getIsolationScope() { + const carrier = getMainCarrier(); + const acs = getAsyncContextStrategy(carrier); + return acs.getIsolationScope(); +} +__name(getIsolationScope, "getIsolationScope"); +function getGlobalScope() { + return getGlobalSingleton("globalScope", () => new Scope()); +} +__name(getGlobalScope, "getGlobalScope"); +function withScope(...rest) { + const carrier = getMainCarrier(); + const acs = getAsyncContextStrategy(carrier); + if (rest.length === 2) { + const [scope, callback] = rest; + if (!scope) { + return acs.withScope(callback); + } + return acs.withSetScope(scope, callback); + } + return acs.withScope(rest[0]); +} +__name(withScope, "withScope"); +function withIsolationScope(...rest) { + const carrier = getMainCarrier(); + const acs = getAsyncContextStrategy(carrier); + if (rest.length === 2) { + const [isolationScope, callback] = rest; + if (!isolationScope) { + return acs.withIsolationScope(callback); + } + return acs.withSetIsolationScope(isolationScope, callback); + } + return acs.withIsolationScope(rest[0]); +} +__name(withIsolationScope, "withIsolationScope"); +function getClient() { + return getCurrentScope$1().getClient(); +} +__name(getClient, "getClient"); +function getTraceContextFromScope(scope) { + const propagationContext = scope.getPropagationContext(); + const { traceId, spanId, parentSpanId } = propagationContext; + const traceContext = dropUndefinedKeys({ + trace_id: traceId, + span_id: spanId, + parent_span_id: parentSpanId + }); + return traceContext; +} +__name(getTraceContextFromScope, "getTraceContextFromScope"); +const METRICS_SPAN_FIELD = "_sentryMetrics"; +function getMetricSummaryJsonForSpan(span) { + const storage = span[METRICS_SPAN_FIELD]; + if (!storage) { + return void 0; + } + const output = {}; + for (const [, [exportKey, summary]] of storage) { + const arr = output[exportKey] || (output[exportKey] = []); + arr.push(dropUndefinedKeys(summary)); + } + return output; +} +__name(getMetricSummaryJsonForSpan, "getMetricSummaryJsonForSpan"); +function updateMetricSummaryOnSpan(span, metricType, sanitizedName, value4, unit, tags, bucketKey) { + const existingStorage = span[METRICS_SPAN_FIELD]; + const storage = existingStorage || (span[METRICS_SPAN_FIELD] = /* @__PURE__ */ new Map()); + const exportKey = `${metricType}:${sanitizedName}@${unit}`; + const bucketItem = storage.get(bucketKey); + if (bucketItem) { + const [, summary] = bucketItem; + storage.set(bucketKey, [ + exportKey, + { + min: Math.min(summary.min, value4), + max: Math.max(summary.max, value4), + count: summary.count += 1, + sum: summary.sum += value4, + tags: summary.tags + } + ]); + } else { + storage.set(bucketKey, [ + exportKey, + { + min: value4, + max: value4, + count: 1, + sum: value4, + tags + } + ]); + } +} +__name(updateMetricSummaryOnSpan, "updateMetricSummaryOnSpan"); +const SEMANTIC_ATTRIBUTE_SENTRY_SOURCE = "sentry.source"; +const SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE = "sentry.sample_rate"; +const SEMANTIC_ATTRIBUTE_SENTRY_OP = "sentry.op"; +const SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN = "sentry.origin"; +const SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON = "sentry.idle_span_finish_reason"; +const SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT = "sentry.measurement_unit"; +const SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE = "sentry.measurement_value"; +const SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME = "sentry.custom_span_name"; +const SEMANTIC_ATTRIBUTE_PROFILE_ID = "sentry.profile_id"; +const SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME = "sentry.exclusive_time"; +const SEMANTIC_ATTRIBUTE_CACHE_HIT = "cache.hit"; +const SEMANTIC_ATTRIBUTE_CACHE_KEY = "cache.key"; +const SEMANTIC_ATTRIBUTE_CACHE_ITEM_SIZE = "cache.item_size"; +const SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD = "http.request.method"; +const SEMANTIC_ATTRIBUTE_URL_FULL = "url.full"; +const SPAN_STATUS_UNSET = 0; +const SPAN_STATUS_OK = 1; +const SPAN_STATUS_ERROR = 2; +function getSpanStatusFromHttpCode(httpStatus) { + if (httpStatus < 400 && httpStatus >= 100) { + return { code: SPAN_STATUS_OK }; + } + if (httpStatus >= 400 && httpStatus < 500) { + switch (httpStatus) { + case 401: + return { code: SPAN_STATUS_ERROR, message: "unauthenticated" }; + case 403: + return { code: SPAN_STATUS_ERROR, message: "permission_denied" }; + case 404: + return { code: SPAN_STATUS_ERROR, message: "not_found" }; + case 409: + return { code: SPAN_STATUS_ERROR, message: "already_exists" }; + case 413: + return { code: SPAN_STATUS_ERROR, message: "failed_precondition" }; + case 429: + return { code: SPAN_STATUS_ERROR, message: "resource_exhausted" }; + case 499: + return { code: SPAN_STATUS_ERROR, message: "cancelled" }; + default: + return { code: SPAN_STATUS_ERROR, message: "invalid_argument" }; + } + } + if (httpStatus >= 500 && httpStatus < 600) { + switch (httpStatus) { + case 501: + return { code: SPAN_STATUS_ERROR, message: "unimplemented" }; + case 503: + return { code: SPAN_STATUS_ERROR, message: "unavailable" }; + case 504: + return { code: SPAN_STATUS_ERROR, message: "deadline_exceeded" }; + default: + return { code: SPAN_STATUS_ERROR, message: "internal_error" }; + } + } + return { code: SPAN_STATUS_ERROR, message: "unknown_error" }; +} +__name(getSpanStatusFromHttpCode, "getSpanStatusFromHttpCode"); +function setHttpStatus(span, httpStatus) { + span.setAttribute("http.response.status_code", httpStatus); + const spanStatus = getSpanStatusFromHttpCode(httpStatus); + if (spanStatus.message !== "unknown_error") { + span.setStatus(spanStatus); + } +} +__name(setHttpStatus, "setHttpStatus"); +const BAGGAGE_HEADER_NAME = "baggage"; +const SENTRY_BAGGAGE_KEY_PREFIX = "sentry-"; +const SENTRY_BAGGAGE_KEY_PREFIX_REGEX = /^sentry-/; +const MAX_BAGGAGE_STRING_LENGTH = 8192; +function baggageHeaderToDynamicSamplingContext(baggageHeader) { + const baggageObject = parseBaggageHeader(baggageHeader); + if (!baggageObject) { + return void 0; + } + const dynamicSamplingContext = Object.entries(baggageObject).reduce((acc, [key, value4]) => { + if (key.match(SENTRY_BAGGAGE_KEY_PREFIX_REGEX)) { + const nonPrefixedKey = key.slice(SENTRY_BAGGAGE_KEY_PREFIX.length); + acc[nonPrefixedKey] = value4; + } + return acc; + }, {}); + if (Object.keys(dynamicSamplingContext).length > 0) { + return dynamicSamplingContext; + } else { + return void 0; + } +} +__name(baggageHeaderToDynamicSamplingContext, "baggageHeaderToDynamicSamplingContext"); +function dynamicSamplingContextToSentryBaggageHeader(dynamicSamplingContext) { + if (!dynamicSamplingContext) { + return void 0; + } + const sentryPrefixedDSC = Object.entries(dynamicSamplingContext).reduce( + (acc, [dscKey, dscValue]) => { + if (dscValue) { + acc[`${SENTRY_BAGGAGE_KEY_PREFIX}${dscKey}`] = dscValue; + } + return acc; + }, + {} + ); + return objectToBaggageHeader(sentryPrefixedDSC); +} +__name(dynamicSamplingContextToSentryBaggageHeader, "dynamicSamplingContextToSentryBaggageHeader"); +function parseBaggageHeader(baggageHeader) { + if (!baggageHeader || !isString$8(baggageHeader) && !Array.isArray(baggageHeader)) { + return void 0; + } + if (Array.isArray(baggageHeader)) { + return baggageHeader.reduce((acc, curr) => { + const currBaggageObject = baggageHeaderToObject(curr); + Object.entries(currBaggageObject).forEach(([key, value4]) => { + acc[key] = value4; + }); + return acc; + }, {}); + } + return baggageHeaderToObject(baggageHeader); +} +__name(parseBaggageHeader, "parseBaggageHeader"); +function baggageHeaderToObject(baggageHeader) { + return baggageHeader.split(",").map((baggageEntry) => baggageEntry.split("=").map((keyOrValue) => decodeURIComponent(keyOrValue.trim()))).reduce((acc, [key, value4]) => { + if (key && value4) { + acc[key] = value4; + } + return acc; + }, {}); +} +__name(baggageHeaderToObject, "baggageHeaderToObject"); +function objectToBaggageHeader(object) { + if (Object.keys(object).length === 0) { + return void 0; + } + return Object.entries(object).reduce((baggageHeader, [objectKey, objectValue], currentIndex) => { + const baggageEntry = `${encodeURIComponent(objectKey)}=${encodeURIComponent(objectValue)}`; + const newBaggageHeader = currentIndex === 0 ? baggageEntry : `${baggageHeader},${baggageEntry}`; + if (newBaggageHeader.length > MAX_BAGGAGE_STRING_LENGTH) { + DEBUG_BUILD$5 && logger$2.warn( + `Not adding key: ${objectKey} with val: ${objectValue} to baggage header due to exceeding baggage size limits.` + ); + return baggageHeader; + } else { + return newBaggageHeader; + } + }, ""); +} +__name(objectToBaggageHeader, "objectToBaggageHeader"); +const TRACEPARENT_REGEXP = new RegExp( + "^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$" + // whitespace +); +function extractTraceparentData(traceparent) { + if (!traceparent) { + return void 0; + } + const matches2 = traceparent.match(TRACEPARENT_REGEXP); + if (!matches2) { + return void 0; + } + let parentSampled; + if (matches2[3] === "1") { + parentSampled = true; + } else if (matches2[3] === "0") { + parentSampled = false; + } + return { + traceId: matches2[1], + parentSampled, + parentSpanId: matches2[2] + }; +} +__name(extractTraceparentData, "extractTraceparentData"); +function propagationContextFromHeaders(sentryTrace, baggage) { + const traceparentData = extractTraceparentData(sentryTrace); + const dynamicSamplingContext = baggageHeaderToDynamicSamplingContext(baggage); + if (!traceparentData || !traceparentData.traceId) { + return { traceId: generateTraceId(), spanId: generateSpanId() }; + } + const { traceId, parentSpanId, parentSampled } = traceparentData; + const virtualSpanId = generateSpanId(); + return { + traceId, + parentSpanId, + spanId: virtualSpanId, + sampled: parentSampled, + dsc: dynamicSamplingContext || {} + // If we have traceparent data but no DSC it means we are not head of trace and we must freeze it + }; +} +__name(propagationContextFromHeaders, "propagationContextFromHeaders"); +function generateSentryTraceHeader(traceId = generateTraceId(), spanId = generateSpanId(), sampled) { + let sampledString = ""; + if (sampled !== void 0) { + sampledString = sampled ? "-1" : "-0"; + } + return `${traceId}-${spanId}${sampledString}`; +} +__name(generateSentryTraceHeader, "generateSentryTraceHeader"); +const TRACE_FLAG_NONE = 0; +const TRACE_FLAG_SAMPLED = 1; +let hasShownSpanDropWarning = false; +function spanToTransactionTraceContext(span) { + const { spanId: span_id, traceId: trace_id } = span.spanContext(); + const { data: data25, op, parent_span_id, status, origin: origin2 } = spanToJSON(span); + return dropUndefinedKeys({ + parent_span_id, + span_id, + trace_id, + data: data25, + op, + status, + origin: origin2 + }); +} +__name(spanToTransactionTraceContext, "spanToTransactionTraceContext"); +function spanToTraceContext(span) { + const { spanId, traceId: trace_id, isRemote } = span.spanContext(); + const parent_span_id = isRemote ? spanId : spanToJSON(span).parent_span_id; + const span_id = isRemote ? generateSpanId() : spanId; + return dropUndefinedKeys({ + parent_span_id, + span_id, + trace_id + }); +} +__name(spanToTraceContext, "spanToTraceContext"); +function spanToTraceHeader(span) { + const { traceId, spanId } = span.spanContext(); + const sampled = spanIsSampled(span); + return generateSentryTraceHeader(traceId, spanId, sampled); +} +__name(spanToTraceHeader, "spanToTraceHeader"); +function spanTimeInputToSeconds(input) { + if (typeof input === "number") { + return ensureTimestampInSeconds(input); + } + if (Array.isArray(input)) { + return input[0] + input[1] / 1e9; + } + if (input instanceof Date) { + return ensureTimestampInSeconds(input.getTime()); + } + return timestampInSeconds(); +} +__name(spanTimeInputToSeconds, "spanTimeInputToSeconds"); +function ensureTimestampInSeconds(timestamp2) { + const isMs = timestamp2 > 9999999999; + return isMs ? timestamp2 / 1e3 : timestamp2; +} +__name(ensureTimestampInSeconds, "ensureTimestampInSeconds"); +function spanToJSON(span) { + if (spanIsSentrySpan(span)) { + return span.getSpanJSON(); + } + try { + const { spanId: span_id, traceId: trace_id } = span.spanContext(); + if (spanIsOpenTelemetrySdkTraceBaseSpan(span)) { + const { attributes, startTime, name: name2, endTime, parentSpanId, status } = span; + return dropUndefinedKeys({ + span_id, + trace_id, + data: attributes, + description: name2, + parent_span_id: parentSpanId, + start_timestamp: spanTimeInputToSeconds(startTime), + // This is [0,0] by default in OTEL, in which case we want to interpret this as no end time + timestamp: spanTimeInputToSeconds(endTime) || void 0, + status: getStatusMessage(status), + op: attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP], + origin: attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN], + _metrics_summary: getMetricSummaryJsonForSpan(span) + }); + } + return { + span_id, + trace_id + }; + } catch (e2) { + return {}; + } +} +__name(spanToJSON, "spanToJSON"); +function spanIsOpenTelemetrySdkTraceBaseSpan(span) { + const castSpan = span; + return !!castSpan.attributes && !!castSpan.startTime && !!castSpan.name && !!castSpan.endTime && !!castSpan.status; +} +__name(spanIsOpenTelemetrySdkTraceBaseSpan, "spanIsOpenTelemetrySdkTraceBaseSpan"); +function spanIsSentrySpan(span) { + return typeof span.getSpanJSON === "function"; +} +__name(spanIsSentrySpan, "spanIsSentrySpan"); +function spanIsSampled(span) { + const { traceFlags } = span.spanContext(); + return traceFlags === TRACE_FLAG_SAMPLED; +} +__name(spanIsSampled, "spanIsSampled"); +function getStatusMessage(status) { + if (!status || status.code === SPAN_STATUS_UNSET) { + return void 0; + } + if (status.code === SPAN_STATUS_OK) { + return "ok"; + } + return status.message || "unknown_error"; +} +__name(getStatusMessage, "getStatusMessage"); +const CHILD_SPANS_FIELD = "_sentryChildSpans"; +const ROOT_SPAN_FIELD = "_sentryRootSpan"; +function addChildSpanToSpan(span, childSpan) { + const rootSpan = span[ROOT_SPAN_FIELD] || span; + addNonEnumerableProperty(childSpan, ROOT_SPAN_FIELD, rootSpan); + if (span[CHILD_SPANS_FIELD]) { + span[CHILD_SPANS_FIELD].add(childSpan); + } else { + addNonEnumerableProperty(span, CHILD_SPANS_FIELD, /* @__PURE__ */ new Set([childSpan])); + } +} +__name(addChildSpanToSpan, "addChildSpanToSpan"); +function removeChildSpanFromSpan(span, childSpan) { + if (span[CHILD_SPANS_FIELD]) { + span[CHILD_SPANS_FIELD].delete(childSpan); + } +} +__name(removeChildSpanFromSpan, "removeChildSpanFromSpan"); +function getSpanDescendants(span) { + const resultSet = /* @__PURE__ */ new Set(); + function addSpanChildren(span2) { + if (resultSet.has(span2)) { + return; + } else if (spanIsSampled(span2)) { + resultSet.add(span2); + const childSpans = span2[CHILD_SPANS_FIELD] ? Array.from(span2[CHILD_SPANS_FIELD]) : []; + for (const childSpan of childSpans) { + addSpanChildren(childSpan); + } + } + } + __name(addSpanChildren, "addSpanChildren"); + addSpanChildren(span); + return Array.from(resultSet); +} +__name(getSpanDescendants, "getSpanDescendants"); +function getRootSpan(span) { + return span[ROOT_SPAN_FIELD] || span; +} +__name(getRootSpan, "getRootSpan"); +function getActiveSpan() { + const carrier = getMainCarrier(); + const acs = getAsyncContextStrategy(carrier); + if (acs.getActiveSpan) { + return acs.getActiveSpan(); + } + return _getSpanForScope(getCurrentScope$1()); +} +__name(getActiveSpan, "getActiveSpan"); +function updateMetricSummaryOnActiveSpan(metricType, sanitizedName, value4, unit, tags, bucketKey) { + const span = getActiveSpan(); + if (span) { + updateMetricSummaryOnSpan(span, metricType, sanitizedName, value4, unit, tags, bucketKey); + } +} +__name(updateMetricSummaryOnActiveSpan, "updateMetricSummaryOnActiveSpan"); +function showSpanDropWarning() { + if (!hasShownSpanDropWarning) { + consoleSandbox(() => { + console.warn( + "[Sentry] Deprecation warning: Returning null from `beforeSendSpan` will be disallowed from SDK version 9.0.0 onwards. The callback will only support mutating spans. To drop certain spans, configure the respective integrations directly." + ); + }); + hasShownSpanDropWarning = true; + } +} +__name(showSpanDropWarning, "showSpanDropWarning"); +function updateSpanName(span, name2) { + span.updateName(name2); + span.setAttributes({ + [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: "custom", + [SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME]: name2 + }); +} +__name(updateSpanName, "updateSpanName"); +let errorsInstrumented = false; +function registerSpanErrorInstrumentation() { + if (errorsInstrumented) { + return; + } + errorsInstrumented = true; + addGlobalErrorInstrumentationHandler(errorCallback); + addGlobalUnhandledRejectionInstrumentationHandler(errorCallback); +} +__name(registerSpanErrorInstrumentation, "registerSpanErrorInstrumentation"); +function errorCallback() { + const activeSpan = getActiveSpan(); + const rootSpan = activeSpan && getRootSpan(activeSpan); + if (rootSpan) { + const message3 = "internal_error"; + DEBUG_BUILD$6 && logger$2.log(`[Tracing] Root span: ${message3} -> Global error occurred`); + rootSpan.setStatus({ code: SPAN_STATUS_ERROR, message: message3 }); + } +} +__name(errorCallback, "errorCallback"); +errorCallback.tag = "sentry_tracingErrorCallback"; +const SCOPE_ON_START_SPAN_FIELD = "_sentryScope"; +const ISOLATION_SCOPE_ON_START_SPAN_FIELD = "_sentryIsolationScope"; +function setCapturedScopesOnSpan(span, scope, isolationScope) { + if (span) { + addNonEnumerableProperty(span, ISOLATION_SCOPE_ON_START_SPAN_FIELD, isolationScope); + addNonEnumerableProperty(span, SCOPE_ON_START_SPAN_FIELD, scope); + } +} +__name(setCapturedScopesOnSpan, "setCapturedScopesOnSpan"); +function getCapturedScopesOnSpan(span) { + return { + scope: span[SCOPE_ON_START_SPAN_FIELD], + isolationScope: span[ISOLATION_SCOPE_ON_START_SPAN_FIELD] + }; +} +__name(getCapturedScopesOnSpan, "getCapturedScopesOnSpan"); +function addTracingExtensions() { + registerSpanErrorInstrumentation(); +} +__name(addTracingExtensions, "addTracingExtensions"); +function hasTracingEnabled(maybeOptions) { + if (typeof __SENTRY_TRACING__ === "boolean" && !__SENTRY_TRACING__) { + return false; + } + const client = getClient(); + const options4 = maybeOptions || client && client.getOptions(); + return !!options4 && (options4.enableTracing || "tracesSampleRate" in options4 || "tracesSampler" in options4); +} +__name(hasTracingEnabled, "hasTracingEnabled"); +class SentryNonRecordingSpan { + static { + __name(this, "SentryNonRecordingSpan"); + } + constructor(spanContext = {}) { + this._traceId = spanContext.traceId || generateTraceId(); + this._spanId = spanContext.spanId || generateSpanId(); + } + /** @inheritdoc */ + spanContext() { + return { + spanId: this._spanId, + traceId: this._traceId, + traceFlags: TRACE_FLAG_NONE + }; + } + /** @inheritdoc */ + // eslint-disable-next-line @typescript-eslint/no-empty-function + end(_timestamp) { + } + /** @inheritdoc */ + setAttribute(_key, _value) { + return this; + } + /** @inheritdoc */ + setAttributes(_values) { + return this; + } + /** @inheritdoc */ + setStatus(_status) { + return this; + } + /** @inheritdoc */ + updateName(_name) { + return this; + } + /** @inheritdoc */ + isRecording() { + return false; + } + /** @inheritdoc */ + addEvent(_name, _attributesOrStartTime, _startTime) { + return this; + } + /** + * This should generally not be used, + * but we need it for being compliant with the OTEL Span interface. + * + * @hidden + * @internal + */ + addLink(_link) { + return this; + } + /** + * This should generally not be used, + * but we need it for being compliant with the OTEL Span interface. + * + * @hidden + * @internal + */ + addLinks(_links) { + return this; + } + /** + * This should generally not be used, + * but we need it for being compliant with the OTEL Span interface. + * + * @hidden + * @internal + */ + recordException(_exception, _time) { + } +} +function handleCallbackErrors(fn, onError, onFinally = () => { +}) { + let maybePromiseResult; + try { + maybePromiseResult = fn(); + } catch (e2) { + onError(e2); + onFinally(); + throw e2; + } + return maybeHandlePromiseRejection(maybePromiseResult, onError, onFinally); +} +__name(handleCallbackErrors, "handleCallbackErrors"); +function maybeHandlePromiseRejection(value4, onError, onFinally) { + if (isThenable$1(value4)) { + return value4.then( + (res) => { + onFinally(); + return res; + }, + (e2) => { + onError(e2); + onFinally(); + throw e2; + } + ); + } + onFinally(); + return value4; +} +__name(maybeHandlePromiseRejection, "maybeHandlePromiseRejection"); +const DEFAULT_ENVIRONMENT = "production"; +const FROZEN_DSC_FIELD = "_frozenDsc"; +function freezeDscOnSpan(span, dsc) { + const spanWithMaybeDsc = span; + addNonEnumerableProperty(spanWithMaybeDsc, FROZEN_DSC_FIELD, dsc); +} +__name(freezeDscOnSpan, "freezeDscOnSpan"); +function getDynamicSamplingContextFromClient(trace_id, client) { + const options4 = client.getOptions(); + const { publicKey: public_key } = client.getDsn() || {}; + const dsc = dropUndefinedKeys({ + environment: options4.environment || DEFAULT_ENVIRONMENT, + release: options4.release, + public_key, + trace_id + }); + client.emit("createDsc", dsc); + return dsc; +} +__name(getDynamicSamplingContextFromClient, "getDynamicSamplingContextFromClient"); +function getDynamicSamplingContextFromScope(client, scope) { + const propagationContext = scope.getPropagationContext(); + return propagationContext.dsc || getDynamicSamplingContextFromClient(propagationContext.traceId, client); +} +__name(getDynamicSamplingContextFromScope, "getDynamicSamplingContextFromScope"); +function getDynamicSamplingContextFromSpan(span) { + const client = getClient(); + if (!client) { + return {}; + } + const rootSpan = getRootSpan(span); + const frozenDsc = rootSpan[FROZEN_DSC_FIELD]; + if (frozenDsc) { + return frozenDsc; + } + const traceState = rootSpan.spanContext().traceState; + const traceStateDsc = traceState && traceState.get("sentry.dsc"); + const dscOnTraceState = traceStateDsc && baggageHeaderToDynamicSamplingContext(traceStateDsc); + if (dscOnTraceState) { + return dscOnTraceState; + } + const dsc = getDynamicSamplingContextFromClient(span.spanContext().traceId, client); + const jsonSpan = spanToJSON(rootSpan); + const attributes = jsonSpan.data || {}; + const maybeSampleRate = attributes[SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]; + if (maybeSampleRate != null) { + dsc.sample_rate = `${maybeSampleRate}`; + } + const source = attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]; + const name2 = jsonSpan.description; + if (source !== "url" && name2) { + dsc.transaction = name2; + } + if (hasTracingEnabled()) { + dsc.sampled = String(spanIsSampled(rootSpan)); + } + client.emit("createDsc", dsc, rootSpan); + return dsc; +} +__name(getDynamicSamplingContextFromSpan, "getDynamicSamplingContextFromSpan"); +function spanToBaggageHeader(span) { + const dsc = getDynamicSamplingContextFromSpan(span); + return dynamicSamplingContextToSentryBaggageHeader(dsc); +} +__name(spanToBaggageHeader, "spanToBaggageHeader"); +function logSpanStart(span) { + if (!DEBUG_BUILD$6) return; + const { description = "< unknown name >", op = "< unknown op >", parent_span_id: parentSpanId } = spanToJSON(span); + const { spanId } = span.spanContext(); + const sampled = spanIsSampled(span); + const rootSpan = getRootSpan(span); + const isRootSpan = rootSpan === span; + const header3 = `[Tracing] Starting ${sampled ? "sampled" : "unsampled"} ${isRootSpan ? "root " : ""}span`; + const infoParts = [`op: ${op}`, `name: ${description}`, `ID: ${spanId}`]; + if (parentSpanId) { + infoParts.push(`parent ID: ${parentSpanId}`); + } + if (!isRootSpan) { + const { op: op2, description: description2 } = spanToJSON(rootSpan); + infoParts.push(`root ID: ${rootSpan.spanContext().spanId}`); + if (op2) { + infoParts.push(`root op: ${op2}`); + } + if (description2) { + infoParts.push(`root description: ${description2}`); + } + } + logger$2.log(`${header3} + ${infoParts.join("\n ")}`); +} +__name(logSpanStart, "logSpanStart"); +function logSpanEnd(span) { + if (!DEBUG_BUILD$6) return; + const { description = "< unknown name >", op = "< unknown op >" } = spanToJSON(span); + const { spanId } = span.spanContext(); + const rootSpan = getRootSpan(span); + const isRootSpan = rootSpan === span; + const msg = `[Tracing] Finishing "${op}" ${isRootSpan ? "root " : ""}span "${description}" with ID ${spanId}`; + logger$2.log(msg); +} +__name(logSpanEnd, "logSpanEnd"); +function parseSampleRate(sampleRate) { + if (typeof sampleRate === "boolean") { + return Number(sampleRate); + } + const rate = typeof sampleRate === "string" ? parseFloat(sampleRate) : sampleRate; + if (typeof rate !== "number" || isNaN(rate) || rate < 0 || rate > 1) { + DEBUG_BUILD$6 && logger$2.warn( + `[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify( + sampleRate + )} of type ${JSON.stringify(typeof sampleRate)}.` + ); + return void 0; + } + return rate; +} +__name(parseSampleRate, "parseSampleRate"); +function sampleSpan(options4, samplingContext) { + if (!hasTracingEnabled(options4)) { + return [false]; + } + const normalizedRequest = getIsolationScope().getScopeData().sdkProcessingMetadata.normalizedRequest; + const enhancedSamplingContext = { + ...samplingContext, + normalizedRequest: samplingContext.normalizedRequest || normalizedRequest + }; + let sampleRate; + if (typeof options4.tracesSampler === "function") { + sampleRate = options4.tracesSampler(enhancedSamplingContext); + } else if (enhancedSamplingContext.parentSampled !== void 0) { + sampleRate = enhancedSamplingContext.parentSampled; + } else if (typeof options4.tracesSampleRate !== "undefined") { + sampleRate = options4.tracesSampleRate; + } else { + sampleRate = 1; + } + const parsedSampleRate = parseSampleRate(sampleRate); + if (parsedSampleRate === void 0) { + DEBUG_BUILD$6 && logger$2.warn("[Tracing] Discarding transaction because of invalid sample rate."); + return [false]; + } + if (!parsedSampleRate) { + DEBUG_BUILD$6 && logger$2.log( + `[Tracing] Discarding transaction because ${typeof options4.tracesSampler === "function" ? "tracesSampler returned 0 or false" : "a negative sampling decision was inherited or tracesSampleRate is set to 0"}` + ); + return [false, parsedSampleRate]; + } + const shouldSample = Math.random() < parsedSampleRate; + if (!shouldSample) { + DEBUG_BUILD$6 && logger$2.log( + `[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number( + sampleRate + )})` + ); + return [false, parsedSampleRate]; + } + return [true, parsedSampleRate]; +} +__name(sampleSpan, "sampleSpan"); +const DSN_REGEX = /^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/; +function isValidProtocol(protocol) { + return protocol === "http" || protocol === "https"; +} +__name(isValidProtocol, "isValidProtocol"); +function dsnToString(dsn, withPassword = false) { + const { host, path, pass, port, projectId, protocol, publicKey } = dsn; + return `${protocol}://${publicKey}${withPassword && pass ? `:${pass}` : ""}@${host}${port ? `:${port}` : ""}/${path ? `${path}/` : path}${projectId}`; +} +__name(dsnToString, "dsnToString"); +function dsnFromString(str) { + const match2 = DSN_REGEX.exec(str); + if (!match2) { + consoleSandbox(() => { + console.error(`Invalid Sentry Dsn: ${str}`); + }); + return void 0; + } + const [protocol, publicKey, pass = "", host = "", port = "", lastPath = ""] = match2.slice(1); + let path = ""; + let projectId = lastPath; + const split2 = projectId.split("/"); + if (split2.length > 1) { + path = split2.slice(0, -1).join("/"); + projectId = split2.pop(); + } + if (projectId) { + const projectMatch = projectId.match(/^\d+/); + if (projectMatch) { + projectId = projectMatch[0]; + } + } + return dsnFromComponents({ host, pass, path, projectId, port, protocol, publicKey }); +} +__name(dsnFromString, "dsnFromString"); +function dsnFromComponents(components) { + return { + protocol: components.protocol, + publicKey: components.publicKey || "", + pass: components.pass || "", + host: components.host, + port: components.port || "", + path: components.path || "", + projectId: components.projectId + }; +} +__name(dsnFromComponents, "dsnFromComponents"); +function validateDsn(dsn) { + if (!DEBUG_BUILD$5) { + return true; + } + const { port, projectId, protocol } = dsn; + const requiredComponents = ["protocol", "publicKey", "host", "projectId"]; + const hasMissingRequiredComponent = requiredComponents.find((component) => { + if (!dsn[component]) { + logger$2.error(`Invalid Sentry Dsn: ${component} missing`); + return true; + } + return false; + }); + if (hasMissingRequiredComponent) { + return false; + } + if (!projectId.match(/^\d+$/)) { + logger$2.error(`Invalid Sentry Dsn: Invalid projectId ${projectId}`); + return false; + } + if (!isValidProtocol(protocol)) { + logger$2.error(`Invalid Sentry Dsn: Invalid protocol ${protocol}`); + return false; + } + if (port && isNaN(parseInt(port, 10))) { + logger$2.error(`Invalid Sentry Dsn: Invalid port ${port}`); + return false; + } + return true; +} +__name(validateDsn, "validateDsn"); +function makeDsn(from2) { + const components = typeof from2 === "string" ? dsnFromString(from2) : dsnFromComponents(from2); + if (!components || !validateDsn(components)) { + return void 0; + } + return components; +} +__name(makeDsn, "makeDsn"); +function memoBuilder() { + const hasWeakSet = typeof WeakSet === "function"; + const inner = hasWeakSet ? /* @__PURE__ */ new WeakSet() : []; + function memoize(obj) { + if (hasWeakSet) { + if (inner.has(obj)) { + return true; + } + inner.add(obj); + return false; + } + for (let i2 = 0; i2 < inner.length; i2++) { + const value4 = inner[i2]; + if (value4 === obj) { + return true; + } + } + inner.push(obj); + return false; + } + __name(memoize, "memoize"); + function unmemoize(obj) { + if (hasWeakSet) { + inner.delete(obj); + } else { + for (let i2 = 0; i2 < inner.length; i2++) { + if (inner[i2] === obj) { + inner.splice(i2, 1); + break; + } + } + } + } + __name(unmemoize, "unmemoize"); + return [memoize, unmemoize]; +} +__name(memoBuilder, "memoBuilder"); +function normalize$2(input, depth = 100, maxProperties = Infinity) { + try { + return visit("", input, depth, maxProperties); + } catch (err) { + return { ERROR: `**non-serializable** (${err})` }; + } +} +__name(normalize$2, "normalize$2"); +function normalizeToSize(object, depth = 3, maxSize = 100 * 1024) { + const normalized = normalize$2(object, depth); + if (jsonSize(normalized) > maxSize) { + return normalizeToSize(object, depth - 1, maxSize); + } + return normalized; +} +__name(normalizeToSize, "normalizeToSize"); +function visit(key, value4, depth = Infinity, maxProperties = Infinity, memo = memoBuilder()) { + const [memoize, unmemoize] = memo; + if (value4 == null || // this matches null and undefined -> eqeq not eqeqeq + ["boolean", "string"].includes(typeof value4) || typeof value4 === "number" && Number.isFinite(value4)) { + return value4; + } + const stringified = stringifyValue(key, value4); + if (!stringified.startsWith("[object ")) { + return stringified; + } + if (value4["__sentry_skip_normalization__"]) { + return value4; + } + const remainingDepth = typeof value4["__sentry_override_normalization_depth__"] === "number" ? value4["__sentry_override_normalization_depth__"] : depth; + if (remainingDepth === 0) { + return stringified.replace("object ", ""); + } + if (memoize(value4)) { + return "[Circular ~]"; + } + const valueWithToJSON = value4; + if (valueWithToJSON && typeof valueWithToJSON.toJSON === "function") { + try { + const jsonValue = valueWithToJSON.toJSON(); + return visit("", jsonValue, remainingDepth - 1, maxProperties, memo); + } catch (err) { + } + } + const normalized = Array.isArray(value4) ? [] : {}; + let numAdded = 0; + const visitable = convertToPlainObject(value4); + for (const visitKey in visitable) { + if (!Object.prototype.hasOwnProperty.call(visitable, visitKey)) { + continue; + } + if (numAdded >= maxProperties) { + normalized[visitKey] = "[MaxProperties ~]"; + break; + } + const visitValue = visitable[visitKey]; + normalized[visitKey] = visit(visitKey, visitValue, remainingDepth - 1, maxProperties, memo); + numAdded++; + } + unmemoize(value4); + return normalized; +} +__name(visit, "visit"); +function stringifyValue(key, value4) { + try { + if (key === "domain" && value4 && typeof value4 === "object" && value4._events) { + return "[Domain]"; + } + if (key === "domainEmitter") { + return "[DomainEmitter]"; + } + if (typeof global !== "undefined" && value4 === global) { + return "[Global]"; + } + if (typeof window !== "undefined" && value4 === window) { + return "[Window]"; + } + if (typeof document !== "undefined" && value4 === document) { + return "[Document]"; + } + if (isVueViewModel(value4)) { + return "[VueViewModel]"; + } + if (isSyntheticEvent(value4)) { + return "[SyntheticEvent]"; + } + if (typeof value4 === "number" && !Number.isFinite(value4)) { + return `[${value4}]`; + } + if (typeof value4 === "function") { + return `[Function: ${getFunctionName(value4)}]`; + } + if (typeof value4 === "symbol") { + return `[${String(value4)}]`; + } + if (typeof value4 === "bigint") { + return `[BigInt: ${String(value4)}]`; + } + const objName = getConstructorName(value4); + if (/^HTML(\w*)Element$/.test(objName)) { + return `[HTMLElement: ${objName}]`; + } + return `[object ${objName}]`; + } catch (err) { + return `**non-serializable** (${err})`; + } +} +__name(stringifyValue, "stringifyValue"); +function getConstructorName(value4) { + const prototype2 = Object.getPrototypeOf(value4); + return prototype2 ? prototype2.constructor.name : "null prototype"; +} +__name(getConstructorName, "getConstructorName"); +function utf8Length(value4) { + return ~-encodeURI(value4).split(/%..|./).length; +} +__name(utf8Length, "utf8Length"); +function jsonSize(value4) { + return utf8Length(JSON.stringify(value4)); +} +__name(jsonSize, "jsonSize"); +function normalizeUrlToBase(url, basePath2) { + const escapedBase = basePath2.replace(/\\/g, "/").replace(/[|\\{}()[\]^$+*?.]/g, "\\$&"); + let newUrl = url; + try { + newUrl = decodeURI(url); + } catch (_Oo) { + } + return newUrl.replace(/\\/g, "/").replace(/webpack:\/?/g, "").replace(new RegExp(`(file://)?/*${escapedBase}/*`, "ig"), "app:///"); +} +__name(normalizeUrlToBase, "normalizeUrlToBase"); +function createEnvelope(headers, items2 = []) { + return [headers, items2]; +} +__name(createEnvelope, "createEnvelope"); +function addItemToEnvelope(envelope, newItem) { + const [headers, items2] = envelope; + return [headers, [...items2, newItem]]; +} +__name(addItemToEnvelope, "addItemToEnvelope"); +function forEachEnvelopeItem(envelope, callback) { + const envelopeItems = envelope[1]; + for (const envelopeItem of envelopeItems) { + const envelopeItemType = envelopeItem[0].type; + const result = callback(envelopeItem, envelopeItemType); + if (result) { + return true; + } + } + return false; +} +__name(forEachEnvelopeItem, "forEachEnvelopeItem"); +function envelopeContainsItemType(envelope, types) { + return forEachEnvelopeItem(envelope, (_2, type) => types.includes(type)); +} +__name(envelopeContainsItemType, "envelopeContainsItemType"); +function encodeUTF8(input) { + return GLOBAL_OBJ.__SENTRY__ && GLOBAL_OBJ.__SENTRY__.encodePolyfill ? GLOBAL_OBJ.__SENTRY__.encodePolyfill(input) : new TextEncoder().encode(input); +} +__name(encodeUTF8, "encodeUTF8"); +function decodeUTF8(input) { + return GLOBAL_OBJ.__SENTRY__ && GLOBAL_OBJ.__SENTRY__.decodePolyfill ? GLOBAL_OBJ.__SENTRY__.decodePolyfill(input) : new TextDecoder().decode(input); +} +__name(decodeUTF8, "decodeUTF8"); +function serializeEnvelope(envelope) { + const [envHeaders, items2] = envelope; + let parts2 = JSON.stringify(envHeaders); + function append3(next2) { + if (typeof parts2 === "string") { + parts2 = typeof next2 === "string" ? parts2 + next2 : [encodeUTF8(parts2), next2]; + } else { + parts2.push(typeof next2 === "string" ? encodeUTF8(next2) : next2); + } + } + __name(append3, "append"); + for (const item3 of items2) { + const [itemHeaders, payload] = item3; + append3(` +${JSON.stringify(itemHeaders)} +`); + if (typeof payload === "string" || payload instanceof Uint8Array) { + append3(payload); + } else { + let stringifiedPayload; + try { + stringifiedPayload = JSON.stringify(payload); + } catch (e2) { + stringifiedPayload = JSON.stringify(normalize$2(payload)); + } + append3(stringifiedPayload); + } + } + return typeof parts2 === "string" ? parts2 : concatBuffers(parts2); +} +__name(serializeEnvelope, "serializeEnvelope"); +function concatBuffers(buffers) { + const totalLength = buffers.reduce((acc, buf) => acc + buf.length, 0); + const merged = new Uint8Array(totalLength); + let offset = 0; + for (const buffer2 of buffers) { + merged.set(buffer2, offset); + offset += buffer2.length; + } + return merged; +} +__name(concatBuffers, "concatBuffers"); +function parseEnvelope(env) { + let buffer2 = typeof env === "string" ? encodeUTF8(env) : env; + function readBinary(length) { + const bin = buffer2.subarray(0, length); + buffer2 = buffer2.subarray(length + 1); + return bin; + } + __name(readBinary, "readBinary"); + function readJson() { + let i2 = buffer2.indexOf(10); + if (i2 < 0) { + i2 = buffer2.length; + } + return JSON.parse(decodeUTF8(readBinary(i2))); + } + __name(readJson, "readJson"); + const envelopeHeader = readJson(); + const items2 = []; + while (buffer2.length) { + const itemHeader = readJson(); + const binaryLength = typeof itemHeader.length === "number" ? itemHeader.length : void 0; + items2.push([itemHeader, binaryLength ? readBinary(binaryLength) : readJson()]); + } + return [envelopeHeader, items2]; +} +__name(parseEnvelope, "parseEnvelope"); +function createSpanEnvelopeItem(spanJson) { + const spanHeaders = { + type: "span" + }; + return [spanHeaders, spanJson]; +} +__name(createSpanEnvelopeItem, "createSpanEnvelopeItem"); +function createAttachmentEnvelopeItem(attachment) { + const buffer2 = typeof attachment.data === "string" ? encodeUTF8(attachment.data) : attachment.data; + return [ + dropUndefinedKeys({ + type: "attachment", + length: buffer2.length, + filename: attachment.filename, + content_type: attachment.contentType, + attachment_type: attachment.attachmentType + }), + buffer2 + ]; +} +__name(createAttachmentEnvelopeItem, "createAttachmentEnvelopeItem"); +const ITEM_TYPE_TO_DATA_CATEGORY_MAP = { + session: "session", + sessions: "session", + attachment: "attachment", + transaction: "transaction", + event: "error", + client_report: "internal", + user_report: "default", + profile: "profile", + profile_chunk: "profile", + replay_event: "replay", + replay_recording: "replay", + check_in: "monitor", + feedback: "feedback", + span: "span", + statsd: "metric_bucket", + raw_security: "security" +}; +function envelopeItemTypeToDataCategory(type) { + return ITEM_TYPE_TO_DATA_CATEGORY_MAP[type]; +} +__name(envelopeItemTypeToDataCategory, "envelopeItemTypeToDataCategory"); +function getSdkMetadataForEnvelopeHeader(metadataOrEvent) { + if (!metadataOrEvent || !metadataOrEvent.sdk) { + return; + } + const { name: name2, version: version2 } = metadataOrEvent.sdk; + return { name: name2, version: version2 }; +} +__name(getSdkMetadataForEnvelopeHeader, "getSdkMetadataForEnvelopeHeader"); +function createEventEnvelopeHeaders(event, sdkInfo, tunnel, dsn) { + const dynamicSamplingContext = event.sdkProcessingMetadata && event.sdkProcessingMetadata.dynamicSamplingContext; + return { + event_id: event.event_id, + sent_at: (/* @__PURE__ */ new Date()).toISOString(), + ...sdkInfo && { sdk: sdkInfo }, + ...!!tunnel && dsn && { dsn: dsnToString(dsn) }, + ...dynamicSamplingContext && { + trace: dropUndefinedKeys({ ...dynamicSamplingContext }) + } + }; +} +__name(createEventEnvelopeHeaders, "createEventEnvelopeHeaders"); +function enhanceEventWithSdkInfo(event, sdkInfo) { + if (!sdkInfo) { + return event; + } + event.sdk = event.sdk || {}; + event.sdk.name = event.sdk.name || sdkInfo.name; + event.sdk.version = event.sdk.version || sdkInfo.version; + event.sdk.integrations = [...event.sdk.integrations || [], ...sdkInfo.integrations || []]; + event.sdk.packages = [...event.sdk.packages || [], ...sdkInfo.packages || []]; + return event; +} +__name(enhanceEventWithSdkInfo, "enhanceEventWithSdkInfo"); +function createSessionEnvelope(session, dsn, metadata, tunnel) { + const sdkInfo = getSdkMetadataForEnvelopeHeader(metadata); + const envelopeHeaders = { + sent_at: (/* @__PURE__ */ new Date()).toISOString(), + ...sdkInfo && { sdk: sdkInfo }, + ...!!tunnel && dsn && { dsn: dsnToString(dsn) } + }; + const envelopeItem = "aggregates" in session ? [{ type: "sessions" }, session] : [{ type: "session" }, session.toJSON()]; + return createEnvelope(envelopeHeaders, [envelopeItem]); +} +__name(createSessionEnvelope, "createSessionEnvelope"); +function createEventEnvelope(event, dsn, metadata, tunnel) { + const sdkInfo = getSdkMetadataForEnvelopeHeader(metadata); + const eventType = event.type && event.type !== "replay_event" ? event.type : "event"; + enhanceEventWithSdkInfo(event, metadata && metadata.sdk); + const envelopeHeaders = createEventEnvelopeHeaders(event, sdkInfo, tunnel, dsn); + delete event.sdkProcessingMetadata; + const eventItem = [{ type: eventType }, event]; + return createEnvelope(envelopeHeaders, [eventItem]); +} +__name(createEventEnvelope, "createEventEnvelope"); +function createSpanEnvelope(spans, client) { + function dscHasRequiredProps(dsc2) { + return !!dsc2.trace_id && !!dsc2.public_key; + } + __name(dscHasRequiredProps, "dscHasRequiredProps"); + const dsc = getDynamicSamplingContextFromSpan(spans[0]); + const dsn = client && client.getDsn(); + const tunnel = client && client.getOptions().tunnel; + const headers = { + sent_at: (/* @__PURE__ */ new Date()).toISOString(), + ...dscHasRequiredProps(dsc) && { trace: dsc }, + ...!!tunnel && dsn && { dsn: dsnToString(dsn) } + }; + const beforeSendSpan = client && client.getOptions().beforeSendSpan; + const convertToSpanJSON = beforeSendSpan ? (span) => { + const spanJson = beforeSendSpan(spanToJSON(span)); + if (!spanJson) { + showSpanDropWarning(); + } + return spanJson; + } : (span) => spanToJSON(span); + const items2 = []; + for (const span of spans) { + const spanJson = convertToSpanJSON(span); + if (spanJson) { + items2.push(createSpanEnvelopeItem(spanJson)); + } + } + return createEnvelope(headers, items2); +} +__name(createSpanEnvelope, "createSpanEnvelope"); +function setMeasurement(name2, value4, unit, activeSpan = getActiveSpan()) { + const rootSpan = activeSpan && getRootSpan(activeSpan); + if (rootSpan) { + DEBUG_BUILD$6 && logger$2.log(`[Measurement] Setting measurement on root span: ${name2} = ${value4} ${unit}`); + rootSpan.addEvent(name2, { + [SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE]: value4, + [SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT]: unit + }); + } +} +__name(setMeasurement, "setMeasurement"); +function timedEventsToMeasurements(events2) { + if (!events2 || events2.length === 0) { + return void 0; + } + const measurements = {}; + events2.forEach((event) => { + const attributes = event.attributes || {}; + const unit = attributes[SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT]; + const value4 = attributes[SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE]; + if (typeof unit === "string" && typeof value4 === "number") { + measurements[event.name] = { value: value4, unit }; + } + }); + return measurements; +} +__name(timedEventsToMeasurements, "timedEventsToMeasurements"); +const MAX_SPAN_COUNT = 1e3; +class SentrySpan { + static { + __name(this, "SentrySpan"); + } + /** Epoch timestamp in seconds when the span started. */ + /** Epoch timestamp in seconds when the span ended. */ + /** Internal keeper of the status */ + /** The timed events added to this span. */ + /** if true, treat span as a standalone span (not part of a transaction) */ + /** + * You should never call the constructor manually, always use `Sentry.startSpan()` + * or other span methods. + * @internal + * @hideconstructor + * @hidden + */ + constructor(spanContext = {}) { + this._traceId = spanContext.traceId || generateTraceId(); + this._spanId = spanContext.spanId || generateSpanId(); + this._startTime = spanContext.startTimestamp || timestampInSeconds(); + this._attributes = {}; + this.setAttributes({ + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "manual", + [SEMANTIC_ATTRIBUTE_SENTRY_OP]: spanContext.op, + ...spanContext.attributes + }); + this._name = spanContext.name; + if (spanContext.parentSpanId) { + this._parentSpanId = spanContext.parentSpanId; + } + if ("sampled" in spanContext) { + this._sampled = spanContext.sampled; + } + if (spanContext.endTimestamp) { + this._endTime = spanContext.endTimestamp; + } + this._events = []; + this._isStandaloneSpan = spanContext.isStandalone; + if (this._endTime) { + this._onSpanEnded(); + } + } + /** + * This should generally not be used, + * but it is needed for being compliant with the OTEL Span interface. + * + * @hidden + * @internal + */ + addLink(_link) { + return this; + } + /** + * This should generally not be used, + * but it is needed for being compliant with the OTEL Span interface. + * + * @hidden + * @internal + */ + addLinks(_links) { + return this; + } + /** + * This should generally not be used, + * but it is needed for being compliant with the OTEL Span interface. + * + * @hidden + * @internal + */ + recordException(_exception, _time) { + } + /** @inheritdoc */ + spanContext() { + const { _spanId: spanId, _traceId: traceId, _sampled: sampled } = this; + return { + spanId, + traceId, + traceFlags: sampled ? TRACE_FLAG_SAMPLED : TRACE_FLAG_NONE + }; + } + /** @inheritdoc */ + setAttribute(key, value4) { + if (value4 === void 0) { + delete this._attributes[key]; + } else { + this._attributes[key] = value4; + } + return this; + } + /** @inheritdoc */ + setAttributes(attributes) { + Object.keys(attributes).forEach((key) => this.setAttribute(key, attributes[key])); + return this; + } + /** + * This should generally not be used, + * but we need it for browser tracing where we want to adjust the start time afterwards. + * USE THIS WITH CAUTION! + * + * @hidden + * @internal + */ + updateStartTime(timeInput) { + this._startTime = spanTimeInputToSeconds(timeInput); + } + /** + * @inheritDoc + */ + setStatus(value4) { + this._status = value4; + return this; + } + /** + * @inheritDoc + */ + updateName(name2) { + this._name = name2; + this.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, "custom"); + return this; + } + /** @inheritdoc */ + end(endTimestamp) { + if (this._endTime) { + return; + } + this._endTime = spanTimeInputToSeconds(endTimestamp); + logSpanEnd(this); + this._onSpanEnded(); + } + /** + * Get JSON representation of this span. + * + * @hidden + * @internal This method is purely for internal purposes and should not be used outside + * of SDK code. If you need to get a JSON representation of a span, + * use `spanToJSON(span)` instead. + */ + getSpanJSON() { + return dropUndefinedKeys({ + data: this._attributes, + description: this._name, + op: this._attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP], + parent_span_id: this._parentSpanId, + span_id: this._spanId, + start_timestamp: this._startTime, + status: getStatusMessage(this._status), + timestamp: this._endTime, + trace_id: this._traceId, + origin: this._attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN], + _metrics_summary: getMetricSummaryJsonForSpan(this), + profile_id: this._attributes[SEMANTIC_ATTRIBUTE_PROFILE_ID], + exclusive_time: this._attributes[SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME], + measurements: timedEventsToMeasurements(this._events), + is_segment: this._isStandaloneSpan && getRootSpan(this) === this || void 0, + segment_id: this._isStandaloneSpan ? getRootSpan(this).spanContext().spanId : void 0 + }); + } + /** @inheritdoc */ + isRecording() { + return !this._endTime && !!this._sampled; + } + /** + * @inheritdoc + */ + addEvent(name2, attributesOrStartTime, startTime) { + DEBUG_BUILD$6 && logger$2.log("[Tracing] Adding an event to span:", name2); + const time = isSpanTimeInput(attributesOrStartTime) ? attributesOrStartTime : startTime || timestampInSeconds(); + const attributes = isSpanTimeInput(attributesOrStartTime) ? {} : attributesOrStartTime || {}; + const event = { + name: name2, + time: spanTimeInputToSeconds(time), + attributes + }; + this._events.push(event); + return this; + } + /** + * This method should generally not be used, + * but for now we need a way to publicly check if the `_isStandaloneSpan` flag is set. + * USE THIS WITH CAUTION! + * @internal + * @hidden + * @experimental + */ + isStandaloneSpan() { + return !!this._isStandaloneSpan; + } + /** Emit `spanEnd` when the span is ended. */ + _onSpanEnded() { + const client = getClient(); + if (client) { + client.emit("spanEnd", this); + } + const isSegmentSpan = this._isStandaloneSpan || this === getRootSpan(this); + if (!isSegmentSpan) { + return; + } + if (this._isStandaloneSpan) { + if (this._sampled) { + sendSpanEnvelope(createSpanEnvelope([this], client)); + } else { + DEBUG_BUILD$6 && logger$2.log("[Tracing] Discarding standalone span because its trace was not chosen to be sampled."); + if (client) { + client.recordDroppedEvent("sample_rate", "span"); + } + } + return; + } + const transactionEvent = this._convertSpanToTransaction(); + if (transactionEvent) { + const scope = getCapturedScopesOnSpan(this).scope || getCurrentScope$1(); + scope.captureEvent(transactionEvent); + } + } + /** + * Finish the transaction & prepare the event to send to Sentry. + */ + _convertSpanToTransaction() { + if (!isFullFinishedSpan(spanToJSON(this))) { + return void 0; + } + if (!this._name) { + DEBUG_BUILD$6 && logger$2.warn("Transaction has no name, falling back to `<unlabeled transaction>`."); + this._name = "<unlabeled transaction>"; + } + const { scope: capturedSpanScope, isolationScope: capturedSpanIsolationScope } = getCapturedScopesOnSpan(this); + const scope = capturedSpanScope || getCurrentScope$1(); + const client = scope.getClient() || getClient(); + if (this._sampled !== true) { + DEBUG_BUILD$6 && logger$2.log("[Tracing] Discarding transaction because its trace was not chosen to be sampled."); + if (client) { + client.recordDroppedEvent("sample_rate", "transaction"); + } + return void 0; + } + const finishedSpans = getSpanDescendants(this).filter((span) => span !== this && !isStandaloneSpan(span)); + const spans = finishedSpans.map((span) => spanToJSON(span)).filter(isFullFinishedSpan); + const source = this._attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]; + delete this._attributes[SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME]; + spans.forEach((span) => { + span.data && delete span.data[SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME]; + }); + const transaction = { + contexts: { + trace: spanToTransactionTraceContext(this) + }, + spans: ( + // spans.sort() mutates the array, but `spans` is already a copy so we can safely do this here + // we do not use spans anymore after this point + spans.length > MAX_SPAN_COUNT ? spans.sort((a2, b2) => a2.start_timestamp - b2.start_timestamp).slice(0, MAX_SPAN_COUNT) : spans + ), + start_timestamp: this._startTime, + timestamp: this._endTime, + transaction: this._name, + type: "transaction", + sdkProcessingMetadata: { + capturedSpanScope, + capturedSpanIsolationScope, + ...dropUndefinedKeys({ + dynamicSamplingContext: getDynamicSamplingContextFromSpan(this) + }) + }, + _metrics_summary: getMetricSummaryJsonForSpan(this), + ...source && { + transaction_info: { + source + } + } + }; + const measurements = timedEventsToMeasurements(this._events); + const hasMeasurements = measurements && Object.keys(measurements).length; + if (hasMeasurements) { + DEBUG_BUILD$6 && logger$2.log( + "[Measurements] Adding measurements to transaction event", + JSON.stringify(measurements, void 0, 2) + ); + transaction.measurements = measurements; + } + return transaction; + } +} +function isSpanTimeInput(value4) { + return value4 && typeof value4 === "number" || value4 instanceof Date || Array.isArray(value4); +} +__name(isSpanTimeInput, "isSpanTimeInput"); +function isFullFinishedSpan(input) { + return !!input.start_timestamp && !!input.timestamp && !!input.span_id && !!input.trace_id; +} +__name(isFullFinishedSpan, "isFullFinishedSpan"); +function isStandaloneSpan(span) { + return span instanceof SentrySpan && span.isStandaloneSpan(); +} +__name(isStandaloneSpan, "isStandaloneSpan"); +function sendSpanEnvelope(envelope) { + const client = getClient(); + if (!client) { + return; + } + const spanItems = envelope[1]; + if (!spanItems || spanItems.length === 0) { + client.recordDroppedEvent("before_send", "span"); + return; + } + client.sendEnvelope(envelope); +} +__name(sendSpanEnvelope, "sendSpanEnvelope"); +const SUPPRESS_TRACING_KEY = "__SENTRY_SUPPRESS_TRACING__"; +function startSpan(options4, callback) { + const acs = getAcs(); + if (acs.startSpan) { + return acs.startSpan(options4, callback); + } + const spanArguments = parseSentrySpanArguments(options4); + const { forceTransaction, parentSpan: customParentSpan } = options4; + return withScope(options4.scope, () => { + const wrapper = getActiveSpanWrapper(customParentSpan); + return wrapper(() => { + const scope = getCurrentScope$1(); + const parentSpan = getParentSpan(scope); + const shouldSkipSpan = options4.onlyIfParent && !parentSpan; + const activeSpan = shouldSkipSpan ? new SentryNonRecordingSpan() : createChildOrRootSpan({ + parentSpan, + spanArguments, + forceTransaction, + scope + }); + _setSpanForScope(scope, activeSpan); + return handleCallbackErrors( + () => callback(activeSpan), + () => { + const { status } = spanToJSON(activeSpan); + if (activeSpan.isRecording() && (!status || status === "ok")) { + activeSpan.setStatus({ code: SPAN_STATUS_ERROR, message: "internal_error" }); + } + }, + () => activeSpan.end() + ); + }); + }); +} +__name(startSpan, "startSpan"); +function startSpanManual(options4, callback) { + const acs = getAcs(); + if (acs.startSpanManual) { + return acs.startSpanManual(options4, callback); + } + const spanArguments = parseSentrySpanArguments(options4); + const { forceTransaction, parentSpan: customParentSpan } = options4; + return withScope(options4.scope, () => { + const wrapper = getActiveSpanWrapper(customParentSpan); + return wrapper(() => { + const scope = getCurrentScope$1(); + const parentSpan = getParentSpan(scope); + const shouldSkipSpan = options4.onlyIfParent && !parentSpan; + const activeSpan = shouldSkipSpan ? new SentryNonRecordingSpan() : createChildOrRootSpan({ + parentSpan, + spanArguments, + forceTransaction, + scope + }); + _setSpanForScope(scope, activeSpan); + function finishAndSetSpan() { + activeSpan.end(); + } + __name(finishAndSetSpan, "finishAndSetSpan"); + return handleCallbackErrors( + () => callback(activeSpan, finishAndSetSpan), + () => { + const { status } = spanToJSON(activeSpan); + if (activeSpan.isRecording() && (!status || status === "ok")) { + activeSpan.setStatus({ code: SPAN_STATUS_ERROR, message: "internal_error" }); + } + } + ); + }); + }); +} +__name(startSpanManual, "startSpanManual"); +function startInactiveSpan(options4) { + const acs = getAcs(); + if (acs.startInactiveSpan) { + return acs.startInactiveSpan(options4); + } + const spanArguments = parseSentrySpanArguments(options4); + const { forceTransaction, parentSpan: customParentSpan } = options4; + const wrapper = options4.scope ? (callback) => withScope(options4.scope, callback) : customParentSpan !== void 0 ? (callback) => withActiveSpan(customParentSpan, callback) : (callback) => callback(); + return wrapper(() => { + const scope = getCurrentScope$1(); + const parentSpan = getParentSpan(scope); + const shouldSkipSpan = options4.onlyIfParent && !parentSpan; + if (shouldSkipSpan) { + return new SentryNonRecordingSpan(); + } + return createChildOrRootSpan({ + parentSpan, + spanArguments, + forceTransaction, + scope + }); + }); +} +__name(startInactiveSpan, "startInactiveSpan"); +const continueTrace = /* @__PURE__ */ __name((options4, callback) => { + const carrier = getMainCarrier(); + const acs = getAsyncContextStrategy(carrier); + if (acs.continueTrace) { + return acs.continueTrace(options4, callback); + } + const { sentryTrace, baggage } = options4; + return withScope((scope) => { + const propagationContext = propagationContextFromHeaders(sentryTrace, baggage); + scope.setPropagationContext(propagationContext); + return callback(); + }); +}, "continueTrace"); +function withActiveSpan(span, callback) { + const acs = getAcs(); + if (acs.withActiveSpan) { + return acs.withActiveSpan(span, callback); + } + return withScope((scope) => { + _setSpanForScope(scope, span || void 0); + return callback(scope); + }); +} +__name(withActiveSpan, "withActiveSpan"); +function suppressTracing(callback) { + const acs = getAcs(); + if (acs.suppressTracing) { + return acs.suppressTracing(callback); + } + return withScope((scope) => { + scope.setSDKProcessingMetadata({ [SUPPRESS_TRACING_KEY]: true }); + return callback(); + }); +} +__name(suppressTracing, "suppressTracing"); +function startNewTrace(callback) { + return withScope((scope) => { + scope.setPropagationContext({ traceId: generateTraceId() }); + DEBUG_BUILD$6 && logger$2.info(`Starting a new trace with id ${scope.getPropagationContext().traceId}`); + return withActiveSpan(null, callback); + }); +} +__name(startNewTrace, "startNewTrace"); +function createChildOrRootSpan({ + parentSpan, + spanArguments, + forceTransaction, + scope +}) { + if (!hasTracingEnabled()) { + return new SentryNonRecordingSpan(); + } + const isolationScope = getIsolationScope(); + let span; + if (parentSpan && !forceTransaction) { + span = _startChildSpan(parentSpan, scope, spanArguments); + addChildSpanToSpan(parentSpan, span); + } else if (parentSpan) { + const dsc = getDynamicSamplingContextFromSpan(parentSpan); + const { traceId, spanId: parentSpanId } = parentSpan.spanContext(); + const parentSampled = spanIsSampled(parentSpan); + span = _startRootSpan( + { + traceId, + parentSpanId, + ...spanArguments + }, + scope, + parentSampled + ); + freezeDscOnSpan(span, dsc); + } else { + const { + traceId, + dsc, + parentSpanId, + sampled: parentSampled + } = { + ...isolationScope.getPropagationContext(), + ...scope.getPropagationContext() + }; + span = _startRootSpan( + { + traceId, + parentSpanId, + ...spanArguments + }, + scope, + parentSampled + ); + if (dsc) { + freezeDscOnSpan(span, dsc); + } + } + logSpanStart(span); + setCapturedScopesOnSpan(span, scope, isolationScope); + return span; +} +__name(createChildOrRootSpan, "createChildOrRootSpan"); +function parseSentrySpanArguments(options4) { + const exp = options4.experimental || {}; + const initialCtx = { + isStandalone: exp.standalone, + ...options4 + }; + if (options4.startTime) { + const ctx = { ...initialCtx }; + ctx.startTimestamp = spanTimeInputToSeconds(options4.startTime); + delete ctx.startTime; + return ctx; + } + return initialCtx; +} +__name(parseSentrySpanArguments, "parseSentrySpanArguments"); +function getAcs() { + const carrier = getMainCarrier(); + return getAsyncContextStrategy(carrier); +} +__name(getAcs, "getAcs"); +function _startRootSpan(spanArguments, scope, parentSampled) { + const client = getClient(); + const options4 = client && client.getOptions() || {}; + const { name: name2 = "", attributes } = spanArguments; + const [sampled, sampleRate] = scope.getScopeData().sdkProcessingMetadata[SUPPRESS_TRACING_KEY] ? [false] : sampleSpan(options4, { + name: name2, + parentSampled, + attributes, + transactionContext: { + name: name2, + parentSampled + } + }); + const rootSpan = new SentrySpan({ + ...spanArguments, + attributes: { + [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: "custom", + ...spanArguments.attributes + }, + sampled + }); + if (sampleRate !== void 0) { + rootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, sampleRate); + } + if (client) { + client.emit("spanStart", rootSpan); + } + return rootSpan; +} +__name(_startRootSpan, "_startRootSpan"); +function _startChildSpan(parentSpan, scope, spanArguments) { + const { spanId, traceId } = parentSpan.spanContext(); + const sampled = scope.getScopeData().sdkProcessingMetadata[SUPPRESS_TRACING_KEY] ? false : spanIsSampled(parentSpan); + const childSpan = sampled ? new SentrySpan({ + ...spanArguments, + parentSpanId: spanId, + traceId, + sampled + }) : new SentryNonRecordingSpan({ traceId }); + addChildSpanToSpan(parentSpan, childSpan); + const client = getClient(); + if (client) { + client.emit("spanStart", childSpan); + if (spanArguments.endTimestamp) { + client.emit("spanEnd", childSpan); + } + } + return childSpan; +} +__name(_startChildSpan, "_startChildSpan"); +function getParentSpan(scope) { + const span = _getSpanForScope(scope); + if (!span) { + return void 0; + } + const client = getClient(); + const options4 = client ? client.getOptions() : {}; + if (options4.parentSpanIsAlwaysRootSpan) { + return getRootSpan(span); + } + return span; +} +__name(getParentSpan, "getParentSpan"); +function getActiveSpanWrapper(parentSpan) { + return parentSpan !== void 0 ? (callback) => { + return withActiveSpan(parentSpan, callback); + } : (callback) => callback(); +} +__name(getActiveSpanWrapper, "getActiveSpanWrapper"); +const TRACING_DEFAULTS = { + idleTimeout: 1e3, + finalTimeout: 3e4, + childSpanTimeout: 15e3 +}; +const FINISH_REASON_HEARTBEAT_FAILED = "heartbeatFailed"; +const FINISH_REASON_IDLE_TIMEOUT = "idleTimeout"; +const FINISH_REASON_FINAL_TIMEOUT = "finalTimeout"; +const FINISH_REASON_EXTERNAL_FINISH = "externalFinish"; +function startIdleSpan(startSpanOptions, options4 = {}) { + const activities = /* @__PURE__ */ new Map(); + let _finished = false; + let _idleTimeoutID; + let _finishReason = FINISH_REASON_EXTERNAL_FINISH; + let _autoFinishAllowed = !options4.disableAutoFinish; + const _cleanupHooks = []; + const { + idleTimeout = TRACING_DEFAULTS.idleTimeout, + finalTimeout = TRACING_DEFAULTS.finalTimeout, + childSpanTimeout = TRACING_DEFAULTS.childSpanTimeout, + beforeSpanEnd + } = options4; + const client = getClient(); + if (!client || !hasTracingEnabled()) { + return new SentryNonRecordingSpan(); + } + const scope = getCurrentScope$1(); + const previousActiveSpan = getActiveSpan(); + const span = _startIdleSpan(startSpanOptions); + span.end = new Proxy(span.end, { + apply(target, thisArg, args) { + if (beforeSpanEnd) { + beforeSpanEnd(span); + } + const [definedEndTimestamp, ...rest] = args; + const timestamp2 = definedEndTimestamp || timestampInSeconds(); + const spanEndTimestamp = spanTimeInputToSeconds(timestamp2); + const spans = getSpanDescendants(span).filter((child) => child !== span); + if (!spans.length) { + onIdleSpanEnded(spanEndTimestamp); + return Reflect.apply(target, thisArg, [spanEndTimestamp, ...rest]); + } + const childEndTimestamps = spans.map((span2) => spanToJSON(span2).timestamp).filter((timestamp3) => !!timestamp3); + const latestSpanEndTimestamp = childEndTimestamps.length ? Math.max(...childEndTimestamps) : void 0; + const spanStartTimestamp = spanToJSON(span).start_timestamp; + const endTimestamp = Math.min( + spanStartTimestamp ? spanStartTimestamp + finalTimeout / 1e3 : Infinity, + Math.max(spanStartTimestamp || -Infinity, Math.min(spanEndTimestamp, latestSpanEndTimestamp || Infinity)) + ); + onIdleSpanEnded(endTimestamp); + return Reflect.apply(target, thisArg, [endTimestamp, ...rest]); + } + }); + function _cancelIdleTimeout() { + if (_idleTimeoutID) { + clearTimeout(_idleTimeoutID); + _idleTimeoutID = void 0; + } + } + __name(_cancelIdleTimeout, "_cancelIdleTimeout"); + function _restartIdleTimeout(endTimestamp) { + _cancelIdleTimeout(); + _idleTimeoutID = setTimeout(() => { + if (!_finished && activities.size === 0 && _autoFinishAllowed) { + _finishReason = FINISH_REASON_IDLE_TIMEOUT; + span.end(endTimestamp); + } + }, idleTimeout); + } + __name(_restartIdleTimeout, "_restartIdleTimeout"); + function _restartChildSpanTimeout(endTimestamp) { + _idleTimeoutID = setTimeout(() => { + if (!_finished && _autoFinishAllowed) { + _finishReason = FINISH_REASON_HEARTBEAT_FAILED; + span.end(endTimestamp); + } + }, childSpanTimeout); + } + __name(_restartChildSpanTimeout, "_restartChildSpanTimeout"); + function _pushActivity(spanId) { + _cancelIdleTimeout(); + activities.set(spanId, true); + const endTimestamp = timestampInSeconds(); + _restartChildSpanTimeout(endTimestamp + childSpanTimeout / 1e3); + } + __name(_pushActivity, "_pushActivity"); + function _popActivity(spanId) { + if (activities.has(spanId)) { + activities.delete(spanId); + } + if (activities.size === 0) { + const endTimestamp = timestampInSeconds(); + _restartIdleTimeout(endTimestamp + idleTimeout / 1e3); + } + } + __name(_popActivity, "_popActivity"); + function onIdleSpanEnded(endTimestamp) { + _finished = true; + activities.clear(); + _cleanupHooks.forEach((cleanup) => cleanup()); + _setSpanForScope(scope, previousActiveSpan); + const spanJSON = spanToJSON(span); + const { start_timestamp: startTimestamp } = spanJSON; + if (!startTimestamp) { + return; + } + const attributes = spanJSON.data || {}; + if (!attributes[SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON]) { + span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON, _finishReason); + } + logger$2.log(`[Tracing] Idle span "${spanJSON.op}" finished`); + const childSpans = getSpanDescendants(span).filter((child) => child !== span); + let discardedSpans = 0; + childSpans.forEach((childSpan) => { + if (childSpan.isRecording()) { + childSpan.setStatus({ code: SPAN_STATUS_ERROR, message: "cancelled" }); + childSpan.end(endTimestamp); + DEBUG_BUILD$6 && logger$2.log("[Tracing] Cancelling span since span ended early", JSON.stringify(childSpan, void 0, 2)); + } + const childSpanJSON = spanToJSON(childSpan); + const { timestamp: childEndTimestamp = 0, start_timestamp: childStartTimestamp = 0 } = childSpanJSON; + const spanStartedBeforeIdleSpanEnd = childStartTimestamp <= endTimestamp; + const timeoutWithMarginOfError = (finalTimeout + idleTimeout) / 1e3; + const spanEndedBeforeFinalTimeout = childEndTimestamp - childStartTimestamp <= timeoutWithMarginOfError; + if (DEBUG_BUILD$6) { + const stringifiedSpan = JSON.stringify(childSpan, void 0, 2); + if (!spanStartedBeforeIdleSpanEnd) { + logger$2.log("[Tracing] Discarding span since it happened after idle span was finished", stringifiedSpan); + } else if (!spanEndedBeforeFinalTimeout) { + logger$2.log("[Tracing] Discarding span since it finished after idle span final timeout", stringifiedSpan); + } + } + if (!spanEndedBeforeFinalTimeout || !spanStartedBeforeIdleSpanEnd) { + removeChildSpanFromSpan(span, childSpan); + discardedSpans++; + } + }); + if (discardedSpans > 0) { + span.setAttribute("sentry.idle_span_discarded_spans", discardedSpans); + } + } + __name(onIdleSpanEnded, "onIdleSpanEnded"); + _cleanupHooks.push( + client.on("spanStart", (startedSpan) => { + if (_finished || startedSpan === span || !!spanToJSON(startedSpan).timestamp) { + return; + } + const allSpans = getSpanDescendants(span); + if (allSpans.includes(startedSpan)) { + _pushActivity(startedSpan.spanContext().spanId); + } + }) + ); + _cleanupHooks.push( + client.on("spanEnd", (endedSpan) => { + if (_finished) { + return; + } + _popActivity(endedSpan.spanContext().spanId); + }) + ); + _cleanupHooks.push( + client.on("idleSpanEnableAutoFinish", (spanToAllowAutoFinish) => { + if (spanToAllowAutoFinish === span) { + _autoFinishAllowed = true; + _restartIdleTimeout(); + if (activities.size) { + _restartChildSpanTimeout(); + } + } + }) + ); + if (!options4.disableAutoFinish) { + _restartIdleTimeout(); + } + setTimeout(() => { + if (!_finished) { + span.setStatus({ code: SPAN_STATUS_ERROR, message: "deadline_exceeded" }); + _finishReason = FINISH_REASON_FINAL_TIMEOUT; + span.end(); + } + }, finalTimeout); + return span; +} +__name(startIdleSpan, "startIdleSpan"); +function _startIdleSpan(options4) { + const span = startInactiveSpan(options4); + _setSpanForScope(getCurrentScope$1(), span); + DEBUG_BUILD$6 && logger$2.log("[Tracing] Started span is an idle span"); + return span; +} +__name(_startIdleSpan, "_startIdleSpan"); +function notifyEventProcessors(processors, event, hint, index2 = 0) { + return new SyncPromise((resolve2, reject3) => { + const processor = processors[index2]; + if (event === null || typeof processor !== "function") { + resolve2(event); + } else { + const result = processor({ ...event }, hint); + DEBUG_BUILD$6 && processor.id && result === null && logger$2.log(`Event processor "${processor.id}" dropped event`); + if (isThenable$1(result)) { + void result.then((final) => notifyEventProcessors(processors, final, hint, index2 + 1).then(resolve2)).then(null, reject3); + } else { + void notifyEventProcessors(processors, result, hint, index2 + 1).then(resolve2).then(null, reject3); + } + } + }); +} +__name(notifyEventProcessors, "notifyEventProcessors"); +let parsedStackResults; +let lastKeysCount; +let cachedFilenameDebugIds; +function getFilenameToDebugIdMap(stackParser) { + const debugIdMap = GLOBAL_OBJ._sentryDebugIds; + if (!debugIdMap) { + return {}; + } + const debugIdKeys = Object.keys(debugIdMap); + if (cachedFilenameDebugIds && debugIdKeys.length === lastKeysCount) { + return cachedFilenameDebugIds; + } + lastKeysCount = debugIdKeys.length; + cachedFilenameDebugIds = debugIdKeys.reduce((acc, stackKey) => { + if (!parsedStackResults) { + parsedStackResults = {}; + } + const result = parsedStackResults[stackKey]; + if (result) { + acc[result[0]] = result[1]; + } else { + const parsedStack = stackParser(stackKey); + for (let i2 = parsedStack.length - 1; i2 >= 0; i2--) { + const stackFrame = parsedStack[i2]; + const filename = stackFrame && stackFrame.filename; + const debugId = debugIdMap[stackKey]; + if (filename && debugId) { + acc[filename] = debugId; + parsedStackResults[stackKey] = [filename, debugId]; + break; + } + } + } + return acc; + }, {}); + return cachedFilenameDebugIds; +} +__name(getFilenameToDebugIdMap, "getFilenameToDebugIdMap"); +function getDebugImagesForResources(stackParser, resource_paths) { + const filenameDebugIdMap = getFilenameToDebugIdMap(stackParser); + if (!filenameDebugIdMap) { + return []; + } + const images = []; + for (const path of resource_paths) { + if (path && filenameDebugIdMap[path]) { + images.push({ + type: "sourcemap", + code_file: path, + debug_id: filenameDebugIdMap[path] + }); + } + } + return images; +} +__name(getDebugImagesForResources, "getDebugImagesForResources"); +function applyScopeDataToEvent(event, data25) { + const { fingerprint, span, breadcrumbs, sdkProcessingMetadata } = data25; + applyDataToEvent(event, data25); + if (span) { + applySpanToEvent(event, span); + } + applyFingerprintToEvent(event, fingerprint); + applyBreadcrumbsToEvent(event, breadcrumbs); + applySdkMetadataToEvent(event, sdkProcessingMetadata); +} +__name(applyScopeDataToEvent, "applyScopeDataToEvent"); +function mergeScopeData(data25, mergeData) { + const { + extra, + tags, + user, + contexts, + level, + sdkProcessingMetadata, + breadcrumbs, + fingerprint, + eventProcessors, + attachments, + propagationContext, + transactionName, + span + } = mergeData; + mergeAndOverwriteScopeData(data25, "extra", extra); + mergeAndOverwriteScopeData(data25, "tags", tags); + mergeAndOverwriteScopeData(data25, "user", user); + mergeAndOverwriteScopeData(data25, "contexts", contexts); + data25.sdkProcessingMetadata = merge$1(data25.sdkProcessingMetadata, sdkProcessingMetadata, 2); + if (level) { + data25.level = level; + } + if (transactionName) { + data25.transactionName = transactionName; + } + if (span) { + data25.span = span; + } + if (breadcrumbs.length) { + data25.breadcrumbs = [...data25.breadcrumbs, ...breadcrumbs]; + } + if (fingerprint.length) { + data25.fingerprint = [...data25.fingerprint, ...fingerprint]; + } + if (eventProcessors.length) { + data25.eventProcessors = [...data25.eventProcessors, ...eventProcessors]; + } + if (attachments.length) { + data25.attachments = [...data25.attachments, ...attachments]; + } + data25.propagationContext = { ...data25.propagationContext, ...propagationContext }; +} +__name(mergeScopeData, "mergeScopeData"); +function mergeAndOverwriteScopeData(data25, prop2, mergeVal) { + data25[prop2] = merge$1(data25[prop2], mergeVal, 1); +} +__name(mergeAndOverwriteScopeData, "mergeAndOverwriteScopeData"); +function applyDataToEvent(event, data25) { + const { extra, tags, user, contexts, level, transactionName } = data25; + const cleanedExtra = dropUndefinedKeys(extra); + if (cleanedExtra && Object.keys(cleanedExtra).length) { + event.extra = { ...cleanedExtra, ...event.extra }; + } + const cleanedTags = dropUndefinedKeys(tags); + if (cleanedTags && Object.keys(cleanedTags).length) { + event.tags = { ...cleanedTags, ...event.tags }; + } + const cleanedUser = dropUndefinedKeys(user); + if (cleanedUser && Object.keys(cleanedUser).length) { + event.user = { ...cleanedUser, ...event.user }; + } + const cleanedContexts = dropUndefinedKeys(contexts); + if (cleanedContexts && Object.keys(cleanedContexts).length) { + event.contexts = { ...cleanedContexts, ...event.contexts }; + } + if (level) { + event.level = level; + } + if (transactionName && event.type !== "transaction") { + event.transaction = transactionName; + } +} +__name(applyDataToEvent, "applyDataToEvent"); +function applyBreadcrumbsToEvent(event, breadcrumbs) { + const mergedBreadcrumbs = [...event.breadcrumbs || [], ...breadcrumbs]; + event.breadcrumbs = mergedBreadcrumbs.length ? mergedBreadcrumbs : void 0; +} +__name(applyBreadcrumbsToEvent, "applyBreadcrumbsToEvent"); +function applySdkMetadataToEvent(event, sdkProcessingMetadata) { + event.sdkProcessingMetadata = { + ...event.sdkProcessingMetadata, + ...sdkProcessingMetadata + }; +} +__name(applySdkMetadataToEvent, "applySdkMetadataToEvent"); +function applySpanToEvent(event, span) { + event.contexts = { + trace: spanToTraceContext(span), + ...event.contexts + }; + event.sdkProcessingMetadata = { + dynamicSamplingContext: getDynamicSamplingContextFromSpan(span), + ...event.sdkProcessingMetadata + }; + const rootSpan = getRootSpan(span); + const transactionName = spanToJSON(rootSpan).description; + if (transactionName && !event.transaction && event.type === "transaction") { + event.transaction = transactionName; + } +} +__name(applySpanToEvent, "applySpanToEvent"); +function applyFingerprintToEvent(event, fingerprint) { + event.fingerprint = event.fingerprint ? Array.isArray(event.fingerprint) ? event.fingerprint : [event.fingerprint] : []; + if (fingerprint) { + event.fingerprint = event.fingerprint.concat(fingerprint); + } + if (event.fingerprint && !event.fingerprint.length) { + delete event.fingerprint; + } +} +__name(applyFingerprintToEvent, "applyFingerprintToEvent"); +function prepareEvent(options4, event, hint, scope, client, isolationScope) { + const { normalizeDepth = 3, normalizeMaxBreadth = 1e3 } = options4; + const prepared = { + ...event, + event_id: event.event_id || hint.event_id || uuid4(), + timestamp: event.timestamp || dateTimestampInSeconds() + }; + const integrations = hint.integrations || options4.integrations.map((i2) => i2.name); + applyClientOptions(prepared, options4); + applyIntegrationsMetadata(prepared, integrations); + if (client) { + client.emit("applyFrameMetadata", event); + } + if (event.type === void 0) { + applyDebugIds(prepared, options4.stackParser); + } + const finalScope = getFinalScope(scope, hint.captureContext); + if (hint.mechanism) { + addExceptionMechanism(prepared, hint.mechanism); + } + const clientEventProcessors = client ? client.getEventProcessors() : []; + const data25 = getGlobalScope().getScopeData(); + if (isolationScope) { + const isolationData = isolationScope.getScopeData(); + mergeScopeData(data25, isolationData); + } + if (finalScope) { + const finalScopeData = finalScope.getScopeData(); + mergeScopeData(data25, finalScopeData); + } + const attachments = [...hint.attachments || [], ...data25.attachments]; + if (attachments.length) { + hint.attachments = attachments; + } + applyScopeDataToEvent(prepared, data25); + const eventProcessors = [ + ...clientEventProcessors, + // Run scope event processors _after_ all other processors + ...data25.eventProcessors + ]; + const result = notifyEventProcessors(eventProcessors, prepared, hint); + return result.then((evt) => { + if (evt) { + applyDebugMeta(evt); + } + if (typeof normalizeDepth === "number" && normalizeDepth > 0) { + return normalizeEvent(evt, normalizeDepth, normalizeMaxBreadth); + } + return evt; + }); +} +__name(prepareEvent, "prepareEvent"); +function applyClientOptions(event, options4) { + const { environment, release, dist: dist3, maxValueLength = 250 } = options4; + event.environment = event.environment || environment || DEFAULT_ENVIRONMENT; + if (!event.release && release) { + event.release = release; + } + if (!event.dist && dist3) { + event.dist = dist3; + } + if (event.message) { + event.message = truncate(event.message, maxValueLength); + } + const exception = event.exception && event.exception.values && event.exception.values[0]; + if (exception && exception.value) { + exception.value = truncate(exception.value, maxValueLength); + } + const request = event.request; + if (request && request.url) { + request.url = truncate(request.url, maxValueLength); + } +} +__name(applyClientOptions, "applyClientOptions"); +function applyDebugIds(event, stackParser) { + const filenameDebugIdMap = getFilenameToDebugIdMap(stackParser); + try { + event.exception.values.forEach((exception) => { + exception.stacktrace.frames.forEach((frame) => { + if (filenameDebugIdMap && frame.filename) { + frame.debug_id = filenameDebugIdMap[frame.filename]; + } + }); + }); + } catch (e2) { + } +} +__name(applyDebugIds, "applyDebugIds"); +function applyDebugMeta(event) { + const filenameDebugIdMap = {}; + try { + event.exception.values.forEach((exception) => { + exception.stacktrace.frames.forEach((frame) => { + if (frame.debug_id) { + if (frame.abs_path) { + filenameDebugIdMap[frame.abs_path] = frame.debug_id; + } else if (frame.filename) { + filenameDebugIdMap[frame.filename] = frame.debug_id; + } + delete frame.debug_id; + } + }); + }); + } catch (e2) { + } + if (Object.keys(filenameDebugIdMap).length === 0) { + return; + } + event.debug_meta = event.debug_meta || {}; + event.debug_meta.images = event.debug_meta.images || []; + const images = event.debug_meta.images; + Object.entries(filenameDebugIdMap).forEach(([filename, debug_id]) => { + images.push({ + type: "sourcemap", + code_file: filename, + debug_id + }); + }); +} +__name(applyDebugMeta, "applyDebugMeta"); +function applyIntegrationsMetadata(event, integrationNames) { + if (integrationNames.length > 0) { + event.sdk = event.sdk || {}; + event.sdk.integrations = [...event.sdk.integrations || [], ...integrationNames]; + } +} +__name(applyIntegrationsMetadata, "applyIntegrationsMetadata"); +function normalizeEvent(event, depth, maxBreadth) { + if (!event) { + return null; + } + const normalized = { + ...event, + ...event.breadcrumbs && { + breadcrumbs: event.breadcrumbs.map((b2) => ({ + ...b2, + ...b2.data && { + data: normalize$2(b2.data, depth, maxBreadth) + } + })) + }, + ...event.user && { + user: normalize$2(event.user, depth, maxBreadth) + }, + ...event.contexts && { + contexts: normalize$2(event.contexts, depth, maxBreadth) + }, + ...event.extra && { + extra: normalize$2(event.extra, depth, maxBreadth) + } + }; + if (event.contexts && event.contexts.trace && normalized.contexts) { + normalized.contexts.trace = event.contexts.trace; + if (event.contexts.trace.data) { + normalized.contexts.trace.data = normalize$2(event.contexts.trace.data, depth, maxBreadth); + } + } + if (event.spans) { + normalized.spans = event.spans.map((span) => { + return { + ...span, + ...span.data && { + data: normalize$2(span.data, depth, maxBreadth) + } + }; + }); + } + if (event.contexts && event.contexts.flags && normalized.contexts) { + normalized.contexts.flags = normalize$2(event.contexts.flags, 3, maxBreadth); + } + return normalized; +} +__name(normalizeEvent, "normalizeEvent"); +function getFinalScope(scope, captureContext) { + if (!captureContext) { + return scope; + } + const finalScope = scope ? scope.clone() : new Scope(); + finalScope.update(captureContext); + return finalScope; +} +__name(getFinalScope, "getFinalScope"); +function parseEventHintOrCaptureContext(hint) { + if (!hint) { + return void 0; + } + if (hintIsScopeOrFunction(hint)) { + return { captureContext: hint }; + } + if (hintIsScopeContext(hint)) { + return { + captureContext: hint + }; + } + return hint; +} +__name(parseEventHintOrCaptureContext, "parseEventHintOrCaptureContext"); +function hintIsScopeOrFunction(hint) { + return hint instanceof Scope || typeof hint === "function"; +} +__name(hintIsScopeOrFunction, "hintIsScopeOrFunction"); +const captureContextKeys = [ + "user", + "level", + "extra", + "contexts", + "tags", + "fingerprint", + "requestSession", + "propagationContext" +]; +function hintIsScopeContext(hint) { + return Object.keys(hint).some((key) => captureContextKeys.includes(key)); +} +__name(hintIsScopeContext, "hintIsScopeContext"); +function captureException(exception, hint) { + return getCurrentScope$1().captureException(exception, parseEventHintOrCaptureContext(hint)); +} +__name(captureException, "captureException"); +function captureMessage(message3, captureContext) { + const level = typeof captureContext === "string" ? captureContext : void 0; + const context = typeof captureContext !== "string" ? { captureContext } : void 0; + return getCurrentScope$1().captureMessage(message3, level, context); +} +__name(captureMessage, "captureMessage"); +function captureEvent(event, hint) { + return getCurrentScope$1().captureEvent(event, hint); +} +__name(captureEvent, "captureEvent"); +function setContext(name2, context) { + getIsolationScope().setContext(name2, context); +} +__name(setContext, "setContext"); +function setExtras(extras) { + getIsolationScope().setExtras(extras); +} +__name(setExtras, "setExtras"); +function setExtra(key, extra) { + getIsolationScope().setExtra(key, extra); +} +__name(setExtra, "setExtra"); +function setTags(tags) { + getIsolationScope().setTags(tags); +} +__name(setTags, "setTags"); +function setTag$5(key, value4) { + getIsolationScope().setTag(key, value4); +} +__name(setTag$5, "setTag$5"); +function setUser(user) { + getIsolationScope().setUser(user); +} +__name(setUser, "setUser"); +function lastEventId() { + return getIsolationScope().lastEventId(); +} +__name(lastEventId, "lastEventId"); +function captureCheckIn(checkIn, upsertMonitorConfig) { + const scope = getCurrentScope$1(); + const client = getClient(); + if (!client) { + DEBUG_BUILD$6 && logger$2.warn("Cannot capture check-in. No client defined."); + } else if (!client.captureCheckIn) { + DEBUG_BUILD$6 && logger$2.warn("Cannot capture check-in. Client does not support sending check-ins."); + } else { + return client.captureCheckIn(checkIn, upsertMonitorConfig, scope); + } + return uuid4(); +} +__name(captureCheckIn, "captureCheckIn"); +function withMonitor(monitorSlug, callback, upsertMonitorConfig) { + const checkInId = captureCheckIn({ monitorSlug, status: "in_progress" }, upsertMonitorConfig); + const now2 = timestampInSeconds(); + function finishCheckIn(status) { + captureCheckIn({ monitorSlug, status, checkInId, duration: timestampInSeconds() - now2 }); + } + __name(finishCheckIn, "finishCheckIn"); + return withIsolationScope(() => { + let maybePromiseResult; + try { + maybePromiseResult = callback(); + } catch (e2) { + finishCheckIn("error"); + throw e2; + } + if (isThenable$1(maybePromiseResult)) { + Promise.resolve(maybePromiseResult).then( + () => { + finishCheckIn("ok"); + }, + (e2) => { + finishCheckIn("error"); + throw e2; + } + ); + } else { + finishCheckIn("ok"); + } + return maybePromiseResult; + }); +} +__name(withMonitor, "withMonitor"); +async function flush(timeout) { + const client = getClient(); + if (client) { + return client.flush(timeout); + } + DEBUG_BUILD$6 && logger$2.warn("Cannot flush events. No client defined."); + return Promise.resolve(false); +} +__name(flush, "flush"); +async function close$1(timeout) { + const client = getClient(); + if (client) { + return client.close(timeout); + } + DEBUG_BUILD$6 && logger$2.warn("Cannot flush events and disable SDK. No client defined."); + return Promise.resolve(false); +} +__name(close$1, "close$1"); +function isInitialized() { + return !!getClient(); +} +__name(isInitialized, "isInitialized"); +function isEnabled() { + const client = getClient(); + return !!client && client.getOptions().enabled !== false && !!client.getTransport(); +} +__name(isEnabled, "isEnabled"); +function addEventProcessor(callback) { + getIsolationScope().addEventProcessor(callback); +} +__name(addEventProcessor, "addEventProcessor"); +function startSession(context) { + const client = getClient(); + const isolationScope = getIsolationScope(); + const currentScope = getCurrentScope$1(); + const { release, environment = DEFAULT_ENVIRONMENT } = client && client.getOptions() || {}; + const { userAgent } = GLOBAL_OBJ.navigator || {}; + const session = makeSession$1({ + release, + environment, + user: currentScope.getUser() || isolationScope.getUser(), + ...userAgent && { userAgent }, + ...context + }); + const currentSession = isolationScope.getSession(); + if (currentSession && currentSession.status === "ok") { + updateSession(currentSession, { status: "exited" }); + } + endSession(); + isolationScope.setSession(session); + currentScope.setSession(session); + return session; +} +__name(startSession, "startSession"); +function endSession() { + const isolationScope = getIsolationScope(); + const currentScope = getCurrentScope$1(); + const session = currentScope.getSession() || isolationScope.getSession(); + if (session) { + closeSession(session); + } + _sendSessionUpdate$1(); + isolationScope.setSession(); + currentScope.setSession(); +} +__name(endSession, "endSession"); +function _sendSessionUpdate$1() { + const isolationScope = getIsolationScope(); + const currentScope = getCurrentScope$1(); + const client = getClient(); + const session = currentScope.getSession() || isolationScope.getSession(); + if (session && client) { + client.captureSession(session); + } +} +__name(_sendSessionUpdate$1, "_sendSessionUpdate$1"); +function captureSession(end = false) { + if (end) { + endSession(); + return; + } + _sendSessionUpdate$1(); +} +__name(captureSession, "captureSession"); +class SessionFlusher { + static { + __name(this, "SessionFlusher"); + } + // We adjust the type here to add the `unref()` part, as setInterval can technically return a number or a NodeJS.Timer + constructor(client, attrs4) { + this._client = client; + this.flushTimeout = 60; + this._pendingAggregates = /* @__PURE__ */ new Map(); + this._isEnabled = true; + this._intervalId = setInterval(() => this.flush(), this.flushTimeout * 1e3); + if (this._intervalId.unref) { + this._intervalId.unref(); + } + this._sessionAttrs = attrs4; + } + /** Checks if `pendingAggregates` has entries, and if it does flushes them by calling `sendSession` */ + flush() { + const sessionAggregates = this.getSessionAggregates(); + if (sessionAggregates.aggregates.length === 0) { + return; + } + this._pendingAggregates = /* @__PURE__ */ new Map(); + this._client.sendSession(sessionAggregates); + } + /** Massages the entries in `pendingAggregates` and returns aggregated sessions */ + getSessionAggregates() { + const aggregates = Array.from(this._pendingAggregates.values()); + const sessionAggregates = { + attrs: this._sessionAttrs, + aggregates + }; + return dropUndefinedKeys(sessionAggregates); + } + /** JSDoc */ + close() { + clearInterval(this._intervalId); + this._isEnabled = false; + this.flush(); + } + /** + * Wrapper function for _incrementSessionStatusCount that checks if the instance of SessionFlusher is enabled then + * fetches the session status of the request from `Scope.getRequestSession().status` on the scope and passes them to + * `_incrementSessionStatusCount` along with the start date + */ + incrementSessionStatusCount() { + if (!this._isEnabled) { + return; + } + const isolationScope = getIsolationScope(); + const requestSession = isolationScope.getRequestSession(); + if (requestSession && requestSession.status) { + this._incrementSessionStatusCount(requestSession.status, /* @__PURE__ */ new Date()); + isolationScope.setRequestSession(void 0); + } + } + /** + * Increments status bucket in pendingAggregates buffer (internal state) corresponding to status of + * the session received + */ + // eslint-disable-next-line deprecation/deprecation + _incrementSessionStatusCount(status, date) { + const sessionStartedTrunc = new Date(date).setSeconds(0, 0); + let aggregationCounts = this._pendingAggregates.get(sessionStartedTrunc); + if (!aggregationCounts) { + aggregationCounts = { started: new Date(sessionStartedTrunc).toISOString() }; + this._pendingAggregates.set(sessionStartedTrunc, aggregationCounts); + } + switch (status) { + case "errored": + aggregationCounts.errored = (aggregationCounts.errored || 0) + 1; + return aggregationCounts.errored; + case "ok": + aggregationCounts.exited = (aggregationCounts.exited || 0) + 1; + return aggregationCounts.exited; + default: + aggregationCounts.crashed = (aggregationCounts.crashed || 0) + 1; + return aggregationCounts.crashed; + } + } +} +const SENTRY_API_VERSION = "7"; +function getBaseApiEndpoint(dsn) { + const protocol = dsn.protocol ? `${dsn.protocol}:` : ""; + const port = dsn.port ? `:${dsn.port}` : ""; + return `${protocol}//${dsn.host}${port}${dsn.path ? `/${dsn.path}` : ""}/api/`; +} +__name(getBaseApiEndpoint, "getBaseApiEndpoint"); +function _getIngestEndpoint(dsn) { + return `${getBaseApiEndpoint(dsn)}${dsn.projectId}/envelope/`; +} +__name(_getIngestEndpoint, "_getIngestEndpoint"); +function _encodedAuth(dsn, sdkInfo) { + const params = { + sentry_version: SENTRY_API_VERSION + }; + if (dsn.publicKey) { + params.sentry_key = dsn.publicKey; + } + if (sdkInfo) { + params.sentry_client = `${sdkInfo.name}/${sdkInfo.version}`; + } + return new URLSearchParams(params).toString(); +} +__name(_encodedAuth, "_encodedAuth"); +function getEnvelopeEndpointWithUrlEncodedAuth(dsn, tunnel, sdkInfo) { + return tunnel ? tunnel : `${_getIngestEndpoint(dsn)}?${_encodedAuth(dsn, sdkInfo)}`; +} +__name(getEnvelopeEndpointWithUrlEncodedAuth, "getEnvelopeEndpointWithUrlEncodedAuth"); +function getReportDialogEndpoint(dsnLike, dialogOptions) { + const dsn = makeDsn(dsnLike); + if (!dsn) { + return ""; + } + const endpoint = `${getBaseApiEndpoint(dsn)}embed/error-page/`; + let encodedOptions = `dsn=${dsnToString(dsn)}`; + for (const key in dialogOptions) { + if (key === "dsn") { + continue; + } + if (key === "onClose") { + continue; + } + if (key === "user") { + const user = dialogOptions.user; + if (!user) { + continue; + } + if (user.name) { + encodedOptions += `&name=${encodeURIComponent(user.name)}`; + } + if (user.email) { + encodedOptions += `&email=${encodeURIComponent(user.email)}`; + } + } else { + encodedOptions += `&${encodeURIComponent(key)}=${encodeURIComponent(dialogOptions[key])}`; + } + } + return `${endpoint}?${encodedOptions}`; +} +__name(getReportDialogEndpoint, "getReportDialogEndpoint"); +const installedIntegrations = []; +function filterDuplicates(integrations) { + const integrationsByName = {}; + integrations.forEach((currentInstance2) => { + const { name: name2 } = currentInstance2; + const existingInstance = integrationsByName[name2]; + if (existingInstance && !existingInstance.isDefaultInstance && currentInstance2.isDefaultInstance) { + return; + } + integrationsByName[name2] = currentInstance2; + }); + return Object.values(integrationsByName); +} +__name(filterDuplicates, "filterDuplicates"); +function getIntegrationsToSetup(options4) { + const defaultIntegrations = options4.defaultIntegrations || []; + const userIntegrations = options4.integrations; + defaultIntegrations.forEach((integration) => { + integration.isDefaultInstance = true; + }); + let integrations; + if (Array.isArray(userIntegrations)) { + integrations = [...defaultIntegrations, ...userIntegrations]; + } else if (typeof userIntegrations === "function") { + const resolvedUserIntegrations = userIntegrations(defaultIntegrations); + integrations = Array.isArray(resolvedUserIntegrations) ? resolvedUserIntegrations : [resolvedUserIntegrations]; + } else { + integrations = defaultIntegrations; + } + const finalIntegrations = filterDuplicates(integrations); + const debugIndex = finalIntegrations.findIndex((integration) => integration.name === "Debug"); + if (debugIndex > -1) { + const [debugInstance] = finalIntegrations.splice(debugIndex, 1); + finalIntegrations.push(debugInstance); + } + return finalIntegrations; +} +__name(getIntegrationsToSetup, "getIntegrationsToSetup"); +function setupIntegrations(client, integrations) { + const integrationIndex = {}; + integrations.forEach((integration) => { + if (integration) { + setupIntegration(client, integration, integrationIndex); + } + }); + return integrationIndex; +} +__name(setupIntegrations, "setupIntegrations"); +function afterSetupIntegrations(client, integrations) { + for (const integration of integrations) { + if (integration && integration.afterAllSetup) { + integration.afterAllSetup(client); + } + } +} +__name(afterSetupIntegrations, "afterSetupIntegrations"); +function setupIntegration(client, integration, integrationIndex) { + if (integrationIndex[integration.name]) { + DEBUG_BUILD$6 && logger$2.log(`Integration skipped because it was already installed: ${integration.name}`); + return; + } + integrationIndex[integration.name] = integration; + if (installedIntegrations.indexOf(integration.name) === -1 && typeof integration.setupOnce === "function") { + integration.setupOnce(); + installedIntegrations.push(integration.name); + } + if (integration.setup && typeof integration.setup === "function") { + integration.setup(client); + } + if (typeof integration.preprocessEvent === "function") { + const callback = integration.preprocessEvent.bind(integration); + client.on("preprocessEvent", (event, hint) => callback(event, hint, client)); + } + if (typeof integration.processEvent === "function") { + const callback = integration.processEvent.bind(integration); + const processor = Object.assign((event, hint) => callback(event, hint, client), { + id: integration.name + }); + client.addEventProcessor(processor); + } + DEBUG_BUILD$6 && logger$2.log(`Integration installed: ${integration.name}`); +} +__name(setupIntegration, "setupIntegration"); +function addIntegration(integration) { + const client = getClient(); + if (!client) { + DEBUG_BUILD$6 && logger$2.warn(`Cannot add integration "${integration.name}" because no SDK Client is available.`); + return; + } + client.addIntegration(integration); +} +__name(addIntegration, "addIntegration"); +function defineIntegration(fn) { + return fn; +} +__name(defineIntegration, "defineIntegration"); +function createClientReportEnvelope(discarded_events, dsn, timestamp2) { + const clientReportItem = [ + { type: "client_report" }, + { + timestamp: timestamp2 || dateTimestampInSeconds(), + discarded_events + } + ]; + return createEnvelope(dsn ? { dsn } : {}, [clientReportItem]); +} +__name(createClientReportEnvelope, "createClientReportEnvelope"); +class SentryError extends Error { + static { + __name(this, "SentryError"); + } + /** Display name of this error instance. */ + constructor(message3, logLevel = "warn") { + super(message3); + this.message = message3; + this.name = new.target.prototype.constructor.name; + Object.setPrototypeOf(this, new.target.prototype); + this.logLevel = logLevel; + } +} +const ALREADY_SEEN_ERROR = "Not capturing exception because it's already been captured."; +class BaseClient { + static { + __name(this, "BaseClient"); + } + /** Options passed to the SDK. */ + /** The client Dsn, if specified in options. Without this Dsn, the SDK will be disabled. */ + /** Array of set up integrations. */ + /** Number of calls being processed */ + /** Holds flushable */ + // eslint-disable-next-line @typescript-eslint/ban-types + /** + * Initializes this client instance. + * + * @param options Options for the client. + */ + constructor(options4) { + this._options = options4; + this._integrations = {}; + this._numProcessing = 0; + this._outcomes = {}; + this._hooks = {}; + this._eventProcessors = []; + if (options4.dsn) { + this._dsn = makeDsn(options4.dsn); + } else { + DEBUG_BUILD$6 && logger$2.warn("No DSN provided, client will not send events."); + } + if (this._dsn) { + const url = getEnvelopeEndpointWithUrlEncodedAuth( + this._dsn, + options4.tunnel, + options4._metadata ? options4._metadata.sdk : void 0 + ); + this._transport = options4.transport({ + tunnel: this._options.tunnel, + recordDroppedEvent: this.recordDroppedEvent.bind(this), + ...options4.transportOptions, + url + }); + } + const tracingOptions = ["enableTracing", "tracesSampleRate", "tracesSampler"]; + const undefinedOption = tracingOptions.find((option3) => option3 in options4 && options4[option3] == void 0); + if (undefinedOption) { + consoleSandbox(() => { + console.warn( + `[Sentry] Deprecation warning: \`${undefinedOption}\` is set to undefined, which leads to tracing being enabled. In v9, a value of \`undefined\` will result in tracing being disabled.` + ); + }); + } + } + /** + * @inheritDoc + */ + captureException(exception, hint, scope) { + const eventId = uuid4(); + if (checkOrSetAlreadyCaught(exception)) { + DEBUG_BUILD$6 && logger$2.log(ALREADY_SEEN_ERROR); + return eventId; + } + const hintWithEventId = { + event_id: eventId, + ...hint + }; + this._process( + this.eventFromException(exception, hintWithEventId).then( + (event) => this._captureEvent(event, hintWithEventId, scope) + ) + ); + return hintWithEventId.event_id; + } + /** + * @inheritDoc + */ + captureMessage(message3, level, hint, currentScope) { + const hintWithEventId = { + event_id: uuid4(), + ...hint + }; + const eventMessage = isParameterizedString(message3) ? message3 : String(message3); + const promisedEvent = isPrimitive(message3) ? this.eventFromMessage(eventMessage, level, hintWithEventId) : this.eventFromException(message3, hintWithEventId); + this._process(promisedEvent.then((event) => this._captureEvent(event, hintWithEventId, currentScope))); + return hintWithEventId.event_id; + } + /** + * @inheritDoc + */ + captureEvent(event, hint, currentScope) { + const eventId = uuid4(); + if (hint && hint.originalException && checkOrSetAlreadyCaught(hint.originalException)) { + DEBUG_BUILD$6 && logger$2.log(ALREADY_SEEN_ERROR); + return eventId; + } + const hintWithEventId = { + event_id: eventId, + ...hint + }; + const sdkProcessingMetadata = event.sdkProcessingMetadata || {}; + const capturedSpanScope = sdkProcessingMetadata.capturedSpanScope; + this._process(this._captureEvent(event, hintWithEventId, capturedSpanScope || currentScope)); + return hintWithEventId.event_id; + } + /** + * @inheritDoc + */ + captureSession(session) { + if (!(typeof session.release === "string")) { + DEBUG_BUILD$6 && logger$2.warn("Discarded session because of missing or non-string release"); + } else { + this.sendSession(session); + updateSession(session, { init: false }); + } + } + /** + * @inheritDoc + */ + getDsn() { + return this._dsn; + } + /** + * @inheritDoc + */ + getOptions() { + return this._options; + } + /** + * @see SdkMetadata + * + * @return The metadata of the SDK + */ + getSdkMetadata() { + return this._options._metadata; + } + /** + * @inheritDoc + */ + getTransport() { + return this._transport; + } + /** + * @inheritDoc + */ + flush(timeout) { + const transport = this._transport; + if (transport) { + this.emit("flush"); + return this._isClientDoneProcessing(timeout).then((clientFinished) => { + return transport.flush(timeout).then((transportFlushed) => clientFinished && transportFlushed); + }); + } else { + return resolvedSyncPromise(true); + } + } + /** + * @inheritDoc + */ + close(timeout) { + return this.flush(timeout).then((result) => { + this.getOptions().enabled = false; + this.emit("close"); + return result; + }); + } + /** Get all installed event processors. */ + getEventProcessors() { + return this._eventProcessors; + } + /** @inheritDoc */ + addEventProcessor(eventProcessor) { + this._eventProcessors.push(eventProcessor); + } + /** @inheritdoc */ + init() { + if (this._isEnabled() || // Force integrations to be setup even if no DSN was set when we have + // Spotlight enabled. This is particularly important for browser as we + // don't support the `spotlight` option there and rely on the users + // adding the `spotlightBrowserIntegration()` to their integrations which + // wouldn't get initialized with the check below when there's no DSN set. + this._options.integrations.some(({ name: name2 }) => name2.startsWith("Spotlight"))) { + this._setupIntegrations(); + } + } + /** + * Gets an installed integration by its name. + * + * @returns The installed integration or `undefined` if no integration with that `name` was installed. + */ + getIntegrationByName(integrationName) { + return this._integrations[integrationName]; + } + /** + * @inheritDoc + */ + addIntegration(integration) { + const isAlreadyInstalled = this._integrations[integration.name]; + setupIntegration(this, integration, this._integrations); + if (!isAlreadyInstalled) { + afterSetupIntegrations(this, [integration]); + } + } + /** + * @inheritDoc + */ + sendEvent(event, hint = {}) { + this.emit("beforeSendEvent", event, hint); + let env = createEventEnvelope(event, this._dsn, this._options._metadata, this._options.tunnel); + for (const attachment of hint.attachments || []) { + env = addItemToEnvelope(env, createAttachmentEnvelopeItem(attachment)); + } + const promise = this.sendEnvelope(env); + if (promise) { + promise.then((sendResponse) => this.emit("afterSendEvent", event, sendResponse), null); + } + } + /** + * @inheritDoc + */ + sendSession(session) { + const env = createSessionEnvelope(session, this._dsn, this._options._metadata, this._options.tunnel); + this.sendEnvelope(env); + } + /** + * @inheritDoc + */ + recordDroppedEvent(reason, category, eventOrCount) { + if (this._options.sendClientReports) { + const count = typeof eventOrCount === "number" ? eventOrCount : 1; + const key = `${reason}:${category}`; + DEBUG_BUILD$6 && logger$2.log(`Recording outcome: "${key}"${count > 1 ? ` (${count} times)` : ""}`); + this._outcomes[key] = (this._outcomes[key] || 0) + count; + } + } + // Keep on() & emit() signatures in sync with types' client.ts interface + /* eslint-disable @typescript-eslint/unified-signatures */ + /** @inheritdoc */ + /** @inheritdoc */ + on(hook, callback) { + const hooks2 = this._hooks[hook] = this._hooks[hook] || []; + hooks2.push(callback); + return () => { + const cbIndex = hooks2.indexOf(callback); + if (cbIndex > -1) { + hooks2.splice(cbIndex, 1); + } + }; + } + /** @inheritdoc */ + /** @inheritdoc */ + emit(hook, ...rest) { + const callbacks = this._hooks[hook]; + if (callbacks) { + callbacks.forEach((callback) => callback(...rest)); + } + } + /** + * @inheritdoc + */ + sendEnvelope(envelope) { + this.emit("beforeEnvelope", envelope); + if (this._isEnabled() && this._transport) { + return this._transport.send(envelope).then(null, (reason) => { + DEBUG_BUILD$6 && logger$2.error("Error while sending envelope:", reason); + return reason; + }); + } + DEBUG_BUILD$6 && logger$2.error("Transport disabled"); + return resolvedSyncPromise({}); + } + /* eslint-enable @typescript-eslint/unified-signatures */ + /** Setup integrations for this client. */ + _setupIntegrations() { + const { integrations } = this._options; + this._integrations = setupIntegrations(this, integrations); + afterSetupIntegrations(this, integrations); + } + /** Updates existing session based on the provided event */ + _updateSessionFromEvent(session, event) { + let crashed = false; + let errored = false; + const exceptions = event.exception && event.exception.values; + if (exceptions) { + errored = true; + for (const ex of exceptions) { + const mechanism = ex.mechanism; + if (mechanism && mechanism.handled === false) { + crashed = true; + break; + } + } + } + const sessionNonTerminal = session.status === "ok"; + const shouldUpdateAndSend = sessionNonTerminal && session.errors === 0 || sessionNonTerminal && crashed; + if (shouldUpdateAndSend) { + updateSession(session, { + ...crashed && { status: "crashed" }, + errors: session.errors || Number(errored || crashed) + }); + this.captureSession(session); + } + } + /** + * Determine if the client is finished processing. Returns a promise because it will wait `timeout` ms before saying + * "no" (resolving to `false`) in order to give the client a chance to potentially finish first. + * + * @param timeout The time, in ms, after which to resolve to `false` if the client is still busy. Passing `0` (or not + * passing anything) will make the promise wait as long as it takes for processing to finish before resolving to + * `true`. + * @returns A promise which will resolve to `true` if processing is already done or finishes before the timeout, and + * `false` otherwise + */ + _isClientDoneProcessing(timeout) { + return new SyncPromise((resolve2) => { + let ticked = 0; + const tick = 1; + const interval = setInterval(() => { + if (this._numProcessing == 0) { + clearInterval(interval); + resolve2(true); + } else { + ticked += tick; + if (timeout && ticked >= timeout) { + clearInterval(interval); + resolve2(false); + } + } + }, tick); + }); + } + /** Determines whether this SDK is enabled and a transport is present. */ + _isEnabled() { + return this.getOptions().enabled !== false && this._transport !== void 0; + } + /** + * Adds common information to events. + * + * The information includes release and environment from `options`, + * breadcrumbs and context (extra, tags and user) from the scope. + * + * Information that is already present in the event is never overwritten. For + * nested objects, such as the context, keys are merged. + * + * @param event The original event. + * @param hint May contain additional information about the original exception. + * @param currentScope A scope containing event metadata. + * @returns A new event with more information. + */ + _prepareEvent(event, hint, currentScope = getCurrentScope$1(), isolationScope = getIsolationScope()) { + const options4 = this.getOptions(); + const integrations = Object.keys(this._integrations); + if (!hint.integrations && integrations.length > 0) { + hint.integrations = integrations; + } + this.emit("preprocessEvent", event, hint); + if (!event.type) { + isolationScope.setLastEventId(event.event_id || hint.event_id); + } + return prepareEvent(options4, event, hint, currentScope, this, isolationScope).then((evt) => { + if (evt === null) { + return evt; + } + evt.contexts = { + trace: getTraceContextFromScope(currentScope), + ...evt.contexts + }; + const dynamicSamplingContext = getDynamicSamplingContextFromScope(this, currentScope); + evt.sdkProcessingMetadata = { + dynamicSamplingContext, + ...evt.sdkProcessingMetadata + }; + return evt; + }); + } + /** + * Processes the event and logs an error in case of rejection + * @param event + * @param hint + * @param scope + */ + _captureEvent(event, hint = {}, scope) { + return this._processEvent(event, hint, scope).then( + (finalEvent) => { + return finalEvent.event_id; + }, + (reason) => { + if (DEBUG_BUILD$6) { + const sentryError = reason; + if (sentryError.logLevel === "log") { + logger$2.log(sentryError.message); + } else { + logger$2.warn(sentryError); + } + } + return void 0; + } + ); + } + /** + * Processes an event (either error or message) and sends it to Sentry. + * + * This also adds breadcrumbs and context information to the event. However, + * platform specific meta data (such as the User's IP address) must be added + * by the SDK implementor. + * + * + * @param event The event to send to Sentry. + * @param hint May contain additional information about the original exception. + * @param currentScope A scope containing event metadata. + * @returns A SyncPromise that resolves with the event or rejects in case event was/will not be send. + */ + _processEvent(event, hint, currentScope) { + const options4 = this.getOptions(); + const { sampleRate } = options4; + const isTransaction = isTransactionEvent$1(event); + const isError2 = isErrorEvent$1(event); + const eventType = event.type || "error"; + const beforeSendLabel = `before send for type \`${eventType}\``; + const parsedSampleRate = typeof sampleRate === "undefined" ? void 0 : parseSampleRate(sampleRate); + if (isError2 && typeof parsedSampleRate === "number" && Math.random() > parsedSampleRate) { + this.recordDroppedEvent("sample_rate", "error", event); + return rejectedSyncPromise( + new SentryError( + `Discarding event because it's not included in the random sample (sampling rate = ${sampleRate})`, + "log" + ) + ); + } + const dataCategory = eventType === "replay_event" ? "replay" : eventType; + const sdkProcessingMetadata = event.sdkProcessingMetadata || {}; + const capturedSpanIsolationScope = sdkProcessingMetadata.capturedSpanIsolationScope; + return this._prepareEvent(event, hint, currentScope, capturedSpanIsolationScope).then((prepared) => { + if (prepared === null) { + this.recordDroppedEvent("event_processor", dataCategory, event); + throw new SentryError("An event processor returned `null`, will not send event.", "log"); + } + const isInternalException = hint.data && hint.data.__sentry__ === true; + if (isInternalException) { + return prepared; + } + const result = processBeforeSend(this, options4, prepared, hint); + return _validateBeforeSendResult(result, beforeSendLabel); + }).then((processedEvent) => { + if (processedEvent === null) { + this.recordDroppedEvent("before_send", dataCategory, event); + if (isTransaction) { + const spans = event.spans || []; + const spanCount = 1 + spans.length; + this.recordDroppedEvent("before_send", "span", spanCount); + } + throw new SentryError(`${beforeSendLabel} returned \`null\`, will not send event.`, "log"); + } + const session = currentScope && currentScope.getSession(); + if (!isTransaction && session) { + this._updateSessionFromEvent(session, processedEvent); + } + if (isTransaction) { + const spanCountBefore = processedEvent.sdkProcessingMetadata && processedEvent.sdkProcessingMetadata.spanCountBeforeProcessing || 0; + const spanCountAfter = processedEvent.spans ? processedEvent.spans.length : 0; + const droppedSpanCount = spanCountBefore - spanCountAfter; + if (droppedSpanCount > 0) { + this.recordDroppedEvent("before_send", "span", droppedSpanCount); + } + } + const transactionInfo = processedEvent.transaction_info; + if (isTransaction && transactionInfo && processedEvent.transaction !== event.transaction) { + const source = "custom"; + processedEvent.transaction_info = { + ...transactionInfo, + source + }; + } + this.sendEvent(processedEvent, hint); + return processedEvent; + }).then(null, (reason) => { + if (reason instanceof SentryError) { + throw reason; + } + this.captureException(reason, { + data: { + __sentry__: true + }, + originalException: reason + }); + throw new SentryError( + `Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event. +Reason: ${reason}` + ); + }); + } + /** + * Occupies the client with processing and event + */ + _process(promise) { + this._numProcessing++; + void promise.then( + (value4) => { + this._numProcessing--; + return value4; + }, + (reason) => { + this._numProcessing--; + return reason; + } + ); + } + /** + * Clears outcomes on this client and returns them. + */ + _clearOutcomes() { + const outcomes = this._outcomes; + this._outcomes = {}; + return Object.entries(outcomes).map(([key, quantity]) => { + const [reason, category] = key.split(":"); + return { + reason, + category, + quantity + }; + }); + } + /** + * Sends client reports as an envelope. + */ + _flushOutcomes() { + DEBUG_BUILD$6 && logger$2.log("Flushing outcomes..."); + const outcomes = this._clearOutcomes(); + if (outcomes.length === 0) { + DEBUG_BUILD$6 && logger$2.log("No outcomes to send"); + return; + } + if (!this._dsn) { + DEBUG_BUILD$6 && logger$2.log("No dsn provided, will not send outcomes"); + return; + } + DEBUG_BUILD$6 && logger$2.log("Sending outcomes:", outcomes); + const envelope = createClientReportEnvelope(outcomes, this._options.tunnel && dsnToString(this._dsn)); + this.sendEnvelope(envelope); + } + /** + * @inheritDoc + */ +} +function _validateBeforeSendResult(beforeSendResult, beforeSendLabel) { + const invalidValueError = `${beforeSendLabel} must return \`null\` or a valid event.`; + if (isThenable$1(beforeSendResult)) { + return beforeSendResult.then( + (event) => { + if (!isPlainObject$5(event) && event !== null) { + throw new SentryError(invalidValueError); + } + return event; + }, + (e2) => { + throw new SentryError(`${beforeSendLabel} rejected with ${e2}`); + } + ); + } else if (!isPlainObject$5(beforeSendResult) && beforeSendResult !== null) { + throw new SentryError(invalidValueError); + } + return beforeSendResult; +} +__name(_validateBeforeSendResult, "_validateBeforeSendResult"); +function processBeforeSend(client, options4, event, hint) { + const { beforeSend, beforeSendTransaction, beforeSendSpan } = options4; + if (isErrorEvent$1(event) && beforeSend) { + return beforeSend(event, hint); + } + if (isTransactionEvent$1(event)) { + if (event.spans && beforeSendSpan) { + const processedSpans = []; + for (const span of event.spans) { + const processedSpan = beforeSendSpan(span); + if (processedSpan) { + processedSpans.push(processedSpan); + } else { + showSpanDropWarning(); + client.recordDroppedEvent("before_send", "span"); + } + } + event.spans = processedSpans; + } + if (beforeSendTransaction) { + if (event.spans) { + const spanCountBefore = event.spans.length; + event.sdkProcessingMetadata = { + ...event.sdkProcessingMetadata, + spanCountBeforeProcessing: spanCountBefore + }; + } + return beforeSendTransaction(event, hint); + } + } + return event; +} +__name(processBeforeSend, "processBeforeSend"); +function isErrorEvent$1(event) { + return event.type === void 0; +} +__name(isErrorEvent$1, "isErrorEvent$1"); +function isTransactionEvent$1(event) { + return event.type === "transaction"; +} +__name(isTransactionEvent$1, "isTransactionEvent$1"); +function createCheckInEnvelope(checkIn, dynamicSamplingContext, metadata, tunnel, dsn) { + const headers = { + sent_at: (/* @__PURE__ */ new Date()).toISOString() + }; + if (metadata && metadata.sdk) { + headers.sdk = { + name: metadata.sdk.name, + version: metadata.sdk.version + }; + } + if (!!tunnel && !!dsn) { + headers.dsn = dsnToString(dsn); + } + if (dynamicSamplingContext) { + headers.trace = dropUndefinedKeys(dynamicSamplingContext); + } + const item3 = createCheckInEnvelopeItem(checkIn); + return createEnvelope(headers, [item3]); +} +__name(createCheckInEnvelope, "createCheckInEnvelope"); +function createCheckInEnvelopeItem(checkIn) { + const checkInHeaders = { + type: "check_in" + }; + return [checkInHeaders, checkIn]; +} +__name(createCheckInEnvelopeItem, "createCheckInEnvelopeItem"); +function parseStackFrames$1(stackParser, error2) { + return stackParser(error2.stack || "", 1); +} +__name(parseStackFrames$1, "parseStackFrames$1"); +function exceptionFromError$1(stackParser, error2) { + const exception = { + type: error2.name || error2.constructor.name, + value: error2.message + }; + const frames = parseStackFrames$1(stackParser, error2); + if (frames.length) { + exception.stacktrace = { frames }; + } + return exception; +} +__name(exceptionFromError$1, "exceptionFromError$1"); +function getErrorPropertyFromObject$1(obj) { + for (const prop2 in obj) { + if (Object.prototype.hasOwnProperty.call(obj, prop2)) { + const value4 = obj[prop2]; + if (value4 instanceof Error) { + return value4; + } + } + } + return void 0; +} +__name(getErrorPropertyFromObject$1, "getErrorPropertyFromObject$1"); +function getMessageForObject(exception) { + if ("name" in exception && typeof exception.name === "string") { + let message3 = `'${exception.name}' captured as exception`; + if ("message" in exception && typeof exception.message === "string") { + message3 += ` with message '${exception.message}'`; + } + return message3; + } else if ("message" in exception && typeof exception.message === "string") { + return exception.message; + } + const keys2 = extractExceptionKeysForMessage(exception); + if (isErrorEvent$2(exception)) { + return `Event \`ErrorEvent\` captured as exception with message \`${exception.message}\``; + } + const className = getObjectClassName$1(exception); + return `${className && className !== "Object" ? `'${className}'` : "Object"} captured as exception with keys: ${keys2}`; +} +__name(getMessageForObject, "getMessageForObject"); +function getObjectClassName$1(obj) { + try { + const prototype2 = Object.getPrototypeOf(obj); + return prototype2 ? prototype2.constructor.name : void 0; + } catch (e2) { + } +} +__name(getObjectClassName$1, "getObjectClassName$1"); +function getException(client, mechanism, exception, hint) { + if (isError(exception)) { + return [exception, void 0]; + } + mechanism.synthetic = true; + if (isPlainObject$5(exception)) { + const normalizeDepth = client && client.getOptions().normalizeDepth; + const extras = { ["__serialized__"]: normalizeToSize(exception, normalizeDepth) }; + const errorFromProp = getErrorPropertyFromObject$1(exception); + if (errorFromProp) { + return [errorFromProp, extras]; + } + const message3 = getMessageForObject(exception); + const ex2 = hint && hint.syntheticException || new Error(message3); + ex2.message = message3; + return [ex2, extras]; + } + const ex = hint && hint.syntheticException || new Error(exception); + ex.message = `${exception}`; + return [ex, void 0]; +} +__name(getException, "getException"); +function eventFromUnknownInput$1(client, stackParser, exception, hint) { + const providedMechanism = hint && hint.data && hint.data.mechanism; + const mechanism = providedMechanism || { + handled: true, + type: "generic" + }; + const [ex, extras] = getException(client, mechanism, exception, hint); + const event = { + exception: { + values: [exceptionFromError$1(stackParser, ex)] + } + }; + if (extras) { + event.extra = extras; + } + addExceptionTypeValue(event, void 0, void 0); + addExceptionMechanism(event, mechanism); + return { + ...event, + event_id: hint && hint.event_id + }; +} +__name(eventFromUnknownInput$1, "eventFromUnknownInput$1"); +function eventFromMessage$1(stackParser, message3, level = "info", hint, attachStacktrace) { + const event = { + event_id: hint && hint.event_id, + level + }; + if (attachStacktrace && hint && hint.syntheticException) { + const frames = parseStackFrames$1(stackParser, hint.syntheticException); + if (frames.length) { + event.exception = { + values: [ + { + value: message3, + stacktrace: { frames } + } + ] + }; + addExceptionMechanism(event, { synthetic: true }); + } + } + if (isParameterizedString(message3)) { + const { __sentry_template_string__, __sentry_template_values__ } = message3; + event.logentry = { + message: __sentry_template_string__, + params: __sentry_template_values__ + }; + return event; + } + event.message = message3; + return event; +} +__name(eventFromMessage$1, "eventFromMessage$1"); +class ServerRuntimeClient extends BaseClient { + static { + __name(this, "ServerRuntimeClient"); + } + // eslint-disable-next-line deprecation/deprecation + /** + * Creates a new Edge SDK instance. + * @param options Configuration options for this SDK. + */ + constructor(options4) { + registerSpanErrorInstrumentation(); + super(options4); + } + /** + * @inheritDoc + */ + eventFromException(exception, hint) { + const event = eventFromUnknownInput$1(this, this._options.stackParser, exception, hint); + event.level = "error"; + return resolvedSyncPromise(event); + } + /** + * @inheritDoc + */ + eventFromMessage(message3, level = "info", hint) { + return resolvedSyncPromise( + eventFromMessage$1(this._options.stackParser, message3, level, hint, this._options.attachStacktrace) + ); + } + /** + * @inheritDoc + */ + captureException(exception, hint, scope) { + if (this._options.autoSessionTracking && this._sessionFlusher) { + const requestSession = getIsolationScope().getRequestSession(); + if (requestSession && requestSession.status === "ok") { + requestSession.status = "errored"; + } + } + return super.captureException(exception, hint, scope); + } + /** + * @inheritDoc + */ + captureEvent(event, hint, scope) { + if (this._options.autoSessionTracking && this._sessionFlusher) { + const eventType = event.type || "exception"; + const isException = eventType === "exception" && event.exception && event.exception.values && event.exception.values.length > 0; + if (isException) { + const requestSession = getIsolationScope().getRequestSession(); + if (requestSession && requestSession.status === "ok") { + requestSession.status = "errored"; + } + } + } + return super.captureEvent(event, hint, scope); + } + /** + * + * @inheritdoc + */ + close(timeout) { + if (this._sessionFlusher) { + this._sessionFlusher.close(); + } + return super.close(timeout); + } + /** + * Initializes an instance of SessionFlusher on the client which will aggregate and periodically flush session data. + * + * NOTICE: This method will implicitly create an interval that is periodically called. + * To clean up this resources, call `.close()` when you no longer intend to use the client. + * Not doing so will result in a memory leak. + */ + initSessionFlusher() { + const { release, environment } = this._options; + if (!release) { + DEBUG_BUILD$6 && logger$2.warn("Cannot initialize an instance of SessionFlusher if no release is provided!"); + } else { + this._sessionFlusher = new SessionFlusher(this, { + release, + environment + }); + } + } + /** + * Create a cron monitor check in and send it to Sentry. + * + * @param checkIn An object that describes a check in. + * @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want + * to create a monitor automatically when sending a check in. + */ + captureCheckIn(checkIn, monitorConfig, scope) { + const id3 = "checkInId" in checkIn && checkIn.checkInId ? checkIn.checkInId : uuid4(); + if (!this._isEnabled()) { + DEBUG_BUILD$6 && logger$2.warn("SDK not enabled, will not capture checkin."); + return id3; + } + const options4 = this.getOptions(); + const { release, environment, tunnel } = options4; + const serializedCheckIn = { + check_in_id: id3, + monitor_slug: checkIn.monitorSlug, + status: checkIn.status, + release, + environment + }; + if ("duration" in checkIn) { + serializedCheckIn.duration = checkIn.duration; + } + if (monitorConfig) { + serializedCheckIn.monitor_config = { + schedule: monitorConfig.schedule, + checkin_margin: monitorConfig.checkinMargin, + max_runtime: monitorConfig.maxRuntime, + timezone: monitorConfig.timezone, + failure_issue_threshold: monitorConfig.failureIssueThreshold, + recovery_threshold: monitorConfig.recoveryThreshold + }; + } + const [dynamicSamplingContext, traceContext] = this._getTraceInfoFromScope(scope); + if (traceContext) { + serializedCheckIn.contexts = { + trace: traceContext + }; + } + const envelope = createCheckInEnvelope( + serializedCheckIn, + dynamicSamplingContext, + this.getSdkMetadata(), + tunnel, + this.getDsn() + ); + DEBUG_BUILD$6 && logger$2.info("Sending checkin:", checkIn.monitorSlug, checkIn.status); + this.sendEnvelope(envelope); + return id3; + } + /** + * Method responsible for capturing/ending a request session by calling `incrementSessionStatusCount` to increment + * appropriate session aggregates bucket + * + * @deprecated This method should not be used or extended. It's functionality will move into the `httpIntegration` and not be part of any public API. + */ + _captureRequestSession() { + if (!this._sessionFlusher) { + DEBUG_BUILD$6 && logger$2.warn("Discarded request mode session because autoSessionTracking option was disabled"); + } else { + this._sessionFlusher.incrementSessionStatusCount(); + } + } + /** + * @inheritDoc + */ + _prepareEvent(event, hint, scope, isolationScope) { + if (this._options.platform) { + event.platform = event.platform || this._options.platform; + } + if (this._options.runtime) { + event.contexts = { + ...event.contexts, + runtime: (event.contexts || {}).runtime || this._options.runtime + }; + } + if (this._options.serverName) { + event.server_name = event.server_name || this._options.serverName; + } + return super._prepareEvent(event, hint, scope, isolationScope); + } + /** Extract trace information from scope */ + _getTraceInfoFromScope(scope) { + if (!scope) { + return [void 0, void 0]; + } + const span = _getSpanForScope(scope); + const traceContext = span ? spanToTraceContext(span) : getTraceContextFromScope(scope); + const dynamicSamplingContext = span ? getDynamicSamplingContextFromSpan(span) : getDynamicSamplingContextFromScope(this, scope); + return [dynamicSamplingContext, traceContext]; + } +} +function initAndBind(clientClass, options4) { + if (options4.debug === true) { + if (DEBUG_BUILD$6) { + logger$2.enable(); + } else { + consoleSandbox(() => { + console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle."); + }); + } + } + const scope = getCurrentScope$1(); + scope.update(options4.initialScope); + const client = new clientClass(options4); + setCurrentClient(client); + client.init(); + return client; +} +__name(initAndBind, "initAndBind"); +function setCurrentClient(client) { + getCurrentScope$1().setClient(client); +} +__name(setCurrentClient, "setCurrentClient"); +function makePromiseBuffer(limit) { + const buffer2 = []; + function isReady() { + return limit === void 0 || buffer2.length < limit; + } + __name(isReady, "isReady"); + function remove4(task) { + return buffer2.splice(buffer2.indexOf(task), 1)[0] || Promise.resolve(void 0); + } + __name(remove4, "remove"); + function add3(taskProducer) { + if (!isReady()) { + return rejectedSyncPromise(new SentryError("Not adding Promise because buffer limit was reached.")); + } + const task = taskProducer(); + if (buffer2.indexOf(task) === -1) { + buffer2.push(task); + } + void task.then(() => remove4(task)).then( + null, + () => remove4(task).then(null, () => { + }) + ); + return task; + } + __name(add3, "add"); + function drain(timeout) { + return new SyncPromise((resolve2, reject3) => { + let counter = buffer2.length; + if (!counter) { + return resolve2(true); + } + const capturedSetTimeout = setTimeout(() => { + if (timeout && timeout > 0) { + resolve2(false); + } + }, timeout); + buffer2.forEach((item3) => { + void resolvedSyncPromise(item3).then(() => { + if (!--counter) { + clearTimeout(capturedSetTimeout); + resolve2(true); + } + }, reject3); + }); + }); + } + __name(drain, "drain"); + return { + $: buffer2, + add: add3, + drain + }; +} +__name(makePromiseBuffer, "makePromiseBuffer"); +const DEFAULT_RETRY_AFTER = 60 * 1e3; +function parseRetryAfterHeader(header3, now2 = Date.now()) { + const headerDelay = parseInt(`${header3}`, 10); + if (!isNaN(headerDelay)) { + return headerDelay * 1e3; + } + const headerDate = Date.parse(`${header3}`); + if (!isNaN(headerDate)) { + return headerDate - now2; + } + return DEFAULT_RETRY_AFTER; +} +__name(parseRetryAfterHeader, "parseRetryAfterHeader"); +function disabledUntil(limits, dataCategory) { + return limits[dataCategory] || limits.all || 0; +} +__name(disabledUntil, "disabledUntil"); +function isRateLimited(limits, dataCategory, now2 = Date.now()) { + return disabledUntil(limits, dataCategory) > now2; +} +__name(isRateLimited, "isRateLimited"); +function updateRateLimits(limits, { statusCode, headers }, now2 = Date.now()) { + const updatedRateLimits = { + ...limits + }; + const rateLimitHeader = headers && headers["x-sentry-rate-limits"]; + const retryAfterHeader = headers && headers["retry-after"]; + if (rateLimitHeader) { + for (const limit of rateLimitHeader.trim().split(",")) { + const [retryAfter, categories, , , namespaces] = limit.split(":", 5); + const headerDelay = parseInt(retryAfter, 10); + const delay = (!isNaN(headerDelay) ? headerDelay : 60) * 1e3; + if (!categories) { + updatedRateLimits.all = now2 + delay; + } else { + for (const category of categories.split(";")) { + if (category === "metric_bucket") { + if (!namespaces || namespaces.split(";").includes("custom")) { + updatedRateLimits[category] = now2 + delay; + } + } else { + updatedRateLimits[category] = now2 + delay; + } + } + } + } + } else if (retryAfterHeader) { + updatedRateLimits.all = now2 + parseRetryAfterHeader(retryAfterHeader, now2); + } else if (statusCode === 429) { + updatedRateLimits.all = now2 + 60 * 1e3; + } + return updatedRateLimits; +} +__name(updateRateLimits, "updateRateLimits"); +const DEFAULT_TRANSPORT_BUFFER_SIZE = 64; +function createTransport(options4, makeRequest, buffer2 = makePromiseBuffer( + options4.bufferSize || DEFAULT_TRANSPORT_BUFFER_SIZE +)) { + let rateLimits = {}; + const flush2 = /* @__PURE__ */ __name((timeout) => buffer2.drain(timeout), "flush"); + function send(envelope) { + const filteredEnvelopeItems = []; + forEachEnvelopeItem(envelope, (item3, type) => { + const dataCategory = envelopeItemTypeToDataCategory(type); + if (isRateLimited(rateLimits, dataCategory)) { + const event = getEventForEnvelopeItem(item3, type); + options4.recordDroppedEvent("ratelimit_backoff", dataCategory, event); + } else { + filteredEnvelopeItems.push(item3); + } + }); + if (filteredEnvelopeItems.length === 0) { + return resolvedSyncPromise({}); + } + const filteredEnvelope = createEnvelope(envelope[0], filteredEnvelopeItems); + const recordEnvelopeLoss = /* @__PURE__ */ __name((reason) => { + forEachEnvelopeItem(filteredEnvelope, (item3, type) => { + const event = getEventForEnvelopeItem(item3, type); + options4.recordDroppedEvent(reason, envelopeItemTypeToDataCategory(type), event); + }); + }, "recordEnvelopeLoss"); + const requestTask = /* @__PURE__ */ __name(() => makeRequest({ body: serializeEnvelope(filteredEnvelope) }).then( + (response) => { + if (response.statusCode !== void 0 && (response.statusCode < 200 || response.statusCode >= 300)) { + DEBUG_BUILD$6 && logger$2.warn(`Sentry responded with status code ${response.statusCode} to sent event.`); + } + rateLimits = updateRateLimits(rateLimits, response); + return response; + }, + (error2) => { + recordEnvelopeLoss("network_error"); + throw error2; + } + ), "requestTask"); + return buffer2.add(requestTask).then( + (result) => result, + (error2) => { + if (error2 instanceof SentryError) { + DEBUG_BUILD$6 && logger$2.error("Skipped sending event because buffer is full."); + recordEnvelopeLoss("queue_overflow"); + return resolvedSyncPromise({}); + } else { + throw error2; + } + } + ); + } + __name(send, "send"); + return { + send, + flush: flush2 + }; +} +__name(createTransport, "createTransport"); +function getEventForEnvelopeItem(item3, type) { + if (type !== "event" && type !== "transaction") { + return void 0; + } + return Array.isArray(item3) ? item3[1] : void 0; +} +__name(getEventForEnvelopeItem, "getEventForEnvelopeItem"); +const MIN_DELAY = 100; +const START_DELAY = 5e3; +const MAX_DELAY = 36e5; +function makeOfflineTransport(createTransport2) { + function log2(...args) { + DEBUG_BUILD$6 && logger$2.info("[Offline]:", ...args); + } + __name(log2, "log"); + return (options4) => { + const transport = createTransport2(options4); + if (!options4.createStore) { + throw new Error("No `createStore` function was provided"); + } + const store = options4.createStore(options4); + let retryDelay = START_DELAY; + let flushTimer; + function shouldQueue(env, error2, retryDelay2) { + if (envelopeContainsItemType(env, ["client_report"])) { + return false; + } + if (options4.shouldStore) { + return options4.shouldStore(env, error2, retryDelay2); + } + return true; + } + __name(shouldQueue, "shouldQueue"); + function flushIn(delay) { + if (flushTimer) { + clearTimeout(flushTimer); + } + flushTimer = setTimeout(async () => { + flushTimer = void 0; + const found2 = await store.shift(); + if (found2) { + log2("Attempting to send previously queued event"); + found2[0].sent_at = (/* @__PURE__ */ new Date()).toISOString(); + void send(found2, true).catch((e2) => { + log2("Failed to retry sending", e2); + }); + } + }, delay); + if (typeof flushTimer !== "number" && flushTimer.unref) { + flushTimer.unref(); + } + } + __name(flushIn, "flushIn"); + function flushWithBackOff() { + if (flushTimer) { + return; + } + flushIn(retryDelay); + retryDelay = Math.min(retryDelay * 2, MAX_DELAY); + } + __name(flushWithBackOff, "flushWithBackOff"); + async function send(envelope, isRetry = false) { + if (!isRetry && envelopeContainsItemType(envelope, ["replay_event", "replay_recording"])) { + await store.push(envelope); + flushIn(MIN_DELAY); + return {}; + } + try { + const result = await transport.send(envelope); + let delay = MIN_DELAY; + if (result) { + if (result.headers && result.headers["retry-after"]) { + delay = parseRetryAfterHeader(result.headers["retry-after"]); + } else if (result.headers && result.headers["x-sentry-rate-limits"]) { + delay = 6e4; + } else if ((result.statusCode || 0) >= 400) { + return result; + } + } + flushIn(delay); + retryDelay = START_DELAY; + return result; + } catch (e2) { + if (await shouldQueue(envelope, e2, retryDelay)) { + if (isRetry) { + await store.unshift(envelope); + } else { + await store.push(envelope); + } + flushWithBackOff(); + log2("Error sending. Event queued.", e2); + return {}; + } else { + throw e2; + } + } + } + __name(send, "send"); + if (options4.flushAtStartup) { + flushWithBackOff(); + } + return { + send, + flush: /* @__PURE__ */ __name((t2) => transport.flush(t2), "flush") + }; + }; +} +__name(makeOfflineTransport, "makeOfflineTransport"); +function eventFromEnvelope(env, types) { + let event; + forEachEnvelopeItem(env, (item3, type) => { + if (types.includes(type)) { + event = Array.isArray(item3) ? item3[1] : void 0; + } + return !!event; + }); + return event; +} +__name(eventFromEnvelope, "eventFromEnvelope"); +function makeOverrideReleaseTransport(createTransport2, release) { + return (options4) => { + const transport = createTransport2(options4); + return { + ...transport, + send: /* @__PURE__ */ __name(async (envelope) => { + const event = eventFromEnvelope(envelope, ["event", "transaction", "profile", "replay_event"]); + if (event) { + event.release = release; + } + return transport.send(envelope); + }, "send") + }; + }; +} +__name(makeOverrideReleaseTransport, "makeOverrideReleaseTransport"); +function overrideDsn(envelope, dsn) { + return createEnvelope( + dsn ? { + ...envelope[0], + dsn + } : envelope[0], + envelope[1] + ); +} +__name(overrideDsn, "overrideDsn"); +function makeMultiplexedTransport(createTransport2, matcher) { + return (options4) => { + const fallbackTransport = createTransport2(options4); + const otherTransports = /* @__PURE__ */ new Map(); + function getTransport(dsn, release) { + const key = release ? `${dsn}:${release}` : dsn; + let transport = otherTransports.get(key); + if (!transport) { + const validatedDsn = dsnFromString(dsn); + if (!validatedDsn) { + return void 0; + } + const url = getEnvelopeEndpointWithUrlEncodedAuth(validatedDsn, options4.tunnel); + transport = release ? makeOverrideReleaseTransport(createTransport2, release)({ ...options4, url }) : createTransport2({ ...options4, url }); + otherTransports.set(key, transport); + } + return [dsn, transport]; + } + __name(getTransport, "getTransport"); + async function send(envelope) { + function getEvent(types) { + const eventTypes = types && types.length ? types : ["event"]; + return eventFromEnvelope(envelope, eventTypes); + } + __name(getEvent, "getEvent"); + const transports = matcher({ envelope, getEvent }).map((result) => { + if (typeof result === "string") { + return getTransport(result, void 0); + } else { + return getTransport(result.dsn, result.release); + } + }).filter((t2) => !!t2); + const transportsWithFallback = transports.length ? transports : [["", fallbackTransport]]; + const results = await Promise.all( + transportsWithFallback.map(([dsn, transport]) => transport.send(overrideDsn(envelope, dsn))) + ); + return results[0]; + } + __name(send, "send"); + async function flush2(timeout) { + const allTransports = [...otherTransports.values(), fallbackTransport]; + const results = await Promise.all(allTransports.map((transport) => transport.flush(timeout))); + return results.every((r2) => r2); + } + __name(flush2, "flush"); + return { + send, + flush: flush2 + }; + }; +} +__name(makeMultiplexedTransport, "makeMultiplexedTransport"); +function isSentryRequestUrl(url, client) { + const dsn = client && client.getDsn(); + const tunnel = client && client.getOptions().tunnel; + return checkDsn(url, dsn) || checkTunnel(url, tunnel); +} +__name(isSentryRequestUrl, "isSentryRequestUrl"); +function checkTunnel(url, tunnel) { + if (!tunnel) { + return false; + } + return removeTrailingSlash$1(url) === removeTrailingSlash$1(tunnel); +} +__name(checkTunnel, "checkTunnel"); +function checkDsn(url, dsn) { + return dsn ? url.includes(dsn.host) : false; +} +__name(checkDsn, "checkDsn"); +function removeTrailingSlash$1(str) { + return str[str.length - 1] === "/" ? str.slice(0, -1) : str; +} +__name(removeTrailingSlash$1, "removeTrailingSlash$1"); +function parameterize(strings, ...values) { + const formatted = new String(String.raw(strings, ...values)); + formatted.__sentry_template_string__ = strings.join("\0").replace(/%/g, "%%").replace(/\0/g, "%s"); + formatted.__sentry_template_values__ = values; + return formatted; +} +__name(parameterize, "parameterize"); +function applySdkMetadata(options4, name2, names = [name2], source = "npm") { + const metadata = options4._metadata || {}; + if (!metadata.sdk) { + metadata.sdk = { + name: `sentry.javascript.${name2}`, + packages: names.map((name3) => ({ + name: `${source}:@sentry/${name3}`, + version: SDK_VERSION + })), + version: SDK_VERSION + }; + } + options4._metadata = metadata; +} +__name(applySdkMetadata, "applySdkMetadata"); +function getTraceData(options4 = {}) { + const client = getClient(); + if (!isEnabled() || !client) { + return {}; + } + const carrier = getMainCarrier(); + const acs = getAsyncContextStrategy(carrier); + if (acs.getTraceData) { + return acs.getTraceData(options4); + } + const scope = getCurrentScope$1(); + const span = options4.span || getActiveSpan(); + const sentryTrace = span ? spanToTraceHeader(span) : scopeToTraceHeader(scope); + const dsc = span ? getDynamicSamplingContextFromSpan(span) : getDynamicSamplingContextFromScope(client, scope); + const baggage = dynamicSamplingContextToSentryBaggageHeader(dsc); + const isValidSentryTraceHeader = TRACEPARENT_REGEXP.test(sentryTrace); + if (!isValidSentryTraceHeader) { + logger$2.warn("Invalid sentry-trace data. Cannot generate trace data"); + return {}; + } + return { + "sentry-trace": sentryTrace, + baggage + }; +} +__name(getTraceData, "getTraceData"); +function scopeToTraceHeader(scope) { + const { traceId, sampled, spanId } = scope.getPropagationContext(); + return generateSentryTraceHeader(traceId, spanId, sampled); +} +__name(scopeToTraceHeader, "scopeToTraceHeader"); +function getTraceMetaTags() { + return Object.entries(getTraceData()).map(([key, value4]) => `<meta name="${key}" content="${value4}"/>`).join("\n"); +} +__name(getTraceMetaTags, "getTraceMetaTags"); +const DEFAULT_BREADCRUMBS = 100; +function addBreadcrumb(breadcrumb, hint) { + const client = getClient(); + const isolationScope = getIsolationScope(); + if (!client) return; + const { beforeBreadcrumb = null, maxBreadcrumbs = DEFAULT_BREADCRUMBS } = client.getOptions(); + if (maxBreadcrumbs <= 0) return; + const timestamp2 = dateTimestampInSeconds(); + const mergedBreadcrumb = { timestamp: timestamp2, ...breadcrumb }; + const finalBreadcrumb = beforeBreadcrumb ? consoleSandbox(() => beforeBreadcrumb(mergedBreadcrumb, hint)) : mergedBreadcrumb; + if (finalBreadcrumb === null) return; + if (client.emit) { + client.emit("beforeAddBreadcrumb", finalBreadcrumb, hint); + } + isolationScope.addBreadcrumb(finalBreadcrumb, maxBreadcrumbs); +} +__name(addBreadcrumb, "addBreadcrumb"); +let originalFunctionToString; +const INTEGRATION_NAME$l = "FunctionToString"; +const SETUP_CLIENTS$1 = /* @__PURE__ */ new WeakMap(); +const _functionToStringIntegration = /* @__PURE__ */ __name(() => { + return { + name: INTEGRATION_NAME$l, + setupOnce() { + originalFunctionToString = Function.prototype.toString; + try { + Function.prototype.toString = function(...args) { + const originalFunction = getOriginalFunction(this); + const context = SETUP_CLIENTS$1.has(getClient()) && originalFunction !== void 0 ? originalFunction : this; + return originalFunctionToString.apply(context, args); + }; + } catch (e2) { + } + }, + setup(client) { + SETUP_CLIENTS$1.set(client, true); + } + }; +}, "_functionToStringIntegration"); +const functionToStringIntegration = defineIntegration(_functionToStringIntegration); +const DEFAULT_IGNORE_ERRORS = [ + /^Script error\.?$/, + /^Javascript error: Script error\.? on line 0$/, + /^ResizeObserver loop completed with undelivered notifications.$/, + // The browser logs this when a ResizeObserver handler takes a bit longer. Usually this is not an actual issue though. It indicates slowness. + /^Cannot redefine property: googletag$/, + // This is thrown when google tag manager is used in combination with an ad blocker + "undefined is not an object (evaluating 'a.L')", + // Random error that happens but not actionable or noticeable to end-users. + `can't redefine non-configurable property "solana"`, + // Probably a browser extension or custom browser (Brave) throwing this error + "vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)", + // Error thrown by GTM, seemingly not affecting end-users + "Can't find variable: _AutofillCallbackHandler", + // Unactionable error in instagram webview https://developers.facebook.com/community/threads/320013549791141/ + /^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/ + // unactionable error from CEFSharp, a .NET library that embeds chromium in .NET apps +]; +const INTEGRATION_NAME$k = "InboundFilters"; +const _inboundFiltersIntegration = /* @__PURE__ */ __name((options4 = {}) => { + return { + name: INTEGRATION_NAME$k, + processEvent(event, _hint, client) { + const clientOptions = client.getOptions(); + const mergedOptions = _mergeOptions(options4, clientOptions); + return _shouldDropEvent$1(event, mergedOptions) ? null : event; + } + }; +}, "_inboundFiltersIntegration"); +const inboundFiltersIntegration = defineIntegration(_inboundFiltersIntegration); +function _mergeOptions(internalOptions = {}, clientOptions = {}) { + return { + allowUrls: [...internalOptions.allowUrls || [], ...clientOptions.allowUrls || []], + denyUrls: [...internalOptions.denyUrls || [], ...clientOptions.denyUrls || []], + ignoreErrors: [ + ...internalOptions.ignoreErrors || [], + ...clientOptions.ignoreErrors || [], + ...internalOptions.disableErrorDefaults ? [] : DEFAULT_IGNORE_ERRORS + ], + ignoreTransactions: [...internalOptions.ignoreTransactions || [], ...clientOptions.ignoreTransactions || []], + ignoreInternal: internalOptions.ignoreInternal !== void 0 ? internalOptions.ignoreInternal : true + }; +} +__name(_mergeOptions, "_mergeOptions"); +function _shouldDropEvent$1(event, options4) { + if (options4.ignoreInternal && _isSentryError(event)) { + DEBUG_BUILD$6 && logger$2.warn(`Event dropped due to being internal Sentry Error. +Event: ${getEventDescription(event)}`); + return true; + } + if (_isIgnoredError(event, options4.ignoreErrors)) { + DEBUG_BUILD$6 && logger$2.warn( + `Event dropped due to being matched by \`ignoreErrors\` option. +Event: ${getEventDescription(event)}` + ); + return true; + } + if (_isUselessError(event)) { + DEBUG_BUILD$6 && logger$2.warn( + `Event dropped due to not having an error message, error type or stacktrace. +Event: ${getEventDescription( + event + )}` + ); + return true; + } + if (_isIgnoredTransaction(event, options4.ignoreTransactions)) { + DEBUG_BUILD$6 && logger$2.warn( + `Event dropped due to being matched by \`ignoreTransactions\` option. +Event: ${getEventDescription(event)}` + ); + return true; + } + if (_isDeniedUrl(event, options4.denyUrls)) { + DEBUG_BUILD$6 && logger$2.warn( + `Event dropped due to being matched by \`denyUrls\` option. +Event: ${getEventDescription( + event + )}. +Url: ${_getEventFilterUrl(event)}` + ); + return true; + } + if (!_isAllowedUrl(event, options4.allowUrls)) { + DEBUG_BUILD$6 && logger$2.warn( + `Event dropped due to not being matched by \`allowUrls\` option. +Event: ${getEventDescription( + event + )}. +Url: ${_getEventFilterUrl(event)}` + ); + return true; + } + return false; +} +__name(_shouldDropEvent$1, "_shouldDropEvent$1"); +function _isIgnoredError(event, ignoreErrors) { + if (event.type || !ignoreErrors || !ignoreErrors.length) { + return false; + } + return _getPossibleEventMessages(event).some((message3) => stringMatchesSomePattern(message3, ignoreErrors)); +} +__name(_isIgnoredError, "_isIgnoredError"); +function _isIgnoredTransaction(event, ignoreTransactions) { + if (event.type !== "transaction" || !ignoreTransactions || !ignoreTransactions.length) { + return false; + } + const name2 = event.transaction; + return name2 ? stringMatchesSomePattern(name2, ignoreTransactions) : false; +} +__name(_isIgnoredTransaction, "_isIgnoredTransaction"); +function _isDeniedUrl(event, denyUrls) { + if (!denyUrls || !denyUrls.length) { + return false; + } + const url = _getEventFilterUrl(event); + return !url ? false : stringMatchesSomePattern(url, denyUrls); +} +__name(_isDeniedUrl, "_isDeniedUrl"); +function _isAllowedUrl(event, allowUrls) { + if (!allowUrls || !allowUrls.length) { + return true; + } + const url = _getEventFilterUrl(event); + return !url ? true : stringMatchesSomePattern(url, allowUrls); +} +__name(_isAllowedUrl, "_isAllowedUrl"); +function _getPossibleEventMessages(event) { + const possibleMessages = []; + if (event.message) { + possibleMessages.push(event.message); + } + let lastException; + try { + lastException = event.exception.values[event.exception.values.length - 1]; + } catch (e2) { + } + if (lastException) { + if (lastException.value) { + possibleMessages.push(lastException.value); + if (lastException.type) { + possibleMessages.push(`${lastException.type}: ${lastException.value}`); + } + } + } + return possibleMessages; +} +__name(_getPossibleEventMessages, "_getPossibleEventMessages"); +function _isSentryError(event) { + try { + return event.exception.values[0].type === "SentryError"; + } catch (e2) { + } + return false; +} +__name(_isSentryError, "_isSentryError"); +function _getLastValidUrl(frames = []) { + for (let i2 = frames.length - 1; i2 >= 0; i2--) { + const frame = frames[i2]; + if (frame && frame.filename !== "<anonymous>" && frame.filename !== "[native code]") { + return frame.filename || null; + } + } + return null; +} +__name(_getLastValidUrl, "_getLastValidUrl"); +function _getEventFilterUrl(event) { + try { + let frames; + try { + frames = event.exception.values[0].stacktrace.frames; + } catch (e2) { + } + return frames ? _getLastValidUrl(frames) : null; + } catch (oO) { + DEBUG_BUILD$6 && logger$2.error(`Cannot extract url for event ${getEventDescription(event)}`); + return null; + } +} +__name(_getEventFilterUrl, "_getEventFilterUrl"); +function _isUselessError(event) { + if (event.type) { + return false; + } + if (!event.exception || !event.exception.values || event.exception.values.length === 0) { + return false; + } + return ( + // No top-level message + !event.message && // There are no exception values that have a stacktrace, a non-generic-Error type or value + !event.exception.values.some((value4) => value4.stacktrace || value4.type && value4.type !== "Error" || value4.value) + ); +} +__name(_isUselessError, "_isUselessError"); +function applyAggregateErrorsToEvent(exceptionFromErrorImplementation, parser, maxValueLimit = 250, key, limit, event, hint) { + if (!event.exception || !event.exception.values || !hint || !isInstanceOf(hint.originalException, Error)) { + return; + } + const originalException = event.exception.values.length > 0 ? event.exception.values[event.exception.values.length - 1] : void 0; + if (originalException) { + event.exception.values = truncateAggregateExceptions( + aggregateExceptionsFromError( + exceptionFromErrorImplementation, + parser, + limit, + hint.originalException, + key, + event.exception.values, + originalException, + 0 + ), + maxValueLimit + ); + } +} +__name(applyAggregateErrorsToEvent, "applyAggregateErrorsToEvent"); +function aggregateExceptionsFromError(exceptionFromErrorImplementation, parser, limit, error2, key, prevExceptions, exception, exceptionId) { + if (prevExceptions.length >= limit + 1) { + return prevExceptions; + } + let newExceptions = [...prevExceptions]; + if (isInstanceOf(error2[key], Error)) { + applyExceptionGroupFieldsForParentException(exception, exceptionId); + const newException = exceptionFromErrorImplementation(parser, error2[key]); + const newExceptionId = newExceptions.length; + applyExceptionGroupFieldsForChildException(newException, key, newExceptionId, exceptionId); + newExceptions = aggregateExceptionsFromError( + exceptionFromErrorImplementation, + parser, + limit, + error2[key], + key, + [newException, ...newExceptions], + newException, + newExceptionId + ); + } + if (Array.isArray(error2.errors)) { + error2.errors.forEach((childError, i2) => { + if (isInstanceOf(childError, Error)) { + applyExceptionGroupFieldsForParentException(exception, exceptionId); + const newException = exceptionFromErrorImplementation(parser, childError); + const newExceptionId = newExceptions.length; + applyExceptionGroupFieldsForChildException(newException, `errors[${i2}]`, newExceptionId, exceptionId); + newExceptions = aggregateExceptionsFromError( + exceptionFromErrorImplementation, + parser, + limit, + childError, + key, + [newException, ...newExceptions], + newException, + newExceptionId + ); + } + }); + } + return newExceptions; +} +__name(aggregateExceptionsFromError, "aggregateExceptionsFromError"); +function applyExceptionGroupFieldsForParentException(exception, exceptionId) { + exception.mechanism = exception.mechanism || { type: "generic", handled: true }; + exception.mechanism = { + ...exception.mechanism, + ...exception.type === "AggregateError" && { is_exception_group: true }, + exception_id: exceptionId + }; +} +__name(applyExceptionGroupFieldsForParentException, "applyExceptionGroupFieldsForParentException"); +function applyExceptionGroupFieldsForChildException(exception, source, exceptionId, parentId) { + exception.mechanism = exception.mechanism || { type: "generic", handled: true }; + exception.mechanism = { + ...exception.mechanism, + type: "chained", + source, + exception_id: exceptionId, + parent_id: parentId + }; +} +__name(applyExceptionGroupFieldsForChildException, "applyExceptionGroupFieldsForChildException"); +function truncateAggregateExceptions(exceptions, maxValueLength) { + return exceptions.map((exception) => { + if (exception.value) { + exception.value = truncate(exception.value, maxValueLength); + } + return exception; + }); +} +__name(truncateAggregateExceptions, "truncateAggregateExceptions"); +const DEFAULT_KEY$1 = "cause"; +const DEFAULT_LIMIT$2 = 5; +const INTEGRATION_NAME$j = "LinkedErrors"; +const _linkedErrorsIntegration$1 = /* @__PURE__ */ __name((options4 = {}) => { + const limit = options4.limit || DEFAULT_LIMIT$2; + const key = options4.key || DEFAULT_KEY$1; + return { + name: INTEGRATION_NAME$j, + preprocessEvent(event, hint, client) { + const options5 = client.getOptions(); + applyAggregateErrorsToEvent( + exceptionFromError$1, + options5.stackParser, + options5.maxValueLength, + key, + limit, + event, + hint + ); + } + }; +}, "_linkedErrorsIntegration$1"); +const linkedErrorsIntegration$1 = defineIntegration(_linkedErrorsIntegration$1); +const filenameMetadataMap = /* @__PURE__ */ new Map(); +const parsedStacks = /* @__PURE__ */ new Set(); +function ensureMetadataStacksAreParsed(parser) { + if (!GLOBAL_OBJ._sentryModuleMetadata) { + return; + } + for (const stack2 of Object.keys(GLOBAL_OBJ._sentryModuleMetadata)) { + const metadata = GLOBAL_OBJ._sentryModuleMetadata[stack2]; + if (parsedStacks.has(stack2)) { + continue; + } + parsedStacks.add(stack2); + const frames = parser(stack2); + for (const frame of frames.reverse()) { + if (frame.filename) { + filenameMetadataMap.set(frame.filename, metadata); + break; + } + } + } +} +__name(ensureMetadataStacksAreParsed, "ensureMetadataStacksAreParsed"); +function getMetadataForUrl(parser, filename) { + ensureMetadataStacksAreParsed(parser); + return filenameMetadataMap.get(filename); +} +__name(getMetadataForUrl, "getMetadataForUrl"); +function addMetadataToStackFrames(parser, event) { + try { + event.exception.values.forEach((exception) => { + if (!exception.stacktrace) { + return; + } + for (const frame of exception.stacktrace.frames || []) { + if (!frame.filename || frame.module_metadata) { + continue; + } + const metadata = getMetadataForUrl(parser, frame.filename); + if (metadata) { + frame.module_metadata = metadata; + } + } + }); + } catch (_2) { + } +} +__name(addMetadataToStackFrames, "addMetadataToStackFrames"); +function stripMetadataFromStackFrames(event) { + try { + event.exception.values.forEach((exception) => { + if (!exception.stacktrace) { + return; + } + for (const frame of exception.stacktrace.frames || []) { + delete frame.module_metadata; + } + }); + } catch (_2) { + } +} +__name(stripMetadataFromStackFrames, "stripMetadataFromStackFrames"); +const moduleMetadataIntegration = defineIntegration(() => { + return { + name: "ModuleMetadata", + setup(client) { + client.on("beforeEnvelope", (envelope) => { + forEachEnvelopeItem(envelope, (item3, type) => { + if (type === "event") { + const event = Array.isArray(item3) ? item3[1] : void 0; + if (event) { + stripMetadataFromStackFrames(event); + item3[1] = event; + } + } + }); + }); + client.on("applyFrameMetadata", (event) => { + if (event.type) { + return; + } + const stackParser = client.getOptions().stackParser; + addMetadataToStackFrames(stackParser, event); + }); + } + }; +}); +function parseCookie(str) { + const obj = {}; + let index2 = 0; + while (index2 < str.length) { + const eqIdx = str.indexOf("=", index2); + if (eqIdx === -1) { + break; + } + let endIdx = str.indexOf(";", index2); + if (endIdx === -1) { + endIdx = str.length; + } else if (endIdx < eqIdx) { + index2 = str.lastIndexOf(";", eqIdx - 1) + 1; + continue; + } + const key = str.slice(index2, eqIdx).trim(); + if (void 0 === obj[key]) { + let val = str.slice(eqIdx + 1, endIdx).trim(); + if (val.charCodeAt(0) === 34) { + val = val.slice(1, -1); + } + try { + obj[key] = val.indexOf("%") !== -1 ? decodeURIComponent(val) : val; + } catch (e2) { + obj[key] = val; + } + } + index2 = endIdx + 1; + } + return obj; +} +__name(parseCookie, "parseCookie"); +function parseUrl$1(url) { + if (!url) { + return {}; + } + const match2 = url.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/); + if (!match2) { + return {}; + } + const query = match2[6] || ""; + const fragment = match2[8] || ""; + return { + host: match2[4], + path: match2[5], + protocol: match2[2], + search: query, + hash: fragment, + relative: match2[5] + query + fragment + // everything minus origin + }; +} +__name(parseUrl$1, "parseUrl$1"); +function stripUrlQueryAndFragment(urlPath) { + return urlPath.split(/[?#]/, 1)[0]; +} +__name(stripUrlQueryAndFragment, "stripUrlQueryAndFragment"); +function getNumberOfUrlSegments(url) { + return url.split(/\\?\//).filter((s2) => s2.length > 0 && s2 !== ",").length; +} +__name(getNumberOfUrlSegments, "getNumberOfUrlSegments"); +function getSanitizedUrlString(url) { + const { protocol, host, path } = url; + const filteredHost = host && host.replace(/^.*@/, "[filtered]:[filtered]@").replace(/(:80)$/, "").replace(/(:443)$/, "") || ""; + return `${protocol ? `${protocol}://` : ""}${filteredHost}${path}`; +} +__name(getSanitizedUrlString, "getSanitizedUrlString"); +const ipHeaderNames = [ + "X-Client-IP", + "X-Forwarded-For", + "Fly-Client-IP", + "CF-Connecting-IP", + "Fastly-Client-Ip", + "True-Client-Ip", + "X-Real-IP", + "X-Cluster-Client-IP", + "X-Forwarded", + "Forwarded-For", + "Forwarded", + "X-Vercel-Forwarded-For" +]; +function getClientIPAddress(headers) { + const headerValues = ipHeaderNames.map((headerName) => { + const rawValue = headers[headerName]; + const value4 = Array.isArray(rawValue) ? rawValue.join(";") : rawValue; + if (headerName === "Forwarded") { + return parseForwardedHeader(value4); + } + return value4 && value4.split(",").map((v2) => v2.trim()); + }); + const flattenedHeaderValues = headerValues.reduce((acc, val) => { + if (!val) { + return acc; + } + return acc.concat(val); + }, []); + const ipAddress = flattenedHeaderValues.find((ip) => ip !== null && isIP(ip)); + return ipAddress || null; +} +__name(getClientIPAddress, "getClientIPAddress"); +function parseForwardedHeader(value4) { + if (!value4) { + return null; + } + for (const part of value4.split(";")) { + if (part.startsWith("for=")) { + return part.slice(4); + } + } + return null; +} +__name(parseForwardedHeader, "parseForwardedHeader"); +function isIP(str) { + const regex2 = /(?:^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$)|(?:^(?:(?:[a-fA-F\d]{1,4}:){7}(?:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,2}|:)|(?:[a-fA-F\d]{1,4}:){4}(?:(?::[a-fA-F\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,3}|:)|(?:[a-fA-F\d]{1,4}:){3}(?:(?::[a-fA-F\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,4}|:)|(?:[a-fA-F\d]{1,4}:){2}(?:(?::[a-fA-F\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,5}|:)|(?:[a-fA-F\d]{1,4}:){1}(?:(?::[a-fA-F\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,6}|:)|(?::(?:(?::[a-fA-F\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,7}|:)))(?:%[0-9a-zA-Z]{1,})?$)/; + return regex2.test(str); +} +__name(isIP, "isIP"); +const DEFAULT_INCLUDES = { + ip: false, + request: true, + user: true +}; +const DEFAULT_REQUEST_INCLUDES = ["cookies", "data", "headers", "method", "query_string", "url"]; +const DEFAULT_USER_INCLUDES = ["id", "username", "email"]; +function extractPathForTransaction(req, options4 = {}) { + const method = req.method && req.method.toUpperCase(); + let path = ""; + let source = "url"; + if (options4.customRoute || req.route) { + path = options4.customRoute || `${req.baseUrl || ""}${req.route && req.route.path}`; + source = "route"; + } else if (req.originalUrl || req.url) { + path = stripUrlQueryAndFragment(req.originalUrl || req.url || ""); + } + let name2 = ""; + if (options4.method && method) { + name2 += method; + } + if (options4.method && options4.path) { + name2 += " "; + } + if (options4.path && path) { + name2 += path; + } + return [name2, source]; +} +__name(extractPathForTransaction, "extractPathForTransaction"); +function extractUserData(user, keys2) { + const extractedUser = {}; + const attributes = Array.isArray(keys2) ? keys2 : DEFAULT_USER_INCLUDES; + attributes.forEach((key) => { + if (user && key in user) { + extractedUser[key] = user[key]; + } + }); + return extractedUser; +} +__name(extractUserData, "extractUserData"); +function extractRequestData(req, options4 = {}) { + const { include = DEFAULT_REQUEST_INCLUDES } = options4; + const requestData = {}; + const headers = req.headers || {}; + const method = req.method; + const host = headers.host || req.hostname || req.host || "<no host>"; + const protocol = req.protocol === "https" || req.socket && req.socket.encrypted ? "https" : "http"; + const originalUrl = req.originalUrl || req.url || ""; + const absoluteUrl = originalUrl.startsWith(protocol) ? originalUrl : `${protocol}://${host}${originalUrl}`; + include.forEach((key) => { + switch (key) { + case "headers": { + requestData.headers = headers; + if (!include.includes("cookies")) { + delete requestData.headers.cookie; + } + if (!include.includes("ip")) { + ipHeaderNames.forEach((ipHeaderName) => { + delete requestData.headers[ipHeaderName]; + }); + } + break; + } + case "method": { + requestData.method = method; + break; + } + case "url": { + requestData.url = absoluteUrl; + break; + } + case "cookies": { + requestData.cookies = // TODO (v8 / #5257): We're only sending the empty object for backwards compatibility, so the last bit can + // come off in v8 + req.cookies || headers.cookie && parseCookie(headers.cookie) || {}; + break; + } + case "query_string": { + requestData.query_string = extractQueryParams(req); + break; + } + case "data": { + if (method === "GET" || method === "HEAD") { + break; + } + const body = req.body; + if (body !== void 0) { + const stringBody = isString$8(body) ? body : isPlainObject$5(body) ? JSON.stringify(normalize$2(body)) : truncate(`${body}`, 1024); + if (stringBody) { + requestData.data = stringBody; + } + } + break; + } + default: { + if ({}.hasOwnProperty.call(req, key)) { + requestData[key] = req[key]; + } + } + } + }); + return requestData; +} +__name(extractRequestData, "extractRequestData"); +function addNormalizedRequestDataToEvent(event, req, additionalData, options4) { + const include = { + ...DEFAULT_INCLUDES, + ...options4 && options4.include + }; + if (include.request) { + const includeRequest = Array.isArray(include.request) ? [...include.request] : [...DEFAULT_REQUEST_INCLUDES]; + if (include.ip) { + includeRequest.push("ip"); + } + const extractedRequestData = extractNormalizedRequestData(req, { include: includeRequest }); + event.request = { + ...event.request, + ...extractedRequestData + }; + } + if (include.user) { + const extractedUser = additionalData.user && isPlainObject$5(additionalData.user) ? extractUserData(additionalData.user, include.user) : {}; + if (Object.keys(extractedUser).length) { + event.user = { + ...extractedUser, + ...event.user + }; + } + } + if (include.ip) { + const ip = req.headers && getClientIPAddress(req.headers) || additionalData.ipAddress; + if (ip) { + event.user = { + ...event.user, + ip_address: ip + }; + } + } +} +__name(addNormalizedRequestDataToEvent, "addNormalizedRequestDataToEvent"); +function addRequestDataToEvent(event, req, options4) { + const include = { + ...DEFAULT_INCLUDES, + ...options4 && options4.include + }; + if (include.request) { + const includeRequest = Array.isArray(include.request) ? [...include.request] : [...DEFAULT_REQUEST_INCLUDES]; + if (include.ip) { + includeRequest.push("ip"); + } + const extractedRequestData = extractRequestData(req, { include: includeRequest }); + event.request = { + ...event.request, + ...extractedRequestData + }; + } + if (include.user) { + const extractedUser = req.user && isPlainObject$5(req.user) ? extractUserData(req.user, include.user) : {}; + if (Object.keys(extractedUser).length) { + event.user = { + ...event.user, + ...extractedUser + }; + } + } + if (include.ip) { + const ip = req.headers && getClientIPAddress(req.headers) || req.ip || req.socket && req.socket.remoteAddress; + if (ip) { + event.user = { + ...event.user, + ip_address: ip + }; + } + } + return event; +} +__name(addRequestDataToEvent, "addRequestDataToEvent"); +function extractQueryParams(req) { + let originalUrl = req.originalUrl || req.url || ""; + if (!originalUrl) { + return; + } + if (originalUrl.startsWith("/")) { + originalUrl = `http://dogs.are.great${originalUrl}`; + } + try { + const queryParams = req.query || new URL(originalUrl).search.slice(1); + return queryParams.length ? queryParams : void 0; + } catch (e2) { + return void 0; + } +} +__name(extractQueryParams, "extractQueryParams"); +function winterCGHeadersToDict(winterCGHeaders) { + const headers = {}; + try { + winterCGHeaders.forEach((value4, key) => { + if (typeof value4 === "string") { + headers[key] = value4; + } + }); + } catch (e2) { + DEBUG_BUILD$5 && logger$2.warn("Sentry failed extracting headers from a request object. If you see this, please file an issue."); + } + return headers; +} +__name(winterCGHeadersToDict, "winterCGHeadersToDict"); +function headersToDict(reqHeaders) { + const headers = /* @__PURE__ */ Object.create(null); + try { + Object.entries(reqHeaders).forEach(([key, value4]) => { + if (typeof value4 === "string") { + headers[key] = value4; + } + }); + } catch (e2) { + DEBUG_BUILD$5 && logger$2.warn("Sentry failed extracting headers from a request object. If you see this, please file an issue."); + } + return headers; +} +__name(headersToDict, "headersToDict"); +function winterCGRequestToRequestData(req) { + const headers = winterCGHeadersToDict(req.headers); + return { + method: req.method, + url: req.url, + query_string: extractQueryParamsFromUrl(req.url), + headers + // TODO: Can we extract body data from the request? + }; +} +__name(winterCGRequestToRequestData, "winterCGRequestToRequestData"); +function httpRequestToRequestData(request) { + const headers = request.headers || {}; + const host = headers.host || "<no host>"; + const protocol = request.socket && request.socket.encrypted ? "https" : "http"; + const originalUrl = request.url || ""; + const absoluteUrl = originalUrl.startsWith(protocol) ? originalUrl : `${protocol}://${host}${originalUrl}`; + const data25 = request.body || void 0; + const cookies2 = request.cookies; + return dropUndefinedKeys({ + url: absoluteUrl, + method: request.method, + query_string: extractQueryParamsFromUrl(originalUrl), + headers: headersToDict(headers), + cookies: cookies2, + data: data25 + }); +} +__name(httpRequestToRequestData, "httpRequestToRequestData"); +function extractQueryParamsFromUrl(url) { + if (!url) { + return; + } + try { + const queryParams = new URL(url, "http://dogs.are.great").search.slice(1); + return queryParams.length ? queryParams : void 0; + } catch (e3) { + return void 0; + } +} +__name(extractQueryParamsFromUrl, "extractQueryParamsFromUrl"); +function extractNormalizedRequestData(normalizedRequest, { include }) { + const includeKeys = include ? Array.isArray(include) ? include : DEFAULT_REQUEST_INCLUDES : []; + const requestData = {}; + const headers = { ...normalizedRequest.headers }; + if (includeKeys.includes("headers")) { + requestData.headers = headers; + if (!include.includes("cookies")) { + delete headers.cookie; + } + if (!include.includes("ip")) { + ipHeaderNames.forEach((ipHeaderName) => { + delete headers[ipHeaderName]; + }); + } + } + if (includeKeys.includes("method")) { + requestData.method = normalizedRequest.method; + } + if (includeKeys.includes("url")) { + requestData.url = normalizedRequest.url; + } + if (includeKeys.includes("cookies")) { + const cookies2 = normalizedRequest.cookies || (headers && headers.cookie ? parseCookie(headers.cookie) : void 0); + requestData.cookies = cookies2 || {}; + } + if (includeKeys.includes("query_string")) { + requestData.query_string = normalizedRequest.query_string; + } + if (includeKeys.includes("data")) { + requestData.data = normalizedRequest.data; + } + return requestData; +} +__name(extractNormalizedRequestData, "extractNormalizedRequestData"); +const DEFAULT_OPTIONS$1 = { + include: { + cookies: true, + data: true, + headers: true, + ip: false, + query_string: true, + url: true, + user: { + id: true, + username: true, + email: true + } + }, + transactionNamingScheme: "methodPath" +}; +const INTEGRATION_NAME$i = "RequestData"; +const _requestDataIntegration = /* @__PURE__ */ __name((options4 = {}) => { + const _options = { + ...DEFAULT_OPTIONS$1, + ...options4, + include: { + ...DEFAULT_OPTIONS$1.include, + ...options4.include, + user: options4.include && typeof options4.include.user === "boolean" ? options4.include.user : { + ...DEFAULT_OPTIONS$1.include.user, + // Unclear why TS still thinks `options.include.user` could be a boolean at this point + ...(options4.include || {}).user + } + } + }; + return { + name: INTEGRATION_NAME$i, + processEvent(event) { + const { sdkProcessingMetadata = {} } = event; + const { request, normalizedRequest } = sdkProcessingMetadata; + const addRequestDataOptions = convertReqDataIntegrationOptsToAddReqDataOpts(_options); + if (normalizedRequest) { + const ipAddress = request ? request.ip || request.socket && request.socket.remoteAddress : void 0; + const user = request ? request.user : void 0; + addNormalizedRequestDataToEvent(event, normalizedRequest, { ipAddress, user }, addRequestDataOptions); + return event; + } + if (!request) { + return event; + } + return addRequestDataToEvent(event, request, addRequestDataOptions); + } + }; +}, "_requestDataIntegration"); +const requestDataIntegration = defineIntegration(_requestDataIntegration); +function convertReqDataIntegrationOptsToAddReqDataOpts(integrationOptions) { + const { + // eslint-disable-next-line deprecation/deprecation + transactionNamingScheme, + include: { ip, user, ...requestOptions } + } = integrationOptions; + const requestIncludeKeys = ["method"]; + for (const [key, value4] of Object.entries(requestOptions)) { + if (value4) { + requestIncludeKeys.push(key); + } + } + let addReqDataUserOpt; + if (user === void 0) { + addReqDataUserOpt = true; + } else if (typeof user === "boolean") { + addReqDataUserOpt = user; + } else { + const userIncludeKeys = []; + for (const [key, value4] of Object.entries(user)) { + if (value4) { + userIncludeKeys.push(key); + } + } + addReqDataUserOpt = userIncludeKeys; + } + return { + include: { + ip, + user: addReqDataUserOpt, + request: requestIncludeKeys.length !== 0 ? requestIncludeKeys : void 0, + transaction: transactionNamingScheme + } + }; +} +__name(convertReqDataIntegrationOptsToAddReqDataOpts, "convertReqDataIntegrationOptsToAddReqDataOpts"); +function addConsoleInstrumentationHandler(handler6) { + const type = "console"; + addHandler$1(type, handler6); + maybeInstrument(type, instrumentConsole); +} +__name(addConsoleInstrumentationHandler, "addConsoleInstrumentationHandler"); +function instrumentConsole() { + if (!("console" in GLOBAL_OBJ)) { + return; + } + CONSOLE_LEVELS$1.forEach(function(level) { + if (!(level in GLOBAL_OBJ.console)) { + return; + } + fill(GLOBAL_OBJ.console, level, function(originalConsoleMethod) { + originalConsoleMethods[level] = originalConsoleMethod; + return function(...args) { + const handlerData = { args, level }; + triggerHandlers$1("console", handlerData); + const log2 = originalConsoleMethods[level]; + log2 && log2.apply(GLOBAL_OBJ.console, args); + }; + }); + }); +} +__name(instrumentConsole, "instrumentConsole"); +const validSeverityLevels = ["fatal", "error", "warning", "log", "info", "debug"]; +function severityLevelFromString(level) { + return level === "warn" ? "warning" : ["fatal", "error", "warning", "log", "info", "debug"].includes(level) ? level : "log"; +} +__name(severityLevelFromString, "severityLevelFromString"); +const INTEGRATION_NAME$h = "CaptureConsole"; +const _captureConsoleIntegration = /* @__PURE__ */ __name((options4 = {}) => { + const levels = options4.levels || CONSOLE_LEVELS$1; + const handled = !!options4.handled; + return { + name: INTEGRATION_NAME$h, + setup(client) { + if (!("console" in GLOBAL_OBJ)) { + return; + } + addConsoleInstrumentationHandler(({ args, level }) => { + if (getClient() !== client || !levels.includes(level)) { + return; + } + consoleHandler(args, level, handled); + }); + } + }; +}, "_captureConsoleIntegration"); +const captureConsoleIntegration = defineIntegration(_captureConsoleIntegration); +function consoleHandler(args, level, handled) { + const captureContext = { + level: severityLevelFromString(level), + extra: { + arguments: args + } + }; + withScope((scope) => { + scope.addEventProcessor((event) => { + event.logger = "console"; + addExceptionMechanism(event, { + handled, + type: "console" + }); + return event; + }); + if (level === "assert") { + if (!args[0]) { + const message4 = `Assertion failed: ${safeJoin(args.slice(1), " ") || "console.assert"}`; + scope.setExtra("arguments", args.slice(1)); + captureMessage(message4, captureContext); + } + return; + } + const error2 = args.find((arg) => arg instanceof Error); + if (error2) { + captureException(error2, captureContext); + return; + } + const message3 = safeJoin(args, " "); + captureMessage(message3, captureContext); + }); +} +__name(consoleHandler, "consoleHandler"); +const INTEGRATION_NAME$g = "Debug"; +const _debugIntegration = /* @__PURE__ */ __name((options4 = {}) => { + const _options = { + debugger: false, + stringify: false, + ...options4 + }; + return { + name: INTEGRATION_NAME$g, + setup(client) { + client.on("beforeSendEvent", (event, hint) => { + if (_options.debugger) { + debugger; + } + consoleSandbox(() => { + if (_options.stringify) { + console.log(JSON.stringify(event, null, 2)); + if (hint && Object.keys(hint).length) { + console.log(JSON.stringify(hint, null, 2)); + } + } else { + console.log(event); + if (hint && Object.keys(hint).length) { + console.log(hint); + } + } + }); + }); + } + }; +}, "_debugIntegration"); +const debugIntegration = defineIntegration(_debugIntegration); +const INTEGRATION_NAME$f = "Dedupe"; +const _dedupeIntegration = /* @__PURE__ */ __name(() => { + let previousEvent; + return { + name: INTEGRATION_NAME$f, + processEvent(currentEvent) { + if (currentEvent.type) { + return currentEvent; + } + try { + if (_shouldDropEvent(currentEvent, previousEvent)) { + DEBUG_BUILD$6 && logger$2.warn("Event dropped due to being a duplicate of previously captured event."); + return null; + } + } catch (_oO) { + } + return previousEvent = currentEvent; + } + }; +}, "_dedupeIntegration"); +const dedupeIntegration = defineIntegration(_dedupeIntegration); +function _shouldDropEvent(currentEvent, previousEvent) { + if (!previousEvent) { + return false; + } + if (_isSameMessageEvent(currentEvent, previousEvent)) { + return true; + } + if (_isSameExceptionEvent(currentEvent, previousEvent)) { + return true; + } + return false; +} +__name(_shouldDropEvent, "_shouldDropEvent"); +function _isSameMessageEvent(currentEvent, previousEvent) { + const currentMessage = currentEvent.message; + const previousMessage = previousEvent.message; + if (!currentMessage && !previousMessage) { + return false; + } + if (currentMessage && !previousMessage || !currentMessage && previousMessage) { + return false; + } + if (currentMessage !== previousMessage) { + return false; + } + if (!_isSameFingerprint(currentEvent, previousEvent)) { + return false; + } + if (!_isSameStacktrace(currentEvent, previousEvent)) { + return false; + } + return true; +} +__name(_isSameMessageEvent, "_isSameMessageEvent"); +function _isSameExceptionEvent(currentEvent, previousEvent) { + const previousException = _getExceptionFromEvent(previousEvent); + const currentException = _getExceptionFromEvent(currentEvent); + if (!previousException || !currentException) { + return false; + } + if (previousException.type !== currentException.type || previousException.value !== currentException.value) { + return false; + } + if (!_isSameFingerprint(currentEvent, previousEvent)) { + return false; + } + if (!_isSameStacktrace(currentEvent, previousEvent)) { + return false; + } + return true; +} +__name(_isSameExceptionEvent, "_isSameExceptionEvent"); +function _isSameStacktrace(currentEvent, previousEvent) { + let currentFrames = getFramesFromEvent(currentEvent); + let previousFrames = getFramesFromEvent(previousEvent); + if (!currentFrames && !previousFrames) { + return true; + } + if (currentFrames && !previousFrames || !currentFrames && previousFrames) { + return false; + } + currentFrames = currentFrames; + previousFrames = previousFrames; + if (previousFrames.length !== currentFrames.length) { + return false; + } + for (let i2 = 0; i2 < previousFrames.length; i2++) { + const frameA = previousFrames[i2]; + const frameB = currentFrames[i2]; + if (frameA.filename !== frameB.filename || frameA.lineno !== frameB.lineno || frameA.colno !== frameB.colno || frameA.function !== frameB.function) { + return false; + } + } + return true; +} +__name(_isSameStacktrace, "_isSameStacktrace"); +function _isSameFingerprint(currentEvent, previousEvent) { + let currentFingerprint = currentEvent.fingerprint; + let previousFingerprint = previousEvent.fingerprint; + if (!currentFingerprint && !previousFingerprint) { + return true; + } + if (currentFingerprint && !previousFingerprint || !currentFingerprint && previousFingerprint) { + return false; + } + currentFingerprint = currentFingerprint; + previousFingerprint = previousFingerprint; + try { + return !!(currentFingerprint.join("") === previousFingerprint.join("")); + } catch (_oO) { + return false; + } +} +__name(_isSameFingerprint, "_isSameFingerprint"); +function _getExceptionFromEvent(event) { + return event.exception && event.exception.values && event.exception.values[0]; +} +__name(_getExceptionFromEvent, "_getExceptionFromEvent"); +const INTEGRATION_NAME$e = "ExtraErrorData"; +const _extraErrorDataIntegration = /* @__PURE__ */ __name((options4 = {}) => { + const { depth = 3, captureErrorCause = true } = options4; + return { + name: INTEGRATION_NAME$e, + processEvent(event, hint, client) { + const { maxValueLength = 250 } = client.getOptions(); + return _enhanceEventWithErrorData(event, hint, depth, captureErrorCause, maxValueLength); + } + }; +}, "_extraErrorDataIntegration"); +const extraErrorDataIntegration = defineIntegration(_extraErrorDataIntegration); +function _enhanceEventWithErrorData(event, hint = {}, depth, captureErrorCause, maxValueLength) { + if (!hint.originalException || !isError(hint.originalException)) { + return event; + } + const exceptionName = hint.originalException.name || hint.originalException.constructor.name; + const errorData = _extractErrorData(hint.originalException, captureErrorCause, maxValueLength); + if (errorData) { + const contexts = { + ...event.contexts + }; + const normalizedErrorData = normalize$2(errorData, depth); + if (isPlainObject$5(normalizedErrorData)) { + addNonEnumerableProperty(normalizedErrorData, "__sentry_skip_normalization__", true); + contexts[exceptionName] = normalizedErrorData; + } + return { + ...event, + contexts + }; + } + return event; +} +__name(_enhanceEventWithErrorData, "_enhanceEventWithErrorData"); +function _extractErrorData(error2, captureErrorCause, maxValueLength) { + try { + const nativeKeys2 = [ + "name", + "message", + "stack", + "line", + "column", + "fileName", + "lineNumber", + "columnNumber", + "toJSON" + ]; + const extraErrorInfo = {}; + for (const key of Object.keys(error2)) { + if (nativeKeys2.indexOf(key) !== -1) { + continue; + } + const value4 = error2[key]; + extraErrorInfo[key] = isError(value4) || typeof value4 === "string" ? truncate(`${value4}`, maxValueLength) : value4; + } + if (captureErrorCause && error2.cause !== void 0) { + extraErrorInfo.cause = isError(error2.cause) ? error2.cause.toString() : error2.cause; + } + if (typeof error2.toJSON === "function") { + const serializedError = error2.toJSON(); + for (const key of Object.keys(serializedError)) { + const value4 = serializedError[key]; + extraErrorInfo[key] = isError(value4) ? value4.toString() : value4; + } + } + return extraErrorInfo; + } catch (oO) { + DEBUG_BUILD$6 && logger$2.error("Unable to extract extra data from the Error object:", oO); + } + return null; +} +__name(_extractErrorData, "_extractErrorData"); +function normalizeArray(parts2, allowAboveRoot) { + let up = 0; + for (let i2 = parts2.length - 1; i2 >= 0; i2--) { + const last = parts2[i2]; + if (last === ".") { + parts2.splice(i2, 1); + } else if (last === "..") { + parts2.splice(i2, 1); + up++; + } else if (up) { + parts2.splice(i2, 1); + up--; + } + } + if (allowAboveRoot) { + for (; up--; up) { + parts2.unshift(".."); + } + } + return parts2; +} +__name(normalizeArray, "normalizeArray"); +const splitPathRe = /^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/; +function splitPath(filename) { + const truncated = filename.length > 1024 ? `<truncated>${filename.slice(-1024)}` : filename; + const parts2 = splitPathRe.exec(truncated); + return parts2 ? parts2.slice(1) : []; +} +__name(splitPath, "splitPath"); +function resolve$1(...args) { + let resolvedPath = ""; + let resolvedAbsolute = false; + for (let i2 = args.length - 1; i2 >= -1 && !resolvedAbsolute; i2--) { + const path = i2 >= 0 ? args[i2] : "/"; + if (!path) { + continue; + } + resolvedPath = `${path}/${resolvedPath}`; + resolvedAbsolute = path.charAt(0) === "/"; + } + resolvedPath = normalizeArray( + resolvedPath.split("/").filter((p2) => !!p2), + !resolvedAbsolute + ).join("/"); + return (resolvedAbsolute ? "/" : "") + resolvedPath || "."; +} +__name(resolve$1, "resolve$1"); +function trim$1(arr) { + let start2 = 0; + for (; start2 < arr.length; start2++) { + if (arr[start2] !== "") { + break; + } + } + let end = arr.length - 1; + for (; end >= 0; end--) { + if (arr[end] !== "") { + break; + } + } + if (start2 > end) { + return []; + } + return arr.slice(start2, end - start2 + 1); +} +__name(trim$1, "trim$1"); +function relative(from2, to) { + from2 = resolve$1(from2).slice(1); + to = resolve$1(to).slice(1); + const fromParts = trim$1(from2.split("/")); + const toParts = trim$1(to.split("/")); + const length = Math.min(fromParts.length, toParts.length); + let samePartsLength = length; + for (let i2 = 0; i2 < length; i2++) { + if (fromParts[i2] !== toParts[i2]) { + samePartsLength = i2; + break; + } + } + let outputParts = []; + for (let i2 = samePartsLength; i2 < fromParts.length; i2++) { + outputParts.push(".."); + } + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + return outputParts.join("/"); +} +__name(relative, "relative"); +function normalizePath(path) { + const isPathAbsolute = isAbsolute(path); + const trailingSlash = path.slice(-1) === "/"; + let normalizedPath = normalizeArray( + path.split("/").filter((p2) => !!p2), + !isPathAbsolute + ).join("/"); + if (!normalizedPath && !isPathAbsolute) { + normalizedPath = "."; + } + if (normalizedPath && trailingSlash) { + normalizedPath += "/"; + } + return (isPathAbsolute ? "/" : "") + normalizedPath; +} +__name(normalizePath, "normalizePath"); +function isAbsolute(path) { + return path.charAt(0) === "/"; +} +__name(isAbsolute, "isAbsolute"); +function join$3(...args) { + return normalizePath(args.join("/")); +} +__name(join$3, "join$3"); +function dirname(path) { + const result = splitPath(path); + const root27 = result[0] || ""; + let dir = result[1]; + if (!root27 && !dir) { + return "."; + } + if (dir) { + dir = dir.slice(0, dir.length - 1); + } + return root27 + dir; +} +__name(dirname, "dirname"); +function basename(path, ext) { + let f2 = splitPath(path)[2] || ""; + if (ext && f2.slice(ext.length * -1) === ext) { + f2 = f2.slice(0, f2.length - ext.length); + } + return f2; +} +__name(basename, "basename"); +const INTEGRATION_NAME$d = "RewriteFrames"; +const rewriteFramesIntegration = defineIntegration((options4 = {}) => { + const root27 = options4.root; + const prefix2 = options4.prefix || "app:///"; + const isBrowser2 = "window" in GLOBAL_OBJ && GLOBAL_OBJ.window !== void 0; + const iteratee = options4.iteratee || generateIteratee({ isBrowser: isBrowser2, root: root27, prefix: prefix2 }); + function _processExceptionsEvent(event) { + try { + return { + ...event, + exception: { + ...event.exception, + // The check for this is performed inside `process` call itself, safe to skip here + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + values: event.exception.values.map((value4) => ({ + ...value4, + ...value4.stacktrace && { stacktrace: _processStacktrace(value4.stacktrace) } + })) + } + }; + } catch (_oO) { + return event; + } + } + __name(_processExceptionsEvent, "_processExceptionsEvent"); + function _processStacktrace(stacktrace) { + return { + ...stacktrace, + frames: stacktrace && stacktrace.frames && stacktrace.frames.map((f2) => iteratee(f2)) + }; + } + __name(_processStacktrace, "_processStacktrace"); + return { + name: INTEGRATION_NAME$d, + processEvent(originalEvent) { + let processedEvent = originalEvent; + if (originalEvent.exception && Array.isArray(originalEvent.exception.values)) { + processedEvent = _processExceptionsEvent(processedEvent); + } + return processedEvent; + } + }; +}); +function generateIteratee({ + isBrowser: isBrowser2, + root: root27, + prefix: prefix2 +}) { + return (frame) => { + if (!frame.filename) { + return frame; + } + const isWindowsFrame = /^[a-zA-Z]:\\/.test(frame.filename) || // or the presence of a backslash without a forward slash (which are not allowed on Windows) + frame.filename.includes("\\") && !frame.filename.includes("/"); + const startsWithSlash = /^\//.test(frame.filename); + if (isBrowser2) { + if (root27) { + const oldFilename = frame.filename; + if (oldFilename.indexOf(root27) === 0) { + frame.filename = oldFilename.replace(root27, prefix2); + } + } + } else { + if (isWindowsFrame || startsWithSlash) { + const filename = isWindowsFrame ? frame.filename.replace(/^[a-zA-Z]:/, "").replace(/\\/g, "/") : frame.filename; + const base2 = root27 ? relative(root27, filename) : basename(filename); + frame.filename = `${prefix2}${base2}`; + } + } + return frame; + }; +} +__name(generateIteratee, "generateIteratee"); +const INTEGRATION_NAME$c = "SessionTiming"; +const _sessionTimingIntegration = /* @__PURE__ */ __name(() => { + const startTime = timestampInSeconds() * 1e3; + return { + name: INTEGRATION_NAME$c, + processEvent(event) { + const now2 = timestampInSeconds() * 1e3; + return { + ...event, + extra: { + ...event.extra, + ["session:start"]: startTime, + ["session:duration"]: now2 - startTime, + ["session:end"]: now2 + } + }; + } + }; +}, "_sessionTimingIntegration"); +const sessionTimingIntegration = defineIntegration(_sessionTimingIntegration); +const DEFAULT_LIMIT$1 = 10; +const INTEGRATION_NAME$b = "ZodErrors"; +function originalExceptionIsZodError(originalException) { + return isError(originalException) && originalException.name === "ZodError" && Array.isArray(originalException.errors); +} +__name(originalExceptionIsZodError, "originalExceptionIsZodError"); +function formatIssueTitle(issue) { + return { + ...issue, + path: "path" in issue && Array.isArray(issue.path) ? issue.path.join(".") : void 0, + keys: "keys" in issue ? JSON.stringify(issue.keys) : void 0, + unionErrors: "unionErrors" in issue ? JSON.stringify(issue.unionErrors) : void 0 + }; +} +__name(formatIssueTitle, "formatIssueTitle"); +function formatIssueMessage(zodError) { + const errorKeyMap = /* @__PURE__ */ new Set(); + for (const iss of zodError.issues) { + if (iss.path && iss.path[0]) { + errorKeyMap.add(iss.path[0]); + } + } + const errorKeys = Array.from(errorKeyMap); + return `Failed to validate keys: ${truncate(errorKeys.join(", "), 100)}`; +} +__name(formatIssueMessage, "formatIssueMessage"); +function applyZodErrorsToEvent(limit, event, hint) { + if (!event.exception || !event.exception.values || !hint || !hint.originalException || !originalExceptionIsZodError(hint.originalException) || hint.originalException.issues.length === 0) { + return event; + } + return { + ...event, + exception: { + ...event.exception, + values: [ + { + ...event.exception.values[0], + value: formatIssueMessage(hint.originalException) + }, + ...event.exception.values.slice(1) + ] + }, + extra: { + ...event.extra, + "zoderror.issues": hint.originalException.errors.slice(0, limit).map(formatIssueTitle) + } + }; +} +__name(applyZodErrorsToEvent, "applyZodErrorsToEvent"); +const _zodErrorsIntegration = /* @__PURE__ */ __name((options4 = {}) => { + const limit = options4.limit || DEFAULT_LIMIT$1; + return { + name: INTEGRATION_NAME$b, + processEvent(originalEvent, hint) { + const processedEvent = applyZodErrorsToEvent(limit, originalEvent, hint); + return processedEvent; + } + }; +}, "_zodErrorsIntegration"); +const zodErrorsIntegration = defineIntegration(_zodErrorsIntegration); +const thirdPartyErrorFilterIntegration = defineIntegration((options4) => { + return { + name: "ThirdPartyErrorsFilter", + setup(client) { + client.on("beforeEnvelope", (envelope) => { + forEachEnvelopeItem(envelope, (item3, type) => { + if (type === "event") { + const event = Array.isArray(item3) ? item3[1] : void 0; + if (event) { + stripMetadataFromStackFrames(event); + item3[1] = event; + } + } + }); + }); + client.on("applyFrameMetadata", (event) => { + if (event.type) { + return; + } + const stackParser = client.getOptions().stackParser; + addMetadataToStackFrames(stackParser, event); + }); + }, + processEvent(event) { + const frameKeys = getBundleKeysForAllFramesWithFilenames(event); + if (frameKeys) { + const arrayMethod = options4.behaviour === "drop-error-if-contains-third-party-frames" || options4.behaviour === "apply-tag-if-contains-third-party-frames" ? "some" : "every"; + const behaviourApplies = frameKeys[arrayMethod]((keys2) => !keys2.some((key) => options4.filterKeys.includes(key))); + if (behaviourApplies) { + const shouldDrop = options4.behaviour === "drop-error-if-contains-third-party-frames" || options4.behaviour === "drop-error-if-exclusively-contains-third-party-frames"; + if (shouldDrop) { + return null; + } else { + event.tags = { + ...event.tags, + third_party_code: true + }; + } + } + } + return event; + } + }; +}); +function getBundleKeysForAllFramesWithFilenames(event) { + const frames = getFramesFromEvent(event); + if (!frames) { + return void 0; + } + return frames.filter((frame) => !!frame.filename).map((frame) => { + if (frame.module_metadata) { + return Object.keys(frame.module_metadata).filter((key) => key.startsWith(BUNDLER_PLUGIN_APP_KEY_PREFIX)).map((key) => key.slice(BUNDLER_PLUGIN_APP_KEY_PREFIX.length)); + } + return []; + }); +} +__name(getBundleKeysForAllFramesWithFilenames, "getBundleKeysForAllFramesWithFilenames"); +const BUNDLER_PLUGIN_APP_KEY_PREFIX = "_sentryBundlerPluginAppKey:"; +const COUNTER_METRIC_TYPE = "c"; +const GAUGE_METRIC_TYPE = "g"; +const SET_METRIC_TYPE = "s"; +const DISTRIBUTION_METRIC_TYPE = "d"; +const DEFAULT_BROWSER_FLUSH_INTERVAL = 5e3; +const DEFAULT_FLUSH_INTERVAL = 1e4; +const MAX_WEIGHT = 1e4; +function getMetricsAggregatorForClient$1(client, Aggregator) { + const globalMetricsAggregators = getGlobalSingleton( + "globalMetricsAggregators", + () => /* @__PURE__ */ new WeakMap() + ); + const aggregator = globalMetricsAggregators.get(client); + if (aggregator) { + return aggregator; + } + const newAggregator = new Aggregator(client); + client.on("flush", () => newAggregator.flush()); + client.on("close", () => newAggregator.close()); + globalMetricsAggregators.set(client, newAggregator); + return newAggregator; +} +__name(getMetricsAggregatorForClient$1, "getMetricsAggregatorForClient$1"); +function addToMetricsAggregator(Aggregator, metricType, name2, value4, data25 = {}) { + const client = data25.client || getClient(); + if (!client) { + return; + } + const span = getActiveSpan(); + const rootSpan = span ? getRootSpan(span) : void 0; + const transactionName = rootSpan && spanToJSON(rootSpan).description; + const { unit, tags, timestamp: timestamp2 } = data25; + const { release, environment } = client.getOptions(); + const metricTags = {}; + if (release) { + metricTags.release = release; + } + if (environment) { + metricTags.environment = environment; + } + if (transactionName) { + metricTags.transaction = transactionName; + } + DEBUG_BUILD$6 && logger$2.log(`Adding value of ${value4} to ${metricType} metric ${name2}`); + const aggregator = getMetricsAggregatorForClient$1(client, Aggregator); + aggregator.add(metricType, name2, value4, unit, { ...metricTags, ...tags }, timestamp2); +} +__name(addToMetricsAggregator, "addToMetricsAggregator"); +function increment$2(aggregator, name2, value4 = 1, data25) { + addToMetricsAggregator(aggregator, COUNTER_METRIC_TYPE, name2, ensureNumber(value4), data25); +} +__name(increment$2, "increment$2"); +function distribution$2(aggregator, name2, value4, data25) { + addToMetricsAggregator(aggregator, DISTRIBUTION_METRIC_TYPE, name2, ensureNumber(value4), data25); +} +__name(distribution$2, "distribution$2"); +function timing$2(aggregator, name2, value4, unit = "second", data25) { + if (typeof value4 === "function") { + const startTime = timestampInSeconds(); + return startSpanManual( + { + op: "metrics.timing", + name: name2, + startTime, + onlyIfParent: true + }, + (span) => { + return handleCallbackErrors( + () => value4(), + () => { + }, + () => { + const endTime = timestampInSeconds(); + const timeDiff = endTime - startTime; + distribution$2(aggregator, name2, timeDiff, { ...data25, unit: "second" }); + span.end(endTime); + } + ); + } + ); + } + distribution$2(aggregator, name2, value4, { ...data25, unit }); +} +__name(timing$2, "timing$2"); +function set$7(aggregator, name2, value4, data25) { + addToMetricsAggregator(aggregator, SET_METRIC_TYPE, name2, value4, data25); +} +__name(set$7, "set$7"); +function gauge$2(aggregator, name2, value4, data25) { + addToMetricsAggregator(aggregator, GAUGE_METRIC_TYPE, name2, ensureNumber(value4), data25); +} +__name(gauge$2, "gauge$2"); +const metrics$1 = { + increment: increment$2, + distribution: distribution$2, + set: set$7, + gauge: gauge$2, + timing: timing$2, + /** + * @ignore This is for internal use only. + */ + getMetricsAggregatorForClient: getMetricsAggregatorForClient$1 +}; +function ensureNumber(number2) { + return typeof number2 === "string" ? parseInt(number2) : number2; +} +__name(ensureNumber, "ensureNumber"); +function isProfilingIntegrationWithProfiler(integration) { + return !!integration && typeof integration["_profiler"] !== "undefined" && typeof integration["_profiler"]["start"] === "function" && typeof integration["_profiler"]["stop"] === "function"; +} +__name(isProfilingIntegrationWithProfiler, "isProfilingIntegrationWithProfiler"); +function startProfiler() { + const client = getClient(); + if (!client) { + DEBUG_BUILD$6 && logger$2.warn("No Sentry client available, profiling is not started"); + return; + } + const integration = client.getIntegrationByName("ProfilingIntegration"); + if (!integration) { + DEBUG_BUILD$6 && logger$2.warn("ProfilingIntegration is not available"); + return; + } + if (!isProfilingIntegrationWithProfiler(integration)) { + DEBUG_BUILD$6 && logger$2.warn("Profiler is not available on profiling integration."); + return; + } + integration._profiler.start(); +} +__name(startProfiler, "startProfiler"); +function stopProfiler() { + const client = getClient(); + if (!client) { + DEBUG_BUILD$6 && logger$2.warn("No Sentry client available, profiling is not started"); + return; + } + const integration = client.getIntegrationByName("ProfilingIntegration"); + if (!integration) { + DEBUG_BUILD$6 && logger$2.warn("ProfilingIntegration is not available"); + return; + } + if (!isProfilingIntegrationWithProfiler(integration)) { + DEBUG_BUILD$6 && logger$2.warn("Profiler is not available on profiling integration."); + return; + } + integration._profiler.stop(); +} +__name(stopProfiler, "stopProfiler"); +const profiler = { + startProfiler, + stopProfiler +}; +function getBucketKey(metricType, name2, unit, tags) { + const stringifiedTags = Object.entries(dropUndefinedKeys(tags)).sort((a2, b2) => a2[0].localeCompare(b2[0])); + return `${metricType}${name2}${unit}${stringifiedTags}`; +} +__name(getBucketKey, "getBucketKey"); +function simpleHash(s2) { + let rv = 0; + for (let i2 = 0; i2 < s2.length; i2++) { + const c2 = s2.charCodeAt(i2); + rv = (rv << 5) - rv + c2; + rv &= rv; + } + return rv >>> 0; +} +__name(simpleHash, "simpleHash"); +function serializeMetricBuckets(metricBucketItems) { + let out = ""; + for (const item3 of metricBucketItems) { + const tagEntries = Object.entries(item3.tags); + const maybeTags = tagEntries.length > 0 ? `|#${tagEntries.map(([key, value4]) => `${key}:${value4}`).join(",")}` : ""; + out += `${item3.name}@${item3.unit}:${item3.metric}|${item3.metricType}${maybeTags}|T${item3.timestamp} +`; + } + return out; +} +__name(serializeMetricBuckets, "serializeMetricBuckets"); +function sanitizeUnit(unit) { + return unit.replace(/[^\w]+/gi, "_"); +} +__name(sanitizeUnit, "sanitizeUnit"); +function sanitizeMetricKey(key) { + return key.replace(/[^\w\-.]+/gi, "_"); +} +__name(sanitizeMetricKey, "sanitizeMetricKey"); +function sanitizeTagKey(key) { + return key.replace(/[^\w\-./]+/gi, ""); +} +__name(sanitizeTagKey, "sanitizeTagKey"); +const tagValueReplacements = [ + ["\n", "\\n"], + ["\r", "\\r"], + [" ", "\\t"], + ["\\", "\\\\"], + ["|", "\\u{7c}"], + [",", "\\u{2c}"] +]; +function getCharOrReplacement(input) { + for (const [search2, replacement] of tagValueReplacements) { + if (input === search2) { + return replacement; + } + } + return input; +} +__name(getCharOrReplacement, "getCharOrReplacement"); +function sanitizeTagValue(value4) { + return [...value4].reduce((acc, char) => acc + getCharOrReplacement(char), ""); +} +__name(sanitizeTagValue, "sanitizeTagValue"); +function sanitizeTags(unsanitizedTags) { + const tags = {}; + for (const key in unsanitizedTags) { + if (Object.prototype.hasOwnProperty.call(unsanitizedTags, key)) { + const sanitizedKey = sanitizeTagKey(key); + tags[sanitizedKey] = sanitizeTagValue(String(unsanitizedTags[key])); + } + } + return tags; +} +__name(sanitizeTags, "sanitizeTags"); +function captureAggregateMetrics(client, metricBucketItems) { + logger$2.log(`Flushing aggregated metrics, number of metrics: ${metricBucketItems.length}`); + const dsn = client.getDsn(); + const metadata = client.getSdkMetadata(); + const tunnel = client.getOptions().tunnel; + const metricsEnvelope = createMetricEnvelope(metricBucketItems, dsn, metadata, tunnel); + client.sendEnvelope(metricsEnvelope); +} +__name(captureAggregateMetrics, "captureAggregateMetrics"); +function createMetricEnvelope(metricBucketItems, dsn, metadata, tunnel) { + const headers = { + sent_at: (/* @__PURE__ */ new Date()).toISOString() + }; + if (metadata && metadata.sdk) { + headers.sdk = { + name: metadata.sdk.name, + version: metadata.sdk.version + }; + } + if (!!tunnel && dsn) { + headers.dsn = dsnToString(dsn); + } + const item3 = createMetricEnvelopeItem(metricBucketItems); + return createEnvelope(headers, [item3]); +} +__name(createMetricEnvelope, "createMetricEnvelope"); +function createMetricEnvelopeItem(metricBucketItems) { + const payload = serializeMetricBuckets(metricBucketItems); + const metricHeaders = { + type: "statsd", + length: payload.length + }; + return [metricHeaders, payload]; +} +__name(createMetricEnvelopeItem, "createMetricEnvelopeItem"); +class CounterMetric { + static { + __name(this, "CounterMetric"); + } + constructor(_value) { + this._value = _value; + } + /** @inheritDoc */ + get weight() { + return 1; + } + /** @inheritdoc */ + add(value4) { + this._value += value4; + } + /** @inheritdoc */ + toString() { + return `${this._value}`; + } +} +class GaugeMetric { + static { + __name(this, "GaugeMetric"); + } + constructor(value4) { + this._last = value4; + this._min = value4; + this._max = value4; + this._sum = value4; + this._count = 1; + } + /** @inheritDoc */ + get weight() { + return 5; + } + /** @inheritdoc */ + add(value4) { + this._last = value4; + if (value4 < this._min) { + this._min = value4; + } + if (value4 > this._max) { + this._max = value4; + } + this._sum += value4; + this._count++; + } + /** @inheritdoc */ + toString() { + return `${this._last}:${this._min}:${this._max}:${this._sum}:${this._count}`; + } +} +class DistributionMetric { + static { + __name(this, "DistributionMetric"); + } + constructor(first2) { + this._value = [first2]; + } + /** @inheritDoc */ + get weight() { + return this._value.length; + } + /** @inheritdoc */ + add(value4) { + this._value.push(value4); + } + /** @inheritdoc */ + toString() { + return this._value.join(":"); + } +} +class SetMetric { + static { + __name(this, "SetMetric"); + } + constructor(first2) { + this.first = first2; + this._value = /* @__PURE__ */ new Set([first2]); + } + /** @inheritDoc */ + get weight() { + return this._value.size; + } + /** @inheritdoc */ + add(value4) { + this._value.add(value4); + } + /** @inheritdoc */ + toString() { + return Array.from(this._value).map((val) => typeof val === "string" ? simpleHash(val) : val).join(":"); + } +} +const METRIC_MAP = { + [COUNTER_METRIC_TYPE]: CounterMetric, + [GAUGE_METRIC_TYPE]: GaugeMetric, + [DISTRIBUTION_METRIC_TYPE]: DistributionMetric, + [SET_METRIC_TYPE]: SetMetric +}; +class MetricsAggregator { + static { + __name(this, "MetricsAggregator"); + } + // TODO(@anonrig): Use FinalizationRegistry to have a proper way of flushing the buckets + // when the aggregator is garbage collected. + // Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry + // Different metrics have different weights. We use this to limit the number of metrics + // that we store in memory. + // We adjust the type here to add the `unref()` part, as setInterval can technically return a number or a NodeJS.Timer + // SDKs are required to shift the flush interval by random() * rollup_in_seconds. + // That shift is determined once per startup to create jittering. + // An SDK is required to perform force flushing ahead of scheduled time if the memory + // pressure is too high. There is no rule for this other than that SDKs should be tracking + // abstract aggregation complexity (eg: a counter only carries a single float, whereas a + // distribution is a float per emission). + // + // Force flush is used on either shutdown, flush() or when we exceed the max weight. + constructor(_client) { + this._client = _client; + this._buckets = /* @__PURE__ */ new Map(); + this._bucketsTotalWeight = 0; + this._interval = setInterval(() => this._flush(), DEFAULT_FLUSH_INTERVAL); + if (this._interval.unref) { + this._interval.unref(); + } + this._flushShift = Math.floor(Math.random() * DEFAULT_FLUSH_INTERVAL / 1e3); + this._forceFlush = false; + } + /** + * @inheritDoc + */ + add(metricType, unsanitizedName, value4, unsanitizedUnit = "none", unsanitizedTags = {}, maybeFloatTimestamp = timestampInSeconds()) { + const timestamp2 = Math.floor(maybeFloatTimestamp); + const name2 = sanitizeMetricKey(unsanitizedName); + const tags = sanitizeTags(unsanitizedTags); + const unit = sanitizeUnit(unsanitizedUnit); + const bucketKey = getBucketKey(metricType, name2, unit, tags); + let bucketItem = this._buckets.get(bucketKey); + const previousWeight = bucketItem && metricType === SET_METRIC_TYPE ? bucketItem.metric.weight : 0; + if (bucketItem) { + bucketItem.metric.add(value4); + if (bucketItem.timestamp < timestamp2) { + bucketItem.timestamp = timestamp2; + } + } else { + bucketItem = { + // @ts-expect-error we don't need to narrow down the type of value here, saves bundle size. + metric: new METRIC_MAP[metricType](value4), + timestamp: timestamp2, + metricType, + name: name2, + unit, + tags + }; + this._buckets.set(bucketKey, bucketItem); + } + const val = typeof value4 === "string" ? bucketItem.metric.weight - previousWeight : value4; + updateMetricSummaryOnActiveSpan(metricType, name2, val, unit, unsanitizedTags, bucketKey); + this._bucketsTotalWeight += bucketItem.metric.weight; + if (this._bucketsTotalWeight >= MAX_WEIGHT) { + this.flush(); + } + } + /** + * Flushes the current metrics to the transport via the transport. + */ + flush() { + this._forceFlush = true; + this._flush(); + } + /** + * Shuts down metrics aggregator and clears all metrics. + */ + close() { + this._forceFlush = true; + clearInterval(this._interval); + this._flush(); + } + /** + * Flushes the buckets according to the internal state of the aggregator. + * If it is a force flush, which happens on shutdown, it will flush all buckets. + * Otherwise, it will only flush buckets that are older than the flush interval, + * and according to the flush shift. + * + * This function mutates `_forceFlush` and `_bucketsTotalWeight` properties. + */ + _flush() { + if (this._forceFlush) { + this._forceFlush = false; + this._bucketsTotalWeight = 0; + this._captureMetrics(this._buckets); + this._buckets.clear(); + return; + } + const cutoffSeconds = Math.floor(timestampInSeconds()) - DEFAULT_FLUSH_INTERVAL / 1e3 - this._flushShift; + const flushedBuckets = /* @__PURE__ */ new Map(); + for (const [key, bucket] of this._buckets) { + if (bucket.timestamp <= cutoffSeconds) { + flushedBuckets.set(key, bucket); + this._bucketsTotalWeight -= bucket.metric.weight; + } + } + for (const [key] of flushedBuckets) { + this._buckets.delete(key); + } + this._captureMetrics(flushedBuckets); + } + /** + * Only captures a subset of the buckets passed to this function. + * @param flushedBuckets + */ + _captureMetrics(flushedBuckets) { + if (flushedBuckets.size > 0) { + const buckets = Array.from(flushedBuckets).map(([, bucketItem]) => bucketItem); + captureAggregateMetrics(this._client, buckets); + } + } +} +function increment$1(name2, value4 = 1, data25) { + metrics$1.increment(MetricsAggregator, name2, value4, data25); +} +__name(increment$1, "increment$1"); +function distribution$1(name2, value4, data25) { + metrics$1.distribution(MetricsAggregator, name2, value4, data25); +} +__name(distribution$1, "distribution$1"); +function set$6(name2, value4, data25) { + metrics$1.set(MetricsAggregator, name2, value4, data25); +} +__name(set$6, "set$6"); +function gauge$1(name2, value4, data25) { + metrics$1.gauge(MetricsAggregator, name2, value4, data25); +} +__name(gauge$1, "gauge$1"); +function timing$1(name2, value4, unit = "second", data25) { + return metrics$1.timing(MetricsAggregator, name2, value4, unit, data25); +} +__name(timing$1, "timing$1"); +function getMetricsAggregatorForClient(client) { + return metrics$1.getMetricsAggregatorForClient(client, MetricsAggregator); +} +__name(getMetricsAggregatorForClient, "getMetricsAggregatorForClient"); +const metricsDefault = { + increment: increment$1, + distribution: distribution$1, + set: set$6, + gauge: gauge$1, + timing: timing$1, + /** + * @ignore This is for internal use only. + */ + getMetricsAggregatorForClient +}; +class BrowserMetricsAggregator { + static { + __name(this, "BrowserMetricsAggregator"); + } + // TODO(@anonrig): Use FinalizationRegistry to have a proper way of flushing the buckets + // when the aggregator is garbage collected. + // Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry + constructor(_client) { + this._client = _client; + this._buckets = /* @__PURE__ */ new Map(); + this._interval = setInterval(() => this.flush(), DEFAULT_BROWSER_FLUSH_INTERVAL); + } + /** + * @inheritDoc + */ + add(metricType, unsanitizedName, value4, unsanitizedUnit = "none", unsanitizedTags = {}, maybeFloatTimestamp = timestampInSeconds()) { + const timestamp2 = Math.floor(maybeFloatTimestamp); + const name2 = sanitizeMetricKey(unsanitizedName); + const tags = sanitizeTags(unsanitizedTags); + const unit = sanitizeUnit(unsanitizedUnit); + const bucketKey = getBucketKey(metricType, name2, unit, tags); + let bucketItem = this._buckets.get(bucketKey); + const previousWeight = bucketItem && metricType === SET_METRIC_TYPE ? bucketItem.metric.weight : 0; + if (bucketItem) { + bucketItem.metric.add(value4); + if (bucketItem.timestamp < timestamp2) { + bucketItem.timestamp = timestamp2; + } + } else { + bucketItem = { + // @ts-expect-error we don't need to narrow down the type of value here, saves bundle size. + metric: new METRIC_MAP[metricType](value4), + timestamp: timestamp2, + metricType, + name: name2, + unit, + tags + }; + this._buckets.set(bucketKey, bucketItem); + } + const val = typeof value4 === "string" ? bucketItem.metric.weight - previousWeight : value4; + updateMetricSummaryOnActiveSpan(metricType, name2, val, unit, unsanitizedTags, bucketKey); + } + /** + * @inheritDoc + */ + flush() { + if (this._buckets.size === 0) { + return; + } + const metricBuckets = Array.from(this._buckets.values()); + captureAggregateMetrics(this._client, metricBuckets); + this._buckets.clear(); + } + /** + * @inheritDoc + */ + close() { + clearInterval(this._interval); + this.flush(); + } +} +function instrumentFetchRequest(handlerData, shouldCreateSpan, shouldAttachHeaders2, spans, spanOrigin = "auto.http.browser") { + if (!handlerData.fetchData) { + return void 0; + } + const shouldCreateSpanResult = hasTracingEnabled() && shouldCreateSpan(handlerData.fetchData.url); + if (handlerData.endTimestamp && shouldCreateSpanResult) { + const spanId = handlerData.fetchData.__span; + if (!spanId) return; + const span2 = spans[spanId]; + if (span2) { + endSpan(span2, handlerData); + delete spans[spanId]; + } + return void 0; + } + const { method, url } = handlerData.fetchData; + const fullUrl = getFullURL$1(url); + const host = fullUrl ? parseUrl$1(fullUrl).host : void 0; + const hasParent = !!getActiveSpan(); + const span = shouldCreateSpanResult && hasParent ? startInactiveSpan({ + name: `${method} ${url}`, + attributes: { + url, + type: "fetch", + "http.method": method, + "http.url": fullUrl, + "server.address": host, + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: spanOrigin, + [SEMANTIC_ATTRIBUTE_SENTRY_OP]: "http.client" + } + }) : new SentryNonRecordingSpan(); + handlerData.fetchData.__span = span.spanContext().spanId; + spans[span.spanContext().spanId] = span; + if (shouldAttachHeaders2(handlerData.fetchData.url)) { + const request = handlerData.args[0]; + const options4 = handlerData.args[1] || {}; + const headers = _addTracingHeadersToFetchRequest( + request, + options4, + // If performance is disabled (TWP) or there's no active root span (pageload/navigation/interaction), + // we do not want to use the span as base for the trace headers, + // which means that the headers will be generated from the scope and the sampling decision is deferred + hasTracingEnabled() && hasParent ? span : void 0 + ); + if (headers) { + handlerData.args[1] = options4; + options4.headers = headers; + } + } + return span; +} +__name(instrumentFetchRequest, "instrumentFetchRequest"); +function _addTracingHeadersToFetchRequest(request, fetchOptionsObj, span) { + const traceHeaders = getTraceData({ span }); + const sentryTrace = traceHeaders["sentry-trace"]; + const baggage = traceHeaders.baggage; + if (!sentryTrace) { + return void 0; + } + const headers = fetchOptionsObj.headers || (isRequest$1(request) ? request.headers : void 0); + if (!headers) { + return { ...traceHeaders }; + } else if (isHeaders$1(headers)) { + const newHeaders = new Headers(headers); + newHeaders.set("sentry-trace", sentryTrace); + if (baggage) { + const prevBaggageHeader = newHeaders.get("baggage"); + if (prevBaggageHeader) { + const prevHeaderStrippedFromSentryBaggage = stripBaggageHeaderOfSentryBaggageValues(prevBaggageHeader); + newHeaders.set( + "baggage", + // If there are non-sentry entries (i.e. if the stripped string is non-empty/truthy) combine the stripped header and sentry baggage header + // otherwise just set the sentry baggage header + prevHeaderStrippedFromSentryBaggage ? `${prevHeaderStrippedFromSentryBaggage},${baggage}` : baggage + ); + } else { + newHeaders.set("baggage", baggage); + } + } + return newHeaders; + } else if (Array.isArray(headers)) { + const newHeaders = [ + ...headers.filter((header3) => { + return !(Array.isArray(header3) && header3[0] === "sentry-trace"); + }).map((header3) => { + if (Array.isArray(header3) && header3[0] === "baggage" && typeof header3[1] === "string") { + const [headerName, headerValue, ...rest] = header3; + return [headerName, stripBaggageHeaderOfSentryBaggageValues(headerValue), ...rest]; + } else { + return header3; + } + }), + // Attach the new sentry-trace header + ["sentry-trace", sentryTrace] + ]; + if (baggage) { + newHeaders.push(["baggage", baggage]); + } + return newHeaders; + } else { + const existingBaggageHeader = "baggage" in headers ? headers.baggage : void 0; + let newBaggageHeaders = []; + if (Array.isArray(existingBaggageHeader)) { + newBaggageHeaders = existingBaggageHeader.map( + (headerItem) => typeof headerItem === "string" ? stripBaggageHeaderOfSentryBaggageValues(headerItem) : headerItem + ).filter((headerItem) => headerItem === ""); + } else if (existingBaggageHeader) { + newBaggageHeaders.push(stripBaggageHeaderOfSentryBaggageValues(existingBaggageHeader)); + } + if (baggage) { + newBaggageHeaders.push(baggage); + } + return { + ...headers, + "sentry-trace": sentryTrace, + baggage: newBaggageHeaders.length > 0 ? newBaggageHeaders.join(",") : void 0 + }; + } +} +__name(_addTracingHeadersToFetchRequest, "_addTracingHeadersToFetchRequest"); +function addTracingHeadersToFetchRequest(request, _client, _scope, fetchOptionsObj, span) { + return _addTracingHeadersToFetchRequest(request, fetchOptionsObj, span); +} +__name(addTracingHeadersToFetchRequest, "addTracingHeadersToFetchRequest"); +function getFullURL$1(url) { + try { + const parsed = new URL(url); + return parsed.href; + } catch (e2) { + return void 0; + } +} +__name(getFullURL$1, "getFullURL$1"); +function endSpan(span, handlerData) { + if (handlerData.response) { + setHttpStatus(span, handlerData.response.status); + const contentLength = handlerData.response && handlerData.response.headers && handlerData.response.headers.get("content-length"); + if (contentLength) { + const contentLengthNum = parseInt(contentLength); + if (contentLengthNum > 0) { + span.setAttribute("http.response_content_length", contentLengthNum); + } + } + } else if (handlerData.error) { + span.setStatus({ code: SPAN_STATUS_ERROR, message: "internal_error" }); + } + span.end(); +} +__name(endSpan, "endSpan"); +function stripBaggageHeaderOfSentryBaggageValues(baggageHeader) { + return baggageHeader.split(",").filter((baggageEntry) => !baggageEntry.split("=")[0].startsWith(SENTRY_BAGGAGE_KEY_PREFIX)).join(","); +} +__name(stripBaggageHeaderOfSentryBaggageValues, "stripBaggageHeaderOfSentryBaggageValues"); +function isRequest$1(request) { + return typeof Request !== "undefined" && isInstanceOf(request, Request); +} +__name(isRequest$1, "isRequest$1"); +function isHeaders$1(headers) { + return typeof Headers !== "undefined" && isInstanceOf(headers, Headers); +} +__name(isHeaders$1, "isHeaders$1"); +const trpcCaptureContext = { mechanism: { handled: false, data: { function: "trpcMiddleware" } } }; +function captureIfError(nextResult) { + if (typeof nextResult === "object" && nextResult !== null && "ok" in nextResult && !nextResult.ok && "error" in nextResult) { + captureException(nextResult.error, trpcCaptureContext); + } +} +__name(captureIfError, "captureIfError"); +function trpcMiddleware(options4 = {}) { + return async function(opts) { + const { path, type, next: next2, rawInput, getRawInput } = opts; + const client = getClient(); + const clientOptions = client && client.getOptions(); + const trpcContext = { + procedure_path: path, + procedure_type: type + }; + if (options4.attachRpcInput !== void 0 ? options4.attachRpcInput : clientOptions && clientOptions.sendDefaultPii) { + if (rawInput !== void 0) { + trpcContext.input = normalize$2(rawInput); + } + if (getRawInput !== void 0 && typeof getRawInput === "function") { + try { + const rawRes = await getRawInput(); + trpcContext.input = normalize$2(rawRes); + } catch (err) { + } + } + } + return withScope((scope) => { + scope.setContext("trpc", trpcContext); + return startSpanManual( + { + name: `trpc/${path}`, + op: "rpc.server", + attributes: { + [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: "route", + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.rpc.trpc" + } + }, + async (span) => { + try { + const nextResult = await next2(); + captureIfError(nextResult); + span.end(); + return nextResult; + } catch (e2) { + captureException(e2, trpcCaptureContext); + span.end(); + throw e2; + } + } + ); + }); + }; +} +__name(trpcMiddleware, "trpcMiddleware"); +function captureFeedback(params, hint = {}, scope = getCurrentScope$1()) { + const { message: message3, name: name2, email, url, source, associatedEventId, tags } = params; + const feedbackEvent = { + contexts: { + feedback: dropUndefinedKeys({ + contact_email: email, + name: name2, + message: message3, + url, + source, + associated_event_id: associatedEventId + }) + }, + type: "feedback", + level: "info", + tags + }; + const client = scope && scope.getClient() || getClient(); + if (client) { + client.emit("beforeSendFeedback", feedbackEvent, hint); + } + const eventId = scope.captureEvent(feedbackEvent, hint); + return eventId; +} +__name(captureFeedback, "captureFeedback"); +function getCurrentHubShim() { + return { + bindClient(client) { + const scope = getCurrentScope$1(); + scope.setClient(client); + }, + withScope, + getClient: /* @__PURE__ */ __name(() => getClient(), "getClient"), + getScope: getCurrentScope$1, + getIsolationScope, + captureException: /* @__PURE__ */ __name((exception, hint) => { + return getCurrentScope$1().captureException(exception, hint); + }, "captureException"), + captureMessage: /* @__PURE__ */ __name((message3, level, hint) => { + return getCurrentScope$1().captureMessage(message3, level, hint); + }, "captureMessage"), + captureEvent, + addBreadcrumb, + setUser, + setTags, + setTag: setTag$5, + setExtra, + setExtras, + setContext, + getIntegration(integration) { + const client = getClient(); + return client && client.getIntegrationByName(integration.id) || null; + }, + startSession, + endSession, + captureSession(end) { + if (end) { + return endSession(); + } + _sendSessionUpdate(); + } + }; +} +__name(getCurrentHubShim, "getCurrentHubShim"); +const getCurrentHub = getCurrentHubShim; +function _sendSessionUpdate() { + const scope = getCurrentScope$1(); + const client = getClient(); + const session = scope.getSession(); + if (client && session) { + client.captureSession(session); + } +} +__name(_sendSessionUpdate, "_sendSessionUpdate"); +function flatten(input) { + const result = []; + const flattenHelper = /* @__PURE__ */ __name((input2) => { + input2.forEach((el) => { + if (Array.isArray(el)) { + flattenHelper(el); + } else { + result.push(el); + } + }); + }, "flattenHelper"); + flattenHelper(input); + return result; +} +__name(flatten, "flatten"); +function getBreadcrumbLogLevelFromHttpStatusCode(statusCode) { + if (statusCode === void 0) { + return void 0; + } else if (statusCode >= 400 && statusCode < 500) { + return "warning"; + } else if (statusCode >= 500) { + return "error"; + } else { + return void 0; + } +} +__name(getBreadcrumbLogLevelFromHttpStatusCode, "getBreadcrumbLogLevelFromHttpStatusCode"); +const WINDOW$7 = GLOBAL_OBJ; +function supportsErrorEvent() { + try { + new ErrorEvent(""); + return true; + } catch (e2) { + return false; + } +} +__name(supportsErrorEvent, "supportsErrorEvent"); +function supportsDOMError() { + try { + new DOMError(""); + return true; + } catch (e2) { + return false; + } +} +__name(supportsDOMError, "supportsDOMError"); +function supportsDOMException() { + try { + new DOMException(""); + return true; + } catch (e2) { + return false; + } +} +__name(supportsDOMException, "supportsDOMException"); +function supportsFetch() { + if (!("fetch" in WINDOW$7)) { + return false; + } + try { + new Headers(); + new Request("http://www.example.com"); + new Response(); + return true; + } catch (e2) { + return false; + } +} +__name(supportsFetch, "supportsFetch"); +function isNativeFunction(func) { + return func && /^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(func.toString()); +} +__name(isNativeFunction, "isNativeFunction"); +function supportsNativeFetch() { + if (typeof EdgeRuntime === "string") { + return true; + } + if (!supportsFetch()) { + return false; + } + if (isNativeFunction(WINDOW$7.fetch)) { + return true; + } + let result = false; + const doc2 = WINDOW$7.document; + if (doc2 && typeof doc2.createElement === "function") { + try { + const sandbox = doc2.createElement("iframe"); + sandbox.hidden = true; + doc2.head.appendChild(sandbox); + if (sandbox.contentWindow && sandbox.contentWindow.fetch) { + result = isNativeFunction(sandbox.contentWindow.fetch); + } + doc2.head.removeChild(sandbox); + } catch (err) { + DEBUG_BUILD$5 && logger$2.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ", err); + } + } + return result; +} +__name(supportsNativeFetch, "supportsNativeFetch"); +function supportsReportingObserver() { + return "ReportingObserver" in WINDOW$7; +} +__name(supportsReportingObserver, "supportsReportingObserver"); +function supportsReferrerPolicy() { + if (!supportsFetch()) { + return false; + } + try { + new Request("_", { + referrerPolicy: "origin" + }); + return true; + } catch (e2) { + return false; + } +} +__name(supportsReferrerPolicy, "supportsReferrerPolicy"); +function addFetchInstrumentationHandler(handler6, skipNativeFetchCheck) { + const type = "fetch"; + addHandler$1(type, handler6); + maybeInstrument(type, () => instrumentFetch(void 0, skipNativeFetchCheck)); +} +__name(addFetchInstrumentationHandler, "addFetchInstrumentationHandler"); +function addFetchEndInstrumentationHandler(handler6) { + const type = "fetch-body-resolved"; + addHandler$1(type, handler6); + maybeInstrument(type, () => instrumentFetch(streamHandler)); +} +__name(addFetchEndInstrumentationHandler, "addFetchEndInstrumentationHandler"); +function instrumentFetch(onFetchResolved, skipNativeFetchCheck = false) { + if (skipNativeFetchCheck && !supportsNativeFetch()) { + return; + } + fill(GLOBAL_OBJ, "fetch", function(originalFetch) { + return function(...args) { + const virtualError = new Error(); + const { method, url } = parseFetchArgs(args); + const handlerData = { + args, + fetchData: { + method, + url + }, + startTimestamp: timestampInSeconds() * 1e3, + // // Adding the error to be able to fingerprint the failed fetch event in HttpClient instrumentation + virtualError + }; + if (!onFetchResolved) { + triggerHandlers$1("fetch", { + ...handlerData + }); + } + return originalFetch.apply(GLOBAL_OBJ, args).then( + async (response) => { + if (onFetchResolved) { + onFetchResolved(response); + } else { + triggerHandlers$1("fetch", { + ...handlerData, + endTimestamp: timestampInSeconds() * 1e3, + response + }); + } + return response; + }, + (error2) => { + triggerHandlers$1("fetch", { + ...handlerData, + endTimestamp: timestampInSeconds() * 1e3, + error: error2 + }); + if (isError(error2) && error2.stack === void 0) { + error2.stack = virtualError.stack; + addNonEnumerableProperty(error2, "framesToPop", 1); + } + throw error2; + } + ); + }; + }); +} +__name(instrumentFetch, "instrumentFetch"); +async function resolveResponse(res, onFinishedResolving) { + if (res && res.body) { + const body = res.body; + const responseReader = body.getReader(); + const maxFetchDurationTimeout = setTimeout( + () => { + body.cancel().then(null, () => { + }); + }, + 90 * 1e3 + // 90s + ); + let readingActive = true; + while (readingActive) { + let chunkTimeout; + try { + chunkTimeout = setTimeout(() => { + body.cancel().then(null, () => { + }); + }, 5e3); + const { done } = await responseReader.read(); + clearTimeout(chunkTimeout); + if (done) { + onFinishedResolving(); + readingActive = false; + } + } catch (error2) { + readingActive = false; + } finally { + clearTimeout(chunkTimeout); + } + } + clearTimeout(maxFetchDurationTimeout); + responseReader.releaseLock(); + body.cancel().then(null, () => { + }); + } +} +__name(resolveResponse, "resolveResponse"); +function streamHandler(response) { + let clonedResponseForResolving; + try { + clonedResponseForResolving = response.clone(); + } catch (e2) { + return; + } + resolveResponse(clonedResponseForResolving, () => { + triggerHandlers$1("fetch-body-resolved", { + endTimestamp: timestampInSeconds() * 1e3, + response + }); + }); +} +__name(streamHandler, "streamHandler"); +function hasProp(obj, prop2) { + return !!obj && typeof obj === "object" && !!obj[prop2]; +} +__name(hasProp, "hasProp"); +function getUrlFromResource(resource) { + if (typeof resource === "string") { + return resource; + } + if (!resource) { + return ""; + } + if (hasProp(resource, "url")) { + return resource.url; + } + if (resource.toString) { + return resource.toString(); + } + return ""; +} +__name(getUrlFromResource, "getUrlFromResource"); +function parseFetchArgs(fetchArgs) { + if (fetchArgs.length === 0) { + return { method: "GET", url: "" }; + } + if (fetchArgs.length === 2) { + const [url, options4] = fetchArgs; + return { + url: getUrlFromResource(url), + method: hasProp(options4, "method") ? String(options4.method).toUpperCase() : "GET" + }; + } + const arg = fetchArgs[0]; + return { + url: getUrlFromResource(arg), + method: hasProp(arg, "method") ? String(arg.method).toUpperCase() : "GET" + }; +} +__name(parseFetchArgs, "parseFetchArgs"); +function isBrowserBundle() { + return typeof __SENTRY_BROWSER_BUNDLE__ !== "undefined" && !!__SENTRY_BROWSER_BUNDLE__; +} +__name(isBrowserBundle, "isBrowserBundle"); +function getSDKSource() { + return "npm"; +} +__name(getSDKSource, "getSDKSource"); +function isNodeEnv() { + return !isBrowserBundle() && Object.prototype.toString.call(typeof process !== "undefined" ? process : 0) === "[object process]"; +} +__name(isNodeEnv, "isNodeEnv"); +function dynamicRequire(mod, request) { + return mod.require(request); +} +__name(dynamicRequire, "dynamicRequire"); +function loadModule(moduleName) { + let mod; + try { + mod = dynamicRequire(module, moduleName); + } catch (e2) { + } + if (!mod) { + try { + const { cwd } = dynamicRequire(module, "process"); + mod = dynamicRequire(module, `${cwd()}/node_modules/${moduleName}`); + } catch (e2) { + } + } + return mod; +} +__name(loadModule, "loadModule"); +function isBrowser$1() { + return typeof window !== "undefined" && (!isNodeEnv() || isElectronNodeRenderer()); +} +__name(isBrowser$1, "isBrowser$1"); +function isElectronNodeRenderer() { + const process2 = GLOBAL_OBJ.process; + return !!process2 && process2.type === "renderer"; +} +__name(isElectronNodeRenderer, "isElectronNodeRenderer"); +function filenameIsInApp(filename, isNative = false) { + const isInternal = isNative || filename && // It's not internal if it's an absolute linux path + !filename.startsWith("/") && // It's not internal if it's an absolute windows path + !filename.match(/^[A-Z]:/) && // It's not internal if the path is starting with a dot + !filename.startsWith(".") && // It's not internal if the frame has a protocol. In node, this is usually the case if the file got pre-processed with a bundler like webpack + !filename.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//); + return !isInternal && filename !== void 0 && !filename.includes("node_modules/"); +} +__name(filenameIsInApp, "filenameIsInApp"); +function node(getModule) { + const FILENAME_MATCH = /^\s*[-]{4,}$/; + const FULL_MATCH = /at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/; + return (line) => { + const lineMatch = line.match(FULL_MATCH); + if (lineMatch) { + let object; + let method; + let functionName; + let typeName; + let methodName; + if (lineMatch[1]) { + functionName = lineMatch[1]; + let methodStart = functionName.lastIndexOf("."); + if (functionName[methodStart - 1] === ".") { + methodStart--; + } + if (methodStart > 0) { + object = functionName.slice(0, methodStart); + method = functionName.slice(methodStart + 1); + const objectEnd = object.indexOf(".Module"); + if (objectEnd > 0) { + functionName = functionName.slice(objectEnd + 1); + object = object.slice(0, objectEnd); + } + } + typeName = void 0; + } + if (method) { + typeName = object; + methodName = method; + } + if (method === "<anonymous>") { + methodName = void 0; + functionName = void 0; + } + if (functionName === void 0) { + methodName = methodName || UNKNOWN_FUNCTION; + functionName = typeName ? `${typeName}.${methodName}` : methodName; + } + let filename = lineMatch[2] && lineMatch[2].startsWith("file://") ? lineMatch[2].slice(7) : lineMatch[2]; + const isNative = lineMatch[5] === "native"; + if (filename && filename.match(/\/[A-Z]:/)) { + filename = filename.slice(1); + } + if (!filename && lineMatch[5] && !isNative) { + filename = lineMatch[5]; + } + return { + filename: filename ? decodeURI(filename) : void 0, + module: getModule ? getModule(filename) : void 0, + function: functionName, + lineno: _parseIntOrUndefined(lineMatch[3]), + colno: _parseIntOrUndefined(lineMatch[4]), + in_app: filenameIsInApp(filename || "", isNative) + }; + } + if (line.match(FILENAME_MATCH)) { + return { + filename: line + }; + } + return void 0; + }; +} +__name(node, "node"); +function nodeStackLineParser(getModule) { + return [90, node(getModule)]; +} +__name(nodeStackLineParser, "nodeStackLineParser"); +function _parseIntOrUndefined(input) { + return parseInt(input || "", 10) || void 0; +} +__name(_parseIntOrUndefined, "_parseIntOrUndefined"); +function makeFifoCache(size2) { + let evictionOrder = []; + let cache2 = {}; + return { + add(key, value4) { + while (evictionOrder.length >= size2) { + const evictCandidate = evictionOrder.shift(); + if (evictCandidate !== void 0) { + delete cache2[evictCandidate]; + } + } + if (cache2[key]) { + this.delete(key); + } + evictionOrder.push(key); + cache2[key] = value4; + }, + clear() { + cache2 = {}; + evictionOrder = []; + }, + get(key) { + return cache2[key]; + }, + size() { + return evictionOrder.length; + }, + // Delete cache key and return true if it existed, false otherwise. + delete(key) { + if (!cache2[key]) { + return false; + } + delete cache2[key]; + for (let i2 = 0; i2 < evictionOrder.length; i2++) { + if (evictionOrder[i2] === key) { + evictionOrder.splice(i2, 1); + break; + } + } + return true; + } + }; +} +__name(makeFifoCache, "makeFifoCache"); +function watchdogTimer(createTimer, pollInterval, anrThreshold, callback) { + const timer = createTimer(); + let triggered = false; + let enabled = true; + setInterval(() => { + const diffMs = timer.getTimeMs(); + if (triggered === false && diffMs > pollInterval + anrThreshold) { + triggered = true; + if (enabled) { + callback(); + } + } + if (diffMs < pollInterval + anrThreshold) { + triggered = false; + } + }, 20); + return { + poll: /* @__PURE__ */ __name(() => { + timer.reset(); + }, "poll"), + enabled: /* @__PURE__ */ __name((state) => { + enabled = state; + }, "enabled") + }; +} +__name(watchdogTimer, "watchdogTimer"); +function callFrameToStackFrame(frame, url, getModuleFromFilename) { + const filename = url ? url.replace(/^file:\/\//, "") : void 0; + const colno = frame.location.columnNumber ? frame.location.columnNumber + 1 : void 0; + const lineno = frame.location.lineNumber ? frame.location.lineNumber + 1 : void 0; + return dropUndefinedKeys({ + filename, + module: getModuleFromFilename(filename), + function: frame.functionName || UNKNOWN_FUNCTION, + colno, + lineno, + in_app: filename ? filenameIsInApp(filename) : void 0 + }); +} +__name(callFrameToStackFrame, "callFrameToStackFrame"); +class LRUMap { + static { + __name(this, "LRUMap"); + } + constructor(_maxSize) { + this._maxSize = _maxSize; + this._cache = /* @__PURE__ */ new Map(); + } + /** Get the current size of the cache */ + get size() { + return this._cache.size; + } + /** Get an entry or undefined if it was not in the cache. Re-inserts to update the recently used order */ + get(key) { + const value4 = this._cache.get(key); + if (value4 === void 0) { + return void 0; + } + this._cache.delete(key); + this._cache.set(key, value4); + return value4; + } + /** Insert an entry and evict an older entry if we've reached maxSize */ + set(key, value4) { + if (this._cache.size >= this._maxSize) { + this._cache.delete(this._cache.keys().next().value); + } + this._cache.set(key, value4); + } + /** Remove an entry and return the entry if it was in the cache */ + remove(key) { + const value4 = this._cache.get(key); + if (value4) { + this._cache.delete(key); + } + return value4; + } + /** Clear all entries */ + clear() { + this._cache.clear(); + } + /** Get all the keys */ + keys() { + return Array.from(this._cache.keys()); + } + /** Get all the values */ + values() { + const values = []; + this._cache.forEach((value4) => values.push(value4)); + return values; + } +} +function vercelWaitUntil(task) { + const vercelRequestContextGlobal = ( + // @ts-expect-error This is not typed + GLOBAL_OBJ[Symbol.for("@vercel/request-context")] + ); + const ctx = vercelRequestContextGlobal && vercelRequestContextGlobal.get && vercelRequestContextGlobal.get() ? vercelRequestContextGlobal.get() : {}; + if (ctx && ctx.waitUntil) { + ctx.waitUntil(task); + } +} +__name(vercelWaitUntil, "vercelWaitUntil"); +function escapeStringForRegex(regexString) { + return regexString.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d"); +} +__name(escapeStringForRegex, "escapeStringForRegex"); +const WINDOW$6 = GLOBAL_OBJ; +function supportsHistory() { + const chromeVar = WINDOW$6.chrome; + const isChromePackagedApp = chromeVar && chromeVar.app && chromeVar.app.runtime; + const hasHistoryApi = "history" in WINDOW$6 && !!WINDOW$6.history.pushState && !!WINDOW$6.history.replaceState; + return !isChromePackagedApp && hasHistoryApi; +} +__name(supportsHistory, "supportsHistory"); +function _nullishCoalesce(lhs, rhsFn) { + return lhs != null ? lhs : rhsFn(); +} +__name(_nullishCoalesce, "_nullishCoalesce"); +async function _asyncNullishCoalesce(lhs, rhsFn) { + return _nullishCoalesce(lhs, rhsFn); +} +__name(_asyncNullishCoalesce, "_asyncNullishCoalesce"); +async function _asyncOptionalChain(ops) { + let lastAccessLHS = void 0; + let value4 = ops[0]; + let i2 = 1; + while (i2 < ops.length) { + const op = ops[i2]; + const fn = ops[i2 + 1]; + i2 += 2; + if ((op === "optionalAccess" || op === "optionalCall") && value4 == null) { + return; + } + if (op === "access" || op === "optionalAccess") { + lastAccessLHS = value4; + value4 = await fn(value4); + } else if (op === "call" || op === "optionalCall") { + value4 = await fn((...args) => value4.call(lastAccessLHS, ...args)); + lastAccessLHS = void 0; + } + } + return value4; +} +__name(_asyncOptionalChain, "_asyncOptionalChain"); +async function _asyncOptionalChainDelete(ops) { + const result = await _asyncOptionalChain(ops); + return result == null ? true : result; +} +__name(_asyncOptionalChainDelete, "_asyncOptionalChainDelete"); +function _optionalChain(ops) { + let lastAccessLHS = void 0; + let value4 = ops[0]; + let i2 = 1; + while (i2 < ops.length) { + const op = ops[i2]; + const fn = ops[i2 + 1]; + i2 += 2; + if ((op === "optionalAccess" || op === "optionalCall") && value4 == null) { + return; + } + if (op === "access" || op === "optionalAccess") { + lastAccessLHS = value4; + value4 = fn(value4); + } else if (op === "call" || op === "optionalCall") { + value4 = fn((...args) => value4.call(lastAccessLHS, ...args)); + lastAccessLHS = void 0; + } + } + return value4; +} +__name(_optionalChain, "_optionalChain"); +function _optionalChainDelete(ops) { + const result = _optionalChain(ops); + return result == null ? true : result; +} +__name(_optionalChainDelete, "_optionalChainDelete"); +const WINDOW$5 = GLOBAL_OBJ; +let ignoreOnError = 0; +function shouldIgnoreOnError() { + return ignoreOnError > 0; +} +__name(shouldIgnoreOnError, "shouldIgnoreOnError"); +function ignoreNextOnError() { + ignoreOnError++; + setTimeout(() => { + ignoreOnError--; + }); +} +__name(ignoreNextOnError, "ignoreNextOnError"); +function wrap$1(fn, options4 = {}) { + function isFunction2(fn2) { + return typeof fn2 === "function"; + } + __name(isFunction2, "isFunction"); + if (!isFunction2(fn)) { + return fn; + } + try { + const wrapper = fn.__sentry_wrapped__; + if (wrapper) { + if (typeof wrapper === "function") { + return wrapper; + } else { + return fn; + } + } + if (getOriginalFunction(fn)) { + return fn; + } + } catch (e2) { + return fn; + } + const sentryWrapped = /* @__PURE__ */ __name(function(...args) { + try { + const wrappedArguments = args.map((arg) => wrap$1(arg, options4)); + return fn.apply(this, wrappedArguments); + } catch (ex) { + ignoreNextOnError(); + withScope((scope) => { + scope.addEventProcessor((event) => { + if (options4.mechanism) { + addExceptionTypeValue(event, void 0, void 0); + addExceptionMechanism(event, options4.mechanism); + } + event.extra = { + ...event.extra, + arguments: args + }; + return event; + }); + captureException(ex); + }); + throw ex; + } + }, "sentryWrapped"); + try { + for (const property in fn) { + if (Object.prototype.hasOwnProperty.call(fn, property)) { + sentryWrapped[property] = fn[property]; + } + } + } catch (e2) { + } + markFunctionWrapped(sentryWrapped, fn); + addNonEnumerableProperty(fn, "__sentry_wrapped__", sentryWrapped); + try { + const descriptor = Object.getOwnPropertyDescriptor(sentryWrapped, "name"); + if (descriptor.configurable) { + Object.defineProperty(sentryWrapped, "name", { + get() { + return fn.name; + } + }); + } + } catch (e3) { + } + return sentryWrapped; +} +__name(wrap$1, "wrap$1"); +const DEBUG_BUILD$4 = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__; +function exceptionFromError(stackParser, ex) { + const frames = parseStackFrames(stackParser, ex); + const exception = { + type: extractType(ex), + value: extractMessage(ex) + }; + if (frames.length) { + exception.stacktrace = { frames }; + } + if (exception.type === void 0 && exception.value === "") { + exception.value = "Unrecoverable error caught"; + } + return exception; +} +__name(exceptionFromError, "exceptionFromError"); +function eventFromPlainObject(stackParser, exception, syntheticException, isUnhandledRejection) { + const client = getClient(); + const normalizeDepth = client && client.getOptions().normalizeDepth; + const errorFromProp = getErrorPropertyFromObject(exception); + const extra = { + __serialized__: normalizeToSize(exception, normalizeDepth) + }; + if (errorFromProp) { + return { + exception: { + values: [exceptionFromError(stackParser, errorFromProp)] + }, + extra + }; + } + const event = { + exception: { + values: [ + { + type: isEvent(exception) ? exception.constructor.name : isUnhandledRejection ? "UnhandledRejection" : "Error", + value: getNonErrorObjectExceptionValue(exception, { isUnhandledRejection }) + } + ] + }, + extra + }; + if (syntheticException) { + const frames = parseStackFrames(stackParser, syntheticException); + if (frames.length) { + event.exception.values[0].stacktrace = { frames }; + } + } + return event; +} +__name(eventFromPlainObject, "eventFromPlainObject"); +function eventFromError(stackParser, ex) { + return { + exception: { + values: [exceptionFromError(stackParser, ex)] + } + }; +} +__name(eventFromError, "eventFromError"); +function parseStackFrames(stackParser, ex) { + const stacktrace = ex.stacktrace || ex.stack || ""; + const skipLines = getSkipFirstStackStringLines(ex); + const framesToPop = getPopFirstTopFrames(ex); + try { + return stackParser(stacktrace, skipLines, framesToPop); + } catch (e2) { + } + return []; +} +__name(parseStackFrames, "parseStackFrames"); +const reactMinifiedRegexp = /Minified React error #\d+;/i; +function getSkipFirstStackStringLines(ex) { + if (ex && reactMinifiedRegexp.test(ex.message)) { + return 1; + } + return 0; +} +__name(getSkipFirstStackStringLines, "getSkipFirstStackStringLines"); +function getPopFirstTopFrames(ex) { + if (typeof ex.framesToPop === "number") { + return ex.framesToPop; + } + return 0; +} +__name(getPopFirstTopFrames, "getPopFirstTopFrames"); +function isWebAssemblyException(exception) { + if (typeof WebAssembly !== "undefined" && typeof WebAssembly.Exception !== "undefined") { + return exception instanceof WebAssembly.Exception; + } else { + return false; + } +} +__name(isWebAssemblyException, "isWebAssemblyException"); +function extractType(ex) { + const name2 = ex && ex.name; + if (!name2 && isWebAssemblyException(ex)) { + const hasTypeInMessage = ex.message && Array.isArray(ex.message) && ex.message.length == 2; + return hasTypeInMessage ? ex.message[0] : "WebAssembly.Exception"; + } + return name2; +} +__name(extractType, "extractType"); +function extractMessage(ex) { + const message3 = ex && ex.message; + if (!message3) { + return "No error message"; + } + if (message3.error && typeof message3.error.message === "string") { + return message3.error.message; + } + if (isWebAssemblyException(ex) && Array.isArray(ex.message) && ex.message.length == 2) { + return ex.message[1]; + } + return message3; +} +__name(extractMessage, "extractMessage"); +function eventFromException(stackParser, exception, hint, attachStacktrace) { + const syntheticException = hint && hint.syntheticException || void 0; + const event = eventFromUnknownInput(stackParser, exception, syntheticException, attachStacktrace); + addExceptionMechanism(event); + event.level = "error"; + if (hint && hint.event_id) { + event.event_id = hint.event_id; + } + return resolvedSyncPromise(event); +} +__name(eventFromException, "eventFromException"); +function eventFromMessage(stackParser, message3, level = "info", hint, attachStacktrace) { + const syntheticException = hint && hint.syntheticException || void 0; + const event = eventFromString(stackParser, message3, syntheticException, attachStacktrace); + event.level = level; + if (hint && hint.event_id) { + event.event_id = hint.event_id; + } + return resolvedSyncPromise(event); +} +__name(eventFromMessage, "eventFromMessage"); +function eventFromUnknownInput(stackParser, exception, syntheticException, attachStacktrace, isUnhandledRejection) { + let event; + if (isErrorEvent$2(exception) && exception.error) { + const errorEvent = exception; + return eventFromError(stackParser, errorEvent.error); + } + if (isDOMError(exception) || isDOMException(exception)) { + const domException = exception; + if ("stack" in exception) { + event = eventFromError(stackParser, exception); + } else { + const name2 = domException.name || (isDOMError(domException) ? "DOMError" : "DOMException"); + const message3 = domException.message ? `${name2}: ${domException.message}` : name2; + event = eventFromString(stackParser, message3, syntheticException, attachStacktrace); + addExceptionTypeValue(event, message3); + } + if ("code" in domException) { + event.tags = { ...event.tags, "DOMException.code": `${domException.code}` }; + } + return event; + } + if (isError(exception)) { + return eventFromError(stackParser, exception); + } + if (isPlainObject$5(exception) || isEvent(exception)) { + const objectException = exception; + event = eventFromPlainObject(stackParser, objectException, syntheticException, isUnhandledRejection); + addExceptionMechanism(event, { + synthetic: true + }); + return event; + } + event = eventFromString(stackParser, exception, syntheticException, attachStacktrace); + addExceptionTypeValue(event, `${exception}`, void 0); + addExceptionMechanism(event, { + synthetic: true + }); + return event; +} +__name(eventFromUnknownInput, "eventFromUnknownInput"); +function eventFromString(stackParser, message3, syntheticException, attachStacktrace) { + const event = {}; + if (attachStacktrace && syntheticException) { + const frames = parseStackFrames(stackParser, syntheticException); + if (frames.length) { + event.exception = { + values: [{ value: message3, stacktrace: { frames } }] + }; + } + addExceptionMechanism(event, { synthetic: true }); + } + if (isParameterizedString(message3)) { + const { __sentry_template_string__, __sentry_template_values__ } = message3; + event.logentry = { + message: __sentry_template_string__, + params: __sentry_template_values__ + }; + return event; + } + event.message = message3; + return event; +} +__name(eventFromString, "eventFromString"); +function getNonErrorObjectExceptionValue(exception, { isUnhandledRejection }) { + const keys2 = extractExceptionKeysForMessage(exception); + const captureType = isUnhandledRejection ? "promise rejection" : "exception"; + if (isErrorEvent$2(exception)) { + return `Event \`ErrorEvent\` captured as ${captureType} with message \`${exception.message}\``; + } + if (isEvent(exception)) { + const className = getObjectClassName(exception); + return `Event \`${className}\` (type=${exception.type}) captured as ${captureType}`; + } + return `Object captured as ${captureType} with keys: ${keys2}`; +} +__name(getNonErrorObjectExceptionValue, "getNonErrorObjectExceptionValue"); +function getObjectClassName(obj) { + try { + const prototype2 = Object.getPrototypeOf(obj); + return prototype2 ? prototype2.constructor.name : void 0; + } catch (e2) { + } +} +__name(getObjectClassName, "getObjectClassName"); +function getErrorPropertyFromObject(obj) { + for (const prop2 in obj) { + if (Object.prototype.hasOwnProperty.call(obj, prop2)) { + const value4 = obj[prop2]; + if (value4 instanceof Error) { + return value4; + } + } + } + return void 0; +} +__name(getErrorPropertyFromObject, "getErrorPropertyFromObject"); +function createUserFeedbackEnvelope(feedback, { + metadata, + tunnel, + dsn +}) { + const headers = { + event_id: feedback.event_id, + sent_at: (/* @__PURE__ */ new Date()).toISOString(), + ...metadata && metadata.sdk && { + sdk: { + name: metadata.sdk.name, + version: metadata.sdk.version + } + }, + ...!!tunnel && !!dsn && { dsn: dsnToString(dsn) } + }; + const item3 = createUserFeedbackEnvelopeItem(feedback); + return createEnvelope(headers, [item3]); +} +__name(createUserFeedbackEnvelope, "createUserFeedbackEnvelope"); +function createUserFeedbackEnvelopeItem(feedback) { + const feedbackHeaders = { + type: "user_report" + }; + return [feedbackHeaders, feedback]; +} +__name(createUserFeedbackEnvelopeItem, "createUserFeedbackEnvelopeItem"); +class BrowserClient extends BaseClient { + static { + __name(this, "BrowserClient"); + } + /** + * Creates a new Browser SDK instance. + * + * @param options Configuration options for this SDK. + */ + constructor(options4) { + const opts = { + // We default this to true, as it is the safer scenario + parentSpanIsAlwaysRootSpan: true, + ...options4 + }; + const sdkSource = WINDOW$5.SENTRY_SDK_SOURCE || getSDKSource(); + applySdkMetadata(opts, "browser", ["browser"], sdkSource); + super(opts); + if (opts.sendClientReports && WINDOW$5.document) { + WINDOW$5.document.addEventListener("visibilitychange", () => { + if (WINDOW$5.document.visibilityState === "hidden") { + this._flushOutcomes(); + } + }); + } + } + /** + * @inheritDoc + */ + eventFromException(exception, hint) { + return eventFromException(this._options.stackParser, exception, hint, this._options.attachStacktrace); + } + /** + * @inheritDoc + */ + eventFromMessage(message3, level = "info", hint) { + return eventFromMessage(this._options.stackParser, message3, level, hint, this._options.attachStacktrace); + } + /** + * Sends user feedback to Sentry. + * + * @deprecated Use `captureFeedback` instead. + */ + captureUserFeedback(feedback) { + if (!this._isEnabled()) { + DEBUG_BUILD$4 && logger$2.warn("SDK not enabled, will not capture user feedback."); + return; + } + const envelope = createUserFeedbackEnvelope(feedback, { + metadata: this.getSdkMetadata(), + dsn: this.getDsn(), + tunnel: this.getOptions().tunnel + }); + this.sendEnvelope(envelope); + } + /** + * @inheritDoc + */ + _prepareEvent(event, hint, scope) { + event.platform = event.platform || "javascript"; + return super._prepareEvent(event, hint, scope); + } +} +const DEBUG_BUILD$3 = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__; +const getRating = /* @__PURE__ */ __name((value4, thresholds) => { + if (value4 > thresholds[1]) { + return "poor"; + } + if (value4 > thresholds[0]) { + return "needs-improvement"; + } + return "good"; +}, "getRating"); +const bindReporter = /* @__PURE__ */ __name((callback, metric, thresholds, reportAllChanges) => { + let prevValue; + let delta2; + return (forceReport) => { + if (metric.value >= 0) { + if (forceReport || reportAllChanges) { + delta2 = metric.value - (prevValue || 0); + if (delta2 || prevValue === void 0) { + prevValue = metric.value; + metric.delta = delta2; + metric.rating = getRating(metric.value, thresholds); + callback(metric); + } + } + } + }; +}, "bindReporter"); +const WINDOW$4 = GLOBAL_OBJ; +const generateUniqueID = /* @__PURE__ */ __name(() => { + return `v4-${Date.now()}-${Math.floor(Math.random() * (9e12 - 1)) + 1e12}`; +}, "generateUniqueID"); +const getNavigationEntry = /* @__PURE__ */ __name((checkResponseStart = true) => { + const navigationEntry = WINDOW$4.performance && WINDOW$4.performance.getEntriesByType && WINDOW$4.performance.getEntriesByType("navigation")[0]; + if ( + // sentry-specific change: + // We don't want to check for responseStart for our own use of `getNavigationEntry` + !checkResponseStart || navigationEntry && navigationEntry.responseStart > 0 && navigationEntry.responseStart < performance.now() + ) { + return navigationEntry; + } +}, "getNavigationEntry"); +const getActivationStart = /* @__PURE__ */ __name(() => { + const navEntry = getNavigationEntry(); + return navEntry && navEntry.activationStart || 0; +}, "getActivationStart"); +const initMetric = /* @__PURE__ */ __name((name2, value4) => { + const navEntry = getNavigationEntry(); + let navigationType = "navigate"; + if (navEntry) { + if (WINDOW$4.document && WINDOW$4.document.prerendering || getActivationStart() > 0) { + navigationType = "prerender"; + } else if (WINDOW$4.document && WINDOW$4.document.wasDiscarded) { + navigationType = "restore"; + } else if (navEntry.type) { + navigationType = navEntry.type.replace(/_/g, "-"); + } + } + const entries = []; + return { + name: name2, + value: typeof value4 === "undefined" ? -1 : value4, + rating: "good", + // If needed, will be updated when reported. `const` to keep the type from widening to `string`. + delta: 0, + entries, + id: generateUniqueID(), + navigationType + }; +}, "initMetric"); +const observe = /* @__PURE__ */ __name((type, callback, opts) => { + try { + if (PerformanceObserver.supportedEntryTypes.includes(type)) { + const po2 = new PerformanceObserver((list2) => { + Promise.resolve().then(() => { + callback(list2.getEntries()); + }); + }); + po2.observe( + Object.assign( + { + type, + buffered: true + }, + opts || {} + ) + ); + return po2; + } + } catch (e2) { + } + return; +}, "observe"); +const onHidden = /* @__PURE__ */ __name((cb) => { + const onHiddenOrPageHide = /* @__PURE__ */ __name((event) => { + if (event.type === "pagehide" || WINDOW$4.document && WINDOW$4.document.visibilityState === "hidden") { + cb(event); + } + }, "onHiddenOrPageHide"); + if (WINDOW$4.document) { + addEventListener("visibilitychange", onHiddenOrPageHide, true); + addEventListener("pagehide", onHiddenOrPageHide, true); + } +}, "onHidden"); +const runOnce = /* @__PURE__ */ __name((cb) => { + let called = false; + return () => { + if (!called) { + cb(); + called = true; + } + }; +}, "runOnce"); +let firstHiddenTime = -1; +const initHiddenTime = /* @__PURE__ */ __name(() => { + return WINDOW$4.document.visibilityState === "hidden" && !WINDOW$4.document.prerendering ? 0 : Infinity; +}, "initHiddenTime"); +const onVisibilityUpdate = /* @__PURE__ */ __name((event) => { + if (WINDOW$4.document.visibilityState === "hidden" && firstHiddenTime > -1) { + firstHiddenTime = event.type === "visibilitychange" ? event.timeStamp : 0; + removeChangeListeners(); + } +}, "onVisibilityUpdate"); +const addChangeListeners = /* @__PURE__ */ __name(() => { + addEventListener("visibilitychange", onVisibilityUpdate, true); + addEventListener("prerenderingchange", onVisibilityUpdate, true); +}, "addChangeListeners"); +const removeChangeListeners = /* @__PURE__ */ __name(() => { + removeEventListener("visibilitychange", onVisibilityUpdate, true); + removeEventListener("prerenderingchange", onVisibilityUpdate, true); +}, "removeChangeListeners"); +const getVisibilityWatcher = /* @__PURE__ */ __name(() => { + if (WINDOW$4.document && firstHiddenTime < 0) { + firstHiddenTime = initHiddenTime(); + addChangeListeners(); + } + return { + get firstHiddenTime() { + return firstHiddenTime; + } + }; +}, "getVisibilityWatcher"); +const whenActivated = /* @__PURE__ */ __name((callback) => { + if (WINDOW$4.document && WINDOW$4.document.prerendering) { + addEventListener("prerenderingchange", () => callback(), true); + } else { + callback(); + } +}, "whenActivated"); +const FCPThresholds = [1800, 3e3]; +const onFCP = /* @__PURE__ */ __name((onReport, opts = {}) => { + whenActivated(() => { + const visibilityWatcher = getVisibilityWatcher(); + const metric = initMetric("FCP"); + let report; + const handleEntries = /* @__PURE__ */ __name((entries) => { + entries.forEach((entry) => { + if (entry.name === "first-contentful-paint") { + po2.disconnect(); + if (entry.startTime < visibilityWatcher.firstHiddenTime) { + metric.value = Math.max(entry.startTime - getActivationStart(), 0); + metric.entries.push(entry); + report(true); + } + } + }); + }, "handleEntries"); + const po2 = observe("paint", handleEntries); + if (po2) { + report = bindReporter(onReport, metric, FCPThresholds, opts.reportAllChanges); + } + }); +}, "onFCP"); +const CLSThresholds = [0.1, 0.25]; +const onCLS = /* @__PURE__ */ __name((onReport, opts = {}) => { + onFCP( + runOnce(() => { + const metric = initMetric("CLS", 0); + let report; + let sessionValue = 0; + let sessionEntries = []; + const handleEntries = /* @__PURE__ */ __name((entries) => { + entries.forEach((entry) => { + if (!entry.hadRecentInput) { + const firstSessionEntry = sessionEntries[0]; + const lastSessionEntry = sessionEntries[sessionEntries.length - 1]; + if (sessionValue && firstSessionEntry && lastSessionEntry && entry.startTime - lastSessionEntry.startTime < 1e3 && entry.startTime - firstSessionEntry.startTime < 5e3) { + sessionValue += entry.value; + sessionEntries.push(entry); + } else { + sessionValue = entry.value; + sessionEntries = [entry]; + } + } + }); + if (sessionValue > metric.value) { + metric.value = sessionValue; + metric.entries = sessionEntries; + report(); + } + }, "handleEntries"); + const po2 = observe("layout-shift", handleEntries); + if (po2) { + report = bindReporter(onReport, metric, CLSThresholds, opts.reportAllChanges); + onHidden(() => { + handleEntries(po2.takeRecords()); + report(true); + }); + setTimeout(report, 0); + } + }) + ); +}, "onCLS"); +const FIDThresholds = [100, 300]; +const onFID = /* @__PURE__ */ __name((onReport, opts = {}) => { + whenActivated(() => { + const visibilityWatcher = getVisibilityWatcher(); + const metric = initMetric("FID"); + let report; + const handleEntry = /* @__PURE__ */ __name((entry) => { + if (entry.startTime < visibilityWatcher.firstHiddenTime) { + metric.value = entry.processingStart - entry.startTime; + metric.entries.push(entry); + report(true); + } + }, "handleEntry"); + const handleEntries = /* @__PURE__ */ __name((entries) => { + entries.forEach(handleEntry); + }, "handleEntries"); + const po2 = observe("first-input", handleEntries); + report = bindReporter(onReport, metric, FIDThresholds, opts.reportAllChanges); + if (po2) { + onHidden( + runOnce(() => { + handleEntries(po2.takeRecords()); + po2.disconnect(); + }) + ); + } + }); +}, "onFID"); +let interactionCountEstimate = 0; +let minKnownInteractionId = Infinity; +let maxKnownInteractionId = 0; +const updateEstimate = /* @__PURE__ */ __name((entries) => { + entries.forEach((e2) => { + if (e2.interactionId) { + minKnownInteractionId = Math.min(minKnownInteractionId, e2.interactionId); + maxKnownInteractionId = Math.max(maxKnownInteractionId, e2.interactionId); + interactionCountEstimate = maxKnownInteractionId ? (maxKnownInteractionId - minKnownInteractionId) / 7 + 1 : 0; + } + }); +}, "updateEstimate"); +let po; +const getInteractionCount = /* @__PURE__ */ __name(() => { + return po ? interactionCountEstimate : performance.interactionCount || 0; +}, "getInteractionCount"); +const initInteractionCountPolyfill = /* @__PURE__ */ __name(() => { + if ("interactionCount" in performance || po) return; + po = observe("event", updateEstimate, { + type: "event", + buffered: true, + durationThreshold: 0 + }); +}, "initInteractionCountPolyfill"); +const longestInteractionList = []; +const longestInteractionMap = /* @__PURE__ */ new Map(); +const DEFAULT_DURATION_THRESHOLD = 40; +let prevInteractionCount = 0; +const getInteractionCountForNavigation = /* @__PURE__ */ __name(() => { + return getInteractionCount() - prevInteractionCount; +}, "getInteractionCountForNavigation"); +const estimateP98LongestInteraction = /* @__PURE__ */ __name(() => { + const candidateInteractionIndex = Math.min( + longestInteractionList.length - 1, + Math.floor(getInteractionCountForNavigation() / 50) + ); + return longestInteractionList[candidateInteractionIndex]; +}, "estimateP98LongestInteraction"); +const MAX_INTERACTIONS_TO_CONSIDER = 10; +const entryPreProcessingCallbacks = []; +const processInteractionEntry = /* @__PURE__ */ __name((entry) => { + entryPreProcessingCallbacks.forEach((cb) => cb(entry)); + if (!(entry.interactionId || entry.entryType === "first-input")) return; + const minLongestInteraction = longestInteractionList[longestInteractionList.length - 1]; + const existingInteraction = longestInteractionMap.get(entry.interactionId); + if (existingInteraction || longestInteractionList.length < MAX_INTERACTIONS_TO_CONSIDER || minLongestInteraction && entry.duration > minLongestInteraction.latency) { + if (existingInteraction) { + if (entry.duration > existingInteraction.latency) { + existingInteraction.entries = [entry]; + existingInteraction.latency = entry.duration; + } else if (entry.duration === existingInteraction.latency && entry.startTime === (existingInteraction.entries[0] && existingInteraction.entries[0].startTime)) { + existingInteraction.entries.push(entry); + } + } else { + const interaction = { + id: entry.interactionId, + latency: entry.duration, + entries: [entry] + }; + longestInteractionMap.set(interaction.id, interaction); + longestInteractionList.push(interaction); + } + longestInteractionList.sort((a2, b2) => b2.latency - a2.latency); + if (longestInteractionList.length > MAX_INTERACTIONS_TO_CONSIDER) { + longestInteractionList.splice(MAX_INTERACTIONS_TO_CONSIDER).forEach((i2) => longestInteractionMap.delete(i2.id)); + } + } +}, "processInteractionEntry"); +const whenIdle = /* @__PURE__ */ __name((cb) => { + const rIC = WINDOW$4.requestIdleCallback || WINDOW$4.setTimeout; + let handle = -1; + cb = runOnce(cb); + if (WINDOW$4.document && WINDOW$4.document.visibilityState === "hidden") { + cb(); + } else { + handle = rIC(cb); + onHidden(cb); + } + return handle; +}, "whenIdle"); +const INPThresholds = [200, 500]; +const onINP = /* @__PURE__ */ __name((onReport, opts = {}) => { + if (!("PerformanceEventTiming" in WINDOW$4 && "interactionId" in PerformanceEventTiming.prototype)) { + return; + } + whenActivated(() => { + initInteractionCountPolyfill(); + const metric = initMetric("INP"); + let report; + const handleEntries = /* @__PURE__ */ __name((entries) => { + whenIdle(() => { + entries.forEach(processInteractionEntry); + const inp = estimateP98LongestInteraction(); + if (inp && inp.latency !== metric.value) { + metric.value = inp.latency; + metric.entries = inp.entries; + report(); + } + }); + }, "handleEntries"); + const po2 = observe("event", handleEntries, { + // Event Timing entries have their durations rounded to the nearest 8ms, + // so a duration of 40ms would be any event that spans 2.5 or more frames + // at 60Hz. This threshold is chosen to strike a balance between usefulness + // and performance. Running this callback for any interaction that spans + // just one or two frames is likely not worth the insight that could be + // gained. + durationThreshold: opts.durationThreshold != null ? opts.durationThreshold : DEFAULT_DURATION_THRESHOLD + }); + report = bindReporter(onReport, metric, INPThresholds, opts.reportAllChanges); + if (po2) { + po2.observe({ type: "first-input", buffered: true }); + onHidden(() => { + handleEntries(po2.takeRecords()); + report(true); + }); + } + }); +}, "onINP"); +const LCPThresholds = [2500, 4e3]; +const reportedMetricIDs = {}; +const onLCP = /* @__PURE__ */ __name((onReport, opts = {}) => { + whenActivated(() => { + const visibilityWatcher = getVisibilityWatcher(); + const metric = initMetric("LCP"); + let report; + const handleEntries = /* @__PURE__ */ __name((entries) => { + if (!opts.reportAllChanges) { + entries = entries.slice(-1); + } + entries.forEach((entry) => { + if (entry.startTime < visibilityWatcher.firstHiddenTime) { + metric.value = Math.max(entry.startTime - getActivationStart(), 0); + metric.entries = [entry]; + report(); + } + }); + }, "handleEntries"); + const po2 = observe("largest-contentful-paint", handleEntries); + if (po2) { + report = bindReporter(onReport, metric, LCPThresholds, opts.reportAllChanges); + const stopListening = runOnce(() => { + if (!reportedMetricIDs[metric.id]) { + handleEntries(po2.takeRecords()); + po2.disconnect(); + reportedMetricIDs[metric.id] = true; + report(true); + } + }); + ["keydown", "click"].forEach((type) => { + if (WINDOW$4.document) { + addEventListener(type, () => whenIdle(stopListening), { + once: true, + capture: true + }); + } + }); + onHidden(stopListening); + } + }); +}, "onLCP"); +const TTFBThresholds = [800, 1800]; +const whenReady = /* @__PURE__ */ __name((callback) => { + if (WINDOW$4.document && WINDOW$4.document.prerendering) { + whenActivated(() => whenReady(callback)); + } else if (WINDOW$4.document && WINDOW$4.document.readyState !== "complete") { + addEventListener("load", () => whenReady(callback), true); + } else { + setTimeout(callback, 0); + } +}, "whenReady"); +const onTTFB = /* @__PURE__ */ __name((onReport, opts = {}) => { + const metric = initMetric("TTFB"); + const report = bindReporter(onReport, metric, TTFBThresholds, opts.reportAllChanges); + whenReady(() => { + const navigationEntry = getNavigationEntry(); + if (navigationEntry) { + metric.value = Math.max(navigationEntry.responseStart - getActivationStart(), 0); + metric.entries = [navigationEntry]; + report(true); + } + }); +}, "onTTFB"); +const handlers$3 = {}; +const instrumented = {}; +let _previousCls; +let _previousFid; +let _previousLcp; +let _previousTtfb; +let _previousInp; +function addClsInstrumentationHandler(callback, stopOnCallback = false) { + return addMetricObserver("cls", callback, instrumentCls, _previousCls, stopOnCallback); +} +__name(addClsInstrumentationHandler, "addClsInstrumentationHandler"); +function addLcpInstrumentationHandler(callback, stopOnCallback = false) { + return addMetricObserver("lcp", callback, instrumentLcp, _previousLcp, stopOnCallback); +} +__name(addLcpInstrumentationHandler, "addLcpInstrumentationHandler"); +function addFidInstrumentationHandler(callback) { + return addMetricObserver("fid", callback, instrumentFid, _previousFid); +} +__name(addFidInstrumentationHandler, "addFidInstrumentationHandler"); +function addTtfbInstrumentationHandler(callback) { + return addMetricObserver("ttfb", callback, instrumentTtfb, _previousTtfb); +} +__name(addTtfbInstrumentationHandler, "addTtfbInstrumentationHandler"); +function addInpInstrumentationHandler(callback) { + return addMetricObserver("inp", callback, instrumentInp, _previousInp); +} +__name(addInpInstrumentationHandler, "addInpInstrumentationHandler"); +function addPerformanceInstrumentationHandler(type, callback) { + addHandler(type, callback); + if (!instrumented[type]) { + instrumentPerformanceObserver(type); + instrumented[type] = true; + } + return getCleanupCallback(type, callback); +} +__name(addPerformanceInstrumentationHandler, "addPerformanceInstrumentationHandler"); +function triggerHandlers(type, data25) { + const typeHandlers = handlers$3[type]; + if (!typeHandlers || !typeHandlers.length) { + return; + } + for (const handler6 of typeHandlers) { + try { + handler6(data25); + } catch (e2) { + DEBUG_BUILD$3 && logger$2.error( + `Error while triggering instrumentation handler. +Type: ${type} +Name: ${getFunctionName(handler6)} +Error:`, + e2 + ); + } + } +} +__name(triggerHandlers, "triggerHandlers"); +function instrumentCls() { + return onCLS( + (metric) => { + triggerHandlers("cls", { + metric + }); + _previousCls = metric; + }, + // We want the callback to be called whenever the CLS value updates. + // By default, the callback is only called when the tab goes to the background. + { reportAllChanges: true } + ); +} +__name(instrumentCls, "instrumentCls"); +function instrumentFid() { + return onFID((metric) => { + triggerHandlers("fid", { + metric + }); + _previousFid = metric; + }); +} +__name(instrumentFid, "instrumentFid"); +function instrumentLcp() { + return onLCP( + (metric) => { + triggerHandlers("lcp", { + metric + }); + _previousLcp = metric; + }, + // We want the callback to be called whenever the LCP value updates. + // By default, the callback is only called when the tab goes to the background. + { reportAllChanges: true } + ); +} +__name(instrumentLcp, "instrumentLcp"); +function instrumentTtfb() { + return onTTFB((metric) => { + triggerHandlers("ttfb", { + metric + }); + _previousTtfb = metric; + }); +} +__name(instrumentTtfb, "instrumentTtfb"); +function instrumentInp() { + return onINP((metric) => { + triggerHandlers("inp", { + metric + }); + _previousInp = metric; + }); +} +__name(instrumentInp, "instrumentInp"); +function addMetricObserver(type, callback, instrumentFn, previousValue, stopOnCallback = false) { + addHandler(type, callback); + let stopListening; + if (!instrumented[type]) { + stopListening = instrumentFn(); + instrumented[type] = true; + } + if (previousValue) { + callback({ metric: previousValue }); + } + return getCleanupCallback(type, callback, stopOnCallback ? stopListening : void 0); +} +__name(addMetricObserver, "addMetricObserver"); +function instrumentPerformanceObserver(type) { + const options4 = {}; + if (type === "event") { + options4.durationThreshold = 0; + } + observe( + type, + (entries) => { + triggerHandlers(type, { entries }); + }, + options4 + ); +} +__name(instrumentPerformanceObserver, "instrumentPerformanceObserver"); +function addHandler(type, handler6) { + handlers$3[type] = handlers$3[type] || []; + handlers$3[type].push(handler6); +} +__name(addHandler, "addHandler"); +function getCleanupCallback(type, callback, stopListening) { + return () => { + if (stopListening) { + stopListening(); + } + const typeHandlers = handlers$3[type]; + if (!typeHandlers) { + return; + } + const index2 = typeHandlers.indexOf(callback); + if (index2 !== -1) { + typeHandlers.splice(index2, 1); + } + }; +} +__name(getCleanupCallback, "getCleanupCallback"); +function isPerformanceEventTiming(entry) { + return "duration" in entry; +} +__name(isPerformanceEventTiming, "isPerformanceEventTiming"); +function isMeasurementValue(value4) { + return typeof value4 === "number" && isFinite(value4); +} +__name(isMeasurementValue, "isMeasurementValue"); +function startAndEndSpan(parentSpan, startTimeInSeconds, endTime, { ...ctx }) { + const parentStartTime = spanToJSON(parentSpan).start_timestamp; + if (parentStartTime && parentStartTime > startTimeInSeconds) { + if (typeof parentSpan.updateStartTime === "function") { + parentSpan.updateStartTime(startTimeInSeconds); + } + } + return withActiveSpan(parentSpan, () => { + const span = startInactiveSpan({ + startTime: startTimeInSeconds, + ...ctx + }); + if (span) { + span.end(endTime); + } + return span; + }); +} +__name(startAndEndSpan, "startAndEndSpan"); +function startStandaloneWebVitalSpan(options4) { + const client = getClient(); + if (!client) { + return; + } + const { name: name2, transaction, attributes: passedAttributes, startTime } = options4; + const { release, environment } = client.getOptions(); + const replay = client.getIntegrationByName("Replay"); + const replayId = replay && replay.getReplayId(); + const scope = getCurrentScope$1(); + const user = scope.getUser(); + const userDisplay = user !== void 0 ? user.email || user.id || user.ip_address : void 0; + let profileId; + try { + profileId = scope.getScopeData().contexts.profile.profile_id; + } catch (e2) { + } + const attributes = { + release, + environment, + user: userDisplay || void 0, + profile_id: profileId || void 0, + replay_id: replayId || void 0, + transaction, + // Web vital score calculation relies on the user agent to account for different + // browsers setting different thresholds for what is considered a good/meh/bad value. + // For example: Chrome vs. Chrome Mobile + "user_agent.original": WINDOW$4.navigator && WINDOW$4.navigator.userAgent, + ...passedAttributes + }; + return startInactiveSpan({ + name: name2, + attributes, + startTime, + experimental: { + standalone: true + } + }); +} +__name(startStandaloneWebVitalSpan, "startStandaloneWebVitalSpan"); +function getBrowserPerformanceAPI() { + return WINDOW$4 && WINDOW$4.addEventListener && WINDOW$4.performance; +} +__name(getBrowserPerformanceAPI, "getBrowserPerformanceAPI"); +function msToSec(time) { + return time / 1e3; +} +__name(msToSec, "msToSec"); +function trackClsAsStandaloneSpan() { + let standaloneCLsValue = 0; + let standaloneClsEntry; + let pageloadSpanId; + if (!supportsLayoutShift()) { + return; + } + let sentSpan = false; + function _collectClsOnce() { + if (sentSpan) { + return; + } + sentSpan = true; + if (pageloadSpanId) { + sendStandaloneClsSpan(standaloneCLsValue, standaloneClsEntry, pageloadSpanId); + } + cleanupClsHandler(); + } + __name(_collectClsOnce, "_collectClsOnce"); + const cleanupClsHandler = addClsInstrumentationHandler(({ metric }) => { + const entry = metric.entries[metric.entries.length - 1]; + if (!entry) { + return; + } + standaloneCLsValue = metric.value; + standaloneClsEntry = entry; + }, true); + onHidden(() => { + _collectClsOnce(); + }); + setTimeout(() => { + const client = getClient(); + if (!client) { + return; + } + const unsubscribeStartNavigation = client.on("startNavigationSpan", () => { + _collectClsOnce(); + unsubscribeStartNavigation && unsubscribeStartNavigation(); + }); + const activeSpan = getActiveSpan(); + const rootSpan = activeSpan && getRootSpan(activeSpan); + const spanJSON = rootSpan && spanToJSON(rootSpan); + if (spanJSON && spanJSON.op === "pageload") { + pageloadSpanId = rootSpan.spanContext().spanId; + } + }, 0); +} +__name(trackClsAsStandaloneSpan, "trackClsAsStandaloneSpan"); +function sendStandaloneClsSpan(clsValue, entry, pageloadSpanId) { + DEBUG_BUILD$3 && logger$2.log(`Sending CLS span (${clsValue})`); + const startTime = msToSec((browserPerformanceTimeOrigin || 0) + (entry && entry.startTime || 0)); + const routeName = getCurrentScope$1().getScopeData().transactionName; + const name2 = entry ? htmlTreeAsString(entry.sources[0] && entry.sources[0].node) : "Layout shift"; + const attributes = dropUndefinedKeys({ + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.http.browser.cls", + [SEMANTIC_ATTRIBUTE_SENTRY_OP]: "ui.webvital.cls", + [SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME]: entry && entry.duration || 0, + // attach the pageload span id to the CLS span so that we can link them in the UI + "sentry.pageload.span_id": pageloadSpanId + }); + const span = startStandaloneWebVitalSpan({ + name: name2, + transaction: routeName, + attributes, + startTime + }); + if (span) { + span.addEvent("cls", { + [SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT]: "", + [SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE]: clsValue + }); + span.end(startTime); + } +} +__name(sendStandaloneClsSpan, "sendStandaloneClsSpan"); +function supportsLayoutShift() { + try { + return PerformanceObserver.supportedEntryTypes.includes("layout-shift"); + } catch (e2) { + return false; + } +} +__name(supportsLayoutShift, "supportsLayoutShift"); +const MAX_INT_AS_BYTES = 2147483647; +let _performanceCursor = 0; +let _measurements = {}; +let _lcpEntry; +let _clsEntry; +function startTrackingWebVitals({ recordClsStandaloneSpans }) { + const performance2 = getBrowserPerformanceAPI(); + if (performance2 && browserPerformanceTimeOrigin) { + if (performance2.mark) { + WINDOW$4.performance.mark("sentry-tracing-init"); + } + const fidCleanupCallback = _trackFID(); + const lcpCleanupCallback = _trackLCP(); + const ttfbCleanupCallback = _trackTtfb(); + const clsCleanupCallback = recordClsStandaloneSpans ? trackClsAsStandaloneSpan() : _trackCLS(); + return () => { + fidCleanupCallback(); + lcpCleanupCallback(); + ttfbCleanupCallback(); + clsCleanupCallback && clsCleanupCallback(); + }; + } + return () => void 0; +} +__name(startTrackingWebVitals, "startTrackingWebVitals"); +function startTrackingLongTasks() { + addPerformanceInstrumentationHandler("longtask", ({ entries }) => { + const parent = getActiveSpan(); + if (!parent) { + return; + } + const { op: parentOp, start_timestamp: parentStartTimestamp } = spanToJSON(parent); + for (const entry of entries) { + const startTime = msToSec(browserPerformanceTimeOrigin + entry.startTime); + const duration = msToSec(entry.duration); + if (parentOp === "navigation" && parentStartTimestamp && startTime < parentStartTimestamp) { + continue; + } + startAndEndSpan(parent, startTime, startTime + duration, { + name: "Main UI thread blocked", + op: "ui.long-task", + attributes: { + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.ui.browser.metrics" + } + }); + } + }); +} +__name(startTrackingLongTasks, "startTrackingLongTasks"); +function startTrackingLongAnimationFrames() { + const observer = new PerformanceObserver((list2) => { + const parent = getActiveSpan(); + if (!parent) { + return; + } + for (const entry of list2.getEntries()) { + if (!entry.scripts[0]) { + continue; + } + const startTime = msToSec(browserPerformanceTimeOrigin + entry.startTime); + const { start_timestamp: parentStartTimestamp, op: parentOp } = spanToJSON(parent); + if (parentOp === "navigation" && parentStartTimestamp && startTime < parentStartTimestamp) { + continue; + } + const duration = msToSec(entry.duration); + const attributes = { + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.ui.browser.metrics" + }; + const initialScript = entry.scripts[0]; + const { invoker, invokerType, sourceURL, sourceFunctionName, sourceCharPosition } = initialScript; + attributes["browser.script.invoker"] = invoker; + attributes["browser.script.invoker_type"] = invokerType; + if (sourceURL) { + attributes["code.filepath"] = sourceURL; + } + if (sourceFunctionName) { + attributes["code.function"] = sourceFunctionName; + } + if (sourceCharPosition !== -1) { + attributes["browser.script.source_char_position"] = sourceCharPosition; + } + startAndEndSpan(parent, startTime, startTime + duration, { + name: "Main UI thread blocked", + op: "ui.long-animation-frame", + attributes + }); + } + }); + observer.observe({ type: "long-animation-frame", buffered: true }); +} +__name(startTrackingLongAnimationFrames, "startTrackingLongAnimationFrames"); +function startTrackingInteractions() { + addPerformanceInstrumentationHandler("event", ({ entries }) => { + const parent = getActiveSpan(); + if (!parent) { + return; + } + for (const entry of entries) { + if (entry.name === "click") { + const startTime = msToSec(browserPerformanceTimeOrigin + entry.startTime); + const duration = msToSec(entry.duration); + const spanOptions = { + name: htmlTreeAsString(entry.target), + op: `ui.interaction.${entry.name}`, + startTime, + attributes: { + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.ui.browser.metrics" + } + }; + const componentName = getComponentName$1(entry.target); + if (componentName) { + spanOptions.attributes["ui.component_name"] = componentName; + } + startAndEndSpan(parent, startTime, startTime + duration, spanOptions); + } + } + }); +} +__name(startTrackingInteractions, "startTrackingInteractions"); +function _trackCLS() { + return addClsInstrumentationHandler(({ metric }) => { + const entry = metric.entries[metric.entries.length - 1]; + if (!entry) { + return; + } + _measurements["cls"] = { value: metric.value, unit: "" }; + _clsEntry = entry; + }, true); +} +__name(_trackCLS, "_trackCLS"); +function _trackLCP() { + return addLcpInstrumentationHandler(({ metric }) => { + const entry = metric.entries[metric.entries.length - 1]; + if (!entry) { + return; + } + _measurements["lcp"] = { value: metric.value, unit: "millisecond" }; + _lcpEntry = entry; + }, true); +} +__name(_trackLCP, "_trackLCP"); +function _trackFID() { + return addFidInstrumentationHandler(({ metric }) => { + const entry = metric.entries[metric.entries.length - 1]; + if (!entry) { + return; + } + const timeOrigin = msToSec(browserPerformanceTimeOrigin); + const startTime = msToSec(entry.startTime); + _measurements["fid"] = { value: metric.value, unit: "millisecond" }; + _measurements["mark.fid"] = { value: timeOrigin + startTime, unit: "second" }; + }); +} +__name(_trackFID, "_trackFID"); +function _trackTtfb() { + return addTtfbInstrumentationHandler(({ metric }) => { + const entry = metric.entries[metric.entries.length - 1]; + if (!entry) { + return; + } + _measurements["ttfb"] = { value: metric.value, unit: "millisecond" }; + }); +} +__name(_trackTtfb, "_trackTtfb"); +function addPerformanceEntries(span, options4) { + const performance2 = getBrowserPerformanceAPI(); + if (!performance2 || !performance2.getEntries || !browserPerformanceTimeOrigin) { + return; + } + const timeOrigin = msToSec(browserPerformanceTimeOrigin); + const performanceEntries = performance2.getEntries(); + const { op, start_timestamp: transactionStartTime } = spanToJSON(span); + performanceEntries.slice(_performanceCursor).forEach((entry) => { + const startTime = msToSec(entry.startTime); + const duration = msToSec( + // Inexplicably, Chrome sometimes emits a negative duration. We need to work around this. + // There is a SO post attempting to explain this, but it leaves one with open questions: https://stackoverflow.com/questions/23191918/peformance-getentries-and-negative-duration-display + // The way we clamp the value is probably not accurate, since we have observed this happen for things that may take a while to load, like for example the replay worker. + // TODO: Investigate why this happens and how to properly mitigate. For now, this is a workaround to prevent transactions being dropped due to negative duration spans. + Math.max(0, entry.duration) + ); + if (op === "navigation" && transactionStartTime && timeOrigin + startTime < transactionStartTime) { + return; + } + switch (entry.entryType) { + case "navigation": { + _addNavigationSpans(span, entry, timeOrigin); + break; + } + case "mark": + case "paint": + case "measure": { + _addMeasureSpans(span, entry, startTime, duration, timeOrigin); + const firstHidden = getVisibilityWatcher(); + const shouldRecord = entry.startTime < firstHidden.firstHiddenTime; + if (entry.name === "first-paint" && shouldRecord) { + _measurements["fp"] = { value: entry.startTime, unit: "millisecond" }; + } + if (entry.name === "first-contentful-paint" && shouldRecord) { + _measurements["fcp"] = { value: entry.startTime, unit: "millisecond" }; + } + break; + } + case "resource": { + _addResourceSpans(span, entry, entry.name, startTime, duration, timeOrigin); + break; + } + } + }); + _performanceCursor = Math.max(performanceEntries.length - 1, 0); + _trackNavigator(span); + if (op === "pageload") { + _addTtfbRequestTimeToMeasurements(_measurements); + const fidMark = _measurements["mark.fid"]; + if (fidMark && _measurements["fid"]) { + startAndEndSpan(span, fidMark.value, fidMark.value + msToSec(_measurements["fid"].value), { + name: "first input delay", + op: "ui.action", + attributes: { + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.ui.browser.metrics" + } + }); + delete _measurements["mark.fid"]; + } + if (!("fcp" in _measurements) || !options4.recordClsOnPageloadSpan) { + delete _measurements.cls; + } + Object.entries(_measurements).forEach(([measurementName, measurement]) => { + setMeasurement(measurementName, measurement.value, measurement.unit); + }); + span.setAttribute("performance.timeOrigin", timeOrigin); + span.setAttribute("performance.activationStart", getActivationStart()); + _setWebVitalAttributes(span); + } + _lcpEntry = void 0; + _clsEntry = void 0; + _measurements = {}; +} +__name(addPerformanceEntries, "addPerformanceEntries"); +function _addMeasureSpans(span, entry, startTime, duration, timeOrigin) { + const navEntry = getNavigationEntry(false); + const requestTime = msToSec(navEntry ? navEntry.requestStart : 0); + const measureStartTimestamp = timeOrigin + Math.max(startTime, requestTime); + const startTimeStamp = timeOrigin + startTime; + const measureEndTimestamp = startTimeStamp + duration; + const attributes = { + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.resource.browser.metrics" + }; + if (measureStartTimestamp !== startTimeStamp) { + attributes["sentry.browser.measure_happened_before_request"] = true; + attributes["sentry.browser.measure_start_time"] = measureStartTimestamp; + } + startAndEndSpan(span, measureStartTimestamp, measureEndTimestamp, { + name: entry.name, + op: entry.entryType, + attributes + }); + return measureStartTimestamp; +} +__name(_addMeasureSpans, "_addMeasureSpans"); +function _addNavigationSpans(span, entry, timeOrigin) { + ["unloadEvent", "redirect", "domContentLoadedEvent", "loadEvent", "connect"].forEach((event) => { + _addPerformanceNavigationTiming(span, entry, event, timeOrigin); + }); + _addPerformanceNavigationTiming(span, entry, "secureConnection", timeOrigin, "TLS/SSL"); + _addPerformanceNavigationTiming(span, entry, "fetch", timeOrigin, "cache"); + _addPerformanceNavigationTiming(span, entry, "domainLookup", timeOrigin, "DNS"); + _addRequest(span, entry, timeOrigin); +} +__name(_addNavigationSpans, "_addNavigationSpans"); +function _addPerformanceNavigationTiming(span, entry, event, timeOrigin, name2 = event) { + const eventEnd = _getEndPropertyNameForNavigationTiming(event); + const end = entry[eventEnd]; + const start2 = entry[`${event}Start`]; + if (!start2 || !end) { + return; + } + startAndEndSpan(span, timeOrigin + msToSec(start2), timeOrigin + msToSec(end), { + op: `browser.${name2}`, + name: entry.name, + attributes: { + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.ui.browser.metrics" + } + }); +} +__name(_addPerformanceNavigationTiming, "_addPerformanceNavigationTiming"); +function _getEndPropertyNameForNavigationTiming(event) { + if (event === "secureConnection") { + return "connectEnd"; + } + if (event === "fetch") { + return "domainLookupStart"; + } + return `${event}End`; +} +__name(_getEndPropertyNameForNavigationTiming, "_getEndPropertyNameForNavigationTiming"); +function _addRequest(span, entry, timeOrigin) { + const requestStartTimestamp = timeOrigin + msToSec(entry.requestStart); + const responseEndTimestamp = timeOrigin + msToSec(entry.responseEnd); + const responseStartTimestamp = timeOrigin + msToSec(entry.responseStart); + if (entry.responseEnd) { + startAndEndSpan(span, requestStartTimestamp, responseEndTimestamp, { + op: "browser.request", + name: entry.name, + attributes: { + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.ui.browser.metrics" + } + }); + startAndEndSpan(span, responseStartTimestamp, responseEndTimestamp, { + op: "browser.response", + name: entry.name, + attributes: { + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.ui.browser.metrics" + } + }); + } +} +__name(_addRequest, "_addRequest"); +function _addResourceSpans(span, entry, resourceUrl, startTime, duration, timeOrigin) { + if (entry.initiatorType === "xmlhttprequest" || entry.initiatorType === "fetch") { + return; + } + const parsedUrl = parseUrl$1(resourceUrl); + const attributes = { + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.resource.browser.metrics" + }; + setResourceEntrySizeData(attributes, entry, "transferSize", "http.response_transfer_size"); + setResourceEntrySizeData(attributes, entry, "encodedBodySize", "http.response_content_length"); + setResourceEntrySizeData(attributes, entry, "decodedBodySize", "http.decoded_response_content_length"); + const deliveryType = entry.deliveryType; + if (deliveryType != null) { + attributes["http.response_delivery_type"] = deliveryType; + } + const renderBlockingStatus = entry.renderBlockingStatus; + if (renderBlockingStatus) { + attributes["resource.render_blocking_status"] = renderBlockingStatus; + } + if (parsedUrl.protocol) { + attributes["url.scheme"] = parsedUrl.protocol.split(":").pop(); + } + if (parsedUrl.host) { + attributes["server.address"] = parsedUrl.host; + } + attributes["url.same_origin"] = resourceUrl.includes(WINDOW$4.location.origin); + const startTimestamp = timeOrigin + startTime; + const endTimestamp = startTimestamp + duration; + startAndEndSpan(span, startTimestamp, endTimestamp, { + name: resourceUrl.replace(WINDOW$4.location.origin, ""), + op: entry.initiatorType ? `resource.${entry.initiatorType}` : "resource.other", + attributes + }); +} +__name(_addResourceSpans, "_addResourceSpans"); +function _trackNavigator(span) { + const navigator2 = WINDOW$4.navigator; + if (!navigator2) { + return; + } + const connection = navigator2.connection; + if (connection) { + if (connection.effectiveType) { + span.setAttribute("effectiveConnectionType", connection.effectiveType); + } + if (connection.type) { + span.setAttribute("connectionType", connection.type); + } + if (isMeasurementValue(connection.rtt)) { + _measurements["connection.rtt"] = { value: connection.rtt, unit: "millisecond" }; + } + } + if (isMeasurementValue(navigator2.deviceMemory)) { + span.setAttribute("deviceMemory", `${navigator2.deviceMemory} GB`); + } + if (isMeasurementValue(navigator2.hardwareConcurrency)) { + span.setAttribute("hardwareConcurrency", String(navigator2.hardwareConcurrency)); + } +} +__name(_trackNavigator, "_trackNavigator"); +function _setWebVitalAttributes(span) { + if (_lcpEntry) { + if (_lcpEntry.element) { + span.setAttribute("lcp.element", htmlTreeAsString(_lcpEntry.element)); + } + if (_lcpEntry.id) { + span.setAttribute("lcp.id", _lcpEntry.id); + } + if (_lcpEntry.url) { + span.setAttribute("lcp.url", _lcpEntry.url.trim().slice(0, 200)); + } + if (_lcpEntry.loadTime != null) { + span.setAttribute("lcp.loadTime", _lcpEntry.loadTime); + } + if (_lcpEntry.renderTime != null) { + span.setAttribute("lcp.renderTime", _lcpEntry.renderTime); + } + span.setAttribute("lcp.size", _lcpEntry.size); + } + if (_clsEntry && _clsEntry.sources) { + _clsEntry.sources.forEach( + (source, index2) => span.setAttribute(`cls.source.${index2 + 1}`, htmlTreeAsString(source.node)) + ); + } +} +__name(_setWebVitalAttributes, "_setWebVitalAttributes"); +function setResourceEntrySizeData(attributes, entry, key, dataKey) { + const entryVal = entry[key]; + if (entryVal != null && entryVal < MAX_INT_AS_BYTES) { + attributes[dataKey] = entryVal; + } +} +__name(setResourceEntrySizeData, "setResourceEntrySizeData"); +function _addTtfbRequestTimeToMeasurements(_measurements2) { + const navEntry = getNavigationEntry(false); + if (!navEntry) { + return; + } + const { responseStart, requestStart } = navEntry; + if (requestStart <= responseStart) { + _measurements2["ttfb.requestTime"] = { + value: responseStart - requestStart, + unit: "millisecond" + }; + } +} +__name(_addTtfbRequestTimeToMeasurements, "_addTtfbRequestTimeToMeasurements"); +const DEBOUNCE_DURATION = 1e3; +let debounceTimerID; +let lastCapturedEventType; +let lastCapturedEventTargetId; +function addClickKeypressInstrumentationHandler(handler6) { + const type = "dom"; + addHandler$1(type, handler6); + maybeInstrument(type, instrumentDOM); +} +__name(addClickKeypressInstrumentationHandler, "addClickKeypressInstrumentationHandler"); +function instrumentDOM() { + if (!WINDOW$4.document) { + return; + } + const triggerDOMHandler = triggerHandlers$1.bind(null, "dom"); + const globalDOMEventHandler = makeDOMEventHandler(triggerDOMHandler, true); + WINDOW$4.document.addEventListener("click", globalDOMEventHandler, false); + WINDOW$4.document.addEventListener("keypress", globalDOMEventHandler, false); + ["EventTarget", "Node"].forEach((target) => { + const globalObject = WINDOW$4; + const targetObj = globalObject[target]; + const proto = targetObj && targetObj.prototype; + if (!proto || !proto.hasOwnProperty || !proto.hasOwnProperty("addEventListener")) { + return; + } + fill(proto, "addEventListener", function(originalAddEventListener) { + return function(type, listener, options4) { + if (type === "click" || type == "keypress") { + try { + const handlers2 = this.__sentry_instrumentation_handlers__ = this.__sentry_instrumentation_handlers__ || {}; + const handlerForType = handlers2[type] = handlers2[type] || { refCount: 0 }; + if (!handlerForType.handler) { + const handler6 = makeDOMEventHandler(triggerDOMHandler); + handlerForType.handler = handler6; + originalAddEventListener.call(this, type, handler6, options4); + } + handlerForType.refCount++; + } catch (e2) { + } + } + return originalAddEventListener.call(this, type, listener, options4); + }; + }); + fill( + proto, + "removeEventListener", + function(originalRemoveEventListener) { + return function(type, listener, options4) { + if (type === "click" || type == "keypress") { + try { + const handlers2 = this.__sentry_instrumentation_handlers__ || {}; + const handlerForType = handlers2[type]; + if (handlerForType) { + handlerForType.refCount--; + if (handlerForType.refCount <= 0) { + originalRemoveEventListener.call(this, type, handlerForType.handler, options4); + handlerForType.handler = void 0; + delete handlers2[type]; + } + if (Object.keys(handlers2).length === 0) { + delete this.__sentry_instrumentation_handlers__; + } + } + } catch (e2) { + } + } + return originalRemoveEventListener.call(this, type, listener, options4); + }; + } + ); + }); +} +__name(instrumentDOM, "instrumentDOM"); +function isSimilarToLastCapturedEvent(event) { + if (event.type !== lastCapturedEventType) { + return false; + } + try { + if (!event.target || event.target._sentryId !== lastCapturedEventTargetId) { + return false; + } + } catch (e2) { + } + return true; +} +__name(isSimilarToLastCapturedEvent, "isSimilarToLastCapturedEvent"); +function shouldSkipDOMEvent(eventType, target) { + if (eventType !== "keypress") { + return false; + } + if (!target || !target.tagName) { + return true; + } + if (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.isContentEditable) { + return false; + } + return true; +} +__name(shouldSkipDOMEvent, "shouldSkipDOMEvent"); +function makeDOMEventHandler(handler6, globalListener = false) { + return (event) => { + if (!event || event["_sentryCaptured"]) { + return; + } + const target = getEventTarget$1(event); + if (shouldSkipDOMEvent(event.type, target)) { + return; + } + addNonEnumerableProperty(event, "_sentryCaptured", true); + if (target && !target._sentryId) { + addNonEnumerableProperty(target, "_sentryId", uuid4()); + } + const name2 = event.type === "keypress" ? "input" : event.type; + if (!isSimilarToLastCapturedEvent(event)) { + const handlerData = { event, name: name2, global: globalListener }; + handler6(handlerData); + lastCapturedEventType = event.type; + lastCapturedEventTargetId = target ? target._sentryId : void 0; + } + clearTimeout(debounceTimerID); + debounceTimerID = WINDOW$4.setTimeout(() => { + lastCapturedEventTargetId = void 0; + lastCapturedEventType = void 0; + }, DEBOUNCE_DURATION); + }; +} +__name(makeDOMEventHandler, "makeDOMEventHandler"); +function getEventTarget$1(event) { + try { + return event.target; + } catch (e2) { + return null; + } +} +__name(getEventTarget$1, "getEventTarget$1"); +let lastHref; +function addHistoryInstrumentationHandler(handler6) { + const type = "history"; + addHandler$1(type, handler6); + maybeInstrument(type, instrumentHistory); +} +__name(addHistoryInstrumentationHandler, "addHistoryInstrumentationHandler"); +function instrumentHistory() { + if (!supportsHistory()) { + return; + } + const oldOnPopState = WINDOW$4.onpopstate; + WINDOW$4.onpopstate = function(...args) { + const to = WINDOW$4.location.href; + const from2 = lastHref; + lastHref = to; + const handlerData = { from: from2, to }; + triggerHandlers$1("history", handlerData); + if (oldOnPopState) { + try { + return oldOnPopState.apply(this, args); + } catch (_oO) { + } + } + }; + function historyReplacementFunction(originalHistoryFunction) { + return function(...args) { + const url = args.length > 2 ? args[2] : void 0; + if (url) { + const from2 = lastHref; + const to = String(url); + lastHref = to; + const handlerData = { from: from2, to }; + triggerHandlers$1("history", handlerData); + } + return originalHistoryFunction.apply(this, args); + }; + } + __name(historyReplacementFunction, "historyReplacementFunction"); + fill(WINDOW$4.history, "pushState", historyReplacementFunction); + fill(WINDOW$4.history, "replaceState", historyReplacementFunction); +} +__name(instrumentHistory, "instrumentHistory"); +const cachedImplementations$3 = {}; +function getNativeImplementation(name2) { + const cached = cachedImplementations$3[name2]; + if (cached) { + return cached; + } + let impl = WINDOW$4[name2]; + if (isNativeFunction(impl)) { + return cachedImplementations$3[name2] = impl.bind(WINDOW$4); + } + const document2 = WINDOW$4.document; + if (document2 && typeof document2.createElement === "function") { + try { + const sandbox = document2.createElement("iframe"); + sandbox.hidden = true; + document2.head.appendChild(sandbox); + const contentWindow = sandbox.contentWindow; + if (contentWindow && contentWindow[name2]) { + impl = contentWindow[name2]; + } + document2.head.removeChild(sandbox); + } catch (e2) { + DEBUG_BUILD$3 && logger$2.warn(`Could not create sandbox iframe for ${name2} check, bailing to window.${name2}: `, e2); + } + } + if (!impl) { + return impl; + } + return cachedImplementations$3[name2] = impl.bind(WINDOW$4); +} +__name(getNativeImplementation, "getNativeImplementation"); +function clearCachedImplementation(name2) { + cachedImplementations$3[name2] = void 0; +} +__name(clearCachedImplementation, "clearCachedImplementation"); +function fetch$1(...rest) { + return getNativeImplementation("fetch")(...rest); +} +__name(fetch$1, "fetch$1"); +function setTimeout$3(...rest) { + return getNativeImplementation("setTimeout")(...rest); +} +__name(setTimeout$3, "setTimeout$3"); +const SENTRY_XHR_DATA_KEY = "__sentry_xhr_v3__"; +function addXhrInstrumentationHandler(handler6) { + const type = "xhr"; + addHandler$1(type, handler6); + maybeInstrument(type, instrumentXHR); +} +__name(addXhrInstrumentationHandler, "addXhrInstrumentationHandler"); +function instrumentXHR() { + if (!WINDOW$4.XMLHttpRequest) { + return; + } + const xhrproto = XMLHttpRequest.prototype; + xhrproto.open = new Proxy(xhrproto.open, { + apply(originalOpen, xhrOpenThisArg, xhrOpenArgArray) { + const virtualError = new Error(); + const startTimestamp = timestampInSeconds() * 1e3; + const method = isString$8(xhrOpenArgArray[0]) ? xhrOpenArgArray[0].toUpperCase() : void 0; + const url = parseUrl(xhrOpenArgArray[1]); + if (!method || !url) { + return originalOpen.apply(xhrOpenThisArg, xhrOpenArgArray); + } + xhrOpenThisArg[SENTRY_XHR_DATA_KEY] = { + method, + url, + request_headers: {} + }; + if (method === "POST" && url.match(/sentry_key/)) { + xhrOpenThisArg.__sentry_own_request__ = true; + } + const onreadystatechangeHandler = /* @__PURE__ */ __name(() => { + const xhrInfo = xhrOpenThisArg[SENTRY_XHR_DATA_KEY]; + if (!xhrInfo) { + return; + } + if (xhrOpenThisArg.readyState === 4) { + try { + xhrInfo.status_code = xhrOpenThisArg.status; + } catch (e2) { + } + const handlerData = { + endTimestamp: timestampInSeconds() * 1e3, + startTimestamp, + xhr: xhrOpenThisArg, + virtualError + }; + triggerHandlers$1("xhr", handlerData); + } + }, "onreadystatechangeHandler"); + if ("onreadystatechange" in xhrOpenThisArg && typeof xhrOpenThisArg.onreadystatechange === "function") { + xhrOpenThisArg.onreadystatechange = new Proxy(xhrOpenThisArg.onreadystatechange, { + apply(originalOnreadystatechange, onreadystatechangeThisArg, onreadystatechangeArgArray) { + onreadystatechangeHandler(); + return originalOnreadystatechange.apply(onreadystatechangeThisArg, onreadystatechangeArgArray); + } + }); + } else { + xhrOpenThisArg.addEventListener("readystatechange", onreadystatechangeHandler); + } + xhrOpenThisArg.setRequestHeader = new Proxy(xhrOpenThisArg.setRequestHeader, { + apply(originalSetRequestHeader, setRequestHeaderThisArg, setRequestHeaderArgArray) { + const [header3, value4] = setRequestHeaderArgArray; + const xhrInfo = setRequestHeaderThisArg[SENTRY_XHR_DATA_KEY]; + if (xhrInfo && isString$8(header3) && isString$8(value4)) { + xhrInfo.request_headers[header3.toLowerCase()] = value4; + } + return originalSetRequestHeader.apply(setRequestHeaderThisArg, setRequestHeaderArgArray); + } + }); + return originalOpen.apply(xhrOpenThisArg, xhrOpenArgArray); + } + }); + xhrproto.send = new Proxy(xhrproto.send, { + apply(originalSend, sendThisArg, sendArgArray) { + const sentryXhrData = sendThisArg[SENTRY_XHR_DATA_KEY]; + if (!sentryXhrData) { + return originalSend.apply(sendThisArg, sendArgArray); + } + if (sendArgArray[0] !== void 0) { + sentryXhrData.body = sendArgArray[0]; + } + const handlerData = { + startTimestamp: timestampInSeconds() * 1e3, + xhr: sendThisArg + }; + triggerHandlers$1("xhr", handlerData); + return originalSend.apply(sendThisArg, sendArgArray); + } + }); +} +__name(instrumentXHR, "instrumentXHR"); +function parseUrl(url) { + if (isString$8(url)) { + return url; + } + try { + return url.toString(); + } catch (e2) { + } + return void 0; +} +__name(parseUrl, "parseUrl"); +const LAST_INTERACTIONS = []; +const INTERACTIONS_SPAN_MAP = /* @__PURE__ */ new Map(); +function startTrackingINP() { + const performance2 = getBrowserPerformanceAPI(); + if (performance2 && browserPerformanceTimeOrigin) { + const inpCallback = _trackINP(); + return () => { + inpCallback(); + }; + } + return () => void 0; +} +__name(startTrackingINP, "startTrackingINP"); +const INP_ENTRY_MAP = { + click: "click", + pointerdown: "click", + pointerup: "click", + mousedown: "click", + mouseup: "click", + touchstart: "click", + touchend: "click", + mouseover: "hover", + mouseout: "hover", + mouseenter: "hover", + mouseleave: "hover", + pointerover: "hover", + pointerout: "hover", + pointerenter: "hover", + pointerleave: "hover", + dragstart: "drag", + dragend: "drag", + drag: "drag", + dragenter: "drag", + dragleave: "drag", + dragover: "drag", + drop: "drag", + keydown: "press", + keyup: "press", + keypress: "press", + input: "press" +}; +function _trackINP() { + return addInpInstrumentationHandler(({ metric }) => { + if (metric.value == void 0) { + return; + } + const entry = metric.entries.find((entry2) => entry2.duration === metric.value && INP_ENTRY_MAP[entry2.name]); + if (!entry) { + return; + } + const { interactionId } = entry; + const interactionType = INP_ENTRY_MAP[entry.name]; + const startTime = msToSec(browserPerformanceTimeOrigin + entry.startTime); + const duration = msToSec(metric.value); + const activeSpan = getActiveSpan(); + const rootSpan = activeSpan ? getRootSpan(activeSpan) : void 0; + const cachedSpan = interactionId != null ? INTERACTIONS_SPAN_MAP.get(interactionId) : void 0; + const spanToUse = cachedSpan || rootSpan; + const routeName = spanToUse ? spanToJSON(spanToUse).description : getCurrentScope$1().getScopeData().transactionName; + const name2 = htmlTreeAsString(entry.target); + const attributes = dropUndefinedKeys({ + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.http.browser.inp", + [SEMANTIC_ATTRIBUTE_SENTRY_OP]: `ui.interaction.${interactionType}`, + [SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME]: entry.duration + }); + const span = startStandaloneWebVitalSpan({ + name: name2, + transaction: routeName, + attributes, + startTime + }); + if (span) { + span.addEvent("inp", { + [SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT]: "millisecond", + [SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE]: metric.value + }); + span.end(startTime + duration); + } + }); +} +__name(_trackINP, "_trackINP"); +function registerInpInteractionListener(_latestRoute) { + const handleEntries = /* @__PURE__ */ __name(({ entries }) => { + const activeSpan = getActiveSpan(); + const activeRootSpan = activeSpan && getRootSpan(activeSpan); + entries.forEach((entry) => { + if (!isPerformanceEventTiming(entry) || !activeRootSpan) { + return; + } + const interactionId = entry.interactionId; + if (interactionId == null) { + return; + } + if (INTERACTIONS_SPAN_MAP.has(interactionId)) { + return; + } + if (LAST_INTERACTIONS.length > 10) { + const last = LAST_INTERACTIONS.shift(); + INTERACTIONS_SPAN_MAP.delete(last); + } + LAST_INTERACTIONS.push(interactionId); + INTERACTIONS_SPAN_MAP.set(interactionId, activeRootSpan); + }); + }, "handleEntries"); + addPerformanceInstrumentationHandler("event", handleEntries); + addPerformanceInstrumentationHandler("first-input", handleEntries); +} +__name(registerInpInteractionListener, "registerInpInteractionListener"); +function makeFetchTransport(options4, nativeFetch = getNativeImplementation("fetch")) { + let pendingBodySize = 0; + let pendingCount = 0; + function makeRequest(request) { + const requestSize = request.body.length; + pendingBodySize += requestSize; + pendingCount++; + const requestOptions = { + body: request.body, + method: "POST", + referrerPolicy: "origin", + headers: options4.headers, + // Outgoing requests are usually cancelled when navigating to a different page, causing a "TypeError: Failed to + // fetch" error and sending a "network_error" client-outcome - in Chrome, the request status shows "(cancelled)". + // The `keepalive` flag keeps outgoing requests alive, even when switching pages. We want this since we're + // frequently sending events right before the user is switching pages (eg. when finishing navigation transactions). + // Gotchas: + // - `keepalive` isn't supported by Firefox + // - As per spec (https://fetch.spec.whatwg.org/#http-network-or-cache-fetch): + // If the sum of contentLength and inflightKeepaliveBytes is greater than 64 kibibytes, then return a network error. + // We will therefore only activate the flag when we're below that limit. + // There is also a limit of requests that can be open at the same time, so we also limit this to 15 + // See https://github.com/getsentry/sentry-javascript/pull/7553 for details + keepalive: pendingBodySize <= 6e4 && pendingCount < 15, + ...options4.fetchOptions + }; + if (!nativeFetch) { + clearCachedImplementation("fetch"); + return rejectedSyncPromise("No fetch implementation available"); + } + try { + return nativeFetch(options4.url, requestOptions).then((response) => { + pendingBodySize -= requestSize; + pendingCount--; + return { + statusCode: response.status, + headers: { + "x-sentry-rate-limits": response.headers.get("X-Sentry-Rate-Limits"), + "retry-after": response.headers.get("Retry-After") + } + }; + }); + } catch (e2) { + clearCachedImplementation("fetch"); + pendingBodySize -= requestSize; + pendingCount--; + return rejectedSyncPromise(e2); + } + } + __name(makeRequest, "makeRequest"); + return createTransport(options4, makeRequest); +} +__name(makeFetchTransport, "makeFetchTransport"); +const OPERA10_PRIORITY = 10; +const OPERA11_PRIORITY = 20; +const CHROME_PRIORITY = 30; +const WINJS_PRIORITY = 40; +const GECKO_PRIORITY = 50; +function createFrame(filename, func, lineno, colno) { + const frame = { + filename, + function: func === "<anonymous>" ? UNKNOWN_FUNCTION : func, + in_app: true + // All browser frames are considered in_app + }; + if (lineno !== void 0) { + frame.lineno = lineno; + } + if (colno !== void 0) { + frame.colno = colno; + } + return frame; +} +__name(createFrame, "createFrame"); +const chromeRegexNoFnName = /^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i; +const chromeRegex = /^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i; +const chromeEvalRegex = /\((\S*)(?::(\d+))(?::(\d+))\)/; +const chromeStackParserFn = /* @__PURE__ */ __name((line) => { + const noFnParts = chromeRegexNoFnName.exec(line); + if (noFnParts) { + const [, filename, line2, col] = noFnParts; + return createFrame(filename, UNKNOWN_FUNCTION, +line2, +col); + } + const parts2 = chromeRegex.exec(line); + if (parts2) { + const isEval = parts2[2] && parts2[2].indexOf("eval") === 0; + if (isEval) { + const subMatch = chromeEvalRegex.exec(parts2[2]); + if (subMatch) { + parts2[2] = subMatch[1]; + parts2[3] = subMatch[2]; + parts2[4] = subMatch[3]; + } + } + const [func, filename] = extractSafariExtensionDetails(parts2[1] || UNKNOWN_FUNCTION, parts2[2]); + return createFrame(filename, func, parts2[3] ? +parts2[3] : void 0, parts2[4] ? +parts2[4] : void 0); + } + return; +}, "chromeStackParserFn"); +const chromeStackLineParser = [CHROME_PRIORITY, chromeStackParserFn]; +const geckoREgex = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i; +const geckoEvalRegex = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i; +const gecko$1 = /* @__PURE__ */ __name((line) => { + const parts2 = geckoREgex.exec(line); + if (parts2) { + const isEval = parts2[3] && parts2[3].indexOf(" > eval") > -1; + if (isEval) { + const subMatch = geckoEvalRegex.exec(parts2[3]); + if (subMatch) { + parts2[1] = parts2[1] || "eval"; + parts2[3] = subMatch[1]; + parts2[4] = subMatch[2]; + parts2[5] = ""; + } + } + let filename = parts2[3]; + let func = parts2[1] || UNKNOWN_FUNCTION; + [func, filename] = extractSafariExtensionDetails(func, filename); + return createFrame(filename, func, parts2[4] ? +parts2[4] : void 0, parts2[5] ? +parts2[5] : void 0); + } + return; +}, "gecko$1"); +const geckoStackLineParser = [GECKO_PRIORITY, gecko$1]; +const winjsRegex = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i; +const winjs = /* @__PURE__ */ __name((line) => { + const parts2 = winjsRegex.exec(line); + return parts2 ? createFrame(parts2[2], parts2[1] || UNKNOWN_FUNCTION, +parts2[3], parts2[4] ? +parts2[4] : void 0) : void 0; +}, "winjs"); +const winjsStackLineParser = [WINJS_PRIORITY, winjs]; +const opera10Regex = / line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i; +const opera10 = /* @__PURE__ */ __name((line) => { + const parts2 = opera10Regex.exec(line); + return parts2 ? createFrame(parts2[2], parts2[3] || UNKNOWN_FUNCTION, +parts2[1]) : void 0; +}, "opera10"); +const opera10StackLineParser = [OPERA10_PRIORITY, opera10]; +const opera11Regex = / line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\(.*\))? in (.*):\s*$/i; +const opera11 = /* @__PURE__ */ __name((line) => { + const parts2 = opera11Regex.exec(line); + return parts2 ? createFrame(parts2[5], parts2[3] || parts2[4] || UNKNOWN_FUNCTION, +parts2[1], +parts2[2]) : void 0; +}, "opera11"); +const opera11StackLineParser = [OPERA11_PRIORITY, opera11]; +const defaultStackLineParsers = [chromeStackLineParser, geckoStackLineParser]; +const defaultStackParser = createStackParser(...defaultStackLineParsers); +const extractSafariExtensionDetails = /* @__PURE__ */ __name((func, filename) => { + const isSafariExtension = func.indexOf("safari-extension") !== -1; + const isSafariWebExtension = func.indexOf("safari-web-extension") !== -1; + return isSafariExtension || isSafariWebExtension ? [ + func.indexOf("@") !== -1 ? func.split("@")[0] : UNKNOWN_FUNCTION, + isSafariExtension ? `safari-extension:${filename}` : `safari-web-extension:${filename}` + ] : [func, filename]; +}, "extractSafariExtensionDetails"); +const MAX_ALLOWED_STRING_LENGTH = 1024; +const INTEGRATION_NAME$a = "Breadcrumbs"; +const _breadcrumbsIntegration = /* @__PURE__ */ __name((options4 = {}) => { + const _options = { + console: true, + dom: true, + fetch: true, + history: true, + sentry: true, + xhr: true, + ...options4 + }; + return { + name: INTEGRATION_NAME$a, + setup(client) { + if (_options.console) { + addConsoleInstrumentationHandler(_getConsoleBreadcrumbHandler(client)); + } + if (_options.dom) { + addClickKeypressInstrumentationHandler(_getDomBreadcrumbHandler(client, _options.dom)); + } + if (_options.xhr) { + addXhrInstrumentationHandler(_getXhrBreadcrumbHandler(client)); + } + if (_options.fetch) { + addFetchInstrumentationHandler(_getFetchBreadcrumbHandler(client)); + } + if (_options.history) { + addHistoryInstrumentationHandler(_getHistoryBreadcrumbHandler(client)); + } + if (_options.sentry) { + client.on("beforeSendEvent", _getSentryBreadcrumbHandler(client)); + } + } + }; +}, "_breadcrumbsIntegration"); +const breadcrumbsIntegration = defineIntegration(_breadcrumbsIntegration); +function _getSentryBreadcrumbHandler(client) { + return /* @__PURE__ */ __name(function addSentryBreadcrumb(event) { + if (getClient() !== client) { + return; + } + addBreadcrumb( + { + category: `sentry.${event.type === "transaction" ? "transaction" : "event"}`, + event_id: event.event_id, + level: event.level, + message: getEventDescription(event) + }, + { + event + } + ); + }, "addSentryBreadcrumb"); +} +__name(_getSentryBreadcrumbHandler, "_getSentryBreadcrumbHandler"); +function _getDomBreadcrumbHandler(client, dom) { + return /* @__PURE__ */ __name(function _innerDomBreadcrumb(handlerData) { + if (getClient() !== client) { + return; + } + let target; + let componentName; + let keyAttrs = typeof dom === "object" ? dom.serializeAttribute : void 0; + let maxStringLength = typeof dom === "object" && typeof dom.maxStringLength === "number" ? dom.maxStringLength : void 0; + if (maxStringLength && maxStringLength > MAX_ALLOWED_STRING_LENGTH) { + DEBUG_BUILD$4 && logger$2.warn( + `\`dom.maxStringLength\` cannot exceed ${MAX_ALLOWED_STRING_LENGTH}, but a value of ${maxStringLength} was configured. Sentry will use ${MAX_ALLOWED_STRING_LENGTH} instead.` + ); + maxStringLength = MAX_ALLOWED_STRING_LENGTH; + } + if (typeof keyAttrs === "string") { + keyAttrs = [keyAttrs]; + } + try { + const event = handlerData.event; + const element = _isEvent(event) ? event.target : event; + target = htmlTreeAsString(element, { keyAttrs, maxStringLength }); + componentName = getComponentName$1(element); + } catch (e2) { + target = "<unknown>"; + } + if (target.length === 0) { + return; + } + const breadcrumb = { + category: `ui.${handlerData.name}`, + message: target + }; + if (componentName) { + breadcrumb.data = { "ui.component_name": componentName }; + } + addBreadcrumb(breadcrumb, { + event: handlerData.event, + name: handlerData.name, + global: handlerData.global + }); + }, "_innerDomBreadcrumb"); +} +__name(_getDomBreadcrumbHandler, "_getDomBreadcrumbHandler"); +function _getConsoleBreadcrumbHandler(client) { + return /* @__PURE__ */ __name(function _consoleBreadcrumb(handlerData) { + if (getClient() !== client) { + return; + } + const breadcrumb = { + category: "console", + data: { + arguments: handlerData.args, + logger: "console" + }, + level: severityLevelFromString(handlerData.level), + message: safeJoin(handlerData.args, " ") + }; + if (handlerData.level === "assert") { + if (handlerData.args[0] === false) { + breadcrumb.message = `Assertion failed: ${safeJoin(handlerData.args.slice(1), " ") || "console.assert"}`; + breadcrumb.data.arguments = handlerData.args.slice(1); + } else { + return; + } + } + addBreadcrumb(breadcrumb, { + input: handlerData.args, + level: handlerData.level + }); + }, "_consoleBreadcrumb"); +} +__name(_getConsoleBreadcrumbHandler, "_getConsoleBreadcrumbHandler"); +function _getXhrBreadcrumbHandler(client) { + return /* @__PURE__ */ __name(function _xhrBreadcrumb(handlerData) { + if (getClient() !== client) { + return; + } + const { startTimestamp, endTimestamp } = handlerData; + const sentryXhrData = handlerData.xhr[SENTRY_XHR_DATA_KEY]; + if (!startTimestamp || !endTimestamp || !sentryXhrData) { + return; + } + const { method, url, status_code, body } = sentryXhrData; + const data25 = { + method, + url, + status_code + }; + const hint = { + xhr: handlerData.xhr, + input: body, + startTimestamp, + endTimestamp + }; + const level = getBreadcrumbLogLevelFromHttpStatusCode(status_code); + addBreadcrumb( + { + category: "xhr", + data: data25, + type: "http", + level + }, + hint + ); + }, "_xhrBreadcrumb"); +} +__name(_getXhrBreadcrumbHandler, "_getXhrBreadcrumbHandler"); +function _getFetchBreadcrumbHandler(client) { + return /* @__PURE__ */ __name(function _fetchBreadcrumb(handlerData) { + if (getClient() !== client) { + return; + } + const { startTimestamp, endTimestamp } = handlerData; + if (!endTimestamp) { + return; + } + if (handlerData.fetchData.url.match(/sentry_key/) && handlerData.fetchData.method === "POST") { + return; + } + if (handlerData.error) { + const data25 = handlerData.fetchData; + const hint = { + data: handlerData.error, + input: handlerData.args, + startTimestamp, + endTimestamp + }; + addBreadcrumb( + { + category: "fetch", + data: data25, + level: "error", + type: "http" + }, + hint + ); + } else { + const response = handlerData.response; + const data25 = { + ...handlerData.fetchData, + status_code: response && response.status + }; + const hint = { + input: handlerData.args, + response, + startTimestamp, + endTimestamp + }; + const level = getBreadcrumbLogLevelFromHttpStatusCode(data25.status_code); + addBreadcrumb( + { + category: "fetch", + data: data25, + type: "http", + level + }, + hint + ); + } + }, "_fetchBreadcrumb"); +} +__name(_getFetchBreadcrumbHandler, "_getFetchBreadcrumbHandler"); +function _getHistoryBreadcrumbHandler(client) { + return /* @__PURE__ */ __name(function _historyBreadcrumb(handlerData) { + if (getClient() !== client) { + return; + } + let from2 = handlerData.from; + let to = handlerData.to; + const parsedLoc = parseUrl$1(WINDOW$5.location.href); + let parsedFrom = from2 ? parseUrl$1(from2) : void 0; + const parsedTo = parseUrl$1(to); + if (!parsedFrom || !parsedFrom.path) { + parsedFrom = parsedLoc; + } + if (parsedLoc.protocol === parsedTo.protocol && parsedLoc.host === parsedTo.host) { + to = parsedTo.relative; + } + if (parsedLoc.protocol === parsedFrom.protocol && parsedLoc.host === parsedFrom.host) { + from2 = parsedFrom.relative; + } + addBreadcrumb({ + category: "navigation", + data: { + from: from2, + to + } + }); + }, "_historyBreadcrumb"); +} +__name(_getHistoryBreadcrumbHandler, "_getHistoryBreadcrumbHandler"); +function _isEvent(event) { + return !!event && !!event.target; +} +__name(_isEvent, "_isEvent"); +const DEFAULT_EVENT_TARGET = [ + "EventTarget", + "Window", + "Node", + "ApplicationCache", + "AudioTrackList", + "BroadcastChannel", + "ChannelMergerNode", + "CryptoOperation", + "EventSource", + "FileReader", + "HTMLUnknownElement", + "IDBDatabase", + "IDBRequest", + "IDBTransaction", + "KeyOperation", + "MediaController", + "MessagePort", + "ModalWindow", + "Notification", + "SVGElementInstance", + "Screen", + "SharedWorker", + "TextTrack", + "TextTrackCue", + "TextTrackList", + "WebSocket", + "WebSocketWorker", + "Worker", + "XMLHttpRequest", + "XMLHttpRequestEventTarget", + "XMLHttpRequestUpload" +]; +const INTEGRATION_NAME$9 = "BrowserApiErrors"; +const _browserApiErrorsIntegration = /* @__PURE__ */ __name((options4 = {}) => { + const _options = { + XMLHttpRequest: true, + eventTarget: true, + requestAnimationFrame: true, + setInterval: true, + setTimeout: true, + ...options4 + }; + return { + name: INTEGRATION_NAME$9, + // TODO: This currently only works for the first client this is setup + // We may want to adjust this to check for client etc. + setupOnce() { + if (_options.setTimeout) { + fill(WINDOW$5, "setTimeout", _wrapTimeFunction); + } + if (_options.setInterval) { + fill(WINDOW$5, "setInterval", _wrapTimeFunction); + } + if (_options.requestAnimationFrame) { + fill(WINDOW$5, "requestAnimationFrame", _wrapRAF); + } + if (_options.XMLHttpRequest && "XMLHttpRequest" in WINDOW$5) { + fill(XMLHttpRequest.prototype, "send", _wrapXHR$1); + } + const eventTargetOption = _options.eventTarget; + if (eventTargetOption) { + const eventTarget = Array.isArray(eventTargetOption) ? eventTargetOption : DEFAULT_EVENT_TARGET; + eventTarget.forEach(_wrapEventTarget); + } + } + }; +}, "_browserApiErrorsIntegration"); +const browserApiErrorsIntegration = defineIntegration(_browserApiErrorsIntegration); +function _wrapTimeFunction(original) { + return function(...args) { + const originalCallback = args[0]; + args[0] = wrap$1(originalCallback, { + mechanism: { + data: { function: getFunctionName(original) }, + handled: false, + type: "instrument" + } + }); + return original.apply(this, args); + }; +} +__name(_wrapTimeFunction, "_wrapTimeFunction"); +function _wrapRAF(original) { + return function(callback) { + return original.apply(this, [ + wrap$1(callback, { + mechanism: { + data: { + function: "requestAnimationFrame", + handler: getFunctionName(original) + }, + handled: false, + type: "instrument" + } + }) + ]); + }; +} +__name(_wrapRAF, "_wrapRAF"); +function _wrapXHR$1(originalSend) { + return function(...args) { + const xhr = this; + const xmlHttpRequestProps = ["onload", "onerror", "onprogress", "onreadystatechange"]; + xmlHttpRequestProps.forEach((prop2) => { + if (prop2 in xhr && typeof xhr[prop2] === "function") { + fill(xhr, prop2, function(original) { + const wrapOptions = { + mechanism: { + data: { + function: prop2, + handler: getFunctionName(original) + }, + handled: false, + type: "instrument" + } + }; + const originalFunction = getOriginalFunction(original); + if (originalFunction) { + wrapOptions.mechanism.data.handler = getFunctionName(originalFunction); + } + return wrap$1(original, wrapOptions); + }); + } + }); + return originalSend.apply(this, args); + }; +} +__name(_wrapXHR$1, "_wrapXHR$1"); +function _wrapEventTarget(target) { + const globalObject = WINDOW$5; + const targetObj = globalObject[target]; + const proto = targetObj && targetObj.prototype; + if (!proto || !proto.hasOwnProperty || !proto.hasOwnProperty("addEventListener")) { + return; + } + fill(proto, "addEventListener", function(original) { + return function(eventName, fn, options4) { + try { + if (isEventListenerObject(fn)) { + fn.handleEvent = wrap$1(fn.handleEvent, { + mechanism: { + data: { + function: "handleEvent", + handler: getFunctionName(fn), + target + }, + handled: false, + type: "instrument" + } + }); + } + } catch (e2) { + } + return original.apply(this, [ + eventName, + wrap$1(fn, { + mechanism: { + data: { + function: "addEventListener", + handler: getFunctionName(fn), + target + }, + handled: false, + type: "instrument" + } + }), + options4 + ]); + }; + }); + fill(proto, "removeEventListener", function(originalRemoveEventListener) { + return function(eventName, fn, options4) { + try { + const originalEventHandler = fn.__sentry_wrapped__; + if (originalEventHandler) { + originalRemoveEventListener.call(this, eventName, originalEventHandler, options4); + } + } catch (e2) { + } + return originalRemoveEventListener.call(this, eventName, fn, options4); + }; + }); +} +__name(_wrapEventTarget, "_wrapEventTarget"); +function isEventListenerObject(obj) { + return typeof obj.handleEvent === "function"; +} +__name(isEventListenerObject, "isEventListenerObject"); +const browserSessionIntegration = defineIntegration(() => { + return { + name: "BrowserSession", + setupOnce() { + if (typeof WINDOW$5.document === "undefined") { + DEBUG_BUILD$4 && logger$2.warn("Using the `browserSessionIntegration` in non-browser environments is not supported."); + return; + } + startSession({ ignoreDuration: true }); + captureSession(); + addHistoryInstrumentationHandler(({ from: from2, to }) => { + if (from2 !== void 0 && from2 !== to) { + startSession({ ignoreDuration: true }); + captureSession(); + } + }); + } + }; +}); +const INTEGRATION_NAME$8 = "GlobalHandlers"; +const _globalHandlersIntegration = /* @__PURE__ */ __name((options4 = {}) => { + const _options = { + onerror: true, + onunhandledrejection: true, + ...options4 + }; + return { + name: INTEGRATION_NAME$8, + setupOnce() { + Error.stackTraceLimit = 50; + }, + setup(client) { + if (_options.onerror) { + _installGlobalOnErrorHandler(client); + globalHandlerLog("onerror"); + } + if (_options.onunhandledrejection) { + _installGlobalOnUnhandledRejectionHandler(client); + globalHandlerLog("onunhandledrejection"); + } + } + }; +}, "_globalHandlersIntegration"); +const globalHandlersIntegration = defineIntegration(_globalHandlersIntegration); +function _installGlobalOnErrorHandler(client) { + addGlobalErrorInstrumentationHandler((data25) => { + const { stackParser, attachStacktrace } = getOptions(); + if (getClient() !== client || shouldIgnoreOnError()) { + return; + } + const { msg, url, line, column, error: error2 } = data25; + const event = _enhanceEventWithInitialFrame( + eventFromUnknownInput(stackParser, error2 || msg, void 0, attachStacktrace, false), + url, + line, + column + ); + event.level = "error"; + captureEvent(event, { + originalException: error2, + mechanism: { + handled: false, + type: "onerror" + } + }); + }); +} +__name(_installGlobalOnErrorHandler, "_installGlobalOnErrorHandler"); +function _installGlobalOnUnhandledRejectionHandler(client) { + addGlobalUnhandledRejectionInstrumentationHandler((e2) => { + const { stackParser, attachStacktrace } = getOptions(); + if (getClient() !== client || shouldIgnoreOnError()) { + return; + } + const error2 = _getUnhandledRejectionError(e2); + const event = isPrimitive(error2) ? _eventFromRejectionWithPrimitive(error2) : eventFromUnknownInput(stackParser, error2, void 0, attachStacktrace, true); + event.level = "error"; + captureEvent(event, { + originalException: error2, + mechanism: { + handled: false, + type: "onunhandledrejection" + } + }); + }); +} +__name(_installGlobalOnUnhandledRejectionHandler, "_installGlobalOnUnhandledRejectionHandler"); +function _getUnhandledRejectionError(error2) { + if (isPrimitive(error2)) { + return error2; + } + try { + if ("reason" in error2) { + return error2.reason; + } + if ("detail" in error2 && "reason" in error2.detail) { + return error2.detail.reason; + } + } catch (e2) { + } + return error2; +} +__name(_getUnhandledRejectionError, "_getUnhandledRejectionError"); +function _eventFromRejectionWithPrimitive(reason) { + return { + exception: { + values: [ + { + type: "UnhandledRejection", + // String() is needed because the Primitive type includes symbols (which can't be automatically stringified) + value: `Non-Error promise rejection captured with value: ${String(reason)}` + } + ] + } + }; +} +__name(_eventFromRejectionWithPrimitive, "_eventFromRejectionWithPrimitive"); +function _enhanceEventWithInitialFrame(event, url, line, column) { + const e2 = event.exception = event.exception || {}; + const ev = e2.values = e2.values || []; + const ev0 = ev[0] = ev[0] || {}; + const ev0s = ev0.stacktrace = ev0.stacktrace || {}; + const ev0sf = ev0s.frames = ev0s.frames || []; + const colno = column; + const lineno = line; + const filename = isString$8(url) && url.length > 0 ? url : getLocationHref(); + if (ev0sf.length === 0) { + ev0sf.push({ + colno, + filename, + function: UNKNOWN_FUNCTION, + in_app: true, + lineno + }); + } + return event; +} +__name(_enhanceEventWithInitialFrame, "_enhanceEventWithInitialFrame"); +function globalHandlerLog(type) { + DEBUG_BUILD$4 && logger$2.log(`Global Handler attached: ${type}`); +} +__name(globalHandlerLog, "globalHandlerLog"); +function getOptions() { + const client = getClient(); + const options4 = client && client.getOptions() || { + stackParser: /* @__PURE__ */ __name(() => [], "stackParser"), + attachStacktrace: false + }; + return options4; +} +__name(getOptions, "getOptions"); +const httpContextIntegration = defineIntegration(() => { + return { + name: "HttpContext", + preprocessEvent(event) { + if (!WINDOW$5.navigator && !WINDOW$5.location && !WINDOW$5.document) { + return; + } + const url = event.request && event.request.url || WINDOW$5.location && WINDOW$5.location.href; + const { referrer } = WINDOW$5.document || {}; + const { userAgent } = WINDOW$5.navigator || {}; + const headers = { + ...event.request && event.request.headers, + ...referrer && { Referer: referrer }, + ...userAgent && { "User-Agent": userAgent } + }; + const request = { ...event.request, ...url && { url }, headers }; + event.request = request; + } + }; +}); +const DEFAULT_KEY = "cause"; +const DEFAULT_LIMIT = 5; +const INTEGRATION_NAME$7 = "LinkedErrors"; +const _linkedErrorsIntegration = /* @__PURE__ */ __name((options4 = {}) => { + const limit = options4.limit || DEFAULT_LIMIT; + const key = options4.key || DEFAULT_KEY; + return { + name: INTEGRATION_NAME$7, + preprocessEvent(event, hint, client) { + const options5 = client.getOptions(); + applyAggregateErrorsToEvent( + // This differs from the LinkedErrors integration in core by using a different exceptionFromError function + exceptionFromError, + options5.stackParser, + options5.maxValueLength, + key, + limit, + event, + hint + ); + } + }; +}, "_linkedErrorsIntegration"); +const linkedErrorsIntegration = defineIntegration(_linkedErrorsIntegration); +function getDefaultIntegrations(options4) { + const integrations = [ + inboundFiltersIntegration(), + functionToStringIntegration(), + browserApiErrorsIntegration(), + breadcrumbsIntegration(), + globalHandlersIntegration(), + linkedErrorsIntegration(), + dedupeIntegration(), + httpContextIntegration() + ]; + if (options4.autoSessionTracking !== false) { + integrations.push(browserSessionIntegration()); + } + return integrations; +} +__name(getDefaultIntegrations, "getDefaultIntegrations"); +function applyDefaultOptions(optionsArg = {}) { + const defaultOptions2 = { + defaultIntegrations: getDefaultIntegrations(optionsArg), + release: typeof __SENTRY_RELEASE__ === "string" ? __SENTRY_RELEASE__ : WINDOW$5.SENTRY_RELEASE && WINDOW$5.SENTRY_RELEASE.id ? WINDOW$5.SENTRY_RELEASE.id : void 0, + autoSessionTracking: true, + sendClientReports: true + }; + if (optionsArg.defaultIntegrations == null) { + delete optionsArg.defaultIntegrations; + } + return { ...defaultOptions2, ...optionsArg }; +} +__name(applyDefaultOptions, "applyDefaultOptions"); +function shouldShowBrowserExtensionError() { + const windowWithMaybeExtension = typeof WINDOW$5.window !== "undefined" && WINDOW$5; + if (!windowWithMaybeExtension) { + return false; + } + const extensionKey = windowWithMaybeExtension.chrome ? "chrome" : "browser"; + const extensionObject = windowWithMaybeExtension[extensionKey]; + const runtimeId = extensionObject && extensionObject.runtime && extensionObject.runtime.id; + const href = WINDOW$5.location && WINDOW$5.location.href || ""; + const extensionProtocols = ["chrome-extension:", "moz-extension:", "ms-browser-extension:", "safari-web-extension:"]; + const isDedicatedExtensionPage = !!runtimeId && WINDOW$5 === WINDOW$5.top && extensionProtocols.some((protocol) => href.startsWith(`${protocol}//`)); + const isNWjs = typeof windowWithMaybeExtension.nw !== "undefined"; + return !!runtimeId && !isDedicatedExtensionPage && !isNWjs; +} +__name(shouldShowBrowserExtensionError, "shouldShowBrowserExtensionError"); +function init$4(browserOptions = {}) { + const options4 = applyDefaultOptions(browserOptions); + if (!options4.skipBrowserExtensionCheck && shouldShowBrowserExtensionError()) { + consoleSandbox(() => { + console.error( + "[Sentry] You cannot run Sentry this way in a browser extension, check: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/" + ); + }); + return; + } + if (DEBUG_BUILD$4) { + if (!supportsFetch()) { + logger$2.warn( + "No Fetch API detected. The Sentry SDK requires a Fetch API compatible environment to send events. Please add a Fetch API polyfill." + ); + } + } + const clientOptions = { + ...options4, + stackParser: stackParserFromStackParserOptions(options4.stackParser || defaultStackParser), + integrations: getIntegrationsToSetup(options4), + transport: options4.transport || makeFetchTransport + }; + return initAndBind(BrowserClient, clientOptions); +} +__name(init$4, "init$4"); +function showReportDialog(options4 = {}) { + if (!WINDOW$5.document) { + DEBUG_BUILD$4 && logger$2.error("Global document not defined in showReportDialog call"); + return; + } + const scope = getCurrentScope$1(); + const client = scope.getClient(); + const dsn = client && client.getDsn(); + if (!dsn) { + DEBUG_BUILD$4 && logger$2.error("DSN not configured for showReportDialog call"); + return; + } + if (scope) { + options4.user = { + ...scope.getUser(), + ...options4.user + }; + } + if (!options4.eventId) { + const eventId = lastEventId(); + if (eventId) { + options4.eventId = eventId; + } + } + const script2 = WINDOW$5.document.createElement("script"); + script2.async = true; + script2.crossOrigin = "anonymous"; + script2.src = getReportDialogEndpoint(dsn, options4); + if (options4.onLoad) { + script2.onload = options4.onLoad; + } + const { onClose } = options4; + if (onClose) { + const reportDialogClosedMessageHandler = /* @__PURE__ */ __name((event) => { + if (event.data === "__sentry_reportdialog_closed__") { + try { + onClose(); + } finally { + WINDOW$5.removeEventListener("message", reportDialogClosedMessageHandler); + } + } + }, "reportDialogClosedMessageHandler"); + WINDOW$5.addEventListener("message", reportDialogClosedMessageHandler); + } + const injectionPoint = WINDOW$5.document.head || WINDOW$5.document.body; + if (injectionPoint) { + injectionPoint.appendChild(script2); + } else { + DEBUG_BUILD$4 && logger$2.error("Not injecting report dialog. No injection point found in HTML"); + } +} +__name(showReportDialog, "showReportDialog"); +function forceLoad() { +} +__name(forceLoad, "forceLoad"); +function onLoad(callback) { + callback(); +} +__name(onLoad, "onLoad"); +function captureUserFeedback(feedback) { + const client = getClient(); + if (client) { + client.captureUserFeedback(feedback); + } +} +__name(captureUserFeedback, "captureUserFeedback"); +const LazyLoadableIntegrations = { + replayIntegration: "replay", + replayCanvasIntegration: "replay-canvas", + feedbackIntegration: "feedback", + feedbackModalIntegration: "feedback-modal", + feedbackScreenshotIntegration: "feedback-screenshot", + captureConsoleIntegration: "captureconsole", + contextLinesIntegration: "contextlines", + linkedErrorsIntegration: "linkederrors", + debugIntegration: "debug", + dedupeIntegration: "dedupe", + extraErrorDataIntegration: "extraerrordata", + httpClientIntegration: "httpclient", + reportingObserverIntegration: "reportingobserver", + rewriteFramesIntegration: "rewriteframes", + sessionTimingIntegration: "sessiontiming", + browserProfilingIntegration: "browserprofiling", + moduleMetadataIntegration: "modulemetadata" +}; +const WindowWithMaybeIntegration = WINDOW$5; +async function lazyLoadIntegration(name2, scriptNonce) { + const bundle = LazyLoadableIntegrations[name2]; + const sentryOnWindow = WindowWithMaybeIntegration.Sentry = WindowWithMaybeIntegration.Sentry || {}; + if (!bundle) { + throw new Error(`Cannot lazy load integration: ${name2}`); + } + const existing = sentryOnWindow[name2]; + if (typeof existing === "function" && !("_isShim" in existing)) { + return existing; + } + const url = getScriptURL(bundle); + const script2 = WINDOW$5.document.createElement("script"); + script2.src = url; + script2.crossOrigin = "anonymous"; + script2.referrerPolicy = "origin"; + if (scriptNonce) { + script2.setAttribute("nonce", scriptNonce); + } + const waitForLoad = new Promise((resolve2, reject3) => { + script2.addEventListener("load", () => resolve2()); + script2.addEventListener("error", reject3); + }); + const currentScript = WINDOW$5.document.currentScript; + const parent = WINDOW$5.document.body || WINDOW$5.document.head || currentScript && currentScript.parentElement; + if (parent) { + parent.appendChild(script2); + } else { + throw new Error(`Could not find parent element to insert lazy-loaded ${name2} script`); + } + try { + await waitForLoad; + } catch (e2) { + throw new Error(`Error when loading integration: ${name2}`); + } + const integrationFn = sentryOnWindow[name2]; + if (typeof integrationFn !== "function") { + throw new Error(`Could not load integration: ${name2}`); + } + return integrationFn; +} +__name(lazyLoadIntegration, "lazyLoadIntegration"); +function getScriptURL(bundle) { + const client = getClient(); + const options4 = client && client.getOptions(); + const baseURL = options4 && options4.cdnBaseUrl || "https://browser.sentry-cdn.com"; + return new URL(`/${SDK_VERSION}/${bundle}.min.js`, baseURL).toString(); +} +__name(getScriptURL, "getScriptURL"); +const WINDOW$3 = GLOBAL_OBJ; +const INTEGRATION_NAME$6 = "ReportingObserver"; +const SETUP_CLIENTS = /* @__PURE__ */ new WeakMap(); +const _reportingObserverIntegration = /* @__PURE__ */ __name((options4 = {}) => { + const types = options4.types || ["crash", "deprecation", "intervention"]; + function handler6(reports) { + if (!SETUP_CLIENTS.has(getClient())) { + return; + } + for (const report of reports) { + withScope((scope) => { + scope.setExtra("url", report.url); + const label5 = `ReportingObserver [${report.type}]`; + let details = "No details available"; + if (report.body) { + const plainBody = {}; + for (const prop2 in report.body) { + plainBody[prop2] = report.body[prop2]; + } + scope.setExtra("body", plainBody); + if (report.type === "crash") { + const body = report.body; + details = [body.crashId || "", body.reason || ""].join(" ").trim() || details; + } else { + const body = report.body; + details = body.message || details; + } + } + captureMessage(`${label5}: ${details}`); + }); + } + } + __name(handler6, "handler"); + return { + name: INTEGRATION_NAME$6, + setupOnce() { + if (!supportsReportingObserver()) { + return; + } + const observer = new WINDOW$3.ReportingObserver( + handler6, + { + buffered: true, + types + } + ); + observer.observe(); + }, + setup(client) { + SETUP_CLIENTS.set(client, true); + } + }; +}, "_reportingObserverIntegration"); +const reportingObserverIntegration = defineIntegration(_reportingObserverIntegration); +const INTEGRATION_NAME$5 = "HttpClient"; +const _httpClientIntegration = /* @__PURE__ */ __name((options4 = {}) => { + const _options = { + failedRequestStatusCodes: [[500, 599]], + failedRequestTargets: [/.*/], + ...options4 + }; + return { + name: INTEGRATION_NAME$5, + setup(client) { + _wrapFetch(client, _options); + _wrapXHR(client, _options); + } + }; +}, "_httpClientIntegration"); +const httpClientIntegration = defineIntegration(_httpClientIntegration); +function _fetchResponseHandler(options4, requestInfo, response, requestInit, error2) { + if (_shouldCaptureResponse(options4, response.status, response.url)) { + const request = _getRequest(requestInfo, requestInit); + let requestHeaders, responseHeaders, requestCookies, responseCookies; + if (_shouldSendDefaultPii()) { + [requestHeaders, requestCookies] = _parseCookieHeaders("Cookie", request); + [responseHeaders, responseCookies] = _parseCookieHeaders("Set-Cookie", response); + } + const event = _createEvent({ + url: request.url, + method: request.method, + status: response.status, + requestHeaders, + responseHeaders, + requestCookies, + responseCookies, + error: error2 + }); + captureEvent(event); + } +} +__name(_fetchResponseHandler, "_fetchResponseHandler"); +function _parseCookieHeaders(cookieHeader, obj) { + const headers = _extractFetchHeaders(obj.headers); + let cookies2; + try { + const cookieString = headers[cookieHeader] || headers[cookieHeader.toLowerCase()] || void 0; + if (cookieString) { + cookies2 = _parseCookieString(cookieString); + } + } catch (e2) { + } + return [headers, cookies2]; +} +__name(_parseCookieHeaders, "_parseCookieHeaders"); +function _xhrResponseHandler(options4, xhr, method, headers, error2) { + if (_shouldCaptureResponse(options4, xhr.status, xhr.responseURL)) { + let requestHeaders, responseCookies, responseHeaders; + if (_shouldSendDefaultPii()) { + try { + const cookieString = xhr.getResponseHeader("Set-Cookie") || xhr.getResponseHeader("set-cookie") || void 0; + if (cookieString) { + responseCookies = _parseCookieString(cookieString); + } + } catch (e3) { + } + try { + responseHeaders = _getXHRResponseHeaders(xhr); + } catch (e4) { + } + requestHeaders = headers; + } + const event = _createEvent({ + url: xhr.responseURL, + method, + status: xhr.status, + requestHeaders, + // Can't access request cookies from XHR + responseHeaders, + responseCookies, + error: error2 + }); + captureEvent(event); + } +} +__name(_xhrResponseHandler, "_xhrResponseHandler"); +function _getResponseSizeFromHeaders(headers) { + if (headers) { + const contentLength = headers["Content-Length"] || headers["content-length"]; + if (contentLength) { + return parseInt(contentLength, 10); + } + } + return void 0; +} +__name(_getResponseSizeFromHeaders, "_getResponseSizeFromHeaders"); +function _parseCookieString(cookieString) { + return cookieString.split("; ").reduce((acc, cookie) => { + const [key, value4] = cookie.split("="); + if (key && value4) { + acc[key] = value4; + } + return acc; + }, {}); +} +__name(_parseCookieString, "_parseCookieString"); +function _extractFetchHeaders(headers) { + const result = {}; + headers.forEach((value4, key) => { + result[key] = value4; + }); + return result; +} +__name(_extractFetchHeaders, "_extractFetchHeaders"); +function _getXHRResponseHeaders(xhr) { + const headers = xhr.getAllResponseHeaders(); + if (!headers) { + return {}; + } + return headers.split("\r\n").reduce((acc, line) => { + const [key, value4] = line.split(": "); + if (key && value4) { + acc[key] = value4; + } + return acc; + }, {}); +} +__name(_getXHRResponseHeaders, "_getXHRResponseHeaders"); +function _isInGivenRequestTargets(failedRequestTargets, target) { + return failedRequestTargets.some((givenRequestTarget) => { + if (typeof givenRequestTarget === "string") { + return target.includes(givenRequestTarget); + } + return givenRequestTarget.test(target); + }); +} +__name(_isInGivenRequestTargets, "_isInGivenRequestTargets"); +function _isInGivenStatusRanges(failedRequestStatusCodes, status) { + return failedRequestStatusCodes.some((range2) => { + if (typeof range2 === "number") { + return range2 === status; + } + return status >= range2[0] && status <= range2[1]; + }); +} +__name(_isInGivenStatusRanges, "_isInGivenStatusRanges"); +function _wrapFetch(client, options4) { + if (!supportsNativeFetch()) { + return; + } + addFetchInstrumentationHandler((handlerData) => { + if (getClient() !== client) { + return; + } + const { response, args, error: error2, virtualError } = handlerData; + const [requestInfo, requestInit] = args; + if (!response) { + return; + } + _fetchResponseHandler(options4, requestInfo, response, requestInit, error2 || virtualError); + }, false); +} +__name(_wrapFetch, "_wrapFetch"); +function _wrapXHR(client, options4) { + if (!("XMLHttpRequest" in GLOBAL_OBJ)) { + return; + } + addXhrInstrumentationHandler((handlerData) => { + if (getClient() !== client) { + return; + } + const { error: error2, virtualError } = handlerData; + const xhr = handlerData.xhr; + const sentryXhrData = xhr[SENTRY_XHR_DATA_KEY]; + if (!sentryXhrData) { + return; + } + const { method, request_headers: headers } = sentryXhrData; + try { + _xhrResponseHandler(options4, xhr, method, headers, error2 || virtualError); + } catch (e2) { + DEBUG_BUILD$4 && logger$2.warn("Error while extracting response event form XHR response", e2); + } + }); +} +__name(_wrapXHR, "_wrapXHR"); +function _shouldCaptureResponse(options4, status, url) { + return _isInGivenStatusRanges(options4.failedRequestStatusCodes, status) && _isInGivenRequestTargets(options4.failedRequestTargets, url) && !isSentryRequestUrl(url, getClient()); +} +__name(_shouldCaptureResponse, "_shouldCaptureResponse"); +function _createEvent(data25) { + const client = getClient(); + const virtualStackTrace = client && data25.error && data25.error instanceof Error ? data25.error.stack : void 0; + const stack2 = virtualStackTrace && client ? client.getOptions().stackParser(virtualStackTrace, 0, 1) : void 0; + const message3 = `HTTP Client Error with status code: ${data25.status}`; + const event = { + message: message3, + exception: { + values: [ + { + type: "Error", + value: message3, + stacktrace: stack2 ? { frames: stack2 } : void 0 + } + ] + }, + request: { + url: data25.url, + method: data25.method, + headers: data25.requestHeaders, + cookies: data25.requestCookies + }, + contexts: { + response: { + status_code: data25.status, + headers: data25.responseHeaders, + cookies: data25.responseCookies, + body_size: _getResponseSizeFromHeaders(data25.responseHeaders) + } + } + }; + addExceptionMechanism(event, { + type: "http.client", + handled: false + }); + return event; +} +__name(_createEvent, "_createEvent"); +function _getRequest(requestInfo, requestInit) { + if (!requestInit && requestInfo instanceof Request) { + return requestInfo; + } + if (requestInfo instanceof Request && requestInfo.bodyUsed) { + return requestInfo; + } + return new Request(requestInfo, requestInit); +} +__name(_getRequest, "_getRequest"); +function _shouldSendDefaultPii() { + const client = getClient(); + return client ? Boolean(client.getOptions().sendDefaultPii) : false; +} +__name(_shouldSendDefaultPii, "_shouldSendDefaultPii"); +const WINDOW$2 = GLOBAL_OBJ; +const DEFAULT_LINES_OF_CONTEXT = 7; +const INTEGRATION_NAME$4 = "ContextLines"; +const _contextLinesIntegration = /* @__PURE__ */ __name((options4 = {}) => { + const contextLines = options4.frameContextLines != null ? options4.frameContextLines : DEFAULT_LINES_OF_CONTEXT; + return { + name: INTEGRATION_NAME$4, + processEvent(event) { + return addSourceContext(event, contextLines); + } + }; +}, "_contextLinesIntegration"); +const contextLinesIntegration = defineIntegration(_contextLinesIntegration); +function addSourceContext(event, contextLines) { + const doc2 = WINDOW$2.document; + const htmlFilename = WINDOW$2.location && stripUrlQueryAndFragment(WINDOW$2.location.href); + if (!doc2 || !htmlFilename) { + return event; + } + const exceptions = event.exception && event.exception.values; + if (!exceptions || !exceptions.length) { + return event; + } + const html = doc2.documentElement.innerHTML; + if (!html) { + return event; + } + const htmlLines = ["<!DOCTYPE html>", "<html>", ...html.split("\n"), "</html>"]; + exceptions.forEach((exception) => { + const stacktrace = exception.stacktrace; + if (stacktrace && stacktrace.frames) { + stacktrace.frames = stacktrace.frames.map( + (frame) => applySourceContextToFrame(frame, htmlLines, htmlFilename, contextLines) + ); + } + }); + return event; +} +__name(addSourceContext, "addSourceContext"); +function applySourceContextToFrame(frame, htmlLines, htmlFilename, linesOfContext) { + if (frame.filename !== htmlFilename || !frame.lineno || !htmlLines.length) { + return frame; + } + addContextToFrame(htmlLines, frame, linesOfContext); + return frame; +} +__name(applySourceContextToFrame, "applySourceContextToFrame"); +const WINDOW$1 = GLOBAL_OBJ; +const REPLAY_SESSION_KEY = "sentryReplaySession"; +const REPLAY_EVENT_NAME = "replay_event"; +const UNABLE_TO_SEND_REPLAY = "Unable to send Replay"; +const SESSION_IDLE_PAUSE_DURATION = 3e5; +const SESSION_IDLE_EXPIRE_DURATION = 9e5; +const DEFAULT_FLUSH_MIN_DELAY = 5e3; +const DEFAULT_FLUSH_MAX_DELAY = 5500; +const BUFFER_CHECKOUT_TIME = 6e4; +const RETRY_BASE_INTERVAL = 5e3; +const RETRY_MAX_COUNT = 3; +const NETWORK_BODY_MAX_SIZE = 15e4; +const CONSOLE_ARG_MAX_SIZE = 5e3; +const SLOW_CLICK_THRESHOLD = 3e3; +const SLOW_CLICK_SCROLL_TIMEOUT = 300; +const REPLAY_MAX_EVENT_BUFFER_SIZE = 2e7; +const MIN_REPLAY_DURATION = 4999; +const MIN_REPLAY_DURATION_LIMIT = 15e3; +const MAX_REPLAY_DURATION = 36e5; +function _nullishCoalesce$1(lhs, rhsFn) { + if (lhs != null) { + return lhs; + } else { + return rhsFn(); + } +} +__name(_nullishCoalesce$1, "_nullishCoalesce$1"); +function _optionalChain$5(ops) { + let lastAccessLHS = void 0; + let value4 = ops[0]; + let i2 = 1; + while (i2 < ops.length) { + const op = ops[i2]; + const fn = ops[i2 + 1]; + i2 += 2; + if ((op === "optionalAccess" || op === "optionalCall") && value4 == null) { + return void 0; + } + if (op === "access" || op === "optionalAccess") { + lastAccessLHS = value4; + value4 = fn(value4); + } else if (op === "call" || op === "optionalCall") { + value4 = fn((...args) => value4.call(lastAccessLHS, ...args)); + lastAccessLHS = void 0; + } + } + return value4; +} +__name(_optionalChain$5, "_optionalChain$5"); +var NodeType$3; +(function(NodeType3) { + NodeType3[NodeType3["Document"] = 0] = "Document"; + NodeType3[NodeType3["DocumentType"] = 1] = "DocumentType"; + NodeType3[NodeType3["Element"] = 2] = "Element"; + NodeType3[NodeType3["Text"] = 3] = "Text"; + NodeType3[NodeType3["CDATA"] = 4] = "CDATA"; + NodeType3[NodeType3["Comment"] = 5] = "Comment"; +})(NodeType$3 || (NodeType$3 = {})); +function isElement$1(n2) { + return n2.nodeType === n2.ELEMENT_NODE; +} +__name(isElement$1, "isElement$1"); +function isShadowRoot(n2) { + const host = _optionalChain$5([n2, "optionalAccess", (_2) => _2.host]); + return Boolean(_optionalChain$5([host, "optionalAccess", (_2) => _2.shadowRoot]) === n2); +} +__name(isShadowRoot, "isShadowRoot"); +function isNativeShadowDom(shadowRoot) { + return Object.prototype.toString.call(shadowRoot) === "[object ShadowRoot]"; +} +__name(isNativeShadowDom, "isNativeShadowDom"); +function fixBrowserCompatibilityIssuesInCSS(cssText) { + if (cssText.includes(" background-clip: text;") && !cssText.includes(" -webkit-background-clip: text;")) { + cssText = cssText.replace(/\sbackground-clip:\s*text;/g, " -webkit-background-clip: text; background-clip: text;"); + } + return cssText; +} +__name(fixBrowserCompatibilityIssuesInCSS, "fixBrowserCompatibilityIssuesInCSS"); +function escapeImportStatement(rule) { + const { cssText } = rule; + if (cssText.split('"').length < 3) + return cssText; + const statement = ["@import", `url(${JSON.stringify(rule.href)})`]; + if (rule.layerName === "") { + statement.push(`layer`); + } else if (rule.layerName) { + statement.push(`layer(${rule.layerName})`); + } + if (rule.supportsText) { + statement.push(`supports(${rule.supportsText})`); + } + if (rule.media.length) { + statement.push(rule.media.mediaText); + } + return statement.join(" ") + ";"; +} +__name(escapeImportStatement, "escapeImportStatement"); +function stringifyStylesheet(s2) { + try { + const rules = s2.rules || s2.cssRules; + return rules ? fixBrowserCompatibilityIssuesInCSS(Array.from(rules, stringifyRule).join("")) : null; + } catch (error2) { + return null; + } +} +__name(stringifyStylesheet, "stringifyStylesheet"); +function fixAllCssProperty(rule) { + let styles = ""; + for (let i2 = 0; i2 < rule.style.length; i2++) { + const styleDeclaration = rule.style; + const attribute2 = styleDeclaration[i2]; + const isImportant = styleDeclaration.getPropertyPriority(attribute2); + styles += `${attribute2}:${styleDeclaration.getPropertyValue(attribute2)}${isImportant ? ` !important` : ""};`; + } + return `${rule.selectorText} { ${styles} }`; +} +__name(fixAllCssProperty, "fixAllCssProperty"); +function stringifyRule(rule) { + let importStringified; + if (isCSSImportRule(rule)) { + try { + importStringified = stringifyStylesheet(rule.styleSheet) || escapeImportStatement(rule); + } catch (error2) { + } + } else if (isCSSStyleRule(rule)) { + let cssText = rule.cssText; + const needsSafariColonFix = rule.selectorText.includes(":"); + const needsAllFix = typeof rule.style["all"] === "string" && rule.style["all"]; + if (needsAllFix) { + cssText = fixAllCssProperty(rule); + } + if (needsSafariColonFix) { + cssText = fixSafariColons(cssText); + } + if (needsSafariColonFix || needsAllFix) { + return cssText; + } + } + return importStringified || rule.cssText; +} +__name(stringifyRule, "stringifyRule"); +function fixSafariColons(cssStringified) { + const regex2 = /(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm; + return cssStringified.replace(regex2, "$1\\$2"); +} +__name(fixSafariColons, "fixSafariColons"); +function isCSSImportRule(rule) { + return "styleSheet" in rule; +} +__name(isCSSImportRule, "isCSSImportRule"); +function isCSSStyleRule(rule) { + return "selectorText" in rule; +} +__name(isCSSStyleRule, "isCSSStyleRule"); +class Mirror { + static { + __name(this, "Mirror"); + } + constructor() { + this.idNodeMap = /* @__PURE__ */ new Map(); + this.nodeMetaMap = /* @__PURE__ */ new WeakMap(); + } + getId(n2) { + if (!n2) + return -1; + const id3 = _optionalChain$5([this, "access", (_3) => _3.getMeta, "call", (_4) => _4(n2), "optionalAccess", (_5) => _5.id]); + return _nullishCoalesce$1(id3, () => -1); + } + getNode(id3) { + return this.idNodeMap.get(id3) || null; + } + getIds() { + return Array.from(this.idNodeMap.keys()); + } + getMeta(n2) { + return this.nodeMetaMap.get(n2) || null; + } + removeNodeFromMap(n2) { + const id3 = this.getId(n2); + this.idNodeMap.delete(id3); + if (n2.childNodes) { + n2.childNodes.forEach((childNode) => this.removeNodeFromMap(childNode)); + } + } + has(id3) { + return this.idNodeMap.has(id3); + } + hasNode(node3) { + return this.nodeMetaMap.has(node3); + } + add(n2, meta) { + const id3 = meta.id; + this.idNodeMap.set(id3, n2); + this.nodeMetaMap.set(n2, meta); + } + replace(id3, n2) { + const oldNode = this.getNode(id3); + if (oldNode) { + const meta = this.nodeMetaMap.get(oldNode); + if (meta) + this.nodeMetaMap.set(n2, meta); + } + this.idNodeMap.set(id3, n2); + } + reset() { + this.idNodeMap = /* @__PURE__ */ new Map(); + this.nodeMetaMap = /* @__PURE__ */ new WeakMap(); + } +} +function createMirror() { + return new Mirror(); +} +__name(createMirror, "createMirror"); +function shouldMaskInput({ maskInputOptions, tagName, type }) { + if (tagName === "OPTION") { + tagName = "SELECT"; + } + return Boolean(maskInputOptions[tagName.toLowerCase()] || type && maskInputOptions[type] || type === "password" || tagName === "INPUT" && !type && maskInputOptions["text"]); +} +__name(shouldMaskInput, "shouldMaskInput"); +function maskInputValue({ isMasked: isMasked2, element, value: value4, maskInputFn }) { + let text2 = value4 || ""; + if (!isMasked2) { + return text2; + } + if (maskInputFn) { + text2 = maskInputFn(text2, element); + } + return "*".repeat(text2.length); +} +__name(maskInputValue, "maskInputValue"); +function toLowerCase(str) { + return str.toLowerCase(); +} +__name(toLowerCase, "toLowerCase"); +function toUpperCase(str) { + return str.toUpperCase(); +} +__name(toUpperCase, "toUpperCase"); +const ORIGINAL_ATTRIBUTE_NAME = "__rrweb_original__"; +function is2DCanvasBlank(canvas) { + const ctx = canvas.getContext("2d"); + if (!ctx) + return true; + const chunkSize = 50; + for (let x2 = 0; x2 < canvas.width; x2 += chunkSize) { + for (let y2 = 0; y2 < canvas.height; y2 += chunkSize) { + const getImageData = ctx.getImageData; + const originalGetImageData = ORIGINAL_ATTRIBUTE_NAME in getImageData ? getImageData[ORIGINAL_ATTRIBUTE_NAME] : getImageData; + const pixelBuffer = new Uint32Array(originalGetImageData.call(ctx, x2, y2, Math.min(chunkSize, canvas.width - x2), Math.min(chunkSize, canvas.height - y2)).data.buffer); + if (pixelBuffer.some((pixel) => pixel !== 0)) + return false; + } + } + return true; +} +__name(is2DCanvasBlank, "is2DCanvasBlank"); +function getInputType(element) { + const type = element.type; + return element.hasAttribute("data-rr-is-password") ? "password" : type ? toLowerCase(type) : null; +} +__name(getInputType, "getInputType"); +function getInputValue(el, tagName, type) { + if (tagName === "INPUT" && (type === "radio" || type === "checkbox")) { + return el.getAttribute("value") || ""; + } + return el.value; +} +__name(getInputValue, "getInputValue"); +function extractFileExtension(path, baseURL) { + let url; + try { + url = new URL(path, _nullishCoalesce$1(baseURL, () => window.location.href)); + } catch (err) { + return null; + } + const regex2 = /\.([0-9a-z]+)(?:$)/i; + const match2 = url.pathname.match(regex2); + return _nullishCoalesce$1(_optionalChain$5([match2, "optionalAccess", (_6) => _6[1]]), () => null); +} +__name(extractFileExtension, "extractFileExtension"); +const cachedImplementations$1 = {}; +function getImplementation$1(name2) { + const cached = cachedImplementations$1[name2]; + if (cached) { + return cached; + } + const document2 = window.document; + let impl = window[name2]; + if (document2 && typeof document2.createElement === "function") { + try { + const sandbox = document2.createElement("iframe"); + sandbox.hidden = true; + document2.head.appendChild(sandbox); + const contentWindow = sandbox.contentWindow; + if (contentWindow && contentWindow[name2]) { + impl = contentWindow[name2]; + } + document2.head.removeChild(sandbox); + } catch (e2) { + } + } + return cachedImplementations$1[name2] = impl.bind(window); +} +__name(getImplementation$1, "getImplementation$1"); +function setTimeout$2(...rest) { + return getImplementation$1("setTimeout")(...rest); +} +__name(setTimeout$2, "setTimeout$2"); +function clearTimeout$2(...rest) { + return getImplementation$1("clearTimeout")(...rest); +} +__name(clearTimeout$2, "clearTimeout$2"); +function getIframeContentDocument(iframe) { + try { + return iframe.contentDocument; + } catch (e2) { + } +} +__name(getIframeContentDocument, "getIframeContentDocument"); +let _id$2 = 1; +const tagNameRegex = new RegExp("[^a-z0-9-_:]"); +const IGNORED_NODE = -2; +function genId() { + return _id$2++; +} +__name(genId, "genId"); +function getValidTagName(element) { + if (element instanceof HTMLFormElement) { + return "form"; + } + const processedTagName = toLowerCase(element.tagName); + if (tagNameRegex.test(processedTagName)) { + return "div"; + } + return processedTagName; +} +__name(getValidTagName, "getValidTagName"); +function extractOrigin(url) { + let origin2 = ""; + if (url.indexOf("//") > -1) { + origin2 = url.split("/").slice(0, 3).join("/"); + } else { + origin2 = url.split("/")[0]; + } + origin2 = origin2.split("?")[0]; + return origin2; +} +__name(extractOrigin, "extractOrigin"); +let canvasService; +let canvasCtx; +const URL_IN_CSS_REF = /url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm; +const URL_PROTOCOL_MATCH = /^(?:[a-z+]+:)?\/\//i; +const URL_WWW_MATCH = /^www\..*/i; +const DATA_URI = /^(data:)([^,]*),(.*)/i; +function absoluteToStylesheet(cssText, href) { + return (cssText || "").replace(URL_IN_CSS_REF, (origin2, quote1, path1, quote2, path2, path3) => { + const filePath = path1 || path2 || path3; + const maybeQuote = quote1 || quote2 || ""; + if (!filePath) { + return origin2; + } + if (URL_PROTOCOL_MATCH.test(filePath) || URL_WWW_MATCH.test(filePath)) { + return `url(${maybeQuote}${filePath}${maybeQuote})`; + } + if (DATA_URI.test(filePath)) { + return `url(${maybeQuote}${filePath}${maybeQuote})`; + } + if (filePath[0] === "/") { + return `url(${maybeQuote}${extractOrigin(href) + filePath}${maybeQuote})`; + } + const stack2 = href.split("/"); + const parts2 = filePath.split("/"); + stack2.pop(); + for (const part of parts2) { + if (part === ".") { + continue; + } else if (part === "..") { + stack2.pop(); + } else { + stack2.push(part); + } + } + return `url(${maybeQuote}${stack2.join("/")}${maybeQuote})`; + }); +} +__name(absoluteToStylesheet, "absoluteToStylesheet"); +const SRCSET_NOT_SPACES = /^[^ \t\n\r\u000c]+/; +const SRCSET_COMMAS_OR_SPACES = /^[, \t\n\r\u000c]+/; +function getAbsoluteSrcsetString(doc2, attributeValue) { + if (attributeValue.trim() === "") { + return attributeValue; + } + let pos2 = 0; + function collectCharacters(regEx) { + let chars2; + const match2 = regEx.exec(attributeValue.substring(pos2)); + if (match2) { + chars2 = match2[0]; + pos2 += chars2.length; + return chars2; + } + return ""; + } + __name(collectCharacters, "collectCharacters"); + const output = []; + while (true) { + collectCharacters(SRCSET_COMMAS_OR_SPACES); + if (pos2 >= attributeValue.length) { + break; + } + let url = collectCharacters(SRCSET_NOT_SPACES); + if (url.slice(-1) === ",") { + url = absoluteToDoc(doc2, url.substring(0, url.length - 1)); + output.push(url); + } else { + let descriptorsStr = ""; + url = absoluteToDoc(doc2, url); + let inParens = false; + while (true) { + const c2 = attributeValue.charAt(pos2); + if (c2 === "") { + output.push((url + descriptorsStr).trim()); + break; + } else if (!inParens) { + if (c2 === ",") { + pos2 += 1; + output.push((url + descriptorsStr).trim()); + break; + } else if (c2 === "(") { + inParens = true; + } + } else { + if (c2 === ")") { + inParens = false; + } + } + descriptorsStr += c2; + pos2 += 1; + } + } + } + return output.join(", "); +} +__name(getAbsoluteSrcsetString, "getAbsoluteSrcsetString"); +const cachedDocument = /* @__PURE__ */ new WeakMap(); +function absoluteToDoc(doc2, attributeValue) { + if (!attributeValue || attributeValue.trim() === "") { + return attributeValue; + } + return getHref(doc2, attributeValue); +} +__name(absoluteToDoc, "absoluteToDoc"); +function isSVGElement(el) { + return Boolean(el.tagName === "svg" || el.ownerSVGElement); +} +__name(isSVGElement, "isSVGElement"); +function getHref(doc2, customHref) { + let a2 = cachedDocument.get(doc2); + if (!a2) { + a2 = doc2.createElement("a"); + cachedDocument.set(doc2, a2); + } + if (!customHref) { + customHref = ""; + } else if (customHref.startsWith("blob:") || customHref.startsWith("data:")) { + return customHref; + } + a2.setAttribute("href", customHref); + return a2.href; +} +__name(getHref, "getHref"); +function transformAttribute(doc2, tagName, name2, value4, element, maskAttributeFn) { + if (!value4) { + return value4; + } + if (name2 === "src" || name2 === "href" && !(tagName === "use" && value4[0] === "#")) { + return absoluteToDoc(doc2, value4); + } else if (name2 === "xlink:href" && value4[0] !== "#") { + return absoluteToDoc(doc2, value4); + } else if (name2 === "background" && (tagName === "table" || tagName === "td" || tagName === "th")) { + return absoluteToDoc(doc2, value4); + } else if (name2 === "srcset") { + return getAbsoluteSrcsetString(doc2, value4); + } else if (name2 === "style") { + return absoluteToStylesheet(value4, getHref(doc2)); + } else if (tagName === "object" && name2 === "data") { + return absoluteToDoc(doc2, value4); + } + if (typeof maskAttributeFn === "function") { + return maskAttributeFn(name2, value4, element); + } + return value4; +} +__name(transformAttribute, "transformAttribute"); +function ignoreAttribute(tagName, name2, _value) { + return (tagName === "video" || tagName === "audio") && name2 === "autoplay"; +} +__name(ignoreAttribute, "ignoreAttribute"); +function _isBlockedElement(element, blockClass, blockSelector, unblockSelector) { + try { + if (unblockSelector && element.matches(unblockSelector)) { + return false; + } + if (typeof blockClass === "string") { + if (element.classList.contains(blockClass)) { + return true; + } + } else { + for (let eIndex = element.classList.length; eIndex--; ) { + const className = element.classList[eIndex]; + if (blockClass.test(className)) { + return true; + } + } + } + if (blockSelector) { + return element.matches(blockSelector); + } + } catch (e2) { + } + return false; +} +__name(_isBlockedElement, "_isBlockedElement"); +function elementClassMatchesRegex$1(el, regex2) { + for (let eIndex = el.classList.length; eIndex--; ) { + const className = el.classList[eIndex]; + if (regex2.test(className)) { + return true; + } + } + return false; +} +__name(elementClassMatchesRegex$1, "elementClassMatchesRegex$1"); +function distanceToMatch$1(node3, matchPredicate, limit = Infinity, distance2 = 0) { + if (!node3) + return -1; + if (node3.nodeType !== node3.ELEMENT_NODE) + return -1; + if (distance2 > limit) + return -1; + if (matchPredicate(node3)) + return distance2; + return distanceToMatch$1(node3.parentNode, matchPredicate, limit, distance2 + 1); +} +__name(distanceToMatch$1, "distanceToMatch$1"); +function createMatchPredicate$1(className, selector) { + return (node3) => { + const el = node3; + if (el === null) + return false; + try { + if (className) { + if (typeof className === "string") { + if (el.matches(`.${className}`)) + return true; + } else if (elementClassMatchesRegex$1(el, className)) { + return true; + } + } + if (selector && el.matches(selector)) + return true; + return false; + } catch (e2) { + return false; + } + }; +} +__name(createMatchPredicate$1, "createMatchPredicate$1"); +function needMaskingText(node3, maskTextClass, maskTextSelector, unmaskTextClass, unmaskTextSelector, maskAllText) { + try { + const el = node3.nodeType === node3.ELEMENT_NODE ? node3 : node3.parentElement; + if (el === null) + return false; + if (el.tagName === "INPUT") { + const autocomplete = el.getAttribute("autocomplete"); + const disallowedAutocompleteValues = [ + "current-password", + "new-password", + "cc-number", + "cc-exp", + "cc-exp-month", + "cc-exp-year", + "cc-csc" + ]; + if (disallowedAutocompleteValues.includes(autocomplete)) { + return true; + } + } + let maskDistance = -1; + let unmaskDistance = -1; + if (maskAllText) { + unmaskDistance = distanceToMatch$1(el, createMatchPredicate$1(unmaskTextClass, unmaskTextSelector)); + if (unmaskDistance < 0) { + return true; + } + maskDistance = distanceToMatch$1(el, createMatchPredicate$1(maskTextClass, maskTextSelector), unmaskDistance >= 0 ? unmaskDistance : Infinity); + } else { + maskDistance = distanceToMatch$1(el, createMatchPredicate$1(maskTextClass, maskTextSelector)); + if (maskDistance < 0) { + return false; + } + unmaskDistance = distanceToMatch$1(el, createMatchPredicate$1(unmaskTextClass, unmaskTextSelector), maskDistance >= 0 ? maskDistance : Infinity); + } + return maskDistance >= 0 ? unmaskDistance >= 0 ? maskDistance <= unmaskDistance : true : unmaskDistance >= 0 ? false : !!maskAllText; + } catch (e2) { + } + return !!maskAllText; +} +__name(needMaskingText, "needMaskingText"); +function onceIframeLoaded(iframeEl, listener, iframeLoadTimeout) { + const win = iframeEl.contentWindow; + if (!win) { + return; + } + let fired = false; + let readyState; + try { + readyState = win.document.readyState; + } catch (error2) { + return; + } + if (readyState !== "complete") { + const timer = setTimeout$2(() => { + if (!fired) { + listener(); + fired = true; + } + }, iframeLoadTimeout); + iframeEl.addEventListener("load", () => { + clearTimeout$2(timer); + fired = true; + listener(); + }); + return; + } + const blankUrl = "about:blank"; + if (win.location.href !== blankUrl || iframeEl.src === blankUrl || iframeEl.src === "") { + setTimeout$2(listener, 0); + return iframeEl.addEventListener("load", listener); + } + iframeEl.addEventListener("load", listener); +} +__name(onceIframeLoaded, "onceIframeLoaded"); +function onceStylesheetLoaded(link2, listener, styleSheetLoadTimeout) { + let fired = false; + let styleSheetLoaded; + try { + styleSheetLoaded = link2.sheet; + } catch (error2) { + return; + } + if (styleSheetLoaded) + return; + const timer = setTimeout$2(() => { + if (!fired) { + listener(); + fired = true; + } + }, styleSheetLoadTimeout); + link2.addEventListener("load", () => { + clearTimeout$2(timer); + fired = true; + listener(); + }); +} +__name(onceStylesheetLoaded, "onceStylesheetLoaded"); +function serializeNode(n2, options4) { + const { doc: doc2, mirror: mirror2, blockClass, blockSelector, unblockSelector, maskAllText, maskAttributeFn, maskTextClass, unmaskTextClass, maskTextSelector, unmaskTextSelector, inlineStylesheet, maskInputOptions = {}, maskTextFn, maskInputFn, dataURLOptions = {}, inlineImages, recordCanvas, keepIframeSrcFn, newlyAddedElement = false } = options4; + const rootId = getRootId(doc2, mirror2); + switch (n2.nodeType) { + case n2.DOCUMENT_NODE: + if (n2.compatMode !== "CSS1Compat") { + return { + type: NodeType$3.Document, + childNodes: [], + compatMode: n2.compatMode + }; + } else { + return { + type: NodeType$3.Document, + childNodes: [] + }; + } + case n2.DOCUMENT_TYPE_NODE: + return { + type: NodeType$3.DocumentType, + name: n2.name, + publicId: n2.publicId, + systemId: n2.systemId, + rootId + }; + case n2.ELEMENT_NODE: + return serializeElementNode(n2, { + doc: doc2, + blockClass, + blockSelector, + unblockSelector, + inlineStylesheet, + maskAttributeFn, + maskInputOptions, + maskInputFn, + dataURLOptions, + inlineImages, + recordCanvas, + keepIframeSrcFn, + newlyAddedElement, + rootId, + maskAllText, + maskTextClass, + unmaskTextClass, + maskTextSelector, + unmaskTextSelector + }); + case n2.TEXT_NODE: + return serializeTextNode(n2, { + doc: doc2, + maskAllText, + maskTextClass, + unmaskTextClass, + maskTextSelector, + unmaskTextSelector, + maskTextFn, + maskInputOptions, + maskInputFn, + rootId + }); + case n2.CDATA_SECTION_NODE: + return { + type: NodeType$3.CDATA, + textContent: "", + rootId + }; + case n2.COMMENT_NODE: + return { + type: NodeType$3.Comment, + textContent: n2.textContent || "", + rootId + }; + default: + return false; + } +} +__name(serializeNode, "serializeNode"); +function getRootId(doc2, mirror2) { + if (!mirror2.hasNode(doc2)) + return void 0; + const docId = mirror2.getId(doc2); + return docId === 1 ? void 0 : docId; +} +__name(getRootId, "getRootId"); +function serializeTextNode(n2, options4) { + const { maskAllText, maskTextClass, unmaskTextClass, maskTextSelector, unmaskTextSelector, maskTextFn, maskInputOptions, maskInputFn, rootId } = options4; + const parentTagName = n2.parentNode && n2.parentNode.tagName; + let textContent = n2.textContent; + const isStyle = parentTagName === "STYLE" ? true : void 0; + const isScript = parentTagName === "SCRIPT" ? true : void 0; + const isTextarea = parentTagName === "TEXTAREA" ? true : void 0; + if (isStyle && textContent) { + try { + if (n2.nextSibling || n2.previousSibling) { + } else if (_optionalChain$5([n2, "access", (_7) => _7.parentNode, "access", (_8) => _8.sheet, "optionalAccess", (_9) => _9.cssRules])) { + textContent = stringifyStylesheet(n2.parentNode.sheet); + } + } catch (err) { + console.warn(`Cannot get CSS styles from text's parentNode. Error: ${err}`, n2); + } + textContent = absoluteToStylesheet(textContent, getHref(options4.doc)); + } + if (isScript) { + textContent = "SCRIPT_PLACEHOLDER"; + } + const forceMask = needMaskingText(n2, maskTextClass, maskTextSelector, unmaskTextClass, unmaskTextSelector, maskAllText); + if (!isStyle && !isScript && !isTextarea && textContent && forceMask) { + textContent = maskTextFn ? maskTextFn(textContent, n2.parentElement) : textContent.replace(/[\S]/g, "*"); + } + if (isTextarea && textContent && (maskInputOptions.textarea || forceMask)) { + textContent = maskInputFn ? maskInputFn(textContent, n2.parentNode) : textContent.replace(/[\S]/g, "*"); + } + if (parentTagName === "OPTION" && textContent) { + const isInputMasked = shouldMaskInput({ + type: null, + tagName: parentTagName, + maskInputOptions + }); + textContent = maskInputValue({ + isMasked: needMaskingText(n2, maskTextClass, maskTextSelector, unmaskTextClass, unmaskTextSelector, isInputMasked), + element: n2, + value: textContent, + maskInputFn + }); + } + return { + type: NodeType$3.Text, + textContent: textContent || "", + isStyle, + rootId + }; +} +__name(serializeTextNode, "serializeTextNode"); +function serializeElementNode(n2, options4) { + const { doc: doc2, blockClass, blockSelector, unblockSelector, inlineStylesheet, maskInputOptions = {}, maskAttributeFn, maskInputFn, dataURLOptions = {}, inlineImages, recordCanvas, keepIframeSrcFn, newlyAddedElement = false, rootId, maskAllText, maskTextClass, unmaskTextClass, maskTextSelector, unmaskTextSelector } = options4; + const needBlock = _isBlockedElement(n2, blockClass, blockSelector, unblockSelector); + const tagName = getValidTagName(n2); + let attributes = {}; + const len = n2.attributes.length; + for (let i2 = 0; i2 < len; i2++) { + const attr = n2.attributes[i2]; + if (attr.name && !ignoreAttribute(tagName, attr.name, attr.value)) { + attributes[attr.name] = transformAttribute(doc2, tagName, toLowerCase(attr.name), attr.value, n2, maskAttributeFn); + } + } + if (tagName === "link" && inlineStylesheet) { + const stylesheet = Array.from(doc2.styleSheets).find((s2) => { + return s2.href === n2.href; + }); + let cssText = null; + if (stylesheet) { + cssText = stringifyStylesheet(stylesheet); + } + if (cssText) { + attributes.rel = null; + attributes.href = null; + attributes.crossorigin = null; + attributes._cssText = absoluteToStylesheet(cssText, stylesheet.href); + } + } + if (tagName === "style" && n2.sheet && !(n2.innerText || n2.textContent || "").trim().length) { + const cssText = stringifyStylesheet(n2.sheet); + if (cssText) { + attributes._cssText = absoluteToStylesheet(cssText, getHref(doc2)); + } + } + if (tagName === "input" || tagName === "textarea" || tagName === "select" || tagName === "option") { + const el = n2; + const type = getInputType(el); + const value4 = getInputValue(el, toUpperCase(tagName), type); + const checked4 = el.checked; + if (type !== "submit" && type !== "button" && value4) { + const forceMask = needMaskingText(el, maskTextClass, maskTextSelector, unmaskTextClass, unmaskTextSelector, shouldMaskInput({ + type, + tagName: toUpperCase(tagName), + maskInputOptions + })); + attributes.value = maskInputValue({ + isMasked: forceMask, + element: el, + value: value4, + maskInputFn + }); + } + if (checked4) { + attributes.checked = checked4; + } + } + if (tagName === "option") { + if (n2.selected && !maskInputOptions["select"]) { + attributes.selected = true; + } else { + delete attributes.selected; + } + } + if (tagName === "canvas" && recordCanvas) { + if (n2.__context === "2d") { + if (!is2DCanvasBlank(n2)) { + attributes.rr_dataURL = n2.toDataURL(dataURLOptions.type, dataURLOptions.quality); + } + } else if (!("__context" in n2)) { + const canvasDataURL = n2.toDataURL(dataURLOptions.type, dataURLOptions.quality); + const blankCanvas = doc2.createElement("canvas"); + blankCanvas.width = n2.width; + blankCanvas.height = n2.height; + const blankCanvasDataURL = blankCanvas.toDataURL(dataURLOptions.type, dataURLOptions.quality); + if (canvasDataURL !== blankCanvasDataURL) { + attributes.rr_dataURL = canvasDataURL; + } + } + } + if (tagName === "img" && inlineImages) { + if (!canvasService) { + canvasService = doc2.createElement("canvas"); + canvasCtx = canvasService.getContext("2d"); + } + const image2 = n2; + const imageSrc = image2.currentSrc || image2.getAttribute("src") || "<unknown-src>"; + const priorCrossOrigin = image2.crossOrigin; + const recordInlineImage = /* @__PURE__ */ __name(() => { + image2.removeEventListener("load", recordInlineImage); + try { + canvasService.width = image2.naturalWidth; + canvasService.height = image2.naturalHeight; + canvasCtx.drawImage(image2, 0, 0); + attributes.rr_dataURL = canvasService.toDataURL(dataURLOptions.type, dataURLOptions.quality); + } catch (err) { + if (image2.crossOrigin !== "anonymous") { + image2.crossOrigin = "anonymous"; + if (image2.complete && image2.naturalWidth !== 0) + recordInlineImage(); + else + image2.addEventListener("load", recordInlineImage); + return; + } else { + console.warn(`Cannot inline img src=${imageSrc}! Error: ${err}`); + } + } + if (image2.crossOrigin === "anonymous") { + priorCrossOrigin ? attributes.crossOrigin = priorCrossOrigin : image2.removeAttribute("crossorigin"); + } + }, "recordInlineImage"); + if (image2.complete && image2.naturalWidth !== 0) + recordInlineImage(); + else + image2.addEventListener("load", recordInlineImage); + } + if (tagName === "audio" || tagName === "video") { + attributes.rr_mediaState = n2.paused ? "paused" : "played"; + attributes.rr_mediaCurrentTime = n2.currentTime; + } + if (!newlyAddedElement) { + if (n2.scrollLeft) { + attributes.rr_scrollLeft = n2.scrollLeft; + } + if (n2.scrollTop) { + attributes.rr_scrollTop = n2.scrollTop; + } + } + if (needBlock) { + const { width: width2, height } = n2.getBoundingClientRect(); + attributes = { + class: attributes.class, + rr_width: `${width2}px`, + rr_height: `${height}px` + }; + } + if (tagName === "iframe" && !keepIframeSrcFn(attributes.src)) { + if (!needBlock && !getIframeContentDocument(n2)) { + attributes.rr_src = attributes.src; + } + delete attributes.src; + } + let isCustomElement; + try { + if (customElements.get(tagName)) + isCustomElement = true; + } catch (e2) { + } + return { + type: NodeType$3.Element, + tagName, + attributes, + childNodes: [], + isSVG: isSVGElement(n2) || void 0, + needBlock, + rootId, + isCustom: isCustomElement + }; +} +__name(serializeElementNode, "serializeElementNode"); +function lowerIfExists(maybeAttr) { + if (maybeAttr === void 0 || maybeAttr === null) { + return ""; + } else { + return maybeAttr.toLowerCase(); + } +} +__name(lowerIfExists, "lowerIfExists"); +function slimDOMExcluded(sn, slimDOMOptions) { + if (slimDOMOptions.comment && sn.type === NodeType$3.Comment) { + return true; + } else if (sn.type === NodeType$3.Element) { + if (slimDOMOptions.script && (sn.tagName === "script" || sn.tagName === "link" && (sn.attributes.rel === "preload" || sn.attributes.rel === "modulepreload") || sn.tagName === "link" && sn.attributes.rel === "prefetch" && typeof sn.attributes.href === "string" && extractFileExtension(sn.attributes.href) === "js")) { + return true; + } else if (slimDOMOptions.headFavicon && (sn.tagName === "link" && sn.attributes.rel === "shortcut icon" || sn.tagName === "meta" && (lowerIfExists(sn.attributes.name).match(/^msapplication-tile(image|color)$/) || lowerIfExists(sn.attributes.name) === "application-name" || lowerIfExists(sn.attributes.rel) === "icon" || lowerIfExists(sn.attributes.rel) === "apple-touch-icon" || lowerIfExists(sn.attributes.rel) === "shortcut icon"))) { + return true; + } else if (sn.tagName === "meta") { + if (slimDOMOptions.headMetaDescKeywords && lowerIfExists(sn.attributes.name).match(/^description|keywords$/)) { + return true; + } else if (slimDOMOptions.headMetaSocial && (lowerIfExists(sn.attributes.property).match(/^(og|twitter|fb):/) || lowerIfExists(sn.attributes.name).match(/^(og|twitter):/) || lowerIfExists(sn.attributes.name) === "pinterest")) { + return true; + } else if (slimDOMOptions.headMetaRobots && (lowerIfExists(sn.attributes.name) === "robots" || lowerIfExists(sn.attributes.name) === "googlebot" || lowerIfExists(sn.attributes.name) === "bingbot")) { + return true; + } else if (slimDOMOptions.headMetaHttpEquiv && sn.attributes["http-equiv"] !== void 0) { + return true; + } else if (slimDOMOptions.headMetaAuthorship && (lowerIfExists(sn.attributes.name) === "author" || lowerIfExists(sn.attributes.name) === "generator" || lowerIfExists(sn.attributes.name) === "framework" || lowerIfExists(sn.attributes.name) === "publisher" || lowerIfExists(sn.attributes.name) === "progid" || lowerIfExists(sn.attributes.property).match(/^article:/) || lowerIfExists(sn.attributes.property).match(/^product:/))) { + return true; + } else if (slimDOMOptions.headMetaVerification && (lowerIfExists(sn.attributes.name) === "google-site-verification" || lowerIfExists(sn.attributes.name) === "yandex-verification" || lowerIfExists(sn.attributes.name) === "csrf-token" || lowerIfExists(sn.attributes.name) === "p:domain_verify" || lowerIfExists(sn.attributes.name) === "verify-v1" || lowerIfExists(sn.attributes.name) === "verification" || lowerIfExists(sn.attributes.name) === "shopify-checkout-api-token")) { + return true; + } + } + } + return false; +} +__name(slimDOMExcluded, "slimDOMExcluded"); +function serializeNodeWithId(n2, options4) { + const { doc: doc2, mirror: mirror2, blockClass, blockSelector, unblockSelector, maskAllText, maskTextClass, unmaskTextClass, maskTextSelector, unmaskTextSelector, skipChild = false, inlineStylesheet = true, maskInputOptions = {}, maskAttributeFn, maskTextFn, maskInputFn, slimDOMOptions, dataURLOptions = {}, inlineImages = false, recordCanvas = false, onSerialize, onIframeLoad, iframeLoadTimeout = 5e3, onStylesheetLoad, stylesheetLoadTimeout = 5e3, keepIframeSrcFn = /* @__PURE__ */ __name(() => false, "keepIframeSrcFn"), newlyAddedElement = false } = options4; + let { preserveWhiteSpace = true } = options4; + const _serializedNode = serializeNode(n2, { + doc: doc2, + mirror: mirror2, + blockClass, + blockSelector, + maskAllText, + unblockSelector, + maskTextClass, + unmaskTextClass, + maskTextSelector, + unmaskTextSelector, + inlineStylesheet, + maskInputOptions, + maskAttributeFn, + maskTextFn, + maskInputFn, + dataURLOptions, + inlineImages, + recordCanvas, + keepIframeSrcFn, + newlyAddedElement + }); + if (!_serializedNode) { + console.warn(n2, "not serialized"); + return null; + } + let id3; + if (mirror2.hasNode(n2)) { + id3 = mirror2.getId(n2); + } else if (slimDOMExcluded(_serializedNode, slimDOMOptions) || !preserveWhiteSpace && _serializedNode.type === NodeType$3.Text && !_serializedNode.isStyle && !_serializedNode.textContent.replace(/^\s+|\s+$/gm, "").length) { + id3 = IGNORED_NODE; + } else { + id3 = genId(); + } + const serializedNode = Object.assign(_serializedNode, { id: id3 }); + mirror2.add(n2, serializedNode); + if (id3 === IGNORED_NODE) { + return null; + } + if (onSerialize) { + onSerialize(n2); + } + let recordChild = !skipChild; + if (serializedNode.type === NodeType$3.Element) { + recordChild = recordChild && !serializedNode.needBlock; + delete serializedNode.needBlock; + const shadowRoot = n2.shadowRoot; + if (shadowRoot && isNativeShadowDom(shadowRoot)) + serializedNode.isShadowHost = true; + } + if ((serializedNode.type === NodeType$3.Document || serializedNode.type === NodeType$3.Element) && recordChild) { + if (slimDOMOptions.headWhitespace && serializedNode.type === NodeType$3.Element && serializedNode.tagName === "head") { + preserveWhiteSpace = false; + } + const bypassOptions = { + doc: doc2, + mirror: mirror2, + blockClass, + blockSelector, + maskAllText, + unblockSelector, + maskTextClass, + unmaskTextClass, + maskTextSelector, + unmaskTextSelector, + skipChild, + inlineStylesheet, + maskInputOptions, + maskAttributeFn, + maskTextFn, + maskInputFn, + slimDOMOptions, + dataURLOptions, + inlineImages, + recordCanvas, + preserveWhiteSpace, + onSerialize, + onIframeLoad, + iframeLoadTimeout, + onStylesheetLoad, + stylesheetLoadTimeout, + keepIframeSrcFn + }; + for (const childN of Array.from(n2.childNodes)) { + const serializedChildNode = serializeNodeWithId(childN, bypassOptions); + if (serializedChildNode) { + serializedNode.childNodes.push(serializedChildNode); + } + } + if (isElement$1(n2) && n2.shadowRoot) { + for (const childN of Array.from(n2.shadowRoot.childNodes)) { + const serializedChildNode = serializeNodeWithId(childN, bypassOptions); + if (serializedChildNode) { + isNativeShadowDom(n2.shadowRoot) && (serializedChildNode.isShadow = true); + serializedNode.childNodes.push(serializedChildNode); + } + } + } + } + if (n2.parentNode && isShadowRoot(n2.parentNode) && isNativeShadowDom(n2.parentNode)) { + serializedNode.isShadow = true; + } + if (serializedNode.type === NodeType$3.Element && serializedNode.tagName === "iframe") { + onceIframeLoaded(n2, () => { + const iframeDoc = getIframeContentDocument(n2); + if (iframeDoc && onIframeLoad) { + const serializedIframeNode = serializeNodeWithId(iframeDoc, { + doc: iframeDoc, + mirror: mirror2, + blockClass, + blockSelector, + unblockSelector, + maskAllText, + maskTextClass, + unmaskTextClass, + maskTextSelector, + unmaskTextSelector, + skipChild: false, + inlineStylesheet, + maskInputOptions, + maskAttributeFn, + maskTextFn, + maskInputFn, + slimDOMOptions, + dataURLOptions, + inlineImages, + recordCanvas, + preserveWhiteSpace, + onSerialize, + onIframeLoad, + iframeLoadTimeout, + onStylesheetLoad, + stylesheetLoadTimeout, + keepIframeSrcFn + }); + if (serializedIframeNode) { + onIframeLoad(n2, serializedIframeNode); + } + } + }, iframeLoadTimeout); + } + if (serializedNode.type === NodeType$3.Element && serializedNode.tagName === "link" && typeof serializedNode.attributes.rel === "string" && (serializedNode.attributes.rel === "stylesheet" || serializedNode.attributes.rel === "preload" && typeof serializedNode.attributes.href === "string" && extractFileExtension(serializedNode.attributes.href) === "css")) { + onceStylesheetLoaded(n2, () => { + if (onStylesheetLoad) { + const serializedLinkNode = serializeNodeWithId(n2, { + doc: doc2, + mirror: mirror2, + blockClass, + blockSelector, + unblockSelector, + maskAllText, + maskTextClass, + unmaskTextClass, + maskTextSelector, + unmaskTextSelector, + skipChild: false, + inlineStylesheet, + maskInputOptions, + maskAttributeFn, + maskTextFn, + maskInputFn, + slimDOMOptions, + dataURLOptions, + inlineImages, + recordCanvas, + preserveWhiteSpace, + onSerialize, + onIframeLoad, + iframeLoadTimeout, + onStylesheetLoad, + stylesheetLoadTimeout, + keepIframeSrcFn + }); + if (serializedLinkNode) { + onStylesheetLoad(n2, serializedLinkNode); + } + } + }, stylesheetLoadTimeout); + } + return serializedNode; +} +__name(serializeNodeWithId, "serializeNodeWithId"); +function snapshot(n2, options4) { + const { mirror: mirror2 = new Mirror(), blockClass = "rr-block", blockSelector = null, unblockSelector = null, maskAllText = false, maskTextClass = "rr-mask", unmaskTextClass = null, maskTextSelector = null, unmaskTextSelector = null, inlineStylesheet = true, inlineImages = false, recordCanvas = false, maskAllInputs = false, maskAttributeFn, maskTextFn, maskInputFn, slimDOM = false, dataURLOptions, preserveWhiteSpace, onSerialize, onIframeLoad, iframeLoadTimeout, onStylesheetLoad, stylesheetLoadTimeout, keepIframeSrcFn = /* @__PURE__ */ __name(() => false, "keepIframeSrcFn") } = options4 || {}; + const maskInputOptions = maskAllInputs === true ? { + color: true, + date: true, + "datetime-local": true, + email: true, + month: true, + number: true, + range: true, + search: true, + tel: true, + text: true, + time: true, + url: true, + week: true, + textarea: true, + select: true + } : maskAllInputs === false ? {} : maskAllInputs; + const slimDOMOptions = slimDOM === true || slimDOM === "all" ? { + script: true, + comment: true, + headFavicon: true, + headWhitespace: true, + headMetaDescKeywords: slimDOM === "all", + headMetaSocial: true, + headMetaRobots: true, + headMetaHttpEquiv: true, + headMetaAuthorship: true, + headMetaVerification: true + } : slimDOM === false ? {} : slimDOM; + return serializeNodeWithId(n2, { + doc: n2, + mirror: mirror2, + blockClass, + blockSelector, + unblockSelector, + maskAllText, + maskTextClass, + unmaskTextClass, + maskTextSelector, + unmaskTextSelector, + skipChild: false, + inlineStylesheet, + maskInputOptions, + maskAttributeFn, + maskTextFn, + maskInputFn, + slimDOMOptions, + dataURLOptions, + inlineImages, + recordCanvas, + preserveWhiteSpace, + onSerialize, + onIframeLoad, + iframeLoadTimeout, + onStylesheetLoad, + stylesheetLoadTimeout, + keepIframeSrcFn, + newlyAddedElement: false + }); +} +__name(snapshot, "snapshot"); +function _optionalChain$4(ops) { + let lastAccessLHS = void 0; + let value4 = ops[0]; + let i2 = 1; + while (i2 < ops.length) { + const op = ops[i2]; + const fn = ops[i2 + 1]; + i2 += 2; + if ((op === "optionalAccess" || op === "optionalCall") && value4 == null) { + return void 0; + } + if (op === "access" || op === "optionalAccess") { + lastAccessLHS = value4; + value4 = fn(value4); + } else if (op === "call" || op === "optionalCall") { + value4 = fn((...args) => value4.call(lastAccessLHS, ...args)); + lastAccessLHS = void 0; + } + } + return value4; +} +__name(_optionalChain$4, "_optionalChain$4"); +function on(type, fn, target = document) { + const options4 = { capture: true, passive: true }; + target.addEventListener(type, fn, options4); + return () => target.removeEventListener(type, fn, options4); +} +__name(on, "on"); +const DEPARTED_MIRROR_ACCESS_WARNING$1 = "Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording."; +let _mirror$1 = { + map: {}, + getId() { + console.error(DEPARTED_MIRROR_ACCESS_WARNING$1); + return -1; + }, + getNode() { + console.error(DEPARTED_MIRROR_ACCESS_WARNING$1); + return null; + }, + removeNodeFromMap() { + console.error(DEPARTED_MIRROR_ACCESS_WARNING$1); + }, + has() { + console.error(DEPARTED_MIRROR_ACCESS_WARNING$1); + return false; + }, + reset() { + console.error(DEPARTED_MIRROR_ACCESS_WARNING$1); + } +}; +if (typeof window !== "undefined" && window.Proxy && window.Reflect) { + _mirror$1 = new Proxy(_mirror$1, { + get(target, prop2, receiver) { + if (prop2 === "map") { + console.error(DEPARTED_MIRROR_ACCESS_WARNING$1); + } + return Reflect.get(target, prop2, receiver); + } + }); +} +function throttle$1(func, wait, options4 = {}) { + let timeout = null; + let previous = 0; + return function(...args) { + const now2 = Date.now(); + if (!previous && options4.leading === false) { + previous = now2; + } + const remaining = wait - (now2 - previous); + const context = this; + if (remaining <= 0 || remaining > wait) { + if (timeout) { + clearTimeout$1(timeout); + timeout = null; + } + previous = now2; + func.apply(context, args); + } else if (!timeout && options4.trailing !== false) { + timeout = setTimeout$1$1(() => { + previous = options4.leading === false ? 0 : Date.now(); + timeout = null; + func.apply(context, args); + }, remaining); + } + }; +} +__name(throttle$1, "throttle$1"); +function hookSetter$1(target, key, d2, isRevoked, win = window) { + const original = win.Object.getOwnPropertyDescriptor(target, key); + win.Object.defineProperty(target, key, isRevoked ? d2 : { + set(value4) { + setTimeout$1$1(() => { + d2.set.call(this, value4); + }, 0); + if (original && original.set) { + original.set.call(this, value4); + } + } + }); + return () => hookSetter$1(target, key, original || {}, true); +} +__name(hookSetter$1, "hookSetter$1"); +function patch$2(source, name2, replacement) { + try { + if (!(name2 in source)) { + return () => { + }; + } + const original = source[name2]; + const wrapped = replacement(original); + if (typeof wrapped === "function") { + wrapped.prototype = wrapped.prototype || {}; + Object.defineProperties(wrapped, { + __rrweb_original__: { + enumerable: false, + value: original + } + }); + } + source[name2] = wrapped; + return () => { + source[name2] = original; + }; + } catch (e2) { + return () => { + }; + } +} +__name(patch$2, "patch$2"); +let nowTimestamp = Date.now; +if (!/[1-9][0-9]{12}/.test(Date.now().toString())) { + nowTimestamp = /* @__PURE__ */ __name(() => (/* @__PURE__ */ new Date()).getTime(), "nowTimestamp"); +} +function getWindowScroll(win) { + const doc2 = win.document; + return { + left: doc2.scrollingElement ? doc2.scrollingElement.scrollLeft : win.pageXOffset !== void 0 ? win.pageXOffset : _optionalChain$4([doc2, "optionalAccess", (_2) => _2.documentElement, "access", (_2) => _2.scrollLeft]) || _optionalChain$4([doc2, "optionalAccess", (_3) => _3.body, "optionalAccess", (_4) => _4.parentElement, "optionalAccess", (_5) => _5.scrollLeft]) || _optionalChain$4([doc2, "optionalAccess", (_6) => _6.body, "optionalAccess", (_7) => _7.scrollLeft]) || 0, + top: doc2.scrollingElement ? doc2.scrollingElement.scrollTop : win.pageYOffset !== void 0 ? win.pageYOffset : _optionalChain$4([doc2, "optionalAccess", (_8) => _8.documentElement, "access", (_9) => _9.scrollTop]) || _optionalChain$4([doc2, "optionalAccess", (_10) => _10.body, "optionalAccess", (_11) => _11.parentElement, "optionalAccess", (_12) => _12.scrollTop]) || _optionalChain$4([doc2, "optionalAccess", (_13) => _13.body, "optionalAccess", (_14) => _14.scrollTop]) || 0 + }; +} +__name(getWindowScroll, "getWindowScroll"); +function getWindowHeight() { + return window.innerHeight || document.documentElement && document.documentElement.clientHeight || document.body && document.body.clientHeight; +} +__name(getWindowHeight, "getWindowHeight"); +function getWindowWidth() { + return window.innerWidth || document.documentElement && document.documentElement.clientWidth || document.body && document.body.clientWidth; +} +__name(getWindowWidth, "getWindowWidth"); +function closestElementOfNode$1(node3) { + if (!node3) { + return null; + } + const el = node3.nodeType === node3.ELEMENT_NODE ? node3 : node3.parentElement; + return el; +} +__name(closestElementOfNode$1, "closestElementOfNode$1"); +function isBlocked$1(node3, blockClass, blockSelector, unblockSelector, checkAncestors) { + if (!node3) { + return false; + } + const el = closestElementOfNode$1(node3); + if (!el) { + return false; + } + const blockedPredicate = createMatchPredicate$1(blockClass, blockSelector); + if (!checkAncestors) { + const isUnblocked = unblockSelector && el.matches(unblockSelector); + return blockedPredicate(el) && !isUnblocked; + } + const blockDistance = distanceToMatch$1(el, blockedPredicate); + let unblockDistance = -1; + if (blockDistance < 0) { + return false; + } + if (unblockSelector) { + unblockDistance = distanceToMatch$1(el, createMatchPredicate$1(null, unblockSelector)); + } + if (blockDistance > -1 && unblockDistance < 0) { + return true; + } + return blockDistance < unblockDistance; +} +__name(isBlocked$1, "isBlocked$1"); +function isSerialized(n2, mirror2) { + return mirror2.getId(n2) !== -1; +} +__name(isSerialized, "isSerialized"); +function isIgnored(n2, mirror2) { + return mirror2.getId(n2) === IGNORED_NODE; +} +__name(isIgnored, "isIgnored"); +function isAncestorRemoved(target, mirror2) { + if (isShadowRoot(target)) { + return false; + } + const id3 = mirror2.getId(target); + if (!mirror2.has(id3)) { + return true; + } + if (target.parentNode && target.parentNode.nodeType === target.DOCUMENT_NODE) { + return false; + } + if (!target.parentNode) { + return true; + } + return isAncestorRemoved(target.parentNode, mirror2); +} +__name(isAncestorRemoved, "isAncestorRemoved"); +function legacy_isTouchEvent(event) { + return Boolean(event.changedTouches); +} +__name(legacy_isTouchEvent, "legacy_isTouchEvent"); +function polyfill(win = window) { + if ("NodeList" in win && !win.NodeList.prototype.forEach) { + win.NodeList.prototype.forEach = Array.prototype.forEach; + } + if ("DOMTokenList" in win && !win.DOMTokenList.prototype.forEach) { + win.DOMTokenList.prototype.forEach = Array.prototype.forEach; + } + if (!Node.prototype.contains) { + Node.prototype.contains = (...args) => { + let node3 = args[0]; + if (!(0 in args)) { + throw new TypeError("1 argument is required"); + } + do { + if (this === node3) { + return true; + } + } while (node3 = node3 && node3.parentNode); + return false; + }; + } +} +__name(polyfill, "polyfill"); +function isSerializedIframe(n2, mirror2) { + return Boolean(n2.nodeName === "IFRAME" && mirror2.getMeta(n2)); +} +__name(isSerializedIframe, "isSerializedIframe"); +function isSerializedStylesheet(n2, mirror2) { + return Boolean(n2.nodeName === "LINK" && n2.nodeType === n2.ELEMENT_NODE && n2.getAttribute && n2.getAttribute("rel") === "stylesheet" && mirror2.getMeta(n2)); +} +__name(isSerializedStylesheet, "isSerializedStylesheet"); +function hasShadowRoot(n2) { + return Boolean(_optionalChain$4([n2, "optionalAccess", (_18) => _18.shadowRoot])); +} +__name(hasShadowRoot, "hasShadowRoot"); +class StyleSheetMirror { + static { + __name(this, "StyleSheetMirror"); + } + constructor() { + this.id = 1; + this.styleIDMap = /* @__PURE__ */ new WeakMap(); + this.idStyleMap = /* @__PURE__ */ new Map(); + } + getId(stylesheet) { + return _nullishCoalesce(this.styleIDMap.get(stylesheet), () => -1); + } + has(stylesheet) { + return this.styleIDMap.has(stylesheet); + } + add(stylesheet, id3) { + if (this.has(stylesheet)) + return this.getId(stylesheet); + let newId; + if (id3 === void 0) { + newId = this.id++; + } else + newId = id3; + this.styleIDMap.set(stylesheet, newId); + this.idStyleMap.set(newId, stylesheet); + return newId; + } + getStyle(id3) { + return this.idStyleMap.get(id3) || null; + } + reset() { + this.styleIDMap = /* @__PURE__ */ new WeakMap(); + this.idStyleMap = /* @__PURE__ */ new Map(); + this.id = 1; + } + generateId() { + return this.id++; + } +} +function getShadowHost(n2) { + let shadowHost = null; + if (_optionalChain$4([n2, "access", (_19) => _19.getRootNode, "optionalCall", (_20) => _20(), "optionalAccess", (_21) => _21.nodeType]) === Node.DOCUMENT_FRAGMENT_NODE && n2.getRootNode().host) + shadowHost = n2.getRootNode().host; + return shadowHost; +} +__name(getShadowHost, "getShadowHost"); +function getRootShadowHost(n2) { + let rootShadowHost = n2; + let shadowHost; + while (shadowHost = getShadowHost(rootShadowHost)) + rootShadowHost = shadowHost; + return rootShadowHost; +} +__name(getRootShadowHost, "getRootShadowHost"); +function shadowHostInDom(n2) { + const doc2 = n2.ownerDocument; + if (!doc2) + return false; + const shadowHost = getRootShadowHost(n2); + return doc2.contains(shadowHost); +} +__name(shadowHostInDom, "shadowHostInDom"); +function inDom(n2) { + const doc2 = n2.ownerDocument; + if (!doc2) + return false; + return doc2.contains(n2) || shadowHostInDom(n2); +} +__name(inDom, "inDom"); +const cachedImplementations$2 = {}; +function getImplementation$2(name2) { + const cached = cachedImplementations$2[name2]; + if (cached) { + return cached; + } + const document2 = window.document; + let impl = window[name2]; + if (document2 && typeof document2.createElement === "function") { + try { + const sandbox = document2.createElement("iframe"); + sandbox.hidden = true; + document2.head.appendChild(sandbox); + const contentWindow = sandbox.contentWindow; + if (contentWindow && contentWindow[name2]) { + impl = contentWindow[name2]; + } + document2.head.removeChild(sandbox); + } catch (e2) { + } + } + return cachedImplementations$2[name2] = impl.bind(window); +} +__name(getImplementation$2, "getImplementation$2"); +function onRequestAnimationFrame$1(...rest) { + return getImplementation$2("requestAnimationFrame")(...rest); +} +__name(onRequestAnimationFrame$1, "onRequestAnimationFrame$1"); +function setTimeout$1$1(...rest) { + return getImplementation$2("setTimeout")(...rest); +} +__name(setTimeout$1$1, "setTimeout$1$1"); +function clearTimeout$1(...rest) { + return getImplementation$2("clearTimeout")(...rest); +} +__name(clearTimeout$1, "clearTimeout$1"); +var EventType = /* @__PURE__ */ ((EventType2) => { + EventType2[EventType2["DomContentLoaded"] = 0] = "DomContentLoaded"; + EventType2[EventType2["Load"] = 1] = "Load"; + EventType2[EventType2["FullSnapshot"] = 2] = "FullSnapshot"; + EventType2[EventType2["IncrementalSnapshot"] = 3] = "IncrementalSnapshot"; + EventType2[EventType2["Meta"] = 4] = "Meta"; + EventType2[EventType2["Custom"] = 5] = "Custom"; + EventType2[EventType2["Plugin"] = 6] = "Plugin"; + return EventType2; +})(EventType || {}); +var IncrementalSource = /* @__PURE__ */ ((IncrementalSource2) => { + IncrementalSource2[IncrementalSource2["Mutation"] = 0] = "Mutation"; + IncrementalSource2[IncrementalSource2["MouseMove"] = 1] = "MouseMove"; + IncrementalSource2[IncrementalSource2["MouseInteraction"] = 2] = "MouseInteraction"; + IncrementalSource2[IncrementalSource2["Scroll"] = 3] = "Scroll"; + IncrementalSource2[IncrementalSource2["ViewportResize"] = 4] = "ViewportResize"; + IncrementalSource2[IncrementalSource2["Input"] = 5] = "Input"; + IncrementalSource2[IncrementalSource2["TouchMove"] = 6] = "TouchMove"; + IncrementalSource2[IncrementalSource2["MediaInteraction"] = 7] = "MediaInteraction"; + IncrementalSource2[IncrementalSource2["StyleSheetRule"] = 8] = "StyleSheetRule"; + IncrementalSource2[IncrementalSource2["CanvasMutation"] = 9] = "CanvasMutation"; + IncrementalSource2[IncrementalSource2["Font"] = 10] = "Font"; + IncrementalSource2[IncrementalSource2["Log"] = 11] = "Log"; + IncrementalSource2[IncrementalSource2["Drag"] = 12] = "Drag"; + IncrementalSource2[IncrementalSource2["StyleDeclaration"] = 13] = "StyleDeclaration"; + IncrementalSource2[IncrementalSource2["Selection"] = 14] = "Selection"; + IncrementalSource2[IncrementalSource2["AdoptedStyleSheet"] = 15] = "AdoptedStyleSheet"; + IncrementalSource2[IncrementalSource2["CustomElement"] = 16] = "CustomElement"; + return IncrementalSource2; +})(IncrementalSource || {}); +var MouseInteractions = /* @__PURE__ */ ((MouseInteractions2) => { + MouseInteractions2[MouseInteractions2["MouseUp"] = 0] = "MouseUp"; + MouseInteractions2[MouseInteractions2["MouseDown"] = 1] = "MouseDown"; + MouseInteractions2[MouseInteractions2["Click"] = 2] = "Click"; + MouseInteractions2[MouseInteractions2["ContextMenu"] = 3] = "ContextMenu"; + MouseInteractions2[MouseInteractions2["DblClick"] = 4] = "DblClick"; + MouseInteractions2[MouseInteractions2["Focus"] = 5] = "Focus"; + MouseInteractions2[MouseInteractions2["Blur"] = 6] = "Blur"; + MouseInteractions2[MouseInteractions2["TouchStart"] = 7] = "TouchStart"; + MouseInteractions2[MouseInteractions2["TouchMove_Departed"] = 8] = "TouchMove_Departed"; + MouseInteractions2[MouseInteractions2["TouchEnd"] = 9] = "TouchEnd"; + MouseInteractions2[MouseInteractions2["TouchCancel"] = 10] = "TouchCancel"; + return MouseInteractions2; +})(MouseInteractions || {}); +var PointerTypes = /* @__PURE__ */ ((PointerTypes2) => { + PointerTypes2[PointerTypes2["Mouse"] = 0] = "Mouse"; + PointerTypes2[PointerTypes2["Pen"] = 1] = "Pen"; + PointerTypes2[PointerTypes2["Touch"] = 2] = "Touch"; + return PointerTypes2; +})(PointerTypes || {}); +var NodeType$1$1; +(function(NodeType3) { + NodeType3[NodeType3["Document"] = 0] = "Document"; + NodeType3[NodeType3["DocumentType"] = 1] = "DocumentType"; + NodeType3[NodeType3["Element"] = 2] = "Element"; + NodeType3[NodeType3["Text"] = 3] = "Text"; + NodeType3[NodeType3["CDATA"] = 4] = "CDATA"; + NodeType3[NodeType3["Comment"] = 5] = "Comment"; +})(NodeType$1$1 || (NodeType$1$1 = {})); +var NodeType$2$1; +(function(NodeType3) { + NodeType3[NodeType3["PLACEHOLDER"] = 0] = "PLACEHOLDER"; + NodeType3[NodeType3["ELEMENT_NODE"] = 1] = "ELEMENT_NODE"; + NodeType3[NodeType3["ATTRIBUTE_NODE"] = 2] = "ATTRIBUTE_NODE"; + NodeType3[NodeType3["TEXT_NODE"] = 3] = "TEXT_NODE"; + NodeType3[NodeType3["CDATA_SECTION_NODE"] = 4] = "CDATA_SECTION_NODE"; + NodeType3[NodeType3["ENTITY_REFERENCE_NODE"] = 5] = "ENTITY_REFERENCE_NODE"; + NodeType3[NodeType3["ENTITY_NODE"] = 6] = "ENTITY_NODE"; + NodeType3[NodeType3["PROCESSING_INSTRUCTION_NODE"] = 7] = "PROCESSING_INSTRUCTION_NODE"; + NodeType3[NodeType3["COMMENT_NODE"] = 8] = "COMMENT_NODE"; + NodeType3[NodeType3["DOCUMENT_NODE"] = 9] = "DOCUMENT_NODE"; + NodeType3[NodeType3["DOCUMENT_TYPE_NODE"] = 10] = "DOCUMENT_TYPE_NODE"; + NodeType3[NodeType3["DOCUMENT_FRAGMENT_NODE"] = 11] = "DOCUMENT_FRAGMENT_NODE"; +})(NodeType$2$1 || (NodeType$2$1 = {})); +function getIFrameContentDocument(iframe) { + try { + return iframe.contentDocument; + } catch (e2) { + } +} +__name(getIFrameContentDocument, "getIFrameContentDocument"); +function getIFrameContentWindow(iframe) { + try { + return iframe.contentWindow; + } catch (e2) { + } +} +__name(getIFrameContentWindow, "getIFrameContentWindow"); +function _optionalChain$3(ops) { + let lastAccessLHS = void 0; + let value4 = ops[0]; + let i2 = 1; + while (i2 < ops.length) { + const op = ops[i2]; + const fn = ops[i2 + 1]; + i2 += 2; + if ((op === "optionalAccess" || op === "optionalCall") && value4 == null) { + return void 0; + } + if (op === "access" || op === "optionalAccess") { + lastAccessLHS = value4; + value4 = fn(value4); + } else if (op === "call" || op === "optionalCall") { + value4 = fn((...args) => value4.call(lastAccessLHS, ...args)); + lastAccessLHS = void 0; + } + } + return value4; +} +__name(_optionalChain$3, "_optionalChain$3"); +function isNodeInLinkedList(n2) { + return "__ln" in n2; +} +__name(isNodeInLinkedList, "isNodeInLinkedList"); +class DoubleLinkedList { + static { + __name(this, "DoubleLinkedList"); + } + constructor() { + this.length = 0; + this.head = null; + this.tail = null; + } + get(position3) { + if (position3 >= this.length) { + throw new Error("Position outside of list range"); + } + let current = this.head; + for (let index2 = 0; index2 < position3; index2++) { + current = _optionalChain$3([current, "optionalAccess", (_2) => _2.next]) || null; + } + return current; + } + addNode(n2) { + const node3 = { + value: n2, + previous: null, + next: null + }; + n2.__ln = node3; + if (n2.previousSibling && isNodeInLinkedList(n2.previousSibling)) { + const current = n2.previousSibling.__ln.next; + node3.next = current; + node3.previous = n2.previousSibling.__ln; + n2.previousSibling.__ln.next = node3; + if (current) { + current.previous = node3; + } + } else if (n2.nextSibling && isNodeInLinkedList(n2.nextSibling) && n2.nextSibling.__ln.previous) { + const current = n2.nextSibling.__ln.previous; + node3.previous = current; + node3.next = n2.nextSibling.__ln; + n2.nextSibling.__ln.previous = node3; + if (current) { + current.next = node3; + } + } else { + if (this.head) { + this.head.previous = node3; + } + node3.next = this.head; + this.head = node3; + } + if (node3.next === null) { + this.tail = node3; + } + this.length++; + } + removeNode(n2) { + const current = n2.__ln; + if (!this.head) { + return; + } + if (!current.previous) { + this.head = current.next; + if (this.head) { + this.head.previous = null; + } else { + this.tail = null; + } + } else { + current.previous.next = current.next; + if (current.next) { + current.next.previous = current.previous; + } else { + this.tail = current.previous; + } + } + if (n2.__ln) { + delete n2.__ln; + } + this.length--; + } +} +const moveKey = /* @__PURE__ */ __name((id3, parentId) => `${id3}@${parentId}`, "moveKey"); +class MutationBuffer { + static { + __name(this, "MutationBuffer"); + } + constructor() { + this.frozen = false; + this.locked = false; + this.texts = []; + this.attributes = []; + this.attributeMap = /* @__PURE__ */ new WeakMap(); + this.removes = []; + this.mapRemoves = []; + this.movedMap = {}; + this.addedSet = /* @__PURE__ */ new Set(); + this.movedSet = /* @__PURE__ */ new Set(); + this.droppedSet = /* @__PURE__ */ new Set(); + this.processMutations = (mutations) => { + mutations.forEach(this.processMutation); + this.emit(); + }; + this.emit = () => { + if (this.frozen || this.locked) { + return; + } + const adds = []; + const addedIds = /* @__PURE__ */ new Set(); + const addList = new DoubleLinkedList(); + const getNextId = /* @__PURE__ */ __name((n2) => { + let ns = n2; + let nextId = IGNORED_NODE; + while (nextId === IGNORED_NODE) { + ns = ns && ns.nextSibling; + nextId = ns && this.mirror.getId(ns); + } + return nextId; + }, "getNextId"); + const pushAdd = /* @__PURE__ */ __name((n2) => { + if (!n2.parentNode || !inDom(n2)) { + return; + } + const parentId = isShadowRoot(n2.parentNode) ? this.mirror.getId(getShadowHost(n2)) : this.mirror.getId(n2.parentNode); + const nextId = getNextId(n2); + if (parentId === -1 || nextId === -1) { + return addList.addNode(n2); + } + const sn = serializeNodeWithId(n2, { + doc: this.doc, + mirror: this.mirror, + blockClass: this.blockClass, + blockSelector: this.blockSelector, + maskAllText: this.maskAllText, + unblockSelector: this.unblockSelector, + maskTextClass: this.maskTextClass, + unmaskTextClass: this.unmaskTextClass, + maskTextSelector: this.maskTextSelector, + unmaskTextSelector: this.unmaskTextSelector, + skipChild: true, + newlyAddedElement: true, + inlineStylesheet: this.inlineStylesheet, + maskInputOptions: this.maskInputOptions, + maskAttributeFn: this.maskAttributeFn, + maskTextFn: this.maskTextFn, + maskInputFn: this.maskInputFn, + slimDOMOptions: this.slimDOMOptions, + dataURLOptions: this.dataURLOptions, + recordCanvas: this.recordCanvas, + inlineImages: this.inlineImages, + onSerialize: /* @__PURE__ */ __name((currentN) => { + if (isSerializedIframe(currentN, this.mirror) && !isBlocked$1(currentN, this.blockClass, this.blockSelector, this.unblockSelector, false)) { + this.iframeManager.addIframe(currentN); + } + if (isSerializedStylesheet(currentN, this.mirror)) { + this.stylesheetManager.trackLinkElement(currentN); + } + if (hasShadowRoot(n2)) { + this.shadowDomManager.addShadowRoot(n2.shadowRoot, this.doc); + } + }, "onSerialize"), + onIframeLoad: /* @__PURE__ */ __name((iframe, childSn) => { + if (isBlocked$1(iframe, this.blockClass, this.blockSelector, this.unblockSelector, false)) { + return; + } + this.iframeManager.attachIframe(iframe, childSn); + if (iframe.contentWindow) { + this.canvasManager.addWindow(iframe.contentWindow); + } + this.shadowDomManager.observeAttachShadow(iframe); + }, "onIframeLoad"), + onStylesheetLoad: /* @__PURE__ */ __name((link2, childSn) => { + this.stylesheetManager.attachLinkElement(link2, childSn); + }, "onStylesheetLoad") + }); + if (sn) { + adds.push({ + parentId, + nextId, + node: sn + }); + addedIds.add(sn.id); + } + }, "pushAdd"); + while (this.mapRemoves.length) { + this.mirror.removeNodeFromMap(this.mapRemoves.shift()); + } + for (const n2 of this.movedSet) { + if (isParentRemoved(this.removes, n2, this.mirror) && !this.movedSet.has(n2.parentNode)) { + continue; + } + pushAdd(n2); + } + for (const n2 of this.addedSet) { + if (!isAncestorInSet(this.droppedSet, n2) && !isParentRemoved(this.removes, n2, this.mirror)) { + pushAdd(n2); + } else if (isAncestorInSet(this.movedSet, n2)) { + pushAdd(n2); + } else { + this.droppedSet.add(n2); + } + } + let candidate = null; + while (addList.length) { + let node3 = null; + if (candidate) { + const parentId = this.mirror.getId(candidate.value.parentNode); + const nextId = getNextId(candidate.value); + if (parentId !== -1 && nextId !== -1) { + node3 = candidate; + } + } + if (!node3) { + let tailNode = addList.tail; + while (tailNode) { + const _node = tailNode; + tailNode = tailNode.previous; + if (_node) { + const parentId = this.mirror.getId(_node.value.parentNode); + const nextId = getNextId(_node.value); + if (nextId === -1) + continue; + else if (parentId !== -1) { + node3 = _node; + break; + } else { + const unhandledNode = _node.value; + if (unhandledNode.parentNode && unhandledNode.parentNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE) { + const shadowHost = unhandledNode.parentNode.host; + const parentId2 = this.mirror.getId(shadowHost); + if (parentId2 !== -1) { + node3 = _node; + break; + } + } + } + } + } + } + if (!node3) { + while (addList.head) { + addList.removeNode(addList.head.value); + } + break; + } + candidate = node3.previous; + addList.removeNode(node3.value); + pushAdd(node3.value); + } + const payload = { + texts: this.texts.map((text2) => ({ + id: this.mirror.getId(text2.node), + value: text2.value + })).filter((text2) => !addedIds.has(text2.id)).filter((text2) => this.mirror.has(text2.id)), + attributes: this.attributes.map((attribute2) => { + const { attributes } = attribute2; + if (typeof attributes.style === "string") { + const diffAsStr = JSON.stringify(attribute2.styleDiff); + const unchangedAsStr = JSON.stringify(attribute2._unchangedStyles); + if (diffAsStr.length < attributes.style.length) { + if ((diffAsStr + unchangedAsStr).split("var(").length === attributes.style.split("var(").length) { + attributes.style = attribute2.styleDiff; + } + } + } + return { + id: this.mirror.getId(attribute2.node), + attributes + }; + }).filter((attribute2) => !addedIds.has(attribute2.id)).filter((attribute2) => this.mirror.has(attribute2.id)), + removes: this.removes, + adds + }; + if (!payload.texts.length && !payload.attributes.length && !payload.removes.length && !payload.adds.length) { + return; + } + this.texts = []; + this.attributes = []; + this.attributeMap = /* @__PURE__ */ new WeakMap(); + this.removes = []; + this.addedSet = /* @__PURE__ */ new Set(); + this.movedSet = /* @__PURE__ */ new Set(); + this.droppedSet = /* @__PURE__ */ new Set(); + this.movedMap = {}; + this.mutationCb(payload); + }; + this.processMutation = (m2) => { + if (isIgnored(m2.target, this.mirror)) { + return; + } + switch (m2.type) { + case "characterData": { + const value4 = m2.target.textContent; + if (!isBlocked$1(m2.target, this.blockClass, this.blockSelector, this.unblockSelector, false) && value4 !== m2.oldValue) { + this.texts.push({ + value: needMaskingText(m2.target, this.maskTextClass, this.maskTextSelector, this.unmaskTextClass, this.unmaskTextSelector, this.maskAllText) && value4 ? this.maskTextFn ? this.maskTextFn(value4, closestElementOfNode$1(m2.target)) : value4.replace(/[\S]/g, "*") : value4, + node: m2.target + }); + } + break; + } + case "attributes": { + const target = m2.target; + let attributeName = m2.attributeName; + let value4 = m2.target.getAttribute(attributeName); + if (attributeName === "value") { + const type = getInputType(target); + const tagName = target.tagName; + value4 = getInputValue(target, tagName, type); + const isInputMasked = shouldMaskInput({ + maskInputOptions: this.maskInputOptions, + tagName, + type + }); + const forceMask = needMaskingText(m2.target, this.maskTextClass, this.maskTextSelector, this.unmaskTextClass, this.unmaskTextSelector, isInputMasked); + value4 = maskInputValue({ + isMasked: forceMask, + element: target, + value: value4, + maskInputFn: this.maskInputFn + }); + } + if (isBlocked$1(m2.target, this.blockClass, this.blockSelector, this.unblockSelector, false) || value4 === m2.oldValue) { + return; + } + let item3 = this.attributeMap.get(m2.target); + if (target.tagName === "IFRAME" && attributeName === "src" && !this.keepIframeSrcFn(value4)) { + const iframeDoc = getIFrameContentDocument(target); + if (!iframeDoc) { + attributeName = "rr_src"; + } else { + return; + } + } + if (!item3) { + item3 = { + node: m2.target, + attributes: {}, + styleDiff: {}, + _unchangedStyles: {} + }; + this.attributes.push(item3); + this.attributeMap.set(m2.target, item3); + } + if (attributeName === "type" && target.tagName === "INPUT" && (m2.oldValue || "").toLowerCase() === "password") { + target.setAttribute("data-rr-is-password", "true"); + } + if (!ignoreAttribute(target.tagName, attributeName)) { + item3.attributes[attributeName] = transformAttribute(this.doc, toLowerCase(target.tagName), toLowerCase(attributeName), value4, target, this.maskAttributeFn); + if (attributeName === "style") { + if (!this.unattachedDoc) { + try { + this.unattachedDoc = document.implementation.createHTMLDocument(); + } catch (e2) { + this.unattachedDoc = this.doc; + } + } + const old = this.unattachedDoc.createElement("span"); + if (m2.oldValue) { + old.setAttribute("style", m2.oldValue); + } + for (const pname of Array.from(target.style)) { + const newValue2 = target.style.getPropertyValue(pname); + const newPriority = target.style.getPropertyPriority(pname); + if (newValue2 !== old.style.getPropertyValue(pname) || newPriority !== old.style.getPropertyPriority(pname)) { + if (newPriority === "") { + item3.styleDiff[pname] = newValue2; + } else { + item3.styleDiff[pname] = [newValue2, newPriority]; + } + } else { + item3._unchangedStyles[pname] = [newValue2, newPriority]; + } + } + for (const pname of Array.from(old.style)) { + if (target.style.getPropertyValue(pname) === "") { + item3.styleDiff[pname] = false; + } + } + } + } + break; + } + case "childList": { + if (isBlocked$1(m2.target, this.blockClass, this.blockSelector, this.unblockSelector, true)) { + return; + } + m2.addedNodes.forEach((n2) => this.genAdds(n2, m2.target)); + m2.removedNodes.forEach((n2) => { + const nodeId = this.mirror.getId(n2); + const parentId = isShadowRoot(m2.target) ? this.mirror.getId(m2.target.host) : this.mirror.getId(m2.target); + if (isBlocked$1(m2.target, this.blockClass, this.blockSelector, this.unblockSelector, false) || isIgnored(n2, this.mirror) || !isSerialized(n2, this.mirror)) { + return; + } + if (this.addedSet.has(n2)) { + deepDelete(this.addedSet, n2); + this.droppedSet.add(n2); + } else if (this.addedSet.has(m2.target) && nodeId === -1) ; + else if (isAncestorRemoved(m2.target, this.mirror)) ; + else if (this.movedSet.has(n2) && this.movedMap[moveKey(nodeId, parentId)]) { + deepDelete(this.movedSet, n2); + } else { + this.removes.push({ + parentId, + id: nodeId, + isShadow: isShadowRoot(m2.target) && isNativeShadowDom(m2.target) ? true : void 0 + }); + } + this.mapRemoves.push(n2); + }); + break; + } + } + }; + this.genAdds = (n2, target) => { + if (this.processedNodeManager.inOtherBuffer(n2, this)) + return; + if (this.addedSet.has(n2) || this.movedSet.has(n2)) + return; + if (this.mirror.hasNode(n2)) { + if (isIgnored(n2, this.mirror)) { + return; + } + this.movedSet.add(n2); + let targetId = null; + if (target && this.mirror.hasNode(target)) { + targetId = this.mirror.getId(target); + } + if (targetId && targetId !== -1) { + this.movedMap[moveKey(this.mirror.getId(n2), targetId)] = true; + } + } else { + this.addedSet.add(n2); + this.droppedSet.delete(n2); + } + if (!isBlocked$1(n2, this.blockClass, this.blockSelector, this.unblockSelector, false)) { + n2.childNodes.forEach((childN) => this.genAdds(childN)); + if (hasShadowRoot(n2)) { + n2.shadowRoot.childNodes.forEach((childN) => { + this.processedNodeManager.add(childN, this); + this.genAdds(childN, n2); + }); + } + } + }; + } + init(options4) { + [ + "mutationCb", + "blockClass", + "blockSelector", + "unblockSelector", + "maskAllText", + "maskTextClass", + "unmaskTextClass", + "maskTextSelector", + "unmaskTextSelector", + "inlineStylesheet", + "maskInputOptions", + "maskAttributeFn", + "maskTextFn", + "maskInputFn", + "keepIframeSrcFn", + "recordCanvas", + "inlineImages", + "slimDOMOptions", + "dataURLOptions", + "doc", + "mirror", + "iframeManager", + "stylesheetManager", + "shadowDomManager", + "canvasManager", + "processedNodeManager" + ].forEach((key) => { + this[key] = options4[key]; + }); + } + freeze() { + this.frozen = true; + this.canvasManager.freeze(); + } + unfreeze() { + this.frozen = false; + this.canvasManager.unfreeze(); + this.emit(); + } + isFrozen() { + return this.frozen; + } + lock() { + this.locked = true; + this.canvasManager.lock(); + } + unlock() { + this.locked = false; + this.canvasManager.unlock(); + this.emit(); + } + reset() { + this.shadowDomManager.reset(); + this.canvasManager.reset(); + } +} +function deepDelete(addsSet, n2) { + addsSet.delete(n2); + n2.childNodes.forEach((childN) => deepDelete(addsSet, childN)); +} +__name(deepDelete, "deepDelete"); +function isParentRemoved(removes, n2, mirror2) { + if (removes.length === 0) + return false; + return _isParentRemoved(removes, n2, mirror2); +} +__name(isParentRemoved, "isParentRemoved"); +function _isParentRemoved(removes, n2, mirror2) { + let node3 = n2.parentNode; + while (node3) { + const parentId = mirror2.getId(node3); + if (removes.some((r2) => r2.id === parentId)) { + return true; + } + node3 = node3.parentNode; + } + return false; +} +__name(_isParentRemoved, "_isParentRemoved"); +function isAncestorInSet(set3, n2) { + if (set3.size === 0) + return false; + return _isAncestorInSet(set3, n2); +} +__name(isAncestorInSet, "isAncestorInSet"); +function _isAncestorInSet(set3, n2) { + const { parentNode: parentNode2 } = n2; + if (!parentNode2) { + return false; + } + if (set3.has(parentNode2)) { + return true; + } + return _isAncestorInSet(set3, parentNode2); +} +__name(_isAncestorInSet, "_isAncestorInSet"); +let errorHandler$1; +function registerErrorHandler$1(handler6) { + errorHandler$1 = handler6; +} +__name(registerErrorHandler$1, "registerErrorHandler$1"); +function unregisterErrorHandler() { + errorHandler$1 = void 0; +} +__name(unregisterErrorHandler, "unregisterErrorHandler"); +const callbackWrapper$1 = /* @__PURE__ */ __name((cb) => { + if (!errorHandler$1) { + return cb; + } + const rrwebWrapped = /* @__PURE__ */ __name((...rest) => { + try { + return cb(...rest); + } catch (error2) { + if (errorHandler$1 && errorHandler$1(error2) === true) { + return () => { + }; + } + throw error2; + } + }, "rrwebWrapped"); + return rrwebWrapped; +}, "callbackWrapper$1"); +function _optionalChain$2(ops) { + let lastAccessLHS = void 0; + let value4 = ops[0]; + let i2 = 1; + while (i2 < ops.length) { + const op = ops[i2]; + const fn = ops[i2 + 1]; + i2 += 2; + if ((op === "optionalAccess" || op === "optionalCall") && value4 == null) { + return void 0; + } + if (op === "access" || op === "optionalAccess") { + lastAccessLHS = value4; + value4 = fn(value4); + } else if (op === "call" || op === "optionalCall") { + value4 = fn((...args) => value4.call(lastAccessLHS, ...args)); + lastAccessLHS = void 0; + } + } + return value4; +} +__name(_optionalChain$2, "_optionalChain$2"); +const mutationBuffers = []; +function getEventTarget(event) { + try { + if ("composedPath" in event) { + const path = event.composedPath(); + if (path.length) { + return path[0]; + } + } else if ("path" in event && event.path.length) { + return event.path[0]; + } + } catch (e2) { + } + return event && event.target; +} +__name(getEventTarget, "getEventTarget"); +function initMutationObserver(options4, rootEl) { + const mutationBuffer = new MutationBuffer(); + mutationBuffers.push(mutationBuffer); + mutationBuffer.init(options4); + let mutationObserverCtor = window.MutationObserver || window.__rrMutationObserver; + const angularZoneSymbol = _optionalChain$2([window, "optionalAccess", (_2) => _2.Zone, "optionalAccess", (_2) => _2.__symbol__, "optionalCall", (_3) => _3("MutationObserver")]); + if (angularZoneSymbol && window[angularZoneSymbol]) { + mutationObserverCtor = window[angularZoneSymbol]; + } + const observer = new mutationObserverCtor(callbackWrapper$1((mutations) => { + if (options4.onMutation && options4.onMutation(mutations) === false) { + return; + } + mutationBuffer.processMutations.bind(mutationBuffer)(mutations); + })); + observer.observe(rootEl, { + attributes: true, + attributeOldValue: true, + characterData: true, + characterDataOldValue: true, + childList: true, + subtree: true + }); + return observer; +} +__name(initMutationObserver, "initMutationObserver"); +function initMoveObserver({ mousemoveCb, sampling, doc: doc2, mirror: mirror2 }) { + if (sampling.mousemove === false) { + return () => { + }; + } + const threshold = typeof sampling.mousemove === "number" ? sampling.mousemove : 50; + const callbackThreshold = typeof sampling.mousemoveCallback === "number" ? sampling.mousemoveCallback : 500; + let positions = []; + let timeBaseline; + const wrappedCb = throttle$1(callbackWrapper$1((source) => { + const totalOffset = Date.now() - timeBaseline; + mousemoveCb(positions.map((p2) => { + p2.timeOffset -= totalOffset; + return p2; + }), source); + positions = []; + timeBaseline = null; + }), callbackThreshold); + const updatePosition = callbackWrapper$1(throttle$1(callbackWrapper$1((evt) => { + const target = getEventTarget(evt); + const { clientX, clientY } = legacy_isTouchEvent(evt) ? evt.changedTouches[0] : evt; + if (!timeBaseline) { + timeBaseline = nowTimestamp(); + } + positions.push({ + x: clientX, + y: clientY, + id: mirror2.getId(target), + timeOffset: nowTimestamp() - timeBaseline + }); + wrappedCb(typeof DragEvent !== "undefined" && evt instanceof DragEvent ? IncrementalSource.Drag : evt instanceof MouseEvent ? IncrementalSource.MouseMove : IncrementalSource.TouchMove); + }), threshold, { + trailing: false + })); + const handlers2 = [ + on("mousemove", updatePosition, doc2), + on("touchmove", updatePosition, doc2), + on("drag", updatePosition, doc2) + ]; + return callbackWrapper$1(() => { + handlers2.forEach((h2) => h2()); + }); +} +__name(initMoveObserver, "initMoveObserver"); +function initMouseInteractionObserver({ mouseInteractionCb, doc: doc2, mirror: mirror2, blockClass, blockSelector, unblockSelector, sampling }) { + if (sampling.mouseInteraction === false) { + return () => { + }; + } + const disableMap = sampling.mouseInteraction === true || sampling.mouseInteraction === void 0 ? {} : sampling.mouseInteraction; + const handlers2 = []; + let currentPointerType = null; + const getHandler = /* @__PURE__ */ __name((eventKey) => { + return (event) => { + const target = getEventTarget(event); + if (isBlocked$1(target, blockClass, blockSelector, unblockSelector, true)) { + return; + } + let pointerType = null; + let thisEventKey = eventKey; + if ("pointerType" in event) { + switch (event.pointerType) { + case "mouse": + pointerType = PointerTypes.Mouse; + break; + case "touch": + pointerType = PointerTypes.Touch; + break; + case "pen": + pointerType = PointerTypes.Pen; + break; + } + if (pointerType === PointerTypes.Touch) { + if (MouseInteractions[eventKey] === MouseInteractions.MouseDown) { + thisEventKey = "TouchStart"; + } else if (MouseInteractions[eventKey] === MouseInteractions.MouseUp) { + thisEventKey = "TouchEnd"; + } + } else if (pointerType === PointerTypes.Pen) ; + } else if (legacy_isTouchEvent(event)) { + pointerType = PointerTypes.Touch; + } + if (pointerType !== null) { + currentPointerType = pointerType; + if (thisEventKey.startsWith("Touch") && pointerType === PointerTypes.Touch || thisEventKey.startsWith("Mouse") && pointerType === PointerTypes.Mouse) { + pointerType = null; + } + } else if (MouseInteractions[eventKey] === MouseInteractions.Click) { + pointerType = currentPointerType; + currentPointerType = null; + } + const e2 = legacy_isTouchEvent(event) ? event.changedTouches[0] : event; + if (!e2) { + return; + } + const id3 = mirror2.getId(target); + const { clientX, clientY } = e2; + callbackWrapper$1(mouseInteractionCb)({ + type: MouseInteractions[thisEventKey], + id: id3, + x: clientX, + y: clientY, + ...pointerType !== null && { pointerType } + }); + }; + }, "getHandler"); + Object.keys(MouseInteractions).filter((key) => Number.isNaN(Number(key)) && !key.endsWith("_Departed") && disableMap[key] !== false).forEach((eventKey) => { + let eventName = toLowerCase(eventKey); + const handler6 = getHandler(eventKey); + if (window.PointerEvent) { + switch (MouseInteractions[eventKey]) { + case MouseInteractions.MouseDown: + case MouseInteractions.MouseUp: + eventName = eventName.replace("mouse", "pointer"); + break; + case MouseInteractions.TouchStart: + case MouseInteractions.TouchEnd: + return; + } + } + handlers2.push(on(eventName, handler6, doc2)); + }); + return callbackWrapper$1(() => { + handlers2.forEach((h2) => h2()); + }); +} +__name(initMouseInteractionObserver, "initMouseInteractionObserver"); +function initScrollObserver({ scrollCb, doc: doc2, mirror: mirror2, blockClass, blockSelector, unblockSelector, sampling }) { + const updatePosition = callbackWrapper$1(throttle$1(callbackWrapper$1((evt) => { + const target = getEventTarget(evt); + if (!target || isBlocked$1(target, blockClass, blockSelector, unblockSelector, true)) { + return; + } + const id3 = mirror2.getId(target); + if (target === doc2 && doc2.defaultView) { + const scrollLeftTop = getWindowScroll(doc2.defaultView); + scrollCb({ + id: id3, + x: scrollLeftTop.left, + y: scrollLeftTop.top + }); + } else { + scrollCb({ + id: id3, + x: target.scrollLeft, + y: target.scrollTop + }); + } + }), sampling.scroll || 100)); + return on("scroll", updatePosition, doc2); +} +__name(initScrollObserver, "initScrollObserver"); +function initViewportResizeObserver({ viewportResizeCb }, { win }) { + let lastH = -1; + let lastW = -1; + const updateDimension = callbackWrapper$1(throttle$1(callbackWrapper$1(() => { + const height = getWindowHeight(); + const width2 = getWindowWidth(); + if (lastH !== height || lastW !== width2) { + viewportResizeCb({ + width: Number(width2), + height: Number(height) + }); + lastH = height; + lastW = width2; + } + }), 200)); + return on("resize", updateDimension, win); +} +__name(initViewportResizeObserver, "initViewportResizeObserver"); +const INPUT_TAGS = ["INPUT", "TEXTAREA", "SELECT"]; +const lastInputValueMap = /* @__PURE__ */ new WeakMap(); +function initInputObserver({ inputCb, doc: doc2, mirror: mirror2, blockClass, blockSelector, unblockSelector, ignoreClass, ignoreSelector, maskInputOptions, maskInputFn, sampling, userTriggeredOnInput, maskTextClass, unmaskTextClass, maskTextSelector, unmaskTextSelector }) { + function eventHandler(event) { + let target = getEventTarget(event); + const userTriggered = event.isTrusted; + const tagName = target && toUpperCase(target.tagName); + if (tagName === "OPTION") + target = target.parentElement; + if (!target || !tagName || INPUT_TAGS.indexOf(tagName) < 0 || isBlocked$1(target, blockClass, blockSelector, unblockSelector, true)) { + return; + } + const el = target; + if (el.classList.contains(ignoreClass) || ignoreSelector && el.matches(ignoreSelector)) { + return; + } + const type = getInputType(target); + let text2 = getInputValue(el, tagName, type); + let isChecked2 = false; + const isInputMasked = shouldMaskInput({ + maskInputOptions, + tagName, + type + }); + const forceMask = needMaskingText(target, maskTextClass, maskTextSelector, unmaskTextClass, unmaskTextSelector, isInputMasked); + if (type === "radio" || type === "checkbox") { + isChecked2 = target.checked; + } + text2 = maskInputValue({ + isMasked: forceMask, + element: target, + value: text2, + maskInputFn + }); + cbWithDedup(target, userTriggeredOnInput ? { text: text2, isChecked: isChecked2, userTriggered } : { text: text2, isChecked: isChecked2 }); + const name2 = target.name; + if (type === "radio" && name2 && isChecked2) { + doc2.querySelectorAll(`input[type="radio"][name="${name2}"]`).forEach((el2) => { + if (el2 !== target) { + const text3 = maskInputValue({ + isMasked: forceMask, + element: el2, + value: getInputValue(el2, tagName, type), + maskInputFn + }); + cbWithDedup(el2, userTriggeredOnInput ? { text: text3, isChecked: !isChecked2, userTriggered: false } : { text: text3, isChecked: !isChecked2 }); + } + }); + } + } + __name(eventHandler, "eventHandler"); + function cbWithDedup(target, v2) { + const lastInputValue = lastInputValueMap.get(target); + if (!lastInputValue || lastInputValue.text !== v2.text || lastInputValue.isChecked !== v2.isChecked) { + lastInputValueMap.set(target, v2); + const id3 = mirror2.getId(target); + callbackWrapper$1(inputCb)({ + ...v2, + id: id3 + }); + } + } + __name(cbWithDedup, "cbWithDedup"); + const events2 = sampling.input === "last" ? ["change"] : ["input", "change"]; + const handlers2 = events2.map((eventName) => on(eventName, callbackWrapper$1(eventHandler), doc2)); + const currentWindow = doc2.defaultView; + if (!currentWindow) { + return () => { + handlers2.forEach((h2) => h2()); + }; + } + const propertyDescriptor = currentWindow.Object.getOwnPropertyDescriptor(currentWindow.HTMLInputElement.prototype, "value"); + const hookProperties = [ + [currentWindow.HTMLInputElement.prototype, "value"], + [currentWindow.HTMLInputElement.prototype, "checked"], + [currentWindow.HTMLSelectElement.prototype, "value"], + [currentWindow.HTMLTextAreaElement.prototype, "value"], + [currentWindow.HTMLSelectElement.prototype, "selectedIndex"], + [currentWindow.HTMLOptionElement.prototype, "selected"] + ]; + if (propertyDescriptor && propertyDescriptor.set) { + handlers2.push(...hookProperties.map((p2) => hookSetter$1(p2[0], p2[1], { + set() { + callbackWrapper$1(eventHandler)({ + target: this, + isTrusted: false + }); + } + }, false, currentWindow))); + } + return callbackWrapper$1(() => { + handlers2.forEach((h2) => h2()); + }); +} +__name(initInputObserver, "initInputObserver"); +function getNestedCSSRulePositions(rule) { + const positions = []; + function recurse(childRule, pos2) { + if (hasNestedCSSRule("CSSGroupingRule") && childRule.parentRule instanceof CSSGroupingRule || hasNestedCSSRule("CSSMediaRule") && childRule.parentRule instanceof CSSMediaRule || hasNestedCSSRule("CSSSupportsRule") && childRule.parentRule instanceof CSSSupportsRule || hasNestedCSSRule("CSSConditionRule") && childRule.parentRule instanceof CSSConditionRule) { + const rules = Array.from(childRule.parentRule.cssRules); + const index2 = rules.indexOf(childRule); + pos2.unshift(index2); + } else if (childRule.parentStyleSheet) { + const rules = Array.from(childRule.parentStyleSheet.cssRules); + const index2 = rules.indexOf(childRule); + pos2.unshift(index2); + } + return pos2; + } + __name(recurse, "recurse"); + return recurse(rule, positions); +} +__name(getNestedCSSRulePositions, "getNestedCSSRulePositions"); +function getIdAndStyleId(sheet, mirror2, styleMirror) { + let id3, styleId; + if (!sheet) + return {}; + if (sheet.ownerNode) + id3 = mirror2.getId(sheet.ownerNode); + else + styleId = styleMirror.getId(sheet); + return { + styleId, + id: id3 + }; +} +__name(getIdAndStyleId, "getIdAndStyleId"); +function initStyleSheetObserver({ styleSheetRuleCb, mirror: mirror2, stylesheetManager }, { win }) { + if (!win.CSSStyleSheet || !win.CSSStyleSheet.prototype) { + return () => { + }; + } + const insertRule = win.CSSStyleSheet.prototype.insertRule; + win.CSSStyleSheet.prototype.insertRule = new Proxy(insertRule, { + apply: callbackWrapper$1((target, thisArg, argumentsList) => { + const [rule, index2] = argumentsList; + const { id: id3, styleId } = getIdAndStyleId(thisArg, mirror2, stylesheetManager.styleMirror); + if (id3 && id3 !== -1 || styleId && styleId !== -1) { + styleSheetRuleCb({ + id: id3, + styleId, + adds: [{ rule, index: index2 }] + }); + } + return target.apply(thisArg, argumentsList); + }) + }); + const deleteRule = win.CSSStyleSheet.prototype.deleteRule; + win.CSSStyleSheet.prototype.deleteRule = new Proxy(deleteRule, { + apply: callbackWrapper$1((target, thisArg, argumentsList) => { + const [index2] = argumentsList; + const { id: id3, styleId } = getIdAndStyleId(thisArg, mirror2, stylesheetManager.styleMirror); + if (id3 && id3 !== -1 || styleId && styleId !== -1) { + styleSheetRuleCb({ + id: id3, + styleId, + removes: [{ index: index2 }] + }); + } + return target.apply(thisArg, argumentsList); + }) + }); + let replace2; + if (win.CSSStyleSheet.prototype.replace) { + replace2 = win.CSSStyleSheet.prototype.replace; + win.CSSStyleSheet.prototype.replace = new Proxy(replace2, { + apply: callbackWrapper$1((target, thisArg, argumentsList) => { + const [text2] = argumentsList; + const { id: id3, styleId } = getIdAndStyleId(thisArg, mirror2, stylesheetManager.styleMirror); + if (id3 && id3 !== -1 || styleId && styleId !== -1) { + styleSheetRuleCb({ + id: id3, + styleId, + replace: text2 + }); + } + return target.apply(thisArg, argumentsList); + }) + }); + } + let replaceSync; + if (win.CSSStyleSheet.prototype.replaceSync) { + replaceSync = win.CSSStyleSheet.prototype.replaceSync; + win.CSSStyleSheet.prototype.replaceSync = new Proxy(replaceSync, { + apply: callbackWrapper$1((target, thisArg, argumentsList) => { + const [text2] = argumentsList; + const { id: id3, styleId } = getIdAndStyleId(thisArg, mirror2, stylesheetManager.styleMirror); + if (id3 && id3 !== -1 || styleId && styleId !== -1) { + styleSheetRuleCb({ + id: id3, + styleId, + replaceSync: text2 + }); + } + return target.apply(thisArg, argumentsList); + }) + }); + } + const supportedNestedCSSRuleTypes = {}; + if (canMonkeyPatchNestedCSSRule("CSSGroupingRule")) { + supportedNestedCSSRuleTypes.CSSGroupingRule = win.CSSGroupingRule; + } else { + if (canMonkeyPatchNestedCSSRule("CSSMediaRule")) { + supportedNestedCSSRuleTypes.CSSMediaRule = win.CSSMediaRule; + } + if (canMonkeyPatchNestedCSSRule("CSSConditionRule")) { + supportedNestedCSSRuleTypes.CSSConditionRule = win.CSSConditionRule; + } + if (canMonkeyPatchNestedCSSRule("CSSSupportsRule")) { + supportedNestedCSSRuleTypes.CSSSupportsRule = win.CSSSupportsRule; + } + } + const unmodifiedFunctions = {}; + Object.entries(supportedNestedCSSRuleTypes).forEach(([typeKey, type]) => { + unmodifiedFunctions[typeKey] = { + insertRule: type.prototype.insertRule, + deleteRule: type.prototype.deleteRule + }; + type.prototype.insertRule = new Proxy(unmodifiedFunctions[typeKey].insertRule, { + apply: callbackWrapper$1((target, thisArg, argumentsList) => { + const [rule, index2] = argumentsList; + const { id: id3, styleId } = getIdAndStyleId(thisArg.parentStyleSheet, mirror2, stylesheetManager.styleMirror); + if (id3 && id3 !== -1 || styleId && styleId !== -1) { + styleSheetRuleCb({ + id: id3, + styleId, + adds: [ + { + rule, + index: [ + ...getNestedCSSRulePositions(thisArg), + index2 || 0 + ] + } + ] + }); + } + return target.apply(thisArg, argumentsList); + }) + }); + type.prototype.deleteRule = new Proxy(unmodifiedFunctions[typeKey].deleteRule, { + apply: callbackWrapper$1((target, thisArg, argumentsList) => { + const [index2] = argumentsList; + const { id: id3, styleId } = getIdAndStyleId(thisArg.parentStyleSheet, mirror2, stylesheetManager.styleMirror); + if (id3 && id3 !== -1 || styleId && styleId !== -1) { + styleSheetRuleCb({ + id: id3, + styleId, + removes: [ + { index: [...getNestedCSSRulePositions(thisArg), index2] } + ] + }); + } + return target.apply(thisArg, argumentsList); + }) + }); + }); + return callbackWrapper$1(() => { + win.CSSStyleSheet.prototype.insertRule = insertRule; + win.CSSStyleSheet.prototype.deleteRule = deleteRule; + replace2 && (win.CSSStyleSheet.prototype.replace = replace2); + replaceSync && (win.CSSStyleSheet.prototype.replaceSync = replaceSync); + Object.entries(supportedNestedCSSRuleTypes).forEach(([typeKey, type]) => { + type.prototype.insertRule = unmodifiedFunctions[typeKey].insertRule; + type.prototype.deleteRule = unmodifiedFunctions[typeKey].deleteRule; + }); + }); +} +__name(initStyleSheetObserver, "initStyleSheetObserver"); +function initAdoptedStyleSheetObserver({ mirror: mirror2, stylesheetManager }, host) { + let hostId = null; + if (host.nodeName === "#document") + hostId = mirror2.getId(host); + else + hostId = mirror2.getId(host.host); + const patchTarget = host.nodeName === "#document" ? _optionalChain$2([host, "access", (_4) => _4.defaultView, "optionalAccess", (_5) => _5.Document]) : _optionalChain$2([host, "access", (_6) => _6.ownerDocument, "optionalAccess", (_7) => _7.defaultView, "optionalAccess", (_8) => _8.ShadowRoot]); + const originalPropertyDescriptor = _optionalChain$2([patchTarget, "optionalAccess", (_9) => _9.prototype]) ? Object.getOwnPropertyDescriptor(_optionalChain$2([patchTarget, "optionalAccess", (_10) => _10.prototype]), "adoptedStyleSheets") : void 0; + if (hostId === null || hostId === -1 || !patchTarget || !originalPropertyDescriptor) + return () => { + }; + Object.defineProperty(host, "adoptedStyleSheets", { + configurable: originalPropertyDescriptor.configurable, + enumerable: originalPropertyDescriptor.enumerable, + get() { + return _optionalChain$2([originalPropertyDescriptor, "access", (_11) => _11.get, "optionalAccess", (_12) => _12.call, "call", (_13) => _13(this)]); + }, + set(sheets) { + const result = _optionalChain$2([originalPropertyDescriptor, "access", (_14) => _14.set, "optionalAccess", (_15) => _15.call, "call", (_16) => _16(this, sheets)]); + if (hostId !== null && hostId !== -1) { + try { + stylesheetManager.adoptStyleSheets(sheets, hostId); + } catch (e2) { + } + } + return result; + } + }); + return callbackWrapper$1(() => { + Object.defineProperty(host, "adoptedStyleSheets", { + configurable: originalPropertyDescriptor.configurable, + enumerable: originalPropertyDescriptor.enumerable, + get: originalPropertyDescriptor.get, + set: originalPropertyDescriptor.set + }); + }); +} +__name(initAdoptedStyleSheetObserver, "initAdoptedStyleSheetObserver"); +function initStyleDeclarationObserver({ styleDeclarationCb, mirror: mirror2, ignoreCSSAttributes, stylesheetManager }, { win }) { + const setProperty2 = win.CSSStyleDeclaration.prototype.setProperty; + win.CSSStyleDeclaration.prototype.setProperty = new Proxy(setProperty2, { + apply: callbackWrapper$1((target, thisArg, argumentsList) => { + const [property, value4, priority] = argumentsList; + if (ignoreCSSAttributes.has(property)) { + return setProperty2.apply(thisArg, [property, value4, priority]); + } + const { id: id3, styleId } = getIdAndStyleId(_optionalChain$2([thisArg, "access", (_17) => _17.parentRule, "optionalAccess", (_18) => _18.parentStyleSheet]), mirror2, stylesheetManager.styleMirror); + if (id3 && id3 !== -1 || styleId && styleId !== -1) { + styleDeclarationCb({ + id: id3, + styleId, + set: { + property, + value: value4, + priority + }, + index: getNestedCSSRulePositions(thisArg.parentRule) + }); + } + return target.apply(thisArg, argumentsList); + }) + }); + const removeProperty = win.CSSStyleDeclaration.prototype.removeProperty; + win.CSSStyleDeclaration.prototype.removeProperty = new Proxy(removeProperty, { + apply: callbackWrapper$1((target, thisArg, argumentsList) => { + const [property] = argumentsList; + if (ignoreCSSAttributes.has(property)) { + return removeProperty.apply(thisArg, [property]); + } + const { id: id3, styleId } = getIdAndStyleId(_optionalChain$2([thisArg, "access", (_19) => _19.parentRule, "optionalAccess", (_20) => _20.parentStyleSheet]), mirror2, stylesheetManager.styleMirror); + if (id3 && id3 !== -1 || styleId && styleId !== -1) { + styleDeclarationCb({ + id: id3, + styleId, + remove: { + property + }, + index: getNestedCSSRulePositions(thisArg.parentRule) + }); + } + return target.apply(thisArg, argumentsList); + }) + }); + return callbackWrapper$1(() => { + win.CSSStyleDeclaration.prototype.setProperty = setProperty2; + win.CSSStyleDeclaration.prototype.removeProperty = removeProperty; + }); +} +__name(initStyleDeclarationObserver, "initStyleDeclarationObserver"); +function initMediaInteractionObserver({ mediaInteractionCb, blockClass, blockSelector, unblockSelector, mirror: mirror2, sampling, doc: doc2 }) { + const handler6 = callbackWrapper$1((type) => throttle$1(callbackWrapper$1((event) => { + const target = getEventTarget(event); + if (!target || isBlocked$1(target, blockClass, blockSelector, unblockSelector, true)) { + return; + } + const { currentTime, volume, muted, playbackRate } = target; + mediaInteractionCb({ + type, + id: mirror2.getId(target), + currentTime, + volume, + muted, + playbackRate + }); + }), sampling.media || 500)); + const handlers2 = [ + on("play", handler6(0), doc2), + on("pause", handler6(1), doc2), + on("seeked", handler6(2), doc2), + on("volumechange", handler6(3), doc2), + on("ratechange", handler6(4), doc2) + ]; + return callbackWrapper$1(() => { + handlers2.forEach((h2) => h2()); + }); +} +__name(initMediaInteractionObserver, "initMediaInteractionObserver"); +function initFontObserver({ fontCb, doc: doc2 }) { + const win = doc2.defaultView; + if (!win) { + return () => { + }; + } + const handlers2 = []; + const fontMap = /* @__PURE__ */ new WeakMap(); + const originalFontFace = win.FontFace; + win.FontFace = /* @__PURE__ */ __name(function FontFace(family, source, descriptors2) { + const fontFace = new originalFontFace(family, source, descriptors2); + fontMap.set(fontFace, { + family, + buffer: typeof source !== "string", + descriptors: descriptors2, + fontSource: typeof source === "string" ? source : JSON.stringify(Array.from(new Uint8Array(source))) + }); + return fontFace; + }, "FontFace"); + const restoreHandler = patch$2(doc2.fonts, "add", function(original) { + return function(fontFace) { + setTimeout$1$1(callbackWrapper$1(() => { + const p2 = fontMap.get(fontFace); + if (p2) { + fontCb(p2); + fontMap.delete(fontFace); + } + }), 0); + return original.apply(this, [fontFace]); + }; + }); + handlers2.push(() => { + win.FontFace = originalFontFace; + }); + handlers2.push(restoreHandler); + return callbackWrapper$1(() => { + handlers2.forEach((h2) => h2()); + }); +} +__name(initFontObserver, "initFontObserver"); +function initSelectionObserver(param) { + const { doc: doc2, mirror: mirror2, blockClass, blockSelector, unblockSelector, selectionCb } = param; + let collapsed2 = true; + const updateSelection2 = callbackWrapper$1(() => { + const selection = doc2.getSelection(); + if (!selection || collapsed2 && _optionalChain$2([selection, "optionalAccess", (_21) => _21.isCollapsed])) + return; + collapsed2 = selection.isCollapsed || false; + const ranges = []; + const count = selection.rangeCount || 0; + for (let i2 = 0; i2 < count; i2++) { + const range2 = selection.getRangeAt(i2); + const { startContainer, startOffset, endContainer, endOffset } = range2; + const blocked2 = isBlocked$1(startContainer, blockClass, blockSelector, unblockSelector, true) || isBlocked$1(endContainer, blockClass, blockSelector, unblockSelector, true); + if (blocked2) + continue; + ranges.push({ + start: mirror2.getId(startContainer), + startOffset, + end: mirror2.getId(endContainer), + endOffset + }); + } + selectionCb({ ranges }); + }); + updateSelection2(); + return on("selectionchange", updateSelection2); +} +__name(initSelectionObserver, "initSelectionObserver"); +function initCustomElementObserver({ doc: doc2, customElementCb }) { + const win = doc2.defaultView; + if (!win || !win.customElements) + return () => { + }; + const restoreHandler = patch$2(win.customElements, "define", function(original) { + return function(name2, constructor, options4) { + try { + customElementCb({ + define: { + name: name2 + } + }); + } catch (e2) { + } + return original.apply(this, [name2, constructor, options4]); + }; + }); + return restoreHandler; +} +__name(initCustomElementObserver, "initCustomElementObserver"); +function initObservers(o2, _hooks = {}) { + const currentWindow = o2.doc.defaultView; + if (!currentWindow) { + return () => { + }; + } + let mutationObserver; + if (o2.recordDOM) { + mutationObserver = initMutationObserver(o2, o2.doc); + } + const mousemoveHandler = initMoveObserver(o2); + const mouseInteractionHandler = initMouseInteractionObserver(o2); + const scrollHandler = initScrollObserver(o2); + const viewportResizeHandler = initViewportResizeObserver(o2, { + win: currentWindow + }); + const inputHandler = initInputObserver(o2); + const mediaInteractionHandler = initMediaInteractionObserver(o2); + let styleSheetObserver = /* @__PURE__ */ __name(() => { + }, "styleSheetObserver"); + let adoptedStyleSheetObserver = /* @__PURE__ */ __name(() => { + }, "adoptedStyleSheetObserver"); + let styleDeclarationObserver = /* @__PURE__ */ __name(() => { + }, "styleDeclarationObserver"); + let fontObserver = /* @__PURE__ */ __name(() => { + }, "fontObserver"); + if (o2.recordDOM) { + styleSheetObserver = initStyleSheetObserver(o2, { win: currentWindow }); + adoptedStyleSheetObserver = initAdoptedStyleSheetObserver(o2, o2.doc); + styleDeclarationObserver = initStyleDeclarationObserver(o2, { + win: currentWindow + }); + if (o2.collectFonts) { + fontObserver = initFontObserver(o2); + } + } + const selectionObserver = initSelectionObserver(o2); + const customElementObserver = initCustomElementObserver(o2); + const pluginHandlers = []; + for (const plugin of o2.plugins) { + pluginHandlers.push(plugin.observer(plugin.callback, currentWindow, plugin.options)); + } + return callbackWrapper$1(() => { + mutationBuffers.forEach((b2) => b2.reset()); + _optionalChain$2([mutationObserver, "optionalAccess", (_22) => _22.disconnect, "call", (_23) => _23()]); + mousemoveHandler(); + mouseInteractionHandler(); + scrollHandler(); + viewportResizeHandler(); + inputHandler(); + mediaInteractionHandler(); + styleSheetObserver(); + adoptedStyleSheetObserver(); + styleDeclarationObserver(); + fontObserver(); + selectionObserver(); + customElementObserver(); + pluginHandlers.forEach((h2) => h2()); + }); +} +__name(initObservers, "initObservers"); +function hasNestedCSSRule(prop2) { + return typeof window[prop2] !== "undefined"; +} +__name(hasNestedCSSRule, "hasNestedCSSRule"); +function canMonkeyPatchNestedCSSRule(prop2) { + return Boolean(typeof window[prop2] !== "undefined" && window[prop2].prototype && "insertRule" in window[prop2].prototype && "deleteRule" in window[prop2].prototype); +} +__name(canMonkeyPatchNestedCSSRule, "canMonkeyPatchNestedCSSRule"); +class CrossOriginIframeMirror { + static { + __name(this, "CrossOriginIframeMirror"); + } + constructor(generateIdFn) { + this.generateIdFn = generateIdFn; + this.iframeIdToRemoteIdMap = /* @__PURE__ */ new WeakMap(); + this.iframeRemoteIdToIdMap = /* @__PURE__ */ new WeakMap(); + } + getId(iframe, remoteId, idToRemoteMap, remoteToIdMap) { + const idToRemoteIdMap = idToRemoteMap || this.getIdToRemoteIdMap(iframe); + const remoteIdToIdMap = remoteToIdMap || this.getRemoteIdToIdMap(iframe); + let id3 = idToRemoteIdMap.get(remoteId); + if (!id3) { + id3 = this.generateIdFn(); + idToRemoteIdMap.set(remoteId, id3); + remoteIdToIdMap.set(id3, remoteId); + } + return id3; + } + getIds(iframe, remoteId) { + const idToRemoteIdMap = this.getIdToRemoteIdMap(iframe); + const remoteIdToIdMap = this.getRemoteIdToIdMap(iframe); + return remoteId.map((id3) => this.getId(iframe, id3, idToRemoteIdMap, remoteIdToIdMap)); + } + getRemoteId(iframe, id3, map3) { + const remoteIdToIdMap = map3 || this.getRemoteIdToIdMap(iframe); + if (typeof id3 !== "number") + return id3; + const remoteId = remoteIdToIdMap.get(id3); + if (!remoteId) + return -1; + return remoteId; + } + getRemoteIds(iframe, ids) { + const remoteIdToIdMap = this.getRemoteIdToIdMap(iframe); + return ids.map((id3) => this.getRemoteId(iframe, id3, remoteIdToIdMap)); + } + reset(iframe) { + if (!iframe) { + this.iframeIdToRemoteIdMap = /* @__PURE__ */ new WeakMap(); + this.iframeRemoteIdToIdMap = /* @__PURE__ */ new WeakMap(); + return; + } + this.iframeIdToRemoteIdMap.delete(iframe); + this.iframeRemoteIdToIdMap.delete(iframe); + } + getIdToRemoteIdMap(iframe) { + let idToRemoteIdMap = this.iframeIdToRemoteIdMap.get(iframe); + if (!idToRemoteIdMap) { + idToRemoteIdMap = /* @__PURE__ */ new Map(); + this.iframeIdToRemoteIdMap.set(iframe, idToRemoteIdMap); + } + return idToRemoteIdMap; + } + getRemoteIdToIdMap(iframe) { + let remoteIdToIdMap = this.iframeRemoteIdToIdMap.get(iframe); + if (!remoteIdToIdMap) { + remoteIdToIdMap = /* @__PURE__ */ new Map(); + this.iframeRemoteIdToIdMap.set(iframe, remoteIdToIdMap); + } + return remoteIdToIdMap; + } +} +function _optionalChain$1(ops) { + let lastAccessLHS = void 0; + let value4 = ops[0]; + let i2 = 1; + while (i2 < ops.length) { + const op = ops[i2]; + const fn = ops[i2 + 1]; + i2 += 2; + if ((op === "optionalAccess" || op === "optionalCall") && value4 == null) { + return void 0; + } + if (op === "access" || op === "optionalAccess") { + lastAccessLHS = value4; + value4 = fn(value4); + } else if (op === "call" || op === "optionalCall") { + value4 = fn((...args) => value4.call(lastAccessLHS, ...args)); + lastAccessLHS = void 0; + } + } + return value4; +} +__name(_optionalChain$1, "_optionalChain$1"); +class IframeManagerNoop { + static { + __name(this, "IframeManagerNoop"); + } + constructor() { + this.crossOriginIframeMirror = new CrossOriginIframeMirror(genId); + this.crossOriginIframeRootIdMap = /* @__PURE__ */ new WeakMap(); + } + addIframe() { + } + addLoadListener() { + } + attachIframe() { + } +} +class IframeManager { + static { + __name(this, "IframeManager"); + } + constructor(options4) { + this.iframes = /* @__PURE__ */ new WeakMap(); + this.crossOriginIframeMap = /* @__PURE__ */ new WeakMap(); + this.crossOriginIframeMirror = new CrossOriginIframeMirror(genId); + this.crossOriginIframeRootIdMap = /* @__PURE__ */ new WeakMap(); + this.mutationCb = options4.mutationCb; + this.wrappedEmit = options4.wrappedEmit; + this.stylesheetManager = options4.stylesheetManager; + this.recordCrossOriginIframes = options4.recordCrossOriginIframes; + this.crossOriginIframeStyleMirror = new CrossOriginIframeMirror(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)); + this.mirror = options4.mirror; + if (this.recordCrossOriginIframes) { + window.addEventListener("message", this.handleMessage.bind(this)); + } + } + addIframe(iframeEl) { + this.iframes.set(iframeEl, true); + if (iframeEl.contentWindow) + this.crossOriginIframeMap.set(iframeEl.contentWindow, iframeEl); + } + addLoadListener(cb) { + this.loadListener = cb; + } + attachIframe(iframeEl, childSn) { + this.mutationCb({ + adds: [ + { + parentId: this.mirror.getId(iframeEl), + nextId: null, + node: childSn + } + ], + removes: [], + texts: [], + attributes: [], + isAttachIframe: true + }); + _optionalChain$1([this, "access", (_2) => _2.loadListener, "optionalCall", (_2) => _2(iframeEl)]); + const iframeDoc = getIFrameContentDocument(iframeEl); + if (iframeDoc && iframeDoc.adoptedStyleSheets && iframeDoc.adoptedStyleSheets.length > 0) + this.stylesheetManager.adoptStyleSheets(iframeDoc.adoptedStyleSheets, this.mirror.getId(iframeDoc)); + } + handleMessage(message3) { + const crossOriginMessageEvent = message3; + if (crossOriginMessageEvent.data.type !== "rrweb" || crossOriginMessageEvent.origin !== crossOriginMessageEvent.data.origin) + return; + const iframeSourceWindow = message3.source; + if (!iframeSourceWindow) + return; + const iframeEl = this.crossOriginIframeMap.get(message3.source); + if (!iframeEl) + return; + const transformedEvent = this.transformCrossOriginEvent(iframeEl, crossOriginMessageEvent.data.event); + if (transformedEvent) + this.wrappedEmit(transformedEvent, crossOriginMessageEvent.data.isCheckout); + } + transformCrossOriginEvent(iframeEl, e2) { + switch (e2.type) { + case EventType.FullSnapshot: { + this.crossOriginIframeMirror.reset(iframeEl); + this.crossOriginIframeStyleMirror.reset(iframeEl); + this.replaceIdOnNode(e2.data.node, iframeEl); + const rootId = e2.data.node.id; + this.crossOriginIframeRootIdMap.set(iframeEl, rootId); + this.patchRootIdOnNode(e2.data.node, rootId); + return { + timestamp: e2.timestamp, + type: EventType.IncrementalSnapshot, + data: { + source: IncrementalSource.Mutation, + adds: [ + { + parentId: this.mirror.getId(iframeEl), + nextId: null, + node: e2.data.node + } + ], + removes: [], + texts: [], + attributes: [], + isAttachIframe: true + } + }; + } + case EventType.Meta: + case EventType.Load: + case EventType.DomContentLoaded: { + return false; + } + case EventType.Plugin: { + return e2; + } + case EventType.Custom: { + this.replaceIds(e2.data.payload, iframeEl, ["id", "parentId", "previousId", "nextId"]); + return e2; + } + case EventType.IncrementalSnapshot: { + switch (e2.data.source) { + case IncrementalSource.Mutation: { + e2.data.adds.forEach((n2) => { + this.replaceIds(n2, iframeEl, [ + "parentId", + "nextId", + "previousId" + ]); + this.replaceIdOnNode(n2.node, iframeEl); + const rootId = this.crossOriginIframeRootIdMap.get(iframeEl); + rootId && this.patchRootIdOnNode(n2.node, rootId); + }); + e2.data.removes.forEach((n2) => { + this.replaceIds(n2, iframeEl, ["parentId", "id"]); + }); + e2.data.attributes.forEach((n2) => { + this.replaceIds(n2, iframeEl, ["id"]); + }); + e2.data.texts.forEach((n2) => { + this.replaceIds(n2, iframeEl, ["id"]); + }); + return e2; + } + case IncrementalSource.Drag: + case IncrementalSource.TouchMove: + case IncrementalSource.MouseMove: { + e2.data.positions.forEach((p2) => { + this.replaceIds(p2, iframeEl, ["id"]); + }); + return e2; + } + case IncrementalSource.ViewportResize: { + return false; + } + case IncrementalSource.MediaInteraction: + case IncrementalSource.MouseInteraction: + case IncrementalSource.Scroll: + case IncrementalSource.CanvasMutation: + case IncrementalSource.Input: { + this.replaceIds(e2.data, iframeEl, ["id"]); + return e2; + } + case IncrementalSource.StyleSheetRule: + case IncrementalSource.StyleDeclaration: { + this.replaceIds(e2.data, iframeEl, ["id"]); + this.replaceStyleIds(e2.data, iframeEl, ["styleId"]); + return e2; + } + case IncrementalSource.Font: { + return e2; + } + case IncrementalSource.Selection: { + e2.data.ranges.forEach((range2) => { + this.replaceIds(range2, iframeEl, ["start", "end"]); + }); + return e2; + } + case IncrementalSource.AdoptedStyleSheet: { + this.replaceIds(e2.data, iframeEl, ["id"]); + this.replaceStyleIds(e2.data, iframeEl, ["styleIds"]); + _optionalChain$1([e2, "access", (_3) => _3.data, "access", (_4) => _4.styles, "optionalAccess", (_5) => _5.forEach, "call", (_6) => _6((style2) => { + this.replaceStyleIds(style2, iframeEl, ["styleId"]); + })]); + return e2; + } + } + } + } + return false; + } + replace(iframeMirror, obj, iframeEl, keys2) { + for (const key of keys2) { + if (!Array.isArray(obj[key]) && typeof obj[key] !== "number") + continue; + if (Array.isArray(obj[key])) { + obj[key] = iframeMirror.getIds(iframeEl, obj[key]); + } else { + obj[key] = iframeMirror.getId(iframeEl, obj[key]); + } + } + return obj; + } + replaceIds(obj, iframeEl, keys2) { + return this.replace(this.crossOriginIframeMirror, obj, iframeEl, keys2); + } + replaceStyleIds(obj, iframeEl, keys2) { + return this.replace(this.crossOriginIframeStyleMirror, obj, iframeEl, keys2); + } + replaceIdOnNode(node3, iframeEl) { + this.replaceIds(node3, iframeEl, ["id", "rootId"]); + if ("childNodes" in node3) { + node3.childNodes.forEach((child) => { + this.replaceIdOnNode(child, iframeEl); + }); + } + } + patchRootIdOnNode(node3, rootId) { + if (node3.type !== NodeType$3.Document && !node3.rootId) + node3.rootId = rootId; + if ("childNodes" in node3) { + node3.childNodes.forEach((child) => { + this.patchRootIdOnNode(child, rootId); + }); + } + } +} +class ShadowDomManagerNoop { + static { + __name(this, "ShadowDomManagerNoop"); + } + init() { + } + addShadowRoot() { + } + observeAttachShadow() { + } + reset() { + } +} +class ShadowDomManager { + static { + __name(this, "ShadowDomManager"); + } + constructor(options4) { + this.shadowDoms = /* @__PURE__ */ new WeakSet(); + this.restoreHandlers = []; + this.mutationCb = options4.mutationCb; + this.scrollCb = options4.scrollCb; + this.bypassOptions = options4.bypassOptions; + this.mirror = options4.mirror; + this.init(); + } + init() { + this.reset(); + this.patchAttachShadow(Element, document); + } + addShadowRoot(shadowRoot, doc2) { + if (!isNativeShadowDom(shadowRoot)) + return; + if (this.shadowDoms.has(shadowRoot)) + return; + this.shadowDoms.add(shadowRoot); + this.bypassOptions.canvasManager.addShadowRoot(shadowRoot); + const observer = initMutationObserver({ + ...this.bypassOptions, + doc: doc2, + mutationCb: this.mutationCb, + mirror: this.mirror, + shadowDomManager: this + }, shadowRoot); + this.restoreHandlers.push(() => observer.disconnect()); + this.restoreHandlers.push(initScrollObserver({ + ...this.bypassOptions, + scrollCb: this.scrollCb, + doc: shadowRoot, + mirror: this.mirror + })); + setTimeout$1$1(() => { + if (shadowRoot.adoptedStyleSheets && shadowRoot.adoptedStyleSheets.length > 0) + this.bypassOptions.stylesheetManager.adoptStyleSheets(shadowRoot.adoptedStyleSheets, this.mirror.getId(shadowRoot.host)); + this.restoreHandlers.push(initAdoptedStyleSheetObserver({ + mirror: this.mirror, + stylesheetManager: this.bypassOptions.stylesheetManager + }, shadowRoot)); + }, 0); + } + observeAttachShadow(iframeElement) { + const iframeDoc = getIFrameContentDocument(iframeElement); + const iframeWindow = getIFrameContentWindow(iframeElement); + if (!iframeDoc || !iframeWindow) + return; + this.patchAttachShadow(iframeWindow.Element, iframeDoc); + } + patchAttachShadow(element, doc2) { + const manager = this; + this.restoreHandlers.push(patch$2(element.prototype, "attachShadow", function(original) { + return function(option3) { + const shadowRoot = original.call(this, option3); + if (this.shadowRoot && inDom(this)) + manager.addShadowRoot(this.shadowRoot, doc2); + return shadowRoot; + }; + })); + } + reset() { + this.restoreHandlers.forEach((handler6) => { + try { + handler6(); + } catch (e2) { + } + }); + this.restoreHandlers = []; + this.shadowDoms = /* @__PURE__ */ new WeakSet(); + this.bypassOptions.canvasManager.resetShadowRoots(); + } +} +class CanvasManagerNoop { + static { + __name(this, "CanvasManagerNoop"); + } + reset() { + } + freeze() { + } + unfreeze() { + } + lock() { + } + unlock() { + } + snapshot() { + } + addWindow() { + } + addShadowRoot() { + } + resetShadowRoots() { + } +} +class StylesheetManager { + static { + __name(this, "StylesheetManager"); + } + constructor(options4) { + this.trackedLinkElements = /* @__PURE__ */ new WeakSet(); + this.styleMirror = new StyleSheetMirror(); + this.mutationCb = options4.mutationCb; + this.adoptedStyleSheetCb = options4.adoptedStyleSheetCb; + } + attachLinkElement(linkEl, childSn) { + if ("_cssText" in childSn.attributes) + this.mutationCb({ + adds: [], + removes: [], + texts: [], + attributes: [ + { + id: childSn.id, + attributes: childSn.attributes + } + ] + }); + this.trackLinkElement(linkEl); + } + trackLinkElement(linkEl) { + if (this.trackedLinkElements.has(linkEl)) + return; + this.trackedLinkElements.add(linkEl); + this.trackStylesheetInLinkElement(linkEl); + } + adoptStyleSheets(sheets, hostId) { + if (sheets.length === 0) + return; + const adoptedStyleSheetData = { + id: hostId, + styleIds: [] + }; + const styles = []; + for (const sheet of sheets) { + let styleId; + if (!this.styleMirror.has(sheet)) { + styleId = this.styleMirror.add(sheet); + styles.push({ + styleId, + rules: Array.from(sheet.rules || CSSRule, (r2, index2) => ({ + rule: stringifyRule(r2), + index: index2 + })) + }); + } else + styleId = this.styleMirror.getId(sheet); + adoptedStyleSheetData.styleIds.push(styleId); + } + if (styles.length > 0) + adoptedStyleSheetData.styles = styles; + this.adoptedStyleSheetCb(adoptedStyleSheetData); + } + reset() { + this.styleMirror.reset(); + this.trackedLinkElements = /* @__PURE__ */ new WeakSet(); + } + trackStylesheetInLinkElement(linkEl) { + } +} +class ProcessedNodeManager { + static { + __name(this, "ProcessedNodeManager"); + } + constructor() { + this.nodeMap = /* @__PURE__ */ new WeakMap(); + this.active = false; + } + inOtherBuffer(node3, thisBuffer) { + const buffers = this.nodeMap.get(node3); + return buffers && Array.from(buffers).some((buffer2) => buffer2 !== thisBuffer); + } + add(node3, buffer2) { + if (!this.active) { + this.active = true; + onRequestAnimationFrame$1(() => { + this.nodeMap = /* @__PURE__ */ new WeakMap(); + this.active = false; + }); + } + this.nodeMap.set(node3, (this.nodeMap.get(node3) || /* @__PURE__ */ new Set()).add(buffer2)); + } + destroy() { + } +} +let wrappedEmit; +let _takeFullSnapshot; +try { + if (Array.from([1], (x2) => x2 * 2)[0] !== 2) { + const cleanFrame = document.createElement("iframe"); + document.body.appendChild(cleanFrame); + Array.from = _optionalChain([cleanFrame, "access", (_2) => _2.contentWindow, "optionalAccess", (_2) => _2.Array, "access", (_3) => _3.from]) || Array.from; + document.body.removeChild(cleanFrame); + } +} catch (err) { + console.debug("Unable to override Array.from", err); +} +const mirror = createMirror(); +function record(options4 = {}) { + const { emit: emit2, checkoutEveryNms, checkoutEveryNth, blockClass = "rr-block", blockSelector = null, unblockSelector = null, ignoreClass = "rr-ignore", ignoreSelector = null, maskAllText = false, maskTextClass = "rr-mask", unmaskTextClass = null, maskTextSelector = null, unmaskTextSelector = null, inlineStylesheet = true, maskAllInputs, maskInputOptions: _maskInputOptions, slimDOMOptions: _slimDOMOptions, maskAttributeFn, maskInputFn, maskTextFn, maxCanvasSize = null, packFn, sampling = {}, dataURLOptions = {}, mousemoveWait, recordDOM = true, recordCanvas = false, recordCrossOriginIframes = false, recordAfter = options4.recordAfter === "DOMContentLoaded" ? options4.recordAfter : "load", userTriggeredOnInput = false, collectFonts = false, inlineImages = false, plugins, keepIframeSrcFn = /* @__PURE__ */ __name(() => false, "keepIframeSrcFn"), ignoreCSSAttributes = /* @__PURE__ */ new Set([]), errorHandler: errorHandler2, onMutation, getCanvasManager } = options4; + registerErrorHandler$1(errorHandler2); + const inEmittingFrame = recordCrossOriginIframes ? window.parent === window : true; + let passEmitsToParent = false; + if (!inEmittingFrame) { + try { + if (window.parent.document) { + passEmitsToParent = false; + } + } catch (e2) { + passEmitsToParent = true; + } + } + if (inEmittingFrame && !emit2) { + throw new Error("emit function is required"); + } + if (!inEmittingFrame && !passEmitsToParent) { + return () => { + }; + } + if (mousemoveWait !== void 0 && sampling.mousemove === void 0) { + sampling.mousemove = mousemoveWait; + } + mirror.reset(); + const maskInputOptions = maskAllInputs === true ? { + color: true, + date: true, + "datetime-local": true, + email: true, + month: true, + number: true, + range: true, + search: true, + tel: true, + text: true, + time: true, + url: true, + week: true, + textarea: true, + select: true, + radio: true, + checkbox: true + } : _maskInputOptions !== void 0 ? _maskInputOptions : {}; + const slimDOMOptions = _slimDOMOptions === true || _slimDOMOptions === "all" ? { + script: true, + comment: true, + headFavicon: true, + headWhitespace: true, + headMetaSocial: true, + headMetaRobots: true, + headMetaHttpEquiv: true, + headMetaVerification: true, + headMetaAuthorship: _slimDOMOptions === "all", + headMetaDescKeywords: _slimDOMOptions === "all" + } : _slimDOMOptions ? _slimDOMOptions : {}; + polyfill(); + let lastFullSnapshotEvent; + let incrementalSnapshotCount = 0; + const eventProcessor = /* @__PURE__ */ __name((e2) => { + for (const plugin of plugins || []) { + if (plugin.eventProcessor) { + e2 = plugin.eventProcessor(e2); + } + } + if (packFn && !passEmitsToParent) { + e2 = packFn(e2); + } + return e2; + }, "eventProcessor"); + wrappedEmit = /* @__PURE__ */ __name((r2, isCheckout) => { + const e2 = r2; + e2.timestamp = nowTimestamp(); + if (_optionalChain([mutationBuffers, "access", (_4) => _4[0], "optionalAccess", (_5) => _5.isFrozen, "call", (_6) => _6()]) && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) { + mutationBuffers.forEach((buf) => buf.unfreeze()); + } + if (inEmittingFrame) { + _optionalChain([emit2, "optionalCall", (_7) => _7(eventProcessor(e2), isCheckout)]); + } else if (passEmitsToParent) { + const message3 = { + type: "rrweb", + event: eventProcessor(e2), + origin: window.location.origin, + isCheckout + }; + window.parent.postMessage(message3, "*"); + } + if (e2.type === EventType.FullSnapshot) { + lastFullSnapshotEvent = e2; + incrementalSnapshotCount = 0; + } else if (e2.type === EventType.IncrementalSnapshot) { + if (e2.data.source === IncrementalSource.Mutation && e2.data.isAttachIframe) { + return; + } + incrementalSnapshotCount++; + const exceedCount = checkoutEveryNth && incrementalSnapshotCount >= checkoutEveryNth; + const exceedTime = checkoutEveryNms && lastFullSnapshotEvent && e2.timestamp - lastFullSnapshotEvent.timestamp > checkoutEveryNms; + if (exceedCount || exceedTime) { + takeFullSnapshot2(true); + } + } + }, "wrappedEmit"); + const wrappedMutationEmit = /* @__PURE__ */ __name((m2) => { + wrappedEmit({ + type: EventType.IncrementalSnapshot, + data: { + source: IncrementalSource.Mutation, + ...m2 + } + }); + }, "wrappedMutationEmit"); + const wrappedScrollEmit = /* @__PURE__ */ __name((p2) => wrappedEmit({ + type: EventType.IncrementalSnapshot, + data: { + source: IncrementalSource.Scroll, + ...p2 + } + }), "wrappedScrollEmit"); + const wrappedCanvasMutationEmit = /* @__PURE__ */ __name((p2) => wrappedEmit({ + type: EventType.IncrementalSnapshot, + data: { + source: IncrementalSource.CanvasMutation, + ...p2 + } + }), "wrappedCanvasMutationEmit"); + const wrappedAdoptedStyleSheetEmit = /* @__PURE__ */ __name((a2) => wrappedEmit({ + type: EventType.IncrementalSnapshot, + data: { + source: IncrementalSource.AdoptedStyleSheet, + ...a2 + } + }), "wrappedAdoptedStyleSheetEmit"); + const stylesheetManager = new StylesheetManager({ + mutationCb: wrappedMutationEmit, + adoptedStyleSheetCb: wrappedAdoptedStyleSheetEmit + }); + const iframeManager = typeof __RRWEB_EXCLUDE_IFRAME__ === "boolean" && __RRWEB_EXCLUDE_IFRAME__ ? new IframeManagerNoop() : new IframeManager({ + mirror, + mutationCb: wrappedMutationEmit, + stylesheetManager, + recordCrossOriginIframes, + wrappedEmit + }); + for (const plugin of plugins || []) { + if (plugin.getMirror) + plugin.getMirror({ + nodeMirror: mirror, + crossOriginIframeMirror: iframeManager.crossOriginIframeMirror, + crossOriginIframeStyleMirror: iframeManager.crossOriginIframeStyleMirror + }); + } + const processedNodeManager = new ProcessedNodeManager(); + const canvasManager = _getCanvasManager(getCanvasManager, { + mirror, + win: window, + mutationCb: /* @__PURE__ */ __name((p2) => wrappedEmit({ + type: EventType.IncrementalSnapshot, + data: { + source: IncrementalSource.CanvasMutation, + ...p2 + } + }), "mutationCb"), + recordCanvas, + blockClass, + blockSelector, + unblockSelector, + maxCanvasSize, + sampling: sampling["canvas"], + dataURLOptions, + errorHandler: errorHandler2 + }); + const shadowDomManager = typeof __RRWEB_EXCLUDE_SHADOW_DOM__ === "boolean" && __RRWEB_EXCLUDE_SHADOW_DOM__ ? new ShadowDomManagerNoop() : new ShadowDomManager({ + mutationCb: wrappedMutationEmit, + scrollCb: wrappedScrollEmit, + bypassOptions: { + onMutation, + blockClass, + blockSelector, + unblockSelector, + maskAllText, + maskTextClass, + unmaskTextClass, + maskTextSelector, + unmaskTextSelector, + inlineStylesheet, + maskInputOptions, + dataURLOptions, + maskAttributeFn, + maskTextFn, + maskInputFn, + recordCanvas, + inlineImages, + sampling, + slimDOMOptions, + iframeManager, + stylesheetManager, + canvasManager, + keepIframeSrcFn, + processedNodeManager + }, + mirror + }); + const takeFullSnapshot2 = /* @__PURE__ */ __name((isCheckout = false) => { + if (!recordDOM) { + return; + } + wrappedEmit({ + type: EventType.Meta, + data: { + href: window.location.href, + width: getWindowWidth(), + height: getWindowHeight() + } + }, isCheckout); + stylesheetManager.reset(); + shadowDomManager.init(); + mutationBuffers.forEach((buf) => buf.lock()); + const node3 = snapshot(document, { + mirror, + blockClass, + blockSelector, + unblockSelector, + maskAllText, + maskTextClass, + unmaskTextClass, + maskTextSelector, + unmaskTextSelector, + inlineStylesheet, + maskAllInputs: maskInputOptions, + maskAttributeFn, + maskInputFn, + maskTextFn, + slimDOM: slimDOMOptions, + dataURLOptions, + recordCanvas, + inlineImages, + onSerialize: /* @__PURE__ */ __name((n2) => { + if (isSerializedIframe(n2, mirror)) { + iframeManager.addIframe(n2); + } + if (isSerializedStylesheet(n2, mirror)) { + stylesheetManager.trackLinkElement(n2); + } + if (hasShadowRoot(n2)) { + shadowDomManager.addShadowRoot(n2.shadowRoot, document); + } + }, "onSerialize"), + onIframeLoad: /* @__PURE__ */ __name((iframe, childSn) => { + iframeManager.attachIframe(iframe, childSn); + if (iframe.contentWindow) { + canvasManager.addWindow(iframe.contentWindow); + } + shadowDomManager.observeAttachShadow(iframe); + }, "onIframeLoad"), + onStylesheetLoad: /* @__PURE__ */ __name((linkEl, childSn) => { + stylesheetManager.attachLinkElement(linkEl, childSn); + }, "onStylesheetLoad"), + keepIframeSrcFn + }); + if (!node3) { + return console.warn("Failed to snapshot the document"); + } + wrappedEmit({ + type: EventType.FullSnapshot, + data: { + node: node3, + initialOffset: getWindowScroll(window) + } + }); + mutationBuffers.forEach((buf) => buf.unlock()); + if (document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0) + stylesheetManager.adoptStyleSheets(document.adoptedStyleSheets, mirror.getId(document)); + }, "takeFullSnapshot"); + _takeFullSnapshot = takeFullSnapshot2; + try { + const handlers2 = []; + const observe2 = /* @__PURE__ */ __name((doc2) => { + return callbackWrapper$1(initObservers)({ + onMutation, + mutationCb: wrappedMutationEmit, + mousemoveCb: /* @__PURE__ */ __name((positions, source) => wrappedEmit({ + type: EventType.IncrementalSnapshot, + data: { + source, + positions + } + }), "mousemoveCb"), + mouseInteractionCb: /* @__PURE__ */ __name((d2) => wrappedEmit({ + type: EventType.IncrementalSnapshot, + data: { + source: IncrementalSource.MouseInteraction, + ...d2 + } + }), "mouseInteractionCb"), + scrollCb: wrappedScrollEmit, + viewportResizeCb: /* @__PURE__ */ __name((d2) => wrappedEmit({ + type: EventType.IncrementalSnapshot, + data: { + source: IncrementalSource.ViewportResize, + ...d2 + } + }), "viewportResizeCb"), + inputCb: /* @__PURE__ */ __name((v2) => wrappedEmit({ + type: EventType.IncrementalSnapshot, + data: { + source: IncrementalSource.Input, + ...v2 + } + }), "inputCb"), + mediaInteractionCb: /* @__PURE__ */ __name((p2) => wrappedEmit({ + type: EventType.IncrementalSnapshot, + data: { + source: IncrementalSource.MediaInteraction, + ...p2 + } + }), "mediaInteractionCb"), + styleSheetRuleCb: /* @__PURE__ */ __name((r2) => wrappedEmit({ + type: EventType.IncrementalSnapshot, + data: { + source: IncrementalSource.StyleSheetRule, + ...r2 + } + }), "styleSheetRuleCb"), + styleDeclarationCb: /* @__PURE__ */ __name((r2) => wrappedEmit({ + type: EventType.IncrementalSnapshot, + data: { + source: IncrementalSource.StyleDeclaration, + ...r2 + } + }), "styleDeclarationCb"), + canvasMutationCb: wrappedCanvasMutationEmit, + fontCb: /* @__PURE__ */ __name((p2) => wrappedEmit({ + type: EventType.IncrementalSnapshot, + data: { + source: IncrementalSource.Font, + ...p2 + } + }), "fontCb"), + selectionCb: /* @__PURE__ */ __name((p2) => { + wrappedEmit({ + type: EventType.IncrementalSnapshot, + data: { + source: IncrementalSource.Selection, + ...p2 + } + }); + }, "selectionCb"), + customElementCb: /* @__PURE__ */ __name((c2) => { + wrappedEmit({ + type: EventType.IncrementalSnapshot, + data: { + source: IncrementalSource.CustomElement, + ...c2 + } + }); + }, "customElementCb"), + blockClass, + ignoreClass, + ignoreSelector, + maskAllText, + maskTextClass, + unmaskTextClass, + maskTextSelector, + unmaskTextSelector, + maskInputOptions, + inlineStylesheet, + sampling, + recordDOM, + recordCanvas, + inlineImages, + userTriggeredOnInput, + collectFonts, + doc: doc2, + maskAttributeFn, + maskInputFn, + maskTextFn, + keepIframeSrcFn, + blockSelector, + unblockSelector, + slimDOMOptions, + dataURLOptions, + mirror, + iframeManager, + stylesheetManager, + shadowDomManager, + processedNodeManager, + canvasManager, + ignoreCSSAttributes, + plugins: _optionalChain([ + plugins, + "optionalAccess", + (_8) => _8.filter, + "call", + (_9) => _9((p2) => p2.observer), + "optionalAccess", + (_10) => _10.map, + "call", + (_11) => _11((p2) => ({ + observer: p2.observer, + options: p2.options, + callback: /* @__PURE__ */ __name((payload) => wrappedEmit({ + type: EventType.Plugin, + data: { + plugin: p2.name, + payload + } + }), "callback") + })) + ]) || [] + }, {}); + }, "observe"); + iframeManager.addLoadListener((iframeEl) => { + try { + handlers2.push(observe2(iframeEl.contentDocument)); + } catch (error2) { + console.warn(error2); + } + }); + const init3 = /* @__PURE__ */ __name(() => { + takeFullSnapshot2(); + handlers2.push(observe2(document)); + }, "init"); + if (document.readyState === "interactive" || document.readyState === "complete") { + init3(); + } else { + handlers2.push(on("DOMContentLoaded", () => { + wrappedEmit({ + type: EventType.DomContentLoaded, + data: {} + }); + if (recordAfter === "DOMContentLoaded") + init3(); + })); + handlers2.push(on("load", () => { + wrappedEmit({ + type: EventType.Load, + data: {} + }); + if (recordAfter === "load") + init3(); + }, window)); + } + return () => { + handlers2.forEach((h2) => h2()); + processedNodeManager.destroy(); + _takeFullSnapshot = void 0; + unregisterErrorHandler(); + }; + } catch (error2) { + console.warn(error2); + } +} +__name(record, "record"); +function takeFullSnapshot(isCheckout) { + if (!_takeFullSnapshot) { + throw new Error("please take full snapshot after start recording"); + } + _takeFullSnapshot(isCheckout); +} +__name(takeFullSnapshot, "takeFullSnapshot"); +record.mirror = mirror; +record.takeFullSnapshot = takeFullSnapshot; +function _getCanvasManager(getCanvasManagerFn, options4) { + try { + return getCanvasManagerFn ? getCanvasManagerFn(options4) : new CanvasManagerNoop(); + } catch (e2) { + console.warn("Unable to initialize CanvasManager"); + return new CanvasManagerNoop(); + } +} +__name(_getCanvasManager, "_getCanvasManager"); +const ReplayEventTypeIncrementalSnapshot = 3; +const ReplayEventTypeCustom = 5; +function timestampToMs(timestamp2) { + const isMs = timestamp2 > 9999999999; + return isMs ? timestamp2 : timestamp2 * 1e3; +} +__name(timestampToMs, "timestampToMs"); +function timestampToS(timestamp2) { + const isMs = timestamp2 > 9999999999; + return isMs ? timestamp2 / 1e3 : timestamp2; +} +__name(timestampToS, "timestampToS"); +function addBreadcrumbEvent(replay, breadcrumb) { + if (breadcrumb.category === "sentry.transaction") { + return; + } + if (["ui.click", "ui.input"].includes(breadcrumb.category)) { + replay.triggerUserActivity(); + } else { + replay.checkAndHandleExpiredSession(); + } + replay.addUpdate(() => { + replay.throttledAddEvent({ + type: EventType.Custom, + // TODO: We were converting from ms to seconds for breadcrumbs, spans, + // but maybe we should just keep them as milliseconds + timestamp: (breadcrumb.timestamp || 0) * 1e3, + data: { + tag: "breadcrumb", + // normalize to max. 10 depth and 1_000 properties per object + payload: normalize$2(breadcrumb, 10, 1e3) + } + }); + return breadcrumb.category === "console"; + }); +} +__name(addBreadcrumbEvent, "addBreadcrumbEvent"); +const INTERACTIVE_SELECTOR = "button,a"; +function getClosestInteractive(element) { + const closestInteractive = element.closest(INTERACTIVE_SELECTOR); + return closestInteractive || element; +} +__name(getClosestInteractive, "getClosestInteractive"); +function getClickTargetNode(event) { + const target = getTargetNode(event); + if (!target || !(target instanceof Element)) { + return target; + } + return getClosestInteractive(target); +} +__name(getClickTargetNode, "getClickTargetNode"); +function getTargetNode(event) { + if (isEventWithTarget(event)) { + return event.target; + } + return event; +} +__name(getTargetNode, "getTargetNode"); +function isEventWithTarget(event) { + return typeof event === "object" && !!event && "target" in event; +} +__name(isEventWithTarget, "isEventWithTarget"); +let handlers$2; +function onWindowOpen(cb) { + if (!handlers$2) { + handlers$2 = []; + monkeyPatchWindowOpen(); + } + handlers$2.push(cb); + return () => { + const pos2 = handlers$2 ? handlers$2.indexOf(cb) : -1; + if (pos2 > -1) { + handlers$2.splice(pos2, 1); + } + }; +} +__name(onWindowOpen, "onWindowOpen"); +function monkeyPatchWindowOpen() { + fill(WINDOW$1, "open", function(originalWindowOpen) { + return function(...args) { + if (handlers$2) { + try { + handlers$2.forEach((handler6) => handler6()); + } catch (e2) { + } + } + return originalWindowOpen.apply(WINDOW$1, args); + }; + }); +} +__name(monkeyPatchWindowOpen, "monkeyPatchWindowOpen"); +const IncrementalMutationSources = /* @__PURE__ */ new Set([ + IncrementalSource.Mutation, + IncrementalSource.StyleSheetRule, + IncrementalSource.StyleDeclaration, + IncrementalSource.AdoptedStyleSheet, + IncrementalSource.CanvasMutation, + IncrementalSource.Selection, + IncrementalSource.MediaInteraction +]); +function handleClick$1(clickDetector, clickBreadcrumb, node3) { + clickDetector.handleClick(clickBreadcrumb, node3); +} +__name(handleClick$1, "handleClick$1"); +class ClickDetector { + static { + __name(this, "ClickDetector"); + } + // protected for testing + constructor(replay, slowClickConfig, _addBreadcrumbEvent = addBreadcrumbEvent) { + this._lastMutation = 0; + this._lastScroll = 0; + this._clicks = []; + this._timeout = slowClickConfig.timeout / 1e3; + this._threshold = slowClickConfig.threshold / 1e3; + this._scrollTimeout = slowClickConfig.scrollTimeout / 1e3; + this._replay = replay; + this._ignoreSelector = slowClickConfig.ignoreSelector; + this._addBreadcrumbEvent = _addBreadcrumbEvent; + } + /** Register click detection handlers on mutation or scroll. */ + addListeners() { + const cleanupWindowOpen = onWindowOpen(() => { + this._lastMutation = nowInSeconds(); + }); + this._teardown = () => { + cleanupWindowOpen(); + this._clicks = []; + this._lastMutation = 0; + this._lastScroll = 0; + }; + } + /** Clean up listeners. */ + removeListeners() { + if (this._teardown) { + this._teardown(); + } + if (this._checkClickTimeout) { + clearTimeout(this._checkClickTimeout); + } + } + /** @inheritDoc */ + handleClick(breadcrumb, node3) { + if (ignoreElement(node3, this._ignoreSelector) || !isClickBreadcrumb(breadcrumb)) { + return; + } + const newClick = { + timestamp: timestampToS(breadcrumb.timestamp), + clickBreadcrumb: breadcrumb, + // Set this to 0 so we know it originates from the click breadcrumb + clickCount: 0, + node: node3 + }; + if (this._clicks.some((click2) => click2.node === newClick.node && Math.abs(click2.timestamp - newClick.timestamp) < 1)) { + return; + } + this._clicks.push(newClick); + if (this._clicks.length === 1) { + this._scheduleCheckClicks(); + } + } + /** @inheritDoc */ + registerMutation(timestamp2 = Date.now()) { + this._lastMutation = timestampToS(timestamp2); + } + /** @inheritDoc */ + registerScroll(timestamp2 = Date.now()) { + this._lastScroll = timestampToS(timestamp2); + } + /** @inheritDoc */ + registerClick(element) { + const node3 = getClosestInteractive(element); + this._handleMultiClick(node3); + } + /** Count multiple clicks on elements. */ + _handleMultiClick(node3) { + this._getClicks(node3).forEach((click2) => { + click2.clickCount++; + }); + } + /** Get all pending clicks for a given node. */ + _getClicks(node3) { + return this._clicks.filter((click2) => click2.node === node3); + } + /** Check the clicks that happened. */ + _checkClicks() { + const timedOutClicks = []; + const now2 = nowInSeconds(); + this._clicks.forEach((click2) => { + if (!click2.mutationAfter && this._lastMutation) { + click2.mutationAfter = click2.timestamp <= this._lastMutation ? this._lastMutation - click2.timestamp : void 0; + } + if (!click2.scrollAfter && this._lastScroll) { + click2.scrollAfter = click2.timestamp <= this._lastScroll ? this._lastScroll - click2.timestamp : void 0; + } + if (click2.timestamp + this._timeout <= now2) { + timedOutClicks.push(click2); + } + }); + for (const click2 of timedOutClicks) { + const pos2 = this._clicks.indexOf(click2); + if (pos2 > -1) { + this._generateBreadcrumbs(click2); + this._clicks.splice(pos2, 1); + } + } + if (this._clicks.length) { + this._scheduleCheckClicks(); + } + } + /** Generate matching breadcrumb(s) for the click. */ + _generateBreadcrumbs(click2) { + const replay = this._replay; + const hadScroll = click2.scrollAfter && click2.scrollAfter <= this._scrollTimeout; + const hadMutation = click2.mutationAfter && click2.mutationAfter <= this._threshold; + const isSlowClick = !hadScroll && !hadMutation; + const { clickCount, clickBreadcrumb } = click2; + if (isSlowClick) { + const timeAfterClickMs = Math.min(click2.mutationAfter || this._timeout, this._timeout) * 1e3; + const endReason = timeAfterClickMs < this._timeout * 1e3 ? "mutation" : "timeout"; + const breadcrumb = { + type: "default", + message: clickBreadcrumb.message, + timestamp: clickBreadcrumb.timestamp, + category: "ui.slowClickDetected", + data: { + ...clickBreadcrumb.data, + url: WINDOW$1.location.href, + route: replay.getCurrentRoute(), + timeAfterClickMs, + endReason, + // If clickCount === 0, it means multiClick was not correctly captured here + // - we still want to send 1 in this case + clickCount: clickCount || 1 + } + }; + this._addBreadcrumbEvent(replay, breadcrumb); + return; + } + if (clickCount > 1) { + const breadcrumb = { + type: "default", + message: clickBreadcrumb.message, + timestamp: clickBreadcrumb.timestamp, + category: "ui.multiClick", + data: { + ...clickBreadcrumb.data, + url: WINDOW$1.location.href, + route: replay.getCurrentRoute(), + clickCount, + metric: true + } + }; + this._addBreadcrumbEvent(replay, breadcrumb); + } + } + /** Schedule to check current clicks. */ + _scheduleCheckClicks() { + if (this._checkClickTimeout) { + clearTimeout(this._checkClickTimeout); + } + this._checkClickTimeout = setTimeout$3(() => this._checkClicks(), 1e3); + } +} +const SLOW_CLICK_TAGS = ["A", "BUTTON", "INPUT"]; +function ignoreElement(node3, ignoreSelector) { + if (!SLOW_CLICK_TAGS.includes(node3.tagName)) { + return true; + } + if (node3.tagName === "INPUT" && !["submit", "button"].includes(node3.getAttribute("type") || "")) { + return true; + } + if (node3.tagName === "A" && (node3.hasAttribute("download") || node3.hasAttribute("target") && node3.getAttribute("target") !== "_self")) { + return true; + } + if (ignoreSelector && node3.matches(ignoreSelector)) { + return true; + } + return false; +} +__name(ignoreElement, "ignoreElement"); +function isClickBreadcrumb(breadcrumb) { + return !!(breadcrumb.data && typeof breadcrumb.data.nodeId === "number" && breadcrumb.timestamp); +} +__name(isClickBreadcrumb, "isClickBreadcrumb"); +function nowInSeconds() { + return Date.now() / 1e3; +} +__name(nowInSeconds, "nowInSeconds"); +function updateClickDetectorForRecordingEvent(clickDetector, event) { + try { + if (!isIncrementalEvent(event)) { + return; + } + const { source } = event.data; + if (IncrementalMutationSources.has(source)) { + clickDetector.registerMutation(event.timestamp); + } + if (source === IncrementalSource.Scroll) { + clickDetector.registerScroll(event.timestamp); + } + if (isIncrementalMouseInteraction(event)) { + const { type, id: id3 } = event.data; + const node3 = record.mirror.getNode(id3); + if (node3 instanceof HTMLElement && type === MouseInteractions.Click) { + clickDetector.registerClick(node3); + } + } + } catch (e2) { + } +} +__name(updateClickDetectorForRecordingEvent, "updateClickDetectorForRecordingEvent"); +function isIncrementalEvent(event) { + return event.type === ReplayEventTypeIncrementalSnapshot; +} +__name(isIncrementalEvent, "isIncrementalEvent"); +function isIncrementalMouseInteraction(event) { + return event.data.source === IncrementalSource.MouseInteraction; +} +__name(isIncrementalMouseInteraction, "isIncrementalMouseInteraction"); +function createBreadcrumb(breadcrumb) { + return { + timestamp: Date.now() / 1e3, + type: "default", + ...breadcrumb + }; +} +__name(createBreadcrumb, "createBreadcrumb"); +var NodeType$4; +(function(NodeType3) { + NodeType3[NodeType3["Document"] = 0] = "Document"; + NodeType3[NodeType3["DocumentType"] = 1] = "DocumentType"; + NodeType3[NodeType3["Element"] = 2] = "Element"; + NodeType3[NodeType3["Text"] = 3] = "Text"; + NodeType3[NodeType3["CDATA"] = 4] = "CDATA"; + NodeType3[NodeType3["Comment"] = 5] = "Comment"; +})(NodeType$4 || (NodeType$4 = {})); +const ATTRIBUTES_TO_RECORD = /* @__PURE__ */ new Set([ + "id", + "class", + "aria-label", + "role", + "name", + "alt", + "title", + "data-test-id", + "data-testid", + "disabled", + "aria-disabled", + "data-sentry-component" +]); +function getAttributesToRecord(attributes) { + const obj = {}; + if (!attributes["data-sentry-component"] && attributes["data-sentry-element"]) { + attributes["data-sentry-component"] = attributes["data-sentry-element"]; + } + for (const key in attributes) { + if (ATTRIBUTES_TO_RECORD.has(key)) { + let normalizedKey = key; + if (key === "data-testid" || key === "data-test-id") { + normalizedKey = "testId"; + } + obj[normalizedKey] = attributes[key]; + } + } + return obj; +} +__name(getAttributesToRecord, "getAttributesToRecord"); +const handleDomListener = /* @__PURE__ */ __name((replay) => { + return (handlerData) => { + if (!replay.isEnabled()) { + return; + } + const result = handleDom(handlerData); + if (!result) { + return; + } + const isClick = handlerData.name === "click"; + const event = isClick ? handlerData.event : void 0; + if (isClick && replay.clickDetector && event && event.target && !event.altKey && !event.metaKey && !event.ctrlKey && !event.shiftKey) { + handleClick$1( + replay.clickDetector, + result, + getClickTargetNode(handlerData.event) + ); + } + addBreadcrumbEvent(replay, result); + }; +}, "handleDomListener"); +function getBaseDomBreadcrumb(target, message3) { + const nodeId = record.mirror.getId(target); + const node3 = nodeId && record.mirror.getNode(nodeId); + const meta = node3 && record.mirror.getMeta(node3); + const element = meta && isElement$2(meta) ? meta : null; + return { + message: message3, + data: element ? { + nodeId, + node: { + id: nodeId, + tagName: element.tagName, + textContent: Array.from(element.childNodes).map((node4) => node4.type === NodeType$4.Text && node4.textContent).filter(Boolean).map((text2) => text2.trim()).join(""), + attributes: getAttributesToRecord(element.attributes) + } + } : {} + }; +} +__name(getBaseDomBreadcrumb, "getBaseDomBreadcrumb"); +function handleDom(handlerData) { + const { target, message: message3 } = getDomTarget(handlerData); + return createBreadcrumb({ + category: `ui.${handlerData.name}`, + ...getBaseDomBreadcrumb(target, message3) + }); +} +__name(handleDom, "handleDom"); +function getDomTarget(handlerData) { + const isClick = handlerData.name === "click"; + let message3; + let target = null; + try { + target = isClick ? getClickTargetNode(handlerData.event) : getTargetNode(handlerData.event); + message3 = htmlTreeAsString(target, { maxStringLength: 200 }) || "<unknown>"; + } catch (e2) { + message3 = "<unknown>"; + } + return { target, message: message3 }; +} +__name(getDomTarget, "getDomTarget"); +function isElement$2(node3) { + return node3.type === NodeType$4.Element; +} +__name(isElement$2, "isElement$2"); +function handleKeyboardEvent(replay, event) { + if (!replay.isEnabled()) { + return; + } + replay.updateUserActivity(); + const breadcrumb = getKeyboardBreadcrumb(event); + if (!breadcrumb) { + return; + } + addBreadcrumbEvent(replay, breadcrumb); +} +__name(handleKeyboardEvent, "handleKeyboardEvent"); +function getKeyboardBreadcrumb(event) { + const { metaKey, shiftKey, ctrlKey, altKey, key, target } = event; + if (!target || isInputElement(target) || !key) { + return null; + } + const hasModifierKey = metaKey || ctrlKey || altKey; + const isCharacterKey = key.length === 1; + if (!hasModifierKey && isCharacterKey) { + return null; + } + const message3 = htmlTreeAsString(target, { maxStringLength: 200 }) || "<unknown>"; + const baseBreadcrumb = getBaseDomBreadcrumb(target, message3); + return createBreadcrumb({ + category: "ui.keyDown", + message: message3, + data: { + ...baseBreadcrumb.data, + metaKey, + shiftKey, + ctrlKey, + altKey, + key + } + }); +} +__name(getKeyboardBreadcrumb, "getKeyboardBreadcrumb"); +function isInputElement(target) { + return target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.isContentEditable; +} +__name(isInputElement, "isInputElement"); +const ENTRY_TYPES = { + // @ts-expect-error TODO: entry type does not fit the create* functions entry type + resource: createResourceEntry, + paint: createPaintEntry, + // @ts-expect-error TODO: entry type does not fit the create* functions entry type + navigation: createNavigationEntry +}; +function webVitalHandler(getter, replay) { + return ({ metric }) => void replay.replayPerformanceEntries.push(getter(metric)); +} +__name(webVitalHandler, "webVitalHandler"); +function createPerformanceEntries(entries) { + return entries.map(createPerformanceEntry).filter(Boolean); +} +__name(createPerformanceEntries, "createPerformanceEntries"); +function createPerformanceEntry(entry) { + const entryType = ENTRY_TYPES[entry.entryType]; + if (!entryType) { + return null; + } + return entryType(entry); +} +__name(createPerformanceEntry, "createPerformanceEntry"); +function getAbsoluteTime$1(time) { + return ((browserPerformanceTimeOrigin || WINDOW$1.performance.timeOrigin) + time) / 1e3; +} +__name(getAbsoluteTime$1, "getAbsoluteTime$1"); +function createPaintEntry(entry) { + const { duration, entryType, name: name2, startTime } = entry; + const start2 = getAbsoluteTime$1(startTime); + return { + type: entryType, + name: name2, + start: start2, + end: start2 + duration, + data: void 0 + }; +} +__name(createPaintEntry, "createPaintEntry"); +function createNavigationEntry(entry) { + const { + entryType, + name: name2, + decodedBodySize, + duration, + domComplete, + encodedBodySize, + domContentLoadedEventStart, + domContentLoadedEventEnd, + domInteractive, + loadEventStart, + loadEventEnd, + redirectCount, + startTime, + transferSize, + type + } = entry; + if (duration === 0) { + return null; + } + return { + type: `${entryType}.${type}`, + start: getAbsoluteTime$1(startTime), + end: getAbsoluteTime$1(domComplete), + name: name2, + data: { + size: transferSize, + decodedBodySize, + encodedBodySize, + duration, + domInteractive, + domContentLoadedEventStart, + domContentLoadedEventEnd, + loadEventStart, + loadEventEnd, + domComplete, + redirectCount + } + }; +} +__name(createNavigationEntry, "createNavigationEntry"); +function createResourceEntry(entry) { + const { + entryType, + initiatorType, + name: name2, + responseEnd, + startTime, + decodedBodySize, + encodedBodySize, + responseStatus, + transferSize + } = entry; + if (["fetch", "xmlhttprequest"].includes(initiatorType)) { + return null; + } + return { + type: `${entryType}.${initiatorType}`, + start: getAbsoluteTime$1(startTime), + end: getAbsoluteTime$1(responseEnd), + name: name2, + data: { + size: transferSize, + statusCode: responseStatus, + decodedBodySize, + encodedBodySize + } + }; +} +__name(createResourceEntry, "createResourceEntry"); +function getLargestContentfulPaint(metric) { + const lastEntry = metric.entries[metric.entries.length - 1]; + const node3 = lastEntry && lastEntry.element ? [lastEntry.element] : void 0; + return getWebVital(metric, "largest-contentful-paint", node3); +} +__name(getLargestContentfulPaint, "getLargestContentfulPaint"); +function isLayoutShift(entry) { + return entry.sources !== void 0; +} +__name(isLayoutShift, "isLayoutShift"); +function getCumulativeLayoutShift(metric) { + const layoutShifts = []; + const nodes = []; + for (const entry of metric.entries) { + if (isLayoutShift(entry)) { + const nodeIds = []; + for (const source of entry.sources) { + if (source.node) { + nodes.push(source.node); + const nodeId = record.mirror.getId(source.node); + if (nodeId) { + nodeIds.push(nodeId); + } + } + } + layoutShifts.push({ value: entry.value, nodeIds: nodeIds.length ? nodeIds : void 0 }); + } + } + return getWebVital(metric, "cumulative-layout-shift", nodes, layoutShifts); +} +__name(getCumulativeLayoutShift, "getCumulativeLayoutShift"); +function getFirstInputDelay(metric) { + const lastEntry = metric.entries[metric.entries.length - 1]; + const node3 = lastEntry && lastEntry.target ? [lastEntry.target] : void 0; + return getWebVital(metric, "first-input-delay", node3); +} +__name(getFirstInputDelay, "getFirstInputDelay"); +function getInteractionToNextPaint(metric) { + const lastEntry = metric.entries[metric.entries.length - 1]; + const node3 = lastEntry && lastEntry.target ? [lastEntry.target] : void 0; + return getWebVital(metric, "interaction-to-next-paint", node3); +} +__name(getInteractionToNextPaint, "getInteractionToNextPaint"); +function getWebVital(metric, name2, nodes, attributions) { + const value4 = metric.value; + const rating = metric.rating; + const end = getAbsoluteTime$1(value4); + return { + type: "web-vital", + name: name2, + start: end, + end, + data: { + value: value4, + size: value4, + rating, + nodeIds: nodes ? nodes.map((node3) => record.mirror.getId(node3)) : void 0, + attributions + } + }; +} +__name(getWebVital, "getWebVital"); +function setupPerformanceObserver(replay) { + function addPerformanceEntry(entry) { + if (!replay.performanceEntries.includes(entry)) { + replay.performanceEntries.push(entry); + } + } + __name(addPerformanceEntry, "addPerformanceEntry"); + function onEntries({ entries }) { + entries.forEach(addPerformanceEntry); + } + __name(onEntries, "onEntries"); + const clearCallbacks = []; + ["navigation", "paint", "resource"].forEach((type) => { + clearCallbacks.push(addPerformanceInstrumentationHandler(type, onEntries)); + }); + clearCallbacks.push( + addLcpInstrumentationHandler(webVitalHandler(getLargestContentfulPaint, replay)), + addClsInstrumentationHandler(webVitalHandler(getCumulativeLayoutShift, replay)), + addFidInstrumentationHandler(webVitalHandler(getFirstInputDelay, replay)), + addInpInstrumentationHandler(webVitalHandler(getInteractionToNextPaint, replay)) + ); + return () => { + clearCallbacks.forEach((clearCallback) => clearCallback()); + }; +} +__name(setupPerformanceObserver, "setupPerformanceObserver"); +const DEBUG_BUILD$2 = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__; +const r$3 = `var t=Uint8Array,n=Uint16Array,r=Int32Array,e=new t([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),i=new t([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),a=new t([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),s=function(t,e){for(var i=new n(31),a=0;a<31;++a)i[a]=e+=1<<t[a-1];var s=new r(i[30]);for(a=1;a<30;++a)for(var o=i[a];o<i[a+1];++o)s[o]=o-i[a]<<5|a;return{b:i,r:s}},o=s(e,2),f=o.b,h=o.r;f[28]=258,h[258]=28;for(var l=s(i,0).r,u=new n(32768),c=0;c<32768;++c){var v=(43690&c)>>1|(21845&c)<<1;v=(61680&(v=(52428&v)>>2|(13107&v)<<2))>>4|(3855&v)<<4,u[c]=((65280&v)>>8|(255&v)<<8)>>1}var d=function(t,r,e){for(var i=t.length,a=0,s=new n(r);a<i;++a)t[a]&&++s[t[a]-1];var o,f=new n(r);for(a=1;a<r;++a)f[a]=f[a-1]+s[a-1]<<1;if(e){o=new n(1<<r);var h=15-r;for(a=0;a<i;++a)if(t[a])for(var l=a<<4|t[a],c=r-t[a],v=f[t[a]-1]++<<c,d=v|(1<<c)-1;v<=d;++v)o[u[v]>>h]=l}else for(o=new n(i),a=0;a<i;++a)t[a]&&(o[a]=u[f[t[a]-1]++]>>15-t[a]);return o},g=new t(288);for(c=0;c<144;++c)g[c]=8;for(c=144;c<256;++c)g[c]=9;for(c=256;c<280;++c)g[c]=7;for(c=280;c<288;++c)g[c]=8;var w=new t(32);for(c=0;c<32;++c)w[c]=5;var p=d(g,9,0),y=d(w,5,0),m=function(t){return(t+7)/8|0},b=function(n,r,e){return(null==e||e>n.length)&&(e=n.length),new t(n.subarray(r,e))},M=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],E=function(t,n,r){var e=new Error(n||M[t]);if(e.code=t,Error.captureStackTrace&&Error.captureStackTrace(e,E),!r)throw e;return e},z=function(t,n,r){r<<=7&n;var e=n/8|0;t[e]|=r,t[e+1]|=r>>8},_=function(t,n,r){r<<=7&n;var e=n/8|0;t[e]|=r,t[e+1]|=r>>8,t[e+2]|=r>>16},x=function(r,e){for(var i=[],a=0;a<r.length;++a)r[a]&&i.push({s:a,f:r[a]});var s=i.length,o=i.slice();if(!s)return{t:F,l:0};if(1==s){var f=new t(i[0].s+1);return f[i[0].s]=1,{t:f,l:1}}i.sort((function(t,n){return t.f-n.f})),i.push({s:-1,f:25001});var h=i[0],l=i[1],u=0,c=1,v=2;for(i[0]={s:-1,f:h.f+l.f,l:h,r:l};c!=s-1;)h=i[i[u].f<i[v].f?u++:v++],l=i[u!=c&&i[u].f<i[v].f?u++:v++],i[c++]={s:-1,f:h.f+l.f,l:h,r:l};var d=o[0].s;for(a=1;a<s;++a)o[a].s>d&&(d=o[a].s);var g=new n(d+1),w=A(i[c-1],g,0);if(w>e){a=0;var p=0,y=w-e,m=1<<y;for(o.sort((function(t,n){return g[n.s]-g[t.s]||t.f-n.f}));a<s;++a){var b=o[a].s;if(!(g[b]>e))break;p+=m-(1<<w-g[b]),g[b]=e}for(p>>=y;p>0;){var M=o[a].s;g[M]<e?p-=1<<e-g[M]++-1:++a}for(;a>=0&&p;--a){var E=o[a].s;g[E]==e&&(--g[E],++p)}w=e}return{t:new t(g),l:w}},A=function(t,n,r){return-1==t.s?Math.max(A(t.l,n,r+1),A(t.r,n,r+1)):n[t.s]=r},D=function(t){for(var r=t.length;r&&!t[--r];);for(var e=new n(++r),i=0,a=t[0],s=1,o=function(t){e[i++]=t},f=1;f<=r;++f)if(t[f]==a&&f!=r)++s;else{if(!a&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(a),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(a);s=1,a=t[f]}return{c:e.subarray(0,i),n:r}},T=function(t,n){for(var r=0,e=0;e<n.length;++e)r+=t[e]*n[e];return r},k=function(t,n,r){var e=r.length,i=m(n+2);t[i]=255&e,t[i+1]=e>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var a=0;a<e;++a)t[i+a+4]=r[a];return 8*(i+4+e)},U=function(t,r,s,o,f,h,l,u,c,v,m){z(r,m++,s),++f[256];for(var b=x(f,15),M=b.t,E=b.l,A=x(h,15),U=A.t,C=A.l,F=D(M),I=F.c,S=F.n,L=D(U),O=L.c,j=L.n,q=new n(19),B=0;B<I.length;++B)++q[31&I[B]];for(B=0;B<O.length;++B)++q[31&O[B]];for(var G=x(q,7),H=G.t,J=G.l,K=19;K>4&&!H[a[K-1]];--K);var N,P,Q,R,V=v+5<<3,W=T(f,g)+T(h,w)+l,X=T(f,M)+T(h,U)+l+14+3*K+T(q,H)+2*q[16]+3*q[17]+7*q[18];if(c>=0&&V<=W&&V<=X)return k(r,m,t.subarray(c,c+v));if(z(r,m,1+(X<W)),m+=2,X<W){N=d(M,E,0),P=M,Q=d(U,C,0),R=U;var Y=d(H,J,0);z(r,m,S-257),z(r,m+5,j-1),z(r,m+10,K-4),m+=14;for(B=0;B<K;++B)z(r,m+3*B,H[a[B]]);m+=3*K;for(var Z=[I,O],$=0;$<2;++$){var tt=Z[$];for(B=0;B<tt.length;++B){var nt=31&tt[B];z(r,m,Y[nt]),m+=H[nt],nt>15&&(z(r,m,tt[B]>>5&127),m+=tt[B]>>12)}}}else N=p,P=g,Q=y,R=w;for(B=0;B<u;++B){var rt=o[B];if(rt>255){_(r,m,N[(nt=rt>>18&31)+257]),m+=P[nt+257],nt>7&&(z(r,m,rt>>23&31),m+=e[nt]);var et=31&rt;_(r,m,Q[et]),m+=R[et],et>3&&(_(r,m,rt>>5&8191),m+=i[et])}else _(r,m,N[rt]),m+=P[rt]}return _(r,m,N[256]),m+P[256]},C=new r([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),F=new t(0),I=function(){for(var t=new Int32Array(256),n=0;n<256;++n){for(var r=n,e=9;--e;)r=(1&r&&-306674912)^r>>>1;t[n]=r}return t}(),S=function(){var t=-1;return{p:function(n){for(var r=t,e=0;e<n.length;++e)r=I[255&r^n[e]]^r>>>8;t=r},d:function(){return~t}}},L=function(){var t=1,n=0;return{p:function(r){for(var e=t,i=n,a=0|r.length,s=0;s!=a;){for(var o=Math.min(s+2655,a);s<o;++s)i+=e+=r[s];e=(65535&e)+15*(e>>16),i=(65535&i)+15*(i>>16)}t=e,n=i},d:function(){return(255&(t%=65521))<<24|(65280&t)<<8|(255&(n%=65521))<<8|n>>8}}},O=function(a,s,o,f,u){if(!u&&(u={l:1},s.dictionary)){var c=s.dictionary.subarray(-32768),v=new t(c.length+a.length);v.set(c),v.set(a,c.length),a=v,u.w=c.length}return function(a,s,o,f,u,c){var v=c.z||a.length,d=new t(f+v+5*(1+Math.ceil(v/7e3))+u),g=d.subarray(f,d.length-u),w=c.l,p=7&(c.r||0);if(s){p&&(g[0]=c.r>>3);for(var y=C[s-1],M=y>>13,E=8191&y,z=(1<<o)-1,_=c.p||new n(32768),x=c.h||new n(z+1),A=Math.ceil(o/3),D=2*A,T=function(t){return(a[t]^a[t+1]<<A^a[t+2]<<D)&z},F=new r(25e3),I=new n(288),S=new n(32),L=0,O=0,j=c.i||0,q=0,B=c.w||0,G=0;j+2<v;++j){var H=T(j),J=32767&j,K=x[H];if(_[J]=K,x[H]=J,B<=j){var N=v-j;if((L>7e3||q>24576)&&(N>423||!w)){p=U(a,g,0,F,I,S,O,q,G,j-G,p),q=L=O=0,G=j;for(var P=0;P<286;++P)I[P]=0;for(P=0;P<30;++P)S[P]=0}var Q=2,R=0,V=E,W=J-K&32767;if(N>2&&H==T(j-W))for(var X=Math.min(M,N)-1,Y=Math.min(32767,j),Z=Math.min(258,N);W<=Y&&--V&&J!=K;){if(a[j+Q]==a[j+Q-W]){for(var $=0;$<Z&&a[j+$]==a[j+$-W];++$);if($>Q){if(Q=$,R=W,$>X)break;var tt=Math.min(W,$-2),nt=0;for(P=0;P<tt;++P){var rt=j-W+P&32767,et=rt-_[rt]&32767;et>nt&&(nt=et,K=rt)}}}W+=(J=K)-(K=_[J])&32767}if(R){F[q++]=268435456|h[Q]<<18|l[R];var it=31&h[Q],at=31&l[R];O+=e[it]+i[at],++I[257+it],++S[at],B=j+Q,++L}else F[q++]=a[j],++I[a[j]]}}for(j=Math.max(j,B);j<v;++j)F[q++]=a[j],++I[a[j]];p=U(a,g,w,F,I,S,O,q,G,j-G,p),w||(c.r=7&p|g[p/8|0]<<3,p-=7,c.h=x,c.p=_,c.i=j,c.w=B)}else{for(j=c.w||0;j<v+w;j+=65535){var st=j+65535;st>=v&&(g[p/8|0]=w,st=v),p=k(g,p+1,a.subarray(j,st))}c.i=v}return b(d,0,f+m(p)+u)}(a,null==s.level?6:s.level,null==s.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(a.length)))):12+s.mem,o,f,u)},j=function(t,n,r){for(;r;++n)t[n]=r,r>>>=8},q=function(t,n){var r=n.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=n.level<2?4:9==n.level?2:0,t[9]=3,0!=n.mtime&&j(t,4,Math.floor(new Date(n.mtime||Date.now())/1e3)),r){t[3]=8;for(var e=0;e<=r.length;++e)t[e+10]=r.charCodeAt(e)}},B=function(t){return 10+(t.filename?t.filename.length+1:0)},G=function(){function n(n,r){if("function"==typeof n&&(r=n,n={}),this.ondata=r,this.o=n||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new t(98304),this.o.dictionary){var e=this.o.dictionary.subarray(-32768);this.b.set(e,32768-e.length),this.s.i=32768-e.length}}return n.prototype.p=function(t,n){this.ondata(O(t,this.o,0,0,this.s),n)},n.prototype.push=function(n,r){this.ondata||E(5),this.s.l&&E(4);var e=n.length+this.s.z;if(e>this.b.length){if(e>2*this.b.length-32768){var i=new t(-32768&e);i.set(this.b.subarray(0,this.s.z)),this.b=i}var a=this.b.length-this.s.z;a&&(this.b.set(n.subarray(0,a),this.s.z),this.s.z=this.b.length,this.p(this.b,!1)),this.b.set(this.b.subarray(-32768)),this.b.set(n.subarray(a),32768),this.s.z=n.length-a+32768,this.s.i=32766,this.s.w=32768}else this.b.set(n,this.s.z),this.s.z+=n.length;this.s.l=1&r,(this.s.z>this.s.w+8191||r)&&(this.p(this.b,r||!1),this.s.w=this.s.i,this.s.i-=2)},n}();var H=function(){function t(t,n){this.c=L(),this.v=1,G.call(this,t,n)}return t.prototype.push=function(t,n){this.c.p(t),G.prototype.push.call(this,t,n)},t.prototype.p=function(t,n){var r=O(t,this.o,this.v&&(this.o.dictionary?6:2),n&&4,this.s);this.v&&(function(t,n){var r=n.level,e=0==r?0:r<6?1:9==r?3:2;if(t[0]=120,t[1]=e<<6|(n.dictionary&&32),t[1]|=31-(t[0]<<8|t[1])%31,n.dictionary){var i=L();i.p(n.dictionary),j(t,2,i.d())}}(r,this.o),this.v=0),n&&j(r,r.length-4,this.c.d()),this.ondata(r,n)},t}(),J="undefined"!=typeof TextEncoder&&new TextEncoder,K="undefined"!=typeof TextDecoder&&new TextDecoder;try{K.decode(F,{stream:!0})}catch(t){}var N=function(){function t(t){this.ondata=t}return t.prototype.push=function(t,n){this.ondata||E(5),this.d&&E(4),this.ondata(P(t),this.d=n||!1)},t}();function P(n,r){if(J)return J.encode(n);for(var e=n.length,i=new t(n.length+(n.length>>1)),a=0,s=function(t){i[a++]=t},o=0;o<e;++o){if(a+5>i.length){var f=new t(a+8+(e-o<<1));f.set(i),i=f}var h=n.charCodeAt(o);h<128||r?s(h):h<2048?(s(192|h>>6),s(128|63&h)):h>55295&&h<57344?(s(240|(h=65536+(1047552&h)|1023&n.charCodeAt(++o))>>18),s(128|h>>12&63),s(128|h>>6&63),s(128|63&h)):(s(224|h>>12),s(128|h>>6&63),s(128|63&h))}return b(i,0,a)}function Q(t){return function(t,n){n||(n={});var r=S(),e=t.length;r.p(t);var i=O(t,n,B(n),8),a=i.length;return q(i,n),j(i,a-8,r.d()),j(i,a-4,e),i}(P(t))}const R=new class{constructor(){this._init()}clear(){this._init()}addEvent(t){if(!t)throw new Error("Adding invalid event");const n=this._hasEvents?",":"";this.stream.push(n+t),this._hasEvents=!0}finish(){this.stream.push("]",!0);const t=function(t){let n=0;for(const r of t)n+=r.length;const r=new Uint8Array(n);for(let n=0,e=0,i=t.length;n<i;n++){const i=t[n];r.set(i,e),e+=i.length}return r}(this._deflatedData);return this._init(),t}_init(){this._hasEvents=!1,this._deflatedData=[],this.deflate=new H,this.deflate.ondata=(t,n)=>{this._deflatedData.push(t)},this.stream=new N(((t,n)=>{this.deflate.push(t,n)})),this.stream.push("[")}},V={clear:()=>{R.clear()},addEvent:t=>R.addEvent(t),finish:()=>R.finish(),compress:t=>Q(t)};addEventListener("message",(function(t){const n=t.data.method,r=t.data.id,e=t.data.arg;if(n in V&&"function"==typeof V[n])try{const t=V[n](e);postMessage({id:r,method:n,success:!0,response:t})}catch(t){postMessage({id:r,method:n,success:!1,response:t.message}),console.error(t)}})),postMessage({id:void 0,method:"init",success:!0,response:void 0});`; +function e$1() { + const e2 = new Blob([r$3]); + return URL.createObjectURL(e2); +} +__name(e$1, "e$1"); +const CONSOLE_LEVELS = ["info", "warn", "error", "log"]; +const PREFIX$1 = "[Replay] "; +function _addBreadcrumb(message3, level = "info") { + addBreadcrumb( + { + category: "console", + data: { + logger: "replay" + }, + level, + message: `${PREFIX$1}${message3}` + }, + { level } + ); +} +__name(_addBreadcrumb, "_addBreadcrumb"); +function makeReplayLogger() { + let _capture = false; + let _trace = false; + const _logger = { + exception: /* @__PURE__ */ __name(() => void 0, "exception"), + infoTick: /* @__PURE__ */ __name(() => void 0, "infoTick"), + setConfig: /* @__PURE__ */ __name((opts) => { + _capture = opts.captureExceptions; + _trace = opts.traceInternals; + }, "setConfig") + }; + if (DEBUG_BUILD$2) { + CONSOLE_LEVELS.forEach((name2) => { + _logger[name2] = (...args) => { + logger$2[name2](PREFIX$1, ...args); + if (_trace) { + _addBreadcrumb(args.join(""), severityLevelFromString(name2)); + } + }; + }); + _logger.exception = (error2, ...message3) => { + if (message3.length && _logger.error) { + _logger.error(...message3); + } + logger$2.error(PREFIX$1, error2); + if (_capture) { + captureException(error2); + } else if (_trace) { + _addBreadcrumb(error2, "error"); + } + }; + _logger.infoTick = (...args) => { + logger$2.info(PREFIX$1, ...args); + if (_trace) { + setTimeout(() => _addBreadcrumb(args[0]), 0); + } + }; + } else { + CONSOLE_LEVELS.forEach((name2) => { + _logger[name2] = () => void 0; + }); + } + return _logger; +} +__name(makeReplayLogger, "makeReplayLogger"); +const logger$1 = makeReplayLogger(); +class EventBufferSizeExceededError extends Error { + static { + __name(this, "EventBufferSizeExceededError"); + } + constructor() { + super(`Event buffer exceeded maximum size of ${REPLAY_MAX_EVENT_BUFFER_SIZE}.`); + } +} +class EventBufferArray { + static { + __name(this, "EventBufferArray"); + } + /** All the events that are buffered to be sent. */ + /** @inheritdoc */ + /** @inheritdoc */ + constructor() { + this.events = []; + this._totalSize = 0; + this.hasCheckout = false; + this.waitForCheckout = false; + } + /** @inheritdoc */ + get hasEvents() { + return this.events.length > 0; + } + /** @inheritdoc */ + get type() { + return "sync"; + } + /** @inheritdoc */ + destroy() { + this.events = []; + } + /** @inheritdoc */ + async addEvent(event) { + const eventSize = JSON.stringify(event).length; + this._totalSize += eventSize; + if (this._totalSize > REPLAY_MAX_EVENT_BUFFER_SIZE) { + throw new EventBufferSizeExceededError(); + } + this.events.push(event); + } + /** @inheritdoc */ + finish() { + return new Promise((resolve2) => { + const eventsRet = this.events; + this.clear(); + resolve2(JSON.stringify(eventsRet)); + }); + } + /** @inheritdoc */ + clear() { + this.events = []; + this._totalSize = 0; + this.hasCheckout = false; + } + /** @inheritdoc */ + getEarliestTimestamp() { + const timestamp2 = this.events.map((event) => event.timestamp).sort()[0]; + if (!timestamp2) { + return null; + } + return timestampToMs(timestamp2); + } +} +class WorkerHandler { + static { + __name(this, "WorkerHandler"); + } + constructor(worker) { + this._worker = worker; + this._id = 0; + } + /** + * Ensure the worker is ready (or not). + * This will either resolve when the worker is ready, or reject if an error occurred. + */ + ensureReady() { + if (this._ensureReadyPromise) { + return this._ensureReadyPromise; + } + this._ensureReadyPromise = new Promise((resolve2, reject3) => { + this._worker.addEventListener( + "message", + ({ data: data25 }) => { + if (data25.success) { + resolve2(); + } else { + reject3(); + } + }, + { once: true } + ); + this._worker.addEventListener( + "error", + (error2) => { + reject3(error2); + }, + { once: true } + ); + }); + return this._ensureReadyPromise; + } + /** + * Destroy the worker. + */ + destroy() { + DEBUG_BUILD$2 && logger$1.info("Destroying compression worker"); + this._worker.terminate(); + } + /** + * Post message to worker and wait for response before resolving promise. + */ + postMessage(method, arg) { + const id3 = this._getAndIncrementId(); + return new Promise((resolve2, reject3) => { + const listener = /* @__PURE__ */ __name(({ data: data25 }) => { + const response = data25; + if (response.method !== method) { + return; + } + if (response.id !== id3) { + return; + } + this._worker.removeEventListener("message", listener); + if (!response.success) { + DEBUG_BUILD$2 && logger$1.error("Error in compression worker: ", response.response); + reject3(new Error("Error in compression worker")); + return; + } + resolve2(response.response); + }, "listener"); + this._worker.addEventListener("message", listener); + this._worker.postMessage({ id: id3, method, arg }); + }); + } + /** Get the current ID and increment it for the next call. */ + _getAndIncrementId() { + return this._id++; + } +} +class EventBufferCompressionWorker { + static { + __name(this, "EventBufferCompressionWorker"); + } + /** @inheritdoc */ + /** @inheritdoc */ + constructor(worker) { + this._worker = new WorkerHandler(worker); + this._earliestTimestamp = null; + this._totalSize = 0; + this.hasCheckout = false; + this.waitForCheckout = false; + } + /** @inheritdoc */ + get hasEvents() { + return !!this._earliestTimestamp; + } + /** @inheritdoc */ + get type() { + return "worker"; + } + /** + * Ensure the worker is ready (or not). + * This will either resolve when the worker is ready, or reject if an error occurred. + */ + ensureReady() { + return this._worker.ensureReady(); + } + /** + * Destroy the event buffer. + */ + destroy() { + this._worker.destroy(); + } + /** + * Add an event to the event buffer. + * + * Returns true if event was successfully received and processed by worker. + */ + addEvent(event) { + const timestamp2 = timestampToMs(event.timestamp); + if (!this._earliestTimestamp || timestamp2 < this._earliestTimestamp) { + this._earliestTimestamp = timestamp2; + } + const data25 = JSON.stringify(event); + this._totalSize += data25.length; + if (this._totalSize > REPLAY_MAX_EVENT_BUFFER_SIZE) { + return Promise.reject(new EventBufferSizeExceededError()); + } + return this._sendEventToWorker(data25); + } + /** + * Finish the event buffer and return the compressed data. + */ + finish() { + return this._finishRequest(); + } + /** @inheritdoc */ + clear() { + this._earliestTimestamp = null; + this._totalSize = 0; + this.hasCheckout = false; + this._worker.postMessage("clear").then(null, (e2) => { + DEBUG_BUILD$2 && logger$1.exception(e2, 'Sending "clear" message to worker failed', e2); + }); + } + /** @inheritdoc */ + getEarliestTimestamp() { + return this._earliestTimestamp; + } + /** + * Send the event to the worker. + */ + _sendEventToWorker(data25) { + return this._worker.postMessage("addEvent", data25); + } + /** + * Finish the request and return the compressed data from the worker. + */ + async _finishRequest() { + const response = await this._worker.postMessage("finish"); + this._earliestTimestamp = null; + this._totalSize = 0; + return response; + } +} +class EventBufferProxy { + static { + __name(this, "EventBufferProxy"); + } + constructor(worker) { + this._fallback = new EventBufferArray(); + this._compression = new EventBufferCompressionWorker(worker); + this._used = this._fallback; + this._ensureWorkerIsLoadedPromise = this._ensureWorkerIsLoaded(); + } + /** @inheritdoc */ + get waitForCheckout() { + return this._used.waitForCheckout; + } + /** @inheritdoc */ + get type() { + return this._used.type; + } + /** @inheritDoc */ + get hasEvents() { + return this._used.hasEvents; + } + /** @inheritdoc */ + get hasCheckout() { + return this._used.hasCheckout; + } + /** @inheritdoc */ + set hasCheckout(value4) { + this._used.hasCheckout = value4; + } + /** @inheritdoc */ + // eslint-disable-next-line @typescript-eslint/adjacent-overload-signatures + set waitForCheckout(value4) { + this._used.waitForCheckout = value4; + } + /** @inheritDoc */ + destroy() { + this._fallback.destroy(); + this._compression.destroy(); + } + /** @inheritdoc */ + clear() { + return this._used.clear(); + } + /** @inheritdoc */ + getEarliestTimestamp() { + return this._used.getEarliestTimestamp(); + } + /** + * Add an event to the event buffer. + * + * Returns true if event was successfully added. + */ + addEvent(event) { + return this._used.addEvent(event); + } + /** @inheritDoc */ + async finish() { + await this.ensureWorkerIsLoaded(); + return this._used.finish(); + } + /** Ensure the worker has loaded. */ + ensureWorkerIsLoaded() { + return this._ensureWorkerIsLoadedPromise; + } + /** Actually check if the worker has been loaded. */ + async _ensureWorkerIsLoaded() { + try { + await this._compression.ensureReady(); + } catch (error2) { + DEBUG_BUILD$2 && logger$1.exception(error2, "Failed to load the compression worker, falling back to simple buffer"); + return; + } + await this._switchToCompressionWorker(); + } + /** Switch the used buffer to the compression worker. */ + async _switchToCompressionWorker() { + const { events: events2, hasCheckout, waitForCheckout } = this._fallback; + const addEventPromises = []; + for (const event of events2) { + addEventPromises.push(this._compression.addEvent(event)); + } + this._compression.hasCheckout = hasCheckout; + this._compression.waitForCheckout = waitForCheckout; + this._used = this._compression; + try { + await Promise.all(addEventPromises); + this._fallback.clear(); + } catch (error2) { + DEBUG_BUILD$2 && logger$1.exception(error2, "Failed to add events when switching buffers."); + } + } +} +function createEventBuffer({ + useCompression, + workerUrl: customWorkerUrl +}) { + if (useCompression && // eslint-disable-next-line no-restricted-globals + window.Worker) { + const worker = _loadWorker(customWorkerUrl); + if (worker) { + return worker; + } + } + DEBUG_BUILD$2 && logger$1.info("Using simple buffer"); + return new EventBufferArray(); +} +__name(createEventBuffer, "createEventBuffer"); +function _loadWorker(customWorkerUrl) { + try { + const workerUrl = customWorkerUrl || _getWorkerUrl(); + if (!workerUrl) { + return; + } + DEBUG_BUILD$2 && logger$1.info(`Using compression worker${customWorkerUrl ? ` from ${customWorkerUrl}` : ""}`); + const worker = new Worker(workerUrl); + return new EventBufferProxy(worker); + } catch (error2) { + DEBUG_BUILD$2 && logger$1.exception(error2, "Failed to create compression worker"); + } +} +__name(_loadWorker, "_loadWorker"); +function _getWorkerUrl() { + if (typeof __SENTRY_EXCLUDE_REPLAY_WORKER__ === "undefined" || !__SENTRY_EXCLUDE_REPLAY_WORKER__) { + return e$1(); + } + return ""; +} +__name(_getWorkerUrl, "_getWorkerUrl"); +function hasSessionStorage() { + try { + return "sessionStorage" in WINDOW$1 && !!WINDOW$1.sessionStorage; + } catch (e2) { + return false; + } +} +__name(hasSessionStorage, "hasSessionStorage"); +function clearSession(replay) { + deleteSession(); + replay.session = void 0; +} +__name(clearSession, "clearSession"); +function deleteSession() { + if (!hasSessionStorage()) { + return; + } + try { + WINDOW$1.sessionStorage.removeItem(REPLAY_SESSION_KEY); + } catch (e2) { + } +} +__name(deleteSession, "deleteSession"); +function isSampled(sampleRate) { + if (sampleRate === void 0) { + return false; + } + return Math.random() < sampleRate; +} +__name(isSampled, "isSampled"); +function makeSession(session) { + const now2 = Date.now(); + const id3 = session.id || uuid4(); + const started = session.started || now2; + const lastActivity = session.lastActivity || now2; + const segmentId = session.segmentId || 0; + const sampled = session.sampled; + const previousSessionId = session.previousSessionId; + return { + id: id3, + started, + lastActivity, + segmentId, + sampled, + previousSessionId + }; +} +__name(makeSession, "makeSession"); +function saveSession(session) { + if (!hasSessionStorage()) { + return; + } + try { + WINDOW$1.sessionStorage.setItem(REPLAY_SESSION_KEY, JSON.stringify(session)); + } catch (e2) { + } +} +__name(saveSession, "saveSession"); +function getSessionSampleType(sessionSampleRate, allowBuffering) { + return isSampled(sessionSampleRate) ? "session" : allowBuffering ? "buffer" : false; +} +__name(getSessionSampleType, "getSessionSampleType"); +function createSession({ sessionSampleRate, allowBuffering, stickySession = false }, { previousSessionId } = {}) { + const sampled = getSessionSampleType(sessionSampleRate, allowBuffering); + const session = makeSession({ + sampled, + previousSessionId + }); + if (stickySession) { + saveSession(session); + } + return session; +} +__name(createSession, "createSession"); +function fetchSession() { + if (!hasSessionStorage()) { + return null; + } + try { + const sessionStringFromStorage = WINDOW$1.sessionStorage.getItem(REPLAY_SESSION_KEY); + if (!sessionStringFromStorage) { + return null; + } + const sessionObj = JSON.parse(sessionStringFromStorage); + DEBUG_BUILD$2 && logger$1.infoTick("Loading existing session"); + return makeSession(sessionObj); + } catch (e2) { + return null; + } +} +__name(fetchSession, "fetchSession"); +function isExpired(initialTime, expiry, targetTime = +/* @__PURE__ */ new Date()) { + if (initialTime === null || expiry === void 0 || expiry < 0) { + return true; + } + if (expiry === 0) { + return false; + } + return initialTime + expiry <= targetTime; +} +__name(isExpired, "isExpired"); +function isSessionExpired(session, { + maxReplayDuration, + sessionIdleExpire, + targetTime = Date.now() +}) { + return ( + // First, check that maximum session length has not been exceeded + isExpired(session.started, maxReplayDuration, targetTime) || // check that the idle timeout has not been exceeded (i.e. user has + // performed an action within the last `sessionIdleExpire` ms) + isExpired(session.lastActivity, sessionIdleExpire, targetTime) + ); +} +__name(isSessionExpired, "isSessionExpired"); +function shouldRefreshSession(session, { sessionIdleExpire, maxReplayDuration }) { + if (!isSessionExpired(session, { sessionIdleExpire, maxReplayDuration })) { + return false; + } + if (session.sampled === "buffer" && session.segmentId === 0) { + return false; + } + return true; +} +__name(shouldRefreshSession, "shouldRefreshSession"); +function loadOrCreateSession({ + sessionIdleExpire, + maxReplayDuration, + previousSessionId +}, sessionOptions) { + const existingSession = sessionOptions.stickySession && fetchSession(); + if (!existingSession) { + DEBUG_BUILD$2 && logger$1.infoTick("Creating new session"); + return createSession(sessionOptions, { previousSessionId }); + } + if (!shouldRefreshSession(existingSession, { sessionIdleExpire, maxReplayDuration })) { + return existingSession; + } + DEBUG_BUILD$2 && logger$1.infoTick("Session in sessionStorage is expired, creating new one..."); + return createSession(sessionOptions, { previousSessionId: existingSession.id }); +} +__name(loadOrCreateSession, "loadOrCreateSession"); +function isCustomEvent(event) { + return event.type === EventType.Custom; +} +__name(isCustomEvent, "isCustomEvent"); +function addEventSync(replay, event, isCheckout) { + if (!shouldAddEvent(replay, event)) { + return false; + } + _addEvent(replay, event, isCheckout); + return true; +} +__name(addEventSync, "addEventSync"); +function addEvent(replay, event, isCheckout) { + if (!shouldAddEvent(replay, event)) { + return Promise.resolve(null); + } + return _addEvent(replay, event, isCheckout); +} +__name(addEvent, "addEvent"); +async function _addEvent(replay, event, isCheckout) { + const { eventBuffer } = replay; + if (!eventBuffer || eventBuffer.waitForCheckout && !isCheckout) { + return null; + } + const isBufferMode = replay.recordingMode === "buffer"; + try { + if (isCheckout && isBufferMode) { + eventBuffer.clear(); + } + if (isCheckout) { + eventBuffer.hasCheckout = true; + eventBuffer.waitForCheckout = false; + } + const replayOptions = replay.getOptions(); + const eventAfterPossibleCallback = maybeApplyCallback(event, replayOptions.beforeAddRecordingEvent); + if (!eventAfterPossibleCallback) { + return; + } + return await eventBuffer.addEvent(eventAfterPossibleCallback); + } catch (error2) { + const isExceeded = error2 && error2 instanceof EventBufferSizeExceededError; + const reason = isExceeded ? "addEventSizeExceeded" : "addEvent"; + if (isExceeded && isBufferMode) { + eventBuffer.clear(); + eventBuffer.waitForCheckout = true; + return null; + } + replay.handleException(error2); + await replay.stop({ reason }); + const client = getClient(); + if (client) { + client.recordDroppedEvent("internal_sdk_error", "replay"); + } + } +} +__name(_addEvent, "_addEvent"); +function shouldAddEvent(replay, event) { + if (!replay.eventBuffer || replay.isPaused() || !replay.isEnabled()) { + return false; + } + const timestampInMs = timestampToMs(event.timestamp); + if (timestampInMs + replay.timeouts.sessionIdlePause < Date.now()) { + return false; + } + if (timestampInMs > replay.getContext().initialTimestamp + replay.getOptions().maxReplayDuration) { + DEBUG_BUILD$2 && logger$1.infoTick(`Skipping event with timestamp ${timestampInMs} because it is after maxReplayDuration`); + return false; + } + return true; +} +__name(shouldAddEvent, "shouldAddEvent"); +function maybeApplyCallback(event, callback) { + try { + if (typeof callback === "function" && isCustomEvent(event)) { + return callback(event); + } + } catch (error2) { + DEBUG_BUILD$2 && logger$1.exception(error2, "An error occurred in the `beforeAddRecordingEvent` callback, skipping the event..."); + return null; + } + return event; +} +__name(maybeApplyCallback, "maybeApplyCallback"); +function isErrorEvent(event) { + return !event.type; +} +__name(isErrorEvent, "isErrorEvent"); +function isTransactionEvent(event) { + return event.type === "transaction"; +} +__name(isTransactionEvent, "isTransactionEvent"); +function isReplayEvent(event) { + return event.type === "replay_event"; +} +__name(isReplayEvent, "isReplayEvent"); +function isFeedbackEvent(event) { + return event.type === "feedback"; +} +__name(isFeedbackEvent, "isFeedbackEvent"); +function handleAfterSendEvent(replay) { + return (event, sendResponse) => { + if (!replay.isEnabled() || !isErrorEvent(event) && !isTransactionEvent(event)) { + return; + } + const statusCode = sendResponse && sendResponse.statusCode; + if (!statusCode || statusCode < 200 || statusCode >= 300) { + return; + } + if (isTransactionEvent(event)) { + handleTransactionEvent(replay, event); + return; + } + handleErrorEvent(replay, event); + }; +} +__name(handleAfterSendEvent, "handleAfterSendEvent"); +function handleTransactionEvent(replay, event) { + const replayContext = replay.getContext(); + if (event.contexts && event.contexts.trace && event.contexts.trace.trace_id && replayContext.traceIds.size < 100) { + replayContext.traceIds.add(event.contexts.trace.trace_id); + } +} +__name(handleTransactionEvent, "handleTransactionEvent"); +function handleErrorEvent(replay, event) { + const replayContext = replay.getContext(); + if (event.event_id && replayContext.errorIds.size < 100) { + replayContext.errorIds.add(event.event_id); + } + if (replay.recordingMode !== "buffer" || !event.tags || !event.tags.replayId) { + return; + } + const { beforeErrorSampling } = replay.getOptions(); + if (typeof beforeErrorSampling === "function" && !beforeErrorSampling(event)) { + return; + } + setTimeout$3(async () => { + try { + await replay.sendBufferedReplayOrFlush(); + } catch (err) { + replay.handleException(err); + } + }); +} +__name(handleErrorEvent, "handleErrorEvent"); +function handleBeforeSendEvent(replay) { + return (event) => { + if (!replay.isEnabled() || !isErrorEvent(event)) { + return; + } + handleHydrationError(replay, event); + }; +} +__name(handleBeforeSendEvent, "handleBeforeSendEvent"); +function handleHydrationError(replay, event) { + const exceptionValue = event.exception && event.exception.values && event.exception.values[0] && event.exception.values[0].value; + if (typeof exceptionValue !== "string") { + return; + } + if ( + // Only matches errors in production builds of react-dom + // Example https://reactjs.org/docs/error-decoder.html?invariant=423 + // With newer React versions, the messages changed to a different website https://react.dev/errors/418 + exceptionValue.match( + /(reactjs\.org\/docs\/error-decoder\.html\?invariant=|react\.dev\/errors\/)(418|419|422|423|425)/ + ) || // Development builds of react-dom + // Error 1: Hydration failed because the initial UI does not match what was rendered on the server. + // Error 2: Text content does not match server-rendered HTML. Warning: Text content did not match. + exceptionValue.match(/(does not match server-rendered HTML|Hydration failed because)/i) + ) { + const breadcrumb = createBreadcrumb({ + category: "replay.hydrate-error", + data: { + url: getLocationHref() + } + }); + addBreadcrumbEvent(replay, breadcrumb); + } +} +__name(handleHydrationError, "handleHydrationError"); +function handleBreadcrumbs(replay) { + const client = getClient(); + if (!client) { + return; + } + client.on("beforeAddBreadcrumb", (breadcrumb) => beforeAddBreadcrumb(replay, breadcrumb)); +} +__name(handleBreadcrumbs, "handleBreadcrumbs"); +function beforeAddBreadcrumb(replay, breadcrumb) { + if (!replay.isEnabled() || !isBreadcrumbWithCategory(breadcrumb)) { + return; + } + const result = normalizeBreadcrumb(breadcrumb); + if (result) { + addBreadcrumbEvent(replay, result); + } +} +__name(beforeAddBreadcrumb, "beforeAddBreadcrumb"); +function normalizeBreadcrumb(breadcrumb) { + if (!isBreadcrumbWithCategory(breadcrumb) || [ + // fetch & xhr are handled separately,in handleNetworkBreadcrumbs + "fetch", + "xhr", + // These two are breadcrumbs for emitted sentry events, we don't care about them + "sentry.event", + "sentry.transaction" + ].includes(breadcrumb.category) || // We capture UI breadcrumbs separately + breadcrumb.category.startsWith("ui.")) { + return null; + } + if (breadcrumb.category === "console") { + return normalizeConsoleBreadcrumb(breadcrumb); + } + return createBreadcrumb(breadcrumb); +} +__name(normalizeBreadcrumb, "normalizeBreadcrumb"); +function normalizeConsoleBreadcrumb(breadcrumb) { + const args = breadcrumb.data && breadcrumb.data.arguments; + if (!Array.isArray(args) || args.length === 0) { + return createBreadcrumb(breadcrumb); + } + let isTruncated = false; + const normalizedArgs = args.map((arg) => { + if (!arg) { + return arg; + } + if (typeof arg === "string") { + if (arg.length > CONSOLE_ARG_MAX_SIZE) { + isTruncated = true; + return `${arg.slice(0, CONSOLE_ARG_MAX_SIZE)}…`; + } + return arg; + } + if (typeof arg === "object") { + try { + const normalizedArg = normalize$2(arg, 7); + const stringified = JSON.stringify(normalizedArg); + if (stringified.length > CONSOLE_ARG_MAX_SIZE) { + isTruncated = true; + return `${JSON.stringify(normalizedArg, null, 2).slice(0, CONSOLE_ARG_MAX_SIZE)}…`; + } + return normalizedArg; + } catch (e2) { + } + } + return arg; + }); + return createBreadcrumb({ + ...breadcrumb, + data: { + ...breadcrumb.data, + arguments: normalizedArgs, + ...isTruncated ? { _meta: { warnings: ["CONSOLE_ARG_TRUNCATED"] } } : {} + } + }); +} +__name(normalizeConsoleBreadcrumb, "normalizeConsoleBreadcrumb"); +function isBreadcrumbWithCategory(breadcrumb) { + return !!breadcrumb.category; +} +__name(isBreadcrumbWithCategory, "isBreadcrumbWithCategory"); +function isRrwebError(event, hint) { + if (event.type || !event.exception || !event.exception.values || !event.exception.values.length) { + return false; + } + if (hint.originalException && hint.originalException.__rrweb__) { + return true; + } + return false; +} +__name(isRrwebError, "isRrwebError"); +function resetReplayIdOnDynamicSamplingContext() { + const dsc = getCurrentScope$1().getPropagationContext().dsc; + if (dsc) { + delete dsc.replay_id; + } + const activeSpan = getActiveSpan(); + if (activeSpan) { + const dsc2 = getDynamicSamplingContextFromSpan(activeSpan); + delete dsc2.replay_id; + } +} +__name(resetReplayIdOnDynamicSamplingContext, "resetReplayIdOnDynamicSamplingContext"); +function addFeedbackBreadcrumb(replay, event) { + replay.triggerUserActivity(); + replay.addUpdate(() => { + if (!event.timestamp) { + return true; + } + replay.throttledAddEvent({ + type: EventType.Custom, + timestamp: event.timestamp * 1e3, + data: { + tag: "breadcrumb", + payload: { + timestamp: event.timestamp, + type: "default", + category: "sentry.feedback", + data: { + feedbackId: event.event_id + } + } + } + }); + return false; + }); +} +__name(addFeedbackBreadcrumb, "addFeedbackBreadcrumb"); +function shouldSampleForBufferEvent(replay, event) { + if (replay.recordingMode !== "buffer") { + return false; + } + if (event.message === UNABLE_TO_SEND_REPLAY) { + return false; + } + if (!event.exception || event.type) { + return false; + } + return isSampled(replay.getOptions().errorSampleRate); +} +__name(shouldSampleForBufferEvent, "shouldSampleForBufferEvent"); +function handleGlobalEventListener(replay) { + return Object.assign( + (event, hint) => { + if (!replay.isEnabled() || replay.isPaused()) { + return event; + } + if (isReplayEvent(event)) { + delete event.breadcrumbs; + return event; + } + if (!isErrorEvent(event) && !isTransactionEvent(event) && !isFeedbackEvent(event)) { + return event; + } + const isSessionActive = replay.checkAndHandleExpiredSession(); + if (!isSessionActive) { + resetReplayIdOnDynamicSamplingContext(); + return event; + } + if (isFeedbackEvent(event)) { + replay.flush(); + event.contexts.feedback.replay_id = replay.getSessionId(); + addFeedbackBreadcrumb(replay, event); + return event; + } + if (isRrwebError(event, hint) && !replay.getOptions()._experiments.captureExceptions) { + DEBUG_BUILD$2 && logger$1.log("Ignoring error from rrweb internals", event); + return null; + } + const isErrorEventSampled = shouldSampleForBufferEvent(replay, event); + const shouldTagReplayId = isErrorEventSampled || replay.recordingMode === "session"; + if (shouldTagReplayId) { + event.tags = { ...event.tags, replayId: replay.getSessionId() }; + } + return event; + }, + { id: "Replay" } + ); +} +__name(handleGlobalEventListener, "handleGlobalEventListener"); +function createPerformanceSpans(replay, entries) { + return entries.map(({ type, start: start2, end, name: name2, data: data25 }) => { + const response = replay.throttledAddEvent({ + type: EventType.Custom, + timestamp: start2, + data: { + tag: "performanceSpan", + payload: { + op: type, + description: name2, + startTimestamp: start2, + endTimestamp: end, + data: data25 + } + } + }); + return typeof response === "string" ? Promise.resolve(null) : response; + }); +} +__name(createPerformanceSpans, "createPerformanceSpans"); +function handleHistory(handlerData) { + const { from: from2, to } = handlerData; + const now2 = Date.now() / 1e3; + return { + type: "navigation.push", + start: now2, + end: now2, + name: to, + data: { + previous: from2 + } + }; +} +__name(handleHistory, "handleHistory"); +function handleHistorySpanListener(replay) { + return (handlerData) => { + if (!replay.isEnabled()) { + return; + } + const result = handleHistory(handlerData); + if (result === null) { + return; + } + replay.getContext().urls.push(result.name); + replay.triggerUserActivity(); + replay.addUpdate(() => { + createPerformanceSpans(replay, [result]); + return false; + }); + }; +} +__name(handleHistorySpanListener, "handleHistorySpanListener"); +function shouldFilterRequest(replay, url) { + if (DEBUG_BUILD$2 && replay.getOptions()._experiments.traceInternals) { + return false; + } + return isSentryRequestUrl(url, getClient()); +} +__name(shouldFilterRequest, "shouldFilterRequest"); +function addNetworkBreadcrumb(replay, result) { + if (!replay.isEnabled()) { + return; + } + if (result === null) { + return; + } + if (shouldFilterRequest(replay, result.name)) { + return; + } + replay.addUpdate(() => { + createPerformanceSpans(replay, [result]); + return true; + }); +} +__name(addNetworkBreadcrumb, "addNetworkBreadcrumb"); +function getBodySize(body) { + if (!body) { + return void 0; + } + const textEncoder = new TextEncoder(); + try { + if (typeof body === "string") { + return textEncoder.encode(body).length; + } + if (body instanceof URLSearchParams) { + return textEncoder.encode(body.toString()).length; + } + if (body instanceof FormData) { + const formDataStr = _serializeFormData(body); + return textEncoder.encode(formDataStr).length; + } + if (body instanceof Blob) { + return body.size; + } + if (body instanceof ArrayBuffer) { + return body.byteLength; + } + } catch (e2) { + } + return void 0; +} +__name(getBodySize, "getBodySize"); +function parseContentLengthHeader(header3) { + if (!header3) { + return void 0; + } + const size2 = parseInt(header3, 10); + return isNaN(size2) ? void 0 : size2; +} +__name(parseContentLengthHeader, "parseContentLengthHeader"); +function getBodyString(body) { + try { + if (typeof body === "string") { + return [body]; + } + if (body instanceof URLSearchParams) { + return [body.toString()]; + } + if (body instanceof FormData) { + return [_serializeFormData(body)]; + } + if (!body) { + return [void 0]; + } + } catch (error2) { + DEBUG_BUILD$2 && logger$1.exception(error2, "Failed to serialize body", body); + return [void 0, "BODY_PARSE_ERROR"]; + } + DEBUG_BUILD$2 && logger$1.info("Skipping network body because of body type", body); + return [void 0, "UNPARSEABLE_BODY_TYPE"]; +} +__name(getBodyString, "getBodyString"); +function mergeWarning(info, warning) { + if (!info) { + return { + headers: {}, + size: void 0, + _meta: { + warnings: [warning] + } + }; + } + const newMeta = { ...info._meta }; + const existingWarnings = newMeta.warnings || []; + newMeta.warnings = [...existingWarnings, warning]; + info._meta = newMeta; + return info; +} +__name(mergeWarning, "mergeWarning"); +function makeNetworkReplayBreadcrumb(type, data25) { + if (!data25) { + return null; + } + const { startTimestamp, endTimestamp, url, method, statusCode, request, response } = data25; + const result = { + type, + start: startTimestamp / 1e3, + end: endTimestamp / 1e3, + name: url, + data: dropUndefinedKeys({ + method, + statusCode, + request, + response + }) + }; + return result; +} +__name(makeNetworkReplayBreadcrumb, "makeNetworkReplayBreadcrumb"); +function buildSkippedNetworkRequestOrResponse(bodySize) { + return { + headers: {}, + size: bodySize, + _meta: { + warnings: ["URL_SKIPPED"] + } + }; +} +__name(buildSkippedNetworkRequestOrResponse, "buildSkippedNetworkRequestOrResponse"); +function buildNetworkRequestOrResponse(headers, bodySize, body) { + if (!bodySize && Object.keys(headers).length === 0) { + return void 0; + } + if (!bodySize) { + return { + headers + }; + } + if (!body) { + return { + headers, + size: bodySize + }; + } + const info = { + headers, + size: bodySize + }; + const { body: normalizedBody, warnings } = normalizeNetworkBody(body); + info.body = normalizedBody; + if (warnings && warnings.length > 0) { + info._meta = { + warnings + }; + } + return info; +} +__name(buildNetworkRequestOrResponse, "buildNetworkRequestOrResponse"); +function getAllowedHeaders(headers, allowedHeaders) { + return Object.entries(headers).reduce((filteredHeaders, [key, value4]) => { + const normalizedKey = key.toLowerCase(); + if (allowedHeaders.includes(normalizedKey) && headers[key]) { + filteredHeaders[normalizedKey] = value4; + } + return filteredHeaders; + }, {}); +} +__name(getAllowedHeaders, "getAllowedHeaders"); +function _serializeFormData(formData) { + return new URLSearchParams(formData).toString(); +} +__name(_serializeFormData, "_serializeFormData"); +function normalizeNetworkBody(body) { + if (!body || typeof body !== "string") { + return { + body + }; + } + const exceedsSizeLimit = body.length > NETWORK_BODY_MAX_SIZE; + const isProbablyJson = _strIsProbablyJson(body); + if (exceedsSizeLimit) { + const truncatedBody = body.slice(0, NETWORK_BODY_MAX_SIZE); + if (isProbablyJson) { + return { + body: truncatedBody, + warnings: ["MAYBE_JSON_TRUNCATED"] + }; + } + return { + body: `${truncatedBody}…`, + warnings: ["TEXT_TRUNCATED"] + }; + } + if (isProbablyJson) { + try { + const jsonBody = JSON.parse(body); + return { + body: jsonBody + }; + } catch (e2) { + } + } + return { + body + }; +} +__name(normalizeNetworkBody, "normalizeNetworkBody"); +function _strIsProbablyJson(str) { + const first2 = str[0]; + const last = str[str.length - 1]; + return first2 === "[" && last === "]" || first2 === "{" && last === "}"; +} +__name(_strIsProbablyJson, "_strIsProbablyJson"); +function urlMatches(url, urls) { + const fullUrl = getFullUrl(url); + return stringMatchesSomePattern(fullUrl, urls); +} +__name(urlMatches, "urlMatches"); +function getFullUrl(url, baseURI = WINDOW$1.document.baseURI) { + if (url.startsWith("http://") || url.startsWith("https://") || url.startsWith(WINDOW$1.location.origin)) { + return url; + } + const fixedUrl = new URL(url, baseURI); + if (fixedUrl.origin !== new URL(baseURI).origin) { + return url; + } + const fullUrl = fixedUrl.href; + if (!url.endsWith("/") && fullUrl.endsWith("/")) { + return fullUrl.slice(0, -1); + } + return fullUrl; +} +__name(getFullUrl, "getFullUrl"); +async function captureFetchBreadcrumbToReplay(breadcrumb, hint, options4) { + try { + const data25 = await _prepareFetchData(breadcrumb, hint, options4); + const result = makeNetworkReplayBreadcrumb("resource.fetch", data25); + addNetworkBreadcrumb(options4.replay, result); + } catch (error2) { + DEBUG_BUILD$2 && logger$1.exception(error2, "Failed to capture fetch breadcrumb"); + } +} +__name(captureFetchBreadcrumbToReplay, "captureFetchBreadcrumbToReplay"); +function enrichFetchBreadcrumb(breadcrumb, hint) { + const { input, response } = hint; + const body = input ? _getFetchRequestArgBody(input) : void 0; + const reqSize = getBodySize(body); + const resSize = response ? parseContentLengthHeader(response.headers.get("content-length")) : void 0; + if (reqSize !== void 0) { + breadcrumb.data.request_body_size = reqSize; + } + if (resSize !== void 0) { + breadcrumb.data.response_body_size = resSize; + } +} +__name(enrichFetchBreadcrumb, "enrichFetchBreadcrumb"); +async function _prepareFetchData(breadcrumb, hint, options4) { + const now2 = Date.now(); + const { startTimestamp = now2, endTimestamp = now2 } = hint; + const { + url, + method, + status_code: statusCode = 0, + request_body_size: requestBodySize, + response_body_size: responseBodySize + } = breadcrumb.data; + const captureDetails = urlMatches(url, options4.networkDetailAllowUrls) && !urlMatches(url, options4.networkDetailDenyUrls); + const request = captureDetails ? _getRequestInfo(options4, hint.input, requestBodySize) : buildSkippedNetworkRequestOrResponse(requestBodySize); + const response = await _getResponseInfo(captureDetails, options4, hint.response, responseBodySize); + return { + startTimestamp, + endTimestamp, + url, + method, + statusCode, + request, + response + }; +} +__name(_prepareFetchData, "_prepareFetchData"); +function _getRequestInfo({ networkCaptureBodies, networkRequestHeaders }, input, requestBodySize) { + const headers = input ? getRequestHeaders(input, networkRequestHeaders) : {}; + if (!networkCaptureBodies) { + return buildNetworkRequestOrResponse(headers, requestBodySize, void 0); + } + const requestBody = _getFetchRequestArgBody(input); + const [bodyStr, warning] = getBodyString(requestBody); + const data25 = buildNetworkRequestOrResponse(headers, requestBodySize, bodyStr); + if (warning) { + return mergeWarning(data25, warning); + } + return data25; +} +__name(_getRequestInfo, "_getRequestInfo"); +async function _getResponseInfo(captureDetails, { + networkCaptureBodies, + networkResponseHeaders +}, response, responseBodySize) { + if (!captureDetails && responseBodySize !== void 0) { + return buildSkippedNetworkRequestOrResponse(responseBodySize); + } + const headers = response ? getAllHeaders(response.headers, networkResponseHeaders) : {}; + if (!response || !networkCaptureBodies && responseBodySize !== void 0) { + return buildNetworkRequestOrResponse(headers, responseBodySize, void 0); + } + const [bodyText, warning] = await _parseFetchResponseBody(response); + const result = getResponseData(bodyText, { + networkCaptureBodies, + responseBodySize, + captureDetails, + headers + }); + if (warning) { + return mergeWarning(result, warning); + } + return result; +} +__name(_getResponseInfo, "_getResponseInfo"); +function getResponseData(bodyText, { + networkCaptureBodies, + responseBodySize, + captureDetails, + headers +}) { + try { + const size2 = bodyText && bodyText.length && responseBodySize === void 0 ? getBodySize(bodyText) : responseBodySize; + if (!captureDetails) { + return buildSkippedNetworkRequestOrResponse(size2); + } + if (networkCaptureBodies) { + return buildNetworkRequestOrResponse(headers, size2, bodyText); + } + return buildNetworkRequestOrResponse(headers, size2, void 0); + } catch (error2) { + DEBUG_BUILD$2 && logger$1.exception(error2, "Failed to serialize response body"); + return buildNetworkRequestOrResponse(headers, responseBodySize, void 0); + } +} +__name(getResponseData, "getResponseData"); +async function _parseFetchResponseBody(response) { + const res = _tryCloneResponse(response); + if (!res) { + return [void 0, "BODY_PARSE_ERROR"]; + } + try { + const text2 = await _tryGetResponseText(res); + return [text2]; + } catch (error2) { + if (error2 instanceof Error && error2.message.indexOf("Timeout") > -1) { + DEBUG_BUILD$2 && logger$1.warn("Parsing text body from response timed out"); + return [void 0, "BODY_PARSE_TIMEOUT"]; + } + DEBUG_BUILD$2 && logger$1.exception(error2, "Failed to get text body from response"); + return [void 0, "BODY_PARSE_ERROR"]; + } +} +__name(_parseFetchResponseBody, "_parseFetchResponseBody"); +function _getFetchRequestArgBody(fetchArgs = []) { + if (fetchArgs.length !== 2 || typeof fetchArgs[1] !== "object") { + return void 0; + } + return fetchArgs[1].body; +} +__name(_getFetchRequestArgBody, "_getFetchRequestArgBody"); +function getAllHeaders(headers, allowedHeaders) { + const allHeaders = {}; + allowedHeaders.forEach((header3) => { + if (headers.get(header3)) { + allHeaders[header3] = headers.get(header3); + } + }); + return allHeaders; +} +__name(getAllHeaders, "getAllHeaders"); +function getRequestHeaders(fetchArgs, allowedHeaders) { + if (fetchArgs.length === 1 && typeof fetchArgs[0] !== "string") { + return getHeadersFromOptions(fetchArgs[0], allowedHeaders); + } + if (fetchArgs.length === 2) { + return getHeadersFromOptions(fetchArgs[1], allowedHeaders); + } + return {}; +} +__name(getRequestHeaders, "getRequestHeaders"); +function getHeadersFromOptions(input, allowedHeaders) { + if (!input) { + return {}; + } + const headers = input.headers; + if (!headers) { + return {}; + } + if (headers instanceof Headers) { + return getAllHeaders(headers, allowedHeaders); + } + if (Array.isArray(headers)) { + return {}; + } + return getAllowedHeaders(headers, allowedHeaders); +} +__name(getHeadersFromOptions, "getHeadersFromOptions"); +function _tryCloneResponse(response) { + try { + return response.clone(); + } catch (error2) { + DEBUG_BUILD$2 && logger$1.exception(error2, "Failed to clone response body"); + } +} +__name(_tryCloneResponse, "_tryCloneResponse"); +function _tryGetResponseText(response) { + return new Promise((resolve2, reject3) => { + const timeout = setTimeout$3(() => reject3(new Error("Timeout while trying to read response body")), 500); + _getResponseText(response).then( + (txt) => resolve2(txt), + (reason) => reject3(reason) + ).finally(() => clearTimeout(timeout)); + }); +} +__name(_tryGetResponseText, "_tryGetResponseText"); +async function _getResponseText(response) { + return await response.text(); +} +__name(_getResponseText, "_getResponseText"); +async function captureXhrBreadcrumbToReplay(breadcrumb, hint, options4) { + try { + const data25 = _prepareXhrData(breadcrumb, hint, options4); + const result = makeNetworkReplayBreadcrumb("resource.xhr", data25); + addNetworkBreadcrumb(options4.replay, result); + } catch (error2) { + DEBUG_BUILD$2 && logger$1.exception(error2, "Failed to capture xhr breadcrumb"); + } +} +__name(captureXhrBreadcrumbToReplay, "captureXhrBreadcrumbToReplay"); +function enrichXhrBreadcrumb(breadcrumb, hint) { + const { xhr, input } = hint; + if (!xhr) { + return; + } + const reqSize = getBodySize(input); + const resSize = xhr.getResponseHeader("content-length") ? parseContentLengthHeader(xhr.getResponseHeader("content-length")) : _getBodySize(xhr.response, xhr.responseType); + if (reqSize !== void 0) { + breadcrumb.data.request_body_size = reqSize; + } + if (resSize !== void 0) { + breadcrumb.data.response_body_size = resSize; + } +} +__name(enrichXhrBreadcrumb, "enrichXhrBreadcrumb"); +function _prepareXhrData(breadcrumb, hint, options4) { + const now2 = Date.now(); + const { startTimestamp = now2, endTimestamp = now2, input, xhr } = hint; + const { + url, + method, + status_code: statusCode = 0, + request_body_size: requestBodySize, + response_body_size: responseBodySize + } = breadcrumb.data; + if (!url) { + return null; + } + if (!xhr || !urlMatches(url, options4.networkDetailAllowUrls) || urlMatches(url, options4.networkDetailDenyUrls)) { + const request2 = buildSkippedNetworkRequestOrResponse(requestBodySize); + const response2 = buildSkippedNetworkRequestOrResponse(responseBodySize); + return { + startTimestamp, + endTimestamp, + url, + method, + statusCode, + request: request2, + response: response2 + }; + } + const xhrInfo = xhr[SENTRY_XHR_DATA_KEY]; + const networkRequestHeaders = xhrInfo ? getAllowedHeaders(xhrInfo.request_headers, options4.networkRequestHeaders) : {}; + const networkResponseHeaders = getAllowedHeaders(getResponseHeaders(xhr), options4.networkResponseHeaders); + const [requestBody, requestWarning] = options4.networkCaptureBodies ? getBodyString(input) : [void 0]; + const [responseBody, responseWarning] = options4.networkCaptureBodies ? _getXhrResponseBody(xhr) : [void 0]; + const request = buildNetworkRequestOrResponse(networkRequestHeaders, requestBodySize, requestBody); + const response = buildNetworkRequestOrResponse(networkResponseHeaders, responseBodySize, responseBody); + return { + startTimestamp, + endTimestamp, + url, + method, + statusCode, + request: requestWarning ? mergeWarning(request, requestWarning) : request, + response: responseWarning ? mergeWarning(response, responseWarning) : response + }; +} +__name(_prepareXhrData, "_prepareXhrData"); +function getResponseHeaders(xhr) { + const headers = xhr.getAllResponseHeaders(); + if (!headers) { + return {}; + } + return headers.split("\r\n").reduce((acc, line) => { + const [key, value4] = line.split(": "); + if (value4) { + acc[key.toLowerCase()] = value4; + } + return acc; + }, {}); +} +__name(getResponseHeaders, "getResponseHeaders"); +function _getXhrResponseBody(xhr) { + const errors2 = []; + try { + return [xhr.responseText]; + } catch (e2) { + errors2.push(e2); + } + try { + return _parseXhrResponse(xhr.response, xhr.responseType); + } catch (e2) { + errors2.push(e2); + } + DEBUG_BUILD$2 && logger$1.warn("Failed to get xhr response body", ...errors2); + return [void 0]; +} +__name(_getXhrResponseBody, "_getXhrResponseBody"); +function _parseXhrResponse(body, responseType) { + try { + if (typeof body === "string") { + return [body]; + } + if (body instanceof Document) { + return [body.body.outerHTML]; + } + if (responseType === "json" && body && typeof body === "object") { + return [JSON.stringify(body)]; + } + if (!body) { + return [void 0]; + } + } catch (error2) { + DEBUG_BUILD$2 && logger$1.exception(error2, "Failed to serialize body", body); + return [void 0, "BODY_PARSE_ERROR"]; + } + DEBUG_BUILD$2 && logger$1.info("Skipping network body because of body type", body); + return [void 0, "UNPARSEABLE_BODY_TYPE"]; +} +__name(_parseXhrResponse, "_parseXhrResponse"); +function _getBodySize(body, responseType) { + try { + const bodyStr = responseType === "json" && body && typeof body === "object" ? JSON.stringify(body) : body; + return getBodySize(bodyStr); + } catch (e2) { + return void 0; + } +} +__name(_getBodySize, "_getBodySize"); +function handleNetworkBreadcrumbs(replay) { + const client = getClient(); + try { + const { + networkDetailAllowUrls, + networkDetailDenyUrls, + networkCaptureBodies, + networkRequestHeaders, + networkResponseHeaders + } = replay.getOptions(); + const options4 = { + replay, + networkDetailAllowUrls, + networkDetailDenyUrls, + networkCaptureBodies, + networkRequestHeaders, + networkResponseHeaders + }; + if (client) { + client.on("beforeAddBreadcrumb", (breadcrumb, hint) => beforeAddNetworkBreadcrumb(options4, breadcrumb, hint)); + } + } catch (e2) { + } +} +__name(handleNetworkBreadcrumbs, "handleNetworkBreadcrumbs"); +function beforeAddNetworkBreadcrumb(options4, breadcrumb, hint) { + if (!breadcrumb.data) { + return; + } + try { + if (_isXhrBreadcrumb(breadcrumb) && _isXhrHint(hint)) { + enrichXhrBreadcrumb(breadcrumb, hint); + captureXhrBreadcrumbToReplay(breadcrumb, hint, options4); + } + if (_isFetchBreadcrumb(breadcrumb) && _isFetchHint(hint)) { + enrichFetchBreadcrumb(breadcrumb, hint); + captureFetchBreadcrumbToReplay(breadcrumb, hint, options4); + } + } catch (e2) { + DEBUG_BUILD$2 && logger$1.exception(e2, "Error when enriching network breadcrumb"); + } +} +__name(beforeAddNetworkBreadcrumb, "beforeAddNetworkBreadcrumb"); +function _isXhrBreadcrumb(breadcrumb) { + return breadcrumb.category === "xhr"; +} +__name(_isXhrBreadcrumb, "_isXhrBreadcrumb"); +function _isFetchBreadcrumb(breadcrumb) { + return breadcrumb.category === "fetch"; +} +__name(_isFetchBreadcrumb, "_isFetchBreadcrumb"); +function _isXhrHint(hint) { + return hint && hint.xhr; +} +__name(_isXhrHint, "_isXhrHint"); +function _isFetchHint(hint) { + return hint && hint.response; +} +__name(_isFetchHint, "_isFetchHint"); +function addGlobalListeners(replay) { + const client = getClient(); + addClickKeypressInstrumentationHandler(handleDomListener(replay)); + addHistoryInstrumentationHandler(handleHistorySpanListener(replay)); + handleBreadcrumbs(replay); + handleNetworkBreadcrumbs(replay); + const eventProcessor = handleGlobalEventListener(replay); + addEventProcessor(eventProcessor); + if (client) { + client.on("beforeSendEvent", handleBeforeSendEvent(replay)); + client.on("afterSendEvent", handleAfterSendEvent(replay)); + client.on("createDsc", (dsc) => { + const replayId = replay.getSessionId(); + if (replayId && replay.isEnabled() && replay.recordingMode === "session") { + const isSessionActive = replay.checkAndHandleExpiredSession(); + if (isSessionActive) { + dsc.replay_id = replayId; + } + } + }); + client.on("spanStart", (span) => { + replay.lastActiveSpan = span; + }); + client.on("spanEnd", (span) => { + replay.lastActiveSpan = span; + }); + client.on("beforeSendFeedback", (feedbackEvent, options4) => { + const replayId = replay.getSessionId(); + if (options4 && options4.includeReplay && replay.isEnabled() && replayId) { + if (feedbackEvent.contexts && feedbackEvent.contexts.feedback) { + feedbackEvent.contexts.feedback.replay_id = replayId; + } + } + }); + } +} +__name(addGlobalListeners, "addGlobalListeners"); +async function addMemoryEntry(replay) { + try { + return Promise.all( + createPerformanceSpans(replay, [ + // @ts-expect-error memory doesn't exist on type Performance as the API is non-standard (we check that it exists above) + createMemoryEntry(WINDOW$1.performance.memory) + ]) + ); + } catch (error2) { + return []; + } +} +__name(addMemoryEntry, "addMemoryEntry"); +function createMemoryEntry(memoryEntry) { + const { jsHeapSizeLimit, totalJSHeapSize, usedJSHeapSize } = memoryEntry; + const time = Date.now() / 1e3; + return { + type: "memory", + name: "memory", + start: time, + end: time, + data: { + memory: { + jsHeapSizeLimit, + totalJSHeapSize, + usedJSHeapSize + } + } + }; +} +__name(createMemoryEntry, "createMemoryEntry"); +function debounce(func, wait, options4) { + let callbackReturnValue; + let timerId; + let maxTimerId; + const maxWait = options4 && options4.maxWait ? Math.max(options4.maxWait, wait) : 0; + function invokeFunc() { + cancelTimers(); + callbackReturnValue = func(); + return callbackReturnValue; + } + __name(invokeFunc, "invokeFunc"); + function cancelTimers() { + timerId !== void 0 && clearTimeout(timerId); + maxTimerId !== void 0 && clearTimeout(maxTimerId); + timerId = maxTimerId = void 0; + } + __name(cancelTimers, "cancelTimers"); + function flush2() { + if (timerId !== void 0 || maxTimerId !== void 0) { + return invokeFunc(); + } + return callbackReturnValue; + } + __name(flush2, "flush"); + function debounced() { + if (timerId) { + clearTimeout(timerId); + } + timerId = setTimeout$3(invokeFunc, wait); + if (maxWait && maxTimerId === void 0) { + maxTimerId = setTimeout$3(invokeFunc, maxWait); + } + return callbackReturnValue; + } + __name(debounced, "debounced"); + debounced.cancel = cancelTimers; + debounced.flush = flush2; + return debounced; +} +__name(debounce, "debounce"); +function getHandleRecordingEmit(replay) { + let hadFirstEvent = false; + return (event, _isCheckout) => { + if (!replay.checkAndHandleExpiredSession()) { + DEBUG_BUILD$2 && logger$1.warn("Received replay event after session expired."); + return; + } + const isCheckout = _isCheckout || !hadFirstEvent; + hadFirstEvent = true; + if (replay.clickDetector) { + updateClickDetectorForRecordingEvent(replay.clickDetector, event); + } + replay.addUpdate(() => { + if (replay.recordingMode === "buffer" && isCheckout) { + replay.setInitialState(); + } + if (!addEventSync(replay, event, isCheckout)) { + return true; + } + if (!isCheckout) { + return false; + } + const session = replay.session; + addSettingsEvent(replay, isCheckout); + if (replay.recordingMode === "buffer" && session && replay.eventBuffer) { + const earliestEvent = replay.eventBuffer.getEarliestTimestamp(); + if (earliestEvent) { + DEBUG_BUILD$2 && logger$1.info(`Updating session start time to earliest event in buffer to ${new Date(earliestEvent)}`); + session.started = earliestEvent; + if (replay.getOptions().stickySession) { + saveSession(session); + } + } + } + if (session && session.previousSessionId) { + return true; + } + if (replay.recordingMode === "session") { + void replay.flush(); + } + return true; + }); + }; +} +__name(getHandleRecordingEmit, "getHandleRecordingEmit"); +function createOptionsEvent(replay) { + const options4 = replay.getOptions(); + return { + type: EventType.Custom, + timestamp: Date.now(), + data: { + tag: "options", + payload: { + shouldRecordCanvas: replay.isRecordingCanvas(), + sessionSampleRate: options4.sessionSampleRate, + errorSampleRate: options4.errorSampleRate, + useCompressionOption: options4.useCompression, + blockAllMedia: options4.blockAllMedia, + maskAllText: options4.maskAllText, + maskAllInputs: options4.maskAllInputs, + useCompression: replay.eventBuffer ? replay.eventBuffer.type === "worker" : false, + networkDetailHasUrls: options4.networkDetailAllowUrls.length > 0, + networkCaptureBodies: options4.networkCaptureBodies, + networkRequestHasHeaders: options4.networkRequestHeaders.length > 0, + networkResponseHasHeaders: options4.networkResponseHeaders.length > 0 + } + } + }; +} +__name(createOptionsEvent, "createOptionsEvent"); +function addSettingsEvent(replay, isCheckout) { + if (!isCheckout || !replay.session || replay.session.segmentId !== 0) { + return; + } + addEventSync(replay, createOptionsEvent(replay), false); +} +__name(addSettingsEvent, "addSettingsEvent"); +function createReplayEnvelope(replayEvent, recordingData, dsn, tunnel) { + return createEnvelope( + createEventEnvelopeHeaders(replayEvent, getSdkMetadataForEnvelopeHeader(replayEvent), tunnel, dsn), + [ + [{ type: "replay_event" }, replayEvent], + [ + { + type: "replay_recording", + // If string then we need to encode to UTF8, otherwise will have + // wrong size. TextEncoder has similar browser support to + // MutationObserver, although it does not accept IE11. + length: typeof recordingData === "string" ? new TextEncoder().encode(recordingData).length : recordingData.length + }, + recordingData + ] + ] + ); +} +__name(createReplayEnvelope, "createReplayEnvelope"); +function prepareRecordingData({ + recordingData, + headers +}) { + let payloadWithSequence; + const replayHeaders = `${JSON.stringify(headers)} +`; + if (typeof recordingData === "string") { + payloadWithSequence = `${replayHeaders}${recordingData}`; + } else { + const enc = new TextEncoder(); + const sequence = enc.encode(replayHeaders); + payloadWithSequence = new Uint8Array(sequence.length + recordingData.length); + payloadWithSequence.set(sequence); + payloadWithSequence.set(recordingData, sequence.length); + } + return payloadWithSequence; +} +__name(prepareRecordingData, "prepareRecordingData"); +async function prepareReplayEvent({ + client, + scope, + replayId: event_id, + event +}) { + const integrations = typeof client._integrations === "object" && client._integrations !== null && !Array.isArray(client._integrations) ? Object.keys(client._integrations) : void 0; + const eventHint = { event_id, integrations }; + client.emit("preprocessEvent", event, eventHint); + const preparedEvent = await prepareEvent( + client.getOptions(), + event, + eventHint, + scope, + client, + getIsolationScope() + ); + if (!preparedEvent) { + return null; + } + preparedEvent.platform = preparedEvent.platform || "javascript"; + const metadata = client.getSdkMetadata(); + const { name: name2, version: version2 } = metadata && metadata.sdk || {}; + preparedEvent.sdk = { + ...preparedEvent.sdk, + name: name2 || "sentry.javascript.unknown", + version: version2 || "0.0.0" + }; + return preparedEvent; +} +__name(prepareReplayEvent, "prepareReplayEvent"); +async function sendReplayRequest({ + recordingData, + replayId, + segmentId: segment_id, + eventContext, + timestamp: timestamp2, + session +}) { + const preparedRecordingData = prepareRecordingData({ + recordingData, + headers: { + segment_id + } + }); + const { urls, errorIds, traceIds, initialTimestamp } = eventContext; + const client = getClient(); + const scope = getCurrentScope$1(); + const transport = client && client.getTransport(); + const dsn = client && client.getDsn(); + if (!client || !transport || !dsn || !session.sampled) { + return resolvedSyncPromise({}); + } + const baseEvent = { + type: REPLAY_EVENT_NAME, + replay_start_timestamp: initialTimestamp / 1e3, + timestamp: timestamp2 / 1e3, + error_ids: errorIds, + trace_ids: traceIds, + urls, + replay_id: replayId, + segment_id, + replay_type: session.sampled + }; + const replayEvent = await prepareReplayEvent({ scope, client, replayId, event: baseEvent }); + if (!replayEvent) { + client.recordDroppedEvent("event_processor", "replay", baseEvent); + DEBUG_BUILD$2 && logger$1.info("An event processor returned `null`, will not send event."); + return resolvedSyncPromise({}); + } + delete replayEvent.sdkProcessingMetadata; + const envelope = createReplayEnvelope(replayEvent, preparedRecordingData, dsn, client.getOptions().tunnel); + let response; + try { + response = await transport.send(envelope); + } catch (err) { + const error2 = new Error(UNABLE_TO_SEND_REPLAY); + try { + error2.cause = err; + } catch (e2) { + } + throw error2; + } + if (typeof response.statusCode === "number" && (response.statusCode < 200 || response.statusCode >= 300)) { + throw new TransportStatusCodeError(response.statusCode); + } + const rateLimits = updateRateLimits({}, response); + if (isRateLimited(rateLimits, "replay")) { + throw new RateLimitError(rateLimits); + } + return response; +} +__name(sendReplayRequest, "sendReplayRequest"); +class TransportStatusCodeError extends Error { + static { + __name(this, "TransportStatusCodeError"); + } + constructor(statusCode) { + super(`Transport returned status code ${statusCode}`); + } +} +class RateLimitError extends Error { + static { + __name(this, "RateLimitError"); + } + constructor(rateLimits) { + super("Rate limit hit"); + this.rateLimits = rateLimits; + } +} +async function sendReplay(replayData, retryConfig = { + count: 0, + interval: RETRY_BASE_INTERVAL +}) { + const { recordingData, onError } = replayData; + if (!recordingData.length) { + return; + } + try { + await sendReplayRequest(replayData); + return true; + } catch (err) { + if (err instanceof TransportStatusCodeError || err instanceof RateLimitError) { + throw err; + } + setContext("Replays", { + _retryCount: retryConfig.count + }); + if (onError) { + onError(err); + } + if (retryConfig.count >= RETRY_MAX_COUNT) { + const error2 = new Error(`${UNABLE_TO_SEND_REPLAY} - max retries exceeded`); + try { + error2.cause = err; + } catch (e2) { + } + throw error2; + } + retryConfig.interval *= ++retryConfig.count; + return new Promise((resolve2, reject3) => { + setTimeout$3(async () => { + try { + await sendReplay(replayData, retryConfig); + resolve2(true); + } catch (err2) { + reject3(err2); + } + }, retryConfig.interval); + }); + } +} +__name(sendReplay, "sendReplay"); +const THROTTLED = "__THROTTLED"; +const SKIPPED = "__SKIPPED"; +function throttle$2(fn, maxCount, durationSeconds) { + const counter = /* @__PURE__ */ new Map(); + const _cleanup = /* @__PURE__ */ __name((now2) => { + const threshold = now2 - durationSeconds; + counter.forEach((_value, key) => { + if (key < threshold) { + counter.delete(key); + } + }); + }, "_cleanup"); + const _getTotalCount = /* @__PURE__ */ __name(() => { + return [...counter.values()].reduce((a2, b2) => a2 + b2, 0); + }, "_getTotalCount"); + let isThrottled = false; + return (...rest) => { + const now2 = Math.floor(Date.now() / 1e3); + _cleanup(now2); + if (_getTotalCount() >= maxCount) { + const wasThrottled = isThrottled; + isThrottled = true; + return wasThrottled ? SKIPPED : THROTTLED; + } + isThrottled = false; + const count = counter.get(now2) || 0; + counter.set(now2, count + 1); + return fn(...rest); + }; +} +__name(throttle$2, "throttle$2"); +class ReplayContainer { + static { + __name(this, "ReplayContainer"); + } + /** + * Recording can happen in one of two modes: + * - session: Record the whole session, sending it continuously + * - buffer: Always keep the last 60s of recording, requires: + * - having replaysOnErrorSampleRate > 0 to capture replay when an error occurs + * - or calling `flush()` to send the replay + */ + /** + * The current or last active span. + * This is only available when performance is enabled. + */ + /** + * These are here so we can overwrite them in tests etc. + * @hidden + */ + /** The replay has to be manually started, because no sample rate (neither session or error) was provided. */ + /** + * Options to pass to `rrweb.record()` + */ + /** + * Timestamp of the last user activity. This lives across sessions. + */ + /** + * Is the integration currently active? + */ + /** + * Paused is a state where: + * - DOM Recording is not listening at all + * - Nothing will be added to event buffer (e.g. core SDK events) + */ + /** + * Have we attached listeners to the core SDK? + * Note we have to track this as there is no way to remove instrumentation handlers. + */ + /** + * Function to stop recording + */ + /** + * Internal use for canvas recording options + */ + constructor({ + options: options4, + recordingOptions + }) { + ReplayContainer.prototype.__init.call(this); + ReplayContainer.prototype.__init2.call(this); + ReplayContainer.prototype.__init3.call(this); + ReplayContainer.prototype.__init4.call(this); + ReplayContainer.prototype.__init5.call(this); + ReplayContainer.prototype.__init6.call(this); + this.eventBuffer = null; + this.performanceEntries = []; + this.replayPerformanceEntries = []; + this.recordingMode = "session"; + this.timeouts = { + sessionIdlePause: SESSION_IDLE_PAUSE_DURATION, + sessionIdleExpire: SESSION_IDLE_EXPIRE_DURATION + }; + this._lastActivity = Date.now(); + this._isEnabled = false; + this._isPaused = false; + this._requiresManualStart = false; + this._hasInitializedCoreListeners = false; + this._context = { + errorIds: /* @__PURE__ */ new Set(), + traceIds: /* @__PURE__ */ new Set(), + urls: [], + initialTimestamp: Date.now(), + initialUrl: "" + }; + this._recordingOptions = recordingOptions; + this._options = options4; + this._debouncedFlush = debounce(() => this._flush(), this._options.flushMinDelay, { + maxWait: this._options.flushMaxDelay + }); + this._throttledAddEvent = throttle$2( + (event, isCheckout) => addEvent(this, event, isCheckout), + // Max 300 events... + 300, + // ... per 5s + 5 + ); + const { slowClickTimeout, slowClickIgnoreSelectors } = this.getOptions(); + const slowClickConfig = slowClickTimeout ? { + threshold: Math.min(SLOW_CLICK_THRESHOLD, slowClickTimeout), + timeout: slowClickTimeout, + scrollTimeout: SLOW_CLICK_SCROLL_TIMEOUT, + ignoreSelector: slowClickIgnoreSelectors ? slowClickIgnoreSelectors.join(",") : "" + } : void 0; + if (slowClickConfig) { + this.clickDetector = new ClickDetector(this, slowClickConfig); + } + if (DEBUG_BUILD$2) { + const experiments = options4._experiments; + logger$1.setConfig({ + captureExceptions: !!experiments.captureExceptions, + traceInternals: !!experiments.traceInternals + }); + } + } + /** Get the event context. */ + getContext() { + return this._context; + } + /** If recording is currently enabled. */ + isEnabled() { + return this._isEnabled; + } + /** If recording is currently paused. */ + isPaused() { + return this._isPaused; + } + /** + * Determine if canvas recording is enabled + */ + isRecordingCanvas() { + return Boolean(this._canvas); + } + /** Get the replay integration options. */ + getOptions() { + return this._options; + } + /** A wrapper to conditionally capture exceptions. */ + handleException(error2) { + DEBUG_BUILD$2 && logger$1.exception(error2); + if (this._options.onError) { + this._options.onError(error2); + } + } + /** + * Initializes the plugin based on sampling configuration. Should not be + * called outside of constructor. + */ + initializeSampling(previousSessionId) { + const { errorSampleRate, sessionSampleRate } = this._options; + const requiresManualStart = errorSampleRate <= 0 && sessionSampleRate <= 0; + this._requiresManualStart = requiresManualStart; + if (requiresManualStart) { + return; + } + this._initializeSessionForSampling(previousSessionId); + if (!this.session) { + DEBUG_BUILD$2 && logger$1.exception(new Error("Unable to initialize and create session")); + return; + } + if (this.session.sampled === false) { + return; + } + this.recordingMode = this.session.sampled === "buffer" && this.session.segmentId === 0 ? "buffer" : "session"; + DEBUG_BUILD$2 && logger$1.infoTick(`Starting replay in ${this.recordingMode} mode`); + this._initializeRecording(); + } + /** + * Start a replay regardless of sampling rate. Calling this will always + * create a new session. Will log a message if replay is already in progress. + * + * Creates or loads a session, attaches listeners to varying events (DOM, + * _performanceObserver, Recording, Sentry SDK, etc) + */ + start() { + if (this._isEnabled && this.recordingMode === "session") { + DEBUG_BUILD$2 && logger$1.info("Recording is already in progress"); + return; + } + if (this._isEnabled && this.recordingMode === "buffer") { + DEBUG_BUILD$2 && logger$1.info("Buffering is in progress, call `flush()` to save the replay"); + return; + } + DEBUG_BUILD$2 && logger$1.infoTick("Starting replay in session mode"); + this._updateUserActivity(); + const session = loadOrCreateSession( + { + maxReplayDuration: this._options.maxReplayDuration, + sessionIdleExpire: this.timeouts.sessionIdleExpire + }, + { + stickySession: this._options.stickySession, + // This is intentional: create a new session-based replay when calling `start()` + sessionSampleRate: 1, + allowBuffering: false + } + ); + this.session = session; + this._initializeRecording(); + } + /** + * Start replay buffering. Buffers until `flush()` is called or, if + * `replaysOnErrorSampleRate` > 0, an error occurs. + */ + startBuffering() { + if (this._isEnabled) { + DEBUG_BUILD$2 && logger$1.info("Buffering is in progress, call `flush()` to save the replay"); + return; + } + DEBUG_BUILD$2 && logger$1.infoTick("Starting replay in buffer mode"); + const session = loadOrCreateSession( + { + sessionIdleExpire: this.timeouts.sessionIdleExpire, + maxReplayDuration: this._options.maxReplayDuration + }, + { + stickySession: this._options.stickySession, + sessionSampleRate: 0, + allowBuffering: true + } + ); + this.session = session; + this.recordingMode = "buffer"; + this._initializeRecording(); + } + /** + * Start recording. + * + * Note that this will cause a new DOM checkout + */ + startRecording() { + try { + const canvasOptions = this._canvas; + this._stopRecording = record({ + ...this._recordingOptions, + // When running in error sampling mode, we need to overwrite `checkoutEveryNms` + // Without this, it would record forever, until an error happens, which we don't want + // instead, we'll always keep the last 60 seconds of replay before an error happened + ...this.recordingMode === "buffer" ? { checkoutEveryNms: BUFFER_CHECKOUT_TIME } : ( + // Otherwise, use experimental option w/ min checkout time of 6 minutes + // This is to improve playback seeking as there could potentially be + // less mutations to process in the worse cases. + // + // checkout by "N" events is probably ideal, but means we have less + // control about the number of checkouts we make (which generally + // increases replay size) + this._options._experiments.continuousCheckout && { + // Minimum checkout time is 6 minutes + checkoutEveryNms: Math.max(36e4, this._options._experiments.continuousCheckout) + } + ), + emit: getHandleRecordingEmit(this), + onMutation: this._onMutationHandler, + ...canvasOptions ? { + recordCanvas: canvasOptions.recordCanvas, + getCanvasManager: canvasOptions.getCanvasManager, + sampling: canvasOptions.sampling, + dataURLOptions: canvasOptions.dataURLOptions + } : {} + }); + } catch (err) { + this.handleException(err); + } + } + /** + * Stops the recording, if it was running. + * + * Returns true if it was previously stopped, or is now stopped, + * otherwise false. + */ + stopRecording() { + try { + if (this._stopRecording) { + this._stopRecording(); + this._stopRecording = void 0; + } + return true; + } catch (err) { + this.handleException(err); + return false; + } + } + /** + * Currently, this needs to be manually called (e.g. for tests). Sentry SDK + * does not support a teardown + */ + async stop({ forceFlush = false, reason } = {}) { + if (!this._isEnabled) { + return; + } + this._isEnabled = false; + try { + DEBUG_BUILD$2 && logger$1.info(`Stopping Replay${reason ? ` triggered by ${reason}` : ""}`); + resetReplayIdOnDynamicSamplingContext(); + this._removeListeners(); + this.stopRecording(); + this._debouncedFlush.cancel(); + if (forceFlush) { + await this._flush({ force: true }); + } + this.eventBuffer && this.eventBuffer.destroy(); + this.eventBuffer = null; + clearSession(this); + } catch (err) { + this.handleException(err); + } + } + /** + * Pause some replay functionality. See comments for `_isPaused`. + * This differs from stop as this only stops DOM recording, it is + * not as thorough of a shutdown as `stop()`. + */ + pause() { + if (this._isPaused) { + return; + } + this._isPaused = true; + this.stopRecording(); + DEBUG_BUILD$2 && logger$1.info("Pausing replay"); + } + /** + * Resumes recording, see notes for `pause(). + * + * Note that calling `startRecording()` here will cause a + * new DOM checkout.` + */ + resume() { + if (!this._isPaused || !this._checkSession()) { + return; + } + this._isPaused = false; + this.startRecording(); + DEBUG_BUILD$2 && logger$1.info("Resuming replay"); + } + /** + * If not in "session" recording mode, flush event buffer which will create a new replay. + * Unless `continueRecording` is false, the replay will continue to record and + * behave as a "session"-based replay. + * + * Otherwise, queue up a flush. + */ + async sendBufferedReplayOrFlush({ continueRecording = true } = {}) { + if (this.recordingMode === "session") { + return this.flushImmediate(); + } + const activityTime = Date.now(); + DEBUG_BUILD$2 && logger$1.info("Converting buffer to session"); + await this.flushImmediate(); + const hasStoppedRecording = this.stopRecording(); + if (!continueRecording || !hasStoppedRecording) { + return; + } + if (this.recordingMode === "session") { + return; + } + this.recordingMode = "session"; + if (this.session) { + this._updateUserActivity(activityTime); + this._updateSessionActivity(activityTime); + this._maybeSaveSession(); + } + this.startRecording(); + } + /** + * We want to batch uploads of replay events. Save events only if + * `<flushMinDelay>` milliseconds have elapsed since the last event + * *OR* if `<flushMaxDelay>` milliseconds have elapsed. + * + * Accepts a callback to perform side-effects and returns true to stop batch + * processing and hand back control to caller. + */ + addUpdate(cb) { + const cbResult = cb(); + if (this.recordingMode === "buffer") { + return; + } + if (cbResult === true) { + return; + } + this._debouncedFlush(); + } + /** + * Updates the user activity timestamp and resumes recording. This should be + * called in an event handler for a user action that we consider as the user + * being "active" (e.g. a mouse click). + */ + triggerUserActivity() { + this._updateUserActivity(); + if (!this._stopRecording) { + if (!this._checkSession()) { + return; + } + this.resume(); + return; + } + this.checkAndHandleExpiredSession(); + this._updateSessionActivity(); + } + /** + * Updates the user activity timestamp *without* resuming + * recording. Some user events (e.g. keydown) can be create + * low-value replays that only contain the keypress as a + * breadcrumb. Instead this would require other events to + * create a new replay after a session has expired. + */ + updateUserActivity() { + this._updateUserActivity(); + this._updateSessionActivity(); + } + /** + * Only flush if `this.recordingMode === 'session'` + */ + conditionalFlush() { + if (this.recordingMode === "buffer") { + return Promise.resolve(); + } + return this.flushImmediate(); + } + /** + * Flush using debounce flush + */ + flush() { + return this._debouncedFlush(); + } + /** + * Always flush via `_debouncedFlush` so that we do not have flushes triggered + * from calling both `flush` and `_debouncedFlush`. Otherwise, there could be + * cases of multiple flushes happening closely together. + */ + flushImmediate() { + this._debouncedFlush(); + return this._debouncedFlush.flush(); + } + /** + * Cancels queued up flushes. + */ + cancelFlush() { + this._debouncedFlush.cancel(); + } + /** Get the current session (=replay) ID */ + getSessionId() { + return this.session && this.session.id; + } + /** + * Checks if recording should be stopped due to user inactivity. Otherwise + * check if session is expired and create a new session if so. Triggers a new + * full snapshot on new session. + * + * Returns true if session is not expired, false otherwise. + * @hidden + */ + checkAndHandleExpiredSession() { + if (this._lastActivity && isExpired(this._lastActivity, this.timeouts.sessionIdlePause) && this.session && this.session.sampled === "session") { + this.pause(); + return; + } + if (!this._checkSession()) { + return false; + } + return true; + } + /** + * Capture some initial state that can change throughout the lifespan of the + * replay. This is required because otherwise they would be captured at the + * first flush. + */ + setInitialState() { + const urlPath = `${WINDOW$1.location.pathname}${WINDOW$1.location.hash}${WINDOW$1.location.search}`; + const url = `${WINDOW$1.location.origin}${urlPath}`; + this.performanceEntries = []; + this.replayPerformanceEntries = []; + this._clearContext(); + this._context.initialUrl = url; + this._context.initialTimestamp = Date.now(); + this._context.urls.push(url); + } + /** + * Add a breadcrumb event, that may be throttled. + * If it was throttled, we add a custom breadcrumb to indicate that. + */ + throttledAddEvent(event, isCheckout) { + const res = this._throttledAddEvent(event, isCheckout); + if (res === THROTTLED) { + const breadcrumb = createBreadcrumb({ + category: "replay.throttled" + }); + this.addUpdate(() => { + return !addEventSync(this, { + type: ReplayEventTypeCustom, + timestamp: breadcrumb.timestamp || 0, + data: { + tag: "breadcrumb", + payload: breadcrumb, + metric: true + } + }); + }); + } + return res; + } + /** + * This will get the parametrized route name of the current page. + * This is only available if performance is enabled, and if an instrumented router is used. + */ + getCurrentRoute() { + const lastActiveSpan = this.lastActiveSpan || getActiveSpan(); + const lastRootSpan = lastActiveSpan && getRootSpan(lastActiveSpan); + const attributes = lastRootSpan && spanToJSON(lastRootSpan).data || {}; + const source = attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]; + if (!lastRootSpan || !source || !["route", "custom"].includes(source)) { + return void 0; + } + return spanToJSON(lastRootSpan).description; + } + /** + * Initialize and start all listeners to varying events (DOM, + * Performance Observer, Recording, Sentry SDK, etc) + */ + _initializeRecording() { + this.setInitialState(); + this._updateSessionActivity(); + this.eventBuffer = createEventBuffer({ + useCompression: this._options.useCompression, + workerUrl: this._options.workerUrl + }); + this._removeListeners(); + this._addListeners(); + this._isEnabled = true; + this._isPaused = false; + this.startRecording(); + } + /** + * Loads (or refreshes) the current session. + */ + _initializeSessionForSampling(previousSessionId) { + const allowBuffering = this._options.errorSampleRate > 0; + const session = loadOrCreateSession( + { + sessionIdleExpire: this.timeouts.sessionIdleExpire, + maxReplayDuration: this._options.maxReplayDuration, + previousSessionId + }, + { + stickySession: this._options.stickySession, + sessionSampleRate: this._options.sessionSampleRate, + allowBuffering + } + ); + this.session = session; + } + /** + * Checks and potentially refreshes the current session. + * Returns false if session is not recorded. + */ + _checkSession() { + if (!this.session) { + return false; + } + const currentSession = this.session; + if (shouldRefreshSession(currentSession, { + sessionIdleExpire: this.timeouts.sessionIdleExpire, + maxReplayDuration: this._options.maxReplayDuration + })) { + this._refreshSession(currentSession); + return false; + } + return true; + } + /** + * Refresh a session with a new one. + * This stops the current session (without forcing a flush, as that would never work since we are expired), + * and then does a new sampling based on the refreshed session. + */ + async _refreshSession(session) { + if (!this._isEnabled) { + return; + } + await this.stop({ reason: "refresh session" }); + this.initializeSampling(session.id); + } + /** + * Adds listeners to record events for the replay + */ + _addListeners() { + try { + WINDOW$1.document.addEventListener("visibilitychange", this._handleVisibilityChange); + WINDOW$1.addEventListener("blur", this._handleWindowBlur); + WINDOW$1.addEventListener("focus", this._handleWindowFocus); + WINDOW$1.addEventListener("keydown", this._handleKeyboardEvent); + if (this.clickDetector) { + this.clickDetector.addListeners(); + } + if (!this._hasInitializedCoreListeners) { + addGlobalListeners(this); + this._hasInitializedCoreListeners = true; + } + } catch (err) { + this.handleException(err); + } + this._performanceCleanupCallback = setupPerformanceObserver(this); + } + /** + * Cleans up listeners that were created in `_addListeners` + */ + _removeListeners() { + try { + WINDOW$1.document.removeEventListener("visibilitychange", this._handleVisibilityChange); + WINDOW$1.removeEventListener("blur", this._handleWindowBlur); + WINDOW$1.removeEventListener("focus", this._handleWindowFocus); + WINDOW$1.removeEventListener("keydown", this._handleKeyboardEvent); + if (this.clickDetector) { + this.clickDetector.removeListeners(); + } + if (this._performanceCleanupCallback) { + this._performanceCleanupCallback(); + } + } catch (err) { + this.handleException(err); + } + } + /** + * Handle when visibility of the page content changes. Opening a new tab will + * cause the state to change to hidden because of content of current page will + * be hidden. Likewise, moving a different window to cover the contents of the + * page will also trigger a change to a hidden state. + */ + __init() { + this._handleVisibilityChange = () => { + if (WINDOW$1.document.visibilityState === "visible") { + this._doChangeToForegroundTasks(); + } else { + this._doChangeToBackgroundTasks(); + } + }; + } + /** + * Handle when page is blurred + */ + __init2() { + this._handleWindowBlur = () => { + const breadcrumb = createBreadcrumb({ + category: "ui.blur" + }); + this._doChangeToBackgroundTasks(breadcrumb); + }; + } + /** + * Handle when page is focused + */ + __init3() { + this._handleWindowFocus = () => { + const breadcrumb = createBreadcrumb({ + category: "ui.focus" + }); + this._doChangeToForegroundTasks(breadcrumb); + }; + } + /** Ensure page remains active when a key is pressed. */ + __init4() { + this._handleKeyboardEvent = (event) => { + handleKeyboardEvent(this, event); + }; + } + /** + * Tasks to run when we consider a page to be hidden (via blurring and/or visibility) + */ + _doChangeToBackgroundTasks(breadcrumb) { + if (!this.session) { + return; + } + const expired = isSessionExpired(this.session, { + maxReplayDuration: this._options.maxReplayDuration, + sessionIdleExpire: this.timeouts.sessionIdleExpire + }); + if (expired) { + return; + } + if (breadcrumb) { + this._createCustomBreadcrumb(breadcrumb); + } + void this.conditionalFlush(); + } + /** + * Tasks to run when we consider a page to be visible (via focus and/or visibility) + */ + _doChangeToForegroundTasks(breadcrumb) { + if (!this.session) { + return; + } + const isSessionActive = this.checkAndHandleExpiredSession(); + if (!isSessionActive) { + DEBUG_BUILD$2 && logger$1.info("Document has become active, but session has expired"); + return; + } + if (breadcrumb) { + this._createCustomBreadcrumb(breadcrumb); + } + } + /** + * Update user activity (across session lifespans) + */ + _updateUserActivity(_lastActivity = Date.now()) { + this._lastActivity = _lastActivity; + } + /** + * Updates the session's last activity timestamp + */ + _updateSessionActivity(_lastActivity = Date.now()) { + if (this.session) { + this.session.lastActivity = _lastActivity; + this._maybeSaveSession(); + } + } + /** + * Helper to create (and buffer) a replay breadcrumb from a core SDK breadcrumb + */ + _createCustomBreadcrumb(breadcrumb) { + this.addUpdate(() => { + this.throttledAddEvent({ + type: EventType.Custom, + timestamp: breadcrumb.timestamp || 0, + data: { + tag: "breadcrumb", + payload: breadcrumb + } + }); + }); + } + /** + * Observed performance events are added to `this.performanceEntries`. These + * are included in the replay event before it is finished and sent to Sentry. + */ + _addPerformanceEntries() { + let performanceEntries = createPerformanceEntries(this.performanceEntries).concat(this.replayPerformanceEntries); + this.performanceEntries = []; + this.replayPerformanceEntries = []; + if (this._requiresManualStart) { + const initialTimestampInSeconds = this._context.initialTimestamp / 1e3; + performanceEntries = performanceEntries.filter((entry) => entry.start >= initialTimestampInSeconds); + } + return Promise.all(createPerformanceSpans(this, performanceEntries)); + } + /** + * Clear _context + */ + _clearContext() { + this._context.errorIds.clear(); + this._context.traceIds.clear(); + this._context.urls = []; + } + /** Update the initial timestamp based on the buffer content. */ + _updateInitialTimestampFromEventBuffer() { + const { session, eventBuffer } = this; + if (!session || !eventBuffer || this._requiresManualStart) { + return; + } + if (session.segmentId) { + return; + } + const earliestEvent = eventBuffer.getEarliestTimestamp(); + if (earliestEvent && earliestEvent < this._context.initialTimestamp) { + this._context.initialTimestamp = earliestEvent; + } + } + /** + * Return and clear _context + */ + _popEventContext() { + const _context = { + initialTimestamp: this._context.initialTimestamp, + initialUrl: this._context.initialUrl, + errorIds: Array.from(this._context.errorIds), + traceIds: Array.from(this._context.traceIds), + urls: this._context.urls + }; + this._clearContext(); + return _context; + } + /** + * Flushes replay event buffer to Sentry. + * + * Performance events are only added right before flushing - this is + * due to the buffered performance observer events. + * + * Should never be called directly, only by `flush` + */ + async _runFlush() { + const replayId = this.getSessionId(); + if (!this.session || !this.eventBuffer || !replayId) { + DEBUG_BUILD$2 && logger$1.error("No session or eventBuffer found to flush."); + return; + } + await this._addPerformanceEntries(); + if (!this.eventBuffer || !this.eventBuffer.hasEvents) { + return; + } + await addMemoryEntry(this); + if (!this.eventBuffer) { + return; + } + if (replayId !== this.getSessionId()) { + return; + } + try { + this._updateInitialTimestampFromEventBuffer(); + const timestamp2 = Date.now(); + if (timestamp2 - this._context.initialTimestamp > this._options.maxReplayDuration + 3e4) { + throw new Error("Session is too long, not sending replay"); + } + const eventContext = this._popEventContext(); + const segmentId = this.session.segmentId++; + this._maybeSaveSession(); + const recordingData = await this.eventBuffer.finish(); + await sendReplay({ + replayId, + recordingData, + segmentId, + eventContext, + session: this.session, + timestamp: timestamp2, + onError: /* @__PURE__ */ __name((err) => this.handleException(err), "onError") + }); + } catch (err) { + this.handleException(err); + this.stop({ reason: "sendReplay" }); + const client = getClient(); + if (client) { + const dropReason = err instanceof RateLimitError ? "ratelimit_backoff" : "send_error"; + client.recordDroppedEvent(dropReason, "replay"); + } + } + } + /** + * Flush recording data to Sentry. Creates a lock so that only a single flush + * can be active at a time. Do not call this directly. + */ + __init5() { + this._flush = async ({ + force = false + } = {}) => { + if (!this._isEnabled && !force) { + return; + } + if (!this.checkAndHandleExpiredSession()) { + DEBUG_BUILD$2 && logger$1.error("Attempting to finish replay event after session expired."); + return; + } + if (!this.session) { + return; + } + const start2 = this.session.started; + const now2 = Date.now(); + const duration = now2 - start2; + this._debouncedFlush.cancel(); + const tooShort = duration < this._options.minReplayDuration; + const tooLong = duration > this._options.maxReplayDuration + 5e3; + if (tooShort || tooLong) { + DEBUG_BUILD$2 && logger$1.info( + `Session duration (${Math.floor(duration / 1e3)}s) is too ${tooShort ? "short" : "long"}, not sending replay.` + ); + if (tooShort) { + this._debouncedFlush(); + } + return; + } + const eventBuffer = this.eventBuffer; + if (eventBuffer && this.session.segmentId === 0 && !eventBuffer.hasCheckout) { + DEBUG_BUILD$2 && logger$1.info("Flushing initial segment without checkout."); + } + const _flushInProgress = !!this._flushLock; + if (!this._flushLock) { + this._flushLock = this._runFlush(); + } + try { + await this._flushLock; + } catch (err) { + this.handleException(err); + } finally { + this._flushLock = void 0; + if (_flushInProgress) { + this._debouncedFlush(); + } + } + }; + } + /** Save the session, if it is sticky */ + _maybeSaveSession() { + if (this.session && this._options.stickySession) { + saveSession(this.session); + } + } + /** Handler for rrweb.record.onMutation */ + __init6() { + this._onMutationHandler = (mutations) => { + const count = mutations.length; + const mutationLimit = this._options.mutationLimit; + const mutationBreadcrumbLimit = this._options.mutationBreadcrumbLimit; + const overMutationLimit = mutationLimit && count > mutationLimit; + if (count > mutationBreadcrumbLimit || overMutationLimit) { + const breadcrumb = createBreadcrumb({ + category: "replay.mutations", + data: { + count, + limit: overMutationLimit + } + }); + this._createCustomBreadcrumb(breadcrumb); + } + if (overMutationLimit) { + this.stop({ reason: "mutationLimit", forceFlush: this.recordingMode === "session" }); + return false; + } + return true; + }; + } +} +function getOption(selectors, defaultSelectors) { + return [ + ...selectors, + // sentry defaults + ...defaultSelectors + ].join(","); +} +__name(getOption, "getOption"); +function getPrivacyOptions({ mask: mask3, unmask, block: block3, unblock: unblock2, ignore }) { + const defaultBlockedElements = ["base", "iframe[srcdoc]:not([src])"]; + const maskSelector = getOption(mask3, [".sentry-mask", "[data-sentry-mask]"]); + const unmaskSelector = getOption(unmask, []); + const options4 = { + // We are making the decision to make text and input selectors the same + maskTextSelector: maskSelector, + unmaskTextSelector: unmaskSelector, + blockSelector: getOption(block3, [".sentry-block", "[data-sentry-block]", ...defaultBlockedElements]), + unblockSelector: getOption(unblock2, []), + ignoreSelector: getOption(ignore, [".sentry-ignore", "[data-sentry-ignore]", 'input[type="file"]']) + }; + return options4; +} +__name(getPrivacyOptions, "getPrivacyOptions"); +function maskAttribute({ + el, + key, + maskAttributes, + maskAllText, + privacyOptions, + value: value4 +}) { + if (!maskAllText) { + return value4; + } + if (privacyOptions.unmaskTextSelector && el.matches(privacyOptions.unmaskTextSelector)) { + return value4; + } + if (maskAttributes.includes(key) || // Need to mask `value` attribute for `<input>` if it's a button-like + // type + key === "value" && el.tagName === "INPUT" && ["submit", "button"].includes(el.getAttribute("type") || "")) { + return value4.replace(/[\S]/g, "*"); + } + return value4; +} +__name(maskAttribute, "maskAttribute"); +const MEDIA_SELECTORS = 'img,image,svg,video,object,picture,embed,map,audio,link[rel="icon"],link[rel="apple-touch-icon"]'; +const DEFAULT_NETWORK_HEADERS = ["content-length", "content-type", "accept"]; +let _initialized = false; +const replayIntegration = /* @__PURE__ */ __name((options4) => { + return new Replay(options4); +}, "replayIntegration"); +class Replay { + static { + __name(this, "Replay"); + } + /** + * @inheritDoc + */ + static __initStatic() { + this.id = "Replay"; + } + /** + * @inheritDoc + */ + /** + * Options to pass to `rrweb.record()` + */ + /** + * Initial options passed to the replay integration, merged with default values. + * Note: `sessionSampleRate` and `errorSampleRate` are not required here, as they + * can only be finally set when setupOnce() is called. + * + * @private + */ + constructor({ + flushMinDelay = DEFAULT_FLUSH_MIN_DELAY, + flushMaxDelay = DEFAULT_FLUSH_MAX_DELAY, + minReplayDuration = MIN_REPLAY_DURATION, + maxReplayDuration = MAX_REPLAY_DURATION, + stickySession = true, + useCompression = true, + workerUrl, + _experiments = {}, + maskAllText = true, + maskAllInputs = true, + blockAllMedia = true, + mutationBreadcrumbLimit = 750, + mutationLimit = 1e4, + slowClickTimeout = 7e3, + slowClickIgnoreSelectors = [], + networkDetailAllowUrls = [], + networkDetailDenyUrls = [], + networkCaptureBodies = true, + networkRequestHeaders = [], + networkResponseHeaders = [], + mask: mask3 = [], + maskAttributes = ["title", "placeholder"], + unmask = [], + block: block3 = [], + unblock: unblock2 = [], + ignore = [], + maskFn, + beforeAddRecordingEvent, + beforeErrorSampling, + onError + } = {}) { + this.name = Replay.id; + const privacyOptions = getPrivacyOptions({ + mask: mask3, + unmask, + block: block3, + unblock: unblock2, + ignore + }); + this._recordingOptions = { + maskAllInputs, + maskAllText, + maskInputOptions: { password: true }, + maskTextFn: maskFn, + maskInputFn: maskFn, + maskAttributeFn: /* @__PURE__ */ __name((key, value4, el) => maskAttribute({ + maskAttributes, + maskAllText, + privacyOptions, + key, + value: value4, + el + }), "maskAttributeFn"), + ...privacyOptions, + // Our defaults + slimDOMOptions: "all", + inlineStylesheet: true, + // Disable inline images as it will increase segment/replay size + inlineImages: false, + // collect fonts, but be aware that `sentry.io` needs to be an allowed + // origin for playback + collectFonts: true, + errorHandler: /* @__PURE__ */ __name((err) => { + try { + err.__rrweb__ = true; + } catch (error2) { + } + }, "errorHandler") + }; + this._initialOptions = { + flushMinDelay, + flushMaxDelay, + minReplayDuration: Math.min(minReplayDuration, MIN_REPLAY_DURATION_LIMIT), + maxReplayDuration: Math.min(maxReplayDuration, MAX_REPLAY_DURATION), + stickySession, + useCompression, + workerUrl, + blockAllMedia, + maskAllInputs, + maskAllText, + mutationBreadcrumbLimit, + mutationLimit, + slowClickTimeout, + slowClickIgnoreSelectors, + networkDetailAllowUrls, + networkDetailDenyUrls, + networkCaptureBodies, + networkRequestHeaders: _getMergedNetworkHeaders(networkRequestHeaders), + networkResponseHeaders: _getMergedNetworkHeaders(networkResponseHeaders), + beforeAddRecordingEvent, + beforeErrorSampling, + onError, + _experiments + }; + if (this._initialOptions.blockAllMedia) { + this._recordingOptions.blockSelector = !this._recordingOptions.blockSelector ? MEDIA_SELECTORS : `${this._recordingOptions.blockSelector},${MEDIA_SELECTORS}`; + } + if (this._isInitialized && isBrowser$1()) { + throw new Error("Multiple Sentry Session Replay instances are not supported"); + } + this._isInitialized = true; + } + /** If replay has already been initialized */ + get _isInitialized() { + return _initialized; + } + /** Update _isInitialized */ + set _isInitialized(value4) { + _initialized = value4; + } + /** + * Setup and initialize replay container + */ + afterAllSetup(client) { + if (!isBrowser$1() || this._replay) { + return; + } + this._setup(client); + this._initialize(client); + } + /** + * Start a replay regardless of sampling rate. Calling this will always + * create a new session. Will log a message if replay is already in progress. + * + * Creates or loads a session, attaches listeners to varying events (DOM, + * PerformanceObserver, Recording, Sentry SDK, etc) + */ + start() { + if (!this._replay) { + return; + } + this._replay.start(); + } + /** + * Start replay buffering. Buffers until `flush()` is called or, if + * `replaysOnErrorSampleRate` > 0, until an error occurs. + */ + startBuffering() { + if (!this._replay) { + return; + } + this._replay.startBuffering(); + } + /** + * Currently, this needs to be manually called (e.g. for tests). Sentry SDK + * does not support a teardown + */ + stop() { + if (!this._replay) { + return Promise.resolve(); + } + return this._replay.stop({ forceFlush: this._replay.recordingMode === "session" }); + } + /** + * If not in "session" recording mode, flush event buffer which will create a new replay. + * If replay is not enabled, a new session replay is started. + * Unless `continueRecording` is false, the replay will continue to record and + * behave as a "session"-based replay. + * + * Otherwise, queue up a flush. + */ + flush(options4) { + if (!this._replay) { + return Promise.resolve(); + } + if (!this._replay.isEnabled()) { + this._replay.start(); + return Promise.resolve(); + } + return this._replay.sendBufferedReplayOrFlush(options4); + } + /** + * Get the current session ID. + */ + getReplayId() { + if (!this._replay || !this._replay.isEnabled()) { + return; + } + return this._replay.getSessionId(); + } + /** + * Get the current recording mode. This can be either `session` or `buffer`. + * + * `session`: Recording the whole session, sending it continuously + * `buffer`: Always keeping the last 60s of recording, requires: + * - having replaysOnErrorSampleRate > 0 to capture replay when an error occurs + * - or calling `flush()` to send the replay + */ + getRecordingMode() { + if (!this._replay || !this._replay.isEnabled()) { + return; + } + return this._replay.recordingMode; + } + /** + * Initializes replay. + */ + _initialize(client) { + if (!this._replay) { + return; + } + this._maybeLoadFromReplayCanvasIntegration(client); + this._replay.initializeSampling(); + } + /** Setup the integration. */ + _setup(client) { + const finalOptions = loadReplayOptionsFromClient(this._initialOptions, client); + this._replay = new ReplayContainer({ + options: finalOptions, + recordingOptions: this._recordingOptions + }); + } + /** Get canvas options from ReplayCanvas integration, if it is also added. */ + _maybeLoadFromReplayCanvasIntegration(client) { + try { + const canvasIntegration = client.getIntegrationByName("ReplayCanvas"); + if (!canvasIntegration) { + return; + } + this._replay["_canvas"] = canvasIntegration.getOptions(); + } catch (e2) { + } + } +} +Replay.__initStatic(); +function loadReplayOptionsFromClient(initialOptions, client) { + const opt = client.getOptions(); + const finalOptions = { + sessionSampleRate: 0, + errorSampleRate: 0, + ...dropUndefinedKeys(initialOptions) + }; + const replaysSessionSampleRate = parseSampleRate(opt.replaysSessionSampleRate); + const replaysOnErrorSampleRate = parseSampleRate(opt.replaysOnErrorSampleRate); + if (replaysSessionSampleRate == null && replaysOnErrorSampleRate == null) { + consoleSandbox(() => { + console.warn( + "Replay is disabled because neither `replaysSessionSampleRate` nor `replaysOnErrorSampleRate` are set." + ); + }); + } + if (replaysSessionSampleRate != null) { + finalOptions.sessionSampleRate = replaysSessionSampleRate; + } + if (replaysOnErrorSampleRate != null) { + finalOptions.errorSampleRate = replaysOnErrorSampleRate; + } + return finalOptions; +} +__name(loadReplayOptionsFromClient, "loadReplayOptionsFromClient"); +function _getMergedNetworkHeaders(headers) { + return [...DEFAULT_NETWORK_HEADERS, ...headers.map((header3) => header3.toLowerCase())]; +} +__name(_getMergedNetworkHeaders, "_getMergedNetworkHeaders"); +function getReplay() { + const client = getClient(); + return client && client.getIntegrationByName("Replay"); +} +__name(getReplay, "getReplay"); +var NodeType$2; +(function(NodeType3) { + NodeType3[NodeType3["Document"] = 0] = "Document"; + NodeType3[NodeType3["DocumentType"] = 1] = "DocumentType"; + NodeType3[NodeType3["Element"] = 2] = "Element"; + NodeType3[NodeType3["Text"] = 3] = "Text"; + NodeType3[NodeType3["CDATA"] = 4] = "CDATA"; + NodeType3[NodeType3["Comment"] = 5] = "Comment"; +})(NodeType$2 || (NodeType$2 = {})); +function elementClassMatchesRegex(el, regex2) { + for (let eIndex = el.classList.length; eIndex--; ) { + const className = el.classList[eIndex]; + if (regex2.test(className)) { + return true; + } + } + return false; +} +__name(elementClassMatchesRegex, "elementClassMatchesRegex"); +function distanceToMatch(node3, matchPredicate, limit = Infinity, distance2 = 0) { + if (!node3) + return -1; + if (node3.nodeType !== node3.ELEMENT_NODE) + return -1; + if (distance2 > limit) + return -1; + if (matchPredicate(node3)) + return distance2; + return distanceToMatch(node3.parentNode, matchPredicate, limit, distance2 + 1); +} +__name(distanceToMatch, "distanceToMatch"); +function createMatchPredicate(className, selector) { + return (node3) => { + const el = node3; + if (el === null) + return false; + try { + if (className) { + if (typeof className === "string") { + if (el.matches(`.${className}`)) + return true; + } else if (elementClassMatchesRegex(el, className)) { + return true; + } + } + if (selector && el.matches(selector)) + return true; + return false; + } catch (e2) { + return false; + } + }; +} +__name(createMatchPredicate, "createMatchPredicate"); +const DEPARTED_MIRROR_ACCESS_WARNING = "Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording."; +let _mirror = { + map: {}, + getId() { + console.error(DEPARTED_MIRROR_ACCESS_WARNING); + return -1; + }, + getNode() { + console.error(DEPARTED_MIRROR_ACCESS_WARNING); + return null; + }, + removeNodeFromMap() { + console.error(DEPARTED_MIRROR_ACCESS_WARNING); + }, + has() { + console.error(DEPARTED_MIRROR_ACCESS_WARNING); + return false; + }, + reset() { + console.error(DEPARTED_MIRROR_ACCESS_WARNING); + } +}; +if (typeof window !== "undefined" && window.Proxy && window.Reflect) { + _mirror = new Proxy(_mirror, { + get(target, prop2, receiver) { + if (prop2 === "map") { + console.error(DEPARTED_MIRROR_ACCESS_WARNING); + } + return Reflect.get(target, prop2, receiver); + } + }); +} +function hookSetter(target, key, d2, isRevoked, win = window) { + const original = win.Object.getOwnPropertyDescriptor(target, key); + win.Object.defineProperty(target, key, isRevoked ? d2 : { + set(value4) { + setTimeout$1(() => { + d2.set.call(this, value4); + }, 0); + if (original && original.set) { + original.set.call(this, value4); + } + } + }); + return () => hookSetter(target, key, original || {}, true); +} +__name(hookSetter, "hookSetter"); +function patch$1(source, name2, replacement) { + try { + if (!(name2 in source)) { + return () => { + }; + } + const original = source[name2]; + const wrapped = replacement(original); + if (typeof wrapped === "function") { + wrapped.prototype = wrapped.prototype || {}; + Object.defineProperties(wrapped, { + __rrweb_original__: { + enumerable: false, + value: original + } + }); + } + source[name2] = wrapped; + return () => { + source[name2] = original; + }; + } catch (e2) { + return () => { + }; + } +} +__name(patch$1, "patch$1"); +if (!/[1-9][0-9]{12}/.test(Date.now().toString())) ; +function closestElementOfNode(node3) { + if (!node3) { + return null; + } + const el = node3.nodeType === node3.ELEMENT_NODE ? node3 : node3.parentElement; + return el; +} +__name(closestElementOfNode, "closestElementOfNode"); +function isBlocked(node3, blockClass, blockSelector, unblockSelector, checkAncestors) { + if (!node3) { + return false; + } + const el = closestElementOfNode(node3); + if (!el) { + return false; + } + const blockedPredicate = createMatchPredicate(blockClass, blockSelector); + const blockDistance = distanceToMatch(el, blockedPredicate); + let unblockDistance = -1; + if (blockDistance < 0) { + return false; + } + if (unblockSelector) { + unblockDistance = distanceToMatch(el, createMatchPredicate(null, unblockSelector)); + } + if (blockDistance > -1 && unblockDistance < 0) { + return true; + } + return blockDistance < unblockDistance; +} +__name(isBlocked, "isBlocked"); +const cachedImplementations = {}; +function getImplementation(name2) { + const cached = cachedImplementations[name2]; + if (cached) { + return cached; + } + const document2 = window.document; + let impl = window[name2]; + if (document2 && typeof document2.createElement === "function") { + try { + const sandbox = document2.createElement("iframe"); + sandbox.hidden = true; + document2.head.appendChild(sandbox); + const contentWindow = sandbox.contentWindow; + if (contentWindow && contentWindow[name2]) { + impl = contentWindow[name2]; + } + document2.head.removeChild(sandbox); + } catch (e2) { + } + } + return cachedImplementations[name2] = impl.bind(window); +} +__name(getImplementation, "getImplementation"); +function onRequestAnimationFrame(...rest) { + return getImplementation("requestAnimationFrame")(...rest); +} +__name(onRequestAnimationFrame, "onRequestAnimationFrame"); +function setTimeout$1(...rest) { + return getImplementation("setTimeout")(...rest); +} +__name(setTimeout$1, "setTimeout$1"); +var CanvasContext = /* @__PURE__ */ ((CanvasContext2) => { + CanvasContext2[CanvasContext2["2D"] = 0] = "2D"; + CanvasContext2[CanvasContext2["WebGL"] = 1] = "WebGL"; + CanvasContext2[CanvasContext2["WebGL2"] = 2] = "WebGL2"; + return CanvasContext2; +})(CanvasContext || {}); +let errorHandler; +function registerErrorHandler(handler6) { + errorHandler = handler6; +} +__name(registerErrorHandler, "registerErrorHandler"); +const callbackWrapper = /* @__PURE__ */ __name((cb) => { + if (!errorHandler) { + return cb; + } + const rrwebWrapped = /* @__PURE__ */ __name((...rest) => { + try { + return cb(...rest); + } catch (error2) { + if (errorHandler && errorHandler(error2) === true) { + return () => { + }; + } + throw error2; + } + }, "rrwebWrapped"); + return rrwebWrapped; +}, "callbackWrapper"); +var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256); +for (var i$3 = 0; i$3 < chars.length; i$3++) { + lookup[chars.charCodeAt(i$3)] = i$3; +} +var encode$5 = /* @__PURE__ */ __name(function(arraybuffer) { + var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = ""; + for (i2 = 0; i2 < len; i2 += 3) { + base64 += chars[bytes[i2] >> 2]; + base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4]; + base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6]; + base64 += chars[bytes[i2 + 2] & 63]; + } + if (len % 3 === 2) { + base64 = base64.substring(0, base64.length - 1) + "="; + } else if (len % 3 === 1) { + base64 = base64.substring(0, base64.length - 2) + "=="; + } + return base64; +}, "encode$5"); +const canvasVarMap = /* @__PURE__ */ new Map(); +function variableListFor(ctx, ctor) { + let contextMap = canvasVarMap.get(ctx); + if (!contextMap) { + contextMap = /* @__PURE__ */ new Map(); + canvasVarMap.set(ctx, contextMap); + } + if (!contextMap.has(ctor)) { + contextMap.set(ctor, []); + } + return contextMap.get(ctor); +} +__name(variableListFor, "variableListFor"); +const saveWebGLVar = /* @__PURE__ */ __name((value4, win, ctx) => { + if (!value4 || !(isInstanceOfWebGLObject(value4, win) || typeof value4 === "object")) + return; + const name2 = value4.constructor.name; + const list2 = variableListFor(ctx, name2); + let index2 = list2.indexOf(value4); + if (index2 === -1) { + index2 = list2.length; + list2.push(value4); + } + return index2; +}, "saveWebGLVar"); +function serializeArg(value4, win, ctx) { + if (value4 instanceof Array) { + return value4.map((arg) => serializeArg(arg, win, ctx)); + } else if (value4 === null) { + return value4; + } else if (value4 instanceof Float32Array || value4 instanceof Float64Array || value4 instanceof Int32Array || value4 instanceof Uint32Array || value4 instanceof Uint8Array || value4 instanceof Uint16Array || value4 instanceof Int16Array || value4 instanceof Int8Array || value4 instanceof Uint8ClampedArray) { + const name2 = value4.constructor.name; + return { + rr_type: name2, + args: [Object.values(value4)] + }; + } else if (value4 instanceof ArrayBuffer) { + const name2 = value4.constructor.name; + const base64 = encode$5(value4); + return { + rr_type: name2, + base64 + }; + } else if (value4 instanceof DataView) { + const name2 = value4.constructor.name; + return { + rr_type: name2, + args: [ + serializeArg(value4.buffer, win, ctx), + value4.byteOffset, + value4.byteLength + ] + }; + } else if (value4 instanceof HTMLImageElement) { + const name2 = value4.constructor.name; + const { src } = value4; + return { + rr_type: name2, + src + }; + } else if (value4 instanceof HTMLCanvasElement) { + const name2 = "HTMLImageElement"; + const src = value4.toDataURL(); + return { + rr_type: name2, + src + }; + } else if (value4 instanceof ImageData) { + const name2 = value4.constructor.name; + return { + rr_type: name2, + args: [serializeArg(value4.data, win, ctx), value4.width, value4.height] + }; + } else if (isInstanceOfWebGLObject(value4, win) || typeof value4 === "object") { + const name2 = value4.constructor.name; + const index2 = saveWebGLVar(value4, win, ctx); + return { + rr_type: name2, + index: index2 + }; + } + return value4; +} +__name(serializeArg, "serializeArg"); +const serializeArgs = /* @__PURE__ */ __name((args, win, ctx) => { + return args.map((arg) => serializeArg(arg, win, ctx)); +}, "serializeArgs"); +const isInstanceOfWebGLObject = /* @__PURE__ */ __name((value4, win) => { + const webGLConstructorNames = [ + "WebGLActiveInfo", + "WebGLBuffer", + "WebGLFramebuffer", + "WebGLProgram", + "WebGLRenderbuffer", + "WebGLShader", + "WebGLShaderPrecisionFormat", + "WebGLTexture", + "WebGLUniformLocation", + "WebGLVertexArrayObject", + "WebGLVertexArrayObjectOES" + ]; + const supportedWebGLConstructorNames = webGLConstructorNames.filter((name2) => typeof win[name2] === "function"); + return Boolean(supportedWebGLConstructorNames.find((name2) => value4 instanceof win[name2])); +}, "isInstanceOfWebGLObject"); +function initCanvas2DMutationObserver(cb, win, blockClass, blockSelector, unblockSelector) { + const handlers2 = []; + const props2D = Object.getOwnPropertyNames(win.CanvasRenderingContext2D.prototype); + for (const prop2 of props2D) { + try { + if (typeof win.CanvasRenderingContext2D.prototype[prop2] !== "function") { + continue; + } + const restoreHandler = patch$1(win.CanvasRenderingContext2D.prototype, prop2, function(original) { + return function(...args) { + if (!isBlocked(this.canvas, blockClass, blockSelector, unblockSelector, true)) { + setTimeout$1(() => { + const recordArgs = serializeArgs(args, win, this); + cb(this.canvas, { + type: CanvasContext["2D"], + property: prop2, + args: recordArgs + }); + }, 0); + } + return original.apply(this, args); + }; + }); + handlers2.push(restoreHandler); + } catch (e2) { + const hookHandler = hookSetter(win.CanvasRenderingContext2D.prototype, prop2, { + set(v2) { + cb(this.canvas, { + type: CanvasContext["2D"], + property: prop2, + args: [v2], + setter: true + }); + } + }); + handlers2.push(hookHandler); + } + } + return () => { + handlers2.forEach((h2) => h2()); + }; +} +__name(initCanvas2DMutationObserver, "initCanvas2DMutationObserver"); +function getNormalizedContextName(contextType) { + return contextType === "experimental-webgl" ? "webgl" : contextType; +} +__name(getNormalizedContextName, "getNormalizedContextName"); +function initCanvasContextObserver(win, blockClass, blockSelector, unblockSelector, setPreserveDrawingBufferToTrue) { + const handlers2 = []; + try { + const restoreHandler = patch$1(win.HTMLCanvasElement.prototype, "getContext", function(original) { + return function(contextType, ...args) { + if (!isBlocked(this, blockClass, blockSelector, unblockSelector, true)) { + const ctxName = getNormalizedContextName(contextType); + if (!("__context" in this)) + this.__context = ctxName; + if (setPreserveDrawingBufferToTrue && ["webgl", "webgl2"].includes(ctxName)) { + if (args[0] && typeof args[0] === "object") { + const contextAttributes = args[0]; + if (!contextAttributes.preserveDrawingBuffer) { + contextAttributes.preserveDrawingBuffer = true; + } + } else { + args.splice(0, 1, { + preserveDrawingBuffer: true + }); + } + } + } + return original.apply(this, [contextType, ...args]); + }; + }); + handlers2.push(restoreHandler); + } catch (e2) { + console.error("failed to patch HTMLCanvasElement.prototype.getContext"); + } + return () => { + handlers2.forEach((h2) => h2()); + }; +} +__name(initCanvasContextObserver, "initCanvasContextObserver"); +function patchGLPrototype(prototype2, type, cb, blockClass, blockSelector, unblockSelector, mirror2, win) { + const handlers2 = []; + const props = Object.getOwnPropertyNames(prototype2); + for (const prop2 of props) { + if ([ + "isContextLost", + "canvas", + "drawingBufferWidth", + "drawingBufferHeight" + ].includes(prop2)) { + continue; + } + try { + if (typeof prototype2[prop2] !== "function") { + continue; + } + const restoreHandler = patch$1(prototype2, prop2, function(original) { + return function(...args) { + const result = original.apply(this, args); + saveWebGLVar(result, win, this); + if ("tagName" in this.canvas && !isBlocked(this.canvas, blockClass, blockSelector, unblockSelector, true)) { + const recordArgs = serializeArgs(args, win, this); + const mutation = { + type, + property: prop2, + args: recordArgs + }; + cb(this.canvas, mutation); + } + return result; + }; + }); + handlers2.push(restoreHandler); + } catch (e2) { + const hookHandler = hookSetter(prototype2, prop2, { + set(v2) { + cb(this.canvas, { + type, + property: prop2, + args: [v2], + setter: true + }); + } + }); + handlers2.push(hookHandler); + } + } + return handlers2; +} +__name(patchGLPrototype, "patchGLPrototype"); +function initCanvasWebGLMutationObserver(cb, win, blockClass, blockSelector, unblockSelector, mirror2) { + const handlers2 = []; + handlers2.push(...patchGLPrototype(win.WebGLRenderingContext.prototype, CanvasContext.WebGL, cb, blockClass, blockSelector, unblockSelector, mirror2, win)); + if (typeof win.WebGL2RenderingContext !== "undefined") { + handlers2.push(...patchGLPrototype(win.WebGL2RenderingContext.prototype, CanvasContext.WebGL2, cb, blockClass, blockSelector, unblockSelector, mirror2, win)); + } + return () => { + handlers2.forEach((h2) => h2()); + }; +} +__name(initCanvasWebGLMutationObserver, "initCanvasWebGLMutationObserver"); +var r$2 = `for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t="undefined"==typeof Uint8Array?[]:new Uint8Array(256),a=0;a<64;a++)t[e.charCodeAt(a)]=a;var n=function(t){var a,n=new Uint8Array(t),r=n.length,s="";for(a=0;a<r;a+=3)s+=e[n[a]>>2],s+=e[(3&n[a])<<4|n[a+1]>>4],s+=e[(15&n[a+1])<<2|n[a+2]>>6],s+=e[63&n[a+2]];return r%3==2?s=s.substring(0,s.length-1)+"=":r%3==1&&(s=s.substring(0,s.length-2)+"=="),s};const r=new Map,s=new Map;const i=self;i.onmessage=async function(e){if(!("OffscreenCanvas"in globalThis))return i.postMessage({id:e.data.id});{const{id:t,bitmap:a,width:o,height:f,maxCanvasSize:c,dataURLOptions:g}=e.data,u=async function(e,t,a){const r=e+"-"+t;if("OffscreenCanvas"in globalThis){if(s.has(r))return s.get(r);const i=new OffscreenCanvas(e,t);i.getContext("2d");const o=await i.convertToBlob(a),f=await o.arrayBuffer(),c=n(f);return s.set(r,c),c}return""}(o,f,g),[h,d]=function(e,t,a){if(!a)return[e,t];const[n,r]=a;if(e<=n&&t<=r)return[e,t];let s=e,i=t;return s>n&&(i=Math.floor(n*t/e),s=n),i>r&&(s=Math.floor(r*e/t),i=r),[s,i]}(o,f,c),l=new OffscreenCanvas(h,d),w=l.getContext("bitmaprenderer"),p=h===o&&d===f?a:await createImageBitmap(a,{resizeWidth:h,resizeHeight:d,resizeQuality:"low"});w.transferFromImageBitmap(p),a.close();const y=await l.convertToBlob(g),v=y.type,b=await y.arrayBuffer(),m=n(b);if(p.close(),!r.has(t)&&await u===m)return r.set(t,m),i.postMessage({id:t});if(r.get(t)===m)return i.postMessage({id:t});i.postMessage({id:t,type:v,base64:m,width:o,height:f}),r.set(t,m)}};`; +function t$2() { + const t2 = new Blob([r$2]); + return URL.createObjectURL(t2); +} +__name(t$2, "t$2"); +class CanvasManager { + static { + __name(this, "CanvasManager"); + } + reset() { + this.pendingCanvasMutations.clear(); + this.restoreHandlers.forEach((handler6) => { + try { + handler6(); + } catch (e2) { + } + }); + this.restoreHandlers = []; + this.windowsSet = /* @__PURE__ */ new WeakSet(); + this.windows = []; + this.shadowDoms = /* @__PURE__ */ new Set(); + _optionalChain([this, "access", (_2) => _2.worker, "optionalAccess", (_2) => _2.terminate, "call", (_3) => _3()]); + this.worker = null; + this.snapshotInProgressMap = /* @__PURE__ */ new Map(); + } + freeze() { + this.frozen = true; + } + unfreeze() { + this.frozen = false; + } + lock() { + this.locked = true; + } + unlock() { + this.locked = false; + } + constructor(options4) { + this.pendingCanvasMutations = /* @__PURE__ */ new Map(); + this.rafStamps = { latestId: 0, invokeId: null }; + this.shadowDoms = /* @__PURE__ */ new Set(); + this.windowsSet = /* @__PURE__ */ new WeakSet(); + this.windows = []; + this.restoreHandlers = []; + this.frozen = false; + this.locked = false; + this.snapshotInProgressMap = /* @__PURE__ */ new Map(); + this.worker = null; + this.processMutation = (target, mutation) => { + const newFrame = this.rafStamps.invokeId && this.rafStamps.latestId !== this.rafStamps.invokeId; + if (newFrame || !this.rafStamps.invokeId) + this.rafStamps.invokeId = this.rafStamps.latestId; + if (!this.pendingCanvasMutations.has(target)) { + this.pendingCanvasMutations.set(target, []); + } + this.pendingCanvasMutations.get(target).push(mutation); + }; + const { sampling = "all", win, blockClass, blockSelector, unblockSelector, maxCanvasSize, recordCanvas, dataURLOptions, errorHandler: errorHandler2 } = options4; + this.mutationCb = options4.mutationCb; + this.mirror = options4.mirror; + this.options = options4; + if (errorHandler2) { + registerErrorHandler(errorHandler2); + } + if (recordCanvas && typeof sampling === "number" || options4.enableManualSnapshot) { + this.worker = this.initFPSWorker(); + } + this.addWindow(win); + if (options4.enableManualSnapshot) { + return; + } + callbackWrapper(() => { + if (recordCanvas && sampling === "all") { + this.startRAFTimestamping(); + this.startPendingCanvasMutationFlusher(); + } + if (recordCanvas && typeof sampling === "number") { + this.initCanvasFPSObserver(sampling, blockClass, blockSelector, unblockSelector, maxCanvasSize, { + dataURLOptions + }); + } + })(); + } + addWindow(win) { + const { sampling = "all", blockClass, blockSelector, unblockSelector, recordCanvas, enableManualSnapshot } = this.options; + if (this.windowsSet.has(win)) + return; + if (enableManualSnapshot) { + this.windowsSet.add(win); + this.windows.push(new WeakRef(win)); + return; + } + callbackWrapper(() => { + if (recordCanvas && sampling === "all") { + this.initCanvasMutationObserver(win, blockClass, blockSelector, unblockSelector); + } + if (recordCanvas && typeof sampling === "number") { + const canvasContextReset = initCanvasContextObserver(win, blockClass, blockSelector, unblockSelector, true); + this.restoreHandlers.push(() => { + canvasContextReset(); + }); + } + })(); + this.windowsSet.add(win); + this.windows.push(new WeakRef(win)); + } + addShadowRoot(shadowRoot) { + this.shadowDoms.add(new WeakRef(shadowRoot)); + } + resetShadowRoots() { + this.shadowDoms = /* @__PURE__ */ new Set(); + } + initFPSWorker() { + const worker = new Worker(t$2()); + worker.onmessage = (e2) => { + const data25 = e2.data; + const { id: id3 } = data25; + this.snapshotInProgressMap.set(id3, false); + if (!("base64" in data25)) + return; + const { base64, type, width: width2, height } = data25; + this.mutationCb({ + id: id3, + type: CanvasContext["2D"], + commands: [ + { + property: "clearRect", + args: [0, 0, width2, height] + }, + { + property: "drawImage", + args: [ + { + rr_type: "ImageBitmap", + args: [ + { + rr_type: "Blob", + data: [{ rr_type: "ArrayBuffer", base64 }], + type + } + ] + }, + 0, + 0, + width2, + height + ] + } + ] + }); + }; + return worker; + } + initCanvasFPSObserver(fps, blockClass, blockSelector, unblockSelector, maxCanvasSize, options4) { + const rafId = this.takeSnapshot(false, fps, blockClass, blockSelector, unblockSelector, maxCanvasSize, options4.dataURLOptions); + this.restoreHandlers.push(() => { + cancelAnimationFrame(rafId); + }); + } + initCanvasMutationObserver(win, blockClass, blockSelector, unblockSelector) { + const canvasContextReset = initCanvasContextObserver(win, blockClass, blockSelector, unblockSelector, false); + const canvas2DReset = initCanvas2DMutationObserver(this.processMutation.bind(this), win, blockClass, blockSelector, unblockSelector); + const canvasWebGL1and2Reset = initCanvasWebGLMutationObserver(this.processMutation.bind(this), win, blockClass, blockSelector, unblockSelector, this.mirror); + this.restoreHandlers.push(() => { + canvasContextReset(); + canvas2DReset(); + canvasWebGL1and2Reset(); + }); + } + snapshot(canvasElement) { + const { options: options4 } = this; + const rafId = this.takeSnapshot(true, options4.sampling === "all" ? 2 : options4.sampling || 2, options4.blockClass, options4.blockSelector, options4.unblockSelector, options4.maxCanvasSize, options4.dataURLOptions, canvasElement); + this.restoreHandlers.push(() => { + cancelAnimationFrame(rafId); + }); + } + takeSnapshot(isManualSnapshot, fps, blockClass, blockSelector, unblockSelector, maxCanvasSize, dataURLOptions, canvasElement) { + const timeBetweenSnapshots = 1e3 / fps; + let lastSnapshotTime = 0; + let rafId; + const getCanvas = /* @__PURE__ */ __name((canvasElement2) => { + if (canvasElement2) { + return [canvasElement2]; + } + const matchedCanvas = []; + const searchCanvas = /* @__PURE__ */ __name((root27) => { + root27.querySelectorAll("canvas").forEach((canvas) => { + if (!isBlocked(canvas, blockClass, blockSelector, unblockSelector)) { + matchedCanvas.push(canvas); + } + }); + }, "searchCanvas"); + for (const item3 of this.windows) { + const window2 = item3.deref(); + if (window2) { + searchCanvas(window2.document); + } + } + for (const item3 of this.shadowDoms) { + const shadowRoot = item3.deref(); + if (shadowRoot) { + searchCanvas(shadowRoot); + } + } + return matchedCanvas; + }, "getCanvas"); + const takeCanvasSnapshots = /* @__PURE__ */ __name((timestamp2) => { + if (!this.windows.length) { + return; + } + if (lastSnapshotTime && timestamp2 - lastSnapshotTime < timeBetweenSnapshots) { + rafId = onRequestAnimationFrame(takeCanvasSnapshots); + return; + } + lastSnapshotTime = timestamp2; + getCanvas(canvasElement).forEach((canvas) => { + if (!this.mirror.hasNode(canvas)) { + return; + } + const id3 = this.mirror.getId(canvas); + if (this.snapshotInProgressMap.get(id3)) + return; + if (!canvas.width || !canvas.height) + return; + this.snapshotInProgressMap.set(id3, true); + if (!isManualSnapshot && ["webgl", "webgl2"].includes(canvas.__context)) { + const context = canvas.getContext(canvas.__context); + if (_optionalChain([context, "optionalAccess", (_4) => _4.getContextAttributes, "call", (_5) => _5(), "optionalAccess", (_6) => _6.preserveDrawingBuffer]) === false) { + context.clear(context.COLOR_BUFFER_BIT); + } + } + createImageBitmap(canvas).then((bitmap) => { + _optionalChain([this, "access", (_7) => _7.worker, "optionalAccess", (_8) => _8.postMessage, "call", (_9) => _9({ + id: id3, + bitmap, + width: canvas.width, + height: canvas.height, + dataURLOptions, + maxCanvasSize + }, [bitmap])]); + }).catch((error2) => { + callbackWrapper(() => { + throw error2; + })(); + }); + }); + if (!isManualSnapshot) { + rafId = onRequestAnimationFrame(takeCanvasSnapshots); + } + }, "takeCanvasSnapshots"); + rafId = onRequestAnimationFrame(takeCanvasSnapshots); + return rafId; + } + startPendingCanvasMutationFlusher() { + onRequestAnimationFrame(() => this.flushPendingCanvasMutations()); + } + startRAFTimestamping() { + const setLatestRAFTimestamp = /* @__PURE__ */ __name((timestamp2) => { + this.rafStamps.latestId = timestamp2; + onRequestAnimationFrame(setLatestRAFTimestamp); + }, "setLatestRAFTimestamp"); + onRequestAnimationFrame(setLatestRAFTimestamp); + } + flushPendingCanvasMutations() { + this.pendingCanvasMutations.forEach((values, canvas) => { + const id3 = this.mirror.getId(canvas); + this.flushPendingCanvasMutationFor(canvas, id3); + }); + onRequestAnimationFrame(() => this.flushPendingCanvasMutations()); + } + flushPendingCanvasMutationFor(canvas, id3) { + if (this.frozen || this.locked) { + return; + } + const valuesWithType = this.pendingCanvasMutations.get(canvas); + if (!valuesWithType || id3 === -1) + return; + const values = valuesWithType.map((value4) => { + const { type: type2, ...rest } = value4; + return rest; + }); + const { type } = valuesWithType[0]; + this.mutationCb({ id: id3, type, commands: values }); + this.pendingCanvasMutations.delete(canvas); + } +} +const CANVAS_QUALITY = { + low: { + sampling: { + canvas: 1 + }, + dataURLOptions: { + type: "image/webp", + quality: 0.25 + } + }, + medium: { + sampling: { + canvas: 2 + }, + dataURLOptions: { + type: "image/webp", + quality: 0.4 + } + }, + high: { + sampling: { + canvas: 4 + }, + dataURLOptions: { + type: "image/webp", + quality: 0.5 + } + } +}; +const INTEGRATION_NAME$3 = "ReplayCanvas"; +const DEFAULT_MAX_CANVAS_SIZE = 1280; +const _replayCanvasIntegration = /* @__PURE__ */ __name((options4 = {}) => { + const [maxCanvasWidth, maxCanvasHeight] = options4.maxCanvasSize || []; + const _canvasOptions = { + quality: options4.quality || "medium", + enableManualSnapshot: options4.enableManualSnapshot, + maxCanvasSize: [ + maxCanvasWidth ? Math.min(maxCanvasWidth, DEFAULT_MAX_CANVAS_SIZE) : DEFAULT_MAX_CANVAS_SIZE, + maxCanvasHeight ? Math.min(maxCanvasHeight, DEFAULT_MAX_CANVAS_SIZE) : DEFAULT_MAX_CANVAS_SIZE + ] + }; + let canvasManagerResolve; + const _canvasManager = new Promise((resolve2) => canvasManagerResolve = resolve2); + return { + name: INTEGRATION_NAME$3, + getOptions() { + const { quality, enableManualSnapshot, maxCanvasSize } = _canvasOptions; + return { + enableManualSnapshot, + recordCanvas: true, + getCanvasManager: /* @__PURE__ */ __name((getCanvasManagerOptions) => { + const manager = new CanvasManager({ + ...getCanvasManagerOptions, + enableManualSnapshot, + maxCanvasSize, + errorHandler: /* @__PURE__ */ __name((err) => { + try { + if (typeof err === "object") { + err.__rrweb__ = true; + } + } catch (error2) { + } + }, "errorHandler") + }); + canvasManagerResolve(manager); + return manager; + }, "getCanvasManager"), + ...CANVAS_QUALITY[quality || "medium"] || CANVAS_QUALITY.medium + }; + }, + async snapshot(canvasElement) { + const canvasManager = await _canvasManager; + canvasManager.snapshot(canvasElement); + } + }; +}, "_replayCanvasIntegration"); +const replayCanvasIntegration = defineIntegration( + _replayCanvasIntegration +); +const WINDOW = GLOBAL_OBJ; +const DOCUMENT = WINDOW.document; +const NAVIGATOR = WINDOW.navigator; +const TRIGGER_LABEL = "Report a Bug"; +const CANCEL_BUTTON_LABEL = "Cancel"; +const SUBMIT_BUTTON_LABEL = "Send Bug Report"; +const CONFIRM_BUTTON_LABEL = "Confirm"; +const FORM_TITLE = "Report a Bug"; +const EMAIL_PLACEHOLDER = "your.email@example.org"; +const EMAIL_LABEL = "Email"; +const MESSAGE_PLACEHOLDER = "What's the bug? What did you expect?"; +const MESSAGE_LABEL = "Description"; +const NAME_PLACEHOLDER = "Your Name"; +const NAME_LABEL = "Name"; +const SUCCESS_MESSAGE_TEXT = "Thank you for your report!"; +const IS_REQUIRED_LABEL = "(required)"; +const ADD_SCREENSHOT_LABEL = "Add a screenshot"; +const REMOVE_SCREENSHOT_LABEL = "Remove screenshot"; +const FEEDBACK_WIDGET_SOURCE = "widget"; +const FEEDBACK_API_SOURCE = "api"; +const SUCCESS_MESSAGE_TIMEOUT = 5e3; +const sendFeedback = /* @__PURE__ */ __name((params, hint = { includeReplay: true }) => { + if (!params.message) { + throw new Error("Unable to submit feedback with empty message"); + } + const client = getClient(); + if (!client) { + throw new Error("No client setup, cannot send feedback."); + } + if (params.tags && Object.keys(params.tags).length) { + getCurrentScope$1().setTags(params.tags); + } + const eventId = captureFeedback( + { + source: FEEDBACK_API_SOURCE, + url: getLocationHref(), + ...params + }, + hint + ); + return new Promise((resolve2, reject3) => { + const timeout = setTimeout(() => reject3("Unable to determine if Feedback was correctly sent."), 5e3); + const cleanup = client.on("afterSendEvent", (event, response) => { + if (event.event_id !== eventId) { + return; + } + clearTimeout(timeout); + cleanup(); + if (response && typeof response.statusCode === "number" && response.statusCode >= 200 && response.statusCode < 300) { + return resolve2(eventId); + } + if (response && typeof response.statusCode === "number" && response.statusCode === 0) { + return reject3( + "Unable to send Feedback. This is because of network issues, or because you are using an ad-blocker." + ); + } + if (response && typeof response.statusCode === "number" && response.statusCode === 403) { + return reject3( + "Unable to send Feedback. This could be because this domain is not in your list of allowed domains." + ); + } + return reject3( + "Unable to send Feedback. This could be because of network issues, or because you are using an ad-blocker" + ); + }); + }); +}, "sendFeedback"); +const DEBUG_BUILD$1 = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__; +function isScreenshotSupported() { + if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(NAVIGATOR.userAgent)) { + return false; + } + if (/Macintosh/i.test(NAVIGATOR.userAgent) && NAVIGATOR.maxTouchPoints && NAVIGATOR.maxTouchPoints > 1) { + return false; + } + if (!isSecureContext) { + return false; + } + return true; +} +__name(isScreenshotSupported, "isScreenshotSupported"); +function mergeOptions$2(defaultOptions2, optionOverrides) { + return { + ...defaultOptions2, + ...optionOverrides, + tags: { + ...defaultOptions2.tags, + ...optionOverrides.tags + }, + onFormOpen: /* @__PURE__ */ __name(() => { + optionOverrides.onFormOpen && optionOverrides.onFormOpen(); + defaultOptions2.onFormOpen && defaultOptions2.onFormOpen(); + }, "onFormOpen"), + onFormClose: /* @__PURE__ */ __name(() => { + optionOverrides.onFormClose && optionOverrides.onFormClose(); + defaultOptions2.onFormClose && defaultOptions2.onFormClose(); + }, "onFormClose"), + onSubmitSuccess: /* @__PURE__ */ __name((data25) => { + optionOverrides.onSubmitSuccess && optionOverrides.onSubmitSuccess(data25); + defaultOptions2.onSubmitSuccess && defaultOptions2.onSubmitSuccess(data25); + }, "onSubmitSuccess"), + onSubmitError: /* @__PURE__ */ __name((error2) => { + optionOverrides.onSubmitError && optionOverrides.onSubmitError(error2); + defaultOptions2.onSubmitError && defaultOptions2.onSubmitError(error2); + }, "onSubmitError"), + onFormSubmitted: /* @__PURE__ */ __name(() => { + optionOverrides.onFormSubmitted && optionOverrides.onFormSubmitted(); + defaultOptions2.onFormSubmitted && defaultOptions2.onFormSubmitted(); + }, "onFormSubmitted"), + themeDark: { + ...defaultOptions2.themeDark, + ...optionOverrides.themeDark + }, + themeLight: { + ...defaultOptions2.themeLight, + ...optionOverrides.themeLight + } + }; +} +__name(mergeOptions$2, "mergeOptions$2"); +function createActorStyles(styleNonce) { + const style2 = DOCUMENT.createElement("style"); + style2.textContent = ` +.widget__actor { + position: fixed; + z-index: var(--z-index); + margin: var(--page-margin); + inset: var(--actor-inset); + + display: flex; + align-items: center; + gap: 8px; + padding: 16px; + + font-family: inherit; + font-size: var(--font-size); + font-weight: 600; + line-height: 1.14em; + text-decoration: none; + + background: var(--actor-background, var(--background)); + border-radius: var(--actor-border-radius, 1.7em/50%); + border: var(--actor-border, var(--border)); + box-shadow: var(--actor-box-shadow, var(--box-shadow)); + color: var(--actor-color, var(--foreground)); + fill: var(--actor-color, var(--foreground)); + cursor: pointer; + opacity: 1; + transition: transform 0.2s ease-in-out; + transform: translate(0, 0) scale(1); +} +.widget__actor[aria-hidden="true"] { + opacity: 0; + pointer-events: none; + visibility: hidden; + transform: translate(0, 16px) scale(0.98); +} + +.widget__actor:hover { + background: var(--actor-hover-background, var(--background)); + filter: var(--interactive-filter); +} + +.widget__actor svg { + width: 1.14em; + height: 1.14em; +} + +@media (max-width: 600px) { + .widget__actor span { + display: none; + } +} +`; + if (styleNonce) { + style2.setAttribute("nonce", styleNonce); + } + return style2; +} +__name(createActorStyles, "createActorStyles"); +function setAttributesNS(el, attributes) { + Object.entries(attributes).forEach(([key, val]) => { + el.setAttributeNS(null, key, val); + }); + return el; +} +__name(setAttributesNS, "setAttributesNS"); +const SIZE$1 = 20; +const XMLNS$2 = "http://www.w3.org/2000/svg"; +function FeedbackIcon() { + const createElementNS = /* @__PURE__ */ __name((tagName) => WINDOW.document.createElementNS(XMLNS$2, tagName), "createElementNS"); + const svg = setAttributesNS(createElementNS("svg"), { + width: `${SIZE$1}`, + height: `${SIZE$1}`, + viewBox: `0 0 ${SIZE$1} ${SIZE$1}`, + fill: "var(--actor-color, var(--foreground))" + }); + const g2 = setAttributesNS(createElementNS("g"), { + clipPath: "url(#clip0_57_80)" + }); + const path = setAttributesNS(createElementNS("path"), { + ["fill-rule"]: "evenodd", + ["clip-rule"]: "evenodd", + d: "M15.6622 15H12.3997C12.2129 14.9959 12.031 14.9396 11.8747 14.8375L8.04965 12.2H7.49956V19.1C7.4875 19.3348 7.3888 19.5568 7.22256 19.723C7.05632 19.8892 6.83435 19.9879 6.59956 20H2.04956C1.80193 19.9968 1.56535 19.8969 1.39023 19.7218C1.21511 19.5467 1.1153 19.3101 1.11206 19.0625V12.2H0.949652C0.824431 12.2017 0.700142 12.1783 0.584123 12.1311C0.468104 12.084 0.362708 12.014 0.274155 11.9255C0.185602 11.8369 0.115689 11.7315 0.0685419 11.6155C0.0213952 11.4995 -0.00202913 11.3752 -0.00034808 11.25V3.75C-0.00900498 3.62067 0.0092504 3.49095 0.0532651 3.36904C0.0972798 3.24712 0.166097 3.13566 0.255372 3.04168C0.344646 2.94771 0.452437 2.87327 0.571937 2.82307C0.691437 2.77286 0.82005 2.74798 0.949652 2.75H8.04965L11.8747 0.1625C12.031 0.0603649 12.2129 0.00407221 12.3997 0H15.6622C15.9098 0.00323746 16.1464 0.103049 16.3215 0.278167C16.4966 0.453286 16.5964 0.689866 16.5997 0.9375V3.25269C17.3969 3.42959 18.1345 3.83026 18.7211 4.41679C19.5322 5.22788 19.9878 6.32796 19.9878 7.47502C19.9878 8.62209 19.5322 9.72217 18.7211 10.5333C18.1345 11.1198 17.3969 11.5205 16.5997 11.6974V14.0125C16.6047 14.1393 16.5842 14.2659 16.5395 14.3847C16.4948 14.5035 16.4268 14.6121 16.3394 14.7042C16.252 14.7962 16.147 14.8698 16.0307 14.9206C15.9144 14.9714 15.7891 14.9984 15.6622 15ZM1.89695 10.325H1.88715V4.625H8.33715C8.52423 4.62301 8.70666 4.56654 8.86215 4.4625L12.6872 1.875H14.7247V13.125H12.6872L8.86215 10.4875C8.70666 10.3835 8.52423 10.327 8.33715 10.325H2.20217C2.15205 10.3167 2.10102 10.3125 2.04956 10.3125C1.9981 10.3125 1.94708 10.3167 1.89695 10.325ZM2.98706 12.2V18.1625H5.66206V12.2H2.98706ZM16.5997 9.93612V5.01393C16.6536 5.02355 16.7072 5.03495 16.7605 5.04814C17.1202 5.13709 17.4556 5.30487 17.7425 5.53934C18.0293 5.77381 18.2605 6.06912 18.4192 6.40389C18.578 6.73866 18.6603 7.10452 18.6603 7.47502C18.6603 7.84552 18.578 8.21139 18.4192 8.54616C18.2605 8.88093 18.0293 9.17624 17.7425 9.41071C17.4556 9.64518 17.1202 9.81296 16.7605 9.90191C16.7072 9.91509 16.6536 9.9265 16.5997 9.93612Z" + }); + svg.appendChild(g2).appendChild(path); + const speakerDefs = createElementNS("defs"); + const speakerClipPathDef = setAttributesNS(createElementNS("clipPath"), { + id: "clip0_57_80" + }); + const speakerRect = setAttributesNS(createElementNS("rect"), { + width: `${SIZE$1}`, + height: `${SIZE$1}`, + fill: "white" + }); + speakerClipPathDef.appendChild(speakerRect); + speakerDefs.appendChild(speakerClipPathDef); + svg.appendChild(speakerDefs).appendChild(speakerClipPathDef).appendChild(speakerRect); + return svg; +} +__name(FeedbackIcon, "FeedbackIcon"); +function Actor({ triggerLabel, triggerAriaLabel, shadow, styleNonce }) { + const el = DOCUMENT.createElement("button"); + el.type = "button"; + el.className = "widget__actor"; + el.ariaHidden = "false"; + el.ariaLabel = triggerAriaLabel || triggerLabel || TRIGGER_LABEL; + el.appendChild(FeedbackIcon()); + if (triggerLabel) { + const label5 = DOCUMENT.createElement("span"); + label5.appendChild(DOCUMENT.createTextNode(triggerLabel)); + el.appendChild(label5); + } + const style2 = createActorStyles(styleNonce); + return { + el, + appendToDom() { + shadow.appendChild(style2); + shadow.appendChild(el); + }, + removeFromDom() { + shadow.removeChild(el); + shadow.removeChild(style2); + }, + show() { + el.ariaHidden = "false"; + }, + hide() { + el.ariaHidden = "true"; + } + }; +} +__name(Actor, "Actor"); +const PURPLE = "rgba(88, 74, 192, 1)"; +const DEFAULT_LIGHT = { + foreground: "#2b2233", + background: "#ffffff", + accentForeground: "white", + accentBackground: PURPLE, + successColor: "#268d75", + errorColor: "#df3338", + border: "1.5px solid rgba(41, 35, 47, 0.13)", + boxShadow: "0px 4px 24px 0px rgba(43, 34, 51, 0.12)", + outline: "1px auto var(--accent-background)", + interactiveFilter: "brightness(95%)" +}; +const DEFAULT_DARK = { + foreground: "#ebe6ef", + background: "#29232f", + accentForeground: "white", + accentBackground: PURPLE, + successColor: "#2da98c", + errorColor: "#f55459", + border: "1.5px solid rgba(235, 230, 239, 0.15)", + boxShadow: "0px 4px 24px 0px rgba(43, 34, 51, 0.12)", + outline: "1px auto var(--accent-background)", + interactiveFilter: "brightness(150%)" +}; +function getThemedCssVariables(theme42) { + return ` + --foreground: ${theme42.foreground}; + --background: ${theme42.background}; + --accent-foreground: ${theme42.accentForeground}; + --accent-background: ${theme42.accentBackground}; + --success-color: ${theme42.successColor}; + --error-color: ${theme42.errorColor}; + --border: ${theme42.border}; + --box-shadow: ${theme42.boxShadow}; + --outline: ${theme42.outline}; + --interactive-filter: ${theme42.interactiveFilter}; + `; +} +__name(getThemedCssVariables, "getThemedCssVariables"); +function createMainStyles({ + colorScheme, + themeDark, + themeLight, + styleNonce +}) { + const style2 = DOCUMENT.createElement("style"); + style2.textContent = ` +:host { + --font-family: system-ui, 'Helvetica Neue', Arial, sans-serif; + --font-size: 14px; + --z-index: 100000; + + --page-margin: 16px; + --inset: auto 0 0 auto; + --actor-inset: var(--inset); + + font-family: var(--font-family); + font-size: var(--font-size); + + ${colorScheme !== "system" ? "color-scheme: only light;" : ""} + + ${getThemedCssVariables( + colorScheme === "dark" ? { ...DEFAULT_DARK, ...themeDark } : { ...DEFAULT_LIGHT, ...themeLight } + )} +} + +${colorScheme === "system" ? ` +@media (prefers-color-scheme: dark) { + :host { + ${getThemedCssVariables({ ...DEFAULT_DARK, ...themeDark })} + } +}` : ""} +} +`; + if (styleNonce) { + style2.setAttribute("nonce", styleNonce); + } + return style2; +} +__name(createMainStyles, "createMainStyles"); +const buildFeedbackIntegration = /* @__PURE__ */ __name(({ + lazyLoadIntegration: lazyLoadIntegration2, + getModalIntegration, + getScreenshotIntegration +}) => { + const feedbackIntegration = /* @__PURE__ */ __name(({ + // FeedbackGeneralConfiguration + id: id3 = "sentry-feedback", + autoInject = true, + showBranding = true, + isEmailRequired = false, + isNameRequired = false, + showEmail = true, + showName = true, + enableScreenshot = true, + useSentryUser = { + email: "email", + name: "username" + }, + tags, + styleNonce, + scriptNonce, + // FeedbackThemeConfiguration + colorScheme = "system", + themeLight = {}, + themeDark = {}, + // FeedbackTextConfiguration + addScreenshotButtonLabel = ADD_SCREENSHOT_LABEL, + cancelButtonLabel = CANCEL_BUTTON_LABEL, + confirmButtonLabel = CONFIRM_BUTTON_LABEL, + emailLabel = EMAIL_LABEL, + emailPlaceholder = EMAIL_PLACEHOLDER, + formTitle = FORM_TITLE, + isRequiredLabel = IS_REQUIRED_LABEL, + messageLabel = MESSAGE_LABEL, + messagePlaceholder = MESSAGE_PLACEHOLDER, + nameLabel = NAME_LABEL, + namePlaceholder = NAME_PLACEHOLDER, + removeScreenshotButtonLabel = REMOVE_SCREENSHOT_LABEL, + submitButtonLabel = SUBMIT_BUTTON_LABEL, + successMessageText = SUCCESS_MESSAGE_TEXT, + triggerLabel = TRIGGER_LABEL, + triggerAriaLabel = "", + // FeedbackCallbacks + onFormOpen, + onFormClose, + onSubmitSuccess, + onSubmitError, + onFormSubmitted + } = {}) => { + const _options = { + id: id3, + autoInject, + showBranding, + isEmailRequired, + isNameRequired, + showEmail, + showName, + enableScreenshot, + useSentryUser, + tags, + styleNonce, + scriptNonce, + colorScheme, + themeDark, + themeLight, + triggerLabel, + triggerAriaLabel, + cancelButtonLabel, + submitButtonLabel, + confirmButtonLabel, + formTitle, + emailLabel, + emailPlaceholder, + messageLabel, + messagePlaceholder, + nameLabel, + namePlaceholder, + successMessageText, + isRequiredLabel, + addScreenshotButtonLabel, + removeScreenshotButtonLabel, + onFormClose, + onFormOpen, + onSubmitError, + onSubmitSuccess, + onFormSubmitted + }; + let _shadow = null; + let _subscriptions = []; + const _createShadow = /* @__PURE__ */ __name((options4) => { + if (!_shadow) { + const host = DOCUMENT.createElement("div"); + host.id = String(options4.id); + DOCUMENT.body.appendChild(host); + _shadow = host.attachShadow({ mode: "open" }); + _shadow.appendChild(createMainStyles(options4)); + } + return _shadow; + }, "_createShadow"); + const _loadAndRenderDialog = /* @__PURE__ */ __name(async (options4) => { + const screenshotRequired = options4.enableScreenshot && isScreenshotSupported(); + let modalIntegration; + let screenshotIntegration; + try { + const modalIntegrationFn = getModalIntegration ? getModalIntegration() : await lazyLoadIntegration2("feedbackModalIntegration", scriptNonce); + modalIntegration = modalIntegrationFn(); + addIntegration(modalIntegration); + } catch (e2) { + DEBUG_BUILD$1 && logger$2.error( + "[Feedback] Error when trying to load feedback integrations. Try using `feedbackSyncIntegration` in your `Sentry.init`." + ); + throw new Error("[Feedback] Missing feedback modal integration!"); + } + try { + const screenshotIntegrationFn = screenshotRequired ? getScreenshotIntegration ? getScreenshotIntegration() : await lazyLoadIntegration2("feedbackScreenshotIntegration", scriptNonce) : void 0; + if (screenshotIntegrationFn) { + screenshotIntegration = screenshotIntegrationFn(); + addIntegration(screenshotIntegration); + } + } catch (e2) { + DEBUG_BUILD$1 && logger$2.error("[Feedback] Missing feedback screenshot integration. Proceeding without screenshots."); + } + const dialog = modalIntegration.createDialog({ + options: { + ...options4, + onFormClose: /* @__PURE__ */ __name(() => { + dialog && dialog.close(); + options4.onFormClose && options4.onFormClose(); + }, "onFormClose"), + onFormSubmitted: /* @__PURE__ */ __name(() => { + dialog && dialog.close(); + options4.onFormSubmitted && options4.onFormSubmitted(); + }, "onFormSubmitted") + }, + screenshotIntegration, + sendFeedback, + shadow: _createShadow(options4) + }); + return dialog; + }, "_loadAndRenderDialog"); + const _attachTo = /* @__PURE__ */ __name((el, optionOverrides = {}) => { + const mergedOptions = mergeOptions$2(_options, optionOverrides); + const targetEl = typeof el === "string" ? DOCUMENT.querySelector(el) : typeof el.addEventListener === "function" ? el : null; + if (!targetEl) { + DEBUG_BUILD$1 && logger$2.error("[Feedback] Unable to attach to target element"); + throw new Error("Unable to attach to target element"); + } + let dialog = null; + const handleClick2 = /* @__PURE__ */ __name(async () => { + if (!dialog) { + dialog = await _loadAndRenderDialog({ + ...mergedOptions, + onFormSubmitted: /* @__PURE__ */ __name(() => { + dialog && dialog.removeFromDom(); + mergedOptions.onFormSubmitted && mergedOptions.onFormSubmitted(); + }, "onFormSubmitted") + }); + } + dialog.appendToDom(); + dialog.open(); + }, "handleClick"); + targetEl.addEventListener("click", handleClick2); + const unsubscribe = /* @__PURE__ */ __name(() => { + _subscriptions = _subscriptions.filter((sub) => sub !== unsubscribe); + dialog && dialog.removeFromDom(); + dialog = null; + targetEl.removeEventListener("click", handleClick2); + }, "unsubscribe"); + _subscriptions.push(unsubscribe); + return unsubscribe; + }, "_attachTo"); + const _createActor = /* @__PURE__ */ __name((optionOverrides = {}) => { + const mergedOptions = mergeOptions$2(_options, optionOverrides); + const shadow = _createShadow(mergedOptions); + const actor = Actor({ + triggerLabel: mergedOptions.triggerLabel, + triggerAriaLabel: mergedOptions.triggerAriaLabel, + shadow, + styleNonce + }); + _attachTo(actor.el, { + ...mergedOptions, + onFormOpen() { + actor.hide(); + }, + onFormClose() { + actor.show(); + }, + onFormSubmitted() { + actor.show(); + } + }); + return actor; + }, "_createActor"); + return { + name: "Feedback", + setupOnce() { + if (!isBrowser$1() || !_options.autoInject) { + return; + } + if (DOCUMENT.readyState === "loading") { + DOCUMENT.addEventListener("DOMContentLoaded", () => _createActor().appendToDom()); + } else { + _createActor().appendToDom(); + } + }, + /** + * Adds click listener to the element to open a feedback dialog + * + * The returned function can be used to remove the click listener + */ + attachTo: _attachTo, + /** + * Creates a new widget which is composed of a Button which triggers a Dialog. + * Accepts partial options to override any options passed to constructor. + */ + createWidget(optionOverrides = {}) { + const actor = _createActor(mergeOptions$2(_options, optionOverrides)); + actor.appendToDom(); + return actor; + }, + /** + * Creates a new Form which you can + * Accepts partial options to override any options passed to constructor. + */ + async createForm(optionOverrides = {}) { + return _loadAndRenderDialog(mergeOptions$2(_options, optionOverrides)); + }, + /** + * Removes the Feedback integration (including host, shadow DOM, and all widgets) + */ + remove() { + if (_shadow) { + _shadow.parentElement && _shadow.parentElement.remove(); + _shadow = null; + } + _subscriptions.forEach((sub) => sub()); + _subscriptions = []; + } + }; + }, "feedbackIntegration"); + return feedbackIntegration; +}, "buildFeedbackIntegration"); +function getFeedback() { + const client = getClient(); + return client && client.getIntegrationByName("Feedback"); +} +__name(getFeedback, "getFeedback"); +var n, l$1, u$1, i$1, o$1, r$1, f$1, c$1 = {}, s$1 = [], a$1 = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, h$1 = Array.isArray; +function v$1(n2, l2) { + for (var u2 in l2) n2[u2] = l2[u2]; + return n2; +} +__name(v$1, "v$1"); +function p$1(n2) { + var l2 = n2.parentNode; + l2 && l2.removeChild(n2); +} +__name(p$1, "p$1"); +function y$1(l2, u2, t2) { + var i2, o2, r2, f2 = {}; + for (r2 in u2) "key" == r2 ? i2 = u2[r2] : "ref" == r2 ? o2 = u2[r2] : f2[r2] = u2[r2]; + if (arguments.length > 2 && (f2.children = arguments.length > 3 ? n.call(arguments, 2) : t2), "function" == typeof l2 && null != l2.defaultProps) for (r2 in l2.defaultProps) void 0 === f2[r2] && (f2[r2] = l2.defaultProps[r2]); + return d$1(l2, f2, i2, o2, null); +} +__name(y$1, "y$1"); +function d$1(n2, t2, i2, o2, r2) { + var f2 = { type: n2, props: t2, key: i2, ref: o2, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: null == r2 ? ++u$1 : r2, __i: -1, __u: 0 }; + return null == r2 && null != l$1.vnode && l$1.vnode(f2), f2; +} +__name(d$1, "d$1"); +function g$1$1(n2) { + return n2.children; +} +__name(g$1$1, "g$1$1"); +function b$1(n2, l2) { + this.props = n2, this.context = l2; +} +__name(b$1, "b$1"); +function m$1(n2, l2) { + if (null == l2) return n2.__ ? m$1(n2.__, n2.__i + 1) : null; + for (var u2; l2 < n2.__k.length; l2++) if (null != (u2 = n2.__k[l2]) && null != u2.__e) return u2.__e; + return "function" == typeof n2.type ? m$1(n2) : null; +} +__name(m$1, "m$1"); +function w$1(n2, u2, t2) { + var i2, o2 = n2.__v, r2 = o2.__e, f2 = n2.__P; + if (f2) return (i2 = v$1({}, o2)).__v = o2.__v + 1, l$1.vnode && l$1.vnode(i2), M(f2, i2, o2, n2.__n, void 0 !== f2.ownerSVGElement, 32 & o2.__u ? [r2] : null, u2, null == r2 ? m$1(o2) : r2, !!(32 & o2.__u), t2), i2.__.__k[i2.__i] = i2, i2.__d = void 0, i2.__e != r2 && k$1(i2), i2; +} +__name(w$1, "w$1"); +function k$1(n2) { + var l2, u2; + if (null != (n2 = n2.__) && null != n2.__c) { + for (n2.__e = n2.__c.base = null, l2 = 0; l2 < n2.__k.length; l2++) if (null != (u2 = n2.__k[l2]) && null != u2.__e) { + n2.__e = n2.__c.base = u2.__e; + break; + } + return k$1(n2); + } +} +__name(k$1, "k$1"); +function x$1(n2) { + (!n2.__d && (n2.__d = true) && i$1.push(n2) && !C$1.__r++ || o$1 !== l$1.debounceRendering) && ((o$1 = l$1.debounceRendering) || r$1)(C$1); +} +__name(x$1, "x$1"); +function C$1() { + var n2, u2, t2, o2 = [], r2 = []; + for (i$1.sort(f$1); n2 = i$1.shift(); ) n2.__d && (t2 = i$1.length, u2 = w$1(n2, o2, r2) || u2, 0 === t2 || i$1.length > t2 ? (j$1(o2, u2, r2), r2.length = o2.length = 0, u2 = void 0, i$1.sort(f$1)) : u2 && l$1.__c && l$1.__c(u2, s$1)); + u2 && j$1(o2, u2, r2), C$1.__r = 0; +} +__name(C$1, "C$1"); +function P$1(n2, l2, u2, t2, i2, o2, r2, f2, e2, a2, h2) { + var v2, p2, y2, d2, _2, g2 = t2 && t2.__k || s$1, b2 = l2.length; + for (u2.__d = e2, S(u2, l2, g2), e2 = u2.__d, v2 = 0; v2 < b2; v2++) null != (y2 = u2.__k[v2]) && "boolean" != typeof y2 && "function" != typeof y2 && (p2 = -1 === y2.__i ? c$1 : g2[y2.__i] || c$1, y2.__i = v2, M(n2, y2, p2, i2, o2, r2, f2, e2, a2, h2), d2 = y2.__e, y2.ref && p2.ref != y2.ref && (p2.ref && N(p2.ref, null, y2), h2.push(y2.ref, y2.__c || d2, y2)), null == _2 && null != d2 && (_2 = d2), 65536 & y2.__u || p2.__k === y2.__k ? e2 = $(y2, e2, n2) : "function" == typeof y2.type && void 0 !== y2.__d ? e2 = y2.__d : d2 && (e2 = d2.nextSibling), y2.__d = void 0, y2.__u &= -196609); + u2.__d = e2, u2.__e = _2; +} +__name(P$1, "P$1"); +function S(n2, l2, u2) { + var t2, i2, o2, r2, f2, e2 = l2.length, c2 = u2.length, s2 = c2, a2 = 0; + for (n2.__k = [], t2 = 0; t2 < e2; t2++) null != (i2 = n2.__k[t2] = null == (i2 = l2[t2]) || "boolean" == typeof i2 || "function" == typeof i2 ? null : "string" == typeof i2 || "number" == typeof i2 || "bigint" == typeof i2 || i2.constructor == String ? d$1(null, i2, null, null, i2) : h$1(i2) ? d$1(g$1$1, { children: i2 }, null, null, null) : void 0 === i2.constructor && i2.__b > 0 ? d$1(i2.type, i2.props, i2.key, i2.ref ? i2.ref : null, i2.__v) : i2) ? (i2.__ = n2, i2.__b = n2.__b + 1, f2 = I(i2, u2, r2 = t2 + a2, s2), i2.__i = f2, o2 = null, -1 !== f2 && (s2--, (o2 = u2[f2]) && (o2.__u |= 131072)), null == o2 || null === o2.__v ? (-1 == f2 && a2--, "function" != typeof i2.type && (i2.__u |= 65536)) : f2 !== r2 && (f2 === r2 + 1 ? a2++ : f2 > r2 ? s2 > e2 - r2 ? a2 += f2 - r2 : a2-- : a2 = f2 < r2 && f2 == r2 - 1 ? f2 - r2 : 0, f2 !== t2 + a2 && (i2.__u |= 65536))) : (o2 = u2[t2]) && null == o2.key && o2.__e && (o2.__e == n2.__d && (n2.__d = m$1(o2)), O(o2, o2, false), u2[t2] = null, s2--); + if (s2) for (t2 = 0; t2 < c2; t2++) null != (o2 = u2[t2]) && 0 == (131072 & o2.__u) && (o2.__e == n2.__d && (n2.__d = m$1(o2)), O(o2, o2)); +} +__name(S, "S"); +function $(n2, l2, u2) { + var t2, i2; + if ("function" == typeof n2.type) { + for (t2 = n2.__k, i2 = 0; t2 && i2 < t2.length; i2++) t2[i2] && (t2[i2].__ = n2, l2 = $(t2[i2], l2, u2)); + return l2; + } + n2.__e != l2 && (u2.insertBefore(n2.__e, l2 || null), l2 = n2.__e); + do { + l2 = l2 && l2.nextSibling; + } while (null != l2 && 8 === l2.nodeType); + return l2; +} +__name($, "$"); +function I(n2, l2, u2, t2) { + var i2 = n2.key, o2 = n2.type, r2 = u2 - 1, f2 = u2 + 1, e2 = l2[u2]; + if (null === e2 || e2 && i2 == e2.key && o2 === e2.type) return u2; + if (t2 > (null != e2 && 0 == (131072 & e2.__u) ? 1 : 0)) for (; r2 >= 0 || f2 < l2.length; ) { + if (r2 >= 0) { + if ((e2 = l2[r2]) && 0 == (131072 & e2.__u) && i2 == e2.key && o2 === e2.type) return r2; + r2--; + } + if (f2 < l2.length) { + if ((e2 = l2[f2]) && 0 == (131072 & e2.__u) && i2 == e2.key && o2 === e2.type) return f2; + f2++; + } + } + return -1; +} +__name(I, "I"); +function T$1(n2, l2, u2) { + "-" === l2[0] ? n2.setProperty(l2, null == u2 ? "" : u2) : n2[l2] = null == u2 ? "" : "number" != typeof u2 || a$1.test(l2) ? u2 : u2 + "px"; +} +__name(T$1, "T$1"); +function A$1(n2, l2, u2, t2, i2) { + var o2; + n: if ("style" === l2) if ("string" == typeof u2) n2.style.cssText = u2; + else { + if ("string" == typeof t2 && (n2.style.cssText = t2 = ""), t2) for (l2 in t2) u2 && l2 in u2 || T$1(n2.style, l2, ""); + if (u2) for (l2 in u2) t2 && u2[l2] === t2[l2] || T$1(n2.style, l2, u2[l2]); + } + else if ("o" === l2[0] && "n" === l2[1]) o2 = l2 !== (l2 = l2.replace(/(PointerCapture)$|Capture$/i, "$1")), l2 = l2.toLowerCase() in n2 ? l2.toLowerCase().slice(2) : l2.slice(2), n2.l || (n2.l = {}), n2.l[l2 + o2] = u2, u2 ? t2 ? u2.u = t2.u : (u2.u = Date.now(), n2.addEventListener(l2, o2 ? L : D$1, o2)) : n2.removeEventListener(l2, o2 ? L : D$1, o2); + else { + if (i2) l2 = l2.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s"); + else if ("width" !== l2 && "height" !== l2 && "href" !== l2 && "list" !== l2 && "form" !== l2 && "tabIndex" !== l2 && "download" !== l2 && "rowSpan" !== l2 && "colSpan" !== l2 && "role" !== l2 && l2 in n2) try { + n2[l2] = null == u2 ? "" : u2; + break n; + } catch (n3) { + } + "function" == typeof u2 || (null == u2 || false === u2 && "-" !== l2[4] ? n2.removeAttribute(l2) : n2.setAttribute(l2, u2)); + } +} +__name(A$1, "A$1"); +function D$1(n2) { + if (this.l) { + var u2 = this.l[n2.type + false]; + if (n2.t) { + if (n2.t <= u2.u) return; + } else n2.t = Date.now(); + return u2(l$1.event ? l$1.event(n2) : n2); + } +} +__name(D$1, "D$1"); +function L(n2) { + if (this.l) return this.l[n2.type + true](l$1.event ? l$1.event(n2) : n2); +} +__name(L, "L"); +function M(n2, u2, t2, i2, o2, r2, f2, e2, c2, s2) { + var a2, p2, y2, d2, _2, m2, w2, k2, x2, C2, S2, $2, H, I2, T2, A2 = u2.type; + if (void 0 !== u2.constructor) return null; + 128 & t2.__u && (c2 = !!(32 & t2.__u), r2 = [e2 = u2.__e = t2.__e]), (a2 = l$1.__b) && a2(u2); + n: if ("function" == typeof A2) try { + if (k2 = u2.props, x2 = (a2 = A2.contextType) && i2[a2.__c], C2 = a2 ? x2 ? x2.props.value : a2.__ : i2, t2.__c ? w2 = (p2 = u2.__c = t2.__c).__ = p2.__E : ("prototype" in A2 && A2.prototype.render ? u2.__c = p2 = new A2(k2, C2) : (u2.__c = p2 = new b$1(k2, C2), p2.constructor = A2, p2.render = q$1), x2 && x2.sub(p2), p2.props = k2, p2.state || (p2.state = {}), p2.context = C2, p2.__n = i2, y2 = p2.__d = true, p2.__h = [], p2._sb = []), null == p2.__s && (p2.__s = p2.state), null != A2.getDerivedStateFromProps && (p2.__s == p2.state && (p2.__s = v$1({}, p2.__s)), v$1(p2.__s, A2.getDerivedStateFromProps(k2, p2.__s))), d2 = p2.props, _2 = p2.state, p2.__v = u2, y2) null == A2.getDerivedStateFromProps && null != p2.componentWillMount && p2.componentWillMount(), null != p2.componentDidMount && p2.__h.push(p2.componentDidMount); + else { + if (null == A2.getDerivedStateFromProps && k2 !== d2 && null != p2.componentWillReceiveProps && p2.componentWillReceiveProps(k2, C2), !p2.__e && (null != p2.shouldComponentUpdate && false === p2.shouldComponentUpdate(k2, p2.__s, C2) || u2.__v === t2.__v)) { + for (u2.__v !== t2.__v && (p2.props = k2, p2.state = p2.__s, p2.__d = false), u2.__e = t2.__e, u2.__k = t2.__k, u2.__k.forEach(function(n3) { + n3 && (n3.__ = u2); + }), S2 = 0; S2 < p2._sb.length; S2++) p2.__h.push(p2._sb[S2]); + p2._sb = [], p2.__h.length && f2.push(p2); + break n; + } + null != p2.componentWillUpdate && p2.componentWillUpdate(k2, p2.__s, C2), null != p2.componentDidUpdate && p2.__h.push(function() { + p2.componentDidUpdate(d2, _2, m2); + }); + } + if (p2.context = C2, p2.props = k2, p2.__P = n2, p2.__e = false, $2 = l$1.__r, H = 0, "prototype" in A2 && A2.prototype.render) { + for (p2.state = p2.__s, p2.__d = false, $2 && $2(u2), a2 = p2.render(p2.props, p2.state, p2.context), I2 = 0; I2 < p2._sb.length; I2++) p2.__h.push(p2._sb[I2]); + p2._sb = []; + } else do { + p2.__d = false, $2 && $2(u2), a2 = p2.render(p2.props, p2.state, p2.context), p2.state = p2.__s; + } while (p2.__d && ++H < 25); + p2.state = p2.__s, null != p2.getChildContext && (i2 = v$1(v$1({}, i2), p2.getChildContext())), y2 || null == p2.getSnapshotBeforeUpdate || (m2 = p2.getSnapshotBeforeUpdate(d2, _2)), P$1(n2, h$1(T2 = null != a2 && a2.type === g$1$1 && null == a2.key ? a2.props.children : a2) ? T2 : [T2], u2, t2, i2, o2, r2, f2, e2, c2, s2), p2.base = u2.__e, u2.__u &= -161, p2.__h.length && f2.push(p2), w2 && (p2.__E = p2.__ = null); + } catch (n3) { + u2.__v = null, c2 || null != r2 ? (u2.__e = e2, u2.__u |= c2 ? 160 : 32, r2[r2.indexOf(e2)] = null) : (u2.__e = t2.__e, u2.__k = t2.__k), l$1.__e(n3, u2, t2); + } + else null == r2 && u2.__v === t2.__v ? (u2.__k = t2.__k, u2.__e = t2.__e) : u2.__e = z$1(t2.__e, u2, t2, i2, o2, r2, f2, c2, s2); + (a2 = l$1.diffed) && a2(u2); +} +__name(M, "M"); +function j$1(n2, u2, t2) { + for (var i2 = 0; i2 < t2.length; i2++) N(t2[i2], t2[++i2], t2[++i2]); + l$1.__c && l$1.__c(u2, n2), n2.some(function(u3) { + try { + n2 = u3.__h, u3.__h = [], n2.some(function(n3) { + n3.call(u3); + }); + } catch (n3) { + l$1.__e(n3, u3.__v); + } + }); +} +__name(j$1, "j$1"); +function z$1(l2, u2, t2, i2, o2, r2, f2, e2, s2) { + var a2, v2, y2, d2, _2, g2, b2, w2 = t2.props, k2 = u2.props, x2 = u2.type; + if ("svg" === x2 && (o2 = true), null != r2) { + for (a2 = 0; a2 < r2.length; a2++) if ((_2 = r2[a2]) && "setAttribute" in _2 == !!x2 && (x2 ? _2.localName === x2 : 3 === _2.nodeType)) { + l2 = _2, r2[a2] = null; + break; + } + } + if (null == l2) { + if (null === x2) return document.createTextNode(k2); + l2 = o2 ? document.createElementNS("http://www.w3.org/2000/svg", x2) : document.createElement(x2, k2.is && k2), r2 = null, e2 = false; + } + if (null === x2) w2 === k2 || e2 && l2.data === k2 || (l2.data = k2); + else { + if (r2 = r2 && n.call(l2.childNodes), w2 = t2.props || c$1, !e2 && null != r2) for (w2 = {}, a2 = 0; a2 < l2.attributes.length; a2++) w2[(_2 = l2.attributes[a2]).name] = _2.value; + for (a2 in w2) _2 = w2[a2], "children" == a2 || ("dangerouslySetInnerHTML" == a2 ? y2 = _2 : "key" === a2 || a2 in k2 || A$1(l2, a2, null, _2, o2)); + for (a2 in k2) _2 = k2[a2], "children" == a2 ? d2 = _2 : "dangerouslySetInnerHTML" == a2 ? v2 = _2 : "value" == a2 ? g2 = _2 : "checked" == a2 ? b2 = _2 : "key" === a2 || e2 && "function" != typeof _2 || w2[a2] === _2 || A$1(l2, a2, _2, w2[a2], o2); + if (v2) e2 || y2 && (v2.__html === y2.__html || v2.__html === l2.innerHTML) || (l2.innerHTML = v2.__html), u2.__k = []; + else if (y2 && (l2.innerHTML = ""), P$1(l2, h$1(d2) ? d2 : [d2], u2, t2, i2, o2 && "foreignObject" !== x2, r2, f2, r2 ? r2[0] : t2.__k && m$1(t2, 0), e2, s2), null != r2) for (a2 = r2.length; a2--; ) null != r2[a2] && p$1(r2[a2]); + e2 || (a2 = "value", void 0 !== g2 && (g2 !== l2[a2] || "progress" === x2 && !g2 || "option" === x2 && g2 !== w2[a2]) && A$1(l2, a2, g2, w2[a2], false), a2 = "checked", void 0 !== b2 && b2 !== l2[a2] && A$1(l2, a2, b2, w2[a2], false)); + } + return l2; +} +__name(z$1, "z$1"); +function N(n2, u2, t2) { + try { + "function" == typeof n2 ? n2(u2) : n2.current = u2; + } catch (n3) { + l$1.__e(n3, t2); + } +} +__name(N, "N"); +function O(n2, u2, t2) { + var i2, o2; + if (l$1.unmount && l$1.unmount(n2), (i2 = n2.ref) && (i2.current && i2.current !== n2.__e || N(i2, null, u2)), null != (i2 = n2.__c)) { + if (i2.componentWillUnmount) try { + i2.componentWillUnmount(); + } catch (n3) { + l$1.__e(n3, u2); + } + i2.base = i2.__P = null, n2.__c = void 0; + } + if (i2 = n2.__k) for (o2 = 0; o2 < i2.length; o2++) i2[o2] && O(i2[o2], u2, t2 || "function" != typeof n2.type); + t2 || null == n2.__e || p$1(n2.__e), n2.__ = n2.__e = n2.__d = void 0; +} +__name(O, "O"); +function q$1(n2, l2, u2) { + return this.constructor(n2, u2); +} +__name(q$1, "q$1"); +function B$1(u2, t2, i2) { + var o2, r2, f2, e2; + l$1.__ && l$1.__(u2, t2), r2 = (o2 = "function" == typeof i2) ? null : t2.__k, f2 = [], e2 = [], M(t2, u2 = (!o2 && i2 || t2).__k = y$1(g$1$1, null, [u2]), r2 || c$1, c$1, void 0 !== t2.ownerSVGElement, !o2 && i2 ? [i2] : r2 ? null : t2.firstChild ? n.call(t2.childNodes) : null, f2, !o2 && i2 ? i2 : r2 ? r2.__e : t2.firstChild, o2, e2), u2.__d = void 0, j$1(f2, u2, e2); +} +__name(B$1, "B$1"); +n = s$1.slice, l$1 = { __e: /* @__PURE__ */ __name(function(n2, l2, u2, t2) { + for (var i2, o2, r2; l2 = l2.__; ) if ((i2 = l2.__c) && !i2.__) try { + if ((o2 = i2.constructor) && null != o2.getDerivedStateFromError && (i2.setState(o2.getDerivedStateFromError(n2)), r2 = i2.__d), null != i2.componentDidCatch && (i2.componentDidCatch(n2, t2 || {}), r2 = i2.__d), r2) return i2.__E = i2; + } catch (l3) { + n2 = l3; + } + throw n2; +}, "__e") }, u$1 = 0, b$1.prototype.setState = function(n2, l2) { + var u2; + u2 = null != this.__s && this.__s !== this.state ? this.__s : this.__s = v$1({}, this.state), "function" == typeof n2 && (n2 = n2(v$1({}, u2), this.props)), n2 && v$1(u2, n2), null != n2 && this.__v && (l2 && this._sb.push(l2), x$1(this)); +}, b$1.prototype.forceUpdate = function(n2) { + this.__v && (this.__e = true, n2 && this.__h.push(n2), x$1(this)); +}, b$1.prototype.render = g$1$1, i$1 = [], r$1 = "function" == typeof Promise ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, f$1 = /* @__PURE__ */ __name(function(n2, l2) { + return n2.__v.__b - l2.__v.__b; +}, "f$1"), C$1.__r = 0; +var t$1, r, u, i$2, o = 0, f = [], c = [], e = l$1, a = e.__b, v = e.__r, l = e.diffed, m = e.__c, s = e.unmount, d = e.__; +function h$2(n2, t2) { + e.__h && e.__h(r, n2, o || t2), o = 0; + var u2 = r.__H || (r.__H = { __: [], __h: [] }); + return n2 >= u2.__.length && u2.__.push({ __V: c }), u2.__[n2]; +} +__name(h$2, "h$2"); +function p$2(n2) { + return o = 1, y(D, n2); +} +__name(p$2, "p$2"); +function y(n2, u2, i2) { + var o2 = h$2(t$1++, 2); + if (o2.t = n2, !o2.__c && (o2.__ = [i2 ? i2(u2) : D(void 0, u2), function(n3) { + var t2 = o2.__N ? o2.__N[0] : o2.__[0], r2 = o2.t(t2, n3); + t2 !== r2 && (o2.__N = [r2, o2.__[1]], o2.__c.setState({})); + }], o2.__c = r, !r.u)) { + var f2 = /* @__PURE__ */ __name(function(n3, t2, r2) { + if (!o2.__c.__H) return true; + var u3 = o2.__c.__H.__.filter(function(n4) { + return !!n4.__c; + }); + if (u3.every(function(n4) { + return !n4.__N; + })) return !c2 || c2.call(this, n3, t2, r2); + var i3 = false; + return u3.forEach(function(n4) { + if (n4.__N) { + var t3 = n4.__[0]; + n4.__ = n4.__N, n4.__N = void 0, t3 !== n4.__[0] && (i3 = true); + } + }), !(!i3 && o2.__c.props === n3) && (!c2 || c2.call(this, n3, t2, r2)); + }, "f"); + r.u = true; + var c2 = r.shouldComponentUpdate, e2 = r.componentWillUpdate; + r.componentWillUpdate = function(n3, t2, r2) { + if (this.__e) { + var u3 = c2; + c2 = void 0, f2(n3, t2, r2), c2 = u3; + } + e2 && e2.call(this, n3, t2, r2); + }, r.shouldComponentUpdate = f2; + } + return o2.__N || o2.__; +} +__name(y, "y"); +function _$1(n2, u2) { + var i2 = h$2(t$1++, 3); + !e.__s && C(i2.__H, u2) && (i2.__ = n2, i2.i = u2, r.__H.__h.push(i2)); +} +__name(_$1, "_$1"); +function A(n2, u2) { + var i2 = h$2(t$1++, 4); + !e.__s && C(i2.__H, u2) && (i2.__ = n2, i2.i = u2, r.__h.push(i2)); +} +__name(A, "A"); +function F(n2) { + return o = 5, q(function() { + return { current: n2 }; + }, []); +} +__name(F, "F"); +function T(n2, t2, r2) { + o = 6, A(function() { + return "function" == typeof n2 ? (n2(t2()), function() { + return n2(null); + }) : n2 ? (n2.current = t2(), function() { + return n2.current = null; + }) : void 0; + }, null == r2 ? r2 : r2.concat(n2)); +} +__name(T, "T"); +function q(n2, r2) { + var u2 = h$2(t$1++, 7); + return C(u2.__H, r2) ? (u2.__V = n2(), u2.i = r2, u2.__h = n2, u2.__V) : u2.__; +} +__name(q, "q"); +function x(n2, t2) { + return o = 8, q(function() { + return n2; + }, t2); +} +__name(x, "x"); +function P$2(n2) { + var u2 = r.context[n2.__c], i2 = h$2(t$1++, 9); + return i2.c = n2, u2 ? (null == i2.__ && (i2.__ = true, u2.sub(r)), u2.props.value) : n2.__; +} +__name(P$2, "P$2"); +function V(n2, t2) { + e.useDebugValue && e.useDebugValue(t2 ? t2(n2) : n2); +} +__name(V, "V"); +function b(n2) { + var u2 = h$2(t$1++, 10), i2 = p$2(); + return u2.__ = n2, r.componentDidCatch || (r.componentDidCatch = function(n3, t2) { + u2.__ && u2.__(n3, t2), i2[1](n3); + }), [i2[0], function() { + i2[1](void 0); + }]; +} +__name(b, "b"); +function g$6() { + var n2 = h$2(t$1++, 11); + if (!n2.__) { + for (var u2 = r.__v; null !== u2 && !u2.__m && null !== u2.__; ) u2 = u2.__; + var i2 = u2.__m || (u2.__m = [0, 0]); + n2.__ = "P" + i2[0] + "-" + i2[1]++; + } + return n2.__; +} +__name(g$6, "g$6"); +function j() { + for (var n2; n2 = f.shift(); ) if (n2.__P && n2.__H) try { + n2.__H.__h.forEach(z$2), n2.__H.__h.forEach(B), n2.__H.__h = []; + } catch (t2) { + n2.__H.__h = [], e.__e(t2, n2.__v); + } +} +__name(j, "j"); +e.__b = function(n2) { + r = null, a && a(n2); +}, e.__ = function(n2, t2) { + t2.__k && t2.__k.__m && (n2.__m = t2.__k.__m), d && d(n2, t2); +}, e.__r = function(n2) { + v && v(n2), t$1 = 0; + var i2 = (r = n2.__c).__H; + i2 && (u === r ? (i2.__h = [], r.__h = [], i2.__.forEach(function(n3) { + n3.__N && (n3.__ = n3.__N), n3.__V = c, n3.__N = n3.i = void 0; + })) : (i2.__h.forEach(z$2), i2.__h.forEach(B), i2.__h = [], t$1 = 0)), u = r; +}, e.diffed = function(n2) { + l && l(n2); + var t2 = n2.__c; + t2 && t2.__H && (t2.__H.__h.length && (1 !== f.push(t2) && i$2 === e.requestAnimationFrame || ((i$2 = e.requestAnimationFrame) || w)(j)), t2.__H.__.forEach(function(n3) { + n3.i && (n3.__H = n3.i), n3.__V !== c && (n3.__ = n3.__V), n3.i = void 0, n3.__V = c; + })), u = r = null; +}, e.__c = function(n2, t2) { + t2.some(function(n3) { + try { + n3.__h.forEach(z$2), n3.__h = n3.__h.filter(function(n4) { + return !n4.__ || B(n4); + }); + } catch (r2) { + t2.some(function(n4) { + n4.__h && (n4.__h = []); + }), t2 = [], e.__e(r2, n3.__v); + } + }), m && m(n2, t2); +}, e.unmount = function(n2) { + s && s(n2); + var t2, r2 = n2.__c; + r2 && r2.__H && (r2.__H.__.forEach(function(n3) { + try { + z$2(n3); + } catch (n4) { + t2 = n4; + } + }), r2.__H = void 0, t2 && e.__e(t2, r2.__v)); +}; +var k = "function" == typeof requestAnimationFrame; +function w(n2) { + var t2, r2 = /* @__PURE__ */ __name(function() { + clearTimeout(u2), k && cancelAnimationFrame(t2), setTimeout(n2); + }, "r"), u2 = setTimeout(r2, 100); + k && (t2 = requestAnimationFrame(r2)); +} +__name(w, "w"); +function z$2(n2) { + var t2 = r, u2 = n2.__c; + "function" == typeof u2 && (n2.__c = void 0, u2()), r = t2; +} +__name(z$2, "z$2"); +function B(n2) { + var t2 = r; + n2.__c = n2.__(), r = t2; +} +__name(B, "B"); +function C(n2, t2) { + return !n2 || n2.length !== t2.length || t2.some(function(t3, r2) { + return t3 !== n2[r2]; + }); +} +__name(C, "C"); +function D(n2, t2) { + return "function" == typeof t2 ? t2(n2) : t2; +} +__name(D, "D"); +const hooks = { + __proto__: null, + useCallback: x, + useContext: P$2, + useDebugValue: V, + useEffect: _$1, + useErrorBoundary: b, + useId: g$6, + useImperativeHandle: T, + useLayoutEffect: A, + useMemo: q, + useReducer: y, + useRef: F, + useState: p$2 +}; +const XMLNS$1 = "http://www.w3.org/2000/svg"; +function SentryLogo() { + const createElementNS = /* @__PURE__ */ __name((tagName) => DOCUMENT.createElementNS(XMLNS$1, tagName), "createElementNS"); + const svg = setAttributesNS(createElementNS("svg"), { + width: "32", + height: "30", + viewBox: "0 0 72 66", + fill: "inherit" + }); + const path = setAttributesNS(createElementNS("path"), { + transform: "translate(11, 11)", + d: "M29,2.26a4.67,4.67,0,0,0-8,0L14.42,13.53A32.21,32.21,0,0,1,32.17,40.19H27.55A27.68,27.68,0,0,0,12.09,17.47L6,28a15.92,15.92,0,0,1,9.23,12.17H4.62A.76.76,0,0,1,4,39.06l2.94-5a10.74,10.74,0,0,0-3.36-1.9l-2.91,5a4.54,4.54,0,0,0,1.69,6.24A4.66,4.66,0,0,0,4.62,44H19.15a19.4,19.4,0,0,0-8-17.31l2.31-4A23.87,23.87,0,0,1,23.76,44H36.07a35.88,35.88,0,0,0-16.41-31.8l4.67-8a.77.77,0,0,1,1.05-.27c.53.29,20.29,34.77,20.66,35.17a.76.76,0,0,1-.68,1.13H40.6q.09,1.91,0,3.81h4.78A4.59,4.59,0,0,0,50,39.43a4.49,4.49,0,0,0-.62-2.28Z" + }); + svg.appendChild(path); + return svg; +} +__name(SentryLogo, "SentryLogo"); +function DialogHeader({ options: options4 }) { + const logoHtml = q(() => ({ __html: SentryLogo().outerHTML }), []); + return y$1( + "h2", + { class: "dialog__header" }, + y$1("span", { class: "dialog__title" }, options4.formTitle), + options4.showBranding ? y$1( + "a", + { + class: "brand-link", + target: "_blank", + href: "https://sentry.io/welcome/", + title: "Powered by Sentry", + rel: "noopener noreferrer", + dangerouslySetInnerHTML: logoHtml + } + ) : null + ); +} +__name(DialogHeader, "DialogHeader"); +function getMissingFields(feedback, props) { + const emptyFields = []; + if (props.isNameRequired && !feedback.name) { + emptyFields.push(props.nameLabel); + } + if (props.isEmailRequired && !feedback.email) { + emptyFields.push(props.emailLabel); + } + if (!feedback.message) { + emptyFields.push(props.messageLabel); + } + return emptyFields; +} +__name(getMissingFields, "getMissingFields"); +function retrieveStringValue(formData, key) { + const value4 = formData.get(key); + if (typeof value4 === "string") { + return value4.trim(); + } + return ""; +} +__name(retrieveStringValue, "retrieveStringValue"); +function Form({ + options: options4, + defaultEmail, + defaultName, + onFormClose, + onSubmit, + onSubmitSuccess, + onSubmitError, + showEmail, + showName, + screenshotInput +}) { + const { + tags, + addScreenshotButtonLabel, + removeScreenshotButtonLabel, + cancelButtonLabel, + emailLabel, + emailPlaceholder, + isEmailRequired, + isNameRequired, + messageLabel, + messagePlaceholder, + nameLabel, + namePlaceholder, + submitButtonLabel, + isRequiredLabel + } = options4; + const [error2, setError] = p$2(null); + const [showScreenshotInput, setShowScreenshotInput] = p$2(false); + const ScreenshotInputComponent = screenshotInput && screenshotInput.input; + const [screenshotError, setScreenshotError] = p$2(null); + const onScreenshotError = x((error3) => { + setScreenshotError(error3); + setShowScreenshotInput(false); + }, []); + const hasAllRequiredFields = x( + (data25) => { + const missingFields = getMissingFields(data25, { + emailLabel, + isEmailRequired, + isNameRequired, + messageLabel, + nameLabel + }); + if (missingFields.length > 0) { + setError(`Please enter in the following required fields: ${missingFields.join(", ")}`); + } else { + setError(null); + } + return missingFields.length === 0; + }, + [emailLabel, isEmailRequired, isNameRequired, messageLabel, nameLabel] + ); + const handleSubmit = x( + async (e2) => { + try { + e2.preventDefault(); + if (!(e2.target instanceof HTMLFormElement)) { + return; + } + const formData = new FormData(e2.target); + const attachment = await (screenshotInput && showScreenshotInput ? screenshotInput.value() : void 0); + const data25 = { + name: retrieveStringValue(formData, "name"), + email: retrieveStringValue(formData, "email"), + message: retrieveStringValue(formData, "message"), + attachments: attachment ? [attachment] : void 0 + }; + if (!hasAllRequiredFields(data25)) { + return; + } + try { + await onSubmit( + { + name: data25.name, + email: data25.email, + message: data25.message, + source: FEEDBACK_WIDGET_SOURCE, + tags + }, + { attachments: data25.attachments } + ); + onSubmitSuccess(data25); + } catch (error3) { + DEBUG_BUILD$1 && logger$2.error(error3); + setError(error3); + onSubmitError(error3); + } + } catch (e22) { + } + }, + [screenshotInput && showScreenshotInput, onSubmitSuccess, onSubmitError] + ); + return y$1( + "form", + { class: "form", onSubmit: handleSubmit }, + ScreenshotInputComponent && showScreenshotInput ? y$1(ScreenshotInputComponent, { onError: onScreenshotError }) : null, + y$1( + "div", + { class: "form__right", "data-sentry-feedback": true }, + y$1( + "div", + { class: "form__top" }, + error2 ? y$1("div", { class: "form__error-container" }, error2) : null, + showName ? y$1( + "label", + { for: "name", class: "form__label" }, + y$1(LabelText, { label: nameLabel, isRequiredLabel, isRequired: isNameRequired }), + y$1( + "input", + { + class: "form__input", + defaultValue: defaultName, + id: "name", + name: "name", + placeholder: namePlaceholder, + required: isNameRequired, + type: "text" + } + ) + ) : y$1("input", { "aria-hidden": true, value: defaultName, name: "name", type: "hidden" }), + showEmail ? y$1( + "label", + { for: "email", class: "form__label" }, + y$1(LabelText, { label: emailLabel, isRequiredLabel, isRequired: isEmailRequired }), + y$1( + "input", + { + class: "form__input", + defaultValue: defaultEmail, + id: "email", + name: "email", + placeholder: emailPlaceholder, + required: isEmailRequired, + type: "email" + } + ) + ) : y$1("input", { "aria-hidden": true, value: defaultEmail, name: "email", type: "hidden" }), + y$1( + "label", + { for: "message", class: "form__label" }, + y$1(LabelText, { label: messageLabel, isRequiredLabel, isRequired: true }), + y$1( + "textarea", + { + autoFocus: true, + class: "form__input form__input--textarea", + id: "message", + name: "message", + placeholder: messagePlaceholder, + required: true, + rows: 5 + } + ) + ), + ScreenshotInputComponent ? y$1( + "label", + { for: "screenshot", class: "form__label" }, + y$1( + "button", + { + class: "btn btn--default", + type: "button", + onClick: /* @__PURE__ */ __name(() => { + setScreenshotError(null); + setShowScreenshotInput((prev2) => !prev2); + }, "onClick") + }, + showScreenshotInput ? removeScreenshotButtonLabel : addScreenshotButtonLabel + ), + screenshotError ? y$1("div", { class: "form__error-container" }, screenshotError.message) : null + ) : null + ), + y$1( + "div", + { class: "btn-group" }, + y$1( + "button", + { class: "btn btn--primary", type: "submit" }, + submitButtonLabel + ), + y$1( + "button", + { class: "btn btn--default", type: "button", onClick: onFormClose }, + cancelButtonLabel + ) + ) + ) + ); +} +__name(Form, "Form"); +function LabelText({ + label: label5, + isRequired, + isRequiredLabel +}) { + return y$1( + "span", + { class: "form__label__text" }, + label5, + isRequired && y$1("span", { class: "form__label__text--required" }, isRequiredLabel) + ); +} +__name(LabelText, "LabelText"); +const WIDTH = 16; +const HEIGHT = 17; +const XMLNS = "http://www.w3.org/2000/svg"; +function SuccessIcon() { + const createElementNS = /* @__PURE__ */ __name((tagName) => WINDOW.document.createElementNS(XMLNS, tagName), "createElementNS"); + const svg = setAttributesNS(createElementNS("svg"), { + width: `${WIDTH}`, + height: `${HEIGHT}`, + viewBox: `0 0 ${WIDTH} ${HEIGHT}`, + fill: "inherit" + }); + const g2 = setAttributesNS(createElementNS("g"), { + clipPath: "url(#clip0_57_156)" + }); + const path2 = setAttributesNS(createElementNS("path"), { + ["fill-rule"]: "evenodd", + ["clip-rule"]: "evenodd", + d: "M3.55544 15.1518C4.87103 16.0308 6.41775 16.5 8 16.5C10.1217 16.5 12.1566 15.6571 13.6569 14.1569C15.1571 12.6566 16 10.6217 16 8.5C16 6.91775 15.5308 5.37103 14.6518 4.05544C13.7727 2.73985 12.5233 1.71447 11.0615 1.10897C9.59966 0.503466 7.99113 0.34504 6.43928 0.653721C4.88743 0.962403 3.46197 1.72433 2.34315 2.84315C1.22433 3.96197 0.462403 5.38743 0.153721 6.93928C-0.15496 8.49113 0.00346625 10.0997 0.608967 11.5615C1.21447 13.0233 2.23985 14.2727 3.55544 15.1518ZM4.40546 3.1204C5.46945 2.40946 6.72036 2.03 8 2.03C9.71595 2.03 11.3616 2.71166 12.575 3.92502C13.7883 5.13838 14.47 6.78405 14.47 8.5C14.47 9.77965 14.0905 11.0306 13.3796 12.0945C12.6687 13.1585 11.6582 13.9878 10.476 14.4775C9.29373 14.9672 7.99283 15.0953 6.73777 14.8457C5.48271 14.596 4.32987 13.9798 3.42502 13.075C2.52018 12.1701 1.90397 11.0173 1.65432 9.76224C1.40468 8.50718 1.5328 7.20628 2.0225 6.02404C2.5122 4.8418 3.34148 3.83133 4.40546 3.1204Z" + }); + const path = setAttributesNS(createElementNS("path"), { + d: "M6.68775 12.4297C6.78586 12.4745 6.89218 12.4984 7 12.5C7.11275 12.4955 7.22315 12.4664 7.32337 12.4145C7.4236 12.3627 7.51121 12.2894 7.58 12.2L12 5.63999C12.0848 5.47724 12.1071 5.28902 12.0625 5.11098C12.0178 4.93294 11.9095 4.77744 11.7579 4.67392C11.6064 4.57041 11.4221 4.52608 11.24 4.54931C11.0579 4.57254 10.8907 4.66173 10.77 4.79999L6.88 10.57L5.13 8.56999C5.06508 8.49566 4.98613 8.43488 4.89768 8.39111C4.80922 8.34735 4.713 8.32148 4.61453 8.31498C4.51605 8.30847 4.41727 8.32147 4.32382 8.35322C4.23038 8.38497 4.14413 8.43484 4.07 8.49999C3.92511 8.63217 3.83692 8.81523 3.82387 9.01092C3.81083 9.2066 3.87393 9.39976 4 9.54999L6.43 12.24C6.50187 12.3204 6.58964 12.385 6.68775 12.4297Z" + }); + svg.appendChild(g2).append(path, path2); + const speakerDefs = createElementNS("defs"); + const speakerClipPathDef = setAttributesNS(createElementNS("clipPath"), { + id: "clip0_57_156" + }); + const speakerRect = setAttributesNS(createElementNS("rect"), { + width: `${WIDTH}`, + height: `${WIDTH}`, + fill: "white", + transform: "translate(0 0.5)" + }); + speakerClipPathDef.appendChild(speakerRect); + speakerDefs.appendChild(speakerClipPathDef); + svg.appendChild(speakerDefs).appendChild(speakerClipPathDef).appendChild(speakerRect); + return svg; +} +__name(SuccessIcon, "SuccessIcon"); +function Dialog({ open: open2, onFormSubmitted, ...props }) { + const options4 = props.options; + const successIconHtml = q(() => ({ __html: SuccessIcon().outerHTML }), []); + const [timeoutId, setTimeoutId] = p$2(null); + const handleOnSuccessClick = x(() => { + if (timeoutId) { + clearTimeout(timeoutId); + setTimeoutId(null); + } + onFormSubmitted(); + }, [timeoutId]); + const onSubmitSuccess = x( + (data25) => { + props.onSubmitSuccess(data25); + setTimeoutId( + setTimeout(() => { + onFormSubmitted(); + setTimeoutId(null); + }, SUCCESS_MESSAGE_TIMEOUT) + ); + }, + [onFormSubmitted] + ); + return y$1( + g$1$1, + null, + timeoutId ? y$1( + "div", + { class: "success__position", onClick: handleOnSuccessClick }, + y$1( + "div", + { class: "success__content" }, + options4.successMessageText, + y$1("span", { class: "success__icon", dangerouslySetInnerHTML: successIconHtml }) + ) + ) : y$1( + "dialog", + { class: "dialog", onClick: options4.onFormClose, open: open2 }, + y$1( + "div", + { class: "dialog__position" }, + y$1( + "div", + { + class: "dialog__content", + onClick: /* @__PURE__ */ __name((e2) => { + e2.stopPropagation(); + }, "onClick") + }, + y$1(DialogHeader, { options: options4 }), + y$1(Form, { ...props, onSubmitSuccess }) + ) + ) + ) + ); +} +__name(Dialog, "Dialog"); +const DIALOG = ` +.dialog { + position: fixed; + z-index: var(--z-index); + margin: 0; + inset: 0; + + display: flex; + align-items: center; + justify-content: center; + padding: 0; + height: 100vh; + width: 100vw; + + color: var(--dialog-color, var(--foreground)); + fill: var(--dialog-color, var(--foreground)); + line-height: 1.75em; + + background-color: rgba(0, 0, 0, 0.05); + border: none; + inset: 0; + opacity: 1; + transition: opacity 0.2s ease-in-out; +} + +.dialog__position { + position: fixed; + z-index: var(--z-index); + inset: var(--dialog-inset); + padding: var(--page-margin); + display: flex; + max-height: calc(100vh - (2 * var(--page-margin))); +} +@media (max-width: 600px) { + .dialog__position { + inset: var(--page-margin); + padding: 0; + } +} + +.dialog__position:has(.editor) { + inset: var(--page-margin); + padding: 0; +} + +.dialog:not([open]) { + opacity: 0; + pointer-events: none; + visibility: hidden; +} +.dialog:not([open]) .dialog__content { + transform: translate(0, -16px) scale(0.98); +} + +.dialog__content { + display: flex; + flex-direction: column; + gap: 16px; + padding: var(--dialog-padding, 24px); + max-width: 100%; + width: 100%; + max-height: 100%; + overflow: auto; + + background: var(--dialog-background, var(--background)); + border-radius: var(--dialog-border-radius, 20px); + border: var(--dialog-border, var(--border)); + box-shadow: var(--dialog-box-shadow, var(--box-shadow)); + transform: translate(0, 0) scale(1); + transition: transform 0.2s ease-in-out; +} + +`; +const DIALOG_HEADER = ` +.dialog__header { + display: flex; + gap: 4px; + justify-content: space-between; + font-weight: var(--dialog-header-weight, 600); + margin: 0; +} +.dialog__title { + align-self: center; + width: var(--form-width, 272px); +} + +@media (max-width: 600px) { + .dialog__title { + width: auto; + } +} + +.dialog__position:has(.editor) .dialog__title { + width: auto; +} + + +.brand-link { + display: inline-flex; +} +.brand-link:focus-visible { + outline: var(--outline); +} +`; +const FORM = ` +.form { + display: flex; + overflow: auto; + flex-direction: row; + gap: 16px; + flex: 1 0; +} + +.form__right { + flex: 0 0 auto; + display: flex; + overflow: auto; + flex-direction: column; + justify-content: space-between; + gap: 20px; + width: var(--form-width, 100%); +} + +.dialog__position:has(.editor) .form__right { + width: var(--form-width, 272px); +} + +.form__top { + display: flex; + flex-direction: column; + gap: 8px; +} + +.form__error-container { + color: var(--error-color); + fill: var(--error-color); +} + +.form__label { + display: flex; + flex-direction: column; + gap: 4px; + margin: 0px; +} + +.form__label__text { + display: flex; + gap: 4px; + align-items: center; +} + +.form__label__text--required { + font-size: 0.85em; +} + +.form__input { + font-family: inherit; + line-height: inherit; + background: transparent; + box-sizing: border-box; + border: var(--input-border, var(--border)); + border-radius: var(--input-border-radius, 6px); + color: var(--input-color, inherit); + fill: var(--input-color, inherit); + font-size: var(--input-font-size, inherit); + font-weight: var(--input-font-weight, 500); + padding: 6px 12px; +} + +.form__input::placeholder { + opacity: 0.65; + color: var(--input-placeholder-color, inherit); + filter: var(--interactive-filter); +} + +.form__input:focus-visible { + outline: var(--input-focus-outline, var(--outline)); +} + +.form__input--textarea { + font-family: inherit; + resize: vertical; +} + +.error { + color: var(--error-color); + fill: var(--error-color); +} +`; +const BUTTON = ` +.btn-group { + display: grid; + gap: 8px; +} + +.btn { + line-height: inherit; + border: var(--button-border, var(--border)); + border-radius: var(--button-border-radius, 6px); + cursor: pointer; + font-family: inherit; + font-size: var(--button-font-size, inherit); + font-weight: var(--button-font-weight, 600); + padding: var(--button-padding, 6px 16px); +} +.btn[disabled] { + opacity: 0.6; + pointer-events: none; +} + +.btn--primary { + color: var(--button-primary-color, var(--accent-foreground)); + fill: var(--button-primary-color, var(--accent-foreground)); + background: var(--button-primary-background, var(--accent-background)); + border: var(--button-primary-border, var(--border)); + border-radius: var(--button-primary-border-radius, 6px); + font-weight: var(--button-primary-font-weight, 500); +} +.btn--primary:hover { + color: var(--button-primary-hover-color, var(--accent-foreground)); + fill: var(--button-primary-hover-color, var(--accent-foreground)); + background: var(--button-primary-hover-background, var(--accent-background)); + filter: var(--interactive-filter); +} +.btn--primary:focus-visible { + background: var(--button-primary-hover-background, var(--accent-background)); + filter: var(--interactive-filter); + outline: var(--button-primary-focus-outline, var(--outline)); +} + +.btn--default { + color: var(--button-color, var(--foreground)); + fill: var(--button-color, var(--foreground)); + background: var(--button-background, var(--background)); + border: var(--button-border, var(--border)); + border-radius: var(--button-border-radius, 6px); + font-weight: var(--button-font-weight, 500); +} +.btn--default:hover { + color: var(--button-color, var(--foreground)); + fill: var(--button-color, var(--foreground)); + background: var(--button-hover-background, var(--background)); + filter: var(--interactive-filter); +} +.btn--default:focus-visible { + background: var(--button-hover-background, var(--background)); + filter: var(--interactive-filter); + outline: var(--button-focus-outline, var(--outline)); +} +`; +const SUCCESS = ` +.success__position { + position: fixed; + inset: var(--dialog-inset); + padding: var(--page-margin); + z-index: var(--z-index); +} +.success__content { + background: var(--success-background, var(--background)); + border: var(--success-border, var(--border)); + border-radius: var(--success-border-radius, 1.7em/50%); + box-shadow: var(--success-box-shadow, var(--box-shadow)); + font-weight: var(--success-font-weight, 600); + color: var(--success-color); + fill: var(--success-color); + padding: 12px 24px; + line-height: 1.75em; + + display: grid; + align-items: center; + grid-auto-flow: column; + gap: 6px; + cursor: default; +} + +.success__icon { + display: flex; +} +`; +function createDialogStyles(styleNonce) { + const style2 = DOCUMENT.createElement("style"); + style2.textContent = ` +:host { + --dialog-inset: var(--inset); +} + +${DIALOG} +${DIALOG_HEADER} +${FORM} +${BUTTON} +${SUCCESS} +`; + if (styleNonce) { + style2.setAttribute("nonce", styleNonce); + } + return style2; +} +__name(createDialogStyles, "createDialogStyles"); +function getUser() { + const currentUser = getCurrentScope$1().getUser(); + const isolationUser = getIsolationScope().getUser(); + const globalUser = getGlobalScope().getUser(); + if (currentUser && Object.keys(currentUser).length) { + return currentUser; + } + if (isolationUser && Object.keys(isolationUser).length) { + return isolationUser; + } + return globalUser; +} +__name(getUser, "getUser"); +const feedbackModalIntegration = /* @__PURE__ */ __name(() => { + return { + name: "FeedbackModal", + // eslint-disable-next-line @typescript-eslint/no-empty-function + setupOnce() { + }, + createDialog: /* @__PURE__ */ __name(({ options: options4, screenshotIntegration, sendFeedback: sendFeedback2, shadow }) => { + const shadowRoot = shadow; + const userKey = options4.useSentryUser; + const user = getUser(); + const el = DOCUMENT.createElement("div"); + const style2 = createDialogStyles(options4.styleNonce); + let originalOverflow = ""; + const dialog = { + get el() { + return el; + }, + appendToDom() { + if (!shadowRoot.contains(style2) && !shadowRoot.contains(el)) { + shadowRoot.appendChild(style2); + shadowRoot.appendChild(el); + } + }, + removeFromDom() { + shadowRoot.removeChild(el); + shadowRoot.removeChild(style2); + DOCUMENT.body.style.overflow = originalOverflow; + }, + open() { + renderContent(true); + options4.onFormOpen && options4.onFormOpen(); + originalOverflow = DOCUMENT.body.style.overflow; + DOCUMENT.body.style.overflow = "hidden"; + }, + close() { + renderContent(false); + DOCUMENT.body.style.overflow = originalOverflow; + } + }; + const screenshotInput = screenshotIntegration && screenshotIntegration.createInput({ h: y$1, hooks, dialog, options: options4 }); + const renderContent = /* @__PURE__ */ __name((open2) => { + B$1( + y$1( + Dialog, + { + options: options4, + screenshotInput, + showName: options4.showName || options4.isNameRequired, + showEmail: options4.showEmail || options4.isEmailRequired, + defaultName: userKey && user && user[userKey.name] || "", + defaultEmail: userKey && user && user[userKey.email] || "", + onFormClose: /* @__PURE__ */ __name(() => { + renderContent(false); + options4.onFormClose && options4.onFormClose(); + }, "onFormClose"), + onSubmit: sendFeedback2, + onSubmitSuccess: /* @__PURE__ */ __name((data25) => { + renderContent(false); + options4.onSubmitSuccess && options4.onSubmitSuccess(data25); + }, "onSubmitSuccess"), + onSubmitError: /* @__PURE__ */ __name((error2) => { + options4.onSubmitError && options4.onSubmitError(error2); + }, "onSubmitError"), + onFormSubmitted: /* @__PURE__ */ __name(() => { + options4.onFormSubmitted && options4.onFormSubmitted(); + }, "onFormSubmitted"), + open: open2 + } + ), + el + ); + }, "renderContent"); + return dialog; + }, "createDialog") + }; +}, "feedbackModalIntegration"); +function CropCornerFactory({ + h: h2 + // eslint-disable-line @typescript-eslint/no-unused-vars +}) { + return /* @__PURE__ */ __name(function CropCorner({ + top, + left, + corner, + onGrabButton + }) { + return h2( + "button", + { + class: `editor__crop-corner editor__crop-corner--${corner} `, + style: { + top, + left + }, + onMouseDown: /* @__PURE__ */ __name((e2) => { + e2.preventDefault(); + onGrabButton(e2, corner); + }, "onMouseDown"), + onClick: /* @__PURE__ */ __name((e2) => { + e2.preventDefault(); + }, "onClick") + } + ); + }, "CropCorner"); +} +__name(CropCornerFactory, "CropCornerFactory"); +function createScreenshotInputStyles(styleNonce) { + const style2 = DOCUMENT.createElement("style"); + const surface200 = "#1A141F"; + const gray100 = "#302735"; + style2.textContent = ` +.editor { + padding: 10px; + padding-top: 65px; + padding-bottom: 65px; + flex-grow: 1; + + background-color: ${surface200}; + background-image: repeating-linear-gradient( + -145deg, + transparent, + transparent 8px, + ${surface200} 8px, + ${surface200} 11px + ), + repeating-linear-gradient( + -45deg, + transparent, + transparent 15px, + ${gray100} 15px, + ${gray100} 16px + ); +} + +.editor__canvas-container { + width: 100%; + height: 100%; + position: relative; + display: flex; + align-items: center; + justify-content: center; +} + +.editor__canvas-container canvas { + object-fit: contain; + position: relative; +} + +.editor__crop-btn-group { + padding: 8px; + gap: 8px; + border-radius: var(--menu-border-radius, 6px); + background: var(--button-primary-background, var(--background)); + width: 175px; + position: absolute; +} + +.editor__crop-corner { + width: 30px; + height: 30px; + position: absolute; + background: none; + border: 3px solid #ffffff; +} + +.editor__crop-corner--top-left { + cursor: nwse-resize; + border-right: none; + border-bottom: none; +} +.editor__crop-corner--top-right { + cursor: nesw-resize; + border-left: none; + border-bottom: none; +} +.editor__crop-corner--bottom-left { + cursor: nesw-resize; + border-right: none; + border-top: none; +} +.editor__crop-corner--bottom-right { + cursor: nwse-resize; + border-left: none; + border-top: none; +} +`; + if (styleNonce) { + style2.setAttribute("nonce", styleNonce); + } + return style2; +} +__name(createScreenshotInputStyles, "createScreenshotInputStyles"); +function useTakeScreenshotFactory({ hooks: hooks2 }) { + return /* @__PURE__ */ __name(function useTakeScreenshot({ onBeforeScreenshot, onScreenshot, onAfterScreenshot, onError }) { + hooks2.useEffect(() => { + const takeScreenshot = /* @__PURE__ */ __name(async () => { + onBeforeScreenshot(); + const stream = await NAVIGATOR.mediaDevices.getDisplayMedia({ + video: { + width: WINDOW.innerWidth * WINDOW.devicePixelRatio, + height: WINDOW.innerHeight * WINDOW.devicePixelRatio + }, + audio: false, + // @ts-expect-error experimental flags: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getDisplayMedia#prefercurrenttab + monitorTypeSurfaces: "exclude", + preferCurrentTab: true, + selfBrowserSurface: "include", + surfaceSwitching: "exclude" + }); + const video = DOCUMENT.createElement("video"); + await new Promise((resolve2, reject3) => { + video.srcObject = stream; + video.onloadedmetadata = () => { + onScreenshot(video); + stream.getTracks().forEach((track2) => track2.stop()); + resolve2(); + }; + video.play().catch(reject3); + }); + onAfterScreenshot(); + }, "takeScreenshot"); + takeScreenshot().catch(onError); + }, []); + }, "useTakeScreenshot"); +} +__name(useTakeScreenshotFactory, "useTakeScreenshotFactory"); +const CROP_BUTTON_SIZE = 30; +const CROP_BUTTON_BORDER = 3; +const CROP_BUTTON_OFFSET = CROP_BUTTON_SIZE + CROP_BUTTON_BORDER; +const DPI = WINDOW.devicePixelRatio; +const constructRect = /* @__PURE__ */ __name((box) => { + return { + x: Math.min(box.startX, box.endX), + y: Math.min(box.startY, box.endY), + width: Math.abs(box.startX - box.endX), + height: Math.abs(box.startY - box.endY) + }; +}, "constructRect"); +const getContainedSize = /* @__PURE__ */ __name((img) => { + const imgClientHeight = img.clientHeight; + const imgClientWidth = img.clientWidth; + const ratio = img.width / img.height; + let width2 = imgClientHeight * ratio; + let height = imgClientHeight; + if (width2 > imgClientWidth) { + width2 = imgClientWidth; + height = imgClientWidth / ratio; + } + const x2 = (imgClientWidth - width2) / 2; + const y2 = (imgClientHeight - height) / 2; + return { startX: x2, startY: y2, endX: width2 + x2, endY: height + y2 }; +}, "getContainedSize"); +function ScreenshotEditorFactory({ + h: h2, + hooks: hooks2, + imageBuffer, + dialog, + options: options4 +}) { + const useTakeScreenshot = useTakeScreenshotFactory({ hooks: hooks2 }); + return /* @__PURE__ */ __name(function ScreenshotEditor({ onError }) { + const styles = hooks2.useMemo(() => ({ __html: createScreenshotInputStyles(options4.styleNonce).innerText }), []); + const CropCorner = CropCornerFactory({ h: h2 }); + const canvasContainerRef = hooks2.useRef(null); + const cropContainerRef = hooks2.useRef(null); + const croppingRef = hooks2.useRef(null); + const [croppingRect, setCroppingRect] = hooks2.useState({ startX: 0, startY: 0, endX: 0, endY: 0 }); + const [confirmCrop, setConfirmCrop] = hooks2.useState(false); + const [isResizing, setIsResizing] = hooks2.useState(false); + hooks2.useEffect(() => { + WINDOW.addEventListener("resize", resizeCropper, false); + }, []); + function resizeCropper() { + const cropper = croppingRef.current; + const imageDimensions = constructRect(getContainedSize(imageBuffer)); + if (cropper) { + cropper.width = imageDimensions.width * DPI; + cropper.height = imageDimensions.height * DPI; + cropper.style.width = `${imageDimensions.width}px`; + cropper.style.height = `${imageDimensions.height}px`; + const ctx = cropper.getContext("2d"); + if (ctx) { + ctx.scale(DPI, DPI); + } + } + const cropButton = cropContainerRef.current; + if (cropButton) { + cropButton.style.width = `${imageDimensions.width}px`; + cropButton.style.height = `${imageDimensions.height}px`; + } + setCroppingRect({ startX: 0, startY: 0, endX: imageDimensions.width, endY: imageDimensions.height }); + } + __name(resizeCropper, "resizeCropper"); + hooks2.useEffect(() => { + const cropper = croppingRef.current; + if (!cropper) { + return; + } + const ctx = cropper.getContext("2d"); + if (!ctx) { + return; + } + const imageDimensions = constructRect(getContainedSize(imageBuffer)); + const croppingBox = constructRect(croppingRect); + ctx.clearRect(0, 0, imageDimensions.width, imageDimensions.height); + ctx.fillStyle = "rgba(0, 0, 0, 0.5)"; + ctx.fillRect(0, 0, imageDimensions.width, imageDimensions.height); + ctx.clearRect(croppingBox.x, croppingBox.y, croppingBox.width, croppingBox.height); + ctx.strokeStyle = "#ffffff"; + ctx.lineWidth = 3; + ctx.strokeRect(croppingBox.x + 1, croppingBox.y + 1, croppingBox.width - 2, croppingBox.height - 2); + ctx.strokeStyle = "#000000"; + ctx.lineWidth = 1; + ctx.strokeRect(croppingBox.x + 3, croppingBox.y + 3, croppingBox.width - 6, croppingBox.height - 6); + }, [croppingRect]); + function onGrabButton(e2, corner) { + setConfirmCrop(false); + setIsResizing(true); + const handleMouseMove2 = makeHandleMouseMove(corner); + const handleMouseUp = /* @__PURE__ */ __name(() => { + DOCUMENT.removeEventListener("mousemove", handleMouseMove2); + DOCUMENT.removeEventListener("mouseup", handleMouseUp); + setConfirmCrop(true); + setIsResizing(false); + }, "handleMouseUp"); + DOCUMENT.addEventListener("mouseup", handleMouseUp); + DOCUMENT.addEventListener("mousemove", handleMouseMove2); + } + __name(onGrabButton, "onGrabButton"); + const makeHandleMouseMove = hooks2.useCallback((corner) => { + return function(e2) { + if (!croppingRef.current) { + return; + } + const cropCanvas = croppingRef.current; + const cropBoundingRect = cropCanvas.getBoundingClientRect(); + const mouseX = e2.clientX - cropBoundingRect.x; + const mouseY = e2.clientY - cropBoundingRect.y; + switch (corner) { + case "top-left": + setCroppingRect((prev2) => ({ + ...prev2, + startX: Math.min(Math.max(0, mouseX), prev2.endX - CROP_BUTTON_OFFSET), + startY: Math.min(Math.max(0, mouseY), prev2.endY - CROP_BUTTON_OFFSET) + })); + break; + case "top-right": + setCroppingRect((prev2) => ({ + ...prev2, + endX: Math.max(Math.min(mouseX, cropCanvas.width / DPI), prev2.startX + CROP_BUTTON_OFFSET), + startY: Math.min(Math.max(0, mouseY), prev2.endY - CROP_BUTTON_OFFSET) + })); + break; + case "bottom-left": + setCroppingRect((prev2) => ({ + ...prev2, + startX: Math.min(Math.max(0, mouseX), prev2.endX - CROP_BUTTON_OFFSET), + endY: Math.max(Math.min(mouseY, cropCanvas.height / DPI), prev2.startY + CROP_BUTTON_OFFSET) + })); + break; + case "bottom-right": + setCroppingRect((prev2) => ({ + ...prev2, + endX: Math.max(Math.min(mouseX, cropCanvas.width / DPI), prev2.startX + CROP_BUTTON_OFFSET), + endY: Math.max(Math.min(mouseY, cropCanvas.height / DPI), prev2.startY + CROP_BUTTON_OFFSET) + })); + break; + } + }; + }, []); + const initialPositionRef = hooks2.useRef({ initialX: 0, initialY: 0 }); + function onDragStart2(e2) { + if (isResizing) return; + initialPositionRef.current = { initialX: e2.clientX, initialY: e2.clientY }; + const handleMouseMove2 = /* @__PURE__ */ __name((moveEvent) => { + const cropCanvas = croppingRef.current; + if (!cropCanvas) return; + const deltaX = moveEvent.clientX - initialPositionRef.current.initialX; + const deltaY = moveEvent.clientY - initialPositionRef.current.initialY; + setCroppingRect((prev2) => { + const newStartX = Math.max( + 0, + Math.min(prev2.startX + deltaX, cropCanvas.width / DPI - (prev2.endX - prev2.startX)) + ); + const newStartY = Math.max( + 0, + Math.min(prev2.startY + deltaY, cropCanvas.height / DPI - (prev2.endY - prev2.startY)) + ); + const newEndX = newStartX + (prev2.endX - prev2.startX); + const newEndY = newStartY + (prev2.endY - prev2.startY); + initialPositionRef.current.initialX = moveEvent.clientX; + initialPositionRef.current.initialY = moveEvent.clientY; + return { + startX: newStartX, + startY: newStartY, + endX: newEndX, + endY: newEndY + }; + }); + }, "handleMouseMove"); + const handleMouseUp = /* @__PURE__ */ __name(() => { + DOCUMENT.removeEventListener("mousemove", handleMouseMove2); + DOCUMENT.removeEventListener("mouseup", handleMouseUp); + }, "handleMouseUp"); + DOCUMENT.addEventListener("mousemove", handleMouseMove2); + DOCUMENT.addEventListener("mouseup", handleMouseUp); + } + __name(onDragStart2, "onDragStart"); + function submit() { + const cutoutCanvas = DOCUMENT.createElement("canvas"); + const imageBox = constructRect(getContainedSize(imageBuffer)); + const croppingBox = constructRect(croppingRect); + cutoutCanvas.width = croppingBox.width * DPI; + cutoutCanvas.height = croppingBox.height * DPI; + const cutoutCtx = cutoutCanvas.getContext("2d"); + if (cutoutCtx && imageBuffer) { + cutoutCtx.drawImage( + imageBuffer, + croppingBox.x / imageBox.width * imageBuffer.width, + croppingBox.y / imageBox.height * imageBuffer.height, + croppingBox.width / imageBox.width * imageBuffer.width, + croppingBox.height / imageBox.height * imageBuffer.height, + 0, + 0, + cutoutCanvas.width, + cutoutCanvas.height + ); + } + const ctx = imageBuffer.getContext("2d"); + if (ctx) { + ctx.clearRect(0, 0, imageBuffer.width, imageBuffer.height); + imageBuffer.width = cutoutCanvas.width; + imageBuffer.height = cutoutCanvas.height; + imageBuffer.style.width = `${croppingBox.width}px`; + imageBuffer.style.height = `${croppingBox.height}px`; + ctx.drawImage(cutoutCanvas, 0, 0); + resizeCropper(); + } + } + __name(submit, "submit"); + useTakeScreenshot({ + onBeforeScreenshot: hooks2.useCallback(() => { + dialog.el.style.display = "none"; + }, []), + onScreenshot: hooks2.useCallback( + (imageSource) => { + const context = imageBuffer.getContext("2d"); + if (!context) { + throw new Error("Could not get canvas context"); + } + imageBuffer.width = imageSource.videoWidth; + imageBuffer.height = imageSource.videoHeight; + imageBuffer.style.width = "100%"; + imageBuffer.style.height = "100%"; + context.drawImage(imageSource, 0, 0); + }, + [imageBuffer] + ), + onAfterScreenshot: hooks2.useCallback(() => { + dialog.el.style.display = "block"; + const container = canvasContainerRef.current; + container && container.appendChild(imageBuffer); + resizeCropper(); + }, []), + onError: hooks2.useCallback((error2) => { + dialog.el.style.display = "block"; + onError(error2); + }, []) + }); + return h2( + "div", + { class: "editor" }, + h2("style", { nonce: options4.styleNonce, dangerouslySetInnerHTML: styles }), + h2( + "div", + { class: "editor__canvas-container", ref: canvasContainerRef }, + h2( + "div", + { class: "editor__crop-container", style: { position: "absolute", zIndex: 1 }, ref: cropContainerRef }, + h2( + "canvas", + { + onMouseDown: onDragStart2, + style: { position: "absolute", cursor: confirmCrop ? "move" : "auto" }, + ref: croppingRef + } + ), + h2( + CropCorner, + { + left: croppingRect.startX - CROP_BUTTON_BORDER, + top: croppingRect.startY - CROP_BUTTON_BORDER, + onGrabButton, + corner: "top-left" + } + ), + h2( + CropCorner, + { + left: croppingRect.endX - CROP_BUTTON_SIZE + CROP_BUTTON_BORDER, + top: croppingRect.startY - CROP_BUTTON_BORDER, + onGrabButton, + corner: "top-right" + } + ), + h2( + CropCorner, + { + left: croppingRect.startX - CROP_BUTTON_BORDER, + top: croppingRect.endY - CROP_BUTTON_SIZE + CROP_BUTTON_BORDER, + onGrabButton, + corner: "bottom-left" + } + ), + h2( + CropCorner, + { + left: croppingRect.endX - CROP_BUTTON_SIZE + CROP_BUTTON_BORDER, + top: croppingRect.endY - CROP_BUTTON_SIZE + CROP_BUTTON_BORDER, + onGrabButton, + corner: "bottom-right" + } + ), + h2( + "div", + { + style: { + left: Math.max(0, croppingRect.endX - 191), + top: Math.max(0, croppingRect.endY + 8), + display: confirmCrop ? "flex" : "none" + }, + class: "editor__crop-btn-group" + }, + h2( + "button", + { + onClick: /* @__PURE__ */ __name((e2) => { + e2.preventDefault(); + if (croppingRef.current) { + setCroppingRect({ + startX: 0, + startY: 0, + endX: croppingRef.current.width / DPI, + endY: croppingRef.current.height / DPI + }); + } + setConfirmCrop(false); + }, "onClick"), + class: "btn btn--default" + }, + options4.cancelButtonLabel + ), + h2( + "button", + { + onClick: /* @__PURE__ */ __name((e2) => { + e2.preventDefault(); + submit(); + setConfirmCrop(false); + }, "onClick"), + class: "btn btn--primary" + }, + options4.confirmButtonLabel + ) + ) + ) + ) + ); + }, "ScreenshotEditor"); +} +__name(ScreenshotEditorFactory, "ScreenshotEditorFactory"); +const feedbackScreenshotIntegration = /* @__PURE__ */ __name(() => { + return { + name: "FeedbackScreenshot", + // eslint-disable-next-line @typescript-eslint/no-empty-function + setupOnce() { + }, + createInput: /* @__PURE__ */ __name(({ h: h2, hooks: hooks2, dialog, options: options4 }) => { + const imageBuffer = DOCUMENT.createElement("canvas"); + return { + input: ScreenshotEditorFactory({ + h: h2, + hooks: hooks2, + imageBuffer, + dialog, + options: options4 + }), + // eslint-disable-line @typescript-eslint/no-explicit-any + value: /* @__PURE__ */ __name(async () => { + const blob = await new Promise((resolve2) => { + imageBuffer.toBlob(resolve2, "image/png"); + }); + if (blob) { + const data25 = new Uint8Array(await blob.arrayBuffer()); + const attachment = { + data: data25, + filename: "screenshot.png", + contentType: "application/png" + // attachmentType?: string; + }; + return attachment; + } + return void 0; + }, "value") + }; + }, "createInput") + }; +}, "feedbackScreenshotIntegration"); +const feedbackAsyncIntegration = buildFeedbackIntegration({ + lazyLoadIntegration +}); +const feedbackSyncIntegration = buildFeedbackIntegration({ + getModalIntegration: /* @__PURE__ */ __name(() => feedbackModalIntegration, "getModalIntegration"), + getScreenshotIntegration: /* @__PURE__ */ __name(() => feedbackScreenshotIntegration, "getScreenshotIntegration") +}); +function increment(name2, value4 = 1, data25) { + metrics$1.increment(BrowserMetricsAggregator, name2, value4, data25); +} +__name(increment, "increment"); +function distribution(name2, value4, data25) { + metrics$1.distribution(BrowserMetricsAggregator, name2, value4, data25); +} +__name(distribution, "distribution"); +function set$5(name2, value4, data25) { + metrics$1.set(BrowserMetricsAggregator, name2, value4, data25); +} +__name(set$5, "set$5"); +function gauge(name2, value4, data25) { + metrics$1.gauge(BrowserMetricsAggregator, name2, value4, data25); +} +__name(gauge, "gauge"); +function timing(name2, value4, unit = "second", data25) { + return metrics$1.timing(BrowserMetricsAggregator, name2, value4, unit, data25); +} +__name(timing, "timing"); +const metrics = { + increment, + distribution, + set: set$5, + gauge, + timing +}; +const responseToSpanId = /* @__PURE__ */ new WeakMap(); +const spanIdToEndTimestamp = /* @__PURE__ */ new Map(); +const defaultRequestInstrumentationOptions = { + traceFetch: true, + traceXHR: true, + enableHTTPTimings: true, + trackFetchStreamPerformance: false +}; +function instrumentOutgoingRequests(client, _options) { + const { + traceFetch, + traceXHR, + trackFetchStreamPerformance, + shouldCreateSpanForRequest, + enableHTTPTimings, + tracePropagationTargets + } = { + traceFetch: defaultRequestInstrumentationOptions.traceFetch, + traceXHR: defaultRequestInstrumentationOptions.traceXHR, + trackFetchStreamPerformance: defaultRequestInstrumentationOptions.trackFetchStreamPerformance, + ..._options + }; + const shouldCreateSpan = typeof shouldCreateSpanForRequest === "function" ? shouldCreateSpanForRequest : (_2) => true; + const shouldAttachHeadersWithTargets = /* @__PURE__ */ __name((url) => shouldAttachHeaders(url, tracePropagationTargets), "shouldAttachHeadersWithTargets"); + const spans = {}; + if (traceFetch) { + client.addEventProcessor((event) => { + if (event.type === "transaction" && event.spans) { + event.spans.forEach((span) => { + if (span.op === "http.client") { + const updatedTimestamp = spanIdToEndTimestamp.get(span.span_id); + if (updatedTimestamp) { + span.timestamp = updatedTimestamp / 1e3; + spanIdToEndTimestamp.delete(span.span_id); + } + } + }); + } + return event; + }); + if (trackFetchStreamPerformance) { + addFetchEndInstrumentationHandler((handlerData) => { + if (handlerData.response) { + const span = responseToSpanId.get(handlerData.response); + if (span && handlerData.endTimestamp) { + spanIdToEndTimestamp.set(span, handlerData.endTimestamp); + } + } + }); + } + addFetchInstrumentationHandler((handlerData) => { + const createdSpan = instrumentFetchRequest(handlerData, shouldCreateSpan, shouldAttachHeadersWithTargets, spans); + if (handlerData.response && handlerData.fetchData.__span) { + responseToSpanId.set(handlerData.response, handlerData.fetchData.__span); + } + if (createdSpan) { + const fullUrl = getFullURL(handlerData.fetchData.url); + const host = fullUrl ? parseUrl$1(fullUrl).host : void 0; + createdSpan.setAttributes({ + "http.url": fullUrl, + "server.address": host + }); + } + if (enableHTTPTimings && createdSpan) { + addHTTPTimings(createdSpan); + } + }); + } + if (traceXHR) { + addXhrInstrumentationHandler((handlerData) => { + const createdSpan = xhrCallback(handlerData, shouldCreateSpan, shouldAttachHeadersWithTargets, spans); + if (enableHTTPTimings && createdSpan) { + addHTTPTimings(createdSpan); + } + }); + } +} +__name(instrumentOutgoingRequests, "instrumentOutgoingRequests"); +function isPerformanceResourceTiming(entry) { + return entry.entryType === "resource" && "initiatorType" in entry && typeof entry.nextHopProtocol === "string" && (entry.initiatorType === "fetch" || entry.initiatorType === "xmlhttprequest"); +} +__name(isPerformanceResourceTiming, "isPerformanceResourceTiming"); +function addHTTPTimings(span) { + const { url } = spanToJSON(span).data || {}; + if (!url || typeof url !== "string") { + return; + } + const cleanup = addPerformanceInstrumentationHandler("resource", ({ entries }) => { + entries.forEach((entry) => { + if (isPerformanceResourceTiming(entry) && entry.name.endsWith(url)) { + const spanData = resourceTimingEntryToSpanData(entry); + spanData.forEach((data25) => span.setAttribute(...data25)); + setTimeout(cleanup); + } + }); + }); +} +__name(addHTTPTimings, "addHTTPTimings"); +function extractNetworkProtocol(nextHopProtocol) { + let name2 = "unknown"; + let version2 = "unknown"; + let _name = ""; + for (const char of nextHopProtocol) { + if (char === "/") { + [name2, version2] = nextHopProtocol.split("/"); + break; + } + if (!isNaN(Number(char))) { + name2 = _name === "h" ? "http" : _name; + version2 = nextHopProtocol.split(_name)[1]; + break; + } + _name += char; + } + if (_name === nextHopProtocol) { + name2 = _name; + } + return { name: name2, version: version2 }; +} +__name(extractNetworkProtocol, "extractNetworkProtocol"); +function getAbsoluteTime(time = 0) { + return ((browserPerformanceTimeOrigin || performance.timeOrigin) + time) / 1e3; +} +__name(getAbsoluteTime, "getAbsoluteTime"); +function resourceTimingEntryToSpanData(resourceTiming) { + const { name: name2, version: version2 } = extractNetworkProtocol(resourceTiming.nextHopProtocol); + const timingSpanData = []; + timingSpanData.push(["network.protocol.version", version2], ["network.protocol.name", name2]); + if (!browserPerformanceTimeOrigin) { + return timingSpanData; + } + return [ + ...timingSpanData, + ["http.request.redirect_start", getAbsoluteTime(resourceTiming.redirectStart)], + ["http.request.fetch_start", getAbsoluteTime(resourceTiming.fetchStart)], + ["http.request.domain_lookup_start", getAbsoluteTime(resourceTiming.domainLookupStart)], + ["http.request.domain_lookup_end", getAbsoluteTime(resourceTiming.domainLookupEnd)], + ["http.request.connect_start", getAbsoluteTime(resourceTiming.connectStart)], + ["http.request.secure_connection_start", getAbsoluteTime(resourceTiming.secureConnectionStart)], + ["http.request.connection_end", getAbsoluteTime(resourceTiming.connectEnd)], + ["http.request.request_start", getAbsoluteTime(resourceTiming.requestStart)], + ["http.request.response_start", getAbsoluteTime(resourceTiming.responseStart)], + ["http.request.response_end", getAbsoluteTime(resourceTiming.responseEnd)] + ]; +} +__name(resourceTimingEntryToSpanData, "resourceTimingEntryToSpanData"); +function shouldAttachHeaders(targetUrl, tracePropagationTargets) { + const href = WINDOW$5.location && WINDOW$5.location.href; + if (!href) { + const isRelativeSameOriginRequest = !!targetUrl.match(/^\/(?!\/)/); + if (!tracePropagationTargets) { + return isRelativeSameOriginRequest; + } else { + return stringMatchesSomePattern(targetUrl, tracePropagationTargets); + } + } else { + let resolvedUrl; + let currentOrigin; + try { + resolvedUrl = new URL(targetUrl, href); + currentOrigin = new URL(href).origin; + } catch (e2) { + return false; + } + const isSameOriginRequest = resolvedUrl.origin === currentOrigin; + if (!tracePropagationTargets) { + return isSameOriginRequest; + } else { + return stringMatchesSomePattern(resolvedUrl.toString(), tracePropagationTargets) || isSameOriginRequest && stringMatchesSomePattern(resolvedUrl.pathname, tracePropagationTargets); + } + } +} +__name(shouldAttachHeaders, "shouldAttachHeaders"); +function xhrCallback(handlerData, shouldCreateSpan, shouldAttachHeaders2, spans) { + const xhr = handlerData.xhr; + const sentryXhrData = xhr && xhr[SENTRY_XHR_DATA_KEY]; + if (!xhr || xhr.__sentry_own_request__ || !sentryXhrData) { + return void 0; + } + const shouldCreateSpanResult = hasTracingEnabled() && shouldCreateSpan(sentryXhrData.url); + if (handlerData.endTimestamp && shouldCreateSpanResult) { + const spanId = xhr.__sentry_xhr_span_id__; + if (!spanId) return; + const span2 = spans[spanId]; + if (span2 && sentryXhrData.status_code !== void 0) { + setHttpStatus(span2, sentryXhrData.status_code); + span2.end(); + delete spans[spanId]; + } + return void 0; + } + const fullUrl = getFullURL(sentryXhrData.url); + const host = fullUrl ? parseUrl$1(fullUrl).host : void 0; + const hasParent = !!getActiveSpan(); + const span = shouldCreateSpanResult && hasParent ? startInactiveSpan({ + name: `${sentryXhrData.method} ${sentryXhrData.url}`, + attributes: { + type: "xhr", + "http.method": sentryXhrData.method, + "http.url": fullUrl, + url: sentryXhrData.url, + "server.address": host, + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.http.browser", + [SEMANTIC_ATTRIBUTE_SENTRY_OP]: "http.client" + } + }) : new SentryNonRecordingSpan(); + xhr.__sentry_xhr_span_id__ = span.spanContext().spanId; + spans[xhr.__sentry_xhr_span_id__] = span; + if (shouldAttachHeaders2(sentryXhrData.url)) { + addTracingHeadersToXhrRequest( + xhr, + // If performance is disabled (TWP) or there's no active root span (pageload/navigation/interaction), + // we do not want to use the span as base for the trace headers, + // which means that the headers will be generated from the scope and the sampling decision is deferred + hasTracingEnabled() && hasParent ? span : void 0 + ); + } + return span; +} +__name(xhrCallback, "xhrCallback"); +function addTracingHeadersToXhrRequest(xhr, span) { + const { "sentry-trace": sentryTrace, baggage } = getTraceData({ span }); + if (sentryTrace) { + setHeaderOnXhr(xhr, sentryTrace, baggage); + } +} +__name(addTracingHeadersToXhrRequest, "addTracingHeadersToXhrRequest"); +function setHeaderOnXhr(xhr, sentryTraceHeader, sentryBaggageHeader) { + try { + xhr.setRequestHeader("sentry-trace", sentryTraceHeader); + if (sentryBaggageHeader) { + xhr.setRequestHeader("baggage", sentryBaggageHeader); + } + } catch (_2) { + } +} +__name(setHeaderOnXhr, "setHeaderOnXhr"); +function getFullURL(url) { + try { + const parsed = new URL(url, WINDOW$5.location.origin); + return parsed.href; + } catch (e2) { + return void 0; + } +} +__name(getFullURL, "getFullURL"); +function registerBackgroundTabDetection() { + if (WINDOW$5 && WINDOW$5.document) { + WINDOW$5.document.addEventListener("visibilitychange", () => { + const activeSpan = getActiveSpan(); + if (!activeSpan) { + return; + } + const rootSpan = getRootSpan(activeSpan); + if (WINDOW$5.document.hidden && rootSpan) { + const cancelledStatus = "cancelled"; + const { op, status } = spanToJSON(rootSpan); + if (DEBUG_BUILD$4) { + logger$2.log(`[Tracing] Transaction: ${cancelledStatus} -> since tab moved to the background, op: ${op}`); + } + if (!status) { + rootSpan.setStatus({ code: SPAN_STATUS_ERROR, message: cancelledStatus }); + } + rootSpan.setAttribute("sentry.cancellation_reason", "document.hidden"); + rootSpan.end(); + } + }); + } else { + DEBUG_BUILD$4 && logger$2.warn("[Tracing] Could not set up background tab detection due to lack of global document"); + } +} +__name(registerBackgroundTabDetection, "registerBackgroundTabDetection"); +const BROWSER_TRACING_INTEGRATION_ID = "BrowserTracing"; +const DEFAULT_BROWSER_TRACING_OPTIONS = { + ...TRACING_DEFAULTS, + instrumentNavigation: true, + instrumentPageLoad: true, + markBackgroundSpan: true, + enableLongTask: true, + enableLongAnimationFrame: true, + enableInp: true, + _experiments: {}, + ...defaultRequestInstrumentationOptions +}; +const browserTracingIntegration$1 = /* @__PURE__ */ __name((_options = {}) => { + registerSpanErrorInstrumentation(); + const { + enableInp, + enableLongTask, + enableLongAnimationFrame, + _experiments: { enableInteractions, enableStandaloneClsSpans }, + beforeStartSpan, + idleTimeout, + finalTimeout, + childSpanTimeout, + markBackgroundSpan, + traceFetch, + traceXHR, + trackFetchStreamPerformance, + shouldCreateSpanForRequest, + enableHTTPTimings, + instrumentPageLoad, + instrumentNavigation + } = { + ...DEFAULT_BROWSER_TRACING_OPTIONS, + ..._options + }; + const _collectWebVitals = startTrackingWebVitals({ recordClsStandaloneSpans: enableStandaloneClsSpans || false }); + if (enableInp) { + startTrackingINP(); + } + if (enableLongAnimationFrame && GLOBAL_OBJ.PerformanceObserver && PerformanceObserver.supportedEntryTypes && PerformanceObserver.supportedEntryTypes.includes("long-animation-frame")) { + startTrackingLongAnimationFrames(); + } else if (enableLongTask) { + startTrackingLongTasks(); + } + if (enableInteractions) { + startTrackingInteractions(); + } + const latestRoute = { + name: void 0, + source: void 0 + }; + function _createRouteSpan(client, startSpanOptions) { + const isPageloadTransaction = startSpanOptions.op === "pageload"; + const finalStartSpanOptions = beforeStartSpan ? beforeStartSpan(startSpanOptions) : startSpanOptions; + const attributes = finalStartSpanOptions.attributes || {}; + if (startSpanOptions.name !== finalStartSpanOptions.name) { + attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] = "custom"; + finalStartSpanOptions.attributes = attributes; + } + latestRoute.name = finalStartSpanOptions.name; + latestRoute.source = attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]; + const idleSpan = startIdleSpan(finalStartSpanOptions, { + idleTimeout, + finalTimeout, + childSpanTimeout, + // should wait for finish signal if it's a pageload transaction + disableAutoFinish: isPageloadTransaction, + beforeSpanEnd: /* @__PURE__ */ __name((span) => { + _collectWebVitals(); + addPerformanceEntries(span, { recordClsOnPageloadSpan: !enableStandaloneClsSpans }); + }, "beforeSpanEnd") + }); + function emitFinish() { + if (["interactive", "complete"].includes(WINDOW$5.document.readyState)) { + client.emit("idleSpanEnableAutoFinish", idleSpan); + } + } + __name(emitFinish, "emitFinish"); + if (isPageloadTransaction && WINDOW$5.document) { + WINDOW$5.document.addEventListener("readystatechange", () => { + emitFinish(); + }); + emitFinish(); + } + return idleSpan; + } + __name(_createRouteSpan, "_createRouteSpan"); + return { + name: BROWSER_TRACING_INTEGRATION_ID, + afterAllSetup(client) { + let activeSpan; + let startingUrl = WINDOW$5.location && WINDOW$5.location.href; + function maybeEndActiveSpan() { + if (activeSpan && !spanToJSON(activeSpan).timestamp) { + DEBUG_BUILD$4 && logger$2.log(`[Tracing] Finishing current active span with op: ${spanToJSON(activeSpan).op}`); + activeSpan.end(); + } + } + __name(maybeEndActiveSpan, "maybeEndActiveSpan"); + client.on("startNavigationSpan", (startSpanOptions) => { + if (getClient() !== client) { + return; + } + maybeEndActiveSpan(); + activeSpan = _createRouteSpan(client, { + op: "navigation", + ...startSpanOptions + }); + }); + client.on("startPageLoadSpan", (startSpanOptions, traceOptions = {}) => { + if (getClient() !== client) { + return; + } + maybeEndActiveSpan(); + const sentryTrace = traceOptions.sentryTrace || getMetaContent("sentry-trace"); + const baggage = traceOptions.baggage || getMetaContent("baggage"); + const propagationContext = propagationContextFromHeaders(sentryTrace, baggage); + getCurrentScope$1().setPropagationContext(propagationContext); + activeSpan = _createRouteSpan(client, { + op: "pageload", + ...startSpanOptions + }); + }); + client.on("spanEnd", (span) => { + const op = spanToJSON(span).op; + if (span !== getRootSpan(span) || op !== "navigation" && op !== "pageload") { + return; + } + const scope = getCurrentScope$1(); + const oldPropagationContext = scope.getPropagationContext(); + scope.setPropagationContext({ + ...oldPropagationContext, + sampled: oldPropagationContext.sampled !== void 0 ? oldPropagationContext.sampled : spanIsSampled(span), + dsc: oldPropagationContext.dsc || getDynamicSamplingContextFromSpan(span) + }); + }); + if (WINDOW$5.location) { + if (instrumentPageLoad) { + startBrowserTracingPageLoadSpan(client, { + name: WINDOW$5.location.pathname, + // pageload should always start at timeOrigin (and needs to be in s, not ms) + startTime: browserPerformanceTimeOrigin ? browserPerformanceTimeOrigin / 1e3 : void 0, + attributes: { + [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: "url", + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.pageload.browser" + } + }); + } + if (instrumentNavigation) { + addHistoryInstrumentationHandler(({ to, from: from2 }) => { + if (from2 === void 0 && startingUrl && startingUrl.indexOf(to) !== -1) { + startingUrl = void 0; + return; + } + if (from2 !== to) { + startingUrl = void 0; + startBrowserTracingNavigationSpan(client, { + name: WINDOW$5.location.pathname, + attributes: { + [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: "url", + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.navigation.browser" + } + }); + } + }); + } + } + if (markBackgroundSpan) { + registerBackgroundTabDetection(); + } + if (enableInteractions) { + registerInteractionListener(idleTimeout, finalTimeout, childSpanTimeout, latestRoute); + } + if (enableInp) { + registerInpInteractionListener(); + } + instrumentOutgoingRequests(client, { + traceFetch, + traceXHR, + trackFetchStreamPerformance, + tracePropagationTargets: client.getOptions().tracePropagationTargets, + shouldCreateSpanForRequest, + enableHTTPTimings + }); + } + }; +}, "browserTracingIntegration$1"); +function startBrowserTracingPageLoadSpan(client, spanOptions, traceOptions) { + client.emit("startPageLoadSpan", spanOptions, traceOptions); + getCurrentScope$1().setTransactionName(spanOptions.name); + const span = getActiveSpan(); + const op = span && spanToJSON(span).op; + return op === "pageload" ? span : void 0; +} +__name(startBrowserTracingPageLoadSpan, "startBrowserTracingPageLoadSpan"); +function startBrowserTracingNavigationSpan(client, spanOptions) { + getIsolationScope().setPropagationContext({ traceId: generateTraceId() }); + getCurrentScope$1().setPropagationContext({ traceId: generateTraceId() }); + client.emit("startNavigationSpan", spanOptions); + getCurrentScope$1().setTransactionName(spanOptions.name); + const span = getActiveSpan(); + const op = span && spanToJSON(span).op; + return op === "navigation" ? span : void 0; +} +__name(startBrowserTracingNavigationSpan, "startBrowserTracingNavigationSpan"); +function getMetaContent(metaName) { + const metaTag = getDomElement(`meta[name=${metaName}]`); + return metaTag ? metaTag.getAttribute("content") : void 0; +} +__name(getMetaContent, "getMetaContent"); +function registerInteractionListener(idleTimeout, finalTimeout, childSpanTimeout, latestRoute) { + let inflightInteractionSpan; + const registerInteractionTransaction = /* @__PURE__ */ __name(() => { + const op = "ui.action.click"; + const activeSpan = getActiveSpan(); + const rootSpan = activeSpan && getRootSpan(activeSpan); + if (rootSpan) { + const currentRootSpanOp = spanToJSON(rootSpan).op; + if (["navigation", "pageload"].includes(currentRootSpanOp)) { + DEBUG_BUILD$4 && logger$2.warn(`[Tracing] Did not create ${op} span because a pageload or navigation span is in progress.`); + return void 0; + } + } + if (inflightInteractionSpan) { + inflightInteractionSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON, "interactionInterrupted"); + inflightInteractionSpan.end(); + inflightInteractionSpan = void 0; + } + if (!latestRoute.name) { + DEBUG_BUILD$4 && logger$2.warn(`[Tracing] Did not create ${op} transaction because _latestRouteName is missing.`); + return void 0; + } + inflightInteractionSpan = startIdleSpan( + { + name: latestRoute.name, + op, + attributes: { + [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: latestRoute.source || "url" + } + }, + { + idleTimeout, + finalTimeout, + childSpanTimeout + } + ); + }, "registerInteractionTransaction"); + if (WINDOW$5.document) { + addEventListener("click", registerInteractionTransaction, { once: false, capture: true }); + } +} +__name(registerInteractionListener, "registerInteractionListener"); +function promisifyRequest(request) { + return new Promise((resolve2, reject3) => { + request.oncomplete = request.onsuccess = () => resolve2(request.result); + request.onabort = request.onerror = () => reject3(request.error); + }); +} +__name(promisifyRequest, "promisifyRequest"); +function createStore(dbName, storeName) { + const request = indexedDB.open(dbName); + request.onupgradeneeded = () => request.result.createObjectStore(storeName); + const dbp = promisifyRequest(request); + return (callback) => dbp.then((db) => callback(db.transaction(storeName, "readwrite").objectStore(storeName))); +} +__name(createStore, "createStore"); +function keys$7(store) { + return promisifyRequest(store.getAllKeys()); +} +__name(keys$7, "keys$7"); +function push(store, value4, maxQueueSize) { + return store((store2) => { + return keys$7(store2).then((keys2) => { + if (keys2.length >= maxQueueSize) { + return; + } + store2.put(value4, Math.max(...keys2, 0) + 1); + return promisifyRequest(store2.transaction); + }); + }); +} +__name(push, "push"); +function unshift(store, value4, maxQueueSize) { + return store((store2) => { + return keys$7(store2).then((keys2) => { + if (keys2.length >= maxQueueSize) { + return; + } + store2.put(value4, Math.min(...keys2, 0) - 1); + return promisifyRequest(store2.transaction); + }); + }); +} +__name(unshift, "unshift"); +function shift$1(store) { + return store((store2) => { + return keys$7(store2).then((keys2) => { + const firstKey = keys2[0]; + if (firstKey == null) { + return void 0; + } + return promisifyRequest(store2.get(firstKey)).then((value4) => { + store2.delete(firstKey); + return promisifyRequest(store2.transaction).then(() => value4); + }); + }); + }); +} +__name(shift$1, "shift$1"); +function createIndexedDbStore(options4) { + let store; + function getStore() { + if (store == void 0) { + store = createStore(options4.dbName || "sentry-offline", options4.storeName || "queue"); + } + return store; + } + __name(getStore, "getStore"); + return { + push: /* @__PURE__ */ __name(async (env) => { + try { + const serialized = await serializeEnvelope(env); + await push(getStore(), serialized, options4.maxQueueSize || 30); + } catch (_2) { + } + }, "push"), + unshift: /* @__PURE__ */ __name(async (env) => { + try { + const serialized = await serializeEnvelope(env); + await unshift(getStore(), serialized, options4.maxQueueSize || 30); + } catch (_2) { + } + }, "unshift"), + shift: /* @__PURE__ */ __name(async () => { + try { + const deserialized = await shift$1(getStore()); + if (deserialized) { + return parseEnvelope(deserialized); + } + } catch (_2) { + } + return void 0; + }, "shift") + }; +} +__name(createIndexedDbStore, "createIndexedDbStore"); +function makeIndexedDbOfflineTransport(createTransport2) { + return (options4) => createTransport2({ ...options4, createStore: createIndexedDbStore }); +} +__name(makeIndexedDbOfflineTransport, "makeIndexedDbOfflineTransport"); +function makeBrowserOfflineTransport(createTransport2 = makeFetchTransport) { + return makeIndexedDbOfflineTransport(makeOfflineTransport(createTransport2)); +} +__name(makeBrowserOfflineTransport, "makeBrowserOfflineTransport"); +const MS_TO_NS = 1e6; +const THREAD_ID_STRING = String(0); +const THREAD_NAME = "main"; +let OS_PLATFORM = ""; +let OS_PLATFORM_VERSION = ""; +let OS_ARCH = ""; +let OS_BROWSER = WINDOW$5.navigator && WINDOW$5.navigator.userAgent || ""; +let OS_MODEL = ""; +const OS_LOCALE = WINDOW$5.navigator && WINDOW$5.navigator.language || WINDOW$5.navigator && WINDOW$5.navigator.languages && WINDOW$5.navigator.languages[0] || ""; +function isUserAgentData(data25) { + return typeof data25 === "object" && data25 !== null && "getHighEntropyValues" in data25; +} +__name(isUserAgentData, "isUserAgentData"); +const userAgentData = WINDOW$5.navigator && WINDOW$5.navigator.userAgentData; +if (isUserAgentData(userAgentData)) { + userAgentData.getHighEntropyValues(["architecture", "model", "platform", "platformVersion", "fullVersionList"]).then((ua) => { + OS_PLATFORM = ua.platform || ""; + OS_ARCH = ua.architecture || ""; + OS_MODEL = ua.model || ""; + OS_PLATFORM_VERSION = ua.platformVersion || ""; + if (ua.fullVersionList && ua.fullVersionList.length > 0) { + const firstUa = ua.fullVersionList[ua.fullVersionList.length - 1]; + OS_BROWSER = `${firstUa.brand} ${firstUa.version}`; + } + }).catch((e2) => void 0); +} +function isProcessedJSSelfProfile(profile) { + return !("thread_metadata" in profile); +} +__name(isProcessedJSSelfProfile, "isProcessedJSSelfProfile"); +function enrichWithThreadInformation(profile) { + if (!isProcessedJSSelfProfile(profile)) { + return profile; + } + return convertJSSelfProfileToSampledFormat(profile); +} +__name(enrichWithThreadInformation, "enrichWithThreadInformation"); +function getTraceId(event) { + const traceId = event && event.contexts && event.contexts["trace"] && event.contexts["trace"]["trace_id"]; + if (typeof traceId === "string" && traceId.length !== 32) { + if (DEBUG_BUILD$4) { + logger$2.log(`[Profiling] Invalid traceId: ${traceId} on profiled event`); + } + } + if (typeof traceId !== "string") { + return ""; + } + return traceId; +} +__name(getTraceId, "getTraceId"); +function createProfilePayload(profile_id, start_timestamp, processed_profile, event) { + if (event.type !== "transaction") { + throw new TypeError("Profiling events may only be attached to transactions, this should never occur."); + } + if (processed_profile === void 0 || processed_profile === null) { + throw new TypeError( + `Cannot construct profiling event envelope without a valid profile. Got ${processed_profile} instead.` + ); + } + const traceId = getTraceId(event); + const enrichedThreadProfile = enrichWithThreadInformation(processed_profile); + const transactionStartMs = start_timestamp ? start_timestamp : typeof event.start_timestamp === "number" ? event.start_timestamp * 1e3 : timestampInSeconds() * 1e3; + const transactionEndMs = typeof event.timestamp === "number" ? event.timestamp * 1e3 : timestampInSeconds() * 1e3; + const profile = { + event_id: profile_id, + timestamp: new Date(transactionStartMs).toISOString(), + platform: "javascript", + version: "1", + release: event.release || "", + environment: event.environment || DEFAULT_ENVIRONMENT, + runtime: { + name: "javascript", + version: WINDOW$5.navigator.userAgent + }, + os: { + name: OS_PLATFORM, + version: OS_PLATFORM_VERSION, + build_number: OS_BROWSER + }, + device: { + locale: OS_LOCALE, + model: OS_MODEL, + manufacturer: OS_BROWSER, + architecture: OS_ARCH, + is_emulator: false + }, + debug_meta: { + images: applyDebugMetadata(processed_profile.resources) + }, + profile: enrichedThreadProfile, + transactions: [ + { + name: event.transaction || "", + id: event.event_id || uuid4(), + trace_id: traceId, + active_thread_id: THREAD_ID_STRING, + relative_start_ns: "0", + relative_end_ns: ((transactionEndMs - transactionStartMs) * 1e6).toFixed(0) + } + ] + }; + return profile; +} +__name(createProfilePayload, "createProfilePayload"); +function isAutomatedPageLoadSpan(span) { + return spanToJSON(span).op === "pageload"; +} +__name(isAutomatedPageLoadSpan, "isAutomatedPageLoadSpan"); +function convertJSSelfProfileToSampledFormat(input) { + let EMPTY_STACK_ID = void 0; + let STACK_ID = 0; + const profile = { + samples: [], + stacks: [], + frames: [], + thread_metadata: { + [THREAD_ID_STRING]: { name: THREAD_NAME } + } + }; + const firstSample = input.samples[0]; + if (!firstSample) { + return profile; + } + const start2 = firstSample.timestamp; + const origin2 = typeof performance.timeOrigin === "number" ? performance.timeOrigin : browserPerformanceTimeOrigin || 0; + const adjustForOriginChange = origin2 - (browserPerformanceTimeOrigin || origin2); + input.samples.forEach((jsSample, i2) => { + if (jsSample.stackId === void 0) { + if (EMPTY_STACK_ID === void 0) { + EMPTY_STACK_ID = STACK_ID; + profile.stacks[EMPTY_STACK_ID] = []; + STACK_ID++; + } + profile["samples"][i2] = { + // convert ms timestamp to ns + elapsed_since_start_ns: ((jsSample.timestamp + adjustForOriginChange - start2) * MS_TO_NS).toFixed(0), + stack_id: EMPTY_STACK_ID, + thread_id: THREAD_ID_STRING + }; + return; + } + let stackTop = input.stacks[jsSample.stackId]; + const stack2 = []; + while (stackTop) { + stack2.push(stackTop.frameId); + const frame = input.frames[stackTop.frameId]; + if (frame && profile.frames[stackTop.frameId] === void 0) { + profile.frames[stackTop.frameId] = { + function: frame.name, + abs_path: typeof frame.resourceId === "number" ? input.resources[frame.resourceId] : void 0, + lineno: frame.line, + colno: frame.column + }; + } + stackTop = stackTop.parentId === void 0 ? void 0 : input.stacks[stackTop.parentId]; + } + const sample = { + // convert ms timestamp to ns + elapsed_since_start_ns: ((jsSample.timestamp + adjustForOriginChange - start2) * MS_TO_NS).toFixed(0), + stack_id: STACK_ID, + thread_id: THREAD_ID_STRING + }; + profile["stacks"][STACK_ID] = stack2; + profile["samples"][i2] = sample; + STACK_ID++; + }); + return profile; +} +__name(convertJSSelfProfileToSampledFormat, "convertJSSelfProfileToSampledFormat"); +function addProfilesToEnvelope(envelope, profiles) { + if (!profiles.length) { + return envelope; + } + for (const profile of profiles) { + envelope[1].push([{ type: "profile" }, profile]); + } + return envelope; +} +__name(addProfilesToEnvelope, "addProfilesToEnvelope"); +function findProfiledTransactionsFromEnvelope(envelope) { + const events2 = []; + forEachEnvelopeItem(envelope, (item3, type) => { + if (type !== "transaction") { + return; + } + for (let j2 = 1; j2 < item3.length; j2++) { + const event = item3[j2]; + if (event && event.contexts && event.contexts["profile"] && event.contexts["profile"]["profile_id"]) { + events2.push(item3[j2]); + } + } + }); + return events2; +} +__name(findProfiledTransactionsFromEnvelope, "findProfiledTransactionsFromEnvelope"); +function applyDebugMetadata(resource_paths) { + const client = getClient(); + const options4 = client && client.getOptions(); + const stackParser = options4 && options4.stackParser; + if (!stackParser) { + return []; + } + return getDebugImagesForResources(stackParser, resource_paths); +} +__name(applyDebugMetadata, "applyDebugMetadata"); +function isValidSampleRate(rate) { + if (typeof rate !== "number" && typeof rate !== "boolean" || typeof rate === "number" && isNaN(rate)) { + DEBUG_BUILD$4 && logger$2.warn( + `[Profiling] Invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify( + rate + )} of type ${JSON.stringify(typeof rate)}.` + ); + return false; + } + if (rate === true || rate === false) { + return true; + } + if (rate < 0 || rate > 1) { + DEBUG_BUILD$4 && logger$2.warn(`[Profiling] Invalid sample rate. Sample rate must be between 0 and 1. Got ${rate}.`); + return false; + } + return true; +} +__name(isValidSampleRate, "isValidSampleRate"); +function isValidProfile(profile) { + if (profile.samples.length < 2) { + if (DEBUG_BUILD$4) { + logger$2.log("[Profiling] Discarding profile because it contains less than 2 samples"); + } + return false; + } + if (!profile.frames.length) { + if (DEBUG_BUILD$4) { + logger$2.log("[Profiling] Discarding profile because it contains no frames"); + } + return false; + } + return true; +} +__name(isValidProfile, "isValidProfile"); +let PROFILING_CONSTRUCTOR_FAILED = false; +const MAX_PROFILE_DURATION_MS = 3e4; +function isJSProfilerSupported(maybeProfiler) { + return typeof maybeProfiler === "function"; +} +__name(isJSProfilerSupported, "isJSProfilerSupported"); +function startJSSelfProfile() { + const JSProfilerConstructor = WINDOW$5.Profiler; + if (!isJSProfilerSupported(JSProfilerConstructor)) { + if (DEBUG_BUILD$4) { + logger$2.log( + "[Profiling] Profiling is not supported by this browser, Profiler interface missing on window object." + ); + } + return; + } + const samplingIntervalMS = 10; + const maxSamples = Math.floor(MAX_PROFILE_DURATION_MS / samplingIntervalMS); + try { + return new JSProfilerConstructor({ sampleInterval: samplingIntervalMS, maxBufferSize: maxSamples }); + } catch (e2) { + if (DEBUG_BUILD$4) { + logger$2.log( + "[Profiling] Failed to initialize the Profiling constructor, this is likely due to a missing 'Document-Policy': 'js-profiling' header." + ); + logger$2.log("[Profiling] Disabling profiling for current user session."); + } + PROFILING_CONSTRUCTOR_FAILED = true; + } + return; +} +__name(startJSSelfProfile, "startJSSelfProfile"); +function shouldProfileSpan(span) { + if (PROFILING_CONSTRUCTOR_FAILED) { + if (DEBUG_BUILD$4) { + logger$2.log("[Profiling] Profiling has been disabled for the duration of the current user session."); + } + return false; + } + if (!span.isRecording()) { + if (DEBUG_BUILD$4) { + logger$2.log("[Profiling] Discarding profile because transaction was not sampled."); + } + return false; + } + const client = getClient(); + const options4 = client && client.getOptions(); + if (!options4) { + DEBUG_BUILD$4 && logger$2.log("[Profiling] Profiling disabled, no options found."); + return false; + } + const profilesSampleRate = options4.profilesSampleRate; + if (!isValidSampleRate(profilesSampleRate)) { + DEBUG_BUILD$4 && logger$2.warn("[Profiling] Discarding profile because of invalid sample rate."); + return false; + } + if (!profilesSampleRate) { + DEBUG_BUILD$4 && logger$2.log( + "[Profiling] Discarding profile because a negative sampling decision was inherited or profileSampleRate is set to 0" + ); + return false; + } + const sampled = profilesSampleRate === true ? true : Math.random() < profilesSampleRate; + if (!sampled) { + DEBUG_BUILD$4 && logger$2.log( + `[Profiling] Discarding profile because it's not included in the random sample (sampling rate = ${Number( + profilesSampleRate + )})` + ); + return false; + } + return true; +} +__name(shouldProfileSpan, "shouldProfileSpan"); +function createProfilingEvent(profile_id, start_timestamp, profile, event) { + if (!isValidProfile(profile)) { + return null; + } + return createProfilePayload(profile_id, start_timestamp, profile, event); +} +__name(createProfilingEvent, "createProfilingEvent"); +const PROFILE_MAP = /* @__PURE__ */ new Map(); +function getActiveProfilesCount() { + return PROFILE_MAP.size; +} +__name(getActiveProfilesCount, "getActiveProfilesCount"); +function takeProfileFromGlobalCache(profile_id) { + const profile = PROFILE_MAP.get(profile_id); + if (profile) { + PROFILE_MAP.delete(profile_id); + } + return profile; +} +__name(takeProfileFromGlobalCache, "takeProfileFromGlobalCache"); +function addProfileToGlobalCache(profile_id, profile) { + PROFILE_MAP.set(profile_id, profile); + if (PROFILE_MAP.size > 30) { + const last = PROFILE_MAP.keys().next().value; + PROFILE_MAP.delete(last); + } +} +__name(addProfileToGlobalCache, "addProfileToGlobalCache"); +function startProfileForSpan(span) { + let startTimestamp; + if (isAutomatedPageLoadSpan(span)) { + startTimestamp = timestampInSeconds() * 1e3; + } + const profiler2 = startJSSelfProfile(); + if (!profiler2) { + return; + } + if (DEBUG_BUILD$4) { + logger$2.log(`[Profiling] started profiling span: ${spanToJSON(span).description}`); + } + const profileId = uuid4(); + getCurrentScope$1().setContext("profile", { + profile_id: profileId, + start_timestamp: startTimestamp + }); + async function onProfileHandler() { + if (!span) { + return; + } + if (!profiler2) { + return; + } + return profiler2.stop().then((profile) => { + if (maxDurationTimeoutID) { + WINDOW$5.clearTimeout(maxDurationTimeoutID); + maxDurationTimeoutID = void 0; + } + if (DEBUG_BUILD$4) { + logger$2.log(`[Profiling] stopped profiling of span: ${spanToJSON(span).description}`); + } + if (!profile) { + if (DEBUG_BUILD$4) { + logger$2.log( + `[Profiling] profiler returned null profile for: ${spanToJSON(span).description}`, + "this may indicate an overlapping span or a call to stopProfiling with a profile title that was never started" + ); + } + return; + } + addProfileToGlobalCache(profileId, profile); + }).catch((error2) => { + if (DEBUG_BUILD$4) { + logger$2.log("[Profiling] error while stopping profiler:", error2); + } + }); + } + __name(onProfileHandler, "onProfileHandler"); + let maxDurationTimeoutID = WINDOW$5.setTimeout(() => { + if (DEBUG_BUILD$4) { + logger$2.log("[Profiling] max profile duration elapsed, stopping profiling for:", spanToJSON(span).description); + } + onProfileHandler(); + }, MAX_PROFILE_DURATION_MS); + const originalEnd = span.end.bind(span); + function profilingWrappedSpanEnd() { + if (!span) { + return originalEnd(); + } + void onProfileHandler().then( + () => { + originalEnd(); + }, + () => { + originalEnd(); + } + ); + return span; + } + __name(profilingWrappedSpanEnd, "profilingWrappedSpanEnd"); + span.end = profilingWrappedSpanEnd; +} +__name(startProfileForSpan, "startProfileForSpan"); +const INTEGRATION_NAME$2 = "BrowserProfiling"; +const _browserProfilingIntegration = /* @__PURE__ */ __name(() => { + return { + name: INTEGRATION_NAME$2, + setup(client) { + const activeSpan = getActiveSpan(); + const rootSpan = activeSpan && getRootSpan(activeSpan); + if (rootSpan && isAutomatedPageLoadSpan(rootSpan)) { + if (shouldProfileSpan(rootSpan)) { + startProfileForSpan(rootSpan); + } + } + client.on("spanStart", (span) => { + if (span === getRootSpan(span) && shouldProfileSpan(span)) { + startProfileForSpan(span); + } + }); + client.on("beforeEnvelope", (envelope) => { + if (!getActiveProfilesCount()) { + return; + } + const profiledTransactionEvents = findProfiledTransactionsFromEnvelope(envelope); + if (!profiledTransactionEvents.length) { + return; + } + const profilesToAddToEnvelope = []; + for (const profiledTransaction of profiledTransactionEvents) { + const context = profiledTransaction && profiledTransaction.contexts; + const profile_id = context && context["profile"] && context["profile"]["profile_id"]; + const start_timestamp = context && context["profile"] && context["profile"]["start_timestamp"]; + if (typeof profile_id !== "string") { + DEBUG_BUILD$4 && logger$2.log("[Profiling] cannot find profile for a span without a profile context"); + continue; + } + if (!profile_id) { + DEBUG_BUILD$4 && logger$2.log("[Profiling] cannot find profile for a span without a profile context"); + continue; + } + if (context && context["profile"]) { + delete context.profile; + } + const profile = takeProfileFromGlobalCache(profile_id); + if (!profile) { + DEBUG_BUILD$4 && logger$2.log(`[Profiling] Could not retrieve profile for span: ${profile_id}`); + continue; + } + const profileEvent = createProfilingEvent( + profile_id, + start_timestamp, + profile, + profiledTransaction + ); + if (profileEvent) { + profilesToAddToEnvelope.push(profileEvent); + } + } + addProfilesToEnvelope(envelope, profilesToAddToEnvelope); + }); + } + }; +}, "_browserProfilingIntegration"); +const browserProfilingIntegration = defineIntegration(_browserProfilingIntegration); +const INTEGRATION_NAME$1 = "SpotlightBrowser"; +const _spotlightIntegration = /* @__PURE__ */ __name((options4 = {}) => { + const sidecarUrl = options4.sidecarUrl || "http://localhost:8969/stream"; + return { + name: INTEGRATION_NAME$1, + setup: /* @__PURE__ */ __name(() => { + DEBUG_BUILD$4 && logger$2.log("Using Sidecar URL", sidecarUrl); + }, "setup"), + // We don't want to send interaction transactions/root spans created from + // clicks within Spotlight to Sentry. Neither do we want them to be sent to + // spotlight. + processEvent: /* @__PURE__ */ __name((event) => isSpotlightInteraction(event) ? null : event, "processEvent"), + afterAllSetup: /* @__PURE__ */ __name((client) => { + setupSidecarForwarding(client, sidecarUrl); + }, "afterAllSetup") + }; +}, "_spotlightIntegration"); +function setupSidecarForwarding(client, sidecarUrl) { + const makeFetch = getNativeImplementation("fetch"); + let failCount = 0; + client.on("beforeEnvelope", (envelope) => { + if (failCount > 3) { + logger$2.warn("[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests:", failCount); + return; + } + makeFetch(sidecarUrl, { + method: "POST", + body: serializeEnvelope(envelope), + headers: { + "Content-Type": "application/x-sentry-envelope" + }, + mode: "cors" + }).then( + (res) => { + if (res.status >= 200 && res.status < 400) { + failCount = 0; + } + }, + (err) => { + failCount++; + logger$2.error( + "Sentry SDK can't connect to Sidecar is it running? See: https://spotlightjs.com/sidecar/npx/", + err + ); + } + ); + }); +} +__name(setupSidecarForwarding, "setupSidecarForwarding"); +const spotlightBrowserIntegration = defineIntegration(_spotlightIntegration); +function isSpotlightInteraction(event) { + return Boolean( + event.type === "transaction" && event.spans && event.contexts && event.contexts.trace && event.contexts.trace.op === "ui.action.click" && event.spans.some(({ description }) => description && description.includes("#sentry-spotlight")) + ); +} +__name(isSpotlightInteraction, "isSpotlightInteraction"); +const FLAG_BUFFER_SIZE = 100; +function copyFlagsFromScopeToEvent(event) { + const scope = getCurrentScope$1(); + const flagContext = scope.getScopeData().contexts.flags; + const flagBuffer = flagContext ? flagContext.values : []; + if (!flagBuffer.length) { + return event; + } + if (event.contexts === void 0) { + event.contexts = {}; + } + event.contexts.flags = { values: [...flagBuffer] }; + return event; +} +__name(copyFlagsFromScopeToEvent, "copyFlagsFromScopeToEvent"); +function insertFlagToScope(name2, value4, maxSize = FLAG_BUFFER_SIZE) { + const scopeContexts = getCurrentScope$1().getScopeData().contexts; + if (!scopeContexts.flags) { + scopeContexts.flags = { values: [] }; + } + const flags = scopeContexts.flags.values; + insertToFlagBuffer(flags, name2, value4, maxSize); +} +__name(insertFlagToScope, "insertFlagToScope"); +function insertToFlagBuffer(flags, name2, value4, maxSize) { + if (typeof value4 !== "boolean") { + return; + } + if (flags.length > maxSize) { + DEBUG_BUILD$4 && logger$2.error(`[Feature Flags] insertToFlagBuffer called on a buffer larger than maxSize=${maxSize}`); + return; + } + const index2 = flags.findIndex((f2) => f2.flag === name2); + if (index2 !== -1) { + flags.splice(index2, 1); + } + if (flags.length === maxSize) { + flags.shift(); + } + flags.push({ + flag: name2, + result: value4 + }); +} +__name(insertToFlagBuffer, "insertToFlagBuffer"); +const featureFlagsIntegration = defineIntegration(() => { + return { + name: "FeatureFlags", + processEvent(event, _hint, _client) { + return copyFlagsFromScopeToEvent(event); + }, + addFeatureFlag(name2, value4) { + insertFlagToScope(name2, value4); + } + }; +}); +const launchDarklyIntegration = defineIntegration(() => { + return { + name: "LaunchDarkly", + processEvent(event, _hint, _client) { + return copyFlagsFromScopeToEvent(event); + } + }; +}); +function buildLaunchDarklyFlagUsedHandler() { + return { + name: "sentry-flag-auditor", + type: "flag-used", + synchronous: true, + /** + * Handle a flag evaluation by storing its name and value on the current scope. + */ + method: /* @__PURE__ */ __name((flagKey, flagDetail, _context) => { + insertFlagToScope(flagKey, flagDetail.value); + }, "method") + }; +} +__name(buildLaunchDarklyFlagUsedHandler, "buildLaunchDarklyFlagUsedHandler"); +const openFeatureIntegration = defineIntegration(() => { + return { + name: "OpenFeature", + processEvent(event, _hint, _client) { + return copyFlagsFromScopeToEvent(event); + } + }; +}); +class OpenFeatureIntegrationHook { + static { + __name(this, "OpenFeatureIntegrationHook"); + } + /** + * Successful evaluation result. + */ + after(_hookContext, evaluationDetails) { + insertFlagToScope(evaluationDetails.flagKey, evaluationDetails.value); + } + /** + * On error evaluation result. + */ + error(hookContext, _error, _hookHints) { + insertFlagToScope(hookContext.flagKey, hookContext.defaultValue); + } +} +const DEFAULT_HOOKS = ["activate", "mount", "update"]; +const DEBUG_BUILD = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__; +const classifyRE$1 = /(?:^|[-_])(\w)/g; +const classify$1 = /* @__PURE__ */ __name((str) => str.replace(classifyRE$1, (c2) => c2.toUpperCase()).replace(/[-_]/g, ""), "classify$1"); +const ROOT_COMPONENT_NAME = "<Root>"; +const ANONYMOUS_COMPONENT_NAME = "<Anonymous>"; +const repeat = /* @__PURE__ */ __name((str, n2) => { + return str.repeat(n2); +}, "repeat"); +const formatComponentName$1 = /* @__PURE__ */ __name((vm, includeFile) => { + if (!vm) { + return ANONYMOUS_COMPONENT_NAME; + } + if (vm.$root === vm) { + return ROOT_COMPONENT_NAME; + } + if (!vm.$options) { + return ANONYMOUS_COMPONENT_NAME; + } + const options4 = vm.$options; + let name2 = options4.name || options4._componentTag || options4.__name; + const file = options4.__file; + if (!name2 && file) { + const match2 = file.match(/([^/\\]+)\.vue$/); + if (match2) { + name2 = match2[1]; + } + } + return (name2 ? `<${classify$1(name2)}>` : ANONYMOUS_COMPONENT_NAME) + (file && includeFile !== false ? ` at ${file}` : ""); +}, "formatComponentName$1"); +const generateComponentTrace = /* @__PURE__ */ __name((vm) => { + if (vm && (vm._isVue || vm.__isVue) && vm.$parent) { + const tree = []; + let currentRecursiveSequence = 0; + while (vm) { + if (tree.length > 0) { + const last = tree[tree.length - 1]; + if (last.constructor === vm.constructor) { + currentRecursiveSequence++; + vm = vm.$parent; + continue; + } else if (currentRecursiveSequence > 0) { + tree[tree.length - 1] = [last, currentRecursiveSequence]; + currentRecursiveSequence = 0; + } + } + tree.push(vm); + vm = vm.$parent; + } + const formattedTree = tree.map( + (vm2, i2) => `${(i2 === 0 ? "---> " : repeat(" ", 5 + i2 * 2)) + (Array.isArray(vm2) ? `${formatComponentName$1(vm2[0])}... (${vm2[1]} recursive calls)` : formatComponentName$1(vm2))}` + ).join("\n"); + return ` + +found in + +${formattedTree}`; + } + return ` + +(found in ${formatComponentName$1(vm)})`; +}, "generateComponentTrace"); +const attachErrorHandler = /* @__PURE__ */ __name((app2, options4) => { + const { errorHandler: originalErrorHandler, warnHandler, silent } = app2.config; + app2.config.errorHandler = (error2, vm, lifecycleHook) => { + const componentName = formatComponentName$1(vm, false); + const trace = vm ? generateComponentTrace(vm) : ""; + const metadata = { + componentName, + lifecycleHook, + trace + }; + if (options4.attachProps && vm) { + if (vm.$options && vm.$options.propsData) { + metadata.propsData = vm.$options.propsData; + } else if (vm.$props) { + metadata.propsData = vm.$props; + } + } + setTimeout(() => { + captureException(error2, { + captureContext: { contexts: { vue: metadata } }, + mechanism: { handled: false } + }); + }); + if (typeof originalErrorHandler === "function" && app2.config.errorHandler) { + originalErrorHandler.call(app2, error2, vm, lifecycleHook); + } + if (options4.logErrors) { + const hasConsole = typeof console !== "undefined"; + const message3 = `Error in ${lifecycleHook}: "${error2 && error2.toString()}"`; + if (warnHandler) { + warnHandler.call(null, message3, vm, trace); + } else if (hasConsole && !silent) { + consoleSandbox(() => { + console.error(`[Vue warn]: ${message3}${trace}`); + }); + } + } + }; +}, "attachErrorHandler"); +const VUE_OP = "ui.vue"; +const HOOKS = { + activate: ["activated", "deactivated"], + create: ["beforeCreate", "created"], + // Vue 3 + unmount: ["beforeUnmount", "unmounted"], + // Vue 2 + destroy: ["beforeDestroy", "destroyed"], + mount: ["beforeMount", "mounted"], + update: ["beforeUpdate", "updated"] +}; +function finishRootSpan(vm, timestamp2, timeout) { + if (vm.$_sentryRootSpanTimer) { + clearTimeout(vm.$_sentryRootSpanTimer); + } + vm.$_sentryRootSpanTimer = setTimeout(() => { + if (vm.$root && vm.$root.$_sentryRootSpan) { + vm.$root.$_sentryRootSpan.end(timestamp2); + vm.$root.$_sentryRootSpan = void 0; + } + }, timeout); +} +__name(finishRootSpan, "finishRootSpan"); +function findTrackComponent(trackComponents, formattedName) { + function extractComponentName(name2) { + return name2.replace(/^<([^\s]*)>(?: at [^\s]*)?$/, "$1"); + } + __name(extractComponentName, "extractComponentName"); + const isMatched = trackComponents.some((compo) => { + return extractComponentName(formattedName) === extractComponentName(compo); + }); + return isMatched; +} +__name(findTrackComponent, "findTrackComponent"); +const createTracingMixins = /* @__PURE__ */ __name((options4) => { + const hooks2 = (options4.hooks || []).concat(DEFAULT_HOOKS).filter((value4, index2, self2) => self2.indexOf(value4) === index2); + const mixins = {}; + for (const operation of hooks2) { + const internalHooks = HOOKS[operation]; + if (!internalHooks) { + DEBUG_BUILD && logger$2.warn(`Unknown hook: ${operation}`); + continue; + } + for (const internalHook of internalHooks) { + mixins[internalHook] = function() { + const isRoot = this.$root === this; + if (isRoot) { + this.$_sentryRootSpan = this.$_sentryRootSpan || startInactiveSpan({ + name: "Application Render", + op: `${VUE_OP}.render`, + attributes: { + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.ui.vue" + }, + onlyIfParent: true + }); + } + const name2 = formatComponentName$1(this, false); + const shouldTrack2 = Array.isArray(options4.trackComponents) ? findTrackComponent(options4.trackComponents, name2) : options4.trackComponents; + if (!isRoot && !shouldTrack2) { + return; + } + this.$_sentrySpans = this.$_sentrySpans || {}; + if (internalHook == internalHooks[0]) { + const activeSpan = this.$root && this.$root.$_sentryRootSpan || getActiveSpan(); + if (activeSpan) { + const oldSpan = this.$_sentrySpans[operation]; + if (oldSpan) { + oldSpan.end(); + } + this.$_sentrySpans[operation] = startInactiveSpan({ + name: `Vue ${name2}`, + op: `${VUE_OP}.${operation}`, + attributes: { + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.ui.vue" + }, + // UI spans should only be created if there is an active root span (transaction) + onlyIfParent: true + }); + } + } else { + const span = this.$_sentrySpans[operation]; + if (!span) return; + span.end(); + finishRootSpan(this, timestampInSeconds(), options4.timeout); + } + }; + } + } + return mixins; +}, "createTracingMixins"); +const globalWithVue = GLOBAL_OBJ; +const DEFAULT_CONFIG = { + Vue: globalWithVue.Vue, + attachProps: true, + logErrors: true, + attachErrorHandler: true, + hooks: DEFAULT_HOOKS, + timeout: 2e3, + trackComponents: false +}; +const INTEGRATION_NAME = "Vue"; +const vueIntegration = defineIntegration((integrationOptions = {}) => { + return { + name: INTEGRATION_NAME, + setup(client) { + const options4 = { ...DEFAULT_CONFIG, ...client.getOptions(), ...integrationOptions }; + if (!options4.Vue && !options4.app) { + consoleSandbox(() => { + console.warn( + "[@sentry/vue]: Misconfigured SDK. Vue specific errors will not be captured. Update your `Sentry.init` call with an appropriate config option: `app` (Application Instance - Vue 3) or `Vue` (Vue Constructor - Vue 2)." + ); + }); + return; + } + if (options4.app) { + const apps = Array.isArray(options4.app) ? options4.app : [options4.app]; + apps.forEach((app2) => vueInit(app2, options4)); + } else if (options4.Vue) { + vueInit(options4.Vue, options4); + } + } + }; +}); +const vueInit = /* @__PURE__ */ __name((app2, options4) => { + if (DEBUG_BUILD) { + const appWithInstance = app2; + const isMounted = appWithInstance._instance && appWithInstance._instance.isMounted; + if (isMounted === true) { + consoleSandbox(() => { + console.warn( + "[@sentry/vue]: Misconfigured SDK. Vue app is already mounted. Make sure to call `app.mount()` after `Sentry.init()`." + ); + }); + } + } + if (options4.attachErrorHandler) { + attachErrorHandler(app2, options4); + } + if (hasTracingEnabled(options4)) { + app2.mixin( + createTracingMixins({ + ...options4, + // eslint-disable-next-line deprecation/deprecation + ...options4.tracingOptions + }) + ); + } +}, "vueInit"); +function init$3(config2 = {}) { + const options4 = { + _metadata: { + sdk: { + name: "sentry.javascript.vue", + packages: [ + { + name: "npm:@sentry/vue", + version: SDK_VERSION + } + ], + version: SDK_VERSION + } + }, + defaultIntegrations: [...getDefaultIntegrations(config2), vueIntegration()], + ...config2 + }; + return init$4(options4); +} +__name(init$3, "init$3"); +function instrumentVueRouter(router2, options4, startNavigationSpanFn) { + let isFirstPageLoad = true; + router2.onError((error2) => captureException(error2, { mechanism: { handled: false } })); + router2.beforeEach((to, from2, next2) => { + const isPageLoadNavigation = from2.name == null && from2.matched.length === 0 || from2.name === void 0 && isFirstPageLoad; + if (isFirstPageLoad) { + isFirstPageLoad = false; + } + const attributes = { + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.navigation.vue" + }; + for (const key of Object.keys(to.params)) { + attributes[`params.${key}`] = to.params[key]; + } + for (const key of Object.keys(to.query)) { + const value4 = to.query[key]; + if (value4) { + attributes[`query.${key}`] = value4; + } + } + let spanName = to.path; + let transactionSource = "url"; + if (to.name && options4.routeLabel !== "path") { + spanName = to.name.toString(); + transactionSource = "custom"; + } else if (to.matched.length > 0) { + const lastIndex2 = to.matched.length - 1; + spanName = to.matched[lastIndex2].path; + transactionSource = "route"; + } + getCurrentScope$1().setTransactionName(spanName); + if (options4.instrumentPageLoad && isPageLoadNavigation) { + const activeRootSpan = getActiveRootSpan(); + if (activeRootSpan) { + const existingAttributes = spanToJSON(activeRootSpan).data || {}; + if (existingAttributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] !== "custom") { + activeRootSpan.updateName(spanName); + activeRootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, transactionSource); + } + activeRootSpan.setAttributes({ + ...attributes, + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.pageload.vue" + }); + } + } + if (options4.instrumentNavigation && !isPageLoadNavigation) { + attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] = transactionSource; + attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = "auto.navigation.vue"; + startNavigationSpanFn({ + name: spanName, + op: "navigation", + attributes + }); + } + if (next2) { + next2(); + } + }); +} +__name(instrumentVueRouter, "instrumentVueRouter"); +function getActiveRootSpan() { + const span = getActiveSpan(); + const rootSpan = span && getRootSpan(span); + if (!rootSpan) { + return void 0; + } + const op = spanToJSON(rootSpan).op; + return op === "navigation" || op === "pageload" ? rootSpan : void 0; +} +__name(getActiveRootSpan, "getActiveRootSpan"); +function browserTracingIntegration(options4 = {}) { + if (!options4.router) { + return browserTracingIntegration$1(options4); + } + const integration = browserTracingIntegration$1({ + ...options4, + instrumentNavigation: false + }); + const { router: router2, instrumentNavigation = true, instrumentPageLoad = true, routeLabel = "name" } = options4; + return { + ...integration, + afterAllSetup(client) { + integration.afterAllSetup(client); + const startNavigationSpan = /* @__PURE__ */ __name((options5) => { + startBrowserTracingNavigationSpan(client, options5); + }, "startNavigationSpan"); + instrumentVueRouter(router2, { routeLabel, instrumentNavigation, instrumentPageLoad }, startNavigationSpan); + } + }; +} +__name(browserTracingIntegration, "browserTracingIntegration"); +const createSentryPiniaPlugin = /* @__PURE__ */ __name((options4 = { + attachPiniaState: true, + addBreadcrumbs: true, + actionTransformer: /* @__PURE__ */ __name((action) => action, "actionTransformer"), + stateTransformer: /* @__PURE__ */ __name((state) => state, "stateTransformer") +}) => { + const plugin = /* @__PURE__ */ __name(({ store }) => { + options4.attachPiniaState !== false && getGlobalScope().addEventProcessor((event, hint) => { + try { + const timestamp2 = (/* @__PURE__ */ new Date()).toTimeString().split(" ")[0]; + const filename = `pinia_state_${store.$id}_${timestamp2}.json`; + hint.attachments = [ + ...hint.attachments || [], + { + filename, + data: JSON.stringify(store.$state) + } + ]; + } catch (_2) { + } + return event; + }); + store.$onAction((context) => { + context.after(() => { + const transformedActionName = options4.actionTransformer ? options4.actionTransformer(context.name) : context.name; + if (typeof transformedActionName !== "undefined" && transformedActionName !== null && options4.addBreadcrumbs !== false) { + addBreadcrumb({ + category: "action", + message: transformedActionName, + level: "info" + }); + } + const transformedState = options4.stateTransformer ? options4.stateTransformer(store.$state) : store.$state; + const scope = getCurrentScope$1(); + const currentState = scope.getScopeData().contexts.state; + if (typeof transformedState !== "undefined" && transformedState !== null) { + const client = getClient(); + const options5 = client && client.getOptions(); + const normalizationDepth = options5 && options5.normalizeDepth || 3; + const piniaStateContext = { type: "pinia", value: transformedState }; + const newState = { + ...currentState || {}, + state: piniaStateContext + }; + addNonEnumerableProperty( + newState, + "__sentry_override_normalization_depth__", + 3 + // 3 layers for `state.value.transformedState + normalizationDepth + // rest for the actual state + ); + scope.setContext("state", newState); + } else { + scope.setContext("state", { + ...currentState || {}, + state: { type: "pinia", value: "undefined" } + }); + } + }); + }); + }, "plugin"); + return plugin; +}, "createSentryPiniaPlugin"); /** * @vue/shared v3.4.31 * (c) 2018-present Yuxi (Evan) You and Vue contributors @@ -6000,22 +31385,22 @@ const remove$1 = /* @__PURE__ */ __name((arr, el) => { arr.splice(i2, 1); } }, "remove$1"); -const hasOwnProperty$3 = Object.prototype.hasOwnProperty; -const hasOwn$3 = /* @__PURE__ */ __name((val, key) => hasOwnProperty$3.call(val, key), "hasOwn$3"); -const isArray$4 = Array.isArray; -const isMap = /* @__PURE__ */ __name((val) => toTypeString$1(val) === "[object Map]", "isMap"); -const isSet = /* @__PURE__ */ __name((val) => toTypeString$1(val) === "[object Set]", "isSet"); +const hasOwnProperty$d = Object.prototype.hasOwnProperty; +const hasOwn$3 = /* @__PURE__ */ __name((val, key) => hasOwnProperty$d.call(val, key), "hasOwn$3"); +const isArray$9 = Array.isArray; +const isMap$3 = /* @__PURE__ */ __name((val) => toTypeString$1(val) === "[object Map]", "isMap$3"); +const isSet$3 = /* @__PURE__ */ __name((val) => toTypeString$1(val) === "[object Set]", "isSet$3"); const isDate$2 = /* @__PURE__ */ __name((val) => toTypeString$1(val) === "[object Date]", "isDate$2"); const isRegExp$4 = /* @__PURE__ */ __name((val) => toTypeString$1(val) === "[object RegExp]", "isRegExp$4"); -const isFunction$4 = /* @__PURE__ */ __name((val) => typeof val === "function", "isFunction$4"); +const isFunction$8 = /* @__PURE__ */ __name((val) => typeof val === "function", "isFunction$8"); const isString$7 = /* @__PURE__ */ __name((val) => typeof val === "string", "isString$7"); const isSymbol$1 = /* @__PURE__ */ __name((val) => typeof val === "symbol", "isSymbol$1"); -const isObject$6 = /* @__PURE__ */ __name((val) => val !== null && typeof val === "object", "isObject$6"); +const isObject$d = /* @__PURE__ */ __name((val) => val !== null && typeof val === "object", "isObject$d"); const isPromise$1 = /* @__PURE__ */ __name((val) => { - return (isObject$6(val) || isFunction$4(val)) && isFunction$4(val.then) && isFunction$4(val.catch); + return (isObject$d(val) || isFunction$8(val)) && isFunction$8(val.then) && isFunction$8(val.catch); }, "isPromise$1"); -const objectToString$1 = Object.prototype.toString; -const toTypeString$1 = /* @__PURE__ */ __name((value4) => objectToString$1.call(value4), "toTypeString$1"); +const objectToString$3 = Object.prototype.toString; +const toTypeString$1 = /* @__PURE__ */ __name((value4) => objectToString$3.call(value4), "toTypeString$1"); const toRawType = /* @__PURE__ */ __name((value4) => { return toTypeString$1(value4).slice(8, -1); }, "toRawType"); @@ -6037,7 +31422,7 @@ const cacheStringFunction$1 = /* @__PURE__ */ __name((fn) => { }, "cacheStringFunction$1"); const camelizeRE$1 = /-(\w)/g; const camelize$1 = cacheStringFunction$1((str) => { - return str.replace(camelizeRE$1, (_2, c) => c ? c.toUpperCase() : ""); + return str.replace(camelizeRE$1, (_2, c2) => c2 ? c2.toUpperCase() : ""); }); const hyphenateRE$1 = /\B([A-Z])/g; const hyphenate$1 = cacheStringFunction$1( @@ -6047,8 +31432,8 @@ const capitalize$1 = cacheStringFunction$1((str) => { return str.charAt(0).toUpperCase() + str.slice(1); }); const toHandlerKey = cacheStringFunction$1((str) => { - const s = str ? `on${capitalize$1(str)}` : ``; - return s; + const s2 = str ? `on${capitalize$1(str)}` : ``; + return s2; }); const hasChanged = /* @__PURE__ */ __name((value4, oldValue2) => !Object.is(value4, oldValue2), "hasChanged"); const invokeArrayFns = /* @__PURE__ */ __name((fns, ...arg) => { @@ -6065,12 +31450,12 @@ const def = /* @__PURE__ */ __name((obj, key, value4, writable = false) => { }); }, "def"); const looseToNumber = /* @__PURE__ */ __name((val) => { - const n = parseFloat(val); - return isNaN(n) ? val : n; + const n2 = parseFloat(val); + return isNaN(n2) ? val : n2; }, "looseToNumber"); const toNumber = /* @__PURE__ */ __name((val) => { - const n = isString$7(val) ? Number(val) : NaN; - return isNaN(n) ? val : n; + const n2 = isString$7(val) ? Number(val) : NaN; + return isNaN(n2) ? val : n2; }, "toNumber"); let _globalThis$1; const getGlobalThis$1 = /* @__PURE__ */ __name(() => { @@ -6180,22 +31565,22 @@ function generateCodeFrame$1(source, start2 = 0, end = source.length) { for (let i2 = 0; i2 < lines.length; i2++) { count += lines[i2].length + (newlineSequences[i2] && newlineSequences[i2].length || 0); if (count >= start2) { - for (let j = i2 - range; j <= i2 + range || end > count; j++) { - if (j < 0 || j >= lines.length) continue; - const line = j + 1; + for (let j2 = i2 - range; j2 <= i2 + range || end > count; j2++) { + if (j2 < 0 || j2 >= lines.length) continue; + const line = j2 + 1; res.push( - `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}` + `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j2]}` ); - const lineLength = lines[j].length; - const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0; - if (j === i2) { + const lineLength = lines[j2].length; + const newLineSeqLength = newlineSequences[j2] && newlineSequences[j2].length || 0; + if (j2 === i2) { const pad = start2 - (count - (lineLength + newLineSeqLength)); const length = Math.max( 1, end > count ? lineLength - pad : end - start2 ); res.push(` | ` + " ".repeat(pad) + "^".repeat(length)); - } else if (j > i2) { + } else if (j2 > i2) { if (end > count) { const length = Math.max(Math.min(end - count, lineLength), 1); res.push(` | ` + "^".repeat(length)); @@ -6210,7 +31595,7 @@ function generateCodeFrame$1(source, start2 = 0, end = source.length) { } __name(generateCodeFrame$1, "generateCodeFrame$1"); function normalizeStyle(value4) { - if (isArray$4(value4)) { + if (isArray$9(value4)) { const res = {}; for (let i2 = 0; i2 < value4.length; i2++) { const item3 = value4[i2]; @@ -6222,7 +31607,7 @@ function normalizeStyle(value4) { } } return res; - } else if (isString$7(value4) || isObject$6(value4)) { + } else if (isString$7(value4) || isObject$d(value4)) { return value4; } } @@ -6260,14 +31645,14 @@ function normalizeClass(value4) { let res = ""; if (isString$7(value4)) { res = value4; - } else if (isArray$4(value4)) { + } else if (isArray$9(value4)) { for (let i2 = 0; i2 < value4.length; i2++) { const normalized = normalizeClass(value4[i2]); if (normalized) { res += normalized + " "; } } - } else if (isObject$6(value4)) { + } else if (isObject$d(value4)) { for (const name2 in value4) { if (value4[name2]) { res += name2 + " "; @@ -6384,52 +31769,52 @@ function escapeHtmlComment(src) { return src.replace(commentStripRE, ""); } __name(escapeHtmlComment, "escapeHtmlComment"); -function looseCompareArrays(a, b) { - if (a.length !== b.length) return false; +function looseCompareArrays(a2, b2) { + if (a2.length !== b2.length) return false; let equal = true; - for (let i2 = 0; equal && i2 < a.length; i2++) { - equal = looseEqual(a[i2], b[i2]); + for (let i2 = 0; equal && i2 < a2.length; i2++) { + equal = looseEqual(a2[i2], b2[i2]); } return equal; } __name(looseCompareArrays, "looseCompareArrays"); -function looseEqual(a, b) { - if (a === b) return true; - let aValidType = isDate$2(a); - let bValidType = isDate$2(b); +function looseEqual(a2, b2) { + if (a2 === b2) return true; + let aValidType = isDate$2(a2); + let bValidType = isDate$2(b2); if (aValidType || bValidType) { - return aValidType && bValidType ? a.getTime() === b.getTime() : false; + return aValidType && bValidType ? a2.getTime() === b2.getTime() : false; } - aValidType = isSymbol$1(a); - bValidType = isSymbol$1(b); + aValidType = isSymbol$1(a2); + bValidType = isSymbol$1(b2); if (aValidType || bValidType) { - return a === b; + return a2 === b2; } - aValidType = isArray$4(a); - bValidType = isArray$4(b); + aValidType = isArray$9(a2); + bValidType = isArray$9(b2); if (aValidType || bValidType) { - return aValidType && bValidType ? looseCompareArrays(a, b) : false; + return aValidType && bValidType ? looseCompareArrays(a2, b2) : false; } - aValidType = isObject$6(a); - bValidType = isObject$6(b); + aValidType = isObject$d(a2); + bValidType = isObject$d(b2); if (aValidType || bValidType) { if (!aValidType || !bValidType) { return false; } - const aKeysCount = Object.keys(a).length; - const bKeysCount = Object.keys(b).length; + const aKeysCount = Object.keys(a2).length; + const bKeysCount = Object.keys(b2).length; if (aKeysCount !== bKeysCount) { return false; } - for (const key in a) { - const aHasKey = a.hasOwnProperty(key); - const bHasKey = b.hasOwnProperty(key); - if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) { + for (const key in a2) { + const aHasKey = a2.hasOwnProperty(key); + const bHasKey = b2.hasOwnProperty(key); + if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a2[key], b2[key])) { return false; } } } - return String(a) === String(b); + return String(a2) === String(b2); } __name(looseEqual, "looseEqual"); function looseIndexOf(arr, val) { @@ -6440,12 +31825,12 @@ const isRef$1 = /* @__PURE__ */ __name((val) => { return !!(val && val.__v_isRef === true); }, "isRef$1"); const toDisplayString$1 = /* @__PURE__ */ __name((val) => { - return isString$7(val) ? val : val == null ? "" : isArray$4(val) || isObject$6(val) && (val.toString === objectToString$1 || !isFunction$4(val.toString)) ? isRef$1(val) ? toDisplayString$1(val.value) : JSON.stringify(val, replacer, 2) : String(val); + return isString$7(val) ? val : val == null ? "" : isArray$9(val) || isObject$d(val) && (val.toString === objectToString$3 || !isFunction$8(val.toString)) ? isRef$1(val) ? toDisplayString$1(val.value) : JSON.stringify(val, replacer, 2) : String(val); }, "toDisplayString$1"); const replacer = /* @__PURE__ */ __name((_key, val) => { if (isRef$1(val)) { return replacer(_key, val.value); - } else if (isMap(val)) { + } else if (isMap$3(val)) { return { [`Map(${val.size})`]: [...val.entries()].reduce( (entries, [key, val2], i2) => { @@ -6455,13 +31840,13 @@ const replacer = /* @__PURE__ */ __name((_key, val) => { {} ) }; - } else if (isSet(val)) { + } else if (isSet$3(val)) { return { [`Set(${val.size})`]: [...val.values()].map((v2) => stringifySymbol(v2)) }; } else if (isSymbol$1(val)) { return stringifySymbol(val); - } else if (isObject$6(val) && !isArray$4(val) && !isPlainObject$4(val)) { + } else if (isObject$d(val) && !isArray$9(val) && !isPlainObject$4(val)) { return String(val); } return val; @@ -6532,15 +31917,15 @@ class EffectScope { } stop(fromParent) { if (this._active) { - let i2, l; - for (i2 = 0, l = this.effects.length; i2 < l; i2++) { + let i2, l2; + for (i2 = 0, l2 = this.effects.length; i2 < l2; i2++) { this.effects[i2].stop(); } - for (i2 = 0, l = this.cleanups.length; i2 < l; i2++) { + for (i2 = 0, l2 = this.cleanups.length; i2 < l2; i2++) { this.cleanups[i2](); } if (this.scopes) { - for (i2 = 0, l = this.scopes.length; i2 < l; i2++) { + for (i2 = 0, l2 = this.scopes.length; i2 < l2; i2++) { this.scopes[i2].stop(true); } } @@ -6816,7 +32201,7 @@ function trigger(target, type, key, newValue2, oldValue2, oldTarget) { let deps = []; if (type === "clear") { deps = [...depsMap.values()]; - } else if (key === "length" && isArray$4(target)) { + } else if (key === "length" && isArray$9(target)) { const newLength = Number(newValue2); depsMap.forEach((dep, key2) => { if (key2 === "length" || !isSymbol$1(key2) && key2 >= newLength) { @@ -6829,9 +32214,9 @@ function trigger(target, type, key, newValue2, oldValue2, oldTarget) { } switch (type) { case "add": - if (!isArray$4(target)) { + if (!isArray$9(target)) { deps.push(depsMap.get(ITERATE_KEY)); - if (isMap(target)) { + if (isMap$3(target)) { deps.push(depsMap.get(MAP_KEY_ITERATE_KEY)); } } else if (isIntegerKey(key)) { @@ -6839,15 +32224,15 @@ function trigger(target, type, key, newValue2, oldValue2, oldTarget) { } break; case "delete": - if (!isArray$4(target)) { + if (!isArray$9(target)) { deps.push(depsMap.get(ITERATE_KEY)); - if (isMap(target)) { + if (isMap$3(target)) { deps.push(depsMap.get(MAP_KEY_ITERATE_KEY)); } } break; case "set": - if (isMap(target)) { + if (isMap$3(target)) { deps.push(depsMap.get(ITERATE_KEY)); } break; @@ -6888,7 +32273,7 @@ function createArrayInstrumentations() { ["includes", "indexOf", "lastIndexOf"].forEach((key) => { instrumentations[key] = function(...args) { const arr = toRaw(this); - for (let i2 = 0, l = this.length; i2 < l; i2++) { + for (let i2 = 0, l2 = this.length; i2 < l2; i2++) { track(arr, "get", i2 + ""); } const res = arr[key](...args); @@ -6912,13 +32297,13 @@ function createArrayInstrumentations() { return instrumentations; } __name(createArrayInstrumentations, "createArrayInstrumentations"); -function hasOwnProperty$2(key) { +function hasOwnProperty$c(key) { if (!isSymbol$1(key)) key = String(key); const obj = toRaw(this); track(obj, "has", key); return obj.hasOwnProperty(key); } -__name(hasOwnProperty$2, "hasOwnProperty$2"); +__name(hasOwnProperty$c, "hasOwnProperty$c"); class BaseReactiveHandler { static { __name(this, "BaseReactiveHandler"); @@ -6943,13 +32328,13 @@ class BaseReactiveHandler { } return; } - const targetIsArray = isArray$4(target); + const targetIsArray = isArray$9(target); if (!isReadonly2) { if (targetIsArray && hasOwn$3(arrayInstrumentations, key)) { return Reflect.get(arrayInstrumentations, key, receiver); } if (key === "hasOwnProperty") { - return hasOwnProperty$2; + return hasOwnProperty$c; } } const res = Reflect.get(target, key, receiver); @@ -6965,7 +32350,7 @@ class BaseReactiveHandler { if (isRef(res)) { return targetIsArray && isIntegerKey(key) ? res : res.value; } - if (isObject$6(res)) { + if (isObject$d(res)) { return isReadonly2 ? readonly(res) : reactive(res); } return res; @@ -6986,7 +32371,7 @@ class MutableReactiveHandler extends BaseReactiveHandler { oldValue2 = toRaw(oldValue2); value4 = toRaw(value4); } - if (!isArray$4(target) && isRef(oldValue2) && !isRef(value4)) { + if (!isArray$9(target) && isRef(oldValue2) && !isRef(value4)) { if (isOldValueReadonly) { return false; } else { @@ -6995,7 +32380,7 @@ class MutableReactiveHandler extends BaseReactiveHandler { } } } - const hadKey = isArray$4(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn$3(target, key); + const hadKey = isArray$9(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn$3(target, key); const result = Reflect.set(target, key, value4, receiver); if (target === toRaw(receiver)) { if (!hadKey) { @@ -7026,7 +32411,7 @@ class MutableReactiveHandler extends BaseReactiveHandler { track( target, "iterate", - isArray$4(target) ? "length" : ITERATE_KEY + isArray$9(target) ? "length" : ITERATE_KEY ); return Reflect.ownKeys(target); } @@ -7159,7 +32544,7 @@ __name(deleteEntry, "deleteEntry"); function clear() { const target = toRaw(this); const hadItems = target.size !== 0; - const oldTarget = false ? isMap(target) ? new Map(target) : new Set(target) : void 0; + const oldTarget = false ? isMap$3(target) ? new Map(target) : new Set(target) : void 0; const result = target.clear(); if (hadItems) { trigger(target, "clear", void 0, void 0, oldTarget); @@ -7184,7 +32569,7 @@ function createIterableMethod(method, isReadonly2, isShallow2) { return function(...args) { const target = this["__v_raw"]; const rawTarget = toRaw(target); - const targetIsMap = isMap(rawTarget); + const targetIsMap = isMap$3(rawTarget); const isPair = method === "entries" || method === Symbol.iterator && targetIsMap; const isKeyOnly = method === "keys" && targetIsMap; const innerIterator = target[method](...args); @@ -7422,7 +32807,7 @@ function shallowReadonly(target) { } __name(shallowReadonly, "shallowReadonly"); function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) { - if (!isObject$6(target)) { + if (!isObject$d(target)) { if (false) { warn$4( `value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String( @@ -7482,8 +32867,8 @@ function markRaw(value4) { return value4; } __name(markRaw, "markRaw"); -const toReactive$1 = /* @__PURE__ */ __name((value4) => isObject$6(value4) ? reactive(value4) : value4, "toReactive$1"); -const toReadonly = /* @__PURE__ */ __name((value4) => isObject$6(value4) ? readonly(value4) : value4, "toReadonly"); +const toReactive$1 = /* @__PURE__ */ __name((value4) => isObject$d(value4) ? reactive(value4) : value4, "toReactive$1"); +const toReadonly = /* @__PURE__ */ __name((value4) => isObject$d(value4) ? readonly(value4) : value4, "toReadonly"); const COMPUTED_SIDE_EFFECT_WARN = `Computed is still dirty after getter evaluation, likely because a computed is mutating its own dependency in its getter. State mutations in computed getters should be avoided. Check the docs for more details: https://vuejs.org/guide/essentials/computed.html#getters-should-be-side-effect-free`; class ComputedRefImpl { static { @@ -7537,7 +32922,7 @@ getter: `, this.getter); function computed$1(getterOrOptions, debugOptions, isSSR = false) { let getter; let setter; - const onlyGetter = isFunction$4(getterOrOptions); + const onlyGetter = isFunction$8(getterOrOptions); if (onlyGetter) { getter = getterOrOptions; setter = false ? () => { @@ -7592,8 +32977,8 @@ function triggerRefValue(ref2, dirtyLevel = 4, newVal, oldVal) { } } __name(triggerRefValue, "triggerRefValue"); -function isRef(r) { - return !!(r && r.__v_isRef === true); +function isRef(r2) { + return !!(r2 && r2.__v_isRef === true); } __name(isRef, "isRef"); function ref(value4) { @@ -7646,7 +33031,7 @@ function unref(ref2) { } __name(unref, "unref"); function toValue$1(source) { - return isFunction$4(source) ? source() : unref(source); + return isFunction$8(source) ? source() : unref(source); } __name(toValue$1, "toValue$1"); const shallowUnwrapHandlers = { @@ -7694,7 +33079,7 @@ function toRefs$1(object) { if (false) { warn$4(`toRefs() expects a reactive object but received a plain one.`); } - const ret = isArray$4(object) ? new Array(object.length) : {}; + const ret = isArray$9(object) ? new Array(object.length) : {}; for (const key in object) { ret[key] = propertyToRef(object, key); } @@ -7738,9 +33123,9 @@ class GetterRefImpl { function toRef$1(source, key, defaultValue) { if (isRef(source)) { return source; - } else if (isFunction$4(source)) { + } else if (isFunction$8(source)) { return new GetterRefImpl(source); - } else if (isObject$6(source) && arguments.length > 1) { + } else if (isObject$d(source) && arguments.length > 1) { return propertyToRef(source, key, defaultValue); } else { return ref(source); @@ -7797,9 +33182,9 @@ function warn$1$1(msg, ...args) { 11, [ // eslint-disable-next-line no-restricted-syntax - msg + args.map((a) => { + msg + args.map((a2) => { var _a2, _b; - return (_b = (_a2 = a.toString) == null ? void 0 : _a2.call(a)) != null ? _b : JSON.stringify(a); + return (_b = (_a2 = a2.toString) == null ? void 0 : _a2.call(a2)) != null ? _b : JSON.stringify(a2); }).join(""), instance && instance.proxy, trace.map( @@ -7884,7 +33269,7 @@ function formatProp(key, value4, raw) { } else if (isRef(value4)) { value4 = formatProp(key, toRaw(value4.value), true); return raw ? value4 : [`${key}=Ref<`, value4, `>`]; - } else if (isFunction$4(value4)) { + } else if (isFunction$8(value4)) { return [`${key}=fn${value4.name ? `<${value4.name}>` : ``}`]; } else { value4 = toRaw(value4); @@ -7975,7 +33360,7 @@ function callWithErrorHandling(fn, instance, type, args) { } __name(callWithErrorHandling, "callWithErrorHandling"); function callWithAsyncErrorHandling(fn, instance, type, args) { - if (isFunction$4(fn)) { + if (isFunction$8(fn)) { const res = callWithErrorHandling(fn, instance, type, args); if (res && isPromise$1(res)) { res.catch((err) => { @@ -7984,7 +33369,7 @@ function callWithAsyncErrorHandling(fn, instance, type, args) { } return res; } - if (isArray$4(fn)) { + if (isArray$9(fn)) { const values = []; for (let i2 = 0; i2 < fn.length; i2++) { values.push(callWithAsyncErrorHandling(fn[i2], instance, type, args)); @@ -8110,7 +33495,7 @@ function invalidateJob(job) { } __name(invalidateJob, "invalidateJob"); function queuePostFlushCb(cb) { - if (!isArray$4(cb)) { + if (!isArray$9(cb)) { if (!activePostFlushCbs || !activePostFlushCbs.includes( cb, cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex @@ -8146,7 +33531,7 @@ __name(flushPreFlushCbs, "flushPreFlushCbs"); function flushPostFlushCbs(seen2) { if (pendingPostFlushCbs.length) { const deduped = [...new Set(pendingPostFlushCbs)].sort( - (a, b) => getId(a) - getId(b) + (a2, b2) => getId(a2) - getId(b2) ); pendingPostFlushCbs.length = 0; if (activePostFlushCbs) { @@ -8170,11 +33555,11 @@ function flushPostFlushCbs(seen2) { } __name(flushPostFlushCbs, "flushPostFlushCbs"); const getId = /* @__PURE__ */ __name((job) => job.id == null ? Infinity : job.id, "getId"); -const comparator = /* @__PURE__ */ __name((a, b) => { - const diff2 = getId(a) - getId(b); +const comparator = /* @__PURE__ */ __name((a2, b2) => { + const diff2 = getId(a2) - getId(b2); if (diff2 === 0) { - if (a.pre && !b.pre) return -1; - if (b.pre && !a.pre) return 1; + if (a2.pre && !b2.pre) return -1; + if (b2.pre && !a2.pre) return 1; } return diff2; }, "comparator"); @@ -8240,12 +33625,12 @@ if (false) { const map$1 = /* @__PURE__ */ new Map(); function registerHMR(instance) { const id3 = instance.type.__hmrId; - let record = map$1.get(id3); - if (!record) { + let record2 = map$1.get(id3); + if (!record2) { createRecord(id3, instance.type); - record = map$1.get(id3); + record2 = map$1.get(id3); } - record.instances.add(instance); + record2.instances.add(instance); } __name(registerHMR, "registerHMR"); function unregisterHMR(instance) { @@ -8268,12 +33653,12 @@ function normalizeClassComponent(component) { } __name(normalizeClassComponent, "normalizeClassComponent"); function rerender(id3, newRender) { - const record = map$1.get(id3); - if (!record) { + const record2 = map$1.get(id3); + if (!record2) { return; } - record.initialDef.render = newRender; - [...record.instances].forEach((instance) => { + record2.initialDef.render = newRender; + [...record2.instances].forEach((instance) => { if (newRender) { instance.render = newRender; normalizeClassComponent(instance.type).render = newRender; @@ -8287,15 +33672,15 @@ function rerender(id3, newRender) { } __name(rerender, "rerender"); function reload(id3, newComp) { - const record = map$1.get(id3); - if (!record) return; + const record2 = map$1.get(id3); + if (!record2) return; newComp = normalizeClassComponent(newComp); - updateComponentDef(record.initialDef, newComp); - const instances = [...record.instances]; + updateComponentDef(record2.initialDef, newComp); + const instances = [...record2.instances]; for (const instance of instances) { const oldComp = normalizeClassComponent(instance.type); if (!hmrDirtyComponents.has(oldComp)) { - if (oldComp !== record.initialDef) { + if (oldComp !== record2.initialDef) { updateComponentDef(oldComp, newComp); } hmrDirtyComponents.add(oldComp); @@ -8484,7 +33869,7 @@ function emit(instance, event, ...rawArgs) { } } else { const validator3 = emitsOptions[event]; - if (isFunction$4(validator3)) { + if (isFunction$8(validator3)) { const isValid2 = validator3(...rawArgs); if (!isValid2) { warn$1$1( @@ -8502,7 +33887,7 @@ function emit(instance, event, ...rawArgs) { const modifiersKey = `${modelArg === "modelValue" ? "model" : modelArg}Modifiers`; const { number: number2, trim: trim2 } = props[modifiersKey] || EMPTY_OBJ; if (trim2) { - args = rawArgs.map((a) => isString$7(a) ? a.trim() : a); + args = rawArgs.map((a2) => isString$7(a2) ? a2.trim() : a2); } if (number2) { args = rawArgs.map(looseToNumber); @@ -8564,7 +33949,7 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) { const raw = comp.emits; let normalized = {}; let hasExtends = false; - if (!isFunction$4(comp)) { + if (!isFunction$8(comp)) { const extendEmits = /* @__PURE__ */ __name((raw2) => { const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true); if (normalizedFromExtend) { @@ -8583,17 +33968,17 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) { } } if (!raw && !hasExtends) { - if (isObject$6(comp)) { + if (isObject$d(comp)) { cache2.set(comp, null); } return null; } - if (isArray$4(raw)) { + if (isArray$9(raw)) { raw.forEach((key) => normalized[key] = null); } else { extend$1(normalized, raw); } - if (isObject$6(comp)) { + if (isObject$d(comp)) { cache2.set(comp, normalized); } return normalized; @@ -8673,7 +34058,7 @@ function renderComponentRoot(instance) { render: render2, renderCache, props, - data: data24, + data: data25, setupState, ctx, inheritAttrs @@ -8704,7 +34089,7 @@ function renderComponentRoot(instance) { renderCache, false ? shallowReadonly(props) : props, setupState, - data24, + data25, ctx ) ); @@ -8737,14 +34122,14 @@ function renderComponentRoot(instance) { handleError(err, instance, 1); result = createVNode(Comment); } - let root24 = result; + let root27 = result; let setRoot = void 0; if (false) { - [root24, setRoot] = getChildRoot(result); + [root27, setRoot] = getChildRoot(result); } if (fallthroughAttrs && inheritAttrs !== false) { const keys2 = Object.keys(fallthroughAttrs); - const { shapeFlag } = root24; + const { shapeFlag } = root27; if (keys2.length) { if (shapeFlag & (1 | 6)) { if (propsOptions && keys2.some(isModelListener)) { @@ -8753,12 +34138,12 @@ function renderComponentRoot(instance) { propsOptions ); } - root24 = cloneVNode(root24, fallthroughAttrs, false, true); + root27 = cloneVNode(root27, fallthroughAttrs, false, true); } else if (false) { const allAttrs = Object.keys(attrs4); const eventAttrs = []; const extraAttrs = []; - for (let i2 = 0, l = allAttrs.length; i2 < l; i2++) { + for (let i2 = 0, l2 = allAttrs.length; i2 < l2; i2++) { const key = allAttrs[i2]; if (isOn(key)) { if (!isModelListener(key)) { @@ -8787,8 +34172,8 @@ function renderComponentRoot(instance) { `Runtime directive used on component with non-element root node. The directives will not function as intended.` ); } - root24 = cloneVNode(root24, null, false, true); - root24.dirs = root24.dirs ? root24.dirs.concat(vnode.dirs) : vnode.dirs; + root27 = cloneVNode(root27, null, false, true); + root27.dirs = root27.dirs ? root27.dirs.concat(vnode.dirs) : vnode.dirs; } if (vnode.transition) { if (false) { @@ -8796,12 +34181,12 @@ function renderComponentRoot(instance) { `Component inside <Transition> renders non-element root node that cannot be animated.` ); } - root24.transition = vnode.transition; + root27.transition = vnode.transition; } if (false) { - setRoot(root24); + setRoot(root27); } else { - result = root24; + result = root27; } setCurrentRenderingInstance(prev2); return result; @@ -8937,11 +34322,11 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) { __name(hasPropsChanged, "hasPropsChanged"); function updateHOCHostEl({ vnode, parent }, el) { while (parent) { - const root24 = parent.subTree; - if (root24.suspense && root24.suspense.activeBranch === vnode) { - root24.el = vnode.el; + const root27 = parent.subTree; + if (root27.suspense && root27.suspense.activeBranch === vnode) { + root27.el = vnode.el; } - if (root24 === vnode) { + if (root27 === vnode) { (vnode = parent.vnode).el = el; parent = parent.parent; } else { @@ -9056,7 +34441,7 @@ const SuspenseImpl = { const Suspense = SuspenseImpl; function triggerEvent(vnode, name2) { const eventListener = vnode.props && vnode.props[name2]; - if (isFunction$4(eventListener)) { + if (isFunction$8(eventListener)) { eventListener(); } } @@ -9549,38 +34934,38 @@ function normalizeSuspenseChildren(vnode) { vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment); } __name(normalizeSuspenseChildren, "normalizeSuspenseChildren"); -function normalizeSuspenseSlot(s) { +function normalizeSuspenseSlot(s2) { let block3; - if (isFunction$4(s)) { - const trackBlock = isBlockTreeEnabled && s._c; + if (isFunction$8(s2)) { + const trackBlock = isBlockTreeEnabled && s2._c; if (trackBlock) { - s._d = false; + s2._d = false; openBlock(); } - s = s(); + s2 = s2(); if (trackBlock) { - s._d = true; + s2._d = true; block3 = currentBlock; closeBlock(); } } - if (isArray$4(s)) { - const singleChild = filterSingleRoot(s); + if (isArray$9(s2)) { + const singleChild = filterSingleRoot(s2); if (false) { warn$1$1(`<Suspense> slots expect a single root node.`); } - s = singleChild; + s2 = singleChild; } - s = normalizeVNode(s); - if (block3 && !s.dynamicChildren) { - s.dynamicChildren = block3.filter((c) => c !== s); + s2 = normalizeVNode(s2); + if (block3 && !s2.dynamicChildren) { + s2.dynamicChildren = block3.filter((c2) => c2 !== s2); } - return s; + return s2; } __name(normalizeSuspenseSlot, "normalizeSuspenseSlot"); function queueEffectWithSuspense(fn, suspense) { if (suspense && suspense.pendingBranch) { - if (isArray$4(fn)) { + if (isArray$9(fn)) { suspense.effects.push(...fn); } else { suspense.effects.push(fn); @@ -9612,7 +34997,7 @@ function isVNodeSuspensible(vnode) { __name(isVNodeSuspensible, "isVNodeSuspensible"); function injectHook(type, hook, target = currentInstance, prepend2 = false) { if (target) { - const hooks = target[type] || (target[type] = []); + const hooks2 = target[type] || (target[type] = []); const wrappedHook = hook.__weh || (hook.__weh = (...args) => { pauseTracking(); const reset2 = setCurrentInstance(target); @@ -9622,9 +35007,9 @@ function injectHook(type, hook, target = currentInstance, prepend2 = false) { return res; }); if (prepend2) { - hooks.unshift(wrappedHook); + hooks2.unshift(wrappedHook); } else { - hooks.push(wrappedHook); + hooks2.push(wrappedHook); } return wrappedHook; } else if (false) { @@ -9672,7 +35057,7 @@ function withDirectives(vnode, directives) { for (let i2 = 0; i2 < directives.length; i2++) { let [dir, value4, arg, modifiers2 = EMPTY_OBJ] = directives[i2]; if (dir) { - if (isFunction$4(dir)) { + if (isFunction$8(dir)) { dir = { mounted: dir, updated: dir @@ -9719,9 +35104,9 @@ __name(invokeDirectiveHook, "invokeDirectiveHook"); function renderList(source, renderItem, cache2, index2) { let ret; const cached = cache2 && cache2[index2]; - if (isArray$4(source) || isString$7(source)) { + if (isArray$9(source) || isString$7(source)) { ret = new Array(source.length); - for (let i2 = 0, l = source.length; i2 < l; i2++) { + for (let i2 = 0, l2 = source.length; i2 < l2; i2++) { ret[i2] = renderItem(source[i2], i2, void 0, cached && cached[i2]); } } else if (typeof source === "number") { @@ -9732,7 +35117,7 @@ function renderList(source, renderItem, cache2, index2) { for (let i2 = 0; i2 < source; i2++) { ret[i2] = renderItem(i2 + 1, i2, void 0, cached && cached[i2]); } - } else if (isObject$6(source)) { + } else if (isObject$d(source)) { if (source[Symbol.iterator]) { ret = Array.from( source, @@ -9741,7 +35126,7 @@ function renderList(source, renderItem, cache2, index2) { } else { const keys2 = Object.keys(source); ret = new Array(keys2.length); - for (let i2 = 0, l = keys2.length; i2 < l; i2++) { + for (let i2 = 0, l2 = keys2.length; i2 < l2; i2++) { const key = keys2[i2]; ret[i2] = renderItem(source[key], key, i2, cached && cached[i2]); } @@ -9758,9 +35143,9 @@ __name(renderList, "renderList"); function createSlots(slots, dynamicSlots) { for (let i2 = 0; i2 < dynamicSlots.length; i2++) { const slot = dynamicSlots[i2]; - if (isArray$4(slot)) { - for (let j = 0; j < slot.length; j++) { - slots[slot[j].name] = slot[j].fn; + if (isArray$9(slot)) { + for (let j2 = 0; j2 < slot.length; j2++) { + slots[slot[j2].name] = slot[j2].fn; } } else if (slot) { slots[slot.name] = slot.key ? (...args) => { @@ -9776,7 +35161,7 @@ __name(createSlots, "createSlots"); /*! #__NO_SIDE_EFFECTS__ */ // @__NO_SIDE_EFFECTS__ function defineComponent(options4, extraOptions) { - return isFunction$4(options4) ? ( + return isFunction$8(options4) ? ( // #8326: extend call and options.name access are considered side-effects // by Rollup, so we have to wrap it in a pure-annotated IIFE. /* @__PURE__ */ (() => extend$1({ name: options4.name }, extraOptions, { setup: options4 }))() @@ -9787,7 +35172,7 @@ const isAsyncWrapper = /* @__PURE__ */ __name((i2) => !!i2.type.__asyncLoader, " /*! #__NO_SIDE_EFFECTS__ */ // @__NO_SIDE_EFFECTS__ function defineAsyncComponent(source) { - if (isFunction$4(source)) { + if (isFunction$8(source)) { source = { loader: source }; } const { @@ -10016,19 +35401,19 @@ const PublicInstanceProxyHandlers = { if (key === "__v_skip") { return true; } - const { ctx, setupState, data: data24, props, accessCache, type, appContext } = instance; + const { ctx, setupState, data: data25, props, accessCache, type, appContext } = instance; if (false) { return true; } let normalizedProps; if (key[0] !== "$") { - const n = accessCache[key]; - if (n !== void 0) { - switch (n) { + const n2 = accessCache[key]; + if (n2 !== void 0) { + switch (n2) { case 1: return setupState[key]; case 2: - return data24[key]; + return data25[key]; case 4: return ctx[key]; case 3: @@ -10037,9 +35422,9 @@ const PublicInstanceProxyHandlers = { } else if (hasSetupBinding(setupState, key)) { accessCache[key] = 1; return setupState[key]; - } else if (data24 !== EMPTY_OBJ && hasOwn$3(data24, key)) { + } else if (data25 !== EMPTY_OBJ && hasOwn$3(data25, key)) { accessCache[key] = 2; - return data24[key]; + return data25[key]; } else if ( // only cache other properties when instance has declared (thus stable) // props @@ -10079,7 +35464,7 @@ const PublicInstanceProxyHandlers = { return globalProperties[key]; } } else if (false) { - if (data24 !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn$3(data24, key)) { + if (data25 !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn$3(data25, key)) { warn$1$1( `Property ${JSON.stringify( key @@ -10093,15 +35478,15 @@ const PublicInstanceProxyHandlers = { } }, set({ _: instance }, key, value4) { - const { data: data24, setupState, ctx } = instance; + const { data: data25, setupState, ctx } = instance; if (hasSetupBinding(setupState, key)) { setupState[key] = value4; return true; } else if (false) { warn$1$1(`Cannot mutate <script setup> binding "${key}" from Options API.`); return false; - } else if (data24 !== EMPTY_OBJ && hasOwn$3(data24, key)) { - data24[key] = value4; + } else if (data25 !== EMPTY_OBJ && hasOwn$3(data25, key)) { + data25[key] = value4; return true; } else if (hasOwn$3(instance.props, key)) { return false; @@ -10122,10 +35507,10 @@ const PublicInstanceProxyHandlers = { return true; }, has({ - _: { data: data24, setupState, accessCache, ctx, appContext, propsOptions } + _: { data: data25, setupState, accessCache, ctx, appContext, propsOptions } }, key) { let normalizedProps; - return !!accessCache[key] || data24 !== EMPTY_OBJ && hasOwn$3(data24, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn$3(normalizedProps, key) || hasOwn$3(ctx, key) || hasOwn$3(publicPropertiesMap, key) || hasOwn$3(appContext.config.globalProperties, key); + return !!accessCache[key] || data25 !== EMPTY_OBJ && hasOwn$3(data25, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn$3(normalizedProps, key) || hasOwn$3(ctx, key) || hasOwn$3(publicPropertiesMap, key) || hasOwn$3(appContext.config.globalProperties, key); }, defineProperty(target, key, descriptor) { if (descriptor.get != null) { @@ -10292,7 +35677,7 @@ function getContext() { } __name(getContext, "getContext"); function normalizePropsOrEmits(props) { - return isArray$4(props) ? props.reduce( + return isArray$9(props) ? props.reduce( (normalized, p2) => (normalized[p2] = null, normalized), {} ) : props; @@ -10304,7 +35689,7 @@ function mergeDefaults(raw, defaults2) { if (key.startsWith("__skip")) continue; let opt = props[key]; if (opt) { - if (isArray$4(opt) || isFunction$4(opt)) { + if (isArray$9(opt) || isFunction$8(opt)) { opt = props[key] = { type: opt, default: defaults2[key] }; } else { opt.default = defaults2[key]; @@ -10321,10 +35706,10 @@ function mergeDefaults(raw, defaults2) { return props; } __name(mergeDefaults, "mergeDefaults"); -function mergeModels(a, b) { - if (!a || !b) return a || b; - if (isArray$4(a) && isArray$4(b)) return a.concat(b); - return extend$1({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b)); +function mergeModels(a2, b2) { + if (!a2 || !b2) return a2 || b2; + if (isArray$9(a2) && isArray$9(b2)) return a2.concat(b2); + return extend$1({}, normalizePropsOrEmits(a2), normalizePropsOrEmits(b2)); } __name(mergeModels, "mergeModels"); function createPropsRestProxy(props, excludedKeys) { @@ -10389,9 +35774,9 @@ function applyOptions(instance) { // lifecycle created: created3, beforeMount: beforeMount4, - mounted: mounted23, + mounted: mounted25, beforeUpdate: beforeUpdate2, - updated: updated13, + updated: updated14, activated, deactivated, beforeDestroy, @@ -10426,7 +35811,7 @@ function applyOptions(instance) { if (methods) { for (const key in methods) { const methodHandler = methods[key]; - if (isFunction$4(methodHandler)) { + if (isFunction$8(methodHandler)) { if (false) { Object.defineProperty(ctx, key, { value: methodHandler.bind(publicThis), @@ -10453,23 +35838,23 @@ function applyOptions(instance) { `The data option must be a function. Plain object usage is no longer supported.` ); } - const data24 = dataOptions.call(publicThis, publicThis); + const data25 = dataOptions.call(publicThis, publicThis); if (false) { warn$1$1( `data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.` ); } - if (!isObject$6(data24)) { + if (!isObject$d(data25)) { } else { - instance.data = reactive(data24); + instance.data = reactive(data25); if (false) { - for (const key in data24) { + for (const key in data25) { checkDuplicateProperties("Data", key); if (!isReservedPrefix(key[0])) { Object.defineProperty(ctx, key, { configurable: true, enumerable: true, - get: /* @__PURE__ */ __name(() => data24[key], "get"), + get: /* @__PURE__ */ __name(() => data25[key], "get"), set: NOOP }); } @@ -10481,24 +35866,24 @@ function applyOptions(instance) { if (computedOptions) { for (const key in computedOptions) { const opt = computedOptions[key]; - const get3 = isFunction$4(opt) ? opt.bind(publicThis, publicThis) : isFunction$4(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP; + const get3 = isFunction$8(opt) ? opt.bind(publicThis, publicThis) : isFunction$8(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP; if (false) { warn$1$1(`Computed property "${key}" has no getter.`); } - const set3 = !isFunction$4(opt) && isFunction$4(opt.set) ? opt.set.bind(publicThis) : false ? () => { + const set3 = !isFunction$8(opt) && isFunction$8(opt.set) ? opt.set.bind(publicThis) : false ? () => { warn$1$1( `Write operation failed: computed property "${key}" is readonly.` ); } : NOOP; - const c = computed({ + const c2 = computed({ get: get3, set: set3 }); Object.defineProperty(ctx, key, { enumerable: true, configurable: true, - get: /* @__PURE__ */ __name(() => c.value, "get"), - set: /* @__PURE__ */ __name((v2) => c.value = v2, "set") + get: /* @__PURE__ */ __name(() => c2.value, "get"), + set: /* @__PURE__ */ __name((v2) => c2.value = v2, "set") }); if (false) { checkDuplicateProperties("Computed", key); @@ -10511,7 +35896,7 @@ function applyOptions(instance) { } } if (provideOptions) { - const provides = isFunction$4(provideOptions) ? provideOptions.call(publicThis) : provideOptions; + const provides = isFunction$8(provideOptions) ? provideOptions.call(publicThis) : provideOptions; Reflect.ownKeys(provides).forEach((key) => { provide(key, provides[key]); }); @@ -10520,7 +35905,7 @@ function applyOptions(instance) { callHook$1(created3, instance, "c"); } function registerLifecycleHook(register3, hook) { - if (isArray$4(hook)) { + if (isArray$9(hook)) { hook.forEach((_hook3) => register3(_hook3.bind(publicThis))); } else if (hook) { register3(hook.bind(publicThis)); @@ -10528,9 +35913,9 @@ function applyOptions(instance) { } __name(registerLifecycleHook, "registerLifecycleHook"); registerLifecycleHook(onBeforeMount, beforeMount4); - registerLifecycleHook(onMounted, mounted23); + registerLifecycleHook(onMounted, mounted25); registerLifecycleHook(onBeforeUpdate, beforeUpdate2); - registerLifecycleHook(onUpdated, updated13); + registerLifecycleHook(onUpdated, updated14); registerLifecycleHook(onActivated, activated); registerLifecycleHook(onDeactivated, deactivated); registerLifecycleHook(onErrorCaptured, errorCaptured); @@ -10539,7 +35924,7 @@ function applyOptions(instance) { registerLifecycleHook(onBeforeUnmount, beforeUnmount15); registerLifecycleHook(onUnmounted, unmounted6); registerLifecycleHook(onServerPrefetch, serverPrefetch); - if (isArray$4(expose)) { + if (isArray$9(expose)) { if (expose.length) { const exposed = instance.exposed || (instance.exposed = {}); expose.forEach((key) => { @@ -10563,13 +35948,13 @@ function applyOptions(instance) { } __name(applyOptions, "applyOptions"); function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) { - if (isArray$4(injectOptions)) { + if (isArray$9(injectOptions)) { injectOptions = normalizeInject(injectOptions); } for (const key in injectOptions) { const opt = injectOptions[key]; let injected; - if (isObject$6(opt)) { + if (isObject$d(opt)) { if ("default" in opt) { injected = inject( opt.from || key, @@ -10600,7 +35985,7 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) __name(resolveInjections, "resolveInjections"); function callHook$1(hook, instance, type) { callWithAsyncErrorHandling( - isArray$4(hook) ? hook.map((h2) => h2.bind(instance.proxy)) : hook.bind(instance.proxy), + isArray$9(hook) ? hook.map((h2) => h2.bind(instance.proxy)) : hook.bind(instance.proxy), instance, type ); @@ -10610,19 +35995,19 @@ function createWatcher(raw, ctx, publicThis, key) { const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key]; if (isString$7(raw)) { const handler6 = ctx[raw]; - if (isFunction$4(handler6)) { + if (isFunction$8(handler6)) { watch(getter, handler6); } else if (false) { warn$1$1(`Invalid watch handler specified by key "${raw}"`, handler6); } - } else if (isFunction$4(raw)) { + } else if (isFunction$8(raw)) { watch(getter, raw.bind(publicThis)); - } else if (isObject$6(raw)) { - if (isArray$4(raw)) { - raw.forEach((r) => createWatcher(r, ctx, publicThis, key)); + } else if (isObject$d(raw)) { + if (isArray$9(raw)) { + raw.forEach((r2) => createWatcher(r2, ctx, publicThis, key)); } else { - const handler6 = isFunction$4(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler]; - if (isFunction$4(handler6)) { + const handler6 = isFunction$8(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler]; + if (isFunction$8(handler6)) { watch(getter, handler6, raw); } else if (false) { warn$1$1(`Invalid watch handler specified by key "${raw.handler}"`, handler6); @@ -10653,12 +36038,12 @@ function resolveMergedOptions(instance) { resolved = {}; if (globalMixins.length) { globalMixins.forEach( - (m) => mergeOptions$1(resolved, m, optionMergeStrategies, true) + (m2) => mergeOptions$1(resolved, m2, optionMergeStrategies, true) ); } mergeOptions$1(resolved, base2, optionMergeStrategies); } - if (isObject$6(base2)) { + if (isObject$d(base2)) { cache2.set(base2, resolved); } return resolved; @@ -10671,7 +36056,7 @@ function mergeOptions$1(to, from2, strats, asMixin = false) { } if (mixins) { mixins.forEach( - (m) => mergeOptions$1(to, m, strats, true) + (m2) => mergeOptions$1(to, m2, strats, true) ); } for (const key in from2) { @@ -10724,8 +36109,8 @@ function mergeDataFn(to, from2) { } return /* @__PURE__ */ __name(function mergedDataFn() { return extend$1( - isFunction$4(to) ? to.call(this, this) : to, - isFunction$4(from2) ? from2.call(this, this) : from2 + isFunction$8(to) ? to.call(this, this) : to, + isFunction$8(from2) ? from2.call(this, this) : from2 ); }, "mergedDataFn"); } @@ -10735,7 +36120,7 @@ function mergeInject(to, from2) { } __name(mergeInject, "mergeInject"); function normalizeInject(raw) { - if (isArray$4(raw)) { + if (isArray$9(raw)) { const res = {}; for (let i2 = 0; i2 < raw.length; i2++) { res[raw[i2]] = raw[i2]; @@ -10755,7 +36140,7 @@ function mergeObjectOptions(to, from2) { __name(mergeObjectOptions, "mergeObjectOptions"); function mergeEmitsOrPropsOptions(to, from2) { if (to) { - if (isArray$4(to) && isArray$4(from2)) { + if (isArray$9(to) && isArray$9(from2)) { return [.../* @__PURE__ */ new Set([...to, ...from2])]; } return extend$1( @@ -10803,10 +36188,10 @@ __name(createAppContext, "createAppContext"); let uid$1 = 0; function createAppAPI(render2, hydrate2) { return /* @__PURE__ */ __name(function createApp2(rootComponent, rootProps = null) { - if (!isFunction$4(rootComponent)) { + if (!isFunction$8(rootComponent)) { rootComponent = extend$1({}, rootComponent); } - if (rootProps != null && !isObject$6(rootProps)) { + if (rootProps != null && !isObject$d(rootProps)) { rootProps = null; } const context = createAppContext(); @@ -10832,10 +36217,10 @@ function createAppAPI(render2, hydrate2) { }, use(plugin, ...options4) { if (installedPlugins.has(plugin)) { - } else if (plugin && isFunction$4(plugin.install)) { + } else if (plugin && isFunction$8(plugin.install)) { installedPlugins.add(plugin); plugin.install(app2, ...options4); - } else if (isFunction$4(plugin)) { + } else if (isFunction$8(plugin)) { installedPlugins.add(plugin); plugin(app2, ...options4); } else if (false) { @@ -10987,7 +36372,7 @@ function inject(key, defaultValue, treatDefaultAsFactory = false) { if (provides && key in provides) { return provides[key]; } else if (arguments.length > 1) { - return treatDefaultAsFactory && isFunction$4(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue; + return treatDefaultAsFactory && isFunction$8(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue; } else if (false) { warn$1$1(`injection "${String(key)}" not found.`); } @@ -11177,7 +36562,7 @@ function resolvePropValue(options4, props, key, value4, instance, isAbsent) { const hasDefault = hasOwn$3(opt, "default"); if (hasDefault && value4 === void 0) { const defaultValue = opt.default; - if (opt.type !== Function && !opt.skipFactory && isFunction$4(defaultValue)) { + if (opt.type !== Function && !opt.skipFactory && isFunction$8(defaultValue)) { const { propsDefaults } = instance; if (key in propsDefaults) { value4 = propsDefaults[key]; @@ -11220,7 +36605,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) { const normalized = {}; const needCastKeys = []; let hasExtends = false; - if (!isFunction$4(comp)) { + if (!isFunction$8(comp)) { const extendProps = /* @__PURE__ */ __name((raw2) => { hasExtends = true; const [props, keys2] = normalizePropsOptions(raw2, appContext, true); @@ -11238,12 +36623,12 @@ function normalizePropsOptions(comp, appContext, asMixin = false) { } } if (!raw && !hasExtends) { - if (isObject$6(comp)) { + if (isObject$d(comp)) { cache2.set(comp, EMPTY_ARR); } return EMPTY_ARR; } - if (isArray$4(raw)) { + if (isArray$9(raw)) { for (let i2 = 0; i2 < raw.length; i2++) { if (false) { warn$1$1(`props must be strings when using array syntax.`, raw[i2]); @@ -11261,7 +36646,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) { const normalizedKey = camelize$1(key); if (validatePropName(normalizedKey)) { const opt = raw[key]; - const prop2 = normalized[normalizedKey] = isArray$4(opt) || isFunction$4(opt) ? { type: opt } : extend$1({}, opt); + const prop2 = normalized[normalizedKey] = isArray$9(opt) || isFunction$8(opt) ? { type: opt } : extend$1({}, opt); if (prop2) { const booleanIndex = getTypeIndex(Boolean, prop2.type); const stringIndex = getTypeIndex(String, prop2.type); @@ -11281,7 +36666,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) { } } const res = [normalized, needCastKeys]; - if (isObject$6(comp)) { + if (isObject$d(comp)) { cache2.set(comp, res); } return res; @@ -11309,14 +36694,14 @@ function getType$1(ctor) { return ""; } __name(getType$1, "getType$1"); -function isSameType(a, b) { - return getType$1(a) === getType$1(b); +function isSameType(a2, b2) { + return getType$1(a2) === getType$1(b2); } __name(isSameType, "isSameType"); function getTypeIndex(type, expectedTypes) { - if (isArray$4(expectedTypes)) { + if (isArray$9(expectedTypes)) { return expectedTypes.findIndex((t2) => isSameType(t2, type)); - } else if (isFunction$4(expectedTypes)) { + } else if (isFunction$8(expectedTypes)) { return isSameType(expectedTypes, type) ? 0 : -1; } return -1; @@ -11349,7 +36734,7 @@ function validateProp(name2, value4, prop2, props, isAbsent) { } if (type != null && type !== true && !skipCheck) { let isValid2 = false; - const types = isArray$4(type) ? type : [type]; + const types = isArray$9(type) ? type : [type]; const expectedTypes = []; for (let i2 = 0; i2 < types.length && !isValid2; i2++) { const { valid, expectedType } = assertType(value4, types[i2]); @@ -11379,9 +36764,9 @@ function assertType(value4, type) { valid = value4 instanceof type; } } else if (expectedType === "Object") { - valid = isObject$6(value4); + valid = isObject$d(value4); } else if (expectedType === "Array") { - valid = isArray$4(value4); + valid = isArray$9(value4); } else if (expectedType === "null") { valid = value4 === null; } else { @@ -11432,7 +36817,7 @@ function isBoolean$3(...args) { } __name(isBoolean$3, "isBoolean$3"); const isInternalKey = /* @__PURE__ */ __name((key) => key[0] === "_" || key === "$stable", "isInternalKey"); -const normalizeSlotValue = /* @__PURE__ */ __name((value4) => isArray$4(value4) ? value4.map(normalizeVNode) : [normalizeVNode(value4)], "normalizeSlotValue"); +const normalizeSlotValue = /* @__PURE__ */ __name((value4) => isArray$9(value4) ? value4.map(normalizeVNode) : [normalizeVNode(value4)], "normalizeSlotValue"); const normalizeSlot$1 = /* @__PURE__ */ __name((key, rawSlot, ctx) => { if (rawSlot._n) { return rawSlot; @@ -11453,7 +36838,7 @@ const normalizeObjectSlots = /* @__PURE__ */ __name((rawSlots, slots, instance) for (const key in rawSlots) { if (isInternalKey(key)) continue; const value4 = rawSlots[key]; - if (isFunction$4(value4)) { + if (isFunction$8(value4)) { slots[key] = normalizeSlot$1(key, value4, ctx); } else if (value4 != null) { if (false) { @@ -11525,11 +36910,11 @@ const updateSlots = /* @__PURE__ */ __name((instance, children, optimized) => { } }, "updateSlots"); function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) { - if (isArray$4(rawRef)) { + if (isArray$9(rawRef)) { rawRef.forEach( - (r, i2) => setRef( - r, - oldRawRef && (isArray$4(oldRawRef) ? oldRawRef[i2] : oldRawRef), + (r2, i2) => setRef( + r2, + oldRawRef && (isArray$9(oldRawRef) ? oldRawRef[i2] : oldRawRef), parentSuspense, vnode, isUnmount @@ -11562,7 +36947,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) { oldRef.value = null; } } - if (isFunction$4(ref3)) { + if (isFunction$8(ref3)) { callWithErrorHandling(ref3, owner, 12, [value4, refs]); } else { const _isString = isString$7(ref3); @@ -11572,9 +36957,9 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) { if (rawRef.f) { const existing = _isString ? hasOwn$3(setupState, ref3) ? setupState[ref3] : refs[ref3] : ref3.value; if (isUnmount) { - isArray$4(existing) && remove$1(existing, refValue); + isArray$9(existing) && remove$1(existing, refValue); } else { - if (!isArray$4(existing)) { + if (!isArray$9(existing)) { if (_isString) { refs[ref3] = [refValue]; if (hasOwn$3(setupState, ref3)) { @@ -11924,9 +37309,9 @@ Server rendered element contains more child nodes than client vdom.` const hydrateChildren = /* @__PURE__ */ __name((node3, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => { optimized = optimized || !!parentVNode.dynamicChildren; const children = parentVNode.children; - const l = children.length; + const l2 = children.length; let hasWarned2 = false; - for (let i2 = 0; i2 < l; i2++) { + for (let i2 = 0; i2 < l2; i2++) { const vnode = optimized ? children[i2] : children[i2] = normalizeVNode(children[i2]); if (node3) { node3 = hydrateNode( @@ -12123,12 +37508,12 @@ function toClassSet(str) { return new Set(str.trim().split(/\s+/)); } __name(toClassSet, "toClassSet"); -function isSetEqual(a, b) { - if (a.size !== b.size) { +function isSetEqual(a2, b2) { + if (a2.size !== b2.size) { return false; } - for (const s of a) { - if (!b.has(s)) { + for (const s2 of a2) { + if (!b2.has(s2)) { return false; } } @@ -12148,12 +37533,12 @@ function toStyleMap(str) { return styleMap; } __name(toStyleMap, "toStyleMap"); -function isMapEqual(a, b) { - if (a.size !== b.size) { +function isMapEqual(a2, b2) { + if (a2.size !== b2.size) { return false; } - for (const [key, value4] of a) { - if (value4 !== b.get(key)) { + for (const [key, value4] of a2) { + if (value4 !== b2.get(key)) { return false; } } @@ -12161,14 +37546,14 @@ function isMapEqual(a, b) { } __name(isMapEqual, "isMapEqual"); function resolveCssVars(instance, vnode, expectedMap) { - const root24 = instance.subTree; - if (instance.getCssVars && (vnode === root24 || root24 && root24.type === Fragment$1 && root24.children.includes(vnode))) { + const root27 = instance.subTree; + if (instance.getCssVars && (vnode === root27 || root27 && root27.type === Fragment$1 && root27.children.includes(vnode))) { const cssVars = instance.getCssVars(); for (const key in cssVars) { expectedMap.set(`--${key}`, String(cssVars[key])); } } - if (vnode === root24 && instance.parent) { + if (vnode === root27 && instance.parent) { resolveCssVars(instance.parent, instance.vnode, expectedMap); } } @@ -12939,7 +38324,7 @@ function baseCreateRenderer(options4, createHydrationFns) { if (!instance.isMounted) { let vnodeHook; const { el, props } = initialVNode; - const { bm, m, parent } = instance; + const { bm, m: m2, parent } = instance; const isAsyncWrapperVNode = isAsyncWrapper(initialVNode); toggleRecurse(instance, false); if (bm) { @@ -13008,8 +38393,8 @@ function baseCreateRenderer(options4, createHydrationFns) { } initialVNode.el = subTree.el; } - if (m) { - queuePostRenderEffect(m, parentSuspense); + if (m2) { + queuePostRenderEffect(m2, parentSuspense); } if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) { const scopedInitialVNode = initialVNode; @@ -13027,7 +38412,7 @@ function baseCreateRenderer(options4, createHydrationFns) { } initialVNode = container = anchor = null; } else { - let { next: next2, bu, u, parent, vnode } = instance; + let { next: next2, bu, u: u2, parent, vnode } = instance; { const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance); if (nonHydratedAsyncRoot) { @@ -13092,8 +38477,8 @@ function baseCreateRenderer(options4, createHydrationFns) { if (originNext === null) { updateHOCHostEl(instance, nextTree.el); } - if (u) { - queuePostRenderEffect(u, parentSuspense); + if (u2) { + queuePostRenderEffect(u2, parentSuspense); } if (vnodeHook = next2.props && next2.props.onVnodeUpdated) { queuePostRenderEffect( @@ -13349,7 +38734,7 @@ function baseCreateRenderer(options4, createHydrationFns) { keyToNewIndexMap.set(nextChild.key, i2); } } - let j; + let j2; let patched = 0; const toBePatched = e2 - s2 + 1; let moved = false; @@ -13366,9 +38751,9 @@ function baseCreateRenderer(options4, createHydrationFns) { if (prevChild.key != null) { newIndex = keyToNewIndexMap.get(prevChild.key); } else { - for (j = s2; j <= e2; j++) { - if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) { - newIndex = j; + for (j2 = s2; j2 <= e2; j2++) { + if (newIndexToOldIndexMap[j2 - s2] === 0 && isSameVNodeType(prevChild, c2[j2])) { + newIndex = j2; break; } } @@ -13397,7 +38782,7 @@ function baseCreateRenderer(options4, createHydrationFns) { } } const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR; - j = increasingNewIndexSequence.length - 1; + j2 = increasingNewIndexSequence.length - 1; for (i2 = toBePatched - 1; i2 >= 0; i2--) { const nextIndex = s2 + i2; const nextChild = c2[nextIndex]; @@ -13415,10 +38800,10 @@ function baseCreateRenderer(options4, createHydrationFns) { optimized ); } else if (moved) { - if (j < 0 || i2 !== increasingNewIndexSequence[j]) { + if (j2 < 0 || i2 !== increasingNewIndexSequence[j2]) { move(nextChild, container, anchor, 2); } else { - j--; + j2--; } } } @@ -13598,9 +38983,9 @@ function baseCreateRenderer(options4, createHydrationFns) { if (false) { unregisterHMR(instance); } - const { bum, scope, update, subTree, um, m, a } = instance; - invalidateMount(m); - invalidateMount(a); + const { bum, scope, update, subTree, um, m: m2, a: a2 } = instance; + invalidateMount(m2); + invalidateMount(a2); if (bum) { invokeArrayFns(bum); } @@ -13705,7 +39090,7 @@ __name(needTransition, "needTransition"); function traverseStaticChildren(n1, n2, shallow = false) { const ch1 = n1.children; const ch2 = n2.children; - if (isArray$4(ch1) && isArray$4(ch2)) { + if (isArray$9(ch1) && isArray$9(ch2)) { for (let i2 = 0; i2 < ch1.length; i2++) { const c1 = ch1[i2]; let c2 = ch2[i2]; @@ -13730,39 +39115,39 @@ __name(traverseStaticChildren, "traverseStaticChildren"); function getSequence(arr) { const p2 = arr.slice(); const result = [0]; - let i2, j, u, v2, c; + let i2, j2, u2, v2, c2; const len = arr.length; for (i2 = 0; i2 < len; i2++) { const arrI = arr[i2]; if (arrI !== 0) { - j = result[result.length - 1]; - if (arr[j] < arrI) { - p2[i2] = j; + j2 = result[result.length - 1]; + if (arr[j2] < arrI) { + p2[i2] = j2; result.push(i2); continue; } - u = 0; + u2 = 0; v2 = result.length - 1; - while (u < v2) { - c = u + v2 >> 1; - if (arr[result[c]] < arrI) { - u = c + 1; + while (u2 < v2) { + c2 = u2 + v2 >> 1; + if (arr[result[c2]] < arrI) { + u2 = c2 + 1; } else { - v2 = c; + v2 = c2; } } - if (arrI < arr[result[u]]) { - if (u > 0) { - p2[i2] = result[u - 1]; + if (arrI < arr[result[u2]]) { + if (u2 > 0) { + p2[i2] = result[u2 - 1]; } - result[u] = i2; + result[u2] = i2; } } } - u = result.length; - v2 = result[u - 1]; - while (u-- > 0) { - result[u] = v2; + u2 = result.length; + v2 = result[u2 - 1]; + while (u2-- > 0) { + result[u2] = v2; v2 = p2[v2]; } return result; @@ -13779,9 +39164,9 @@ function locateNonHydratedAsyncRoot(instance) { } } __name(locateNonHydratedAsyncRoot, "locateNonHydratedAsyncRoot"); -function invalidateMount(hooks) { - if (hooks) { - for (let i2 = 0; i2 < hooks.length; i2++) hooks[i2].active = false; +function invalidateMount(hooks2) { + if (hooks2) { + for (let i2 = 0; i2 < hooks2.length; i2++) hooks2[i2].active = false; } } __name(invalidateMount, "invalidateMount"); @@ -13827,7 +39212,7 @@ __name(watch, "watch"); function doWatch(source, cb, { immediate, deep, - flush, + flush: flush2, once: once2, onTrack, onTrigger @@ -13861,10 +39246,10 @@ function doWatch(source, cb, { ); } } - const warnInvalidSource = /* @__PURE__ */ __name((s) => { + const warnInvalidSource = /* @__PURE__ */ __name((s2) => { warn$1$1( `Invalid watch source: `, - s, + s2, `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.` ); }, "warnInvalidSource"); @@ -13882,20 +39267,20 @@ function doWatch(source, cb, { } else if (isReactive(source)) { getter = /* @__PURE__ */ __name(() => reactiveGetter(source), "getter"); forceTrigger = true; - } else if (isArray$4(source)) { + } else if (isArray$9(source)) { isMultiSource = true; - forceTrigger = source.some((s) => isReactive(s) || isShallow(s)); - getter = /* @__PURE__ */ __name(() => source.map((s) => { - if (isRef(s)) { - return s.value; - } else if (isReactive(s)) { - return reactiveGetter(s); - } else if (isFunction$4(s)) { - return callWithErrorHandling(s, instance, 2); + forceTrigger = source.some((s2) => isReactive(s2) || isShallow(s2)); + getter = /* @__PURE__ */ __name(() => source.map((s2) => { + if (isRef(s2)) { + return s2.value; + } else if (isReactive(s2)) { + return reactiveGetter(s2); + } else if (isFunction$8(s2)) { + return callWithErrorHandling(s2, instance, 2); } else { } }), "getter"); - } else if (isFunction$4(source)) { + } else if (isFunction$8(source)) { if (cb) { getter = /* @__PURE__ */ __name(() => callWithErrorHandling(source, instance, 2), "getter"); } else { @@ -13937,7 +39322,7 @@ function doWatch(source, cb, { onCleanup ]); } - if (flush === "sync") { + if (flush2 === "sync") { const ctx = useSSRContext(); ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []); } else { @@ -13969,9 +39354,9 @@ function doWatch(source, cb, { }, "job"); job.allowRecurse = !!cb; let scheduler; - if (flush === "sync") { + if (flush2 === "sync") { scheduler = job; - } else if (flush === "post") { + } else if (flush2 === "post") { scheduler = /* @__PURE__ */ __name(() => queuePostRenderEffect(job, instance && instance.suspense), "scheduler"); } else { job.pre = true; @@ -13996,7 +39381,7 @@ function doWatch(source, cb, { } else { oldValue2 = effect2.run(); } - } else if (flush === "post") { + } else if (flush2 === "post") { queuePostRenderEffect( effect2.run.bind(effect2), instance && instance.suspense @@ -14012,7 +39397,7 @@ function instanceWatch(source, value4, options4) { const publicThis = this.proxy; const getter = isString$7(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis); let cb; - if (isFunction$4(value4)) { + if (isFunction$8(value4)) { cb = value4; } else { cb = value4.handler; @@ -14036,7 +39421,7 @@ function createPathGetter(ctx, path) { } __name(createPathGetter, "createPathGetter"); function traverse(value4, depth = Infinity, seen2) { - if (depth <= 0 || !isObject$6(value4) || value4["__v_skip"]) { + if (depth <= 0 || !isObject$d(value4) || value4["__v_skip"]) { return value4; } seen2 = seen2 || /* @__PURE__ */ new Set(); @@ -14047,11 +39432,11 @@ function traverse(value4, depth = Infinity, seen2) { depth--; if (isRef(value4)) { traverse(value4.value, depth, seen2); - } else if (isArray$4(value4)) { + } else if (isArray$9(value4)) { for (let i2 = 0; i2 < value4.length; i2++) { traverse(value4[i2], depth, seen2); } - } else if (isSet(value4) || isMap(value4)) { + } else if (isSet$3(value4) || isMap$3(value4)) { value4.forEach((v2) => { traverse(v2, depth, seen2); }); @@ -14272,7 +39657,7 @@ const KeepAliveImpl = { }; const KeepAlive = KeepAliveImpl; function matches$1(pattern, name2) { - if (isArray$4(pattern)) { + if (isArray$9(pattern)) { return pattern.some((p2) => matches$1(p2, name2)); } else if (isString$7(pattern)) { return pattern.split(",").includes(name2); @@ -14392,15 +39777,15 @@ const BaseTransitionImpl = { let child = children[0]; if (children.length > 1) { let hasFound = false; - for (const c of children) { - if (c.type !== Comment) { + for (const c2 of children) { + if (c2.type !== Comment) { if (false) { warn$1$1( "<transition> can only be used on a single element or component. Use <transition-group> for lists." ); break; } - child = c; + child = c2; hasFound = true; if (true) break; } @@ -14424,7 +39809,7 @@ const BaseTransitionImpl = { state, instance, // #11061, ensure enterHooks is fresh after clone - (hooks) => enterHooks = hooks + (hooks2) => enterHooks = hooks2 ); setTransitionHooks(innerChild, enterHooks); const oldChild = instance.subTree; @@ -14509,13 +39894,13 @@ function resolveTransitionHooks(vnode, props, state, instance, postClone) { const callAsyncHook = /* @__PURE__ */ __name((hook, args) => { const done = args[1]; callHook2(hook, args); - if (isArray$4(hook)) { + if (isArray$9(hook)) { if (hook.every((hook2) => hook2.length <= 1)) done(); } else if (hook.length <= 1) { done(); } }, "callAsyncHook"); - const hooks = { + const hooks2 = { mode: mode2, persisted, beforeEnter(el) { @@ -14561,8 +39946,8 @@ function resolveTransitionHooks(vnode, props, state, instance, postClone) { } else { callHook2(afterHook, [el]); } - if (hooks.delayedLeave) { - hooks.delayedLeave(); + if (hooks2.delayedLeave) { + hooks2.delayedLeave(); } el[enterCbKey$1] = void 0; }; @@ -14607,18 +39992,18 @@ function resolveTransitionHooks(vnode, props, state, instance, postClone) { } }, clone(vnode2) { - const hooks2 = resolveTransitionHooks( + const hooks22 = resolveTransitionHooks( vnode2, props, state, instance, postClone ); - if (postClone) postClone(hooks2); - return hooks2; + if (postClone) postClone(hooks22); + return hooks22; } }; - return hooks; + return hooks2; } __name(resolveTransitionHooks, "resolveTransitionHooks"); function emptyPlaceholder(vnode) { @@ -14641,20 +40026,20 @@ function getKeepAliveChild(vnode) { if (shapeFlag & 16) { return children[0]; } - if (shapeFlag & 32 && isFunction$4(children.default)) { + if (shapeFlag & 32 && isFunction$8(children.default)) { return children.default(); } } } __name(getKeepAliveChild, "getKeepAliveChild"); -function setTransitionHooks(vnode, hooks) { +function setTransitionHooks(vnode, hooks2) { if (vnode.shapeFlag & 6 && vnode.component) { - setTransitionHooks(vnode.component.subTree, hooks); + setTransitionHooks(vnode.component.subTree, hooks2); } else if (vnode.shapeFlag & 128) { - vnode.ssContent.transition = hooks.clone(vnode.ssContent); - vnode.ssFallback.transition = hooks.clone(vnode.ssFallback); + vnode.ssContent.transition = hooks2.clone(vnode.ssContent); + vnode.ssFallback.transition = hooks2.clone(vnode.ssFallback); } else { - vnode.transition = hooks; + vnode.transition = hooks2; } } __name(setTransitionHooks, "setTransitionHooks"); @@ -15041,7 +40426,7 @@ const normalizeRef = /* @__PURE__ */ __name(({ if (typeof ref3 === "number") { ref3 = "" + ref3; } - return ref3 != null ? isString$7(ref3) || isRef(ref3) || isFunction$4(ref3) ? { i: currentRenderingInstance, r: ref3, k: ref_key, f: !!ref_for } : ref3 : null; + return ref3 != null ? isString$7(ref3) || isRef(ref3) || isFunction$8(ref3) ? { i: currentRenderingInstance, r: ref3, k: ref_key, f: !!ref_for } : ref3 : null; }, "normalizeRef"); function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment$1 ? 0 : 1, isBlockNode2 = false, needFullChildrenNormalization = false) { const vnode = { @@ -15134,14 +40519,14 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami if (klass && !isString$7(klass)) { props.class = normalizeClass(klass); } - if (isObject$6(style2)) { - if (isProxy(style2) && !isArray$4(style2)) { + if (isObject$d(style2)) { + if (isProxy(style2) && !isArray$9(style2)) { style2 = extend$1({}, style2); } props.style = normalizeStyle(style2); } } - const shapeFlag = isString$7(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject$6(type) ? 4 : isFunction$4(type) ? 2 : 0; + const shapeFlag = isString$7(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject$d(type) ? 4 : isFunction$8(type) ? 2 : 0; if (false) { type = toRaw(type); warn$1$1( @@ -15181,7 +40566,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false // #2078 in the case of <component :is="vnode" ref="extra"/> // if the vnode itself already has a ref, cloneVNode will need to merge // the refs so the single vnode can be set on multiple refs - mergeRef && ref3 ? isArray$4(ref3) ? ref3.concat(normalizeRef(extraProps)) : [ref3, normalizeRef(extraProps)] : normalizeRef(extraProps) + mergeRef && ref3 ? isArray$9(ref3) ? ref3.concat(normalizeRef(extraProps)) : [ref3, normalizeRef(extraProps)] : normalizeRef(extraProps) ) : ref3, scopeId: vnode.scopeId, slotScopeIds: vnode.slotScopeIds, @@ -15224,7 +40609,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false __name(cloneVNode, "cloneVNode"); function deepCloneVNode(vnode) { const cloned = cloneVNode(vnode); - if (isArray$4(vnode.children)) { + if (isArray$9(vnode.children)) { cloned.children = vnode.children.map(deepCloneVNode); } return cloned; @@ -15247,7 +40632,7 @@ __name(createCommentVNode, "createCommentVNode"); function normalizeVNode(child) { if (child == null || typeof child === "boolean") { return createVNode(Comment); - } else if (isArray$4(child)) { + } else if (isArray$9(child)) { return createVNode( Fragment$1, null, @@ -15270,7 +40655,7 @@ function normalizeChildren(vnode, children) { const { shapeFlag } = vnode; if (children == null) { children = null; - } else if (isArray$4(children)) { + } else if (isArray$9(children)) { type = 16; } else if (typeof children === "object") { if (shapeFlag & (1 | 64)) { @@ -15295,7 +40680,7 @@ function normalizeChildren(vnode, children) { } } } - } else if (isFunction$4(children)) { + } else if (isFunction$8(children)) { children = { default: children, _ctx: currentRenderingInstance }; type = 32; } else { @@ -15325,7 +40710,7 @@ function mergeProps(...args) { } else if (isOn(key)) { const existing = ret[key]; const incoming = toMerge[key]; - if (incoming && existing !== incoming && !(isArray$4(existing) && existing.includes(incoming))) { + if (incoming && existing !== incoming && !(isArray$9(existing) && existing.includes(incoming))) { ret[key] = existing ? [].concat(existing, incoming) : incoming; } } else if (key !== "") { @@ -15571,13 +40956,13 @@ function setupStatefulComponent(instance, isSSR) { } __name(setupStatefulComponent, "setupStatefulComponent"); function handleSetupResult(instance, setupResult, isSSR) { - if (isFunction$4(setupResult)) { + if (isFunction$8(setupResult)) { if (instance.type.__ssrInlineRender) { instance.ssrRender = setupResult; } else { instance.render = setupResult; } - } else if (isObject$6(setupResult)) { + } else if (isObject$d(setupResult)) { if (false) { warn$1$1( `setup() should not return VNodes directly - return a render function instead.` @@ -15701,7 +41086,7 @@ function createSetupContext(instance) { if (exposed != null) { let exposedType = typeof exposed; if (exposedType === "object") { - if (isArray$4(exposed)) { + if (isArray$9(exposed)) { exposedType = "array"; } else if (isRef(exposed)) { exposedType = "ref"; @@ -15760,9 +41145,9 @@ function getComponentPublicInstance(instance) { } __name(getComponentPublicInstance, "getComponentPublicInstance"); const classifyRE = /(?:^|[-_])(\w)/g; -const classify = /* @__PURE__ */ __name((str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, ""), "classify"); +const classify = /* @__PURE__ */ __name((str) => str.replace(classifyRE, (c2) => c2.toUpperCase()).replace(/[-_]/g, ""), "classify"); function getComponentName(Component, includeInferred = true) { - return isFunction$4(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name; + return isFunction$8(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name; } __name(getComponentName, "getComponentName"); function formatComponentName(instance, Component, isRoot = false) { @@ -15789,18 +41174,18 @@ function formatComponentName(instance, Component, isRoot = false) { } __name(formatComponentName, "formatComponentName"); function isClassComponent(value4) { - return isFunction$4(value4) && "__vccOpts" in value4; + return isFunction$8(value4) && "__vccOpts" in value4; } __name(isClassComponent, "isClassComponent"); const computed = /* @__PURE__ */ __name((getterOrOptions, debugOptions) => { - const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup); + const c2 = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup); if (false) { const i2 = getCurrentInstance(); if (i2 && i2.appContext.config.warnRecursiveComputed) { - c._warnRecursive = true; + c2._warnRecursive = true; } } - return c; + return c2; }, "computed"); function useModel(props, name2, options4 = EMPTY_OBJ) { const i2 = getCurrentInstance(); @@ -15856,9 +41241,9 @@ function useModel(props, name2, options4 = EMPTY_OBJ) { } __name(useModel, "useModel"); function h(type, propsOrChildren, children) { - const l = arguments.length; - if (l === 2) { - if (isObject$6(propsOrChildren) && !isArray$4(propsOrChildren)) { + const l2 = arguments.length; + if (l2 === 2) { + if (isObject$d(propsOrChildren) && !isArray$9(propsOrChildren)) { if (isVNode$1(propsOrChildren)) { return createVNode(type, null, [propsOrChildren]); } @@ -15867,9 +41252,9 @@ function h(type, propsOrChildren, children) { return createVNode(type, null, propsOrChildren); } } else { - if (l > 3) { + if (l2 > 3) { children = Array.prototype.slice.call(arguments, 2); - } else if (l === 3 && isVNode$1(children)) { + } else if (l2 === 3 && isVNode$1(children)) { children = [children]; } return createVNode(type, propsOrChildren, children); @@ -15886,7 +41271,7 @@ function initCustomFormatter() { const keywordStyle = { style: "color:#eb2f96" }; const formatter = { header(obj) { - if (!isObject$6(obj)) { + if (!isObject$d(obj)) { return null; } if (obj.__isVue) { @@ -16007,7 +41392,7 @@ function initCustomFormatter() { return ["span", stringStyle, JSON.stringify(v2)]; } else if (typeof v2 === "boolean") { return ["span", keywordStyle, v2]; - } else if (isObject$6(v2)) { + } else if (isObject$d(v2)) { return ["object", { object: asRaw ? toRaw(v2) : v2 }]; } else { return ["span", stringStyle, String(v2)]; @@ -16016,7 +41401,7 @@ function initCustomFormatter() { __name(formatValue2, "formatValue"); function extractKeys(instance, type) { const Comp = instance.type; - if (isFunction$4(Comp)) { + if (isFunction$8(Comp)) { return; } const extracted = {}; @@ -16030,13 +41415,13 @@ function initCustomFormatter() { __name(extractKeys, "extractKeys"); function isKeyOfType(Comp, key, type) { const opts = Comp[type]; - if (isArray$4(opts) && opts.includes(key) || isObject$6(opts) && key in opts) { + if (isArray$9(opts) && opts.includes(key) || isObject$d(opts) && key in opts) { return true; } if (Comp.extends && isKeyOfType(Comp.extends, key, type)) { return true; } - if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) { + if (Comp.mixins && Comp.mixins.some((m2) => isKeyOfType(m2, key, type))) { return true; } } @@ -16203,14 +41588,14 @@ const TransitionPropsValidators = Transition.props = /* @__PURE__ */ extend$1( DOMTransitionPropsValidators ); const callHook = /* @__PURE__ */ __name((hook, args = []) => { - if (isArray$4(hook)) { + if (isArray$9(hook)) { hook.forEach((h2) => h2(...args)); } else if (hook) { hook(...args); } }, "callHook"); const hasExplicitCallback = /* @__PURE__ */ __name((hook) => { - return hook ? isArray$4(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false; + return hook ? isArray$9(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false; }, "hasExplicitCallback"); function resolveTransitionProps(rawProps) { const baseProps = {}; @@ -16324,11 +41709,11 @@ __name(resolveTransitionProps, "resolveTransitionProps"); function normalizeDuration(duration) { if (duration == null) { return null; - } else if (isObject$6(duration)) { + } else if (isObject$d(duration)) { return [NumberOf(duration.enter), NumberOf(duration.leave)]; } else { - const n = NumberOf(duration); - return [n, n]; + const n2 = NumberOf(duration); + return [n2, n2]; } } __name(normalizeDuration, "normalizeDuration"); @@ -16341,12 +41726,12 @@ function NumberOf(val) { } __name(NumberOf, "NumberOf"); function addTransitionClass(el, cls) { - cls.split(/\s+/).forEach((c) => c && el.classList.add(c)); + cls.split(/\s+/).forEach((c2) => c2 && el.classList.add(c2)); (el[vtcKey] || (el[vtcKey] = /* @__PURE__ */ new Set())).add(cls); } __name(addTransitionClass, "addTransitionClass"); function removeTransitionClass(el, cls) { - cls.split(/\s+/).forEach((c) => c && el.classList.remove(c)); + cls.split(/\s+/).forEach((c2) => c2 && el.classList.remove(c2)); const _vtc = el[vtcKey]; if (_vtc) { _vtc.delete(cls); @@ -16440,12 +41825,12 @@ function getTimeout(delays, durations) { while (delays.length < durations.length) { delays = delays.concat(delays); } - return Math.max(...durations.map((d, i2) => toMs(d) + toMs(delays[i2]))); + return Math.max(...durations.map((d2, i2) => toMs(d2) + toMs(delays[i2]))); } __name(getTimeout, "getTimeout"); -function toMs(s) { - if (s === "auto") return 0; - return Number(s.slice(0, -1).replace(",", ".")) * 1e3; +function toMs(s2) { + if (s2 === "auto") return 0; + return Number(s2.slice(0, -1).replace(",", ".")) * 1e3; } __name(toMs, "toMs"); function forceReflow() { @@ -16561,7 +41946,7 @@ function setVarsOnVNode(vnode, vars) { if (vnode.shapeFlag & 1 && vnode.el) { setVarsOnNode(vnode.el, vars); } else if (vnode.type === Fragment$1) { - vnode.children.forEach((c) => setVarsOnVNode(c, vars)); + vnode.children.forEach((c2) => setVarsOnVNode(c2, vars)); } else if (vnode.type === Static) { let { el, anchor } = vnode; while (el) { @@ -16637,7 +42022,7 @@ __name(patchStyle, "patchStyle"); const semicolonRE = /[^\\];\s*$/; const importantRE = /\s*!important$/; function setStyle(style2, name2, val) { - if (isArray$4(val)) { + if (isArray$9(val)) { val.forEach((v2) => setStyle(style2, name2, v2)); } else { if (val == null) val = ""; @@ -16754,14 +42139,14 @@ function patchDOMProp(el, key, value4, prevChildren, parentComponent, parentSusp needRemove && el.removeAttribute(key); } __name(patchDOMProp, "patchDOMProp"); -function addEventListener(el, event, handler6, options4) { +function addEventListener$1(el, event, handler6, options4) { el.addEventListener(event, handler6, options4); } -__name(addEventListener, "addEventListener"); -function removeEventListener(el, event, handler6, options4) { +__name(addEventListener$1, "addEventListener$1"); +function removeEventListener$1(el, event, handler6, options4) { el.removeEventListener(event, handler6, options4); } -__name(removeEventListener, "removeEventListener"); +__name(removeEventListener$1, "removeEventListener$1"); const veiKey = Symbol("_vei"); function patchEvent(el, rawName, prevValue, nextValue, instance = null) { const invokers = el[veiKey] || (el[veiKey] = {}); @@ -16775,9 +42160,9 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) { false ? sanitizeEventValue(nextValue, rawName) : nextValue, instance ); - addEventListener(el, name2, invoker, options4); + addEventListener$1(el, name2, invoker, options4); } else if (existingInvoker) { - removeEventListener(el, name2, existingInvoker, options4); + removeEventListener$1(el, name2, existingInvoker, options4); invokers[rawName] = void 0; } } @@ -16788,10 +42173,10 @@ function parseName(name2) { let options4; if (optionsModifierRE.test(name2)) { options4 = {}; - let m; - while (m = name2.match(optionsModifierRE)) { - name2 = name2.slice(0, name2.length - m[0].length); - options4[m[0].toLowerCase()] = true; + let m2; + while (m2 = name2.match(optionsModifierRE)) { + name2 = name2.slice(0, name2.length - m2[0].length); + options4[m2[0].toLowerCase()] = true; } } const event = name2[2] === ":" ? name2.slice(3) : hyphenate$1(name2.slice(2)); @@ -16821,7 +42206,7 @@ function createInvoker(initialValue, instance) { } __name(createInvoker, "createInvoker"); function sanitizeEventValue(value4, propName) { - if (isFunction$4(value4) || isArray$4(value4)) { + if (isFunction$8(value4) || isArray$9(value4)) { return value4; } warn$3( @@ -16832,7 +42217,7 @@ Expected function or array of functions, received type ${typeof value4}.` } __name(sanitizeEventValue, "sanitizeEventValue"); function patchStopImmediatePropagation(e2, value4) { - if (isArray$4(value4)) { + if (isArray$9(value4)) { const originalStop = e2.stopImmediatePropagation; e2.stopImmediatePropagation = () => { originalStop.call(e2); @@ -16885,7 +42270,7 @@ function shouldSetAsProp(el, key, value4, isSVG) { if (key === "innerHTML" || key === "textContent") { return true; } - if (key in el && isNativeOn(key) && isFunction$4(value4)) { + if (key in el && isNativeOn(key) && isFunction$8(value4)) { return true; } return false; @@ -16981,7 +42366,7 @@ class VueElement extends BaseClass { this._ob.disconnect(); this._ob = null; } - render$Y(null, this.shadowRoot); + render$$(null, this.shadowRoot); this._instance = null; } }); @@ -16995,15 +42380,15 @@ class VueElement extends BaseClass { this._setAttr(this.attributes[i2].name); } this._ob = new MutationObserver((mutations) => { - for (const m of mutations) { - this._setAttr(m.attributeName); + for (const m2 of mutations) { + this._setAttr(m2.attributeName); } }); this._ob.observe(this, { attributes: true }); const resolve2 = /* @__PURE__ */ __name((def2, isAsync2 = false) => { const { props, styles } = def2; let numberProps; - if (props && !isArray$4(props)) { + if (props && !isArray$9(props)) { for (const key in props) { const opt = props[key]; if (opt === Number || opt && opt.type === Number) { @@ -17030,7 +42415,7 @@ class VueElement extends BaseClass { } _resolveProps(def2) { const { props } = def2; - const declaredPropKeys = isArray$4(props) ? props : Object.keys(props || {}); + const declaredPropKeys = isArray$9(props) ? props : Object.keys(props || {}); for (const key of Object.keys(this)) { if (key[0] !== "_" && declaredPropKeys.includes(key)) { this._setProp(key, this[key], true, false); @@ -17082,7 +42467,7 @@ class VueElement extends BaseClass { } } _update() { - render$Y(this._createVNode(), this.shadowRoot); + render$$(this._createVNode(), this.shadowRoot); } _createVNode() { const vnode = createVNode(this._def, extend$1({}, this._props)); @@ -17093,7 +42478,7 @@ class VueElement extends BaseClass { if (false) { instance.ceReload = (newStyles) => { if (this._styles) { - this._styles.forEach((s) => this.shadowRoot.removeChild(s)); + this._styles.forEach((s2) => this.shadowRoot.removeChild(s2)); this._styles.length = 0; } this._applyStyles(newStyles); @@ -17129,11 +42514,11 @@ class VueElement extends BaseClass { _applyStyles(styles) { if (styles) { styles.forEach((css3) => { - const s = document.createElement("style"); - s.textContent = css3; - this.shadowRoot.appendChild(s); + const s2 = document.createElement("style"); + s2.textContent = css3; + this.shadowRoot.appendChild(s2); if (false) { - (this._styles || (this._styles = [])).push(s); + (this._styles || (this._styles = [])).push(s2); } }); } @@ -17188,8 +42573,8 @@ const TransitionGroupImpl = { prevChildren.forEach(recordPosition); const movedChildren = prevChildren.filter(applyTranslation); forceReflow(); - movedChildren.forEach((c) => { - const el = c.el; + movedChildren.forEach((c2) => { + const el = c2.el; const style2 = el.style; addTransitionClass(el, moveClass); style2.transform = style2.webkitTransform = style2.transitionDuration = ""; @@ -17251,8 +42636,8 @@ const TransitionGroupImpl = { const removeMode = /* @__PURE__ */ __name((props) => delete props.mode, "removeMode"); /* @__PURE__ */ removeMode(TransitionGroupImpl.props); const TransitionGroup = TransitionGroupImpl; -function callPendingCbs(c) { - const el = c.el; +function callPendingCbs(c2) { + const el = c2.el; if (el[moveCbKey]) { el[moveCbKey](); } @@ -17261,34 +42646,34 @@ function callPendingCbs(c) { } } __name(callPendingCbs, "callPendingCbs"); -function recordPosition(c) { - newPositionMap.set(c, c.el.getBoundingClientRect()); +function recordPosition(c2) { + newPositionMap.set(c2, c2.el.getBoundingClientRect()); } __name(recordPosition, "recordPosition"); -function applyTranslation(c) { - const oldPos = positionMap.get(c); - const newPos = newPositionMap.get(c); +function applyTranslation(c2) { + const oldPos = positionMap.get(c2); + const newPos = newPositionMap.get(c2); const dx = oldPos.left - newPos.left; const dy = oldPos.top - newPos.top; if (dx || dy) { - const s = c.el.style; - s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`; - s.transitionDuration = "0s"; - return c; + const s2 = c2.el.style; + s2.transform = s2.webkitTransform = `translate(${dx}px,${dy}px)`; + s2.transitionDuration = "0s"; + return c2; } } __name(applyTranslation, "applyTranslation"); -function hasCSSTransform(el, root24, moveClass) { +function hasCSSTransform(el, root27, moveClass) { const clone2 = el.cloneNode(); const _vtc = el[vtcKey]; if (_vtc) { _vtc.forEach((cls) => { - cls.split(/\s+/).forEach((c) => c && clone2.classList.remove(c)); + cls.split(/\s+/).forEach((c2) => c2 && clone2.classList.remove(c2)); }); } - moveClass.split(/\s+/).forEach((c) => c && clone2.classList.add(c)); + moveClass.split(/\s+/).forEach((c2) => c2 && clone2.classList.add(c2)); clone2.style.display = "none"; - const container = root24.nodeType === 1 ? root24 : root24.parentNode; + const container = root27.nodeType === 1 ? root27 : root27.parentNode; container.appendChild(clone2); const { hasTransform } = getTransitionInfo(clone2); container.removeChild(clone2); @@ -17297,7 +42682,7 @@ function hasCSSTransform(el, root24, moveClass) { __name(hasCSSTransform, "hasCSSTransform"); const getModelAssigner = /* @__PURE__ */ __name((vnode) => { const fn = vnode.props["onUpdate:modelValue"] || false; - return isArray$4(fn) ? (value4) => invokeArrayFns(fn, value4) : fn; + return isArray$9(fn) ? (value4) => invokeArrayFns(fn, value4) : fn; }, "getModelAssigner"); function onCompositionStart(e2) { e2.target.composing = true; @@ -17316,7 +42701,7 @@ const vModelText = { created(el, { modifiers: { lazy, trim: trim2, number: number2 } }, vnode) { el[assignKey] = getModelAssigner(vnode); const castToNumber = number2 || vnode.props && vnode.props.type === "number"; - addEventListener(el, lazy ? "change" : "input", (e2) => { + addEventListener$1(el, lazy ? "change" : "input", (e2) => { if (e2.target.composing) return; let domValue = el.value; if (trim2) { @@ -17328,14 +42713,14 @@ const vModelText = { el[assignKey](domValue); }); if (trim2) { - addEventListener(el, "change", () => { + addEventListener$1(el, "change", () => { el.value = el.value.trim(); }); } if (!lazy) { - addEventListener(el, "compositionstart", onCompositionStart); - addEventListener(el, "compositionend", onCompositionEnd); - addEventListener(el, "change", onCompositionEnd); + addEventListener$1(el, "compositionstart", onCompositionStart); + addEventListener$1(el, "compositionend", onCompositionEnd); + addEventListener$1(el, "change", onCompositionEnd); } }, // set value on mounted so it's after min/max for type="range" @@ -17366,12 +42751,12 @@ const vModelCheckbox = { deep: true, created(el, _2, vnode) { el[assignKey] = getModelAssigner(vnode); - addEventListener(el, "change", () => { + addEventListener$1(el, "change", () => { const modelValue3 = el._modelValue; - const elementValue = getValue$1(el); + const elementValue = getValue$3(el); const checked4 = el.checked; const assign2 = el[assignKey]; - if (isArray$4(modelValue3)) { + if (isArray$9(modelValue3)) { const index2 = looseIndexOf(modelValue3, elementValue); const found2 = index2 !== -1; if (checked4 && !found2) { @@ -17381,7 +42766,7 @@ const vModelCheckbox = { filtered.splice(index2, 1); assign2(filtered); } - } else if (isSet(modelValue3)) { + } else if (isSet$3(modelValue3)) { const cloned = new Set(modelValue3); if (checked4) { cloned.add(elementValue); @@ -17403,9 +42788,9 @@ const vModelCheckbox = { }; function setChecked(el, { value: value4, oldValue: oldValue2 }, vnode) { el._modelValue = value4; - if (isArray$4(value4)) { + if (isArray$9(value4)) { el.checked = looseIndexOf(value4, vnode.props.value) > -1; - } else if (isSet(value4)) { + } else if (isSet$3(value4)) { el.checked = value4.has(vnode.props.value); } else if (value4 !== oldValue2) { el.checked = looseEqual(value4, getCheckboxValue(el, true)); @@ -17416,8 +42801,8 @@ const vModelRadio = { created(el, { value: value4 }, vnode) { el.checked = looseEqual(value4, vnode.props.value); el[assignKey] = getModelAssigner(vnode); - addEventListener(el, "change", () => { - el[assignKey](getValue$1(el)); + addEventListener$1(el, "change", () => { + el[assignKey](getValue$3(el)); }); }, beforeUpdate(el, { value: value4, oldValue: oldValue2 }, vnode) { @@ -17431,10 +42816,10 @@ const vModelSelect = { // <select multiple> value need to be deep traversed deep: true, created(el, { value: value4, modifiers: { number: number2 } }, vnode) { - const isSetModel = isSet(value4); - addEventListener(el, "change", () => { - const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map( - (o) => number2 ? looseToNumber(getValue$1(o)) : getValue$1(o) + const isSetModel = isSet$3(value4); + addEventListener$1(el, "change", () => { + const selectedVal = Array.prototype.filter.call(el.options, (o2) => o2.selected).map( + (o2) => number2 ? looseToNumber(getValue$3(o2)) : getValue$3(o2) ); el[assignKey]( el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0] @@ -17462,13 +42847,13 @@ const vModelSelect = { }; function setSelected(el, value4, number2) { const isMultiple = el.multiple; - const isArrayValue = isArray$4(value4); - if (isMultiple && !isArrayValue && !isSet(value4)) { + const isArrayValue = isArray$9(value4); + if (isMultiple && !isArrayValue && !isSet$3(value4)) { return; } - for (let i2 = 0, l = el.options.length; i2 < l; i2++) { + for (let i2 = 0, l2 = el.options.length; i2 < l2; i2++) { const option3 = el.options[i2]; - const optionValue = getValue$1(option3); + const optionValue = getValue$3(option3); if (isMultiple) { if (isArrayValue) { const optionType = typeof optionValue; @@ -17480,7 +42865,7 @@ function setSelected(el, value4, number2) { } else { option3.selected = value4.has(optionValue); } - } else if (looseEqual(getValue$1(option3), value4)) { + } else if (looseEqual(getValue$3(option3), value4)) { if (el.selectedIndex !== i2) el.selectedIndex = i2; return; } @@ -17490,10 +42875,10 @@ function setSelected(el, value4, number2) { } } __name(setSelected, "setSelected"); -function getValue$1(el) { +function getValue$3(el) { return "_value" in el ? el._value : el.value; } -__name(getValue$1, "getValue$1"); +__name(getValue$3, "getValue$3"); function getCheckboxValue(el, checked4) { const key = checked4 ? "_trueValue" : "_falseValue"; return key in el ? el[key] : checked4; @@ -17548,11 +42933,11 @@ function initVModelForSSR() { } }; vModelCheckbox.getSSRProps = ({ value: value4 }, vnode) => { - if (isArray$4(value4)) { + if (isArray$9(value4)) { if (vnode.props && looseIndexOf(value4, vnode.props.value) > -1) { return { checked: true }; } - } else if (isSet(value4)) { + } else if (isSet$3(value4)) { if (vnode.props && value4.has(vnode.props.value)) { return { checked: true }; } @@ -17587,7 +42972,7 @@ const modifierGuards = { left: /* @__PURE__ */ __name((e2) => "button" in e2 && e2.button !== 0, "left"), middle: /* @__PURE__ */ __name((e2) => "button" in e2 && e2.button !== 1, "middle"), right: /* @__PURE__ */ __name((e2) => "button" in e2 && e2.button !== 2, "right"), - exact: /* @__PURE__ */ __name((e2, modifiers2) => systemModifiers.some((m) => e2[`${m}Key`] && !modifiers2.includes(m)), "exact") + exact: /* @__PURE__ */ __name((e2, modifiers2) => systemModifiers.some((m2) => e2[`${m2}Key`] && !modifiers2.includes(m2)), "exact") }; const withModifiers = /* @__PURE__ */ __name((fn, modifiers2) => { const cache2 = fn._withMods || (fn._withMods = {}); @@ -17617,7 +43002,7 @@ const withKeys = /* @__PURE__ */ __name((fn, modifiers2) => { return; } const eventKey = hyphenate$1(event.key); - if (modifiers2.some((k) => k === eventKey || keyNames[k] === eventKey)) { + if (modifiers2.some((k2) => k2 === eventKey || keyNames[k2] === eventKey)) { return fn(event); } }); @@ -17635,9 +43020,9 @@ function ensureHydrationRenderer() { return renderer; } __name(ensureHydrationRenderer, "ensureHydrationRenderer"); -const render$Y = /* @__PURE__ */ __name((...args) => { +const render$$ = /* @__PURE__ */ __name((...args) => { ensureRenderer().render(...args); -}, "render$Y"); +}, "render$$"); const hydrate = /* @__PURE__ */ __name((...args) => { ensureHydrationRenderer().hydrate(...args); }, "hydrate"); @@ -17652,7 +43037,7 @@ const createApp = /* @__PURE__ */ __name((...args) => { const container = normalizeContainer(containerOrSelector); if (!container) return; const component = app2._component; - if (!isFunction$4(component) && !component.render && !component.template) { + if (!isFunction$8(component) && !component.render && !component.template) { component.template = container.innerHTML; } container.innerHTML = ""; @@ -17880,7 +43265,7 @@ const vue_runtime_esmBundler = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Obj readonly, ref, registerRuntimeCompiler, - render: render$Y, + render: render$$, renderList, renderSlot, resolveComponent, @@ -18014,8 +43399,8 @@ class ApiProxy { let currentSettings = Object.assign({}, defaultSettings); try { const raw = localStorage.getItem(localSettingsSaveId); - const data24 = JSON.parse(raw); - Object.assign(currentSettings, data24); + const data25 = JSON.parse(raw); + Object.assign(currentSettings, data25); } catch (e2) { } this.fallbacks = { @@ -18127,8 +43512,8 @@ const piniaSymbol = false ? Symbol("pinia") : ( /* istanbul ignore next */ Symbol() ); -function isPlainObject$3(o) { - return o && typeof o === "object" && Object.prototype.toString.call(o) === "[object Object]" && typeof o.toJSON !== "function"; +function isPlainObject$3(o2) { + return o2 && typeof o2 === "object" && Object.prototype.toString.call(o2) === "[object Object]" && typeof o2.toJSON !== "function"; } __name(isPlainObject$3, "isPlainObject$3"); var MutationType; @@ -18193,28 +43578,28 @@ const saveAs$1 = !IS_CLIENT ? () => { ) ); function downloadSaveAs(blob, name2 = "download", opts) { - const a = document.createElement("a"); - a.download = name2; - a.rel = "noopener"; + const a2 = document.createElement("a"); + a2.download = name2; + a2.rel = "noopener"; if (typeof blob === "string") { - a.href = blob; - if (a.origin !== location.origin) { - if (corsEnabled(a.href)) { + a2.href = blob; + if (a2.origin !== location.origin) { + if (corsEnabled(a2.href)) { download(blob, name2, opts); } else { - a.target = "_blank"; - click(a); + a2.target = "_blank"; + click(a2); } } else { - click(a); + click(a2); } } else { - a.href = URL.createObjectURL(blob); + a2.href = URL.createObjectURL(blob); setTimeout(function() { - URL.revokeObjectURL(a.href); + URL.revokeObjectURL(a2.href); }, 4e4); setTimeout(function() { - click(a); + click(a2); }, 0); } } @@ -18224,11 +43609,11 @@ function msSaveAs(blob, name2 = "download", opts) { if (corsEnabled(blob)) { download(blob, name2, opts); } else { - const a = document.createElement("a"); - a.href = blob; - a.target = "_blank"; + const a2 = document.createElement("a"); + a2.href = blob; + a2.target = "_blank"; setTimeout(function() { - click(a); + click(a2); }); } } else { @@ -18289,8 +43674,8 @@ function toastMessage(message3, type) { } } __name(toastMessage, "toastMessage"); -function isPinia(o) { - return "_a" in o && "install" in o; +function isPinia(o2) { + return "_a" in o2 && "install" in o2; } __name(isPinia, "isPinia"); function checkClipboardAccess() { @@ -18472,12 +43857,12 @@ function formatEventData(events2) { if (!events2) return {}; if (Array.isArray(events2)) { - return events2.reduce((data24, event) => { - data24.keys.push(event.key); - data24.operations.push(event.type); - data24.oldValue[event.key] = event.oldValue; - data24.newValue[event.key] = event.newValue; - return data24; + return events2.reduce((data25, event) => { + data25.keys.push(event.key); + data25.operations.push(event.type); + data25.oldValue[event.key] = event.oldValue; + data25.newValue[event.key] = event.newValue; + return data25; }, { oldValue: {}, keys: [], @@ -19081,8 +44466,8 @@ function shouldHydrate(obj) { } __name(shouldHydrate, "shouldHydrate"); const { assign: assign$6 } = Object; -function isComputed(o) { - return !!(isRef(o) && o.effect); +function isComputed(o2) { + return !!(isRef(o2) && o2.effect); } __name(isComputed, "isComputed"); function createOptionsStore(id3, options4, pinia2, hot) { @@ -19679,50 +45064,50 @@ var FilterOperator = { AND: "and", OR: "or" }; -function _createForOfIteratorHelper$4(r, e2) { - var t2 = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; +function _createForOfIteratorHelper$4(r2, e2) { + var t2 = "undefined" != typeof Symbol && r2[Symbol.iterator] || r2["@@iterator"]; if (!t2) { - if (Array.isArray(r) || (t2 = _unsupportedIterableToArray$j(r)) || e2) { - t2 && (r = t2); - var _n = 0, F = /* @__PURE__ */ __name(function F2() { + if (Array.isArray(r2) || (t2 = _unsupportedIterableToArray$j(r2)) || e2) { + t2 && (r2 = t2); + var _n = 0, F2 = /* @__PURE__ */ __name(function F3() { }, "F"); - return { s: F, n: /* @__PURE__ */ __name(function n() { - return _n >= r.length ? { done: true } : { done: false, value: r[_n++] }; - }, "n"), e: /* @__PURE__ */ __name(function e3(r2) { - throw r2; - }, "e"), f: F }; + return { s: F2, n: /* @__PURE__ */ __name(function n2() { + return _n >= r2.length ? { done: true } : { done: false, value: r2[_n++] }; + }, "n"), e: /* @__PURE__ */ __name(function e3(r3) { + throw r3; + }, "e"), f: F2 }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - var o, a = true, u = false; - return { s: /* @__PURE__ */ __name(function s() { - t2 = t2.call(r); - }, "s"), n: /* @__PURE__ */ __name(function n() { - var r2 = t2.next(); - return a = r2.done, r2; - }, "n"), e: /* @__PURE__ */ __name(function e3(r2) { - u = true, o = r2; - }, "e"), f: /* @__PURE__ */ __name(function f() { + var o2, a2 = true, u2 = false; + return { s: /* @__PURE__ */ __name(function s2() { + t2 = t2.call(r2); + }, "s"), n: /* @__PURE__ */ __name(function n2() { + var r3 = t2.next(); + return a2 = r3.done, r3; + }, "n"), e: /* @__PURE__ */ __name(function e3(r3) { + u2 = true, o2 = r3; + }, "e"), f: /* @__PURE__ */ __name(function f2() { try { - a || null == t2["return"] || t2["return"](); + a2 || null == t2["return"] || t2["return"](); } finally { - if (u) throw o; + if (u2) throw o2; } }, "f") }; } __name(_createForOfIteratorHelper$4, "_createForOfIteratorHelper$4"); -function _unsupportedIterableToArray$j(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray$j(r, a); - var t2 = {}.toString.call(r).slice(8, -1); - return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$j(r, a) : void 0; +function _unsupportedIterableToArray$j(r2, a2) { + if (r2) { + if ("string" == typeof r2) return _arrayLikeToArray$j(r2, a2); + var t2 = {}.toString.call(r2).slice(8, -1); + return "Object" === t2 && r2.constructor && (t2 = r2.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r2) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$j(r2, a2) : void 0; } } __name(_unsupportedIterableToArray$j, "_unsupportedIterableToArray$j"); -function _arrayLikeToArray$j(r, a) { - (null == a || a > r.length) && (a = r.length); - for (var e2 = 0, n = Array(a); e2 < a; e2++) n[e2] = r[e2]; - return n; +function _arrayLikeToArray$j(r2, a2) { + (null == a2 || a2 > r2.length) && (a2 = r2.length); + for (var e2 = 0, n2 = Array(a2); e2 < a2; e2++) n2[e2] = r2[e2]; + return n2; } __name(_arrayLikeToArray$j, "_arrayLikeToArray$j"); var FilterService = { @@ -20306,8 +45691,8 @@ function getHiddenElementDimensions(element) { } __name(getHiddenElementDimensions, "getHiddenElementDimensions"); function getViewport() { - let win = window, d = document, e2 = d.documentElement, g2 = d.getElementsByTagName("body")[0], w = win.innerWidth || e2.clientWidth || g2.clientWidth, h2 = win.innerHeight || e2.clientHeight || g2.clientHeight; - return { width: w, height: h2 }; + let win = window, d2 = document, e2 = d2.documentElement, g2 = d2.getElementsByTagName("body")[0], w2 = win.innerWidth || e2.clientWidth || g2.clientWidth, h2 = win.innerHeight || e2.clientHeight || g2.clientHeight; + return { width: w2, height: h2 }; } __name(getViewport, "getViewport"); function getWindowScrollLeft() { @@ -20510,7 +45895,7 @@ function setAttributes(element, attributes = {}) { cv.push(v2); } else if (type === "object") { const _cv = Array.isArray(v2) ? computedStyles(rule, v2) : Object.entries(v2).map(([_k, _v]) => rule === "style" && (!!_v || _v === 0) ? `${_k.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase()}:${_v}` : !!_v ? _k : void 0); - cv = _cv.length ? cv.concat(_cv.filter((c) => !!c)) : cv; + cv = _cv.length ? cv.concat(_cv.filter((c2) => !!c2)) : cv; } } return cv; @@ -20544,7 +45929,7 @@ function createElement(type, attributes = {}, ...children) { } __name(createElement, "createElement"); function createStyleAsString(css3, options4 = {}) { - return css3 ? `'<style type="text/css" ${Object.entries(options4).reduce((s, [k, v2]) => s + `${k}="${v2}"`, " ")}>${css3}</style>'` : ""; + return css3 ? `'<style type="text/css" ${Object.entries(options4).reduce((s2, [k2, v2]) => s2 + `${k2}="${v2}"`, " ")}>${css3}</style>'` : ""; } __name(createStyleAsString, "createStyleAsString"); function createStyleTag$1(attributes = {}, container) { @@ -21070,56 +46455,56 @@ function setAttribute(element, attribute2 = "", value4) { } } __name(setAttribute, "setAttribute"); -function _typeof$l(o) { +function _typeof$l(o2) { "@babel/helpers - typeof"; - return _typeof$l = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { - return typeof o2; - } : function(o2) { - return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; - }, _typeof$l(o); + return _typeof$l = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { + return typeof o3; + } : function(o3) { + return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; + }, _typeof$l(o2); } __name(_typeof$l, "_typeof$l"); -function ownKeys$j(e2, r) { +function ownKeys$j(e2, r2) { var t2 = Object.keys(e2); if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e2); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e2, r2).enumerable; - })), t2.push.apply(t2, o); + var o2 = Object.getOwnPropertySymbols(e2); + r2 && (o2 = o2.filter(function(r3) { + return Object.getOwnPropertyDescriptor(e2, r3).enumerable; + })), t2.push.apply(t2, o2); } return t2; } __name(ownKeys$j, "ownKeys$j"); function _objectSpread$j(e2) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$j(Object(t2), true).forEach(function(r2) { - _defineProperty$l(e2, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$j(Object(t2)).forEach(function(r2) { - Object.defineProperty(e2, r2, Object.getOwnPropertyDescriptor(t2, r2)); + for (var r2 = 1; r2 < arguments.length; r2++) { + var t2 = null != arguments[r2] ? arguments[r2] : {}; + r2 % 2 ? ownKeys$j(Object(t2), true).forEach(function(r3) { + _defineProperty$n(e2, r3, t2[r3]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$j(Object(t2)).forEach(function(r3) { + Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3)); }); } return e2; } __name(_objectSpread$j, "_objectSpread$j"); -function _defineProperty$l(e2, r, t2) { - return (r = _toPropertyKey$k(r)) in e2 ? Object.defineProperty(e2, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r] = t2, e2; +function _defineProperty$n(e2, r2, t2) { + return (r2 = _toPropertyKey$k(r2)) in e2 ? Object.defineProperty(e2, r2, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r2] = t2, e2; } -__name(_defineProperty$l, "_defineProperty$l"); +__name(_defineProperty$n, "_defineProperty$n"); function _toPropertyKey$k(t2) { var i2 = _toPrimitive$k(t2, "string"); return "symbol" == _typeof$l(i2) ? i2 : i2 + ""; } __name(_toPropertyKey$k, "_toPropertyKey$k"); -function _toPrimitive$k(t2, r) { +function _toPrimitive$k(t2, r2) { if ("object" != _typeof$l(t2) || !t2) return t2; var e2 = t2[Symbol.toPrimitive]; if (void 0 !== e2) { - var i2 = e2.call(t2, r || "default"); + var i2 = e2.call(t2, r2 || "default"); if ("object" != _typeof$l(i2)) return i2; throw new TypeError("@@toPrimitive must return a primitive value."); } - return ("string" === r ? String : Number)(t2); + return ("string" === r2 ? String : Number)(t2); } __name(_toPrimitive$k, "_toPrimitive$k"); function tryOnMounted$1(fn) { @@ -21190,105 +46575,105 @@ function useStyle(css3) { }; } __name(useStyle, "useStyle"); -function _typeof$k(o) { +function _typeof$k(o2) { "@babel/helpers - typeof"; - return _typeof$k = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { - return typeof o2; - } : function(o2) { - return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; - }, _typeof$k(o); + return _typeof$k = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { + return typeof o3; + } : function(o3) { + return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; + }, _typeof$k(o2); } __name(_typeof$k, "_typeof$k"); -function _slicedToArray$4(r, e2) { - return _arrayWithHoles$4(r) || _iterableToArrayLimit$4(r, e2) || _unsupportedIterableToArray$i(r, e2) || _nonIterableRest$4(); +function _slicedToArray$4(r2, e2) { + return _arrayWithHoles$4(r2) || _iterableToArrayLimit$4(r2, e2) || _unsupportedIterableToArray$i(r2, e2) || _nonIterableRest$4(); } __name(_slicedToArray$4, "_slicedToArray$4"); function _nonIterableRest$4() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } __name(_nonIterableRest$4, "_nonIterableRest$4"); -function _unsupportedIterableToArray$i(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray$i(r, a); - var t2 = {}.toString.call(r).slice(8, -1); - return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$i(r, a) : void 0; +function _unsupportedIterableToArray$i(r2, a2) { + if (r2) { + if ("string" == typeof r2) return _arrayLikeToArray$i(r2, a2); + var t2 = {}.toString.call(r2).slice(8, -1); + return "Object" === t2 && r2.constructor && (t2 = r2.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r2) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$i(r2, a2) : void 0; } } __name(_unsupportedIterableToArray$i, "_unsupportedIterableToArray$i"); -function _arrayLikeToArray$i(r, a) { - (null == a || a > r.length) && (a = r.length); - for (var e2 = 0, n = Array(a); e2 < a; e2++) n[e2] = r[e2]; - return n; +function _arrayLikeToArray$i(r2, a2) { + (null == a2 || a2 > r2.length) && (a2 = r2.length); + for (var e2 = 0, n2 = Array(a2); e2 < a2; e2++) n2[e2] = r2[e2]; + return n2; } __name(_arrayLikeToArray$i, "_arrayLikeToArray$i"); -function _iterableToArrayLimit$4(r, l) { - var t2 = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; +function _iterableToArrayLimit$4(r2, l2) { + var t2 = null == r2 ? null : "undefined" != typeof Symbol && r2[Symbol.iterator] || r2["@@iterator"]; if (null != t2) { - var e2, n, i2, u, a = [], f = true, o = false; + var e2, n2, i2, u2, a2 = [], f2 = true, o2 = false; try { - if (i2 = (t2 = t2.call(r)).next, 0 === l) ; - else for (; !(f = (e2 = i2.call(t2)).done) && (a.push(e2.value), a.length !== l); f = true) ; - } catch (r2) { - o = true, n = r2; + if (i2 = (t2 = t2.call(r2)).next, 0 === l2) ; + else for (; !(f2 = (e2 = i2.call(t2)).done) && (a2.push(e2.value), a2.length !== l2); f2 = true) ; + } catch (r3) { + o2 = true, n2 = r3; } finally { try { - if (!f && null != t2["return"] && (u = t2["return"](), Object(u) !== u)) return; + if (!f2 && null != t2["return"] && (u2 = t2["return"](), Object(u2) !== u2)) return; } finally { - if (o) throw n; + if (o2) throw n2; } } - return a; + return a2; } } __name(_iterableToArrayLimit$4, "_iterableToArrayLimit$4"); -function _arrayWithHoles$4(r) { - if (Array.isArray(r)) return r; +function _arrayWithHoles$4(r2) { + if (Array.isArray(r2)) return r2; } __name(_arrayWithHoles$4, "_arrayWithHoles$4"); -function ownKeys$i(e2, r) { +function ownKeys$i(e2, r2) { var t2 = Object.keys(e2); if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e2); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e2, r2).enumerable; - })), t2.push.apply(t2, o); + var o2 = Object.getOwnPropertySymbols(e2); + r2 && (o2 = o2.filter(function(r3) { + return Object.getOwnPropertyDescriptor(e2, r3).enumerable; + })), t2.push.apply(t2, o2); } return t2; } __name(ownKeys$i, "ownKeys$i"); function _objectSpread$i(e2) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$i(Object(t2), true).forEach(function(r2) { - _defineProperty$k(e2, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$i(Object(t2)).forEach(function(r2) { - Object.defineProperty(e2, r2, Object.getOwnPropertyDescriptor(t2, r2)); + for (var r2 = 1; r2 < arguments.length; r2++) { + var t2 = null != arguments[r2] ? arguments[r2] : {}; + r2 % 2 ? ownKeys$i(Object(t2), true).forEach(function(r3) { + _defineProperty$m(e2, r3, t2[r3]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$i(Object(t2)).forEach(function(r3) { + Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3)); }); } return e2; } __name(_objectSpread$i, "_objectSpread$i"); -function _defineProperty$k(e2, r, t2) { - return (r = _toPropertyKey$j(r)) in e2 ? Object.defineProperty(e2, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r] = t2, e2; +function _defineProperty$m(e2, r2, t2) { + return (r2 = _toPropertyKey$j(r2)) in e2 ? Object.defineProperty(e2, r2, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r2] = t2, e2; } -__name(_defineProperty$k, "_defineProperty$k"); +__name(_defineProperty$m, "_defineProperty$m"); function _toPropertyKey$j(t2) { var i2 = _toPrimitive$j(t2, "string"); return "symbol" == _typeof$k(i2) ? i2 : i2 + ""; } __name(_toPropertyKey$j, "_toPropertyKey$j"); -function _toPrimitive$j(t2, r) { +function _toPrimitive$j(t2, r2) { if ("object" != _typeof$k(t2) || !t2) return t2; var e2 = t2[Symbol.toPrimitive]; if (void 0 !== e2) { - var i2 = e2.call(t2, r || "default"); + var i2 = e2.call(t2, r2 || "default"); if ("object" != _typeof$k(i2)) return i2; throw new TypeError("@@toPrimitive must return a primitive value."); } - return ("string" === r ? String : Number)(t2); + return ("string" === r2 ? String : Number)(t2); } __name(_toPrimitive$j, "_toPrimitive$j"); -var theme$B = /* @__PURE__ */ __name(function theme2(_ref) { +var theme$D = /* @__PURE__ */ __name(function theme2(_ref) { var dt2 = _ref.dt; return "\n* {\n box-sizing: border-box;\n}\n\n/* Non vue overlay animations */\n.p-connected-overlay {\n opacity: 0;\n transform: scaleY(0.8);\n transition: transform 0.12s cubic-bezier(0, 0, 0.2, 1),\n opacity 0.12s cubic-bezier(0, 0, 0.2, 1);\n}\n\n.p-connected-overlay-visible {\n opacity: 1;\n transform: scaleY(1);\n}\n\n.p-connected-overlay-hidden {\n opacity: 0;\n transform: scaleY(1);\n transition: opacity 0.1s linear;\n}\n\n/* Vue based overlay animations */\n.p-connected-overlay-enter-from {\n opacity: 0;\n transform: scaleY(0.8);\n}\n\n.p-connected-overlay-leave-to {\n opacity: 0;\n}\n\n.p-connected-overlay-enter-active {\n transition: transform 0.12s cubic-bezier(0, 0, 0.2, 1),\n opacity 0.12s cubic-bezier(0, 0, 0.2, 1);\n}\n\n.p-connected-overlay-leave-active {\n transition: opacity 0.1s linear;\n}\n\n/* Toggleable Content */\n.p-toggleable-content-enter-from,\n.p-toggleable-content-leave-to {\n max-height: 0;\n}\n\n.p-toggleable-content-enter-to,\n.p-toggleable-content-leave-from {\n max-height: 1000px;\n}\n\n.p-toggleable-content-leave-active {\n overflow: hidden;\n transition: max-height 0.45s cubic-bezier(0, 1, 0, 1);\n}\n\n.p-toggleable-content-enter-active {\n overflow: hidden;\n transition: max-height 1s ease-in-out;\n}\n\n.p-disabled,\n.p-disabled * {\n cursor: default;\n pointer-events: none;\n user-select: none;\n}\n\n.p-disabled,\n.p-component:disabled {\n opacity: ".concat(dt2("disabled.opacity"), ";\n}\n\n.pi {\n font-size: ").concat(dt2("icon.size"), ";\n}\n\n.p-icon {\n width: ").concat(dt2("icon.size"), ";\n height: ").concat(dt2("icon.size"), ";\n}\n\n.p-overlay-mask {\n background: ").concat(dt2("mask.background"), ";\n color: ").concat(dt2("mask.color"), ";\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n}\n\n.p-overlay-mask-enter {\n animation: p-overlay-mask-enter-animation ").concat(dt2("mask.transition.duration"), " forwards;\n}\n\n.p-overlay-mask-leave {\n animation: p-overlay-mask-leave-animation ").concat(dt2("mask.transition.duration"), " forwards;\n}\n\n@keyframes p-overlay-mask-enter-animation {\n from {\n background: transparent;\n }\n to {\n background: ").concat(dt2("mask.background"), ";\n }\n}\n@keyframes p-overlay-mask-leave-animation {\n from {\n background: ").concat(dt2("mask.background"), ";\n }\n to {\n background: transparent;\n }\n}\n"); }, "theme"); @@ -21296,20 +46681,20 @@ var css$1 = /* @__PURE__ */ __name(function css2(_ref2) { var dt2 = _ref2.dt; return "\n.p-hidden-accessible {\n border: 0;\n clip: rect(0 0 0 0);\n height: 1px;\n margin: -1px;\n overflow: hidden;\n padding: 0;\n position: absolute;\n width: 1px;\n}\n\n.p-hidden-accessible input,\n.p-hidden-accessible select {\n transform: scale(0);\n}\n\n.p-overflow-hidden {\n overflow: hidden;\n padding-right: ".concat(dt2("scrollbar.width"), ";\n}\n"); }, "css"); -var classes$D = {}; +var classes$F = {}; var inlineStyles$4 = {}; var BaseStyle = { name: "base", css: css$1, - theme: theme$B, - classes: classes$D, + theme: theme$D, + classes: classes$F, inlineStyles: inlineStyles$4, load: /* @__PURE__ */ __name(function load(style2) { var options4 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; var transform2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : function(cs) { return cs; }; - var computedStyle = transform2(resolve$1(style2, { + var computedStyle = transform2(resolve$2(style2, { dt })); return computedStyle ? useStyle(minifyCSS(computedStyle), _objectSpread$i({ @@ -21346,13 +46731,13 @@ var BaseStyle = { var extendedCSS = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ""; var props = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; if (this.css) { - var _css = resolve$1(this.css, { + var _css = resolve$2(this.css, { dt }); var _style = minifyCSS("".concat(_css).concat(extendedCSS)); var _props = Object.entries(props).reduce(function(acc, _ref3) { - var _ref4 = _slicedToArray$4(_ref3, 2), k = _ref4[0], v2 = _ref4[1]; - return acc.push("".concat(k, '="').concat(v2, '"')) && acc; + var _ref4 = _slicedToArray$4(_ref3, 2), k2 = _ref4[0], v2 = _ref4[1]; + return acc.push("".concat(k2, '="').concat(v2, '"')) && acc; }, []).join(" "); return '<style type="text/css" data-primevue-style-id="'.concat(this.name, '" ').concat(_props, ">").concat(_style, "</style>"); } @@ -21367,13 +46752,13 @@ var BaseStyle = { var css3 = [config_default.getStyleSheet(this.name, params, props)]; if (this.theme) { var name2 = this.name === "base" ? "global-style" : "".concat(this.name, "-style"); - var _css = resolve$1(this.theme, { + var _css = resolve$2(this.theme, { dt }); var _style = minifyCSS(config_default.transformCSS(name2, _css)); var _props = Object.entries(props).reduce(function(acc, _ref5) { - var _ref6 = _slicedToArray$4(_ref5, 2), k = _ref6[0], v2 = _ref6[1]; - return acc.push("".concat(k, '="').concat(v2, '"')) && acc; + var _ref6 = _slicedToArray$4(_ref5, 2), k2 = _ref6[0], v2 = _ref6[1]; + return acc.push("".concat(k2, '="').concat(v2, '"')) && acc; }, []).join(" "); css3.push('<style type="text/css" data-primevue-style-id="'.concat(name2, '" ').concat(_props, ">").concat(_style, "</style>")); } @@ -21434,56 +46819,56 @@ function handler() { } __name(handler, "handler"); var ZIndex = handler(); -function _typeof$j(o) { +function _typeof$j(o2) { "@babel/helpers - typeof"; - return _typeof$j = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { - return typeof o2; - } : function(o2) { - return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; - }, _typeof$j(o); + return _typeof$j = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { + return typeof o3; + } : function(o3) { + return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; + }, _typeof$j(o2); } __name(_typeof$j, "_typeof$j"); -function ownKeys$h(e2, r) { +function ownKeys$h(e2, r2) { var t2 = Object.keys(e2); if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e2); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e2, r2).enumerable; - })), t2.push.apply(t2, o); + var o2 = Object.getOwnPropertySymbols(e2); + r2 && (o2 = o2.filter(function(r3) { + return Object.getOwnPropertyDescriptor(e2, r3).enumerable; + })), t2.push.apply(t2, o2); } return t2; } __name(ownKeys$h, "ownKeys$h"); function _objectSpread$h(e2) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$h(Object(t2), true).forEach(function(r2) { - _defineProperty$j(e2, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$h(Object(t2)).forEach(function(r2) { - Object.defineProperty(e2, r2, Object.getOwnPropertyDescriptor(t2, r2)); + for (var r2 = 1; r2 < arguments.length; r2++) { + var t2 = null != arguments[r2] ? arguments[r2] : {}; + r2 % 2 ? ownKeys$h(Object(t2), true).forEach(function(r3) { + _defineProperty$l(e2, r3, t2[r3]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$h(Object(t2)).forEach(function(r3) { + Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3)); }); } return e2; } __name(_objectSpread$h, "_objectSpread$h"); -function _defineProperty$j(e2, r, t2) { - return (r = _toPropertyKey$i(r)) in e2 ? Object.defineProperty(e2, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r] = t2, e2; +function _defineProperty$l(e2, r2, t2) { + return (r2 = _toPropertyKey$i(r2)) in e2 ? Object.defineProperty(e2, r2, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r2] = t2, e2; } -__name(_defineProperty$j, "_defineProperty$j"); +__name(_defineProperty$l, "_defineProperty$l"); function _toPropertyKey$i(t2) { var i2 = _toPrimitive$i(t2, "string"); return "symbol" == _typeof$j(i2) ? i2 : i2 + ""; } __name(_toPropertyKey$i, "_toPropertyKey$i"); -function _toPrimitive$i(t2, r) { +function _toPrimitive$i(t2, r2) { if ("object" != _typeof$j(t2) || !t2) return t2; var e2 = t2[Symbol.toPrimitive]; if (void 0 !== e2) { - var i2 = e2.call(t2, r || "default"); + var i2 = e2.call(t2, r2 || "default"); if ("object" != _typeof$j(i2)) return i2; throw new TypeError("@@toPrimitive must return a primitive value."); } - return ("string" === r ? String : Number)(t2); + return ("string" === r2 ? String : Number)(t2); } __name(_toPrimitive$i, "_toPrimitive$i"); var defaultOptions$2 = { @@ -21807,28 +47192,28 @@ var ToastService = { app2.provide(PrimeVueToastSymbol, ToastService2); }, "install") }; -function _typeof$1$2(o) { +function _typeof$1$2(o2) { "@babel/helpers - typeof"; - return _typeof$1$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { - return typeof o2; - } : function(o2) { - return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; - }, _typeof$1$2(o); + return _typeof$1$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { + return typeof o3; + } : function(o3) { + return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; + }, _typeof$1$2(o2); } __name(_typeof$1$2, "_typeof$1$2"); -function _classCallCheck$1(a, n) { - if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); +function _classCallCheck$1(a2, n2) { + if (!(a2 instanceof n2)) throw new TypeError("Cannot call a class as a function"); } __name(_classCallCheck$1, "_classCallCheck$1"); -function _defineProperties$1(e2, r) { - for (var t2 = 0; t2 < r.length; t2++) { - var o = r[t2]; - o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e2, _toPropertyKey$1$2(o.key), o); +function _defineProperties$1(e2, r2) { + for (var t2 = 0; t2 < r2.length; t2++) { + var o2 = r2[t2]; + o2.enumerable = o2.enumerable || false, o2.configurable = true, "value" in o2 && (o2.writable = true), Object.defineProperty(e2, _toPropertyKey$1$2(o2.key), o2); } } __name(_defineProperties$1, "_defineProperties$1"); -function _createClass$1(e2, r, t2) { - return r && _defineProperties$1(e2.prototype, r), Object.defineProperty(e2, "prototype", { writable: false }), e2; +function _createClass$1(e2, r2, t2) { + return r2 && _defineProperties$1(e2.prototype, r2), Object.defineProperty(e2, "prototype", { writable: false }), e2; } __name(_createClass$1, "_createClass$1"); function _toPropertyKey$1$2(t2) { @@ -21836,11 +47221,11 @@ function _toPropertyKey$1$2(t2) { return "symbol" == _typeof$1$2(i2) ? i2 : i2 + ""; } __name(_toPropertyKey$1$2, "_toPropertyKey$1$2"); -function _toPrimitive$1$2(t2, r) { +function _toPrimitive$1$2(t2, r2) { if ("object" != _typeof$1$2(t2) || !t2) return t2; var e2 = t2[Symbol.toPrimitive]; if (void 0 !== e2) { - var i2 = e2.call(t2, r); + var i2 = e2.call(t2, r2); if ("object" != _typeof$1$2(i2)) return i2; throw new TypeError("@@toPrimitive must return a primitive value."); } @@ -21883,74 +47268,74 @@ var ConnectedOverlayScrollHandler = /* @__PURE__ */ function() { }, "destroy") }]); }(); -function _typeof$i(o) { +function _typeof$i(o2) { "@babel/helpers - typeof"; - return _typeof$i = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { - return typeof o2; - } : function(o2) { - return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; - }, _typeof$i(o); + return _typeof$i = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { + return typeof o3; + } : function(o3) { + return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; + }, _typeof$i(o2); } __name(_typeof$i, "_typeof$i"); -function _toConsumableArray$c(r) { - return _arrayWithoutHoles$c(r) || _iterableToArray$d(r) || _unsupportedIterableToArray$h(r) || _nonIterableSpread$c(); +function _toConsumableArray$c(r2) { + return _arrayWithoutHoles$c(r2) || _iterableToArray$d(r2) || _unsupportedIterableToArray$h(r2) || _nonIterableSpread$c(); } __name(_toConsumableArray$c, "_toConsumableArray$c"); function _nonIterableSpread$c() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } __name(_nonIterableSpread$c, "_nonIterableSpread$c"); -function _unsupportedIterableToArray$h(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray$h(r, a); - var t2 = {}.toString.call(r).slice(8, -1); - return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$h(r, a) : void 0; +function _unsupportedIterableToArray$h(r2, a2) { + if (r2) { + if ("string" == typeof r2) return _arrayLikeToArray$h(r2, a2); + var t2 = {}.toString.call(r2).slice(8, -1); + return "Object" === t2 && r2.constructor && (t2 = r2.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r2) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$h(r2, a2) : void 0; } } __name(_unsupportedIterableToArray$h, "_unsupportedIterableToArray$h"); -function _iterableToArray$d(r) { - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); +function _iterableToArray$d(r2) { + if ("undefined" != typeof Symbol && null != r2[Symbol.iterator] || null != r2["@@iterator"]) return Array.from(r2); } __name(_iterableToArray$d, "_iterableToArray$d"); -function _arrayWithoutHoles$c(r) { - if (Array.isArray(r)) return _arrayLikeToArray$h(r); +function _arrayWithoutHoles$c(r2) { + if (Array.isArray(r2)) return _arrayLikeToArray$h(r2); } __name(_arrayWithoutHoles$c, "_arrayWithoutHoles$c"); -function _arrayLikeToArray$h(r, a) { - (null == a || a > r.length) && (a = r.length); - for (var e2 = 0, n = Array(a); e2 < a; e2++) n[e2] = r[e2]; - return n; +function _arrayLikeToArray$h(r2, a2) { + (null == a2 || a2 > r2.length) && (a2 = r2.length); + for (var e2 = 0, n2 = Array(a2); e2 < a2; e2++) n2[e2] = r2[e2]; + return n2; } __name(_arrayLikeToArray$h, "_arrayLikeToArray$h"); -function _classCallCheck(a, n) { - if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); +function _classCallCheck(a2, n2) { + if (!(a2 instanceof n2)) throw new TypeError("Cannot call a class as a function"); } __name(_classCallCheck, "_classCallCheck"); -function _defineProperties(e2, r) { - for (var t2 = 0; t2 < r.length; t2++) { - var o = r[t2]; - o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e2, _toPropertyKey$h(o.key), o); +function _defineProperties(e2, r2) { + for (var t2 = 0; t2 < r2.length; t2++) { + var o2 = r2[t2]; + o2.enumerable = o2.enumerable || false, o2.configurable = true, "value" in o2 && (o2.writable = true), Object.defineProperty(e2, _toPropertyKey$h(o2.key), o2); } } __name(_defineProperties, "_defineProperties"); -function _createClass(e2, r, t2) { - return r && _defineProperties(e2.prototype, r), Object.defineProperty(e2, "prototype", { writable: false }), e2; +function _createClass(e2, r2, t2) { + return r2 && _defineProperties(e2.prototype, r2), Object.defineProperty(e2, "prototype", { writable: false }), e2; } __name(_createClass, "_createClass"); -function _defineProperty$i(e2, r, t2) { - return (r = _toPropertyKey$h(r)) in e2 ? Object.defineProperty(e2, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r] = t2, e2; +function _defineProperty$k(e2, r2, t2) { + return (r2 = _toPropertyKey$h(r2)) in e2 ? Object.defineProperty(e2, r2, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r2] = t2, e2; } -__name(_defineProperty$i, "_defineProperty$i"); +__name(_defineProperty$k, "_defineProperty$k"); function _toPropertyKey$h(t2) { var i2 = _toPrimitive$h(t2, "string"); return "symbol" == _typeof$i(i2) ? i2 : i2 + ""; } __name(_toPropertyKey$h, "_toPropertyKey$h"); -function _toPrimitive$h(t2, r) { +function _toPrimitive$h(t2, r2) { if ("object" != _typeof$i(t2) || !t2) return t2; var e2 = t2[Symbol.toPrimitive]; if (void 0 !== e2) { - var i2 = e2.call(t2, r); + var i2 = e2.call(t2, r2); if ("object" != _typeof$i(i2)) return i2; throw new TypeError("@@toPrimitive must return a primitive value."); } @@ -21958,16 +47343,16 @@ function _toPrimitive$h(t2, r) { } __name(_toPrimitive$h, "_toPrimitive$h"); var _default = /* @__PURE__ */ function() { - function _default6(_ref) { + function _default7(_ref) { var init3 = _ref.init, type = _ref.type; - _classCallCheck(this, _default6); - _defineProperty$i(this, "helpers", void 0); - _defineProperty$i(this, "type", void 0); + _classCallCheck(this, _default7); + _defineProperty$k(this, "helpers", void 0); + _defineProperty$k(this, "type", void 0); this.helpers = new Set(init3); this.type = type; } - __name(_default6, "_default"); - return _createClass(_default6, [{ + __name(_default7, "_default"); + return _createClass(_default7, [{ key: "add", value: /* @__PURE__ */ __name(function add3(instance) { this.helpers.add(instance); @@ -22019,10 +47404,10 @@ var _default = /* @__PURE__ */ function() { } else if (child.type.name === _this.type) { components.push(child); } else if (isNotEmpty(child.key)) { - components = components.concat(helpers2.filter(function(c) { - return _this._isMatched(c, child.key); - }).map(function(c) { - return c.vnode; + components = components.concat(helpers2.filter(function(c2) { + return _this._isMatched(c2, child.key); + }).map(function(c2) { + return c2.vnode; })); } }); @@ -22065,107 +47450,107 @@ var Base = { this._loadedStyleNames.clear(); }, "clearLoadedStyleNames") }; -function _typeof$h(o) { +function _typeof$h(o2) { "@babel/helpers - typeof"; - return _typeof$h = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { - return typeof o2; - } : function(o2) { - return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; - }, _typeof$h(o); + return _typeof$h = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { + return typeof o3; + } : function(o3) { + return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; + }, _typeof$h(o2); } __name(_typeof$h, "_typeof$h"); -function _slicedToArray$3(r, e2) { - return _arrayWithHoles$3(r) || _iterableToArrayLimit$3(r, e2) || _unsupportedIterableToArray$g(r, e2) || _nonIterableRest$3(); +function _slicedToArray$3(r2, e2) { + return _arrayWithHoles$3(r2) || _iterableToArrayLimit$3(r2, e2) || _unsupportedIterableToArray$g(r2, e2) || _nonIterableRest$3(); } __name(_slicedToArray$3, "_slicedToArray$3"); function _nonIterableRest$3() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } __name(_nonIterableRest$3, "_nonIterableRest$3"); -function _unsupportedIterableToArray$g(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray$g(r, a); - var t2 = {}.toString.call(r).slice(8, -1); - return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$g(r, a) : void 0; +function _unsupportedIterableToArray$g(r2, a2) { + if (r2) { + if ("string" == typeof r2) return _arrayLikeToArray$g(r2, a2); + var t2 = {}.toString.call(r2).slice(8, -1); + return "Object" === t2 && r2.constructor && (t2 = r2.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r2) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$g(r2, a2) : void 0; } } __name(_unsupportedIterableToArray$g, "_unsupportedIterableToArray$g"); -function _arrayLikeToArray$g(r, a) { - (null == a || a > r.length) && (a = r.length); - for (var e2 = 0, n = Array(a); e2 < a; e2++) n[e2] = r[e2]; - return n; +function _arrayLikeToArray$g(r2, a2) { + (null == a2 || a2 > r2.length) && (a2 = r2.length); + for (var e2 = 0, n2 = Array(a2); e2 < a2; e2++) n2[e2] = r2[e2]; + return n2; } __name(_arrayLikeToArray$g, "_arrayLikeToArray$g"); -function _iterableToArrayLimit$3(r, l) { - var t2 = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; +function _iterableToArrayLimit$3(r2, l2) { + var t2 = null == r2 ? null : "undefined" != typeof Symbol && r2[Symbol.iterator] || r2["@@iterator"]; if (null != t2) { - var e2, n, i2, u, a = [], f = true, o = false; + var e2, n2, i2, u2, a2 = [], f2 = true, o2 = false; try { - if (i2 = (t2 = t2.call(r)).next, 0 === l) ; - else for (; !(f = (e2 = i2.call(t2)).done) && (a.push(e2.value), a.length !== l); f = true) ; - } catch (r2) { - o = true, n = r2; + if (i2 = (t2 = t2.call(r2)).next, 0 === l2) ; + else for (; !(f2 = (e2 = i2.call(t2)).done) && (a2.push(e2.value), a2.length !== l2); f2 = true) ; + } catch (r3) { + o2 = true, n2 = r3; } finally { try { - if (!f && null != t2["return"] && (u = t2["return"](), Object(u) !== u)) return; + if (!f2 && null != t2["return"] && (u2 = t2["return"](), Object(u2) !== u2)) return; } finally { - if (o) throw n; + if (o2) throw n2; } } - return a; + return a2; } } __name(_iterableToArrayLimit$3, "_iterableToArrayLimit$3"); -function _arrayWithHoles$3(r) { - if (Array.isArray(r)) return r; +function _arrayWithHoles$3(r2) { + if (Array.isArray(r2)) return r2; } __name(_arrayWithHoles$3, "_arrayWithHoles$3"); -function ownKeys$g(e2, r) { +function ownKeys$g(e2, r2) { var t2 = Object.keys(e2); if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e2); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e2, r2).enumerable; - })), t2.push.apply(t2, o); + var o2 = Object.getOwnPropertySymbols(e2); + r2 && (o2 = o2.filter(function(r3) { + return Object.getOwnPropertyDescriptor(e2, r3).enumerable; + })), t2.push.apply(t2, o2); } return t2; } __name(ownKeys$g, "ownKeys$g"); function _objectSpread$g(e2) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$g(Object(t2), true).forEach(function(r2) { - _defineProperty$h(e2, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$g(Object(t2)).forEach(function(r2) { - Object.defineProperty(e2, r2, Object.getOwnPropertyDescriptor(t2, r2)); + for (var r2 = 1; r2 < arguments.length; r2++) { + var t2 = null != arguments[r2] ? arguments[r2] : {}; + r2 % 2 ? ownKeys$g(Object(t2), true).forEach(function(r3) { + _defineProperty$j(e2, r3, t2[r3]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$g(Object(t2)).forEach(function(r3) { + Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3)); }); } return e2; } __name(_objectSpread$g, "_objectSpread$g"); -function _defineProperty$h(e2, r, t2) { - return (r = _toPropertyKey$g(r)) in e2 ? Object.defineProperty(e2, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r] = t2, e2; +function _defineProperty$j(e2, r2, t2) { + return (r2 = _toPropertyKey$g(r2)) in e2 ? Object.defineProperty(e2, r2, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r2] = t2, e2; } -__name(_defineProperty$h, "_defineProperty$h"); +__name(_defineProperty$j, "_defineProperty$j"); function _toPropertyKey$g(t2) { var i2 = _toPrimitive$g(t2, "string"); return "symbol" == _typeof$h(i2) ? i2 : i2 + ""; } __name(_toPropertyKey$g, "_toPropertyKey$g"); -function _toPrimitive$g(t2, r) { +function _toPrimitive$g(t2, r2) { if ("object" != _typeof$h(t2) || !t2) return t2; var e2 = t2[Symbol.toPrimitive]; if (void 0 !== e2) { - var i2 = e2.call(t2, r || "default"); + var i2 = e2.call(t2, r2 || "default"); if ("object" != _typeof$h(i2)) return i2; throw new TypeError("@@toPrimitive must return a primitive value."); } - return ("string" === r ? String : Number)(t2); + return ("string" === r2 ? String : Number)(t2); } __name(_toPrimitive$g, "_toPrimitive$g"); var BaseDirective = { _getMeta: /* @__PURE__ */ __name(function _getMeta() { - return [isObject$7(arguments.length <= 0 ? void 0 : arguments[0]) ? void 0 : arguments.length <= 0 ? void 0 : arguments[0], resolve$1(isObject$7(arguments.length <= 0 ? void 0 : arguments[0]) ? arguments.length <= 0 ? void 0 : arguments[0] : arguments.length <= 1 ? void 0 : arguments[1])]; + return [isObject$e(arguments.length <= 0 ? void 0 : arguments[0]) ? void 0 : arguments.length <= 0 ? void 0 : arguments[0], resolve$2(isObject$e(arguments.length <= 0 ? void 0 : arguments[0]) ? arguments.length <= 0 ? void 0 : arguments[0] : arguments.length <= 1 ? void 0 : arguments[1])]; }, "_getMeta"), _getConfig: /* @__PURE__ */ __name(function _getConfig(binding, vnode) { var _ref, _binding$instance, _vnode$ctx; @@ -22181,7 +47566,7 @@ var BaseDirective = { var searchInDefaultPT = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : true; var getValue2 = /* @__PURE__ */ __name(function getValue3() { var value4 = BaseDirective._getOptionValue.apply(BaseDirective, arguments); - return isString$8(value4) || isArray$5(value4) ? { + return isString$9(value4) || isArray$a(value4) ? { "class": value4 } : value4; }, "getValue"); @@ -22197,7 +47582,7 @@ var BaseDirective = { var instance = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; var key = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ""; var datasetPrefix = "data-pc-"; - return _objectSpread$g(_objectSpread$g({}, key === "root" && _defineProperty$h({}, "".concat(datasetPrefix, "name"), toFlatCase(instance.$name))), {}, _defineProperty$h({}, "".concat(datasetPrefix, "section"), toFlatCase(key))); + return _objectSpread$g(_objectSpread$g({}, key === "root" && _defineProperty$j({}, "".concat(datasetPrefix, "name"), toFlatCase(instance.$name))), {}, _defineProperty$j({}, "".concat(datasetPrefix, "section"), toFlatCase(key))); }, "_getPTDatasets"), _getPT: /* @__PURE__ */ __name(function _getPT(pt) { var key = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ""; @@ -22229,8 +47614,8 @@ var BaseDirective = { var originalValue = fn(pt.originalValue); var value4 = fn(pt.value); if (originalValue === void 0 && value4 === void 0) return void 0; - else if (isString$8(value4)) return value4; - else if (isString$8(originalValue)) return originalValue; + else if (isString$9(value4)) return value4; + else if (isString$9(originalValue)) return originalValue; return mergeSections || !mergeSections && value4 ? useMergeProps ? BaseDirective._mergeProps(instance, useMergeProps, originalValue, value4) : _objectSpread$g(_objectSpread$g({}, originalValue), value4) : value4; } return fn(pt); @@ -22347,7 +47732,7 @@ var BaseDirective = { for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key2 = 2; _key2 < _len; _key2++) { args[_key2 - 2] = arguments[_key2]; } - return isFunction$5(fn) ? fn.apply(void 0, args) : mergeProps.apply(void 0, args); + return isFunction$9(fn) ? fn.apply(void 0, args) : mergeProps.apply(void 0, args); }, "_mergeProps"), _extend: /* @__PURE__ */ __name(function _extend(name2) { var options4 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; @@ -22388,7 +47773,7 @@ var BaseDirective = { var _el$$instance, _el$$instance2; return ((_el$$instance = el.$instance) === null || _el$$instance === void 0 || (_el$$instance = _el$$instance.$binding) === null || _el$$instance === void 0 || (_el$$instance = _el$$instance.value) === null || _el$$instance === void 0 ? void 0 : _el$$instance.unstyled) !== void 0 ? (_el$$instance2 = el.$instance) === null || _el$$instance2 === void 0 || (_el$$instance2 = _el$$instance2.$binding) === null || _el$$instance2 === void 0 || (_el$$instance2 = _el$$instance2.value) === null || _el$$instance2 === void 0 ? void 0 : _el$$instance2.unstyled : config2 === null || config2 === void 0 ? void 0 : config2.unstyled; }, "isUnstyled"), - theme: /* @__PURE__ */ __name(function theme40() { + theme: /* @__PURE__ */ __name(function theme42() { var _el$$instance3; return (_el$$instance3 = el.$instance) === null || _el$$instance3 === void 0 || (_el$$instance3 = _el$$instance3.$primevueConfig) === null || _el$$instance3 === void 0 ? void 0 : _el$$instance3.theme; }, "theme"), @@ -22459,14 +47844,14 @@ var BaseDirective = { handleHook("beforeMount", el, binding, vnode, prevVnode); handleWatch(el); }, "beforeMount"), - mounted: /* @__PURE__ */ __name(function mounted23(el, binding, vnode, prevVnode) { + mounted: /* @__PURE__ */ __name(function mounted25(el, binding, vnode, prevVnode) { BaseDirective._loadStyles(el, binding, vnode); handleHook("mounted", el, binding, vnode, prevVnode); }, "mounted"), beforeUpdate: /* @__PURE__ */ __name(function beforeUpdate2(el, binding, vnode, prevVnode) { handleHook("beforeUpdate", el, binding, vnode, prevVnode); }, "beforeUpdate"), - updated: /* @__PURE__ */ __name(function updated13(el, binding, vnode, prevVnode) { + updated: /* @__PURE__ */ __name(function updated14(el, binding, vnode, prevVnode) { BaseDirective._loadStyles(el, binding, vnode); handleHook("updated", el, binding, vnode, prevVnode); }, "updated"), @@ -22490,96 +47875,96 @@ var BaseDirective = { }, BaseDirective._extend(name2, options4)); }, "extend") }; -var theme$A = /* @__PURE__ */ __name(function theme3(_ref) { +var theme$C = /* @__PURE__ */ __name(function theme3(_ref) { var dt2 = _ref.dt; return "\n.p-tooltip {\n position: absolute;\n display: none;\n max-width: ".concat(dt2("tooltip.max.width"), ";\n}\n\n.p-tooltip-right,\n.p-tooltip-left {\n padding: 0 ").concat(dt2("tooltip.gutter"), ";\n}\n\n.p-tooltip-top,\n.p-tooltip-bottom {\n padding: ").concat(dt2("tooltip.gutter"), " 0;\n}\n\n.p-tooltip-text {\n white-space: pre-line;\n word-break: break-word;\n background: ").concat(dt2("tooltip.background"), ";\n color: ").concat(dt2("tooltip.color"), ";\n padding: ").concat(dt2("tooltip.padding"), ";\n box-shadow: ").concat(dt2("tooltip.shadow"), ";\n border-radius: ").concat(dt2("tooltip.border.radius"), ";\n}\n\n.p-tooltip-arrow {\n position: absolute;\n width: 0;\n height: 0;\n border-color: transparent;\n border-style: solid;\n scale: 2;\n}\n\n.p-tooltip-right .p-tooltip-arrow {\n margin-top: calc(-1 * ").concat(dt2("tooltip.gutter"), ");\n border-width: ").concat(dt2("tooltip.gutter"), " ").concat(dt2("tooltip.gutter"), " ").concat(dt2("tooltip.gutter"), " 0;\n border-right-color: ").concat(dt2("tooltip.background"), ";\n}\n\n.p-tooltip-left .p-tooltip-arrow {\n margin-top: calc(-1 * ").concat(dt2("tooltip.gutter"), ");\n border-width: ").concat(dt2("tooltip.gutter"), " 0 ").concat(dt2("tooltip.gutter"), " ").concat(dt2("tooltip.gutter"), ";\n border-left-color: ").concat(dt2("tooltip.background"), ";\n}\n\n.p-tooltip-top .p-tooltip-arrow {\n margin-left: calc(-1 * ").concat(dt2("tooltip.gutter"), ");\n border-width: ").concat(dt2("tooltip.gutter"), " ").concat(dt2("tooltip.gutter"), " 0 ").concat(dt2("tooltip.gutter"), ";\n border-top-color: ").concat(dt2("tooltip.background"), ";\n border-bottom-color: ").concat(dt2("tooltip.background"), ";\n}\n\n.p-tooltip-bottom .p-tooltip-arrow {\n margin-left: calc(-1 * ").concat(dt2("tooltip.gutter"), ");\n border-width: 0 ").concat(dt2("tooltip.gutter"), " ").concat(dt2("tooltip.gutter"), " ").concat(dt2("tooltip.gutter"), ";\n border-top-color: ").concat(dt2("tooltip.background"), ";\n border-bottom-color: ").concat(dt2("tooltip.background"), ";\n}\n"); }, "theme"); -var classes$C = { +var classes$E = { root: "p-tooltip p-component", arrow: "p-tooltip-arrow", text: "p-tooltip-text" }; var TooltipStyle = BaseStyle.extend({ name: "tooltip-directive", - theme: theme$A, - classes: classes$C + theme: theme$C, + classes: classes$E }); var BaseTooltip = BaseDirective.extend({ style: TooltipStyle }); -function _slicedToArray$2(r, e2) { - return _arrayWithHoles$2(r) || _iterableToArrayLimit$2(r, e2) || _unsupportedIterableToArray$f(r, e2) || _nonIterableRest$2(); +function _slicedToArray$2(r2, e2) { + return _arrayWithHoles$2(r2) || _iterableToArrayLimit$2(r2, e2) || _unsupportedIterableToArray$f(r2, e2) || _nonIterableRest$2(); } __name(_slicedToArray$2, "_slicedToArray$2"); function _nonIterableRest$2() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } __name(_nonIterableRest$2, "_nonIterableRest$2"); -function _unsupportedIterableToArray$f(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray$f(r, a); - var t2 = {}.toString.call(r).slice(8, -1); - return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$f(r, a) : void 0; +function _unsupportedIterableToArray$f(r2, a2) { + if (r2) { + if ("string" == typeof r2) return _arrayLikeToArray$f(r2, a2); + var t2 = {}.toString.call(r2).slice(8, -1); + return "Object" === t2 && r2.constructor && (t2 = r2.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r2) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$f(r2, a2) : void 0; } } __name(_unsupportedIterableToArray$f, "_unsupportedIterableToArray$f"); -function _arrayLikeToArray$f(r, a) { - (null == a || a > r.length) && (a = r.length); - for (var e2 = 0, n = Array(a); e2 < a; e2++) n[e2] = r[e2]; - return n; +function _arrayLikeToArray$f(r2, a2) { + (null == a2 || a2 > r2.length) && (a2 = r2.length); + for (var e2 = 0, n2 = Array(a2); e2 < a2; e2++) n2[e2] = r2[e2]; + return n2; } __name(_arrayLikeToArray$f, "_arrayLikeToArray$f"); -function _iterableToArrayLimit$2(r, l) { - var t2 = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; +function _iterableToArrayLimit$2(r2, l2) { + var t2 = null == r2 ? null : "undefined" != typeof Symbol && r2[Symbol.iterator] || r2["@@iterator"]; if (null != t2) { - var e2, n, i2, u, a = [], f = true, o = false; + var e2, n2, i2, u2, a2 = [], f2 = true, o2 = false; try { - if (i2 = (t2 = t2.call(r)).next, 0 === l) ; - else for (; !(f = (e2 = i2.call(t2)).done) && (a.push(e2.value), a.length !== l); f = true) ; - } catch (r2) { - o = true, n = r2; + if (i2 = (t2 = t2.call(r2)).next, 0 === l2) ; + else for (; !(f2 = (e2 = i2.call(t2)).done) && (a2.push(e2.value), a2.length !== l2); f2 = true) ; + } catch (r3) { + o2 = true, n2 = r3; } finally { try { - if (!f && null != t2["return"] && (u = t2["return"](), Object(u) !== u)) return; + if (!f2 && null != t2["return"] && (u2 = t2["return"](), Object(u2) !== u2)) return; } finally { - if (o) throw n; + if (o2) throw n2; } } - return a; + return a2; } } __name(_iterableToArrayLimit$2, "_iterableToArrayLimit$2"); -function _arrayWithHoles$2(r) { - if (Array.isArray(r)) return r; +function _arrayWithHoles$2(r2) { + if (Array.isArray(r2)) return r2; } __name(_arrayWithHoles$2, "_arrayWithHoles$2"); -function _defineProperty$g(e2, r, t2) { - return (r = _toPropertyKey$f(r)) in e2 ? Object.defineProperty(e2, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r] = t2, e2; +function _defineProperty$i(e2, r2, t2) { + return (r2 = _toPropertyKey$f(r2)) in e2 ? Object.defineProperty(e2, r2, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r2] = t2, e2; } -__name(_defineProperty$g, "_defineProperty$g"); +__name(_defineProperty$i, "_defineProperty$i"); function _toPropertyKey$f(t2) { var i2 = _toPrimitive$f(t2, "string"); return "symbol" == _typeof$g(i2) ? i2 : i2 + ""; } __name(_toPropertyKey$f, "_toPropertyKey$f"); -function _toPrimitive$f(t2, r) { +function _toPrimitive$f(t2, r2) { if ("object" != _typeof$g(t2) || !t2) return t2; var e2 = t2[Symbol.toPrimitive]; if (void 0 !== e2) { - var i2 = e2.call(t2, r || "default"); + var i2 = e2.call(t2, r2 || "default"); if ("object" != _typeof$g(i2)) return i2; throw new TypeError("@@toPrimitive must return a primitive value."); } - return ("string" === r ? String : Number)(t2); + return ("string" === r2 ? String : Number)(t2); } __name(_toPrimitive$f, "_toPrimitive$f"); -function _typeof$g(o) { +function _typeof$g(o2) { "@babel/helpers - typeof"; - return _typeof$g = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { - return typeof o2; - } : function(o2) { - return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; - }, _typeof$g(o); + return _typeof$g = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { + return typeof o3; + } : function(o3) { + return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; + }, _typeof$g(o2); } __name(_typeof$g, "_typeof$g"); var Tooltip = BaseTooltip.extend("tooltip", { @@ -22814,7 +48199,7 @@ var Tooltip = BaseTooltip.extend("tooltip", { tooltipText.innerHTML = ""; tooltipText.appendChild(document.createTextNode(el.$_ptooltipValue)); } - var container = createElement("div", _defineProperty$g(_defineProperty$g({ + var container = createElement("div", _defineProperty$i(_defineProperty$i({ id: el.$_ptooltipIdAttr, role: "tooltip", style: { @@ -23064,14 +48449,14 @@ function applyToParams(fn, params) { const newParams = {}; for (const key in params) { const value4 = params[key]; - newParams[key] = isArray$3(value4) ? value4.map(fn) : fn(value4); + newParams[key] = isArray$8(value4) ? value4.map(fn) : fn(value4); } return newParams; } __name(applyToParams, "applyToParams"); const noop$3 = /* @__PURE__ */ __name(() => { }, "noop$3"); -const isArray$3 = Array.isArray; +const isArray$8 = Array.isArray; function warn$2(msg) { const args = Array.from(arguments).slice(1); console.warn.apply(console, ["[Vue Router warn]: " + msg].concat(args)); @@ -23161,32 +48546,32 @@ function stripBase(pathname, base2) { return pathname.slice(base2.length) || "/"; } __name(stripBase, "stripBase"); -function isSameRouteLocation(stringifyQuery2, a, b) { - const aLastIndex = a.matched.length - 1; - const bLastIndex = b.matched.length - 1; - return aLastIndex > -1 && aLastIndex === bLastIndex && isSameRouteRecord(a.matched[aLastIndex], b.matched[bLastIndex]) && isSameRouteLocationParams(a.params, b.params) && stringifyQuery2(a.query) === stringifyQuery2(b.query) && a.hash === b.hash; +function isSameRouteLocation(stringifyQuery2, a2, b2) { + const aLastIndex = a2.matched.length - 1; + const bLastIndex = b2.matched.length - 1; + return aLastIndex > -1 && aLastIndex === bLastIndex && isSameRouteRecord(a2.matched[aLastIndex], b2.matched[bLastIndex]) && isSameRouteLocationParams(a2.params, b2.params) && stringifyQuery2(a2.query) === stringifyQuery2(b2.query) && a2.hash === b2.hash; } __name(isSameRouteLocation, "isSameRouteLocation"); -function isSameRouteRecord(a, b) { - return (a.aliasOf || a) === (b.aliasOf || b); +function isSameRouteRecord(a2, b2) { + return (a2.aliasOf || a2) === (b2.aliasOf || b2); } __name(isSameRouteRecord, "isSameRouteRecord"); -function isSameRouteLocationParams(a, b) { - if (Object.keys(a).length !== Object.keys(b).length) +function isSameRouteLocationParams(a2, b2) { + if (Object.keys(a2).length !== Object.keys(b2).length) return false; - for (const key in a) { - if (!isSameRouteLocationParamsValue(a[key], b[key])) + for (const key in a2) { + if (!isSameRouteLocationParamsValue(a2[key], b2[key])) return false; } return true; } __name(isSameRouteLocationParams, "isSameRouteLocationParams"); -function isSameRouteLocationParamsValue(a, b) { - return isArray$3(a) ? isEquivalentArray(a, b) : isArray$3(b) ? isEquivalentArray(b, a) : a === b; +function isSameRouteLocationParamsValue(a2, b2) { + return isArray$8(a2) ? isEquivalentArray(a2, b2) : isArray$8(b2) ? isEquivalentArray(b2, a2) : a2 === b2; } __name(isSameRouteLocationParamsValue, "isSameRouteLocationParamsValue"); -function isEquivalentArray(a, b) { - return isArray$3(b) ? a.length === b.length && a.every((value4, i2) => value4 === b[i2]) : a.length === 1 && a[0] === b; +function isEquivalentArray(a2, b2) { + return isArray$8(b2) ? a2.length === b2.length && a2.every((value4, i2) => value4 === b2[i2]) : a2.length === 1 && a2[0] === b2; } __name(isEquivalentArray, "isEquivalentArray"); function resolveRelativePath(to, from2) { @@ -23458,19 +48843,19 @@ function useHistoryStateNavigation(base2) { } } __name(changeLocation, "changeLocation"); - function replace2(to, data24) { + function replace2(to, data25) { const state = assign$5({}, history2.state, buildState( historyState.value.back, // keep back and forward entries but override current position to, historyState.value.forward, true - ), data24, { position: historyState.value.position }); + ), data25, { position: historyState.value.position }); changeLocation(to, state, true); currentLocation.value = to; } __name(replace2, "replace"); - function push(to, data24) { + function push2(to, data25) { const currentState = assign$5( {}, // use current history state to gracefully handle a wrong call to @@ -23491,15 +48876,15 @@ history.replaceState(history.state, '', url) You can find more information at https://router.vuejs.org/guide/migration/#Usage-of-history-state`); } changeLocation(currentState.current, currentState, true); - const state = assign$5({}, buildState(currentLocation.value, to, null), { position: currentState.position + 1 }, data24); + const state = assign$5({}, buildState(currentLocation.value, to, null), { position: currentState.position + 1 }, data25); changeLocation(to, state, false); currentLocation.value = to; } - __name(push, "push"); + __name(push2, "push"); return { location: currentLocation, state: historyState, - push, + push: push2, replace: replace2 }; } @@ -23567,7 +48952,7 @@ function createMemoryHistory(base2 = "") { queue2.splice(position3--, 1); setLocation(to); }, - push(to, data24) { + push(to, data25) { setLocation(to); }, listen(callback) { @@ -23799,10 +49184,10 @@ function tokensToParser(segments, extraOptions) { } else if (token.type === 1) { const { value: value4, repeatable, optional } = token; const param = value4 in params ? params[value4] : ""; - if (isArray$3(param) && !repeatable) { + if (isArray$8(param) && !repeatable) { throw new Error(`Provided param "${value4}" is an array but it is not repeatable (* or + modifiers)`); } - const text2 = isArray$3(param) ? param.join("/") : param; + const text2 = isArray$8(param) ? param.join("/") : param; if (!text2) { if (optional) { if (segment.length < 2) { @@ -23830,26 +49215,26 @@ function tokensToParser(segments, extraOptions) { }; } __name(tokensToParser, "tokensToParser"); -function compareScoreArray(a, b) { +function compareScoreArray(a2, b2) { let i2 = 0; - while (i2 < a.length && i2 < b.length) { - const diff2 = b[i2] - a[i2]; + while (i2 < a2.length && i2 < b2.length) { + const diff2 = b2[i2] - a2[i2]; if (diff2) return diff2; i2++; } - if (a.length < b.length) { - return a.length === 1 && a[0] === 40 + 40 ? -1 : 1; - } else if (a.length > b.length) { - return b.length === 1 && b[0] === 40 + 40 ? 1 : -1; + if (a2.length < b2.length) { + return a2.length === 1 && a2[0] === 40 + 40 ? -1 : 1; + } else if (a2.length > b2.length) { + return b2.length === 1 && b2[0] === 40 + 40 ? 1 : -1; } return 0; } __name(compareScoreArray, "compareScoreArray"); -function comparePathParserScore(a, b) { +function comparePathParserScore(a2, b2) { let i2 = 0; - const aScore = a.score; - const bScore = b.score; + const aScore = a2.score; + const bScore = b2.score; while (i2 < aScore.length && i2 < bScore.length) { const comp = compareScoreArray(aScore[i2], bScore[i2]); if (comp) @@ -23995,18 +49380,18 @@ function tokenizePath(path) { return tokens; } __name(tokenizePath, "tokenizePath"); -function createRouteRecordMatcher(record, parent, options4) { - const parser = tokensToParser(tokenizePath(record.path), options4); +function createRouteRecordMatcher(record2, parent, options4) { + const parser = tokensToParser(tokenizePath(record2.path), options4); if (false) { const existingKeys = /* @__PURE__ */ new Set(); for (const key of parser.keys) { if (existingKeys.has(key.name)) - warn$2(`Found duplicated params with name "${key.name}" for path "${record.path}". Only the last one will be available on "$route.params".`); + warn$2(`Found duplicated params with name "${key.name}" for path "${record2.path}". Only the last one will be available on "$route.params".`); existingKeys.add(key.name); } } const matcher = assign$5(parser, { - record, + record: record2, parent, // these needs to be populated by the parent children: [], @@ -24027,19 +49412,19 @@ function createRouterMatcher(routes, globalOptions) { return matcherMap.get(name2); } __name(getRecordMatcher, "getRecordMatcher"); - function addRoute(record, parent, originalRecord) { + function addRoute(record2, parent, originalRecord) { const isRootAdd = !originalRecord; - const mainNormalizedRecord = normalizeRouteRecord(record); + const mainNormalizedRecord = normalizeRouteRecord(record2); if (false) { checkChildMissingNameWithEmptyPath(mainNormalizedRecord, parent); } mainNormalizedRecord.aliasOf = originalRecord && originalRecord.record; - const options4 = mergeOptions(globalOptions, record); + const options4 = mergeOptions(globalOptions, record2); const normalizedRecords = [ mainNormalizedRecord ]; - if ("alias" in record) { - const aliases = typeof record.alias === "string" ? [record.alias] : record.alias; + if ("alias" in record2) { + const aliases = typeof record2.alias === "string" ? [record2.alias] : record2.alias; for (const alias of aliases) { normalizedRecords.push(assign$5({}, mainNormalizedRecord, { // this allows us to hold a copy of the `components` option @@ -24077,8 +49462,8 @@ function createRouterMatcher(routes, globalOptions) { originalMatcher = originalMatcher || matcher; if (originalMatcher !== matcher) originalMatcher.alias.push(matcher); - if (isRootAdd && record.name && !isAliasRecord(matcher)) - removeRoute(record.name); + if (isRootAdd && record2.name && !isAliasRecord(matcher)) + removeRoute(record2.name); } if (isMatchable(matcher)) { insertMatcher(matcher); @@ -24140,7 +49525,7 @@ function createRouterMatcher(routes, globalOptions) { location: location2 }); if (false) { - const invalidParams = Object.keys(location2.params || {}).filter((paramName) => !matcher.keys.find((k) => k.name === paramName)); + const invalidParams = Object.keys(location2.params || {}).filter((paramName) => !matcher.keys.find((k2) => k2.name === paramName)); if (invalidParams.length) { warn$2(`Discarded invalid param(s) "${invalidParams.join('", "')}" when navigating. See https://github.com/vuejs/router/blob/main/packages/router/CHANGELOG.md#414-2022-08-22 for more details.`); } @@ -24152,11 +49537,11 @@ function createRouterMatcher(routes, globalOptions) { currentLocation.params, // only keep params that exist in the resolved location // only keep optional params coming from a parent record - matcher.keys.filter((k) => !k.optional).concat(matcher.parent ? matcher.parent.keys.filter((k) => k.optional) : []).map((k) => k.name) + matcher.keys.filter((k2) => !k2.optional).concat(matcher.parent ? matcher.parent.keys.filter((k2) => k2.optional) : []).map((k2) => k2.name) ), // discard any existing params in the current location that do not exist here // #1497 this ensures better active/exact matching - location2.params && paramsFromLocation(location2.params, matcher.keys.map((k) => k.name)) + location2.params && paramsFromLocation(location2.params, matcher.keys.map((k2) => k2.name)) ); path = matcher.stringify(params); } else if (location2.path != null) { @@ -24164,13 +49549,13 @@ function createRouterMatcher(routes, globalOptions) { if (false) { warn$2(`The Matcher cannot resolve relative paths but received "${path}". Unless you directly called \`matcher.resolve("${path}")\`, this is probably a bug in vue-router. Please open an issue at https://github.com/vuejs/router/issues/new/choose.`); } - matcher = matchers.find((m) => m.re.test(path)); + matcher = matchers.find((m2) => m2.re.test(path)); if (matcher) { params = matcher.parse(path); name2 = matcher.record.name; } } else { - matcher = currentLocation.name ? matcherMap.get(currentLocation.name) : matchers.find((m) => m.re.test(currentLocation.path)); + matcher = currentLocation.name ? matcherMap.get(currentLocation.name) : matchers.find((m2) => m2.re.test(currentLocation.path)); if (!matcher) throw createRouterError(1, { location: location2, @@ -24220,47 +49605,47 @@ function paramsFromLocation(params, keys2) { return newParams; } __name(paramsFromLocation, "paramsFromLocation"); -function normalizeRouteRecord(record) { +function normalizeRouteRecord(record2) { return { - path: record.path, - redirect: record.redirect, - name: record.name, - meta: record.meta || {}, + path: record2.path, + redirect: record2.redirect, + name: record2.name, + meta: record2.meta || {}, aliasOf: void 0, - beforeEnter: record.beforeEnter, - props: normalizeRecordProps(record), - children: record.children || [], + beforeEnter: record2.beforeEnter, + props: normalizeRecordProps(record2), + children: record2.children || [], instances: {}, leaveGuards: /* @__PURE__ */ new Set(), updateGuards: /* @__PURE__ */ new Set(), enterCallbacks: {}, - components: "components" in record ? record.components || null : record.component && { default: record.component } + components: "components" in record2 ? record2.components || null : record2.component && { default: record2.component } }; } __name(normalizeRouteRecord, "normalizeRouteRecord"); -function normalizeRecordProps(record) { +function normalizeRecordProps(record2) { const propsObject = {}; - const props = record.props || false; - if ("component" in record) { + const props = record2.props || false; + if ("component" in record2) { propsObject.default = props; } else { - for (const name2 in record.components) + for (const name2 in record2.components) propsObject[name2] = typeof props === "object" ? props[name2] : props; } return propsObject; } __name(normalizeRecordProps, "normalizeRecordProps"); -function isAliasRecord(record) { - while (record) { - if (record.record.aliasOf) +function isAliasRecord(record2) { + while (record2) { + if (record2.record.aliasOf) return true; - record = record.parent; + record2 = record2.parent; } return false; } __name(isAliasRecord, "isAliasRecord"); function mergeMetaFields(matched) { - return matched.reduce((meta, record) => assign$5(meta, record.meta), {}); + return matched.reduce((meta, record2) => assign$5(meta, record2.meta), {}); } __name(mergeMetaFields, "mergeMetaFields"); function mergeOptions(defaults2, partialOptions) { @@ -24271,18 +49656,18 @@ function mergeOptions(defaults2, partialOptions) { return options4; } __name(mergeOptions, "mergeOptions"); -function isSameParam(a, b) { - return a.name === b.name && a.optional === b.optional && a.repeatable === b.repeatable; +function isSameParam(a2, b2) { + return a2.name === b2.name && a2.optional === b2.optional && a2.repeatable === b2.repeatable; } __name(isSameParam, "isSameParam"); -function checkSameParams(a, b) { - for (const key of a.keys) { - if (!key.optional && !b.keys.find(isSameParam.bind(null, key))) - return warn$2(`Alias "${b.record.path}" and the original record: "${a.record.path}" must have the exact same param named "${key.name}"`); +function checkSameParams(a2, b2) { + for (const key of a2.keys) { + if (!key.optional && !b2.keys.find(isSameParam.bind(null, key))) + return warn$2(`Alias "${b2.record.path}" and the original record: "${a2.record.path}" must have the exact same param named "${key.name}"`); } - for (const key of b.keys) { - if (!key.optional && !a.keys.find(isSameParam.bind(null, key))) - return warn$2(`Alias "${b.record.path}" and the original record: "${a.record.path}" must have the exact same param named "${key.name}"`); + for (const key of b2.keys) { + if (!key.optional && !a2.keys.find(isSameParam.bind(null, key))) + return warn$2(`Alias "${b2.record.path}" and the original record: "${a2.record.path}" must have the exact same param named "${key.name}"`); } } __name(checkSameParams, "checkSameParams"); @@ -24292,10 +49677,10 @@ function checkChildMissingNameWithEmptyPath(mainNormalizedRecord, parent) { } } __name(checkChildMissingNameWithEmptyPath, "checkChildMissingNameWithEmptyPath"); -function checkMissingParamsInAbsolutePath(record, parent) { +function checkMissingParamsInAbsolutePath(record2, parent) { for (const key of parent.keys) { - if (!record.keys.find(isSameParam.bind(null, key))) - return warn$2(`Absolute path "${record.record.path}" must have the exact same param named "${key.name}" as its parent "${parent.record.path}".`); + if (!record2.keys.find(isSameParam.bind(null, key))) + return warn$2(`Absolute path "${record2.record.path}" must have the exact same param named "${key.name}" as its parent "${parent.record.path}".`); } } __name(checkMissingParamsInAbsolutePath, "checkMissingParamsInAbsolutePath"); @@ -24331,8 +49716,8 @@ function getInsertionAncestor(matcher) { return; } __name(getInsertionAncestor, "getInsertionAncestor"); -function isMatchable({ record }) { - return !!(record.name || record.components && Object.keys(record.components).length || record.redirect); +function isMatchable({ record: record2 }) { + return !!(record2.name || record2.components && Object.keys(record2.components).length || record2.redirect); } __name(isMatchable, "isMatchable"); function parseQuery$1(search2) { @@ -24348,7 +49733,7 @@ function parseQuery$1(search2) { const value4 = eqPos < 0 ? null : decode$3(searchParam.slice(eqPos + 1)); if (key in query) { let currentValue = query[key]; - if (!isArray$3(currentValue)) { + if (!isArray$8(currentValue)) { currentValue = query[key] = [currentValue]; } currentValue.push(value4); @@ -24370,7 +49755,7 @@ function stringifyQuery(query) { } continue; } - const values = isArray$3(value4) ? value4.map((v2) => v2 && encodeQueryValue(v2)) : [value4 && encodeQueryValue(value4)]; + const values = isArray$8(value4) ? value4.map((v2) => v2 && encodeQueryValue(v2)) : [value4 && encodeQueryValue(value4)]; values.forEach((value22) => { if (value22 !== void 0) { search2 += (search2.length ? "&" : "") + key; @@ -24387,7 +49772,7 @@ function normalizeQuery(query) { for (const key in query) { const value4 = query[key]; if (value4 !== void 0) { - normalizedQuery[key] = isArray$3(value4) ? value4.map((v2) => v2 == null ? null : "" + v2) : value4 == null ? value4 : "" + value4; + normalizedQuery[key] = isArray$8(value4) ? value4.map((v2) => v2 == null ? null : "" + v2) : value4 == null ? value4 : "" + value4; } } return normalizedQuery; @@ -24420,16 +49805,16 @@ function useCallbacks() { }; } __name(useCallbacks, "useCallbacks"); -function registerGuard(record, name2, guard) { +function registerGuard(record2, name2, guard) { const removeFromList = /* @__PURE__ */ __name(() => { - record[name2].delete(guard); + record2[name2].delete(guard); }, "removeFromList"); onUnmounted(removeFromList); onDeactivated(removeFromList); onActivated(() => { - record[name2].add(guard); + record2[name2].add(guard); }); - record[name2].add(guard); + record2[name2].add(guard); } __name(registerGuard, "registerGuard"); function onBeforeRouteLeave(leaveGuard) { @@ -24464,9 +49849,9 @@ function onBeforeRouteUpdate(updateGuard) { registerGuard(activeRecord, "updateGuards", updateGuard); } __name(onBeforeRouteUpdate, "onBeforeRouteUpdate"); -function guardToPromiseFn(guard, to, from2, record, name2, runWithContext = (fn) => fn()) { - const enterCallbackArray = record && // name is defined if record is because of the function overload - (record.enterCallbacks[name2] = record.enterCallbacks[name2] || []); +function guardToPromiseFn(guard, to, from2, record2, name2, runWithContext = (fn) => fn()) { + const enterCallbackArray = record2 && // name is defined if record is because of the function overload + (record2.enterCallbacks[name2] = record2.enterCallbacks[name2] || []); return () => new Promise((resolve2, reject3) => { const next2 = /* @__PURE__ */ __name((valid) => { if (valid === false) { @@ -24483,13 +49868,13 @@ function guardToPromiseFn(guard, to, from2, record, name2, runWithContext = (fn) })); } else { if (enterCallbackArray && // since enterCallbackArray is truthy, both record and name also are - record.enterCallbacks[name2] === enterCallbackArray && typeof valid === "function") { + record2.enterCallbacks[name2] === enterCallbackArray && typeof valid === "function") { enterCallbackArray.push(valid); } resolve2(); } }, "next"); - const guardReturn = runWithContext(() => guard.call(record && record.instances[name2], to, from2, false ? canOnlyBeCalledOnce(next2, to, from2) : next2)); + const guardReturn = runWithContext(() => guard.call(record2 && record2.instances[name2], to, from2, false ? canOnlyBeCalledOnce(next2, to, from2) : next2)); let guardCall = Promise.resolve(guardReturn); if (guard.length < 3) guardCall = guardCall.then(next2); @@ -24530,46 +49915,46 @@ function canOnlyBeCalledOnce(next2, to, from2) { __name(canOnlyBeCalledOnce, "canOnlyBeCalledOnce"); function extractComponentsGuards(matched, guardType, to, from2, runWithContext = (fn) => fn()) { const guards = []; - for (const record of matched) { + for (const record2 of matched) { if (false) { - warn$2(`Record with path "${record.path}" is either missing a "component(s)" or "children" property.`); + warn$2(`Record with path "${record2.path}" is either missing a "component(s)" or "children" property.`); } - for (const name2 in record.components) { - let rawComponent = record.components[name2]; + for (const name2 in record2.components) { + let rawComponent = record2.components[name2]; if (false) { if (!rawComponent || typeof rawComponent !== "object" && typeof rawComponent !== "function") { - warn$2(`Component "${name2}" in record with path "${record.path}" is not a valid component. Received "${String(rawComponent)}".`); + warn$2(`Component "${name2}" in record with path "${record2.path}" is not a valid component. Received "${String(rawComponent)}".`); throw new Error("Invalid route component"); } else if ("then" in rawComponent) { - warn$2(`Component "${name2}" in record with path "${record.path}" is a Promise instead of a function that returns a Promise. Did you write "import('./MyPage.vue')" instead of "() => import('./MyPage.vue')" ? This will break in production if not fixed.`); + warn$2(`Component "${name2}" in record with path "${record2.path}" is a Promise instead of a function that returns a Promise. Did you write "import('./MyPage.vue')" instead of "() => import('./MyPage.vue')" ? This will break in production if not fixed.`); const promise = rawComponent; rawComponent = /* @__PURE__ */ __name(() => promise, "rawComponent"); } else if (rawComponent.__asyncLoader && // warn only once per component !rawComponent.__warnedDefineAsync) { rawComponent.__warnedDefineAsync = true; - warn$2(`Component "${name2}" in record with path "${record.path}" is defined using "defineAsyncComponent()". Write "() => import('./MyPage.vue')" instead of "defineAsyncComponent(() => import('./MyPage.vue'))".`); + warn$2(`Component "${name2}" in record with path "${record2.path}" is defined using "defineAsyncComponent()". Write "() => import('./MyPage.vue')" instead of "defineAsyncComponent(() => import('./MyPage.vue'))".`); } } - if (guardType !== "beforeRouteEnter" && !record.instances[name2]) + if (guardType !== "beforeRouteEnter" && !record2.instances[name2]) continue; if (isRouteComponent(rawComponent)) { const options4 = rawComponent.__vccOpts || rawComponent; const guard = options4[guardType]; - guard && guards.push(guardToPromiseFn(guard, to, from2, record, name2, runWithContext)); + guard && guards.push(guardToPromiseFn(guard, to, from2, record2, name2, runWithContext)); } else { let componentPromise = rawComponent(); if (false) { - warn$2(`Component "${name2}" in record with path "${record.path}" is a function that does not return a Promise. If you were passing a functional component, make sure to add a "displayName" to the component. This will break in production if not fixed.`); + warn$2(`Component "${name2}" in record with path "${record2.path}" is a function that does not return a Promise. If you were passing a functional component, make sure to add a "displayName" to the component. This will break in production if not fixed.`); componentPromise = Promise.resolve(componentPromise); } guards.push(() => componentPromise.then((resolved) => { if (!resolved) - return Promise.reject(new Error(`Couldn't resolve component "${name2}" at "${record.path}"`)); + return Promise.reject(new Error(`Couldn't resolve component "${name2}" at "${record2.path}"`)); const resolvedComponent = isESModule(resolved) ? resolved.default : resolved; - record.components[name2] = resolvedComponent; + record2.components[name2] = resolvedComponent; const options4 = resolvedComponent.__vccOpts || resolvedComponent; const guard = options4[guardType]; - return guard && guardToPromiseFn(guard, to, from2, record, name2, runWithContext)(); + return guard && guardToPromiseFn(guard, to, from2, record2, name2, runWithContext)(); })); } } @@ -24582,14 +49967,14 @@ function isRouteComponent(component) { } __name(isRouteComponent, "isRouteComponent"); function loadRouteLocation(route) { - return route.matched.every((record) => record.redirect) ? Promise.reject(new Error("Cannot load a route that redirects.")) : Promise.all(route.matched.map((record) => record.components && Promise.all(Object.keys(record.components).reduce((promises, name2) => { - const rawComponent = record.components[name2]; + return route.matched.every((record2) => record2.redirect) ? Promise.reject(new Error("Cannot load a route that redirects.")) : Promise.all(route.matched.map((record2) => record2.components && Promise.all(Object.keys(record2.components).reduce((promises, name2) => { + const rawComponent = record2.components[name2]; if (typeof rawComponent === "function" && !("displayName" in rawComponent)) { promises.push(rawComponent().then((resolved) => { if (!resolved) - return Promise.reject(new Error(`Couldn't resolve component "${name2}" at "${record.path}". Ensure you passed a function that returns a promise.`)); + return Promise.reject(new Error(`Couldn't resolve component "${name2}" at "${record2.path}". Ensure you passed a function that returns a promise.`)); const resolvedComponent = isESModule(resolved) ? resolved.default : resolved; - record.components[name2] = resolvedComponent; + record2.components[name2] = resolvedComponent; return; })); } @@ -24752,15 +50137,15 @@ function includesParams(outer, inner) { if (innerValue !== outerValue) return false; } else { - if (!isArray$3(outerValue) || outerValue.length !== innerValue.length || innerValue.some((value4, i2) => value4 !== outerValue[i2])) + if (!isArray$8(outerValue) || outerValue.length !== innerValue.length || innerValue.some((value4, i2) => value4 !== outerValue[i2])) return false; } } return true; } __name(includesParams, "includesParams"); -function getOriginalPath(record) { - return record ? record.aliasOf ? record.aliasOf.path : record.path : ""; +function getOriginalPath(record2) { + return record2 ? record2.aliasOf ? record2.aliasOf.path : record2.path : ""; } __name(getOriginalPath, "getOriginalPath"); const getLinkClass = /* @__PURE__ */ __name((propClass, globalClass, defaultClass) => propClass != null ? propClass : globalClass != null ? globalClass : defaultClass, "getLinkClass"); @@ -24840,7 +50225,7 @@ const RouterViewImpl = /* @__PURE__ */ defineComponent({ path: matchedRoute.path, meta: matchedRoute.meta }; - const internalInstances = isArray$3(component.ref) ? component.ref.map((r) => r.i) : [component.ref.i]; + const internalInstances = isArray$8(component.ref) ? component.ref.map((r2) => r2.i) : [component.ref.i]; internalInstances.forEach((instance) => { instance.__vrv_devtools = info; }); @@ -24853,10 +50238,10 @@ const RouterViewImpl = /* @__PURE__ */ defineComponent({ }; } }); -function normalizeSlot(slot, data24) { +function normalizeSlot(slot, data25) { if (!slot) return null; - const slotContent = slot(data24); + const slotContent = slot(data25); return slotContent.length === 1 ? slotContent[0] : slotContent; } __name(normalizeSlot, "normalizeSlot"); @@ -24940,7 +50325,7 @@ function addDevtools(app2, router2, matcher) { backgroundColor: PINK_500 }); } - if (isArray$3(componentInstance.__vrl_devtools)) { + if (isArray$8(componentInstance.__vrl_devtools)) { componentInstance.__devtoolsApi = api2; componentInstance.__vrl_devtools.forEach((devtoolsData) => { let label5 = devtoolsData.route.path; @@ -24994,7 +50379,7 @@ function addDevtools(app2, router2, matcher) { }); let navigationId = 0; router2.beforeEach((to, from2) => { - const data24 = { + const data25 = { guard: formatDisplay("beforeEach"), from: formatRouteLocation(from2, "Current Location during this navigation"), to: formatRouteLocation(to, "Target location") @@ -25008,17 +50393,17 @@ function addDevtools(app2, router2, matcher) { time: api2.now(), title: "Start of navigation", subtitle: to.fullPath, - data: data24, + data: data25, groupId: to.meta.__navigationId } }); }); router2.afterEach((to, from2, failure) => { - const data24 = { + const data25 = { guard: formatDisplay("afterEach") }; if (failure) { - data24.failure = { + data25.failure = { _custom: { type: Error, readOnly: true, @@ -25027,19 +50412,19 @@ function addDevtools(app2, router2, matcher) { value: failure } }; - data24.status = formatDisplay("❌"); + data25.status = formatDisplay("❌"); } else { - data24.status = formatDisplay("✅"); + data25.status = formatDisplay("✅"); } - data24.from = formatRouteLocation(from2, "Current Location during this navigation"); - data24.to = formatRouteLocation(to, "Target location"); + data25.from = formatRouteLocation(from2, "Current Location during this navigation"); + data25.to = formatRouteLocation(to, "Target location"); api2.addTimelineEvent({ layerId: navigationsLayerId, event: { title: "End of navigation", subtitle: to.fullPath, time: api2.now(), - data: data24, + data: data25, logType: failure ? "warning" : "default", groupId: to.meta.__navigationId } @@ -25102,15 +50487,15 @@ function modifierForKey(key) { } __name(modifierForKey, "modifierForKey"); function formatRouteRecordMatcherForStateInspector(route) { - const { record } = route; + const { record: record2 } = route; const fields = [ - { editable: false, key: "path", value: record.path } + { editable: false, key: "path", value: record2.path } ]; - if (record.name != null) { + if (record2.name != null) { fields.push({ editable: false, key: "name", - value: record.name + value: record2.name }); } fields.push({ editable: false, key: "regexp", value: route.re }); @@ -25129,11 +50514,11 @@ function formatRouteRecordMatcherForStateInspector(route) { } }); } - if (record.redirect != null) { + if (record2.redirect != null) { fields.push({ editable: false, key: "redirect", - value: record.redirect + value: record2.redirect }); } if (route.alias.length) { @@ -25176,15 +50561,15 @@ const RED_100 = 16704226; const RED_700 = 12131356; function formatRouteRecordForInspector(route) { const tags = []; - const { record } = route; - if (record.name != null) { + const { record: record2 } = route; + if (record2.name != null) { tags.push({ - label: String(record.name), + label: String(record2.name), textColor: 0, backgroundColor: CYAN_400 }); } - if (record.aliasOf) { + if (record2.aliasOf) { tags.push({ label: "alias", textColor: 0, @@ -25212,21 +50597,21 @@ function formatRouteRecordForInspector(route) { backgroundColor: BLUE_600 }); } - if (record.redirect) { + if (record2.redirect) { tags.push({ - label: typeof record.redirect === "string" ? `redirect: ${record.redirect}` : "redirects", + label: typeof record2.redirect === "string" ? `redirect: ${record2.redirect}` : "redirects", textColor: 16777215, backgroundColor: DARK }); } - let id3 = record.__vd_id; + let id3 = record2.__vd_id; if (id3 == null) { id3 = String(routeRecordId++); - record.__vd_id = id3; + record2.__vd_id = id3; } return { id: id3, - label: record.path, + label: record2.path, tags, children: route.children.map(formatRouteRecordForInspector) }; @@ -25307,17 +50692,17 @@ function createRouter(options4) { ); function addRoute(parentOrRoute, route) { let parent; - let record; + let record2; if (isRouteName(parentOrRoute)) { parent = matcher.getRecordMatcher(parentOrRoute); if (false) { warn$2(`Parent route "${String(parentOrRoute)}" not found when adding child route`, route); } - record = route; + record2 = route; } else { - record = parentOrRoute; + record2 = parentOrRoute; } - return matcher.addRoute(record, parent); + return matcher.addRoute(record2, parent); } __name(addRoute, "addRoute"); function removeRoute(name2) { @@ -25432,12 +50817,12 @@ function createRouter(options4) { } } __name(checkCanceledNavigation, "checkCanceledNavigation"); - function push(to) { + function push2(to) { return pushWithRedirect(to); } - __name(push, "push"); + __name(push2, "push"); function replace2(to) { - return push(assign$5(locationAsObject(to), { replace: true })); + return push2(assign$5(locationAsObject(to), { replace: true })); } __name(replace2, "replace"); function handleRedirectRecord(to) { @@ -25470,14 +50855,14 @@ ${JSON.stringify(newTargetLocation, null, 2)} function pushWithRedirect(to, redirectedFrom) { const targetLocation = pendingLocation = resolve2(to); const from2 = currentRoute.value; - const data24 = to.state; + const data25 = to.state; const force = to.force; const replace22 = to.replace === true; const shouldRedirect = handleRedirectRecord(targetLocation); if (shouldRedirect) return pushWithRedirect( assign$5(locationAsObject(shouldRedirect), { - state: typeof shouldRedirect === "object" ? assign$5({}, data24, shouldRedirect.state) : data24, + state: typeof shouldRedirect === "object" ? assign$5({}, data25, shouldRedirect.state) : data25, force, replace: replace22 }), @@ -25528,7 +50913,7 @@ ${JSON.stringify(newTargetLocation, null, 2)} // preserve an existing replacement but allow the redirect to override it replace: replace22 }, locationAsObject(failure2.to), { - state: typeof failure2.to === "object" ? assign$5({}, data24, failure2.to.state) : data24, + state: typeof failure2.to === "object" ? assign$5({}, data25, failure2.to.state) : data25, force }), // preserve the original redirectedFrom if any @@ -25536,7 +50921,7 @@ ${JSON.stringify(newTargetLocation, null, 2)} ); } } else { - failure2 = finalizeNavigation(toLocation, from2, true, replace22, data24); + failure2 = finalizeNavigation(toLocation, from2, true, replace22, data25); } triggerAfterEach(toLocation, from2, failure2); return failure2; @@ -25557,8 +50942,8 @@ ${JSON.stringify(newTargetLocation, null, 2)} let guards; const [leavingRecords, updatingRecords, enteringRecords] = extractChangingRecords(to, from2); guards = extractComponentsGuards(leavingRecords.reverse(), "beforeRouteLeave", to, from2); - for (const record of leavingRecords) { - record.leaveGuards.forEach((guard) => { + for (const record2 of leavingRecords) { + record2.leaveGuards.forEach((guard) => { guards.push(guardToPromiseFn(guard, to, from2)); }); } @@ -25573,8 +50958,8 @@ ${JSON.stringify(newTargetLocation, null, 2)} return runGuardQueue(guards); }).then(() => { guards = extractComponentsGuards(updatingRecords, "beforeRouteUpdate", to, from2); - for (const record of updatingRecords) { - record.updateGuards.forEach((guard) => { + for (const record2 of updatingRecords) { + record2.updateGuards.forEach((guard) => { guards.push(guardToPromiseFn(guard, to, from2)); }); } @@ -25582,20 +50967,20 @@ ${JSON.stringify(newTargetLocation, null, 2)} return runGuardQueue(guards); }).then(() => { guards = []; - for (const record of enteringRecords) { - if (record.beforeEnter) { - if (isArray$3(record.beforeEnter)) { - for (const beforeEnter of record.beforeEnter) + for (const record2 of enteringRecords) { + if (record2.beforeEnter) { + if (isArray$8(record2.beforeEnter)) { + for (const beforeEnter of record2.beforeEnter) guards.push(guardToPromiseFn(beforeEnter, to, from2)); } else { - guards.push(guardToPromiseFn(record.beforeEnter, to, from2)); + guards.push(guardToPromiseFn(record2.beforeEnter, to, from2)); } } } guards.push(canceledNavigationCheck); return runGuardQueue(guards); }).then(() => { - to.matched.forEach((record) => record.enterCallbacks = {}); + to.matched.forEach((record2) => record2.enterCallbacks = {}); guards = extractComponentsGuards(enteringRecords, "beforeRouteEnter", to, from2, runWithContext); guards.push(canceledNavigationCheck); return runGuardQueue(guards); @@ -25617,7 +51002,7 @@ ${JSON.stringify(newTargetLocation, null, 2)} afterGuards.list().forEach((guard) => runWithContext(() => guard(to, from2, failure))); } __name(triggerAfterEach, "triggerAfterEach"); - function finalizeNavigation(toLocation, from2, isPush, replace22, data24) { + function finalizeNavigation(toLocation, from2, isPush, replace22, data25) { const error2 = checkCanceledNavigation(toLocation, from2); if (error2) return error2; @@ -25627,9 +51012,9 @@ ${JSON.stringify(newTargetLocation, null, 2)} if (replace22 || isFirstNavigation) routerHistory.replace(toLocation.fullPath, assign$5({ scroll: isFirstNavigation && state && state.scroll - }, data24)); + }, data25)); else - routerHistory.push(toLocation.fullPath, data24); + routerHistory.push(toLocation.fullPath, data25); } currentRoute.value = toLocation; handleScroll(toLocation, from2, isPush, isFirstNavigation); @@ -25771,7 +51156,7 @@ ${JSON.stringify(newTargetLocation, null, 2)} getRoutes, resolve: resolve2, options: options4, - push, + push: push2, replace: replace2, go, back: /* @__PURE__ */ __name(() => go(-1), "back"), @@ -25794,7 +51179,7 @@ ${JSON.stringify(newTargetLocation, null, 2)} // multiple times when the router is used in multiple apps !started && currentRoute.value === START_LOCATION_NORMALIZED) { started = true; - push(routerHistory.location).catch((err) => { + push2(routerHistory.location).catch((err) => { if (false) warn$2("Unexpected error when starting the router:", err); }); @@ -25843,14 +51228,14 @@ function extractChangingRecords(to, from2) { for (let i2 = 0; i2 < len; i2++) { const recordFrom = from2.matched[i2]; if (recordFrom) { - if (to.matched.find((record) => isSameRouteRecord(record, recordFrom))) + if (to.matched.find((record2) => isSameRouteRecord(record2, recordFrom))) updatingRecords.push(recordFrom); else leavingRecords.push(recordFrom); } const recordTo = to.matched[i2]; if (recordTo) { - if (!from2.matched.find((record) => isSameRouteRecord(record, recordTo))) { + if (!from2.matched.find((record2) => isSameRouteRecord(record2, recordTo))) { enteringRecords.push(recordTo); } } @@ -25873,16 +51258,16 @@ const _export_sfc = /* @__PURE__ */ __name((sfc, props) => { } return target; }, "_export_sfc"); -const _sfc_main$_ = {}; -const _hoisted_1$1r = { class: "w-full min-h-screen overflow-hidden relative" }; +const _sfc_main$$ = {}; +const _hoisted_1$1w = { class: "w-full min-h-screen overflow-hidden relative" }; function _sfc_render$1(_ctx, _cache) { const _component_router_view = resolveComponent("router-view"); - return openBlock(), createElementBlock("main", _hoisted_1$1r, [ + return openBlock(), createElementBlock("main", _hoisted_1$1w, [ createVNode(_component_router_view) ]); } __name(_sfc_render$1, "_sfc_render$1"); -const LayoutDefault = /* @__PURE__ */ _export_sfc(_sfc_main$_, [["render", _sfc_render$1]]); +const LayoutDefault = /* @__PURE__ */ _export_sfc(_sfc_main$$, [["render", _sfc_render$1]]); "use strict"; function bind$3(fn, thisArg) { return /* @__PURE__ */ __name(function wrap2() { @@ -25902,12 +51287,12 @@ const kindOfTest = /* @__PURE__ */ __name((type) => { return (thing) => kindOf(thing) === type; }, "kindOfTest"); const typeOfTest = /* @__PURE__ */ __name((type) => (thing) => typeof thing === type, "typeOfTest"); -const { isArray: isArray$2 } = Array; +const { isArray: isArray$7 } = Array; const isUndefined = typeOfTest("undefined"); -function isBuffer(val) { - return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction$3(val.constructor.isBuffer) && val.constructor.isBuffer(val); +function isBuffer$4(val) { + return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction$7(val.constructor.isBuffer) && val.constructor.isBuffer(val); } -__name(isBuffer, "isBuffer"); +__name(isBuffer$4, "isBuffer$4"); const isArrayBuffer = kindOfTest("ArrayBuffer"); function isArrayBufferView(val) { let result; @@ -25920,9 +51305,9 @@ function isArrayBufferView(val) { } __name(isArrayBufferView, "isArrayBufferView"); const isString$6 = typeOfTest("string"); -const isFunction$3 = typeOfTest("function"); +const isFunction$7 = typeOfTest("function"); const isNumber$4 = typeOfTest("number"); -const isObject$5 = /* @__PURE__ */ __name((thing) => thing !== null && typeof thing === "object", "isObject$5"); +const isObject$c = /* @__PURE__ */ __name((thing) => thing !== null && typeof thing === "object", "isObject$c"); const isBoolean$2 = /* @__PURE__ */ __name((thing) => thing === true || thing === false, "isBoolean$2"); const isPlainObject$2 = /* @__PURE__ */ __name((val) => { if (kindOf(val) !== "object") { @@ -25935,11 +51320,11 @@ const isDate$1 = kindOfTest("Date"); const isFile = kindOfTest("File"); const isBlob = kindOfTest("Blob"); const isFileList = kindOfTest("FileList"); -const isStream = /* @__PURE__ */ __name((val) => isObject$5(val) && isFunction$3(val.pipe), "isStream"); +const isStream = /* @__PURE__ */ __name((val) => isObject$c(val) && isFunction$7(val.pipe), "isStream"); const isFormData = /* @__PURE__ */ __name((thing) => { let kind; - return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction$3(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance - kind === "object" && isFunction$3(thing.toString) && thing.toString() === "[object FormData]")); + return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction$7(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance + kind === "object" && isFunction$7(thing.toString) && thing.toString() === "[object FormData]")); }, "isFormData"); const isURLSearchParams = kindOfTest("URLSearchParams"); const [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest); @@ -25949,12 +51334,12 @@ function forEach$1(obj, fn, { allOwnKeys = false } = {}) { return; } let i2; - let l; + let l2; if (typeof obj !== "object") { obj = [obj]; } - if (isArray$2(obj)) { - for (i2 = 0, l = obj.length; i2 < l; i2++) { + if (isArray$7(obj)) { + for (i2 = 0, l2 = obj.length; i2 < l2; i2++) { fn.call(null, obj[i2], i2, obj); } } else { @@ -25990,33 +51375,33 @@ const isContextDefined = /* @__PURE__ */ __name((context) => !isUndefined(contex function merge() { const { caseless } = isContextDefined(this) && this || {}; const result = {}; - const assignValue = /* @__PURE__ */ __name((val, key) => { + const assignValue2 = /* @__PURE__ */ __name((val, key) => { const targetKey = caseless && findKey(result, key) || key; if (isPlainObject$2(result[targetKey]) && isPlainObject$2(val)) { result[targetKey] = merge(result[targetKey], val); } else if (isPlainObject$2(val)) { result[targetKey] = merge({}, val); - } else if (isArray$2(val)) { + } else if (isArray$7(val)) { result[targetKey] = val.slice(); } else { result[targetKey] = val; } }, "assignValue"); - for (let i2 = 0, l = arguments.length; i2 < l; i2++) { - arguments[i2] && forEach$1(arguments[i2], assignValue); + for (let i2 = 0, l2 = arguments.length; i2 < l2; i2++) { + arguments[i2] && forEach$1(arguments[i2], assignValue2); } return result; } __name(merge, "merge"); -const extend = /* @__PURE__ */ __name((a, b, thisArg, { allOwnKeys } = {}) => { - forEach$1(b, (val, key) => { - if (thisArg && isFunction$3(val)) { - a[key] = bind$3(val, thisArg); +const extend = /* @__PURE__ */ __name((a2, b2, thisArg, { allOwnKeys } = {}) => { + forEach$1(b2, (val, key) => { + if (thisArg && isFunction$7(val)) { + a2[key] = bind$3(val, thisArg); } else { - a[key] = val; + a2[key] = val; } }, { allOwnKeys }); - return a; + return a2; }, "extend"); const stripBOM = /* @__PURE__ */ __name((content2) => { if (content2.charCodeAt(0) === 65279) { @@ -26064,7 +51449,7 @@ const endsWith = /* @__PURE__ */ __name((str, searchString, position3) => { }, "endsWith"); const toArray = /* @__PURE__ */ __name((thing) => { if (!thing) return null; - if (isArray$2(thing)) return thing; + if (isArray$7(thing)) return thing; let i2 = thing.length; if (!isNumber$4(i2)) return null; const arr = new Array(i2); @@ -26073,7 +51458,7 @@ const toArray = /* @__PURE__ */ __name((thing) => { } return arr; }, "toArray"); -const isTypedArray = /* @__PURE__ */ ((TypedArray) => { +const isTypedArray$3 = /* @__PURE__ */ ((TypedArray) => { return (thing) => { return TypedArray && thing instanceof TypedArray; }; @@ -26099,12 +51484,12 @@ const isHTMLForm = kindOfTest("HTMLFormElement"); const toCamelCase = /* @__PURE__ */ __name((str) => { return str.toLowerCase().replace( /[-_\s]([a-z\d])(\w*)/g, - /* @__PURE__ */ __name(function replacer2(m, p1, p2) { + /* @__PURE__ */ __name(function replacer2(m2, p1, p2) { return p1.toUpperCase() + p2; }, "replacer") ); }, "toCamelCase"); -const hasOwnProperty$1 = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop2) => hasOwnProperty2.call(obj, prop2))(Object.prototype); +const hasOwnProperty$b = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop2) => hasOwnProperty2.call(obj, prop2))(Object.prototype); const isRegExp$3 = kindOfTest("RegExp"); const reduceDescriptors = /* @__PURE__ */ __name((obj, reducer) => { const descriptors2 = Object.getOwnPropertyDescriptors(obj); @@ -26119,11 +51504,11 @@ const reduceDescriptors = /* @__PURE__ */ __name((obj, reducer) => { }, "reduceDescriptors"); const freezeMethods = /* @__PURE__ */ __name((obj) => { reduceDescriptors(obj, (descriptor, name2) => { - if (isFunction$3(obj) && ["arguments", "caller", "callee"].indexOf(name2) !== -1) { + if (isFunction$7(obj) && ["arguments", "caller", "callee"].indexOf(name2) !== -1) { return false; } const value4 = obj[name2]; - if (!isFunction$3(value4)) return; + if (!isFunction$7(value4)) return; descriptor.enumerable = false; if ("writable" in descriptor) { descriptor.writable = false; @@ -26143,7 +51528,7 @@ const toObjectSet = /* @__PURE__ */ __name((arrayOrString, delimiter2) => { obj[value4] = true; }); }, "define"); - isArray$2(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter2)); + isArray$7(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter2)); return obj; }, "toObjectSet"); const noop$2 = /* @__PURE__ */ __name(() => { @@ -26167,21 +51552,21 @@ const generateString = /* @__PURE__ */ __name((size2 = 16, alphabet = ALPHABET.A return str; }, "generateString"); function isSpecCompliantForm(thing) { - return !!(thing && isFunction$3(thing.append) && thing[Symbol.toStringTag] === "FormData" && thing[Symbol.iterator]); + return !!(thing && isFunction$7(thing.append) && thing[Symbol.toStringTag] === "FormData" && thing[Symbol.iterator]); } __name(isSpecCompliantForm, "isSpecCompliantForm"); const toJSONObject = /* @__PURE__ */ __name((obj) => { const stack2 = new Array(10); - const visit = /* @__PURE__ */ __name((source, i2) => { - if (isObject$5(source)) { + const visit2 = /* @__PURE__ */ __name((source, i2) => { + if (isObject$c(source)) { if (stack2.indexOf(source) >= 0) { return; } if (!("toJSON" in source)) { stack2[i2] = source; - const target = isArray$2(source) ? [] : {}; + const target = isArray$7(source) ? [] : {}; forEach$1(source, (value4, key) => { - const reducedValue = visit(value4, i2 + 1); + const reducedValue = visit2(value4, i2 + 1); !isUndefined(reducedValue) && (target[key] = reducedValue); }); stack2[i2] = void 0; @@ -26190,17 +51575,17 @@ const toJSONObject = /* @__PURE__ */ __name((obj) => { } return source; }, "visit"); - return visit(obj, 0); + return visit2(obj, 0); }, "toJSONObject"); const isAsyncFn = kindOfTest("AsyncFunction"); -const isThenable = /* @__PURE__ */ __name((thing) => thing && (isObject$5(thing) || isFunction$3(thing)) && isFunction$3(thing.then) && isFunction$3(thing.catch), "isThenable"); +const isThenable = /* @__PURE__ */ __name((thing) => thing && (isObject$c(thing) || isFunction$7(thing)) && isFunction$7(thing.then) && isFunction$7(thing.catch), "isThenable"); const _setImmediate = ((setImmediateSupported, postMessageSupported) => { if (setImmediateSupported) { return setImmediate; } return postMessageSupported ? ((token, callbacks) => { - _global$1.addEventListener("message", ({ source, data: data24 }) => { - if (source === _global$1 && data24 === token) { + _global$1.addEventListener("message", ({ source, data: data25 }) => { + if (source === _global$1 && data25 === token) { callbacks.length && callbacks.shift()(); } }, false); @@ -26211,19 +51596,19 @@ const _setImmediate = ((setImmediateSupported, postMessageSupported) => { })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb); })( typeof setImmediate === "function", - isFunction$3(_global$1.postMessage) + isFunction$7(_global$1.postMessage) ); const asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global$1) : typeof process !== "undefined" && process.nextTick || _setImmediate; const utils$2 = { - isArray: isArray$2, + isArray: isArray$7, isArrayBuffer, - isBuffer, + isBuffer: isBuffer$4, isFormData, isArrayBufferView, isString: isString$6, isNumber: isNumber$4, isBoolean: isBoolean$2, - isObject: isObject$5, + isObject: isObject$c, isPlainObject: isPlainObject$2, isReadableStream, isRequest, @@ -26234,10 +51619,10 @@ const utils$2 = { isFile, isBlob, isRegExp: isRegExp$3, - isFunction: isFunction$3, + isFunction: isFunction$7, isStream, isURLSearchParams, - isTypedArray, + isTypedArray: isTypedArray$3, isFileList, forEach: forEach$1, merge, @@ -26253,8 +51638,8 @@ const utils$2 = { forEachEntry, matchAll, isHTMLForm, - hasOwnProperty: hasOwnProperty$1, - hasOwnProp: hasOwnProperty$1, + hasOwnProperty: hasOwnProperty$b, + hasOwnProp: hasOwnProperty$b, // an alias to avoid ESLint no-prototype-builtins detection reduceDescriptors, freezeMethods, @@ -26631,8 +52016,8 @@ const platform = { ...platform$1 }; "use strict"; -function toURLEncodedForm(data24, options4) { - return toFormData$1(data24, new platform.classes.URLSearchParams(), Object.assign({ +function toURLEncodedForm(data25, options4) { + return toFormData$1(data25, new platform.classes.URLSearchParams(), Object.assign({ visitor: /* @__PURE__ */ __name(function(value4, key, path, helpers2) { if (platform.isNode && utils$2.isBuffer(value4)) { this.append(key, value4.toString("base64")); @@ -26716,36 +52101,36 @@ __name(stringifySafely, "stringifySafely"); const defaults$2 = { transitional: transitionalDefaults, adapter: ["xhr", "http", "fetch"], - transformRequest: [/* @__PURE__ */ __name(function transformRequest(data24, headers) { + transformRequest: [/* @__PURE__ */ __name(function transformRequest(data25, headers) { const contentType = headers.getContentType() || ""; const hasJSONContentType = contentType.indexOf("application/json") > -1; - const isObjectPayload = utils$2.isObject(data24); - if (isObjectPayload && utils$2.isHTMLForm(data24)) { - data24 = new FormData(data24); + const isObjectPayload = utils$2.isObject(data25); + if (isObjectPayload && utils$2.isHTMLForm(data25)) { + data25 = new FormData(data25); } - const isFormData2 = utils$2.isFormData(data24); + const isFormData2 = utils$2.isFormData(data25); if (isFormData2) { - return hasJSONContentType ? JSON.stringify(formDataToJSON(data24)) : data24; + return hasJSONContentType ? JSON.stringify(formDataToJSON(data25)) : data25; } - if (utils$2.isArrayBuffer(data24) || utils$2.isBuffer(data24) || utils$2.isStream(data24) || utils$2.isFile(data24) || utils$2.isBlob(data24) || utils$2.isReadableStream(data24)) { - return data24; + if (utils$2.isArrayBuffer(data25) || utils$2.isBuffer(data25) || utils$2.isStream(data25) || utils$2.isFile(data25) || utils$2.isBlob(data25) || utils$2.isReadableStream(data25)) { + return data25; } - if (utils$2.isArrayBufferView(data24)) { - return data24.buffer; + if (utils$2.isArrayBufferView(data25)) { + return data25.buffer; } - if (utils$2.isURLSearchParams(data24)) { + if (utils$2.isURLSearchParams(data25)) { headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false); - return data24.toString(); + return data25.toString(); } let isFileList2; if (isObjectPayload) { if (contentType.indexOf("application/x-www-form-urlencoded") > -1) { - return toURLEncodedForm(data24, this.formSerializer).toString(); + return toURLEncodedForm(data25, this.formSerializer).toString(); } - if ((isFileList2 = utils$2.isFileList(data24)) || contentType.indexOf("multipart/form-data") > -1) { + if ((isFileList2 = utils$2.isFileList(data25)) || contentType.indexOf("multipart/form-data") > -1) { const _FormData = this.env && this.env.FormData; return toFormData$1( - isFileList2 ? { "files[]": data24 } : data24, + isFileList2 ? { "files[]": data25 } : data25, _FormData && new _FormData(), this.formSerializer ); @@ -26753,22 +52138,22 @@ const defaults$2 = { } if (isObjectPayload || hasJSONContentType) { headers.setContentType("application/json", false); - return stringifySafely(data24); + return stringifySafely(data25); } - return data24; + return data25; }, "transformRequest")], - transformResponse: [/* @__PURE__ */ __name(function transformResponse(data24) { + transformResponse: [/* @__PURE__ */ __name(function transformResponse(data25) { const transitional2 = this.transitional || defaults$2.transitional; const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing; const JSONRequested = this.responseType === "json"; - if (utils$2.isResponse(data24) || utils$2.isReadableStream(data24)) { - return data24; + if (utils$2.isResponse(data25) || utils$2.isReadableStream(data25)) { + return data25; } - if (data24 && utils$2.isString(data24) && (forcedJSONParsing && !this.responseType || JSONRequested)) { + if (data25 && utils$2.isString(data25) && (forcedJSONParsing && !this.responseType || JSONRequested)) { const silentJSONParsing = transitional2 && transitional2.silentJSONParsing; const strictJSONParsing = !silentJSONParsing && JSONRequested; try { - return JSON.parse(data24); + return JSON.parse(data25); } catch (e2) { if (strictJSONParsing) { if (e2.name === "SyntaxError") { @@ -26778,7 +52163,7 @@ const defaults$2 = { } } } - return data24; + return data25; }, "transformResponse")], /** * A timeout in milliseconds to abort a request. If set to 0 (default) a @@ -26891,7 +52276,7 @@ function matchHeaderValue(context, value4, header3, filter4, isHeaderNameFilter) } __name(matchHeaderValue, "matchHeaderValue"); function formatHeader(header3) { - return header3.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => { + return header3.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w2, char, str) => { return char.toUpperCase() + str; }); } @@ -27086,12 +52471,12 @@ function transformData(fns, response) { const config2 = this || defaults$2; const context = response || config2; const headers = AxiosHeaders$1.from(context.headers); - let data24 = context.data; + let data25 = context.data; utils$2.forEach(fns, /* @__PURE__ */ __name(function transform2(fn) { - data24 = fn.call(config2, data24, headers.normalize(), response ? response.status : void 0); + data25 = fn.call(config2, data25, headers.normalize(), response ? response.status : void 0); }, "transform")); headers.normalize(); - return data24; + return data25; } __name(transformData, "transformData"); "use strict"; @@ -27139,7 +52524,7 @@ function speedometer(samplesCount, min) { let tail = 0; let firstSampleTS; min = min !== void 0 ? min : 1e3; - return /* @__PURE__ */ __name(function push(chunkLength) { + return /* @__PURE__ */ __name(function push2(chunkLength) { const now2 = Date.now(); const startedAt = timestamps[tail]; if (!firstSampleTS) { @@ -27194,8 +52579,8 @@ function throttle(fn, freq) { } } }, "throttled"); - const flush = /* @__PURE__ */ __name(() => lastArgs && invoke2(lastArgs), "flush"); - return [throttled, flush]; + const flush2 = /* @__PURE__ */ __name(() => lastArgs && invoke2(lastArgs), "flush"); + return [throttled, flush2]; } __name(throttle, "throttle"); const progressEventReducer = /* @__PURE__ */ __name((listener, isDownloadStream, freq = 3) => { @@ -27208,7 +52593,7 @@ const progressEventReducer = /* @__PURE__ */ __name((listener, isDownloadStream, const rate = _speedometer(progressBytes); const inRange = loaded <= total; bytesNotified = loaded; - const data24 = { + const data25 = { loaded, total, progress: total ? loaded / total : void 0, @@ -27219,7 +52604,7 @@ const progressEventReducer = /* @__PURE__ */ __name((listener, isDownloadStream, lengthComputable: total != null, [isDownloadStream ? "download" : "upload"]: true }; - listener(data24); + listener(data25); }, freq); }, "progressEventReducer"); const progressEventDecorator = /* @__PURE__ */ __name((total, throttled) => { @@ -27337,33 +52722,33 @@ function mergeConfig$1(config1, config2) { return source; } __name(getMergedValue, "getMergedValue"); - function mergeDeepProperties(a, b, caseless) { - if (!utils$2.isUndefined(b)) { - return getMergedValue(a, b, caseless); - } else if (!utils$2.isUndefined(a)) { - return getMergedValue(void 0, a, caseless); + function mergeDeepProperties(a2, b2, caseless) { + if (!utils$2.isUndefined(b2)) { + return getMergedValue(a2, b2, caseless); + } else if (!utils$2.isUndefined(a2)) { + return getMergedValue(void 0, a2, caseless); } } __name(mergeDeepProperties, "mergeDeepProperties"); - function valueFromConfig2(a, b) { - if (!utils$2.isUndefined(b)) { - return getMergedValue(void 0, b); + function valueFromConfig2(a2, b2) { + if (!utils$2.isUndefined(b2)) { + return getMergedValue(void 0, b2); } } __name(valueFromConfig2, "valueFromConfig2"); - function defaultToConfig2(a, b) { - if (!utils$2.isUndefined(b)) { - return getMergedValue(void 0, b); - } else if (!utils$2.isUndefined(a)) { - return getMergedValue(void 0, a); + function defaultToConfig2(a2, b2) { + if (!utils$2.isUndefined(b2)) { + return getMergedValue(void 0, b2); + } else if (!utils$2.isUndefined(a2)) { + return getMergedValue(void 0, a2); } } __name(defaultToConfig2, "defaultToConfig2"); - function mergeDirectKeys(a, b, prop2) { + function mergeDirectKeys(a2, b2, prop2) { if (prop2 in config2) { - return getMergedValue(a, b); + return getMergedValue(a2, b2); } else if (prop2 in config1) { - return getMergedValue(void 0, a); + return getMergedValue(void 0, a2); } } __name(mergeDirectKeys, "mergeDirectKeys"); @@ -27396,7 +52781,7 @@ function mergeConfig$1(config1, config2) { socketPath: defaultToConfig2, responseEncoding: defaultToConfig2, validateStatus: mergeDirectKeys, - headers: /* @__PURE__ */ __name((a, b) => mergeDeepProperties(headersToObject$1(a), headersToObject$1(b), true), "headers") + headers: /* @__PURE__ */ __name((a2, b2) => mergeDeepProperties(headersToObject$1(a2), headersToObject$1(b2), true), "headers") }; utils$2.forEach(Object.keys(Object.assign({}, config1, config2)), /* @__PURE__ */ __name(function computeConfigValue(prop2) { const merge2 = mergeMap[prop2] || mergeDeepProperties; @@ -27408,7 +52793,7 @@ function mergeConfig$1(config1, config2) { __name(mergeConfig$1, "mergeConfig$1"); const resolveConfig = /* @__PURE__ */ __name((config2) => { const newConfig = mergeConfig$1({}, config2); - let { data: data24, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig; + let { data: data25, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig; newConfig.headers = headers = AxiosHeaders$1.from(headers); newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config2.params, config2.paramsSerializer); if (auth) { @@ -27418,7 +52803,7 @@ const resolveConfig = /* @__PURE__ */ __name((config2) => { ); } let contentType; - if (utils$2.isFormData(data24)) { + if (utils$2.isFormData(data25)) { if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) { headers.setContentType(void 0); } else if ((contentType = headers.getContentType()) !== false) { @@ -27715,7 +53100,7 @@ const fetchAdapter = isFetchSupported && (async (config2) => { let { url, method, - data: data24, + data: data25, signal, cancelToken, timeout, @@ -27737,22 +53122,22 @@ const fetchAdapter = isFetchSupported && (async (config2) => { }, "onFinish"); let requestContentLength; try { - if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data24)) !== 0) { + if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data25)) !== 0) { let _request = new Request(url, { method: "POST", - body: data24, + body: data25, duplex: "half" }); let contentTypeHeader; - if (utils$2.isFormData(data24) && (contentTypeHeader = _request.headers.get("content-type"))) { + if (utils$2.isFormData(data25) && (contentTypeHeader = _request.headers.get("content-type"))) { headers.setContentType(contentTypeHeader); } if (_request.body) { - const [onProgress, flush] = progressEventDecorator( + const [onProgress, flush2] = progressEventDecorator( requestContentLength, progressEventReducer(asyncDecorator(onUploadProgress)) ); - data24 = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush, encodeText); + data25 = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush2, encodeText); } } if (!utils$2.isString(withCredentials)) { @@ -27763,7 +53148,7 @@ const fetchAdapter = isFetchSupported && (async (config2) => { signal: composedSignal, method: method.toUpperCase(), headers: headers.normalize().toJSON(), - body: data24, + body: data25, duplex: "half", credentials: withCredentials }); @@ -27775,13 +53160,13 @@ const fetchAdapter = isFetchSupported && (async (config2) => { options4[prop2] = response[prop2]; }); const responseContentLength = utils$2.toFiniteNumber(response.headers.get("content-length")); - const [onProgress, flush] = onDownloadProgress && progressEventDecorator( + const [onProgress, flush2] = onDownloadProgress && progressEventDecorator( responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true) ) || []; response = new Response( trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => { - flush && flush(); + flush2 && flush2(); isStreamResponse && onFinish(); }, encodeText), options4 @@ -27856,9 +53241,9 @@ const adapters = { const reasons = Object.entries(rejectedReasons).map( ([id3, state]) => `adapter ${id3} ` + (state === false ? "is not supported by the environment" : "is not available in the build") ); - let s = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified"; + let s2 = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified"; throw new AxiosError$1( - `There is no suitable adapter to dispatch the request ` + s, + `There is no suitable adapter to dispatch the request ` + s2, "ERR_NOT_SUPPORT" ); } @@ -28122,14 +53507,14 @@ utils$2.forEach(["delete", "get", "head", "options"], /* @__PURE__ */ __name(fun }, "forEachMethodNoData")); utils$2.forEach(["post", "put", "patch"], /* @__PURE__ */ __name(function forEachMethodWithData(method) { function generateHTTPMethod(isForm) { - return /* @__PURE__ */ __name(function httpMethod(url, data24, config2) { + return /* @__PURE__ */ __name(function httpMethod(url, data25, config2) { return this.request(mergeConfig$1(config2 || {}, { method, headers: isForm ? { "Content-Type": "multipart/form-data" } : {}, url, - data: data24 + data: data25 })); }, "httpMethod"); } @@ -28218,8 +53603,8 @@ let CancelToken$1 = class CancelToken2 { */ static source() { let cancel; - const token = new CancelToken2(/* @__PURE__ */ __name(function executor(c) { - cancel = c; + const token = new CancelToken2(/* @__PURE__ */ __name(function executor(c2) { + cancel = c2; }, "executor")); return { token, @@ -28357,6 +53742,12021 @@ const { getAdapter, mergeConfig } = axios; +class LLink { + static { + __name(this, "LLink"); + } + /** Link ID */ + id; + parentId; + type; + /** Output node ID */ + origin_id; + /** Output slot index */ + origin_slot; + /** Input node ID */ + target_id; + /** Input slot index */ + target_slot; + data; + _data; + /** Centre point of the link, calculated during render only - can be inaccurate */ + _pos; + /** @todo Clean up - never implemented in comfy. */ + _last_time; + /** The last canvas 2D path that was used to render this link */ + path; + /** @inheritdoc */ + _centreAngle; + #color; + /** Custom colour for this link only */ + get color() { + return this.#color; + } + set color(value4) { + this.#color = value4 === "" ? null : value4; + } + constructor(id3, type, origin_id, origin_slot, target_id, target_slot, parentId) { + this.id = id3; + this.type = type; + this.origin_id = origin_id; + this.origin_slot = origin_slot; + this.target_id = target_id; + this.target_slot = target_slot; + this.parentId = parentId; + this._data = null; + this._pos = new Float32Array(2); + } + /** @deprecated Use {@link LLink.create} */ + static createFromArray(data25) { + return new LLink(data25[0], data25[5], data25[1], data25[2], data25[3], data25[4]); + } + /** + * LLink static factory: creates a new LLink from the provided data. + * @param data Serialised LLink data to create the link from + * @returns A new LLink + */ + static create(data25) { + return new LLink( + data25.id, + data25.type, + data25.origin_id, + data25.origin_slot, + data25.target_id, + data25.target_slot, + data25.parentId + ); + } + /** + * Gets all reroutes from the output slot to this segment. If this segment is a reroute, it will be the last element. + * @returns An ordered array of all reroutes from the node output to + * this reroute or the reroute before it. Otherwise, an empty array. + */ + static getReroutes(network, linkSegment) { + return network.reroutes.get(linkSegment.parentId)?.getReroutes() ?? []; + } + /** + * Finds the reroute in the chain after the provided reroute ID. + * @param network The network this link belongs to + * @param linkSegment The starting point of the search (input side). + * Typically the LLink object itself, but can be any link segment. + * @param rerouteId The matching reroute will have this set as its {@link parentId}. + * @returns The reroute that was found, `undefined` if no reroute was found, or `null` if an infinite loop was detected. + */ + static findNextReroute(network, linkSegment, rerouteId) { + return network.reroutes.get(linkSegment.parentId)?.findNextReroute(rerouteId); + } + configure(o2) { + if (Array.isArray(o2)) { + this.id = o2[0]; + this.origin_id = o2[1]; + this.origin_slot = o2[2]; + this.target_id = o2[3]; + this.target_slot = o2[4]; + this.type = o2[5]; + } else { + this.id = o2.id; + this.type = o2.type; + this.origin_id = o2.origin_id; + this.origin_slot = o2.origin_slot; + this.target_id = o2.target_id; + this.target_slot = o2.target_slot; + this.parentId = o2.parentId; + } + } + /** + * Disconnects a link and removes it from the graph, cleaning up any reroutes that are no longer used + * @param network The container (LGraph) where reroutes should be updated + * @param keepReroutes If `true`, reroutes will not be garbage collected. + */ + disconnect(network, keepReroutes) { + const reroutes = LLink.getReroutes(network, this); + for (const reroute of reroutes) { + reroute.linkIds.delete(this.id); + if (!keepReroutes && !reroute.linkIds.size) + network.reroutes.delete(reroute.id); + } + network.links.delete(this.id); + } + /** + * @deprecated Prefer {@link LLink.asSerialisable} (returns an object, not an array) + * @returns An array representing this LLink + */ + serialize() { + return [ + this.id, + this.origin_id, + this.origin_slot, + this.target_id, + this.target_slot, + this.type + ]; + } + asSerialisable() { + const copy2 = { + id: this.id, + origin_id: this.origin_id, + origin_slot: this.origin_slot, + target_id: this.target_id, + target_slot: this.target_slot, + type: this.type + }; + if (this.parentId) copy2.parentId = this.parentId; + return copy2; + } +} +var NodeSlotType = /* @__PURE__ */ ((NodeSlotType2) => { + NodeSlotType2[NodeSlotType2["INPUT"] = 1] = "INPUT"; + NodeSlotType2[NodeSlotType2["OUTPUT"] = 2] = "OUTPUT"; + return NodeSlotType2; +})(NodeSlotType || {}); +var RenderShape = /* @__PURE__ */ ((RenderShape2) => { + RenderShape2[RenderShape2["BOX"] = 1] = "BOX"; + RenderShape2[RenderShape2["ROUND"] = 2] = "ROUND"; + RenderShape2[RenderShape2["CIRCLE"] = 3] = "CIRCLE"; + RenderShape2[RenderShape2["CARD"] = 4] = "CARD"; + RenderShape2[RenderShape2["ARROW"] = 5] = "ARROW"; + RenderShape2[RenderShape2["GRID"] = 6] = "GRID"; + RenderShape2[RenderShape2["HollowCircle"] = 7] = "HollowCircle"; + return RenderShape2; +})(RenderShape || {}); +var CanvasItem = /* @__PURE__ */ ((CanvasItem2) => { + CanvasItem2[CanvasItem2["Nothing"] = 0] = "Nothing"; + CanvasItem2[CanvasItem2["Node"] = 1] = "Node"; + CanvasItem2[CanvasItem2["Group"] = 2] = "Group"; + CanvasItem2[CanvasItem2["Reroute"] = 4] = "Reroute"; + CanvasItem2[CanvasItem2["Link"] = 8] = "Link"; + CanvasItem2[CanvasItem2["ResizeSe"] = 16] = "ResizeSe"; + return CanvasItem2; +})(CanvasItem || {}); +var LinkDirection = /* @__PURE__ */ ((LinkDirection2) => { + LinkDirection2[LinkDirection2["NONE"] = 0] = "NONE"; + LinkDirection2[LinkDirection2["UP"] = 1] = "UP"; + LinkDirection2[LinkDirection2["DOWN"] = 2] = "DOWN"; + LinkDirection2[LinkDirection2["LEFT"] = 3] = "LEFT"; + LinkDirection2[LinkDirection2["RIGHT"] = 4] = "RIGHT"; + LinkDirection2[LinkDirection2["CENTER"] = 5] = "CENTER"; + return LinkDirection2; +})(LinkDirection || {}); +var LinkRenderType = /* @__PURE__ */ ((LinkRenderType2) => { + LinkRenderType2[LinkRenderType2["HIDDEN_LINK"] = -1] = "HIDDEN_LINK"; + LinkRenderType2[LinkRenderType2["STRAIGHT_LINK"] = 0] = "STRAIGHT_LINK"; + LinkRenderType2[LinkRenderType2["LINEAR_LINK"] = 1] = "LINEAR_LINK"; + LinkRenderType2[LinkRenderType2["SPLINE_LINK"] = 2] = "SPLINE_LINK"; + return LinkRenderType2; +})(LinkRenderType || {}); +var LinkMarkerShape = /* @__PURE__ */ ((LinkMarkerShape2) => { + LinkMarkerShape2[LinkMarkerShape2["None"] = 0] = "None"; + LinkMarkerShape2[LinkMarkerShape2["Circle"] = 1] = "Circle"; + LinkMarkerShape2[LinkMarkerShape2["Arrow"] = 2] = "Arrow"; + return LinkMarkerShape2; +})(LinkMarkerShape || {}); +var TitleMode = /* @__PURE__ */ ((TitleMode2) => { + TitleMode2[TitleMode2["NORMAL_TITLE"] = 0] = "NORMAL_TITLE"; + TitleMode2[TitleMode2["NO_TITLE"] = 1] = "NO_TITLE"; + TitleMode2[TitleMode2["TRANSPARENT_TITLE"] = 2] = "TRANSPARENT_TITLE"; + TitleMode2[TitleMode2["AUTOHIDE_TITLE"] = 3] = "AUTOHIDE_TITLE"; + return TitleMode2; +})(TitleMode || {}); +var LGraphEventMode = /* @__PURE__ */ ((LGraphEventMode2) => { + LGraphEventMode2[LGraphEventMode2["ALWAYS"] = 0] = "ALWAYS"; + LGraphEventMode2[LGraphEventMode2["ON_EVENT"] = 1] = "ON_EVENT"; + LGraphEventMode2[LGraphEventMode2["NEVER"] = 2] = "NEVER"; + LGraphEventMode2[LGraphEventMode2["ON_TRIGGER"] = 3] = "ON_TRIGGER"; + LGraphEventMode2[LGraphEventMode2["BYPASS"] = 4] = "BYPASS"; + return LGraphEventMode2; +})(LGraphEventMode || {}); +var EaseFunction = /* @__PURE__ */ ((EaseFunction2) => { + EaseFunction2["LINEAR"] = "linear"; + EaseFunction2["EASE_IN_QUAD"] = "easeInQuad"; + EaseFunction2["EASE_OUT_QUAD"] = "easeOutQuad"; + EaseFunction2["EASE_IN_OUT_QUAD"] = "easeInOutQuad"; + return EaseFunction2; +})(EaseFunction || {}); +function distance(a2, b2) { + return Math.sqrt( + (b2[0] - a2[0]) * (b2[0] - a2[0]) + (b2[1] - a2[1]) * (b2[1] - a2[1]) + ); +} +__name(distance, "distance"); +function dist2(x1, y1, x2, y2) { + return (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1); +} +__name(dist2, "dist2"); +function isInRectangle(x2, y2, left, top, width2, height) { + return x2 >= left && x2 < left + width2 && y2 >= top && y2 < top + height; +} +__name(isInRectangle, "isInRectangle"); +function isPointInRect(point, rect) { + return point[0] >= rect[0] && point[0] < rect[0] + rect[2] && point[1] >= rect[1] && point[1] < rect[1] + rect[3]; +} +__name(isPointInRect, "isPointInRect"); +function isInRect(x2, y2, rect) { + return x2 >= rect[0] && x2 < rect[0] + rect[2] && y2 >= rect[1] && y2 < rect[1] + rect[3]; +} +__name(isInRect, "isInRect"); +function isInsideRectangle(x2, y2, left, top, width2, height) { + return left < x2 && left + width2 > x2 && top < y2 && top + height > y2; +} +__name(isInsideRectangle, "isInsideRectangle"); +function isSortaInsideOctagon(x2, y2, radius) { + const sum = Math.min(radius, Math.abs(x2)) + Math.min(radius, Math.abs(y2)); + return sum < radius * 0.75; +} +__name(isSortaInsideOctagon, "isSortaInsideOctagon"); +function overlapBounding(a2, b2) { + const aRight = a2[0] + a2[2]; + const aBottom = a2[1] + a2[3]; + const bRight = b2[0] + b2[2]; + const bBottom = b2[1] + b2[3]; + return a2[0] > bRight || a2[1] > bBottom || aRight < b2[0] || aBottom < b2[1] ? false : true; +} +__name(overlapBounding, "overlapBounding"); +function containsCentre(a2, b2) { + const centreX = b2[0] + b2[2] * 0.5; + const centreY = b2[1] + b2[3] * 0.5; + return isInRect(centreX, centreY, a2); +} +__name(containsCentre, "containsCentre"); +function containsRect(a2, b2) { + const aRight = a2[0] + a2[2]; + const aBottom = a2[1] + a2[3]; + const bRight = b2[0] + b2[2]; + const bBottom = b2[1] + b2[3]; + const identical = a2[0] === b2[0] && a2[1] === b2[1] && aRight === bRight && aBottom === bBottom; + return !identical && a2[0] <= b2[0] && a2[1] <= b2[1] && aRight >= bRight && aBottom >= bBottom; +} +__name(containsRect, "containsRect"); +function findPointOnCurve(out, a2, b2, controlA, controlB, t2 = 0.5) { + const iT = 1 - t2; + const c1 = iT * iT * iT; + const c2 = 3 * (iT * iT) * t2; + const c3 = 3 * iT * (t2 * t2); + const c4 = t2 * t2 * t2; + out[0] = c1 * a2[0] + c2 * controlA[0] + c3 * controlB[0] + c4 * b2[0]; + out[1] = c1 * a2[1] + c2 * controlA[1] + c3 * controlB[1] + c4 * b2[1]; +} +__name(findPointOnCurve, "findPointOnCurve"); +function createBounds(objects, padding = 10) { + const bounds = new Float32Array([Infinity, Infinity, -Infinity, -Infinity]); + for (const obj of objects) { + const rect = obj.boundingRect; + bounds[0] = Math.min(bounds[0], rect[0]); + bounds[1] = Math.min(bounds[1], rect[1]); + bounds[2] = Math.max(bounds[2], rect[0] + rect[2]); + bounds[3] = Math.max(bounds[3], rect[1] + rect[3]); + } + if (!bounds.every((x2) => isFinite(x2))) return null; + return [ + bounds[0] - padding, + bounds[1] - padding, + bounds[2] - bounds[0] + 2 * padding, + bounds[3] - bounds[1] + 2 * padding + ]; +} +__name(createBounds, "createBounds"); +function snapPoint(pos2, snapTo) { + if (!snapTo) return false; + pos2[0] = snapTo * Math.round(pos2[0] / snapTo); + pos2[1] = snapTo * Math.round(pos2[1] / snapTo); + return true; +} +__name(snapPoint, "snapPoint"); +class Reroute { + static { + __name(this, "Reroute"); + } + /** + * Initialises a new link reroute object. + * @param id Unique identifier for this reroute + * @param network The network of links this reroute belongs to. Internally converted to a WeakRef. + * @param pos Position in graph coordinates + * @param linkIds Link IDs ({@link LLink.id}) of all links that use this reroute + */ + constructor(id3, network, pos2, parentId, linkIds) { + this.id = id3; + this.#network = new WeakRef(network); + this.update(parentId, pos2, linkIds); + this.linkIds ??= /* @__PURE__ */ new Set(); + } + static radius = 10; + #malloc = new Float32Array(8); + /** The network this reroute belongs to. Contains all valid links and reroutes. */ + #network; + #parentId; + /** @inheritdoc */ + get parentId() { + return this.#parentId; + } + /** Ignores attempts to create an infinite loop. @inheritdoc */ + set parentId(value4) { + if (value4 === this.id) return; + if (this.getReroutes() === null) return; + this.#parentId = value4; + } + #pos = this.#malloc.subarray(0, 2); + /** @inheritdoc */ + get pos() { + return this.#pos; + } + set pos(value4) { + if (!(value4?.length >= 2)) + throw new TypeError("Reroute.pos is an x,y point, and expects an indexable with at least two values."); + this.#pos[0] = value4[0]; + this.#pos[1] = value4[1]; + } + /** @inheritdoc */ + get boundingRect() { + const { radius } = Reroute; + const [x2, y2] = this.#pos; + return [x2 - radius, y2 - radius, 2 * radius, 2 * radius]; + } + /** @inheritdoc */ + selected; + /** The ID ({@link LLink.id}) of every link using this reroute */ + linkIds; + /** The averaged angle of every link through this reroute. */ + otherAngle = 0; + /** Cached cos */ + cos = 0; + sin = 0; + /** Bezier curve control point for the "target" (input) side of the link */ + controlPoint = this.#malloc.subarray(4, 6); + /** @inheritdoc */ + path; + /** @inheritdoc */ + _centreAngle; + /** @inheritdoc */ + _pos = this.#malloc.subarray(6, 8); + /** Colour of the first link that rendered this reroute */ + _colour; + /** + * Used to ensure reroute angles are only executed once per frame. + * @todo Calculate on change instead. + */ + #lastRenderTime = -Infinity; + #buffer = this.#malloc.subarray(2, 4); + /** @inheritdoc */ + get origin_id() { + return this.#network.deref()?.links.get(this.linkIds.values().next().value)?.origin_id; + } + /** @inheritdoc */ + get origin_slot() { + return this.#network.deref()?.links.get(this.linkIds.values().next().value)?.origin_slot; + } + /** + * Applies a new parentId to the reroute, and optinoally a new position and linkId. + * Primarily used for deserialisation. + * @param parentId The ID of the reroute prior to this reroute, or + * `undefined` if it is the first reroute connected to a nodes output + * @param pos The position of this reroute + * @param linkIds All link IDs that pass through this reroute + */ + update(parentId, pos2, linkIds) { + this.parentId = parentId; + if (pos2) this.pos = pos2; + if (linkIds) this.linkIds = new Set(linkIds); + } + /** + * Validates the linkIds this reroute has. Removes broken links. + * @param links Collection of valid links + * @returns true if any links remain after validation + */ + validateLinks(links) { + const { linkIds } = this; + for (const linkId of linkIds) { + if (!links.get(linkId)) linkIds.delete(linkId); + } + return linkIds.size > 0; + } + /** + * Retrieves an ordered array of all reroutes from the node output. + * @param visited Internal. A set of reroutes that this function + * has already visited whilst recursing up the chain. + * @returns An ordered array of all reroutes from the node output to this reroute, inclusive. + * `null` if an infinite loop is detected. + * `undefined` if the reroute chain or {@link LinkNetwork} are invalid. + */ + getReroutes(visited = /* @__PURE__ */ new Set()) { + if (this.#parentId === void 0) return [this]; + if (visited.has(this)) return null; + visited.add(this); + const parent = this.#network.deref()?.reroutes.get(this.#parentId); + if (!parent) { + this.#parentId = void 0; + return [this]; + } + const reroutes = parent.getReroutes(visited); + reroutes?.push(this); + return reroutes; + } + /** + * Internal. Called by {@link LLink.findNextReroute}. Not intended for use by itself. + * @param withParentId The rerouteId to look for + * @param visited A set of reroutes that have already been visited + * @returns The reroute that was found, `undefined` if no reroute was found, or `null` if an infinite loop was detected. + */ + findNextReroute(withParentId, visited = /* @__PURE__ */ new Set()) { + if (this.#parentId === withParentId) return this; + if (visited.has(this)) return null; + visited.add(this); + return this.#network.deref()?.reroutes.get(this.#parentId)?.findNextReroute(withParentId, visited); + } + /** @inheritdoc */ + move(deltaX, deltaY) { + this.#pos[0] += deltaX; + this.#pos[1] += deltaY; + } + /** @inheritdoc */ + snapToGrid(snapTo) { + if (!snapTo) return false; + const { pos: pos2 } = this; + pos2[0] = snapTo * Math.round(pos2[0] / snapTo); + pos2[1] = snapTo * Math.round(pos2[1] / snapTo); + return true; + } + calculateAngle(lastRenderTime, network, linkStart) { + if (!(lastRenderTime > this.#lastRenderTime)) return; + this.#lastRenderTime = lastRenderTime; + const { links } = network; + const { linkIds, id: id3 } = this; + const angles = []; + let sum = 0; + for (const linkId of linkIds) { + const link2 = links.get(linkId); + if (!link2) continue; + const pos2 = LLink.findNextReroute(network, link2, id3)?.pos ?? network.getNodeById(link2.target_id)?.getConnectionPos(true, link2.target_slot, this.#buffer); + if (!pos2) continue; + const angle = Math.atan2(pos2[1] - this.#pos[1], pos2[0] - this.#pos[0]); + angles.push(angle); + sum += angle; + } + if (!angles.length) return; + sum /= angles.length; + const originToReroute = Math.atan2( + this.#pos[1] - linkStart[1], + this.#pos[0] - linkStart[0] + ); + let diff2 = (originToReroute - sum) * 0.5; + if (Math.abs(diff2) > Math.PI * 0.5) diff2 += Math.PI; + const dist3 = Math.min(80, distance(linkStart, this.#pos) * 0.25); + const originDiff = originToReroute - diff2; + const cos = Math.cos(originDiff); + const sin = Math.sin(originDiff); + this.otherAngle = originDiff; + this.cos = cos; + this.sin = sin; + this.controlPoint[0] = dist3 * -cos; + this.controlPoint[1] = dist3 * -sin; + return; + } + /** + * Renders the reroute on the canvas. + * @param ctx Canvas context to draw on + * @remarks Leaves {@link ctx}.fillStyle, strokeStyle, and lineWidth dirty (perf.). + */ + draw(ctx) { + const { pos: pos2 } = this; + ctx.fillStyle = this._colour; + ctx.beginPath(); + ctx.arc(pos2[0], pos2[1], Reroute.radius, 0, 2 * Math.PI); + ctx.fill(); + ctx.lineWidth = Reroute.radius * 0.1; + ctx.strokeStyle = "rgb(0,0,0,0.5)"; + ctx.stroke(); + ctx.fillStyle = "#ffffff55"; + ctx.strokeStyle = "rgb(0,0,0,0.3)"; + ctx.beginPath(); + ctx.arc(pos2[0], pos2[1], Reroute.radius * 0.8, 0, 2 * Math.PI); + ctx.fill(); + ctx.stroke(); + if (this.selected) { + ctx.strokeStyle = "#fff"; + ctx.beginPath(); + ctx.arc(pos2[0], pos2[1], Reroute.radius * 1.2, 0, 2 * Math.PI); + ctx.stroke(); + } + } + /** @inheritdoc */ + asSerialisable() { + return { + id: this.id, + parentId: this.parentId, + pos: [this.pos[0], this.pos[1]], + linkIds: [...this.linkIds] + }; + } +} +var BadgePosition = /* @__PURE__ */ ((BadgePosition2) => { + BadgePosition2["TopLeft"] = "top-left"; + BadgePosition2["TopRight"] = "top-right"; + return BadgePosition2; +})(BadgePosition || {}); +class LGraphBadge { + static { + __name(this, "LGraphBadge"); + } + text; + fgColor; + bgColor; + fontSize; + padding; + height; + cornerRadius; + constructor({ + text: text2, + fgColor = "white", + bgColor = "#0F1F0F", + fontSize = 12, + padding = 6, + height = 20, + cornerRadius = 5 + }) { + this.text = text2; + this.fgColor = fgColor; + this.bgColor = bgColor; + this.fontSize = fontSize; + this.padding = padding; + this.height = height; + this.cornerRadius = cornerRadius; + } + get visible() { + return this.text.length > 0; + } + getWidth(ctx) { + if (!this.visible) return 0; + const { font } = ctx; + ctx.font = `${this.fontSize}px sans-serif`; + const textWidth = ctx.measureText(this.text).width; + ctx.font = font; + return textWidth + this.padding * 2; + } + draw(ctx, x2, y2) { + if (!this.visible) return; + const { fillStyle } = ctx; + ctx.font = `${this.fontSize}px sans-serif`; + const badgeWidth = this.getWidth(ctx); + const badgeX = 0; + ctx.fillStyle = this.bgColor; + ctx.beginPath(); + if (ctx.roundRect) { + ctx.roundRect(x2 + badgeX, y2, badgeWidth, this.height, this.cornerRadius); + } else { + ctx.rect(x2 + badgeX, y2, badgeWidth, this.height); + } + ctx.fill(); + ctx.fillStyle = this.fgColor; + ctx.fillText( + this.text, + x2 + badgeX + this.padding, + y2 + this.height - this.padding + ); + ctx.fillStyle = fillStyle; + } +} +class LGraphNode { + static { + __name(this, "LGraphNode"); + } + // Static properties used by dynamic child classes + static title; + static MAX_CONSOLE; + static type; + static category; + static supported_extensions; + static filter; + static skip_list; + /** Default setting for {@link LGraphNode.connectInputToOutput}. @see {@link INodeFlags.keepAllLinksOnBypass} */ + static keepAllLinksOnBypass = false; + title; + graph = null; + id; + type = null; + inputs = []; + outputs = []; + // Not used + connections = []; + properties = {}; + properties_info = []; + flags = {}; + widgets; + locked; + // Execution order, automatically computed during run + order; + mode; + last_serialization; + serialize_widgets; + color; + bgcolor; + boxcolor; + exec_version; + action_call; + execute_triggered; + action_triggered; + widgets_up; + widgets_start_y; + lostFocusAt; + gotFocusAt; + badges = []; + badgePosition = BadgePosition.TopLeft; + _collapsed_width; + horizontal; + console; + _level; + _shape; + subgraph; + skip_subgraph_button; + mouseOver; + redraw_on_mouse; + // Appears unused + optional_inputs; + // Appears unused + optional_outputs; + resizable; + clonable; + _relative_id; + clip_area; + ignore_remove; + has_errors; + removable; + block_delete; + selected; + showAdvanced; + /** @inheritdoc {@link renderArea} */ + #renderArea = new Float32Array(4); + /** + * Rect describing the node area, including shadows and any protrusions. + * Determines if the node is visible. Calculated once at the start of every frame. + */ + get renderArea() { + return this.#renderArea; + } + /** @inheritdoc {@link boundingRect} */ + #boundingRect = new Float32Array(4); + /** + * Cached node position & area as `x, y, width, height`. Includes changes made by {@link onBounding}, if present. + * + * Determines the node hitbox and other rendering effects. Calculated once at the start of every frame. + */ + get boundingRect() { + return this.#boundingRect; + } + /** {@link pos} and {@link size} values are backed by this {@link Rect}. */ + _posSize = new Float32Array(4); + _pos = this._posSize.subarray(0, 2); + _size = this._posSize.subarray(2, 4); + get pos() { + return this._pos; + } + set pos(value4) { + if (!value4 || value4.length < 2) return; + this._pos[0] = value4[0]; + this._pos[1] = value4[1]; + } + get size() { + return this._size; + } + set size(value4) { + if (!value4 || value4.length < 2) return; + this._size[0] = value4[0]; + this._size[1] = value4[1]; + } + get shape() { + return this._shape; + } + set shape(v2) { + switch (v2) { + case "default": + delete this._shape; + break; + case "box": + this._shape = RenderShape.BOX; + break; + case "round": + this._shape = RenderShape.ROUND; + break; + case "circle": + this._shape = RenderShape.CIRCLE; + break; + case "card": + this._shape = RenderShape.CARD; + break; + default: + this._shape = v2; + } + } + get is_selected() { + return this.selected; + } + set is_selected(value4) { + this.selected = value4; + } + constructor(title) { + this.id = LiteGraph.use_uuids ? LiteGraph.uuidv4() : -1; + this.title = title || "Unnamed"; + this.size = [LiteGraph.NODE_WIDTH, 60]; + this.pos = [10, 10]; + } + /** + * configure a node from an object containing the serialized info + */ + configure(info) { + if (this.graph) { + this.graph._version++; + } + for (const j2 in info) { + if (j2 == "properties") { + for (const k2 in info.properties) { + this.properties[k2] = info.properties[k2]; + this.onPropertyChanged?.(k2, info.properties[k2]); + } + continue; + } + if (info[j2] == null) { + continue; + } else if (typeof info[j2] == "object") { + if (this[j2]?.configure) { + this[j2]?.configure(info[j2]); + } else { + this[j2] = LiteGraph.cloneObject(info[j2], this[j2]); + } + } else { + this[j2] = info[j2]; + } + } + if (!info.title) { + this.title = this.constructor.title; + } + if (this.inputs) { + for (let i2 = 0; i2 < this.inputs.length; ++i2) { + const input = this.inputs[i2]; + const link2 = this.graph ? this.graph._links.get(input.link) : null; + this.onConnectionsChange?.(NodeSlotType.INPUT, i2, true, link2, input); + this.onInputAdded?.(input); + } + } + if (this.outputs) { + for (let i2 = 0; i2 < this.outputs.length; ++i2) { + const output = this.outputs[i2]; + if (!output.links) { + continue; + } + for (let j2 = 0; j2 < output.links.length; ++j2) { + const link2 = this.graph ? this.graph._links.get(output.links[j2]) : null; + this.onConnectionsChange?.(NodeSlotType.OUTPUT, i2, true, link2, output); + } + this.onOutputAdded?.(output); + } + } + if (this.widgets) { + for (let i2 = 0; i2 < this.widgets.length; ++i2) { + const w2 = this.widgets[i2]; + if (!w2) continue; + if (w2.options?.property && this.properties[w2.options.property] != void 0) + w2.value = JSON.parse(JSON.stringify(this.properties[w2.options.property])); + } + if (info.widgets_values) { + for (let i2 = 0; i2 < info.widgets_values.length; ++i2) { + if (this.widgets[i2]) { + this.widgets[i2].value = info.widgets_values[i2]; + } + } + } + } + if (this.pinned) this.pin(true); + this.onConfigure?.(info); + } + /** + * serialize the content + */ + serialize() { + const o2 = { + id: this.id, + type: this.type, + pos: [this.pos[0], this.pos[1]], + size: [this.size[0], this.size[1]], + flags: LiteGraph.cloneObject(this.flags), + order: this.order, + mode: this.mode, + showAdvanced: this.showAdvanced + }; + if (this.constructor === LGraphNode && this.last_serialization) + return this.last_serialization; + if (this.inputs) o2.inputs = this.inputs; + if (this.outputs) { + for (let i2 = 0; i2 < this.outputs.length; i2++) { + delete this.outputs[i2]._data; + } + o2.outputs = this.outputs; + } + if (this.title && this.title != this.constructor.title) o2.title = this.title; + if (this.properties) o2.properties = LiteGraph.cloneObject(this.properties); + if (this.widgets && this.serialize_widgets) { + o2.widgets_values = []; + for (let i2 = 0; i2 < this.widgets.length; ++i2) { + if (this.widgets[i2]) + o2.widgets_values[i2] = this.widgets[i2].value; + else + o2.widgets_values[i2] = null; + } + } + if (!o2.type) o2.type = this.constructor.type; + if (this.color) o2.color = this.color; + if (this.bgcolor) o2.bgcolor = this.bgcolor; + if (this.boxcolor) o2.boxcolor = this.boxcolor; + if (this.shape) o2.shape = this.shape; + if (this.onSerialize?.(o2)) console.warn("node onSerialize shouldnt return anything, data should be stored in the object pass in the first parameter"); + return o2; + } + /* Creates a clone of this node */ + clone() { + const node22 = LiteGraph.createNode(this.type); + if (!node22) return null; + const data25 = LiteGraph.cloneObject(this.serialize()); + if (data25.inputs) { + for (let i2 = 0; i2 < data25.inputs.length; ++i2) { + data25.inputs[i2].link = null; + } + } + if (data25.outputs) { + for (let i2 = 0; i2 < data25.outputs.length; ++i2) { + if (data25.outputs[i2].links) { + data25.outputs[i2].links.length = 0; + } + } + } + delete data25.id; + if (LiteGraph.use_uuids) data25.id = LiteGraph.uuidv4(); + node22.configure(data25); + return node22; + } + /** + * serialize and stringify + */ + toString() { + return JSON.stringify(this.serialize()); + } + /** + * get the title string + */ + getTitle() { + return this.title || this.constructor.title; + } + /** + * sets the value of a property + * @param name + * @param value + */ + setProperty(name2, value4) { + this.properties ||= {}; + if (value4 === this.properties[name2]) return; + const prev_value = this.properties[name2]; + this.properties[name2] = value4; + if (this.onPropertyChanged?.(name2, value4, prev_value) === false) + this.properties[name2] = prev_value; + if (this.widgets) { + for (let i2 = 0; i2 < this.widgets.length; ++i2) { + const w2 = this.widgets[i2]; + if (!w2) continue; + if (w2.options.property == name2) { + w2.value = value4; + break; + } + } + } + } + /** + * sets the output data + * @param slot + * @param data + */ + setOutputData(slot, data25) { + if (!this.outputs) return; + if (slot == -1 || slot >= this.outputs.length) return; + const output_info = this.outputs[slot]; + if (!output_info) return; + output_info._data = data25; + if (this.outputs[slot].links) { + for (let i2 = 0; i2 < this.outputs[slot].links.length; i2++) { + const link_id = this.outputs[slot].links[i2]; + const link2 = this.graph._links.get(link_id); + if (link2) link2.data = data25; + } + } + } + /** + * sets the output data type, useful when you want to be able to overwrite the data type + */ + setOutputDataType(slot, type) { + if (!this.outputs) return; + if (slot == -1 || slot >= this.outputs.length) return; + const output_info = this.outputs[slot]; + if (!output_info) return; + output_info.type = type; + if (this.outputs[slot].links) { + for (let i2 = 0; i2 < this.outputs[slot].links.length; i2++) { + const link_id = this.outputs[slot].links[i2]; + this.graph._links.get(link_id).type = type; + } + } + } + /** + * Retrieves the input data (data traveling through the connection) from one slot + * @param slot + * @param force_update if set to true it will force the connected node of this slot to output data into this link + * @returns data or if it is not connected returns undefined + */ + getInputData(slot, force_update) { + if (!this.inputs) return; + if (slot >= this.inputs.length || this.inputs[slot].link == null) return; + const link_id = this.inputs[slot].link; + const link2 = this.graph._links.get(link_id); + if (!link2) return null; + if (!force_update) return link2.data; + const node22 = this.graph.getNodeById(link2.origin_id); + if (!node22) return link2.data; + if (node22.updateOutputData) { + node22.updateOutputData(link2.origin_slot); + } else { + node22.onExecute?.(); + } + return link2.data; + } + /** + * Retrieves the input data type (in case this supports multiple input types) + * @param slot + * @returns datatype in string format + */ + getInputDataType(slot) { + if (!this.inputs) return null; + if (slot >= this.inputs.length || this.inputs[slot].link == null) return null; + const link_id = this.inputs[slot].link; + const link2 = this.graph._links.get(link_id); + if (!link2) return null; + const node22 = this.graph.getNodeById(link2.origin_id); + if (!node22) return link2.type; + const output_info = node22.outputs[link2.origin_slot]; + return output_info ? output_info.type : null; + } + /** + * Retrieves the input data from one slot using its name instead of slot number + * @param slot_name + * @param force_update if set to true it will force the connected node of this slot to output data into this link + * @returns data or if it is not connected returns null + */ + getInputDataByName(slot_name, force_update) { + const slot = this.findInputSlot(slot_name); + return slot == -1 ? null : this.getInputData(slot, force_update); + } + /** + * tells you if there is a connection in one input slot + * @param slot The 0-based index of the input to check + * @returns `true` if the input slot has a link ID (does not perform validation) + */ + isInputConnected(slot) { + if (!this.inputs) return false; + return slot < this.inputs.length && this.inputs[slot].link != null; + } + /** + * tells you info about an input connection (which node, type, etc) + * @returns object or null { link: id, name: string, type: string or 0 } + */ + getInputInfo(slot) { + return !this.inputs || !(slot < this.inputs.length) ? null : this.inputs[slot]; + } + /** + * Returns the link info in the connection of an input slot + * @returns object or null + */ + getInputLink(slot) { + if (!this.inputs) return null; + if (slot < this.inputs.length) { + const slot_info = this.inputs[slot]; + return this.graph._links.get(slot_info.link); + } + return null; + } + /** + * returns the node connected in the input slot + * @returns node or null + */ + getInputNode(slot) { + if (!this.inputs) return null; + if (slot >= this.inputs.length) return null; + const input = this.inputs[slot]; + if (!input || input.link === null) return null; + const link_info = this.graph._links.get(input.link); + if (!link_info) return null; + return this.graph.getNodeById(link_info.origin_id); + } + /** + * returns the value of an input with this name, otherwise checks if there is a property with that name + * @returns value + */ + getInputOrProperty(name2) { + if (!this.inputs || !this.inputs.length) { + return this.properties ? this.properties[name2] : null; + } + for (let i2 = 0, l2 = this.inputs.length; i2 < l2; ++i2) { + const input_info = this.inputs[i2]; + if (name2 == input_info.name && input_info.link != null) { + const link2 = this.graph._links.get(input_info.link); + if (link2) return link2.data; + } + } + return this.properties[name2]; + } + /** + * tells you the last output data that went in that slot + * @returns object or null + */ + getOutputData(slot) { + if (!this.outputs) return null; + if (slot >= this.outputs.length) return null; + const info = this.outputs[slot]; + return info._data; + } + /** + * tells you info about an output connection (which node, type, etc) + * @returns object or null { name: string, type: string, links: [ ids of links in number ] } + */ + getOutputInfo(slot) { + return !this.outputs || !(slot < this.outputs.length) ? null : this.outputs[slot]; + } + /** + * tells you if there is a connection in one output slot + */ + isOutputConnected(slot) { + if (!this.outputs) return false; + return slot < this.outputs.length && this.outputs[slot].links?.length > 0; + } + /** + * tells you if there is any connection in the output slots + */ + isAnyOutputConnected() { + if (!this.outputs) return false; + for (let i2 = 0; i2 < this.outputs.length; ++i2) { + if (this.outputs[i2].links && this.outputs[i2].links.length) { + return true; + } + } + return false; + } + /** + * retrieves all the nodes connected to this output slot + */ + getOutputNodes(slot) { + if (!this.outputs || this.outputs.length == 0) return null; + if (slot >= this.outputs.length) return null; + const output = this.outputs[slot]; + if (!output.links || output.links.length == 0) return null; + const r2 = []; + for (let i2 = 0; i2 < output.links.length; i2++) { + const link_id = output.links[i2]; + const link2 = this.graph._links.get(link_id); + if (link2) { + const target_node = this.graph.getNodeById(link2.target_id); + if (target_node) { + r2.push(target_node); + } + } + } + return r2; + } + addOnTriggerInput() { + const trigS = this.findInputSlot("onTrigger"); + if (trigS == -1) { + this.addInput("onTrigger", LiteGraph.EVENT, { + optional: true, + nameLocked: true + }); + return this.findInputSlot("onTrigger"); + } + return trigS; + } + addOnExecutedOutput() { + const trigS = this.findOutputSlot("onExecuted"); + if (trigS == -1) { + this.addOutput("onExecuted", LiteGraph.ACTION, { + optional: true, + nameLocked: true + }); + return this.findOutputSlot("onExecuted"); + } + return trigS; + } + onAfterExecuteNode(param, options4) { + const trigS = this.findOutputSlot("onExecuted"); + if (trigS != -1) { + this.triggerSlot(trigS, param, null, options4); + } + } + changeMode(modeTo) { + switch (modeTo) { + case LGraphEventMode.ON_EVENT: + break; + case LGraphEventMode.ON_TRIGGER: + this.addOnTriggerInput(); + this.addOnExecutedOutput(); + break; + case LGraphEventMode.NEVER: + break; + case LGraphEventMode.ALWAYS: + break; + case LiteGraph.ON_REQUEST: + break; + default: + return false; + } + this.mode = modeTo; + return true; + } + /** + * Triggers the node code execution, place a boolean/counter to mark the node as being executed + */ + doExecute(param, options4) { + options4 = options4 || {}; + if (this.onExecute) { + options4.action_call ||= this.id + "_exec_" + Math.floor(Math.random() * 9999); + this.graph.nodes_executing[this.id] = true; + this.onExecute(param, options4); + this.graph.nodes_executing[this.id] = false; + this.exec_version = this.graph.iteration; + if (options4?.action_call) { + this.action_call = options4.action_call; + this.graph.nodes_executedAction[this.id] = options4.action_call; + } + } + this.execute_triggered = 2; + this.onAfterExecuteNode?.(param, options4); + } + /** + * Triggers an action, wrapped by logics to control execution flow + * @param action name + */ + actionDo(action, param, options4) { + options4 = options4 || {}; + if (this.onAction) { + options4.action_call ||= this.id + "_" + (action ? action : "action") + "_" + Math.floor(Math.random() * 9999); + this.graph.nodes_actioning[this.id] = action ? action : "actioning"; + this.onAction(action, param, options4); + this.graph.nodes_actioning[this.id] = false; + if (options4?.action_call) { + this.action_call = options4.action_call; + this.graph.nodes_executedAction[this.id] = options4.action_call; + } + } + this.action_triggered = 2; + this.onAfterExecuteNode?.(param, options4); + } + /** + * Triggers an event in this node, this will trigger any output with the same name + * @param action name ( "on_play", ... ) if action is equivalent to false then the event is send to all + */ + trigger(action, param, options4) { + if (!this.outputs || !this.outputs.length) { + return; + } + if (this.graph) this.graph._last_trigger_time = LiteGraph.getTime(); + for (let i2 = 0; i2 < this.outputs.length; ++i2) { + const output = this.outputs[i2]; + if (!output || output.type !== LiteGraph.EVENT || action && output.name != action) + continue; + this.triggerSlot(i2, param, null, options4); + } + } + /** + * Triggers a slot event in this node: cycle output slots and launch execute/action on connected nodes + * @param slot the index of the output slot + * @param link_id [optional] in case you want to trigger and specific output link in a slot + */ + triggerSlot(slot, param, link_id, options4) { + options4 = options4 || {}; + if (!this.outputs) return; + if (slot == null) { + console.error("slot must be a number"); + return; + } + if (typeof slot !== "number") + console.warn("slot must be a number, use node.trigger('name') if you want to use a string"); + const output = this.outputs[slot]; + if (!output) return; + const links = output.links; + if (!links || !links.length) return; + if (this.graph) this.graph._last_trigger_time = LiteGraph.getTime(); + for (let k2 = 0; k2 < links.length; ++k2) { + const id3 = links[k2]; + if (link_id != null && link_id != id3) continue; + const link_info = this.graph._links.get(id3); + if (!link_info) continue; + link_info._last_time = LiteGraph.getTime(); + const node22 = this.graph.getNodeById(link_info.target_id); + if (!node22) continue; + if (node22.mode === LGraphEventMode.ON_TRIGGER) { + if (!options4.action_call) + options4.action_call = this.id + "_trigg_" + Math.floor(Math.random() * 9999); + node22.doExecute?.(param, options4); + } else if (node22.onAction) { + if (!options4.action_call) + options4.action_call = this.id + "_act_" + Math.floor(Math.random() * 9999); + const target_connection = node22.inputs[link_info.target_slot]; + node22.actionDo(target_connection.name, param, options4); + } + } + } + /** + * clears the trigger slot animation + * @param slot the index of the output slot + * @param link_id [optional] in case you want to trigger and specific output link in a slot + */ + clearTriggeredSlot(slot, link_id) { + if (!this.outputs) return; + const output = this.outputs[slot]; + if (!output) return; + const links = output.links; + if (!links || !links.length) return; + for (let k2 = 0; k2 < links.length; ++k2) { + const id3 = links[k2]; + if (link_id != null && link_id != id3) continue; + const link_info = this.graph._links.get(id3); + if (!link_info) continue; + link_info._last_time = 0; + } + } + /** + * changes node size and triggers callback + */ + setSize(size2) { + this.size = size2; + this.onResize?.(this.size); + } + /** + * add a new property to this node + * @param type string defining the output type ("vec3","number",...) + * @param extra_info this can be used to have special properties of the property (like values, etc) + */ + addProperty(name2, default_value, type, extra_info) { + const o2 = { + name: name2, + type, + default_value + }; + if (extra_info) { + for (const i2 in extra_info) { + o2[i2] = extra_info[i2]; + } + } + this.properties_info ||= []; + this.properties_info.push(o2); + this.properties ||= {}; + this.properties[name2] = default_value; + return o2; + } + /** + * add a new output slot to use in this node + * @param type string defining the output type ("vec3","number",...) + * @param extra_info this can be used to have special properties of an output (label, special color, position, etc) + */ + addOutput(name2, type, extra_info) { + const output = { name: name2, type, links: null }; + if (extra_info) { + for (const i2 in extra_info) { + output[i2] = extra_info[i2]; + } + } + this.outputs ||= []; + this.outputs.push(output); + this.onOutputAdded?.(output); + if (LiteGraph.auto_load_slot_types) + LiteGraph.registerNodeAndSlotType(this, type, true); + this.setSize(this.computeSize()); + this.setDirtyCanvas(true, true); + return output; + } + /** + * add a new output slot to use in this node + * @param array of triplets like [[name,type,extra_info],[...]] + */ + addOutputs(array) { + for (let i2 = 0; i2 < array.length; ++i2) { + const info = array[i2]; + const o2 = { name: info[0], type: info[1], links: null }; + if (array[2]) { + for (const j2 in info[2]) { + o2[j2] = info[2][j2]; + } + } + this.outputs ||= []; + this.outputs.push(o2); + this.onOutputAdded?.(o2); + if (LiteGraph.auto_load_slot_types) + LiteGraph.registerNodeAndSlotType(this, info[1], true); + } + this.setSize(this.computeSize()); + this.setDirtyCanvas(true, true); + } + /** + * remove an existing output slot + */ + removeOutput(slot) { + this.disconnectOutput(slot); + this.outputs.splice(slot, 1); + for (let i2 = slot; i2 < this.outputs.length; ++i2) { + if (!this.outputs[i2] || !this.outputs[i2].links) continue; + const links = this.outputs[i2].links; + for (let j2 = 0; j2 < links.length; ++j2) { + const link2 = this.graph._links.get(links[j2]); + if (!link2) continue; + link2.origin_slot -= 1; + } + } + this.setSize(this.computeSize()); + this.onOutputRemoved?.(slot); + this.setDirtyCanvas(true, true); + } + /** + * add a new input slot to use in this node + * @param type string defining the input type ("vec3","number",...), it its a generic one use 0 + * @param extra_info this can be used to have special properties of an input (label, color, position, etc) + */ + addInput(name2, type, extra_info) { + type = type || 0; + const input = { name: name2, type, link: null }; + if (extra_info) { + for (const i2 in extra_info) { + input[i2] = extra_info[i2]; + } + } + this.inputs ||= []; + this.inputs.push(input); + this.setSize(this.computeSize()); + this.onInputAdded?.(input); + LiteGraph.registerNodeAndSlotType(this, type); + this.setDirtyCanvas(true, true); + return input; + } + /** + * add several new input slots in this node + * @param array of triplets like [[name,type,extra_info],[...]] + */ + addInputs(array) { + for (let i2 = 0; i2 < array.length; ++i2) { + const info = array[i2]; + const o2 = { name: info[0], type: info[1], link: null }; + if (array[2]) { + for (const j2 in info[2]) { + o2[j2] = info[2][j2]; + } + } + this.inputs ||= []; + this.inputs.push(o2); + this.onInputAdded?.(o2); + LiteGraph.registerNodeAndSlotType(this, info[1]); + } + this.setSize(this.computeSize()); + this.setDirtyCanvas(true, true); + } + /** + * remove an existing input slot + */ + removeInput(slot) { + this.disconnectInput(slot); + const slot_info = this.inputs.splice(slot, 1); + for (let i2 = slot; i2 < this.inputs.length; ++i2) { + if (!this.inputs[i2]) continue; + const link2 = this.graph._links.get(this.inputs[i2].link); + if (!link2) continue; + link2.target_slot -= 1; + } + this.setSize(this.computeSize()); + this.onInputRemoved?.(slot, slot_info[0]); + this.setDirtyCanvas(true, true); + } + /** + * add an special connection to this node (used for special kinds of graphs) + * @param type string defining the input type ("vec3","number",...) + * @param pos position of the connection inside the node + * @param direction if is input or output + */ + addConnection(name2, type, pos2, direction) { + const o2 = { + name: name2, + type, + pos: pos2, + direction, + links: null + }; + this.connections.push(o2); + return o2; + } + /** + * computes the minimum size of a node according to its inputs and output slots + * @returns the total size + */ + computeSize(out) { + const ctorSize = this.constructor.size; + if (ctorSize) return [ctorSize[0], ctorSize[1]]; + let rows = Math.max( + this.inputs ? this.inputs.length : 1, + this.outputs ? this.outputs.length : 1 + ); + const size2 = out || new Float32Array([0, 0]); + rows = Math.max(rows, 1); + const font_size = LiteGraph.NODE_TEXT_SIZE; + const title_width = compute_text_size(this.title); + let input_width = 0; + let output_width = 0; + if (this.inputs) { + for (let i2 = 0, l2 = this.inputs.length; i2 < l2; ++i2) { + const input = this.inputs[i2]; + const text2 = input.label || input.localized_name || input.name || ""; + const text_width = compute_text_size(text2); + if (input_width < text_width) + input_width = text_width; + } + } + if (this.outputs) { + for (let i2 = 0, l2 = this.outputs.length; i2 < l2; ++i2) { + const output = this.outputs[i2]; + const text2 = output.label || output.localized_name || output.name || ""; + const text_width = compute_text_size(text2); + if (output_width < text_width) + output_width = text_width; + } + } + size2[0] = Math.max(input_width + output_width + 10, title_width); + size2[0] = Math.max(size2[0], LiteGraph.NODE_WIDTH); + if (this.widgets?.length) + size2[0] = Math.max(size2[0], LiteGraph.NODE_WIDTH * 1.5); + size2[1] = (this.constructor.slot_start_y || 0) + rows * LiteGraph.NODE_SLOT_HEIGHT; + let widgets_height = 0; + if (this.widgets?.length) { + for (let i2 = 0, l2 = this.widgets.length; i2 < l2; ++i2) { + const widget2 = this.widgets[i2]; + if (widget2.hidden || widget2.advanced && !this.showAdvanced) continue; + widgets_height += widget2.computeSize ? widget2.computeSize(size2[0])[1] + 4 : LiteGraph.NODE_WIDGET_HEIGHT + 4; + } + widgets_height += 8; + } + if (this.widgets_up) + size2[1] = Math.max(size2[1], widgets_height); + else if (this.widgets_start_y != null) + size2[1] = Math.max(size2[1], widgets_height + this.widgets_start_y); + else + size2[1] += widgets_height; + function compute_text_size(text2) { + return text2 ? font_size * text2.length * 0.6 : 0; + } + __name(compute_text_size, "compute_text_size"); + if (this.constructor.min_height && size2[1] < this.constructor.min_height) { + size2[1] = this.constructor.min_height; + } + size2[1] += 6; + return size2; + } + inResizeCorner(canvasX, canvasY) { + const rows = this.outputs ? this.outputs.length : 1; + const outputs_offset = (this.constructor.slot_start_y || 0) + rows * LiteGraph.NODE_SLOT_HEIGHT; + return isInRectangle( + canvasX, + canvasY, + this.pos[0] + this.size[0] - 15, + this.pos[1] + Math.max(this.size[1] - 15, outputs_offset), + 20, + 20 + ); + } + /** + * returns all the info available about a property of this node. + * @param property name of the property + * @returns the object with all the available info + */ + getPropertyInfo(property) { + let info = null; + if (this.properties_info) { + for (let i2 = 0; i2 < this.properties_info.length; ++i2) { + if (this.properties_info[i2].name == property) { + info = this.properties_info[i2]; + break; + } + } + } + if (this.constructor["@" + property]) + info = this.constructor["@" + property]; + if (this.constructor.widgets_info?.[property]) + info = this.constructor.widgets_info[property]; + if (!info && this.onGetPropertyInfo) { + info = this.onGetPropertyInfo(property); + } + info ||= {}; + info.type ||= typeof this.properties[property]; + if (info.widget == "combo") info.type = "enum"; + return info; + } + /** + * Defines a widget inside the node, it will be rendered on top of the node, you can control lots of properties + * @param type the widget type (could be "number","string","combo" + * @param name the text to show on the widget + * @param value the default value + * @param callback function to call when it changes (optionally, it can be the name of the property to modify) + * @param options the object that contains special properties of this widget + * @returns the created widget object + */ + addWidget(type, name2, value4, callback, options4) { + this.widgets ||= []; + if (!options4 && callback && typeof callback === "object") { + options4 = callback; + callback = null; + } + if (options4 && typeof options4 === "string") + options4 = { property: options4 }; + if (callback && typeof callback === "string") { + options4 ||= {}; + options4.property = callback; + callback = null; + } + if (callback && typeof callback !== "function") { + console.warn("addWidget: callback must be a function"); + callback = null; + } + const w2 = { + // @ts-expect-error Type check or just assert? + type: type.toLowerCase(), + name: name2, + value: value4, + callback, + options: options4 || {} + }; + if (w2.options.y !== void 0) { + w2.y = w2.options.y; + } + if (!callback && !w2.options.callback && !w2.options.property) { + console.warn("LiteGraph addWidget(...) without a callback or property assigned"); + } + if (type == "combo" && !w2.options.values) { + throw "LiteGraph addWidget('combo',...) requires to pass values in options: { values:['red','blue'] }"; + } + this.widgets.push(w2); + this.setSize(this.computeSize()); + return w2; + } + addCustomWidget(custom_widget) { + this.widgets ||= []; + this.widgets.push(custom_widget); + return custom_widget; + } + move(deltaX, deltaY) { + if (this.pinned) return; + this.pos[0] += deltaX; + this.pos[1] += deltaY; + } + /** + * Internal method to measure the node for rendering. Prefer {@link boundingRect} where possible. + * + * Populates {@link out} with the results in graph space. + * Adjusts for title and collapsed status, but does not call {@link onBounding}. + * @param out `x, y, width, height` are written to this array. + * @param pad Expands the area by this amount on each side. Default: 0 + */ + measure(out, pad = 0) { + const titleMode = this.constructor.title_mode; + const renderTitle = titleMode != TitleMode.TRANSPARENT_TITLE && titleMode != TitleMode.NO_TITLE; + const titleHeight = renderTitle ? LiteGraph.NODE_TITLE_HEIGHT : 0; + out[0] = this.pos[0] - pad; + out[1] = this.pos[1] + -titleHeight - pad; + if (!this.flags?.collapsed) { + out[2] = this.size[0] + 2 * pad; + out[3] = this.size[1] + titleHeight + 2 * pad; + } else { + out[2] = (this._collapsed_width || LiteGraph.NODE_COLLAPSED_WIDTH) + 2 * pad; + out[3] = LiteGraph.NODE_TITLE_HEIGHT + 2 * pad; + } + } + /** + * returns the bounding of the object, used for rendering purposes + * @param out {Float32Array[4]?} [optional] a place to store the output, to free garbage + * @param includeExternal {boolean?} [optional] set to true to + * include the shadow and connection points in the bounding calculation + * @returns the bounding box in format of [topleft_cornerx, topleft_cornery, width, height] + */ + getBounding(out, includeExternal) { + out ||= new Float32Array(4); + const rect = includeExternal ? this.renderArea : this.boundingRect; + out[0] = rect[0]; + out[1] = rect[1]; + out[2] = rect[2]; + out[3] = rect[3]; + return out; + } + /** + * Calculates the render area of this node, populating both {@link boundingRect} and {@link renderArea}. + * Called automatically at the start of every frame. + */ + updateArea() { + const bounds = this.#boundingRect; + this.measure(bounds); + this.onBounding?.(bounds); + const renderArea = this.#renderArea; + renderArea.set(bounds); + renderArea[0] -= 4; + renderArea[1] -= 4; + renderArea[2] += 6 + 4; + renderArea[3] += 5 + 4; + } + /** + * checks if a point is inside the shape of a node + */ + isPointInside(x2, y2) { + return isInRect(x2, y2, this.boundingRect); + } + /** + * Checks if the provided point is inside this node's collapse button area. + * @param x X co-ordinate to check + * @param y Y co-ordinate to check + * @returns true if the x,y point is in the collapse button area, otherwise false + */ + isPointInCollapse(x2, y2) { + const squareLength = LiteGraph.NODE_TITLE_HEIGHT; + return isInRectangle( + x2, + y2, + this.pos[0], + this.pos[1] - squareLength, + squareLength, + squareLength + ); + } + /** + * checks if a point is inside a node slot, and returns info about which slot + * @param x + * @param y + * @returns if found the object contains { input|output: slot object, slot: number, link_pos: [x,y] } + */ + getSlotInPosition(x2, y2) { + const link_pos = new Float32Array(2); + if (this.inputs) { + for (let i2 = 0, l2 = this.inputs.length; i2 < l2; ++i2) { + const input = this.inputs[i2]; + this.getConnectionPos(true, i2, link_pos); + if (isInRectangle(x2, y2, link_pos[0] - 10, link_pos[1] - 5, 20, 10)) { + return { input, slot: i2, link_pos }; + } + } + } + if (this.outputs) { + for (let i2 = 0, l2 = this.outputs.length; i2 < l2; ++i2) { + const output = this.outputs[i2]; + this.getConnectionPos(false, i2, link_pos); + if (isInRectangle(x2, y2, link_pos[0] - 10, link_pos[1] - 5, 20, 10)) { + return { output, slot: i2, link_pos }; + } + } + } + return null; + } + /** + * Gets the widget on this node at the given co-ordinates. + * @param canvasX X co-ordinate in graph space + * @param canvasY Y co-ordinate in graph space + * @returns The widget found, otherwise `null` + */ + getWidgetOnPos(canvasX, canvasY, includeDisabled = false) { + const { widgets, pos: pos2, size: size2 } = this; + if (!widgets?.length) return null; + const x2 = canvasX - pos2[0]; + const y2 = canvasY - pos2[1]; + const nodeWidth = size2[0]; + for (const widget2 of widgets) { + if (!widget2 || widget2.disabled && !includeDisabled || widget2.hidden || widget2.advanced && !this.showAdvanced) + continue; + const h2 = widget2.computeSize ? widget2.computeSize(nodeWidth)[1] : LiteGraph.NODE_WIDGET_HEIGHT; + const w2 = widget2.width || nodeWidth; + if (widget2.last_y !== void 0 && isInRectangle(x2, y2, 6, widget2.last_y, w2 - 12, h2)) + return widget2; + } + return null; + } + findInputSlot(name2, returnObj = false) { + if (!this.inputs) return -1; + for (let i2 = 0, l2 = this.inputs.length; i2 < l2; ++i2) { + if (name2 == this.inputs[i2].name) { + return !returnObj ? i2 : this.inputs[i2]; + } + } + return -1; + } + findOutputSlot(name2, returnObj = false) { + if (!this.outputs) return -1; + for (let i2 = 0, l2 = this.outputs.length; i2 < l2; ++i2) { + if (name2 == this.outputs[i2].name) { + return !returnObj ? i2 : this.outputs[i2]; + } + } + return -1; + } + findInputSlotFree(optsIn) { + return this.#findFreeSlot(this.inputs, optsIn); + } + findOutputSlotFree(optsIn) { + return this.#findFreeSlot(this.outputs, optsIn); + } + /** + * Finds the next free slot + * @param slots The slots to search, i.e. this.inputs or this.outputs + */ + #findFreeSlot(slots, options4) { + const defaults2 = { + returnObj: false, + typesNotAccepted: [] + }; + const opts = Object.assign(defaults2, options4 || {}); + const length = slots?.length; + if (!(length > 0)) return -1; + for (let i2 = 0; i2 < length; ++i2) { + const slot = slots[i2]; + if (!slot || slot.link || slot.links?.length) continue; + if (opts.typesNotAccepted?.includes?.(slot.type)) continue; + return !opts.returnObj ? i2 : slot; + } + return -1; + } + findInputSlotByType(type, returnObj, preferFreeSlot, doNotUseOccupied) { + return this.#findSlotByType( + this.inputs, + type, + returnObj, + preferFreeSlot, + doNotUseOccupied + ); + } + findOutputSlotByType(type, returnObj, preferFreeSlot, doNotUseOccupied) { + return this.#findSlotByType( + this.outputs, + type, + returnObj, + preferFreeSlot, + doNotUseOccupied + ); + } + findSlotByType(input, type, returnObj, preferFreeSlot, doNotUseOccupied) { + return input ? this.#findSlotByType( + this.inputs, + type, + returnObj, + preferFreeSlot, + doNotUseOccupied + ) : this.#findSlotByType( + this.outputs, + type, + returnObj, + preferFreeSlot, + doNotUseOccupied + ); + } + /** + * Finds a matching slot from those provided, returning the slot itself or its index in {@link slots}. + * @param slots Slots to search (this.inputs or this.outputs) + * @param type Type of slot to look for + * @param returnObj If true, returns the slot itself. Otherwise, the index. + * @param preferFreeSlot Prefer a free slot, but if none are found, fall back to an occupied slot. + * @param doNotUseOccupied Do not fall back to occupied slots. + * @see {findSlotByType} + * @see {findOutputSlotByType} + * @see {findInputSlotByType} + * @returns If a match is found, the slot if returnObj is true, otherwise the index. If no matches are found, -1 + */ + #findSlotByType(slots, type, returnObj, preferFreeSlot, doNotUseOccupied) { + const length = slots?.length; + if (!length) return -1; + if (type == "" || type == "*") type = 0; + const sourceTypes = String(type).toLowerCase().split(","); + let occupiedSlot = null; + for (let i2 = 0; i2 < length; ++i2) { + const slot = slots[i2]; + const destTypes = slot.type == "0" || slot.type == "*" ? ["0"] : String(slot.type).toLowerCase().split(","); + for (const sourceType of sourceTypes) { + const source = sourceType == "_event_" ? LiteGraph.EVENT : sourceType; + for (const destType of destTypes) { + const dest = destType == "_event_" ? LiteGraph.EVENT : destType; + if (source == dest || source === "*" || dest === "*") { + if (preferFreeSlot && (slot.links?.length || slot.link != null)) { + occupiedSlot ??= returnObj ? slot : i2; + continue; + } + return returnObj ? slot : i2; + } + } + } + } + return doNotUseOccupied ? -1 : occupiedSlot ?? -1; + } + /** + * Determines the slot index to connect to when attempting to connect by type. + * @param findInputs If true, searches for an input. Otherwise, an output. + * @param node The node at the other end of the connection. + * @param slotType The type of slot at the other end of the connection. + * @param options Search restrictions to adhere to. + * @see {connectByType} + * @see {connectByTypeOutput} + */ + findConnectByTypeSlot(findInputs, node22, slotType, options4) { + if (options4 && typeof options4 === "object") { + if ("firstFreeIfInputGeneralInCase" in options4) options4.wildcardToTyped = !!options4.firstFreeIfInputGeneralInCase; + if ("firstFreeIfOutputGeneralInCase" in options4) options4.wildcardToTyped = !!options4.firstFreeIfOutputGeneralInCase; + if ("generalTypeInCase" in options4) options4.typedToWildcard = !!options4.generalTypeInCase; + } + const optsDef = { + createEventInCase: true, + wildcardToTyped: true, + typedToWildcard: true + }; + const opts = Object.assign(optsDef, options4); + if (node22 && typeof node22 === "number") { + node22 = this.graph.getNodeById(node22); + } + const slot = node22.findSlotByType(findInputs, slotType, false, true); + if (slot >= 0 && slot !== null) return slot; + if (opts.createEventInCase && slotType == LiteGraph.EVENT) { + if (findInputs) return -1; + if (LiteGraph.do_add_triggers_slots) return node22.addOnExecutedOutput(); + } + if (opts.typedToWildcard) { + const generalSlot = node22.findSlotByType(findInputs, 0, false, true, true); + if (generalSlot >= 0) return generalSlot; + } + if (opts.wildcardToTyped && (slotType == 0 || slotType == "*" || slotType == "")) { + const opt = { typesNotAccepted: [LiteGraph.EVENT] }; + const nonEventSlot = findInputs ? node22.findInputSlotFree(opt) : node22.findOutputSlotFree(opt); + if (nonEventSlot >= 0) return nonEventSlot; + } + return null; + } + /** + * connect this node output to the input of another node BY TYPE + * @param slot (could be the number of the slot or the string with the name of the slot) + * @param target_node the target node + * @param target_slotType the input slot type of the target node + * @returns the link_info is created, otherwise null + */ + connectByType(slot, target_node, target_slotType, optsIn) { + const slotIndex = this.findConnectByTypeSlot( + true, + target_node, + target_slotType, + optsIn + ); + if (slotIndex !== null) + return this.connect(slot, target_node, slotIndex, optsIn?.afterRerouteId); + console.debug("[connectByType]: no way to connect type: ", target_slotType, " to node: ", target_node); + return null; + } + /** + * connect this node input to the output of another node BY TYPE + * @param slot (could be the number of the slot or the string with the name of the slot) + * @param source_node the target node + * @param source_slotType the output slot type of the target node + * @returns the link_info is created, otherwise null + */ + connectByTypeOutput(slot, source_node, source_slotType, optsIn) { + if (typeof optsIn === "object") { + if ("firstFreeIfInputGeneralInCase" in optsIn) optsIn.wildcardToTyped = !!optsIn.firstFreeIfInputGeneralInCase; + if ("generalTypeInCase" in optsIn) optsIn.typedToWildcard = !!optsIn.generalTypeInCase; + } + const slotIndex = this.findConnectByTypeSlot( + false, + source_node, + source_slotType, + optsIn + ); + if (slotIndex !== null) + return source_node.connect(slotIndex, this, slot, optsIn?.afterRerouteId); + console.debug("[connectByType]: no way to connect type: ", source_slotType, " to node: ", source_node); + return null; + } + /** + * Connect an output of this node to an input of another node + * @param slot (could be the number of the slot or the string with the name of the slot) + * @param target_node the target node + * @param target_slot the input slot of the target node (could be the number of the slot or the string with the name of the slot, or -1 to connect a trigger) + * @returns the link_info is created, otherwise null + */ + connect(slot, target_node, target_slot, afterRerouteId) { + let targetIndex; + const graph = this.graph; + if (!graph) { + console.log("Connect: Error, node doesn't belong to any graph. Nodes must be added first to a graph before connecting them."); + return null; + } + if (typeof slot === "string") { + slot = this.findOutputSlot(slot); + if (slot == -1) { + if (LiteGraph.debug) console.log("Connect: Error, no slot of name " + slot); + return null; + } + } else if (!this.outputs || slot >= this.outputs.length) { + if (LiteGraph.debug) console.log("Connect: Error, slot number not found"); + return null; + } + if (target_node && typeof target_node === "number") { + target_node = graph.getNodeById(target_node); + } + if (!target_node) throw "target node is null"; + if (target_node == this) return null; + if (typeof target_slot === "string") { + targetIndex = target_node.findInputSlot(target_slot); + if (targetIndex == -1) { + if (LiteGraph.debug) console.log("Connect: Error, no slot of name " + targetIndex); + return null; + } + } else if (target_slot === LiteGraph.EVENT) { + if (LiteGraph.do_add_triggers_slots) { + target_node.changeMode(LGraphEventMode.ON_TRIGGER); + targetIndex = target_node.findInputSlot("onTrigger"); + } else { + return null; + } + } else if (typeof target_slot === "number") { + targetIndex = target_slot; + } else { + targetIndex = 0; + } + if (target_node.onBeforeConnectInput) { + const requestedIndex = target_node.onBeforeConnectInput(targetIndex, target_slot); + targetIndex = typeof requestedIndex === "number" ? requestedIndex : null; + } + if (targetIndex === null || !target_node.inputs || targetIndex >= target_node.inputs.length) { + if (LiteGraph.debug) console.log("Connect: Error, slot number not found"); + return null; + } + let changed = false; + const input = target_node.inputs[targetIndex]; + let link_info = null; + const output = this.outputs[slot]; + if (!this.outputs[slot]) return null; + if (!LiteGraph.isValidConnection(output.type, input.type)) { + this.setDirtyCanvas(false, true); + if (changed) graph.connectionChange(this, link_info); + return null; + } + if (target_node.onConnectInput?.(targetIndex, output.type, output, this, slot) === false) + return null; + if (this.onConnectOutput?.(slot, input.type, input, target_node, targetIndex) === false) + return null; + if (target_node.inputs[targetIndex]?.link != null) { + graph.beforeChange(); + target_node.disconnectInput(targetIndex, true); + changed = true; + } + if (output.links?.length) { + if (output.type === LiteGraph.EVENT && !LiteGraph.allow_multi_output_for_events) { + graph.beforeChange(); + this.disconnectOutput(slot, false, { doProcessChange: false }); + changed = true; + } + } + const nextId = ++graph.state.lastLinkId; + link_info = new LLink( + nextId, + input.type || output.type, + this.id, + slot, + target_node.id, + targetIndex, + afterRerouteId + ); + graph._links.set(link_info.id, link_info); + output.links ??= []; + output.links.push(link_info.id); + target_node.inputs[targetIndex].link = link_info.id; + LLink.getReroutes(graph, link_info).forEach((x2) => x2?.linkIds.add(nextId)); + graph._version++; + this.onConnectionsChange?.( + NodeSlotType.OUTPUT, + slot, + true, + link_info, + output + ); + target_node.onConnectionsChange?.( + NodeSlotType.INPUT, + targetIndex, + true, + link_info, + input + ); + graph.onNodeConnectionChange?.( + NodeSlotType.INPUT, + target_node, + targetIndex, + this, + slot + ); + graph.onNodeConnectionChange?.( + NodeSlotType.OUTPUT, + this, + slot, + target_node, + targetIndex + ); + this.setDirtyCanvas(false, true); + graph.afterChange(); + graph.connectionChange(this); + return link_info; + } + /** + * disconnect one output to an specific node + * @param slot (could be the number of the slot or the string with the name of the slot) + * @param target_node the target node to which this slot is connected [Optional, + * if not target_node is specified all nodes will be disconnected] + * @returns if it was disconnected successfully + */ + disconnectOutput(slot, target_node) { + if (typeof slot === "string") { + slot = this.findOutputSlot(slot); + if (slot == -1) { + if (LiteGraph.debug) console.log("Connect: Error, no slot of name " + slot); + return false; + } + } else if (!this.outputs || slot >= this.outputs.length) { + if (LiteGraph.debug) console.log("Connect: Error, slot number not found"); + return false; + } + const output = this.outputs[slot]; + if (!output || !output.links || output.links.length == 0) return false; + const graph = this.graph; + if (target_node) { + if (typeof target_node === "number") + target_node = graph.getNodeById(target_node); + if (!target_node) throw "Target Node not found"; + for (let i2 = 0, l2 = output.links.length; i2 < l2; i2++) { + const link_id = output.links[i2]; + const link_info = graph._links.get(link_id); + if (link_info.target_id == target_node.id) { + output.links.splice(i2, 1); + const input = target_node.inputs[link_info.target_slot]; + input.link = null; + graph._links.delete(link_id); + graph._version++; + target_node.onConnectionsChange?.( + NodeSlotType.INPUT, + link_info.target_slot, + false, + link_info, + input + ); + this.onConnectionsChange?.( + NodeSlotType.OUTPUT, + slot, + false, + link_info, + output + ); + graph.onNodeConnectionChange?.(NodeSlotType.OUTPUT, this, slot); + graph.onNodeConnectionChange?.(NodeSlotType.INPUT, target_node, link_info.target_slot); + break; + } + } + } else { + for (let i2 = 0, l2 = output.links.length; i2 < l2; i2++) { + const link_id = output.links[i2]; + const link_info = graph._links.get(link_id); + if (!link_info) continue; + target_node = graph.getNodeById(link_info.target_id); + graph._version++; + if (target_node) { + const input = target_node.inputs[link_info.target_slot]; + input.link = null; + target_node.onConnectionsChange?.( + NodeSlotType.INPUT, + link_info.target_slot, + false, + link_info, + input + ); + } + graph._links.delete(link_id); + this.onConnectionsChange?.( + NodeSlotType.OUTPUT, + slot, + false, + link_info, + output + ); + graph.onNodeConnectionChange?.(NodeSlotType.OUTPUT, this, slot); + graph.onNodeConnectionChange?.(NodeSlotType.INPUT, target_node, link_info.target_slot); + } + output.links = null; + } + this.setDirtyCanvas(false, true); + graph.connectionChange(this); + return true; + } + /** + * Disconnect one input + * @param slot Input slot index, or the name of the slot + * @param keepReroutes If `true`, reroutes will not be garbage collected. + * @returns true if disconnected successfully or already disconnected, otherwise false + */ + disconnectInput(slot, keepReroutes) { + if (typeof slot === "string") { + slot = this.findInputSlot(slot); + if (slot == -1) { + if (LiteGraph.debug) console.log("Connect: Error, no slot of name " + slot); + return false; + } + } else if (!this.inputs || slot >= this.inputs.length) { + if (LiteGraph.debug) { + console.log("Connect: Error, slot number not found"); + } + return false; + } + const input = this.inputs[slot]; + if (!input) return false; + const link_id = this.inputs[slot].link; + if (link_id != null) { + this.inputs[slot].link = null; + const link_info = this.graph._links.get(link_id); + if (link_info) { + const target_node = this.graph.getNodeById(link_info.origin_id); + if (!target_node) return false; + const output = target_node.outputs[link_info.origin_slot]; + if (!(output?.links?.length > 0)) return false; + let i2 = 0; + for (const l2 = output.links.length; i2 < l2; i2++) { + if (output.links[i2] == link_id) { + output.links.splice(i2, 1); + break; + } + } + link_info.disconnect(this.graph, keepReroutes); + if (this.graph) this.graph._version++; + this.onConnectionsChange?.( + NodeSlotType.INPUT, + slot, + false, + link_info, + input + ); + target_node.onConnectionsChange?.( + NodeSlotType.OUTPUT, + i2, + false, + link_info, + output + ); + this.graph?.onNodeConnectionChange?.(NodeSlotType.OUTPUT, target_node, i2); + this.graph?.onNodeConnectionChange?.(NodeSlotType.INPUT, this, slot); + } + } + this.setDirtyCanvas(false, true); + this.graph?.connectionChange(this); + return true; + } + /** + * returns the center of a connection point in canvas coords + * @param is_input true if if a input slot, false if it is an output + * @param slot_number (could be the number of the slot or the string with the name of the slot) + * @param out [optional] a place to store the output, to free garbage + * @returns the position + */ + getConnectionPos(is_input, slot_number, out) { + out ||= new Float32Array(2); + const num_slots = is_input ? this.inputs?.length ?? 0 : this.outputs?.length ?? 0; + const offset = LiteGraph.NODE_SLOT_HEIGHT * 0.5; + if (this.flags.collapsed) { + const w2 = this._collapsed_width || LiteGraph.NODE_COLLAPSED_WIDTH; + if (this.horizontal) { + out[0] = this.pos[0] + w2 * 0.5; + out[1] = is_input ? this.pos[1] - LiteGraph.NODE_TITLE_HEIGHT : this.pos[1]; + } else { + out[0] = is_input ? this.pos[0] : this.pos[0] + w2; + out[1] = this.pos[1] - LiteGraph.NODE_TITLE_HEIGHT * 0.5; + } + return out; + } + if (is_input && slot_number == -1) { + out[0] = this.pos[0] + LiteGraph.NODE_TITLE_HEIGHT * 0.5; + out[1] = this.pos[1] + LiteGraph.NODE_TITLE_HEIGHT * 0.5; + return out; + } + if (is_input && num_slots > slot_number && this.inputs[slot_number].pos) { + out[0] = this.pos[0] + this.inputs[slot_number].pos[0]; + out[1] = this.pos[1] + this.inputs[slot_number].pos[1]; + return out; + } else if (!is_input && num_slots > slot_number && this.outputs[slot_number].pos) { + out[0] = this.pos[0] + this.outputs[slot_number].pos[0]; + out[1] = this.pos[1] + this.outputs[slot_number].pos[1]; + return out; + } + if (this.horizontal) { + out[0] = this.pos[0] + (slot_number + 0.5) * (this.size[0] / num_slots); + out[1] = is_input ? this.pos[1] - LiteGraph.NODE_TITLE_HEIGHT : this.pos[1] + this.size[1]; + return out; + } + out[0] = is_input ? this.pos[0] + offset : this.pos[0] + this.size[0] + 1 - offset; + out[1] = this.pos[1] + (slot_number + 0.7) * LiteGraph.NODE_SLOT_HEIGHT + (this.constructor.slot_start_y || 0); + return out; + } + /** @inheritdoc */ + snapToGrid(snapTo) { + return this.pinned ? false : snapPoint(this.pos, snapTo); + } + /** @see {@link snapToGrid} */ + alignToGrid() { + this.snapToGrid(LiteGraph.CANVAS_GRID_SIZE); + } + /* Console output */ + trace(msg) { + this.console ||= []; + this.console.push(msg); + if (this.console.length > LGraphNode.MAX_CONSOLE) + this.console.shift(); + this.graph.onNodeTrace?.(this, msg); + } + /* Forces to redraw or the main canvas (LGraphNode) or the bg canvas (links) */ + setDirtyCanvas(dirty_foreground, dirty_background) { + this.graph?.canvasAction((c2) => c2.setDirty(dirty_foreground, dirty_background)); + } + loadImage(url) { + const img = new Image(); + img.src = LiteGraph.node_images_path + url; + img.ready = false; + const that = this; + img.onload = function() { + this.ready = true; + that.setDirtyCanvas(true); + }; + return img; + } + /* Allows to get onMouseMove and onMouseUp events even if the mouse is out of focus */ + captureInput(v2) { + if (!this.graph || !this.graph.list_of_graphcanvas) return; + const list2 = this.graph.list_of_graphcanvas; + for (let i2 = 0; i2 < list2.length; ++i2) { + const c2 = list2[i2]; + if (!v2 && c2.node_capturing_input != this) continue; + c2.node_capturing_input = v2 ? this : null; + } + } + get collapsed() { + return !!this.flags.collapsed; + } + get collapsible() { + return !this.pinned && this.constructor.collapsable !== false; + } + /** + * Toggle node collapse (makes it smaller on the canvas) + */ + collapse(force) { + if (!this.collapsible && !force) return; + this.graph._version++; + this.flags.collapsed = !this.flags.collapsed; + this.setDirtyCanvas(true, true); + } + /** + * Toggles advanced mode of the node, showing advanced widgets + */ + toggleAdvanced() { + if (!this.widgets?.some((w2) => w2.advanced)) return; + this.graph._version++; + this.showAdvanced = !this.showAdvanced; + const prefSize = this.computeSize(); + if (this.size[0] < prefSize[0] || this.size[1] < prefSize[1]) { + this.setSize([ + Math.max(this.size[0], prefSize[0]), + Math.max(this.size[1], prefSize[1]) + ]); + } + this.setDirtyCanvas(true, true); + } + get pinned() { + return !!this.flags.pinned; + } + /** + * Prevents the node being accidentally moved or resized by mouse interaction. + * Toggles pinned state if no value is provided. + */ + pin(v2) { + if (this.graph) { + this.graph._version++; + } + this.flags.pinned = v2 ?? !this.flags.pinned; + this.resizable = !this.pinned; + if (!this.pinned) delete this.flags.pinned; + } + unpin() { + this.pin(false); + } + localToScreen(x2, y2, dragAndScale) { + return [ + (x2 + this.pos[0]) * dragAndScale.scale + dragAndScale.offset[0], + (y2 + this.pos[1]) * dragAndScale.scale + dragAndScale.offset[1] + ]; + } + get width() { + return this.collapsed ? this._collapsed_width || LiteGraph.NODE_COLLAPSED_WIDTH : this.size[0]; + } + get height() { + return this.collapsed ? LiteGraph.NODE_COLLAPSED_HEIGHT : this.size[1]; + } + drawBadges(ctx, { gap = 2 } = {}) { + const badgeInstances = this.badges.map((badge) => badge instanceof LGraphBadge ? badge : badge()); + const isLeftAligned = this.badgePosition === BadgePosition.TopLeft; + let currentX = isLeftAligned ? 0 : this.width - badgeInstances.reduce((acc, badge) => acc + badge.getWidth(ctx) + gap, 0); + const y2 = -(LiteGraph.NODE_TITLE_HEIGHT + gap); + for (const badge of badgeInstances) { + badge.draw(ctx, currentX, y2 - badge.height); + currentX += badge.getWidth(ctx) + gap; + } + } + /** + * Attempts to gracefully bypass this node in all of its connections by reconnecting all links. + * + * Each input is checked against each output. This is done on a matching index basis, i.e. input 3 -> output 3. + * If there are any input links remaining, + * and {@link flags}.{@link INodeFlags.keepAllLinksOnBypass keepAllLinksOnBypass} is `true`, + * each input will check for outputs that match, and take the first one that matches + * `true`: Try the index matching first, then every input to every output. + * `false`: Only matches indexes, e.g. input 3 to output 3. + * + * If {@link flags}.{@link INodeFlags.keepAllLinksOnBypass keepAllLinksOnBypass} is `undefined`, it will fall back to + * the static {@link keepAllLinksOnBypass}. + * @returns `true` if any new links were established, otherwise `false`. + * @todo Decision: Change API to return array of new links instead? + */ + connectInputToOutput() { + const { inputs, outputs, graph } = this; + if (!inputs || !outputs) return; + const { _links } = graph; + let madeAnyConnections = false; + for (const [index2, input] of inputs.entries()) { + const output = outputs[index2]; + if (!output || !LiteGraph.isValidConnection(input.type, output.type)) continue; + const inLink = _links.get(input.link); + const inNode = graph.getNodeById(inLink?.origin_id); + if (!inNode) continue; + bypassAllLinks(output, inNode, inLink); + } + if (!(this.flags.keepAllLinksOnBypass ?? LGraphNode.keepAllLinksOnBypass)) + return madeAnyConnections; + for (const input of inputs) { + const inLink = _links.get(input.link); + const inNode = graph.getNodeById(inLink?.origin_id); + if (!inNode) continue; + for (const output of outputs) { + if (!LiteGraph.isValidConnection(input.type, output.type)) continue; + bypassAllLinks(output, inNode, inLink); + break; + } + } + return madeAnyConnections; + function bypassAllLinks(output, inNode, inLink) { + const outLinks = output.links?.map((x2) => _links.get(x2)).filter((x2) => !!x2); + if (!outLinks?.length) return; + for (const outLink of outLinks) { + const outNode = graph.getNodeById(outLink.target_id); + if (!outNode) return; + const result = inNode.connect( + inLink.origin_slot, + outNode, + outLink.target_slot, + inLink.parentId + ); + madeAnyConnections ||= !!result; + } + } + __name(bypassAllLinks, "bypassAllLinks"); + } +} +class LGraphGroup { + static { + __name(this, "LGraphGroup"); + } + static minWidth = 140; + static minHeight = 80; + static resizeLength = 10; + static padding = 4; + static defaultColour = "#335"; + id; + color; + title; + font; + font_size = LiteGraph.DEFAULT_GROUP_FONT || 24; + _bounding = new Float32Array([ + 10, + 10, + LGraphGroup.minWidth, + LGraphGroup.minHeight + ]); + _pos = this._bounding.subarray(0, 2); + _size = this._bounding.subarray(2, 4); + /** @deprecated See {@link _children} */ + _nodes = []; + _children = /* @__PURE__ */ new Set(); + graph = null; + flags = {}; + selected; + constructor(title, id3) { + this.id = id3 ?? -1; + this.title = title || "Group"; + this.color = LGraphCanvas.node_colors.pale_blue ? LGraphCanvas.node_colors.pale_blue.groupcolor : "#AAA"; + } + /** Position of the group, as x,y co-ordinates in graph space */ + get pos() { + return this._pos; + } + set pos(v2) { + if (!v2 || v2.length < 2) return; + this._pos[0] = v2[0]; + this._pos[1] = v2[1]; + } + /** Size of the group, as width,height in graph units */ + get size() { + return this._size; + } + set size(v2) { + if (!v2 || v2.length < 2) return; + this._size[0] = Math.max(LGraphGroup.minWidth, v2[0]); + this._size[1] = Math.max(LGraphGroup.minHeight, v2[1]); + } + get boundingRect() { + return this._bounding; + } + get nodes() { + return this._nodes; + } + get titleHeight() { + return this.font_size * 1.4; + } + get children() { + return this._children; + } + get pinned() { + return !!this.flags.pinned; + } + /** + * Prevents the group being accidentally moved or resized by mouse interaction. + * Toggles pinned state if no value is provided. + */ + pin(value4) { + const newState = value4 === void 0 ? !this.pinned : value4; + if (newState) this.flags.pinned = true; + else delete this.flags.pinned; + } + unpin() { + this.pin(false); + } + configure(o2) { + this.id = o2.id; + this.title = o2.title; + this._bounding.set(o2.bounding); + this.color = o2.color; + this.flags = o2.flags || this.flags; + if (o2.font_size) this.font_size = o2.font_size; + } + serialize() { + const b2 = this._bounding; + return { + id: this.id, + title: this.title, + bounding: [...b2], + color: this.color, + font_size: this.font_size, + flags: this.flags + }; + } + /** + * Draws the group on the canvas + * @param graphCanvas + * @param ctx + */ + draw(graphCanvas, ctx) { + const { padding, resizeLength, defaultColour } = LGraphGroup; + const font_size = this.font_size || LiteGraph.DEFAULT_GROUP_FONT_SIZE; + const [x2, y2] = this._pos; + const [width2, height] = this._size; + ctx.globalAlpha = 0.25 * graphCanvas.editor_alpha; + ctx.fillStyle = this.color || defaultColour; + ctx.strokeStyle = this.color || defaultColour; + ctx.beginPath(); + ctx.rect(x2 + 0.5, y2 + 0.5, width2, font_size * 1.4); + ctx.fill(); + ctx.fillStyle = this.color; + ctx.strokeStyle = this.color; + ctx.beginPath(); + ctx.rect(x2 + 0.5, y2 + 0.5, width2, height); + ctx.fill(); + ctx.globalAlpha = graphCanvas.editor_alpha; + ctx.stroke(); + ctx.beginPath(); + ctx.moveTo(x2 + width2, y2 + height); + ctx.lineTo(x2 + width2 - resizeLength, y2 + height); + ctx.lineTo(x2 + width2, y2 + height - resizeLength); + ctx.fill(); + ctx.font = font_size + "px Arial"; + ctx.textAlign = "left"; + ctx.fillText(this.title + (this.pinned ? "📌" : ""), x2 + padding, y2 + font_size); + if (LiteGraph.highlight_selected_group && this.selected) { + graphCanvas.strokeShape(ctx, this._bounding, { + title_height: this.titleHeight, + padding + }); + } + } + resize(width2, height) { + if (this.pinned) return false; + this._size[0] = Math.max(LGraphGroup.minWidth, width2); + this._size[1] = Math.max(LGraphGroup.minHeight, height); + return true; + } + move(deltaX, deltaY, skipChildren = false) { + if (this.pinned) return; + this._pos[0] += deltaX; + this._pos[1] += deltaY; + if (skipChildren === true) return; + for (const item3 of this._children) { + item3.move(deltaX, deltaY); + } + } + /** @inheritdoc */ + snapToGrid(snapTo) { + return this.pinned ? false : snapPoint(this.pos, snapTo); + } + recomputeInsideNodes() { + const { nodes, reroutes, groups } = this.graph; + const children = this._children; + this._nodes.length = 0; + children.clear(); + for (const node22 of nodes) { + if (containsCentre(this._bounding, node22.boundingRect)) { + this._nodes.push(node22); + children.add(node22); + } + } + for (const reroute of reroutes.values()) { + if (isPointInRect(reroute.pos, this._bounding)) + children.add(reroute); + } + for (const group of groups) { + if (containsRect(this._bounding, group._bounding)) + children.add(group); + } + groups.sort((a2, b2) => { + if (a2 === this) { + return children.has(b2) ? -1 : 0; + } else if (b2 === this) { + return children.has(a2) ? 1 : 0; + } + }); + } + /** + * Resizes and moves the group to neatly fit all given {@link objects}. + * @param objects All objects that should be inside the group + * @param padding Value in graph units to add to all sides of the group. Default: 10 + */ + resizeTo(objects, padding = 10) { + const boundingBox = createBounds(objects, padding); + if (boundingBox === null) return; + this.pos[0] = boundingBox[0]; + this.pos[1] = boundingBox[1] - this.titleHeight; + this.size[0] = boundingBox[2]; + this.size[1] = boundingBox[3] + this.titleHeight; + } + /** + * Add nodes to the group and adjust the group's position and size accordingly + * @param nodes The nodes to add to the group + * @param padding The padding around the group + */ + addNodes(nodes, padding = 10) { + if (!this._nodes && nodes.length === 0) return; + this.resizeTo([...this.children, ...this._nodes, ...nodes], padding); + } + getMenuOptions() { + return [ + { + content: this.pinned ? "Unpin" : "Pin", + callback: /* @__PURE__ */ __name(() => { + if (this.pinned) this.unpin(); + else this.pin(); + this.setDirtyCanvas(false, true); + }, "callback") + }, + null, + { content: "Title", callback: LGraphCanvas.onShowPropertyEditor }, + { + content: "Color", + has_submenu: true, + callback: LGraphCanvas.onMenuNodeColors + }, + { + content: "Font size", + property: "font_size", + type: "Number", + callback: LGraphCanvas.onShowPropertyEditor + }, + null, + { content: "Remove", callback: LGraphCanvas.onMenuNodeRemove } + ]; + } + isPointInTitlebar(x2, y2) { + const b2 = this.boundingRect; + return isInRectangle(x2, y2, b2[0], b2[1], b2[2], this.titleHeight); + } + isInResize(x2, y2) { + const b2 = this.boundingRect; + const right = b2[0] + b2[2]; + const bottom = b2[1] + b2[3]; + return x2 < right && y2 < bottom && x2 - right + (y2 - bottom) > -LGraphGroup.resizeLength; + } + isPointInside = LGraphNode.prototype.isPointInside; + setDirtyCanvas = LGraphNode.prototype.setDirtyCanvas; +} +var SlotType = /* @__PURE__ */ ((SlotType2) => { + SlotType2["Array"] = "array"; + SlotType2[SlotType2["Event"] = -1] = "Event"; + return SlotType2; +})(SlotType || {}); +var SlotShape = ((SlotShape2) => { + SlotShape2[SlotShape2["Box"] = RenderShape.BOX] = "Box"; + SlotShape2[SlotShape2["Arrow"] = RenderShape.ARROW] = "Arrow"; + SlotShape2[SlotShape2["Grid"] = RenderShape.GRID] = "Grid"; + SlotShape2[SlotShape2["Circle"] = RenderShape.CIRCLE] = "Circle"; + SlotShape2[SlotShape2["HollowCircle"] = RenderShape.HollowCircle] = "HollowCircle"; + return SlotShape2; +})(SlotShape || {}); +var SlotDirection = ((SlotDirection2) => { + SlotDirection2[SlotDirection2["Up"] = LinkDirection.UP] = "Up"; + SlotDirection2[SlotDirection2["Right"] = LinkDirection.RIGHT] = "Right"; + SlotDirection2[SlotDirection2["Down"] = LinkDirection.DOWN] = "Down"; + SlotDirection2[SlotDirection2["Left"] = LinkDirection.LEFT] = "Left"; + return SlotDirection2; +})(SlotDirection || {}); +var LabelPosition = /* @__PURE__ */ ((LabelPosition2) => { + LabelPosition2["Left"] = "left"; + LabelPosition2["Right"] = "right"; + return LabelPosition2; +})(LabelPosition || {}); +function drawSlot(ctx, slot, pos2, { + label_color = "#AAA", + label_position = "right", + horizontal: horizontal2 = false, + low_quality = false, + render_text = true, + do_stroke = false, + highlight = false +} = {}) { + const originalFillStyle = ctx.fillStyle; + const originalStrokeStyle = ctx.strokeStyle; + const originalLineWidth = ctx.lineWidth; + const slot_type = slot.type; + const slot_shape = slot_type === "array" ? SlotShape.Grid : slot.shape; + ctx.beginPath(); + let doStroke = do_stroke; + let doFill = true; + if (slot_type === -1 || slot_shape === SlotShape.Box) { + if (horizontal2) { + ctx.rect(pos2[0] - 5 + 0.5, pos2[1] - 8 + 0.5, 10, 14); + } else { + ctx.rect(pos2[0] - 6 + 0.5, pos2[1] - 5 + 0.5, 14, 10); + } + } else if (slot_shape === SlotShape.Arrow) { + ctx.moveTo(pos2[0] + 8, pos2[1] + 0.5); + ctx.lineTo(pos2[0] - 4, pos2[1] + 6 + 0.5); + ctx.lineTo(pos2[0] - 4, pos2[1] - 6 + 0.5); + ctx.closePath(); + } else if (slot_shape === SlotShape.Grid) { + const gridSize = 3; + const cellSize = 2; + const spacing = 3; + for (let x2 = 0; x2 < gridSize; x2++) { + for (let y2 = 0; y2 < gridSize; y2++) { + ctx.rect( + pos2[0] - 4 + x2 * spacing, + pos2[1] - 4 + y2 * spacing, + cellSize, + cellSize + ); + } + } + doStroke = false; + } else { + if (low_quality) { + ctx.rect(pos2[0] - 4, pos2[1] - 4, 8, 8); + } else { + let radius; + if (slot_shape === SlotShape.HollowCircle) { + doFill = false; + doStroke = true; + ctx.lineWidth = 3; + ctx.strokeStyle = ctx.fillStyle; + radius = highlight ? 4 : 3; + } else { + radius = highlight ? 5 : 4; + } + ctx.arc(pos2[0], pos2[1], radius, 0, Math.PI * 2); + } + } + if (doFill) ctx.fill(); + if (!low_quality && doStroke) ctx.stroke(); + if (render_text) { + const text2 = slot.label || slot.localized_name || slot.name; + if (text2) { + ctx.fillStyle = label_color; + if (label_position === "right") { + if (horizontal2 || slot.dir == LinkDirection.UP) { + ctx.fillText(text2, pos2[0], pos2[1] - 10); + } else { + ctx.fillText(text2, pos2[0] + 10, pos2[1] + 5); + } + } else { + if (horizontal2 || slot.dir == LinkDirection.DOWN) { + ctx.fillText(text2, pos2[0], pos2[1] - 8); + } else { + ctx.fillText(text2, pos2[0] - 10, pos2[1] + 5); + } + } + } + } + ctx.fillStyle = originalFillStyle; + ctx.strokeStyle = originalStrokeStyle; + ctx.lineWidth = originalLineWidth; +} +__name(drawSlot, "drawSlot"); +class DragAndScale { + static { + __name(this, "DragAndScale"); + } + /** + * The state of this DragAndScale instance. + * + * Implemented as a POCO that can be proxied without side-effects. + */ + state; + /** Maximum scale (zoom in) */ + max_scale; + /** Minimum scale (zoom out) */ + min_scale; + enabled; + last_mouse; + element; + visible_area; + _binded_mouse_callback; + dragging; + viewport; + get offset() { + return this.state.offset; + } + set offset(value4) { + this.state.offset = value4; + } + get scale() { + return this.state.scale; + } + set scale(value4) { + this.state.scale = value4; + } + constructor(element, skip_events) { + this.state = { + offset: new Float32Array([0, 0]), + scale: 1 + }; + this.max_scale = 10; + this.min_scale = 0.1; + this.onredraw = null; + this.enabled = true; + this.last_mouse = [0, 0]; + this.element = null; + this.visible_area = new Float32Array(4); + if (element) { + this.element = element; + if (!skip_events) { + this.bindEvents(element); + } + } + } + /** @deprecated Has not been kept up to date */ + bindEvents(element) { + this.last_mouse = new Float32Array(2); + this._binded_mouse_callback = this.onMouse.bind(this); + LiteGraph.pointerListenerAdd(element, "down", this._binded_mouse_callback); + LiteGraph.pointerListenerAdd(element, "move", this._binded_mouse_callback); + LiteGraph.pointerListenerAdd(element, "up", this._binded_mouse_callback); + element.addEventListener("mousewheel", this._binded_mouse_callback, false); + element.addEventListener("wheel", this._binded_mouse_callback, false); + } + computeVisibleArea(viewport) { + if (!this.element) { + this.visible_area[0] = this.visible_area[1] = this.visible_area[2] = this.visible_area[3] = 0; + return; + } + let width2 = this.element.width; + let height = this.element.height; + let startx = -this.offset[0]; + let starty = -this.offset[1]; + if (viewport) { + startx += viewport[0] / this.scale; + starty += viewport[1] / this.scale; + width2 = viewport[2]; + height = viewport[3]; + } + const endx = startx + width2 / this.scale; + const endy = starty + height / this.scale; + this.visible_area[0] = startx; + this.visible_area[1] = starty; + this.visible_area[2] = endx - startx; + this.visible_area[3] = endy - starty; + } + /** @deprecated Has not been kept up to date */ + onMouse(e2) { + if (!this.enabled) { + return; + } + const canvas = this.element; + const rect = canvas.getBoundingClientRect(); + const x2 = e2.clientX - rect.left; + const y2 = e2.clientY - rect.top; + e2.canvasx = x2; + e2.canvasy = y2; + e2.dragging = this.dragging; + const is_inside = !this.viewport || isInRect(x2, y2, this.viewport); + let ignore = false; + if (this.onmouse) { + ignore = this.onmouse(e2); + } + if (e2.type == LiteGraph.pointerevents_method + "down" && is_inside) { + this.dragging = true; + LiteGraph.pointerListenerRemove(canvas, "move", this._binded_mouse_callback); + LiteGraph.pointerListenerAdd(document, "move", this._binded_mouse_callback); + LiteGraph.pointerListenerAdd(document, "up", this._binded_mouse_callback); + } else if (e2.type == LiteGraph.pointerevents_method + "move") { + if (!ignore) { + const deltax = x2 - this.last_mouse[0]; + const deltay = y2 - this.last_mouse[1]; + if (this.dragging) { + this.mouseDrag(deltax, deltay); + } + } + } else if (e2.type == LiteGraph.pointerevents_method + "up") { + this.dragging = false; + LiteGraph.pointerListenerRemove(document, "move", this._binded_mouse_callback); + LiteGraph.pointerListenerRemove(document, "up", this._binded_mouse_callback); + LiteGraph.pointerListenerAdd(canvas, "move", this._binded_mouse_callback); + } else if (is_inside && (e2.type == "mousewheel" || e2.type == "wheel" || e2.type == "DOMMouseScroll")) { + e2.eventType = "mousewheel"; + if (e2.type == "wheel") e2.wheel = -e2.deltaY; + else e2.wheel = e2.wheelDeltaY != null ? e2.wheelDeltaY : e2.detail * -60; + e2.delta = e2.wheelDelta ? e2.wheelDelta / 40 : e2.deltaY ? -e2.deltaY / 3 : 0; + this.changeDeltaScale(1 + e2.delta * 0.05); + } + this.last_mouse[0] = x2; + this.last_mouse[1] = y2; + if (is_inside) { + e2.preventDefault(); + e2.stopPropagation(); + return false; + } + } + toCanvasContext(ctx) { + ctx.scale(this.scale, this.scale); + ctx.translate(this.offset[0], this.offset[1]); + } + convertOffsetToCanvas(pos2) { + return [ + (pos2[0] + this.offset[0]) * this.scale, + (pos2[1] + this.offset[1]) * this.scale + ]; + } + convertCanvasToOffset(pos2, out) { + out = out || [0, 0]; + out[0] = pos2[0] / this.scale - this.offset[0]; + out[1] = pos2[1] / this.scale - this.offset[1]; + return out; + } + /** @deprecated Has not been kept up to date */ + mouseDrag(x2, y2) { + this.offset[0] += x2 / this.scale; + this.offset[1] += y2 / this.scale; + this.onredraw?.(this); + } + changeScale(value4, zooming_center) { + if (value4 < this.min_scale) { + value4 = this.min_scale; + } else if (value4 > this.max_scale) { + value4 = this.max_scale; + } + if (value4 == this.scale) return; + if (!this.element) return; + const rect = this.element.getBoundingClientRect(); + if (!rect) return; + zooming_center = zooming_center || [rect.width * 0.5, rect.height * 0.5]; + zooming_center[0] -= rect.x; + zooming_center[1] -= rect.y; + const center = this.convertCanvasToOffset(zooming_center); + this.scale = value4; + if (Math.abs(this.scale - 1) < 0.01) this.scale = 1; + const new_center = this.convertCanvasToOffset(zooming_center); + const delta_offset = [ + new_center[0] - center[0], + new_center[1] - center[1] + ]; + this.offset[0] += delta_offset[0]; + this.offset[1] += delta_offset[1]; + this.onredraw?.(this); + } + changeDeltaScale(value4, zooming_center) { + this.changeScale(this.scale * value4, zooming_center); + } + reset() { + this.scale = 1; + this.offset[0] = 0; + this.offset[1] = 0; + } +} +function stringOrNull(value4) { + return value4 == null ? null : String(value4); +} +__name(stringOrNull, "stringOrNull"); +function stringOrEmpty(value4) { + return value4 == null ? "" : String(value4); +} +__name(stringOrEmpty, "stringOrEmpty"); +function getBoundaryNodes(nodes) { + const valid = nodes?.find((x2) => x2); + if (!valid) return null; + let top = valid; + let right = valid; + let bottom = valid; + let left = valid; + for (const node22 of nodes) { + if (!node22) continue; + const [x2, y2] = node22.pos; + const [width2, height] = node22.size; + if (y2 < top.pos[1]) top = node22; + if (x2 + width2 > right.pos[0] + right.size[0]) right = node22; + if (y2 + height > bottom.pos[1] + bottom.size[1]) bottom = node22; + if (x2 < left.pos[0]) left = node22; + } + return { + top, + right, + bottom, + left + }; +} +__name(getBoundaryNodes, "getBoundaryNodes"); +function distributeNodes(nodes, horizontal2) { + const nodeCount = nodes?.length; + if (!(nodeCount > 1)) return; + const index2 = horizontal2 ? 0 : 1; + let total = 0; + let highest = -Infinity; + for (const node22 of nodes) { + total += node22.size[index2]; + const high = node22.pos[index2] + node22.size[index2]; + if (high > highest) highest = high; + } + const sorted = [...nodes].sort((a2, b2) => a2.pos[index2] - b2.pos[index2]); + const lowest = sorted[0].pos[index2]; + const gap = (highest - lowest - total) / (nodeCount - 1); + let startAt = lowest; + for (let i2 = 0; i2 < nodeCount; i2++) { + const node22 = sorted[i2]; + node22.pos[index2] = startAt + gap * i2; + startAt += node22.size[index2]; + } +} +__name(distributeNodes, "distributeNodes"); +function alignNodes(nodes, direction, align_to) { + if (!nodes) return; + const boundary = align_to === void 0 ? getBoundaryNodes(nodes) : { top: align_to, right: align_to, bottom: align_to, left: align_to }; + if (boundary === null) return; + for (const node22 of nodes) { + switch (direction) { + case "right": + node22.pos[0] = boundary.right.pos[0] + boundary.right.size[0] - node22.size[0]; + break; + case "left": + node22.pos[0] = boundary.left.pos[0]; + break; + case "top": + node22.pos[1] = boundary.top.pos[1]; + break; + case "bottom": + node22.pos[1] = boundary.bottom.pos[1] + boundary.bottom.size[1] - node22.size[1]; + break; + } + } +} +__name(alignNodes, "alignNodes"); +function getAllNestedItems(items2) { + const allItems = /* @__PURE__ */ new Set(); + items2?.forEach((x2) => addRecursively(x2, allItems)); + return allItems; + function addRecursively(item3, flatSet) { + if (flatSet.has(item3) || item3.pinned) return; + flatSet.add(item3); + item3.children?.forEach((x2) => addRecursively(x2, flatSet)); + } + __name(addRecursively, "addRecursively"); +} +__name(getAllNestedItems, "getAllNestedItems"); +function findFirstNode(items2) { + for (const item3 of items2) { + if (item3 instanceof LGraphNode) return item3; + } +} +__name(findFirstNode, "findFirstNode"); +class CanvasPointer { + static { + __name(this, "CanvasPointer"); + } + /** Maximum time in milliseconds to ignore click drift */ + static bufferTime = 150; + /** Maximum gap between pointerup and pointerdown events to be considered as a double click */ + static doubleClickTime = 300; + /** Maximum offset from click location */ + static get maxClickDrift() { + return this.#maxClickDrift; + } + static set maxClickDrift(value4) { + this.#maxClickDrift = value4; + this.#maxClickDrift2 = value4 * value4; + } + static #maxClickDrift = 6; + /** {@link maxClickDrift} squared. Used to calculate click drift without `sqrt`. */ + static #maxClickDrift2 = this.#maxClickDrift ** 2; + /** The element this PointerState should capture input against when dragging. */ + element; + /** Pointer ID used by drag capture. */ + pointerId; + /** Set to true when if the pointer moves far enough after a down event, before the corresponding up event is fired. */ + dragStarted = false; + /** The {@link eUp} from the last successful click */ + eLastDown; + /** Used downstream for touch event support. */ + isDouble = false; + /** Used downstream for touch event support. */ + isDown = false; + /** + * If `true`, {@link eDown}, {@link eMove}, and {@link eUp} will be set to + * `null` when {@link reset} is called. + * + * Default: `true` + */ + clearEventsOnReset = true; + /** The last pointerdown event for the primary button */ + eDown = null; + /** The last pointermove event for the primary button */ + eMove = null; + /** The last pointerup event for the primary button */ + eUp = null; + /** + * Run-once callback, called at the end of any click or drag, whether or not it was successful in any way. + * + * The setter of this callback will call the existing value before replacing it. + * Therefore, simply setting this value twice will execute the first callback. + */ + get finally() { + return this.#finally; + } + set finally(value4) { + try { + this.#finally?.(); + } finally { + this.#finally = value4; + } + } + #finally; + constructor(element) { + this.element = element; + } + /** + * Callback for `pointerdown` events. To be used as the event handler (or called by it). + * @param e The `pointerdown` event + */ + down(e2) { + this.reset(); + this.eDown = e2; + this.pointerId = e2.pointerId; + this.element.setPointerCapture(e2.pointerId); + } + /** + * Callback for `pointermove` events. To be used as the event handler (or called by it). + * @param e The `pointermove` event + */ + move(e2) { + const { eDown } = this; + if (!eDown) return; + if (!e2.buttons) { + this.reset(); + return; + } + if (!(e2.buttons & eDown.buttons)) { + this.#completeClick(e2); + this.reset(); + return; + } + this.eMove = e2; + this.onDrag?.(e2); + if (this.dragStarted) return; + const longerThanBufferTime = e2.timeStamp - eDown.timeStamp > CanvasPointer.bufferTime; + if (longerThanBufferTime || !this.#hasSamePosition(e2, eDown)) { + this.#setDragStarted(); + } + } + /** + * Callback for `pointerup` events. To be used as the event handler (or called by it). + * @param e The `pointerup` event + */ + up(e2) { + if (e2.button !== this.eDown?.button) return false; + this.#completeClick(e2); + const { dragStarted } = this; + this.reset(); + return !dragStarted; + } + #completeClick(e2) { + const { eDown } = this; + if (!eDown) return; + this.eUp = e2; + if (this.dragStarted) { + this.onDragEnd?.(e2); + } else if (!this.#hasSamePosition(e2, eDown)) { + this.#setDragStarted(); + this.onDragEnd?.(e2); + } else if (this.onDoubleClick && this.#isDoubleClick()) { + this.onDoubleClick(e2); + this.eLastDown = void 0; + } else { + this.onClick?.(e2); + this.eLastDown = eDown; + } + } + /** + * Checks if two events occurred near each other - not further apart than the maximum click drift. + * @param a The first event to compare + * @param b The second event to compare + * @param tolerance2 The maximum distance (squared) before the positions are considered different + * @returns `true` if the two events were no more than {@link maxClickDrift} apart, otherwise `false` + */ + #hasSamePosition(a2, b2, tolerance2 = CanvasPointer.#maxClickDrift2) { + const drift = dist2(a2.clientX, a2.clientY, b2.clientX, b2.clientY); + return drift <= tolerance2; + } + /** + * Checks whether the pointer is currently past the max click drift threshold. + * @returns `true` if the latest pointer event is past the the click drift threshold + */ + #isDoubleClick() { + const { eDown, eLastDown } = this; + if (!eDown || !eLastDown) return false; + const tolerance2 = (3 * CanvasPointer.#maxClickDrift) ** 2; + const diff2 = eDown.timeStamp - eLastDown.timeStamp; + return diff2 > 0 && diff2 < CanvasPointer.doubleClickTime && this.#hasSamePosition(eDown, eLastDown, tolerance2); + } + #setDragStarted() { + this.dragStarted = true; + this.onDragStart?.(this); + delete this.onDragStart; + } + /** + * Resets the state of this {@link CanvasPointer} instance. + * + * The {@link finally} callback is first executed, then all callbacks and intra-click + * state is cleared. + */ + reset() { + this.finally = void 0; + delete this.onClick; + delete this.onDoubleClick; + delete this.onDragStart; + delete this.onDrag; + delete this.onDragEnd; + this.isDown = false; + this.isDouble = false; + this.dragStarted = false; + if (this.clearEventsOnReset) { + this.eDown = null; + this.eMove = null; + this.eUp = null; + } + const { element, pointerId } = this; + if (element.hasPointerCapture(pointerId)) + element.releasePointerCapture(pointerId); + } +} +class LGraphCanvas { + static { + __name(this, "LGraphCanvas"); + } + // Optimised buffers used during rendering + static #temp = new Float32Array(4); + static #temp_vec2 = new Float32Array(2); + static #tmp_area = new Float32Array(4); + static #margin_area = new Float32Array(4); + static #link_bounding = new Float32Array(4); + static #tempA = new Float32Array(2); + static #tempB = new Float32Array(2); + static #lTempA = new Float32Array(2); + static #lTempB = new Float32Array(2); + static #lTempC = new Float32Array(2); + static DEFAULT_BACKGROUND_IMAGE = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQBJREFUeNrs1rEKwjAUhlETUkj3vP9rdmr1Ysammk2w5wdxuLgcMHyptfawuZX4pJSWZTnfnu/lnIe/jNNxHHGNn//HNbbv+4dr6V+11uF527arU7+u63qfa/bnmh8sWLBgwYJlqRf8MEptXPBXJXa37BSl3ixYsGDBMliwFLyCV/DeLIMFCxYsWLBMwSt4Be/NggXLYMGCBUvBK3iNruC9WbBgwYJlsGApeAWv4L1ZBgsWLFiwYJmCV/AK3psFC5bBggULloJX8BpdwXuzYMGCBctgwVLwCl7Be7MMFixYsGDBsu8FH1FaSmExVfAxBa/gvVmwYMGCZbBg/W4vAQYA5tRF9QYlv/QAAAAASUVORK5CYII="; + /** Initialised from LiteGraphGlobal static block to avoid circular dependency. */ + static link_type_colors; + static gradients = {}; + // cache of gradients + static search_limit = -1; + static node_colors = { + red: { color: "#322", bgcolor: "#533", groupcolor: "#A88" }, + brown: { color: "#332922", bgcolor: "#593930", groupcolor: "#b06634" }, + green: { color: "#232", bgcolor: "#353", groupcolor: "#8A8" }, + blue: { color: "#223", bgcolor: "#335", groupcolor: "#88A" }, + pale_blue: { + color: "#2a363b", + bgcolor: "#3f5159", + groupcolor: "#3f789e" + }, + cyan: { color: "#233", bgcolor: "#355", groupcolor: "#8AA" }, + purple: { color: "#323", bgcolor: "#535", groupcolor: "#a1309b" }, + yellow: { color: "#432", bgcolor: "#653", groupcolor: "#b58b2a" }, + black: { color: "#222", bgcolor: "#000", groupcolor: "#444" } + }; + /** + * The state of this canvas, e.g. whether it is being dragged, or read-only. + * + * Implemented as a POCO that can be proxied without side-effects. + */ + state = { + draggingItems: false, + draggingCanvas: false, + readOnly: false, + hoveringOver: CanvasItem.Nothing, + shouldSetCursor: true + }; + #updateCursorStyle() { + if (this.state.shouldSetCursor) { + let cursor = "default"; + if (this.state.draggingCanvas) { + cursor = "grabbing"; + } else if (this.state.readOnly) { + cursor = "grab"; + } else if (this.state.hoveringOver & CanvasItem.ResizeSe) { + cursor = "se-resize"; + } else if (this.state.hoveringOver & CanvasItem.Node) { + cursor = "crosshair"; + } + this.canvas.style.cursor = cursor; + } + } + // Whether the canvas was previously being dragged prior to pressing space key. + // null if space key is not pressed. + _previously_dragging_canvas = null; + // #region Legacy accessors + /** @deprecated @inheritdoc {@link LGraphCanvasState.readOnly} */ + get read_only() { + return this.state.readOnly; + } + set read_only(value4) { + this.state.readOnly = value4; + this.#updateCursorStyle(); + } + get isDragging() { + return this.state.draggingItems; + } + set isDragging(value4) { + this.state.draggingItems = value4; + } + get hoveringOver() { + return this.state.hoveringOver; + } + set hoveringOver(value4) { + this.state.hoveringOver = value4; + this.#updateCursorStyle(); + } + /** @deprecated Replace all references with {@link pointer}.{@link CanvasPointer.isDown isDown}. */ + get pointer_is_down() { + return this.pointer.isDown; + } + /** @deprecated Replace all references with {@link pointer}.{@link CanvasPointer.isDouble isDouble}. */ + get pointer_is_double() { + return this.pointer.isDouble; + } + /** @deprecated @inheritdoc {@link LGraphCanvasState.draggingCanvas} */ + get dragging_canvas() { + return this.state.draggingCanvas; + } + set dragging_canvas(value4) { + this.state.draggingCanvas = value4; + this.#updateCursorStyle(); + } + // #endregion Legacy accessors + get title_text_font() { + return `${LiteGraph.NODE_TEXT_SIZE}px Arial`; + } + get inner_text_font() { + return `normal ${LiteGraph.NODE_SUBTEXT_SIZE}px Arial`; + } + #maximumFrameGap = 0; + /** Maximum frames per second to render. 0: unlimited. Default: 0 */ + get maximumFps() { + return this.#maximumFrameGap > Number.EPSILON ? this.#maximumFrameGap / 1e3 : 0; + } + set maximumFps(value4) { + this.#maximumFrameGap = value4 > Number.EPSILON ? 1e3 / value4 : 0; + } + options; + background_image; + ds; + pointer; + zoom_modify_alpha; + zoom_speed; + node_title_color; + default_link_color; + default_connection_color; + default_connection_color_byType; + default_connection_color_byTypeOff; + highquality_render; + use_gradients; + editor_alpha; + pause_rendering; + clear_background; + clear_background_color; + render_only_selected; + show_info; + allow_dragcanvas; + allow_dragnodes; + allow_interaction; + multi_select; + allow_searchbox; + allow_reconnect_links; + align_to_grid; + drag_mode; + dragging_rectangle; + filter; + set_canvas_dirty_on_mouse_event; + always_render_background; + render_shadows; + render_canvas_border; + render_connections_shadows; + render_connections_border; + render_curved_connections; + render_connection_arrows; + render_collapsed_slots; + render_execution_order; + render_title_colored; + render_link_tooltip; + /** Controls whether reroutes are rendered at all. */ + reroutesEnabled = false; + /** Shape of the markers shown at the midpoint of links. Default: Circle */ + linkMarkerShape = LinkMarkerShape.Circle; + links_render_mode; + /** mouse in canvas coordinates, where 0,0 is the top-left corner of the blue rectangle */ + mouse; + /** mouse in graph coordinates, where 0,0 is the top-left corner of the blue rectangle */ + graph_mouse; + /** @deprecated LEGACY: REMOVE THIS, USE {@link graph_mouse} INSTEAD */ + canvas_mouse; + /** to personalize the search box */ + onSearchBox; + onSearchBoxSelection; + onMouse; + /** to render background objects (behind nodes and connections) in the canvas affected by transform */ + onDrawBackground; + /** to render foreground objects (above nodes and connections) in the canvas affected by transform */ + onDrawForeground; + connections_width; + round_radius; + /** The current node being drawn by {@link drawNode}. This should NOT be used to determine the currently selected node. See {@link selectedItems} */ + current_node; + /** used for widgets */ + node_widget; + /** The link to draw a tooltip for. */ + over_link_center; + last_mouse_position; + /** The visible area of this canvas. Tightly coupled with {@link ds}. */ + visible_area; + /** Contains all links and reroutes that were rendered. Repopulated every render cycle. */ + renderedPaths = /* @__PURE__ */ new Set(); + visible_links; + connecting_links; + /** The viewport of this canvas. Tightly coupled with {@link ds}. */ + viewport; + autoresize; + static active_canvas; + frame = 0; + last_draw_time = 0; + render_time = 0; + fps = 0; + /** @deprecated See {@link LGraphCanvas.selectedItems} */ + selected_nodes = {}; + /** All selected nodes, groups, and reroutes */ + selectedItems = /* @__PURE__ */ new Set(); + /** The group currently being resized. */ + resizingGroup = null; + /** @deprecated See {@link LGraphCanvas.selectedItems} */ + selected_group = null; + visible_nodes = []; + node_over; + node_capturing_input; + highlighted_links = {}; + link_over_widget; + link_over_widget_type; + dirty_canvas = true; + dirty_bgcanvas = true; + /** A map of nodes that require selective-redraw */ + dirty_nodes = /* @__PURE__ */ new Map(); + dirty_area; + /** @deprecated Unused */ + node_in_panel; + last_mouse = [0, 0]; + last_mouseclick = 0; + graph; + _graph_stack = null; + canvas; + bgcanvas; + ctx; + _events_binded; + /** @deprecated WebGL */ + gl; + bgctx; + is_rendering; + /** @deprecated Panels */ + block_click; + /** @deprecated Panels */ + last_click_position; + resizing_node; + /** @deprecated See {@link LGraphCanvas.resizingGroup} */ + selected_group_resizing; + /** @deprecated See {@link pointer}.{@link CanvasPointer.dragStarted dragStarted} */ + last_mouse_dragging; + onMouseDown; + _highlight_pos; + _highlight_input; + // TODO: Check if panels are used + /** @deprecated Panels */ + node_panel; + /** @deprecated Panels */ + options_panel; + onDropItem; + _bg_img; + _pattern; + _pattern_img; + // TODO: This looks like another panel thing + prompt_box; + search_box; + /** @deprecated Panels */ + SELECTED_NODE; + /** @deprecated Panels */ + NODEPANEL_IS_OPEN; + /** Once per frame check of snap to grid value. @todo Update on change. */ + #snapToGrid; + /** Set on keydown, keyup. @todo */ + #shiftDown = false; + static active_node; + onClear; + /** called after moving a node @deprecated Does not handle multi-node move, and can return the wrong node. */ + onNodeMoved; + /** called if the selection changes */ + onSelectionChange; + /** called when rendering a tooltip */ + onDrawLinkTooltip; + /** to render foreground objects not affected by transform (for GUIs) */ + onDrawOverlay; + onRenderBackground; + onNodeDblClicked; + onShowNodePanel; + onNodeSelected; + onNodeDeselected; + onRender; + /** Implement this function to allow conversion of widget types to input types, e.g. number -> INT or FLOAT for widget link validation checks */ + getWidgetLinkType; + /** + * Creates a new instance of LGraphCanvas. + * @param canvas The canvas HTML element (or its id) to use, or null / undefined to leave blank. + * @param graph The graph that owns this canvas. + * @param options + */ + constructor(canvas, graph, options4) { + options4 ||= {}; + this.options = options4; + this.background_image = LGraphCanvas.DEFAULT_BACKGROUND_IMAGE; + this.ds = new DragAndScale(); + this.pointer = new CanvasPointer(this.canvas); + this.zoom_modify_alpha = true; + this.zoom_speed = 1.1; + this.node_title_color = LiteGraph.NODE_TITLE_COLOR; + this.default_link_color = LiteGraph.LINK_COLOR; + this.default_connection_color = { + input_off: "#778", + input_on: "#7F7", + // "#BBD" + output_off: "#778", + output_on: "#7F7" + // "#BBD" + }; + this.default_connection_color_byType = { + /* number: "#7F7", + string: "#77F", + boolean: "#F77", */ + }; + this.default_connection_color_byTypeOff = { + /* number: "#474", + string: "#447", + boolean: "#744", */ + }; + this.highquality_render = true; + this.use_gradients = false; + this.editor_alpha = 1; + this.pause_rendering = false; + this.clear_background = true; + this.clear_background_color = "#222"; + this.render_only_selected = true; + this.show_info = true; + this.allow_dragcanvas = true; + this.allow_dragnodes = true; + this.allow_interaction = true; + this.multi_select = false; + this.allow_searchbox = true; + this.allow_reconnect_links = true; + this.align_to_grid = false; + this.drag_mode = false; + this.dragging_rectangle = null; + this.filter = null; + this.set_canvas_dirty_on_mouse_event = true; + this.always_render_background = false; + this.render_shadows = true; + this.render_canvas_border = true; + this.render_connections_shadows = false; + this.render_connections_border = true; + this.render_curved_connections = false; + this.render_connection_arrows = false; + this.render_collapsed_slots = true; + this.render_execution_order = false; + this.render_title_colored = true; + this.render_link_tooltip = true; + this.links_render_mode = LinkRenderType.SPLINE_LINK; + this.mouse = [0, 0]; + this.graph_mouse = [0, 0]; + this.canvas_mouse = this.graph_mouse; + this.onSearchBox = null; + this.onSearchBoxSelection = null; + this.onMouse = null; + this.onDrawBackground = null; + this.onDrawForeground = null; + this.onDrawOverlay = null; + this.onDrawLinkTooltip = null; + this.onNodeMoved = null; + this.onSelectionChange = null; + this.onConnectingChange = null; + this.onBeforeChange = null; + this.onAfterChange = null; + this.connections_width = 3; + this.round_radius = 8; + this.current_node = null; + this.node_widget = null; + this.over_link_center = null; + this.last_mouse_position = [0, 0]; + this.visible_area = this.ds.visible_area; + this.visible_links = []; + this.connecting_links = null; + this.viewport = options4.viewport || null; + graph?.attachCanvas(this); + this.setCanvas(canvas, options4.skip_events); + this.clear(); + if (!options4.skip_render) { + this.startRendering(); + } + this.autoresize = options4.autoresize; + } + static getFileExtension(url) { + const question = url.indexOf("?"); + if (question !== -1) url = url.substring(0, question); + const point = url.lastIndexOf("."); + return point === -1 ? "" : url.substring(point + 1).toLowerCase(); + } + static onGroupAdd(info, entry, mouse_event) { + const canvas = LGraphCanvas.active_canvas; + const group = new LiteGraph.LGraphGroup(); + group.pos = canvas.convertEventToCanvasOffset(mouse_event); + canvas.graph.add(group); + } + /** + * @deprecated Functionality moved to {@link getBoundaryNodes}. The new function returns null on failure, instead of an object with all null properties. + * Determines the furthest nodes in each direction + * @param nodes the nodes to from which boundary nodes will be extracted + * @returns + */ + static getBoundaryNodes(nodes) { + const _nodes = Array.isArray(nodes) ? nodes : Object.values(nodes); + return getBoundaryNodes(_nodes) ?? { + top: null, + right: null, + bottom: null, + left: null + }; + } + /** + * @deprecated Functionality moved to {@link alignNodes}. The new function does not set dirty canvas. + * @param nodes a list of nodes + * @param direction Direction to align the nodes + * @param align_to Node to align to (if null, align to the furthest node in the given direction) + */ + static alignNodes(nodes, direction, align_to) { + alignNodes(Object.values(nodes), direction, align_to); + LGraphCanvas.active_canvas.setDirty(true, true); + } + static onNodeAlign(value4, options4, event, prev_menu, node22) { + new LiteGraph.ContextMenu(["Top", "Bottom", "Left", "Right"], { + event, + callback: inner_clicked, + parentMenu: prev_menu + }); + function inner_clicked(value22) { + alignNodes( + Object.values(LGraphCanvas.active_canvas.selected_nodes), + value22.toLowerCase(), + node22 + ); + LGraphCanvas.active_canvas.setDirty(true, true); + } + __name(inner_clicked, "inner_clicked"); + } + static onGroupAlign(value4, options4, event, prev_menu) { + new LiteGraph.ContextMenu(["Top", "Bottom", "Left", "Right"], { + event, + callback: inner_clicked, + parentMenu: prev_menu + }); + function inner_clicked(value22) { + alignNodes( + Object.values(LGraphCanvas.active_canvas.selected_nodes), + value22.toLowerCase() + ); + LGraphCanvas.active_canvas.setDirty(true, true); + } + __name(inner_clicked, "inner_clicked"); + } + static createDistributeMenu(value4, options4, event, prev_menu, node22) { + new LiteGraph.ContextMenu(["Vertically", "Horizontally"], { + event, + callback: inner_clicked, + parentMenu: prev_menu + }); + function inner_clicked(value22) { + const canvas = LGraphCanvas.active_canvas; + distributeNodes(Object.values(canvas.selected_nodes), value22 === "Horizontally"); + canvas.setDirty(true, true); + } + __name(inner_clicked, "inner_clicked"); + } + static onMenuAdd(node22, options4, e2, prev_menu, callback) { + const canvas = LGraphCanvas.active_canvas; + const ref_window = canvas.getCanvasWindow(); + const graph = canvas.graph; + if (!graph) return; + function inner_onMenuAdded(base_category, prev_menu2) { + const categories = LiteGraph.getNodeTypesCategories(canvas.filter || graph.filter).filter(function(category) { + return category.startsWith(base_category); + }); + const entries = []; + categories.map(function(category) { + if (!category) return; + const base_category_regex = new RegExp("^(" + base_category + ")"); + const category_name = category.replace(base_category_regex, "").split("/")[0]; + const category_path = base_category === "" ? category_name + "/" : base_category + category_name + "/"; + let name2 = category_name; + if (name2.indexOf("::") != -1) + name2 = name2.split("::")[1]; + const index2 = entries.findIndex(function(entry) { + return entry.value === category_path; + }); + if (index2 === -1) { + entries.push({ + value: category_path, + content: name2, + has_submenu: true, + callback: /* @__PURE__ */ __name(function(value4, event, mouseEvent, contextMenu) { + inner_onMenuAdded(value4.value, contextMenu); + }, "callback") + }); + } + }); + const nodes = LiteGraph.getNodeTypesInCategory( + base_category.slice(0, -1), + canvas.filter || graph.filter + ); + nodes.map(function(node3) { + if (node3.skip_list) return; + const entry = { + value: node3.type, + content: node3.title, + has_submenu: false, + callback: /* @__PURE__ */ __name(function(value4, event, mouseEvent, contextMenu) { + const first_event = contextMenu.getFirstEvent(); + canvas.graph.beforeChange(); + const node4 = LiteGraph.createNode(value4.value); + if (node4) { + node4.pos = canvas.convertEventToCanvasOffset(first_event); + canvas.graph.add(node4); + } + callback?.(node4); + canvas.graph.afterChange(); + }, "callback") + }; + entries.push(entry); + }); + new LiteGraph.ContextMenu(entries, { event: e2, parentMenu: prev_menu2 }, ref_window); + } + __name(inner_onMenuAdded, "inner_onMenuAdded"); + inner_onMenuAdded("", prev_menu); + return false; + } + static onMenuCollapseAll() { + } + static onMenuNodeEdit() { + } + /** @param options Parameter is never used */ + static showMenuNodeOptionalInputs(v2, options4, e2, prev_menu, node22) { + if (!node22) return; + const that = this; + const canvas = LGraphCanvas.active_canvas; + const ref_window = canvas.getCanvasWindow(); + options4 = node22.onGetInputs ? node22.onGetInputs() : node22.optional_inputs; + let entries = []; + if (options4) { + for (let i2 = 0; i2 < options4.length; i2++) { + const entry = options4[i2]; + if (!entry) { + entries.push(null); + continue; + } + let label5 = entry[0]; + entry[2] ||= {}; + if (entry[2].label) { + label5 = entry[2].label; + } + entry[2].removable = true; + const data25 = { content: label5, value: entry }; + if (entry[1] == LiteGraph.ACTION) { + data25.className = "event"; + } + entries.push(data25); + } + } + const retEntries = node22.onMenuNodeInputs?.(entries); + if (retEntries) entries = retEntries; + if (!entries.length) { + console.log("no input entries"); + return; + } + new LiteGraph.ContextMenu( + entries, + { + event: e2, + callback: inner_clicked, + parentMenu: prev_menu, + node: node22 + }, + // @ts-expect-error Unused param + ref_window + ); + function inner_clicked(v3, e3, prev2) { + if (!node22) return; + v3.callback?.call(that, node22, v3, e3, prev2); + if (!v3.value) return; + node22.graph.beforeChange(); + node22.addInput(v3.value[0], v3.value[1], v3.value[2]); + node22.onNodeInputAdd?.(v3.value); + canvas.setDirty(true, true); + node22.graph.afterChange(); + } + __name(inner_clicked, "inner_clicked"); + return false; + } + /** @param options Parameter is never used */ + static showMenuNodeOptionalOutputs(v2, options4, e2, prev_menu, node22) { + if (!node22) return; + const that = this; + const canvas = LGraphCanvas.active_canvas; + const ref_window = canvas.getCanvasWindow(); + options4 = node22.onGetOutputs ? node22.onGetOutputs() : node22.optional_outputs; + let entries = []; + if (options4) { + for (let i2 = 0; i2 < options4.length; i2++) { + const entry = options4[i2]; + if (!entry) { + entries.push(null); + continue; + } + if (node22.flags && node22.flags.skip_repeated_outputs && node22.findOutputSlot(entry[0]) != -1) { + continue; + } + let label5 = entry[0]; + entry[2] ||= {}; + if (entry[2].label) { + label5 = entry[2].label; + } + entry[2].removable = true; + const data25 = { content: label5, value: entry }; + if (entry[1] == LiteGraph.EVENT) { + data25.className = "event"; + } + entries.push(data25); + } + } + if (this.onMenuNodeOutputs) entries = this.onMenuNodeOutputs(entries); + if (LiteGraph.do_add_triggers_slots) { + if (node22.findOutputSlot("onExecuted") == -1) { + entries.push({ content: "On Executed", value: ["onExecuted", LiteGraph.EVENT, { nameLocked: true }], className: "event" }); + } + } + const retEntries = node22.onMenuNodeOutputs?.(entries); + if (retEntries) entries = retEntries; + if (!entries.length) return; + new LiteGraph.ContextMenu( + entries, + { + event: e2, + callback: inner_clicked, + parentMenu: prev_menu, + node: node22 + }, + // @ts-expect-error Unused + ref_window + ); + function inner_clicked(v3, e3, prev2) { + if (!node22) return; + if (v3.callback) v3.callback.call(that, node22, v3, e3, prev2); + if (!v3.value) return; + const value4 = v3.value[1]; + if (value4 && (typeof value4 === "object" || Array.isArray(value4))) { + const entries2 = []; + for (const i2 in value4) { + entries2.push({ content: i2, value: value4[i2] }); + } + new LiteGraph.ContextMenu(entries2, { + event: e3, + callback: inner_clicked, + parentMenu: prev_menu, + node: node22 + }); + return false; + } + const graph = node22.graph; + graph.beforeChange(); + node22.addOutput(v3.value[0], v3.value[1], v3.value[2]); + node22.onNodeOutputAdd?.(v3.value); + canvas.setDirty(true, true); + graph.afterChange(); + } + __name(inner_clicked, "inner_clicked"); + return false; + } + /** @param value Parameter is never used */ + static onShowMenuNodeProperties(value4, options4, e2, prev_menu, node22) { + if (!node22 || !node22.properties) return; + const canvas = LGraphCanvas.active_canvas; + const ref_window = canvas.getCanvasWindow(); + const entries = []; + for (const i2 in node22.properties) { + value4 = node22.properties[i2] !== void 0 ? node22.properties[i2] : " "; + if (typeof value4 == "object") + value4 = JSON.stringify(value4); + const info = node22.getPropertyInfo(i2); + if (info.type == "enum" || info.type == "combo") + value4 = LGraphCanvas.getPropertyPrintableValue(value4, info.values); + value4 = LGraphCanvas.decodeHTML(stringOrNull(value4)); + entries.push({ + content: "<span class='property_name'>" + (info.label || i2) + "</span><span class='property_value'>" + value4 + "</span>", + value: i2 + }); + } + if (!entries.length) { + return; + } + new LiteGraph.ContextMenu( + entries, + { + event: e2, + callback: inner_clicked, + parentMenu: prev_menu, + allow_html: true, + node: node22 + }, + // @ts-expect-error Unused + ref_window + ); + function inner_clicked(v2) { + if (!node22) return; + const rect = this.getBoundingClientRect(); + canvas.showEditPropertyValue(node22, v2.value, { + position: [rect.left, rect.top] + }); + } + __name(inner_clicked, "inner_clicked"); + return false; + } + static decodeHTML(str) { + const e2 = document.createElement("div"); + e2.innerText = str; + return e2.innerHTML; + } + static onMenuResizeNode(value4, options4, e2, menu2, node22) { + if (!node22) return; + const fApplyMultiNode = /* @__PURE__ */ __name(function(node3) { + node3.size = node3.computeSize(); + node3.onResize?.(node3.size); + }, "fApplyMultiNode"); + const canvas = LGraphCanvas.active_canvas; + if (!canvas.selected_nodes || Object.keys(canvas.selected_nodes).length <= 1) { + fApplyMultiNode(node22); + } else { + for (const i2 in canvas.selected_nodes) { + fApplyMultiNode(canvas.selected_nodes[i2]); + } + } + canvas.setDirty(true, true); + } + // TODO refactor :: this is used fot title but not for properties! + static onShowPropertyEditor(item3, options4, e2, menu2, node22) { + const property = item3.property || "title"; + const value4 = node22[property]; + const dialog = document.createElement("div"); + dialog.is_modified = false; + dialog.className = "graphdialog"; + dialog.innerHTML = "<span class='name'></span><input autofocus type='text' class='value'/><button>OK</button>"; + dialog.close = function() { + dialog.parentNode?.removeChild(dialog); + }; + const title = dialog.querySelector(".name"); + title.innerText = property; + const input = dialog.querySelector(".value"); + if (input) { + input.value = value4; + input.addEventListener("blur", function() { + this.focus(); + }); + input.addEventListener("keydown", function(e3) { + dialog.is_modified = true; + if (e3.keyCode == 27) { + dialog.close(); + } else if (e3.keyCode == 13) { + inner(); + } else if (e3.keyCode != 13 && e3.target.localName != "textarea") { + return; + } + e3.preventDefault(); + e3.stopPropagation(); + }); + } + const canvas = LGraphCanvas.active_canvas; + const canvasEl = canvas.canvas; + const rect = canvasEl.getBoundingClientRect(); + let offsetx = -20; + let offsety = -20; + if (rect) { + offsetx -= rect.left; + offsety -= rect.top; + } + if (e2) { + dialog.style.left = e2.clientX + offsetx + "px"; + dialog.style.top = e2.clientY + offsety + "px"; + } else { + dialog.style.left = canvasEl.width * 0.5 + offsetx + "px"; + dialog.style.top = canvasEl.height * 0.5 + offsety + "px"; + } + const button = dialog.querySelector("button"); + button.addEventListener("click", inner); + canvasEl.parentNode.appendChild(dialog); + input?.focus(); + let dialogCloseTimer = null; + dialog.addEventListener("mouseleave", function() { + if (LiteGraph.dialog_close_on_mouse_leave) { + if (!dialog.is_modified && LiteGraph.dialog_close_on_mouse_leave) + dialogCloseTimer = setTimeout( + dialog.close, + LiteGraph.dialog_close_on_mouse_leave_delay + ); + } + }); + dialog.addEventListener("mouseenter", function() { + if (LiteGraph.dialog_close_on_mouse_leave) { + if (dialogCloseTimer) clearTimeout(dialogCloseTimer); + } + }); + function inner() { + if (input) setValue2(input.value); + } + __name(inner, "inner"); + function setValue2(value22) { + if (item3.type == "Number") { + value22 = Number(value22); + } else if (item3.type == "Boolean") { + value22 = Boolean(value22); + } + node22[property] = value22; + dialog.parentNode?.removeChild(dialog); + canvas.setDirty(true, true); + } + __name(setValue2, "setValue"); + } + static getPropertyPrintableValue(value4, values) { + if (!values) return String(value4); + if (Array.isArray(values)) { + return String(value4); + } + if (typeof values === "object") { + let desc_value = ""; + for (const k2 in values) { + if (values[k2] != value4) continue; + desc_value = k2; + break; + } + return String(value4) + " (" + desc_value + ")"; + } + } + static onMenuNodeCollapse(value4, options4, e2, menu2, node22) { + node22.graph.beforeChange( + /* ? */ + ); + const fApplyMultiNode = /* @__PURE__ */ __name(function(node3) { + node3.collapse(); + }, "fApplyMultiNode"); + const graphcanvas = LGraphCanvas.active_canvas; + if (!graphcanvas.selected_nodes || Object.keys(graphcanvas.selected_nodes).length <= 1) { + fApplyMultiNode(node22); + } else { + for (const i2 in graphcanvas.selected_nodes) { + fApplyMultiNode(graphcanvas.selected_nodes[i2]); + } + } + node22.graph.afterChange( + /* ? */ + ); + } + static onMenuToggleAdvanced(value4, options4, e2, menu2, node22) { + node22.graph.beforeChange( + /* ? */ + ); + const fApplyMultiNode = /* @__PURE__ */ __name(function(node3) { + node3.toggleAdvanced(); + }, "fApplyMultiNode"); + const graphcanvas = LGraphCanvas.active_canvas; + if (!graphcanvas.selected_nodes || Object.keys(graphcanvas.selected_nodes).length <= 1) { + fApplyMultiNode(node22); + } else { + for (const i2 in graphcanvas.selected_nodes) { + fApplyMultiNode(graphcanvas.selected_nodes[i2]); + } + } + node22.graph.afterChange( + /* ? */ + ); + } + static onMenuNodePin(value4, options4, e2, menu2, node22) { + } + static onMenuNodeMode(value4, options4, e2, menu2, node22) { + new LiteGraph.ContextMenu( + LiteGraph.NODE_MODES, + { event: e2, callback: inner_clicked, parentMenu: menu2, node: node22 } + ); + function inner_clicked(v2) { + if (!node22) return; + const kV = Object.values(LiteGraph.NODE_MODES).indexOf(v2); + const fApplyMultiNode = /* @__PURE__ */ __name(function(node3) { + if (kV >= 0 && LiteGraph.NODE_MODES[kV]) + node3.changeMode(kV); + else { + console.warn("unexpected mode: " + v2); + node3.changeMode(LGraphEventMode.ALWAYS); + } + }, "fApplyMultiNode"); + const graphcanvas = LGraphCanvas.active_canvas; + if (!graphcanvas.selected_nodes || Object.keys(graphcanvas.selected_nodes).length <= 1) { + fApplyMultiNode(node22); + } else { + for (const i2 in graphcanvas.selected_nodes) { + fApplyMultiNode(graphcanvas.selected_nodes[i2]); + } + } + } + __name(inner_clicked, "inner_clicked"); + return false; + } + /** @param value Parameter is never used */ + static onMenuNodeColors(value4, options4, e2, menu2, node22) { + if (!node22) throw "no node for color"; + const values = []; + values.push({ + value: null, + content: "<span style='display: block; padding-left: 4px;'>No color</span>" + }); + for (const i2 in LGraphCanvas.node_colors) { + const color2 = LGraphCanvas.node_colors[i2]; + value4 = { + value: i2, + content: "<span style='display: block; color: #999; padding-left: 4px; border-left: 8px solid " + color2.color + "; background-color:" + color2.bgcolor + "'>" + i2 + "</span>" + }; + values.push(value4); + } + new LiteGraph.ContextMenu(values, { + event: e2, + callback: inner_clicked, + parentMenu: menu2, + node: node22 + }); + function inner_clicked(v2) { + if (!node22) return; + const color2 = v2.value ? LGraphCanvas.node_colors[v2.value] : null; + const fApplyColor = /* @__PURE__ */ __name(function(node3) { + if (color2) { + if (node3 instanceof LGraphGroup) { + node3.color = color2.groupcolor; + } else { + node3.color = color2.color; + node3.bgcolor = color2.bgcolor; + } + } else { + delete node3.color; + delete node3.bgcolor; + } + }, "fApplyColor"); + const canvas = LGraphCanvas.active_canvas; + if (!canvas.selected_nodes || Object.keys(canvas.selected_nodes).length <= 1) { + fApplyColor(node22); + } else { + for (const i2 in canvas.selected_nodes) { + fApplyColor(canvas.selected_nodes[i2]); + } + } + canvas.setDirty(true, true); + } + __name(inner_clicked, "inner_clicked"); + return false; + } + static onMenuNodeShapes(value4, options4, e2, menu2, node22) { + if (!node22) throw "no node passed"; + new LiteGraph.ContextMenu(LiteGraph.VALID_SHAPES, { + event: e2, + callback: inner_clicked, + parentMenu: menu2, + node: node22 + }); + function inner_clicked(v2) { + if (!node22) return; + node22.graph.beforeChange( + /* ? */ + ); + const fApplyMultiNode = /* @__PURE__ */ __name(function(node3) { + node3.shape = v2; + }, "fApplyMultiNode"); + const canvas = LGraphCanvas.active_canvas; + if (!canvas.selected_nodes || Object.keys(canvas.selected_nodes).length <= 1) { + fApplyMultiNode(node22); + } else { + for (const i2 in canvas.selected_nodes) { + fApplyMultiNode(canvas.selected_nodes[i2]); + } + } + node22.graph.afterChange( + /* ? */ + ); + canvas.setDirty(true); + } + __name(inner_clicked, "inner_clicked"); + return false; + } + static onMenuNodeRemove(value4, options4, e2, menu2, node22) { + if (!node22) throw "no node passed"; + const graph = node22.graph; + graph.beforeChange(); + const fApplyMultiNode = /* @__PURE__ */ __name(function(node3) { + if (node3.removable === false) return; + graph.remove(node3); + }, "fApplyMultiNode"); + const canvas = LGraphCanvas.active_canvas; + if (!canvas.selected_nodes || Object.keys(canvas.selected_nodes).length <= 1) { + fApplyMultiNode(node22); + } else { + for (const i2 in canvas.selected_nodes) { + fApplyMultiNode(canvas.selected_nodes[i2]); + } + } + graph.afterChange(); + canvas.setDirty(true, true); + } + static onMenuNodeToSubgraph(value4, options4, e2, menu2, node22) { + const graph = node22.graph; + const canvas = LGraphCanvas.active_canvas; + if (!canvas) return; + let nodes_list = Object.values(canvas.selected_nodes || {}); + if (!nodes_list.length) nodes_list = [node22]; + const subgraph_node = LiteGraph.createNode("graph/subgraph"); + subgraph_node.pos = node22.pos.concat(); + graph.add(subgraph_node); + subgraph_node.buildFromNodes(nodes_list); + canvas.deselectAll(); + canvas.setDirty(true, true); + } + static onMenuNodeClone(value4, options4, e2, menu2, node22) { + const graph = node22.graph; + graph.beforeChange(); + const newSelected = /* @__PURE__ */ new Set(); + const fApplyMultiNode = /* @__PURE__ */ __name(function(node3, newNodes) { + if (node3.clonable === false) return; + const newnode = node3.clone(); + if (!newnode) return; + newnode.pos = [node3.pos[0] + 5, node3.pos[1] + 5]; + node3.graph.add(newnode); + newNodes.add(newnode); + }, "fApplyMultiNode"); + const canvas = LGraphCanvas.active_canvas; + if (!canvas.selected_nodes || Object.keys(canvas.selected_nodes).length <= 1) { + fApplyMultiNode(node22, newSelected); + } else { + for (const i2 in canvas.selected_nodes) { + fApplyMultiNode(canvas.selected_nodes[i2], newSelected); + } + } + if (newSelected.size) { + canvas.selectNodes([...newSelected]); + } + graph.afterChange(); + canvas.setDirty(true, true); + } + /** + * clears all the data inside + * + */ + clear() { + this.frame = 0; + this.last_draw_time = 0; + this.render_time = 0; + this.fps = 0; + this.dragging_rectangle = null; + this.selected_nodes = {}; + this.selected_group = null; + this.visible_nodes = []; + this.node_over = null; + this.node_capturing_input = null; + this.connecting_links = null; + this.highlighted_links = {}; + this.dragging_canvas = false; + this.#dirty(); + this.dirty_area = null; + this.node_in_panel = null; + this.node_widget = null; + this.last_mouse = [0, 0]; + this.last_mouseclick = 0; + this.pointer.reset(); + this.visible_area.set([0, 0, 0, 0]); + this.onClear?.(); + } + /** + * assigns a graph, you can reassign graphs to the same canvas + * @param graph + */ + setGraph(graph, skip_clear) { + if (this.graph == graph) return; + if (!skip_clear) this.clear(); + if (!graph && this.graph) { + this.graph.detachCanvas(this); + return; + } + graph.attachCanvas(this); + this._graph_stack &&= null; + this.setDirty(true, true); + } + /** + * @returns the top level graph (in case there are subgraphs open on the canvas) + */ + getTopGraph() { + return this._graph_stack.length ? this._graph_stack[0] : this.graph; + } + /** + * @returns the visually active graph (in case there are more in the stack) + */ + getCurrentGraph() { + return this.graph; + } + /** + * Finds the canvas if required, throwing on failure. + * @param canvas Canvas element, or its element ID + * @returns The canvas element + * @throws If {@link canvas} is an element ID that does not belong to a valid HTML canvas element + */ + #validateCanvas(canvas) { + if (typeof canvas === "string") { + const el = document.getElementById(canvas); + if (!(el instanceof HTMLCanvasElement)) throw "Error validating LiteGraph canvas: Canvas element not found"; + return el; + } + return canvas; + } + /** + * Sets the current HTML canvas element. + * Calls bindEvents to add input event listeners, and (re)creates the background canvas. + * @param canvas The canvas element to assign, or its HTML element ID. If null or undefined, the current reference is cleared. + * @param skip_events If true, events on the previous canvas will not be removed. Has no effect on the first invocation. + */ + setCanvas(canvas, skip_events) { + const element = this.#validateCanvas(canvas); + if (element === this.canvas) return; + if (!element && this.canvas && !skip_events) this.unbindEvents(); + this.canvas = element; + this.ds.element = element; + this.pointer.element = element; + if (!element) return; + element.className += " lgraphcanvas"; + element.data = this; + element.tabindex = "1"; + this.bgcanvas = null; + if (!this.bgcanvas) { + this.bgcanvas = document.createElement("canvas"); + this.bgcanvas.width = this.canvas.width; + this.bgcanvas.height = this.canvas.height; + } + if (element.getContext == null) { + if (element.localName != "canvas") { + throw "Element supplied for LGraphCanvas must be a <canvas> element, you passed a " + element.localName; + } + throw "This browser doesn't support Canvas"; + } + const ctx = this.ctx = element.getContext("2d"); + if (ctx == null) { + if (!element.webgl_enabled) { + console.warn("This canvas seems to be WebGL, enabling WebGL renderer"); + } + this.enableWebGL(); + } + if (!skip_events) this.bindEvents(); + } + /** Captures an event and prevents default - returns false. */ + _doNothing(e2) { + e2.preventDefault(); + return false; + } + /** Captures an event and prevents default - returns true. */ + _doReturnTrue(e2) { + e2.preventDefault(); + return true; + } + /** + * binds mouse, keyboard, touch and drag events to the canvas + */ + bindEvents() { + if (this._events_binded) { + console.warn("LGraphCanvas: events already binded"); + return; + } + const canvas = this.canvas; + const ref_window = this.getCanvasWindow(); + const document2 = ref_window.document; + this._mousedown_callback = this.processMouseDown.bind(this); + this._mousewheel_callback = this.processMouseWheel.bind(this); + this._mousemove_callback = this.processMouseMove.bind(this); + this._mouseup_callback = this.processMouseUp.bind(this); + this._mouseout_callback = this.processMouseOut.bind(this); + this._mousecancel_callback = this.processMouseCancel.bind(this); + LiteGraph.pointerListenerAdd(canvas, "down", this._mousedown_callback, true); + canvas.addEventListener("mousewheel", this._mousewheel_callback, false); + LiteGraph.pointerListenerAdd(canvas, "up", this._mouseup_callback, true); + LiteGraph.pointerListenerAdd(canvas, "move", this._mousemove_callback); + canvas.addEventListener("pointerout", this._mouseout_callback); + canvas.addEventListener("pointercancel", this._mousecancel_callback, true); + canvas.addEventListener("contextmenu", this._doNothing); + canvas.addEventListener( + "DOMMouseScroll", + this._mousewheel_callback, + false + ); + this._key_callback = this.processKey.bind(this); + canvas.addEventListener("keydown", this._key_callback, true); + document2.addEventListener("keyup", this._key_callback, true); + this._ondrop_callback = this.processDrop.bind(this); + canvas.addEventListener("dragover", this._doNothing, false); + canvas.addEventListener("dragend", this._doNothing, false); + canvas.addEventListener("drop", this._ondrop_callback, false); + canvas.addEventListener("dragenter", this._doReturnTrue, false); + this._events_binded = true; + } + /** + * unbinds mouse events from the canvas + */ + unbindEvents() { + if (!this._events_binded) { + console.warn("LGraphCanvas: no events binded"); + return; + } + const ref_window = this.getCanvasWindow(); + const document2 = ref_window.document; + this.canvas.removeEventListener("pointercancel", this._mousecancel_callback); + this.canvas.removeEventListener("pointerout", this._mouseout_callback); + LiteGraph.pointerListenerRemove(this.canvas, "move", this._mousemove_callback); + LiteGraph.pointerListenerRemove(this.canvas, "up", this._mouseup_callback); + LiteGraph.pointerListenerRemove(this.canvas, "down", this._mousedown_callback); + this.canvas.removeEventListener( + "mousewheel", + this._mousewheel_callback + ); + this.canvas.removeEventListener( + "DOMMouseScroll", + this._mousewheel_callback + ); + this.canvas.removeEventListener("keydown", this._key_callback); + document2.removeEventListener("keyup", this._key_callback); + this.canvas.removeEventListener("contextmenu", this._doNothing); + this.canvas.removeEventListener("drop", this._ondrop_callback); + this.canvas.removeEventListener("dragenter", this._doReturnTrue); + this._mousedown_callback = null; + this._mousewheel_callback = null; + this._key_callback = null; + this._ondrop_callback = null; + this._events_binded = false; + } + /** + * this function allows to render the canvas using WebGL instead of Canvas2D + * this is useful if you plant to render 3D objects inside your nodes, it uses litegl.js for webgl and canvas2DtoWebGL to emulate the Canvas2D calls in webGL + */ + enableWebGL() { + if (typeof GL === "undefined") { + throw "litegl.js must be included to use a WebGL canvas"; + } + if (typeof enableWebGLCanvas === "undefined") { + throw "webglCanvas.js must be included to use this feature"; + } + this.gl = this.ctx = enableWebGLCanvas(this.canvas); + this.ctx.webgl = true; + this.bgcanvas = this.canvas; + this.bgctx = this.gl; + this.canvas.webgl_enabled = true; + } + /** + * Ensures the canvas will be redrawn on the next frame by setting the dirty flag(s). + * Without parameters, this function does nothing. + * @todo Impl. `setDirty()` or similar as shorthand to redraw everything. + * @param fgcanvas If true, marks the foreground canvas as dirty (nodes and anything drawn on top of them). Default: false + * @param bgcanvas If true, mark the background canvas as dirty (background, groups, links). Default: false + */ + setDirty(fgcanvas, bgcanvas) { + if (fgcanvas) this.dirty_canvas = true; + if (bgcanvas) this.dirty_bgcanvas = true; + } + /** Marks the entire canvas as dirty. */ + #dirty() { + this.dirty_canvas = true; + this.dirty_bgcanvas = true; + } + /** + * Used to attach the canvas in a popup + * @returns returns the window where the canvas is attached (the DOM root node) + */ + getCanvasWindow() { + if (!this.canvas) return window; + const doc2 = this.canvas.ownerDocument; + return doc2.defaultView || doc2.parentWindow; + } + /** + * starts rendering the content of the canvas when needed + * + */ + startRendering() { + if (this.is_rendering) return; + this.is_rendering = true; + renderFrame.call(this); + function renderFrame() { + if (!this.pause_rendering) { + this.draw(); + } + const window2 = this.getCanvasWindow(); + if (this.is_rendering) { + if (this.#maximumFrameGap > 0) { + const gap = this.#maximumFrameGap - (LiteGraph.getTime() - this.last_draw_time); + setTimeout(renderFrame.bind(this), Math.max(1, gap)); + } else { + window2.requestAnimationFrame(renderFrame.bind(this)); + } + } + } + __name(renderFrame, "renderFrame"); + } + /** + * stops rendering the content of the canvas (to save resources) + * + */ + stopRendering() { + this.is_rendering = false; + } + /* LiteGraphCanvas input */ + // used to block future mouse events (because of im gui) + blockClick() { + this.block_click = true; + this.last_mouseclick = 0; + } + /** + * Gets the widget at the current cursor position + * @param node Optional node to check for widgets under cursor + * @returns The widget located at the current cursor position or null + */ + getWidgetAtCursor(node22) { + node22 ??= this.node_over; + if (!node22.widgets) return null; + const graphPos = this.graph_mouse; + const x2 = graphPos[0] - node22.pos[0]; + const y2 = graphPos[1] - node22.pos[1]; + for (const widget2 of node22.widgets) { + if (widget2.hidden || widget2.advanced && !node22.showAdvanced) continue; + let widgetWidth, widgetHeight; + if (widget2.computeSize) { + [widgetWidth, widgetHeight] = widget2.computeSize(node22.size[0]); + } else { + widgetWidth = widget2.width || node22.size[0]; + widgetHeight = LiteGraph.NODE_WIDGET_HEIGHT; + } + if (widget2.last_y !== void 0 && x2 >= 6 && x2 <= widgetWidth - 12 && y2 >= widget2.last_y && y2 <= widget2.last_y + widgetHeight) { + return widget2; + } + } + return null; + } + /** + * Clears highlight and mouse-over information from nodes that should not have it. + * + * Intended to be called when the pointer moves away from a node. + * @param node The node that the mouse is now over + * @param e MouseEvent that is triggering this + */ + updateMouseOverNodes(node22, e2) { + const nodes = this.graph._nodes; + const l2 = nodes.length; + for (let i2 = 0; i2 < l2; ++i2) { + if (nodes[i2].mouseOver && node22 != nodes[i2]) { + nodes[i2].mouseOver = null; + this._highlight_input = null; + this._highlight_pos = null; + this.link_over_widget = null; + nodes[i2].lostFocusAt = LiteGraph.getTime(); + this.node_over?.onMouseLeave?.(e2); + this.node_over = null; + this.dirty_canvas = true; + } + } + } + processMouseDown(e2) { + const { graph, pointer: pointer2 } = this; + this.adjustMouseEvent(e2); + if (e2.isPrimary) pointer2.down(e2); + if (this.set_canvas_dirty_on_mouse_event) this.dirty_canvas = true; + if (!graph) return; + const ref_window = this.getCanvasWindow(); + LGraphCanvas.active_canvas = this; + const x2 = e2.clientX; + const y2 = e2.clientY; + this.ds.viewport = this.viewport; + const is_inside = !this.viewport || isInRect(x2, y2, this.viewport); + if (!is_inside) return; + const node22 = graph.getNodeOnPos(e2.canvasX, e2.canvasY, this.visible_nodes); + this.mouse[0] = x2; + this.mouse[1] = y2; + this.graph_mouse[0] = e2.canvasX; + this.graph_mouse[1] = e2.canvasY; + this.last_click_position = [this.mouse[0], this.mouse[1]]; + pointer2.isDouble = pointer2.isDown && e2.isPrimary; + pointer2.isDown = true; + this.canvas.focus(); + LiteGraph.closeAllContextMenus(ref_window); + if (this.onMouse?.(e2) == true) return; + if (e2.button === 0 && !pointer2.isDouble) { + this.#processPrimaryButton(e2, node22); + } else if (e2.button === 1) { + this.#processMiddleButton(e2, node22); + } else if ((e2.button === 2 || pointer2.isDouble) && this.allow_interaction && !this.read_only) { + if (node22) this.processSelect(node22, e2, true); + this.processContextMenu(node22, e2); + } + this.last_mouse = [x2, y2]; + this.last_mouseclick = LiteGraph.getTime(); + this.last_mouse_dragging = true; + graph.change(); + if (!ref_window.document.activeElement || ref_window.document.activeElement.nodeName.toLowerCase() != "input" && ref_window.document.activeElement.nodeName.toLowerCase() != "textarea") { + e2.preventDefault(); + } + e2.stopPropagation(); + this.onMouseDown?.(e2); + } + #processPrimaryButton(e2, node22) { + const { pointer: pointer2, graph } = this; + const x2 = e2.canvasX; + const y2 = e2.canvasY; + const ctrlOrMeta = e2.ctrlKey || e2.metaKey; + if (ctrlOrMeta && !e2.altKey) { + const dragRect = new Float32Array(4); + dragRect[0] = x2; + dragRect[1] = y2; + dragRect[2] = 1; + dragRect[3] = 1; + pointer2.onClick = (eUp) => { + const clickedItem = node22 ?? (this.reroutesEnabled ? graph.getRerouteOnPos(eUp.canvasX, eUp.canvasY) : null) ?? graph.getGroupTitlebarOnPos(eUp.canvasX, eUp.canvasY); + this.processSelect(clickedItem, eUp); + }; + pointer2.onDragStart = () => this.dragging_rectangle = dragRect; + pointer2.onDragEnd = (upEvent2) => this.#handleMultiSelect(upEvent2, dragRect); + pointer2.finally = () => this.dragging_rectangle = null; + return; + } + if (this.read_only) { + pointer2.finally = () => this.dragging_canvas = false; + this.dragging_canvas = true; + return; + } + if (LiteGraph.alt_drag_do_clone_nodes && e2.altKey && !e2.ctrlKey && node22 && this.allow_interaction) { + const node_data = node22.clone()?.serialize(); + const cloned = LiteGraph.createNode(node_data.type); + if (cloned) { + cloned.configure(node_data); + cloned.pos[0] += 5; + cloned.pos[1] += 5; + if (this.allow_dragnodes) { + pointer2.onDragStart = (pointer3) => { + graph.add(cloned, false); + this.#startDraggingItems(cloned, pointer3); + }; + pointer2.onDragEnd = (e3) => this.#processDraggedItems(e3); + } else { + graph.beforeChange(); + graph.add(cloned, false); + graph.afterChange(); + } + return; + } + } + if (node22 && (this.allow_interaction || node22.flags.allow_interaction)) { + this.#processNodeClick(e2, ctrlOrMeta, node22); + } else { + if (this.reroutesEnabled && this.links_render_mode !== LinkRenderType.HIDDEN_LINK) { + const reroute = graph.getRerouteOnPos(x2, y2); + if (reroute) { + if (e2.shiftKey) { + const link2 = graph._links.get(reroute.linkIds.values().next().value); + const outputNode = graph.getNodeById(link2.origin_id); + const slot = link2.origin_slot; + const connecting = { + node: outputNode, + slot, + input: null, + pos: outputNode.getConnectionPos(false, slot), + afterRerouteId: reroute.id + }; + this.connecting_links = [connecting]; + pointer2.onDragStart = () => connecting.output = outputNode.outputs[slot]; + this.dirty_bgcanvas = true; + } + pointer2.onClick = () => this.processSelect(reroute, e2); + if (!pointer2.onDragStart) { + pointer2.onDragStart = (pointer3) => this.#startDraggingItems(reroute, pointer3, true); + pointer2.onDragEnd = (e3) => this.#processDraggedItems(e3); + } + return; + } + } + const { lineWidth } = this.ctx; + this.ctx.lineWidth = this.connections_width + 7; + const dpi = window?.devicePixelRatio || 1; + for (const linkSegment of this.renderedPaths) { + const centre = linkSegment._pos; + if (!centre) continue; + if ((e2.shiftKey || e2.altKey) && linkSegment.path && this.ctx.isPointInStroke(linkSegment.path, x2 * dpi, y2 * dpi)) { + this.ctx.lineWidth = lineWidth; + if (e2.shiftKey && !e2.altKey) { + const slot = linkSegment.origin_slot; + const originNode = graph._nodes_by_id[linkSegment.origin_id]; + const connecting = { + node: originNode, + slot, + pos: originNode.getConnectionPos(false, slot) + }; + this.connecting_links = [connecting]; + if (linkSegment.parentId) connecting.afterRerouteId = linkSegment.parentId; + pointer2.onDragStart = () => connecting.output = originNode.outputs[slot]; + return; + } else if (this.reroutesEnabled && e2.altKey && !e2.shiftKey) { + const newReroute = graph.createReroute([x2, y2], linkSegment); + pointer2.onDragStart = (pointer3) => this.#startDraggingItems(newReroute, pointer3); + pointer2.onDragEnd = (e3) => this.#processDraggedItems(e3); + return; + } + } else if (isInRectangle(x2, y2, centre[0] - 4, centre[1] - 4, 8, 8)) { + this.ctx.lineWidth = lineWidth; + pointer2.onClick = () => this.showLinkMenu(linkSegment, e2); + pointer2.onDragStart = () => this.dragging_canvas = true; + pointer2.finally = () => this.dragging_canvas = false; + this.over_link_center = null; + return; + } + } + this.ctx.lineWidth = lineWidth; + const group = graph.getGroupOnPos(x2, y2); + this.selected_group = group; + if (group) { + if (group.isInResize(x2, y2)) { + const b2 = group.boundingRect; + const offsetX = x2 - (b2[0] + b2[2]); + const offsetY = y2 - (b2[1] + b2[3]); + pointer2.onDragStart = () => this.resizingGroup = group; + pointer2.onDrag = (eMove) => { + if (this.read_only) return; + const pos2 = [ + eMove.canvasX - group.pos[0] - offsetX, + eMove.canvasY - group.pos[1] - offsetY + ]; + snapPoint(pos2, this.#snapToGrid); + const resized = group.resize(pos2[0], pos2[1]); + if (resized) this.dirty_bgcanvas = true; + }; + pointer2.finally = () => this.resizingGroup = null; + } else { + const f2 = group.font_size || LiteGraph.DEFAULT_GROUP_FONT_SIZE; + const headerHeight = f2 * 1.4; + if (isInRectangle( + x2, + y2, + group.pos[0], + group.pos[1], + group.size[0], + headerHeight + )) { + pointer2.onClick = () => this.processSelect(group, e2); + pointer2.onDragStart = (pointer3) => { + group.recomputeInsideNodes(); + this.#startDraggingItems(group, pointer3, true); + }; + pointer2.onDragEnd = (e3) => this.#processDraggedItems(e3); + } + } + pointer2.onDoubleClick = () => { + this.emitEvent({ + subType: "group-double-click", + originalEvent: e2, + group + }); + }; + } else { + pointer2.onDoubleClick = () => { + if (this.allow_searchbox) { + this.showSearchBox(e2); + e2.preventDefault(); + } + this.emitEvent({ + subType: "empty-double-click", + originalEvent: e2 + }); + }; + } + } + if (!pointer2.onDragStart && !pointer2.onClick && !pointer2.onDrag && this.allow_dragcanvas) { + pointer2.onClick = () => this.processSelect(null, e2); + pointer2.finally = () => this.dragging_canvas = false; + this.dragging_canvas = true; + } + } + /** + * Processes a pointerdown event inside the bounds of a node. Part of {@link processMouseDown}. + * @param e The pointerdown event + * @param ctrlOrMeta Ctrl or meta key is pressed + * @param node The node to process a click event for + */ + #processNodeClick(e2, ctrlOrMeta, node22) { + const { pointer: pointer2, graph } = this; + const x2 = e2.canvasX; + const y2 = e2.canvasY; + pointer2.onClick = () => this.processSelect(node22, e2); + if (!node22.flags.pinned) { + this.bringToFront(node22); + } + const inCollapse = node22.isPointInCollapse(x2, y2); + if (inCollapse) { + pointer2.onClick = () => { + node22.collapse(); + this.setDirty(true, true); + }; + } else if (!node22.flags.collapsed) { + if (node22.resizable !== false && node22.inResizeCorner(x2, y2)) { + const b2 = node22.boundingRect; + const offsetX = x2 - (b2[0] + b2[2]); + const offsetY = y2 - (b2[1] + b2[3]); + pointer2.onDragStart = () => { + graph.beforeChange(); + this.resizing_node = node22; + }; + pointer2.onDrag = (eMove) => { + if (this.read_only) return; + const pos3 = [ + eMove.canvasX - node22.pos[0] - offsetX, + eMove.canvasY - node22.pos[1] - offsetY + ]; + snapPoint(pos3, this.#snapToGrid); + const min = node22.computeSize(); + pos3[0] = Math.max(min[0], pos3[0]); + pos3[1] = Math.max(min[1], pos3[1]); + node22.setSize(pos3); + this.#dirty(); + }; + pointer2.onDragEnd = (upEvent2) => { + this.#dirty(); + graph.afterChange(this.resizing_node); + }; + pointer2.finally = () => this.resizing_node = null; + this.canvas.style.cursor = "se-resize"; + return; + } + if (node22.outputs) { + for (let i2 = 0, l2 = node22.outputs.length; i2 < l2; ++i2) { + const output = node22.outputs[i2]; + const link_pos = node22.getConnectionPos(false, i2); + if (isInRectangle(x2, y2, link_pos[0] - 15, link_pos[1] - 10, 30, 20)) { + if (e2.shiftKey && output.links?.length > 0) { + this.connecting_links = []; + for (const linkId of output.links) { + const link2 = graph._links.get(linkId); + const slot = link2.target_slot; + const linked_node = graph._nodes_by_id[link2.target_id]; + const input = linked_node.inputs[slot]; + const pos3 = linked_node.getConnectionPos(true, slot); + this.connecting_links.push({ + node: linked_node, + slot, + input, + output: null, + pos: pos3, + direction: node22.horizontal !== true ? LinkDirection.RIGHT : LinkDirection.CENTER + }); + } + return; + } + output.slot_index = i2; + this.connecting_links = [ + { + node: node22, + slot: i2, + input: null, + output, + pos: link_pos + } + ]; + if (LiteGraph.shift_click_do_break_link_from) { + if (e2.shiftKey) { + node22.disconnectOutput(i2); + } + } else if (LiteGraph.ctrl_alt_click_do_break_link) { + if (ctrlOrMeta && e2.altKey && !e2.shiftKey) { + node22.disconnectOutput(i2); + } + } + pointer2.onDoubleClick = () => node22.onOutputDblClick?.(i2, e2); + pointer2.onClick = () => node22.onOutputClick?.(i2, e2); + return; + } + } + } + if (node22.inputs) { + for (let i2 = 0, l2 = node22.inputs.length; i2 < l2; ++i2) { + const input = node22.inputs[i2]; + const link_pos = node22.getConnectionPos(true, i2); + if (isInRectangle(x2, y2, link_pos[0] - 15, link_pos[1] - 10, 30, 20)) { + pointer2.onDoubleClick = () => node22.onInputDblClick?.(i2, e2); + pointer2.onClick = () => node22.onInputClick?.(i2, e2); + if (input.link !== null) { + const link_info = graph._links.get(input.link); + const slot = link_info.origin_slot; + const linked_node = graph._nodes_by_id[link_info.origin_id]; + if (LiteGraph.click_do_break_link_to || LiteGraph.ctrl_alt_click_do_break_link && ctrlOrMeta && e2.altKey && !e2.shiftKey) { + node22.disconnectInput(i2); + } else if (e2.shiftKey || this.allow_reconnect_links) { + const connecting = { + node: linked_node, + slot, + output: linked_node.outputs[slot], + pos: linked_node.getConnectionPos(false, slot) + }; + this.connecting_links = [connecting]; + pointer2.onDragStart = () => { + if (this.allow_reconnect_links && !LiteGraph.click_do_break_link_to) + node22.disconnectInput(i2); + connecting.output = linked_node.outputs[slot]; + }; + this.dirty_bgcanvas = true; + } + } + if (!pointer2.onDragStart) { + const connecting = { + node: node22, + slot: i2, + output: null, + pos: link_pos + }; + this.connecting_links = [connecting]; + pointer2.onDragStart = () => connecting.input = input; + this.dirty_bgcanvas = true; + } + return; + } + } + } + } + const pos2 = [x2 - node22.pos[0], y2 - node22.pos[1]]; + const widget2 = node22.getWidgetOnPos(x2, y2); + if (widget2) { + this.#processWidgetClick(e2, node22, widget2); + this.node_widget = [node22, widget2]; + } else { + pointer2.onDoubleClick = () => { + if (pos2[1] < 0 && !inCollapse) { + node22.onNodeTitleDblClick?.(e2, pos2, this); + } + node22.onDblClick?.(e2, pos2, this); + this.emitEvent({ + subType: "node-double-click", + originalEvent: e2, + node: node22 + }); + this.processNodeDblClicked(node22); + }; + if (node22.onMouseDown?.(e2, pos2, this) || !this.allow_dragnodes) + return; + pointer2.onDragStart = (pointer3) => this.#startDraggingItems(node22, pointer3, true); + pointer2.onDragEnd = (e3) => this.#processDraggedItems(e3); + } + this.dirty_canvas = true; + } + #processWidgetClick(e, node, widget) { + const { pointer } = this; + if (typeof widget.onPointerDown === "function") { + const handled = widget.onPointerDown(pointer, node, this); + if (handled) return; + } + const width = widget.width || node.width; + const oldValue = widget.value; + const pos = this.graph_mouse; + const x = pos[0] - node.pos[0]; + const y = pos[1] - node.pos[1]; + switch (widget.type) { + case "button": + pointer.onClick = () => { + widget.callback?.(widget, this, node, pos, e); + widget.clicked = true; + this.dirty_canvas = true; + }; + break; + case "slider": { + if (widget.options.read_only) break; + pointer.onDrag = (eMove) => { + const x2 = eMove.canvasX - node.pos[0]; + const slideFactor = clamp$1((x2 - 15) / (width - 30), 0, 1); + widget.value = widget.options.min + (widget.options.max - widget.options.min) * slideFactor; + if (oldValue != widget.value) { + setWidgetValue(this, node, widget, widget.value); + } + this.dirty_canvas = true; + }; + break; + } + case "number": { + const delta = x < 40 ? -1 : x > width - 40 ? 1 : 0; + pointer.onClick = (upEvent) => { + let newValue = widget.value + delta * 0.1 * (widget.options.step || 1); + if (widget.options.min != null && newValue < widget.options.min) { + newValue = widget.options.min; + } + if (widget.options.max != null && newValue > widget.options.max) { + newValue = widget.options.max; + } + if (newValue !== widget.value) setWidgetValue(this, node, widget, newValue); + if (delta !== 0) return; + this.prompt("Value", widget.value, (v) => { + if (/^[0-9+\-*/()\s]+|\d+\.\d+$/.test(v)) { + try { + v = eval(v); + } catch { + } + } + widget.value = Number(v); + setWidgetValue(this, node, widget, widget.value); + }, e); + this.dirty_canvas = true; + }; + pointer.onDrag = (eMove) => { + const x2 = eMove.canvasX - node.pos[0]; + if (delta && (x2 > -3 && x2 < width + 3)) return; + let newValue2 = widget.value; + if (eMove.deltaX) newValue2 += eMove.deltaX * 0.1 * (widget.options.step || 1); + if (widget.options.min != null && newValue2 < widget.options.min) { + newValue2 = widget.options.min; + } + if (widget.options.max != null && newValue2 > widget.options.max) { + newValue2 = widget.options.max; + } + if (newValue2 !== widget.value) setWidgetValue(this, node, widget, newValue2); + }; + break; + } + case "combo": { + let values; + let values_list; + pointer.onClick = (upEvent2) => { + const delta2 = x < 40 ? -1 : x > width - 40 ? 1 : 0; + values = widget.options.values; + if (typeof values === "function") { + values = values(widget, node); + } + values_list = null; + values_list = Array.isArray(values) ? values : Object.keys(values); + if (delta2) { + let index2 = -1; + this.last_mouseclick = 0; + index2 = typeof values === "object" ? values_list.indexOf(String(widget.value)) + delta2 : values_list.indexOf(widget.value) + delta2; + if (index2 >= values_list.length) index2 = values_list.length - 1; + if (index2 < 0) index2 = 0; + widget.value = Array.isArray(values) ? values[index2] : index2; + if (oldValue != widget.value) setWidgetValue(this, node, widget, widget.value); + this.dirty_canvas = true; + return; + } + const text_values = values != values_list ? Object.values(values) : values; + new LiteGraph.ContextMenu(text_values, { + scale: Math.max(1, this.ds.scale), + event: e, + className: "dark", + callback: /* @__PURE__ */ __name((value4) => { + widget.value = values != values_list ? text_values.indexOf(value4) : value4; + setWidgetValue(this, node, widget, widget.value); + this.dirty_canvas = true; + return false; + }, "callback") + }); + }; + break; + } + case "toggle": + pointer.onClick = () => { + widget.value = !widget.value; + setWidgetValue(this, node, widget, widget.value); + }; + break; + case "string": + case "text": + pointer.onClick = () => this.prompt( + "Value", + widget.value, + (v2) => setWidgetValue(this, node, widget, v2), + e, + widget.options ? widget.options.multiline : false + ); + break; + default: + if (widget.mouse) { + const result = widget.mouse(e, [x, y], node); + if (result != null) this.dirty_canvas = result; + } + break; + } + if (oldValue != widget.value) { + node.onWidgetChanged?.(widget.name, widget.value, oldValue, widget); + node.graph._version++; + } + pointer.finally = () => { + if (widget.mouse) { + const { eUp } = pointer; + const { canvasX, canvasY } = eUp; + widget.mouse(eUp, [canvasX - node.pos[0], canvasY - node.pos[1]], node); + } + this.node_widget = null; + }; + function setWidgetValue(canvas, node22, widget2, value4) { + const v2 = widget2.type === "number" ? Number(value4) : value4; + widget2.value = v2; + if (widget2.options?.property && node22.properties[widget2.options.property] !== void 0) { + node22.setProperty(widget2.options.property, v2); + } + widget2.callback?.(widget2.value, canvas, node22, pos, e); + node22.onWidgetChanged?.(widget2.name, v2, oldValue, widget2); + node22.graph._version++; + } + __name(setWidgetValue, "setWidgetValue"); + } + /** + * Pointer middle button click processing. Part of {@link processMouseDown}. + * @param e The pointerdown event + * @param node The node to process a click event for + */ + #processMiddleButton(e2, node22) { + const { pointer: pointer2 } = this; + if (LiteGraph.middle_click_slot_add_default_node && node22 && this.allow_interaction && !this.read_only && !this.connecting_links && !node22.flags.collapsed) { + let mClikSlot = false; + let mClikSlot_index = false; + let mClikSlot_isOut = false; + if (node22.outputs) { + for (let i2 = 0, l2 = node22.outputs.length; i2 < l2; ++i2) { + const output = node22.outputs[i2]; + const link_pos = node22.getConnectionPos(false, i2); + if (isInRectangle(e2.canvasX, e2.canvasY, link_pos[0] - 15, link_pos[1] - 10, 30, 20)) { + mClikSlot = output; + mClikSlot_index = i2; + mClikSlot_isOut = true; + break; + } + } + } + if (node22.inputs) { + for (let i2 = 0, l2 = node22.inputs.length; i2 < l2; ++i2) { + const input = node22.inputs[i2]; + const link_pos = node22.getConnectionPos(true, i2); + if (isInRectangle(e2.canvasX, e2.canvasY, link_pos[0] - 15, link_pos[1] - 10, 30, 20)) { + mClikSlot = input; + mClikSlot_index = i2; + mClikSlot_isOut = false; + break; + } + } + } + if (mClikSlot && mClikSlot_index !== false) { + const alphaPosY = 0.5 - (mClikSlot_index + 1) / (mClikSlot_isOut ? node22.outputs.length : node22.inputs.length); + const node_bounding = node22.getBounding(); + const posRef = [ + !mClikSlot_isOut ? node_bounding[0] : node_bounding[0] + node_bounding[2], + e2.canvasY - 80 + ]; + pointer2.onClick = () => this.createDefaultNodeForSlot({ + nodeFrom: !mClikSlot_isOut ? null : node22, + slotFrom: !mClikSlot_isOut ? null : mClikSlot_index, + nodeTo: !mClikSlot_isOut ? node22 : null, + slotTo: !mClikSlot_isOut ? mClikSlot_index : null, + position: posRef, + nodeType: "AUTO", + posAdd: [!mClikSlot_isOut ? -30 : 30, -alphaPosY * 130], + posSizeFix: [!mClikSlot_isOut ? -1 : 0, 0] + }); + } + } + if (this.allow_dragcanvas) { + pointer2.onDragStart = () => this.dragging_canvas = true; + pointer2.finally = () => this.dragging_canvas = false; + } + } + /** + * Called when a mouse move event has to be processed + */ + processMouseMove(e2) { + if (this.autoresize) this.resize(); + if (this.set_canvas_dirty_on_mouse_event) this.dirty_canvas = true; + if (!this.graph) return; + LGraphCanvas.active_canvas = this; + this.adjustMouseEvent(e2); + const mouse = [e2.clientX, e2.clientY]; + this.mouse[0] = mouse[0]; + this.mouse[1] = mouse[1]; + const delta2 = [ + mouse[0] - this.last_mouse[0], + mouse[1] - this.last_mouse[1] + ]; + this.last_mouse = mouse; + this.graph_mouse[0] = e2.canvasX; + this.graph_mouse[1] = e2.canvasY; + if (e2.isPrimary) this.pointer.move(e2); + if (this.block_click) { + e2.preventDefault(); + return; + } + e2.dragging = this.last_mouse_dragging; + if (this.node_widget) { + const [node3, widget2] = this.node_widget; + if (widget2?.mouse) { + const x2 = e2.canvasX - node3.pos[0]; + const y2 = e2.canvasY - node3.pos[1]; + const result = widget2.mouse(e2, [x2, y2], node3); + if (result != null) this.dirty_canvas = result; + } + } + let underPointer = CanvasItem.Nothing; + const node22 = this.graph.getNodeOnPos( + e2.canvasX, + e2.canvasY, + this.visible_nodes + ); + const { resizingGroup } = this; + const dragRect = this.dragging_rectangle; + if (dragRect) { + dragRect[2] = e2.canvasX - dragRect[0]; + dragRect[3] = e2.canvasY - dragRect[1]; + this.dirty_canvas = true; + } else if (resizingGroup) { + underPointer |= CanvasItem.ResizeSe | CanvasItem.Group; + } else if (this.dragging_canvas) { + this.ds.offset[0] += delta2[0] / this.ds.scale; + this.ds.offset[1] += delta2[1] / this.ds.scale; + this.#dirty(); + } else if ((this.allow_interaction || node22 && node22.flags.allow_interaction) && !this.read_only) { + if (this.connecting_links) this.dirty_canvas = true; + this.updateMouseOverNodes(node22, e2); + if (node22) { + underPointer |= CanvasItem.Node; + if (node22.redraw_on_mouse) this.dirty_canvas = true; + const pos2 = [0, 0]; + const inputId = this.isOverNodeInput(node22, e2.canvasX, e2.canvasY, pos2); + const outputId = this.isOverNodeOutput(node22, e2.canvasX, e2.canvasY, pos2); + const overWidget = this.getWidgetAtCursor(node22); + if (!node22.mouseOver) { + node22.mouseOver = { + inputId: null, + outputId: null, + overWidget: null + }; + this.node_over = node22; + this.dirty_canvas = true; + node22.onMouseEnter?.(e2); + } + node22.onMouseMove?.(e2, [e2.canvasX - node22.pos[0], e2.canvasY - node22.pos[1]], this); + if (node22.mouseOver.inputId !== inputId || node22.mouseOver.outputId !== outputId || node22.mouseOver.overWidget !== overWidget) { + node22.mouseOver.inputId = inputId; + node22.mouseOver.outputId = outputId; + node22.mouseOver.overWidget = overWidget; + if (this.connecting_links?.length) { + const firstLink = this.connecting_links[0]; + let highlightPos = null; + let highlightInput = null; + let linkOverWidget = null; + if (firstLink.node === node22) ; + else if (firstLink.output) { + if (inputId === -1 && outputId === -1) { + if (this.getWidgetLinkType && overWidget) { + const widgetLinkType = this.getWidgetLinkType(overWidget, node22); + if (widgetLinkType && LiteGraph.isValidConnection(firstLink.output.type, widgetLinkType)) { + if (firstLink.node.isValidWidgetLink?.(firstLink.output.slot_index, node22, overWidget) !== false) { + linkOverWidget = overWidget; + this.link_over_widget_type = widgetLinkType; + } + } + } + if (!linkOverWidget) { + const targetSlotId = firstLink.node.findConnectByTypeSlot(true, node22, firstLink.output.type); + if (targetSlotId !== null && targetSlotId >= 0) { + node22.getConnectionPos(true, targetSlotId, pos2); + highlightPos = pos2; + highlightInput = node22.inputs[targetSlotId]; + } + } + } else if (inputId != -1 && node22.inputs[inputId] && LiteGraph.isValidConnection(firstLink.output.type, node22.inputs[inputId].type)) { + if (inputId != -1 && node22.inputs[inputId] && LiteGraph.isValidConnection(firstLink.output.type, node22.inputs[inputId].type)) { + highlightPos = pos2; + highlightInput = node22.inputs[inputId]; + } + } + } else if (firstLink.input) { + if (inputId === -1 && outputId === -1) { + const targetSlotId = firstLink.node.findConnectByTypeSlot(false, node22, firstLink.input.type); + if (targetSlotId !== null && targetSlotId >= 0) { + node22.getConnectionPos(false, targetSlotId, pos2); + highlightPos = pos2; + } + } else { + if (outputId != -1 && node22.outputs[outputId] && LiteGraph.isValidConnection(firstLink.input.type, node22.outputs[outputId].type)) { + highlightPos = pos2; + } + } + } + this._highlight_pos = highlightPos; + this._highlight_input = highlightInput; + this.link_over_widget = linkOverWidget; + } + this.dirty_canvas = true; + } + if (node22.inResizeCorner(e2.canvasX, e2.canvasY)) { + underPointer |= CanvasItem.ResizeSe; + } + } else { + const segment = this.#getLinkCentreOnPos(e2); + if (this.over_link_center !== segment) { + underPointer |= CanvasItem.Link; + this.over_link_center = segment; + this.dirty_bgcanvas = true; + } + if (this.canvas) { + const group = this.graph.getGroupOnPos(e2.canvasX, e2.canvasY); + if (group && !e2.ctrlKey && !this.read_only && group.isInResize(e2.canvasX, e2.canvasY)) { + underPointer |= CanvasItem.ResizeSe; + } + } + } + if (this.node_capturing_input && this.node_capturing_input != node22) { + this.node_capturing_input.onMouseMove?.( + e2, + [ + e2.canvasX - this.node_capturing_input.pos[0], + e2.canvasY - this.node_capturing_input.pos[1] + ], + this + ); + } + if (this.isDragging) { + const selected2 = this.selectedItems; + const allItems = e2.ctrlKey ? selected2 : getAllNestedItems(selected2); + const deltaX = delta2[0] / this.ds.scale; + const deltaY = delta2[1] / this.ds.scale; + for (const item3 of allItems) { + item3.move(deltaX, deltaY, true); + } + this.#dirty(); + } + if (this.resizing_node) underPointer |= CanvasItem.ResizeSe; + } + this.hoveringOver = underPointer; + e2.preventDefault(); + return; + } + /** + * Start dragging an item, optionally including all other selected items. + * + * ** This function sets the {@link CanvasPointer.finally}() callback. ** + * @param item The item that the drag event started on + * @param pointer The pointer event that initiated the drag, e.g. pointerdown + * @param sticky If `true`, the item is added to the selection - see {@link processSelect} + */ + #startDraggingItems(item3, pointer2, sticky = false) { + this.emitBeforeChange(); + this.graph.beforeChange(); + pointer2.finally = () => { + this.isDragging = false; + this.graph.afterChange(); + this.emitAfterChange(); + }; + this.processSelect(item3, pointer2.eDown, sticky); + this.isDragging = true; + } + /** + * Handles shared clean up and placement after items have been dragged. + * @param e The event that completed the drag, e.g. pointerup, pointermove + */ + #processDraggedItems(e2) { + const { graph } = this; + if (e2.shiftKey || LiteGraph.alwaysSnapToGrid) + graph.snapToGrid(this.selectedItems); + this.dirty_canvas = true; + this.dirty_bgcanvas = true; + this.onNodeMoved?.(findFirstNode(this.selectedItems)); + } + /** + * Called when a mouse up event has to be processed + */ + processMouseUp(e2) { + if (e2.isPrimary === false) return; + const { graph, pointer: pointer2 } = this; + if (!graph) return; + LGraphCanvas.active_canvas = this; + this.adjustMouseEvent(e2); + const now2 = LiteGraph.getTime(); + e2.click_time = now2 - this.last_mouseclick; + const isClick = pointer2.up(e2); + if (isClick === true) { + pointer2.isDown = false; + pointer2.isDouble = false; + this.connecting_links = null; + this.dragging_canvas = false; + graph.change(); + e2.stopPropagation(); + e2.preventDefault(); + return; + } + this.last_mouse_dragging = false; + this.last_click_position = null; + this.block_click &&= false; + if (e2.button === 0) { + this.selected_group = null; + this.isDragging = false; + const x2 = e2.canvasX; + const y2 = e2.canvasY; + const node22 = graph.getNodeOnPos(x2, y2, this.visible_nodes); + if (this.connecting_links?.length) { + const firstLink = this.connecting_links[0]; + if (node22) { + for (const link2 of this.connecting_links) { + this.#dirty(); + if (link2.output) { + const slot = this.isOverNodeInput(node22, x2, y2); + if (slot != -1) { + link2.node.connect(link2.slot, node22, slot, link2.afterRerouteId); + } else if (this.link_over_widget) { + this.emitEvent({ + subType: "connectingWidgetLink", + link: link2, + node: node22, + widget: this.link_over_widget + }); + this.link_over_widget = null; + } else { + link2.node.connectByType(link2.slot, node22, link2.output.type, { + afterRerouteId: link2.afterRerouteId + }); + } + } else if (link2.input) { + const slot = this.isOverNodeOutput(node22, x2, y2); + if (slot != -1) { + node22.connect(slot, link2.node, link2.slot, link2.afterRerouteId); + } else { + link2.node.connectByTypeOutput( + link2.slot, + node22, + link2.input.type, + { afterRerouteId: link2.afterRerouteId } + ); + } + } + } + } else if (firstLink.input || firstLink.output) { + const linkReleaseContext = firstLink.output ? { + node_from: firstLink.node, + slot_from: firstLink.output, + type_filter_in: firstLink.output.type + } : { + node_to: firstLink.node, + slot_from: firstLink.input, + type_filter_out: firstLink.input.type + }; + const linkReleaseContextExtended = { + links: this.connecting_links + }; + this.emitEvent({ + subType: "empty-release", + originalEvent: e2, + linkReleaseContext: linkReleaseContextExtended + }); + if (LiteGraph.release_link_on_empty_shows_menu) { + if (e2.shiftKey) { + if (this.allow_searchbox) { + this.showSearchBox(e2, linkReleaseContext); + } + } else { + if (firstLink.output) { + this.showConnectionMenu({ nodeFrom: firstLink.node, slotFrom: firstLink.output, e: e2 }); + } else if (firstLink.input) { + this.showConnectionMenu({ nodeTo: firstLink.node, slotTo: firstLink.input, e: e2 }); + } + } + } + } + } else { + this.dirty_canvas = true; + this.node_over?.onMouseUp?.(e2, [x2 - this.node_over.pos[0], y2 - this.node_over.pos[1]], this); + this.node_capturing_input?.onMouseUp?.(e2, [ + x2 - this.node_capturing_input.pos[0], + y2 - this.node_capturing_input.pos[1] + ]); + } + this.connecting_links = null; + } else if (e2.button === 1) { + this.dirty_canvas = true; + this.dragging_canvas = false; + } else if (e2.button === 2) { + this.dirty_canvas = true; + } + pointer2.isDown = false; + pointer2.isDouble = false; + graph.change(); + e2.stopPropagation(); + e2.preventDefault(); + return; + } + /** + * Called when the mouse moves off the canvas. Clears all node hover states. + * @param e + */ + processMouseOut(e2) { + this.adjustMouseEvent(e2); + this.updateMouseOverNodes(null, e2); + } + processMouseCancel(e2) { + console.warn("Pointer cancel!"); + this.pointer.reset(); + } + /** + * Called when a mouse wheel event has to be processed + */ + processMouseWheel(e2) { + if (!this.graph || !this.allow_dragcanvas) return; + const delta2 = e2.wheelDeltaY ?? e2.detail * -60; + this.adjustMouseEvent(e2); + const pos2 = [e2.clientX, e2.clientY]; + if (this.viewport && !isPointInRect(pos2, this.viewport)) return; + let scale = this.ds.scale; + if (delta2 > 0) scale *= this.zoom_speed; + else if (delta2 < 0) scale *= 1 / this.zoom_speed; + this.ds.changeScale(scale, [e2.clientX, e2.clientY]); + this.graph.change(); + e2.preventDefault(); + return; + } + /** + * returns the INDEX if a position (in graph space) is on top of a node input slot + */ + isOverNodeInput(node22, canvasx, canvasy, slot_pos) { + if (node22.inputs) { + for (let i2 = 0, l2 = node22.inputs.length; i2 < l2; ++i2) { + const input = node22.inputs[i2]; + const link_pos = node22.getConnectionPos(true, i2); + let is_inside = false; + if (node22.horizontal) { + is_inside = isInRectangle( + canvasx, + canvasy, + link_pos[0] - 5, + link_pos[1] - 10, + 10, + 20 + ); + } else { + const width2 = 20 + ((input.label?.length ?? input.localized_name?.length ?? input.name?.length) || 3) * 7; + is_inside = isInRectangle( + canvasx, + canvasy, + link_pos[0] - 10, + link_pos[1] - 10, + width2, + 20 + ); + } + if (is_inside) { + if (slot_pos) { + slot_pos[0] = link_pos[0]; + slot_pos[1] = link_pos[1]; + } + return i2; + } + } + } + return -1; + } + /** + * returns the INDEX if a position (in graph space) is on top of a node output slot + */ + isOverNodeOutput(node22, canvasx, canvasy, slot_pos) { + if (node22.outputs) { + for (let i2 = 0, l2 = node22.outputs.length; i2 < l2; ++i2) { + const link_pos = node22.getConnectionPos(false, i2); + let is_inside = false; + if (node22.horizontal) { + is_inside = isInRectangle( + canvasx, + canvasy, + link_pos[0] - 5, + link_pos[1] - 10, + 10, + 20 + ); + } else { + is_inside = isInRectangle( + canvasx, + canvasy, + link_pos[0] - 10, + link_pos[1] - 10, + 40, + 20 + ); + } + if (is_inside) { + if (slot_pos) { + slot_pos[0] = link_pos[0]; + slot_pos[1] = link_pos[1]; + } + return i2; + } + } + } + return -1; + } + /** + * process a key event + */ + processKey(e2) { + this.#shiftDown = e2.shiftKey; + if (!this.graph) return; + let block_default = false; + if (e2.target.localName == "input") return; + if (e2.type == "keydown") { + if (e2.keyCode == 32) { + this.read_only = true; + if (this._previously_dragging_canvas === null) { + this._previously_dragging_canvas = this.dragging_canvas; + } + this.dragging_canvas = this.pointer.isDown; + block_default = true; + } else if (e2.keyCode == 27) { + this.node_panel?.close(); + this.options_panel?.close(); + block_default = true; + } else if (e2.keyCode == 65 && e2.ctrlKey) { + this.selectItems(); + block_default = true; + } else if (e2.keyCode === 67 && (e2.metaKey || e2.ctrlKey) && !e2.shiftKey) { + if (this.selected_nodes) { + this.copyToClipboard(); + block_default = true; + } + } else if (e2.keyCode === 86 && (e2.metaKey || e2.ctrlKey)) { + this.pasteFromClipboard(e2.shiftKey); + } else if (e2.keyCode == 46 || e2.keyCode == 8) { + if (e2.target.localName != "input" && e2.target.localName != "textarea") { + this.deleteSelected(); + block_default = true; + } + } + if (this.selected_nodes) { + for (const i2 in this.selected_nodes) { + this.selected_nodes[i2].onKeyDown?.(e2); + } + } + } else if (e2.type == "keyup") { + if (e2.keyCode == 32) { + this.read_only = false; + this.dragging_canvas = (this._previously_dragging_canvas ?? false) && this.pointer.isDown; + this._previously_dragging_canvas = null; + } + if (this.selected_nodes) { + for (const i2 in this.selected_nodes) { + this.selected_nodes[i2].onKeyUp?.(e2); + } + } + } + this.graph.change(); + if (block_default) { + e2.preventDefault(); + e2.stopImmediatePropagation(); + return false; + } + } + /** + * Copies canvas items to an internal, app-specific clipboard backed by local storage. + * When called without parameters, it copies {@link selectedItems}. + * @param items The items to copy. If nullish, all selected items are copied. + */ + copyToClipboard(items2) { + const serialisable = { + nodes: [], + groups: [], + reroutes: [], + links: [] + }; + for (const item3 of items2 ?? this.selectedItems) { + if (item3 instanceof LGraphNode) { + if (item3.clonable === false) continue; + const cloned = item3.clone()?.serialize(); + if (!cloned) continue; + cloned.id = item3.id; + serialisable.nodes.push(cloned); + const links = item3.inputs?.map((input) => this.graph._links.get(input?.link)?.asSerialisable()).filter((x2) => !!x2); + if (!links) continue; + serialisable.links.push(...links); + } else if (item3 instanceof LGraphGroup) { + serialisable.groups.push(item3.serialize()); + } else if (this.reroutesEnabled && item3 instanceof Reroute) { + serialisable.reroutes.push(item3.asSerialisable()); + } + } + localStorage.setItem( + "litegrapheditor_clipboard", + JSON.stringify(serialisable) + ); + } + emitEvent(detail) { + this.canvas.dispatchEvent( + new CustomEvent("litegraph:canvas", { + bubbles: true, + detail + }) + ); + } + /** @todo Refactor to where it belongs - e.g. Deleting / creating nodes is not actually canvas event. */ + emitBeforeChange() { + this.emitEvent({ + subType: "before-change" + }); + } + /** @todo See {@link emitBeforeChange} */ + emitAfterChange() { + this.emitEvent({ + subType: "after-change" + }); + } + /** + * Pastes the items from the canvas "clipbaord" - a local storage variable. + * @param connectInputs If `true`, always attempt to connect inputs of pasted nodes - including to nodes that were not pasted. + */ + _pasteFromClipboard(connectInputs = false) { + if (!LiteGraph.ctrl_shift_v_paste_connect_unselected_outputs && connectInputs) return; + const data25 = localStorage.getItem("litegrapheditor_clipboard"); + if (!data25) return; + const { graph } = this; + graph.beforeChange(); + const parsed = JSON.parse(data25); + parsed.nodes ??= []; + parsed.groups ??= []; + parsed.reroutes ??= []; + parsed.links ??= []; + let offsetX = Infinity; + let offsetY = Infinity; + for (const item3 of [...parsed.nodes, ...parsed.reroutes]) { + if (item3.pos[0] < offsetX) offsetX = item3.pos[0]; + if (item3.pos[1] < offsetY) offsetY = item3.pos[1]; + } + if (parsed.groups) { + for (const group of parsed.groups) { + if (group.bounding[0] < offsetX) offsetX = group.bounding[0]; + if (group.bounding[1] < offsetY) offsetY = group.bounding[1]; + } + } + const results = { + created: [], + nodes: /* @__PURE__ */ new Map(), + links: /* @__PURE__ */ new Map(), + reroutes: /* @__PURE__ */ new Map() + }; + const { created: created3, nodes, links, reroutes } = results; + for (const info of parsed.groups) { + info.id = void 0; + const group = new LGraphGroup(); + group.configure(info); + graph.add(group); + created3.push(group); + } + for (const info of parsed.nodes) { + const node22 = LiteGraph.createNode(info.type); + if (!node22) { + continue; + } + nodes.set(info.id, node22); + info.id = void 0; + node22.configure(info); + graph.add(node22); + created3.push(node22); + } + for (const info of parsed.reroutes) { + const { id: id3 } = info; + info.id = void 0; + const reroute = graph.setReroute(info); + created3.push(reroute); + reroutes.set(id3, reroute); + } + for (const reroute of reroutes.values()) { + const mapped = reroutes.get(reroute.parentId); + if (mapped) reroute.parentId = mapped.id; + } + for (const info of parsed.links) { + let outNode = nodes.get(info.origin_id); + let afterRerouteId = reroutes.get(info.parentId)?.id; + if (connectInputs && LiteGraph.ctrl_shift_v_paste_connect_unselected_outputs) { + outNode ??= graph.getNodeById(info.origin_id); + afterRerouteId ??= info.parentId; + } + const inNode = nodes.get(info.target_id); + if (inNode) { + const link2 = outNode?.connect( + info.origin_slot, + inNode, + info.target_slot, + afterRerouteId + ); + if (link2) links.set(info.id, link2); + } + } + for (const reroute of reroutes.values()) { + const ids = [...reroute.linkIds].map((x2) => links.get(x2)?.id ?? x2); + reroute.update(reroute.parentId, void 0, ids); + if (!reroute.validateLinks(graph.links)) graph.removeReroute(reroute.id); + } + for (const item3 of created3) { + item3.pos[0] += this.graph_mouse[0] - offsetX; + item3.pos[1] += this.graph_mouse[1] - offsetY; + } + this.selectItems(created3); + graph.afterChange(); + return results; + } + pasteFromClipboard(isConnectUnselected = false) { + this.emitBeforeChange(); + try { + this._pasteFromClipboard(isConnectUnselected); + } finally { + this.emitAfterChange(); + } + } + /** + * process a item drop event on top the canvas + */ + processDrop(e2) { + e2.preventDefault(); + this.adjustMouseEvent(e2); + const x2 = e2.clientX; + const y2 = e2.clientY; + const is_inside = !this.viewport || isInRect(x2, y2, this.viewport); + if (!is_inside) return; + const pos2 = [e2.canvasX, e2.canvasY]; + const node22 = this.graph ? this.graph.getNodeOnPos(pos2[0], pos2[1]) : null; + if (!node22) { + const r2 = this.onDropItem?.(e2); + if (!r2) this.checkDropItem(e2); + return; + } + if (node22.onDropFile || node22.onDropData) { + const files = e2.dataTransfer.files; + if (files && files.length) { + for (let i2 = 0; i2 < files.length; i2++) { + const file = e2.dataTransfer.files[0]; + const filename = file.name; + node22.onDropFile?.(file); + if (node22.onDropData) { + const reader = new FileReader(); + reader.onload = function(event) { + const data25 = event.target.result; + node22.onDropData(data25, filename, file); + }; + const type = file.type.split("/")[0]; + if (type == "text" || type == "") { + reader.readAsText(file); + } else if (type == "image") { + reader.readAsDataURL(file); + } else { + reader.readAsArrayBuffer(file); + } + } + } + } + } + if (node22.onDropItem?.(e2)) return true; + return this.onDropItem ? this.onDropItem(e2) : false; + } + // called if the graph doesn't have a default drop item behaviour + checkDropItem(e2) { + if (!e2.dataTransfer.files.length) return; + const file = e2.dataTransfer.files[0]; + const ext = LGraphCanvas.getFileExtension(file.name).toLowerCase(); + const nodetype = LiteGraph.node_types_by_file_extension[ext]; + if (!nodetype) return; + this.graph.beforeChange(); + const node22 = LiteGraph.createNode(nodetype.type); + node22.pos = [e2.canvasX, e2.canvasY]; + this.graph.add(node22); + node22.onDropFile?.(file); + this.graph.afterChange(); + } + processNodeDblClicked(n2) { + this.onShowNodePanel?.(n2); + this.onNodeDblClicked?.(n2); + this.setDirty(true); + } + #handleMultiSelect(e2, dragRect) { + const { graph, selectedItems } = this; + const w2 = Math.abs(dragRect[2]); + const h2 = Math.abs(dragRect[3]); + if (dragRect[2] < 0) dragRect[0] -= w2; + if (dragRect[3] < 0) dragRect[1] -= h2; + dragRect[2] = w2; + dragRect[3] = h2; + const isSelected5 = []; + const notSelected = []; + for (const nodeX of graph._nodes) { + if (!overlapBounding(dragRect, nodeX.boundingRect)) continue; + if (!nodeX.selected || !selectedItems.has(nodeX)) + notSelected.push(nodeX); + else isSelected5.push(nodeX); + } + for (const group of graph.groups) { + if (!containsRect(dragRect, group._bounding)) continue; + group.recomputeInsideNodes(); + if (!group.selected || !selectedItems.has(group)) + notSelected.push(group); + else isSelected5.push(group); + } + for (const reroute of graph.reroutes.values()) { + if (!isPointInRect(reroute.pos, dragRect)) continue; + selectedItems.add(reroute); + reroute.selected = true; + if (!reroute.selected || !selectedItems.has(reroute)) + notSelected.push(reroute); + else isSelected5.push(reroute); + } + if (e2.shiftKey) { + for (const item3 of notSelected) this.select(item3); + } else if (e2.altKey) { + for (const item3 of isSelected5) this.deselect(item3); + } else { + for (const item3 of selectedItems.values()) { + if (!isSelected5.includes(item3)) this.deselect(item3); + } + for (const item3 of notSelected) this.select(item3); + } + } + /** + * Determines whether to select or deselect an item that has received a pointer event. Will deselect other nodes if + * @param item Canvas item to select/deselect + * @param e The MouseEvent to handle + * @param sticky Prevents deselecting individual nodes (as used by aux/right-click) + * @remarks + * Accessibility: anyone using {@link mutli_select} always deselects when clicking empty space. + */ + processSelect(item3, e2, sticky = false) { + const addModifier = e2?.shiftKey; + const subtractModifier = e2 != null && (e2.metaKey || e2.ctrlKey); + const eitherModifier = addModifier || subtractModifier; + const modifySelection = eitherModifier || this.multi_select; + if (!item3) { + if (!eitherModifier || this.multi_select) this.deselectAll(); + } else if (!item3.selected || !this.selectedItems.has(item3)) { + if (!modifySelection) this.deselectAll(item3); + this.select(item3); + } else if (modifySelection && !sticky) { + this.deselect(item3); + } else if (!sticky) { + this.deselectAll(item3); + } else { + return; + } + this.onSelectionChange?.(this.selected_nodes); + this.setDirty(true); + } + /** + * Selects a {@link Positionable} item. + * @param item The canvas item to add to the selection. + */ + select(item3) { + if (item3.selected && this.selectedItems.has(item3)) return; + item3.selected = true; + this.selectedItems.add(item3); + if (!(item3 instanceof LGraphNode)) return; + item3.onSelected?.(); + this.selected_nodes[item3.id] = item3; + this.onNodeSelected?.(item3); + item3.inputs?.forEach((input) => this.highlighted_links[input.link] = true); + item3.outputs?.flatMap((x2) => x2.links).forEach((id3) => this.highlighted_links[id3] = true); + } + /** + * Deselects a {@link Positionable} item. + * @param item The canvas item to remove from the selection. + */ + deselect(item3) { + if (!item3.selected && !this.selectedItems.has(item3)) return; + item3.selected = false; + this.selectedItems.delete(item3); + if (!(item3 instanceof LGraphNode)) return; + item3.onDeselected?.(); + delete this.selected_nodes[item3.id]; + this.onNodeDeselected?.(item3); + item3.inputs?.forEach((input) => delete this.highlighted_links[input.link]); + item3.outputs?.flatMap((x2) => x2.links).forEach((id3) => delete this.highlighted_links[id3]); + } + /** @deprecated See {@link LGraphCanvas.processSelect} */ + processNodeSelected(item3, e2) { + this.processSelect( + item3, + e2, + e2 && (e2.shiftKey || e2.metaKey || e2.ctrlKey || this.multi_select) + ); + } + /** @deprecated See {@link LGraphCanvas.select} */ + selectNode(node22, add_to_current_selection) { + if (node22 == null) { + this.deselectAll(); + } else { + this.selectNodes([node22], add_to_current_selection); + } + } + get empty() { + return this.graph.empty; + } + get positionableItems() { + return this.graph.positionableItems(); + } + /** + * Selects several items. + * @param items Items to select - if falsy, all items on the canvas will be selected + * @param add_to_current_selection If set, the items will be added to the current selection instead of replacing it + */ + selectItems(items2, add_to_current_selection) { + const itemsToSelect = items2 ?? this.positionableItems; + if (!add_to_current_selection) this.deselectAll(); + for (const item3 of itemsToSelect) this.select(item3); + this.onSelectionChange?.(this.selected_nodes); + this.setDirty(true); + } + /** + * selects several nodes (or adds them to the current selection) + * @deprecated See {@link LGraphCanvas.selectItems} + */ + selectNodes(nodes, add_to_current_selection) { + this.selectItems(nodes, add_to_current_selection); + } + /** @deprecated See {@link LGraphCanvas.deselect} */ + deselectNode(node22) { + this.deselect(node22); + } + /** + * Deselects all items on the canvas. + * @param keepSelected If set, this item will not be removed from the selection. + */ + deselectAll(keepSelected) { + if (!this.graph) return; + const selected2 = this.selectedItems; + let wasSelected; + for (const sel of selected2) { + if (sel === keepSelected) { + wasSelected = sel; + continue; + } + sel.onDeselected?.(); + sel.selected = false; + } + selected2.clear(); + if (wasSelected) selected2.add(wasSelected); + this.setDirty(true); + const oldNode = keepSelected?.id == null ? null : this.selected_nodes[keepSelected.id]; + this.selected_nodes = {}; + this.current_node = null; + this.highlighted_links = {}; + if (keepSelected instanceof LGraphNode) { + if (oldNode) this.selected_nodes[oldNode.id] = oldNode; + keepSelected.inputs?.forEach((input) => this.highlighted_links[input.link] = true); + keepSelected.outputs?.flatMap((x2) => x2.links).forEach((id3) => this.highlighted_links[id3] = true); + } + this.onSelectionChange?.(this.selected_nodes); + } + /** @deprecated See {@link LGraphCanvas.deselectAll} */ + deselectAllNodes() { + this.deselectAll(); + } + /** + * Deletes all selected items from the graph. + * @todo Refactor deletion task to LGraph. Selection is a canvas property, delete is a graph action. + */ + deleteSelected() { + const { graph } = this; + this.emitBeforeChange(); + graph.beforeChange(); + for (const item3 of this.selectedItems) { + if (item3 instanceof LGraphNode) { + const node22 = item3; + if (node22.block_delete) continue; + node22.connectInputToOutput(); + graph.remove(node22); + this.onNodeDeselected?.(node22); + } else if (item3 instanceof LGraphGroup) { + graph.remove(item3); + } else if (item3 instanceof Reroute) { + graph.removeReroute(item3.id); + } + } + this.selectedItems.clear(); + this.selected_nodes = {}; + this.selectedItems.clear(); + this.current_node = null; + this.highlighted_links = {}; + this.setDirty(true); + graph.afterChange(); + this.emitAfterChange(); + } + /** + * deletes all nodes in the current selection from the graph + * @deprecated See {@link LGraphCanvas.deleteSelected} + */ + deleteSelectedNodes() { + this.deleteSelected(); + } + /** + * centers the camera on a given node + */ + centerOnNode(node22) { + const dpi = window?.devicePixelRatio || 1; + this.ds.offset[0] = -node22.pos[0] - node22.size[0] * 0.5 + this.canvas.width * 0.5 / (this.ds.scale * dpi); + this.ds.offset[1] = -node22.pos[1] - node22.size[1] * 0.5 + this.canvas.height * 0.5 / (this.ds.scale * dpi); + this.setDirty(true, true); + } + /** + * adds some useful properties to a mouse event, like the position in graph coordinates + */ + adjustMouseEvent(e2) { + let clientX_rel = e2.clientX; + let clientY_rel = e2.clientY; + if (this.canvas) { + const b2 = this.canvas.getBoundingClientRect(); + clientX_rel -= b2.left; + clientY_rel -= b2.top; + } + e2.safeOffsetX = clientX_rel; + e2.safeOffsetY = clientY_rel; + if (e2.deltaX === void 0) + e2.deltaX = clientX_rel - this.last_mouse_position[0]; + if (e2.deltaY === void 0) + e2.deltaY = clientY_rel - this.last_mouse_position[1]; + this.last_mouse_position[0] = clientX_rel; + this.last_mouse_position[1] = clientY_rel; + e2.canvasX = clientX_rel / this.ds.scale - this.ds.offset[0]; + e2.canvasY = clientY_rel / this.ds.scale - this.ds.offset[1]; + } + /** + * changes the zoom level of the graph (default is 1), you can pass also a place used to pivot the zoom + */ + setZoom(value4, zooming_center) { + this.ds.changeScale(value4, zooming_center); + this.#dirty(); + } + /** + * converts a coordinate from graph coordinates to canvas2D coordinates + */ + convertOffsetToCanvas(pos2, out) { + return this.ds.convertOffsetToCanvas(pos2, out); + } + /** + * converts a coordinate from Canvas2D coordinates to graph space + */ + convertCanvasToOffset(pos2, out) { + return this.ds.convertCanvasToOffset(pos2, out); + } + // converts event coordinates from canvas2D to graph coordinates + convertEventToCanvasOffset(e2) { + const rect = this.canvas.getBoundingClientRect(); + return this.convertCanvasToOffset([ + e2.clientX - rect.left, + e2.clientY - rect.top + ]); + } + /** + * brings a node to front (above all other nodes) + */ + bringToFront(node22) { + const i2 = this.graph._nodes.indexOf(node22); + if (i2 == -1) return; + this.graph._nodes.splice(i2, 1); + this.graph._nodes.push(node22); + } + /** + * sends a node to the back (below all other nodes) + */ + sendToBack(node22) { + const i2 = this.graph._nodes.indexOf(node22); + if (i2 == -1) return; + this.graph._nodes.splice(i2, 1); + this.graph._nodes.unshift(node22); + } + /** + * Determines which nodes are visible and populates {@link out} with the results. + * @param nodes The list of nodes to check - if falsy, all nodes in the graph will be checked + * @param out Array to write visible nodes into - if falsy, a new array is created instead + * @returns Array passed ({@link out}), or a new array containing all visible nodes + */ + computeVisibleNodes(nodes, out) { + const visible_nodes = out || []; + visible_nodes.length = 0; + const _nodes = nodes || this.graph._nodes; + for (const node22 of _nodes) { + node22.updateArea(); + if (!overlapBounding(this.visible_area, node22.renderArea)) continue; + visible_nodes.push(node22); + } + return visible_nodes; + } + /** + * renders the whole canvas content, by rendering in two separated canvas, one containing the background grid and the connections, and one containing the nodes) + */ + draw(force_canvas, force_bgcanvas) { + if (!this.canvas || this.canvas.width == 0 || this.canvas.height == 0) return; + const now2 = LiteGraph.getTime(); + this.render_time = (now2 - this.last_draw_time) * 1e-3; + this.last_draw_time = now2; + if (this.graph) this.ds.computeVisibleArea(this.viewport); + if (this.dirty_canvas || force_canvas) + this.computeVisibleNodes(null, this.visible_nodes); + if (this.dirty_bgcanvas || force_bgcanvas || this.always_render_background || this.graph?._last_trigger_time && now2 - this.graph._last_trigger_time < 1e3) { + this.drawBackCanvas(); + } + if (this.dirty_canvas || force_canvas) this.drawFrontCanvas(); + this.fps = this.render_time ? 1 / this.render_time : 0; + this.frame++; + } + /** + * draws the front canvas (the one containing all the nodes) + */ + drawFrontCanvas() { + this.dirty_canvas = false; + if (!this.ctx) { + this.ctx = this.bgcanvas.getContext("2d"); + } + const ctx = this.ctx; + if (!ctx) return; + const canvas = this.canvas; + if (ctx.start2D && !this.viewport) { + ctx.start2D(); + ctx.restore(); + ctx.setTransform(1, 0, 0, 1, 0, 0); + } + const area = this.viewport || this.dirty_area; + if (area) { + ctx.save(); + ctx.beginPath(); + ctx.rect(area[0], area[1], area[2], area[3]); + ctx.clip(); + } + this.#snapToGrid = this.#shiftDown || LiteGraph.alwaysSnapToGrid ? this.graph.getSnapToGridSize() : void 0; + if (this.clear_background) { + if (area) ctx.clearRect(area[0], area[1], area[2], area[3]); + else ctx.clearRect(0, 0, canvas.width, canvas.height); + } + if (this.bgcanvas == this.canvas) { + this.drawBackCanvas(); + } else { + const scale = window.devicePixelRatio; + ctx.drawImage( + this.bgcanvas, + 0, + 0, + this.bgcanvas.width / scale, + this.bgcanvas.height / scale + ); + } + this.onRender?.(canvas, ctx); + if (this.show_info) { + this.renderInfo(ctx, area ? area[0] : 0, area ? area[1] : 0); + } + if (this.graph) { + ctx.save(); + this.ds.toCanvasContext(ctx); + const visible_nodes = this.visible_nodes; + const drawSnapGuides = this.#snapToGrid && this.isDragging; + for (let i2 = 0; i2 < visible_nodes.length; ++i2) { + const node22 = visible_nodes[i2]; + ctx.save(); + if (drawSnapGuides && this.selectedItems.has(node22)) + this.drawSnapGuide(ctx, node22); + ctx.translate(node22.pos[0], node22.pos[1]); + this.drawNode(node22, ctx); + ctx.restore(); + } + if (this.render_execution_order) { + this.drawExecutionOrder(ctx); + } + if (this.graph.config.links_ontop) { + this.drawConnections(ctx); + } + if (this.connecting_links?.length) { + for (const link2 of this.connecting_links) { + ctx.lineWidth = this.connections_width; + let link_color = null; + const connInOrOut = link2.output || link2.input; + const connType = connInOrOut?.type; + let connDir = connInOrOut?.dir; + if (connDir == null) { + if (link2.output) + connDir = link2.node.horizontal ? LinkDirection.DOWN : LinkDirection.RIGHT; + else + connDir = link2.node.horizontal ? LinkDirection.UP : LinkDirection.LEFT; + } + const connShape = connInOrOut?.shape; + switch (connType) { + case LiteGraph.EVENT: + link_color = LiteGraph.EVENT_LINK_COLOR; + break; + default: + link_color = LiteGraph.CONNECTING_LINK_COLOR; + } + const pos2 = this.graph.reroutes.get(link2.afterRerouteId)?.pos ?? link2.pos; + const highlightPos = this.#getHighlightPosition(); + this.renderLink( + ctx, + pos2, + highlightPos, + null, + false, + null, + link_color, + connDir, + link2.direction ?? LinkDirection.CENTER + ); + ctx.beginPath(); + if (connType === LiteGraph.EVENT || connShape === RenderShape.BOX) { + ctx.rect(pos2[0] - 6 + 0.5, pos2[1] - 5 + 0.5, 14, 10); + ctx.fill(); + ctx.beginPath(); + ctx.rect( + this.graph_mouse[0] - 6 + 0.5, + this.graph_mouse[1] - 5 + 0.5, + 14, + 10 + ); + } else if (connShape === RenderShape.ARROW) { + ctx.moveTo(pos2[0] + 8, pos2[1] + 0.5); + ctx.lineTo(pos2[0] - 4, pos2[1] + 6 + 0.5); + ctx.lineTo(pos2[0] - 4, pos2[1] - 6 + 0.5); + ctx.closePath(); + } else { + ctx.arc(pos2[0], pos2[1], 4, 0, Math.PI * 2); + ctx.fill(); + ctx.beginPath(); + ctx.arc(this.graph_mouse[0], this.graph_mouse[1], 4, 0, Math.PI * 2); + } + ctx.fill(); + this.#renderSnapHighlight(ctx, highlightPos); + } + } + if (this.dragging_rectangle) { + const { eDown, eMove } = this.pointer; + ctx.strokeStyle = "#FFF"; + if (eDown && eMove) { + const transform2 = ctx.getTransform(); + const ratio = window.devicePixelRatio; + ctx.setTransform(ratio, 0, 0, ratio, 0, 0); + const x2 = eDown.safeOffsetX; + const y2 = eDown.safeOffsetY; + ctx.strokeRect(x2, y2, eMove.safeOffsetX - x2, eMove.safeOffsetY - y2); + ctx.setTransform(transform2); + } else { + const [x2, y2, w2, h2] = this.dragging_rectangle; + ctx.strokeRect(x2, y2, w2, h2); + } + } + if (this.over_link_center && this.render_link_tooltip) + this.drawLinkTooltip(ctx, this.over_link_center); + else + this.onDrawLinkTooltip?.(ctx, null); + this.onDrawForeground?.(ctx, this.visible_area); + ctx.restore(); + } + this.onDrawOverlay?.(ctx); + if (area) ctx.restore(); + if (ctx.finish2D) ctx.finish2D(); + } + /** @returns If the pointer is over a link centre marker, the link segment it belongs to. Otherwise, `undefined`. */ + #getLinkCentreOnPos(e2) { + for (const linkSegment of this.renderedPaths) { + const centre = linkSegment._pos; + if (!centre) continue; + if (isInRectangle(e2.canvasX, e2.canvasY, centre[0] - 4, centre[1] - 4, 8, 8)) { + return linkSegment; + } + } + } + /** Get the target snap / highlight point in graph space */ + #getHighlightPosition() { + return LiteGraph.snaps_for_comfy ? this._highlight_pos ?? this.graph_mouse : this.graph_mouse; + } + /** + * Renders indicators showing where a link will connect if released. + * Partial border over target node and a highlight over the slot itself. + * @param ctx Canvas 2D context + */ + #renderSnapHighlight(ctx, highlightPos) { + if (!this._highlight_pos) return; + ctx.fillStyle = "#ffcc00"; + ctx.beginPath(); + const shape = this._highlight_input?.shape; + if (shape === RenderShape.ARROW) { + ctx.moveTo(highlightPos[0] + 8, highlightPos[1] + 0.5); + ctx.lineTo(highlightPos[0] - 4, highlightPos[1] + 6 + 0.5); + ctx.lineTo(highlightPos[0] - 4, highlightPos[1] - 6 + 0.5); + ctx.closePath(); + } else { + ctx.arc(highlightPos[0], highlightPos[1], 6, 0, Math.PI * 2); + } + ctx.fill(); + if (!LiteGraph.snap_highlights_node) return; + const node22 = this.node_over; + if (!(node22 && this.connecting_links?.[0])) return; + const { strokeStyle, lineWidth } = ctx; + const area = node22.boundingRect; + const gap = 3; + const radius = this.round_radius + gap; + const x2 = area[0] - gap; + const y2 = area[1] - gap; + const width2 = area[2] + gap * 2; + const height = area[3] + gap * 2; + ctx.beginPath(); + ctx.roundRect(x2, y2, width2, height, radius); + const start2 = this.connecting_links[0].output === null ? 0 : 1; + const inverter = start2 ? -1 : 1; + const hx = highlightPos[0]; + const hy = highlightPos[1]; + const gRadius = width2 < height ? width2 : width2 * Math.max(height / width2, 0.5); + const gradient = ctx.createRadialGradient(hx, hy, 0, hx, hy, gRadius); + gradient.addColorStop(1, "#00000000"); + gradient.addColorStop(0, "#ffcc00aa"); + const linearGradient = ctx.createLinearGradient(x2, y2, x2 + width2, y2); + linearGradient.addColorStop(0.5, "#00000000"); + linearGradient.addColorStop(start2 + 0.67 * inverter, "#ddeeff33"); + linearGradient.addColorStop(start2 + inverter, "#ffcc0055"); + ctx.setLineDash([radius, radius * 1e-3]); + ctx.lineWidth = 1; + ctx.strokeStyle = linearGradient; + ctx.stroke(); + ctx.strokeStyle = gradient; + ctx.stroke(); + ctx.setLineDash([]); + ctx.lineWidth = lineWidth; + ctx.strokeStyle = strokeStyle; + } + /** + * draws some useful stats in the corner of the canvas + */ + renderInfo(ctx, x2, y2) { + x2 = x2 || 10; + y2 = y2 || this.canvas.offsetHeight - 80; + ctx.save(); + ctx.translate(x2, y2); + ctx.font = "10px Arial"; + ctx.fillStyle = "#888"; + ctx.textAlign = "left"; + if (this.graph) { + ctx.fillText("T: " + this.graph.globaltime.toFixed(2) + "s", 5, 13 * 1); + ctx.fillText("I: " + this.graph.iteration, 5, 13 * 2); + ctx.fillText("N: " + this.graph._nodes.length + " [" + this.visible_nodes.length + "]", 5, 13 * 3); + ctx.fillText("V: " + this.graph._version, 5, 13 * 4); + ctx.fillText("FPS:" + this.fps.toFixed(2), 5, 13 * 5); + } else { + ctx.fillText("No graph selected", 5, 13 * 1); + } + ctx.restore(); + } + /** + * draws the back canvas (the one containing the background and the connections) + */ + drawBackCanvas() { + const canvas = this.bgcanvas; + if (canvas.width != this.canvas.width || canvas.height != this.canvas.height) { + canvas.width = this.canvas.width; + canvas.height = this.canvas.height; + } + if (!this.bgctx) { + this.bgctx = this.bgcanvas.getContext("2d"); + } + const ctx = this.bgctx; + if (ctx.start) ctx.start(); + const viewport = this.viewport || [0, 0, ctx.canvas.width, ctx.canvas.height]; + if (this.clear_background) { + ctx.clearRect(viewport[0], viewport[1], viewport[2], viewport[3]); + } + if (this._graph_stack?.length) { + ctx.save(); + const subgraph_node = this.graph._subgraph_node; + ctx.strokeStyle = subgraph_node.bgcolor; + ctx.lineWidth = 10; + ctx.strokeRect(1, 1, canvas.width - 2, canvas.height - 2); + ctx.lineWidth = 1; + ctx.font = "40px Arial"; + ctx.textAlign = "center"; + ctx.fillStyle = subgraph_node.bgcolor || "#AAA"; + let title = ""; + for (let i2 = 1; i2 < this._graph_stack.length; ++i2) { + title += this._graph_stack[i2]._subgraph_node.getTitle() + " >> "; + } + ctx.fillText(title + subgraph_node.getTitle(), canvas.width * 0.5, 40); + ctx.restore(); + } + const bg_already_painted = this.onRenderBackground ? this.onRenderBackground(canvas, ctx) : false; + if (!this.viewport) { + const scale = window.devicePixelRatio; + ctx.restore(); + ctx.setTransform(scale, 0, 0, scale, 0, 0); + } + this.visible_links.length = 0; + if (this.graph) { + ctx.save(); + this.ds.toCanvasContext(ctx); + if (this.ds.scale < 1.5 && !bg_already_painted && this.clear_background_color) { + ctx.fillStyle = this.clear_background_color; + ctx.fillRect( + this.visible_area[0], + this.visible_area[1], + this.visible_area[2], + this.visible_area[3] + ); + } + if (this.background_image && this.ds.scale > 0.5 && !bg_already_painted) { + if (this.zoom_modify_alpha) { + ctx.globalAlpha = (1 - 0.5 / this.ds.scale) * this.editor_alpha; + } else { + ctx.globalAlpha = this.editor_alpha; + } + ctx.imageSmoothingEnabled = false; + if (!this._bg_img || this._bg_img.name != this.background_image) { + this._bg_img = new Image(); + this._bg_img.name = this.background_image; + this._bg_img.src = this.background_image; + const that = this; + this._bg_img.onload = function() { + that.draw(true, true); + }; + } + let pattern = this._pattern; + if (pattern == null && this._bg_img.width > 0) { + pattern = ctx.createPattern(this._bg_img, "repeat"); + this._pattern_img = this._bg_img; + this._pattern = pattern; + } + if (pattern) { + ctx.fillStyle = pattern; + ctx.fillRect( + this.visible_area[0], + this.visible_area[1], + this.visible_area[2], + this.visible_area[3] + ); + ctx.fillStyle = "transparent"; + } + ctx.globalAlpha = 1; + ctx.imageSmoothingEnabled = true; + } + if (this.graph._groups.length) { + this.drawGroups(canvas, ctx); + } + this.onDrawBackground?.(ctx, this.visible_area); + if (this.render_canvas_border) { + ctx.strokeStyle = "#235"; + ctx.strokeRect(0, 0, canvas.width, canvas.height); + } + if (this.render_connections_shadows) { + ctx.shadowColor = "#000"; + ctx.shadowOffsetX = 0; + ctx.shadowOffsetY = 0; + ctx.shadowBlur = 6; + } else { + ctx.shadowColor = "rgba(0,0,0,0)"; + } + this.drawConnections(ctx); + ctx.shadowColor = "rgba(0,0,0,0)"; + ctx.restore(); + } + ctx.finish?.(); + this.dirty_bgcanvas = false; + this.dirty_canvas = true; + } + /** + * draws the given node inside the canvas + */ + drawNode(node22, ctx) { + this.current_node = node22; + const color2 = node22.color || node22.constructor.color || LiteGraph.NODE_DEFAULT_COLOR; + const bgcolor = node22.bgcolor || node22.constructor.bgcolor || LiteGraph.NODE_DEFAULT_BGCOLOR; + const low_quality = this.ds.scale < 0.6; + const editor_alpha = this.editor_alpha; + ctx.globalAlpha = editor_alpha; + if (this.render_shadows && !low_quality) { + ctx.shadowColor = LiteGraph.DEFAULT_SHADOW_COLOR; + ctx.shadowOffsetX = 2 * this.ds.scale; + ctx.shadowOffsetY = 2 * this.ds.scale; + ctx.shadowBlur = 3 * this.ds.scale; + } else { + ctx.shadowColor = "transparent"; + } + if (node22.flags.collapsed && node22.onDrawCollapsed?.(ctx, this) == true) + return; + const shape = node22._shape || RenderShape.BOX; + const size2 = LGraphCanvas.#temp_vec2; + LGraphCanvas.#temp_vec2.set(node22.size); + const horizontal2 = node22.horizontal; + if (node22.flags.collapsed) { + ctx.font = this.inner_text_font; + const title = node22.getTitle ? node22.getTitle() : node22.title; + if (title != null) { + node22._collapsed_width = Math.min( + node22.size[0], + ctx.measureText(title).width + LiteGraph.NODE_TITLE_HEIGHT * 2 + ); + size2[0] = node22._collapsed_width; + size2[1] = 0; + } + } + if (node22.clip_area) { + ctx.save(); + ctx.beginPath(); + if (shape == RenderShape.BOX) { + ctx.rect(0, 0, size2[0], size2[1]); + } else if (shape == RenderShape.ROUND) { + ctx.roundRect(0, 0, size2[0], size2[1], [10]); + } else if (shape == RenderShape.CIRCLE) { + ctx.arc(size2[0] * 0.5, size2[1] * 0.5, size2[0] * 0.5, 0, Math.PI * 2); + } + ctx.clip(); + } + this.drawNodeShape( + node22, + ctx, + size2, + color2, + bgcolor, + node22.selected + ); + if (!low_quality) { + node22.drawBadges(ctx); + } + ctx.shadowColor = "transparent"; + ctx.strokeStyle = LiteGraph.NODE_BOX_OUTLINE_COLOR; + node22.onDrawForeground?.(ctx, this, this.canvas); + ctx.textAlign = horizontal2 ? "center" : "left"; + ctx.font = this.inner_text_font; + const render_text = !low_quality; + const highlightColour = LiteGraph.NODE_TEXT_HIGHLIGHT_COLOR ?? LiteGraph.NODE_SELECTED_TITLE_COLOR ?? LiteGraph.NODE_TEXT_COLOR; + const out_slot = this.connecting_links?.[0]?.output; + const in_slot = this.connecting_links?.[0]?.input; + ctx.lineWidth = 1; + let max_y = 0; + const slot_pos = new Float32Array(2); + if (!node22.flags.collapsed) { + if (node22.inputs) { + for (let i2 = 0; i2 < node22.inputs.length; i2++) { + const slot = node22.inputs[i2]; + const slot_type = slot.type; + const isValid2 = !this.connecting_links || out_slot && LiteGraph.isValidConnection(slot.type, out_slot.type); + const highlight = isValid2 && node22.mouseOver?.inputId === i2; + const label_color = highlight ? highlightColour : LiteGraph.NODE_TEXT_COLOR; + ctx.globalAlpha = isValid2 ? editor_alpha : 0.4 * editor_alpha; + ctx.fillStyle = slot.link != null ? slot.color_on || this.default_connection_color_byType[slot_type] || this.default_connection_color.input_on : slot.color_off || this.default_connection_color_byTypeOff[slot_type] || this.default_connection_color_byType[slot_type] || this.default_connection_color.input_off; + const pos2 = node22.getConnectionPos(true, i2, slot_pos); + pos2[0] -= node22.pos[0]; + pos2[1] -= node22.pos[1]; + if (max_y < pos2[1] + LiteGraph.NODE_SLOT_HEIGHT * 0.5) { + max_y = pos2[1] + LiteGraph.NODE_SLOT_HEIGHT * 0.5; + } + drawSlot(ctx, slot, pos2, { + horizontal: horizontal2, + low_quality, + render_text, + label_color, + label_position: LabelPosition.Right, + // Input slot is not stroked. + do_stroke: false, + highlight + }); + } + } + ctx.textAlign = horizontal2 ? "center" : "right"; + ctx.strokeStyle = "black"; + if (node22.outputs) { + for (let i2 = 0; i2 < node22.outputs.length; i2++) { + const slot = node22.outputs[i2]; + const slot_type = slot.type; + const isValid2 = !this.connecting_links || in_slot && LiteGraph.isValidConnection(slot_type, in_slot.type); + const highlight = isValid2 && node22.mouseOver?.outputId === i2; + const label_color = highlight ? highlightColour : LiteGraph.NODE_TEXT_COLOR; + ctx.globalAlpha = isValid2 ? editor_alpha : 0.4 * editor_alpha; + const pos2 = node22.getConnectionPos(false, i2, slot_pos); + pos2[0] -= node22.pos[0]; + pos2[1] -= node22.pos[1]; + if (max_y < pos2[1] + LiteGraph.NODE_SLOT_HEIGHT * 0.5) { + max_y = pos2[1] + LiteGraph.NODE_SLOT_HEIGHT * 0.5; + } + ctx.fillStyle = slot.links && slot.links.length ? slot.color_on || this.default_connection_color_byType[slot_type] || this.default_connection_color.output_on : slot.color_off || this.default_connection_color_byTypeOff[slot_type] || this.default_connection_color_byType[slot_type] || this.default_connection_color.output_off; + drawSlot(ctx, slot, pos2, { + horizontal: horizontal2, + low_quality, + render_text, + label_color, + label_position: LabelPosition.Left, + do_stroke: true, + highlight + }); + } + } + ctx.textAlign = "left"; + ctx.globalAlpha = 1; + if (node22.widgets) { + let widgets_y = max_y; + if (horizontal2 || node22.widgets_up) { + widgets_y = 2; + } + if (node22.widgets_start_y != null) widgets_y = node22.widgets_start_y; + this.drawNodeWidgets( + node22, + widgets_y, + ctx, + this.node_widget && this.node_widget[0] == node22 ? this.node_widget[1] : null + ); + } + } else if (this.render_collapsed_slots) { + let input_slot = null; + let output_slot = null; + let slot; + if (node22.inputs) { + for (let i2 = 0; i2 < node22.inputs.length; i2++) { + slot = node22.inputs[i2]; + if (slot.link == null) { + continue; + } + input_slot = slot; + break; + } + } + if (node22.outputs) { + for (let i2 = 0; i2 < node22.outputs.length; i2++) { + slot = node22.outputs[i2]; + if (!slot.links || !slot.links.length) { + continue; + } + output_slot = slot; + } + } + if (input_slot) { + let x2 = 0; + let y2 = LiteGraph.NODE_TITLE_HEIGHT * -0.5; + if (horizontal2) { + x2 = node22._collapsed_width * 0.5; + y2 = -LiteGraph.NODE_TITLE_HEIGHT; + } + ctx.fillStyle = "#686"; + ctx.beginPath(); + if (slot.type === LiteGraph.EVENT || slot.shape === RenderShape.BOX) { + ctx.rect(x2 - 7 + 0.5, y2 - 4, 14, 8); + } else if (slot.shape === RenderShape.ARROW) { + ctx.moveTo(x2 + 8, y2); + ctx.lineTo(x2 + -4, y2 - 4); + ctx.lineTo(x2 + -4, y2 + 4); + ctx.closePath(); + } else { + ctx.arc(x2, y2, 4, 0, Math.PI * 2); + } + ctx.fill(); + } + if (output_slot) { + let x2 = node22._collapsed_width; + let y2 = LiteGraph.NODE_TITLE_HEIGHT * -0.5; + if (horizontal2) { + x2 = node22._collapsed_width * 0.5; + y2 = 0; + } + ctx.fillStyle = "#686"; + ctx.strokeStyle = "black"; + ctx.beginPath(); + if (slot.type === LiteGraph.EVENT || slot.shape === RenderShape.BOX) { + ctx.rect(x2 - 7 + 0.5, y2 - 4, 14, 8); + } else if (slot.shape === RenderShape.ARROW) { + ctx.moveTo(x2 + 6, y2); + ctx.lineTo(x2 - 6, y2 - 4); + ctx.lineTo(x2 - 6, y2 + 4); + ctx.closePath(); + } else { + ctx.arc(x2, y2, 4, 0, Math.PI * 2); + } + ctx.fill(); + } + } + if (node22.clip_area) { + ctx.restore(); + } + ctx.globalAlpha = 1; + } + /** + * Draws the link mouseover effect and tooltip. + * @param ctx Canvas 2D context to draw on + * @param link The link to render the mouseover effect for + * @remarks + * Called against {@link LGraphCanvas.over_link_center}. + * @todo Split tooltip from hover, so it can be drawn / eased separately + */ + drawLinkTooltip(ctx, link2) { + const pos2 = link2._pos; + ctx.fillStyle = "black"; + ctx.beginPath(); + if (this.linkMarkerShape === LinkMarkerShape.Arrow) { + const transform2 = ctx.getTransform(); + ctx.translate(pos2[0], pos2[1]); + if (Number.isFinite(link2._centreAngle)) ctx.rotate(link2._centreAngle); + ctx.moveTo(-2, -3); + ctx.lineTo(4, 0); + ctx.lineTo(-2, 3); + ctx.setTransform(transform2); + } else if (this.linkMarkerShape == null || this.linkMarkerShape === LinkMarkerShape.Circle) { + ctx.arc(pos2[0], pos2[1], 3, 0, Math.PI * 2); + } + ctx.fill(); + const data25 = link2.data; + if (data25 == null) return; + if (this.onDrawLinkTooltip?.(ctx, link2, this) == true) return; + let text2 = null; + if (typeof data25 === "number") + text2 = data25.toFixed(2); + else if (typeof data25 === "string") + text2 = '"' + data25 + '"'; + else if (typeof data25 === "boolean") + text2 = String(data25); + else if (data25.toToolTip) + text2 = data25.toToolTip(); + else + text2 = "[" + data25.constructor.name + "]"; + if (text2 == null) return; + text2 = text2.substring(0, 30); + ctx.font = "14px Courier New"; + const info = ctx.measureText(text2); + const w2 = info.width + 20; + const h2 = 24; + ctx.shadowColor = "black"; + ctx.shadowOffsetX = 2; + ctx.shadowOffsetY = 2; + ctx.shadowBlur = 3; + ctx.fillStyle = "#454"; + ctx.beginPath(); + ctx.roundRect(pos2[0] - w2 * 0.5, pos2[1] - 15 - h2, w2, h2, [3]); + ctx.moveTo(pos2[0] - 10, pos2[1] - 15); + ctx.lineTo(pos2[0] + 10, pos2[1] - 15); + ctx.lineTo(pos2[0], pos2[1] - 5); + ctx.fill(); + ctx.shadowColor = "transparent"; + ctx.textAlign = "center"; + ctx.fillStyle = "#CEC"; + ctx.fillText(text2, pos2[0], pos2[1] - 15 - h2 * 0.3); + } + /** + * Draws the shape of the given node on the canvas + * @param node The node to draw + * @param ctx 2D canvas rendering context used to draw + * @param size Size of the background to draw, in graph units. Differs from node size if collapsed, etc. + * @param fgcolor Foreground colour - used for text + * @param bgcolor Background colour of the node + * @param selected Whether to render the node as selected. Likely to be removed in future, as current usage is simply the selected property of the node. + */ + drawNodeShape(node22, ctx, size2, fgcolor, bgcolor, selected2) { + ctx.strokeStyle = fgcolor; + ctx.fillStyle = LiteGraph.use_legacy_node_error_indicator ? "#F00" : bgcolor; + const title_height = LiteGraph.NODE_TITLE_HEIGHT; + const low_quality = this.ds.scale < 0.5; + const { collapsed: collapsed2 } = node22.flags; + const shape = node22._shape || node22.constructor.shape || LiteGraph.NODE_DEFAULT_SHAPE; + const { title_mode } = node22.constructor; + const render_title = title_mode == TitleMode.TRANSPARENT_TITLE || title_mode == TitleMode.NO_TITLE ? false : true; + const area = LGraphCanvas.#tmp_area; + node22.measure(area); + area[0] -= node22.pos[0]; + area[1] -= node22.pos[1]; + const old_alpha = ctx.globalAlpha; + ctx.beginPath(); + if (shape == RenderShape.BOX || low_quality) { + ctx.fillRect(area[0], area[1], area[2], area[3]); + } else if (shape == RenderShape.ROUND || shape == RenderShape.CARD) { + ctx.roundRect( + area[0], + area[1], + area[2], + area[3], + shape == RenderShape.CARD ? [this.round_radius, this.round_radius, 0, 0] : [this.round_radius] + ); + } else if (shape == RenderShape.CIRCLE) { + ctx.arc(size2[0] * 0.5, size2[1] * 0.5, size2[0] * 0.5, 0, Math.PI * 2); + } + ctx.fill(); + if (node22.has_errors && !LiteGraph.use_legacy_node_error_indicator) { + this.strokeShape(ctx, area, { + shape, + title_mode, + title_height, + padding: 12, + colour: LiteGraph.NODE_ERROR_COLOUR, + collapsed: collapsed2, + thickness: 10 + }); + } + if (!collapsed2 && render_title) { + ctx.shadowColor = "transparent"; + ctx.fillStyle = "rgba(0,0,0,0.2)"; + ctx.fillRect(0, -1, area[2], 2); + } + ctx.shadowColor = "transparent"; + node22.onDrawBackground?.(ctx, this, this.canvas, this.graph_mouse); + if (render_title || title_mode == TitleMode.TRANSPARENT_TITLE) { + if (node22.onDrawTitleBar) { + node22.onDrawTitleBar(ctx, title_height, size2, this.ds.scale, fgcolor); + } else if (title_mode != TitleMode.TRANSPARENT_TITLE && (node22.constructor.title_color || this.render_title_colored)) { + const title_color = node22.constructor.title_color || fgcolor; + if (collapsed2) { + ctx.shadowColor = LiteGraph.DEFAULT_SHADOW_COLOR; + } + ctx.fillStyle = title_color; + ctx.beginPath(); + if (shape == RenderShape.BOX || low_quality) { + ctx.rect(0, -title_height, size2[0], title_height); + } else if (shape == RenderShape.ROUND || shape == RenderShape.CARD) { + ctx.roundRect( + 0, + -title_height, + size2[0], + title_height, + collapsed2 ? [this.round_radius] : [this.round_radius, this.round_radius, 0, 0] + ); + } + ctx.fill(); + ctx.shadowColor = "transparent"; + } + let colState = LiteGraph.node_box_coloured_by_mode && LiteGraph.NODE_MODES_COLORS[node22.mode] ? LiteGraph.NODE_MODES_COLORS[node22.mode] : false; + if (LiteGraph.node_box_coloured_when_on) { + colState = node22.action_triggered ? "#FFF" : node22.execute_triggered ? "#AAA" : colState; + } + const box_size = 10; + if (node22.onDrawTitleBox) { + node22.onDrawTitleBox(ctx, title_height, size2, this.ds.scale); + } else if (shape == RenderShape.ROUND || shape == RenderShape.CIRCLE || shape == RenderShape.CARD) { + if (low_quality) { + ctx.fillStyle = "black"; + ctx.beginPath(); + ctx.arc( + title_height * 0.5, + title_height * -0.5, + box_size * 0.5 + 1, + 0, + Math.PI * 2 + ); + ctx.fill(); + } + ctx.fillStyle = node22.boxcolor || colState || LiteGraph.NODE_DEFAULT_BOXCOLOR; + if (low_quality) + ctx.fillRect( + title_height * 0.5 - box_size * 0.5, + title_height * -0.5 - box_size * 0.5, + box_size, + box_size + ); + else { + ctx.beginPath(); + ctx.arc( + title_height * 0.5, + title_height * -0.5, + box_size * 0.5, + 0, + Math.PI * 2 + ); + ctx.fill(); + } + } else { + if (low_quality) { + ctx.fillStyle = "black"; + ctx.fillRect( + (title_height - box_size) * 0.5 - 1, + (title_height + box_size) * -0.5 - 1, + box_size + 2, + box_size + 2 + ); + } + ctx.fillStyle = node22.boxcolor || colState || LiteGraph.NODE_DEFAULT_BOXCOLOR; + ctx.fillRect( + (title_height - box_size) * 0.5, + (title_height + box_size) * -0.5, + box_size, + box_size + ); + } + ctx.globalAlpha = old_alpha; + if (node22.onDrawTitleText) { + node22.onDrawTitleText( + ctx, + title_height, + size2, + this.ds.scale, + this.title_text_font, + selected2 + ); + } + if (!low_quality) { + ctx.font = this.title_text_font; + const rawTitle = node22.getTitle() ?? `❌ ${node22.type}`; + const title = String(rawTitle) + (node22.pinned ? "📌" : ""); + if (title) { + if (selected2) { + ctx.fillStyle = LiteGraph.NODE_SELECTED_TITLE_COLOR; + } else { + ctx.fillStyle = node22.constructor.title_text_color || this.node_title_color; + } + if (collapsed2) { + ctx.textAlign = "left"; + ctx.fillText( + title.substr(0, 20), + // avoid urls too long + title_height, + // + measure.width * 0.5, + LiteGraph.NODE_TITLE_TEXT_Y - title_height + ); + ctx.textAlign = "left"; + } else { + ctx.textAlign = "left"; + ctx.fillText( + title, + title_height, + LiteGraph.NODE_TITLE_TEXT_Y - title_height + ); + } + } + } + if (!collapsed2 && node22.subgraph && !node22.skip_subgraph_button) { + const w2 = LiteGraph.NODE_TITLE_HEIGHT; + const x2 = node22.size[0] - w2; + const over = LiteGraph.isInsideRectangle( + this.graph_mouse[0] - node22.pos[0], + this.graph_mouse[1] - node22.pos[1], + x2 + 2, + -w2 + 2, + w2 - 4, + w2 - 4 + ); + ctx.fillStyle = over ? "#888" : "#555"; + if (shape == RenderShape.BOX || low_quality) { + ctx.fillRect(x2 + 2, -w2 + 2, w2 - 4, w2 - 4); + } else { + ctx.beginPath(); + ctx.roundRect(x2 + 2, -w2 + 2, w2 - 4, w2 - 4, [4]); + ctx.fill(); + } + ctx.fillStyle = "#333"; + ctx.beginPath(); + ctx.moveTo(x2 + w2 * 0.2, -w2 * 0.6); + ctx.lineTo(x2 + w2 * 0.8, -w2 * 0.6); + ctx.lineTo(x2 + w2 * 0.5, -w2 * 0.3); + ctx.fill(); + } + node22.onDrawTitle?.(ctx); + } + if (selected2) { + node22.onBounding?.(area); + const padding = node22.has_errors && !LiteGraph.use_legacy_node_error_indicator ? 20 : void 0; + this.strokeShape(ctx, area, { + shape, + title_height, + title_mode, + padding, + collapsed: node22.flags?.collapsed + }); + } + if (node22.execute_triggered > 0) node22.execute_triggered--; + if (node22.action_triggered > 0) node22.action_triggered--; + } + /** + * Draws only the path of a shape on the canvas, without filling. + * Used to draw indicators for node status, e.g. "selected". + * @param ctx The 2D context to draw on + * @param area The position and size of the shape to render + */ + strokeShape(ctx, area, { + /** The shape to render */ + shape = RenderShape.BOX, + /** Shape will extend above the Y-axis 0 by this amount */ + title_height = LiteGraph.NODE_TITLE_HEIGHT, + /** @deprecated This is node-specific: it should be removed entirely, and behaviour defined by the caller more explicitly */ + title_mode = TitleMode.NORMAL_TITLE, + /** The colour that should be drawn */ + colour = LiteGraph.NODE_BOX_OUTLINE_COLOR, + /** The distance between the edge of the {@link area} and the middle of the line */ + padding = 6, + /** @deprecated This is node-specific: it should be removed entirely, and behaviour defined by the caller more explicitly */ + collapsed: collapsed2 = false, + /** Thickness of the line drawn (`lineWidth`) */ + thickness = 1 + } = {}) { + if (title_mode === TitleMode.TRANSPARENT_TITLE) { + area[1] -= title_height; + area[3] += title_height; + } + const { lineWidth, strokeStyle } = ctx; + ctx.lineWidth = thickness; + ctx.globalAlpha = 0.8; + ctx.strokeStyle = colour; + ctx.beginPath(); + const [x2, y2, width2, height] = area; + switch (shape) { + case RenderShape.BOX: { + ctx.rect( + x2 - padding, + y2 - padding, + width2 + 2 * padding, + height + 2 * padding + ); + break; + } + case RenderShape.ROUND: + case RenderShape.CARD: { + const radius = this.round_radius + padding; + const isCollapsed = shape === RenderShape.CARD && collapsed2; + const cornerRadii = isCollapsed || shape === RenderShape.ROUND ? [radius] : [radius, 2, radius, 2]; + ctx.roundRect( + x2 - padding, + y2 - padding, + width2 + 2 * padding, + height + 2 * padding, + cornerRadii + ); + break; + } + case RenderShape.CIRCLE: { + const centerX = x2 + width2 / 2; + const centerY = y2 + height / 2; + const radius = Math.max(width2, height) / 2 + padding; + ctx.arc(centerX, centerY, radius, 0, Math.PI * 2); + break; + } + } + ctx.stroke(); + ctx.lineWidth = lineWidth; + ctx.strokeStyle = strokeStyle; + ctx.globalAlpha = 1; + } + /** + * Draws a snap guide for a {@link Positionable} item. + * + * Initial design was a simple white rectangle representing the location the + * item would land if dropped. + * @param ctx The 2D canvas context to draw on + * @param item The item to draw a snap guide for + * @param shape The shape of the snap guide to draw + * @todo Update to align snapping with boundingRect + * @todo Shapes + */ + drawSnapGuide(ctx, item3, shape = RenderShape.ROUND) { + const snapGuide = LGraphCanvas.#temp; + snapGuide.set(item3.boundingRect); + const { pos: pos2 } = item3; + const offsetX = pos2[0] - snapGuide[0]; + const offsetY = pos2[1] - snapGuide[1]; + snapGuide[0] += offsetX; + snapGuide[1] += offsetY; + snapPoint(snapGuide, this.#snapToGrid); + snapGuide[0] -= offsetX; + snapGuide[1] -= offsetY; + const { globalAlpha } = ctx; + ctx.globalAlpha = 1; + ctx.beginPath(); + const [x2, y2, w2, h2] = snapGuide; + if (shape === RenderShape.CIRCLE) { + const midX = x2 + w2 * 0.5; + const midY = y2 + h2 * 0.5; + const radius = Math.min(w2 * 0.5, h2 * 0.5); + ctx.arc(midX, midY, radius, 0, Math.PI * 2); + } else { + ctx.rect(x2, y2, w2, h2); + } + ctx.lineWidth = 0.5; + ctx.strokeStyle = "#FFFFFF66"; + ctx.fillStyle = "#FFFFFF22"; + ctx.fill(); + ctx.stroke(); + ctx.globalAlpha = globalAlpha; + } + drawConnections(ctx) { + const rendered = this.renderedPaths; + rendered.clear(); + if (this.links_render_mode === LinkRenderType.HIDDEN_LINK) return; + const visibleReroutes = []; + const now2 = LiteGraph.getTime(); + const visible_area = this.visible_area; + LGraphCanvas.#margin_area[0] = visible_area[0] - 20; + LGraphCanvas.#margin_area[1] = visible_area[1] - 20; + LGraphCanvas.#margin_area[2] = visible_area[2] + 40; + LGraphCanvas.#margin_area[3] = visible_area[3] + 40; + ctx.lineWidth = this.connections_width; + ctx.fillStyle = "#AAA"; + ctx.strokeStyle = "#AAA"; + ctx.globalAlpha = this.editor_alpha; + const nodes = this.graph._nodes; + for (let n2 = 0, l2 = nodes.length; n2 < l2; ++n2) { + const node22 = nodes[n2]; + if (!node22.inputs || !node22.inputs.length) continue; + for (let i2 = 0; i2 < node22.inputs.length; ++i2) { + const input = node22.inputs[i2]; + if (!input || input.link == null) continue; + const link_id = input.link; + const link2 = this.graph._links.get(link_id); + if (!link2) continue; + const start_node = this.graph.getNodeById(link2.origin_id); + if (start_node == null) continue; + const outputId = link2.origin_slot; + const start_node_slotpos = outputId == -1 ? [start_node.pos[0] + 10, start_node.pos[1] + 10] : start_node.getConnectionPos(false, outputId, LGraphCanvas.#tempA); + const end_node_slotpos = node22.getConnectionPos(true, i2, LGraphCanvas.#tempB); + const reroutes = this.reroutesEnabled ? LLink.getReroutes(this.graph, link2) : []; + const points = [ + start_node_slotpos, + ...reroutes.map((x2) => x2.pos), + end_node_slotpos + ]; + const pointsX = points.map((x2) => x2[0]); + const pointsY = points.map((x2) => x2[1]); + LGraphCanvas.#link_bounding[0] = Math.min(...pointsX); + LGraphCanvas.#link_bounding[1] = Math.min(...pointsY); + LGraphCanvas.#link_bounding[2] = Math.max(...pointsX) - LGraphCanvas.#link_bounding[0]; + LGraphCanvas.#link_bounding[3] = Math.max(...pointsY) - LGraphCanvas.#link_bounding[1]; + if (!overlapBounding(LGraphCanvas.#link_bounding, LGraphCanvas.#margin_area)) + continue; + const start_slot = start_node.outputs[outputId]; + const end_slot = node22.inputs[i2]; + if (!start_slot || !end_slot) continue; + const start_dir = start_slot.dir || (start_node.horizontal ? LinkDirection.DOWN : LinkDirection.RIGHT); + const end_dir = end_slot.dir || (node22.horizontal ? LinkDirection.UP : LinkDirection.LEFT); + if (reroutes.length) { + let startControl; + const l22 = reroutes.length; + for (let j2 = 0; j2 < l22; j2++) { + const reroute = reroutes[j2]; + if (!rendered.has(reroute)) { + rendered.add(reroute); + visibleReroutes.push(reroute); + reroute._colour = link2.color || LGraphCanvas.link_type_colors[link2.type] || this.default_link_color; + const prevReroute = this.graph.reroutes.get(reroute.parentId); + const startPos = prevReroute?.pos ?? start_node_slotpos; + reroute.calculateAngle(this.last_draw_time, this.graph, startPos); + this.renderLink( + ctx, + startPos, + reroute.pos, + link2, + false, + 0, + null, + start_dir, + end_dir, + { + startControl, + endControl: reroute.controlPoint, + reroute + } + ); + } + const nextPos = reroutes[j2 + 1]?.pos ?? end_node_slotpos; + const dist3 = Math.min(80, distance(reroute.pos, nextPos) * 0.25); + startControl = [dist3 * reroute.cos, dist3 * reroute.sin]; + } + this.renderLink( + ctx, + points.at(-2), + points.at(-1), + link2, + false, + 0, + null, + start_dir, + end_dir, + { startControl } + ); + } else { + this.renderLink( + ctx, + start_node_slotpos, + end_node_slotpos, + link2, + false, + 0, + null, + start_dir, + end_dir + ); + } + rendered.add(link2); + if (link2 && link2._last_time && now2 - link2._last_time < 1e3) { + const f2 = 2 - (now2 - link2._last_time) * 2e-3; + const tmp = ctx.globalAlpha; + ctx.globalAlpha = tmp * f2; + this.renderLink( + ctx, + start_node_slotpos, + end_node_slotpos, + link2, + true, + f2, + "white", + start_dir, + end_dir + ); + ctx.globalAlpha = tmp; + } + } + } + for (const reroute of visibleReroutes) { + if (this.#snapToGrid && this.isDragging && this.selectedItems.has(reroute)) + this.drawSnapGuide(ctx, reroute, RenderShape.CIRCLE); + reroute.draw(ctx); + } + ctx.globalAlpha = 1; + } + /** + * draws a link between two points + * @param ctx Canvas 2D rendering context + * @param a start pos + * @param b end pos + * @param link the link object with all the link info + * @param skip_border ignore the shadow of the link + * @param flow show flow animation (for events) + * @param color the color for the link + * @param start_dir the direction enum + * @param end_dir the direction enum + */ + renderLink(ctx, a2, b2, link2, skip_border, flow, color2, start_dir, end_dir, { + startControl, + endControl, + reroute, + num_sublines = 1 + } = {}) { + if (link2) this.visible_links.push(link2); + const linkColour = link2 != null && this.highlighted_links[link2.id] ? "#FFF" : color2 || link2?.color || LGraphCanvas.link_type_colors[link2.type] || this.default_link_color; + const startDir = start_dir || LinkDirection.RIGHT; + const endDir = end_dir || LinkDirection.LEFT; + const dist3 = this.links_render_mode == LinkRenderType.SPLINE_LINK && (!endControl || !startControl) ? distance(a2, b2) : null; + if (this.render_connections_border && this.ds.scale > 0.6) { + ctx.lineWidth = this.connections_width + 4; + } + ctx.lineJoin = "round"; + num_sublines ||= 1; + if (num_sublines > 1) ctx.lineWidth = 0.5; + const path = new Path2D(); + const linkSegment = reroute ?? link2; + if (linkSegment) linkSegment.path = path; + const innerA = LGraphCanvas.#lTempA; + const innerB = LGraphCanvas.#lTempB; + const pos2 = linkSegment?._pos ?? [0, 0]; + for (let i2 = 0; i2 < num_sublines; i2 += 1) { + const offsety = (i2 - (num_sublines - 1) * 0.5) * 5; + innerA[0] = a2[0]; + innerA[1] = a2[1]; + innerB[0] = b2[0]; + innerB[1] = b2[1]; + if (this.links_render_mode == LinkRenderType.SPLINE_LINK) { + if (endControl) { + innerB[0] = b2[0] + endControl[0]; + innerB[1] = b2[1] + endControl[1]; + } else { + this.#addSplineOffset(innerB, endDir, dist3); + } + if (startControl) { + innerA[0] = a2[0] + startControl[0]; + innerA[1] = a2[1] + startControl[1]; + } else { + this.#addSplineOffset(innerA, startDir, dist3); + } + path.moveTo(a2[0], a2[1] + offsety); + path.bezierCurveTo( + innerA[0], + innerA[1] + offsety, + innerB[0], + innerB[1] + offsety, + b2[0], + b2[1] + offsety + ); + findPointOnCurve(pos2, a2, b2, innerA, innerB, 0.5); + if (linkSegment && this.linkMarkerShape === LinkMarkerShape.Arrow) { + const justPastCentre = LGraphCanvas.#lTempC; + findPointOnCurve(justPastCentre, a2, b2, innerA, innerB, 0.51); + linkSegment._centreAngle = Math.atan2( + justPastCentre[1] - pos2[1], + justPastCentre[0] - pos2[0] + ); + } + } else if (this.links_render_mode == LinkRenderType.LINEAR_LINK) { + const l2 = 15; + switch (startDir) { + case LinkDirection.LEFT: + innerA[0] += -l2; + break; + case LinkDirection.RIGHT: + innerA[0] += l2; + break; + case LinkDirection.UP: + innerA[1] += -l2; + break; + case LinkDirection.DOWN: + innerA[1] += l2; + break; + } + switch (endDir) { + case LinkDirection.LEFT: + innerB[0] += -l2; + break; + case LinkDirection.RIGHT: + innerB[0] += l2; + break; + case LinkDirection.UP: + innerB[1] += -l2; + break; + case LinkDirection.DOWN: + innerB[1] += l2; + break; + } + path.moveTo(a2[0], a2[1] + offsety); + path.lineTo(innerA[0], innerA[1] + offsety); + path.lineTo(innerB[0], innerB[1] + offsety); + path.lineTo(b2[0], b2[1] + offsety); + pos2[0] = (innerA[0] + innerB[0]) * 0.5; + pos2[1] = (innerA[1] + innerB[1]) * 0.5; + if (linkSegment && this.linkMarkerShape === LinkMarkerShape.Arrow) { + linkSegment._centreAngle = Math.atan2( + innerB[1] - innerA[1], + innerB[0] - innerA[0] + ); + } + } else if (this.links_render_mode == LinkRenderType.STRAIGHT_LINK) { + if (startDir == LinkDirection.RIGHT) { + innerA[0] += 10; + } else { + innerA[1] += 10; + } + if (endDir == LinkDirection.LEFT) { + innerB[0] -= 10; + } else { + innerB[1] -= 10; + } + const midX = (innerA[0] + innerB[0]) * 0.5; + path.moveTo(a2[0], a2[1]); + path.lineTo(innerA[0], innerA[1]); + path.lineTo(midX, innerA[1]); + path.lineTo(midX, innerB[1]); + path.lineTo(innerB[0], innerB[1]); + path.lineTo(b2[0], b2[1]); + pos2[0] = midX; + pos2[1] = (innerA[1] + innerB[1]) * 0.5; + if (linkSegment && this.linkMarkerShape === LinkMarkerShape.Arrow) { + const diff2 = innerB[1] - innerA[1]; + if (Math.abs(diff2) < 4) linkSegment._centreAngle = 0; + else if (diff2 > 0) linkSegment._centreAngle = Math.PI * 0.5; + else linkSegment._centreAngle = -(Math.PI * 0.5); + } + } else { + return; + } + } + if (this.render_connections_border && this.ds.scale > 0.6 && !skip_border) { + ctx.strokeStyle = "rgba(0,0,0,0.5)"; + ctx.stroke(path); + } + ctx.lineWidth = this.connections_width; + ctx.fillStyle = ctx.strokeStyle = linkColour; + ctx.stroke(path); + if (this.ds.scale >= 0.6 && this.highquality_render && linkSegment && // TODO: Re-assess this usage - likely a workaround that linkSegment truthy check resolves + endDir != LinkDirection.CENTER) { + if (this.render_connection_arrows) { + const posA = this.computeConnectionPoint(a2, b2, 0.25, startDir, endDir); + const posB = this.computeConnectionPoint(a2, b2, 0.26, startDir, endDir); + const posC = this.computeConnectionPoint(a2, b2, 0.75, startDir, endDir); + const posD = this.computeConnectionPoint(a2, b2, 0.76, startDir, endDir); + let angleA = 0; + let angleB = 0; + if (this.render_curved_connections) { + angleA = -Math.atan2(posB[0] - posA[0], posB[1] - posA[1]); + angleB = -Math.atan2(posD[0] - posC[0], posD[1] - posC[1]); + } else { + angleB = angleA = b2[1] > a2[1] ? 0 : Math.PI; + } + const transform2 = ctx.getTransform(); + ctx.translate(posA[0], posA[1]); + ctx.rotate(angleA); + ctx.beginPath(); + ctx.moveTo(-5, -3); + ctx.lineTo(0, 7); + ctx.lineTo(5, -3); + ctx.fill(); + ctx.setTransform(transform2); + ctx.translate(posC[0], posC[1]); + ctx.rotate(angleB); + ctx.beginPath(); + ctx.moveTo(-5, -3); + ctx.lineTo(0, 7); + ctx.lineTo(5, -3); + ctx.fill(); + ctx.setTransform(transform2); + } + ctx.beginPath(); + if (this.linkMarkerShape === LinkMarkerShape.Arrow) { + const transform2 = ctx.getTransform(); + ctx.translate(pos2[0], pos2[1]); + ctx.rotate(linkSegment._centreAngle); + ctx.moveTo(-3.2, -5); + ctx.lineTo(7, 0); + ctx.lineTo(-3.2, 5); + ctx.fill(); + ctx.setTransform(transform2); + } else if (this.linkMarkerShape == null || this.linkMarkerShape === LinkMarkerShape.Circle) { + ctx.arc(pos2[0], pos2[1], 5, 0, Math.PI * 2); + } + ctx.fill(); + } + if (flow) { + ctx.fillStyle = linkColour; + for (let i2 = 0; i2 < 5; ++i2) { + const f2 = (LiteGraph.getTime() * 1e-3 + i2 * 0.2) % 1; + const flowPos = this.computeConnectionPoint(a2, b2, f2, startDir, endDir); + ctx.beginPath(); + ctx.arc(flowPos[0], flowPos[1], 5, 0, 2 * Math.PI); + ctx.fill(); + } + } + } + /** + * Finds a point along a spline represented by a to b, with spline endpoint directions dictacted by start_dir and end_dir. + * @param a Start point + * @param b End point + * @param t Time: distance between points (e.g 0.25 is 25% along the line) + * @param start_dir Spline start direction + * @param end_dir Spline end direction + * @returns The point at {@link t} distance along the spline a-b. + */ + computeConnectionPoint(a2, b2, t2, start_dir, end_dir) { + start_dir ||= LinkDirection.RIGHT; + end_dir ||= LinkDirection.LEFT; + const dist3 = distance(a2, b2); + const pa = [a2[0], a2[1]]; + const pb = [b2[0], b2[1]]; + this.#addSplineOffset(pa, start_dir, dist3); + this.#addSplineOffset(pb, end_dir, dist3); + const c1 = (1 - t2) * (1 - t2) * (1 - t2); + const c2 = 3 * ((1 - t2) * (1 - t2)) * t2; + const c3 = 3 * (1 - t2) * (t2 * t2); + const c4 = t2 * t2 * t2; + const x2 = c1 * a2[0] + c2 * pa[0] + c3 * pb[0] + c4 * b2[0]; + const y2 = c1 * a2[1] + c2 * pa[1] + c3 * pb[1] + c4 * b2[1]; + return [x2, y2]; + } + /** + * Modifies an existing point, adding a single-axis offset. + * @param point The point to add the offset to + * @param direction The direction to add the offset in + * @param dist Distance to offset + * @param factor Distance is mulitplied by this value. Default: 0.25 + */ + #addSplineOffset(point, direction, dist3, factor = 0.25) { + switch (direction) { + case LinkDirection.LEFT: + point[0] += dist3 * -factor; + break; + case LinkDirection.RIGHT: + point[0] += dist3 * factor; + break; + case LinkDirection.UP: + point[1] += dist3 * -factor; + break; + case LinkDirection.DOWN: + point[1] += dist3 * factor; + break; + } + } + drawExecutionOrder(ctx) { + ctx.shadowColor = "transparent"; + ctx.globalAlpha = 0.25; + ctx.textAlign = "center"; + ctx.strokeStyle = "white"; + ctx.globalAlpha = 0.75; + const visible_nodes = this.visible_nodes; + for (let i2 = 0; i2 < visible_nodes.length; ++i2) { + const node22 = visible_nodes[i2]; + ctx.fillStyle = "black"; + ctx.fillRect( + node22.pos[0] - LiteGraph.NODE_TITLE_HEIGHT, + node22.pos[1] - LiteGraph.NODE_TITLE_HEIGHT, + LiteGraph.NODE_TITLE_HEIGHT, + LiteGraph.NODE_TITLE_HEIGHT + ); + if (node22.order == 0) { + ctx.strokeRect( + node22.pos[0] - LiteGraph.NODE_TITLE_HEIGHT + 0.5, + node22.pos[1] - LiteGraph.NODE_TITLE_HEIGHT + 0.5, + LiteGraph.NODE_TITLE_HEIGHT, + LiteGraph.NODE_TITLE_HEIGHT + ); + } + ctx.fillStyle = "#FFF"; + ctx.fillText( + stringOrEmpty(node22.order), + node22.pos[0] + LiteGraph.NODE_TITLE_HEIGHT * -0.5, + node22.pos[1] - 6 + ); + } + ctx.globalAlpha = 1; + } + /** + * draws the widgets stored inside a node + */ + drawNodeWidgets(node22, posY, ctx, active_widget) { + if (!node22.widgets || !node22.widgets.length) return 0; + const width2 = node22.size[0]; + const widgets = node22.widgets; + posY += 2; + const H = LiteGraph.NODE_WIDGET_HEIGHT; + const show_text = this.ds.scale > 0.5; + ctx.save(); + ctx.globalAlpha = this.editor_alpha; + const background_color = LiteGraph.WIDGET_BGCOLOR; + const text_color = LiteGraph.WIDGET_TEXT_COLOR; + const secondary_text_color = LiteGraph.WIDGET_SECONDARY_TEXT_COLOR; + const margin = 15; + for (let i2 = 0; i2 < widgets.length; ++i2) { + const w2 = widgets[i2]; + if (w2.hidden || w2.advanced && !node22.showAdvanced) continue; + const y2 = w2.y || posY; + const outline_color = w2.advanced ? LiteGraph.WIDGET_ADVANCED_OUTLINE_COLOR : LiteGraph.WIDGET_OUTLINE_COLOR; + if (w2 === this.link_over_widget) { + ctx.fillStyle = this.default_connection_color_byType[this.link_over_widget_type] || this.default_connection_color.input_on; + drawSlot(ctx, {}, [10, y2 + 10], {}); + } + w2.last_y = y2; + ctx.strokeStyle = outline_color; + ctx.fillStyle = "#222"; + ctx.textAlign = "left"; + if (w2.disabled) ctx.globalAlpha *= 0.5; + const widget_width = w2.width || width2; + switch (w2.type) { + case "button": + ctx.fillStyle = background_color; + if (w2.clicked) { + ctx.fillStyle = "#AAA"; + w2.clicked = false; + this.dirty_canvas = true; + } + ctx.fillRect(margin, y2, widget_width - margin * 2, H); + if (show_text && !w2.disabled) + ctx.strokeRect(margin, y2, widget_width - margin * 2, H); + if (show_text) { + ctx.textAlign = "center"; + ctx.fillStyle = text_color; + ctx.fillText(w2.label || w2.name, widget_width * 0.5, y2 + H * 0.7); + } + break; + case "toggle": + ctx.textAlign = "left"; + ctx.strokeStyle = outline_color; + ctx.fillStyle = background_color; + ctx.beginPath(); + if (show_text) + ctx.roundRect(margin, y2, widget_width - margin * 2, H, [H * 0.5]); + else ctx.rect(margin, y2, widget_width - margin * 2, H); + ctx.fill(); + if (show_text && !w2.disabled) ctx.stroke(); + ctx.fillStyle = w2.value ? "#89A" : "#333"; + ctx.beginPath(); + ctx.arc( + widget_width - margin * 2, + y2 + H * 0.5, + H * 0.36, + 0, + Math.PI * 2 + ); + ctx.fill(); + if (show_text) { + ctx.fillStyle = secondary_text_color; + const label5 = w2.label || w2.name; + if (label5 != null) { + ctx.fillText(label5, margin * 2, y2 + H * 0.7); + } + ctx.fillStyle = w2.value ? text_color : secondary_text_color; + ctx.textAlign = "right"; + ctx.fillText( + w2.value ? w2.options.on || "true" : w2.options.off || "false", + widget_width - 40, + y2 + H * 0.7 + ); + } + break; + case "slider": { + ctx.fillStyle = background_color; + ctx.fillRect(margin, y2, widget_width - margin * 2, H); + const range2 = w2.options.max - w2.options.min; + let nvalue = (w2.value - w2.options.min) / range2; + if (nvalue < 0) nvalue = 0; + if (nvalue > 1) nvalue = 1; + ctx.fillStyle = w2.options.hasOwnProperty("slider_color") ? w2.options.slider_color : active_widget == w2 ? "#89A" : "#678"; + ctx.fillRect(margin, y2, nvalue * (widget_width - margin * 2), H); + if (show_text && !w2.disabled) + ctx.strokeRect(margin, y2, widget_width - margin * 2, H); + if (w2.marker) { + let marker_nvalue = (w2.marker - w2.options.min) / range2; + if (marker_nvalue < 0) marker_nvalue = 0; + if (marker_nvalue > 1) marker_nvalue = 1; + ctx.fillStyle = w2.options.hasOwnProperty("marker_color") ? w2.options.marker_color : "#AA9"; + ctx.fillRect( + margin + marker_nvalue * (widget_width - margin * 2), + y2, + 2, + H + ); + } + if (show_text) { + ctx.textAlign = "center"; + ctx.fillStyle = text_color; + ctx.fillText( + (w2.label || w2.name) + " " + Number(w2.value).toFixed( + w2.options.precision != null ? w2.options.precision : 3 + ), + widget_width * 0.5, + y2 + H * 0.7 + ); + } + break; + } + case "number": + case "combo": + ctx.textAlign = "left"; + ctx.strokeStyle = outline_color; + ctx.fillStyle = background_color; + ctx.beginPath(); + if (show_text) + ctx.roundRect(margin, y2, widget_width - margin * 2, H, [H * 0.5]); + else ctx.rect(margin, y2, widget_width - margin * 2, H); + ctx.fill(); + if (show_text) { + if (!w2.disabled) ctx.stroke(); + ctx.fillStyle = text_color; + if (!w2.disabled) { + ctx.beginPath(); + ctx.moveTo(margin + 16, y2 + 5); + ctx.lineTo(margin + 6, y2 + H * 0.5); + ctx.lineTo(margin + 16, y2 + H - 5); + ctx.fill(); + ctx.beginPath(); + ctx.moveTo(widget_width - margin - 16, y2 + 5); + ctx.lineTo(widget_width - margin - 6, y2 + H * 0.5); + ctx.lineTo(widget_width - margin - 16, y2 + H - 5); + ctx.fill(); + } + ctx.fillStyle = secondary_text_color; + ctx.fillText(w2.label || w2.name, margin * 2 + 5, y2 + H * 0.7); + ctx.fillStyle = text_color; + ctx.textAlign = "right"; + if (w2.type == "number") { + ctx.fillText( + Number(w2.value).toFixed( + w2.options.precision !== void 0 ? w2.options.precision : 3 + ), + widget_width - margin * 2 - 20, + y2 + H * 0.7 + ); + } else { + let v2 = typeof w2.value === "number" ? String(w2.value) : w2.value; + if (w2.options.values) { + let values = w2.options.values; + if (typeof values === "function") + values = values(); + if (values && !Array.isArray(values)) + v2 = values[w2.value]; + } + const labelWidth = ctx.measureText(w2.label || w2.name).width + margin * 2; + const inputWidth = widget_width - margin * 4; + const availableWidth = inputWidth - labelWidth; + const textWidth = ctx.measureText(v2).width; + if (textWidth > availableWidth) { + const ELLIPSIS = "…"; + const ellipsisWidth = ctx.measureText(ELLIPSIS).width; + const charWidthAvg = ctx.measureText("a").width; + if (availableWidth <= ellipsisWidth) { + v2 = "․"; + } else { + v2 = `${v2}`; + const overflowWidth = textWidth + ellipsisWidth - availableWidth; + if (overflowWidth + charWidthAvg * 3 > availableWidth) { + const preciseRange = availableWidth + charWidthAvg * 3; + const preTruncateCt = Math.floor((preciseRange - ellipsisWidth) / charWidthAvg); + v2 = v2.substr(0, preTruncateCt); + } + while (ctx.measureText(v2).width + ellipsisWidth > availableWidth) { + v2 = v2.substr(0, v2.length - 1); + } + v2 += ELLIPSIS; + } + } + ctx.fillText( + v2, + widget_width - margin * 2 - 20, + y2 + H * 0.7 + ); + } + } + break; + case "string": + case "text": + ctx.textAlign = "left"; + ctx.strokeStyle = outline_color; + ctx.fillStyle = background_color; + ctx.beginPath(); + if (show_text) + ctx.roundRect(margin, y2, widget_width - margin * 2, H, [H * 0.5]); + else + ctx.rect(margin, y2, widget_width - margin * 2, H); + ctx.fill(); + if (show_text) { + if (!w2.disabled) ctx.stroke(); + ctx.save(); + ctx.beginPath(); + ctx.rect(margin, y2, widget_width - margin * 2, H); + ctx.clip(); + ctx.fillStyle = secondary_text_color; + const label5 = w2.label || w2.name; + if (label5 != null) ctx.fillText(label5, margin * 2, y2 + H * 0.7); + ctx.fillStyle = text_color; + ctx.textAlign = "right"; + ctx.fillText( + String(w2.value).substr(0, 30), + widget_width - margin * 2, + y2 + H * 0.7 + ); + ctx.restore(); + } + break; + default: + w2.draw?.(ctx, node22, widget_width, y2, H); + break; + } + posY += (w2.computeSize ? w2.computeSize(widget_width)[1] : H) + 4; + ctx.globalAlpha = this.editor_alpha; + } + ctx.restore(); + ctx.textAlign = "left"; + } + /** + * draws every group area in the background + */ + drawGroups(canvas, ctx) { + if (!this.graph) return; + const groups = this.graph._groups; + ctx.save(); + ctx.globalAlpha = 0.5 * this.editor_alpha; + const drawSnapGuides = this.#snapToGrid && this.isDragging; + for (let i2 = 0; i2 < groups.length; ++i2) { + const group = groups[i2]; + if (!overlapBounding(this.visible_area, group._bounding)) { + continue; + } + if (drawSnapGuides && this.selectedItems.has(group)) + this.drawSnapGuide(ctx, group); + group.draw(this, ctx); + } + ctx.restore(); + } + adjustNodesSize() { + const nodes = this.graph._nodes; + for (let i2 = 0; i2 < nodes.length; ++i2) { + nodes[i2].size = nodes[i2].computeSize(); + } + this.setDirty(true, true); + } + /** + * resizes the canvas to a given size, if no size is passed, then it tries to fill the parentNode + * @todo Remove or rewrite + */ + resize(width2, height) { + if (!width2 && !height) { + const parent = this.canvas.parentElement; + width2 = parent.offsetWidth; + height = parent.offsetHeight; + } + if (this.canvas.width == width2 && this.canvas.height == height) return; + this.canvas.width = width2; + this.canvas.height = height; + this.bgcanvas.width = this.canvas.width; + this.bgcanvas.height = this.canvas.height; + this.setDirty(true, true); + } + onNodeSelectionChange() { + } + /** + * Determines the furthest nodes in each direction for the currently selected nodes + */ + boundaryNodesForSelection() { + return LGraphCanvas.getBoundaryNodes(this.selected_nodes); + } + showLinkMenu(segment, e2) { + const { graph } = this; + const node_left = graph.getNodeById(segment.origin_id); + const fromType = node_left?.outputs?.[segment.origin_slot]?.type ?? "*"; + const options4 = ["Add Node", null, "Delete", null]; + if (this.reroutesEnabled) options4.splice(1, 0, "Add Reroute"); + const title = "data" in segment && segment.data != null ? segment.data.constructor.name : null; + const menu2 = new LiteGraph.ContextMenu(options4, { + event: e2, + title, + callback: inner_clicked.bind(this) + }); + function inner_clicked(v2, options22, e3) { + switch (v2) { + case "Add Node": + LGraphCanvas.onMenuAdd(null, null, e3, menu2, function(node22) { + if (!node22.inputs?.length || !node22.outputs?.length) return; + const options32 = this.reroutesEnabled ? { afterRerouteId: segment.parentId } : void 0; + if (node_left.connectByType(segment.origin_slot, node22, fromType, options32)) { + node22.pos[0] -= node22.size[0] * 0.5; + } + }); + break; + case "Add Reroute": { + this.adjustMouseEvent(e3); + graph.createReroute([e3.canvasX, e3.canvasY], segment); + this.setDirty(false, true); + break; + } + case "Delete": + graph.removeLink(segment.id); + break; + } + } + __name(inner_clicked, "inner_clicked"); + return false; + } + createDefaultNodeForSlot(optPass) { + const opts = Object.assign({ + nodeFrom: null, + slotFrom: null, + nodeTo: null, + slotTo: null, + position: [0, 0], + nodeType: null, + posAdd: [0, 0], + posSizeFix: [0, 0] + }, optPass || {}); + const { afterRerouteId } = opts; + const isFrom = opts.nodeFrom && opts.slotFrom !== null; + const isTo = !isFrom && opts.nodeTo && opts.slotTo !== null; + if (!isFrom && !isTo) { + console.warn("No data passed to createDefaultNodeForSlot " + opts.nodeFrom + " " + opts.slotFrom + " " + opts.nodeTo + " " + opts.slotTo); + return false; + } + if (!opts.nodeType) { + console.warn("No type to createDefaultNodeForSlot"); + return false; + } + const nodeX = isFrom ? opts.nodeFrom : opts.nodeTo; + let slotX = isFrom ? opts.slotFrom : opts.slotTo; + let iSlotConn = false; + switch (typeof slotX) { + case "string": + iSlotConn = isFrom ? nodeX.findOutputSlot(slotX, false) : nodeX.findInputSlot(slotX, false); + slotX = isFrom ? nodeX.outputs[slotX] : nodeX.inputs[slotX]; + break; + case "object": + iSlotConn = isFrom ? nodeX.findOutputSlot(slotX.name) : nodeX.findInputSlot(slotX.name); + break; + case "number": + iSlotConn = slotX; + slotX = isFrom ? nodeX.outputs[slotX] : nodeX.inputs[slotX]; + break; + case "undefined": + default: + console.warn("Cant get slot information " + slotX); + return false; + } + const fromSlotType = slotX.type == LiteGraph.EVENT ? "_event_" : slotX.type; + const slotTypesDefault = isFrom ? LiteGraph.slot_types_default_out : LiteGraph.slot_types_default_in; + if (slotTypesDefault?.[fromSlotType]) { + let nodeNewType = false; + if (typeof slotTypesDefault[fromSlotType] == "object") { + for (const typeX in slotTypesDefault[fromSlotType]) { + if (opts.nodeType == slotTypesDefault[fromSlotType][typeX] || opts.nodeType == "AUTO") { + nodeNewType = slotTypesDefault[fromSlotType][typeX]; + break; + } + } + } else if (opts.nodeType == slotTypesDefault[fromSlotType] || opts.nodeType == "AUTO") { + nodeNewType = slotTypesDefault[fromSlotType]; + } + if (nodeNewType) { + let nodeNewOpts = false; + if (typeof nodeNewType == "object" && nodeNewType.node) { + nodeNewOpts = nodeNewType; + nodeNewType = nodeNewType.node; + } + const newNode = LiteGraph.createNode(nodeNewType); + if (newNode) { + if (nodeNewOpts) { + if (nodeNewOpts.properties) { + for (const i2 in nodeNewOpts.properties) { + newNode.addProperty(i2, nodeNewOpts.properties[i2]); + } + } + if (nodeNewOpts.inputs) { + newNode.inputs = []; + for (const i2 in nodeNewOpts.inputs) { + newNode.addOutput( + nodeNewOpts.inputs[i2][0], + nodeNewOpts.inputs[i2][1] + ); + } + } + if (nodeNewOpts.outputs) { + newNode.outputs = []; + for (const i2 in nodeNewOpts.outputs) { + newNode.addOutput( + nodeNewOpts.outputs[i2][0], + nodeNewOpts.outputs[i2][1] + ); + } + } + if (nodeNewOpts.title) { + newNode.title = nodeNewOpts.title; + } + if (nodeNewOpts.json) { + newNode.configure(nodeNewOpts.json); + } + } + this.graph.add(newNode); + newNode.pos = [ + opts.position[0] + opts.posAdd[0] + (opts.posSizeFix[0] ? opts.posSizeFix[0] * newNode.size[0] : 0), + opts.position[1] + opts.posAdd[1] + (opts.posSizeFix[1] ? opts.posSizeFix[1] * newNode.size[1] : 0) + ]; + if (isFrom) { + opts.nodeFrom.connectByType(iSlotConn, newNode, fromSlotType, { afterRerouteId }); + } else { + opts.nodeTo.connectByTypeOutput(iSlotConn, newNode, fromSlotType, { afterRerouteId }); + } + return true; + } + console.log("failed creating " + nodeNewType); + } + } + return false; + } + showConnectionMenu(optPass) { + const opts = Object.assign({ + nodeFrom: null, + slotFrom: null, + nodeTo: null, + slotTo: null, + e: null, + allow_searchbox: this.allow_searchbox, + showSearchBox: this.showSearchBox + }, optPass || {}); + const that = this; + const { afterRerouteId } = opts; + const isFrom = opts.nodeFrom && opts.slotFrom; + const isTo = !isFrom && opts.nodeTo && opts.slotTo; + if (!isFrom && !isTo) { + console.warn("No data passed to showConnectionMenu"); + return; + } + const nodeX = isFrom ? opts.nodeFrom : opts.nodeTo; + let slotX = isFrom ? opts.slotFrom : opts.slotTo; + let iSlotConn; + switch (typeof slotX) { + case "string": + iSlotConn = isFrom ? nodeX.findOutputSlot(slotX, false) : nodeX.findInputSlot(slotX, false); + slotX = isFrom ? nodeX.outputs[slotX] : nodeX.inputs[slotX]; + break; + case "object": + iSlotConn = isFrom ? nodeX.findOutputSlot(slotX.name) : nodeX.findInputSlot(slotX.name); + break; + case "number": + iSlotConn = slotX; + slotX = isFrom ? nodeX.outputs[slotX] : nodeX.inputs[slotX]; + break; + default: + console.warn("Cant get slot information " + slotX); + return; + } + const options4 = ["Add Node", null]; + if (opts.allow_searchbox) { + options4.push("Search"); + options4.push(null); + } + const fromSlotType = slotX.type == LiteGraph.EVENT ? "_event_" : slotX.type; + const slotTypesDefault = isFrom ? LiteGraph.slot_types_default_out : LiteGraph.slot_types_default_in; + if (slotTypesDefault?.[fromSlotType]) { + if (typeof slotTypesDefault[fromSlotType] == "object") { + for (const typeX in slotTypesDefault[fromSlotType]) { + options4.push(slotTypesDefault[fromSlotType][typeX]); + } + } else { + options4.push(slotTypesDefault[fromSlotType]); + } + } + const menu2 = new LiteGraph.ContextMenu(options4, { + event: opts.e, + title: (slotX && slotX.name != "" ? slotX.name + (fromSlotType ? " | " : "") : "") + (slotX && fromSlotType ? fromSlotType : ""), + callback: inner_clicked + }); + function inner_clicked(v2, options22, e2) { + switch (v2) { + case "Add Node": + LGraphCanvas.onMenuAdd(null, null, e2, menu2, function(node22) { + if (isFrom) { + opts.nodeFrom.connectByType(iSlotConn, node22, fromSlotType, { afterRerouteId }); + } else { + opts.nodeTo.connectByTypeOutput(iSlotConn, node22, fromSlotType, { afterRerouteId }); + } + }); + break; + case "Search": + if (isFrom) { + opts.showSearchBox(e2, { node_from: opts.nodeFrom, slot_from: slotX, type_filter_in: fromSlotType }); + } else { + opts.showSearchBox(e2, { node_to: opts.nodeTo, slot_from: slotX, type_filter_out: fromSlotType }); + } + break; + default: { + that.createDefaultNodeForSlot(Object.assign(opts, { + position: [opts.e.canvasX, opts.e.canvasY], + nodeType: v2, + afterRerouteId + })); + break; + } + } + } + __name(inner_clicked, "inner_clicked"); + } + // refactor: there are different dialogs, some uses createDialog some dont + prompt(title, value4, callback, event, multiline) { + const that = this; + title = title || ""; + const dialog = document.createElement("div"); + dialog.is_modified = false; + dialog.className = "graphdialog rounded"; + dialog.innerHTML = multiline ? "<span class='name'></span> <textarea autofocus class='value'></textarea><button class='rounded'>OK</button>" : "<span class='name'></span> <input autofocus type='text' class='value'/><button class='rounded'>OK</button>"; + dialog.close = function() { + that.prompt_box = null; + if (dialog.parentNode) { + dialog.parentNode.removeChild(dialog); + } + }; + const graphcanvas = LGraphCanvas.active_canvas; + const canvas = graphcanvas.canvas; + canvas.parentNode.appendChild(dialog); + if (this.ds.scale > 1) dialog.style.transform = "scale(" + this.ds.scale + ")"; + let dialogCloseTimer = null; + let prevent_timeout = 0; + LiteGraph.pointerListenerAdd(dialog, "leave", function() { + if (prevent_timeout) return; + if (LiteGraph.dialog_close_on_mouse_leave) { + if (!dialog.is_modified && LiteGraph.dialog_close_on_mouse_leave) + dialogCloseTimer = setTimeout( + dialog.close, + LiteGraph.dialog_close_on_mouse_leave_delay + ); + } + }); + LiteGraph.pointerListenerAdd(dialog, "enter", function() { + if (LiteGraph.dialog_close_on_mouse_leave && dialogCloseTimer) + clearTimeout(dialogCloseTimer); + }); + const selInDia = dialog.querySelectorAll("select"); + if (selInDia) { + for (const selIn of selInDia) { + selIn.addEventListener("click", function() { + prevent_timeout++; + }); + selIn.addEventListener("blur", function() { + prevent_timeout = 0; + }); + selIn.addEventListener("change", function() { + prevent_timeout = -1; + }); + } + } + this.prompt_box?.close(); + this.prompt_box = dialog; + const name_element = dialog.querySelector(".name"); + name_element.innerText = title; + const value_element = dialog.querySelector(".value"); + value_element.value = value4; + value_element.select(); + const input = value_element; + input.addEventListener("keydown", function(e2) { + dialog.is_modified = true; + if (e2.keyCode == 27) { + dialog.close(); + } else if (e2.keyCode == 13 && e2.target.localName != "textarea") { + if (callback) { + callback(this.value); + } + dialog.close(); + } else { + return; + } + e2.preventDefault(); + e2.stopPropagation(); + }); + const button = dialog.querySelector("button"); + button.addEventListener("click", function() { + callback?.(input.value); + that.setDirty(true); + dialog.close(); + }); + const rect = canvas.getBoundingClientRect(); + let offsetx = -20; + let offsety = -20; + if (rect) { + offsetx -= rect.left; + offsety -= rect.top; + } + if (event) { + dialog.style.left = event.clientX + offsetx + "px"; + dialog.style.top = event.clientY + offsety + "px"; + } else { + dialog.style.left = canvas.width * 0.5 + offsetx + "px"; + dialog.style.top = canvas.height * 0.5 + offsety + "px"; + } + setTimeout(function() { + input.focus(); + const clickTime = Date.now(); + function handleOutsideClick(e2) { + if (e2.target === canvas && Date.now() - clickTime > 256) { + dialog.close(); + canvas.parentNode.removeEventListener("click", handleOutsideClick); + canvas.parentNode.removeEventListener("touchend", handleOutsideClick); + } + } + __name(handleOutsideClick, "handleOutsideClick"); + canvas.parentNode.addEventListener("click", handleOutsideClick); + canvas.parentNode.addEventListener("touchend", handleOutsideClick); + }, 10); + return dialog; + } + showSearchBox(event, options4) { + const def_options = { + slot_from: null, + node_from: null, + node_to: null, + do_type_filter: LiteGraph.search_filter_enabled, + // TODO check for registered_slot_[in/out]_types not empty // this will be checked for functionality enabled : filter on slot type, in and out + // @ts-expect-error + type_filter_in: false, + // these are default: pass to set initially set values + type_filter_out: false, + show_general_if_none_on_typefilter: true, + show_general_after_typefiltered: true, + hide_on_mouse_leave: LiteGraph.search_hide_on_mouse_leave, + show_all_if_empty: true, + show_all_on_open: LiteGraph.search_show_all_on_open + }; + options4 = Object.assign(def_options, options4 || {}); + const that = this; + const graphcanvas = LGraphCanvas.active_canvas; + const canvas = graphcanvas.canvas; + const root_document = canvas.ownerDocument || document; + const dialog = document.createElement("div"); + dialog.className = "litegraph litesearchbox graphdialog rounded"; + dialog.innerHTML = "<span class='name'>Search</span> <input autofocus type='text' class='value rounded'/>"; + if (options4.do_type_filter) { + dialog.innerHTML += "<select class='slot_in_type_filter'><option value=''></option></select>"; + dialog.innerHTML += "<select class='slot_out_type_filter'><option value=''></option></select>"; + } + dialog.innerHTML += "<div class='helper'></div>"; + if (root_document.fullscreenElement) + root_document.fullscreenElement.appendChild(dialog); + else { + root_document.body.appendChild(dialog); + root_document.body.style.overflow = "hidden"; + } + let selIn; + let selOut; + if (options4.do_type_filter) { + selIn = dialog.querySelector(".slot_in_type_filter"); + selOut = dialog.querySelector(".slot_out_type_filter"); + } + dialog.close = function() { + that.search_box = null; + this.blur(); + canvas.focus(); + root_document.body.style.overflow = ""; + setTimeout(function() { + that.canvas.focus(); + }, 20); + dialog.parentNode?.removeChild(dialog); + }; + if (this.ds.scale > 1) { + dialog.style.transform = "scale(" + this.ds.scale + ")"; + } + if (options4.hide_on_mouse_leave) { + let prevent_timeout = false; + let timeout_close = null; + LiteGraph.pointerListenerAdd(dialog, "enter", function() { + if (timeout_close) { + clearTimeout(timeout_close); + timeout_close = null; + } + }); + LiteGraph.pointerListenerAdd(dialog, "leave", function() { + if (prevent_timeout) + return; + timeout_close = setTimeout(function() { + dialog.close(); + }, typeof options4.hide_on_mouse_leave === "number" ? options4.hide_on_mouse_leave : 500); + }); + if (options4.do_type_filter) { + selIn.addEventListener("click", function() { + prevent_timeout++; + }); + selIn.addEventListener("blur", function() { + prevent_timeout = 0; + }); + selIn.addEventListener("change", function() { + prevent_timeout = -1; + }); + selOut.addEventListener("click", function() { + prevent_timeout++; + }); + selOut.addEventListener("blur", function() { + prevent_timeout = 0; + }); + selOut.addEventListener("change", function() { + prevent_timeout = -1; + }); + } + } + that.search_box?.close(); + that.search_box = dialog; + const helper = dialog.querySelector(".helper"); + let first2 = null; + let timeout = null; + let selected2 = null; + const input = dialog.querySelector("input"); + if (input) { + input.addEventListener("blur", function() { + this.focus(); + }); + input.addEventListener("keydown", function(e2) { + if (e2.keyCode == 38) { + changeSelection(false); + } else if (e2.keyCode == 40) { + changeSelection(true); + } else if (e2.keyCode == 27) { + dialog.close(); + } else if (e2.keyCode == 13) { + if (selected2) { + select(unescape(selected2.dataset["type"])); + } else if (first2) { + select(first2); + } else { + dialog.close(); + } + } else { + if (timeout) { + clearInterval(timeout); + } + timeout = setTimeout(refreshHelper, 10); + return; + } + e2.preventDefault(); + e2.stopPropagation(); + e2.stopImmediatePropagation(); + return true; + }); + } + if (options4.do_type_filter) { + if (selIn) { + const aSlots = LiteGraph.slot_types_in; + const nSlots = aSlots.length; + if (options4.type_filter_in == LiteGraph.EVENT || options4.type_filter_in == LiteGraph.ACTION) + options4.type_filter_in = "_event_"; + for (let iK = 0; iK < nSlots; iK++) { + const opt = document.createElement("option"); + opt.value = aSlots[iK]; + opt.innerHTML = aSlots[iK]; + selIn.appendChild(opt); + if ( + // @ts-expect-error + options4.type_filter_in !== false && (options4.type_filter_in + "").toLowerCase() == (aSlots[iK] + "").toLowerCase() + ) { + opt.selected = true; + } + } + selIn.addEventListener("change", function() { + refreshHelper(); + }); + } + if (selOut) { + const aSlots = LiteGraph.slot_types_out; + const nSlots = aSlots.length; + if (options4.type_filter_out == LiteGraph.EVENT || options4.type_filter_out == LiteGraph.ACTION) + options4.type_filter_out = "_event_"; + for (let iK = 0; iK < nSlots; iK++) { + const opt = document.createElement("option"); + opt.value = aSlots[iK]; + opt.innerHTML = aSlots[iK]; + selOut.appendChild(opt); + if (options4.type_filter_out !== false && (options4.type_filter_out + "").toLowerCase() == (aSlots[iK] + "").toLowerCase()) + opt.selected = true; + } + selOut.addEventListener("change", function() { + refreshHelper(); + }); + } + } + const rect = canvas.getBoundingClientRect(); + const left = (event ? event.clientX : rect.left + rect.width * 0.5) - 80; + const top = (event ? event.clientY : rect.top + rect.height * 0.5) - 20; + dialog.style.left = left + "px"; + dialog.style.top = top + "px"; + if (event.layerY > rect.height - 200) + helper.style.maxHeight = rect.height - event.layerY - 20 + "px"; + requestAnimationFrame(function() { + input.focus(); + }); + if (options4.show_all_on_open) refreshHelper(); + function select(name2) { + if (name2) { + if (that.onSearchBoxSelection) { + that.onSearchBoxSelection(name2, event, graphcanvas); + } else { + const extra = LiteGraph.searchbox_extras[name2.toLowerCase()]; + if (extra) name2 = extra.type; + graphcanvas.graph.beforeChange(); + const node22 = LiteGraph.createNode(name2); + if (node22) { + node22.pos = graphcanvas.convertEventToCanvasOffset(event); + graphcanvas.graph.add(node22, false); + } + if (extra?.data) { + if (extra.data.properties) { + for (const i2 in extra.data.properties) { + node22.addProperty(i2, extra.data.properties[i2]); + } + } + if (extra.data.inputs) { + node22.inputs = []; + for (const i2 in extra.data.inputs) { + node22.addOutput( + extra.data.inputs[i2][0], + extra.data.inputs[i2][1] + ); + } + } + if (extra.data.outputs) { + node22.outputs = []; + for (const i2 in extra.data.outputs) { + node22.addOutput( + extra.data.outputs[i2][0], + extra.data.outputs[i2][1] + ); + } + } + if (extra.data.title) { + node22.title = extra.data.title; + } + if (extra.data.json) { + node22.configure(extra.data.json); + } + } + if (options4.node_from) { + let iS = false; + switch (typeof options4.slot_from) { + case "string": + iS = options4.node_from.findOutputSlot(options4.slot_from); + break; + case "object": + iS = options4.slot_from.name ? options4.node_from.findOutputSlot(options4.slot_from.name) : -1; + if (iS == -1 && typeof options4.slot_from.slot_index !== "undefined") iS = options4.slot_from.slot_index; + break; + case "number": + iS = options4.slot_from; + break; + default: + iS = 0; + } + if (typeof options4.node_from.outputs[iS] !== "undefined") { + if (iS !== false && iS > -1) { + options4.node_from.connectByType(iS, node22, options4.node_from.outputs[iS].type); + } + } + } + if (options4.node_to) { + let iS = false; + switch (typeof options4.slot_from) { + case "string": + iS = options4.node_to.findInputSlot(options4.slot_from); + break; + case "object": + iS = options4.slot_from.name ? options4.node_to.findInputSlot(options4.slot_from.name) : -1; + if (iS == -1 && typeof options4.slot_from.slot_index !== "undefined") iS = options4.slot_from.slot_index; + break; + case "number": + iS = options4.slot_from; + break; + default: + iS = 0; + } + if (typeof options4.node_to.inputs[iS] !== "undefined") { + if (iS !== false && iS > -1) { + options4.node_to.connectByTypeOutput(iS, node22, options4.node_to.inputs[iS].type); + } + } + } + graphcanvas.graph.afterChange(); + } + } + dialog.close(); + } + __name(select, "select"); + function changeSelection(forward) { + const prev2 = selected2; + if (!selected2) { + selected2 = forward ? helper.childNodes[0] : helper.childNodes[helper.childNodes.length]; + } else { + selected2.classList.remove("selected"); + selected2 = forward ? selected2.nextSibling : selected2.previousSibling; + selected2 ||= prev2; + } + if (!selected2) return; + selected2.classList.add("selected"); + selected2.scrollIntoView({ block: "end", behavior: "smooth" }); + } + __name(changeSelection, "changeSelection"); + function refreshHelper() { + timeout = null; + let str = input.value; + first2 = null; + helper.innerHTML = ""; + if (!str && !options4.show_all_if_empty) return; + if (that.onSearchBox) { + const list2 = that.onSearchBox(helper, str, graphcanvas); + if (list2) { + for (let i2 = 0; i2 < list2.length; ++i2) { + addResult(list2[i2]); + } + } + } else { + let inner_test_filter = /* @__PURE__ */ __name(function(type, optsIn) { + optsIn = optsIn || {}; + const optsDef = { + skipFilter: false, + inTypeOverride: false, + outTypeOverride: false + }; + const opts = Object.assign(optsDef, optsIn); + const ctor = LiteGraph.registered_node_types[type]; + if (filter4 && ctor.filter != filter4) return false; + if ((!options4.show_all_if_empty || str) && type.toLowerCase().indexOf(str) === -1 && (!ctor.title || ctor.title.toLowerCase().indexOf(str) === -1)) + return false; + if (options4.do_type_filter && !opts.skipFilter) { + const sType = type; + let sV = opts.inTypeOverride !== false ? opts.inTypeOverride : sIn.value; + if (sIn && sV && LiteGraph.registered_slot_in_types[sV]?.nodes) { + const doesInc = LiteGraph.registered_slot_in_types[sV].nodes.includes(sType); + if (doesInc === false) return false; + } + sV = sOut.value; + if (opts.outTypeOverride !== false) sV = opts.outTypeOverride; + if (sOut && sV && LiteGraph.registered_slot_out_types[sV]?.nodes) { + const doesInc = LiteGraph.registered_slot_out_types[sV].nodes.includes(sType); + if (doesInc === false) return false; + } + } + return true; + }, "inner_test_filter"); + let c2 = 0; + str = str.toLowerCase(); + const filter4 = graphcanvas.filter || graphcanvas.graph.filter; + let sIn = false; + let sOut = false; + if (options4.do_type_filter && that.search_box) { + sIn = that.search_box.querySelector(".slot_in_type_filter"); + sOut = that.search_box.querySelector(".slot_out_type_filter"); + } + for (const i2 in LiteGraph.searchbox_extras) { + const extra = LiteGraph.searchbox_extras[i2]; + if ((!options4.show_all_if_empty || str) && extra.desc.toLowerCase().indexOf(str) === -1) + continue; + const ctor = LiteGraph.registered_node_types[extra.type]; + if (ctor && ctor.filter != filter4) continue; + if (!inner_test_filter(extra.type)) continue; + addResult(extra.desc, "searchbox_extra"); + if (LGraphCanvas.search_limit !== -1 && c2++ > LGraphCanvas.search_limit) { + break; + } + } + let filtered = null; + if (Array.prototype.filter) { + const keys2 = Object.keys(LiteGraph.registered_node_types); + filtered = keys2.filter(inner_test_filter); + } else { + filtered = []; + for (const i2 in LiteGraph.registered_node_types) { + if (inner_test_filter(i2)) filtered.push(i2); + } + } + for (let i2 = 0; i2 < filtered.length; i2++) { + addResult(filtered[i2]); + if (LGraphCanvas.search_limit !== -1 && c2++ > LGraphCanvas.search_limit) + break; + } + if (options4.show_general_after_typefiltered && (sIn.value || sOut.value)) { + filtered_extra = []; + for (const i2 in LiteGraph.registered_node_types) { + if (inner_test_filter(i2, { + inTypeOverride: sIn && sIn.value ? "*" : false, + outTypeOverride: sOut && sOut.value ? "*" : false + })) + filtered_extra.push(i2); + } + for (let i2 = 0; i2 < filtered_extra.length; i2++) { + addResult(filtered_extra[i2], "generic_type"); + if (LGraphCanvas.search_limit !== -1 && c2++ > LGraphCanvas.search_limit) + break; + } + } + if ((sIn.value || sOut.value) && helper.childNodes.length == 0 && options4.show_general_if_none_on_typefilter) { + filtered_extra = []; + for (const i2 in LiteGraph.registered_node_types) { + if (inner_test_filter(i2, { skipFilter: true })) + filtered_extra.push(i2); + } + for (let i2 = 0; i2 < filtered_extra.length; i2++) { + addResult(filtered_extra[i2], "not_in_filter"); + if (LGraphCanvas.search_limit !== -1 && c2++ > LGraphCanvas.search_limit) + break; + } + } + } + function addResult(type, className) { + const help = document.createElement("div"); + first2 ||= type; + const nodeType = LiteGraph.registered_node_types[type]; + if (nodeType?.title) { + help.innerText = nodeType?.title; + const typeEl = document.createElement("span"); + typeEl.className = "litegraph lite-search-item-type"; + typeEl.textContent = type; + help.append(typeEl); + } else { + help.innerText = type; + } + help.dataset["type"] = escape(type); + help.className = "litegraph lite-search-item"; + if (className) { + help.className += " " + className; + } + help.addEventListener("click", function() { + select(unescape(this.dataset["type"])); + }); + helper.appendChild(help); + } + __name(addResult, "addResult"); + } + __name(refreshHelper, "refreshHelper"); + return dialog; + } + showEditPropertyValue(node22, property, options4) { + if (!node22 || node22.properties[property] === void 0) return; + options4 = options4 || {}; + const info = node22.getPropertyInfo(property); + const type = info.type; + let input_html = ""; + if (type == "string" || type == "number" || type == "array" || type == "object") { + input_html = "<input autofocus type='text' class='value'/>"; + } else if ((type == "enum" || type == "combo") && info.values) { + input_html = "<select autofocus type='text' class='value'>"; + for (const i2 in info.values) { + const v2 = Array.isArray(info.values) ? info.values[i2] : i2; + input_html += "<option value='" + v2 + "' " + (v2 == node22.properties[property] ? "selected" : "") + ">" + info.values[i2] + "</option>"; + } + input_html += "</select>"; + } else if (type == "boolean" || type == "toggle") { + input_html = "<input autofocus type='checkbox' class='value' " + (node22.properties[property] ? "checked" : "") + "/>"; + } else { + console.warn("unknown type: " + type); + return; + } + const dialog = this.createDialog( + "<span class='name'>" + (info.label || property) + "</span>" + input_html + "<button>OK</button>", + options4 + ); + let input; + if ((type == "enum" || type == "combo") && info.values) { + input = dialog.querySelector("select"); + input.addEventListener("change", function(e2) { + dialog.modified(); + setValue2(e2.target?.value); + }); + } else if (type == "boolean" || type == "toggle") { + input = dialog.querySelector("input"); + input?.addEventListener("click", function() { + dialog.modified(); + setValue2(!!input.checked); + }); + } else { + input = dialog.querySelector("input"); + if (input) { + input.addEventListener("blur", function() { + this.focus(); + }); + let v2 = node22.properties[property] !== void 0 ? node22.properties[property] : ""; + if (type !== "string") { + v2 = JSON.stringify(v2); + } + input.value = v2; + input.addEventListener("keydown", function(e2) { + if (e2.keyCode == 27) { + dialog.close(); + } else if (e2.keyCode == 13) { + inner(); + } else if (e2.keyCode != 13) { + dialog.modified(); + return; + } + e2.preventDefault(); + e2.stopPropagation(); + }); + } + } + input?.focus(); + const button = dialog.querySelector("button"); + button.addEventListener("click", inner); + function inner() { + setValue2(input.value); + } + __name(inner, "inner"); + function setValue2(value4) { + if (info?.values && typeof info.values === "object" && info.values[value4] != void 0) + value4 = info.values[value4]; + if (typeof node22.properties[property] == "number") { + value4 = Number(value4); + } + if (type == "array" || type == "object") { + value4 = JSON.parse(value4); + } + node22.properties[property] = value4; + if (node22.graph) { + node22.graph._version++; + } + node22.onPropertyChanged?.(property, value4); + options4.onclose?.(); + dialog.close(); + this.setDirty(true, true); + } + __name(setValue2, "setValue"); + return dialog; + } + // TODO refactor, theer are different dialog, some uses createDialog, some dont + createDialog(html, options4) { + const def_options = { + checkForInput: false, + closeOnLeave: true, + closeOnLeave_checkModified: true + }; + options4 = Object.assign(def_options, options4 || {}); + const dialog = document.createElement("div"); + dialog.className = "graphdialog"; + dialog.innerHTML = html; + dialog.is_modified = false; + const rect = this.canvas.getBoundingClientRect(); + let offsetx = -20; + let offsety = -20; + if (rect) { + offsetx -= rect.left; + offsety -= rect.top; + } + if (options4.position) { + offsetx += options4.position[0]; + offsety += options4.position[1]; + } else if (options4.event) { + offsetx += options4.event.clientX; + offsety += options4.event.clientY; + } else { + offsetx += this.canvas.width * 0.5; + offsety += this.canvas.height * 0.5; + } + dialog.style.left = offsetx + "px"; + dialog.style.top = offsety + "px"; + this.canvas.parentNode.appendChild(dialog); + if (options4.checkForInput) { + const aI = dialog.querySelectorAll("input"); + aI?.forEach(function(iX) { + iX.addEventListener("keydown", function(e2) { + dialog.modified(); + if (e2.keyCode == 27) { + dialog.close(); + } else if (e2.keyCode != 13) { + return; + } + e2.preventDefault(); + e2.stopPropagation(); + }); + iX.focus(); + }); + } + dialog.modified = function() { + dialog.is_modified = true; + }; + dialog.close = function() { + dialog.parentNode?.removeChild(dialog); + }; + let dialogCloseTimer = null; + let prevent_timeout = 0; + dialog.addEventListener("mouseleave", function() { + if (prevent_timeout) return; + if (!dialog.is_modified && LiteGraph.dialog_close_on_mouse_leave) + dialogCloseTimer = setTimeout( + dialog.close, + LiteGraph.dialog_close_on_mouse_leave_delay + ); + }); + dialog.addEventListener("mouseenter", function() { + if (options4.closeOnLeave || LiteGraph.dialog_close_on_mouse_leave) { + if (dialogCloseTimer) clearTimeout(dialogCloseTimer); + } + }); + const selInDia = dialog.querySelectorAll("select"); + selInDia?.forEach(function(selIn) { + selIn.addEventListener("click", function() { + prevent_timeout++; + }); + selIn.addEventListener("blur", function() { + prevent_timeout = 0; + }); + selIn.addEventListener("change", function() { + prevent_timeout = -1; + }); + }); + return dialog; + } + createPanel(title, options4) { + options4 = options4 || {}; + const ref_window = options4.window || window; + const root27 = document.createElement("div"); + root27.className = "litegraph dialog"; + root27.innerHTML = "<div class='dialog-header'><span class='dialog-title'></span></div><div class='dialog-content'></div><div style='display:none;' class='dialog-alt-content'></div><div class='dialog-footer'></div>"; + root27.header = root27.querySelector(".dialog-header"); + if (options4.width) + root27.style.width = options4.width + (typeof options4.width === "number" ? "px" : ""); + if (options4.height) + root27.style.height = options4.height + (typeof options4.height === "number" ? "px" : ""); + if (options4.closable) { + const close5 = document.createElement("span"); + close5.innerHTML = "✕"; + close5.classList.add("close"); + close5.addEventListener("click", function() { + root27.close(); + }); + root27.header.appendChild(close5); + } + root27.title_element = root27.querySelector(".dialog-title"); + root27.title_element.innerText = title; + root27.content = root27.querySelector(".dialog-content"); + root27.alt_content = root27.querySelector(".dialog-alt-content"); + root27.footer = root27.querySelector(".dialog-footer"); + root27.close = function() { + if (typeof root27.onClose == "function") root27.onClose(); + root27.parentNode?.removeChild(root27); + this.parentNode?.removeChild(this); + }; + root27.toggleAltContent = function(force) { + let vTo; + let vAlt; + if (typeof force != "undefined") { + vTo = force ? "block" : "none"; + vAlt = force ? "none" : "block"; + } else { + vTo = root27.alt_content.style.display != "block" ? "block" : "none"; + vAlt = root27.alt_content.style.display != "block" ? "none" : "block"; + } + root27.alt_content.style.display = vTo; + root27.content.style.display = vAlt; + }; + root27.toggleFooterVisibility = function(force) { + let vTo; + if (typeof force != "undefined") { + vTo = force ? "block" : "none"; + } else { + vTo = root27.footer.style.display != "block" ? "block" : "none"; + } + root27.footer.style.display = vTo; + }; + root27.clear = function() { + this.content.innerHTML = ""; + }; + root27.addHTML = function(code2, classname, on_footer) { + const elem = document.createElement("div"); + if (classname) elem.className = classname; + elem.innerHTML = code2; + if (on_footer) root27.footer.appendChild(elem); + else root27.content.appendChild(elem); + return elem; + }; + root27.addButton = function(name2, callback, options22) { + const elem = document.createElement("button"); + elem.innerText = name2; + elem.options = options22; + elem.classList.add("btn"); + elem.addEventListener("click", callback); + root27.footer.appendChild(elem); + return elem; + }; + root27.addSeparator = function() { + const elem = document.createElement("div"); + elem.className = "separator"; + root27.content.appendChild(elem); + }; + root27.addWidget = function(type, name2, value4, options22, callback) { + options22 = options22 || {}; + let str_value = String(value4); + type = type.toLowerCase(); + if (type == "number") str_value = value4.toFixed(3); + const elem = document.createElement("div"); + elem.className = "property"; + elem.innerHTML = "<span class='property_name'></span><span class='property_value'></span>"; + elem.querySelector(".property_name").innerText = options22.label || name2; + const value_element = elem.querySelector(".property_value"); + value_element.innerText = str_value; + elem.dataset["property"] = name2; + elem.dataset["type"] = options22.type || type; + elem.options = options22; + elem.value = value4; + if (type == "code") + elem.addEventListener("click", function() { + root27.inner_showCodePad(this.dataset["property"]); + }); + else if (type == "boolean") { + elem.classList.add("boolean"); + if (value4) elem.classList.add("bool-on"); + elem.addEventListener("click", function() { + const propname = this.dataset["property"]; + this.value = !this.value; + this.classList.toggle("bool-on"); + this.querySelector(".property_value").innerText = this.value ? "true" : "false"; + innerChange(propname, this.value); + }); + } else if (type == "string" || type == "number") { + value_element.setAttribute("contenteditable", true); + value_element.addEventListener("keydown", function(e2) { + if (e2.code == "Enter" && (type != "string" || !e2.shiftKey)) { + e2.preventDefault(); + this.blur(); + } + }); + value_element.addEventListener("blur", function() { + let v2 = this.innerText; + const propname = this.parentNode.dataset["property"]; + const proptype = this.parentNode.dataset["type"]; + if (proptype == "number") v2 = Number(v2); + innerChange(propname, v2); + }); + } else if (type == "enum" || type == "combo") { + const str_value2 = LGraphCanvas.getPropertyPrintableValue(value4, options22.values); + value_element.innerText = str_value2; + value_element.addEventListener("click", function(event) { + const values = options22.values || []; + const propname = this.parentNode.dataset["property"]; + const elem_that = this; + new LiteGraph.ContextMenu( + values, + { + event, + className: "dark", + callback: inner_clicked + }, + // @ts-expect-error + ref_window + ); + function inner_clicked(v2) { + elem_that.innerText = v2; + innerChange(propname, v2); + return false; + } + __name(inner_clicked, "inner_clicked"); + }); + } + root27.content.appendChild(elem); + function innerChange(name22, value22) { + options22.callback?.(name22, value22, options22); + callback?.(name22, value22, options22); + } + __name(innerChange, "innerChange"); + return elem; + }; + if (root27.onOpen && typeof root27.onOpen == "function") root27.onOpen(); + return root27; + } + closePanels() { + document.querySelector("#node-panel")?.close(); + document.querySelector("#option-panel")?.close(); + } + showShowNodePanel(node22) { + this.SELECTED_NODE = node22; + this.closePanels(); + const ref_window = this.getCanvasWindow(); + const graphcanvas = this; + const panel2 = this.createPanel(node22.title || "", { + closable: true, + window: ref_window, + onOpen: /* @__PURE__ */ __name(function() { + graphcanvas.NODEPANEL_IS_OPEN = true; + }, "onOpen"), + onClose: /* @__PURE__ */ __name(function() { + graphcanvas.NODEPANEL_IS_OPEN = false; + graphcanvas.node_panel = null; + }, "onClose") + }); + graphcanvas.node_panel = panel2; + panel2.id = "node-panel"; + panel2.node = node22; + panel2.classList.add("settings"); + function inner_refresh() { + panel2.content.innerHTML = ""; + panel2.addHTML(`<span class='node_type'>${node22.type}</span><span class='node_desc'>${node22.constructor.desc || ""}</span><span class='separator'></span>`); + panel2.addHTML("<h3>Properties</h3>"); + const fUpdate = /* @__PURE__ */ __name(function(name2, value4) { + graphcanvas.graph.beforeChange(node22); + switch (name2) { + case "Title": + node22.title = value4; + break; + case "Mode": { + const kV = Object.values(LiteGraph.NODE_MODES).indexOf(value4); + if (kV >= 0 && LiteGraph.NODE_MODES[kV]) { + node22.changeMode(kV); + } else { + console.warn("unexpected mode: " + value4); + } + break; + } + case "Color": + if (LGraphCanvas.node_colors[value4]) { + node22.color = LGraphCanvas.node_colors[value4].color; + node22.bgcolor = LGraphCanvas.node_colors[value4].bgcolor; + } else { + console.warn("unexpected color: " + value4); + } + break; + default: + node22.setProperty(name2, value4); + break; + } + graphcanvas.graph.afterChange(); + graphcanvas.dirty_canvas = true; + }, "fUpdate"); + panel2.addWidget("string", "Title", node22.title, {}, fUpdate); + panel2.addWidget("combo", "Mode", LiteGraph.NODE_MODES[node22.mode], { values: LiteGraph.NODE_MODES }, fUpdate); + const nodeCol = node22.color !== void 0 ? Object.keys(LGraphCanvas.node_colors).filter(function(nK) { + return LGraphCanvas.node_colors[nK].color == node22.color; + }) : ""; + panel2.addWidget("combo", "Color", nodeCol, { values: Object.keys(LGraphCanvas.node_colors) }, fUpdate); + for (const pName in node22.properties) { + const value4 = node22.properties[pName]; + const info = node22.getPropertyInfo(pName); + if (node22.onAddPropertyToPanel?.(pName, panel2)) continue; + panel2.addWidget(info.widget || info.type, pName, value4, info, fUpdate); + } + panel2.addSeparator(); + node22.onShowCustomPanelInfo?.(panel2); + panel2.footer.innerHTML = ""; + panel2.addButton("Delete", function() { + if (node22.block_delete) + return; + node22.graph.remove(node22); + panel2.close(); + }).classList.add("delete"); + } + __name(inner_refresh, "inner_refresh"); + panel2.inner_showCodePad = function(propname) { + panel2.classList.remove("settings"); + panel2.classList.add("centered"); + panel2.alt_content.innerHTML = "<textarea class='code'></textarea>"; + const textarea = panel2.alt_content.querySelector("textarea"); + const fDoneWith = /* @__PURE__ */ __name(function() { + panel2.toggleAltContent(false); + panel2.toggleFooterVisibility(true); + textarea.parentNode.removeChild(textarea); + panel2.classList.add("settings"); + panel2.classList.remove("centered"); + inner_refresh(); + }, "fDoneWith"); + textarea.value = node22.properties[propname]; + textarea.addEventListener("keydown", function(e2) { + if (e2.code == "Enter" && e2.ctrlKey) { + node22.setProperty(propname, textarea.value); + fDoneWith(); + } + }); + panel2.toggleAltContent(true); + panel2.toggleFooterVisibility(false); + textarea.style.height = "calc(100% - 40px)"; + const assign2 = panel2.addButton("Assign", function() { + node22.setProperty(propname, textarea.value); + fDoneWith(); + }); + panel2.alt_content.appendChild(assign2); + const button = panel2.addButton("Close", fDoneWith); + button.style.float = "right"; + panel2.alt_content.appendChild(button); + }; + inner_refresh(); + this.canvas.parentNode.appendChild(panel2); + } + checkPanels() { + if (!this.canvas) return; + const panels = this.canvas.parentNode.querySelectorAll(".litegraph.dialog"); + for (let i2 = 0; i2 < panels.length; ++i2) { + const panel2 = panels[i2]; + if (!panel2.node) continue; + if (!panel2.node.graph || panel2.graph != this.graph) panel2.close(); + } + } + getCanvasMenuOptions() { + let options4 = null; + if (this.getMenuOptions) { + options4 = this.getMenuOptions(); + } else { + options4 = [ + { + content: "Add Node", + has_submenu: true, + // @ts-expect-error Might be broken? Or just param overlap + callback: LGraphCanvas.onMenuAdd + }, + { content: "Add Group", callback: LGraphCanvas.onGroupAdd } + // { content: "Arrange", callback: that.graph.arrange }, + // {content:"Collapse All", callback: LGraphCanvas.onMenuCollapseAll } + ]; + if (Object.keys(this.selected_nodes).length > 1) { + options4.push({ + content: "Align", + has_submenu: true, + callback: LGraphCanvas.onGroupAlign + }); + } + } + const extra = this.getExtraMenuOptions?.(this, options4); + return Array.isArray(extra) ? options4.concat(extra) : options4; + } + // called by processContextMenu to extract the menu list + getNodeMenuOptions(node22) { + let options4 = null; + if (node22.getMenuOptions) { + options4 = node22.getMenuOptions(this); + } else { + options4 = [ + { + content: "Inputs", + has_submenu: true, + disabled: true, + callback: LGraphCanvas.showMenuNodeOptionalInputs + }, + { + content: "Outputs", + has_submenu: true, + disabled: true, + callback: LGraphCanvas.showMenuNodeOptionalOutputs + }, + null, + { + content: "Properties", + has_submenu: true, + callback: LGraphCanvas.onShowMenuNodeProperties + }, + { + content: "Properties Panel", + callback: /* @__PURE__ */ __name(function(item3, options22, e2, menu2, node3) { + LGraphCanvas.active_canvas.showShowNodePanel(node3); + }, "callback") + }, + null, + { + content: "Title", + callback: LGraphCanvas.onShowPropertyEditor + }, + { + content: "Mode", + has_submenu: true, + callback: LGraphCanvas.onMenuNodeMode + } + ]; + if (node22.resizable !== false) { + options4.push({ + content: "Resize", + callback: LGraphCanvas.onMenuResizeNode + }); + } + if (node22.collapsible) { + options4.push({ + content: node22.collapsed ? "Expand" : "Collapse", + callback: LGraphCanvas.onMenuNodeCollapse + }); + } + if (node22.widgets?.some((w2) => w2.advanced)) { + options4.push({ + content: node22.showAdvanced ? "Hide Advanced" : "Show Advanced", + callback: LGraphCanvas.onMenuToggleAdvanced + }); + } + options4.push( + { + content: node22.pinned ? "Unpin" : "Pin", + callback: /* @__PURE__ */ __name((...args) => { + LGraphCanvas.onMenuNodePin(...args); + for (const i2 in this.selected_nodes) { + const node3 = this.selected_nodes[i2]; + node3.pin(); + } + this.setDirty(true, true); + }, "callback") + }, + { + content: "Colors", + has_submenu: true, + callback: LGraphCanvas.onMenuNodeColors + }, + { + content: "Shapes", + has_submenu: true, + callback: LGraphCanvas.onMenuNodeShapes + }, + null + ); + } + const inputs = node22.onGetInputs?.(); + if (inputs?.length) options4[0].disabled = false; + const outputs = node22.onGetOutputs?.(); + if (outputs?.length) options4[1].disabled = false; + const extra = node22.getExtraMenuOptions?.(this, options4); + if (Array.isArray(extra) && extra.length > 0) { + extra.push(null); + options4 = extra.concat(options4); + } + if (node22.clonable !== false) { + options4.push({ + content: "Clone", + callback: LGraphCanvas.onMenuNodeClone + }); + } + if (Object.keys(this.selected_nodes).length > 1) { + options4.push({ + content: "Align Selected To", + has_submenu: true, + callback: LGraphCanvas.onNodeAlign + }); + options4.push({ + content: "Distribute Nodes", + has_submenu: true, + callback: LGraphCanvas.createDistributeMenu + }); + } + options4.push(null, { + content: "Remove", + disabled: !(node22.removable !== false && !node22.block_delete), + callback: LGraphCanvas.onMenuNodeRemove + }); + node22.graph?.onGetNodeMenuOptions?.(options4, node22); + return options4; + } + getGroupMenuOptions(group) { + console.warn("LGraphCanvas.getGroupMenuOptions is deprecated, use LGraphGroup.getMenuOptions instead"); + return group.getMenuOptions(); + } + processContextMenu(node22, event) { + const that = this; + const canvas = LGraphCanvas.active_canvas; + const ref_window = canvas.getCanvasWindow(); + let menu_info = null; + const options4 = { + event, + callback: inner_option_clicked, + extra: node22 + }; + if (node22) options4.title = node22.type; + let slot = null; + if (node22) { + slot = node22.getSlotInPosition(event.canvasX, event.canvasY); + LGraphCanvas.active_node = node22; + } + if (slot) { + menu_info = []; + if (node22.getSlotMenuOptions) { + menu_info = node22.getSlotMenuOptions(slot); + } else { + if (slot?.output?.links?.length) + menu_info.push({ content: "Disconnect Links", slot }); + const _slot = slot.input || slot.output; + if (_slot.removable) { + menu_info.push( + _slot.locked ? "Cannot remove" : { content: "Remove Slot", slot } + ); + } + if (!_slot.nameLocked) + menu_info.push({ content: "Rename Slot", slot }); + } + options4.title = (slot.input ? slot.input.type : slot.output.type) || "*"; + if (slot.input && slot.input.type == LiteGraph.ACTION) + options4.title = "Action"; + if (slot.output && slot.output.type == LiteGraph.EVENT) + options4.title = "Event"; + } else if (node22) { + menu_info = this.getNodeMenuOptions(node22); + } else { + menu_info = this.getCanvasMenuOptions(); + if (this.reroutesEnabled && this.links_render_mode !== LinkRenderType.HIDDEN_LINK) { + const reroute = this.graph.getRerouteOnPos(event.canvasX, event.canvasY); + if (reroute) { + menu_info.unshift({ + content: "Delete Reroute", + callback: /* @__PURE__ */ __name(() => this.graph.removeReroute(reroute.id), "callback") + }, null); + } + } + const group = this.graph.getGroupOnPos( + event.canvasX, + event.canvasY + ); + if (group) { + menu_info.push(null, { + content: "Edit Group", + has_submenu: true, + submenu: { + title: "Group", + extra: group, + options: group.getMenuOptions() + } + }); + } + } + if (!menu_info) return; + new LiteGraph.ContextMenu(menu_info, options4, ref_window); + function inner_option_clicked(v2, options22) { + if (!v2) return; + if (v2.content == "Remove Slot") { + const info = v2.slot; + node22.graph.beforeChange(); + if (info.input) { + node22.removeInput(info.slot); + } else if (info.output) { + node22.removeOutput(info.slot); + } + node22.graph.afterChange(); + return; + } else if (v2.content == "Disconnect Links") { + const info = v2.slot; + node22.graph.beforeChange(); + if (info.output) { + node22.disconnectOutput(info.slot); + } else if (info.input) { + node22.disconnectInput(info.slot); + } + node22.graph.afterChange(); + return; + } else if (v2.content == "Rename Slot") { + const info = v2.slot; + const slot_info = info.input ? node22.getInputInfo(info.slot) : node22.getOutputInfo(info.slot); + const dialog = that.createDialog( + "<span class='name'>Name</span><input autofocus type='text'/><button>OK</button>", + options22 + ); + const input = dialog.querySelector("input"); + if (input && slot_info) { + input.value = slot_info.label || ""; + } + const inner = /* @__PURE__ */ __name(function() { + node22.graph.beforeChange(); + if (input.value) { + if (slot_info) { + slot_info.label = input.value; + } + that.setDirty(true); + } + dialog.close(); + node22.graph.afterChange(); + }, "inner"); + dialog.querySelector("button").addEventListener("click", inner); + input.addEventListener("keydown", function(e2) { + dialog.is_modified = true; + if (e2.keyCode == 27) { + dialog.close(); + } else if (e2.keyCode == 13) { + inner(); + } else if (e2.keyCode != 13 && e2.target.localName != "textarea") { + return; + } + e2.preventDefault(); + e2.stopPropagation(); + }); + input.focus(); + } + } + __name(inner_option_clicked, "inner_option_clicked"); + } + /** + * Starts an animation to fit the view around the specified selection of nodes. + * @param bounds The bounds to animate the view to, defined by a rectangle. + */ + animateToBounds(bounds, { + duration = 350, + zoom = 0.75, + easing = EaseFunction.EASE_IN_OUT_QUAD + } = {}) { + const easeFunctions = { + linear: /* @__PURE__ */ __name((t2) => t2, "linear"), + easeInQuad: /* @__PURE__ */ __name((t2) => t2 * t2, "easeInQuad"), + easeOutQuad: /* @__PURE__ */ __name((t2) => t2 * (2 - t2), "easeOutQuad"), + easeInOutQuad: /* @__PURE__ */ __name((t2) => t2 < 0.5 ? 2 * t2 * t2 : -1 + (4 - 2 * t2) * t2, "easeInOutQuad") + }; + const easeFunction = easeFunctions[easing] ?? easeFunctions.linear; + let animationId = null; + const startTimestamp = performance.now(); + const startX = this.ds.offset[0]; + const startY = this.ds.offset[1]; + const startScale = this.ds.scale; + const cw = this.canvas.width / window.devicePixelRatio; + const ch = this.canvas.height / window.devicePixelRatio; + let targetScale = startScale; + let targetX = startX; + let targetY = startY; + if (zoom > 0) { + const targetScaleX = zoom * cw / Math.max(bounds[2], 300); + const targetScaleY = zoom * ch / Math.max(bounds[3], 300); + targetScale = Math.min(targetScaleX, targetScaleY, this.ds.max_scale); + } + targetX = -bounds[0] - bounds[2] * 0.5 + cw * 0.5 / targetScale; + targetY = -bounds[1] - bounds[3] * 0.5 + ch * 0.5 / targetScale; + const animate = /* @__PURE__ */ __name((timestamp2) => { + const elapsed = timestamp2 - startTimestamp; + const progress = Math.min(elapsed / duration, 1); + const easedProgress = easeFunction(progress); + this.ds.offset[0] = startX + (targetX - startX) * easedProgress; + this.ds.offset[1] = startY + (targetY - startY) * easedProgress; + if (zoom > 0) { + this.ds.scale = startScale + (targetScale - startScale) * easedProgress; + } + this.setDirty(true, true); + if (progress < 1) { + animationId = requestAnimationFrame(animate); + } else { + cancelAnimationFrame(animationId); + } + }, "animate"); + animationId = requestAnimationFrame(animate); + } + /** + * Fits the view to the selected nodes with animation. + * If nothing is selected, the view is fitted around all items in the graph. + */ + fitViewToSelectionAnimated(options4 = {}) { + const items2 = this.selectedItems.size ? Array.from(this.selectedItems) : this.positionableItems; + this.animateToBounds(createBounds(items2), options4); + } +} +class MapProxyHandler { + static { + __name(this, "MapProxyHandler"); + } + getOwnPropertyDescriptor(target, p2) { + const value4 = this.get(target, p2); + if (value4) return { + configurable: true, + enumerable: true, + value: value4 + }; + } + has(target, p2) { + if (typeof p2 === "symbol") return false; + const int = parseInt(p2, 10); + return target.has(!isNaN(int) ? int : p2); + } + ownKeys(target) { + return [...target.keys()].map((x2) => String(x2)); + } + get(target, p2) { + if (p2 in target) return Reflect.get(target, p2, target); + if (typeof p2 === "symbol") return; + const int = parseInt(p2, 10); + return target.get(!isNaN(int) ? int : p2); + } + set(target, p2, newValue2) { + if (typeof p2 === "symbol") return false; + const int = parseInt(p2, 10); + target.set(!isNaN(int) ? int : p2, newValue2); + return true; + } + deleteProperty(target, p2) { + return target.delete(p2); + } + static bindAllMethods(map3) { + map3.clear = map3.clear.bind(map3); + map3.delete = map3.delete.bind(map3); + map3.forEach = map3.forEach.bind(map3); + map3.get = map3.get.bind(map3); + map3.has = map3.has.bind(map3); + map3.set = map3.set.bind(map3); + map3.entries = map3.entries.bind(map3); + map3.keys = map3.keys.bind(map3); + map3.values = map3.values.bind(map3); + } +} +let LGraph$1 = class LGraph2 { + static { + __name(this, "LGraph"); + } + static serialisedSchemaVersion = 1; + // default supported types + static supported_types = ["number", "string", "boolean"]; + static STATUS_STOPPED = 1; + static STATUS_RUNNING = 2; + _version; + /** The backing store for links. Keys are wrapped in String() */ + _links = /* @__PURE__ */ new Map(); + /** + * Indexed property access is deprecated. + * Backwards compatibility with a Proxy has been added, but will eventually be removed. + * + * Use {@link Map} methods: + * ``` + * const linkId = 123 + * const link = graph.links.get(linkId) + * // Deprecated: const link = graph.links[linkId] + * ``` + */ + links; + list_of_graphcanvas; + status; + state; + _nodes; + _nodes_by_id; + _nodes_in_order; + _nodes_executable; + _groups; + iteration; + globaltime; + runningtime; + fixedtime; + fixedtime_lapse; + elapsed_time; + last_update_time; + starttime; + catch_errors; + execution_timer_id; + errors_in_execution; + execution_time; + _last_trigger_time; + filter; + _subgraph_node; + /** Must contain serialisable values, e.g. primitive types */ + config; + vars; + nodes_executing; + nodes_actioning; + nodes_executedAction; + extra; + inputs; + outputs; + /** @returns Whether the graph has no items */ + get empty() { + return this._nodes.length + this._groups.length + this.reroutes.size === 0; + } + /** @returns All items on the canvas that can be selected */ + *positionableItems() { + for (const node22 of this._nodes) yield node22; + for (const group of this._groups) yield group; + for (const reroute of this.reroutes.values()) yield reroute; + return; + } + #reroutes = /* @__PURE__ */ new Map(); + /** All reroutes in this graph. */ + get reroutes() { + return this.#reroutes; + } + set reroutes(value4) { + if (!value4) throw new TypeError("Attempted to set LGraph.reroutes to a falsy value."); + const reroutes = this.#reroutes; + if (value4.size === 0) { + reroutes.clear(); + return; + } + for (const rerouteId of reroutes.keys()) { + if (!value4.has(rerouteId)) reroutes.delete(rerouteId); + } + for (const [id3, reroute] of value4) { + reroutes.set(id3, reroute); + } + } + /** @deprecated See {@link state}.{@link LGraphState.lastNodeId lastNodeId} */ + get last_node_id() { + return this.state.lastNodeId; + } + set last_node_id(value4) { + this.state.lastNodeId = value4; + } + /** @deprecated See {@link state}.{@link LGraphState.lastLinkId lastLinkId} */ + get last_link_id() { + return this.state.lastLinkId; + } + set last_link_id(value4) { + this.state.lastLinkId = value4; + } + _input_nodes; + /** + * See {@link LGraph} + * @param o data from previous serialization [optional] + */ + constructor(o2) { + if (LiteGraph.debug) console.log("Graph created"); + const links = this._links; + MapProxyHandler.bindAllMethods(links); + const handler6 = new MapProxyHandler(); + this.links = new Proxy(links, handler6); + this.list_of_graphcanvas = null; + this.clear(); + if (o2) this.configure(o2); + } + // TODO: Remove + // used to know which types of connections support this graph (some graphs do not allow certain types) + getSupportedTypes() { + return this.supported_types || LGraph2.supported_types; + } + /** + * Removes all nodes from this graph + */ + clear() { + this.stop(); + this.status = LGraph2.STATUS_STOPPED; + this.state = { + lastGroupId: 0, + lastNodeId: 0, + lastLinkId: 0, + lastRerouteId: 0 + }; + this._version = -1; + if (this._nodes) { + for (let i2 = 0; i2 < this._nodes.length; ++i2) { + this._nodes[i2].onRemoved?.(); + } + } + this._nodes = []; + this._nodes_by_id = {}; + this._nodes_in_order = []; + this._nodes_executable = null; + this._links.clear(); + this.reroutes.clear(); + this._groups = []; + this.iteration = 0; + this.config = {}; + this.vars = {}; + this.extra = {}; + this.globaltime = 0; + this.runningtime = 0; + this.fixedtime = 0; + this.fixedtime_lapse = 0.01; + this.elapsed_time = 0.01; + this.last_update_time = 0; + this.starttime = 0; + this.catch_errors = true; + this.nodes_executing = []; + this.nodes_actioning = []; + this.nodes_executedAction = []; + this.inputs = {}; + this.outputs = {}; + this.change(); + this.canvasAction((c2) => c2.clear()); + } + get nodes() { + return this._nodes; + } + get groups() { + return this._groups; + } + /** + * Attach Canvas to this graph + */ + attachCanvas(graphcanvas) { + if (graphcanvas.constructor != LGraphCanvas) + throw "attachCanvas expects a LGraphCanvas instance"; + if (graphcanvas.graph != this) + graphcanvas.graph?.detachCanvas(graphcanvas); + graphcanvas.graph = this; + this.list_of_graphcanvas ||= []; + this.list_of_graphcanvas.push(graphcanvas); + } + /** + * Detach Canvas from this graph + */ + detachCanvas(graphcanvas) { + if (!this.list_of_graphcanvas) return; + const pos2 = this.list_of_graphcanvas.indexOf(graphcanvas); + if (pos2 == -1) return; + graphcanvas.graph = null; + this.list_of_graphcanvas.splice(pos2, 1); + } + /** + * Starts running this graph every interval milliseconds. + * @param interval amount of milliseconds between executions, if 0 then it renders to the monitor refresh rate + */ + start(interval) { + if (this.status == LGraph2.STATUS_RUNNING) return; + this.status = LGraph2.STATUS_RUNNING; + this.onPlayEvent?.(); + this.sendEventToAllNodes("onStart"); + this.starttime = LiteGraph.getTime(); + this.last_update_time = this.starttime; + interval ||= 0; + const that = this; + if (interval == 0 && typeof window != "undefined" && window.requestAnimationFrame) { + let on_frame = /* @__PURE__ */ __name(function() { + if (that.execution_timer_id != -1) return; + window.requestAnimationFrame(on_frame); + that.onBeforeStep?.(); + that.runStep(1, !that.catch_errors); + that.onAfterStep?.(); + }, "on_frame"); + this.execution_timer_id = -1; + on_frame(); + } else { + this.execution_timer_id = setInterval(function() { + that.onBeforeStep?.(); + that.runStep(1, !that.catch_errors); + that.onAfterStep?.(); + }, interval); + } + } + /** + * Stops the execution loop of the graph + */ + stop() { + if (this.status == LGraph2.STATUS_STOPPED) return; + this.status = LGraph2.STATUS_STOPPED; + this.onStopEvent?.(); + if (this.execution_timer_id != null) { + if (this.execution_timer_id != -1) { + clearInterval(this.execution_timer_id); + } + this.execution_timer_id = null; + } + this.sendEventToAllNodes("onStop"); + } + /** + * Run N steps (cycles) of the graph + * @param num number of steps to run, default is 1 + * @param do_not_catch_errors [optional] if you want to try/catch errors + * @param limit max number of nodes to execute (used to execute from start to a node) + */ + runStep(num, do_not_catch_errors, limit) { + num = num || 1; + const start2 = LiteGraph.getTime(); + this.globaltime = 1e-3 * (start2 - this.starttime); + const nodes = this._nodes_executable ? this._nodes_executable : this._nodes; + if (!nodes) return; + limit = limit || nodes.length; + if (do_not_catch_errors) { + for (let i2 = 0; i2 < num; i2++) { + for (let j2 = 0; j2 < limit; ++j2) { + const node22 = nodes[j2]; + if (node22.mode == LGraphEventMode.ALWAYS && node22.onExecute) { + node22.doExecute?.(); + } + } + this.fixedtime += this.fixedtime_lapse; + this.onExecuteStep?.(); + } + this.onAfterExecute?.(); + } else { + try { + for (let i2 = 0; i2 < num; i2++) { + for (let j2 = 0; j2 < limit; ++j2) { + const node22 = nodes[j2]; + if (node22.mode == LGraphEventMode.ALWAYS) { + node22.onExecute?.(); + } + } + this.fixedtime += this.fixedtime_lapse; + this.onExecuteStep?.(); + } + this.onAfterExecute?.(); + this.errors_in_execution = false; + } catch (err) { + this.errors_in_execution = true; + if (LiteGraph.throw_errors) throw err; + if (LiteGraph.debug) console.log("Error during execution: " + err); + this.stop(); + } + } + const now2 = LiteGraph.getTime(); + let elapsed = now2 - start2; + if (elapsed == 0) elapsed = 1; + this.execution_time = 1e-3 * elapsed; + this.globaltime += 1e-3 * elapsed; + this.iteration += 1; + this.elapsed_time = (now2 - this.last_update_time) * 1e-3; + this.last_update_time = now2; + this.nodes_executing = []; + this.nodes_actioning = []; + this.nodes_executedAction = []; + } + /** + * Updates the graph execution order according to relevance of the nodes (nodes with only outputs have more relevance than + * nodes with only inputs. + */ + updateExecutionOrder() { + this._nodes_in_order = this.computeExecutionOrder(false); + this._nodes_executable = []; + for (let i2 = 0; i2 < this._nodes_in_order.length; ++i2) { + if (this._nodes_in_order[i2].onExecute) { + this._nodes_executable.push(this._nodes_in_order[i2]); + } + } + } + // This is more internal, it computes the executable nodes in order and returns it + computeExecutionOrder(only_onExecute, set_level) { + const L2 = []; + const S2 = []; + const M2 = {}; + const visited_links = {}; + const remaining_links = {}; + for (let i2 = 0, l2 = this._nodes.length; i2 < l2; ++i2) { + const node22 = this._nodes[i2]; + if (only_onExecute && !node22.onExecute) { + continue; + } + M2[node22.id] = node22; + let num = 0; + if (node22.inputs) { + for (let j2 = 0, l22 = node22.inputs.length; j2 < l22; j2++) { + if (node22.inputs[j2]?.link != null) { + num += 1; + } + } + } + if (num == 0) { + S2.push(node22); + if (set_level) node22._level = 1; + } else { + if (set_level) node22._level = 0; + remaining_links[node22.id] = num; + } + } + while (true) { + const node22 = S2.shift(); + if (node22 === void 0) break; + L2.push(node22); + delete M2[node22.id]; + if (!node22.outputs) continue; + for (let i2 = 0; i2 < node22.outputs.length; i2++) { + const output = node22.outputs[i2]; + if (output?.links == null || output.links.length == 0) + continue; + for (let j2 = 0; j2 < output.links.length; j2++) { + const link_id = output.links[j2]; + const link2 = this._links.get(link_id); + if (!link2) continue; + if (visited_links[link2.id]) continue; + const target_node = this.getNodeById(link2.target_id); + if (target_node == null) { + visited_links[link2.id] = true; + continue; + } + if (set_level && (!target_node._level || target_node._level <= node22._level)) { + target_node._level = node22._level + 1; + } + visited_links[link2.id] = true; + remaining_links[target_node.id] -= 1; + if (remaining_links[target_node.id] == 0) S2.push(target_node); + } + } + } + for (const i2 in M2) { + L2.push(M2[i2]); + } + if (L2.length != this._nodes.length && LiteGraph.debug) + console.warn("something went wrong, nodes missing"); + L2.length; + function setOrder(nodes) { + const l2 = nodes.length; + for (let i2 = 0; i2 < l2; ++i2) { + nodes[i2].order = i2; + } + } + __name(setOrder, "setOrder"); + setOrder(L2); + L2.sort(function(A2, B2) { + const Ap = A2.constructor.priority || A2.priority || 0; + const Bp = B2.constructor.priority || B2.priority || 0; + return Ap == Bp ? A2.order - B2.order : Ap - Bp; + }); + setOrder(L2); + return L2; + } + /** + * Returns all the nodes that could affect this one (ancestors) by crawling all the inputs recursively. + * It doesn't include the node itself + * @returns an array with all the LGraphNodes that affect this node, in order of execution + */ + getAncestors(node22) { + const ancestors = []; + const pending = [node22]; + const visited = {}; + while (pending.length) { + const current = pending.shift(); + if (!current?.inputs) continue; + if (!visited[current.id] && current != node22) { + visited[current.id] = true; + ancestors.push(current); + } + for (let i2 = 0; i2 < current.inputs.length; ++i2) { + const input = current.getInputNode(i2); + if (input && ancestors.indexOf(input) == -1) { + pending.push(input); + } + } + } + ancestors.sort(function(a2, b2) { + return a2.order - b2.order; + }); + return ancestors; + } + /** + * Positions every node in a more readable manner + */ + arrange(margin, layout) { + margin = margin || 100; + const nodes = this.computeExecutionOrder(false, true); + const columns = []; + for (let i2 = 0; i2 < nodes.length; ++i2) { + const node22 = nodes[i2]; + const col = node22._level || 1; + columns[col] ||= []; + columns[col].push(node22); + } + let x2 = margin; + for (let i2 = 0; i2 < columns.length; ++i2) { + const column = columns[i2]; + if (!column) continue; + let max_size = 100; + let y2 = margin + LiteGraph.NODE_TITLE_HEIGHT; + for (let j2 = 0; j2 < column.length; ++j2) { + const node22 = column[j2]; + node22.pos[0] = layout == LiteGraph.VERTICAL_LAYOUT ? y2 : x2; + node22.pos[1] = layout == LiteGraph.VERTICAL_LAYOUT ? x2 : y2; + const max_size_index = layout == LiteGraph.VERTICAL_LAYOUT ? 1 : 0; + if (node22.size[max_size_index] > max_size) { + max_size = node22.size[max_size_index]; + } + const node_size_index = layout == LiteGraph.VERTICAL_LAYOUT ? 0 : 1; + y2 += node22.size[node_size_index] + margin + LiteGraph.NODE_TITLE_HEIGHT; + } + x2 += max_size + margin; + } + this.setDirtyCanvas(true, true); + } + /** + * Returns the amount of time the graph has been running in milliseconds + * @returns number of milliseconds the graph has been running + */ + getTime() { + return this.globaltime; + } + /** + * Returns the amount of time accumulated using the fixedtime_lapse var. + * This is used in context where the time increments should be constant + * @returns number of milliseconds the graph has been running + */ + getFixedTime() { + return this.fixedtime; + } + /** + * Returns the amount of time it took to compute the latest iteration. + * Take into account that this number could be not correct + * if the nodes are using graphical actions + * @returns number of milliseconds it took the last cycle + */ + getElapsedTime() { + return this.elapsed_time; + } + /** + * Sends an event to all the nodes, useful to trigger stuff + * @param eventname the name of the event (function to be called) + * @param params parameters in array format + */ + sendEventToAllNodes(eventname, params, mode2) { + mode2 = mode2 || LGraphEventMode.ALWAYS; + const nodes = this._nodes_in_order ? this._nodes_in_order : this._nodes; + if (!nodes) return; + for (let j2 = 0, l2 = nodes.length; j2 < l2; ++j2) { + const node22 = nodes[j2]; + if (node22.constructor === LiteGraph.Subgraph && eventname != "onExecute") { + if (node22.mode == mode2) { + node22.sendEventToAllNodes(eventname, params, mode2); + } + continue; + } + if (!node22[eventname] || node22.mode != mode2) continue; + if (params === void 0) { + node22[eventname](); + } else if (params && params.constructor === Array) { + node22[eventname].apply(node22, params); + } else { + node22[eventname](params); + } + } + } + /** + * Runs an action on every canvas registered to this graph. + * @param action Action to run for every canvas + */ + canvasAction(action) { + this.list_of_graphcanvas?.forEach(action); + } + /** @deprecated See {@link LGraph.canvasAction} */ + sendActionToCanvas(action, params) { + if (!this.list_of_graphcanvas) return; + for (let i2 = 0; i2 < this.list_of_graphcanvas.length; ++i2) { + const c2 = this.list_of_graphcanvas[i2]; + c2[action]?.apply(c2, params); + } + } + /** + * Adds a new node instance to this graph + * @param node the instance of the node + */ + add(node22, skip_compute_order) { + if (!node22) return; + const { state } = this; + if (LiteGraph.alwaysSnapToGrid) { + const snapTo = this.getSnapToGridSize(); + if (snapTo) node22.snapToGrid(snapTo); + } + if (node22 instanceof LGraphGroup) { + if (node22.id == null || node22.id === -1) node22.id = ++state.lastGroupId; + if (node22.id > state.lastGroupId) state.lastGroupId = node22.id; + this._groups.push(node22); + this.setDirtyCanvas(true); + this.change(); + node22.graph = this; + this._version++; + return; + } + if (node22.id != -1 && this._nodes_by_id[node22.id] != null) { + console.warn( + "LiteGraph: there is already a node with this ID, changing it" + ); + node22.id = LiteGraph.use_uuids ? LiteGraph.uuidv4() : ++state.lastNodeId; + } + if (this._nodes.length >= LiteGraph.MAX_NUMBER_OF_NODES) { + throw "LiteGraph: max number of nodes in a graph reached"; + } + if (LiteGraph.use_uuids) { + if (node22.id == null || node22.id == -1) + node22.id = LiteGraph.uuidv4(); + } else { + if (node22.id == null || node22.id == -1) { + node22.id = ++state.lastNodeId; + } else if (typeof node22.id === "number" && state.lastNodeId < node22.id) { + state.lastNodeId = node22.id; + } + } + node22.graph = this; + this._version++; + this._nodes.push(node22); + this._nodes_by_id[node22.id] = node22; + node22.onAdded?.(this); + if (this.config.align_to_grid) node22.alignToGrid(); + if (!skip_compute_order) this.updateExecutionOrder(); + this.onNodeAdded?.(node22); + this.setDirtyCanvas(true); + this.change(); + return node22; + } + /** + * Removes a node from the graph + * @param node the instance of the node + */ + remove(node22) { + if (node22 instanceof LGraphGroup) { + const index2 = this._groups.indexOf(node22); + if (index2 != -1) { + this._groups.splice(index2, 1); + } + node22.graph = null; + this._version++; + this.setDirtyCanvas(true, true); + this.change(); + return; + } + if (this._nodes_by_id[node22.id] == null) return; + if (node22.ignore_remove) return; + this.beforeChange(); + if (node22.inputs) { + for (let i2 = 0; i2 < node22.inputs.length; i2++) { + const slot = node22.inputs[i2]; + if (slot.link != null) node22.disconnectInput(i2); + } + } + if (node22.outputs) { + for (let i2 = 0; i2 < node22.outputs.length; i2++) { + const slot = node22.outputs[i2]; + if (slot.links?.length) node22.disconnectOutput(i2); + } + } + node22.onRemoved?.(); + node22.graph = null; + this._version++; + if (this.list_of_graphcanvas) { + for (let i2 = 0; i2 < this.list_of_graphcanvas.length; ++i2) { + const canvas = this.list_of_graphcanvas[i2]; + if (canvas.selected_nodes[node22.id]) + delete canvas.selected_nodes[node22.id]; + } + } + const pos2 = this._nodes.indexOf(node22); + if (pos2 != -1) this._nodes.splice(pos2, 1); + delete this._nodes_by_id[node22.id]; + this.onNodeRemoved?.(node22); + this.canvasAction((c2) => c2.checkPanels()); + this.setDirtyCanvas(true, true); + this.afterChange(); + this.change(); + this.updateExecutionOrder(); + } + /** + * Returns a node by its id. + */ + getNodeById(id3) { + return id3 != null ? this._nodes_by_id[id3] : null; + } + /** + * Returns a list of nodes that matches a class + * @param classObject the class itself (not an string) + * @returns a list with all the nodes of this type + */ + // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type + findNodesByClass(classObject, result) { + result = result || []; + result.length = 0; + for (let i2 = 0, l2 = this._nodes.length; i2 < l2; ++i2) { + if (this._nodes[i2].constructor === classObject) + result.push(this._nodes[i2]); + } + return result; + } + /** + * Returns a list of nodes that matches a type + * @param type the name of the node type + * @returns a list with all the nodes of this type + */ + findNodesByType(type, result) { + const matchType = type.toLowerCase(); + result = result || []; + result.length = 0; + for (let i2 = 0, l2 = this._nodes.length; i2 < l2; ++i2) { + if (this._nodes[i2].type?.toLowerCase() == matchType) + result.push(this._nodes[i2]); + } + return result; + } + /** + * Returns the first node that matches a name in its title + * @param title the name of the node to search + * @returns the node or null + */ + findNodeByTitle(title) { + for (let i2 = 0, l2 = this._nodes.length; i2 < l2; ++i2) { + if (this._nodes[i2].title == title) + return this._nodes[i2]; + } + return null; + } + /** + * Returns a list of nodes that matches a name + * @param title the name of the node to search + * @returns a list with all the nodes with this name + */ + findNodesByTitle(title) { + const result = []; + for (let i2 = 0, l2 = this._nodes.length; i2 < l2; ++i2) { + if (this._nodes[i2].title == title) + result.push(this._nodes[i2]); + } + return result; + } + /** + * Returns the top-most node in this position of the canvas + * @param x the x coordinate in canvas space + * @param y the y coordinate in canvas space + * @param nodeList a list with all the nodes to search from, by default is all the nodes in the graph + * @returns the node at this position or null + */ + getNodeOnPos(x2, y2, nodeList) { + const nodes = nodeList || this._nodes; + let i2 = nodes.length; + while (--i2 >= 0) { + const node22 = nodes[i2]; + if (node22.isPointInside(x2, y2)) return node22; + } + return null; + } + /** + * Returns the top-most group in that position + * @param x The x coordinate in canvas space + * @param y The y coordinate in canvas space + * @returns The group or null + */ + getGroupOnPos(x2, y2) { + return this._groups.toReversed().find((g2) => g2.isPointInside(x2, y2)); + } + /** + * Returns the top-most group with a titlebar in the provided position. + * @param x The x coordinate in canvas space + * @param y The y coordinate in canvas space + * @returns The group or null + */ + getGroupTitlebarOnPos(x2, y2) { + return this._groups.toReversed().find((g2) => g2.isPointInTitlebar(x2, y2)); + } + /** + * Finds a reroute a the given graph point + * @param x X co-ordinate in graph space + * @param y Y co-ordinate in graph space + * @returns The first reroute under the given co-ordinates, or undefined + */ + getRerouteOnPos(x2, y2) { + for (const reroute of this.reroutes.values()) { + const { pos: pos2 } = reroute; + if (isSortaInsideOctagon(x2 - pos2[0], y2 - pos2[1], 2 * Reroute.radius)) + return reroute; + } + } + /** + * Snaps the provided items to a grid. + * + * Item positions are reounded to the nearest multiple of {@link LiteGraph.CANVAS_GRID_SIZE}. + * + * When {@link LiteGraph.alwaysSnapToGrid} is enabled + * and the grid size is falsy, a default of 1 is used. + * @param items The items to be snapped to the grid + * @todo Currently only snaps nodes. + */ + snapToGrid(items2) { + const snapTo = this.getSnapToGridSize(); + if (!snapTo) return; + getAllNestedItems(items2).forEach((item3) => { + if (!item3.pinned) item3.snapToGrid(snapTo); + }); + } + /** + * Finds the size of the grid that items should be snapped to when moved. + * @returns The size of the grid that items should be snapped to + */ + getSnapToGridSize() { + return LiteGraph.alwaysSnapToGrid ? LiteGraph.CANVAS_GRID_SIZE || 1 : LiteGraph.CANVAS_GRID_SIZE; + } + /** + * Checks that the node type matches the node type registered, + * used when replacing a nodetype by a newer version during execution + * this replaces the ones using the old version with the new version + */ + checkNodeTypes() { + for (let i2 = 0; i2 < this._nodes.length; i2++) { + const node22 = this._nodes[i2]; + const ctor = LiteGraph.registered_node_types[node22.type]; + if (node22.constructor == ctor) continue; + console.log("node being replaced by newer version: " + node22.type); + const newnode = LiteGraph.createNode(node22.type); + this._nodes[i2] = newnode; + newnode.configure(node22.serialize()); + newnode.graph = this; + this._nodes_by_id[newnode.id] = newnode; + if (node22.inputs) newnode.inputs = node22.inputs.concat(); + if (node22.outputs) newnode.outputs = node22.outputs.concat(); + } + this.updateExecutionOrder(); + } + // ********** GLOBALS ***************** + onAction(action, param, options4) { + this._input_nodes = this.findNodesByClass( + // @ts-expect-error Never impl. + LiteGraph.GraphInput, + this._input_nodes + ); + for (let i2 = 0; i2 < this._input_nodes.length; ++i2) { + const node22 = this._input_nodes[i2]; + if (node22.properties.name != action) continue; + node22.actionDo(action, param, options4); + break; + } + } + trigger(action, param) { + this.onTrigger?.(action, param); + } + /** + * Tell this graph it has a global graph input of this type + */ + addInput(name2, type, value4) { + const input = this.inputs[name2]; + if (input) return; + this.beforeChange(); + this.inputs[name2] = { name: name2, type, value: value4 }; + this._version++; + this.afterChange(); + this.onInputAdded?.(name2, type); + this.onInputsOutputsChange?.(); + } + /** + * Assign a data to the global graph input + */ + setInputData(name2, data25) { + const input = this.inputs[name2]; + if (!input) return; + input.value = data25; + } + /** + * Returns the current value of a global graph input + */ + getInputData(name2) { + const input = this.inputs[name2]; + return input ? input.value : null; + } + /** + * Changes the name of a global graph input + */ + renameInput(old_name, name2) { + if (name2 == old_name) return; + if (!this.inputs[old_name]) return false; + if (this.inputs[name2]) { + console.error("there is already one input with that name"); + return false; + } + this.inputs[name2] = this.inputs[old_name]; + delete this.inputs[old_name]; + this._version++; + this.onInputRenamed?.(old_name, name2); + this.onInputsOutputsChange?.(); + } + /** + * Changes the type of a global graph input + */ + changeInputType(name2, type) { + if (!this.inputs[name2]) return false; + if (this.inputs[name2].type && String(this.inputs[name2].type).toLowerCase() == String(type).toLowerCase()) { + return; + } + this.inputs[name2].type = type; + this._version++; + this.onInputTypeChanged?.(name2, type); + } + /** + * Removes a global graph input + */ + removeInput(name2) { + if (!this.inputs[name2]) return false; + delete this.inputs[name2]; + this._version++; + this.onInputRemoved?.(name2); + this.onInputsOutputsChange?.(); + return true; + } + /** + * Creates a global graph output + */ + addOutput(name2, type, value4) { + this.outputs[name2] = { name: name2, type, value: value4 }; + this._version++; + this.onOutputAdded?.(name2, type); + this.onInputsOutputsChange?.(); + } + /** + * Assign a data to the global output + */ + setOutputData(name2, value4) { + const output = this.outputs[name2]; + if (!output) return; + output.value = value4; + } + /** + * Returns the current value of a global graph output + */ + getOutputData(name2) { + const output = this.outputs[name2]; + if (!output) return null; + return output.value; + } + /** + * Renames a global graph output + */ + renameOutput(old_name, name2) { + if (!this.outputs[old_name]) return false; + if (this.outputs[name2]) { + console.error("there is already one output with that name"); + return false; + } + this.outputs[name2] = this.outputs[old_name]; + delete this.outputs[old_name]; + this._version++; + this.onOutputRenamed?.(old_name, name2); + this.onInputsOutputsChange?.(); + } + /** + * Changes the type of a global graph output + */ + changeOutputType(name2, type) { + if (!this.outputs[name2]) return false; + if (this.outputs[name2].type && String(this.outputs[name2].type).toLowerCase() == String(type).toLowerCase()) { + return; + } + this.outputs[name2].type = type; + this._version++; + this.onOutputTypeChanged?.(name2, type); + } + /** + * Removes a global graph output + */ + removeOutput(name2) { + if (!this.outputs[name2]) return false; + delete this.outputs[name2]; + this._version++; + this.onOutputRemoved?.(name2); + this.onInputsOutputsChange?.(); + return true; + } + /** @todo Clean up - never implemented. */ + triggerInput(name2, value4) { + const nodes = this.findNodesByTitle(name2); + for (let i2 = 0; i2 < nodes.length; ++i2) { + nodes[i2].onTrigger(value4); + } + } + /** @todo Clean up - never implemented. */ + setCallback(name2, func) { + const nodes = this.findNodesByTitle(name2); + for (let i2 = 0; i2 < nodes.length; ++i2) { + nodes[i2].setTrigger(func); + } + } + // used for undo, called before any change is made to the graph + beforeChange(info) { + this.onBeforeChange?.(this, info); + this.canvasAction((c2) => c2.onBeforeChange?.(this)); + } + // used to resend actions, called after any change is made to the graph + afterChange(info) { + this.onAfterChange?.(this, info); + this.canvasAction((c2) => c2.onAfterChange?.(this)); + } + connectionChange(node22) { + this.updateExecutionOrder(); + this.onConnectionChange?.(node22); + this._version++; + this.canvasAction((c2) => c2.onConnectionChange?.()); + } + /** + * clears the triggered slot animation in all links (stop visual animation) + */ + clearTriggeredSlots() { + for (const link_info of this._links.values()) { + if (!link_info) continue; + if (link_info._last_time) link_info._last_time = 0; + } + } + /* Called when something visually changed (not the graph!) */ + change() { + if (LiteGraph.debug) { + console.log("Graph changed"); + } + this.canvasAction((c2) => c2.setDirty(true, true)); + this.on_change?.(this); + } + setDirtyCanvas(fg, bg) { + this.canvasAction((c2) => c2.setDirty(fg, bg)); + } + /** + * Configures a reroute on the graph where ID is already known (probably deserialisation). + * Creates the object if it does not exist. + * @param serialisedReroute See {@link SerialisableReroute} + */ + setReroute({ id: id3, parentId, pos: pos2, linkIds }) { + id3 ??= ++this.state.lastRerouteId; + if (id3 > this.state.lastRerouteId) this.state.lastRerouteId = id3; + const reroute = this.reroutes.get(id3) ?? new Reroute(id3, this); + reroute.update(parentId, pos2, linkIds); + this.reroutes.set(id3, reroute); + return reroute; + } + /** + * Creates a new reroute and adds it to the graph. + * @param pos Position in graph space + * @param before The existing link segment (reroute, link) that will be after this reroute, + * going from the node output to input. + * @returns The newly created reroute - typically ignored. + */ + createReroute(pos2, before) { + const rerouteId = ++this.state.lastRerouteId; + const linkIds = before instanceof Reroute ? before.linkIds : [before.id]; + const reroute = new Reroute(rerouteId, this, pos2, before.parentId, linkIds); + this.reroutes.set(rerouteId, reroute); + for (const linkId of linkIds) { + const link2 = this._links.get(linkId); + if (!link2) continue; + if (link2.parentId === before.parentId) link2.parentId = rerouteId; + LLink.getReroutes(this, link2)?.filter((x2) => x2.parentId === before.parentId).forEach((x2) => x2.parentId = rerouteId); + } + return reroute; + } + /** + * Removes a reroute from the graph + * @param id ID of reroute to remove + */ + removeReroute(id3) { + const { reroutes } = this; + const reroute = reroutes.get(id3); + if (!reroute) return; + const { parentId, linkIds } = reroute; + for (const reroute2 of reroutes.values()) { + if (reroute2.parentId === id3) reroute2.parentId = parentId; + } + for (const linkId of linkIds) { + const link2 = this._links.get(linkId); + if (link2 && link2.parentId === id3) link2.parentId = parentId; + } + reroutes.delete(id3); + this.setDirtyCanvas(false, true); + } + /** + * Destroys a link + */ + removeLink(link_id) { + const link2 = this._links.get(link_id); + if (!link2) return; + const node22 = this.getNodeById(link2.target_id); + node22?.disconnectInput(link2.target_slot); + link2.disconnect(this); + } + /** + * Creates a Object containing all the info about this graph, it can be serialized + * @deprecated Use {@link asSerialisable}, which returns the newer schema version. + * @returns value of the node + */ + serialize(option3) { + const { config: config2, state, groups, nodes, reroutes, extra } = this.asSerialisable(option3); + const linkArray = [...this._links.values()]; + const links = linkArray.map((x2) => x2.serialize()); + if (reroutes.length) { + extra.reroutes = reroutes; + extra.linkExtensions = linkArray.filter((x2) => x2.parentId !== void 0).map((x2) => ({ id: x2.id, parentId: x2.parentId })); + } + return { + last_node_id: state.lastNodeId, + last_link_id: state.lastLinkId, + nodes, + links, + groups, + config: config2, + extra, + version: LiteGraph.VERSION + }; + } + /** + * Prepares a shallow copy of this object for immediate serialisation or structuredCloning. + * The return value should be discarded immediately. + * @param options Serialise options = currently `sortNodes: boolean`, whether to sort nodes by ID. + * @returns A shallow copy of parts of this graph, with shallow copies of its serialisable objects. + * Mutating the properties of the return object may result in changes to your graph. + * It is intended for use with {@link structuredClone} or {@link JSON.stringify}. + */ + asSerialisable(options4) { + const { config: config2, state, extra } = this; + const nodeList = !LiteGraph.use_uuids && options4?.sortNodes ? [...this._nodes].sort((a2, b2) => a2.id - b2.id) : this._nodes; + const nodes = nodeList.map((node22) => node22.serialize()); + const groups = this._groups.map((x2) => x2.serialize()); + const links = [...this._links.values()].map((x2) => x2.asSerialisable()); + const reroutes = [...this.reroutes.values()].map((x2) => x2.asSerialisable()); + const data25 = { + version: LGraph2.serialisedSchemaVersion, + config: config2, + state, + groups, + nodes, + links, + reroutes, + extra + }; + this.onSerialize?.(data25); + return data25; + } + /** + * Configure a graph from a JSON string + * @param data The deserialised object to configure this graph from + * @param keep_old If `true`, the graph will not be cleared prior to + * adding the configuration. + */ + configure(data25, keep_old) { + if (!data25) return; + if (!keep_old) this.clear(); + const { extra } = data25; + let reroutes; + if (data25.version === 0.4) { + if (Array.isArray(data25.links)) { + for (const linkData of data25.links) { + const link2 = LLink.createFromArray(linkData); + this._links.set(link2.id, link2); + } + } + if (Array.isArray(extra?.linkExtensions)) { + for (const linkEx of extra.linkExtensions) { + const link2 = this._links.get(linkEx.id); + if (link2) link2.parentId = linkEx.parentId; + } + } + reroutes = extra?.reroutes; + } else { + if (data25.state) { + const { state: { lastGroupId, lastLinkId, lastNodeId, lastRerouteId } } = data25; + if (lastGroupId != null) this.state.lastGroupId = lastGroupId; + if (lastLinkId != null) this.state.lastLinkId = lastLinkId; + if (lastNodeId != null) this.state.lastNodeId = lastNodeId; + if (lastRerouteId != null) this.state.lastRerouteId = lastRerouteId; + } + if (Array.isArray(data25.links)) { + for (const linkData of data25.links) { + const link2 = LLink.create(linkData); + this._links.set(link2.id, link2); + } + } + reroutes = data25.reroutes; + } + if (Array.isArray(reroutes)) { + for (const rerouteData of reroutes) { + const reroute = this.setReroute(rerouteData); + if (!reroute.validateLinks(this._links)) + this.reroutes.delete(rerouteData.id); + } + } + const nodesData = data25.nodes; + for (const i2 in data25) { + if (i2 == "nodes" || i2 == "groups" || i2 == "links" || i2 === "state" || i2 === "reroutes") + continue; + this[i2] = data25[i2]; + } + let error2 = false; + this._nodes = []; + if (nodesData) { + for (let i2 = 0, l2 = nodesData.length; i2 < l2; ++i2) { + const n_info = nodesData[i2]; + let node22 = LiteGraph.createNode(n_info.type, n_info.title); + if (!node22) { + if (LiteGraph.debug) console.log("Node not found or has errors: " + n_info.type); + node22 = new LGraphNode(void 0); + node22.last_serialization = n_info; + node22.has_errors = true; + error2 = true; + } + node22.id = n_info.id; + this.add(node22, true); + } + for (let i2 = 0, l2 = nodesData.length; i2 < l2; ++i2) { + const n_info = nodesData[i2]; + const node22 = this.getNodeById(n_info.id); + node22?.configure(n_info); + } + } + this._groups.length = 0; + if (data25.groups) { + for (let i2 = 0; i2 < data25.groups.length; ++i2) { + const group = new LiteGraph.LGraphGroup(); + group.configure(data25.groups[i2]); + this.add(group); + } + } + this.updateExecutionOrder(); + this.extra = data25.extra || {}; + this.onConfigure?.(data25); + this._version++; + this.setDirtyCanvas(true, true); + return error2; + } + load(url, callback) { + const that = this; + if (url instanceof Blob || url instanceof File) { + const reader = new FileReader(); + reader.addEventListener("load", function(event) { + const data25 = JSON.parse(event.target.result.toString()); + that.configure(data25); + callback?.(); + }); + reader.readAsText(url); + return; + } + const req = new XMLHttpRequest(); + req.open("GET", url, true); + req.send(null); + req.onload = function() { + if (req.status !== 200) { + console.error("Error loading graph:", req.status, req.response); + return; + } + const data25 = JSON.parse(req.response); + that.configure(data25); + callback?.(); + }; + req.onerror = function(err) { + console.error("Error loading graph:", err); + }; + } + onNodeTrace(node22, msg) { + } +}; +class ContextMenu { + static { + __name(this, "ContextMenu"); + } + options; + parentMenu; + root; + current_submenu; + lock; + /** + * @todo Interface for values requires functionality change - currently accepts + * an array of strings, functions, objects, nulls, or undefined. + * @param values (allows object { title: "Nice text", callback: function ... }) + * @param options [optional] Some options:\ + * - title: title to show on top of the menu + * - callback: function to call when an option is clicked, it receives the item information + * - ignore_item_callbacks: ignores the callback inside the item, it just calls the options.callback + * - event: you can pass a MouseEvent, this way the ContextMenu appears in that position + */ + constructor(values, options4) { + options4 ||= {}; + this.options = options4; + const parent = options4.parentMenu; + if (parent) { + if (!(parent instanceof ContextMenu)) { + console.error("parentMenu must be of class ContextMenu, ignoring it"); + options4.parentMenu = null; + } else { + this.parentMenu = parent; + this.parentMenu.lock = true; + this.parentMenu.current_submenu = this; + } + if (parent.options?.className === "dark") { + options4.className = "dark"; + } + } + const eventClass = options4.event ? options4.event.constructor.name : null; + if (eventClass !== "MouseEvent" && eventClass !== "CustomEvent" && eventClass !== "PointerEvent") { + console.error(`Event passed to ContextMenu is not of type MouseEvent or CustomEvent. Ignoring it. (${eventClass})`); + options4.event = null; + } + const root27 = document.createElement("div"); + let classes2 = "litegraph litecontextmenu litemenubar-panel"; + if (options4.className) classes2 += " " + options4.className; + root27.className = classes2; + root27.style.minWidth = "100"; + root27.style.minHeight = "100"; + root27.style.pointerEvents = "none"; + setTimeout(function() { + root27.style.pointerEvents = "auto"; + }, 100); + LiteGraph.pointerListenerAdd( + root27, + "up", + function(e2) { + e2.preventDefault(); + return true; + }, + true + ); + root27.addEventListener( + "contextmenu", + function(e2) { + if (e2.button != 2) return false; + e2.preventDefault(); + return false; + }, + true + ); + LiteGraph.pointerListenerAdd( + root27, + "down", + (e2) => { + if (e2.button == 2) { + this.close(); + e2.preventDefault(); + return true; + } + }, + true + ); + this.root = root27; + if (options4.title) { + const element = document.createElement("div"); + element.className = "litemenu-title"; + element.innerHTML = options4.title; + root27.appendChild(element); + } + for (let i2 = 0; i2 < values.length; i2++) { + const value4 = values[i2]; + let name2 = Array.isArray(values) ? value4 : String(i2); + if (typeof name2 !== "string") { + name2 = name2 != null ? name2.content === void 0 ? String(name2) : name2.content : name2; + } + this.addItem(name2, value4, options4); + } + LiteGraph.pointerListenerAdd(root27, "enter", function() { + if (root27.closing_timer) { + clearTimeout(root27.closing_timer); + } + }); + const ownerDocument = (options4.event?.target).ownerDocument; + const root_document = ownerDocument || document; + if (root_document.fullscreenElement) + root_document.fullscreenElement.appendChild(root27); + else + root_document.body.appendChild(root27); + let left = options4.left || 0; + let top = options4.top || 0; + if (options4.event) { + left = options4.event.clientX - 10; + top = options4.event.clientY - 10; + if (options4.title) top -= 20; + if (parent) { + const rect = parent.root.getBoundingClientRect(); + left = rect.left + rect.width; + } + const body_rect = document.body.getBoundingClientRect(); + const root_rect = root27.getBoundingClientRect(); + if (body_rect.height == 0) + console.error("document.body height is 0. That is dangerous, set html,body { height: 100%; }"); + if (body_rect.width && left > body_rect.width - root_rect.width - 10) + left = body_rect.width - root_rect.width - 10; + if (body_rect.height && top > body_rect.height - root_rect.height - 10) + top = body_rect.height - root_rect.height - 10; + } + root27.style.left = left + "px"; + root27.style.top = top + "px"; + if (options4.scale) root27.style.transform = `scale(${Math.round(options4.scale * 4) * 0.25})`; + } + addItem(name2, value4, options4) { + options4 ||= {}; + const element = document.createElement("div"); + element.className = "litemenu-entry submenu"; + let disabled2 = false; + if (value4 === null) { + element.classList.add("separator"); + } else { + if (typeof value4 === "string") { + element.innerHTML = name2; + } else { + element.innerHTML = value4?.title ?? name2; + if (value4.disabled) { + disabled2 = true; + element.classList.add("disabled"); + element.setAttribute("aria-disabled", "true"); + } + if (value4.submenu || value4.has_submenu) { + element.classList.add("has_submenu"); + element.setAttribute("aria-haspopup", "true"); + element.setAttribute("aria-expanded", "false"); + } + if (value4.className) element.className += " " + value4.className; + } + element.value = value4; + element.setAttribute("role", "menuitem"); + if (typeof value4 === "function") { + element.dataset["value"] = name2; + element.onclick_callback = value4; + } else { + element.dataset["value"] = String(value4); + } + } + this.root.appendChild(element); + if (!disabled2) element.addEventListener("click", inner_onclick); + if (!disabled2 && options4.autoopen) + LiteGraph.pointerListenerAdd(element, "enter", inner_over); + const setAriaExpanded = /* @__PURE__ */ __name(() => { + const entries = this.root.querySelectorAll("div.litemenu-entry.has_submenu"); + if (entries) { + for (let i2 = 0; i2 < entries.length; i2++) { + entries[i2].setAttribute("aria-expanded", "false"); + } + } + element.setAttribute("aria-expanded", "true"); + }, "setAriaExpanded"); + function inner_over(e2) { + const value22 = this.value; + if (!value22 || !value22.has_submenu) return; + inner_onclick.call(this, e2); + setAriaExpanded(); + } + __name(inner_over, "inner_over"); + const that = this; + function inner_onclick(e2) { + const value22 = this.value; + let close_parent = true; + that.current_submenu?.close(e2); + if (value22?.has_submenu || value22?.submenu) { + setAriaExpanded(); + } + if (options4.callback) { + const r2 = options4.callback.call( + this, + value22, + options4, + e2, + that, + options4.node + ); + if (r2 === true) close_parent = false; + } + if (typeof value22 === "object") { + if (value22.callback && !options4.ignore_item_callbacks && value22.disabled !== true) { + const r2 = value22.callback.call( + this, + value22, + options4, + e2, + that, + options4.extra + ); + if (r2 === true) close_parent = false; + } + if (value22.submenu) { + if (!value22.submenu.options) throw "ContextMenu submenu needs options"; + new that.constructor(value22.submenu.options, { + callback: value22.submenu.callback, + event: e2, + parentMenu: that, + ignore_item_callbacks: value22.submenu.ignore_item_callbacks, + title: value22.submenu.title, + extra: value22.submenu.extra, + autoopen: options4.autoopen + }); + close_parent = false; + } + } + if (close_parent && !that.lock) that.close(); + } + __name(inner_onclick, "inner_onclick"); + return element; + } + close(e2, ignore_parent_menu) { + this.root.remove(); + if (this.parentMenu && !ignore_parent_menu) { + this.parentMenu.lock = false; + this.parentMenu.current_submenu = null; + if (e2 === void 0) { + this.parentMenu.close(); + } else if (e2 && !ContextMenu.isCursorOverElement(e2, this.parentMenu.root)) { + ContextMenu.trigger( + this.parentMenu.root, + LiteGraph.pointerevents_method + "leave", + e2 + ); + } + } + this.current_submenu?.close(e2, true); + if (this.root.closing_timer) clearTimeout(this.root.closing_timer); + } + // this code is used to trigger events easily (used in the context menu mouseleave + static trigger(element, event_name, params, origin2) { + const evt = document.createEvent("CustomEvent"); + evt.initCustomEvent(event_name, true, true, params); + if (element.dispatchEvent) element.dispatchEvent(evt); + else if (element.__events) element.__events.dispatchEvent(evt); + return evt; + } + // returns the top most menu + getTopMenu() { + return this.options.parentMenu ? this.options.parentMenu.getTopMenu() : this; + } + getFirstEvent() { + return this.options.parentMenu ? this.options.parentMenu.getFirstEvent() : this.options.event; + } + static isCursorOverElement(event, element) { + const left = event.clientX; + const top = event.clientY; + const rect = element.getBoundingClientRect(); + if (!rect) return false; + if (top > rect.top && top < rect.top + rect.height && left > rect.left && left < rect.left + rect.width) { + return true; + } + return false; + } +} +class CurveEditor { + static { + __name(this, "CurveEditor"); + } + points; + selected; + nearest; + size; + must_update; + margin; + _nearest; + constructor(points) { + this.points = points; + this.selected = -1; + this.nearest = -1; + this.size = null; + this.must_update = true; + this.margin = 5; + } + static sampleCurve(f2, points) { + if (!points) return; + for (let i2 = 0; i2 < points.length - 1; ++i2) { + const p2 = points[i2]; + const pn = points[i2 + 1]; + if (pn[0] < f2) continue; + const r2 = pn[0] - p2[0]; + if (Math.abs(r2) < 1e-5) return p2[1]; + const local_f = (f2 - p2[0]) / r2; + return p2[1] * (1 - local_f) + pn[1] * local_f; + } + return 0; + } + draw(ctx, size2, graphcanvas, background_color, line_color, inactive = false) { + const points = this.points; + if (!points) return; + this.size = size2; + const w2 = size2[0] - this.margin * 2; + const h2 = size2[1] - this.margin * 2; + line_color = line_color || "#666"; + ctx.save(); + ctx.translate(this.margin, this.margin); + if (background_color) { + ctx.fillStyle = "#111"; + ctx.fillRect(0, 0, w2, h2); + ctx.fillStyle = "#222"; + ctx.fillRect(w2 * 0.5, 0, 1, h2); + ctx.strokeStyle = "#333"; + ctx.strokeRect(0, 0, w2, h2); + } + ctx.strokeStyle = line_color; + if (inactive) ctx.globalAlpha = 0.5; + ctx.beginPath(); + for (let i2 = 0; i2 < points.length; ++i2) { + const p2 = points[i2]; + ctx.lineTo(p2[0] * w2, (1 - p2[1]) * h2); + } + ctx.stroke(); + ctx.globalAlpha = 1; + if (!inactive) + for (let i2 = 0; i2 < points.length; ++i2) { + const p2 = points[i2]; + ctx.fillStyle = this.selected == i2 ? "#FFF" : this.nearest == i2 ? "#DDD" : "#AAA"; + ctx.beginPath(); + ctx.arc(p2[0] * w2, (1 - p2[1]) * h2, 2, 0, Math.PI * 2); + ctx.fill(); + } + ctx.restore(); + } + // localpos is mouse in curve editor space + onMouseDown(localpos, graphcanvas) { + const points = this.points; + if (!points) return; + if (localpos[1] < 0) return; + const w2 = this.size[0] - this.margin * 2; + const h2 = this.size[1] - this.margin * 2; + const x2 = localpos[0] - this.margin; + const y2 = localpos[1] - this.margin; + const pos2 = [x2, y2]; + const max_dist = 30 / graphcanvas.ds.scale; + this.selected = this.getCloserPoint(pos2, max_dist); + if (this.selected == -1) { + const point = [x2 / w2, 1 - y2 / h2]; + points.push(point); + points.sort(function(a2, b2) { + return a2[0] - b2[0]; + }); + this.selected = points.indexOf(point); + this.must_update = true; + } + if (this.selected != -1) return true; + } + onMouseMove(localpos, graphcanvas) { + const points = this.points; + if (!points) return; + const s2 = this.selected; + if (s2 < 0) return; + const x2 = (localpos[0] - this.margin) / (this.size[0] - this.margin * 2); + const y2 = (localpos[1] - this.margin) / (this.size[1] - this.margin * 2); + const curvepos = [ + localpos[0] - this.margin, + localpos[1] - this.margin + ]; + const max_dist = 30 / graphcanvas.ds.scale; + this._nearest = this.getCloserPoint(curvepos, max_dist); + const point = points[s2]; + if (point) { + const is_edge_point = s2 == 0 || s2 == points.length - 1; + if (!is_edge_point && (localpos[0] < -10 || localpos[0] > this.size[0] + 10 || localpos[1] < -10 || localpos[1] > this.size[1] + 10)) { + points.splice(s2, 1); + this.selected = -1; + return; + } + if (!is_edge_point) point[0] = clamp$1(x2, 0, 1); + else point[0] = s2 == 0 ? 0 : 1; + point[1] = 1 - clamp$1(y2, 0, 1); + points.sort(function(a2, b2) { + return a2[0] - b2[0]; + }); + this.selected = points.indexOf(point); + this.must_update = true; + } + } + // Former params: localpos, graphcanvas + onMouseUp() { + this.selected = -1; + return false; + } + getCloserPoint(pos2, max_dist) { + const points = this.points; + if (!points) return -1; + max_dist = max_dist || 30; + const w2 = this.size[0] - this.margin * 2; + const h2 = this.size[1] - this.margin * 2; + const num = points.length; + const p2 = [0, 0]; + let min_dist = 1e6; + let closest = -1; + for (let i2 = 0; i2 < num; ++i2) { + const p3 = points[i2]; + p2[0] = p3[0] * w2; + p2[1] = (1 - p3[1]) * h2; + const dist3 = distance(pos2, p2); + if (dist3 > min_dist || dist3 > max_dist) continue; + closest = i2; + min_dist = dist3; + } + return closest; + } +} +class LiteGraphGlobal { + static { + __name(this, "LiteGraphGlobal"); + } + // Enums + SlotShape = SlotShape; + SlotDirection = SlotDirection; + SlotType = SlotType; + LabelPosition = LabelPosition; + /** Used in serialised graphs at one point. */ + VERSION = 0.4; + CANVAS_GRID_SIZE = 10; + NODE_TITLE_HEIGHT = 30; + NODE_TITLE_TEXT_Y = 20; + NODE_SLOT_HEIGHT = 20; + NODE_WIDGET_HEIGHT = 20; + NODE_WIDTH = 140; + NODE_MIN_WIDTH = 50; + NODE_COLLAPSED_RADIUS = 10; + NODE_COLLAPSED_WIDTH = 80; + NODE_TITLE_COLOR = "#999"; + NODE_SELECTED_TITLE_COLOR = "#FFF"; + NODE_TEXT_SIZE = 14; + NODE_TEXT_COLOR = "#AAA"; + NODE_TEXT_HIGHLIGHT_COLOR = "#EEE"; + NODE_SUBTEXT_SIZE = 12; + NODE_DEFAULT_COLOR = "#333"; + NODE_DEFAULT_BGCOLOR = "#353535"; + NODE_DEFAULT_BOXCOLOR = "#666"; + NODE_DEFAULT_SHAPE = RenderShape.ROUND; + NODE_BOX_OUTLINE_COLOR = "#FFF"; + NODE_ERROR_COLOUR = "#E00"; + DEFAULT_SHADOW_COLOR = "rgba(0,0,0,0.5)"; + DEFAULT_GROUP_FONT = 24; + DEFAULT_GROUP_FONT_SIZE; + WIDGET_BGCOLOR = "#222"; + WIDGET_OUTLINE_COLOR = "#666"; + WIDGET_ADVANCED_OUTLINE_COLOR = "rgba(56, 139, 253, 0.8)"; + WIDGET_TEXT_COLOR = "#DDD"; + WIDGET_SECONDARY_TEXT_COLOR = "#999"; + LINK_COLOR = "#9A9"; + // TODO: This is a workaround until LGraphCanvas.link_type_colors is no longer static. + static DEFAULT_EVENT_LINK_COLOR = "#A86"; + EVENT_LINK_COLOR = "#A86"; + CONNECTING_LINK_COLOR = "#AFA"; + /** avoid infinite loops */ + MAX_NUMBER_OF_NODES = 1e4; + /** default node position */ + DEFAULT_POSITION = [100, 100]; + /** ,"circle" */ + VALID_SHAPES = ["default", "box", "round", "card"]; + // shapes are used for nodes but also for slots + BOX_SHAPE = RenderShape.BOX; + ROUND_SHAPE = RenderShape.ROUND; + CIRCLE_SHAPE = RenderShape.CIRCLE; + CARD_SHAPE = RenderShape.CARD; + ARROW_SHAPE = RenderShape.ARROW; + /** intended for slot arrays */ + GRID_SHAPE = RenderShape.GRID; + // enums + INPUT = NodeSlotType.INPUT; + OUTPUT = NodeSlotType.OUTPUT; + // TODO: -1 can lead to ambiguity in JS; these should be updated to a more explicit constant or Symbol. + /** for outputs */ + EVENT = -1; + /** for inputs */ + ACTION = -1; + /** helper, will add "On Request" and more in the future */ + NODE_MODES = ["Always", "On Event", "Never", "On Trigger"]; + /** use with node_box_coloured_by_mode */ + NODE_MODES_COLORS = ["#666", "#422", "#333", "#224", "#626"]; + ALWAYS = LGraphEventMode.ALWAYS; + ON_EVENT = LGraphEventMode.ON_EVENT; + NEVER = LGraphEventMode.NEVER; + ON_TRIGGER = LGraphEventMode.ON_TRIGGER; + UP = LinkDirection.UP; + DOWN = LinkDirection.DOWN; + LEFT = LinkDirection.LEFT; + RIGHT = LinkDirection.RIGHT; + CENTER = LinkDirection.CENTER; + /** helper */ + LINK_RENDER_MODES = ["Straight", "Linear", "Spline"]; + HIDDEN_LINK = LinkRenderType.HIDDEN_LINK; + STRAIGHT_LINK = LinkRenderType.STRAIGHT_LINK; + LINEAR_LINK = LinkRenderType.LINEAR_LINK; + SPLINE_LINK = LinkRenderType.SPLINE_LINK; + NORMAL_TITLE = TitleMode.NORMAL_TITLE; + NO_TITLE = TitleMode.NO_TITLE; + TRANSPARENT_TITLE = TitleMode.TRANSPARENT_TITLE; + AUTOHIDE_TITLE = TitleMode.AUTOHIDE_TITLE; + /** arrange nodes vertically */ + VERTICAL_LAYOUT = "vertical"; + /** used to redirect calls */ + proxy = null; + node_images_path = ""; + debug = false; + catch_exceptions = true; + throw_errors = true; + allow_scripts = false; + // if set to true some nodes like Formula would be allowed to evaluate code that comes from unsafe sources (like node configuration), which could lead to exploits + /** nodetypes by string */ + registered_node_types = {}; + /** used for dropping files in the canvas */ + node_types_by_file_extension = {}; + /** node types by classname */ + Nodes = {}; + /** used to store vars between graphs */ + Globals = {}; + /** used to add extra features to the search box */ + searchbox_extras = {}; + /** [true!] If set to true, will automatically sort node types / categories in the context menus */ + auto_sort_node_types = false; + /** [true!] this make the nodes box (top left circle) coloured when triggered (execute/action), visual feedback */ + node_box_coloured_when_on = false; + /** [true!] nodebox based on node mode, visual feedback */ + node_box_coloured_by_mode = false; + /** [false on mobile] better true if not touch device, TODO add an helper/listener to close if false */ + dialog_close_on_mouse_leave = false; + dialog_close_on_mouse_leave_delay = 500; + /** [false!] prefer false if results too easy to break links - implement with ALT or TODO custom keys */ + shift_click_do_break_link_from = false; + /** [false!]prefer false, way too easy to break links */ + click_do_break_link_to = false; + /** [true!] who accidentally ctrl-alt-clicks on an in/output? nobody! that's who! */ + ctrl_alt_click_do_break_link = true; + /** [true!] snaps links when dragging connections over valid targets */ + snaps_for_comfy = true; + /** [true!] renders a partial border to highlight when a dragged link is snapped to a node */ + snap_highlights_node = true; + /** + * If `true`, items always snap to the grid - modifier keys are ignored. + * When {@link snapToGrid} is falsy, a value of `1` is used. + * Default: `false` + */ + alwaysSnapToGrid; + /** + * When set to a positive number, when nodes are moved their positions will + * be rounded to the nearest multiple of this value. Half up. + * Default: `undefined` + * @todo Not implemented - see {@link LiteGraph.CANVAS_GRID_SIZE} + */ + snapToGrid; + /** [false on mobile] better true if not touch device, TODO add an helper/listener to close if false */ + search_hide_on_mouse_leave = true; + /** + * [true!] enable filtering slots type in the search widget + * !requires auto_load_slot_types or manual set registered_slot_[in/out]_types and slot_types_[in/out] + */ + search_filter_enabled = false; + /** [true!] opens the results list when opening the search widget */ + search_show_all_on_open = true; + /** + * [if want false, use true, run, get vars values to be statically set, than disable] + * nodes types and nodeclass association with node types need to be calculated, + * if dont want this, calculate once and set registered_slot_[in/out]_types and slot_types_[in/out] + */ + auto_load_slot_types = false; + // set these values if not using auto_load_slot_types + /** slot types for nodeclass */ + registered_slot_in_types = {}; + /** slot types for nodeclass */ + registered_slot_out_types = {}; + /** slot types IN */ + slot_types_in = []; + /** slot types OUT */ + slot_types_out = []; + /** + * specify for each IN slot type a(/many) default node(s), use single string, array, or object + * (with node, title, parameters, ..) like for search + */ + slot_types_default_in = {}; + /** + * specify for each OUT slot type a(/many) default node(s), use single string, array, or object + * (with node, title, parameters, ..) like for search + */ + slot_types_default_out = {}; + /** [true!] very handy, ALT click to clone and drag the new node */ + alt_drag_do_clone_nodes = false; + /** + * [true!] will create and connect event slots when using action/events connections, + * !WILL CHANGE node mode when using onTrigger (enable mode colors), onExecuted does not need this + */ + do_add_triggers_slots = false; + /** [false!] being events, it is strongly reccomended to use them sequentially, one by one */ + allow_multi_output_for_events = true; + /** [true!] allows to create and connect a ndoe clicking with the third button (wheel) */ + middle_click_slot_add_default_node = false; + /** [true!] dragging a link to empty space will open a menu, add from list, search or defaults */ + release_link_on_empty_shows_menu = false; + /** "mouse"|"pointer" use mouse for retrocompatibility issues? (none found @ now) */ + pointerevents_method = "pointer"; + /** + * [true!] allows ctrl + shift + v to paste nodes with the outputs of the unselected nodes connected + * with the inputs of the newly pasted nodes + */ + ctrl_shift_v_paste_connect_unselected_outputs = true; + // if true, all newly created nodes/links will use string UUIDs for their id fields instead of integers. + // use this if you must have node IDs that are unique across all graphs and subgraphs. + use_uuids = false; + // Whether to highlight the bounding box of selected groups + highlight_selected_group = true; + /** If `true`, the old "eye-melting-red" error indicator will be used for nodes */ + use_legacy_node_error_indicator = false; + // TODO: Remove legacy accessors + LGraph = LGraph$1; + LLink = LLink; + LGraphNode = LGraphNode; + LGraphGroup = LGraphGroup; + DragAndScale = DragAndScale; + LGraphCanvas = LGraphCanvas; + ContextMenu = ContextMenu; + CurveEditor = CurveEditor; + Reroute = Reroute; + static { + LGraphCanvas.link_type_colors = { + "-1": LiteGraphGlobal.DEFAULT_EVENT_LINK_COLOR, + "number": "#AAA", + "node": "#DCA" + }; + } + constructor() { + if (typeof performance != "undefined") { + this.getTime = performance.now.bind(performance); + } else if (typeof Date != "undefined" && Date.now) { + this.getTime = Date.now.bind(Date); + } else if (typeof process != "undefined") { + this.getTime = function() { + const t2 = process.hrtime(); + return t2[0] * 1e-3 + t2[1] * 1e-6; + }; + } else { + this.getTime = function() { + return (/* @__PURE__ */ new Date()).getTime(); + }; + } + } + /** + * Register a node class so it can be listed when the user wants to create a new one + * @param type name of the node and path + * @param base_class class containing the structure of a node + */ + registerNodeType(type, base_class) { + if (!base_class.prototype) + throw "Cannot register a simple object, it must be a class with a prototype"; + base_class.type = type; + if (this.debug) console.log("Node registered: " + type); + const classname = base_class.name; + const pos2 = type.lastIndexOf("/"); + base_class.category = type.substring(0, pos2); + base_class.title ||= classname; + for (const i2 in LGraphNode.prototype) { + base_class.prototype[i2] ||= LGraphNode.prototype[i2]; + } + const prev2 = this.registered_node_types[type]; + if (prev2) { + console.log("replacing node type: " + type); + } + if (!Object.prototype.hasOwnProperty.call(base_class.prototype, "shape")) { + Object.defineProperty(base_class.prototype, "shape", { + set(v2) { + switch (v2) { + case "default": + delete this._shape; + break; + case "box": + this._shape = RenderShape.BOX; + break; + case "round": + this._shape = RenderShape.ROUND; + break; + case "circle": + this._shape = RenderShape.CIRCLE; + break; + case "card": + this._shape = RenderShape.CARD; + break; + default: + this._shape = v2; + } + }, + get() { + return this._shape; + }, + enumerable: true, + configurable: true + }); + if (base_class.supported_extensions) { + for (const i2 in base_class.supported_extensions) { + const ext = base_class.supported_extensions[i2]; + if (ext && typeof ext === "string") { + this.node_types_by_file_extension[ext.toLowerCase()] = base_class; + } + } + } + } + this.registered_node_types[type] = base_class; + if (base_class.constructor.name) this.Nodes[classname] = base_class; + this.onNodeTypeRegistered?.(type, base_class); + if (prev2) this.onNodeTypeReplaced?.(type, base_class, prev2); + if (base_class.prototype.onPropertyChange) + console.warn(`LiteGraph node class ${type} has onPropertyChange method, it must be called onPropertyChanged with d at the end`); + if (this.auto_load_slot_types) new base_class(base_class.title || "tmpnode"); + } + /** + * removes a node type from the system + * @param type name of the node or the node constructor itself + */ + unregisterNodeType(type) { + const base_class = typeof type === "string" ? this.registered_node_types[type] : type; + if (!base_class) throw "node type not found: " + type; + delete this.registered_node_types[base_class.type]; + const name2 = base_class.constructor.name; + if (name2) delete this.Nodes[name2]; + } + /** + * Save a slot type and his node + * @param type name of the node or the node constructor itself + * @param slot_type name of the slot type (variable type), eg. string, number, array, boolean, .. + */ + registerNodeAndSlotType(type, slot_type, out) { + out ||= false; + const base_class = typeof type === "string" && this.registered_node_types[type] !== "anonymous" ? this.registered_node_types[type] : type; + const class_type = base_class.constructor.type; + let allTypes = []; + if (typeof slot_type === "string") { + allTypes = slot_type.split(","); + } else if (slot_type == this.EVENT || slot_type == this.ACTION) { + allTypes = ["_event_"]; + } else { + allTypes = ["*"]; + } + for (let i2 = 0; i2 < allTypes.length; ++i2) { + let slotType = allTypes[i2]; + if (slotType === "") slotType = "*"; + const registerTo = out ? "registered_slot_out_types" : "registered_slot_in_types"; + if (this[registerTo][slotType] === void 0) + this[registerTo][slotType] = { nodes: [] }; + if (!this[registerTo][slotType].nodes.includes(class_type)) + this[registerTo][slotType].nodes.push(class_type); + const types = out ? this.slot_types_out : this.slot_types_in; + if (!types.includes(slotType.toLowerCase())) { + types.push(slotType.toLowerCase()); + types.sort(); + } + } + } + /** + * Create a new nodetype by passing a function, it wraps it with a proper class and + * generates inputs according to the parameters of the function. + * Useful to wrap simple methods that do not require properties, and that only process some input to generate an output. + * @param name node name with namespace (p.e.: 'math/sum') + * @param func + * @param param_types [optional] an array containing the type of every parameter, + * otherwise parameters will accept any type + * @param return_type [optional] string with the return type, otherwise it will be generic + * @param properties [optional] properties to be configurable + */ + wrapFunctionAsNode(name2, func, param_types, return_type, properties) { + const params = Array(func.length); + let code2 = ""; + const names = this.getParameterNames(func); + for (let i2 = 0; i2 < names.length; ++i2) { + code2 += `this.addInput('${names[i2]}',${param_types && param_types[i2] ? `'${param_types[i2]}'` : "0"}); +`; + } + code2 += `this.addOutput('out',${return_type ? `'${return_type}'` : 0}); +`; + if (properties) code2 += `this.properties = ${JSON.stringify(properties)}; +`; + const classobj = Function(code2); + classobj.title = name2.split("/").pop(); + classobj.desc = "Generated from " + func.name; + classobj.prototype.onExecute = /* @__PURE__ */ __name(function onExecute() { + for (let i2 = 0; i2 < params.length; ++i2) { + params[i2] = this.getInputData(i2); + } + const r2 = func.apply(this, params); + this.setOutputData(0, r2); + }, "onExecute"); + this.registerNodeType(name2, classobj); + } + /** + * Removes all previously registered node's types + */ + clearRegisteredTypes() { + this.registered_node_types = {}; + this.node_types_by_file_extension = {}; + this.Nodes = {}; + this.searchbox_extras = {}; + } + /** + * Adds this method to all nodetypes, existing and to be created + * (You can add it to LGraphNode.prototype but then existing node types wont have it) + */ + // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type + addNodeMethod(name2, func) { + LGraphNode.prototype[name2] = func; + for (const i2 in this.registered_node_types) { + const type = this.registered_node_types[i2]; + if (type.prototype[name2]) type.prototype["_" + name2] = type.prototype[name2]; + type.prototype[name2] = func; + } + } + /** + * Create a node of a given type with a name. The node is not attached to any graph yet. + * @param type full name of the node class. p.e. "math/sin" + * @param title a name to distinguish from other nodes + * @param options to set options + */ + createNode(type, title, options4) { + const base_class = this.registered_node_types[type]; + if (!base_class) { + if (this.debug) console.log(`GraphNode type "${type}" not registered.`); + return null; + } + title = title || base_class.title || type; + let node22 = null; + if (this.catch_exceptions) { + try { + node22 = new base_class(title); + } catch (err) { + console.error(err); + return null; + } + } else { + node22 = new base_class(title); + } + node22.type = type; + if (!node22.title && title) node22.title = title; + node22.properties ||= {}; + node22.properties_info ||= []; + node22.flags ||= {}; + node22.size ||= node22.computeSize(); + node22.pos ||= this.DEFAULT_POSITION.concat(); + node22.mode ||= LGraphEventMode.ALWAYS; + if (options4) { + for (const i2 in options4) { + node22[i2] = options4[i2]; + } + } + node22.onNodeCreated?.(); + return node22; + } + /** + * Returns a registered node type with a given name + * @param type full name of the node class. p.e. "math/sin" + * @returns the node class + */ + getNodeType(type) { + return this.registered_node_types[type]; + } + /** + * Returns a list of node types matching one category + * @param category category name + * @returns array with all the node classes + */ + getNodeTypesInCategory(category, filter4) { + const r2 = []; + for (const i2 in this.registered_node_types) { + const type = this.registered_node_types[i2]; + if (type.filter != filter4) continue; + if (category == "") { + if (type.category == null) r2.push(type); + } else if (type.category == category) { + r2.push(type); + } + } + if (this.auto_sort_node_types) { + r2.sort(function(a2, b2) { + return a2.title.localeCompare(b2.title); + }); + } + return r2; + } + /** + * Returns a list with all the node type categories + * @param filter only nodes with ctor.filter equal can be shown + * @returns array with all the names of the categories + */ + getNodeTypesCategories(filter4) { + const categories = { "": 1 }; + for (const i2 in this.registered_node_types) { + const type = this.registered_node_types[i2]; + if (type.category && !type.skip_list) { + if (type.filter != filter4) continue; + categories[type.category] = 1; + } + } + const result = []; + for (const i2 in categories) { + result.push(i2); + } + return this.auto_sort_node_types ? result.sort() : result; + } + // debug purposes: reloads all the js scripts that matches a wildcard + reloadNodes(folder_wildcard) { + const tmp = document.getElementsByTagName("script"); + const script_files = []; + for (let i2 = 0; i2 < tmp.length; i2++) { + script_files.push(tmp[i2]); + } + const docHeadObj = document.getElementsByTagName("head")[0]; + folder_wildcard = document.location.href + folder_wildcard; + for (let i2 = 0; i2 < script_files.length; i2++) { + const src = script_files[i2].src; + if (!src || src.substr(0, folder_wildcard.length) != folder_wildcard) + continue; + try { + if (this.debug) console.log("Reloading: " + src); + const dynamicScript = document.createElement("script"); + dynamicScript.type = "text/javascript"; + dynamicScript.src = src; + docHeadObj.appendChild(dynamicScript); + docHeadObj.removeChild(script_files[i2]); + } catch (err) { + if (this.throw_errors) throw err; + if (this.debug) console.log("Error while reloading " + src); + } + } + if (this.debug) console.log("Nodes reloaded"); + } + // separated just to improve if it doesn't work + cloneObject(obj, target) { + if (obj == null) return null; + const r2 = JSON.parse(JSON.stringify(obj)); + if (!target) return r2; + for (const i2 in r2) { + target[i2] = r2[i2]; + } + return target; + } + /* + * https://gist.github.com/jed/982883?permalink_comment_id=852670#gistcomment-852670 + */ + uuidv4() { + return ("10000000-1000-4000-8000" + -1e11).replace(/[018]/g, (a2) => (a2 ^ Math.random() * 16 >> a2 / 4).toString(16)); + } + /** + * Returns if the types of two slots are compatible (taking into account wildcards, etc) + * @param type_a output + * @param type_b input + * @returns true if they can be connected + */ + isValidConnection(type_a, type_b) { + if (type_a == "" || type_a === "*") type_a = 0; + if (type_b == "" || type_b === "*") type_b = 0; + if (!type_a || !type_b || type_a == type_b || type_a == this.EVENT && type_b == this.ACTION) + return true; + type_a = String(type_a); + type_b = String(type_b); + type_a = type_a.toLowerCase(); + type_b = type_b.toLowerCase(); + if (type_a.indexOf(",") == -1 && type_b.indexOf(",") == -1) + return type_a == type_b; + const supported_types_a = type_a.split(","); + const supported_types_b = type_b.split(","); + for (let i2 = 0; i2 < supported_types_a.length; ++i2) { + for (let j2 = 0; j2 < supported_types_b.length; ++j2) { + if (this.isValidConnection(supported_types_a[i2], supported_types_b[j2])) + return true; + } + } + return false; + } + /** + * Register a string in the search box so when the user types it it will recommend this node + * @param node_type the node recommended + * @param description text to show next to it + * @param data it could contain info of how the node should be configured + */ + registerSearchboxExtra(node_type, description, data25) { + this.searchbox_extras[description.toLowerCase()] = { + type: node_type, + desc: description, + data: data25 + }; + } + /** + * Wrapper to load files (from url using fetch or from file using FileReader) + * @param url the url of the file (or the file itself) + * @param type an string to know how to fetch it: "text","arraybuffer","json","blob" + * @param on_complete callback(data) + * @param on_error in case of an error + * @returns returns the object used to + */ + fetchFile(url, type, on_complete, on_error) { + if (!url) return null; + type = type || "text"; + if (typeof url === "string") { + if (url.substr(0, 4) == "http" && this.proxy) + url = this.proxy + url.substr(url.indexOf(":") + 3); + return fetch(url).then(function(response) { + if (!response.ok) + throw new Error("File not found"); + if (type == "arraybuffer") + return response.arrayBuffer(); + else if (type == "text" || type == "string") + return response.text(); + else if (type == "json") + return response.json(); + else if (type == "blob") + return response.blob(); + }).then(function(data25) { + on_complete?.(data25); + }).catch(function(error2) { + console.error("error fetching file:", url); + on_error?.(error2); + }); + } else if (url instanceof File || url instanceof Blob) { + const reader = new FileReader(); + reader.onload = function(e2) { + let v2 = e2.target.result; + if (type == "json") + v2 = JSON.parse(v2); + on_complete?.(v2); + }; + if (type == "arraybuffer") + return reader.readAsArrayBuffer(url); + else if (type == "text" || type == "json") + return reader.readAsText(url); + else if (type == "blob") + return reader.readAsBinaryString(url); + } + return null; + } + // used to create nodes from wrapping functions + getParameterNames(func) { + return (func + "").replace(/[/][/].*$/gm, "").replace(/\s+/g, "").replace(/[/][*][^/*]*[*][/]/g, "").split("){", 1)[0].replace(/^[^(]*[(]/, "").replace(/=[^,]+/g, "").split(",").filter(Boolean); + } + /* helper for interaction: pointer, touch, mouse Listeners + used by LGraphCanvas DragAndScale ContextMenu */ + pointerListenerAdd(oDOM, sEvIn, fCall, capture = false) { + if (!oDOM || !oDOM.addEventListener || !sEvIn || typeof fCall !== "function") return; + let sMethod = this.pointerevents_method; + let sEvent = sEvIn; + if (sMethod == "pointer" && !window.PointerEvent) { + console.warn("sMethod=='pointer' && !window.PointerEvent"); + console.log("Converting pointer[" + sEvent + "] : down move up cancel enter TO touchstart touchmove touchend, etc .."); + switch (sEvent) { + case "down": { + sMethod = "touch"; + sEvent = "start"; + break; + } + case "move": { + sMethod = "touch"; + break; + } + case "up": { + sMethod = "touch"; + sEvent = "end"; + break; + } + case "cancel": { + sMethod = "touch"; + break; + } + case "enter": { + console.log("debug: Should I send a move event?"); + break; + } + default: { + console.warn("PointerEvent not available in this browser ? The event " + sEvent + " would not be called"); + } + } + } + switch (sEvent) { + case "down": + case "up": + case "move": + case "over": + case "out": + case "enter": { + oDOM.addEventListener(sMethod + sEvent, fCall, capture); + } + case "leave": + case "cancel": + case "gotpointercapture": + case "lostpointercapture": { + if (sMethod != "mouse") { + return oDOM.addEventListener(sMethod + sEvent, fCall, capture); + } + } + default: + return oDOM.addEventListener(sEvent, fCall, capture); + } + } + pointerListenerRemove(oDOM, sEvent, fCall, capture = false) { + if (!oDOM || !oDOM.removeEventListener || !sEvent || typeof fCall !== "function") return; + switch (sEvent) { + case "down": + case "up": + case "move": + case "over": + case "out": + case "enter": { + if (this.pointerevents_method == "pointer" || this.pointerevents_method == "mouse") { + oDOM.removeEventListener(this.pointerevents_method + sEvent, fCall, capture); + } + } + case "leave": + case "cancel": + case "gotpointercapture": + case "lostpointercapture": { + if (this.pointerevents_method == "pointer") { + return oDOM.removeEventListener(this.pointerevents_method + sEvent, fCall, capture); + } + } + default: + return oDOM.removeEventListener(sEvent, fCall, capture); + } + } + getTime; + compareObjects(a2, b2) { + for (const i2 in a2) { + if (a2[i2] != b2[i2]) return false; + } + return true; + } + distance = distance; + colorToString(c2) { + return "rgba(" + Math.round(c2[0] * 255).toFixed() + "," + Math.round(c2[1] * 255).toFixed() + "," + Math.round(c2[2] * 255).toFixed() + "," + (c2.length == 4 ? c2[3].toFixed(2) : "1.0") + ")"; + } + isInsideRectangle = isInsideRectangle; + // [minx,miny,maxx,maxy] + growBounding(bounding, x2, y2) { + if (x2 < bounding[0]) { + bounding[0] = x2; + } else if (x2 > bounding[2]) { + bounding[2] = x2; + } + if (y2 < bounding[1]) { + bounding[1] = y2; + } else if (y2 > bounding[3]) { + bounding[3] = y2; + } + } + overlapBounding = overlapBounding; + // point inside bounding box + isInsideBounding(p2, bb) { + if (p2[0] < bb[0][0] || p2[1] < bb[0][1] || p2[0] > bb[1][0] || p2[1] > bb[1][1]) { + return false; + } + return true; + } + // Convert a hex value to its decimal value - the inputted hex must be in the + // format of a hex triplet - the kind we use for HTML colours. The function + // will return an array with three values. + hex2num(hex) { + if (hex.charAt(0) == "#") { + hex = hex.slice(1); + } + hex = hex.toUpperCase(); + const hex_alphabets = "0123456789ABCDEF"; + const value4 = new Array(3); + let k2 = 0; + let int1, int2; + for (let i2 = 0; i2 < 6; i2 += 2) { + int1 = hex_alphabets.indexOf(hex.charAt(i2)); + int2 = hex_alphabets.indexOf(hex.charAt(i2 + 1)); + value4[k2] = int1 * 16 + int2; + k2++; + } + return value4; + } + // Give a array with three values as the argument and the function will return + // the corresponding hex triplet. + num2hex(triplet) { + const hex_alphabets = "0123456789ABCDEF"; + let hex = "#"; + let int1, int2; + for (let i2 = 0; i2 < 3; i2++) { + int1 = triplet[i2] / 16; + int2 = triplet[i2] % 16; + hex += hex_alphabets.charAt(int1) + hex_alphabets.charAt(int2); + } + return hex; + } + closeAllContextMenus(ref_window) { + ref_window = ref_window || window; + const elements = ref_window.document.querySelectorAll(".litecontextmenu"); + if (!elements.length) return; + const result = []; + for (let i2 = 0; i2 < elements.length; i2++) { + result.push(elements[i2]); + } + for (let i2 = 0; i2 < result.length; i2++) { + if (result[i2].close) { + result[i2].close(); + } else if (result[i2].parentNode) { + result[i2].parentNode.removeChild(result[i2]); + } + } + } + extendClass(target, origin2) { + for (const i2 in origin2) { + if (target.hasOwnProperty(i2)) continue; + target[i2] = origin2[i2]; + } + if (origin2.prototype) { + for (const i2 in origin2.prototype) { + if (!origin2.prototype.hasOwnProperty(i2)) continue; + if (target.prototype.hasOwnProperty(i2)) continue; + if (origin2.prototype.__lookupGetter__(i2)) { + target.prototype.__defineGetter__( + i2, + origin2.prototype.__lookupGetter__(i2) + ); + } else { + target.prototype[i2] = origin2.prototype[i2]; + } + if (origin2.prototype.__lookupSetter__(i2)) { + target.prototype.__defineSetter__( + i2, + origin2.prototype.__lookupSetter__(i2) + ); + } + } + } + } +} +function loadPolyfills() { + if (typeof window != "undefined" && window.CanvasRenderingContext2D && !window.CanvasRenderingContext2D.prototype.roundRect) { + window.CanvasRenderingContext2D.prototype.roundRect = function(x2, y2, w2, h2, radius, radius_low) { + let top_left_radius = 0; + let top_right_radius = 0; + let bottom_left_radius = 0; + let bottom_right_radius = 0; + if (radius === 0) { + this.rect(x2, y2, w2, h2); + return; + } + if (radius_low === void 0) radius_low = radius; + if (radius != null && radius.constructor === Array) { + if (radius.length == 1) + top_left_radius = top_right_radius = bottom_left_radius = bottom_right_radius = radius[0]; + else if (radius.length == 2) { + top_left_radius = bottom_right_radius = radius[0]; + top_right_radius = bottom_left_radius = radius[1]; + } else if (radius.length == 4) { + top_left_radius = radius[0]; + top_right_radius = radius[1]; + bottom_left_radius = radius[2]; + bottom_right_radius = radius[3]; + } else { + return; + } + } else { + top_left_radius = radius || 0; + top_right_radius = radius || 0; + bottom_left_radius = radius_low || 0; + bottom_right_radius = radius_low || 0; + } + this.moveTo(x2 + top_left_radius, y2); + this.lineTo(x2 + w2 - top_right_radius, y2); + this.quadraticCurveTo(x2 + w2, y2, x2 + w2, y2 + top_right_radius); + this.lineTo(x2 + w2, y2 + h2 - bottom_right_radius); + this.quadraticCurveTo( + x2 + w2, + y2 + h2, + x2 + w2 - bottom_right_radius, + y2 + h2 + ); + this.lineTo(x2 + bottom_right_radius, y2 + h2); + this.quadraticCurveTo(x2, y2 + h2, x2, y2 + h2 - bottom_left_radius); + this.lineTo(x2, y2 + bottom_left_radius); + this.quadraticCurveTo(x2, y2, x2 + top_left_radius, y2); + }; + } + if (typeof window != "undefined" && !window["requestAnimationFrame"]) { + window.requestAnimationFrame = // @ts-expect-error Legacy code + window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) { + window.setTimeout(callback, 1e3 / 60); + }; + } +} +__name(loadPolyfills, "loadPolyfills"); +const LiteGraph = new LiteGraphGlobal(); +function clamp$1(v2, a2, b2) { + return a2 > v2 ? a2 : b2 < v2 ? b2 : v2; +} +__name(clamp$1, "clamp$1"); +loadPolyfills(); var util; (function(util2) { util2.assertEqual = (val) => val; @@ -28377,10 +65777,10 @@ var util; return obj; }; util2.getValidEnumValues = (obj) => { - const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number"); + const validKeys = util2.objectKeys(obj).filter((k2) => typeof obj[obj[k2]] !== "number"); const filtered = {}; - for (const k of validKeys) { - filtered[k] = obj[k]; + for (const k2 of validKeys) { + filtered[k2] = obj[k2]; } return util2.objectValues(filtered); }; @@ -28450,15 +65850,15 @@ const ZodParsedType = util.arrayToEnum([ "map", "set" ]); -const getParsedType = /* @__PURE__ */ __name((data24) => { - const t2 = typeof data24; +const getParsedType = /* @__PURE__ */ __name((data25) => { + const t2 = typeof data25; switch (t2) { case "undefined": return ZodParsedType.undefined; case "string": return ZodParsedType.string; case "number": - return isNaN(data24) ? ZodParsedType.nan : ZodParsedType.number; + return isNaN(data25) ? ZodParsedType.nan : ZodParsedType.number; case "boolean": return ZodParsedType.boolean; case "function": @@ -28468,22 +65868,22 @@ const getParsedType = /* @__PURE__ */ __name((data24) => { case "symbol": return ZodParsedType.symbol; case "object": - if (Array.isArray(data24)) { + if (Array.isArray(data25)) { return ZodParsedType.array; } - if (data24 === null) { + if (data25 === null) { return ZodParsedType.null; } - if (data24.then && typeof data24.then === "function" && data24.catch && typeof data24.catch === "function") { + if (data25.then && typeof data25.then === "function" && data25.catch && typeof data25.catch === "function") { return ZodParsedType.promise; } - if (typeof Map !== "undefined" && data24 instanceof Map) { + if (typeof Map !== "undefined" && data25 instanceof Map) { return ZodParsedType.map; } - if (typeof Set !== "undefined" && data24 instanceof Set) { + if (typeof Set !== "undefined" && data25 instanceof Set) { return ZodParsedType.set; } - if (typeof Date !== "undefined" && data24 instanceof Date) { + if (typeof Date !== "undefined" && data25 instanceof Date) { return ZodParsedType.date; } return ZodParsedType.object; @@ -28517,6 +65917,9 @@ class ZodError extends Error { static { __name(this, "ZodError"); } + get errors() { + return this.issues; + } constructor(issues) { super(); this.issues = []; @@ -28535,9 +65938,6 @@ class ZodError extends Error { this.name = "ZodError"; this.issues = issues; } - get errors() { - return this.issues; - } format(_mapper) { const mapper = _mapper || function(issue) { return issue.message; @@ -28717,7 +66117,7 @@ function getErrorMap() { } __name(getErrorMap, "getErrorMap"); const makeIssue = /* @__PURE__ */ __name((params) => { - const { data: data24, path, errorMaps, issueData } = params; + const { data: data25, path, errorMaps, issueData } = params; const fullPath = [...path, ...issueData.path || []]; const fullIssue = { ...issueData, @@ -28731,9 +66131,9 @@ const makeIssue = /* @__PURE__ */ __name((params) => { }; } let errorMessage = ""; - const maps = errorMaps.filter((m) => !!m).slice().reverse(); + const maps = errorMaps.filter((m2) => !!m2).slice().reverse(); for (const map3 of maps) { - errorMessage = map3(fullIssue, { data: data24, defaultError: errorMessage }).message; + errorMessage = map3(fullIssue, { data: data25, defaultError: errorMessage }).message; } return { ...issueData, @@ -28750,8 +66150,11 @@ function addIssueToContext(ctx, issueData) { path: ctx.path, errorMaps: [ ctx.common.contextualErrorMap, + // contextual error map is first priority ctx.schemaErrorMap, + // then schema-bound map if available overrideMap, + // then global override map overrideMap === errorMap$1 ? void 0 : errorMap$1 // then global default map ].filter((x2) => !!x2) @@ -28776,12 +66179,12 @@ class ParseStatus { } static mergeArray(status, results) { const arrayValue = []; - for (const s of results) { - if (s.status === "aborted") + for (const s2 of results) { + if (s2.status === "aborted") return INVALID; - if (s.status === "dirty") + if (s2.status === "dirty") status.dirty(); - arrayValue.push(s.value); + arrayValue.push(s2.value); } return { status: status.value, value: arrayValue }; } @@ -28825,17 +66228,17 @@ const isAborted = /* @__PURE__ */ __name((x2) => x2.status === "aborted", "isAbo const isDirty = /* @__PURE__ */ __name((x2) => x2.status === "dirty", "isDirty"); const isValid = /* @__PURE__ */ __name((x2) => x2.status === "valid", "isValid"); const isAsync = /* @__PURE__ */ __name((x2) => typeof Promise !== "undefined" && x2 instanceof Promise, "isAsync"); -function __classPrivateFieldGet(receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +function __classPrivateFieldGet(receiver, state, kind, f2) { + if (kind === "a" && !f2) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f2 : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f2 : kind === "a" ? f2.call(receiver) : f2 ? f2.value : state.get(receiver); } __name(__classPrivateFieldGet, "__classPrivateFieldGet"); -function __classPrivateFieldSet(receiver, state, value4, kind, f) { +function __classPrivateFieldSet(receiver, state, value4, kind, f2) { if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return kind === "a" ? f.call(receiver, value4) : f ? f.value = value4 : state.set(receiver, value4), value4; + if (kind === "a" && !f2) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f2 : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return kind === "a" ? f2.call(receiver, value4) : f2 ? f2.value = value4 : state.set(receiver, value4), value4; } __name(__classPrivateFieldSet, "__classPrivateFieldSet"); typeof SuppressedError === "function" ? SuppressedError : function(error2, suppressed, message3) { @@ -28918,34 +66321,6 @@ class ZodType { static { __name(this, "ZodType"); } - constructor(def2) { - this.spa = this.safeParseAsync; - this._def = def2; - this.parse = this.parse.bind(this); - this.safeParse = this.safeParse.bind(this); - this.parseAsync = this.parseAsync.bind(this); - this.safeParseAsync = this.safeParseAsync.bind(this); - this.spa = this.spa.bind(this); - this.refine = this.refine.bind(this); - this.refinement = this.refinement.bind(this); - this.superRefine = this.superRefine.bind(this); - this.optional = this.optional.bind(this); - this.nullable = this.nullable.bind(this); - this.nullish = this.nullish.bind(this); - this.array = this.array.bind(this); - this.promise = this.promise.bind(this); - this.or = this.or.bind(this); - this.and = this.and.bind(this); - this.transform = this.transform.bind(this); - this.brand = this.brand.bind(this); - this.default = this.default.bind(this); - this.catch = this.catch.bind(this); - this.describe = this.describe.bind(this); - this.pipe = this.pipe.bind(this); - this.readonly = this.readonly.bind(this); - this.isNullable = this.isNullable.bind(this); - this.isOptional = this.isOptional.bind(this); - } get description() { return this._def.description; } @@ -28986,13 +66361,13 @@ class ZodType { const result = this._parse(input); return Promise.resolve(result); } - parse(data24, params) { - const result = this.safeParse(data24, params); + parse(data25, params) { + const result = this.safeParse(data25, params); if (result.success) return result.data; throw result.error; } - safeParse(data24, params) { + safeParse(data25, params) { var _a2; const ctx = { common: { @@ -29003,19 +66378,56 @@ class ZodType { path: (params === null || params === void 0 ? void 0 : params.path) || [], schemaErrorMap: this._def.errorMap, parent: null, - data: data24, - parsedType: getParsedType(data24) + data: data25, + parsedType: getParsedType(data25) }; - const result = this._parseSync({ data: data24, path: ctx.path, parent: ctx }); + const result = this._parseSync({ data: data25, path: ctx.path, parent: ctx }); return handleResult(ctx, result); } - async parseAsync(data24, params) { - const result = await this.safeParseAsync(data24, params); + "~validate"(data25) { + var _a2, _b; + const ctx = { + common: { + issues: [], + async: !!this["~standard"].async + }, + path: [], + schemaErrorMap: this._def.errorMap, + parent: null, + data: data25, + parsedType: getParsedType(data25) + }; + if (!this["~standard"].async) { + try { + const result = this._parseSync({ data: data25, path: [], parent: ctx }); + return isValid(result) ? { + value: result.value + } : { + issues: ctx.common.issues + }; + } catch (err) { + if ((_b = (_a2 = err === null || err === void 0 ? void 0 : err.message) === null || _a2 === void 0 ? void 0 : _a2.toLowerCase()) === null || _b === void 0 ? void 0 : _b.includes("encountered")) { + this["~standard"].async = true; + } + ctx.common = { + issues: [], + async: true + }; + } + } + return this._parseAsync({ data: data25, path: [], parent: ctx }).then((result) => isValid(result) ? { + value: result.value + } : { + issues: ctx.common.issues + }); + } + async parseAsync(data25, params) { + const result = await this.safeParseAsync(data25, params); if (result.success) return result.data; throw result.error; } - async safeParseAsync(data24, params) { + async safeParseAsync(data25, params) { const ctx = { common: { issues: [], @@ -29025,10 +66437,10 @@ class ZodType { path: (params === null || params === void 0 ? void 0 : params.path) || [], schemaErrorMap: this._def.errorMap, parent: null, - data: data24, - parsedType: getParsedType(data24) + data: data25, + parsedType: getParsedType(data25) }; - const maybeAsyncResult = this._parse({ data: data24, path: ctx.path, parent: ctx }); + const maybeAsyncResult = this._parse({ data: data25, path: ctx.path, parent: ctx }); const result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult)); return handleResult(ctx, result); } @@ -29049,8 +66461,8 @@ class ZodType { ...getIssueProperties(val) }), "setError"); if (typeof Promise !== "undefined" && result instanceof Promise) { - return result.then((data24) => { - if (!data24) { + return result.then((data25) => { + if (!data25) { setError(); return false; } else { @@ -29086,6 +66498,39 @@ class ZodType { superRefine(refinement) { return this._refinement(refinement); } + constructor(def2) { + this.spa = this.safeParseAsync; + this._def = def2; + this.parse = this.parse.bind(this); + this.safeParse = this.safeParse.bind(this); + this.parseAsync = this.parseAsync.bind(this); + this.safeParseAsync = this.safeParseAsync.bind(this); + this.spa = this.spa.bind(this); + this.refine = this.refine.bind(this); + this.refinement = this.refinement.bind(this); + this.superRefine = this.superRefine.bind(this); + this.optional = this.optional.bind(this); + this.nullable = this.nullable.bind(this); + this.nullish = this.nullish.bind(this); + this.array = this.array.bind(this); + this.promise = this.promise.bind(this); + this.or = this.or.bind(this); + this.and = this.and.bind(this); + this.transform = this.transform.bind(this); + this.brand = this.brand.bind(this); + this.default = this.default.bind(this); + this.catch = this.catch.bind(this); + this.describe = this.describe.bind(this); + this.pipe = this.pipe.bind(this); + this.readonly = this.readonly.bind(this); + this.isNullable = this.isNullable.bind(this); + this.isOptional = this.isOptional.bind(this); + this["~standard"] = { + version: 1, + vendor: "zod", + validate: /* @__PURE__ */ __name((data25) => this["~validate"](data25), "validate") + }; + } optional() { return ZodOptional.create(this, this._def); } @@ -29096,7 +66541,7 @@ class ZodType { return this.nullable().optional(); } array() { - return ZodArray.create(this, this._def); + return ZodArray.create(this); } promise() { return ZodPromise.create(this, this._def); @@ -29162,16 +66607,20 @@ class ZodType { } const cuidRegex = /^c[^\s-]{8,}$/i; const cuid2Regex = /^[0-9a-z]+$/; -const ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/; +const ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i; const uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i; const nanoidRegex = /^[a-z0-9_-]{21}$/i; +const jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/; const durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/; const emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i; const _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`; let emojiRegex; const ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/; -const ipv6Regex = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/; +const ipv4CidrRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/; +const ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/; +const ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/; const base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/; +const base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/; const dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`; const dateRegex = new RegExp(`^${dateRegexSource}$`); function timeRegexSource(args) { @@ -29208,6 +66657,35 @@ function isValidIP(ip, version2) { return false; } __name(isValidIP, "isValidIP"); +function isValidJWT(jwt, alg) { + if (!jwtRegex.test(jwt)) + return false; + try { + const [header3] = jwt.split("."); + const base64 = header3.replace(/-/g, "+").replace(/_/g, "/").padEnd(header3.length + (4 - header3.length % 4) % 4, "="); + const decoded = JSON.parse(atob(base64)); + if (typeof decoded !== "object" || decoded === null) + return false; + if (!decoded.typ || !decoded.alg) + return false; + if (alg && decoded.alg !== alg) + return false; + return true; + } catch (_a2) { + return false; + } +} +__name(isValidJWT, "isValidJWT"); +function isValidCidr(ip, version2) { + if ((version2 === "v4" || !version2) && ipv4CidrRegex.test(ip)) { + return true; + } + if ((version2 === "v6" || !version2) && ipv6CidrRegex.test(ip)) { + return true; + } + return false; +} +__name(isValidCidr, "isValidCidr"); class ZodString extends ZodType { static { __name(this, "ZodString"); @@ -29467,6 +66945,26 @@ class ZodString extends ZodType { }); status.dirty(); } + } else if (check.kind === "jwt") { + if (!isValidJWT(input.data, check.alg)) { + ctx = this._getOrReturnCtx(input, ctx); + addIssueToContext(ctx, { + validation: "jwt", + code: ZodIssueCode.invalid_string, + message: check.message + }); + status.dirty(); + } + } else if (check.kind === "cidr") { + if (!isValidCidr(input.data, check.version)) { + ctx = this._getOrReturnCtx(input, ctx); + addIssueToContext(ctx, { + validation: "cidr", + code: ZodIssueCode.invalid_string, + message: check.message + }); + status.dirty(); + } } else if (check.kind === "base64") { if (!base64Regex.test(input.data)) { ctx = this._getOrReturnCtx(input, ctx); @@ -29477,6 +66975,16 @@ class ZodString extends ZodType { }); status.dirty(); } + } else if (check.kind === "base64url") { + if (!base64urlRegex.test(input.data)) { + ctx = this._getOrReturnCtx(input, ctx); + addIssueToContext(ctx, { + validation: "base64url", + code: ZodIssueCode.invalid_string, + message: check.message + }); + status.dirty(); + } } else { util.assertNever(check); } @@ -29484,7 +66992,7 @@ class ZodString extends ZodType { return { status: status.value, value: input.data }; } _regex(regex2, validation, message3) { - return this.refinement((data24) => regex2.test(data24), { + return this.refinement((data25) => regex2.test(data25), { validation, code: ZodIssueCode.invalid_string, ...errorUtil.errToObj(message3) @@ -29523,9 +67031,21 @@ class ZodString extends ZodType { base64(message3) { return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message3) }); } + base64url(message3) { + return this._addCheck({ + kind: "base64url", + ...errorUtil.errToObj(message3) + }); + } + jwt(options4) { + return this._addCheck({ kind: "jwt", ...errorUtil.errToObj(options4) }); + } ip(options4) { return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options4) }); } + cidr(options4) { + return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options4) }); + } datetime(options4) { var _a2, _b; if (typeof options4 === "string") { @@ -29616,8 +67136,7 @@ class ZodString extends ZodType { }); } /** - * @deprecated Use z.string().min(1) instead. - * @see {@link ZodString.min} + * Equivalent to `.min(1)` */ nonempty(message3) { return this.min(1, errorUtil.errToObj(message3)); @@ -29679,9 +67198,15 @@ class ZodString extends ZodType { get isIP() { return !!this._def.checks.find((ch) => ch.kind === "ip"); } + get isCIDR() { + return !!this._def.checks.find((ch) => ch.kind === "cidr"); + } get isBase64() { return !!this._def.checks.find((ch) => ch.kind === "base64"); } + get isBase64url() { + return !!this._def.checks.find((ch) => ch.kind === "base64url"); + } get minLength() { let min = null; for (const ch of this._def.checks) { @@ -29966,17 +67491,15 @@ class ZodBigInt extends ZodType { } _parse(input) { if (this._def.coerce) { - input.data = BigInt(input.data); + try { + input.data = BigInt(input.data); + } catch (_a2) { + return this._getInvalidInput(input); + } } const parsedType = this._getType(input); if (parsedType !== ZodParsedType.bigint) { - const ctx2 = this._getOrReturnCtx(input); - addIssueToContext(ctx2, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.bigint, - received: ctx2.parsedType - }); - return INVALID; + return this._getInvalidInput(input); } let ctx = void 0; const status = new ParseStatus(); @@ -30023,6 +67546,15 @@ class ZodBigInt extends ZodType { } return { status: status.value, value: input.data }; } + _getInvalidInput(input) { + const ctx = this._getOrReturnCtx(input); + addIssueToContext(ctx, { + code: ZodIssueCode.invalid_type, + expected: ZodParsedType.bigint, + received: ctx.parsedType + }); + return INVALID; + } gte(value4, message3) { return this.setLimit("min", value4, true, errorUtil.toString(message3)); } @@ -31093,17 +68625,17 @@ class ZodDiscriminatedUnion extends ZodType { }); } } -function mergeValues(a, b) { - const aType = getParsedType(a); - const bType = getParsedType(b); - if (a === b) { - return { valid: true, data: a }; +function mergeValues(a2, b2) { + const aType = getParsedType(a2); + const bType = getParsedType(b2); + if (a2 === b2) { + return { valid: true, data: a2 }; } else if (aType === ZodParsedType.object && bType === ZodParsedType.object) { - const bKeys = util.objectKeys(b); - const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1); - const newObj = { ...a, ...b }; + const bKeys = util.objectKeys(b2); + const sharedKeys = util.objectKeys(a2).filter((key) => bKeys.indexOf(key) !== -1); + const newObj = { ...a2, ...b2 }; for (const key of sharedKeys) { - const sharedValue = mergeValues(a[key], b[key]); + const sharedValue = mergeValues(a2[key], b2[key]); if (!sharedValue.valid) { return { valid: false }; } @@ -31111,13 +68643,13 @@ function mergeValues(a, b) { } return { valid: true, data: newObj }; } else if (aType === ZodParsedType.array && bType === ZodParsedType.array) { - if (a.length !== b.length) { + if (a2.length !== b2.length) { return { valid: false }; } const newArray = []; - for (let index2 = 0; index2 < a.length; index2++) { - const itemA = a[index2]; - const itemB = b[index2]; + for (let index2 = 0; index2 < a2.length; index2++) { + const itemA = a2[index2]; + const itemB = b2[index2]; const sharedValue = mergeValues(itemA, itemB); if (!sharedValue.valid) { return { valid: false }; @@ -31125,8 +68657,8 @@ function mergeValues(a, b) { newArray.push(sharedValue.data); } return { valid: true, data: newArray }; - } else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) { - return { valid: true, data: a }; + } else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a2 === +b2) { + return { valid: true, data: a2 }; } else { return { valid: false }; } @@ -31784,8 +69316,8 @@ class ZodPromise extends ZodType { return INVALID; } const promisified = ctx.parsedType === ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data); - return OK(promisified.then((data24) => { - return this._def.type.parseAsync(data24, { + return OK(promisified.then((data25) => { + return this._def.type.parseAsync(data25, { path: ctx.path, errorMap: ctx.common.contextualErrorMap }); @@ -31988,12 +69520,12 @@ class ZodDefault extends ZodType { } _parse(input) { const { ctx } = this._processInputParams(input); - let data24 = ctx.data; + let data25 = ctx.data; if (ctx.parsedType === ZodParsedType.undefined) { - data24 = this._def.defaultValue(); + data25 = this._def.defaultValue(); } return this._def.innerType._parse({ - data: data24, + data: data25, path: ctx.path, parent: ctx }); @@ -32097,9 +69629,9 @@ class ZodBranded extends ZodType { } _parse(input) { const { ctx } = this._processInputParams(input); - const data24 = ctx.data; + const data25 = ctx.data; return this._def.type._parse({ - data: data24, + data: data25, path: ctx.path, parent: ctx }); @@ -32158,10 +69690,10 @@ class ZodPipeline extends ZodType { } } } - static create(a, b) { + static create(a2, b2) { return new ZodPipeline({ - in: a, - out: b, + in: a2, + out: b2, typeName: ZodFirstPartyTypeKind.ZodPipeline }); } @@ -32172,13 +69704,13 @@ class ZodReadonly extends ZodType { } _parse(input) { const result = this._def.innerType._parse(input); - const freeze = /* @__PURE__ */ __name((data24) => { - if (isValid(data24)) { - data24.value = Object.freeze(data24.value); + const freeze = /* @__PURE__ */ __name((data25) => { + if (isValid(data25)) { + data25.value = Object.freeze(data25.value); } - return data24; + return data25; }, "freeze"); - return isAsync(result) ? result.then((data24) => freeze(data24)) : freeze(result); + return isAsync(result) ? result.then((data25) => freeze(data25)) : freeze(result); } unwrap() { return this._def.innerType; @@ -32193,10 +69725,10 @@ ZodReadonly.create = (type, params) => { }; function custom(check, params = {}, fatal) { if (check) - return ZodAny.create().superRefine((data24, ctx) => { + return ZodAny.create().superRefine((data25, ctx) => { var _a2, _b; - if (!check(data24)) { - const p2 = typeof params === "function" ? params(data24) : typeof params === "string" ? { message: params } : params; + if (!check(data25)) { + const p2 = typeof params === "function" ? params(data25) : typeof params === "string" ? { message: params } : params; const _fatal = (_b = (_a2 = p2.fatal) !== null && _a2 !== void 0 ? _a2 : fatal) !== null && _b !== void 0 ? _b : true; const p22 = typeof p2 === "string" ? { message: p2 } : p2; ctx.addIssue({ code: "custom", ...p22, fatal: _fatal }); @@ -32249,7 +69781,7 @@ var ZodFirstPartyTypeKind; })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {})); const instanceOfType = /* @__PURE__ */ __name((cls, params = { message: `Input not instance of ${cls.name}` -}) => custom((data24) => data24 instanceof cls, params), "instanceOfType"); +}) => custom((data25) => data25 instanceof cls, params), "instanceOfType"); const stringType = ZodString.create; const numberType = ZodNumber.create; const nanType = ZodNaN.create; @@ -32626,12021 +70158,6 @@ function fromError(err, options4 = {}) { return toValidationError(options4)(err); } __name(fromError, "fromError"); -class LLink { - static { - __name(this, "LLink"); - } - /** Link ID */ - id; - parentId; - type; - /** Output node ID */ - origin_id; - /** Output slot index */ - origin_slot; - /** Input node ID */ - target_id; - /** Input slot index */ - target_slot; - data; - _data; - /** Centre point of the link, calculated during render only - can be inaccurate */ - _pos; - /** @todo Clean up - never implemented in comfy. */ - _last_time; - /** The last canvas 2D path that was used to render this link */ - path; - /** @inheritdoc */ - _centreAngle; - #color; - /** Custom colour for this link only */ - get color() { - return this.#color; - } - set color(value4) { - this.#color = value4 === "" ? null : value4; - } - constructor(id3, type, origin_id, origin_slot, target_id, target_slot, parentId) { - this.id = id3; - this.type = type; - this.origin_id = origin_id; - this.origin_slot = origin_slot; - this.target_id = target_id; - this.target_slot = target_slot; - this.parentId = parentId; - this._data = null; - this._pos = new Float32Array(2); - } - /** @deprecated Use {@link LLink.create} */ - static createFromArray(data24) { - return new LLink(data24[0], data24[5], data24[1], data24[2], data24[3], data24[4]); - } - /** - * LLink static factory: creates a new LLink from the provided data. - * @param data Serialised LLink data to create the link from - * @returns A new LLink - */ - static create(data24) { - return new LLink( - data24.id, - data24.type, - data24.origin_id, - data24.origin_slot, - data24.target_id, - data24.target_slot, - data24.parentId - ); - } - /** - * Gets all reroutes from the output slot to this segment. If this segment is a reroute, it will be the last element. - * @returns An ordered array of all reroutes from the node output to - * this reroute or the reroute before it. Otherwise, an empty array. - */ - static getReroutes(network, linkSegment) { - return network.reroutes.get(linkSegment.parentId)?.getReroutes() ?? []; - } - /** - * Finds the reroute in the chain after the provided reroute ID. - * @param network The network this link belongs to - * @param linkSegment The starting point of the search (input side). - * Typically the LLink object itself, but can be any link segment. - * @param rerouteId The matching reroute will have this set as its {@link parentId}. - * @returns The reroute that was found, `undefined` if no reroute was found, or `null` if an infinite loop was detected. - */ - static findNextReroute(network, linkSegment, rerouteId) { - return network.reroutes.get(linkSegment.parentId)?.findNextReroute(rerouteId); - } - configure(o) { - if (Array.isArray(o)) { - this.id = o[0]; - this.origin_id = o[1]; - this.origin_slot = o[2]; - this.target_id = o[3]; - this.target_slot = o[4]; - this.type = o[5]; - } else { - this.id = o.id; - this.type = o.type; - this.origin_id = o.origin_id; - this.origin_slot = o.origin_slot; - this.target_id = o.target_id; - this.target_slot = o.target_slot; - this.parentId = o.parentId; - } - } - /** - * Disconnects a link and removes it from the graph, cleaning up any reroutes that are no longer used - * @param network The container (LGraph) where reroutes should be updated - * @param keepReroutes If `true`, reroutes will not be garbage collected. - */ - disconnect(network, keepReroutes) { - const reroutes = LLink.getReroutes(network, this); - for (const reroute of reroutes) { - reroute.linkIds.delete(this.id); - if (!keepReroutes && !reroute.linkIds.size) - network.reroutes.delete(reroute.id); - } - network.links.delete(this.id); - } - /** - * @deprecated Prefer {@link LLink.asSerialisable} (returns an object, not an array) - * @returns An array representing this LLink - */ - serialize() { - return [ - this.id, - this.origin_id, - this.origin_slot, - this.target_id, - this.target_slot, - this.type - ]; - } - asSerialisable() { - const copy2 = { - id: this.id, - origin_id: this.origin_id, - origin_slot: this.origin_slot, - target_id: this.target_id, - target_slot: this.target_slot, - type: this.type - }; - if (this.parentId) copy2.parentId = this.parentId; - return copy2; - } -} -var NodeSlotType = /* @__PURE__ */ ((NodeSlotType2) => { - NodeSlotType2[NodeSlotType2["INPUT"] = 1] = "INPUT"; - NodeSlotType2[NodeSlotType2["OUTPUT"] = 2] = "OUTPUT"; - return NodeSlotType2; -})(NodeSlotType || {}); -var RenderShape = /* @__PURE__ */ ((RenderShape2) => { - RenderShape2[RenderShape2["BOX"] = 1] = "BOX"; - RenderShape2[RenderShape2["ROUND"] = 2] = "ROUND"; - RenderShape2[RenderShape2["CIRCLE"] = 3] = "CIRCLE"; - RenderShape2[RenderShape2["CARD"] = 4] = "CARD"; - RenderShape2[RenderShape2["ARROW"] = 5] = "ARROW"; - RenderShape2[RenderShape2["GRID"] = 6] = "GRID"; - RenderShape2[RenderShape2["HollowCircle"] = 7] = "HollowCircle"; - return RenderShape2; -})(RenderShape || {}); -var CanvasItem = /* @__PURE__ */ ((CanvasItem2) => { - CanvasItem2[CanvasItem2["Nothing"] = 0] = "Nothing"; - CanvasItem2[CanvasItem2["Node"] = 1] = "Node"; - CanvasItem2[CanvasItem2["Group"] = 2] = "Group"; - CanvasItem2[CanvasItem2["Reroute"] = 4] = "Reroute"; - CanvasItem2[CanvasItem2["Link"] = 8] = "Link"; - CanvasItem2[CanvasItem2["ResizeSe"] = 16] = "ResizeSe"; - return CanvasItem2; -})(CanvasItem || {}); -var LinkDirection = /* @__PURE__ */ ((LinkDirection2) => { - LinkDirection2[LinkDirection2["NONE"] = 0] = "NONE"; - LinkDirection2[LinkDirection2["UP"] = 1] = "UP"; - LinkDirection2[LinkDirection2["DOWN"] = 2] = "DOWN"; - LinkDirection2[LinkDirection2["LEFT"] = 3] = "LEFT"; - LinkDirection2[LinkDirection2["RIGHT"] = 4] = "RIGHT"; - LinkDirection2[LinkDirection2["CENTER"] = 5] = "CENTER"; - return LinkDirection2; -})(LinkDirection || {}); -var LinkRenderType = /* @__PURE__ */ ((LinkRenderType2) => { - LinkRenderType2[LinkRenderType2["HIDDEN_LINK"] = -1] = "HIDDEN_LINK"; - LinkRenderType2[LinkRenderType2["STRAIGHT_LINK"] = 0] = "STRAIGHT_LINK"; - LinkRenderType2[LinkRenderType2["LINEAR_LINK"] = 1] = "LINEAR_LINK"; - LinkRenderType2[LinkRenderType2["SPLINE_LINK"] = 2] = "SPLINE_LINK"; - return LinkRenderType2; -})(LinkRenderType || {}); -var LinkMarkerShape = /* @__PURE__ */ ((LinkMarkerShape2) => { - LinkMarkerShape2[LinkMarkerShape2["None"] = 0] = "None"; - LinkMarkerShape2[LinkMarkerShape2["Circle"] = 1] = "Circle"; - LinkMarkerShape2[LinkMarkerShape2["Arrow"] = 2] = "Arrow"; - return LinkMarkerShape2; -})(LinkMarkerShape || {}); -var TitleMode = /* @__PURE__ */ ((TitleMode2) => { - TitleMode2[TitleMode2["NORMAL_TITLE"] = 0] = "NORMAL_TITLE"; - TitleMode2[TitleMode2["NO_TITLE"] = 1] = "NO_TITLE"; - TitleMode2[TitleMode2["TRANSPARENT_TITLE"] = 2] = "TRANSPARENT_TITLE"; - TitleMode2[TitleMode2["AUTOHIDE_TITLE"] = 3] = "AUTOHIDE_TITLE"; - return TitleMode2; -})(TitleMode || {}); -var LGraphEventMode = /* @__PURE__ */ ((LGraphEventMode2) => { - LGraphEventMode2[LGraphEventMode2["ALWAYS"] = 0] = "ALWAYS"; - LGraphEventMode2[LGraphEventMode2["ON_EVENT"] = 1] = "ON_EVENT"; - LGraphEventMode2[LGraphEventMode2["NEVER"] = 2] = "NEVER"; - LGraphEventMode2[LGraphEventMode2["ON_TRIGGER"] = 3] = "ON_TRIGGER"; - LGraphEventMode2[LGraphEventMode2["BYPASS"] = 4] = "BYPASS"; - return LGraphEventMode2; -})(LGraphEventMode || {}); -var EaseFunction = /* @__PURE__ */ ((EaseFunction2) => { - EaseFunction2["LINEAR"] = "linear"; - EaseFunction2["EASE_IN_QUAD"] = "easeInQuad"; - EaseFunction2["EASE_OUT_QUAD"] = "easeOutQuad"; - EaseFunction2["EASE_IN_OUT_QUAD"] = "easeInOutQuad"; - return EaseFunction2; -})(EaseFunction || {}); -function distance(a, b) { - return Math.sqrt( - (b[0] - a[0]) * (b[0] - a[0]) + (b[1] - a[1]) * (b[1] - a[1]) - ); -} -__name(distance, "distance"); -function dist2(x1, y1, x2, y2) { - return (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1); -} -__name(dist2, "dist2"); -function isInRectangle(x2, y2, left, top, width2, height) { - return x2 >= left && x2 < left + width2 && y2 >= top && y2 < top + height; -} -__name(isInRectangle, "isInRectangle"); -function isPointInRect(point, rect) { - return point[0] >= rect[0] && point[0] < rect[0] + rect[2] && point[1] >= rect[1] && point[1] < rect[1] + rect[3]; -} -__name(isPointInRect, "isPointInRect"); -function isInRect(x2, y2, rect) { - return x2 >= rect[0] && x2 < rect[0] + rect[2] && y2 >= rect[1] && y2 < rect[1] + rect[3]; -} -__name(isInRect, "isInRect"); -function isInsideRectangle(x2, y2, left, top, width2, height) { - return left < x2 && left + width2 > x2 && top < y2 && top + height > y2; -} -__name(isInsideRectangle, "isInsideRectangle"); -function isSortaInsideOctagon(x2, y2, radius) { - const sum = Math.min(radius, Math.abs(x2)) + Math.min(radius, Math.abs(y2)); - return sum < radius * 0.75; -} -__name(isSortaInsideOctagon, "isSortaInsideOctagon"); -function overlapBounding(a, b) { - const aRight = a[0] + a[2]; - const aBottom = a[1] + a[3]; - const bRight = b[0] + b[2]; - const bBottom = b[1] + b[3]; - return a[0] > bRight || a[1] > bBottom || aRight < b[0] || aBottom < b[1] ? false : true; -} -__name(overlapBounding, "overlapBounding"); -function containsCentre(a, b) { - const centreX = b[0] + b[2] * 0.5; - const centreY = b[1] + b[3] * 0.5; - return isInRect(centreX, centreY, a); -} -__name(containsCentre, "containsCentre"); -function containsRect(a, b) { - const aRight = a[0] + a[2]; - const aBottom = a[1] + a[3]; - const bRight = b[0] + b[2]; - const bBottom = b[1] + b[3]; - const identical = a[0] === b[0] && a[1] === b[1] && aRight === bRight && aBottom === bBottom; - return !identical && a[0] <= b[0] && a[1] <= b[1] && aRight >= bRight && aBottom >= bBottom; -} -__name(containsRect, "containsRect"); -function findPointOnCurve(out, a, b, controlA, controlB, t2 = 0.5) { - const iT = 1 - t2; - const c1 = iT * iT * iT; - const c2 = 3 * (iT * iT) * t2; - const c3 = 3 * iT * (t2 * t2); - const c4 = t2 * t2 * t2; - out[0] = c1 * a[0] + c2 * controlA[0] + c3 * controlB[0] + c4 * b[0]; - out[1] = c1 * a[1] + c2 * controlA[1] + c3 * controlB[1] + c4 * b[1]; -} -__name(findPointOnCurve, "findPointOnCurve"); -function createBounds(objects, padding = 10) { - const bounds = new Float32Array([Infinity, Infinity, -Infinity, -Infinity]); - for (const obj of objects) { - const rect = obj.boundingRect; - bounds[0] = Math.min(bounds[0], rect[0]); - bounds[1] = Math.min(bounds[1], rect[1]); - bounds[2] = Math.max(bounds[2], rect[0] + rect[2]); - bounds[3] = Math.max(bounds[3], rect[1] + rect[3]); - } - if (!bounds.every((x2) => isFinite(x2))) return null; - return [ - bounds[0] - padding, - bounds[1] - padding, - bounds[2] - bounds[0] + 2 * padding, - bounds[3] - bounds[1] + 2 * padding - ]; -} -__name(createBounds, "createBounds"); -function snapPoint(pos2, snapTo) { - if (!snapTo) return false; - pos2[0] = snapTo * Math.round(pos2[0] / snapTo); - pos2[1] = snapTo * Math.round(pos2[1] / snapTo); - return true; -} -__name(snapPoint, "snapPoint"); -class Reroute { - static { - __name(this, "Reroute"); - } - /** - * Initialises a new link reroute object. - * @param id Unique identifier for this reroute - * @param network The network of links this reroute belongs to. Internally converted to a WeakRef. - * @param pos Position in graph coordinates - * @param linkIds Link IDs ({@link LLink.id}) of all links that use this reroute - */ - constructor(id3, network, pos2, parentId, linkIds) { - this.id = id3; - this.#network = new WeakRef(network); - this.update(parentId, pos2, linkIds); - this.linkIds ??= /* @__PURE__ */ new Set(); - } - static radius = 10; - #malloc = new Float32Array(8); - /** The network this reroute belongs to. Contains all valid links and reroutes. */ - #network; - #parentId; - /** @inheritdoc */ - get parentId() { - return this.#parentId; - } - /** Ignores attempts to create an infinite loop. @inheritdoc */ - set parentId(value4) { - if (value4 === this.id) return; - if (this.getReroutes() === null) return; - this.#parentId = value4; - } - #pos = this.#malloc.subarray(0, 2); - /** @inheritdoc */ - get pos() { - return this.#pos; - } - set pos(value4) { - if (!(value4?.length >= 2)) - throw new TypeError("Reroute.pos is an x,y point, and expects an indexable with at least two values."); - this.#pos[0] = value4[0]; - this.#pos[1] = value4[1]; - } - /** @inheritdoc */ - get boundingRect() { - const { radius } = Reroute; - const [x2, y2] = this.#pos; - return [x2 - radius, y2 - radius, 2 * radius, 2 * radius]; - } - /** @inheritdoc */ - selected; - /** The ID ({@link LLink.id}) of every link using this reroute */ - linkIds; - /** The averaged angle of every link through this reroute. */ - otherAngle = 0; - /** Cached cos */ - cos = 0; - sin = 0; - /** Bezier curve control point for the "target" (input) side of the link */ - controlPoint = this.#malloc.subarray(4, 6); - /** @inheritdoc */ - path; - /** @inheritdoc */ - _centreAngle; - /** @inheritdoc */ - _pos = this.#malloc.subarray(6, 8); - /** Colour of the first link that rendered this reroute */ - _colour; - /** - * Used to ensure reroute angles are only executed once per frame. - * @todo Calculate on change instead. - */ - #lastRenderTime = -Infinity; - #buffer = this.#malloc.subarray(2, 4); - /** @inheritdoc */ - get origin_id() { - return this.#network.deref()?.links.get(this.linkIds.values().next().value)?.origin_id; - } - /** @inheritdoc */ - get origin_slot() { - return this.#network.deref()?.links.get(this.linkIds.values().next().value)?.origin_slot; - } - /** - * Applies a new parentId to the reroute, and optinoally a new position and linkId. - * Primarily used for deserialisation. - * @param parentId The ID of the reroute prior to this reroute, or - * `undefined` if it is the first reroute connected to a nodes output - * @param pos The position of this reroute - * @param linkIds All link IDs that pass through this reroute - */ - update(parentId, pos2, linkIds) { - this.parentId = parentId; - if (pos2) this.pos = pos2; - if (linkIds) this.linkIds = new Set(linkIds); - } - /** - * Validates the linkIds this reroute has. Removes broken links. - * @param links Collection of valid links - * @returns true if any links remain after validation - */ - validateLinks(links) { - const { linkIds } = this; - for (const linkId of linkIds) { - if (!links.get(linkId)) linkIds.delete(linkId); - } - return linkIds.size > 0; - } - /** - * Retrieves an ordered array of all reroutes from the node output. - * @param visited Internal. A set of reroutes that this function - * has already visited whilst recursing up the chain. - * @returns An ordered array of all reroutes from the node output to this reroute, inclusive. - * `null` if an infinite loop is detected. - * `undefined` if the reroute chain or {@link LinkNetwork} are invalid. - */ - getReroutes(visited = /* @__PURE__ */ new Set()) { - if (this.#parentId === void 0) return [this]; - if (visited.has(this)) return null; - visited.add(this); - const parent = this.#network.deref()?.reroutes.get(this.#parentId); - if (!parent) { - this.#parentId = void 0; - return [this]; - } - const reroutes = parent.getReroutes(visited); - reroutes?.push(this); - return reroutes; - } - /** - * Internal. Called by {@link LLink.findNextReroute}. Not intended for use by itself. - * @param withParentId The rerouteId to look for - * @param visited A set of reroutes that have already been visited - * @returns The reroute that was found, `undefined` if no reroute was found, or `null` if an infinite loop was detected. - */ - findNextReroute(withParentId, visited = /* @__PURE__ */ new Set()) { - if (this.#parentId === withParentId) return this; - if (visited.has(this)) return null; - visited.add(this); - return this.#network.deref()?.reroutes.get(this.#parentId)?.findNextReroute(withParentId, visited); - } - /** @inheritdoc */ - move(deltaX, deltaY) { - this.#pos[0] += deltaX; - this.#pos[1] += deltaY; - } - /** @inheritdoc */ - snapToGrid(snapTo) { - if (!snapTo) return false; - const { pos: pos2 } = this; - pos2[0] = snapTo * Math.round(pos2[0] / snapTo); - pos2[1] = snapTo * Math.round(pos2[1] / snapTo); - return true; - } - calculateAngle(lastRenderTime, network, linkStart) { - if (!(lastRenderTime > this.#lastRenderTime)) return; - this.#lastRenderTime = lastRenderTime; - const { links } = network; - const { linkIds, id: id3 } = this; - const angles = []; - let sum = 0; - for (const linkId of linkIds) { - const link2 = links.get(linkId); - if (!link2) continue; - const pos2 = LLink.findNextReroute(network, link2, id3)?.pos ?? network.getNodeById(link2.target_id)?.getConnectionPos(true, link2.target_slot, this.#buffer); - if (!pos2) continue; - const angle = Math.atan2(pos2[1] - this.#pos[1], pos2[0] - this.#pos[0]); - angles.push(angle); - sum += angle; - } - if (!angles.length) return; - sum /= angles.length; - const originToReroute = Math.atan2( - this.#pos[1] - linkStart[1], - this.#pos[0] - linkStart[0] - ); - let diff2 = (originToReroute - sum) * 0.5; - if (Math.abs(diff2) > Math.PI * 0.5) diff2 += Math.PI; - const dist3 = Math.min(80, distance(linkStart, this.#pos) * 0.25); - const originDiff = originToReroute - diff2; - const cos = Math.cos(originDiff); - const sin = Math.sin(originDiff); - this.otherAngle = originDiff; - this.cos = cos; - this.sin = sin; - this.controlPoint[0] = dist3 * -cos; - this.controlPoint[1] = dist3 * -sin; - return; - } - /** - * Renders the reroute on the canvas. - * @param ctx Canvas context to draw on - * @remarks Leaves {@link ctx}.fillStyle, strokeStyle, and lineWidth dirty (perf.). - */ - draw(ctx) { - const { pos: pos2 } = this; - ctx.fillStyle = this._colour; - ctx.beginPath(); - ctx.arc(pos2[0], pos2[1], Reroute.radius, 0, 2 * Math.PI); - ctx.fill(); - ctx.lineWidth = Reroute.radius * 0.1; - ctx.strokeStyle = "rgb(0,0,0,0.5)"; - ctx.stroke(); - ctx.fillStyle = "#ffffff55"; - ctx.strokeStyle = "rgb(0,0,0,0.3)"; - ctx.beginPath(); - ctx.arc(pos2[0], pos2[1], Reroute.radius * 0.8, 0, 2 * Math.PI); - ctx.fill(); - ctx.stroke(); - if (this.selected) { - ctx.strokeStyle = "#fff"; - ctx.beginPath(); - ctx.arc(pos2[0], pos2[1], Reroute.radius * 1.2, 0, 2 * Math.PI); - ctx.stroke(); - } - } - /** @inheritdoc */ - asSerialisable() { - return { - id: this.id, - parentId: this.parentId, - pos: [this.pos[0], this.pos[1]], - linkIds: [...this.linkIds] - }; - } -} -var BadgePosition = /* @__PURE__ */ ((BadgePosition2) => { - BadgePosition2["TopLeft"] = "top-left"; - BadgePosition2["TopRight"] = "top-right"; - return BadgePosition2; -})(BadgePosition || {}); -class LGraphBadge { - static { - __name(this, "LGraphBadge"); - } - text; - fgColor; - bgColor; - fontSize; - padding; - height; - cornerRadius; - constructor({ - text: text2, - fgColor = "white", - bgColor = "#0F1F0F", - fontSize = 12, - padding = 6, - height = 20, - cornerRadius = 5 - }) { - this.text = text2; - this.fgColor = fgColor; - this.bgColor = bgColor; - this.fontSize = fontSize; - this.padding = padding; - this.height = height; - this.cornerRadius = cornerRadius; - } - get visible() { - return this.text.length > 0; - } - getWidth(ctx) { - if (!this.visible) return 0; - const { font } = ctx; - ctx.font = `${this.fontSize}px sans-serif`; - const textWidth = ctx.measureText(this.text).width; - ctx.font = font; - return textWidth + this.padding * 2; - } - draw(ctx, x2, y2) { - if (!this.visible) return; - const { fillStyle } = ctx; - ctx.font = `${this.fontSize}px sans-serif`; - const badgeWidth = this.getWidth(ctx); - const badgeX = 0; - ctx.fillStyle = this.bgColor; - ctx.beginPath(); - if (ctx.roundRect) { - ctx.roundRect(x2 + badgeX, y2, badgeWidth, this.height, this.cornerRadius); - } else { - ctx.rect(x2 + badgeX, y2, badgeWidth, this.height); - } - ctx.fill(); - ctx.fillStyle = this.fgColor; - ctx.fillText( - this.text, - x2 + badgeX + this.padding, - y2 + this.height - this.padding - ); - ctx.fillStyle = fillStyle; - } -} -class LGraphNode { - static { - __name(this, "LGraphNode"); - } - // Static properties used by dynamic child classes - static title; - static MAX_CONSOLE; - static type; - static category; - static supported_extensions; - static filter; - static skip_list; - /** Default setting for {@link LGraphNode.connectInputToOutput}. @see {@link INodeFlags.keepAllLinksOnBypass} */ - static keepAllLinksOnBypass = false; - title; - graph = null; - id; - type = null; - inputs = []; - outputs = []; - // Not used - connections = []; - properties = {}; - properties_info = []; - flags = {}; - widgets; - locked; - // Execution order, automatically computed during run - order; - mode; - last_serialization; - serialize_widgets; - color; - bgcolor; - boxcolor; - exec_version; - action_call; - execute_triggered; - action_triggered; - widgets_up; - widgets_start_y; - lostFocusAt; - gotFocusAt; - badges = []; - badgePosition = BadgePosition.TopLeft; - _collapsed_width; - horizontal; - console; - _level; - _shape; - subgraph; - skip_subgraph_button; - mouseOver; - redraw_on_mouse; - // Appears unused - optional_inputs; - // Appears unused - optional_outputs; - resizable; - clonable; - _relative_id; - clip_area; - ignore_remove; - has_errors; - removable; - block_delete; - selected; - showAdvanced; - /** @inheritdoc {@link renderArea} */ - #renderArea = new Float32Array(4); - /** - * Rect describing the node area, including shadows and any protrusions. - * Determines if the node is visible. Calculated once at the start of every frame. - */ - get renderArea() { - return this.#renderArea; - } - /** @inheritdoc {@link boundingRect} */ - #boundingRect = new Float32Array(4); - /** - * Cached node position & area as `x, y, width, height`. Includes changes made by {@link onBounding}, if present. - * - * Determines the node hitbox and other rendering effects. Calculated once at the start of every frame. - */ - get boundingRect() { - return this.#boundingRect; - } - /** {@link pos} and {@link size} values are backed by this {@link Rect}. */ - _posSize = new Float32Array(4); - _pos = this._posSize.subarray(0, 2); - _size = this._posSize.subarray(2, 4); - get pos() { - return this._pos; - } - set pos(value4) { - if (!value4 || value4.length < 2) return; - this._pos[0] = value4[0]; - this._pos[1] = value4[1]; - } - get size() { - return this._size; - } - set size(value4) { - if (!value4 || value4.length < 2) return; - this._size[0] = value4[0]; - this._size[1] = value4[1]; - } - get shape() { - return this._shape; - } - set shape(v2) { - switch (v2) { - case "default": - delete this._shape; - break; - case "box": - this._shape = RenderShape.BOX; - break; - case "round": - this._shape = RenderShape.ROUND; - break; - case "circle": - this._shape = RenderShape.CIRCLE; - break; - case "card": - this._shape = RenderShape.CARD; - break; - default: - this._shape = v2; - } - } - get is_selected() { - return this.selected; - } - set is_selected(value4) { - this.selected = value4; - } - constructor(title) { - this.id = LiteGraph.use_uuids ? LiteGraph.uuidv4() : -1; - this.title = title || "Unnamed"; - this.size = [LiteGraph.NODE_WIDTH, 60]; - this.pos = [10, 10]; - } - /** - * configure a node from an object containing the serialized info - */ - configure(info) { - if (this.graph) { - this.graph._version++; - } - for (const j in info) { - if (j == "properties") { - for (const k in info.properties) { - this.properties[k] = info.properties[k]; - this.onPropertyChanged?.(k, info.properties[k]); - } - continue; - } - if (info[j] == null) { - continue; - } else if (typeof info[j] == "object") { - if (this[j]?.configure) { - this[j]?.configure(info[j]); - } else { - this[j] = LiteGraph.cloneObject(info[j], this[j]); - } - } else { - this[j] = info[j]; - } - } - if (!info.title) { - this.title = this.constructor.title; - } - if (this.inputs) { - for (let i2 = 0; i2 < this.inputs.length; ++i2) { - const input = this.inputs[i2]; - const link2 = this.graph ? this.graph._links.get(input.link) : null; - this.onConnectionsChange?.(NodeSlotType.INPUT, i2, true, link2, input); - this.onInputAdded?.(input); - } - } - if (this.outputs) { - for (let i2 = 0; i2 < this.outputs.length; ++i2) { - const output = this.outputs[i2]; - if (!output.links) { - continue; - } - for (let j = 0; j < output.links.length; ++j) { - const link2 = this.graph ? this.graph._links.get(output.links[j]) : null; - this.onConnectionsChange?.(NodeSlotType.OUTPUT, i2, true, link2, output); - } - this.onOutputAdded?.(output); - } - } - if (this.widgets) { - for (let i2 = 0; i2 < this.widgets.length; ++i2) { - const w = this.widgets[i2]; - if (!w) continue; - if (w.options?.property && this.properties[w.options.property] != void 0) - w.value = JSON.parse(JSON.stringify(this.properties[w.options.property])); - } - if (info.widgets_values) { - for (let i2 = 0; i2 < info.widgets_values.length; ++i2) { - if (this.widgets[i2]) { - this.widgets[i2].value = info.widgets_values[i2]; - } - } - } - } - if (this.pinned) this.pin(true); - this.onConfigure?.(info); - } - /** - * serialize the content - */ - serialize() { - const o = { - id: this.id, - type: this.type, - pos: [this.pos[0], this.pos[1]], - size: [this.size[0], this.size[1]], - flags: LiteGraph.cloneObject(this.flags), - order: this.order, - mode: this.mode, - showAdvanced: this.showAdvanced - }; - if (this.constructor === LGraphNode && this.last_serialization) - return this.last_serialization; - if (this.inputs) o.inputs = this.inputs; - if (this.outputs) { - for (let i2 = 0; i2 < this.outputs.length; i2++) { - delete this.outputs[i2]._data; - } - o.outputs = this.outputs; - } - if (this.title && this.title != this.constructor.title) o.title = this.title; - if (this.properties) o.properties = LiteGraph.cloneObject(this.properties); - if (this.widgets && this.serialize_widgets) { - o.widgets_values = []; - for (let i2 = 0; i2 < this.widgets.length; ++i2) { - if (this.widgets[i2]) - o.widgets_values[i2] = this.widgets[i2].value; - else - o.widgets_values[i2] = null; - } - } - if (!o.type) o.type = this.constructor.type; - if (this.color) o.color = this.color; - if (this.bgcolor) o.bgcolor = this.bgcolor; - if (this.boxcolor) o.boxcolor = this.boxcolor; - if (this.shape) o.shape = this.shape; - if (this.onSerialize?.(o)) console.warn("node onSerialize shouldnt return anything, data should be stored in the object pass in the first parameter"); - return o; - } - /* Creates a clone of this node */ - clone() { - const node22 = LiteGraph.createNode(this.type); - if (!node22) return null; - const data24 = LiteGraph.cloneObject(this.serialize()); - if (data24.inputs) { - for (let i2 = 0; i2 < data24.inputs.length; ++i2) { - data24.inputs[i2].link = null; - } - } - if (data24.outputs) { - for (let i2 = 0; i2 < data24.outputs.length; ++i2) { - if (data24.outputs[i2].links) { - data24.outputs[i2].links.length = 0; - } - } - } - delete data24.id; - if (LiteGraph.use_uuids) data24.id = LiteGraph.uuidv4(); - node22.configure(data24); - return node22; - } - /** - * serialize and stringify - */ - toString() { - return JSON.stringify(this.serialize()); - } - /** - * get the title string - */ - getTitle() { - return this.title || this.constructor.title; - } - /** - * sets the value of a property - * @param name - * @param value - */ - setProperty(name2, value4) { - this.properties ||= {}; - if (value4 === this.properties[name2]) return; - const prev_value = this.properties[name2]; - this.properties[name2] = value4; - if (this.onPropertyChanged?.(name2, value4, prev_value) === false) - this.properties[name2] = prev_value; - if (this.widgets) { - for (let i2 = 0; i2 < this.widgets.length; ++i2) { - const w = this.widgets[i2]; - if (!w) continue; - if (w.options.property == name2) { - w.value = value4; - break; - } - } - } - } - /** - * sets the output data - * @param slot - * @param data - */ - setOutputData(slot, data24) { - if (!this.outputs) return; - if (slot == -1 || slot >= this.outputs.length) return; - const output_info = this.outputs[slot]; - if (!output_info) return; - output_info._data = data24; - if (this.outputs[slot].links) { - for (let i2 = 0; i2 < this.outputs[slot].links.length; i2++) { - const link_id = this.outputs[slot].links[i2]; - const link2 = this.graph._links.get(link_id); - if (link2) link2.data = data24; - } - } - } - /** - * sets the output data type, useful when you want to be able to overwrite the data type - */ - setOutputDataType(slot, type) { - if (!this.outputs) return; - if (slot == -1 || slot >= this.outputs.length) return; - const output_info = this.outputs[slot]; - if (!output_info) return; - output_info.type = type; - if (this.outputs[slot].links) { - for (let i2 = 0; i2 < this.outputs[slot].links.length; i2++) { - const link_id = this.outputs[slot].links[i2]; - this.graph._links.get(link_id).type = type; - } - } - } - /** - * Retrieves the input data (data traveling through the connection) from one slot - * @param slot - * @param force_update if set to true it will force the connected node of this slot to output data into this link - * @returns data or if it is not connected returns undefined - */ - getInputData(slot, force_update) { - if (!this.inputs) return; - if (slot >= this.inputs.length || this.inputs[slot].link == null) return; - const link_id = this.inputs[slot].link; - const link2 = this.graph._links.get(link_id); - if (!link2) return null; - if (!force_update) return link2.data; - const node22 = this.graph.getNodeById(link2.origin_id); - if (!node22) return link2.data; - if (node22.updateOutputData) { - node22.updateOutputData(link2.origin_slot); - } else { - node22.onExecute?.(); - } - return link2.data; - } - /** - * Retrieves the input data type (in case this supports multiple input types) - * @param slot - * @returns datatype in string format - */ - getInputDataType(slot) { - if (!this.inputs) return null; - if (slot >= this.inputs.length || this.inputs[slot].link == null) return null; - const link_id = this.inputs[slot].link; - const link2 = this.graph._links.get(link_id); - if (!link2) return null; - const node22 = this.graph.getNodeById(link2.origin_id); - if (!node22) return link2.type; - const output_info = node22.outputs[link2.origin_slot]; - return output_info ? output_info.type : null; - } - /** - * Retrieves the input data from one slot using its name instead of slot number - * @param slot_name - * @param force_update if set to true it will force the connected node of this slot to output data into this link - * @returns data or if it is not connected returns null - */ - getInputDataByName(slot_name, force_update) { - const slot = this.findInputSlot(slot_name); - return slot == -1 ? null : this.getInputData(slot, force_update); - } - /** - * tells you if there is a connection in one input slot - * @param slot The 0-based index of the input to check - * @returns `true` if the input slot has a link ID (does not perform validation) - */ - isInputConnected(slot) { - if (!this.inputs) return false; - return slot < this.inputs.length && this.inputs[slot].link != null; - } - /** - * tells you info about an input connection (which node, type, etc) - * @returns object or null { link: id, name: string, type: string or 0 } - */ - getInputInfo(slot) { - return !this.inputs || !(slot < this.inputs.length) ? null : this.inputs[slot]; - } - /** - * Returns the link info in the connection of an input slot - * @returns object or null - */ - getInputLink(slot) { - if (!this.inputs) return null; - if (slot < this.inputs.length) { - const slot_info = this.inputs[slot]; - return this.graph._links.get(slot_info.link); - } - return null; - } - /** - * returns the node connected in the input slot - * @returns node or null - */ - getInputNode(slot) { - if (!this.inputs) return null; - if (slot >= this.inputs.length) return null; - const input = this.inputs[slot]; - if (!input || input.link === null) return null; - const link_info = this.graph._links.get(input.link); - if (!link_info) return null; - return this.graph.getNodeById(link_info.origin_id); - } - /** - * returns the value of an input with this name, otherwise checks if there is a property with that name - * @returns value - */ - getInputOrProperty(name2) { - if (!this.inputs || !this.inputs.length) { - return this.properties ? this.properties[name2] : null; - } - for (let i2 = 0, l = this.inputs.length; i2 < l; ++i2) { - const input_info = this.inputs[i2]; - if (name2 == input_info.name && input_info.link != null) { - const link2 = this.graph._links.get(input_info.link); - if (link2) return link2.data; - } - } - return this.properties[name2]; - } - /** - * tells you the last output data that went in that slot - * @returns object or null - */ - getOutputData(slot) { - if (!this.outputs) return null; - if (slot >= this.outputs.length) return null; - const info = this.outputs[slot]; - return info._data; - } - /** - * tells you info about an output connection (which node, type, etc) - * @returns object or null { name: string, type: string, links: [ ids of links in number ] } - */ - getOutputInfo(slot) { - return !this.outputs || !(slot < this.outputs.length) ? null : this.outputs[slot]; - } - /** - * tells you if there is a connection in one output slot - */ - isOutputConnected(slot) { - if (!this.outputs) return false; - return slot < this.outputs.length && this.outputs[slot].links?.length > 0; - } - /** - * tells you if there is any connection in the output slots - */ - isAnyOutputConnected() { - if (!this.outputs) return false; - for (let i2 = 0; i2 < this.outputs.length; ++i2) { - if (this.outputs[i2].links && this.outputs[i2].links.length) { - return true; - } - } - return false; - } - /** - * retrieves all the nodes connected to this output slot - */ - getOutputNodes(slot) { - if (!this.outputs || this.outputs.length == 0) return null; - if (slot >= this.outputs.length) return null; - const output = this.outputs[slot]; - if (!output.links || output.links.length == 0) return null; - const r = []; - for (let i2 = 0; i2 < output.links.length; i2++) { - const link_id = output.links[i2]; - const link2 = this.graph._links.get(link_id); - if (link2) { - const target_node = this.graph.getNodeById(link2.target_id); - if (target_node) { - r.push(target_node); - } - } - } - return r; - } - addOnTriggerInput() { - const trigS = this.findInputSlot("onTrigger"); - if (trigS == -1) { - this.addInput("onTrigger", LiteGraph.EVENT, { - optional: true, - nameLocked: true - }); - return this.findInputSlot("onTrigger"); - } - return trigS; - } - addOnExecutedOutput() { - const trigS = this.findOutputSlot("onExecuted"); - if (trigS == -1) { - this.addOutput("onExecuted", LiteGraph.ACTION, { - optional: true, - nameLocked: true - }); - return this.findOutputSlot("onExecuted"); - } - return trigS; - } - onAfterExecuteNode(param, options4) { - const trigS = this.findOutputSlot("onExecuted"); - if (trigS != -1) { - this.triggerSlot(trigS, param, null, options4); - } - } - changeMode(modeTo) { - switch (modeTo) { - case LGraphEventMode.ON_EVENT: - break; - case LGraphEventMode.ON_TRIGGER: - this.addOnTriggerInput(); - this.addOnExecutedOutput(); - break; - case LGraphEventMode.NEVER: - break; - case LGraphEventMode.ALWAYS: - break; - case LiteGraph.ON_REQUEST: - break; - default: - return false; - } - this.mode = modeTo; - return true; - } - /** - * Triggers the node code execution, place a boolean/counter to mark the node as being executed - */ - doExecute(param, options4) { - options4 = options4 || {}; - if (this.onExecute) { - options4.action_call ||= this.id + "_exec_" + Math.floor(Math.random() * 9999); - this.graph.nodes_executing[this.id] = true; - this.onExecute(param, options4); - this.graph.nodes_executing[this.id] = false; - this.exec_version = this.graph.iteration; - if (options4?.action_call) { - this.action_call = options4.action_call; - this.graph.nodes_executedAction[this.id] = options4.action_call; - } - } - this.execute_triggered = 2; - this.onAfterExecuteNode?.(param, options4); - } - /** - * Triggers an action, wrapped by logics to control execution flow - * @param action name - */ - actionDo(action, param, options4) { - options4 = options4 || {}; - if (this.onAction) { - options4.action_call ||= this.id + "_" + (action ? action : "action") + "_" + Math.floor(Math.random() * 9999); - this.graph.nodes_actioning[this.id] = action ? action : "actioning"; - this.onAction(action, param, options4); - this.graph.nodes_actioning[this.id] = false; - if (options4?.action_call) { - this.action_call = options4.action_call; - this.graph.nodes_executedAction[this.id] = options4.action_call; - } - } - this.action_triggered = 2; - this.onAfterExecuteNode?.(param, options4); - } - /** - * Triggers an event in this node, this will trigger any output with the same name - * @param action name ( "on_play", ... ) if action is equivalent to false then the event is send to all - */ - trigger(action, param, options4) { - if (!this.outputs || !this.outputs.length) { - return; - } - if (this.graph) this.graph._last_trigger_time = LiteGraph.getTime(); - for (let i2 = 0; i2 < this.outputs.length; ++i2) { - const output = this.outputs[i2]; - if (!output || output.type !== LiteGraph.EVENT || action && output.name != action) - continue; - this.triggerSlot(i2, param, null, options4); - } - } - /** - * Triggers a slot event in this node: cycle output slots and launch execute/action on connected nodes - * @param slot the index of the output slot - * @param link_id [optional] in case you want to trigger and specific output link in a slot - */ - triggerSlot(slot, param, link_id, options4) { - options4 = options4 || {}; - if (!this.outputs) return; - if (slot == null) { - console.error("slot must be a number"); - return; - } - if (typeof slot !== "number") - console.warn("slot must be a number, use node.trigger('name') if you want to use a string"); - const output = this.outputs[slot]; - if (!output) return; - const links = output.links; - if (!links || !links.length) return; - if (this.graph) this.graph._last_trigger_time = LiteGraph.getTime(); - for (let k = 0; k < links.length; ++k) { - const id3 = links[k]; - if (link_id != null && link_id != id3) continue; - const link_info = this.graph._links.get(id3); - if (!link_info) continue; - link_info._last_time = LiteGraph.getTime(); - const node22 = this.graph.getNodeById(link_info.target_id); - if (!node22) continue; - if (node22.mode === LGraphEventMode.ON_TRIGGER) { - if (!options4.action_call) - options4.action_call = this.id + "_trigg_" + Math.floor(Math.random() * 9999); - node22.doExecute?.(param, options4); - } else if (node22.onAction) { - if (!options4.action_call) - options4.action_call = this.id + "_act_" + Math.floor(Math.random() * 9999); - const target_connection = node22.inputs[link_info.target_slot]; - node22.actionDo(target_connection.name, param, options4); - } - } - } - /** - * clears the trigger slot animation - * @param slot the index of the output slot - * @param link_id [optional] in case you want to trigger and specific output link in a slot - */ - clearTriggeredSlot(slot, link_id) { - if (!this.outputs) return; - const output = this.outputs[slot]; - if (!output) return; - const links = output.links; - if (!links || !links.length) return; - for (let k = 0; k < links.length; ++k) { - const id3 = links[k]; - if (link_id != null && link_id != id3) continue; - const link_info = this.graph._links.get(id3); - if (!link_info) continue; - link_info._last_time = 0; - } - } - /** - * changes node size and triggers callback - */ - setSize(size2) { - this.size = size2; - this.onResize?.(this.size); - } - /** - * add a new property to this node - * @param type string defining the output type ("vec3","number",...) - * @param extra_info this can be used to have special properties of the property (like values, etc) - */ - addProperty(name2, default_value, type, extra_info) { - const o = { - name: name2, - type, - default_value - }; - if (extra_info) { - for (const i2 in extra_info) { - o[i2] = extra_info[i2]; - } - } - this.properties_info ||= []; - this.properties_info.push(o); - this.properties ||= {}; - this.properties[name2] = default_value; - return o; - } - /** - * add a new output slot to use in this node - * @param type string defining the output type ("vec3","number",...) - * @param extra_info this can be used to have special properties of an output (label, special color, position, etc) - */ - addOutput(name2, type, extra_info) { - const output = { name: name2, type, links: null }; - if (extra_info) { - for (const i2 in extra_info) { - output[i2] = extra_info[i2]; - } - } - this.outputs ||= []; - this.outputs.push(output); - this.onOutputAdded?.(output); - if (LiteGraph.auto_load_slot_types) - LiteGraph.registerNodeAndSlotType(this, type, true); - this.setSize(this.computeSize()); - this.setDirtyCanvas(true, true); - return output; - } - /** - * add a new output slot to use in this node - * @param array of triplets like [[name,type,extra_info],[...]] - */ - addOutputs(array) { - for (let i2 = 0; i2 < array.length; ++i2) { - const info = array[i2]; - const o = { name: info[0], type: info[1], links: null }; - if (array[2]) { - for (const j in info[2]) { - o[j] = info[2][j]; - } - } - this.outputs ||= []; - this.outputs.push(o); - this.onOutputAdded?.(o); - if (LiteGraph.auto_load_slot_types) - LiteGraph.registerNodeAndSlotType(this, info[1], true); - } - this.setSize(this.computeSize()); - this.setDirtyCanvas(true, true); - } - /** - * remove an existing output slot - */ - removeOutput(slot) { - this.disconnectOutput(slot); - this.outputs.splice(slot, 1); - for (let i2 = slot; i2 < this.outputs.length; ++i2) { - if (!this.outputs[i2] || !this.outputs[i2].links) continue; - const links = this.outputs[i2].links; - for (let j = 0; j < links.length; ++j) { - const link2 = this.graph._links.get(links[j]); - if (!link2) continue; - link2.origin_slot -= 1; - } - } - this.setSize(this.computeSize()); - this.onOutputRemoved?.(slot); - this.setDirtyCanvas(true, true); - } - /** - * add a new input slot to use in this node - * @param type string defining the input type ("vec3","number",...), it its a generic one use 0 - * @param extra_info this can be used to have special properties of an input (label, color, position, etc) - */ - addInput(name2, type, extra_info) { - type = type || 0; - const input = { name: name2, type, link: null }; - if (extra_info) { - for (const i2 in extra_info) { - input[i2] = extra_info[i2]; - } - } - this.inputs ||= []; - this.inputs.push(input); - this.setSize(this.computeSize()); - this.onInputAdded?.(input); - LiteGraph.registerNodeAndSlotType(this, type); - this.setDirtyCanvas(true, true); - return input; - } - /** - * add several new input slots in this node - * @param array of triplets like [[name,type,extra_info],[...]] - */ - addInputs(array) { - for (let i2 = 0; i2 < array.length; ++i2) { - const info = array[i2]; - const o = { name: info[0], type: info[1], link: null }; - if (array[2]) { - for (const j in info[2]) { - o[j] = info[2][j]; - } - } - this.inputs ||= []; - this.inputs.push(o); - this.onInputAdded?.(o); - LiteGraph.registerNodeAndSlotType(this, info[1]); - } - this.setSize(this.computeSize()); - this.setDirtyCanvas(true, true); - } - /** - * remove an existing input slot - */ - removeInput(slot) { - this.disconnectInput(slot); - const slot_info = this.inputs.splice(slot, 1); - for (let i2 = slot; i2 < this.inputs.length; ++i2) { - if (!this.inputs[i2]) continue; - const link2 = this.graph._links.get(this.inputs[i2].link); - if (!link2) continue; - link2.target_slot -= 1; - } - this.setSize(this.computeSize()); - this.onInputRemoved?.(slot, slot_info[0]); - this.setDirtyCanvas(true, true); - } - /** - * add an special connection to this node (used for special kinds of graphs) - * @param type string defining the input type ("vec3","number",...) - * @param pos position of the connection inside the node - * @param direction if is input or output - */ - addConnection(name2, type, pos2, direction) { - const o = { - name: name2, - type, - pos: pos2, - direction, - links: null - }; - this.connections.push(o); - return o; - } - /** - * computes the minimum size of a node according to its inputs and output slots - * @returns the total size - */ - computeSize(out) { - const ctorSize = this.constructor.size; - if (ctorSize) return [ctorSize[0], ctorSize[1]]; - let rows = Math.max( - this.inputs ? this.inputs.length : 1, - this.outputs ? this.outputs.length : 1 - ); - const size2 = out || new Float32Array([0, 0]); - rows = Math.max(rows, 1); - const font_size = LiteGraph.NODE_TEXT_SIZE; - const title_width = compute_text_size(this.title); - let input_width = 0; - let output_width = 0; - if (this.inputs) { - for (let i2 = 0, l = this.inputs.length; i2 < l; ++i2) { - const input = this.inputs[i2]; - const text2 = input.label || input.localized_name || input.name || ""; - const text_width = compute_text_size(text2); - if (input_width < text_width) - input_width = text_width; - } - } - if (this.outputs) { - for (let i2 = 0, l = this.outputs.length; i2 < l; ++i2) { - const output = this.outputs[i2]; - const text2 = output.label || output.localized_name || output.name || ""; - const text_width = compute_text_size(text2); - if (output_width < text_width) - output_width = text_width; - } - } - size2[0] = Math.max(input_width + output_width + 10, title_width); - size2[0] = Math.max(size2[0], LiteGraph.NODE_WIDTH); - if (this.widgets?.length) - size2[0] = Math.max(size2[0], LiteGraph.NODE_WIDTH * 1.5); - size2[1] = (this.constructor.slot_start_y || 0) + rows * LiteGraph.NODE_SLOT_HEIGHT; - let widgets_height = 0; - if (this.widgets?.length) { - for (let i2 = 0, l = this.widgets.length; i2 < l; ++i2) { - const widget2 = this.widgets[i2]; - if (widget2.hidden || widget2.advanced && !this.showAdvanced) continue; - widgets_height += widget2.computeSize ? widget2.computeSize(size2[0])[1] + 4 : LiteGraph.NODE_WIDGET_HEIGHT + 4; - } - widgets_height += 8; - } - if (this.widgets_up) - size2[1] = Math.max(size2[1], widgets_height); - else if (this.widgets_start_y != null) - size2[1] = Math.max(size2[1], widgets_height + this.widgets_start_y); - else - size2[1] += widgets_height; - function compute_text_size(text2) { - return text2 ? font_size * text2.length * 0.6 : 0; - } - __name(compute_text_size, "compute_text_size"); - if (this.constructor.min_height && size2[1] < this.constructor.min_height) { - size2[1] = this.constructor.min_height; - } - size2[1] += 6; - return size2; - } - inResizeCorner(canvasX, canvasY) { - const rows = this.outputs ? this.outputs.length : 1; - const outputs_offset = (this.constructor.slot_start_y || 0) + rows * LiteGraph.NODE_SLOT_HEIGHT; - return isInRectangle( - canvasX, - canvasY, - this.pos[0] + this.size[0] - 15, - this.pos[1] + Math.max(this.size[1] - 15, outputs_offset), - 20, - 20 - ); - } - /** - * returns all the info available about a property of this node. - * @param property name of the property - * @returns the object with all the available info - */ - getPropertyInfo(property) { - let info = null; - if (this.properties_info) { - for (let i2 = 0; i2 < this.properties_info.length; ++i2) { - if (this.properties_info[i2].name == property) { - info = this.properties_info[i2]; - break; - } - } - } - if (this.constructor["@" + property]) - info = this.constructor["@" + property]; - if (this.constructor.widgets_info?.[property]) - info = this.constructor.widgets_info[property]; - if (!info && this.onGetPropertyInfo) { - info = this.onGetPropertyInfo(property); - } - info ||= {}; - info.type ||= typeof this.properties[property]; - if (info.widget == "combo") info.type = "enum"; - return info; - } - /** - * Defines a widget inside the node, it will be rendered on top of the node, you can control lots of properties - * @param type the widget type (could be "number","string","combo" - * @param name the text to show on the widget - * @param value the default value - * @param callback function to call when it changes (optionally, it can be the name of the property to modify) - * @param options the object that contains special properties of this widget - * @returns the created widget object - */ - addWidget(type, name2, value4, callback, options4) { - this.widgets ||= []; - if (!options4 && callback && typeof callback === "object") { - options4 = callback; - callback = null; - } - if (options4 && typeof options4 === "string") - options4 = { property: options4 }; - if (callback && typeof callback === "string") { - options4 ||= {}; - options4.property = callback; - callback = null; - } - if (callback && typeof callback !== "function") { - console.warn("addWidget: callback must be a function"); - callback = null; - } - const w = { - // @ts-expect-error Type check or just assert? - type: type.toLowerCase(), - name: name2, - value: value4, - callback, - options: options4 || {} - }; - if (w.options.y !== void 0) { - w.y = w.options.y; - } - if (!callback && !w.options.callback && !w.options.property) { - console.warn("LiteGraph addWidget(...) without a callback or property assigned"); - } - if (type == "combo" && !w.options.values) { - throw "LiteGraph addWidget('combo',...) requires to pass values in options: { values:['red','blue'] }"; - } - this.widgets.push(w); - this.setSize(this.computeSize()); - return w; - } - addCustomWidget(custom_widget) { - this.widgets ||= []; - this.widgets.push(custom_widget); - return custom_widget; - } - move(deltaX, deltaY) { - if (this.pinned) return; - this.pos[0] += deltaX; - this.pos[1] += deltaY; - } - /** - * Internal method to measure the node for rendering. Prefer {@link boundingRect} where possible. - * - * Populates {@link out} with the results in graph space. - * Adjusts for title and collapsed status, but does not call {@link onBounding}. - * @param out `x, y, width, height` are written to this array. - * @param pad Expands the area by this amount on each side. Default: 0 - */ - measure(out, pad = 0) { - const titleMode = this.constructor.title_mode; - const renderTitle = titleMode != TitleMode.TRANSPARENT_TITLE && titleMode != TitleMode.NO_TITLE; - const titleHeight = renderTitle ? LiteGraph.NODE_TITLE_HEIGHT : 0; - out[0] = this.pos[0] - pad; - out[1] = this.pos[1] + -titleHeight - pad; - if (!this.flags?.collapsed) { - out[2] = this.size[0] + 2 * pad; - out[3] = this.size[1] + titleHeight + 2 * pad; - } else { - out[2] = (this._collapsed_width || LiteGraph.NODE_COLLAPSED_WIDTH) + 2 * pad; - out[3] = LiteGraph.NODE_TITLE_HEIGHT + 2 * pad; - } - } - /** - * returns the bounding of the object, used for rendering purposes - * @param out {Float32Array[4]?} [optional] a place to store the output, to free garbage - * @param includeExternal {boolean?} [optional] set to true to - * include the shadow and connection points in the bounding calculation - * @returns the bounding box in format of [topleft_cornerx, topleft_cornery, width, height] - */ - getBounding(out, includeExternal) { - out ||= new Float32Array(4); - const rect = includeExternal ? this.renderArea : this.boundingRect; - out[0] = rect[0]; - out[1] = rect[1]; - out[2] = rect[2]; - out[3] = rect[3]; - return out; - } - /** - * Calculates the render area of this node, populating both {@link boundingRect} and {@link renderArea}. - * Called automatically at the start of every frame. - */ - updateArea() { - const bounds = this.#boundingRect; - this.measure(bounds); - this.onBounding?.(bounds); - const renderArea = this.#renderArea; - renderArea.set(bounds); - renderArea[0] -= 4; - renderArea[1] -= 4; - renderArea[2] += 6 + 4; - renderArea[3] += 5 + 4; - } - /** - * checks if a point is inside the shape of a node - */ - isPointInside(x2, y2) { - return isInRect(x2, y2, this.boundingRect); - } - /** - * Checks if the provided point is inside this node's collapse button area. - * @param x X co-ordinate to check - * @param y Y co-ordinate to check - * @returns true if the x,y point is in the collapse button area, otherwise false - */ - isPointInCollapse(x2, y2) { - const squareLength = LiteGraph.NODE_TITLE_HEIGHT; - return isInRectangle( - x2, - y2, - this.pos[0], - this.pos[1] - squareLength, - squareLength, - squareLength - ); - } - /** - * checks if a point is inside a node slot, and returns info about which slot - * @param x - * @param y - * @returns if found the object contains { input|output: slot object, slot: number, link_pos: [x,y] } - */ - getSlotInPosition(x2, y2) { - const link_pos = new Float32Array(2); - if (this.inputs) { - for (let i2 = 0, l = this.inputs.length; i2 < l; ++i2) { - const input = this.inputs[i2]; - this.getConnectionPos(true, i2, link_pos); - if (isInRectangle(x2, y2, link_pos[0] - 10, link_pos[1] - 5, 20, 10)) { - return { input, slot: i2, link_pos }; - } - } - } - if (this.outputs) { - for (let i2 = 0, l = this.outputs.length; i2 < l; ++i2) { - const output = this.outputs[i2]; - this.getConnectionPos(false, i2, link_pos); - if (isInRectangle(x2, y2, link_pos[0] - 10, link_pos[1] - 5, 20, 10)) { - return { output, slot: i2, link_pos }; - } - } - } - return null; - } - /** - * Gets the widget on this node at the given co-ordinates. - * @param canvasX X co-ordinate in graph space - * @param canvasY Y co-ordinate in graph space - * @returns The widget found, otherwise `null` - */ - getWidgetOnPos(canvasX, canvasY, includeDisabled = false) { - const { widgets, pos: pos2, size: size2 } = this; - if (!widgets?.length) return null; - const x2 = canvasX - pos2[0]; - const y2 = canvasY - pos2[1]; - const nodeWidth = size2[0]; - for (const widget2 of widgets) { - if (!widget2 || widget2.disabled && !includeDisabled || widget2.hidden || widget2.advanced && !this.showAdvanced) - continue; - const h2 = widget2.computeSize ? widget2.computeSize(nodeWidth)[1] : LiteGraph.NODE_WIDGET_HEIGHT; - const w = widget2.width || nodeWidth; - if (widget2.last_y !== void 0 && isInRectangle(x2, y2, 6, widget2.last_y, w - 12, h2)) - return widget2; - } - return null; - } - findInputSlot(name2, returnObj = false) { - if (!this.inputs) return -1; - for (let i2 = 0, l = this.inputs.length; i2 < l; ++i2) { - if (name2 == this.inputs[i2].name) { - return !returnObj ? i2 : this.inputs[i2]; - } - } - return -1; - } - findOutputSlot(name2, returnObj = false) { - if (!this.outputs) return -1; - for (let i2 = 0, l = this.outputs.length; i2 < l; ++i2) { - if (name2 == this.outputs[i2].name) { - return !returnObj ? i2 : this.outputs[i2]; - } - } - return -1; - } - findInputSlotFree(optsIn) { - return this.#findFreeSlot(this.inputs, optsIn); - } - findOutputSlotFree(optsIn) { - return this.#findFreeSlot(this.outputs, optsIn); - } - /** - * Finds the next free slot - * @param slots The slots to search, i.e. this.inputs or this.outputs - */ - #findFreeSlot(slots, options4) { - const defaults2 = { - returnObj: false, - typesNotAccepted: [] - }; - const opts = Object.assign(defaults2, options4 || {}); - const length = slots?.length; - if (!(length > 0)) return -1; - for (let i2 = 0; i2 < length; ++i2) { - const slot = slots[i2]; - if (!slot || slot.link || slot.links?.length) continue; - if (opts.typesNotAccepted?.includes?.(slot.type)) continue; - return !opts.returnObj ? i2 : slot; - } - return -1; - } - findInputSlotByType(type, returnObj, preferFreeSlot, doNotUseOccupied) { - return this.#findSlotByType( - this.inputs, - type, - returnObj, - preferFreeSlot, - doNotUseOccupied - ); - } - findOutputSlotByType(type, returnObj, preferFreeSlot, doNotUseOccupied) { - return this.#findSlotByType( - this.outputs, - type, - returnObj, - preferFreeSlot, - doNotUseOccupied - ); - } - findSlotByType(input, type, returnObj, preferFreeSlot, doNotUseOccupied) { - return input ? this.#findSlotByType( - this.inputs, - type, - returnObj, - preferFreeSlot, - doNotUseOccupied - ) : this.#findSlotByType( - this.outputs, - type, - returnObj, - preferFreeSlot, - doNotUseOccupied - ); - } - /** - * Finds a matching slot from those provided, returning the slot itself or its index in {@link slots}. - * @param slots Slots to search (this.inputs or this.outputs) - * @param type Type of slot to look for - * @param returnObj If true, returns the slot itself. Otherwise, the index. - * @param preferFreeSlot Prefer a free slot, but if none are found, fall back to an occupied slot. - * @param doNotUseOccupied Do not fall back to occupied slots. - * @see {findSlotByType} - * @see {findOutputSlotByType} - * @see {findInputSlotByType} - * @returns If a match is found, the slot if returnObj is true, otherwise the index. If no matches are found, -1 - */ - #findSlotByType(slots, type, returnObj, preferFreeSlot, doNotUseOccupied) { - const length = slots?.length; - if (!length) return -1; - if (type == "" || type == "*") type = 0; - const sourceTypes = String(type).toLowerCase().split(","); - let occupiedSlot = null; - for (let i2 = 0; i2 < length; ++i2) { - const slot = slots[i2]; - const destTypes = slot.type == "0" || slot.type == "*" ? ["0"] : String(slot.type).toLowerCase().split(","); - for (const sourceType of sourceTypes) { - const source = sourceType == "_event_" ? LiteGraph.EVENT : sourceType; - for (const destType of destTypes) { - const dest = destType == "_event_" ? LiteGraph.EVENT : destType; - if (source == dest || source === "*" || dest === "*") { - if (preferFreeSlot && (slot.links?.length || slot.link != null)) { - occupiedSlot ??= returnObj ? slot : i2; - continue; - } - return returnObj ? slot : i2; - } - } - } - } - return doNotUseOccupied ? -1 : occupiedSlot ?? -1; - } - /** - * Determines the slot index to connect to when attempting to connect by type. - * @param findInputs If true, searches for an input. Otherwise, an output. - * @param node The node at the other end of the connection. - * @param slotType The type of slot at the other end of the connection. - * @param options Search restrictions to adhere to. - * @see {connectByType} - * @see {connectByTypeOutput} - */ - findConnectByTypeSlot(findInputs, node22, slotType, options4) { - if (options4 && typeof options4 === "object") { - if ("firstFreeIfInputGeneralInCase" in options4) options4.wildcardToTyped = !!options4.firstFreeIfInputGeneralInCase; - if ("firstFreeIfOutputGeneralInCase" in options4) options4.wildcardToTyped = !!options4.firstFreeIfOutputGeneralInCase; - if ("generalTypeInCase" in options4) options4.typedToWildcard = !!options4.generalTypeInCase; - } - const optsDef = { - createEventInCase: true, - wildcardToTyped: true, - typedToWildcard: true - }; - const opts = Object.assign(optsDef, options4); - if (node22 && typeof node22 === "number") { - node22 = this.graph.getNodeById(node22); - } - const slot = node22.findSlotByType(findInputs, slotType, false, true); - if (slot >= 0 && slot !== null) return slot; - if (opts.createEventInCase && slotType == LiteGraph.EVENT) { - if (findInputs) return -1; - if (LiteGraph.do_add_triggers_slots) return node22.addOnExecutedOutput(); - } - if (opts.typedToWildcard) { - const generalSlot = node22.findSlotByType(findInputs, 0, false, true, true); - if (generalSlot >= 0) return generalSlot; - } - if (opts.wildcardToTyped && (slotType == 0 || slotType == "*" || slotType == "")) { - const opt = { typesNotAccepted: [LiteGraph.EVENT] }; - const nonEventSlot = findInputs ? node22.findInputSlotFree(opt) : node22.findOutputSlotFree(opt); - if (nonEventSlot >= 0) return nonEventSlot; - } - return null; - } - /** - * connect this node output to the input of another node BY TYPE - * @param slot (could be the number of the slot or the string with the name of the slot) - * @param target_node the target node - * @param target_slotType the input slot type of the target node - * @returns the link_info is created, otherwise null - */ - connectByType(slot, target_node, target_slotType, optsIn) { - const slotIndex = this.findConnectByTypeSlot( - true, - target_node, - target_slotType, - optsIn - ); - if (slotIndex !== null) - return this.connect(slot, target_node, slotIndex, optsIn?.afterRerouteId); - console.debug("[connectByType]: no way to connect type: ", target_slotType, " to node: ", target_node); - return null; - } - /** - * connect this node input to the output of another node BY TYPE - * @param slot (could be the number of the slot or the string with the name of the slot) - * @param source_node the target node - * @param source_slotType the output slot type of the target node - * @returns the link_info is created, otherwise null - */ - connectByTypeOutput(slot, source_node, source_slotType, optsIn) { - if (typeof optsIn === "object") { - if ("firstFreeIfInputGeneralInCase" in optsIn) optsIn.wildcardToTyped = !!optsIn.firstFreeIfInputGeneralInCase; - if ("generalTypeInCase" in optsIn) optsIn.typedToWildcard = !!optsIn.generalTypeInCase; - } - const slotIndex = this.findConnectByTypeSlot( - false, - source_node, - source_slotType, - optsIn - ); - if (slotIndex !== null) - return source_node.connect(slotIndex, this, slot, optsIn?.afterRerouteId); - console.debug("[connectByType]: no way to connect type: ", source_slotType, " to node: ", source_node); - return null; - } - /** - * Connect an output of this node to an input of another node - * @param slot (could be the number of the slot or the string with the name of the slot) - * @param target_node the target node - * @param target_slot the input slot of the target node (could be the number of the slot or the string with the name of the slot, or -1 to connect a trigger) - * @returns the link_info is created, otherwise null - */ - connect(slot, target_node, target_slot, afterRerouteId) { - let targetIndex; - const graph = this.graph; - if (!graph) { - console.log("Connect: Error, node doesn't belong to any graph. Nodes must be added first to a graph before connecting them."); - return null; - } - if (typeof slot === "string") { - slot = this.findOutputSlot(slot); - if (slot == -1) { - if (LiteGraph.debug) console.log("Connect: Error, no slot of name " + slot); - return null; - } - } else if (!this.outputs || slot >= this.outputs.length) { - if (LiteGraph.debug) console.log("Connect: Error, slot number not found"); - return null; - } - if (target_node && typeof target_node === "number") { - target_node = graph.getNodeById(target_node); - } - if (!target_node) throw "target node is null"; - if (target_node == this) return null; - if (typeof target_slot === "string") { - targetIndex = target_node.findInputSlot(target_slot); - if (targetIndex == -1) { - if (LiteGraph.debug) console.log("Connect: Error, no slot of name " + targetIndex); - return null; - } - } else if (target_slot === LiteGraph.EVENT) { - if (LiteGraph.do_add_triggers_slots) { - target_node.changeMode(LGraphEventMode.ON_TRIGGER); - targetIndex = target_node.findInputSlot("onTrigger"); - } else { - return null; - } - } else if (typeof target_slot === "number") { - targetIndex = target_slot; - } else { - targetIndex = 0; - } - if (target_node.onBeforeConnectInput) { - const requestedIndex = target_node.onBeforeConnectInput(targetIndex, target_slot); - targetIndex = typeof requestedIndex === "number" ? requestedIndex : null; - } - if (targetIndex === null || !target_node.inputs || targetIndex >= target_node.inputs.length) { - if (LiteGraph.debug) console.log("Connect: Error, slot number not found"); - return null; - } - let changed = false; - const input = target_node.inputs[targetIndex]; - let link_info = null; - const output = this.outputs[slot]; - if (!this.outputs[slot]) return null; - if (!LiteGraph.isValidConnection(output.type, input.type)) { - this.setDirtyCanvas(false, true); - if (changed) graph.connectionChange(this, link_info); - return null; - } - if (target_node.onConnectInput?.(targetIndex, output.type, output, this, slot) === false) - return null; - if (this.onConnectOutput?.(slot, input.type, input, target_node, targetIndex) === false) - return null; - if (target_node.inputs[targetIndex]?.link != null) { - graph.beforeChange(); - target_node.disconnectInput(targetIndex, true); - changed = true; - } - if (output.links?.length) { - if (output.type === LiteGraph.EVENT && !LiteGraph.allow_multi_output_for_events) { - graph.beforeChange(); - this.disconnectOutput(slot, false, { doProcessChange: false }); - changed = true; - } - } - const nextId = ++graph.state.lastLinkId; - link_info = new LLink( - nextId, - input.type || output.type, - this.id, - slot, - target_node.id, - targetIndex, - afterRerouteId - ); - graph._links.set(link_info.id, link_info); - output.links ??= []; - output.links.push(link_info.id); - target_node.inputs[targetIndex].link = link_info.id; - LLink.getReroutes(graph, link_info).forEach((x2) => x2?.linkIds.add(nextId)); - graph._version++; - this.onConnectionsChange?.( - NodeSlotType.OUTPUT, - slot, - true, - link_info, - output - ); - target_node.onConnectionsChange?.( - NodeSlotType.INPUT, - targetIndex, - true, - link_info, - input - ); - graph.onNodeConnectionChange?.( - NodeSlotType.INPUT, - target_node, - targetIndex, - this, - slot - ); - graph.onNodeConnectionChange?.( - NodeSlotType.OUTPUT, - this, - slot, - target_node, - targetIndex - ); - this.setDirtyCanvas(false, true); - graph.afterChange(); - graph.connectionChange(this); - return link_info; - } - /** - * disconnect one output to an specific node - * @param slot (could be the number of the slot or the string with the name of the slot) - * @param target_node the target node to which this slot is connected [Optional, - * if not target_node is specified all nodes will be disconnected] - * @returns if it was disconnected successfully - */ - disconnectOutput(slot, target_node) { - if (typeof slot === "string") { - slot = this.findOutputSlot(slot); - if (slot == -1) { - if (LiteGraph.debug) console.log("Connect: Error, no slot of name " + slot); - return false; - } - } else if (!this.outputs || slot >= this.outputs.length) { - if (LiteGraph.debug) console.log("Connect: Error, slot number not found"); - return false; - } - const output = this.outputs[slot]; - if (!output || !output.links || output.links.length == 0) return false; - const graph = this.graph; - if (target_node) { - if (typeof target_node === "number") - target_node = graph.getNodeById(target_node); - if (!target_node) throw "Target Node not found"; - for (let i2 = 0, l = output.links.length; i2 < l; i2++) { - const link_id = output.links[i2]; - const link_info = graph._links.get(link_id); - if (link_info.target_id == target_node.id) { - output.links.splice(i2, 1); - const input = target_node.inputs[link_info.target_slot]; - input.link = null; - graph._links.delete(link_id); - graph._version++; - target_node.onConnectionsChange?.( - NodeSlotType.INPUT, - link_info.target_slot, - false, - link_info, - input - ); - this.onConnectionsChange?.( - NodeSlotType.OUTPUT, - slot, - false, - link_info, - output - ); - graph.onNodeConnectionChange?.(NodeSlotType.OUTPUT, this, slot); - graph.onNodeConnectionChange?.(NodeSlotType.INPUT, target_node, link_info.target_slot); - break; - } - } - } else { - for (let i2 = 0, l = output.links.length; i2 < l; i2++) { - const link_id = output.links[i2]; - const link_info = graph._links.get(link_id); - if (!link_info) continue; - target_node = graph.getNodeById(link_info.target_id); - graph._version++; - if (target_node) { - const input = target_node.inputs[link_info.target_slot]; - input.link = null; - target_node.onConnectionsChange?.( - NodeSlotType.INPUT, - link_info.target_slot, - false, - link_info, - input - ); - } - graph._links.delete(link_id); - this.onConnectionsChange?.( - NodeSlotType.OUTPUT, - slot, - false, - link_info, - output - ); - graph.onNodeConnectionChange?.(NodeSlotType.OUTPUT, this, slot); - graph.onNodeConnectionChange?.(NodeSlotType.INPUT, target_node, link_info.target_slot); - } - output.links = null; - } - this.setDirtyCanvas(false, true); - graph.connectionChange(this); - return true; - } - /** - * Disconnect one input - * @param slot Input slot index, or the name of the slot - * @param keepReroutes If `true`, reroutes will not be garbage collected. - * @returns true if disconnected successfully or already disconnected, otherwise false - */ - disconnectInput(slot, keepReroutes) { - if (typeof slot === "string") { - slot = this.findInputSlot(slot); - if (slot == -1) { - if (LiteGraph.debug) console.log("Connect: Error, no slot of name " + slot); - return false; - } - } else if (!this.inputs || slot >= this.inputs.length) { - if (LiteGraph.debug) { - console.log("Connect: Error, slot number not found"); - } - return false; - } - const input = this.inputs[slot]; - if (!input) return false; - const link_id = this.inputs[slot].link; - if (link_id != null) { - this.inputs[slot].link = null; - const link_info = this.graph._links.get(link_id); - if (link_info) { - const target_node = this.graph.getNodeById(link_info.origin_id); - if (!target_node) return false; - const output = target_node.outputs[link_info.origin_slot]; - if (!(output?.links?.length > 0)) return false; - let i2 = 0; - for (const l = output.links.length; i2 < l; i2++) { - if (output.links[i2] == link_id) { - output.links.splice(i2, 1); - break; - } - } - link_info.disconnect(this.graph, keepReroutes); - if (this.graph) this.graph._version++; - this.onConnectionsChange?.( - NodeSlotType.INPUT, - slot, - false, - link_info, - input - ); - target_node.onConnectionsChange?.( - NodeSlotType.OUTPUT, - i2, - false, - link_info, - output - ); - this.graph?.onNodeConnectionChange?.(NodeSlotType.OUTPUT, target_node, i2); - this.graph?.onNodeConnectionChange?.(NodeSlotType.INPUT, this, slot); - } - } - this.setDirtyCanvas(false, true); - this.graph?.connectionChange(this); - return true; - } - /** - * returns the center of a connection point in canvas coords - * @param is_input true if if a input slot, false if it is an output - * @param slot_number (could be the number of the slot or the string with the name of the slot) - * @param out [optional] a place to store the output, to free garbage - * @returns the position - */ - getConnectionPos(is_input, slot_number, out) { - out ||= new Float32Array(2); - const num_slots = is_input ? this.inputs?.length ?? 0 : this.outputs?.length ?? 0; - const offset = LiteGraph.NODE_SLOT_HEIGHT * 0.5; - if (this.flags.collapsed) { - const w = this._collapsed_width || LiteGraph.NODE_COLLAPSED_WIDTH; - if (this.horizontal) { - out[0] = this.pos[0] + w * 0.5; - out[1] = is_input ? this.pos[1] - LiteGraph.NODE_TITLE_HEIGHT : this.pos[1]; - } else { - out[0] = is_input ? this.pos[0] : this.pos[0] + w; - out[1] = this.pos[1] - LiteGraph.NODE_TITLE_HEIGHT * 0.5; - } - return out; - } - if (is_input && slot_number == -1) { - out[0] = this.pos[0] + LiteGraph.NODE_TITLE_HEIGHT * 0.5; - out[1] = this.pos[1] + LiteGraph.NODE_TITLE_HEIGHT * 0.5; - return out; - } - if (is_input && num_slots > slot_number && this.inputs[slot_number].pos) { - out[0] = this.pos[0] + this.inputs[slot_number].pos[0]; - out[1] = this.pos[1] + this.inputs[slot_number].pos[1]; - return out; - } else if (!is_input && num_slots > slot_number && this.outputs[slot_number].pos) { - out[0] = this.pos[0] + this.outputs[slot_number].pos[0]; - out[1] = this.pos[1] + this.outputs[slot_number].pos[1]; - return out; - } - if (this.horizontal) { - out[0] = this.pos[0] + (slot_number + 0.5) * (this.size[0] / num_slots); - out[1] = is_input ? this.pos[1] - LiteGraph.NODE_TITLE_HEIGHT : this.pos[1] + this.size[1]; - return out; - } - out[0] = is_input ? this.pos[0] + offset : this.pos[0] + this.size[0] + 1 - offset; - out[1] = this.pos[1] + (slot_number + 0.7) * LiteGraph.NODE_SLOT_HEIGHT + (this.constructor.slot_start_y || 0); - return out; - } - /** @inheritdoc */ - snapToGrid(snapTo) { - return this.pinned ? false : snapPoint(this.pos, snapTo); - } - /** @see {@link snapToGrid} */ - alignToGrid() { - this.snapToGrid(LiteGraph.CANVAS_GRID_SIZE); - } - /* Console output */ - trace(msg) { - this.console ||= []; - this.console.push(msg); - if (this.console.length > LGraphNode.MAX_CONSOLE) - this.console.shift(); - this.graph.onNodeTrace?.(this, msg); - } - /* Forces to redraw or the main canvas (LGraphNode) or the bg canvas (links) */ - setDirtyCanvas(dirty_foreground, dirty_background) { - this.graph?.canvasAction((c) => c.setDirty(dirty_foreground, dirty_background)); - } - loadImage(url) { - const img = new Image(); - img.src = LiteGraph.node_images_path + url; - img.ready = false; - const that = this; - img.onload = function() { - this.ready = true; - that.setDirtyCanvas(true); - }; - return img; - } - /* Allows to get onMouseMove and onMouseUp events even if the mouse is out of focus */ - captureInput(v2) { - if (!this.graph || !this.graph.list_of_graphcanvas) return; - const list2 = this.graph.list_of_graphcanvas; - for (let i2 = 0; i2 < list2.length; ++i2) { - const c = list2[i2]; - if (!v2 && c.node_capturing_input != this) continue; - c.node_capturing_input = v2 ? this : null; - } - } - get collapsed() { - return !!this.flags.collapsed; - } - get collapsible() { - return !this.pinned && this.constructor.collapsable !== false; - } - /** - * Toggle node collapse (makes it smaller on the canvas) - */ - collapse(force) { - if (!this.collapsible && !force) return; - this.graph._version++; - this.flags.collapsed = !this.flags.collapsed; - this.setDirtyCanvas(true, true); - } - /** - * Toggles advanced mode of the node, showing advanced widgets - */ - toggleAdvanced() { - if (!this.widgets?.some((w) => w.advanced)) return; - this.graph._version++; - this.showAdvanced = !this.showAdvanced; - const prefSize = this.computeSize(); - if (this.size[0] < prefSize[0] || this.size[1] < prefSize[1]) { - this.setSize([ - Math.max(this.size[0], prefSize[0]), - Math.max(this.size[1], prefSize[1]) - ]); - } - this.setDirtyCanvas(true, true); - } - get pinned() { - return !!this.flags.pinned; - } - /** - * Prevents the node being accidentally moved or resized by mouse interaction. - * Toggles pinned state if no value is provided. - */ - pin(v2) { - if (this.graph) { - this.graph._version++; - } - this.flags.pinned = v2 ?? !this.flags.pinned; - this.resizable = !this.pinned; - if (!this.pinned) delete this.flags.pinned; - } - unpin() { - this.pin(false); - } - localToScreen(x2, y2, dragAndScale) { - return [ - (x2 + this.pos[0]) * dragAndScale.scale + dragAndScale.offset[0], - (y2 + this.pos[1]) * dragAndScale.scale + dragAndScale.offset[1] - ]; - } - get width() { - return this.collapsed ? this._collapsed_width || LiteGraph.NODE_COLLAPSED_WIDTH : this.size[0]; - } - get height() { - return this.collapsed ? LiteGraph.NODE_COLLAPSED_HEIGHT : this.size[1]; - } - drawBadges(ctx, { gap = 2 } = {}) { - const badgeInstances = this.badges.map((badge) => badge instanceof LGraphBadge ? badge : badge()); - const isLeftAligned = this.badgePosition === BadgePosition.TopLeft; - let currentX = isLeftAligned ? 0 : this.width - badgeInstances.reduce((acc, badge) => acc + badge.getWidth(ctx) + gap, 0); - const y2 = -(LiteGraph.NODE_TITLE_HEIGHT + gap); - for (const badge of badgeInstances) { - badge.draw(ctx, currentX, y2 - badge.height); - currentX += badge.getWidth(ctx) + gap; - } - } - /** - * Attempts to gracefully bypass this node in all of its connections by reconnecting all links. - * - * Each input is checked against each output. This is done on a matching index basis, i.e. input 3 -> output 3. - * If there are any input links remaining, - * and {@link flags}.{@link INodeFlags.keepAllLinksOnBypass keepAllLinksOnBypass} is `true`, - * each input will check for outputs that match, and take the first one that matches - * `true`: Try the index matching first, then every input to every output. - * `false`: Only matches indexes, e.g. input 3 to output 3. - * - * If {@link flags}.{@link INodeFlags.keepAllLinksOnBypass keepAllLinksOnBypass} is `undefined`, it will fall back to - * the static {@link keepAllLinksOnBypass}. - * @returns `true` if any new links were established, otherwise `false`. - * @todo Decision: Change API to return array of new links instead? - */ - connectInputToOutput() { - const { inputs, outputs, graph } = this; - if (!inputs || !outputs) return; - const { _links } = graph; - let madeAnyConnections = false; - for (const [index2, input] of inputs.entries()) { - const output = outputs[index2]; - if (!output || !LiteGraph.isValidConnection(input.type, output.type)) continue; - const inLink = _links.get(input.link); - const inNode = graph.getNodeById(inLink?.origin_id); - if (!inNode) continue; - bypassAllLinks(output, inNode, inLink); - } - if (!(this.flags.keepAllLinksOnBypass ?? LGraphNode.keepAllLinksOnBypass)) - return madeAnyConnections; - for (const input of inputs) { - const inLink = _links.get(input.link); - const inNode = graph.getNodeById(inLink?.origin_id); - if (!inNode) continue; - for (const output of outputs) { - if (!LiteGraph.isValidConnection(input.type, output.type)) continue; - bypassAllLinks(output, inNode, inLink); - break; - } - } - return madeAnyConnections; - function bypassAllLinks(output, inNode, inLink) { - const outLinks = output.links?.map((x2) => _links.get(x2)).filter((x2) => !!x2); - if (!outLinks?.length) return; - for (const outLink of outLinks) { - const outNode = graph.getNodeById(outLink.target_id); - if (!outNode) return; - const result = inNode.connect( - inLink.origin_slot, - outNode, - outLink.target_slot, - inLink.parentId - ); - madeAnyConnections ||= !!result; - } - } - __name(bypassAllLinks, "bypassAllLinks"); - } -} -class LGraphGroup { - static { - __name(this, "LGraphGroup"); - } - static minWidth = 140; - static minHeight = 80; - static resizeLength = 10; - static padding = 4; - static defaultColour = "#335"; - id; - color; - title; - font; - font_size = LiteGraph.DEFAULT_GROUP_FONT || 24; - _bounding = new Float32Array([ - 10, - 10, - LGraphGroup.minWidth, - LGraphGroup.minHeight - ]); - _pos = this._bounding.subarray(0, 2); - _size = this._bounding.subarray(2, 4); - /** @deprecated See {@link _children} */ - _nodes = []; - _children = /* @__PURE__ */ new Set(); - graph = null; - flags = {}; - selected; - constructor(title, id3) { - this.id = id3 ?? -1; - this.title = title || "Group"; - this.color = LGraphCanvas.node_colors.pale_blue ? LGraphCanvas.node_colors.pale_blue.groupcolor : "#AAA"; - } - /** Position of the group, as x,y co-ordinates in graph space */ - get pos() { - return this._pos; - } - set pos(v2) { - if (!v2 || v2.length < 2) return; - this._pos[0] = v2[0]; - this._pos[1] = v2[1]; - } - /** Size of the group, as width,height in graph units */ - get size() { - return this._size; - } - set size(v2) { - if (!v2 || v2.length < 2) return; - this._size[0] = Math.max(LGraphGroup.minWidth, v2[0]); - this._size[1] = Math.max(LGraphGroup.minHeight, v2[1]); - } - get boundingRect() { - return this._bounding; - } - get nodes() { - return this._nodes; - } - get titleHeight() { - return this.font_size * 1.4; - } - get children() { - return this._children; - } - get pinned() { - return !!this.flags.pinned; - } - /** - * Prevents the group being accidentally moved or resized by mouse interaction. - * Toggles pinned state if no value is provided. - */ - pin(value4) { - const newState = value4 === void 0 ? !this.pinned : value4; - if (newState) this.flags.pinned = true; - else delete this.flags.pinned; - } - unpin() { - this.pin(false); - } - configure(o) { - this.id = o.id; - this.title = o.title; - this._bounding.set(o.bounding); - this.color = o.color; - this.flags = o.flags || this.flags; - if (o.font_size) this.font_size = o.font_size; - } - serialize() { - const b = this._bounding; - return { - id: this.id, - title: this.title, - bounding: [...b], - color: this.color, - font_size: this.font_size, - flags: this.flags - }; - } - /** - * Draws the group on the canvas - * @param graphCanvas - * @param ctx - */ - draw(graphCanvas, ctx) { - const { padding, resizeLength, defaultColour } = LGraphGroup; - const font_size = this.font_size || LiteGraph.DEFAULT_GROUP_FONT_SIZE; - const [x2, y2] = this._pos; - const [width2, height] = this._size; - ctx.globalAlpha = 0.25 * graphCanvas.editor_alpha; - ctx.fillStyle = this.color || defaultColour; - ctx.strokeStyle = this.color || defaultColour; - ctx.beginPath(); - ctx.rect(x2 + 0.5, y2 + 0.5, width2, font_size * 1.4); - ctx.fill(); - ctx.fillStyle = this.color; - ctx.strokeStyle = this.color; - ctx.beginPath(); - ctx.rect(x2 + 0.5, y2 + 0.5, width2, height); - ctx.fill(); - ctx.globalAlpha = graphCanvas.editor_alpha; - ctx.stroke(); - ctx.beginPath(); - ctx.moveTo(x2 + width2, y2 + height); - ctx.lineTo(x2 + width2 - resizeLength, y2 + height); - ctx.lineTo(x2 + width2, y2 + height - resizeLength); - ctx.fill(); - ctx.font = font_size + "px Arial"; - ctx.textAlign = "left"; - ctx.fillText(this.title + (this.pinned ? "📌" : ""), x2 + padding, y2 + font_size); - if (LiteGraph.highlight_selected_group && this.selected) { - graphCanvas.strokeShape(ctx, this._bounding, { - title_height: this.titleHeight, - padding - }); - } - } - resize(width2, height) { - if (this.pinned) return false; - this._size[0] = Math.max(LGraphGroup.minWidth, width2); - this._size[1] = Math.max(LGraphGroup.minHeight, height); - return true; - } - move(deltaX, deltaY, skipChildren = false) { - if (this.pinned) return; - this._pos[0] += deltaX; - this._pos[1] += deltaY; - if (skipChildren === true) return; - for (const item3 of this._children) { - item3.move(deltaX, deltaY); - } - } - /** @inheritdoc */ - snapToGrid(snapTo) { - return this.pinned ? false : snapPoint(this.pos, snapTo); - } - recomputeInsideNodes() { - const { nodes, reroutes, groups } = this.graph; - const children = this._children; - this._nodes.length = 0; - children.clear(); - for (const node22 of nodes) { - if (containsCentre(this._bounding, node22.boundingRect)) { - this._nodes.push(node22); - children.add(node22); - } - } - for (const reroute of reroutes.values()) { - if (isPointInRect(reroute.pos, this._bounding)) - children.add(reroute); - } - for (const group of groups) { - if (containsRect(this._bounding, group._bounding)) - children.add(group); - } - groups.sort((a, b) => { - if (a === this) { - return children.has(b) ? -1 : 0; - } else if (b === this) { - return children.has(a) ? 1 : 0; - } - }); - } - /** - * Resizes and moves the group to neatly fit all given {@link objects}. - * @param objects All objects that should be inside the group - * @param padding Value in graph units to add to all sides of the group. Default: 10 - */ - resizeTo(objects, padding = 10) { - const boundingBox = createBounds(objects, padding); - if (boundingBox === null) return; - this.pos[0] = boundingBox[0]; - this.pos[1] = boundingBox[1] - this.titleHeight; - this.size[0] = boundingBox[2]; - this.size[1] = boundingBox[3] + this.titleHeight; - } - /** - * Add nodes to the group and adjust the group's position and size accordingly - * @param nodes The nodes to add to the group - * @param padding The padding around the group - */ - addNodes(nodes, padding = 10) { - if (!this._nodes && nodes.length === 0) return; - this.resizeTo([...this.children, ...this._nodes, ...nodes], padding); - } - getMenuOptions() { - return [ - { - content: this.pinned ? "Unpin" : "Pin", - callback: /* @__PURE__ */ __name(() => { - if (this.pinned) this.unpin(); - else this.pin(); - this.setDirtyCanvas(false, true); - }, "callback") - }, - null, - { content: "Title", callback: LGraphCanvas.onShowPropertyEditor }, - { - content: "Color", - has_submenu: true, - callback: LGraphCanvas.onMenuNodeColors - }, - { - content: "Font size", - property: "font_size", - type: "Number", - callback: LGraphCanvas.onShowPropertyEditor - }, - null, - { content: "Remove", callback: LGraphCanvas.onMenuNodeRemove } - ]; - } - isPointInTitlebar(x2, y2) { - const b = this.boundingRect; - return isInRectangle(x2, y2, b[0], b[1], b[2], this.titleHeight); - } - isInResize(x2, y2) { - const b = this.boundingRect; - const right = b[0] + b[2]; - const bottom = b[1] + b[3]; - return x2 < right && y2 < bottom && x2 - right + (y2 - bottom) > -LGraphGroup.resizeLength; - } - isPointInside = LGraphNode.prototype.isPointInside; - setDirtyCanvas = LGraphNode.prototype.setDirtyCanvas; -} -var SlotType = /* @__PURE__ */ ((SlotType2) => { - SlotType2["Array"] = "array"; - SlotType2[SlotType2["Event"] = -1] = "Event"; - return SlotType2; -})(SlotType || {}); -var SlotShape = ((SlotShape2) => { - SlotShape2[SlotShape2["Box"] = RenderShape.BOX] = "Box"; - SlotShape2[SlotShape2["Arrow"] = RenderShape.ARROW] = "Arrow"; - SlotShape2[SlotShape2["Grid"] = RenderShape.GRID] = "Grid"; - SlotShape2[SlotShape2["Circle"] = RenderShape.CIRCLE] = "Circle"; - SlotShape2[SlotShape2["HollowCircle"] = RenderShape.HollowCircle] = "HollowCircle"; - return SlotShape2; -})(SlotShape || {}); -var SlotDirection = ((SlotDirection2) => { - SlotDirection2[SlotDirection2["Up"] = LinkDirection.UP] = "Up"; - SlotDirection2[SlotDirection2["Right"] = LinkDirection.RIGHT] = "Right"; - SlotDirection2[SlotDirection2["Down"] = LinkDirection.DOWN] = "Down"; - SlotDirection2[SlotDirection2["Left"] = LinkDirection.LEFT] = "Left"; - return SlotDirection2; -})(SlotDirection || {}); -var LabelPosition = /* @__PURE__ */ ((LabelPosition2) => { - LabelPosition2["Left"] = "left"; - LabelPosition2["Right"] = "right"; - return LabelPosition2; -})(LabelPosition || {}); -function drawSlot(ctx, slot, pos2, { - label_color = "#AAA", - label_position = "right", - horizontal: horizontal2 = false, - low_quality = false, - render_text = true, - do_stroke = false, - highlight = false -} = {}) { - const originalFillStyle = ctx.fillStyle; - const originalStrokeStyle = ctx.strokeStyle; - const originalLineWidth = ctx.lineWidth; - const slot_type = slot.type; - const slot_shape = slot_type === "array" ? SlotShape.Grid : slot.shape; - ctx.beginPath(); - let doStroke = do_stroke; - let doFill = true; - if (slot_type === -1 || slot_shape === SlotShape.Box) { - if (horizontal2) { - ctx.rect(pos2[0] - 5 + 0.5, pos2[1] - 8 + 0.5, 10, 14); - } else { - ctx.rect(pos2[0] - 6 + 0.5, pos2[1] - 5 + 0.5, 14, 10); - } - } else if (slot_shape === SlotShape.Arrow) { - ctx.moveTo(pos2[0] + 8, pos2[1] + 0.5); - ctx.lineTo(pos2[0] - 4, pos2[1] + 6 + 0.5); - ctx.lineTo(pos2[0] - 4, pos2[1] - 6 + 0.5); - ctx.closePath(); - } else if (slot_shape === SlotShape.Grid) { - const gridSize = 3; - const cellSize = 2; - const spacing = 3; - for (let x2 = 0; x2 < gridSize; x2++) { - for (let y2 = 0; y2 < gridSize; y2++) { - ctx.rect( - pos2[0] - 4 + x2 * spacing, - pos2[1] - 4 + y2 * spacing, - cellSize, - cellSize - ); - } - } - doStroke = false; - } else { - if (low_quality) { - ctx.rect(pos2[0] - 4, pos2[1] - 4, 8, 8); - } else { - let radius; - if (slot_shape === SlotShape.HollowCircle) { - doFill = false; - doStroke = true; - ctx.lineWidth = 3; - ctx.strokeStyle = ctx.fillStyle; - radius = highlight ? 4 : 3; - } else { - radius = highlight ? 5 : 4; - } - ctx.arc(pos2[0], pos2[1], radius, 0, Math.PI * 2); - } - } - if (doFill) ctx.fill(); - if (!low_quality && doStroke) ctx.stroke(); - if (render_text) { - const text2 = slot.label || slot.localized_name || slot.name; - if (text2) { - ctx.fillStyle = label_color; - if (label_position === "right") { - if (horizontal2 || slot.dir == LinkDirection.UP) { - ctx.fillText(text2, pos2[0], pos2[1] - 10); - } else { - ctx.fillText(text2, pos2[0] + 10, pos2[1] + 5); - } - } else { - if (horizontal2 || slot.dir == LinkDirection.DOWN) { - ctx.fillText(text2, pos2[0], pos2[1] - 8); - } else { - ctx.fillText(text2, pos2[0] - 10, pos2[1] + 5); - } - } - } - } - ctx.fillStyle = originalFillStyle; - ctx.strokeStyle = originalStrokeStyle; - ctx.lineWidth = originalLineWidth; -} -__name(drawSlot, "drawSlot"); -class DragAndScale { - static { - __name(this, "DragAndScale"); - } - /** - * The state of this DragAndScale instance. - * - * Implemented as a POCO that can be proxied without side-effects. - */ - state; - /** Maximum scale (zoom in) */ - max_scale; - /** Minimum scale (zoom out) */ - min_scale; - enabled; - last_mouse; - element; - visible_area; - _binded_mouse_callback; - dragging; - viewport; - get offset() { - return this.state.offset; - } - set offset(value4) { - this.state.offset = value4; - } - get scale() { - return this.state.scale; - } - set scale(value4) { - this.state.scale = value4; - } - constructor(element, skip_events) { - this.state = { - offset: new Float32Array([0, 0]), - scale: 1 - }; - this.max_scale = 10; - this.min_scale = 0.1; - this.onredraw = null; - this.enabled = true; - this.last_mouse = [0, 0]; - this.element = null; - this.visible_area = new Float32Array(4); - if (element) { - this.element = element; - if (!skip_events) { - this.bindEvents(element); - } - } - } - /** @deprecated Has not been kept up to date */ - bindEvents(element) { - this.last_mouse = new Float32Array(2); - this._binded_mouse_callback = this.onMouse.bind(this); - LiteGraph.pointerListenerAdd(element, "down", this._binded_mouse_callback); - LiteGraph.pointerListenerAdd(element, "move", this._binded_mouse_callback); - LiteGraph.pointerListenerAdd(element, "up", this._binded_mouse_callback); - element.addEventListener("mousewheel", this._binded_mouse_callback, false); - element.addEventListener("wheel", this._binded_mouse_callback, false); - } - computeVisibleArea(viewport) { - if (!this.element) { - this.visible_area[0] = this.visible_area[1] = this.visible_area[2] = this.visible_area[3] = 0; - return; - } - let width2 = this.element.width; - let height = this.element.height; - let startx = -this.offset[0]; - let starty = -this.offset[1]; - if (viewport) { - startx += viewport[0] / this.scale; - starty += viewport[1] / this.scale; - width2 = viewport[2]; - height = viewport[3]; - } - const endx = startx + width2 / this.scale; - const endy = starty + height / this.scale; - this.visible_area[0] = startx; - this.visible_area[1] = starty; - this.visible_area[2] = endx - startx; - this.visible_area[3] = endy - starty; - } - /** @deprecated Has not been kept up to date */ - onMouse(e2) { - if (!this.enabled) { - return; - } - const canvas = this.element; - const rect = canvas.getBoundingClientRect(); - const x2 = e2.clientX - rect.left; - const y2 = e2.clientY - rect.top; - e2.canvasx = x2; - e2.canvasy = y2; - e2.dragging = this.dragging; - const is_inside = !this.viewport || isInRect(x2, y2, this.viewport); - let ignore = false; - if (this.onmouse) { - ignore = this.onmouse(e2); - } - if (e2.type == LiteGraph.pointerevents_method + "down" && is_inside) { - this.dragging = true; - LiteGraph.pointerListenerRemove(canvas, "move", this._binded_mouse_callback); - LiteGraph.pointerListenerAdd(document, "move", this._binded_mouse_callback); - LiteGraph.pointerListenerAdd(document, "up", this._binded_mouse_callback); - } else if (e2.type == LiteGraph.pointerevents_method + "move") { - if (!ignore) { - const deltax = x2 - this.last_mouse[0]; - const deltay = y2 - this.last_mouse[1]; - if (this.dragging) { - this.mouseDrag(deltax, deltay); - } - } - } else if (e2.type == LiteGraph.pointerevents_method + "up") { - this.dragging = false; - LiteGraph.pointerListenerRemove(document, "move", this._binded_mouse_callback); - LiteGraph.pointerListenerRemove(document, "up", this._binded_mouse_callback); - LiteGraph.pointerListenerAdd(canvas, "move", this._binded_mouse_callback); - } else if (is_inside && (e2.type == "mousewheel" || e2.type == "wheel" || e2.type == "DOMMouseScroll")) { - e2.eventType = "mousewheel"; - if (e2.type == "wheel") e2.wheel = -e2.deltaY; - else e2.wheel = e2.wheelDeltaY != null ? e2.wheelDeltaY : e2.detail * -60; - e2.delta = e2.wheelDelta ? e2.wheelDelta / 40 : e2.deltaY ? -e2.deltaY / 3 : 0; - this.changeDeltaScale(1 + e2.delta * 0.05); - } - this.last_mouse[0] = x2; - this.last_mouse[1] = y2; - if (is_inside) { - e2.preventDefault(); - e2.stopPropagation(); - return false; - } - } - toCanvasContext(ctx) { - ctx.scale(this.scale, this.scale); - ctx.translate(this.offset[0], this.offset[1]); - } - convertOffsetToCanvas(pos2) { - return [ - (pos2[0] + this.offset[0]) * this.scale, - (pos2[1] + this.offset[1]) * this.scale - ]; - } - convertCanvasToOffset(pos2, out) { - out = out || [0, 0]; - out[0] = pos2[0] / this.scale - this.offset[0]; - out[1] = pos2[1] / this.scale - this.offset[1]; - return out; - } - /** @deprecated Has not been kept up to date */ - mouseDrag(x2, y2) { - this.offset[0] += x2 / this.scale; - this.offset[1] += y2 / this.scale; - this.onredraw?.(this); - } - changeScale(value4, zooming_center) { - if (value4 < this.min_scale) { - value4 = this.min_scale; - } else if (value4 > this.max_scale) { - value4 = this.max_scale; - } - if (value4 == this.scale) return; - if (!this.element) return; - const rect = this.element.getBoundingClientRect(); - if (!rect) return; - zooming_center = zooming_center || [rect.width * 0.5, rect.height * 0.5]; - zooming_center[0] -= rect.x; - zooming_center[1] -= rect.y; - const center = this.convertCanvasToOffset(zooming_center); - this.scale = value4; - if (Math.abs(this.scale - 1) < 0.01) this.scale = 1; - const new_center = this.convertCanvasToOffset(zooming_center); - const delta_offset = [ - new_center[0] - center[0], - new_center[1] - center[1] - ]; - this.offset[0] += delta_offset[0]; - this.offset[1] += delta_offset[1]; - this.onredraw?.(this); - } - changeDeltaScale(value4, zooming_center) { - this.changeScale(this.scale * value4, zooming_center); - } - reset() { - this.scale = 1; - this.offset[0] = 0; - this.offset[1] = 0; - } -} -function stringOrNull(value4) { - return value4 == null ? null : String(value4); -} -__name(stringOrNull, "stringOrNull"); -function stringOrEmpty(value4) { - return value4 == null ? "" : String(value4); -} -__name(stringOrEmpty, "stringOrEmpty"); -function getBoundaryNodes(nodes) { - const valid = nodes?.find((x2) => x2); - if (!valid) return null; - let top = valid; - let right = valid; - let bottom = valid; - let left = valid; - for (const node22 of nodes) { - if (!node22) continue; - const [x2, y2] = node22.pos; - const [width2, height] = node22.size; - if (y2 < top.pos[1]) top = node22; - if (x2 + width2 > right.pos[0] + right.size[0]) right = node22; - if (y2 + height > bottom.pos[1] + bottom.size[1]) bottom = node22; - if (x2 < left.pos[0]) left = node22; - } - return { - top, - right, - bottom, - left - }; -} -__name(getBoundaryNodes, "getBoundaryNodes"); -function distributeNodes(nodes, horizontal2) { - const nodeCount = nodes?.length; - if (!(nodeCount > 1)) return; - const index2 = horizontal2 ? 0 : 1; - let total = 0; - let highest = -Infinity; - for (const node22 of nodes) { - total += node22.size[index2]; - const high = node22.pos[index2] + node22.size[index2]; - if (high > highest) highest = high; - } - const sorted = [...nodes].sort((a, b) => a.pos[index2] - b.pos[index2]); - const lowest = sorted[0].pos[index2]; - const gap = (highest - lowest - total) / (nodeCount - 1); - let startAt = lowest; - for (let i2 = 0; i2 < nodeCount; i2++) { - const node22 = sorted[i2]; - node22.pos[index2] = startAt + gap * i2; - startAt += node22.size[index2]; - } -} -__name(distributeNodes, "distributeNodes"); -function alignNodes(nodes, direction, align_to) { - if (!nodes) return; - const boundary = align_to === void 0 ? getBoundaryNodes(nodes) : { top: align_to, right: align_to, bottom: align_to, left: align_to }; - if (boundary === null) return; - for (const node22 of nodes) { - switch (direction) { - case "right": - node22.pos[0] = boundary.right.pos[0] + boundary.right.size[0] - node22.size[0]; - break; - case "left": - node22.pos[0] = boundary.left.pos[0]; - break; - case "top": - node22.pos[1] = boundary.top.pos[1]; - break; - case "bottom": - node22.pos[1] = boundary.bottom.pos[1] + boundary.bottom.size[1] - node22.size[1]; - break; - } - } -} -__name(alignNodes, "alignNodes"); -function getAllNestedItems(items2) { - const allItems = /* @__PURE__ */ new Set(); - items2?.forEach((x2) => addRecursively(x2, allItems)); - return allItems; - function addRecursively(item3, flatSet) { - if (flatSet.has(item3) || item3.pinned) return; - flatSet.add(item3); - item3.children?.forEach((x2) => addRecursively(x2, flatSet)); - } - __name(addRecursively, "addRecursively"); -} -__name(getAllNestedItems, "getAllNestedItems"); -function findFirstNode(items2) { - for (const item3 of items2) { - if (item3 instanceof LGraphNode) return item3; - } -} -__name(findFirstNode, "findFirstNode"); -class CanvasPointer { - static { - __name(this, "CanvasPointer"); - } - /** Maximum time in milliseconds to ignore click drift */ - static bufferTime = 150; - /** Maximum gap between pointerup and pointerdown events to be considered as a double click */ - static doubleClickTime = 300; - /** Maximum offset from click location */ - static get maxClickDrift() { - return this.#maxClickDrift; - } - static set maxClickDrift(value4) { - this.#maxClickDrift = value4; - this.#maxClickDrift2 = value4 * value4; - } - static #maxClickDrift = 6; - /** {@link maxClickDrift} squared. Used to calculate click drift without `sqrt`. */ - static #maxClickDrift2 = this.#maxClickDrift ** 2; - /** The element this PointerState should capture input against when dragging. */ - element; - /** Pointer ID used by drag capture. */ - pointerId; - /** Set to true when if the pointer moves far enough after a down event, before the corresponding up event is fired. */ - dragStarted = false; - /** The {@link eUp} from the last successful click */ - eLastDown; - /** Used downstream for touch event support. */ - isDouble = false; - /** Used downstream for touch event support. */ - isDown = false; - /** - * If `true`, {@link eDown}, {@link eMove}, and {@link eUp} will be set to - * `null` when {@link reset} is called. - * - * Default: `true` - */ - clearEventsOnReset = true; - /** The last pointerdown event for the primary button */ - eDown = null; - /** The last pointermove event for the primary button */ - eMove = null; - /** The last pointerup event for the primary button */ - eUp = null; - /** - * Run-once callback, called at the end of any click or drag, whether or not it was successful in any way. - * - * The setter of this callback will call the existing value before replacing it. - * Therefore, simply setting this value twice will execute the first callback. - */ - get finally() { - return this.#finally; - } - set finally(value4) { - try { - this.#finally?.(); - } finally { - this.#finally = value4; - } - } - #finally; - constructor(element) { - this.element = element; - } - /** - * Callback for `pointerdown` events. To be used as the event handler (or called by it). - * @param e The `pointerdown` event - */ - down(e2) { - this.reset(); - this.eDown = e2; - this.pointerId = e2.pointerId; - this.element.setPointerCapture(e2.pointerId); - } - /** - * Callback for `pointermove` events. To be used as the event handler (or called by it). - * @param e The `pointermove` event - */ - move(e2) { - const { eDown } = this; - if (!eDown) return; - if (!e2.buttons) { - this.reset(); - return; - } - if (!(e2.buttons & eDown.buttons)) { - this.#completeClick(e2); - this.reset(); - return; - } - this.eMove = e2; - this.onDrag?.(e2); - if (this.dragStarted) return; - const longerThanBufferTime = e2.timeStamp - eDown.timeStamp > CanvasPointer.bufferTime; - if (longerThanBufferTime || !this.#hasSamePosition(e2, eDown)) { - this.#setDragStarted(); - } - } - /** - * Callback for `pointerup` events. To be used as the event handler (or called by it). - * @param e The `pointerup` event - */ - up(e2) { - if (e2.button !== this.eDown?.button) return false; - this.#completeClick(e2); - const { dragStarted } = this; - this.reset(); - return !dragStarted; - } - #completeClick(e2) { - const { eDown } = this; - if (!eDown) return; - this.eUp = e2; - if (this.dragStarted) { - this.onDragEnd?.(e2); - } else if (!this.#hasSamePosition(e2, eDown)) { - this.#setDragStarted(); - this.onDragEnd?.(e2); - } else if (this.onDoubleClick && this.#isDoubleClick()) { - this.onDoubleClick(e2); - this.eLastDown = void 0; - } else { - this.onClick?.(e2); - this.eLastDown = eDown; - } - } - /** - * Checks if two events occurred near each other - not further apart than the maximum click drift. - * @param a The first event to compare - * @param b The second event to compare - * @param tolerance2 The maximum distance (squared) before the positions are considered different - * @returns `true` if the two events were no more than {@link maxClickDrift} apart, otherwise `false` - */ - #hasSamePosition(a, b, tolerance2 = CanvasPointer.#maxClickDrift2) { - const drift = dist2(a.clientX, a.clientY, b.clientX, b.clientY); - return drift <= tolerance2; - } - /** - * Checks whether the pointer is currently past the max click drift threshold. - * @returns `true` if the latest pointer event is past the the click drift threshold - */ - #isDoubleClick() { - const { eDown, eLastDown } = this; - if (!eDown || !eLastDown) return false; - const tolerance2 = (3 * CanvasPointer.#maxClickDrift) ** 2; - const diff2 = eDown.timeStamp - eLastDown.timeStamp; - return diff2 > 0 && diff2 < CanvasPointer.doubleClickTime && this.#hasSamePosition(eDown, eLastDown, tolerance2); - } - #setDragStarted() { - this.dragStarted = true; - this.onDragStart?.(this); - delete this.onDragStart; - } - /** - * Resets the state of this {@link CanvasPointer} instance. - * - * The {@link finally} callback is first executed, then all callbacks and intra-click - * state is cleared. - */ - reset() { - this.finally = void 0; - delete this.onClick; - delete this.onDoubleClick; - delete this.onDragStart; - delete this.onDrag; - delete this.onDragEnd; - this.isDown = false; - this.isDouble = false; - this.dragStarted = false; - if (this.clearEventsOnReset) { - this.eDown = null; - this.eMove = null; - this.eUp = null; - } - const { element, pointerId } = this; - if (element.hasPointerCapture(pointerId)) - element.releasePointerCapture(pointerId); - } -} -class LGraphCanvas { - static { - __name(this, "LGraphCanvas"); - } - // Optimised buffers used during rendering - static #temp = new Float32Array(4); - static #temp_vec2 = new Float32Array(2); - static #tmp_area = new Float32Array(4); - static #margin_area = new Float32Array(4); - static #link_bounding = new Float32Array(4); - static #tempA = new Float32Array(2); - static #tempB = new Float32Array(2); - static #lTempA = new Float32Array(2); - static #lTempB = new Float32Array(2); - static #lTempC = new Float32Array(2); - static DEFAULT_BACKGROUND_IMAGE = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQBJREFUeNrs1rEKwjAUhlETUkj3vP9rdmr1Ysammk2w5wdxuLgcMHyptfawuZX4pJSWZTnfnu/lnIe/jNNxHHGNn//HNbbv+4dr6V+11uF527arU7+u63qfa/bnmh8sWLBgwYJlqRf8MEptXPBXJXa37BSl3ixYsGDBMliwFLyCV/DeLIMFCxYsWLBMwSt4Be/NggXLYMGCBUvBK3iNruC9WbBgwYJlsGApeAWv4L1ZBgsWLFiwYJmCV/AK3psFC5bBggULloJX8BpdwXuzYMGCBctgwVLwCl7Be7MMFixYsGDBsu8FH1FaSmExVfAxBa/gvVmwYMGCZbBg/W4vAQYA5tRF9QYlv/QAAAAASUVORK5CYII="; - /** Initialised from LiteGraphGlobal static block to avoid circular dependency. */ - static link_type_colors; - static gradients = {}; - // cache of gradients - static search_limit = -1; - static node_colors = { - red: { color: "#322", bgcolor: "#533", groupcolor: "#A88" }, - brown: { color: "#332922", bgcolor: "#593930", groupcolor: "#b06634" }, - green: { color: "#232", bgcolor: "#353", groupcolor: "#8A8" }, - blue: { color: "#223", bgcolor: "#335", groupcolor: "#88A" }, - pale_blue: { - color: "#2a363b", - bgcolor: "#3f5159", - groupcolor: "#3f789e" - }, - cyan: { color: "#233", bgcolor: "#355", groupcolor: "#8AA" }, - purple: { color: "#323", bgcolor: "#535", groupcolor: "#a1309b" }, - yellow: { color: "#432", bgcolor: "#653", groupcolor: "#b58b2a" }, - black: { color: "#222", bgcolor: "#000", groupcolor: "#444" } - }; - /** - * The state of this canvas, e.g. whether it is being dragged, or read-only. - * - * Implemented as a POCO that can be proxied without side-effects. - */ - state = { - draggingItems: false, - draggingCanvas: false, - readOnly: false, - hoveringOver: CanvasItem.Nothing, - shouldSetCursor: true - }; - #updateCursorStyle() { - if (this.state.shouldSetCursor) { - let cursor = "default"; - if (this.state.draggingCanvas) { - cursor = "grabbing"; - } else if (this.state.readOnly) { - cursor = "grab"; - } else if (this.state.hoveringOver & CanvasItem.ResizeSe) { - cursor = "se-resize"; - } else if (this.state.hoveringOver & CanvasItem.Node) { - cursor = "crosshair"; - } - this.canvas.style.cursor = cursor; - } - } - // Whether the canvas was previously being dragged prior to pressing space key. - // null if space key is not pressed. - _previously_dragging_canvas = null; - // #region Legacy accessors - /** @deprecated @inheritdoc {@link LGraphCanvasState.readOnly} */ - get read_only() { - return this.state.readOnly; - } - set read_only(value4) { - this.state.readOnly = value4; - this.#updateCursorStyle(); - } - get isDragging() { - return this.state.draggingItems; - } - set isDragging(value4) { - this.state.draggingItems = value4; - } - get hoveringOver() { - return this.state.hoveringOver; - } - set hoveringOver(value4) { - this.state.hoveringOver = value4; - this.#updateCursorStyle(); - } - /** @deprecated Replace all references with {@link pointer}.{@link CanvasPointer.isDown isDown}. */ - get pointer_is_down() { - return this.pointer.isDown; - } - /** @deprecated Replace all references with {@link pointer}.{@link CanvasPointer.isDouble isDouble}. */ - get pointer_is_double() { - return this.pointer.isDouble; - } - /** @deprecated @inheritdoc {@link LGraphCanvasState.draggingCanvas} */ - get dragging_canvas() { - return this.state.draggingCanvas; - } - set dragging_canvas(value4) { - this.state.draggingCanvas = value4; - this.#updateCursorStyle(); - } - // #endregion Legacy accessors - get title_text_font() { - return `${LiteGraph.NODE_TEXT_SIZE}px Arial`; - } - get inner_text_font() { - return `normal ${LiteGraph.NODE_SUBTEXT_SIZE}px Arial`; - } - #maximumFrameGap = 0; - /** Maximum frames per second to render. 0: unlimited. Default: 0 */ - get maximumFps() { - return this.#maximumFrameGap > Number.EPSILON ? this.#maximumFrameGap / 1e3 : 0; - } - set maximumFps(value4) { - this.#maximumFrameGap = value4 > Number.EPSILON ? 1e3 / value4 : 0; - } - options; - background_image; - ds; - pointer; - zoom_modify_alpha; - zoom_speed; - node_title_color; - default_link_color; - default_connection_color; - default_connection_color_byType; - default_connection_color_byTypeOff; - highquality_render; - use_gradients; - editor_alpha; - pause_rendering; - clear_background; - clear_background_color; - render_only_selected; - show_info; - allow_dragcanvas; - allow_dragnodes; - allow_interaction; - multi_select; - allow_searchbox; - allow_reconnect_links; - align_to_grid; - drag_mode; - dragging_rectangle; - filter; - set_canvas_dirty_on_mouse_event; - always_render_background; - render_shadows; - render_canvas_border; - render_connections_shadows; - render_connections_border; - render_curved_connections; - render_connection_arrows; - render_collapsed_slots; - render_execution_order; - render_title_colored; - render_link_tooltip; - /** Controls whether reroutes are rendered at all. */ - reroutesEnabled = false; - /** Shape of the markers shown at the midpoint of links. Default: Circle */ - linkMarkerShape = LinkMarkerShape.Circle; - links_render_mode; - /** mouse in canvas coordinates, where 0,0 is the top-left corner of the blue rectangle */ - mouse; - /** mouse in graph coordinates, where 0,0 is the top-left corner of the blue rectangle */ - graph_mouse; - /** @deprecated LEGACY: REMOVE THIS, USE {@link graph_mouse} INSTEAD */ - canvas_mouse; - /** to personalize the search box */ - onSearchBox; - onSearchBoxSelection; - onMouse; - /** to render background objects (behind nodes and connections) in the canvas affected by transform */ - onDrawBackground; - /** to render foreground objects (above nodes and connections) in the canvas affected by transform */ - onDrawForeground; - connections_width; - round_radius; - /** The current node being drawn by {@link drawNode}. This should NOT be used to determine the currently selected node. See {@link selectedItems} */ - current_node; - /** used for widgets */ - node_widget; - /** The link to draw a tooltip for. */ - over_link_center; - last_mouse_position; - /** The visible area of this canvas. Tightly coupled with {@link ds}. */ - visible_area; - /** Contains all links and reroutes that were rendered. Repopulated every render cycle. */ - renderedPaths = /* @__PURE__ */ new Set(); - visible_links; - connecting_links; - /** The viewport of this canvas. Tightly coupled with {@link ds}. */ - viewport; - autoresize; - static active_canvas; - frame = 0; - last_draw_time = 0; - render_time = 0; - fps = 0; - /** @deprecated See {@link LGraphCanvas.selectedItems} */ - selected_nodes = {}; - /** All selected nodes, groups, and reroutes */ - selectedItems = /* @__PURE__ */ new Set(); - /** The group currently being resized. */ - resizingGroup = null; - /** @deprecated See {@link LGraphCanvas.selectedItems} */ - selected_group = null; - visible_nodes = []; - node_over; - node_capturing_input; - highlighted_links = {}; - link_over_widget; - link_over_widget_type; - dirty_canvas = true; - dirty_bgcanvas = true; - /** A map of nodes that require selective-redraw */ - dirty_nodes = /* @__PURE__ */ new Map(); - dirty_area; - /** @deprecated Unused */ - node_in_panel; - last_mouse = [0, 0]; - last_mouseclick = 0; - graph; - _graph_stack = null; - canvas; - bgcanvas; - ctx; - _events_binded; - /** @deprecated WebGL */ - gl; - bgctx; - is_rendering; - /** @deprecated Panels */ - block_click; - /** @deprecated Panels */ - last_click_position; - resizing_node; - /** @deprecated See {@link LGraphCanvas.resizingGroup} */ - selected_group_resizing; - /** @deprecated See {@link pointer}.{@link CanvasPointer.dragStarted dragStarted} */ - last_mouse_dragging; - onMouseDown; - _highlight_pos; - _highlight_input; - // TODO: Check if panels are used - /** @deprecated Panels */ - node_panel; - /** @deprecated Panels */ - options_panel; - onDropItem; - _bg_img; - _pattern; - _pattern_img; - // TODO: This looks like another panel thing - prompt_box; - search_box; - /** @deprecated Panels */ - SELECTED_NODE; - /** @deprecated Panels */ - NODEPANEL_IS_OPEN; - /** Once per frame check of snap to grid value. @todo Update on change. */ - #snapToGrid; - /** Set on keydown, keyup. @todo */ - #shiftDown = false; - static active_node; - onClear; - /** called after moving a node @deprecated Does not handle multi-node move, and can return the wrong node. */ - onNodeMoved; - /** called if the selection changes */ - onSelectionChange; - /** called when rendering a tooltip */ - onDrawLinkTooltip; - /** to render foreground objects not affected by transform (for GUIs) */ - onDrawOverlay; - onRenderBackground; - onNodeDblClicked; - onShowNodePanel; - onNodeSelected; - onNodeDeselected; - onRender; - /** Implement this function to allow conversion of widget types to input types, e.g. number -> INT or FLOAT for widget link validation checks */ - getWidgetLinkType; - /** - * Creates a new instance of LGraphCanvas. - * @param canvas The canvas HTML element (or its id) to use, or null / undefined to leave blank. - * @param graph The graph that owns this canvas. - * @param options - */ - constructor(canvas, graph, options4) { - options4 ||= {}; - this.options = options4; - this.background_image = LGraphCanvas.DEFAULT_BACKGROUND_IMAGE; - this.ds = new DragAndScale(); - this.pointer = new CanvasPointer(this.canvas); - this.zoom_modify_alpha = true; - this.zoom_speed = 1.1; - this.node_title_color = LiteGraph.NODE_TITLE_COLOR; - this.default_link_color = LiteGraph.LINK_COLOR; - this.default_connection_color = { - input_off: "#778", - input_on: "#7F7", - // "#BBD" - output_off: "#778", - output_on: "#7F7" - // "#BBD" - }; - this.default_connection_color_byType = { - /* number: "#7F7", - string: "#77F", - boolean: "#F77", */ - }; - this.default_connection_color_byTypeOff = { - /* number: "#474", - string: "#447", - boolean: "#744", */ - }; - this.highquality_render = true; - this.use_gradients = false; - this.editor_alpha = 1; - this.pause_rendering = false; - this.clear_background = true; - this.clear_background_color = "#222"; - this.render_only_selected = true; - this.show_info = true; - this.allow_dragcanvas = true; - this.allow_dragnodes = true; - this.allow_interaction = true; - this.multi_select = false; - this.allow_searchbox = true; - this.allow_reconnect_links = true; - this.align_to_grid = false; - this.drag_mode = false; - this.dragging_rectangle = null; - this.filter = null; - this.set_canvas_dirty_on_mouse_event = true; - this.always_render_background = false; - this.render_shadows = true; - this.render_canvas_border = true; - this.render_connections_shadows = false; - this.render_connections_border = true; - this.render_curved_connections = false; - this.render_connection_arrows = false; - this.render_collapsed_slots = true; - this.render_execution_order = false; - this.render_title_colored = true; - this.render_link_tooltip = true; - this.links_render_mode = LinkRenderType.SPLINE_LINK; - this.mouse = [0, 0]; - this.graph_mouse = [0, 0]; - this.canvas_mouse = this.graph_mouse; - this.onSearchBox = null; - this.onSearchBoxSelection = null; - this.onMouse = null; - this.onDrawBackground = null; - this.onDrawForeground = null; - this.onDrawOverlay = null; - this.onDrawLinkTooltip = null; - this.onNodeMoved = null; - this.onSelectionChange = null; - this.onConnectingChange = null; - this.onBeforeChange = null; - this.onAfterChange = null; - this.connections_width = 3; - this.round_radius = 8; - this.current_node = null; - this.node_widget = null; - this.over_link_center = null; - this.last_mouse_position = [0, 0]; - this.visible_area = this.ds.visible_area; - this.visible_links = []; - this.connecting_links = null; - this.viewport = options4.viewport || null; - graph?.attachCanvas(this); - this.setCanvas(canvas, options4.skip_events); - this.clear(); - if (!options4.skip_render) { - this.startRendering(); - } - this.autoresize = options4.autoresize; - } - static getFileExtension(url) { - const question = url.indexOf("?"); - if (question !== -1) url = url.substring(0, question); - const point = url.lastIndexOf("."); - return point === -1 ? "" : url.substring(point + 1).toLowerCase(); - } - static onGroupAdd(info, entry, mouse_event) { - const canvas = LGraphCanvas.active_canvas; - const group = new LiteGraph.LGraphGroup(); - group.pos = canvas.convertEventToCanvasOffset(mouse_event); - canvas.graph.add(group); - } - /** - * @deprecated Functionality moved to {@link getBoundaryNodes}. The new function returns null on failure, instead of an object with all null properties. - * Determines the furthest nodes in each direction - * @param nodes the nodes to from which boundary nodes will be extracted - * @returns - */ - static getBoundaryNodes(nodes) { - const _nodes = Array.isArray(nodes) ? nodes : Object.values(nodes); - return getBoundaryNodes(_nodes) ?? { - top: null, - right: null, - bottom: null, - left: null - }; - } - /** - * @deprecated Functionality moved to {@link alignNodes}. The new function does not set dirty canvas. - * @param nodes a list of nodes - * @param direction Direction to align the nodes - * @param align_to Node to align to (if null, align to the furthest node in the given direction) - */ - static alignNodes(nodes, direction, align_to) { - alignNodes(Object.values(nodes), direction, align_to); - LGraphCanvas.active_canvas.setDirty(true, true); - } - static onNodeAlign(value4, options4, event, prev_menu, node22) { - new LiteGraph.ContextMenu(["Top", "Bottom", "Left", "Right"], { - event, - callback: inner_clicked, - parentMenu: prev_menu - }); - function inner_clicked(value22) { - alignNodes( - Object.values(LGraphCanvas.active_canvas.selected_nodes), - value22.toLowerCase(), - node22 - ); - LGraphCanvas.active_canvas.setDirty(true, true); - } - __name(inner_clicked, "inner_clicked"); - } - static onGroupAlign(value4, options4, event, prev_menu) { - new LiteGraph.ContextMenu(["Top", "Bottom", "Left", "Right"], { - event, - callback: inner_clicked, - parentMenu: prev_menu - }); - function inner_clicked(value22) { - alignNodes( - Object.values(LGraphCanvas.active_canvas.selected_nodes), - value22.toLowerCase() - ); - LGraphCanvas.active_canvas.setDirty(true, true); - } - __name(inner_clicked, "inner_clicked"); - } - static createDistributeMenu(value4, options4, event, prev_menu, node22) { - new LiteGraph.ContextMenu(["Vertically", "Horizontally"], { - event, - callback: inner_clicked, - parentMenu: prev_menu - }); - function inner_clicked(value22) { - const canvas = LGraphCanvas.active_canvas; - distributeNodes(Object.values(canvas.selected_nodes), value22 === "Horizontally"); - canvas.setDirty(true, true); - } - __name(inner_clicked, "inner_clicked"); - } - static onMenuAdd(node22, options4, e2, prev_menu, callback) { - const canvas = LGraphCanvas.active_canvas; - const ref_window = canvas.getCanvasWindow(); - const graph = canvas.graph; - if (!graph) return; - function inner_onMenuAdded(base_category, prev_menu2) { - const categories = LiteGraph.getNodeTypesCategories(canvas.filter || graph.filter).filter(function(category) { - return category.startsWith(base_category); - }); - const entries = []; - categories.map(function(category) { - if (!category) return; - const base_category_regex = new RegExp("^(" + base_category + ")"); - const category_name = category.replace(base_category_regex, "").split("/")[0]; - const category_path = base_category === "" ? category_name + "/" : base_category + category_name + "/"; - let name2 = category_name; - if (name2.indexOf("::") != -1) - name2 = name2.split("::")[1]; - const index2 = entries.findIndex(function(entry) { - return entry.value === category_path; - }); - if (index2 === -1) { - entries.push({ - value: category_path, - content: name2, - has_submenu: true, - callback: /* @__PURE__ */ __name(function(value4, event, mouseEvent, contextMenu) { - inner_onMenuAdded(value4.value, contextMenu); - }, "callback") - }); - } - }); - const nodes = LiteGraph.getNodeTypesInCategory( - base_category.slice(0, -1), - canvas.filter || graph.filter - ); - nodes.map(function(node3) { - if (node3.skip_list) return; - const entry = { - value: node3.type, - content: node3.title, - has_submenu: false, - callback: /* @__PURE__ */ __name(function(value4, event, mouseEvent, contextMenu) { - const first_event = contextMenu.getFirstEvent(); - canvas.graph.beforeChange(); - const node4 = LiteGraph.createNode(value4.value); - if (node4) { - node4.pos = canvas.convertEventToCanvasOffset(first_event); - canvas.graph.add(node4); - } - callback?.(node4); - canvas.graph.afterChange(); - }, "callback") - }; - entries.push(entry); - }); - new LiteGraph.ContextMenu(entries, { event: e2, parentMenu: prev_menu2 }, ref_window); - } - __name(inner_onMenuAdded, "inner_onMenuAdded"); - inner_onMenuAdded("", prev_menu); - return false; - } - static onMenuCollapseAll() { - } - static onMenuNodeEdit() { - } - /** @param options Parameter is never used */ - static showMenuNodeOptionalInputs(v2, options4, e2, prev_menu, node22) { - if (!node22) return; - const that = this; - const canvas = LGraphCanvas.active_canvas; - const ref_window = canvas.getCanvasWindow(); - options4 = node22.onGetInputs ? node22.onGetInputs() : node22.optional_inputs; - let entries = []; - if (options4) { - for (let i2 = 0; i2 < options4.length; i2++) { - const entry = options4[i2]; - if (!entry) { - entries.push(null); - continue; - } - let label5 = entry[0]; - entry[2] ||= {}; - if (entry[2].label) { - label5 = entry[2].label; - } - entry[2].removable = true; - const data24 = { content: label5, value: entry }; - if (entry[1] == LiteGraph.ACTION) { - data24.className = "event"; - } - entries.push(data24); - } - } - const retEntries = node22.onMenuNodeInputs?.(entries); - if (retEntries) entries = retEntries; - if (!entries.length) { - console.log("no input entries"); - return; - } - new LiteGraph.ContextMenu( - entries, - { - event: e2, - callback: inner_clicked, - parentMenu: prev_menu, - node: node22 - }, - // @ts-expect-error Unused param - ref_window - ); - function inner_clicked(v3, e3, prev2) { - if (!node22) return; - v3.callback?.call(that, node22, v3, e3, prev2); - if (!v3.value) return; - node22.graph.beforeChange(); - node22.addInput(v3.value[0], v3.value[1], v3.value[2]); - node22.onNodeInputAdd?.(v3.value); - canvas.setDirty(true, true); - node22.graph.afterChange(); - } - __name(inner_clicked, "inner_clicked"); - return false; - } - /** @param options Parameter is never used */ - static showMenuNodeOptionalOutputs(v2, options4, e2, prev_menu, node22) { - if (!node22) return; - const that = this; - const canvas = LGraphCanvas.active_canvas; - const ref_window = canvas.getCanvasWindow(); - options4 = node22.onGetOutputs ? node22.onGetOutputs() : node22.optional_outputs; - let entries = []; - if (options4) { - for (let i2 = 0; i2 < options4.length; i2++) { - const entry = options4[i2]; - if (!entry) { - entries.push(null); - continue; - } - if (node22.flags && node22.flags.skip_repeated_outputs && node22.findOutputSlot(entry[0]) != -1) { - continue; - } - let label5 = entry[0]; - entry[2] ||= {}; - if (entry[2].label) { - label5 = entry[2].label; - } - entry[2].removable = true; - const data24 = { content: label5, value: entry }; - if (entry[1] == LiteGraph.EVENT) { - data24.className = "event"; - } - entries.push(data24); - } - } - if (this.onMenuNodeOutputs) entries = this.onMenuNodeOutputs(entries); - if (LiteGraph.do_add_triggers_slots) { - if (node22.findOutputSlot("onExecuted") == -1) { - entries.push({ content: "On Executed", value: ["onExecuted", LiteGraph.EVENT, { nameLocked: true }], className: "event" }); - } - } - const retEntries = node22.onMenuNodeOutputs?.(entries); - if (retEntries) entries = retEntries; - if (!entries.length) return; - new LiteGraph.ContextMenu( - entries, - { - event: e2, - callback: inner_clicked, - parentMenu: prev_menu, - node: node22 - }, - // @ts-expect-error Unused - ref_window - ); - function inner_clicked(v3, e3, prev2) { - if (!node22) return; - if (v3.callback) v3.callback.call(that, node22, v3, e3, prev2); - if (!v3.value) return; - const value4 = v3.value[1]; - if (value4 && (typeof value4 === "object" || Array.isArray(value4))) { - const entries2 = []; - for (const i2 in value4) { - entries2.push({ content: i2, value: value4[i2] }); - } - new LiteGraph.ContextMenu(entries2, { - event: e3, - callback: inner_clicked, - parentMenu: prev_menu, - node: node22 - }); - return false; - } - const graph = node22.graph; - graph.beforeChange(); - node22.addOutput(v3.value[0], v3.value[1], v3.value[2]); - node22.onNodeOutputAdd?.(v3.value); - canvas.setDirty(true, true); - graph.afterChange(); - } - __name(inner_clicked, "inner_clicked"); - return false; - } - /** @param value Parameter is never used */ - static onShowMenuNodeProperties(value4, options4, e2, prev_menu, node22) { - if (!node22 || !node22.properties) return; - const canvas = LGraphCanvas.active_canvas; - const ref_window = canvas.getCanvasWindow(); - const entries = []; - for (const i2 in node22.properties) { - value4 = node22.properties[i2] !== void 0 ? node22.properties[i2] : " "; - if (typeof value4 == "object") - value4 = JSON.stringify(value4); - const info = node22.getPropertyInfo(i2); - if (info.type == "enum" || info.type == "combo") - value4 = LGraphCanvas.getPropertyPrintableValue(value4, info.values); - value4 = LGraphCanvas.decodeHTML(stringOrNull(value4)); - entries.push({ - content: "<span class='property_name'>" + (info.label || i2) + "</span><span class='property_value'>" + value4 + "</span>", - value: i2 - }); - } - if (!entries.length) { - return; - } - new LiteGraph.ContextMenu( - entries, - { - event: e2, - callback: inner_clicked, - parentMenu: prev_menu, - allow_html: true, - node: node22 - }, - // @ts-expect-error Unused - ref_window - ); - function inner_clicked(v2) { - if (!node22) return; - const rect = this.getBoundingClientRect(); - canvas.showEditPropertyValue(node22, v2.value, { - position: [rect.left, rect.top] - }); - } - __name(inner_clicked, "inner_clicked"); - return false; - } - static decodeHTML(str) { - const e2 = document.createElement("div"); - e2.innerText = str; - return e2.innerHTML; - } - static onMenuResizeNode(value4, options4, e2, menu2, node22) { - if (!node22) return; - const fApplyMultiNode = /* @__PURE__ */ __name(function(node3) { - node3.size = node3.computeSize(); - node3.onResize?.(node3.size); - }, "fApplyMultiNode"); - const canvas = LGraphCanvas.active_canvas; - if (!canvas.selected_nodes || Object.keys(canvas.selected_nodes).length <= 1) { - fApplyMultiNode(node22); - } else { - for (const i2 in canvas.selected_nodes) { - fApplyMultiNode(canvas.selected_nodes[i2]); - } - } - canvas.setDirty(true, true); - } - // TODO refactor :: this is used fot title but not for properties! - static onShowPropertyEditor(item3, options4, e2, menu2, node22) { - const property = item3.property || "title"; - const value4 = node22[property]; - const dialog = document.createElement("div"); - dialog.is_modified = false; - dialog.className = "graphdialog"; - dialog.innerHTML = "<span class='name'></span><input autofocus type='text' class='value'/><button>OK</button>"; - dialog.close = function() { - dialog.parentNode?.removeChild(dialog); - }; - const title = dialog.querySelector(".name"); - title.innerText = property; - const input = dialog.querySelector(".value"); - if (input) { - input.value = value4; - input.addEventListener("blur", function() { - this.focus(); - }); - input.addEventListener("keydown", function(e3) { - dialog.is_modified = true; - if (e3.keyCode == 27) { - dialog.close(); - } else if (e3.keyCode == 13) { - inner(); - } else if (e3.keyCode != 13 && e3.target.localName != "textarea") { - return; - } - e3.preventDefault(); - e3.stopPropagation(); - }); - } - const canvas = LGraphCanvas.active_canvas; - const canvasEl = canvas.canvas; - const rect = canvasEl.getBoundingClientRect(); - let offsetx = -20; - let offsety = -20; - if (rect) { - offsetx -= rect.left; - offsety -= rect.top; - } - if (e2) { - dialog.style.left = e2.clientX + offsetx + "px"; - dialog.style.top = e2.clientY + offsety + "px"; - } else { - dialog.style.left = canvasEl.width * 0.5 + offsetx + "px"; - dialog.style.top = canvasEl.height * 0.5 + offsety + "px"; - } - const button = dialog.querySelector("button"); - button.addEventListener("click", inner); - canvasEl.parentNode.appendChild(dialog); - input?.focus(); - let dialogCloseTimer = null; - dialog.addEventListener("mouseleave", function() { - if (LiteGraph.dialog_close_on_mouse_leave) { - if (!dialog.is_modified && LiteGraph.dialog_close_on_mouse_leave) - dialogCloseTimer = setTimeout( - dialog.close, - LiteGraph.dialog_close_on_mouse_leave_delay - ); - } - }); - dialog.addEventListener("mouseenter", function() { - if (LiteGraph.dialog_close_on_mouse_leave) { - if (dialogCloseTimer) clearTimeout(dialogCloseTimer); - } - }); - function inner() { - if (input) setValue2(input.value); - } - __name(inner, "inner"); - function setValue2(value22) { - if (item3.type == "Number") { - value22 = Number(value22); - } else if (item3.type == "Boolean") { - value22 = Boolean(value22); - } - node22[property] = value22; - dialog.parentNode?.removeChild(dialog); - canvas.setDirty(true, true); - } - __name(setValue2, "setValue"); - } - static getPropertyPrintableValue(value4, values) { - if (!values) return String(value4); - if (Array.isArray(values)) { - return String(value4); - } - if (typeof values === "object") { - let desc_value = ""; - for (const k in values) { - if (values[k] != value4) continue; - desc_value = k; - break; - } - return String(value4) + " (" + desc_value + ")"; - } - } - static onMenuNodeCollapse(value4, options4, e2, menu2, node22) { - node22.graph.beforeChange( - /* ? */ - ); - const fApplyMultiNode = /* @__PURE__ */ __name(function(node3) { - node3.collapse(); - }, "fApplyMultiNode"); - const graphcanvas = LGraphCanvas.active_canvas; - if (!graphcanvas.selected_nodes || Object.keys(graphcanvas.selected_nodes).length <= 1) { - fApplyMultiNode(node22); - } else { - for (const i2 in graphcanvas.selected_nodes) { - fApplyMultiNode(graphcanvas.selected_nodes[i2]); - } - } - node22.graph.afterChange( - /* ? */ - ); - } - static onMenuToggleAdvanced(value4, options4, e2, menu2, node22) { - node22.graph.beforeChange( - /* ? */ - ); - const fApplyMultiNode = /* @__PURE__ */ __name(function(node3) { - node3.toggleAdvanced(); - }, "fApplyMultiNode"); - const graphcanvas = LGraphCanvas.active_canvas; - if (!graphcanvas.selected_nodes || Object.keys(graphcanvas.selected_nodes).length <= 1) { - fApplyMultiNode(node22); - } else { - for (const i2 in graphcanvas.selected_nodes) { - fApplyMultiNode(graphcanvas.selected_nodes[i2]); - } - } - node22.graph.afterChange( - /* ? */ - ); - } - static onMenuNodePin(value4, options4, e2, menu2, node22) { - } - static onMenuNodeMode(value4, options4, e2, menu2, node22) { - new LiteGraph.ContextMenu( - LiteGraph.NODE_MODES, - { event: e2, callback: inner_clicked, parentMenu: menu2, node: node22 } - ); - function inner_clicked(v2) { - if (!node22) return; - const kV = Object.values(LiteGraph.NODE_MODES).indexOf(v2); - const fApplyMultiNode = /* @__PURE__ */ __name(function(node3) { - if (kV >= 0 && LiteGraph.NODE_MODES[kV]) - node3.changeMode(kV); - else { - console.warn("unexpected mode: " + v2); - node3.changeMode(LGraphEventMode.ALWAYS); - } - }, "fApplyMultiNode"); - const graphcanvas = LGraphCanvas.active_canvas; - if (!graphcanvas.selected_nodes || Object.keys(graphcanvas.selected_nodes).length <= 1) { - fApplyMultiNode(node22); - } else { - for (const i2 in graphcanvas.selected_nodes) { - fApplyMultiNode(graphcanvas.selected_nodes[i2]); - } - } - } - __name(inner_clicked, "inner_clicked"); - return false; - } - /** @param value Parameter is never used */ - static onMenuNodeColors(value4, options4, e2, menu2, node22) { - if (!node22) throw "no node for color"; - const values = []; - values.push({ - value: null, - content: "<span style='display: block; padding-left: 4px;'>No color</span>" - }); - for (const i2 in LGraphCanvas.node_colors) { - const color2 = LGraphCanvas.node_colors[i2]; - value4 = { - value: i2, - content: "<span style='display: block; color: #999; padding-left: 4px; border-left: 8px solid " + color2.color + "; background-color:" + color2.bgcolor + "'>" + i2 + "</span>" - }; - values.push(value4); - } - new LiteGraph.ContextMenu(values, { - event: e2, - callback: inner_clicked, - parentMenu: menu2, - node: node22 - }); - function inner_clicked(v2) { - if (!node22) return; - const color2 = v2.value ? LGraphCanvas.node_colors[v2.value] : null; - const fApplyColor = /* @__PURE__ */ __name(function(node3) { - if (color2) { - if (node3 instanceof LGraphGroup) { - node3.color = color2.groupcolor; - } else { - node3.color = color2.color; - node3.bgcolor = color2.bgcolor; - } - } else { - delete node3.color; - delete node3.bgcolor; - } - }, "fApplyColor"); - const canvas = LGraphCanvas.active_canvas; - if (!canvas.selected_nodes || Object.keys(canvas.selected_nodes).length <= 1) { - fApplyColor(node22); - } else { - for (const i2 in canvas.selected_nodes) { - fApplyColor(canvas.selected_nodes[i2]); - } - } - canvas.setDirty(true, true); - } - __name(inner_clicked, "inner_clicked"); - return false; - } - static onMenuNodeShapes(value4, options4, e2, menu2, node22) { - if (!node22) throw "no node passed"; - new LiteGraph.ContextMenu(LiteGraph.VALID_SHAPES, { - event: e2, - callback: inner_clicked, - parentMenu: menu2, - node: node22 - }); - function inner_clicked(v2) { - if (!node22) return; - node22.graph.beforeChange( - /* ? */ - ); - const fApplyMultiNode = /* @__PURE__ */ __name(function(node3) { - node3.shape = v2; - }, "fApplyMultiNode"); - const canvas = LGraphCanvas.active_canvas; - if (!canvas.selected_nodes || Object.keys(canvas.selected_nodes).length <= 1) { - fApplyMultiNode(node22); - } else { - for (const i2 in canvas.selected_nodes) { - fApplyMultiNode(canvas.selected_nodes[i2]); - } - } - node22.graph.afterChange( - /* ? */ - ); - canvas.setDirty(true); - } - __name(inner_clicked, "inner_clicked"); - return false; - } - static onMenuNodeRemove(value4, options4, e2, menu2, node22) { - if (!node22) throw "no node passed"; - const graph = node22.graph; - graph.beforeChange(); - const fApplyMultiNode = /* @__PURE__ */ __name(function(node3) { - if (node3.removable === false) return; - graph.remove(node3); - }, "fApplyMultiNode"); - const canvas = LGraphCanvas.active_canvas; - if (!canvas.selected_nodes || Object.keys(canvas.selected_nodes).length <= 1) { - fApplyMultiNode(node22); - } else { - for (const i2 in canvas.selected_nodes) { - fApplyMultiNode(canvas.selected_nodes[i2]); - } - } - graph.afterChange(); - canvas.setDirty(true, true); - } - static onMenuNodeToSubgraph(value4, options4, e2, menu2, node22) { - const graph = node22.graph; - const canvas = LGraphCanvas.active_canvas; - if (!canvas) return; - let nodes_list = Object.values(canvas.selected_nodes || {}); - if (!nodes_list.length) nodes_list = [node22]; - const subgraph_node = LiteGraph.createNode("graph/subgraph"); - subgraph_node.pos = node22.pos.concat(); - graph.add(subgraph_node); - subgraph_node.buildFromNodes(nodes_list); - canvas.deselectAll(); - canvas.setDirty(true, true); - } - static onMenuNodeClone(value4, options4, e2, menu2, node22) { - const graph = node22.graph; - graph.beforeChange(); - const newSelected = /* @__PURE__ */ new Set(); - const fApplyMultiNode = /* @__PURE__ */ __name(function(node3, newNodes) { - if (node3.clonable === false) return; - const newnode = node3.clone(); - if (!newnode) return; - newnode.pos = [node3.pos[0] + 5, node3.pos[1] + 5]; - node3.graph.add(newnode); - newNodes.add(newnode); - }, "fApplyMultiNode"); - const canvas = LGraphCanvas.active_canvas; - if (!canvas.selected_nodes || Object.keys(canvas.selected_nodes).length <= 1) { - fApplyMultiNode(node22, newSelected); - } else { - for (const i2 in canvas.selected_nodes) { - fApplyMultiNode(canvas.selected_nodes[i2], newSelected); - } - } - if (newSelected.size) { - canvas.selectNodes([...newSelected]); - } - graph.afterChange(); - canvas.setDirty(true, true); - } - /** - * clears all the data inside - * - */ - clear() { - this.frame = 0; - this.last_draw_time = 0; - this.render_time = 0; - this.fps = 0; - this.dragging_rectangle = null; - this.selected_nodes = {}; - this.selected_group = null; - this.visible_nodes = []; - this.node_over = null; - this.node_capturing_input = null; - this.connecting_links = null; - this.highlighted_links = {}; - this.dragging_canvas = false; - this.#dirty(); - this.dirty_area = null; - this.node_in_panel = null; - this.node_widget = null; - this.last_mouse = [0, 0]; - this.last_mouseclick = 0; - this.pointer.reset(); - this.visible_area.set([0, 0, 0, 0]); - this.onClear?.(); - } - /** - * assigns a graph, you can reassign graphs to the same canvas - * @param graph - */ - setGraph(graph, skip_clear) { - if (this.graph == graph) return; - if (!skip_clear) this.clear(); - if (!graph && this.graph) { - this.graph.detachCanvas(this); - return; - } - graph.attachCanvas(this); - this._graph_stack &&= null; - this.setDirty(true, true); - } - /** - * @returns the top level graph (in case there are subgraphs open on the canvas) - */ - getTopGraph() { - return this._graph_stack.length ? this._graph_stack[0] : this.graph; - } - /** - * @returns the visually active graph (in case there are more in the stack) - */ - getCurrentGraph() { - return this.graph; - } - /** - * Finds the canvas if required, throwing on failure. - * @param canvas Canvas element, or its element ID - * @returns The canvas element - * @throws If {@link canvas} is an element ID that does not belong to a valid HTML canvas element - */ - #validateCanvas(canvas) { - if (typeof canvas === "string") { - const el = document.getElementById(canvas); - if (!(el instanceof HTMLCanvasElement)) throw "Error validating LiteGraph canvas: Canvas element not found"; - return el; - } - return canvas; - } - /** - * Sets the current HTML canvas element. - * Calls bindEvents to add input event listeners, and (re)creates the background canvas. - * @param canvas The canvas element to assign, or its HTML element ID. If null or undefined, the current reference is cleared. - * @param skip_events If true, events on the previous canvas will not be removed. Has no effect on the first invocation. - */ - setCanvas(canvas, skip_events) { - const element = this.#validateCanvas(canvas); - if (element === this.canvas) return; - if (!element && this.canvas && !skip_events) this.unbindEvents(); - this.canvas = element; - this.ds.element = element; - this.pointer.element = element; - if (!element) return; - element.className += " lgraphcanvas"; - element.data = this; - element.tabindex = "1"; - this.bgcanvas = null; - if (!this.bgcanvas) { - this.bgcanvas = document.createElement("canvas"); - this.bgcanvas.width = this.canvas.width; - this.bgcanvas.height = this.canvas.height; - } - if (element.getContext == null) { - if (element.localName != "canvas") { - throw "Element supplied for LGraphCanvas must be a <canvas> element, you passed a " + element.localName; - } - throw "This browser doesn't support Canvas"; - } - const ctx = this.ctx = element.getContext("2d"); - if (ctx == null) { - if (!element.webgl_enabled) { - console.warn("This canvas seems to be WebGL, enabling WebGL renderer"); - } - this.enableWebGL(); - } - if (!skip_events) this.bindEvents(); - } - /** Captures an event and prevents default - returns false. */ - _doNothing(e2) { - e2.preventDefault(); - return false; - } - /** Captures an event and prevents default - returns true. */ - _doReturnTrue(e2) { - e2.preventDefault(); - return true; - } - /** - * binds mouse, keyboard, touch and drag events to the canvas - */ - bindEvents() { - if (this._events_binded) { - console.warn("LGraphCanvas: events already binded"); - return; - } - const canvas = this.canvas; - const ref_window = this.getCanvasWindow(); - const document2 = ref_window.document; - this._mousedown_callback = this.processMouseDown.bind(this); - this._mousewheel_callback = this.processMouseWheel.bind(this); - this._mousemove_callback = this.processMouseMove.bind(this); - this._mouseup_callback = this.processMouseUp.bind(this); - this._mouseout_callback = this.processMouseOut.bind(this); - this._mousecancel_callback = this.processMouseCancel.bind(this); - LiteGraph.pointerListenerAdd(canvas, "down", this._mousedown_callback, true); - canvas.addEventListener("mousewheel", this._mousewheel_callback, false); - LiteGraph.pointerListenerAdd(canvas, "up", this._mouseup_callback, true); - LiteGraph.pointerListenerAdd(canvas, "move", this._mousemove_callback); - canvas.addEventListener("pointerout", this._mouseout_callback); - canvas.addEventListener("pointercancel", this._mousecancel_callback, true); - canvas.addEventListener("contextmenu", this._doNothing); - canvas.addEventListener( - "DOMMouseScroll", - this._mousewheel_callback, - false - ); - this._key_callback = this.processKey.bind(this); - canvas.addEventListener("keydown", this._key_callback, true); - document2.addEventListener("keyup", this._key_callback, true); - this._ondrop_callback = this.processDrop.bind(this); - canvas.addEventListener("dragover", this._doNothing, false); - canvas.addEventListener("dragend", this._doNothing, false); - canvas.addEventListener("drop", this._ondrop_callback, false); - canvas.addEventListener("dragenter", this._doReturnTrue, false); - this._events_binded = true; - } - /** - * unbinds mouse events from the canvas - */ - unbindEvents() { - if (!this._events_binded) { - console.warn("LGraphCanvas: no events binded"); - return; - } - const ref_window = this.getCanvasWindow(); - const document2 = ref_window.document; - this.canvas.removeEventListener("pointercancel", this._mousecancel_callback); - this.canvas.removeEventListener("pointerout", this._mouseout_callback); - LiteGraph.pointerListenerRemove(this.canvas, "move", this._mousemove_callback); - LiteGraph.pointerListenerRemove(this.canvas, "up", this._mouseup_callback); - LiteGraph.pointerListenerRemove(this.canvas, "down", this._mousedown_callback); - this.canvas.removeEventListener( - "mousewheel", - this._mousewheel_callback - ); - this.canvas.removeEventListener( - "DOMMouseScroll", - this._mousewheel_callback - ); - this.canvas.removeEventListener("keydown", this._key_callback); - document2.removeEventListener("keyup", this._key_callback); - this.canvas.removeEventListener("contextmenu", this._doNothing); - this.canvas.removeEventListener("drop", this._ondrop_callback); - this.canvas.removeEventListener("dragenter", this._doReturnTrue); - this._mousedown_callback = null; - this._mousewheel_callback = null; - this._key_callback = null; - this._ondrop_callback = null; - this._events_binded = false; - } - /** - * this function allows to render the canvas using WebGL instead of Canvas2D - * this is useful if you plant to render 3D objects inside your nodes, it uses litegl.js for webgl and canvas2DtoWebGL to emulate the Canvas2D calls in webGL - */ - enableWebGL() { - if (typeof GL === "undefined") { - throw "litegl.js must be included to use a WebGL canvas"; - } - if (typeof enableWebGLCanvas === "undefined") { - throw "webglCanvas.js must be included to use this feature"; - } - this.gl = this.ctx = enableWebGLCanvas(this.canvas); - this.ctx.webgl = true; - this.bgcanvas = this.canvas; - this.bgctx = this.gl; - this.canvas.webgl_enabled = true; - } - /** - * Ensures the canvas will be redrawn on the next frame by setting the dirty flag(s). - * Without parameters, this function does nothing. - * @todo Impl. `setDirty()` or similar as shorthand to redraw everything. - * @param fgcanvas If true, marks the foreground canvas as dirty (nodes and anything drawn on top of them). Default: false - * @param bgcanvas If true, mark the background canvas as dirty (background, groups, links). Default: false - */ - setDirty(fgcanvas, bgcanvas) { - if (fgcanvas) this.dirty_canvas = true; - if (bgcanvas) this.dirty_bgcanvas = true; - } - /** Marks the entire canvas as dirty. */ - #dirty() { - this.dirty_canvas = true; - this.dirty_bgcanvas = true; - } - /** - * Used to attach the canvas in a popup - * @returns returns the window where the canvas is attached (the DOM root node) - */ - getCanvasWindow() { - if (!this.canvas) return window; - const doc2 = this.canvas.ownerDocument; - return doc2.defaultView || doc2.parentWindow; - } - /** - * starts rendering the content of the canvas when needed - * - */ - startRendering() { - if (this.is_rendering) return; - this.is_rendering = true; - renderFrame.call(this); - function renderFrame() { - if (!this.pause_rendering) { - this.draw(); - } - const window2 = this.getCanvasWindow(); - if (this.is_rendering) { - if (this.#maximumFrameGap > 0) { - const gap = this.#maximumFrameGap - (LiteGraph.getTime() - this.last_draw_time); - setTimeout(renderFrame.bind(this), Math.max(1, gap)); - } else { - window2.requestAnimationFrame(renderFrame.bind(this)); - } - } - } - __name(renderFrame, "renderFrame"); - } - /** - * stops rendering the content of the canvas (to save resources) - * - */ - stopRendering() { - this.is_rendering = false; - } - /* LiteGraphCanvas input */ - // used to block future mouse events (because of im gui) - blockClick() { - this.block_click = true; - this.last_mouseclick = 0; - } - /** - * Gets the widget at the current cursor position - * @param node Optional node to check for widgets under cursor - * @returns The widget located at the current cursor position or null - */ - getWidgetAtCursor(node22) { - node22 ??= this.node_over; - if (!node22.widgets) return null; - const graphPos = this.graph_mouse; - const x2 = graphPos[0] - node22.pos[0]; - const y2 = graphPos[1] - node22.pos[1]; - for (const widget2 of node22.widgets) { - if (widget2.hidden || widget2.advanced && !node22.showAdvanced) continue; - let widgetWidth, widgetHeight; - if (widget2.computeSize) { - [widgetWidth, widgetHeight] = widget2.computeSize(node22.size[0]); - } else { - widgetWidth = widget2.width || node22.size[0]; - widgetHeight = LiteGraph.NODE_WIDGET_HEIGHT; - } - if (widget2.last_y !== void 0 && x2 >= 6 && x2 <= widgetWidth - 12 && y2 >= widget2.last_y && y2 <= widget2.last_y + widgetHeight) { - return widget2; - } - } - return null; - } - /** - * Clears highlight and mouse-over information from nodes that should not have it. - * - * Intended to be called when the pointer moves away from a node. - * @param node The node that the mouse is now over - * @param e MouseEvent that is triggering this - */ - updateMouseOverNodes(node22, e2) { - const nodes = this.graph._nodes; - const l = nodes.length; - for (let i2 = 0; i2 < l; ++i2) { - if (nodes[i2].mouseOver && node22 != nodes[i2]) { - nodes[i2].mouseOver = null; - this._highlight_input = null; - this._highlight_pos = null; - this.link_over_widget = null; - nodes[i2].lostFocusAt = LiteGraph.getTime(); - this.node_over?.onMouseLeave?.(e2); - this.node_over = null; - this.dirty_canvas = true; - } - } - } - processMouseDown(e2) { - const { graph, pointer: pointer2 } = this; - this.adjustMouseEvent(e2); - if (e2.isPrimary) pointer2.down(e2); - if (this.set_canvas_dirty_on_mouse_event) this.dirty_canvas = true; - if (!graph) return; - const ref_window = this.getCanvasWindow(); - LGraphCanvas.active_canvas = this; - const x2 = e2.clientX; - const y2 = e2.clientY; - this.ds.viewport = this.viewport; - const is_inside = !this.viewport || isInRect(x2, y2, this.viewport); - if (!is_inside) return; - const node22 = graph.getNodeOnPos(e2.canvasX, e2.canvasY, this.visible_nodes); - this.mouse[0] = x2; - this.mouse[1] = y2; - this.graph_mouse[0] = e2.canvasX; - this.graph_mouse[1] = e2.canvasY; - this.last_click_position = [this.mouse[0], this.mouse[1]]; - pointer2.isDouble = pointer2.isDown && e2.isPrimary; - pointer2.isDown = true; - this.canvas.focus(); - LiteGraph.closeAllContextMenus(ref_window); - if (this.onMouse?.(e2) == true) return; - if (e2.button === 0 && !pointer2.isDouble) { - this.#processPrimaryButton(e2, node22); - } else if (e2.button === 1) { - this.#processMiddleButton(e2, node22); - } else if ((e2.button === 2 || pointer2.isDouble) && this.allow_interaction && !this.read_only) { - if (node22) this.processSelect(node22, e2, true); - this.processContextMenu(node22, e2); - } - this.last_mouse = [x2, y2]; - this.last_mouseclick = LiteGraph.getTime(); - this.last_mouse_dragging = true; - graph.change(); - if (!ref_window.document.activeElement || ref_window.document.activeElement.nodeName.toLowerCase() != "input" && ref_window.document.activeElement.nodeName.toLowerCase() != "textarea") { - e2.preventDefault(); - } - e2.stopPropagation(); - this.onMouseDown?.(e2); - } - #processPrimaryButton(e2, node22) { - const { pointer: pointer2, graph } = this; - const x2 = e2.canvasX; - const y2 = e2.canvasY; - const ctrlOrMeta = e2.ctrlKey || e2.metaKey; - if (ctrlOrMeta && !e2.altKey) { - const dragRect = new Float32Array(4); - dragRect[0] = x2; - dragRect[1] = y2; - dragRect[2] = 1; - dragRect[3] = 1; - pointer2.onClick = (eUp) => { - const clickedItem = node22 ?? (this.reroutesEnabled ? graph.getRerouteOnPos(eUp.canvasX, eUp.canvasY) : null) ?? graph.getGroupTitlebarOnPos(eUp.canvasX, eUp.canvasY); - this.processSelect(clickedItem, eUp); - }; - pointer2.onDragStart = () => this.dragging_rectangle = dragRect; - pointer2.onDragEnd = (upEvent2) => this.#handleMultiSelect(upEvent2, dragRect); - pointer2.finally = () => this.dragging_rectangle = null; - return; - } - if (this.read_only) { - pointer2.finally = () => this.dragging_canvas = false; - this.dragging_canvas = true; - return; - } - if (LiteGraph.alt_drag_do_clone_nodes && e2.altKey && !e2.ctrlKey && node22 && this.allow_interaction) { - const node_data = node22.clone()?.serialize(); - const cloned = LiteGraph.createNode(node_data.type); - if (cloned) { - cloned.configure(node_data); - cloned.pos[0] += 5; - cloned.pos[1] += 5; - if (this.allow_dragnodes) { - pointer2.onDragStart = (pointer3) => { - graph.add(cloned, false); - this.#startDraggingItems(cloned, pointer3); - }; - pointer2.onDragEnd = (e3) => this.#processDraggedItems(e3); - } else { - graph.beforeChange(); - graph.add(cloned, false); - graph.afterChange(); - } - return; - } - } - if (node22 && (this.allow_interaction || node22.flags.allow_interaction)) { - this.#processNodeClick(e2, ctrlOrMeta, node22); - } else { - if (this.reroutesEnabled && this.links_render_mode !== LinkRenderType.HIDDEN_LINK) { - const reroute = graph.getRerouteOnPos(x2, y2); - if (reroute) { - if (e2.shiftKey) { - const link2 = graph._links.get(reroute.linkIds.values().next().value); - const outputNode = graph.getNodeById(link2.origin_id); - const slot = link2.origin_slot; - const connecting = { - node: outputNode, - slot, - input: null, - pos: outputNode.getConnectionPos(false, slot), - afterRerouteId: reroute.id - }; - this.connecting_links = [connecting]; - pointer2.onDragStart = () => connecting.output = outputNode.outputs[slot]; - this.dirty_bgcanvas = true; - } - pointer2.onClick = () => this.processSelect(reroute, e2); - if (!pointer2.onDragStart) { - pointer2.onDragStart = (pointer3) => this.#startDraggingItems(reroute, pointer3, true); - pointer2.onDragEnd = (e3) => this.#processDraggedItems(e3); - } - return; - } - } - const { lineWidth } = this.ctx; - this.ctx.lineWidth = this.connections_width + 7; - const dpi = window?.devicePixelRatio || 1; - for (const linkSegment of this.renderedPaths) { - const centre = linkSegment._pos; - if (!centre) continue; - if ((e2.shiftKey || e2.altKey) && linkSegment.path && this.ctx.isPointInStroke(linkSegment.path, x2 * dpi, y2 * dpi)) { - this.ctx.lineWidth = lineWidth; - if (e2.shiftKey && !e2.altKey) { - const slot = linkSegment.origin_slot; - const originNode = graph._nodes_by_id[linkSegment.origin_id]; - const connecting = { - node: originNode, - slot, - pos: originNode.getConnectionPos(false, slot) - }; - this.connecting_links = [connecting]; - if (linkSegment.parentId) connecting.afterRerouteId = linkSegment.parentId; - pointer2.onDragStart = () => connecting.output = originNode.outputs[slot]; - return; - } else if (this.reroutesEnabled && e2.altKey && !e2.shiftKey) { - const newReroute = graph.createReroute([x2, y2], linkSegment); - pointer2.onDragStart = (pointer3) => this.#startDraggingItems(newReroute, pointer3); - pointer2.onDragEnd = (e3) => this.#processDraggedItems(e3); - return; - } - } else if (isInRectangle(x2, y2, centre[0] - 4, centre[1] - 4, 8, 8)) { - this.ctx.lineWidth = lineWidth; - pointer2.onClick = () => this.showLinkMenu(linkSegment, e2); - pointer2.onDragStart = () => this.dragging_canvas = true; - pointer2.finally = () => this.dragging_canvas = false; - this.over_link_center = null; - return; - } - } - this.ctx.lineWidth = lineWidth; - const group = graph.getGroupOnPos(x2, y2); - this.selected_group = group; - if (group) { - if (group.isInResize(x2, y2)) { - const b = group.boundingRect; - const offsetX = x2 - (b[0] + b[2]); - const offsetY = y2 - (b[1] + b[3]); - pointer2.onDragStart = () => this.resizingGroup = group; - pointer2.onDrag = (eMove) => { - if (this.read_only) return; - const pos2 = [ - eMove.canvasX - group.pos[0] - offsetX, - eMove.canvasY - group.pos[1] - offsetY - ]; - snapPoint(pos2, this.#snapToGrid); - const resized = group.resize(pos2[0], pos2[1]); - if (resized) this.dirty_bgcanvas = true; - }; - pointer2.finally = () => this.resizingGroup = null; - } else { - const f = group.font_size || LiteGraph.DEFAULT_GROUP_FONT_SIZE; - const headerHeight = f * 1.4; - if (isInRectangle( - x2, - y2, - group.pos[0], - group.pos[1], - group.size[0], - headerHeight - )) { - pointer2.onClick = () => this.processSelect(group, e2); - pointer2.onDragStart = (pointer3) => { - group.recomputeInsideNodes(); - this.#startDraggingItems(group, pointer3, true); - }; - pointer2.onDragEnd = (e3) => this.#processDraggedItems(e3); - } - } - pointer2.onDoubleClick = () => { - this.emitEvent({ - subType: "group-double-click", - originalEvent: e2, - group - }); - }; - } else { - pointer2.onDoubleClick = () => { - if (this.allow_searchbox) { - this.showSearchBox(e2); - e2.preventDefault(); - } - this.emitEvent({ - subType: "empty-double-click", - originalEvent: e2 - }); - }; - } - } - if (!pointer2.onDragStart && !pointer2.onClick && !pointer2.onDrag && this.allow_dragcanvas) { - pointer2.onClick = () => this.processSelect(null, e2); - pointer2.finally = () => this.dragging_canvas = false; - this.dragging_canvas = true; - } - } - /** - * Processes a pointerdown event inside the bounds of a node. Part of {@link processMouseDown}. - * @param e The pointerdown event - * @param ctrlOrMeta Ctrl or meta key is pressed - * @param node The node to process a click event for - */ - #processNodeClick(e2, ctrlOrMeta, node22) { - const { pointer: pointer2, graph } = this; - const x2 = e2.canvasX; - const y2 = e2.canvasY; - pointer2.onClick = () => this.processSelect(node22, e2); - if (!node22.flags.pinned) { - this.bringToFront(node22); - } - const inCollapse = node22.isPointInCollapse(x2, y2); - if (inCollapse) { - pointer2.onClick = () => { - node22.collapse(); - this.setDirty(true, true); - }; - } else if (!node22.flags.collapsed) { - if (node22.resizable !== false && node22.inResizeCorner(x2, y2)) { - const b = node22.boundingRect; - const offsetX = x2 - (b[0] + b[2]); - const offsetY = y2 - (b[1] + b[3]); - pointer2.onDragStart = () => { - graph.beforeChange(); - this.resizing_node = node22; - }; - pointer2.onDrag = (eMove) => { - if (this.read_only) return; - const pos3 = [ - eMove.canvasX - node22.pos[0] - offsetX, - eMove.canvasY - node22.pos[1] - offsetY - ]; - snapPoint(pos3, this.#snapToGrid); - const min = node22.computeSize(); - pos3[0] = Math.max(min[0], pos3[0]); - pos3[1] = Math.max(min[1], pos3[1]); - node22.setSize(pos3); - this.#dirty(); - }; - pointer2.onDragEnd = (upEvent2) => { - this.#dirty(); - graph.afterChange(this.resizing_node); - }; - pointer2.finally = () => this.resizing_node = null; - this.canvas.style.cursor = "se-resize"; - return; - } - if (node22.outputs) { - for (let i2 = 0, l = node22.outputs.length; i2 < l; ++i2) { - const output = node22.outputs[i2]; - const link_pos = node22.getConnectionPos(false, i2); - if (isInRectangle(x2, y2, link_pos[0] - 15, link_pos[1] - 10, 30, 20)) { - if (e2.shiftKey && output.links?.length > 0) { - this.connecting_links = []; - for (const linkId of output.links) { - const link2 = graph._links.get(linkId); - const slot = link2.target_slot; - const linked_node = graph._nodes_by_id[link2.target_id]; - const input = linked_node.inputs[slot]; - const pos3 = linked_node.getConnectionPos(true, slot); - this.connecting_links.push({ - node: linked_node, - slot, - input, - output: null, - pos: pos3, - direction: node22.horizontal !== true ? LinkDirection.RIGHT : LinkDirection.CENTER - }); - } - return; - } - output.slot_index = i2; - this.connecting_links = [ - { - node: node22, - slot: i2, - input: null, - output, - pos: link_pos - } - ]; - if (LiteGraph.shift_click_do_break_link_from) { - if (e2.shiftKey) { - node22.disconnectOutput(i2); - } - } else if (LiteGraph.ctrl_alt_click_do_break_link) { - if (ctrlOrMeta && e2.altKey && !e2.shiftKey) { - node22.disconnectOutput(i2); - } - } - pointer2.onDoubleClick = () => node22.onOutputDblClick?.(i2, e2); - pointer2.onClick = () => node22.onOutputClick?.(i2, e2); - return; - } - } - } - if (node22.inputs) { - for (let i2 = 0, l = node22.inputs.length; i2 < l; ++i2) { - const input = node22.inputs[i2]; - const link_pos = node22.getConnectionPos(true, i2); - if (isInRectangle(x2, y2, link_pos[0] - 15, link_pos[1] - 10, 30, 20)) { - pointer2.onDoubleClick = () => node22.onInputDblClick?.(i2, e2); - pointer2.onClick = () => node22.onInputClick?.(i2, e2); - if (input.link !== null) { - const link_info = graph._links.get(input.link); - const slot = link_info.origin_slot; - const linked_node = graph._nodes_by_id[link_info.origin_id]; - if (LiteGraph.click_do_break_link_to || LiteGraph.ctrl_alt_click_do_break_link && ctrlOrMeta && e2.altKey && !e2.shiftKey) { - node22.disconnectInput(i2); - } else if (e2.shiftKey || this.allow_reconnect_links) { - const connecting = { - node: linked_node, - slot, - output: linked_node.outputs[slot], - pos: linked_node.getConnectionPos(false, slot) - }; - this.connecting_links = [connecting]; - pointer2.onDragStart = () => { - if (this.allow_reconnect_links && !LiteGraph.click_do_break_link_to) - node22.disconnectInput(i2); - connecting.output = linked_node.outputs[slot]; - }; - this.dirty_bgcanvas = true; - } - } - if (!pointer2.onDragStart) { - const connecting = { - node: node22, - slot: i2, - output: null, - pos: link_pos - }; - this.connecting_links = [connecting]; - pointer2.onDragStart = () => connecting.input = input; - this.dirty_bgcanvas = true; - } - return; - } - } - } - } - const pos2 = [x2 - node22.pos[0], y2 - node22.pos[1]]; - const widget2 = node22.getWidgetOnPos(x2, y2); - if (widget2) { - this.#processWidgetClick(e2, node22, widget2); - this.node_widget = [node22, widget2]; - } else { - pointer2.onDoubleClick = () => { - if (pos2[1] < 0 && !inCollapse) { - node22.onNodeTitleDblClick?.(e2, pos2, this); - } - node22.onDblClick?.(e2, pos2, this); - this.emitEvent({ - subType: "node-double-click", - originalEvent: e2, - node: node22 - }); - this.processNodeDblClicked(node22); - }; - if (node22.onMouseDown?.(e2, pos2, this) || !this.allow_dragnodes) - return; - pointer2.onDragStart = (pointer3) => this.#startDraggingItems(node22, pointer3, true); - pointer2.onDragEnd = (e3) => this.#processDraggedItems(e3); - } - this.dirty_canvas = true; - } - #processWidgetClick(e, node, widget) { - const { pointer } = this; - if (typeof widget.onPointerDown === "function") { - const handled = widget.onPointerDown(pointer, node, this); - if (handled) return; - } - const width = widget.width || node.width; - const oldValue = widget.value; - const pos = this.graph_mouse; - const x = pos[0] - node.pos[0]; - const y = pos[1] - node.pos[1]; - switch (widget.type) { - case "button": - pointer.onClick = () => { - widget.callback?.(widget, this, node, pos, e); - widget.clicked = true; - this.dirty_canvas = true; - }; - break; - case "slider": { - if (widget.options.read_only) break; - pointer.onDrag = (eMove) => { - const x2 = eMove.canvasX - node.pos[0]; - const slideFactor = clamp$1((x2 - 15) / (width - 30), 0, 1); - widget.value = widget.options.min + (widget.options.max - widget.options.min) * slideFactor; - if (oldValue != widget.value) { - setWidgetValue(this, node, widget, widget.value); - } - this.dirty_canvas = true; - }; - break; - } - case "number": { - const delta = x < 40 ? -1 : x > width - 40 ? 1 : 0; - pointer.onClick = (upEvent) => { - let newValue = widget.value + delta * 0.1 * (widget.options.step || 1); - if (widget.options.min != null && newValue < widget.options.min) { - newValue = widget.options.min; - } - if (widget.options.max != null && newValue > widget.options.max) { - newValue = widget.options.max; - } - if (newValue !== widget.value) setWidgetValue(this, node, widget, newValue); - if (delta !== 0) return; - this.prompt("Value", widget.value, (v) => { - if (/^[0-9+\-*/()\s]+|\d+\.\d+$/.test(v)) { - try { - v = eval(v); - } catch { - } - } - widget.value = Number(v); - setWidgetValue(this, node, widget, widget.value); - }, e); - this.dirty_canvas = true; - }; - pointer.onDrag = (eMove) => { - const x2 = eMove.canvasX - node.pos[0]; - if (delta && (x2 > -3 && x2 < width + 3)) return; - let newValue2 = widget.value; - if (eMove.deltaX) newValue2 += eMove.deltaX * 0.1 * (widget.options.step || 1); - if (widget.options.min != null && newValue2 < widget.options.min) { - newValue2 = widget.options.min; - } - if (widget.options.max != null && newValue2 > widget.options.max) { - newValue2 = widget.options.max; - } - if (newValue2 !== widget.value) setWidgetValue(this, node, widget, newValue2); - }; - break; - } - case "combo": { - let values; - let values_list; - pointer.onClick = (upEvent2) => { - const delta2 = x < 40 ? -1 : x > width - 40 ? 1 : 0; - values = widget.options.values; - if (typeof values === "function") { - values = values(widget, node); - } - values_list = null; - values_list = Array.isArray(values) ? values : Object.keys(values); - if (delta2) { - let index2 = -1; - this.last_mouseclick = 0; - index2 = typeof values === "object" ? values_list.indexOf(String(widget.value)) + delta2 : values_list.indexOf(widget.value) + delta2; - if (index2 >= values_list.length) index2 = values_list.length - 1; - if (index2 < 0) index2 = 0; - widget.value = Array.isArray(values) ? values[index2] : index2; - if (oldValue != widget.value) setWidgetValue(this, node, widget, widget.value); - this.dirty_canvas = true; - return; - } - const text_values = values != values_list ? Object.values(values) : values; - new LiteGraph.ContextMenu(text_values, { - scale: Math.max(1, this.ds.scale), - event: e, - className: "dark", - callback: /* @__PURE__ */ __name((value4) => { - widget.value = values != values_list ? text_values.indexOf(value4) : value4; - setWidgetValue(this, node, widget, widget.value); - this.dirty_canvas = true; - return false; - }, "callback") - }); - }; - break; - } - case "toggle": - pointer.onClick = () => { - widget.value = !widget.value; - setWidgetValue(this, node, widget, widget.value); - }; - break; - case "string": - case "text": - pointer.onClick = () => this.prompt( - "Value", - widget.value, - (v2) => setWidgetValue(this, node, widget, v2), - e, - widget.options ? widget.options.multiline : false - ); - break; - default: - if (widget.mouse) { - const result = widget.mouse(e, [x, y], node); - if (result != null) this.dirty_canvas = result; - } - break; - } - if (oldValue != widget.value) { - node.onWidgetChanged?.(widget.name, widget.value, oldValue, widget); - node.graph._version++; - } - pointer.finally = () => { - if (widget.mouse) { - const { eUp } = pointer; - const { canvasX, canvasY } = eUp; - widget.mouse(eUp, [canvasX - node.pos[0], canvasY - node.pos[1]], node); - } - this.node_widget = null; - }; - function setWidgetValue(canvas, node22, widget2, value4) { - const v2 = widget2.type === "number" ? Number(value4) : value4; - widget2.value = v2; - if (widget2.options?.property && node22.properties[widget2.options.property] !== void 0) { - node22.setProperty(widget2.options.property, v2); - } - widget2.callback?.(widget2.value, canvas, node22, pos, e); - node22.onWidgetChanged?.(widget2.name, v2, oldValue, widget2); - node22.graph._version++; - } - __name(setWidgetValue, "setWidgetValue"); - } - /** - * Pointer middle button click processing. Part of {@link processMouseDown}. - * @param e The pointerdown event - * @param node The node to process a click event for - */ - #processMiddleButton(e2, node22) { - const { pointer: pointer2 } = this; - if (LiteGraph.middle_click_slot_add_default_node && node22 && this.allow_interaction && !this.read_only && !this.connecting_links && !node22.flags.collapsed) { - let mClikSlot = false; - let mClikSlot_index = false; - let mClikSlot_isOut = false; - if (node22.outputs) { - for (let i2 = 0, l = node22.outputs.length; i2 < l; ++i2) { - const output = node22.outputs[i2]; - const link_pos = node22.getConnectionPos(false, i2); - if (isInRectangle(e2.canvasX, e2.canvasY, link_pos[0] - 15, link_pos[1] - 10, 30, 20)) { - mClikSlot = output; - mClikSlot_index = i2; - mClikSlot_isOut = true; - break; - } - } - } - if (node22.inputs) { - for (let i2 = 0, l = node22.inputs.length; i2 < l; ++i2) { - const input = node22.inputs[i2]; - const link_pos = node22.getConnectionPos(true, i2); - if (isInRectangle(e2.canvasX, e2.canvasY, link_pos[0] - 15, link_pos[1] - 10, 30, 20)) { - mClikSlot = input; - mClikSlot_index = i2; - mClikSlot_isOut = false; - break; - } - } - } - if (mClikSlot && mClikSlot_index !== false) { - const alphaPosY = 0.5 - (mClikSlot_index + 1) / (mClikSlot_isOut ? node22.outputs.length : node22.inputs.length); - const node_bounding = node22.getBounding(); - const posRef = [ - !mClikSlot_isOut ? node_bounding[0] : node_bounding[0] + node_bounding[2], - e2.canvasY - 80 - ]; - pointer2.onClick = () => this.createDefaultNodeForSlot({ - nodeFrom: !mClikSlot_isOut ? null : node22, - slotFrom: !mClikSlot_isOut ? null : mClikSlot_index, - nodeTo: !mClikSlot_isOut ? node22 : null, - slotTo: !mClikSlot_isOut ? mClikSlot_index : null, - position: posRef, - nodeType: "AUTO", - posAdd: [!mClikSlot_isOut ? -30 : 30, -alphaPosY * 130], - posSizeFix: [!mClikSlot_isOut ? -1 : 0, 0] - }); - } - } - if (this.allow_dragcanvas) { - pointer2.onDragStart = () => this.dragging_canvas = true; - pointer2.finally = () => this.dragging_canvas = false; - } - } - /** - * Called when a mouse move event has to be processed - */ - processMouseMove(e2) { - if (this.autoresize) this.resize(); - if (this.set_canvas_dirty_on_mouse_event) this.dirty_canvas = true; - if (!this.graph) return; - LGraphCanvas.active_canvas = this; - this.adjustMouseEvent(e2); - const mouse = [e2.clientX, e2.clientY]; - this.mouse[0] = mouse[0]; - this.mouse[1] = mouse[1]; - const delta2 = [ - mouse[0] - this.last_mouse[0], - mouse[1] - this.last_mouse[1] - ]; - this.last_mouse = mouse; - this.graph_mouse[0] = e2.canvasX; - this.graph_mouse[1] = e2.canvasY; - if (e2.isPrimary) this.pointer.move(e2); - if (this.block_click) { - e2.preventDefault(); - return; - } - e2.dragging = this.last_mouse_dragging; - if (this.node_widget) { - const [node3, widget2] = this.node_widget; - if (widget2?.mouse) { - const x2 = e2.canvasX - node3.pos[0]; - const y2 = e2.canvasY - node3.pos[1]; - const result = widget2.mouse(e2, [x2, y2], node3); - if (result != null) this.dirty_canvas = result; - } - } - let underPointer = CanvasItem.Nothing; - const node22 = this.graph.getNodeOnPos( - e2.canvasX, - e2.canvasY, - this.visible_nodes - ); - const { resizingGroup } = this; - const dragRect = this.dragging_rectangle; - if (dragRect) { - dragRect[2] = e2.canvasX - dragRect[0]; - dragRect[3] = e2.canvasY - dragRect[1]; - this.dirty_canvas = true; - } else if (resizingGroup) { - underPointer |= CanvasItem.ResizeSe | CanvasItem.Group; - } else if (this.dragging_canvas) { - this.ds.offset[0] += delta2[0] / this.ds.scale; - this.ds.offset[1] += delta2[1] / this.ds.scale; - this.#dirty(); - } else if ((this.allow_interaction || node22 && node22.flags.allow_interaction) && !this.read_only) { - if (this.connecting_links) this.dirty_canvas = true; - this.updateMouseOverNodes(node22, e2); - if (node22) { - underPointer |= CanvasItem.Node; - if (node22.redraw_on_mouse) this.dirty_canvas = true; - const pos2 = [0, 0]; - const inputId = this.isOverNodeInput(node22, e2.canvasX, e2.canvasY, pos2); - const outputId = this.isOverNodeOutput(node22, e2.canvasX, e2.canvasY, pos2); - const overWidget = this.getWidgetAtCursor(node22); - if (!node22.mouseOver) { - node22.mouseOver = { - inputId: null, - outputId: null, - overWidget: null - }; - this.node_over = node22; - this.dirty_canvas = true; - node22.onMouseEnter?.(e2); - } - node22.onMouseMove?.(e2, [e2.canvasX - node22.pos[0], e2.canvasY - node22.pos[1]], this); - if (node22.mouseOver.inputId !== inputId || node22.mouseOver.outputId !== outputId || node22.mouseOver.overWidget !== overWidget) { - node22.mouseOver.inputId = inputId; - node22.mouseOver.outputId = outputId; - node22.mouseOver.overWidget = overWidget; - if (this.connecting_links?.length) { - const firstLink = this.connecting_links[0]; - let highlightPos = null; - let highlightInput = null; - let linkOverWidget = null; - if (firstLink.node === node22) ; - else if (firstLink.output) { - if (inputId === -1 && outputId === -1) { - if (this.getWidgetLinkType && overWidget) { - const widgetLinkType = this.getWidgetLinkType(overWidget, node22); - if (widgetLinkType && LiteGraph.isValidConnection(firstLink.output.type, widgetLinkType)) { - if (firstLink.node.isValidWidgetLink?.(firstLink.output.slot_index, node22, overWidget) !== false) { - linkOverWidget = overWidget; - this.link_over_widget_type = widgetLinkType; - } - } - } - if (!linkOverWidget) { - const targetSlotId = firstLink.node.findConnectByTypeSlot(true, node22, firstLink.output.type); - if (targetSlotId !== null && targetSlotId >= 0) { - node22.getConnectionPos(true, targetSlotId, pos2); - highlightPos = pos2; - highlightInput = node22.inputs[targetSlotId]; - } - } - } else if (inputId != -1 && node22.inputs[inputId] && LiteGraph.isValidConnection(firstLink.output.type, node22.inputs[inputId].type)) { - if (inputId != -1 && node22.inputs[inputId] && LiteGraph.isValidConnection(firstLink.output.type, node22.inputs[inputId].type)) { - highlightPos = pos2; - highlightInput = node22.inputs[inputId]; - } - } - } else if (firstLink.input) { - if (inputId === -1 && outputId === -1) { - const targetSlotId = firstLink.node.findConnectByTypeSlot(false, node22, firstLink.input.type); - if (targetSlotId !== null && targetSlotId >= 0) { - node22.getConnectionPos(false, targetSlotId, pos2); - highlightPos = pos2; - } - } else { - if (outputId != -1 && node22.outputs[outputId] && LiteGraph.isValidConnection(firstLink.input.type, node22.outputs[outputId].type)) { - highlightPos = pos2; - } - } - } - this._highlight_pos = highlightPos; - this._highlight_input = highlightInput; - this.link_over_widget = linkOverWidget; - } - this.dirty_canvas = true; - } - if (node22.inResizeCorner(e2.canvasX, e2.canvasY)) { - underPointer |= CanvasItem.ResizeSe; - } - } else { - const segment = this.#getLinkCentreOnPos(e2); - if (this.over_link_center !== segment) { - underPointer |= CanvasItem.Link; - this.over_link_center = segment; - this.dirty_bgcanvas = true; - } - if (this.canvas) { - const group = this.graph.getGroupOnPos(e2.canvasX, e2.canvasY); - if (group && !e2.ctrlKey && !this.read_only && group.isInResize(e2.canvasX, e2.canvasY)) { - underPointer |= CanvasItem.ResizeSe; - } - } - } - if (this.node_capturing_input && this.node_capturing_input != node22) { - this.node_capturing_input.onMouseMove?.( - e2, - [ - e2.canvasX - this.node_capturing_input.pos[0], - e2.canvasY - this.node_capturing_input.pos[1] - ], - this - ); - } - if (this.isDragging) { - const selected2 = this.selectedItems; - const allItems = e2.ctrlKey ? selected2 : getAllNestedItems(selected2); - const deltaX = delta2[0] / this.ds.scale; - const deltaY = delta2[1] / this.ds.scale; - for (const item3 of allItems) { - item3.move(deltaX, deltaY, true); - } - this.#dirty(); - } - if (this.resizing_node) underPointer |= CanvasItem.ResizeSe; - } - this.hoveringOver = underPointer; - e2.preventDefault(); - return; - } - /** - * Start dragging an item, optionally including all other selected items. - * - * ** This function sets the {@link CanvasPointer.finally}() callback. ** - * @param item The item that the drag event started on - * @param pointer The pointer event that initiated the drag, e.g. pointerdown - * @param sticky If `true`, the item is added to the selection - see {@link processSelect} - */ - #startDraggingItems(item3, pointer2, sticky = false) { - this.emitBeforeChange(); - this.graph.beforeChange(); - pointer2.finally = () => { - this.isDragging = false; - this.graph.afterChange(); - this.emitAfterChange(); - }; - this.processSelect(item3, pointer2.eDown, sticky); - this.isDragging = true; - } - /** - * Handles shared clean up and placement after items have been dragged. - * @param e The event that completed the drag, e.g. pointerup, pointermove - */ - #processDraggedItems(e2) { - const { graph } = this; - if (e2.shiftKey || LiteGraph.alwaysSnapToGrid) - graph.snapToGrid(this.selectedItems); - this.dirty_canvas = true; - this.dirty_bgcanvas = true; - this.onNodeMoved?.(findFirstNode(this.selectedItems)); - } - /** - * Called when a mouse up event has to be processed - */ - processMouseUp(e2) { - if (e2.isPrimary === false) return; - const { graph, pointer: pointer2 } = this; - if (!graph) return; - LGraphCanvas.active_canvas = this; - this.adjustMouseEvent(e2); - const now2 = LiteGraph.getTime(); - e2.click_time = now2 - this.last_mouseclick; - const isClick = pointer2.up(e2); - if (isClick === true) { - pointer2.isDown = false; - pointer2.isDouble = false; - this.connecting_links = null; - this.dragging_canvas = false; - graph.change(); - e2.stopPropagation(); - e2.preventDefault(); - return; - } - this.last_mouse_dragging = false; - this.last_click_position = null; - this.block_click &&= false; - if (e2.button === 0) { - this.selected_group = null; - this.isDragging = false; - const x2 = e2.canvasX; - const y2 = e2.canvasY; - const node22 = graph.getNodeOnPos(x2, y2, this.visible_nodes); - if (this.connecting_links?.length) { - const firstLink = this.connecting_links[0]; - if (node22) { - for (const link2 of this.connecting_links) { - this.#dirty(); - if (link2.output) { - const slot = this.isOverNodeInput(node22, x2, y2); - if (slot != -1) { - link2.node.connect(link2.slot, node22, slot, link2.afterRerouteId); - } else if (this.link_over_widget) { - this.emitEvent({ - subType: "connectingWidgetLink", - link: link2, - node: node22, - widget: this.link_over_widget - }); - this.link_over_widget = null; - } else { - link2.node.connectByType(link2.slot, node22, link2.output.type, { - afterRerouteId: link2.afterRerouteId - }); - } - } else if (link2.input) { - const slot = this.isOverNodeOutput(node22, x2, y2); - if (slot != -1) { - node22.connect(slot, link2.node, link2.slot, link2.afterRerouteId); - } else { - link2.node.connectByTypeOutput( - link2.slot, - node22, - link2.input.type, - { afterRerouteId: link2.afterRerouteId } - ); - } - } - } - } else if (firstLink.input || firstLink.output) { - const linkReleaseContext = firstLink.output ? { - node_from: firstLink.node, - slot_from: firstLink.output, - type_filter_in: firstLink.output.type - } : { - node_to: firstLink.node, - slot_from: firstLink.input, - type_filter_out: firstLink.input.type - }; - const linkReleaseContextExtended = { - links: this.connecting_links - }; - this.emitEvent({ - subType: "empty-release", - originalEvent: e2, - linkReleaseContext: linkReleaseContextExtended - }); - if (LiteGraph.release_link_on_empty_shows_menu) { - if (e2.shiftKey) { - if (this.allow_searchbox) { - this.showSearchBox(e2, linkReleaseContext); - } - } else { - if (firstLink.output) { - this.showConnectionMenu({ nodeFrom: firstLink.node, slotFrom: firstLink.output, e: e2 }); - } else if (firstLink.input) { - this.showConnectionMenu({ nodeTo: firstLink.node, slotTo: firstLink.input, e: e2 }); - } - } - } - } - } else { - this.dirty_canvas = true; - this.node_over?.onMouseUp?.(e2, [x2 - this.node_over.pos[0], y2 - this.node_over.pos[1]], this); - this.node_capturing_input?.onMouseUp?.(e2, [ - x2 - this.node_capturing_input.pos[0], - y2 - this.node_capturing_input.pos[1] - ]); - } - this.connecting_links = null; - } else if (e2.button === 1) { - this.dirty_canvas = true; - this.dragging_canvas = false; - } else if (e2.button === 2) { - this.dirty_canvas = true; - } - pointer2.isDown = false; - pointer2.isDouble = false; - graph.change(); - e2.stopPropagation(); - e2.preventDefault(); - return; - } - /** - * Called when the mouse moves off the canvas. Clears all node hover states. - * @param e - */ - processMouseOut(e2) { - this.adjustMouseEvent(e2); - this.updateMouseOverNodes(null, e2); - } - processMouseCancel(e2) { - console.warn("Pointer cancel!"); - this.pointer.reset(); - } - /** - * Called when a mouse wheel event has to be processed - */ - processMouseWheel(e2) { - if (!this.graph || !this.allow_dragcanvas) return; - const delta2 = e2.wheelDeltaY ?? e2.detail * -60; - this.adjustMouseEvent(e2); - const pos2 = [e2.clientX, e2.clientY]; - if (this.viewport && !isPointInRect(pos2, this.viewport)) return; - let scale = this.ds.scale; - if (delta2 > 0) scale *= this.zoom_speed; - else if (delta2 < 0) scale *= 1 / this.zoom_speed; - this.ds.changeScale(scale, [e2.clientX, e2.clientY]); - this.graph.change(); - e2.preventDefault(); - return; - } - /** - * returns the INDEX if a position (in graph space) is on top of a node input slot - */ - isOverNodeInput(node22, canvasx, canvasy, slot_pos) { - if (node22.inputs) { - for (let i2 = 0, l = node22.inputs.length; i2 < l; ++i2) { - const input = node22.inputs[i2]; - const link_pos = node22.getConnectionPos(true, i2); - let is_inside = false; - if (node22.horizontal) { - is_inside = isInRectangle( - canvasx, - canvasy, - link_pos[0] - 5, - link_pos[1] - 10, - 10, - 20 - ); - } else { - const width2 = 20 + ((input.label?.length ?? input.localized_name?.length ?? input.name?.length) || 3) * 7; - is_inside = isInRectangle( - canvasx, - canvasy, - link_pos[0] - 10, - link_pos[1] - 10, - width2, - 20 - ); - } - if (is_inside) { - if (slot_pos) { - slot_pos[0] = link_pos[0]; - slot_pos[1] = link_pos[1]; - } - return i2; - } - } - } - return -1; - } - /** - * returns the INDEX if a position (in graph space) is on top of a node output slot - */ - isOverNodeOutput(node22, canvasx, canvasy, slot_pos) { - if (node22.outputs) { - for (let i2 = 0, l = node22.outputs.length; i2 < l; ++i2) { - const link_pos = node22.getConnectionPos(false, i2); - let is_inside = false; - if (node22.horizontal) { - is_inside = isInRectangle( - canvasx, - canvasy, - link_pos[0] - 5, - link_pos[1] - 10, - 10, - 20 - ); - } else { - is_inside = isInRectangle( - canvasx, - canvasy, - link_pos[0] - 10, - link_pos[1] - 10, - 40, - 20 - ); - } - if (is_inside) { - if (slot_pos) { - slot_pos[0] = link_pos[0]; - slot_pos[1] = link_pos[1]; - } - return i2; - } - } - } - return -1; - } - /** - * process a key event - */ - processKey(e2) { - this.#shiftDown = e2.shiftKey; - if (!this.graph) return; - let block_default = false; - if (e2.target.localName == "input") return; - if (e2.type == "keydown") { - if (e2.keyCode == 32) { - this.read_only = true; - if (this._previously_dragging_canvas === null) { - this._previously_dragging_canvas = this.dragging_canvas; - } - this.dragging_canvas = this.pointer.isDown; - block_default = true; - } else if (e2.keyCode == 27) { - this.node_panel?.close(); - this.options_panel?.close(); - block_default = true; - } else if (e2.keyCode == 65 && e2.ctrlKey) { - this.selectItems(); - block_default = true; - } else if (e2.keyCode === 67 && (e2.metaKey || e2.ctrlKey) && !e2.shiftKey) { - if (this.selected_nodes) { - this.copyToClipboard(); - block_default = true; - } - } else if (e2.keyCode === 86 && (e2.metaKey || e2.ctrlKey)) { - this.pasteFromClipboard(e2.shiftKey); - } else if (e2.keyCode == 46 || e2.keyCode == 8) { - if (e2.target.localName != "input" && e2.target.localName != "textarea") { - this.deleteSelected(); - block_default = true; - } - } - if (this.selected_nodes) { - for (const i2 in this.selected_nodes) { - this.selected_nodes[i2].onKeyDown?.(e2); - } - } - } else if (e2.type == "keyup") { - if (e2.keyCode == 32) { - this.read_only = false; - this.dragging_canvas = (this._previously_dragging_canvas ?? false) && this.pointer.isDown; - this._previously_dragging_canvas = null; - } - if (this.selected_nodes) { - for (const i2 in this.selected_nodes) { - this.selected_nodes[i2].onKeyUp?.(e2); - } - } - } - this.graph.change(); - if (block_default) { - e2.preventDefault(); - e2.stopImmediatePropagation(); - return false; - } - } - /** - * Copies canvas items to an internal, app-specific clipboard backed by local storage. - * When called without parameters, it copies {@link selectedItems}. - * @param items The items to copy. If nullish, all selected items are copied. - */ - copyToClipboard(items2) { - const serialisable = { - nodes: [], - groups: [], - reroutes: [], - links: [] - }; - for (const item3 of items2 ?? this.selectedItems) { - if (item3 instanceof LGraphNode) { - if (item3.clonable === false) continue; - const cloned = item3.clone()?.serialize(); - if (!cloned) continue; - cloned.id = item3.id; - serialisable.nodes.push(cloned); - const links = item3.inputs?.map((input) => this.graph._links.get(input?.link)?.asSerialisable()).filter((x2) => !!x2); - if (!links) continue; - serialisable.links.push(...links); - } else if (item3 instanceof LGraphGroup) { - serialisable.groups.push(item3.serialize()); - } else if (this.reroutesEnabled && item3 instanceof Reroute) { - serialisable.reroutes.push(item3.asSerialisable()); - } - } - localStorage.setItem( - "litegrapheditor_clipboard", - JSON.stringify(serialisable) - ); - } - emitEvent(detail) { - this.canvas.dispatchEvent( - new CustomEvent("litegraph:canvas", { - bubbles: true, - detail - }) - ); - } - /** @todo Refactor to where it belongs - e.g. Deleting / creating nodes is not actually canvas event. */ - emitBeforeChange() { - this.emitEvent({ - subType: "before-change" - }); - } - /** @todo See {@link emitBeforeChange} */ - emitAfterChange() { - this.emitEvent({ - subType: "after-change" - }); - } - /** - * Pastes the items from the canvas "clipbaord" - a local storage variable. - * @param connectInputs If `true`, always attempt to connect inputs of pasted nodes - including to nodes that were not pasted. - */ - _pasteFromClipboard(connectInputs = false) { - if (!LiteGraph.ctrl_shift_v_paste_connect_unselected_outputs && connectInputs) return; - const data24 = localStorage.getItem("litegrapheditor_clipboard"); - if (!data24) return; - const { graph } = this; - graph.beforeChange(); - const parsed = JSON.parse(data24); - parsed.nodes ??= []; - parsed.groups ??= []; - parsed.reroutes ??= []; - parsed.links ??= []; - let offsetX = Infinity; - let offsetY = Infinity; - for (const item3 of [...parsed.nodes, ...parsed.reroutes]) { - if (item3.pos[0] < offsetX) offsetX = item3.pos[0]; - if (item3.pos[1] < offsetY) offsetY = item3.pos[1]; - } - if (parsed.groups) { - for (const group of parsed.groups) { - if (group.bounding[0] < offsetX) offsetX = group.bounding[0]; - if (group.bounding[1] < offsetY) offsetY = group.bounding[1]; - } - } - const results = { - created: [], - nodes: /* @__PURE__ */ new Map(), - links: /* @__PURE__ */ new Map(), - reroutes: /* @__PURE__ */ new Map() - }; - const { created: created3, nodes, links, reroutes } = results; - for (const info of parsed.groups) { - info.id = void 0; - const group = new LGraphGroup(); - group.configure(info); - graph.add(group); - created3.push(group); - } - for (const info of parsed.nodes) { - const node22 = LiteGraph.createNode(info.type); - if (!node22) { - continue; - } - nodes.set(info.id, node22); - info.id = void 0; - node22.configure(info); - graph.add(node22); - created3.push(node22); - } - for (const info of parsed.reroutes) { - const { id: id3 } = info; - info.id = void 0; - const reroute = graph.setReroute(info); - created3.push(reroute); - reroutes.set(id3, reroute); - } - for (const reroute of reroutes.values()) { - const mapped = reroutes.get(reroute.parentId); - if (mapped) reroute.parentId = mapped.id; - } - for (const info of parsed.links) { - let outNode = nodes.get(info.origin_id); - let afterRerouteId = reroutes.get(info.parentId)?.id; - if (connectInputs && LiteGraph.ctrl_shift_v_paste_connect_unselected_outputs) { - outNode ??= graph.getNodeById(info.origin_id); - afterRerouteId ??= info.parentId; - } - const inNode = nodes.get(info.target_id); - if (inNode) { - const link2 = outNode?.connect( - info.origin_slot, - inNode, - info.target_slot, - afterRerouteId - ); - if (link2) links.set(info.id, link2); - } - } - for (const reroute of reroutes.values()) { - const ids = [...reroute.linkIds].map((x2) => links.get(x2)?.id ?? x2); - reroute.update(reroute.parentId, void 0, ids); - if (!reroute.validateLinks(graph.links)) graph.removeReroute(reroute.id); - } - for (const item3 of created3) { - item3.pos[0] += this.graph_mouse[0] - offsetX; - item3.pos[1] += this.graph_mouse[1] - offsetY; - } - this.selectItems(created3); - graph.afterChange(); - return results; - } - pasteFromClipboard(isConnectUnselected = false) { - this.emitBeforeChange(); - try { - this._pasteFromClipboard(isConnectUnselected); - } finally { - this.emitAfterChange(); - } - } - /** - * process a item drop event on top the canvas - */ - processDrop(e2) { - e2.preventDefault(); - this.adjustMouseEvent(e2); - const x2 = e2.clientX; - const y2 = e2.clientY; - const is_inside = !this.viewport || isInRect(x2, y2, this.viewport); - if (!is_inside) return; - const pos2 = [e2.canvasX, e2.canvasY]; - const node22 = this.graph ? this.graph.getNodeOnPos(pos2[0], pos2[1]) : null; - if (!node22) { - const r = this.onDropItem?.(e2); - if (!r) this.checkDropItem(e2); - return; - } - if (node22.onDropFile || node22.onDropData) { - const files = e2.dataTransfer.files; - if (files && files.length) { - for (let i2 = 0; i2 < files.length; i2++) { - const file = e2.dataTransfer.files[0]; - const filename = file.name; - node22.onDropFile?.(file); - if (node22.onDropData) { - const reader = new FileReader(); - reader.onload = function(event) { - const data24 = event.target.result; - node22.onDropData(data24, filename, file); - }; - const type = file.type.split("/")[0]; - if (type == "text" || type == "") { - reader.readAsText(file); - } else if (type == "image") { - reader.readAsDataURL(file); - } else { - reader.readAsArrayBuffer(file); - } - } - } - } - } - if (node22.onDropItem?.(e2)) return true; - return this.onDropItem ? this.onDropItem(e2) : false; - } - // called if the graph doesn't have a default drop item behaviour - checkDropItem(e2) { - if (!e2.dataTransfer.files.length) return; - const file = e2.dataTransfer.files[0]; - const ext = LGraphCanvas.getFileExtension(file.name).toLowerCase(); - const nodetype = LiteGraph.node_types_by_file_extension[ext]; - if (!nodetype) return; - this.graph.beforeChange(); - const node22 = LiteGraph.createNode(nodetype.type); - node22.pos = [e2.canvasX, e2.canvasY]; - this.graph.add(node22); - node22.onDropFile?.(file); - this.graph.afterChange(); - } - processNodeDblClicked(n) { - this.onShowNodePanel?.(n); - this.onNodeDblClicked?.(n); - this.setDirty(true); - } - #handleMultiSelect(e2, dragRect) { - const { graph, selectedItems } = this; - const w = Math.abs(dragRect[2]); - const h2 = Math.abs(dragRect[3]); - if (dragRect[2] < 0) dragRect[0] -= w; - if (dragRect[3] < 0) dragRect[1] -= h2; - dragRect[2] = w; - dragRect[3] = h2; - const isSelected5 = []; - const notSelected = []; - for (const nodeX of graph._nodes) { - if (!overlapBounding(dragRect, nodeX.boundingRect)) continue; - if (!nodeX.selected || !selectedItems.has(nodeX)) - notSelected.push(nodeX); - else isSelected5.push(nodeX); - } - for (const group of graph.groups) { - if (!containsRect(dragRect, group._bounding)) continue; - group.recomputeInsideNodes(); - if (!group.selected || !selectedItems.has(group)) - notSelected.push(group); - else isSelected5.push(group); - } - for (const reroute of graph.reroutes.values()) { - if (!isPointInRect(reroute.pos, dragRect)) continue; - selectedItems.add(reroute); - reroute.selected = true; - if (!reroute.selected || !selectedItems.has(reroute)) - notSelected.push(reroute); - else isSelected5.push(reroute); - } - if (e2.shiftKey) { - for (const item3 of notSelected) this.select(item3); - } else if (e2.altKey) { - for (const item3 of isSelected5) this.deselect(item3); - } else { - for (const item3 of selectedItems.values()) { - if (!isSelected5.includes(item3)) this.deselect(item3); - } - for (const item3 of notSelected) this.select(item3); - } - } - /** - * Determines whether to select or deselect an item that has received a pointer event. Will deselect other nodes if - * @param item Canvas item to select/deselect - * @param e The MouseEvent to handle - * @param sticky Prevents deselecting individual nodes (as used by aux/right-click) - * @remarks - * Accessibility: anyone using {@link mutli_select} always deselects when clicking empty space. - */ - processSelect(item3, e2, sticky = false) { - const addModifier = e2?.shiftKey; - const subtractModifier = e2 != null && (e2.metaKey || e2.ctrlKey); - const eitherModifier = addModifier || subtractModifier; - const modifySelection = eitherModifier || this.multi_select; - if (!item3) { - if (!eitherModifier || this.multi_select) this.deselectAll(); - } else if (!item3.selected || !this.selectedItems.has(item3)) { - if (!modifySelection) this.deselectAll(item3); - this.select(item3); - } else if (modifySelection && !sticky) { - this.deselect(item3); - } else if (!sticky) { - this.deselectAll(item3); - } else { - return; - } - this.onSelectionChange?.(this.selected_nodes); - this.setDirty(true); - } - /** - * Selects a {@link Positionable} item. - * @param item The canvas item to add to the selection. - */ - select(item3) { - if (item3.selected && this.selectedItems.has(item3)) return; - item3.selected = true; - this.selectedItems.add(item3); - if (!(item3 instanceof LGraphNode)) return; - item3.onSelected?.(); - this.selected_nodes[item3.id] = item3; - this.onNodeSelected?.(item3); - item3.inputs?.forEach((input) => this.highlighted_links[input.link] = true); - item3.outputs?.flatMap((x2) => x2.links).forEach((id3) => this.highlighted_links[id3] = true); - } - /** - * Deselects a {@link Positionable} item. - * @param item The canvas item to remove from the selection. - */ - deselect(item3) { - if (!item3.selected && !this.selectedItems.has(item3)) return; - item3.selected = false; - this.selectedItems.delete(item3); - if (!(item3 instanceof LGraphNode)) return; - item3.onDeselected?.(); - delete this.selected_nodes[item3.id]; - this.onNodeDeselected?.(item3); - item3.inputs?.forEach((input) => delete this.highlighted_links[input.link]); - item3.outputs?.flatMap((x2) => x2.links).forEach((id3) => delete this.highlighted_links[id3]); - } - /** @deprecated See {@link LGraphCanvas.processSelect} */ - processNodeSelected(item3, e2) { - this.processSelect( - item3, - e2, - e2 && (e2.shiftKey || e2.metaKey || e2.ctrlKey || this.multi_select) - ); - } - /** @deprecated See {@link LGraphCanvas.select} */ - selectNode(node22, add_to_current_selection) { - if (node22 == null) { - this.deselectAll(); - } else { - this.selectNodes([node22], add_to_current_selection); - } - } - get empty() { - return this.graph.empty; - } - get positionableItems() { - return this.graph.positionableItems(); - } - /** - * Selects several items. - * @param items Items to select - if falsy, all items on the canvas will be selected - * @param add_to_current_selection If set, the items will be added to the current selection instead of replacing it - */ - selectItems(items2, add_to_current_selection) { - const itemsToSelect = items2 ?? this.positionableItems; - if (!add_to_current_selection) this.deselectAll(); - for (const item3 of itemsToSelect) this.select(item3); - this.onSelectionChange?.(this.selected_nodes); - this.setDirty(true); - } - /** - * selects several nodes (or adds them to the current selection) - * @deprecated See {@link LGraphCanvas.selectItems} - */ - selectNodes(nodes, add_to_current_selection) { - this.selectItems(nodes, add_to_current_selection); - } - /** @deprecated See {@link LGraphCanvas.deselect} */ - deselectNode(node22) { - this.deselect(node22); - } - /** - * Deselects all items on the canvas. - * @param keepSelected If set, this item will not be removed from the selection. - */ - deselectAll(keepSelected) { - if (!this.graph) return; - const selected2 = this.selectedItems; - let wasSelected; - for (const sel of selected2) { - if (sel === keepSelected) { - wasSelected = sel; - continue; - } - sel.onDeselected?.(); - sel.selected = false; - } - selected2.clear(); - if (wasSelected) selected2.add(wasSelected); - this.setDirty(true); - const oldNode = keepSelected?.id == null ? null : this.selected_nodes[keepSelected.id]; - this.selected_nodes = {}; - this.current_node = null; - this.highlighted_links = {}; - if (keepSelected instanceof LGraphNode) { - if (oldNode) this.selected_nodes[oldNode.id] = oldNode; - keepSelected.inputs?.forEach((input) => this.highlighted_links[input.link] = true); - keepSelected.outputs?.flatMap((x2) => x2.links).forEach((id3) => this.highlighted_links[id3] = true); - } - this.onSelectionChange?.(this.selected_nodes); - } - /** @deprecated See {@link LGraphCanvas.deselectAll} */ - deselectAllNodes() { - this.deselectAll(); - } - /** - * Deletes all selected items from the graph. - * @todo Refactor deletion task to LGraph. Selection is a canvas property, delete is a graph action. - */ - deleteSelected() { - const { graph } = this; - this.emitBeforeChange(); - graph.beforeChange(); - for (const item3 of this.selectedItems) { - if (item3 instanceof LGraphNode) { - const node22 = item3; - if (node22.block_delete) continue; - node22.connectInputToOutput(); - graph.remove(node22); - this.onNodeDeselected?.(node22); - } else if (item3 instanceof LGraphGroup) { - graph.remove(item3); - } else if (item3 instanceof Reroute) { - graph.removeReroute(item3.id); - } - } - this.selectedItems.clear(); - this.selected_nodes = {}; - this.selectedItems.clear(); - this.current_node = null; - this.highlighted_links = {}; - this.setDirty(true); - graph.afterChange(); - this.emitAfterChange(); - } - /** - * deletes all nodes in the current selection from the graph - * @deprecated See {@link LGraphCanvas.deleteSelected} - */ - deleteSelectedNodes() { - this.deleteSelected(); - } - /** - * centers the camera on a given node - */ - centerOnNode(node22) { - const dpi = window?.devicePixelRatio || 1; - this.ds.offset[0] = -node22.pos[0] - node22.size[0] * 0.5 + this.canvas.width * 0.5 / (this.ds.scale * dpi); - this.ds.offset[1] = -node22.pos[1] - node22.size[1] * 0.5 + this.canvas.height * 0.5 / (this.ds.scale * dpi); - this.setDirty(true, true); - } - /** - * adds some useful properties to a mouse event, like the position in graph coordinates - */ - adjustMouseEvent(e2) { - let clientX_rel = e2.clientX; - let clientY_rel = e2.clientY; - if (this.canvas) { - const b = this.canvas.getBoundingClientRect(); - clientX_rel -= b.left; - clientY_rel -= b.top; - } - e2.safeOffsetX = clientX_rel; - e2.safeOffsetY = clientY_rel; - if (e2.deltaX === void 0) - e2.deltaX = clientX_rel - this.last_mouse_position[0]; - if (e2.deltaY === void 0) - e2.deltaY = clientY_rel - this.last_mouse_position[1]; - this.last_mouse_position[0] = clientX_rel; - this.last_mouse_position[1] = clientY_rel; - e2.canvasX = clientX_rel / this.ds.scale - this.ds.offset[0]; - e2.canvasY = clientY_rel / this.ds.scale - this.ds.offset[1]; - } - /** - * changes the zoom level of the graph (default is 1), you can pass also a place used to pivot the zoom - */ - setZoom(value4, zooming_center) { - this.ds.changeScale(value4, zooming_center); - this.#dirty(); - } - /** - * converts a coordinate from graph coordinates to canvas2D coordinates - */ - convertOffsetToCanvas(pos2, out) { - return this.ds.convertOffsetToCanvas(pos2, out); - } - /** - * converts a coordinate from Canvas2D coordinates to graph space - */ - convertCanvasToOffset(pos2, out) { - return this.ds.convertCanvasToOffset(pos2, out); - } - // converts event coordinates from canvas2D to graph coordinates - convertEventToCanvasOffset(e2) { - const rect = this.canvas.getBoundingClientRect(); - return this.convertCanvasToOffset([ - e2.clientX - rect.left, - e2.clientY - rect.top - ]); - } - /** - * brings a node to front (above all other nodes) - */ - bringToFront(node22) { - const i2 = this.graph._nodes.indexOf(node22); - if (i2 == -1) return; - this.graph._nodes.splice(i2, 1); - this.graph._nodes.push(node22); - } - /** - * sends a node to the back (below all other nodes) - */ - sendToBack(node22) { - const i2 = this.graph._nodes.indexOf(node22); - if (i2 == -1) return; - this.graph._nodes.splice(i2, 1); - this.graph._nodes.unshift(node22); - } - /** - * Determines which nodes are visible and populates {@link out} with the results. - * @param nodes The list of nodes to check - if falsy, all nodes in the graph will be checked - * @param out Array to write visible nodes into - if falsy, a new array is created instead - * @returns Array passed ({@link out}), or a new array containing all visible nodes - */ - computeVisibleNodes(nodes, out) { - const visible_nodes = out || []; - visible_nodes.length = 0; - const _nodes = nodes || this.graph._nodes; - for (const node22 of _nodes) { - node22.updateArea(); - if (!overlapBounding(this.visible_area, node22.renderArea)) continue; - visible_nodes.push(node22); - } - return visible_nodes; - } - /** - * renders the whole canvas content, by rendering in two separated canvas, one containing the background grid and the connections, and one containing the nodes) - */ - draw(force_canvas, force_bgcanvas) { - if (!this.canvas || this.canvas.width == 0 || this.canvas.height == 0) return; - const now2 = LiteGraph.getTime(); - this.render_time = (now2 - this.last_draw_time) * 1e-3; - this.last_draw_time = now2; - if (this.graph) this.ds.computeVisibleArea(this.viewport); - if (this.dirty_canvas || force_canvas) - this.computeVisibleNodes(null, this.visible_nodes); - if (this.dirty_bgcanvas || force_bgcanvas || this.always_render_background || this.graph?._last_trigger_time && now2 - this.graph._last_trigger_time < 1e3) { - this.drawBackCanvas(); - } - if (this.dirty_canvas || force_canvas) this.drawFrontCanvas(); - this.fps = this.render_time ? 1 / this.render_time : 0; - this.frame++; - } - /** - * draws the front canvas (the one containing all the nodes) - */ - drawFrontCanvas() { - this.dirty_canvas = false; - if (!this.ctx) { - this.ctx = this.bgcanvas.getContext("2d"); - } - const ctx = this.ctx; - if (!ctx) return; - const canvas = this.canvas; - if (ctx.start2D && !this.viewport) { - ctx.start2D(); - ctx.restore(); - ctx.setTransform(1, 0, 0, 1, 0, 0); - } - const area = this.viewport || this.dirty_area; - if (area) { - ctx.save(); - ctx.beginPath(); - ctx.rect(area[0], area[1], area[2], area[3]); - ctx.clip(); - } - this.#snapToGrid = this.#shiftDown || LiteGraph.alwaysSnapToGrid ? this.graph.getSnapToGridSize() : void 0; - if (this.clear_background) { - if (area) ctx.clearRect(area[0], area[1], area[2], area[3]); - else ctx.clearRect(0, 0, canvas.width, canvas.height); - } - if (this.bgcanvas == this.canvas) { - this.drawBackCanvas(); - } else { - const scale = window.devicePixelRatio; - ctx.drawImage( - this.bgcanvas, - 0, - 0, - this.bgcanvas.width / scale, - this.bgcanvas.height / scale - ); - } - this.onRender?.(canvas, ctx); - if (this.show_info) { - this.renderInfo(ctx, area ? area[0] : 0, area ? area[1] : 0); - } - if (this.graph) { - ctx.save(); - this.ds.toCanvasContext(ctx); - const visible_nodes = this.visible_nodes; - const drawSnapGuides = this.#snapToGrid && this.isDragging; - for (let i2 = 0; i2 < visible_nodes.length; ++i2) { - const node22 = visible_nodes[i2]; - ctx.save(); - if (drawSnapGuides && this.selectedItems.has(node22)) - this.drawSnapGuide(ctx, node22); - ctx.translate(node22.pos[0], node22.pos[1]); - this.drawNode(node22, ctx); - ctx.restore(); - } - if (this.render_execution_order) { - this.drawExecutionOrder(ctx); - } - if (this.graph.config.links_ontop) { - this.drawConnections(ctx); - } - if (this.connecting_links?.length) { - for (const link2 of this.connecting_links) { - ctx.lineWidth = this.connections_width; - let link_color = null; - const connInOrOut = link2.output || link2.input; - const connType = connInOrOut?.type; - let connDir = connInOrOut?.dir; - if (connDir == null) { - if (link2.output) - connDir = link2.node.horizontal ? LinkDirection.DOWN : LinkDirection.RIGHT; - else - connDir = link2.node.horizontal ? LinkDirection.UP : LinkDirection.LEFT; - } - const connShape = connInOrOut?.shape; - switch (connType) { - case LiteGraph.EVENT: - link_color = LiteGraph.EVENT_LINK_COLOR; - break; - default: - link_color = LiteGraph.CONNECTING_LINK_COLOR; - } - const pos2 = this.graph.reroutes.get(link2.afterRerouteId)?.pos ?? link2.pos; - const highlightPos = this.#getHighlightPosition(); - this.renderLink( - ctx, - pos2, - highlightPos, - null, - false, - null, - link_color, - connDir, - link2.direction ?? LinkDirection.CENTER - ); - ctx.beginPath(); - if (connType === LiteGraph.EVENT || connShape === RenderShape.BOX) { - ctx.rect(pos2[0] - 6 + 0.5, pos2[1] - 5 + 0.5, 14, 10); - ctx.fill(); - ctx.beginPath(); - ctx.rect( - this.graph_mouse[0] - 6 + 0.5, - this.graph_mouse[1] - 5 + 0.5, - 14, - 10 - ); - } else if (connShape === RenderShape.ARROW) { - ctx.moveTo(pos2[0] + 8, pos2[1] + 0.5); - ctx.lineTo(pos2[0] - 4, pos2[1] + 6 + 0.5); - ctx.lineTo(pos2[0] - 4, pos2[1] - 6 + 0.5); - ctx.closePath(); - } else { - ctx.arc(pos2[0], pos2[1], 4, 0, Math.PI * 2); - ctx.fill(); - ctx.beginPath(); - ctx.arc(this.graph_mouse[0], this.graph_mouse[1], 4, 0, Math.PI * 2); - } - ctx.fill(); - this.#renderSnapHighlight(ctx, highlightPos); - } - } - if (this.dragging_rectangle) { - const { eDown, eMove } = this.pointer; - ctx.strokeStyle = "#FFF"; - if (eDown && eMove) { - const transform2 = ctx.getTransform(); - const ratio = window.devicePixelRatio; - ctx.setTransform(ratio, 0, 0, ratio, 0, 0); - const x2 = eDown.safeOffsetX; - const y2 = eDown.safeOffsetY; - ctx.strokeRect(x2, y2, eMove.safeOffsetX - x2, eMove.safeOffsetY - y2); - ctx.setTransform(transform2); - } else { - const [x2, y2, w, h2] = this.dragging_rectangle; - ctx.strokeRect(x2, y2, w, h2); - } - } - if (this.over_link_center && this.render_link_tooltip) - this.drawLinkTooltip(ctx, this.over_link_center); - else - this.onDrawLinkTooltip?.(ctx, null); - this.onDrawForeground?.(ctx, this.visible_area); - ctx.restore(); - } - this.onDrawOverlay?.(ctx); - if (area) ctx.restore(); - if (ctx.finish2D) ctx.finish2D(); - } - /** @returns If the pointer is over a link centre marker, the link segment it belongs to. Otherwise, `undefined`. */ - #getLinkCentreOnPos(e2) { - for (const linkSegment of this.renderedPaths) { - const centre = linkSegment._pos; - if (!centre) continue; - if (isInRectangle(e2.canvasX, e2.canvasY, centre[0] - 4, centre[1] - 4, 8, 8)) { - return linkSegment; - } - } - } - /** Get the target snap / highlight point in graph space */ - #getHighlightPosition() { - return LiteGraph.snaps_for_comfy ? this._highlight_pos ?? this.graph_mouse : this.graph_mouse; - } - /** - * Renders indicators showing where a link will connect if released. - * Partial border over target node and a highlight over the slot itself. - * @param ctx Canvas 2D context - */ - #renderSnapHighlight(ctx, highlightPos) { - if (!this._highlight_pos) return; - ctx.fillStyle = "#ffcc00"; - ctx.beginPath(); - const shape = this._highlight_input?.shape; - if (shape === RenderShape.ARROW) { - ctx.moveTo(highlightPos[0] + 8, highlightPos[1] + 0.5); - ctx.lineTo(highlightPos[0] - 4, highlightPos[1] + 6 + 0.5); - ctx.lineTo(highlightPos[0] - 4, highlightPos[1] - 6 + 0.5); - ctx.closePath(); - } else { - ctx.arc(highlightPos[0], highlightPos[1], 6, 0, Math.PI * 2); - } - ctx.fill(); - if (!LiteGraph.snap_highlights_node) return; - const node22 = this.node_over; - if (!(node22 && this.connecting_links?.[0])) return; - const { strokeStyle, lineWidth } = ctx; - const area = node22.boundingRect; - const gap = 3; - const radius = this.round_radius + gap; - const x2 = area[0] - gap; - const y2 = area[1] - gap; - const width2 = area[2] + gap * 2; - const height = area[3] + gap * 2; - ctx.beginPath(); - ctx.roundRect(x2, y2, width2, height, radius); - const start2 = this.connecting_links[0].output === null ? 0 : 1; - const inverter = start2 ? -1 : 1; - const hx = highlightPos[0]; - const hy = highlightPos[1]; - const gRadius = width2 < height ? width2 : width2 * Math.max(height / width2, 0.5); - const gradient = ctx.createRadialGradient(hx, hy, 0, hx, hy, gRadius); - gradient.addColorStop(1, "#00000000"); - gradient.addColorStop(0, "#ffcc00aa"); - const linearGradient = ctx.createLinearGradient(x2, y2, x2 + width2, y2); - linearGradient.addColorStop(0.5, "#00000000"); - linearGradient.addColorStop(start2 + 0.67 * inverter, "#ddeeff33"); - linearGradient.addColorStop(start2 + inverter, "#ffcc0055"); - ctx.setLineDash([radius, radius * 1e-3]); - ctx.lineWidth = 1; - ctx.strokeStyle = linearGradient; - ctx.stroke(); - ctx.strokeStyle = gradient; - ctx.stroke(); - ctx.setLineDash([]); - ctx.lineWidth = lineWidth; - ctx.strokeStyle = strokeStyle; - } - /** - * draws some useful stats in the corner of the canvas - */ - renderInfo(ctx, x2, y2) { - x2 = x2 || 10; - y2 = y2 || this.canvas.offsetHeight - 80; - ctx.save(); - ctx.translate(x2, y2); - ctx.font = "10px Arial"; - ctx.fillStyle = "#888"; - ctx.textAlign = "left"; - if (this.graph) { - ctx.fillText("T: " + this.graph.globaltime.toFixed(2) + "s", 5, 13 * 1); - ctx.fillText("I: " + this.graph.iteration, 5, 13 * 2); - ctx.fillText("N: " + this.graph._nodes.length + " [" + this.visible_nodes.length + "]", 5, 13 * 3); - ctx.fillText("V: " + this.graph._version, 5, 13 * 4); - ctx.fillText("FPS:" + this.fps.toFixed(2), 5, 13 * 5); - } else { - ctx.fillText("No graph selected", 5, 13 * 1); - } - ctx.restore(); - } - /** - * draws the back canvas (the one containing the background and the connections) - */ - drawBackCanvas() { - const canvas = this.bgcanvas; - if (canvas.width != this.canvas.width || canvas.height != this.canvas.height) { - canvas.width = this.canvas.width; - canvas.height = this.canvas.height; - } - if (!this.bgctx) { - this.bgctx = this.bgcanvas.getContext("2d"); - } - const ctx = this.bgctx; - if (ctx.start) ctx.start(); - const viewport = this.viewport || [0, 0, ctx.canvas.width, ctx.canvas.height]; - if (this.clear_background) { - ctx.clearRect(viewport[0], viewport[1], viewport[2], viewport[3]); - } - if (this._graph_stack?.length) { - ctx.save(); - const subgraph_node = this.graph._subgraph_node; - ctx.strokeStyle = subgraph_node.bgcolor; - ctx.lineWidth = 10; - ctx.strokeRect(1, 1, canvas.width - 2, canvas.height - 2); - ctx.lineWidth = 1; - ctx.font = "40px Arial"; - ctx.textAlign = "center"; - ctx.fillStyle = subgraph_node.bgcolor || "#AAA"; - let title = ""; - for (let i2 = 1; i2 < this._graph_stack.length; ++i2) { - title += this._graph_stack[i2]._subgraph_node.getTitle() + " >> "; - } - ctx.fillText(title + subgraph_node.getTitle(), canvas.width * 0.5, 40); - ctx.restore(); - } - const bg_already_painted = this.onRenderBackground ? this.onRenderBackground(canvas, ctx) : false; - if (!this.viewport) { - const scale = window.devicePixelRatio; - ctx.restore(); - ctx.setTransform(scale, 0, 0, scale, 0, 0); - } - this.visible_links.length = 0; - if (this.graph) { - ctx.save(); - this.ds.toCanvasContext(ctx); - if (this.ds.scale < 1.5 && !bg_already_painted && this.clear_background_color) { - ctx.fillStyle = this.clear_background_color; - ctx.fillRect( - this.visible_area[0], - this.visible_area[1], - this.visible_area[2], - this.visible_area[3] - ); - } - if (this.background_image && this.ds.scale > 0.5 && !bg_already_painted) { - if (this.zoom_modify_alpha) { - ctx.globalAlpha = (1 - 0.5 / this.ds.scale) * this.editor_alpha; - } else { - ctx.globalAlpha = this.editor_alpha; - } - ctx.imageSmoothingEnabled = false; - if (!this._bg_img || this._bg_img.name != this.background_image) { - this._bg_img = new Image(); - this._bg_img.name = this.background_image; - this._bg_img.src = this.background_image; - const that = this; - this._bg_img.onload = function() { - that.draw(true, true); - }; - } - let pattern = this._pattern; - if (pattern == null && this._bg_img.width > 0) { - pattern = ctx.createPattern(this._bg_img, "repeat"); - this._pattern_img = this._bg_img; - this._pattern = pattern; - } - if (pattern) { - ctx.fillStyle = pattern; - ctx.fillRect( - this.visible_area[0], - this.visible_area[1], - this.visible_area[2], - this.visible_area[3] - ); - ctx.fillStyle = "transparent"; - } - ctx.globalAlpha = 1; - ctx.imageSmoothingEnabled = true; - } - if (this.graph._groups.length) { - this.drawGroups(canvas, ctx); - } - this.onDrawBackground?.(ctx, this.visible_area); - if (this.render_canvas_border) { - ctx.strokeStyle = "#235"; - ctx.strokeRect(0, 0, canvas.width, canvas.height); - } - if (this.render_connections_shadows) { - ctx.shadowColor = "#000"; - ctx.shadowOffsetX = 0; - ctx.shadowOffsetY = 0; - ctx.shadowBlur = 6; - } else { - ctx.shadowColor = "rgba(0,0,0,0)"; - } - this.drawConnections(ctx); - ctx.shadowColor = "rgba(0,0,0,0)"; - ctx.restore(); - } - ctx.finish?.(); - this.dirty_bgcanvas = false; - this.dirty_canvas = true; - } - /** - * draws the given node inside the canvas - */ - drawNode(node22, ctx) { - this.current_node = node22; - const color2 = node22.color || node22.constructor.color || LiteGraph.NODE_DEFAULT_COLOR; - const bgcolor = node22.bgcolor || node22.constructor.bgcolor || LiteGraph.NODE_DEFAULT_BGCOLOR; - const low_quality = this.ds.scale < 0.6; - const editor_alpha = this.editor_alpha; - ctx.globalAlpha = editor_alpha; - if (this.render_shadows && !low_quality) { - ctx.shadowColor = LiteGraph.DEFAULT_SHADOW_COLOR; - ctx.shadowOffsetX = 2 * this.ds.scale; - ctx.shadowOffsetY = 2 * this.ds.scale; - ctx.shadowBlur = 3 * this.ds.scale; - } else { - ctx.shadowColor = "transparent"; - } - if (node22.flags.collapsed && node22.onDrawCollapsed?.(ctx, this) == true) - return; - const shape = node22._shape || RenderShape.BOX; - const size2 = LGraphCanvas.#temp_vec2; - LGraphCanvas.#temp_vec2.set(node22.size); - const horizontal2 = node22.horizontal; - if (node22.flags.collapsed) { - ctx.font = this.inner_text_font; - const title = node22.getTitle ? node22.getTitle() : node22.title; - if (title != null) { - node22._collapsed_width = Math.min( - node22.size[0], - ctx.measureText(title).width + LiteGraph.NODE_TITLE_HEIGHT * 2 - ); - size2[0] = node22._collapsed_width; - size2[1] = 0; - } - } - if (node22.clip_area) { - ctx.save(); - ctx.beginPath(); - if (shape == RenderShape.BOX) { - ctx.rect(0, 0, size2[0], size2[1]); - } else if (shape == RenderShape.ROUND) { - ctx.roundRect(0, 0, size2[0], size2[1], [10]); - } else if (shape == RenderShape.CIRCLE) { - ctx.arc(size2[0] * 0.5, size2[1] * 0.5, size2[0] * 0.5, 0, Math.PI * 2); - } - ctx.clip(); - } - this.drawNodeShape( - node22, - ctx, - size2, - color2, - bgcolor, - node22.selected - ); - if (!low_quality) { - node22.drawBadges(ctx); - } - ctx.shadowColor = "transparent"; - ctx.strokeStyle = LiteGraph.NODE_BOX_OUTLINE_COLOR; - node22.onDrawForeground?.(ctx, this, this.canvas); - ctx.textAlign = horizontal2 ? "center" : "left"; - ctx.font = this.inner_text_font; - const render_text = !low_quality; - const highlightColour = LiteGraph.NODE_TEXT_HIGHLIGHT_COLOR ?? LiteGraph.NODE_SELECTED_TITLE_COLOR ?? LiteGraph.NODE_TEXT_COLOR; - const out_slot = this.connecting_links?.[0]?.output; - const in_slot = this.connecting_links?.[0]?.input; - ctx.lineWidth = 1; - let max_y = 0; - const slot_pos = new Float32Array(2); - if (!node22.flags.collapsed) { - if (node22.inputs) { - for (let i2 = 0; i2 < node22.inputs.length; i2++) { - const slot = node22.inputs[i2]; - const slot_type = slot.type; - const isValid2 = !this.connecting_links || out_slot && LiteGraph.isValidConnection(slot.type, out_slot.type); - const highlight = isValid2 && node22.mouseOver?.inputId === i2; - const label_color = highlight ? highlightColour : LiteGraph.NODE_TEXT_COLOR; - ctx.globalAlpha = isValid2 ? editor_alpha : 0.4 * editor_alpha; - ctx.fillStyle = slot.link != null ? slot.color_on || this.default_connection_color_byType[slot_type] || this.default_connection_color.input_on : slot.color_off || this.default_connection_color_byTypeOff[slot_type] || this.default_connection_color_byType[slot_type] || this.default_connection_color.input_off; - const pos2 = node22.getConnectionPos(true, i2, slot_pos); - pos2[0] -= node22.pos[0]; - pos2[1] -= node22.pos[1]; - if (max_y < pos2[1] + LiteGraph.NODE_SLOT_HEIGHT * 0.5) { - max_y = pos2[1] + LiteGraph.NODE_SLOT_HEIGHT * 0.5; - } - drawSlot(ctx, slot, pos2, { - horizontal: horizontal2, - low_quality, - render_text, - label_color, - label_position: LabelPosition.Right, - // Input slot is not stroked. - do_stroke: false, - highlight - }); - } - } - ctx.textAlign = horizontal2 ? "center" : "right"; - ctx.strokeStyle = "black"; - if (node22.outputs) { - for (let i2 = 0; i2 < node22.outputs.length; i2++) { - const slot = node22.outputs[i2]; - const slot_type = slot.type; - const isValid2 = !this.connecting_links || in_slot && LiteGraph.isValidConnection(slot_type, in_slot.type); - const highlight = isValid2 && node22.mouseOver?.outputId === i2; - const label_color = highlight ? highlightColour : LiteGraph.NODE_TEXT_COLOR; - ctx.globalAlpha = isValid2 ? editor_alpha : 0.4 * editor_alpha; - const pos2 = node22.getConnectionPos(false, i2, slot_pos); - pos2[0] -= node22.pos[0]; - pos2[1] -= node22.pos[1]; - if (max_y < pos2[1] + LiteGraph.NODE_SLOT_HEIGHT * 0.5) { - max_y = pos2[1] + LiteGraph.NODE_SLOT_HEIGHT * 0.5; - } - ctx.fillStyle = slot.links && slot.links.length ? slot.color_on || this.default_connection_color_byType[slot_type] || this.default_connection_color.output_on : slot.color_off || this.default_connection_color_byTypeOff[slot_type] || this.default_connection_color_byType[slot_type] || this.default_connection_color.output_off; - drawSlot(ctx, slot, pos2, { - horizontal: horizontal2, - low_quality, - render_text, - label_color, - label_position: LabelPosition.Left, - do_stroke: true, - highlight - }); - } - } - ctx.textAlign = "left"; - ctx.globalAlpha = 1; - if (node22.widgets) { - let widgets_y = max_y; - if (horizontal2 || node22.widgets_up) { - widgets_y = 2; - } - if (node22.widgets_start_y != null) widgets_y = node22.widgets_start_y; - this.drawNodeWidgets( - node22, - widgets_y, - ctx, - this.node_widget && this.node_widget[0] == node22 ? this.node_widget[1] : null - ); - } - } else if (this.render_collapsed_slots) { - let input_slot = null; - let output_slot = null; - let slot; - if (node22.inputs) { - for (let i2 = 0; i2 < node22.inputs.length; i2++) { - slot = node22.inputs[i2]; - if (slot.link == null) { - continue; - } - input_slot = slot; - break; - } - } - if (node22.outputs) { - for (let i2 = 0; i2 < node22.outputs.length; i2++) { - slot = node22.outputs[i2]; - if (!slot.links || !slot.links.length) { - continue; - } - output_slot = slot; - } - } - if (input_slot) { - let x2 = 0; - let y2 = LiteGraph.NODE_TITLE_HEIGHT * -0.5; - if (horizontal2) { - x2 = node22._collapsed_width * 0.5; - y2 = -LiteGraph.NODE_TITLE_HEIGHT; - } - ctx.fillStyle = "#686"; - ctx.beginPath(); - if (slot.type === LiteGraph.EVENT || slot.shape === RenderShape.BOX) { - ctx.rect(x2 - 7 + 0.5, y2 - 4, 14, 8); - } else if (slot.shape === RenderShape.ARROW) { - ctx.moveTo(x2 + 8, y2); - ctx.lineTo(x2 + -4, y2 - 4); - ctx.lineTo(x2 + -4, y2 + 4); - ctx.closePath(); - } else { - ctx.arc(x2, y2, 4, 0, Math.PI * 2); - } - ctx.fill(); - } - if (output_slot) { - let x2 = node22._collapsed_width; - let y2 = LiteGraph.NODE_TITLE_HEIGHT * -0.5; - if (horizontal2) { - x2 = node22._collapsed_width * 0.5; - y2 = 0; - } - ctx.fillStyle = "#686"; - ctx.strokeStyle = "black"; - ctx.beginPath(); - if (slot.type === LiteGraph.EVENT || slot.shape === RenderShape.BOX) { - ctx.rect(x2 - 7 + 0.5, y2 - 4, 14, 8); - } else if (slot.shape === RenderShape.ARROW) { - ctx.moveTo(x2 + 6, y2); - ctx.lineTo(x2 - 6, y2 - 4); - ctx.lineTo(x2 - 6, y2 + 4); - ctx.closePath(); - } else { - ctx.arc(x2, y2, 4, 0, Math.PI * 2); - } - ctx.fill(); - } - } - if (node22.clip_area) { - ctx.restore(); - } - ctx.globalAlpha = 1; - } - /** - * Draws the link mouseover effect and tooltip. - * @param ctx Canvas 2D context to draw on - * @param link The link to render the mouseover effect for - * @remarks - * Called against {@link LGraphCanvas.over_link_center}. - * @todo Split tooltip from hover, so it can be drawn / eased separately - */ - drawLinkTooltip(ctx, link2) { - const pos2 = link2._pos; - ctx.fillStyle = "black"; - ctx.beginPath(); - if (this.linkMarkerShape === LinkMarkerShape.Arrow) { - const transform2 = ctx.getTransform(); - ctx.translate(pos2[0], pos2[1]); - if (Number.isFinite(link2._centreAngle)) ctx.rotate(link2._centreAngle); - ctx.moveTo(-2, -3); - ctx.lineTo(4, 0); - ctx.lineTo(-2, 3); - ctx.setTransform(transform2); - } else if (this.linkMarkerShape == null || this.linkMarkerShape === LinkMarkerShape.Circle) { - ctx.arc(pos2[0], pos2[1], 3, 0, Math.PI * 2); - } - ctx.fill(); - const data24 = link2.data; - if (data24 == null) return; - if (this.onDrawLinkTooltip?.(ctx, link2, this) == true) return; - let text2 = null; - if (typeof data24 === "number") - text2 = data24.toFixed(2); - else if (typeof data24 === "string") - text2 = '"' + data24 + '"'; - else if (typeof data24 === "boolean") - text2 = String(data24); - else if (data24.toToolTip) - text2 = data24.toToolTip(); - else - text2 = "[" + data24.constructor.name + "]"; - if (text2 == null) return; - text2 = text2.substring(0, 30); - ctx.font = "14px Courier New"; - const info = ctx.measureText(text2); - const w = info.width + 20; - const h2 = 24; - ctx.shadowColor = "black"; - ctx.shadowOffsetX = 2; - ctx.shadowOffsetY = 2; - ctx.shadowBlur = 3; - ctx.fillStyle = "#454"; - ctx.beginPath(); - ctx.roundRect(pos2[0] - w * 0.5, pos2[1] - 15 - h2, w, h2, [3]); - ctx.moveTo(pos2[0] - 10, pos2[1] - 15); - ctx.lineTo(pos2[0] + 10, pos2[1] - 15); - ctx.lineTo(pos2[0], pos2[1] - 5); - ctx.fill(); - ctx.shadowColor = "transparent"; - ctx.textAlign = "center"; - ctx.fillStyle = "#CEC"; - ctx.fillText(text2, pos2[0], pos2[1] - 15 - h2 * 0.3); - } - /** - * Draws the shape of the given node on the canvas - * @param node The node to draw - * @param ctx 2D canvas rendering context used to draw - * @param size Size of the background to draw, in graph units. Differs from node size if collapsed, etc. - * @param fgcolor Foreground colour - used for text - * @param bgcolor Background colour of the node - * @param selected Whether to render the node as selected. Likely to be removed in future, as current usage is simply the selected property of the node. - */ - drawNodeShape(node22, ctx, size2, fgcolor, bgcolor, selected2) { - ctx.strokeStyle = fgcolor; - ctx.fillStyle = LiteGraph.use_legacy_node_error_indicator ? "#F00" : bgcolor; - const title_height = LiteGraph.NODE_TITLE_HEIGHT; - const low_quality = this.ds.scale < 0.5; - const { collapsed } = node22.flags; - const shape = node22._shape || node22.constructor.shape || LiteGraph.NODE_DEFAULT_SHAPE; - const { title_mode } = node22.constructor; - const render_title = title_mode == TitleMode.TRANSPARENT_TITLE || title_mode == TitleMode.NO_TITLE ? false : true; - const area = LGraphCanvas.#tmp_area; - node22.measure(area); - area[0] -= node22.pos[0]; - area[1] -= node22.pos[1]; - const old_alpha = ctx.globalAlpha; - ctx.beginPath(); - if (shape == RenderShape.BOX || low_quality) { - ctx.fillRect(area[0], area[1], area[2], area[3]); - } else if (shape == RenderShape.ROUND || shape == RenderShape.CARD) { - ctx.roundRect( - area[0], - area[1], - area[2], - area[3], - shape == RenderShape.CARD ? [this.round_radius, this.round_radius, 0, 0] : [this.round_radius] - ); - } else if (shape == RenderShape.CIRCLE) { - ctx.arc(size2[0] * 0.5, size2[1] * 0.5, size2[0] * 0.5, 0, Math.PI * 2); - } - ctx.fill(); - if (node22.has_errors && !LiteGraph.use_legacy_node_error_indicator) { - this.strokeShape(ctx, area, { - shape, - title_mode, - title_height, - padding: 12, - colour: LiteGraph.NODE_ERROR_COLOUR, - collapsed, - thickness: 10 - }); - } - if (!collapsed && render_title) { - ctx.shadowColor = "transparent"; - ctx.fillStyle = "rgba(0,0,0,0.2)"; - ctx.fillRect(0, -1, area[2], 2); - } - ctx.shadowColor = "transparent"; - node22.onDrawBackground?.(ctx, this, this.canvas, this.graph_mouse); - if (render_title || title_mode == TitleMode.TRANSPARENT_TITLE) { - if (node22.onDrawTitleBar) { - node22.onDrawTitleBar(ctx, title_height, size2, this.ds.scale, fgcolor); - } else if (title_mode != TitleMode.TRANSPARENT_TITLE && (node22.constructor.title_color || this.render_title_colored)) { - const title_color = node22.constructor.title_color || fgcolor; - if (collapsed) { - ctx.shadowColor = LiteGraph.DEFAULT_SHADOW_COLOR; - } - ctx.fillStyle = title_color; - ctx.beginPath(); - if (shape == RenderShape.BOX || low_quality) { - ctx.rect(0, -title_height, size2[0], title_height); - } else if (shape == RenderShape.ROUND || shape == RenderShape.CARD) { - ctx.roundRect( - 0, - -title_height, - size2[0], - title_height, - collapsed ? [this.round_radius] : [this.round_radius, this.round_radius, 0, 0] - ); - } - ctx.fill(); - ctx.shadowColor = "transparent"; - } - let colState = LiteGraph.node_box_coloured_by_mode && LiteGraph.NODE_MODES_COLORS[node22.mode] ? LiteGraph.NODE_MODES_COLORS[node22.mode] : false; - if (LiteGraph.node_box_coloured_when_on) { - colState = node22.action_triggered ? "#FFF" : node22.execute_triggered ? "#AAA" : colState; - } - const box_size = 10; - if (node22.onDrawTitleBox) { - node22.onDrawTitleBox(ctx, title_height, size2, this.ds.scale); - } else if (shape == RenderShape.ROUND || shape == RenderShape.CIRCLE || shape == RenderShape.CARD) { - if (low_quality) { - ctx.fillStyle = "black"; - ctx.beginPath(); - ctx.arc( - title_height * 0.5, - title_height * -0.5, - box_size * 0.5 + 1, - 0, - Math.PI * 2 - ); - ctx.fill(); - } - ctx.fillStyle = node22.boxcolor || colState || LiteGraph.NODE_DEFAULT_BOXCOLOR; - if (low_quality) - ctx.fillRect( - title_height * 0.5 - box_size * 0.5, - title_height * -0.5 - box_size * 0.5, - box_size, - box_size - ); - else { - ctx.beginPath(); - ctx.arc( - title_height * 0.5, - title_height * -0.5, - box_size * 0.5, - 0, - Math.PI * 2 - ); - ctx.fill(); - } - } else { - if (low_quality) { - ctx.fillStyle = "black"; - ctx.fillRect( - (title_height - box_size) * 0.5 - 1, - (title_height + box_size) * -0.5 - 1, - box_size + 2, - box_size + 2 - ); - } - ctx.fillStyle = node22.boxcolor || colState || LiteGraph.NODE_DEFAULT_BOXCOLOR; - ctx.fillRect( - (title_height - box_size) * 0.5, - (title_height + box_size) * -0.5, - box_size, - box_size - ); - } - ctx.globalAlpha = old_alpha; - if (node22.onDrawTitleText) { - node22.onDrawTitleText( - ctx, - title_height, - size2, - this.ds.scale, - this.title_text_font, - selected2 - ); - } - if (!low_quality) { - ctx.font = this.title_text_font; - const rawTitle = node22.getTitle() ?? `❌ ${node22.type}`; - const title = String(rawTitle) + (node22.pinned ? "📌" : ""); - if (title) { - if (selected2) { - ctx.fillStyle = LiteGraph.NODE_SELECTED_TITLE_COLOR; - } else { - ctx.fillStyle = node22.constructor.title_text_color || this.node_title_color; - } - if (collapsed) { - ctx.textAlign = "left"; - ctx.fillText( - title.substr(0, 20), - // avoid urls too long - title_height, - // + measure.width * 0.5, - LiteGraph.NODE_TITLE_TEXT_Y - title_height - ); - ctx.textAlign = "left"; - } else { - ctx.textAlign = "left"; - ctx.fillText( - title, - title_height, - LiteGraph.NODE_TITLE_TEXT_Y - title_height - ); - } - } - } - if (!collapsed && node22.subgraph && !node22.skip_subgraph_button) { - const w = LiteGraph.NODE_TITLE_HEIGHT; - const x2 = node22.size[0] - w; - const over = LiteGraph.isInsideRectangle( - this.graph_mouse[0] - node22.pos[0], - this.graph_mouse[1] - node22.pos[1], - x2 + 2, - -w + 2, - w - 4, - w - 4 - ); - ctx.fillStyle = over ? "#888" : "#555"; - if (shape == RenderShape.BOX || low_quality) { - ctx.fillRect(x2 + 2, -w + 2, w - 4, w - 4); - } else { - ctx.beginPath(); - ctx.roundRect(x2 + 2, -w + 2, w - 4, w - 4, [4]); - ctx.fill(); - } - ctx.fillStyle = "#333"; - ctx.beginPath(); - ctx.moveTo(x2 + w * 0.2, -w * 0.6); - ctx.lineTo(x2 + w * 0.8, -w * 0.6); - ctx.lineTo(x2 + w * 0.5, -w * 0.3); - ctx.fill(); - } - node22.onDrawTitle?.(ctx); - } - if (selected2) { - node22.onBounding?.(area); - const padding = node22.has_errors && !LiteGraph.use_legacy_node_error_indicator ? 20 : void 0; - this.strokeShape(ctx, area, { - shape, - title_height, - title_mode, - padding, - collapsed: node22.flags?.collapsed - }); - } - if (node22.execute_triggered > 0) node22.execute_triggered--; - if (node22.action_triggered > 0) node22.action_triggered--; - } - /** - * Draws only the path of a shape on the canvas, without filling. - * Used to draw indicators for node status, e.g. "selected". - * @param ctx The 2D context to draw on - * @param area The position and size of the shape to render - */ - strokeShape(ctx, area, { - /** The shape to render */ - shape = RenderShape.BOX, - /** Shape will extend above the Y-axis 0 by this amount */ - title_height = LiteGraph.NODE_TITLE_HEIGHT, - /** @deprecated This is node-specific: it should be removed entirely, and behaviour defined by the caller more explicitly */ - title_mode = TitleMode.NORMAL_TITLE, - /** The colour that should be drawn */ - colour = LiteGraph.NODE_BOX_OUTLINE_COLOR, - /** The distance between the edge of the {@link area} and the middle of the line */ - padding = 6, - /** @deprecated This is node-specific: it should be removed entirely, and behaviour defined by the caller more explicitly */ - collapsed = false, - /** Thickness of the line drawn (`lineWidth`) */ - thickness = 1 - } = {}) { - if (title_mode === TitleMode.TRANSPARENT_TITLE) { - area[1] -= title_height; - area[3] += title_height; - } - const { lineWidth, strokeStyle } = ctx; - ctx.lineWidth = thickness; - ctx.globalAlpha = 0.8; - ctx.strokeStyle = colour; - ctx.beginPath(); - const [x2, y2, width2, height] = area; - switch (shape) { - case RenderShape.BOX: { - ctx.rect( - x2 - padding, - y2 - padding, - width2 + 2 * padding, - height + 2 * padding - ); - break; - } - case RenderShape.ROUND: - case RenderShape.CARD: { - const radius = this.round_radius + padding; - const isCollapsed = shape === RenderShape.CARD && collapsed; - const cornerRadii = isCollapsed || shape === RenderShape.ROUND ? [radius] : [radius, 2, radius, 2]; - ctx.roundRect( - x2 - padding, - y2 - padding, - width2 + 2 * padding, - height + 2 * padding, - cornerRadii - ); - break; - } - case RenderShape.CIRCLE: { - const centerX = x2 + width2 / 2; - const centerY = y2 + height / 2; - const radius = Math.max(width2, height) / 2 + padding; - ctx.arc(centerX, centerY, radius, 0, Math.PI * 2); - break; - } - } - ctx.stroke(); - ctx.lineWidth = lineWidth; - ctx.strokeStyle = strokeStyle; - ctx.globalAlpha = 1; - } - /** - * Draws a snap guide for a {@link Positionable} item. - * - * Initial design was a simple white rectangle representing the location the - * item would land if dropped. - * @param ctx The 2D canvas context to draw on - * @param item The item to draw a snap guide for - * @param shape The shape of the snap guide to draw - * @todo Update to align snapping with boundingRect - * @todo Shapes - */ - drawSnapGuide(ctx, item3, shape = RenderShape.ROUND) { - const snapGuide = LGraphCanvas.#temp; - snapGuide.set(item3.boundingRect); - const { pos: pos2 } = item3; - const offsetX = pos2[0] - snapGuide[0]; - const offsetY = pos2[1] - snapGuide[1]; - snapGuide[0] += offsetX; - snapGuide[1] += offsetY; - snapPoint(snapGuide, this.#snapToGrid); - snapGuide[0] -= offsetX; - snapGuide[1] -= offsetY; - const { globalAlpha } = ctx; - ctx.globalAlpha = 1; - ctx.beginPath(); - const [x2, y2, w, h2] = snapGuide; - if (shape === RenderShape.CIRCLE) { - const midX = x2 + w * 0.5; - const midY = y2 + h2 * 0.5; - const radius = Math.min(w * 0.5, h2 * 0.5); - ctx.arc(midX, midY, radius, 0, Math.PI * 2); - } else { - ctx.rect(x2, y2, w, h2); - } - ctx.lineWidth = 0.5; - ctx.strokeStyle = "#FFFFFF66"; - ctx.fillStyle = "#FFFFFF22"; - ctx.fill(); - ctx.stroke(); - ctx.globalAlpha = globalAlpha; - } - drawConnections(ctx) { - const rendered = this.renderedPaths; - rendered.clear(); - if (this.links_render_mode === LinkRenderType.HIDDEN_LINK) return; - const visibleReroutes = []; - const now2 = LiteGraph.getTime(); - const visible_area = this.visible_area; - LGraphCanvas.#margin_area[0] = visible_area[0] - 20; - LGraphCanvas.#margin_area[1] = visible_area[1] - 20; - LGraphCanvas.#margin_area[2] = visible_area[2] + 40; - LGraphCanvas.#margin_area[3] = visible_area[3] + 40; - ctx.lineWidth = this.connections_width; - ctx.fillStyle = "#AAA"; - ctx.strokeStyle = "#AAA"; - ctx.globalAlpha = this.editor_alpha; - const nodes = this.graph._nodes; - for (let n = 0, l = nodes.length; n < l; ++n) { - const node22 = nodes[n]; - if (!node22.inputs || !node22.inputs.length) continue; - for (let i2 = 0; i2 < node22.inputs.length; ++i2) { - const input = node22.inputs[i2]; - if (!input || input.link == null) continue; - const link_id = input.link; - const link2 = this.graph._links.get(link_id); - if (!link2) continue; - const start_node = this.graph.getNodeById(link2.origin_id); - if (start_node == null) continue; - const outputId = link2.origin_slot; - const start_node_slotpos = outputId == -1 ? [start_node.pos[0] + 10, start_node.pos[1] + 10] : start_node.getConnectionPos(false, outputId, LGraphCanvas.#tempA); - const end_node_slotpos = node22.getConnectionPos(true, i2, LGraphCanvas.#tempB); - const reroutes = this.reroutesEnabled ? LLink.getReroutes(this.graph, link2) : []; - const points = [ - start_node_slotpos, - ...reroutes.map((x2) => x2.pos), - end_node_slotpos - ]; - const pointsX = points.map((x2) => x2[0]); - const pointsY = points.map((x2) => x2[1]); - LGraphCanvas.#link_bounding[0] = Math.min(...pointsX); - LGraphCanvas.#link_bounding[1] = Math.min(...pointsY); - LGraphCanvas.#link_bounding[2] = Math.max(...pointsX) - LGraphCanvas.#link_bounding[0]; - LGraphCanvas.#link_bounding[3] = Math.max(...pointsY) - LGraphCanvas.#link_bounding[1]; - if (!overlapBounding(LGraphCanvas.#link_bounding, LGraphCanvas.#margin_area)) - continue; - const start_slot = start_node.outputs[outputId]; - const end_slot = node22.inputs[i2]; - if (!start_slot || !end_slot) continue; - const start_dir = start_slot.dir || (start_node.horizontal ? LinkDirection.DOWN : LinkDirection.RIGHT); - const end_dir = end_slot.dir || (node22.horizontal ? LinkDirection.UP : LinkDirection.LEFT); - if (reroutes.length) { - let startControl; - const l2 = reroutes.length; - for (let j = 0; j < l2; j++) { - const reroute = reroutes[j]; - if (!rendered.has(reroute)) { - rendered.add(reroute); - visibleReroutes.push(reroute); - reroute._colour = link2.color || LGraphCanvas.link_type_colors[link2.type] || this.default_link_color; - const prevReroute = this.graph.reroutes.get(reroute.parentId); - const startPos = prevReroute?.pos ?? start_node_slotpos; - reroute.calculateAngle(this.last_draw_time, this.graph, startPos); - this.renderLink( - ctx, - startPos, - reroute.pos, - link2, - false, - 0, - null, - start_dir, - end_dir, - { - startControl, - endControl: reroute.controlPoint, - reroute - } - ); - } - const nextPos = reroutes[j + 1]?.pos ?? end_node_slotpos; - const dist3 = Math.min(80, distance(reroute.pos, nextPos) * 0.25); - startControl = [dist3 * reroute.cos, dist3 * reroute.sin]; - } - this.renderLink( - ctx, - points.at(-2), - points.at(-1), - link2, - false, - 0, - null, - start_dir, - end_dir, - { startControl } - ); - } else { - this.renderLink( - ctx, - start_node_slotpos, - end_node_slotpos, - link2, - false, - 0, - null, - start_dir, - end_dir - ); - } - rendered.add(link2); - if (link2 && link2._last_time && now2 - link2._last_time < 1e3) { - const f = 2 - (now2 - link2._last_time) * 2e-3; - const tmp = ctx.globalAlpha; - ctx.globalAlpha = tmp * f; - this.renderLink( - ctx, - start_node_slotpos, - end_node_slotpos, - link2, - true, - f, - "white", - start_dir, - end_dir - ); - ctx.globalAlpha = tmp; - } - } - } - for (const reroute of visibleReroutes) { - if (this.#snapToGrid && this.isDragging && this.selectedItems.has(reroute)) - this.drawSnapGuide(ctx, reroute, RenderShape.CIRCLE); - reroute.draw(ctx); - } - ctx.globalAlpha = 1; - } - /** - * draws a link between two points - * @param ctx Canvas 2D rendering context - * @param a start pos - * @param b end pos - * @param link the link object with all the link info - * @param skip_border ignore the shadow of the link - * @param flow show flow animation (for events) - * @param color the color for the link - * @param start_dir the direction enum - * @param end_dir the direction enum - */ - renderLink(ctx, a, b, link2, skip_border, flow, color2, start_dir, end_dir, { - startControl, - endControl, - reroute, - num_sublines = 1 - } = {}) { - if (link2) this.visible_links.push(link2); - const linkColour = link2 != null && this.highlighted_links[link2.id] ? "#FFF" : color2 || link2?.color || LGraphCanvas.link_type_colors[link2.type] || this.default_link_color; - const startDir = start_dir || LinkDirection.RIGHT; - const endDir = end_dir || LinkDirection.LEFT; - const dist3 = this.links_render_mode == LinkRenderType.SPLINE_LINK && (!endControl || !startControl) ? distance(a, b) : null; - if (this.render_connections_border && this.ds.scale > 0.6) { - ctx.lineWidth = this.connections_width + 4; - } - ctx.lineJoin = "round"; - num_sublines ||= 1; - if (num_sublines > 1) ctx.lineWidth = 0.5; - const path = new Path2D(); - const linkSegment = reroute ?? link2; - if (linkSegment) linkSegment.path = path; - const innerA = LGraphCanvas.#lTempA; - const innerB = LGraphCanvas.#lTempB; - const pos2 = linkSegment?._pos ?? [0, 0]; - for (let i2 = 0; i2 < num_sublines; i2 += 1) { - const offsety = (i2 - (num_sublines - 1) * 0.5) * 5; - innerA[0] = a[0]; - innerA[1] = a[1]; - innerB[0] = b[0]; - innerB[1] = b[1]; - if (this.links_render_mode == LinkRenderType.SPLINE_LINK) { - if (endControl) { - innerB[0] = b[0] + endControl[0]; - innerB[1] = b[1] + endControl[1]; - } else { - this.#addSplineOffset(innerB, endDir, dist3); - } - if (startControl) { - innerA[0] = a[0] + startControl[0]; - innerA[1] = a[1] + startControl[1]; - } else { - this.#addSplineOffset(innerA, startDir, dist3); - } - path.moveTo(a[0], a[1] + offsety); - path.bezierCurveTo( - innerA[0], - innerA[1] + offsety, - innerB[0], - innerB[1] + offsety, - b[0], - b[1] + offsety - ); - findPointOnCurve(pos2, a, b, innerA, innerB, 0.5); - if (linkSegment && this.linkMarkerShape === LinkMarkerShape.Arrow) { - const justPastCentre = LGraphCanvas.#lTempC; - findPointOnCurve(justPastCentre, a, b, innerA, innerB, 0.51); - linkSegment._centreAngle = Math.atan2( - justPastCentre[1] - pos2[1], - justPastCentre[0] - pos2[0] - ); - } - } else if (this.links_render_mode == LinkRenderType.LINEAR_LINK) { - const l = 15; - switch (startDir) { - case LinkDirection.LEFT: - innerA[0] += -l; - break; - case LinkDirection.RIGHT: - innerA[0] += l; - break; - case LinkDirection.UP: - innerA[1] += -l; - break; - case LinkDirection.DOWN: - innerA[1] += l; - break; - } - switch (endDir) { - case LinkDirection.LEFT: - innerB[0] += -l; - break; - case LinkDirection.RIGHT: - innerB[0] += l; - break; - case LinkDirection.UP: - innerB[1] += -l; - break; - case LinkDirection.DOWN: - innerB[1] += l; - break; - } - path.moveTo(a[0], a[1] + offsety); - path.lineTo(innerA[0], innerA[1] + offsety); - path.lineTo(innerB[0], innerB[1] + offsety); - path.lineTo(b[0], b[1] + offsety); - pos2[0] = (innerA[0] + innerB[0]) * 0.5; - pos2[1] = (innerA[1] + innerB[1]) * 0.5; - if (linkSegment && this.linkMarkerShape === LinkMarkerShape.Arrow) { - linkSegment._centreAngle = Math.atan2( - innerB[1] - innerA[1], - innerB[0] - innerA[0] - ); - } - } else if (this.links_render_mode == LinkRenderType.STRAIGHT_LINK) { - if (startDir == LinkDirection.RIGHT) { - innerA[0] += 10; - } else { - innerA[1] += 10; - } - if (endDir == LinkDirection.LEFT) { - innerB[0] -= 10; - } else { - innerB[1] -= 10; - } - const midX = (innerA[0] + innerB[0]) * 0.5; - path.moveTo(a[0], a[1]); - path.lineTo(innerA[0], innerA[1]); - path.lineTo(midX, innerA[1]); - path.lineTo(midX, innerB[1]); - path.lineTo(innerB[0], innerB[1]); - path.lineTo(b[0], b[1]); - pos2[0] = midX; - pos2[1] = (innerA[1] + innerB[1]) * 0.5; - if (linkSegment && this.linkMarkerShape === LinkMarkerShape.Arrow) { - const diff2 = innerB[1] - innerA[1]; - if (Math.abs(diff2) < 4) linkSegment._centreAngle = 0; - else if (diff2 > 0) linkSegment._centreAngle = Math.PI * 0.5; - else linkSegment._centreAngle = -(Math.PI * 0.5); - } - } else { - return; - } - } - if (this.render_connections_border && this.ds.scale > 0.6 && !skip_border) { - ctx.strokeStyle = "rgba(0,0,0,0.5)"; - ctx.stroke(path); - } - ctx.lineWidth = this.connections_width; - ctx.fillStyle = ctx.strokeStyle = linkColour; - ctx.stroke(path); - if (this.ds.scale >= 0.6 && this.highquality_render && linkSegment && // TODO: Re-assess this usage - likely a workaround that linkSegment truthy check resolves - endDir != LinkDirection.CENTER) { - if (this.render_connection_arrows) { - const posA = this.computeConnectionPoint(a, b, 0.25, startDir, endDir); - const posB = this.computeConnectionPoint(a, b, 0.26, startDir, endDir); - const posC = this.computeConnectionPoint(a, b, 0.75, startDir, endDir); - const posD = this.computeConnectionPoint(a, b, 0.76, startDir, endDir); - let angleA = 0; - let angleB = 0; - if (this.render_curved_connections) { - angleA = -Math.atan2(posB[0] - posA[0], posB[1] - posA[1]); - angleB = -Math.atan2(posD[0] - posC[0], posD[1] - posC[1]); - } else { - angleB = angleA = b[1] > a[1] ? 0 : Math.PI; - } - const transform2 = ctx.getTransform(); - ctx.translate(posA[0], posA[1]); - ctx.rotate(angleA); - ctx.beginPath(); - ctx.moveTo(-5, -3); - ctx.lineTo(0, 7); - ctx.lineTo(5, -3); - ctx.fill(); - ctx.setTransform(transform2); - ctx.translate(posC[0], posC[1]); - ctx.rotate(angleB); - ctx.beginPath(); - ctx.moveTo(-5, -3); - ctx.lineTo(0, 7); - ctx.lineTo(5, -3); - ctx.fill(); - ctx.setTransform(transform2); - } - ctx.beginPath(); - if (this.linkMarkerShape === LinkMarkerShape.Arrow) { - const transform2 = ctx.getTransform(); - ctx.translate(pos2[0], pos2[1]); - ctx.rotate(linkSegment._centreAngle); - ctx.moveTo(-3.2, -5); - ctx.lineTo(7, 0); - ctx.lineTo(-3.2, 5); - ctx.fill(); - ctx.setTransform(transform2); - } else if (this.linkMarkerShape == null || this.linkMarkerShape === LinkMarkerShape.Circle) { - ctx.arc(pos2[0], pos2[1], 5, 0, Math.PI * 2); - } - ctx.fill(); - } - if (flow) { - ctx.fillStyle = linkColour; - for (let i2 = 0; i2 < 5; ++i2) { - const f = (LiteGraph.getTime() * 1e-3 + i2 * 0.2) % 1; - const flowPos = this.computeConnectionPoint(a, b, f, startDir, endDir); - ctx.beginPath(); - ctx.arc(flowPos[0], flowPos[1], 5, 0, 2 * Math.PI); - ctx.fill(); - } - } - } - /** - * Finds a point along a spline represented by a to b, with spline endpoint directions dictacted by start_dir and end_dir. - * @param a Start point - * @param b End point - * @param t Time: distance between points (e.g 0.25 is 25% along the line) - * @param start_dir Spline start direction - * @param end_dir Spline end direction - * @returns The point at {@link t} distance along the spline a-b. - */ - computeConnectionPoint(a, b, t2, start_dir, end_dir) { - start_dir ||= LinkDirection.RIGHT; - end_dir ||= LinkDirection.LEFT; - const dist3 = distance(a, b); - const pa = [a[0], a[1]]; - const pb = [b[0], b[1]]; - this.#addSplineOffset(pa, start_dir, dist3); - this.#addSplineOffset(pb, end_dir, dist3); - const c1 = (1 - t2) * (1 - t2) * (1 - t2); - const c2 = 3 * ((1 - t2) * (1 - t2)) * t2; - const c3 = 3 * (1 - t2) * (t2 * t2); - const c4 = t2 * t2 * t2; - const x2 = c1 * a[0] + c2 * pa[0] + c3 * pb[0] + c4 * b[0]; - const y2 = c1 * a[1] + c2 * pa[1] + c3 * pb[1] + c4 * b[1]; - return [x2, y2]; - } - /** - * Modifies an existing point, adding a single-axis offset. - * @param point The point to add the offset to - * @param direction The direction to add the offset in - * @param dist Distance to offset - * @param factor Distance is mulitplied by this value. Default: 0.25 - */ - #addSplineOffset(point, direction, dist3, factor = 0.25) { - switch (direction) { - case LinkDirection.LEFT: - point[0] += dist3 * -factor; - break; - case LinkDirection.RIGHT: - point[0] += dist3 * factor; - break; - case LinkDirection.UP: - point[1] += dist3 * -factor; - break; - case LinkDirection.DOWN: - point[1] += dist3 * factor; - break; - } - } - drawExecutionOrder(ctx) { - ctx.shadowColor = "transparent"; - ctx.globalAlpha = 0.25; - ctx.textAlign = "center"; - ctx.strokeStyle = "white"; - ctx.globalAlpha = 0.75; - const visible_nodes = this.visible_nodes; - for (let i2 = 0; i2 < visible_nodes.length; ++i2) { - const node22 = visible_nodes[i2]; - ctx.fillStyle = "black"; - ctx.fillRect( - node22.pos[0] - LiteGraph.NODE_TITLE_HEIGHT, - node22.pos[1] - LiteGraph.NODE_TITLE_HEIGHT, - LiteGraph.NODE_TITLE_HEIGHT, - LiteGraph.NODE_TITLE_HEIGHT - ); - if (node22.order == 0) { - ctx.strokeRect( - node22.pos[0] - LiteGraph.NODE_TITLE_HEIGHT + 0.5, - node22.pos[1] - LiteGraph.NODE_TITLE_HEIGHT + 0.5, - LiteGraph.NODE_TITLE_HEIGHT, - LiteGraph.NODE_TITLE_HEIGHT - ); - } - ctx.fillStyle = "#FFF"; - ctx.fillText( - stringOrEmpty(node22.order), - node22.pos[0] + LiteGraph.NODE_TITLE_HEIGHT * -0.5, - node22.pos[1] - 6 - ); - } - ctx.globalAlpha = 1; - } - /** - * draws the widgets stored inside a node - */ - drawNodeWidgets(node22, posY, ctx, active_widget) { - if (!node22.widgets || !node22.widgets.length) return 0; - const width2 = node22.size[0]; - const widgets = node22.widgets; - posY += 2; - const H = LiteGraph.NODE_WIDGET_HEIGHT; - const show_text = this.ds.scale > 0.5; - ctx.save(); - ctx.globalAlpha = this.editor_alpha; - const background_color = LiteGraph.WIDGET_BGCOLOR; - const text_color = LiteGraph.WIDGET_TEXT_COLOR; - const secondary_text_color = LiteGraph.WIDGET_SECONDARY_TEXT_COLOR; - const margin = 15; - for (let i2 = 0; i2 < widgets.length; ++i2) { - const w = widgets[i2]; - if (w.hidden || w.advanced && !node22.showAdvanced) continue; - const y2 = w.y || posY; - const outline_color = w.advanced ? LiteGraph.WIDGET_ADVANCED_OUTLINE_COLOR : LiteGraph.WIDGET_OUTLINE_COLOR; - if (w === this.link_over_widget) { - ctx.fillStyle = this.default_connection_color_byType[this.link_over_widget_type] || this.default_connection_color.input_on; - drawSlot(ctx, {}, [10, y2 + 10], {}); - } - w.last_y = y2; - ctx.strokeStyle = outline_color; - ctx.fillStyle = "#222"; - ctx.textAlign = "left"; - if (w.disabled) ctx.globalAlpha *= 0.5; - const widget_width = w.width || width2; - switch (w.type) { - case "button": - ctx.fillStyle = background_color; - if (w.clicked) { - ctx.fillStyle = "#AAA"; - w.clicked = false; - this.dirty_canvas = true; - } - ctx.fillRect(margin, y2, widget_width - margin * 2, H); - if (show_text && !w.disabled) - ctx.strokeRect(margin, y2, widget_width - margin * 2, H); - if (show_text) { - ctx.textAlign = "center"; - ctx.fillStyle = text_color; - ctx.fillText(w.label || w.name, widget_width * 0.5, y2 + H * 0.7); - } - break; - case "toggle": - ctx.textAlign = "left"; - ctx.strokeStyle = outline_color; - ctx.fillStyle = background_color; - ctx.beginPath(); - if (show_text) - ctx.roundRect(margin, y2, widget_width - margin * 2, H, [H * 0.5]); - else ctx.rect(margin, y2, widget_width - margin * 2, H); - ctx.fill(); - if (show_text && !w.disabled) ctx.stroke(); - ctx.fillStyle = w.value ? "#89A" : "#333"; - ctx.beginPath(); - ctx.arc( - widget_width - margin * 2, - y2 + H * 0.5, - H * 0.36, - 0, - Math.PI * 2 - ); - ctx.fill(); - if (show_text) { - ctx.fillStyle = secondary_text_color; - const label5 = w.label || w.name; - if (label5 != null) { - ctx.fillText(label5, margin * 2, y2 + H * 0.7); - } - ctx.fillStyle = w.value ? text_color : secondary_text_color; - ctx.textAlign = "right"; - ctx.fillText( - w.value ? w.options.on || "true" : w.options.off || "false", - widget_width - 40, - y2 + H * 0.7 - ); - } - break; - case "slider": { - ctx.fillStyle = background_color; - ctx.fillRect(margin, y2, widget_width - margin * 2, H); - const range2 = w.options.max - w.options.min; - let nvalue = (w.value - w.options.min) / range2; - if (nvalue < 0) nvalue = 0; - if (nvalue > 1) nvalue = 1; - ctx.fillStyle = w.options.hasOwnProperty("slider_color") ? w.options.slider_color : active_widget == w ? "#89A" : "#678"; - ctx.fillRect(margin, y2, nvalue * (widget_width - margin * 2), H); - if (show_text && !w.disabled) - ctx.strokeRect(margin, y2, widget_width - margin * 2, H); - if (w.marker) { - let marker_nvalue = (w.marker - w.options.min) / range2; - if (marker_nvalue < 0) marker_nvalue = 0; - if (marker_nvalue > 1) marker_nvalue = 1; - ctx.fillStyle = w.options.hasOwnProperty("marker_color") ? w.options.marker_color : "#AA9"; - ctx.fillRect( - margin + marker_nvalue * (widget_width - margin * 2), - y2, - 2, - H - ); - } - if (show_text) { - ctx.textAlign = "center"; - ctx.fillStyle = text_color; - ctx.fillText( - (w.label || w.name) + " " + Number(w.value).toFixed( - w.options.precision != null ? w.options.precision : 3 - ), - widget_width * 0.5, - y2 + H * 0.7 - ); - } - break; - } - case "number": - case "combo": - ctx.textAlign = "left"; - ctx.strokeStyle = outline_color; - ctx.fillStyle = background_color; - ctx.beginPath(); - if (show_text) - ctx.roundRect(margin, y2, widget_width - margin * 2, H, [H * 0.5]); - else ctx.rect(margin, y2, widget_width - margin * 2, H); - ctx.fill(); - if (show_text) { - if (!w.disabled) ctx.stroke(); - ctx.fillStyle = text_color; - if (!w.disabled) { - ctx.beginPath(); - ctx.moveTo(margin + 16, y2 + 5); - ctx.lineTo(margin + 6, y2 + H * 0.5); - ctx.lineTo(margin + 16, y2 + H - 5); - ctx.fill(); - ctx.beginPath(); - ctx.moveTo(widget_width - margin - 16, y2 + 5); - ctx.lineTo(widget_width - margin - 6, y2 + H * 0.5); - ctx.lineTo(widget_width - margin - 16, y2 + H - 5); - ctx.fill(); - } - ctx.fillStyle = secondary_text_color; - ctx.fillText(w.label || w.name, margin * 2 + 5, y2 + H * 0.7); - ctx.fillStyle = text_color; - ctx.textAlign = "right"; - if (w.type == "number") { - ctx.fillText( - Number(w.value).toFixed( - w.options.precision !== void 0 ? w.options.precision : 3 - ), - widget_width - margin * 2 - 20, - y2 + H * 0.7 - ); - } else { - let v2 = typeof w.value === "number" ? String(w.value) : w.value; - if (w.options.values) { - let values = w.options.values; - if (typeof values === "function") - values = values(); - if (values && !Array.isArray(values)) - v2 = values[w.value]; - } - const labelWidth = ctx.measureText(w.label || w.name).width + margin * 2; - const inputWidth = widget_width - margin * 4; - const availableWidth = inputWidth - labelWidth; - const textWidth = ctx.measureText(v2).width; - if (textWidth > availableWidth) { - const ELLIPSIS = "…"; - const ellipsisWidth = ctx.measureText(ELLIPSIS).width; - const charWidthAvg = ctx.measureText("a").width; - if (availableWidth <= ellipsisWidth) { - v2 = "․"; - } else { - v2 = `${v2}`; - const overflowWidth = textWidth + ellipsisWidth - availableWidth; - if (overflowWidth + charWidthAvg * 3 > availableWidth) { - const preciseRange = availableWidth + charWidthAvg * 3; - const preTruncateCt = Math.floor((preciseRange - ellipsisWidth) / charWidthAvg); - v2 = v2.substr(0, preTruncateCt); - } - while (ctx.measureText(v2).width + ellipsisWidth > availableWidth) { - v2 = v2.substr(0, v2.length - 1); - } - v2 += ELLIPSIS; - } - } - ctx.fillText( - v2, - widget_width - margin * 2 - 20, - y2 + H * 0.7 - ); - } - } - break; - case "string": - case "text": - ctx.textAlign = "left"; - ctx.strokeStyle = outline_color; - ctx.fillStyle = background_color; - ctx.beginPath(); - if (show_text) - ctx.roundRect(margin, y2, widget_width - margin * 2, H, [H * 0.5]); - else - ctx.rect(margin, y2, widget_width - margin * 2, H); - ctx.fill(); - if (show_text) { - if (!w.disabled) ctx.stroke(); - ctx.save(); - ctx.beginPath(); - ctx.rect(margin, y2, widget_width - margin * 2, H); - ctx.clip(); - ctx.fillStyle = secondary_text_color; - const label5 = w.label || w.name; - if (label5 != null) ctx.fillText(label5, margin * 2, y2 + H * 0.7); - ctx.fillStyle = text_color; - ctx.textAlign = "right"; - ctx.fillText( - String(w.value).substr(0, 30), - widget_width - margin * 2, - y2 + H * 0.7 - ); - ctx.restore(); - } - break; - default: - w.draw?.(ctx, node22, widget_width, y2, H); - break; - } - posY += (w.computeSize ? w.computeSize(widget_width)[1] : H) + 4; - ctx.globalAlpha = this.editor_alpha; - } - ctx.restore(); - ctx.textAlign = "left"; - } - /** - * draws every group area in the background - */ - drawGroups(canvas, ctx) { - if (!this.graph) return; - const groups = this.graph._groups; - ctx.save(); - ctx.globalAlpha = 0.5 * this.editor_alpha; - const drawSnapGuides = this.#snapToGrid && this.isDragging; - for (let i2 = 0; i2 < groups.length; ++i2) { - const group = groups[i2]; - if (!overlapBounding(this.visible_area, group._bounding)) { - continue; - } - if (drawSnapGuides && this.selectedItems.has(group)) - this.drawSnapGuide(ctx, group); - group.draw(this, ctx); - } - ctx.restore(); - } - adjustNodesSize() { - const nodes = this.graph._nodes; - for (let i2 = 0; i2 < nodes.length; ++i2) { - nodes[i2].size = nodes[i2].computeSize(); - } - this.setDirty(true, true); - } - /** - * resizes the canvas to a given size, if no size is passed, then it tries to fill the parentNode - * @todo Remove or rewrite - */ - resize(width2, height) { - if (!width2 && !height) { - const parent = this.canvas.parentElement; - width2 = parent.offsetWidth; - height = parent.offsetHeight; - } - if (this.canvas.width == width2 && this.canvas.height == height) return; - this.canvas.width = width2; - this.canvas.height = height; - this.bgcanvas.width = this.canvas.width; - this.bgcanvas.height = this.canvas.height; - this.setDirty(true, true); - } - onNodeSelectionChange() { - } - /** - * Determines the furthest nodes in each direction for the currently selected nodes - */ - boundaryNodesForSelection() { - return LGraphCanvas.getBoundaryNodes(this.selected_nodes); - } - showLinkMenu(segment, e2) { - const { graph } = this; - const node_left = graph.getNodeById(segment.origin_id); - const fromType = node_left?.outputs?.[segment.origin_slot]?.type ?? "*"; - const options4 = ["Add Node", null, "Delete", null]; - if (this.reroutesEnabled) options4.splice(1, 0, "Add Reroute"); - const title = "data" in segment && segment.data != null ? segment.data.constructor.name : null; - const menu2 = new LiteGraph.ContextMenu(options4, { - event: e2, - title, - callback: inner_clicked.bind(this) - }); - function inner_clicked(v2, options22, e3) { - switch (v2) { - case "Add Node": - LGraphCanvas.onMenuAdd(null, null, e3, menu2, function(node22) { - if (!node22.inputs?.length || !node22.outputs?.length) return; - const options32 = this.reroutesEnabled ? { afterRerouteId: segment.parentId } : void 0; - if (node_left.connectByType(segment.origin_slot, node22, fromType, options32)) { - node22.pos[0] -= node22.size[0] * 0.5; - } - }); - break; - case "Add Reroute": { - this.adjustMouseEvent(e3); - graph.createReroute([e3.canvasX, e3.canvasY], segment); - this.setDirty(false, true); - break; - } - case "Delete": - graph.removeLink(segment.id); - break; - } - } - __name(inner_clicked, "inner_clicked"); - return false; - } - createDefaultNodeForSlot(optPass) { - const opts = Object.assign({ - nodeFrom: null, - slotFrom: null, - nodeTo: null, - slotTo: null, - position: [0, 0], - nodeType: null, - posAdd: [0, 0], - posSizeFix: [0, 0] - }, optPass || {}); - const { afterRerouteId } = opts; - const isFrom = opts.nodeFrom && opts.slotFrom !== null; - const isTo = !isFrom && opts.nodeTo && opts.slotTo !== null; - if (!isFrom && !isTo) { - console.warn("No data passed to createDefaultNodeForSlot " + opts.nodeFrom + " " + opts.slotFrom + " " + opts.nodeTo + " " + opts.slotTo); - return false; - } - if (!opts.nodeType) { - console.warn("No type to createDefaultNodeForSlot"); - return false; - } - const nodeX = isFrom ? opts.nodeFrom : opts.nodeTo; - let slotX = isFrom ? opts.slotFrom : opts.slotTo; - let iSlotConn = false; - switch (typeof slotX) { - case "string": - iSlotConn = isFrom ? nodeX.findOutputSlot(slotX, false) : nodeX.findInputSlot(slotX, false); - slotX = isFrom ? nodeX.outputs[slotX] : nodeX.inputs[slotX]; - break; - case "object": - iSlotConn = isFrom ? nodeX.findOutputSlot(slotX.name) : nodeX.findInputSlot(slotX.name); - break; - case "number": - iSlotConn = slotX; - slotX = isFrom ? nodeX.outputs[slotX] : nodeX.inputs[slotX]; - break; - case "undefined": - default: - console.warn("Cant get slot information " + slotX); - return false; - } - const fromSlotType = slotX.type == LiteGraph.EVENT ? "_event_" : slotX.type; - const slotTypesDefault = isFrom ? LiteGraph.slot_types_default_out : LiteGraph.slot_types_default_in; - if (slotTypesDefault?.[fromSlotType]) { - let nodeNewType = false; - if (typeof slotTypesDefault[fromSlotType] == "object") { - for (const typeX in slotTypesDefault[fromSlotType]) { - if (opts.nodeType == slotTypesDefault[fromSlotType][typeX] || opts.nodeType == "AUTO") { - nodeNewType = slotTypesDefault[fromSlotType][typeX]; - break; - } - } - } else if (opts.nodeType == slotTypesDefault[fromSlotType] || opts.nodeType == "AUTO") { - nodeNewType = slotTypesDefault[fromSlotType]; - } - if (nodeNewType) { - let nodeNewOpts = false; - if (typeof nodeNewType == "object" && nodeNewType.node) { - nodeNewOpts = nodeNewType; - nodeNewType = nodeNewType.node; - } - const newNode = LiteGraph.createNode(nodeNewType); - if (newNode) { - if (nodeNewOpts) { - if (nodeNewOpts.properties) { - for (const i2 in nodeNewOpts.properties) { - newNode.addProperty(i2, nodeNewOpts.properties[i2]); - } - } - if (nodeNewOpts.inputs) { - newNode.inputs = []; - for (const i2 in nodeNewOpts.inputs) { - newNode.addOutput( - nodeNewOpts.inputs[i2][0], - nodeNewOpts.inputs[i2][1] - ); - } - } - if (nodeNewOpts.outputs) { - newNode.outputs = []; - for (const i2 in nodeNewOpts.outputs) { - newNode.addOutput( - nodeNewOpts.outputs[i2][0], - nodeNewOpts.outputs[i2][1] - ); - } - } - if (nodeNewOpts.title) { - newNode.title = nodeNewOpts.title; - } - if (nodeNewOpts.json) { - newNode.configure(nodeNewOpts.json); - } - } - this.graph.add(newNode); - newNode.pos = [ - opts.position[0] + opts.posAdd[0] + (opts.posSizeFix[0] ? opts.posSizeFix[0] * newNode.size[0] : 0), - opts.position[1] + opts.posAdd[1] + (opts.posSizeFix[1] ? opts.posSizeFix[1] * newNode.size[1] : 0) - ]; - if (isFrom) { - opts.nodeFrom.connectByType(iSlotConn, newNode, fromSlotType, { afterRerouteId }); - } else { - opts.nodeTo.connectByTypeOutput(iSlotConn, newNode, fromSlotType, { afterRerouteId }); - } - return true; - } - console.log("failed creating " + nodeNewType); - } - } - return false; - } - showConnectionMenu(optPass) { - const opts = Object.assign({ - nodeFrom: null, - slotFrom: null, - nodeTo: null, - slotTo: null, - e: null, - allow_searchbox: this.allow_searchbox, - showSearchBox: this.showSearchBox - }, optPass || {}); - const that = this; - const { afterRerouteId } = opts; - const isFrom = opts.nodeFrom && opts.slotFrom; - const isTo = !isFrom && opts.nodeTo && opts.slotTo; - if (!isFrom && !isTo) { - console.warn("No data passed to showConnectionMenu"); - return; - } - const nodeX = isFrom ? opts.nodeFrom : opts.nodeTo; - let slotX = isFrom ? opts.slotFrom : opts.slotTo; - let iSlotConn; - switch (typeof slotX) { - case "string": - iSlotConn = isFrom ? nodeX.findOutputSlot(slotX, false) : nodeX.findInputSlot(slotX, false); - slotX = isFrom ? nodeX.outputs[slotX] : nodeX.inputs[slotX]; - break; - case "object": - iSlotConn = isFrom ? nodeX.findOutputSlot(slotX.name) : nodeX.findInputSlot(slotX.name); - break; - case "number": - iSlotConn = slotX; - slotX = isFrom ? nodeX.outputs[slotX] : nodeX.inputs[slotX]; - break; - default: - console.warn("Cant get slot information " + slotX); - return; - } - const options4 = ["Add Node", null]; - if (opts.allow_searchbox) { - options4.push("Search"); - options4.push(null); - } - const fromSlotType = slotX.type == LiteGraph.EVENT ? "_event_" : slotX.type; - const slotTypesDefault = isFrom ? LiteGraph.slot_types_default_out : LiteGraph.slot_types_default_in; - if (slotTypesDefault?.[fromSlotType]) { - if (typeof slotTypesDefault[fromSlotType] == "object") { - for (const typeX in slotTypesDefault[fromSlotType]) { - options4.push(slotTypesDefault[fromSlotType][typeX]); - } - } else { - options4.push(slotTypesDefault[fromSlotType]); - } - } - const menu2 = new LiteGraph.ContextMenu(options4, { - event: opts.e, - title: (slotX && slotX.name != "" ? slotX.name + (fromSlotType ? " | " : "") : "") + (slotX && fromSlotType ? fromSlotType : ""), - callback: inner_clicked - }); - function inner_clicked(v2, options22, e2) { - switch (v2) { - case "Add Node": - LGraphCanvas.onMenuAdd(null, null, e2, menu2, function(node22) { - if (isFrom) { - opts.nodeFrom.connectByType(iSlotConn, node22, fromSlotType, { afterRerouteId }); - } else { - opts.nodeTo.connectByTypeOutput(iSlotConn, node22, fromSlotType, { afterRerouteId }); - } - }); - break; - case "Search": - if (isFrom) { - opts.showSearchBox(e2, { node_from: opts.nodeFrom, slot_from: slotX, type_filter_in: fromSlotType }); - } else { - opts.showSearchBox(e2, { node_to: opts.nodeTo, slot_from: slotX, type_filter_out: fromSlotType }); - } - break; - default: { - that.createDefaultNodeForSlot(Object.assign(opts, { - position: [opts.e.canvasX, opts.e.canvasY], - nodeType: v2, - afterRerouteId - })); - break; - } - } - } - __name(inner_clicked, "inner_clicked"); - } - // refactor: there are different dialogs, some uses createDialog some dont - prompt(title, value4, callback, event, multiline) { - const that = this; - title = title || ""; - const dialog = document.createElement("div"); - dialog.is_modified = false; - dialog.className = "graphdialog rounded"; - dialog.innerHTML = multiline ? "<span class='name'></span> <textarea autofocus class='value'></textarea><button class='rounded'>OK</button>" : "<span class='name'></span> <input autofocus type='text' class='value'/><button class='rounded'>OK</button>"; - dialog.close = function() { - that.prompt_box = null; - if (dialog.parentNode) { - dialog.parentNode.removeChild(dialog); - } - }; - const graphcanvas = LGraphCanvas.active_canvas; - const canvas = graphcanvas.canvas; - canvas.parentNode.appendChild(dialog); - if (this.ds.scale > 1) dialog.style.transform = "scale(" + this.ds.scale + ")"; - let dialogCloseTimer = null; - let prevent_timeout = 0; - LiteGraph.pointerListenerAdd(dialog, "leave", function() { - if (prevent_timeout) return; - if (LiteGraph.dialog_close_on_mouse_leave) { - if (!dialog.is_modified && LiteGraph.dialog_close_on_mouse_leave) - dialogCloseTimer = setTimeout( - dialog.close, - LiteGraph.dialog_close_on_mouse_leave_delay - ); - } - }); - LiteGraph.pointerListenerAdd(dialog, "enter", function() { - if (LiteGraph.dialog_close_on_mouse_leave && dialogCloseTimer) - clearTimeout(dialogCloseTimer); - }); - const selInDia = dialog.querySelectorAll("select"); - if (selInDia) { - for (const selIn of selInDia) { - selIn.addEventListener("click", function() { - prevent_timeout++; - }); - selIn.addEventListener("blur", function() { - prevent_timeout = 0; - }); - selIn.addEventListener("change", function() { - prevent_timeout = -1; - }); - } - } - this.prompt_box?.close(); - this.prompt_box = dialog; - const name_element = dialog.querySelector(".name"); - name_element.innerText = title; - const value_element = dialog.querySelector(".value"); - value_element.value = value4; - value_element.select(); - const input = value_element; - input.addEventListener("keydown", function(e2) { - dialog.is_modified = true; - if (e2.keyCode == 27) { - dialog.close(); - } else if (e2.keyCode == 13 && e2.target.localName != "textarea") { - if (callback) { - callback(this.value); - } - dialog.close(); - } else { - return; - } - e2.preventDefault(); - e2.stopPropagation(); - }); - const button = dialog.querySelector("button"); - button.addEventListener("click", function() { - callback?.(input.value); - that.setDirty(true); - dialog.close(); - }); - const rect = canvas.getBoundingClientRect(); - let offsetx = -20; - let offsety = -20; - if (rect) { - offsetx -= rect.left; - offsety -= rect.top; - } - if (event) { - dialog.style.left = event.clientX + offsetx + "px"; - dialog.style.top = event.clientY + offsety + "px"; - } else { - dialog.style.left = canvas.width * 0.5 + offsetx + "px"; - dialog.style.top = canvas.height * 0.5 + offsety + "px"; - } - setTimeout(function() { - input.focus(); - const clickTime = Date.now(); - function handleOutsideClick(e2) { - if (e2.target === canvas && Date.now() - clickTime > 256) { - dialog.close(); - canvas.parentNode.removeEventListener("click", handleOutsideClick); - canvas.parentNode.removeEventListener("touchend", handleOutsideClick); - } - } - __name(handleOutsideClick, "handleOutsideClick"); - canvas.parentNode.addEventListener("click", handleOutsideClick); - canvas.parentNode.addEventListener("touchend", handleOutsideClick); - }, 10); - return dialog; - } - showSearchBox(event, options4) { - const def_options = { - slot_from: null, - node_from: null, - node_to: null, - do_type_filter: LiteGraph.search_filter_enabled, - // TODO check for registered_slot_[in/out]_types not empty // this will be checked for functionality enabled : filter on slot type, in and out - // @ts-expect-error - type_filter_in: false, - // these are default: pass to set initially set values - type_filter_out: false, - show_general_if_none_on_typefilter: true, - show_general_after_typefiltered: true, - hide_on_mouse_leave: LiteGraph.search_hide_on_mouse_leave, - show_all_if_empty: true, - show_all_on_open: LiteGraph.search_show_all_on_open - }; - options4 = Object.assign(def_options, options4 || {}); - const that = this; - const graphcanvas = LGraphCanvas.active_canvas; - const canvas = graphcanvas.canvas; - const root_document = canvas.ownerDocument || document; - const dialog = document.createElement("div"); - dialog.className = "litegraph litesearchbox graphdialog rounded"; - dialog.innerHTML = "<span class='name'>Search</span> <input autofocus type='text' class='value rounded'/>"; - if (options4.do_type_filter) { - dialog.innerHTML += "<select class='slot_in_type_filter'><option value=''></option></select>"; - dialog.innerHTML += "<select class='slot_out_type_filter'><option value=''></option></select>"; - } - dialog.innerHTML += "<div class='helper'></div>"; - if (root_document.fullscreenElement) - root_document.fullscreenElement.appendChild(dialog); - else { - root_document.body.appendChild(dialog); - root_document.body.style.overflow = "hidden"; - } - let selIn; - let selOut; - if (options4.do_type_filter) { - selIn = dialog.querySelector(".slot_in_type_filter"); - selOut = dialog.querySelector(".slot_out_type_filter"); - } - dialog.close = function() { - that.search_box = null; - this.blur(); - canvas.focus(); - root_document.body.style.overflow = ""; - setTimeout(function() { - that.canvas.focus(); - }, 20); - dialog.parentNode?.removeChild(dialog); - }; - if (this.ds.scale > 1) { - dialog.style.transform = "scale(" + this.ds.scale + ")"; - } - if (options4.hide_on_mouse_leave) { - let prevent_timeout = false; - let timeout_close = null; - LiteGraph.pointerListenerAdd(dialog, "enter", function() { - if (timeout_close) { - clearTimeout(timeout_close); - timeout_close = null; - } - }); - LiteGraph.pointerListenerAdd(dialog, "leave", function() { - if (prevent_timeout) - return; - timeout_close = setTimeout(function() { - dialog.close(); - }, typeof options4.hide_on_mouse_leave === "number" ? options4.hide_on_mouse_leave : 500); - }); - if (options4.do_type_filter) { - selIn.addEventListener("click", function() { - prevent_timeout++; - }); - selIn.addEventListener("blur", function() { - prevent_timeout = 0; - }); - selIn.addEventListener("change", function() { - prevent_timeout = -1; - }); - selOut.addEventListener("click", function() { - prevent_timeout++; - }); - selOut.addEventListener("blur", function() { - prevent_timeout = 0; - }); - selOut.addEventListener("change", function() { - prevent_timeout = -1; - }); - } - } - that.search_box?.close(); - that.search_box = dialog; - const helper = dialog.querySelector(".helper"); - let first2 = null; - let timeout = null; - let selected2 = null; - const input = dialog.querySelector("input"); - if (input) { - input.addEventListener("blur", function() { - this.focus(); - }); - input.addEventListener("keydown", function(e2) { - if (e2.keyCode == 38) { - changeSelection(false); - } else if (e2.keyCode == 40) { - changeSelection(true); - } else if (e2.keyCode == 27) { - dialog.close(); - } else if (e2.keyCode == 13) { - if (selected2) { - select(unescape(selected2.dataset["type"])); - } else if (first2) { - select(first2); - } else { - dialog.close(); - } - } else { - if (timeout) { - clearInterval(timeout); - } - timeout = setTimeout(refreshHelper, 10); - return; - } - e2.preventDefault(); - e2.stopPropagation(); - e2.stopImmediatePropagation(); - return true; - }); - } - if (options4.do_type_filter) { - if (selIn) { - const aSlots = LiteGraph.slot_types_in; - const nSlots = aSlots.length; - if (options4.type_filter_in == LiteGraph.EVENT || options4.type_filter_in == LiteGraph.ACTION) - options4.type_filter_in = "_event_"; - for (let iK = 0; iK < nSlots; iK++) { - const opt = document.createElement("option"); - opt.value = aSlots[iK]; - opt.innerHTML = aSlots[iK]; - selIn.appendChild(opt); - if ( - // @ts-expect-error - options4.type_filter_in !== false && (options4.type_filter_in + "").toLowerCase() == (aSlots[iK] + "").toLowerCase() - ) { - opt.selected = true; - } - } - selIn.addEventListener("change", function() { - refreshHelper(); - }); - } - if (selOut) { - const aSlots = LiteGraph.slot_types_out; - const nSlots = aSlots.length; - if (options4.type_filter_out == LiteGraph.EVENT || options4.type_filter_out == LiteGraph.ACTION) - options4.type_filter_out = "_event_"; - for (let iK = 0; iK < nSlots; iK++) { - const opt = document.createElement("option"); - opt.value = aSlots[iK]; - opt.innerHTML = aSlots[iK]; - selOut.appendChild(opt); - if (options4.type_filter_out !== false && (options4.type_filter_out + "").toLowerCase() == (aSlots[iK] + "").toLowerCase()) - opt.selected = true; - } - selOut.addEventListener("change", function() { - refreshHelper(); - }); - } - } - const rect = canvas.getBoundingClientRect(); - const left = (event ? event.clientX : rect.left + rect.width * 0.5) - 80; - const top = (event ? event.clientY : rect.top + rect.height * 0.5) - 20; - dialog.style.left = left + "px"; - dialog.style.top = top + "px"; - if (event.layerY > rect.height - 200) - helper.style.maxHeight = rect.height - event.layerY - 20 + "px"; - requestAnimationFrame(function() { - input.focus(); - }); - if (options4.show_all_on_open) refreshHelper(); - function select(name2) { - if (name2) { - if (that.onSearchBoxSelection) { - that.onSearchBoxSelection(name2, event, graphcanvas); - } else { - const extra = LiteGraph.searchbox_extras[name2.toLowerCase()]; - if (extra) name2 = extra.type; - graphcanvas.graph.beforeChange(); - const node22 = LiteGraph.createNode(name2); - if (node22) { - node22.pos = graphcanvas.convertEventToCanvasOffset(event); - graphcanvas.graph.add(node22, false); - } - if (extra?.data) { - if (extra.data.properties) { - for (const i2 in extra.data.properties) { - node22.addProperty(i2, extra.data.properties[i2]); - } - } - if (extra.data.inputs) { - node22.inputs = []; - for (const i2 in extra.data.inputs) { - node22.addOutput( - extra.data.inputs[i2][0], - extra.data.inputs[i2][1] - ); - } - } - if (extra.data.outputs) { - node22.outputs = []; - for (const i2 in extra.data.outputs) { - node22.addOutput( - extra.data.outputs[i2][0], - extra.data.outputs[i2][1] - ); - } - } - if (extra.data.title) { - node22.title = extra.data.title; - } - if (extra.data.json) { - node22.configure(extra.data.json); - } - } - if (options4.node_from) { - let iS = false; - switch (typeof options4.slot_from) { - case "string": - iS = options4.node_from.findOutputSlot(options4.slot_from); - break; - case "object": - iS = options4.slot_from.name ? options4.node_from.findOutputSlot(options4.slot_from.name) : -1; - if (iS == -1 && typeof options4.slot_from.slot_index !== "undefined") iS = options4.slot_from.slot_index; - break; - case "number": - iS = options4.slot_from; - break; - default: - iS = 0; - } - if (typeof options4.node_from.outputs[iS] !== "undefined") { - if (iS !== false && iS > -1) { - options4.node_from.connectByType(iS, node22, options4.node_from.outputs[iS].type); - } - } - } - if (options4.node_to) { - let iS = false; - switch (typeof options4.slot_from) { - case "string": - iS = options4.node_to.findInputSlot(options4.slot_from); - break; - case "object": - iS = options4.slot_from.name ? options4.node_to.findInputSlot(options4.slot_from.name) : -1; - if (iS == -1 && typeof options4.slot_from.slot_index !== "undefined") iS = options4.slot_from.slot_index; - break; - case "number": - iS = options4.slot_from; - break; - default: - iS = 0; - } - if (typeof options4.node_to.inputs[iS] !== "undefined") { - if (iS !== false && iS > -1) { - options4.node_to.connectByTypeOutput(iS, node22, options4.node_to.inputs[iS].type); - } - } - } - graphcanvas.graph.afterChange(); - } - } - dialog.close(); - } - __name(select, "select"); - function changeSelection(forward) { - const prev2 = selected2; - if (!selected2) { - selected2 = forward ? helper.childNodes[0] : helper.childNodes[helper.childNodes.length]; - } else { - selected2.classList.remove("selected"); - selected2 = forward ? selected2.nextSibling : selected2.previousSibling; - selected2 ||= prev2; - } - if (!selected2) return; - selected2.classList.add("selected"); - selected2.scrollIntoView({ block: "end", behavior: "smooth" }); - } - __name(changeSelection, "changeSelection"); - function refreshHelper() { - timeout = null; - let str = input.value; - first2 = null; - helper.innerHTML = ""; - if (!str && !options4.show_all_if_empty) return; - if (that.onSearchBox) { - const list2 = that.onSearchBox(helper, str, graphcanvas); - if (list2) { - for (let i2 = 0; i2 < list2.length; ++i2) { - addResult(list2[i2]); - } - } - } else { - let inner_test_filter = /* @__PURE__ */ __name(function(type, optsIn) { - optsIn = optsIn || {}; - const optsDef = { - skipFilter: false, - inTypeOverride: false, - outTypeOverride: false - }; - const opts = Object.assign(optsDef, optsIn); - const ctor = LiteGraph.registered_node_types[type]; - if (filter4 && ctor.filter != filter4) return false; - if ((!options4.show_all_if_empty || str) && type.toLowerCase().indexOf(str) === -1 && (!ctor.title || ctor.title.toLowerCase().indexOf(str) === -1)) - return false; - if (options4.do_type_filter && !opts.skipFilter) { - const sType = type; - let sV = opts.inTypeOverride !== false ? opts.inTypeOverride : sIn.value; - if (sIn && sV && LiteGraph.registered_slot_in_types[sV]?.nodes) { - const doesInc = LiteGraph.registered_slot_in_types[sV].nodes.includes(sType); - if (doesInc === false) return false; - } - sV = sOut.value; - if (opts.outTypeOverride !== false) sV = opts.outTypeOverride; - if (sOut && sV && LiteGraph.registered_slot_out_types[sV]?.nodes) { - const doesInc = LiteGraph.registered_slot_out_types[sV].nodes.includes(sType); - if (doesInc === false) return false; - } - } - return true; - }, "inner_test_filter"); - let c = 0; - str = str.toLowerCase(); - const filter4 = graphcanvas.filter || graphcanvas.graph.filter; - let sIn = false; - let sOut = false; - if (options4.do_type_filter && that.search_box) { - sIn = that.search_box.querySelector(".slot_in_type_filter"); - sOut = that.search_box.querySelector(".slot_out_type_filter"); - } - for (const i2 in LiteGraph.searchbox_extras) { - const extra = LiteGraph.searchbox_extras[i2]; - if ((!options4.show_all_if_empty || str) && extra.desc.toLowerCase().indexOf(str) === -1) - continue; - const ctor = LiteGraph.registered_node_types[extra.type]; - if (ctor && ctor.filter != filter4) continue; - if (!inner_test_filter(extra.type)) continue; - addResult(extra.desc, "searchbox_extra"); - if (LGraphCanvas.search_limit !== -1 && c++ > LGraphCanvas.search_limit) { - break; - } - } - let filtered = null; - if (Array.prototype.filter) { - const keys2 = Object.keys(LiteGraph.registered_node_types); - filtered = keys2.filter(inner_test_filter); - } else { - filtered = []; - for (const i2 in LiteGraph.registered_node_types) { - if (inner_test_filter(i2)) filtered.push(i2); - } - } - for (let i2 = 0; i2 < filtered.length; i2++) { - addResult(filtered[i2]); - if (LGraphCanvas.search_limit !== -1 && c++ > LGraphCanvas.search_limit) - break; - } - if (options4.show_general_after_typefiltered && (sIn.value || sOut.value)) { - filtered_extra = []; - for (const i2 in LiteGraph.registered_node_types) { - if (inner_test_filter(i2, { - inTypeOverride: sIn && sIn.value ? "*" : false, - outTypeOverride: sOut && sOut.value ? "*" : false - })) - filtered_extra.push(i2); - } - for (let i2 = 0; i2 < filtered_extra.length; i2++) { - addResult(filtered_extra[i2], "generic_type"); - if (LGraphCanvas.search_limit !== -1 && c++ > LGraphCanvas.search_limit) - break; - } - } - if ((sIn.value || sOut.value) && helper.childNodes.length == 0 && options4.show_general_if_none_on_typefilter) { - filtered_extra = []; - for (const i2 in LiteGraph.registered_node_types) { - if (inner_test_filter(i2, { skipFilter: true })) - filtered_extra.push(i2); - } - for (let i2 = 0; i2 < filtered_extra.length; i2++) { - addResult(filtered_extra[i2], "not_in_filter"); - if (LGraphCanvas.search_limit !== -1 && c++ > LGraphCanvas.search_limit) - break; - } - } - } - function addResult(type, className) { - const help = document.createElement("div"); - first2 ||= type; - const nodeType = LiteGraph.registered_node_types[type]; - if (nodeType?.title) { - help.innerText = nodeType?.title; - const typeEl = document.createElement("span"); - typeEl.className = "litegraph lite-search-item-type"; - typeEl.textContent = type; - help.append(typeEl); - } else { - help.innerText = type; - } - help.dataset["type"] = escape(type); - help.className = "litegraph lite-search-item"; - if (className) { - help.className += " " + className; - } - help.addEventListener("click", function() { - select(unescape(this.dataset["type"])); - }); - helper.appendChild(help); - } - __name(addResult, "addResult"); - } - __name(refreshHelper, "refreshHelper"); - return dialog; - } - showEditPropertyValue(node22, property, options4) { - if (!node22 || node22.properties[property] === void 0) return; - options4 = options4 || {}; - const info = node22.getPropertyInfo(property); - const type = info.type; - let input_html = ""; - if (type == "string" || type == "number" || type == "array" || type == "object") { - input_html = "<input autofocus type='text' class='value'/>"; - } else if ((type == "enum" || type == "combo") && info.values) { - input_html = "<select autofocus type='text' class='value'>"; - for (const i2 in info.values) { - const v2 = Array.isArray(info.values) ? info.values[i2] : i2; - input_html += "<option value='" + v2 + "' " + (v2 == node22.properties[property] ? "selected" : "") + ">" + info.values[i2] + "</option>"; - } - input_html += "</select>"; - } else if (type == "boolean" || type == "toggle") { - input_html = "<input autofocus type='checkbox' class='value' " + (node22.properties[property] ? "checked" : "") + "/>"; - } else { - console.warn("unknown type: " + type); - return; - } - const dialog = this.createDialog( - "<span class='name'>" + (info.label || property) + "</span>" + input_html + "<button>OK</button>", - options4 - ); - let input; - if ((type == "enum" || type == "combo") && info.values) { - input = dialog.querySelector("select"); - input.addEventListener("change", function(e2) { - dialog.modified(); - setValue2(e2.target?.value); - }); - } else if (type == "boolean" || type == "toggle") { - input = dialog.querySelector("input"); - input?.addEventListener("click", function() { - dialog.modified(); - setValue2(!!input.checked); - }); - } else { - input = dialog.querySelector("input"); - if (input) { - input.addEventListener("blur", function() { - this.focus(); - }); - let v2 = node22.properties[property] !== void 0 ? node22.properties[property] : ""; - if (type !== "string") { - v2 = JSON.stringify(v2); - } - input.value = v2; - input.addEventListener("keydown", function(e2) { - if (e2.keyCode == 27) { - dialog.close(); - } else if (e2.keyCode == 13) { - inner(); - } else if (e2.keyCode != 13) { - dialog.modified(); - return; - } - e2.preventDefault(); - e2.stopPropagation(); - }); - } - } - input?.focus(); - const button = dialog.querySelector("button"); - button.addEventListener("click", inner); - function inner() { - setValue2(input.value); - } - __name(inner, "inner"); - function setValue2(value4) { - if (info?.values && typeof info.values === "object" && info.values[value4] != void 0) - value4 = info.values[value4]; - if (typeof node22.properties[property] == "number") { - value4 = Number(value4); - } - if (type == "array" || type == "object") { - value4 = JSON.parse(value4); - } - node22.properties[property] = value4; - if (node22.graph) { - node22.graph._version++; - } - node22.onPropertyChanged?.(property, value4); - options4.onclose?.(); - dialog.close(); - this.setDirty(true, true); - } - __name(setValue2, "setValue"); - return dialog; - } - // TODO refactor, theer are different dialog, some uses createDialog, some dont - createDialog(html, options4) { - const def_options = { - checkForInput: false, - closeOnLeave: true, - closeOnLeave_checkModified: true - }; - options4 = Object.assign(def_options, options4 || {}); - const dialog = document.createElement("div"); - dialog.className = "graphdialog"; - dialog.innerHTML = html; - dialog.is_modified = false; - const rect = this.canvas.getBoundingClientRect(); - let offsetx = -20; - let offsety = -20; - if (rect) { - offsetx -= rect.left; - offsety -= rect.top; - } - if (options4.position) { - offsetx += options4.position[0]; - offsety += options4.position[1]; - } else if (options4.event) { - offsetx += options4.event.clientX; - offsety += options4.event.clientY; - } else { - offsetx += this.canvas.width * 0.5; - offsety += this.canvas.height * 0.5; - } - dialog.style.left = offsetx + "px"; - dialog.style.top = offsety + "px"; - this.canvas.parentNode.appendChild(dialog); - if (options4.checkForInput) { - const aI = dialog.querySelectorAll("input"); - aI?.forEach(function(iX) { - iX.addEventListener("keydown", function(e2) { - dialog.modified(); - if (e2.keyCode == 27) { - dialog.close(); - } else if (e2.keyCode != 13) { - return; - } - e2.preventDefault(); - e2.stopPropagation(); - }); - iX.focus(); - }); - } - dialog.modified = function() { - dialog.is_modified = true; - }; - dialog.close = function() { - dialog.parentNode?.removeChild(dialog); - }; - let dialogCloseTimer = null; - let prevent_timeout = 0; - dialog.addEventListener("mouseleave", function() { - if (prevent_timeout) return; - if (!dialog.is_modified && LiteGraph.dialog_close_on_mouse_leave) - dialogCloseTimer = setTimeout( - dialog.close, - LiteGraph.dialog_close_on_mouse_leave_delay - ); - }); - dialog.addEventListener("mouseenter", function() { - if (options4.closeOnLeave || LiteGraph.dialog_close_on_mouse_leave) { - if (dialogCloseTimer) clearTimeout(dialogCloseTimer); - } - }); - const selInDia = dialog.querySelectorAll("select"); - selInDia?.forEach(function(selIn) { - selIn.addEventListener("click", function() { - prevent_timeout++; - }); - selIn.addEventListener("blur", function() { - prevent_timeout = 0; - }); - selIn.addEventListener("change", function() { - prevent_timeout = -1; - }); - }); - return dialog; - } - createPanel(title, options4) { - options4 = options4 || {}; - const ref_window = options4.window || window; - const root24 = document.createElement("div"); - root24.className = "litegraph dialog"; - root24.innerHTML = "<div class='dialog-header'><span class='dialog-title'></span></div><div class='dialog-content'></div><div style='display:none;' class='dialog-alt-content'></div><div class='dialog-footer'></div>"; - root24.header = root24.querySelector(".dialog-header"); - if (options4.width) - root24.style.width = options4.width + (typeof options4.width === "number" ? "px" : ""); - if (options4.height) - root24.style.height = options4.height + (typeof options4.height === "number" ? "px" : ""); - if (options4.closable) { - const close5 = document.createElement("span"); - close5.innerHTML = "✕"; - close5.classList.add("close"); - close5.addEventListener("click", function() { - root24.close(); - }); - root24.header.appendChild(close5); - } - root24.title_element = root24.querySelector(".dialog-title"); - root24.title_element.innerText = title; - root24.content = root24.querySelector(".dialog-content"); - root24.alt_content = root24.querySelector(".dialog-alt-content"); - root24.footer = root24.querySelector(".dialog-footer"); - root24.close = function() { - if (typeof root24.onClose == "function") root24.onClose(); - root24.parentNode?.removeChild(root24); - this.parentNode?.removeChild(this); - }; - root24.toggleAltContent = function(force) { - let vTo; - let vAlt; - if (typeof force != "undefined") { - vTo = force ? "block" : "none"; - vAlt = force ? "none" : "block"; - } else { - vTo = root24.alt_content.style.display != "block" ? "block" : "none"; - vAlt = root24.alt_content.style.display != "block" ? "none" : "block"; - } - root24.alt_content.style.display = vTo; - root24.content.style.display = vAlt; - }; - root24.toggleFooterVisibility = function(force) { - let vTo; - if (typeof force != "undefined") { - vTo = force ? "block" : "none"; - } else { - vTo = root24.footer.style.display != "block" ? "block" : "none"; - } - root24.footer.style.display = vTo; - }; - root24.clear = function() { - this.content.innerHTML = ""; - }; - root24.addHTML = function(code2, classname, on_footer) { - const elem = document.createElement("div"); - if (classname) elem.className = classname; - elem.innerHTML = code2; - if (on_footer) root24.footer.appendChild(elem); - else root24.content.appendChild(elem); - return elem; - }; - root24.addButton = function(name2, callback, options22) { - const elem = document.createElement("button"); - elem.innerText = name2; - elem.options = options22; - elem.classList.add("btn"); - elem.addEventListener("click", callback); - root24.footer.appendChild(elem); - return elem; - }; - root24.addSeparator = function() { - const elem = document.createElement("div"); - elem.className = "separator"; - root24.content.appendChild(elem); - }; - root24.addWidget = function(type, name2, value4, options22, callback) { - options22 = options22 || {}; - let str_value = String(value4); - type = type.toLowerCase(); - if (type == "number") str_value = value4.toFixed(3); - const elem = document.createElement("div"); - elem.className = "property"; - elem.innerHTML = "<span class='property_name'></span><span class='property_value'></span>"; - elem.querySelector(".property_name").innerText = options22.label || name2; - const value_element = elem.querySelector(".property_value"); - value_element.innerText = str_value; - elem.dataset["property"] = name2; - elem.dataset["type"] = options22.type || type; - elem.options = options22; - elem.value = value4; - if (type == "code") - elem.addEventListener("click", function() { - root24.inner_showCodePad(this.dataset["property"]); - }); - else if (type == "boolean") { - elem.classList.add("boolean"); - if (value4) elem.classList.add("bool-on"); - elem.addEventListener("click", function() { - const propname = this.dataset["property"]; - this.value = !this.value; - this.classList.toggle("bool-on"); - this.querySelector(".property_value").innerText = this.value ? "true" : "false"; - innerChange(propname, this.value); - }); - } else if (type == "string" || type == "number") { - value_element.setAttribute("contenteditable", true); - value_element.addEventListener("keydown", function(e2) { - if (e2.code == "Enter" && (type != "string" || !e2.shiftKey)) { - e2.preventDefault(); - this.blur(); - } - }); - value_element.addEventListener("blur", function() { - let v2 = this.innerText; - const propname = this.parentNode.dataset["property"]; - const proptype = this.parentNode.dataset["type"]; - if (proptype == "number") v2 = Number(v2); - innerChange(propname, v2); - }); - } else if (type == "enum" || type == "combo") { - const str_value2 = LGraphCanvas.getPropertyPrintableValue(value4, options22.values); - value_element.innerText = str_value2; - value_element.addEventListener("click", function(event) { - const values = options22.values || []; - const propname = this.parentNode.dataset["property"]; - const elem_that = this; - new LiteGraph.ContextMenu( - values, - { - event, - className: "dark", - callback: inner_clicked - }, - // @ts-expect-error - ref_window - ); - function inner_clicked(v2) { - elem_that.innerText = v2; - innerChange(propname, v2); - return false; - } - __name(inner_clicked, "inner_clicked"); - }); - } - root24.content.appendChild(elem); - function innerChange(name22, value22) { - options22.callback?.(name22, value22, options22); - callback?.(name22, value22, options22); - } - __name(innerChange, "innerChange"); - return elem; - }; - if (root24.onOpen && typeof root24.onOpen == "function") root24.onOpen(); - return root24; - } - closePanels() { - document.querySelector("#node-panel")?.close(); - document.querySelector("#option-panel")?.close(); - } - showShowNodePanel(node22) { - this.SELECTED_NODE = node22; - this.closePanels(); - const ref_window = this.getCanvasWindow(); - const graphcanvas = this; - const panel2 = this.createPanel(node22.title || "", { - closable: true, - window: ref_window, - onOpen: /* @__PURE__ */ __name(function() { - graphcanvas.NODEPANEL_IS_OPEN = true; - }, "onOpen"), - onClose: /* @__PURE__ */ __name(function() { - graphcanvas.NODEPANEL_IS_OPEN = false; - graphcanvas.node_panel = null; - }, "onClose") - }); - graphcanvas.node_panel = panel2; - panel2.id = "node-panel"; - panel2.node = node22; - panel2.classList.add("settings"); - function inner_refresh() { - panel2.content.innerHTML = ""; - panel2.addHTML(`<span class='node_type'>${node22.type}</span><span class='node_desc'>${node22.constructor.desc || ""}</span><span class='separator'></span>`); - panel2.addHTML("<h3>Properties</h3>"); - const fUpdate = /* @__PURE__ */ __name(function(name2, value4) { - graphcanvas.graph.beforeChange(node22); - switch (name2) { - case "Title": - node22.title = value4; - break; - case "Mode": { - const kV = Object.values(LiteGraph.NODE_MODES).indexOf(value4); - if (kV >= 0 && LiteGraph.NODE_MODES[kV]) { - node22.changeMode(kV); - } else { - console.warn("unexpected mode: " + value4); - } - break; - } - case "Color": - if (LGraphCanvas.node_colors[value4]) { - node22.color = LGraphCanvas.node_colors[value4].color; - node22.bgcolor = LGraphCanvas.node_colors[value4].bgcolor; - } else { - console.warn("unexpected color: " + value4); - } - break; - default: - node22.setProperty(name2, value4); - break; - } - graphcanvas.graph.afterChange(); - graphcanvas.dirty_canvas = true; - }, "fUpdate"); - panel2.addWidget("string", "Title", node22.title, {}, fUpdate); - panel2.addWidget("combo", "Mode", LiteGraph.NODE_MODES[node22.mode], { values: LiteGraph.NODE_MODES }, fUpdate); - const nodeCol = node22.color !== void 0 ? Object.keys(LGraphCanvas.node_colors).filter(function(nK) { - return LGraphCanvas.node_colors[nK].color == node22.color; - }) : ""; - panel2.addWidget("combo", "Color", nodeCol, { values: Object.keys(LGraphCanvas.node_colors) }, fUpdate); - for (const pName in node22.properties) { - const value4 = node22.properties[pName]; - const info = node22.getPropertyInfo(pName); - if (node22.onAddPropertyToPanel?.(pName, panel2)) continue; - panel2.addWidget(info.widget || info.type, pName, value4, info, fUpdate); - } - panel2.addSeparator(); - node22.onShowCustomPanelInfo?.(panel2); - panel2.footer.innerHTML = ""; - panel2.addButton("Delete", function() { - if (node22.block_delete) - return; - node22.graph.remove(node22); - panel2.close(); - }).classList.add("delete"); - } - __name(inner_refresh, "inner_refresh"); - panel2.inner_showCodePad = function(propname) { - panel2.classList.remove("settings"); - panel2.classList.add("centered"); - panel2.alt_content.innerHTML = "<textarea class='code'></textarea>"; - const textarea = panel2.alt_content.querySelector("textarea"); - const fDoneWith = /* @__PURE__ */ __name(function() { - panel2.toggleAltContent(false); - panel2.toggleFooterVisibility(true); - textarea.parentNode.removeChild(textarea); - panel2.classList.add("settings"); - panel2.classList.remove("centered"); - inner_refresh(); - }, "fDoneWith"); - textarea.value = node22.properties[propname]; - textarea.addEventListener("keydown", function(e2) { - if (e2.code == "Enter" && e2.ctrlKey) { - node22.setProperty(propname, textarea.value); - fDoneWith(); - } - }); - panel2.toggleAltContent(true); - panel2.toggleFooterVisibility(false); - textarea.style.height = "calc(100% - 40px)"; - const assign2 = panel2.addButton("Assign", function() { - node22.setProperty(propname, textarea.value); - fDoneWith(); - }); - panel2.alt_content.appendChild(assign2); - const button = panel2.addButton("Close", fDoneWith); - button.style.float = "right"; - panel2.alt_content.appendChild(button); - }; - inner_refresh(); - this.canvas.parentNode.appendChild(panel2); - } - checkPanels() { - if (!this.canvas) return; - const panels = this.canvas.parentNode.querySelectorAll(".litegraph.dialog"); - for (let i2 = 0; i2 < panels.length; ++i2) { - const panel2 = panels[i2]; - if (!panel2.node) continue; - if (!panel2.node.graph || panel2.graph != this.graph) panel2.close(); - } - } - getCanvasMenuOptions() { - let options4 = null; - if (this.getMenuOptions) { - options4 = this.getMenuOptions(); - } else { - options4 = [ - { - content: "Add Node", - has_submenu: true, - // @ts-expect-error Might be broken? Or just param overlap - callback: LGraphCanvas.onMenuAdd - }, - { content: "Add Group", callback: LGraphCanvas.onGroupAdd } - // { content: "Arrange", callback: that.graph.arrange }, - // {content:"Collapse All", callback: LGraphCanvas.onMenuCollapseAll } - ]; - if (Object.keys(this.selected_nodes).length > 1) { - options4.push({ - content: "Align", - has_submenu: true, - callback: LGraphCanvas.onGroupAlign - }); - } - } - const extra = this.getExtraMenuOptions?.(this, options4); - return Array.isArray(extra) ? options4.concat(extra) : options4; - } - // called by processContextMenu to extract the menu list - getNodeMenuOptions(node22) { - let options4 = null; - if (node22.getMenuOptions) { - options4 = node22.getMenuOptions(this); - } else { - options4 = [ - { - content: "Inputs", - has_submenu: true, - disabled: true, - callback: LGraphCanvas.showMenuNodeOptionalInputs - }, - { - content: "Outputs", - has_submenu: true, - disabled: true, - callback: LGraphCanvas.showMenuNodeOptionalOutputs - }, - null, - { - content: "Properties", - has_submenu: true, - callback: LGraphCanvas.onShowMenuNodeProperties - }, - { - content: "Properties Panel", - callback: /* @__PURE__ */ __name(function(item3, options22, e2, menu2, node3) { - LGraphCanvas.active_canvas.showShowNodePanel(node3); - }, "callback") - }, - null, - { - content: "Title", - callback: LGraphCanvas.onShowPropertyEditor - }, - { - content: "Mode", - has_submenu: true, - callback: LGraphCanvas.onMenuNodeMode - } - ]; - if (node22.resizable !== false) { - options4.push({ - content: "Resize", - callback: LGraphCanvas.onMenuResizeNode - }); - } - if (node22.collapsible) { - options4.push({ - content: node22.collapsed ? "Expand" : "Collapse", - callback: LGraphCanvas.onMenuNodeCollapse - }); - } - if (node22.widgets?.some((w) => w.advanced)) { - options4.push({ - content: node22.showAdvanced ? "Hide Advanced" : "Show Advanced", - callback: LGraphCanvas.onMenuToggleAdvanced - }); - } - options4.push( - { - content: node22.pinned ? "Unpin" : "Pin", - callback: /* @__PURE__ */ __name((...args) => { - LGraphCanvas.onMenuNodePin(...args); - for (const i2 in this.selected_nodes) { - const node3 = this.selected_nodes[i2]; - node3.pin(); - } - this.setDirty(true, true); - }, "callback") - }, - { - content: "Colors", - has_submenu: true, - callback: LGraphCanvas.onMenuNodeColors - }, - { - content: "Shapes", - has_submenu: true, - callback: LGraphCanvas.onMenuNodeShapes - }, - null - ); - } - const inputs = node22.onGetInputs?.(); - if (inputs?.length) options4[0].disabled = false; - const outputs = node22.onGetOutputs?.(); - if (outputs?.length) options4[1].disabled = false; - const extra = node22.getExtraMenuOptions?.(this, options4); - if (Array.isArray(extra) && extra.length > 0) { - extra.push(null); - options4 = extra.concat(options4); - } - if (node22.clonable !== false) { - options4.push({ - content: "Clone", - callback: LGraphCanvas.onMenuNodeClone - }); - } - if (Object.keys(this.selected_nodes).length > 1) { - options4.push({ - content: "Align Selected To", - has_submenu: true, - callback: LGraphCanvas.onNodeAlign - }); - options4.push({ - content: "Distribute Nodes", - has_submenu: true, - callback: LGraphCanvas.createDistributeMenu - }); - } - options4.push(null, { - content: "Remove", - disabled: !(node22.removable !== false && !node22.block_delete), - callback: LGraphCanvas.onMenuNodeRemove - }); - node22.graph?.onGetNodeMenuOptions?.(options4, node22); - return options4; - } - getGroupMenuOptions(group) { - console.warn("LGraphCanvas.getGroupMenuOptions is deprecated, use LGraphGroup.getMenuOptions instead"); - return group.getMenuOptions(); - } - processContextMenu(node22, event) { - const that = this; - const canvas = LGraphCanvas.active_canvas; - const ref_window = canvas.getCanvasWindow(); - let menu_info = null; - const options4 = { - event, - callback: inner_option_clicked, - extra: node22 - }; - if (node22) options4.title = node22.type; - let slot = null; - if (node22) { - slot = node22.getSlotInPosition(event.canvasX, event.canvasY); - LGraphCanvas.active_node = node22; - } - if (slot) { - menu_info = []; - if (node22.getSlotMenuOptions) { - menu_info = node22.getSlotMenuOptions(slot); - } else { - if (slot?.output?.links?.length) - menu_info.push({ content: "Disconnect Links", slot }); - const _slot = slot.input || slot.output; - if (_slot.removable) { - menu_info.push( - _slot.locked ? "Cannot remove" : { content: "Remove Slot", slot } - ); - } - if (!_slot.nameLocked) - menu_info.push({ content: "Rename Slot", slot }); - } - options4.title = (slot.input ? slot.input.type : slot.output.type) || "*"; - if (slot.input && slot.input.type == LiteGraph.ACTION) - options4.title = "Action"; - if (slot.output && slot.output.type == LiteGraph.EVENT) - options4.title = "Event"; - } else if (node22) { - menu_info = this.getNodeMenuOptions(node22); - } else { - menu_info = this.getCanvasMenuOptions(); - if (this.reroutesEnabled && this.links_render_mode !== LinkRenderType.HIDDEN_LINK) { - const reroute = this.graph.getRerouteOnPos(event.canvasX, event.canvasY); - if (reroute) { - menu_info.unshift({ - content: "Delete Reroute", - callback: /* @__PURE__ */ __name(() => this.graph.removeReroute(reroute.id), "callback") - }, null); - } - } - const group = this.graph.getGroupOnPos( - event.canvasX, - event.canvasY - ); - if (group) { - menu_info.push(null, { - content: "Edit Group", - has_submenu: true, - submenu: { - title: "Group", - extra: group, - options: group.getMenuOptions() - } - }); - } - } - if (!menu_info) return; - new LiteGraph.ContextMenu(menu_info, options4, ref_window); - function inner_option_clicked(v2, options22) { - if (!v2) return; - if (v2.content == "Remove Slot") { - const info = v2.slot; - node22.graph.beforeChange(); - if (info.input) { - node22.removeInput(info.slot); - } else if (info.output) { - node22.removeOutput(info.slot); - } - node22.graph.afterChange(); - return; - } else if (v2.content == "Disconnect Links") { - const info = v2.slot; - node22.graph.beforeChange(); - if (info.output) { - node22.disconnectOutput(info.slot); - } else if (info.input) { - node22.disconnectInput(info.slot); - } - node22.graph.afterChange(); - return; - } else if (v2.content == "Rename Slot") { - const info = v2.slot; - const slot_info = info.input ? node22.getInputInfo(info.slot) : node22.getOutputInfo(info.slot); - const dialog = that.createDialog( - "<span class='name'>Name</span><input autofocus type='text'/><button>OK</button>", - options22 - ); - const input = dialog.querySelector("input"); - if (input && slot_info) { - input.value = slot_info.label || ""; - } - const inner = /* @__PURE__ */ __name(function() { - node22.graph.beforeChange(); - if (input.value) { - if (slot_info) { - slot_info.label = input.value; - } - that.setDirty(true); - } - dialog.close(); - node22.graph.afterChange(); - }, "inner"); - dialog.querySelector("button").addEventListener("click", inner); - input.addEventListener("keydown", function(e2) { - dialog.is_modified = true; - if (e2.keyCode == 27) { - dialog.close(); - } else if (e2.keyCode == 13) { - inner(); - } else if (e2.keyCode != 13 && e2.target.localName != "textarea") { - return; - } - e2.preventDefault(); - e2.stopPropagation(); - }); - input.focus(); - } - } - __name(inner_option_clicked, "inner_option_clicked"); - } - /** - * Starts an animation to fit the view around the specified selection of nodes. - * @param bounds The bounds to animate the view to, defined by a rectangle. - */ - animateToBounds(bounds, { - duration = 350, - zoom = 0.75, - easing = EaseFunction.EASE_IN_OUT_QUAD - } = {}) { - const easeFunctions = { - linear: /* @__PURE__ */ __name((t2) => t2, "linear"), - easeInQuad: /* @__PURE__ */ __name((t2) => t2 * t2, "easeInQuad"), - easeOutQuad: /* @__PURE__ */ __name((t2) => t2 * (2 - t2), "easeOutQuad"), - easeInOutQuad: /* @__PURE__ */ __name((t2) => t2 < 0.5 ? 2 * t2 * t2 : -1 + (4 - 2 * t2) * t2, "easeInOutQuad") - }; - const easeFunction = easeFunctions[easing] ?? easeFunctions.linear; - let animationId = null; - const startTimestamp = performance.now(); - const startX = this.ds.offset[0]; - const startY = this.ds.offset[1]; - const startScale = this.ds.scale; - const cw = this.canvas.width / window.devicePixelRatio; - const ch = this.canvas.height / window.devicePixelRatio; - let targetScale = startScale; - let targetX = startX; - let targetY = startY; - if (zoom > 0) { - const targetScaleX = zoom * cw / Math.max(bounds[2], 300); - const targetScaleY = zoom * ch / Math.max(bounds[3], 300); - targetScale = Math.min(targetScaleX, targetScaleY, this.ds.max_scale); - } - targetX = -bounds[0] - bounds[2] * 0.5 + cw * 0.5 / targetScale; - targetY = -bounds[1] - bounds[3] * 0.5 + ch * 0.5 / targetScale; - const animate = /* @__PURE__ */ __name((timestamp2) => { - const elapsed = timestamp2 - startTimestamp; - const progress = Math.min(elapsed / duration, 1); - const easedProgress = easeFunction(progress); - this.ds.offset[0] = startX + (targetX - startX) * easedProgress; - this.ds.offset[1] = startY + (targetY - startY) * easedProgress; - if (zoom > 0) { - this.ds.scale = startScale + (targetScale - startScale) * easedProgress; - } - this.setDirty(true, true); - if (progress < 1) { - animationId = requestAnimationFrame(animate); - } else { - cancelAnimationFrame(animationId); - } - }, "animate"); - animationId = requestAnimationFrame(animate); - } - /** - * Fits the view to the selected nodes with animation. - * If nothing is selected, the view is fitted around all items in the graph. - */ - fitViewToSelectionAnimated(options4 = {}) { - const items2 = this.selectedItems.size ? Array.from(this.selectedItems) : this.positionableItems; - this.animateToBounds(createBounds(items2), options4); - } -} -class MapProxyHandler { - static { - __name(this, "MapProxyHandler"); - } - getOwnPropertyDescriptor(target, p2) { - const value4 = this.get(target, p2); - if (value4) return { - configurable: true, - enumerable: true, - value: value4 - }; - } - has(target, p2) { - if (typeof p2 === "symbol") return false; - const int = parseInt(p2, 10); - return target.has(!isNaN(int) ? int : p2); - } - ownKeys(target) { - return [...target.keys()].map((x2) => String(x2)); - } - get(target, p2) { - if (p2 in target) return Reflect.get(target, p2, target); - if (typeof p2 === "symbol") return; - const int = parseInt(p2, 10); - return target.get(!isNaN(int) ? int : p2); - } - set(target, p2, newValue2) { - if (typeof p2 === "symbol") return false; - const int = parseInt(p2, 10); - target.set(!isNaN(int) ? int : p2, newValue2); - return true; - } - deleteProperty(target, p2) { - return target.delete(p2); - } - static bindAllMethods(map3) { - map3.clear = map3.clear.bind(map3); - map3.delete = map3.delete.bind(map3); - map3.forEach = map3.forEach.bind(map3); - map3.get = map3.get.bind(map3); - map3.has = map3.has.bind(map3); - map3.set = map3.set.bind(map3); - map3.entries = map3.entries.bind(map3); - map3.keys = map3.keys.bind(map3); - map3.values = map3.values.bind(map3); - } -} -let LGraph$1 = class LGraph2 { - static { - __name(this, "LGraph"); - } - static serialisedSchemaVersion = 1; - // default supported types - static supported_types = ["number", "string", "boolean"]; - static STATUS_STOPPED = 1; - static STATUS_RUNNING = 2; - _version; - /** The backing store for links. Keys are wrapped in String() */ - _links = /* @__PURE__ */ new Map(); - /** - * Indexed property access is deprecated. - * Backwards compatibility with a Proxy has been added, but will eventually be removed. - * - * Use {@link Map} methods: - * ``` - * const linkId = 123 - * const link = graph.links.get(linkId) - * // Deprecated: const link = graph.links[linkId] - * ``` - */ - links; - list_of_graphcanvas; - status; - state; - _nodes; - _nodes_by_id; - _nodes_in_order; - _nodes_executable; - _groups; - iteration; - globaltime; - runningtime; - fixedtime; - fixedtime_lapse; - elapsed_time; - last_update_time; - starttime; - catch_errors; - execution_timer_id; - errors_in_execution; - execution_time; - _last_trigger_time; - filter; - _subgraph_node; - /** Must contain serialisable values, e.g. primitive types */ - config; - vars; - nodes_executing; - nodes_actioning; - nodes_executedAction; - extra; - inputs; - outputs; - /** @returns Whether the graph has no items */ - get empty() { - return this._nodes.length + this._groups.length + this.reroutes.size === 0; - } - /** @returns All items on the canvas that can be selected */ - *positionableItems() { - for (const node22 of this._nodes) yield node22; - for (const group of this._groups) yield group; - for (const reroute of this.reroutes.values()) yield reroute; - return; - } - #reroutes = /* @__PURE__ */ new Map(); - /** All reroutes in this graph. */ - get reroutes() { - return this.#reroutes; - } - set reroutes(value4) { - if (!value4) throw new TypeError("Attempted to set LGraph.reroutes to a falsy value."); - const reroutes = this.#reroutes; - if (value4.size === 0) { - reroutes.clear(); - return; - } - for (const rerouteId of reroutes.keys()) { - if (!value4.has(rerouteId)) reroutes.delete(rerouteId); - } - for (const [id3, reroute] of value4) { - reroutes.set(id3, reroute); - } - } - /** @deprecated See {@link state}.{@link LGraphState.lastNodeId lastNodeId} */ - get last_node_id() { - return this.state.lastNodeId; - } - set last_node_id(value4) { - this.state.lastNodeId = value4; - } - /** @deprecated See {@link state}.{@link LGraphState.lastLinkId lastLinkId} */ - get last_link_id() { - return this.state.lastLinkId; - } - set last_link_id(value4) { - this.state.lastLinkId = value4; - } - _input_nodes; - /** - * See {@link LGraph} - * @param o data from previous serialization [optional] - */ - constructor(o) { - if (LiteGraph.debug) console.log("Graph created"); - const links = this._links; - MapProxyHandler.bindAllMethods(links); - const handler6 = new MapProxyHandler(); - this.links = new Proxy(links, handler6); - this.list_of_graphcanvas = null; - this.clear(); - if (o) this.configure(o); - } - // TODO: Remove - // used to know which types of connections support this graph (some graphs do not allow certain types) - getSupportedTypes() { - return this.supported_types || LGraph2.supported_types; - } - /** - * Removes all nodes from this graph - */ - clear() { - this.stop(); - this.status = LGraph2.STATUS_STOPPED; - this.state = { - lastGroupId: 0, - lastNodeId: 0, - lastLinkId: 0, - lastRerouteId: 0 - }; - this._version = -1; - if (this._nodes) { - for (let i2 = 0; i2 < this._nodes.length; ++i2) { - this._nodes[i2].onRemoved?.(); - } - } - this._nodes = []; - this._nodes_by_id = {}; - this._nodes_in_order = []; - this._nodes_executable = null; - this._links.clear(); - this.reroutes.clear(); - this._groups = []; - this.iteration = 0; - this.config = {}; - this.vars = {}; - this.extra = {}; - this.globaltime = 0; - this.runningtime = 0; - this.fixedtime = 0; - this.fixedtime_lapse = 0.01; - this.elapsed_time = 0.01; - this.last_update_time = 0; - this.starttime = 0; - this.catch_errors = true; - this.nodes_executing = []; - this.nodes_actioning = []; - this.nodes_executedAction = []; - this.inputs = {}; - this.outputs = {}; - this.change(); - this.canvasAction((c) => c.clear()); - } - get nodes() { - return this._nodes; - } - get groups() { - return this._groups; - } - /** - * Attach Canvas to this graph - */ - attachCanvas(graphcanvas) { - if (graphcanvas.constructor != LGraphCanvas) - throw "attachCanvas expects a LGraphCanvas instance"; - if (graphcanvas.graph != this) - graphcanvas.graph?.detachCanvas(graphcanvas); - graphcanvas.graph = this; - this.list_of_graphcanvas ||= []; - this.list_of_graphcanvas.push(graphcanvas); - } - /** - * Detach Canvas from this graph - */ - detachCanvas(graphcanvas) { - if (!this.list_of_graphcanvas) return; - const pos2 = this.list_of_graphcanvas.indexOf(graphcanvas); - if (pos2 == -1) return; - graphcanvas.graph = null; - this.list_of_graphcanvas.splice(pos2, 1); - } - /** - * Starts running this graph every interval milliseconds. - * @param interval amount of milliseconds between executions, if 0 then it renders to the monitor refresh rate - */ - start(interval) { - if (this.status == LGraph2.STATUS_RUNNING) return; - this.status = LGraph2.STATUS_RUNNING; - this.onPlayEvent?.(); - this.sendEventToAllNodes("onStart"); - this.starttime = LiteGraph.getTime(); - this.last_update_time = this.starttime; - interval ||= 0; - const that = this; - if (interval == 0 && typeof window != "undefined" && window.requestAnimationFrame) { - let on_frame = /* @__PURE__ */ __name(function() { - if (that.execution_timer_id != -1) return; - window.requestAnimationFrame(on_frame); - that.onBeforeStep?.(); - that.runStep(1, !that.catch_errors); - that.onAfterStep?.(); - }, "on_frame"); - this.execution_timer_id = -1; - on_frame(); - } else { - this.execution_timer_id = setInterval(function() { - that.onBeforeStep?.(); - that.runStep(1, !that.catch_errors); - that.onAfterStep?.(); - }, interval); - } - } - /** - * Stops the execution loop of the graph - */ - stop() { - if (this.status == LGraph2.STATUS_STOPPED) return; - this.status = LGraph2.STATUS_STOPPED; - this.onStopEvent?.(); - if (this.execution_timer_id != null) { - if (this.execution_timer_id != -1) { - clearInterval(this.execution_timer_id); - } - this.execution_timer_id = null; - } - this.sendEventToAllNodes("onStop"); - } - /** - * Run N steps (cycles) of the graph - * @param num number of steps to run, default is 1 - * @param do_not_catch_errors [optional] if you want to try/catch errors - * @param limit max number of nodes to execute (used to execute from start to a node) - */ - runStep(num, do_not_catch_errors, limit) { - num = num || 1; - const start2 = LiteGraph.getTime(); - this.globaltime = 1e-3 * (start2 - this.starttime); - const nodes = this._nodes_executable ? this._nodes_executable : this._nodes; - if (!nodes) return; - limit = limit || nodes.length; - if (do_not_catch_errors) { - for (let i2 = 0; i2 < num; i2++) { - for (let j = 0; j < limit; ++j) { - const node22 = nodes[j]; - if (node22.mode == LGraphEventMode.ALWAYS && node22.onExecute) { - node22.doExecute?.(); - } - } - this.fixedtime += this.fixedtime_lapse; - this.onExecuteStep?.(); - } - this.onAfterExecute?.(); - } else { - try { - for (let i2 = 0; i2 < num; i2++) { - for (let j = 0; j < limit; ++j) { - const node22 = nodes[j]; - if (node22.mode == LGraphEventMode.ALWAYS) { - node22.onExecute?.(); - } - } - this.fixedtime += this.fixedtime_lapse; - this.onExecuteStep?.(); - } - this.onAfterExecute?.(); - this.errors_in_execution = false; - } catch (err) { - this.errors_in_execution = true; - if (LiteGraph.throw_errors) throw err; - if (LiteGraph.debug) console.log("Error during execution: " + err); - this.stop(); - } - } - const now2 = LiteGraph.getTime(); - let elapsed = now2 - start2; - if (elapsed == 0) elapsed = 1; - this.execution_time = 1e-3 * elapsed; - this.globaltime += 1e-3 * elapsed; - this.iteration += 1; - this.elapsed_time = (now2 - this.last_update_time) * 1e-3; - this.last_update_time = now2; - this.nodes_executing = []; - this.nodes_actioning = []; - this.nodes_executedAction = []; - } - /** - * Updates the graph execution order according to relevance of the nodes (nodes with only outputs have more relevance than - * nodes with only inputs. - */ - updateExecutionOrder() { - this._nodes_in_order = this.computeExecutionOrder(false); - this._nodes_executable = []; - for (let i2 = 0; i2 < this._nodes_in_order.length; ++i2) { - if (this._nodes_in_order[i2].onExecute) { - this._nodes_executable.push(this._nodes_in_order[i2]); - } - } - } - // This is more internal, it computes the executable nodes in order and returns it - computeExecutionOrder(only_onExecute, set_level) { - const L = []; - const S = []; - const M = {}; - const visited_links = {}; - const remaining_links = {}; - for (let i2 = 0, l2 = this._nodes.length; i2 < l2; ++i2) { - const node22 = this._nodes[i2]; - if (only_onExecute && !node22.onExecute) { - continue; - } - M[node22.id] = node22; - let num = 0; - if (node22.inputs) { - for (let j = 0, l22 = node22.inputs.length; j < l22; j++) { - if (node22.inputs[j]?.link != null) { - num += 1; - } - } - } - if (num == 0) { - S.push(node22); - if (set_level) node22._level = 1; - } else { - if (set_level) node22._level = 0; - remaining_links[node22.id] = num; - } - } - while (true) { - const node22 = S.shift(); - if (node22 === void 0) break; - L.push(node22); - delete M[node22.id]; - if (!node22.outputs) continue; - for (let i2 = 0; i2 < node22.outputs.length; i2++) { - const output = node22.outputs[i2]; - if (output?.links == null || output.links.length == 0) - continue; - for (let j = 0; j < output.links.length; j++) { - const link_id = output.links[j]; - const link2 = this._links.get(link_id); - if (!link2) continue; - if (visited_links[link2.id]) continue; - const target_node = this.getNodeById(link2.target_id); - if (target_node == null) { - visited_links[link2.id] = true; - continue; - } - if (set_level && (!target_node._level || target_node._level <= node22._level)) { - target_node._level = node22._level + 1; - } - visited_links[link2.id] = true; - remaining_links[target_node.id] -= 1; - if (remaining_links[target_node.id] == 0) S.push(target_node); - } - } - } - for (const i2 in M) { - L.push(M[i2]); - } - if (L.length != this._nodes.length && LiteGraph.debug) - console.warn("something went wrong, nodes missing"); - L.length; - function setOrder(nodes) { - const l2 = nodes.length; - for (let i2 = 0; i2 < l2; ++i2) { - nodes[i2].order = i2; - } - } - __name(setOrder, "setOrder"); - setOrder(L); - L.sort(function(A, B) { - const Ap = A.constructor.priority || A.priority || 0; - const Bp = B.constructor.priority || B.priority || 0; - return Ap == Bp ? A.order - B.order : Ap - Bp; - }); - setOrder(L); - return L; - } - /** - * Returns all the nodes that could affect this one (ancestors) by crawling all the inputs recursively. - * It doesn't include the node itself - * @returns an array with all the LGraphNodes that affect this node, in order of execution - */ - getAncestors(node22) { - const ancestors = []; - const pending = [node22]; - const visited = {}; - while (pending.length) { - const current = pending.shift(); - if (!current?.inputs) continue; - if (!visited[current.id] && current != node22) { - visited[current.id] = true; - ancestors.push(current); - } - for (let i2 = 0; i2 < current.inputs.length; ++i2) { - const input = current.getInputNode(i2); - if (input && ancestors.indexOf(input) == -1) { - pending.push(input); - } - } - } - ancestors.sort(function(a, b) { - return a.order - b.order; - }); - return ancestors; - } - /** - * Positions every node in a more readable manner - */ - arrange(margin, layout) { - margin = margin || 100; - const nodes = this.computeExecutionOrder(false, true); - const columns = []; - for (let i2 = 0; i2 < nodes.length; ++i2) { - const node22 = nodes[i2]; - const col = node22._level || 1; - columns[col] ||= []; - columns[col].push(node22); - } - let x2 = margin; - for (let i2 = 0; i2 < columns.length; ++i2) { - const column = columns[i2]; - if (!column) continue; - let max_size = 100; - let y2 = margin + LiteGraph.NODE_TITLE_HEIGHT; - for (let j = 0; j < column.length; ++j) { - const node22 = column[j]; - node22.pos[0] = layout == LiteGraph.VERTICAL_LAYOUT ? y2 : x2; - node22.pos[1] = layout == LiteGraph.VERTICAL_LAYOUT ? x2 : y2; - const max_size_index = layout == LiteGraph.VERTICAL_LAYOUT ? 1 : 0; - if (node22.size[max_size_index] > max_size) { - max_size = node22.size[max_size_index]; - } - const node_size_index = layout == LiteGraph.VERTICAL_LAYOUT ? 0 : 1; - y2 += node22.size[node_size_index] + margin + LiteGraph.NODE_TITLE_HEIGHT; - } - x2 += max_size + margin; - } - this.setDirtyCanvas(true, true); - } - /** - * Returns the amount of time the graph has been running in milliseconds - * @returns number of milliseconds the graph has been running - */ - getTime() { - return this.globaltime; - } - /** - * Returns the amount of time accumulated using the fixedtime_lapse var. - * This is used in context where the time increments should be constant - * @returns number of milliseconds the graph has been running - */ - getFixedTime() { - return this.fixedtime; - } - /** - * Returns the amount of time it took to compute the latest iteration. - * Take into account that this number could be not correct - * if the nodes are using graphical actions - * @returns number of milliseconds it took the last cycle - */ - getElapsedTime() { - return this.elapsed_time; - } - /** - * Sends an event to all the nodes, useful to trigger stuff - * @param eventname the name of the event (function to be called) - * @param params parameters in array format - */ - sendEventToAllNodes(eventname, params, mode2) { - mode2 = mode2 || LGraphEventMode.ALWAYS; - const nodes = this._nodes_in_order ? this._nodes_in_order : this._nodes; - if (!nodes) return; - for (let j = 0, l = nodes.length; j < l; ++j) { - const node22 = nodes[j]; - if (node22.constructor === LiteGraph.Subgraph && eventname != "onExecute") { - if (node22.mode == mode2) { - node22.sendEventToAllNodes(eventname, params, mode2); - } - continue; - } - if (!node22[eventname] || node22.mode != mode2) continue; - if (params === void 0) { - node22[eventname](); - } else if (params && params.constructor === Array) { - node22[eventname].apply(node22, params); - } else { - node22[eventname](params); - } - } - } - /** - * Runs an action on every canvas registered to this graph. - * @param action Action to run for every canvas - */ - canvasAction(action) { - this.list_of_graphcanvas?.forEach(action); - } - /** @deprecated See {@link LGraph.canvasAction} */ - sendActionToCanvas(action, params) { - if (!this.list_of_graphcanvas) return; - for (let i2 = 0; i2 < this.list_of_graphcanvas.length; ++i2) { - const c = this.list_of_graphcanvas[i2]; - c[action]?.apply(c, params); - } - } - /** - * Adds a new node instance to this graph - * @param node the instance of the node - */ - add(node22, skip_compute_order) { - if (!node22) return; - const { state } = this; - if (LiteGraph.alwaysSnapToGrid) { - const snapTo = this.getSnapToGridSize(); - if (snapTo) node22.snapToGrid(snapTo); - } - if (node22 instanceof LGraphGroup) { - if (node22.id == null || node22.id === -1) node22.id = ++state.lastGroupId; - if (node22.id > state.lastGroupId) state.lastGroupId = node22.id; - this._groups.push(node22); - this.setDirtyCanvas(true); - this.change(); - node22.graph = this; - this._version++; - return; - } - if (node22.id != -1 && this._nodes_by_id[node22.id] != null) { - console.warn( - "LiteGraph: there is already a node with this ID, changing it" - ); - node22.id = LiteGraph.use_uuids ? LiteGraph.uuidv4() : ++state.lastNodeId; - } - if (this._nodes.length >= LiteGraph.MAX_NUMBER_OF_NODES) { - throw "LiteGraph: max number of nodes in a graph reached"; - } - if (LiteGraph.use_uuids) { - if (node22.id == null || node22.id == -1) - node22.id = LiteGraph.uuidv4(); - } else { - if (node22.id == null || node22.id == -1) { - node22.id = ++state.lastNodeId; - } else if (typeof node22.id === "number" && state.lastNodeId < node22.id) { - state.lastNodeId = node22.id; - } - } - node22.graph = this; - this._version++; - this._nodes.push(node22); - this._nodes_by_id[node22.id] = node22; - node22.onAdded?.(this); - if (this.config.align_to_grid) node22.alignToGrid(); - if (!skip_compute_order) this.updateExecutionOrder(); - this.onNodeAdded?.(node22); - this.setDirtyCanvas(true); - this.change(); - return node22; - } - /** - * Removes a node from the graph - * @param node the instance of the node - */ - remove(node22) { - if (node22 instanceof LGraphGroup) { - const index2 = this._groups.indexOf(node22); - if (index2 != -1) { - this._groups.splice(index2, 1); - } - node22.graph = null; - this._version++; - this.setDirtyCanvas(true, true); - this.change(); - return; - } - if (this._nodes_by_id[node22.id] == null) return; - if (node22.ignore_remove) return; - this.beforeChange(); - if (node22.inputs) { - for (let i2 = 0; i2 < node22.inputs.length; i2++) { - const slot = node22.inputs[i2]; - if (slot.link != null) node22.disconnectInput(i2); - } - } - if (node22.outputs) { - for (let i2 = 0; i2 < node22.outputs.length; i2++) { - const slot = node22.outputs[i2]; - if (slot.links?.length) node22.disconnectOutput(i2); - } - } - node22.onRemoved?.(); - node22.graph = null; - this._version++; - if (this.list_of_graphcanvas) { - for (let i2 = 0; i2 < this.list_of_graphcanvas.length; ++i2) { - const canvas = this.list_of_graphcanvas[i2]; - if (canvas.selected_nodes[node22.id]) - delete canvas.selected_nodes[node22.id]; - } - } - const pos2 = this._nodes.indexOf(node22); - if (pos2 != -1) this._nodes.splice(pos2, 1); - delete this._nodes_by_id[node22.id]; - this.onNodeRemoved?.(node22); - this.canvasAction((c) => c.checkPanels()); - this.setDirtyCanvas(true, true); - this.afterChange(); - this.change(); - this.updateExecutionOrder(); - } - /** - * Returns a node by its id. - */ - getNodeById(id3) { - return id3 != null ? this._nodes_by_id[id3] : null; - } - /** - * Returns a list of nodes that matches a class - * @param classObject the class itself (not an string) - * @returns a list with all the nodes of this type - */ - // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type - findNodesByClass(classObject, result) { - result = result || []; - result.length = 0; - for (let i2 = 0, l = this._nodes.length; i2 < l; ++i2) { - if (this._nodes[i2].constructor === classObject) - result.push(this._nodes[i2]); - } - return result; - } - /** - * Returns a list of nodes that matches a type - * @param type the name of the node type - * @returns a list with all the nodes of this type - */ - findNodesByType(type, result) { - const matchType = type.toLowerCase(); - result = result || []; - result.length = 0; - for (let i2 = 0, l = this._nodes.length; i2 < l; ++i2) { - if (this._nodes[i2].type?.toLowerCase() == matchType) - result.push(this._nodes[i2]); - } - return result; - } - /** - * Returns the first node that matches a name in its title - * @param title the name of the node to search - * @returns the node or null - */ - findNodeByTitle(title) { - for (let i2 = 0, l = this._nodes.length; i2 < l; ++i2) { - if (this._nodes[i2].title == title) - return this._nodes[i2]; - } - return null; - } - /** - * Returns a list of nodes that matches a name - * @param title the name of the node to search - * @returns a list with all the nodes with this name - */ - findNodesByTitle(title) { - const result = []; - for (let i2 = 0, l = this._nodes.length; i2 < l; ++i2) { - if (this._nodes[i2].title == title) - result.push(this._nodes[i2]); - } - return result; - } - /** - * Returns the top-most node in this position of the canvas - * @param x the x coordinate in canvas space - * @param y the y coordinate in canvas space - * @param nodeList a list with all the nodes to search from, by default is all the nodes in the graph - * @returns the node at this position or null - */ - getNodeOnPos(x2, y2, nodeList) { - const nodes = nodeList || this._nodes; - let i2 = nodes.length; - while (--i2 >= 0) { - const node22 = nodes[i2]; - if (node22.isPointInside(x2, y2)) return node22; - } - return null; - } - /** - * Returns the top-most group in that position - * @param x The x coordinate in canvas space - * @param y The y coordinate in canvas space - * @returns The group or null - */ - getGroupOnPos(x2, y2) { - return this._groups.toReversed().find((g2) => g2.isPointInside(x2, y2)); - } - /** - * Returns the top-most group with a titlebar in the provided position. - * @param x The x coordinate in canvas space - * @param y The y coordinate in canvas space - * @returns The group or null - */ - getGroupTitlebarOnPos(x2, y2) { - return this._groups.toReversed().find((g2) => g2.isPointInTitlebar(x2, y2)); - } - /** - * Finds a reroute a the given graph point - * @param x X co-ordinate in graph space - * @param y Y co-ordinate in graph space - * @returns The first reroute under the given co-ordinates, or undefined - */ - getRerouteOnPos(x2, y2) { - for (const reroute of this.reroutes.values()) { - const { pos: pos2 } = reroute; - if (isSortaInsideOctagon(x2 - pos2[0], y2 - pos2[1], 2 * Reroute.radius)) - return reroute; - } - } - /** - * Snaps the provided items to a grid. - * - * Item positions are reounded to the nearest multiple of {@link LiteGraph.CANVAS_GRID_SIZE}. - * - * When {@link LiteGraph.alwaysSnapToGrid} is enabled - * and the grid size is falsy, a default of 1 is used. - * @param items The items to be snapped to the grid - * @todo Currently only snaps nodes. - */ - snapToGrid(items2) { - const snapTo = this.getSnapToGridSize(); - if (!snapTo) return; - getAllNestedItems(items2).forEach((item3) => { - if (!item3.pinned) item3.snapToGrid(snapTo); - }); - } - /** - * Finds the size of the grid that items should be snapped to when moved. - * @returns The size of the grid that items should be snapped to - */ - getSnapToGridSize() { - return LiteGraph.alwaysSnapToGrid ? LiteGraph.CANVAS_GRID_SIZE || 1 : LiteGraph.CANVAS_GRID_SIZE; - } - /** - * Checks that the node type matches the node type registered, - * used when replacing a nodetype by a newer version during execution - * this replaces the ones using the old version with the new version - */ - checkNodeTypes() { - for (let i2 = 0; i2 < this._nodes.length; i2++) { - const node22 = this._nodes[i2]; - const ctor = LiteGraph.registered_node_types[node22.type]; - if (node22.constructor == ctor) continue; - console.log("node being replaced by newer version: " + node22.type); - const newnode = LiteGraph.createNode(node22.type); - this._nodes[i2] = newnode; - newnode.configure(node22.serialize()); - newnode.graph = this; - this._nodes_by_id[newnode.id] = newnode; - if (node22.inputs) newnode.inputs = node22.inputs.concat(); - if (node22.outputs) newnode.outputs = node22.outputs.concat(); - } - this.updateExecutionOrder(); - } - // ********** GLOBALS ***************** - onAction(action, param, options4) { - this._input_nodes = this.findNodesByClass( - // @ts-expect-error Never impl. - LiteGraph.GraphInput, - this._input_nodes - ); - for (let i2 = 0; i2 < this._input_nodes.length; ++i2) { - const node22 = this._input_nodes[i2]; - if (node22.properties.name != action) continue; - node22.actionDo(action, param, options4); - break; - } - } - trigger(action, param) { - this.onTrigger?.(action, param); - } - /** - * Tell this graph it has a global graph input of this type - */ - addInput(name2, type, value4) { - const input = this.inputs[name2]; - if (input) return; - this.beforeChange(); - this.inputs[name2] = { name: name2, type, value: value4 }; - this._version++; - this.afterChange(); - this.onInputAdded?.(name2, type); - this.onInputsOutputsChange?.(); - } - /** - * Assign a data to the global graph input - */ - setInputData(name2, data24) { - const input = this.inputs[name2]; - if (!input) return; - input.value = data24; - } - /** - * Returns the current value of a global graph input - */ - getInputData(name2) { - const input = this.inputs[name2]; - return input ? input.value : null; - } - /** - * Changes the name of a global graph input - */ - renameInput(old_name, name2) { - if (name2 == old_name) return; - if (!this.inputs[old_name]) return false; - if (this.inputs[name2]) { - console.error("there is already one input with that name"); - return false; - } - this.inputs[name2] = this.inputs[old_name]; - delete this.inputs[old_name]; - this._version++; - this.onInputRenamed?.(old_name, name2); - this.onInputsOutputsChange?.(); - } - /** - * Changes the type of a global graph input - */ - changeInputType(name2, type) { - if (!this.inputs[name2]) return false; - if (this.inputs[name2].type && String(this.inputs[name2].type).toLowerCase() == String(type).toLowerCase()) { - return; - } - this.inputs[name2].type = type; - this._version++; - this.onInputTypeChanged?.(name2, type); - } - /** - * Removes a global graph input - */ - removeInput(name2) { - if (!this.inputs[name2]) return false; - delete this.inputs[name2]; - this._version++; - this.onInputRemoved?.(name2); - this.onInputsOutputsChange?.(); - return true; - } - /** - * Creates a global graph output - */ - addOutput(name2, type, value4) { - this.outputs[name2] = { name: name2, type, value: value4 }; - this._version++; - this.onOutputAdded?.(name2, type); - this.onInputsOutputsChange?.(); - } - /** - * Assign a data to the global output - */ - setOutputData(name2, value4) { - const output = this.outputs[name2]; - if (!output) return; - output.value = value4; - } - /** - * Returns the current value of a global graph output - */ - getOutputData(name2) { - const output = this.outputs[name2]; - if (!output) return null; - return output.value; - } - /** - * Renames a global graph output - */ - renameOutput(old_name, name2) { - if (!this.outputs[old_name]) return false; - if (this.outputs[name2]) { - console.error("there is already one output with that name"); - return false; - } - this.outputs[name2] = this.outputs[old_name]; - delete this.outputs[old_name]; - this._version++; - this.onOutputRenamed?.(old_name, name2); - this.onInputsOutputsChange?.(); - } - /** - * Changes the type of a global graph output - */ - changeOutputType(name2, type) { - if (!this.outputs[name2]) return false; - if (this.outputs[name2].type && String(this.outputs[name2].type).toLowerCase() == String(type).toLowerCase()) { - return; - } - this.outputs[name2].type = type; - this._version++; - this.onOutputTypeChanged?.(name2, type); - } - /** - * Removes a global graph output - */ - removeOutput(name2) { - if (!this.outputs[name2]) return false; - delete this.outputs[name2]; - this._version++; - this.onOutputRemoved?.(name2); - this.onInputsOutputsChange?.(); - return true; - } - /** @todo Clean up - never implemented. */ - triggerInput(name2, value4) { - const nodes = this.findNodesByTitle(name2); - for (let i2 = 0; i2 < nodes.length; ++i2) { - nodes[i2].onTrigger(value4); - } - } - /** @todo Clean up - never implemented. */ - setCallback(name2, func) { - const nodes = this.findNodesByTitle(name2); - for (let i2 = 0; i2 < nodes.length; ++i2) { - nodes[i2].setTrigger(func); - } - } - // used for undo, called before any change is made to the graph - beforeChange(info) { - this.onBeforeChange?.(this, info); - this.canvasAction((c) => c.onBeforeChange?.(this)); - } - // used to resend actions, called after any change is made to the graph - afterChange(info) { - this.onAfterChange?.(this, info); - this.canvasAction((c) => c.onAfterChange?.(this)); - } - connectionChange(node22) { - this.updateExecutionOrder(); - this.onConnectionChange?.(node22); - this._version++; - this.canvasAction((c) => c.onConnectionChange?.()); - } - /** - * clears the triggered slot animation in all links (stop visual animation) - */ - clearTriggeredSlots() { - for (const link_info of this._links.values()) { - if (!link_info) continue; - if (link_info._last_time) link_info._last_time = 0; - } - } - /* Called when something visually changed (not the graph!) */ - change() { - if (LiteGraph.debug) { - console.log("Graph changed"); - } - this.canvasAction((c) => c.setDirty(true, true)); - this.on_change?.(this); - } - setDirtyCanvas(fg, bg) { - this.canvasAction((c) => c.setDirty(fg, bg)); - } - /** - * Configures a reroute on the graph where ID is already known (probably deserialisation). - * Creates the object if it does not exist. - * @param serialisedReroute See {@link SerialisableReroute} - */ - setReroute({ id: id3, parentId, pos: pos2, linkIds }) { - id3 ??= ++this.state.lastRerouteId; - if (id3 > this.state.lastRerouteId) this.state.lastRerouteId = id3; - const reroute = this.reroutes.get(id3) ?? new Reroute(id3, this); - reroute.update(parentId, pos2, linkIds); - this.reroutes.set(id3, reroute); - return reroute; - } - /** - * Creates a new reroute and adds it to the graph. - * @param pos Position in graph space - * @param before The existing link segment (reroute, link) that will be after this reroute, - * going from the node output to input. - * @returns The newly created reroute - typically ignored. - */ - createReroute(pos2, before) { - const rerouteId = ++this.state.lastRerouteId; - const linkIds = before instanceof Reroute ? before.linkIds : [before.id]; - const reroute = new Reroute(rerouteId, this, pos2, before.parentId, linkIds); - this.reroutes.set(rerouteId, reroute); - for (const linkId of linkIds) { - const link2 = this._links.get(linkId); - if (!link2) continue; - if (link2.parentId === before.parentId) link2.parentId = rerouteId; - LLink.getReroutes(this, link2)?.filter((x2) => x2.parentId === before.parentId).forEach((x2) => x2.parentId = rerouteId); - } - return reroute; - } - /** - * Removes a reroute from the graph - * @param id ID of reroute to remove - */ - removeReroute(id3) { - const { reroutes } = this; - const reroute = reroutes.get(id3); - if (!reroute) return; - const { parentId, linkIds } = reroute; - for (const reroute2 of reroutes.values()) { - if (reroute2.parentId === id3) reroute2.parentId = parentId; - } - for (const linkId of linkIds) { - const link2 = this._links.get(linkId); - if (link2 && link2.parentId === id3) link2.parentId = parentId; - } - reroutes.delete(id3); - this.setDirtyCanvas(false, true); - } - /** - * Destroys a link - */ - removeLink(link_id) { - const link2 = this._links.get(link_id); - if (!link2) return; - const node22 = this.getNodeById(link2.target_id); - node22?.disconnectInput(link2.target_slot); - link2.disconnect(this); - } - /** - * Creates a Object containing all the info about this graph, it can be serialized - * @deprecated Use {@link asSerialisable}, which returns the newer schema version. - * @returns value of the node - */ - serialize(option3) { - const { config: config2, state, groups, nodes, reroutes, extra } = this.asSerialisable(option3); - const linkArray = [...this._links.values()]; - const links = linkArray.map((x2) => x2.serialize()); - if (reroutes.length) { - extra.reroutes = reroutes; - extra.linkExtensions = linkArray.filter((x2) => x2.parentId !== void 0).map((x2) => ({ id: x2.id, parentId: x2.parentId })); - } - return { - last_node_id: state.lastNodeId, - last_link_id: state.lastLinkId, - nodes, - links, - groups, - config: config2, - extra, - version: LiteGraph.VERSION - }; - } - /** - * Prepares a shallow copy of this object for immediate serialisation or structuredCloning. - * The return value should be discarded immediately. - * @param options Serialise options = currently `sortNodes: boolean`, whether to sort nodes by ID. - * @returns A shallow copy of parts of this graph, with shallow copies of its serialisable objects. - * Mutating the properties of the return object may result in changes to your graph. - * It is intended for use with {@link structuredClone} or {@link JSON.stringify}. - */ - asSerialisable(options4) { - const { config: config2, state, extra } = this; - const nodeList = !LiteGraph.use_uuids && options4?.sortNodes ? [...this._nodes].sort((a, b) => a.id - b.id) : this._nodes; - const nodes = nodeList.map((node22) => node22.serialize()); - const groups = this._groups.map((x2) => x2.serialize()); - const links = [...this._links.values()].map((x2) => x2.asSerialisable()); - const reroutes = [...this.reroutes.values()].map((x2) => x2.asSerialisable()); - const data24 = { - version: LGraph2.serialisedSchemaVersion, - config: config2, - state, - groups, - nodes, - links, - reroutes, - extra - }; - this.onSerialize?.(data24); - return data24; - } - /** - * Configure a graph from a JSON string - * @param data The deserialised object to configure this graph from - * @param keep_old If `true`, the graph will not be cleared prior to - * adding the configuration. - */ - configure(data24, keep_old) { - if (!data24) return; - if (!keep_old) this.clear(); - const { extra } = data24; - let reroutes; - if (data24.version === 0.4) { - if (Array.isArray(data24.links)) { - for (const linkData of data24.links) { - const link2 = LLink.createFromArray(linkData); - this._links.set(link2.id, link2); - } - } - if (Array.isArray(extra?.linkExtensions)) { - for (const linkEx of extra.linkExtensions) { - const link2 = this._links.get(linkEx.id); - if (link2) link2.parentId = linkEx.parentId; - } - } - reroutes = extra?.reroutes; - } else { - if (data24.state) { - const { state: { lastGroupId, lastLinkId, lastNodeId, lastRerouteId } } = data24; - if (lastGroupId != null) this.state.lastGroupId = lastGroupId; - if (lastLinkId != null) this.state.lastLinkId = lastLinkId; - if (lastNodeId != null) this.state.lastNodeId = lastNodeId; - if (lastRerouteId != null) this.state.lastRerouteId = lastRerouteId; - } - if (Array.isArray(data24.links)) { - for (const linkData of data24.links) { - const link2 = LLink.create(linkData); - this._links.set(link2.id, link2); - } - } - reroutes = data24.reroutes; - } - if (Array.isArray(reroutes)) { - for (const rerouteData of reroutes) { - const reroute = this.setReroute(rerouteData); - if (!reroute.validateLinks(this._links)) - this.reroutes.delete(rerouteData.id); - } - } - const nodesData = data24.nodes; - for (const i2 in data24) { - if (i2 == "nodes" || i2 == "groups" || i2 == "links" || i2 === "state" || i2 === "reroutes") - continue; - this[i2] = data24[i2]; - } - let error2 = false; - this._nodes = []; - if (nodesData) { - for (let i2 = 0, l = nodesData.length; i2 < l; ++i2) { - const n_info = nodesData[i2]; - let node22 = LiteGraph.createNode(n_info.type, n_info.title); - if (!node22) { - if (LiteGraph.debug) console.log("Node not found or has errors: " + n_info.type); - node22 = new LGraphNode(void 0); - node22.last_serialization = n_info; - node22.has_errors = true; - error2 = true; - } - node22.id = n_info.id; - this.add(node22, true); - } - for (let i2 = 0, l = nodesData.length; i2 < l; ++i2) { - const n_info = nodesData[i2]; - const node22 = this.getNodeById(n_info.id); - node22?.configure(n_info); - } - } - this._groups.length = 0; - if (data24.groups) { - for (let i2 = 0; i2 < data24.groups.length; ++i2) { - const group = new LiteGraph.LGraphGroup(); - group.configure(data24.groups[i2]); - this.add(group); - } - } - this.updateExecutionOrder(); - this.extra = data24.extra || {}; - this.onConfigure?.(data24); - this._version++; - this.setDirtyCanvas(true, true); - return error2; - } - load(url, callback) { - const that = this; - if (url instanceof Blob || url instanceof File) { - const reader = new FileReader(); - reader.addEventListener("load", function(event) { - const data24 = JSON.parse(event.target.result.toString()); - that.configure(data24); - callback?.(); - }); - reader.readAsText(url); - return; - } - const req = new XMLHttpRequest(); - req.open("GET", url, true); - req.send(null); - req.onload = function() { - if (req.status !== 200) { - console.error("Error loading graph:", req.status, req.response); - return; - } - const data24 = JSON.parse(req.response); - that.configure(data24); - callback?.(); - }; - req.onerror = function(err) { - console.error("Error loading graph:", err); - }; - } - onNodeTrace(node22, msg) { - } -}; -class ContextMenu { - static { - __name(this, "ContextMenu"); - } - options; - parentMenu; - root; - current_submenu; - lock; - /** - * @todo Interface for values requires functionality change - currently accepts - * an array of strings, functions, objects, nulls, or undefined. - * @param values (allows object { title: "Nice text", callback: function ... }) - * @param options [optional] Some options:\ - * - title: title to show on top of the menu - * - callback: function to call when an option is clicked, it receives the item information - * - ignore_item_callbacks: ignores the callback inside the item, it just calls the options.callback - * - event: you can pass a MouseEvent, this way the ContextMenu appears in that position - */ - constructor(values, options4) { - options4 ||= {}; - this.options = options4; - const parent = options4.parentMenu; - if (parent) { - if (!(parent instanceof ContextMenu)) { - console.error("parentMenu must be of class ContextMenu, ignoring it"); - options4.parentMenu = null; - } else { - this.parentMenu = parent; - this.parentMenu.lock = true; - this.parentMenu.current_submenu = this; - } - if (parent.options?.className === "dark") { - options4.className = "dark"; - } - } - const eventClass = options4.event ? options4.event.constructor.name : null; - if (eventClass !== "MouseEvent" && eventClass !== "CustomEvent" && eventClass !== "PointerEvent") { - console.error(`Event passed to ContextMenu is not of type MouseEvent or CustomEvent. Ignoring it. (${eventClass})`); - options4.event = null; - } - const root24 = document.createElement("div"); - let classes2 = "litegraph litecontextmenu litemenubar-panel"; - if (options4.className) classes2 += " " + options4.className; - root24.className = classes2; - root24.style.minWidth = "100"; - root24.style.minHeight = "100"; - root24.style.pointerEvents = "none"; - setTimeout(function() { - root24.style.pointerEvents = "auto"; - }, 100); - LiteGraph.pointerListenerAdd( - root24, - "up", - function(e2) { - e2.preventDefault(); - return true; - }, - true - ); - root24.addEventListener( - "contextmenu", - function(e2) { - if (e2.button != 2) return false; - e2.preventDefault(); - return false; - }, - true - ); - LiteGraph.pointerListenerAdd( - root24, - "down", - (e2) => { - if (e2.button == 2) { - this.close(); - e2.preventDefault(); - return true; - } - }, - true - ); - this.root = root24; - if (options4.title) { - const element = document.createElement("div"); - element.className = "litemenu-title"; - element.innerHTML = options4.title; - root24.appendChild(element); - } - for (let i2 = 0; i2 < values.length; i2++) { - const value4 = values[i2]; - let name2 = Array.isArray(values) ? value4 : String(i2); - if (typeof name2 !== "string") { - name2 = name2 != null ? name2.content === void 0 ? String(name2) : name2.content : name2; - } - this.addItem(name2, value4, options4); - } - LiteGraph.pointerListenerAdd(root24, "enter", function() { - if (root24.closing_timer) { - clearTimeout(root24.closing_timer); - } - }); - const ownerDocument = (options4.event?.target).ownerDocument; - const root_document = ownerDocument || document; - if (root_document.fullscreenElement) - root_document.fullscreenElement.appendChild(root24); - else - root_document.body.appendChild(root24); - let left = options4.left || 0; - let top = options4.top || 0; - if (options4.event) { - left = options4.event.clientX - 10; - top = options4.event.clientY - 10; - if (options4.title) top -= 20; - if (parent) { - const rect = parent.root.getBoundingClientRect(); - left = rect.left + rect.width; - } - const body_rect = document.body.getBoundingClientRect(); - const root_rect = root24.getBoundingClientRect(); - if (body_rect.height == 0) - console.error("document.body height is 0. That is dangerous, set html,body { height: 100%; }"); - if (body_rect.width && left > body_rect.width - root_rect.width - 10) - left = body_rect.width - root_rect.width - 10; - if (body_rect.height && top > body_rect.height - root_rect.height - 10) - top = body_rect.height - root_rect.height - 10; - } - root24.style.left = left + "px"; - root24.style.top = top + "px"; - if (options4.scale) root24.style.transform = `scale(${Math.round(options4.scale * 4) * 0.25})`; - } - addItem(name2, value4, options4) { - options4 ||= {}; - const element = document.createElement("div"); - element.className = "litemenu-entry submenu"; - let disabled2 = false; - if (value4 === null) { - element.classList.add("separator"); - } else { - if (typeof value4 === "string") { - element.innerHTML = name2; - } else { - element.innerHTML = value4?.title ?? name2; - if (value4.disabled) { - disabled2 = true; - element.classList.add("disabled"); - element.setAttribute("aria-disabled", "true"); - } - if (value4.submenu || value4.has_submenu) { - element.classList.add("has_submenu"); - element.setAttribute("aria-haspopup", "true"); - element.setAttribute("aria-expanded", "false"); - } - if (value4.className) element.className += " " + value4.className; - } - element.value = value4; - element.setAttribute("role", "menuitem"); - if (typeof value4 === "function") { - element.dataset["value"] = name2; - element.onclick_callback = value4; - } else { - element.dataset["value"] = String(value4); - } - } - this.root.appendChild(element); - if (!disabled2) element.addEventListener("click", inner_onclick); - if (!disabled2 && options4.autoopen) - LiteGraph.pointerListenerAdd(element, "enter", inner_over); - const setAriaExpanded = /* @__PURE__ */ __name(() => { - const entries = this.root.querySelectorAll("div.litemenu-entry.has_submenu"); - if (entries) { - for (let i2 = 0; i2 < entries.length; i2++) { - entries[i2].setAttribute("aria-expanded", "false"); - } - } - element.setAttribute("aria-expanded", "true"); - }, "setAriaExpanded"); - function inner_over(e2) { - const value22 = this.value; - if (!value22 || !value22.has_submenu) return; - inner_onclick.call(this, e2); - setAriaExpanded(); - } - __name(inner_over, "inner_over"); - const that = this; - function inner_onclick(e2) { - const value22 = this.value; - let close_parent = true; - that.current_submenu?.close(e2); - if (value22?.has_submenu || value22?.submenu) { - setAriaExpanded(); - } - if (options4.callback) { - const r = options4.callback.call( - this, - value22, - options4, - e2, - that, - options4.node - ); - if (r === true) close_parent = false; - } - if (typeof value22 === "object") { - if (value22.callback && !options4.ignore_item_callbacks && value22.disabled !== true) { - const r = value22.callback.call( - this, - value22, - options4, - e2, - that, - options4.extra - ); - if (r === true) close_parent = false; - } - if (value22.submenu) { - if (!value22.submenu.options) throw "ContextMenu submenu needs options"; - new that.constructor(value22.submenu.options, { - callback: value22.submenu.callback, - event: e2, - parentMenu: that, - ignore_item_callbacks: value22.submenu.ignore_item_callbacks, - title: value22.submenu.title, - extra: value22.submenu.extra, - autoopen: options4.autoopen - }); - close_parent = false; - } - } - if (close_parent && !that.lock) that.close(); - } - __name(inner_onclick, "inner_onclick"); - return element; - } - close(e2, ignore_parent_menu) { - this.root.remove(); - if (this.parentMenu && !ignore_parent_menu) { - this.parentMenu.lock = false; - this.parentMenu.current_submenu = null; - if (e2 === void 0) { - this.parentMenu.close(); - } else if (e2 && !ContextMenu.isCursorOverElement(e2, this.parentMenu.root)) { - ContextMenu.trigger( - this.parentMenu.root, - LiteGraph.pointerevents_method + "leave", - e2 - ); - } - } - this.current_submenu?.close(e2, true); - if (this.root.closing_timer) clearTimeout(this.root.closing_timer); - } - // this code is used to trigger events easily (used in the context menu mouseleave - static trigger(element, event_name, params, origin2) { - const evt = document.createEvent("CustomEvent"); - evt.initCustomEvent(event_name, true, true, params); - if (element.dispatchEvent) element.dispatchEvent(evt); - else if (element.__events) element.__events.dispatchEvent(evt); - return evt; - } - // returns the top most menu - getTopMenu() { - return this.options.parentMenu ? this.options.parentMenu.getTopMenu() : this; - } - getFirstEvent() { - return this.options.parentMenu ? this.options.parentMenu.getFirstEvent() : this.options.event; - } - static isCursorOverElement(event, element) { - const left = event.clientX; - const top = event.clientY; - const rect = element.getBoundingClientRect(); - if (!rect) return false; - if (top > rect.top && top < rect.top + rect.height && left > rect.left && left < rect.left + rect.width) { - return true; - } - return false; - } -} -class CurveEditor { - static { - __name(this, "CurveEditor"); - } - points; - selected; - nearest; - size; - must_update; - margin; - _nearest; - constructor(points) { - this.points = points; - this.selected = -1; - this.nearest = -1; - this.size = null; - this.must_update = true; - this.margin = 5; - } - static sampleCurve(f, points) { - if (!points) return; - for (let i2 = 0; i2 < points.length - 1; ++i2) { - const p2 = points[i2]; - const pn = points[i2 + 1]; - if (pn[0] < f) continue; - const r = pn[0] - p2[0]; - if (Math.abs(r) < 1e-5) return p2[1]; - const local_f = (f - p2[0]) / r; - return p2[1] * (1 - local_f) + pn[1] * local_f; - } - return 0; - } - draw(ctx, size2, graphcanvas, background_color, line_color, inactive = false) { - const points = this.points; - if (!points) return; - this.size = size2; - const w = size2[0] - this.margin * 2; - const h2 = size2[1] - this.margin * 2; - line_color = line_color || "#666"; - ctx.save(); - ctx.translate(this.margin, this.margin); - if (background_color) { - ctx.fillStyle = "#111"; - ctx.fillRect(0, 0, w, h2); - ctx.fillStyle = "#222"; - ctx.fillRect(w * 0.5, 0, 1, h2); - ctx.strokeStyle = "#333"; - ctx.strokeRect(0, 0, w, h2); - } - ctx.strokeStyle = line_color; - if (inactive) ctx.globalAlpha = 0.5; - ctx.beginPath(); - for (let i2 = 0; i2 < points.length; ++i2) { - const p2 = points[i2]; - ctx.lineTo(p2[0] * w, (1 - p2[1]) * h2); - } - ctx.stroke(); - ctx.globalAlpha = 1; - if (!inactive) - for (let i2 = 0; i2 < points.length; ++i2) { - const p2 = points[i2]; - ctx.fillStyle = this.selected == i2 ? "#FFF" : this.nearest == i2 ? "#DDD" : "#AAA"; - ctx.beginPath(); - ctx.arc(p2[0] * w, (1 - p2[1]) * h2, 2, 0, Math.PI * 2); - ctx.fill(); - } - ctx.restore(); - } - // localpos is mouse in curve editor space - onMouseDown(localpos, graphcanvas) { - const points = this.points; - if (!points) return; - if (localpos[1] < 0) return; - const w = this.size[0] - this.margin * 2; - const h2 = this.size[1] - this.margin * 2; - const x2 = localpos[0] - this.margin; - const y2 = localpos[1] - this.margin; - const pos2 = [x2, y2]; - const max_dist = 30 / graphcanvas.ds.scale; - this.selected = this.getCloserPoint(pos2, max_dist); - if (this.selected == -1) { - const point = [x2 / w, 1 - y2 / h2]; - points.push(point); - points.sort(function(a, b) { - return a[0] - b[0]; - }); - this.selected = points.indexOf(point); - this.must_update = true; - } - if (this.selected != -1) return true; - } - onMouseMove(localpos, graphcanvas) { - const points = this.points; - if (!points) return; - const s = this.selected; - if (s < 0) return; - const x2 = (localpos[0] - this.margin) / (this.size[0] - this.margin * 2); - const y2 = (localpos[1] - this.margin) / (this.size[1] - this.margin * 2); - const curvepos = [ - localpos[0] - this.margin, - localpos[1] - this.margin - ]; - const max_dist = 30 / graphcanvas.ds.scale; - this._nearest = this.getCloserPoint(curvepos, max_dist); - const point = points[s]; - if (point) { - const is_edge_point = s == 0 || s == points.length - 1; - if (!is_edge_point && (localpos[0] < -10 || localpos[0] > this.size[0] + 10 || localpos[1] < -10 || localpos[1] > this.size[1] + 10)) { - points.splice(s, 1); - this.selected = -1; - return; - } - if (!is_edge_point) point[0] = clamp$1(x2, 0, 1); - else point[0] = s == 0 ? 0 : 1; - point[1] = 1 - clamp$1(y2, 0, 1); - points.sort(function(a, b) { - return a[0] - b[0]; - }); - this.selected = points.indexOf(point); - this.must_update = true; - } - } - // Former params: localpos, graphcanvas - onMouseUp() { - this.selected = -1; - return false; - } - getCloserPoint(pos2, max_dist) { - const points = this.points; - if (!points) return -1; - max_dist = max_dist || 30; - const w = this.size[0] - this.margin * 2; - const h2 = this.size[1] - this.margin * 2; - const num = points.length; - const p2 = [0, 0]; - let min_dist = 1e6; - let closest = -1; - for (let i2 = 0; i2 < num; ++i2) { - const p3 = points[i2]; - p2[0] = p3[0] * w; - p2[1] = (1 - p3[1]) * h2; - const dist3 = distance(pos2, p2); - if (dist3 > min_dist || dist3 > max_dist) continue; - closest = i2; - min_dist = dist3; - } - return closest; - } -} -class LiteGraphGlobal { - static { - __name(this, "LiteGraphGlobal"); - } - // Enums - SlotShape = SlotShape; - SlotDirection = SlotDirection; - SlotType = SlotType; - LabelPosition = LabelPosition; - /** Used in serialised graphs at one point. */ - VERSION = 0.4; - CANVAS_GRID_SIZE = 10; - NODE_TITLE_HEIGHT = 30; - NODE_TITLE_TEXT_Y = 20; - NODE_SLOT_HEIGHT = 20; - NODE_WIDGET_HEIGHT = 20; - NODE_WIDTH = 140; - NODE_MIN_WIDTH = 50; - NODE_COLLAPSED_RADIUS = 10; - NODE_COLLAPSED_WIDTH = 80; - NODE_TITLE_COLOR = "#999"; - NODE_SELECTED_TITLE_COLOR = "#FFF"; - NODE_TEXT_SIZE = 14; - NODE_TEXT_COLOR = "#AAA"; - NODE_TEXT_HIGHLIGHT_COLOR = "#EEE"; - NODE_SUBTEXT_SIZE = 12; - NODE_DEFAULT_COLOR = "#333"; - NODE_DEFAULT_BGCOLOR = "#353535"; - NODE_DEFAULT_BOXCOLOR = "#666"; - NODE_DEFAULT_SHAPE = RenderShape.ROUND; - NODE_BOX_OUTLINE_COLOR = "#FFF"; - NODE_ERROR_COLOUR = "#E00"; - DEFAULT_SHADOW_COLOR = "rgba(0,0,0,0.5)"; - DEFAULT_GROUP_FONT = 24; - DEFAULT_GROUP_FONT_SIZE; - WIDGET_BGCOLOR = "#222"; - WIDGET_OUTLINE_COLOR = "#666"; - WIDGET_ADVANCED_OUTLINE_COLOR = "rgba(56, 139, 253, 0.8)"; - WIDGET_TEXT_COLOR = "#DDD"; - WIDGET_SECONDARY_TEXT_COLOR = "#999"; - LINK_COLOR = "#9A9"; - // TODO: This is a workaround until LGraphCanvas.link_type_colors is no longer static. - static DEFAULT_EVENT_LINK_COLOR = "#A86"; - EVENT_LINK_COLOR = "#A86"; - CONNECTING_LINK_COLOR = "#AFA"; - /** avoid infinite loops */ - MAX_NUMBER_OF_NODES = 1e4; - /** default node position */ - DEFAULT_POSITION = [100, 100]; - /** ,"circle" */ - VALID_SHAPES = ["default", "box", "round", "card"]; - // shapes are used for nodes but also for slots - BOX_SHAPE = RenderShape.BOX; - ROUND_SHAPE = RenderShape.ROUND; - CIRCLE_SHAPE = RenderShape.CIRCLE; - CARD_SHAPE = RenderShape.CARD; - ARROW_SHAPE = RenderShape.ARROW; - /** intended for slot arrays */ - GRID_SHAPE = RenderShape.GRID; - // enums - INPUT = NodeSlotType.INPUT; - OUTPUT = NodeSlotType.OUTPUT; - // TODO: -1 can lead to ambiguity in JS; these should be updated to a more explicit constant or Symbol. - /** for outputs */ - EVENT = -1; - /** for inputs */ - ACTION = -1; - /** helper, will add "On Request" and more in the future */ - NODE_MODES = ["Always", "On Event", "Never", "On Trigger"]; - /** use with node_box_coloured_by_mode */ - NODE_MODES_COLORS = ["#666", "#422", "#333", "#224", "#626"]; - ALWAYS = LGraphEventMode.ALWAYS; - ON_EVENT = LGraphEventMode.ON_EVENT; - NEVER = LGraphEventMode.NEVER; - ON_TRIGGER = LGraphEventMode.ON_TRIGGER; - UP = LinkDirection.UP; - DOWN = LinkDirection.DOWN; - LEFT = LinkDirection.LEFT; - RIGHT = LinkDirection.RIGHT; - CENTER = LinkDirection.CENTER; - /** helper */ - LINK_RENDER_MODES = ["Straight", "Linear", "Spline"]; - HIDDEN_LINK = LinkRenderType.HIDDEN_LINK; - STRAIGHT_LINK = LinkRenderType.STRAIGHT_LINK; - LINEAR_LINK = LinkRenderType.LINEAR_LINK; - SPLINE_LINK = LinkRenderType.SPLINE_LINK; - NORMAL_TITLE = TitleMode.NORMAL_TITLE; - NO_TITLE = TitleMode.NO_TITLE; - TRANSPARENT_TITLE = TitleMode.TRANSPARENT_TITLE; - AUTOHIDE_TITLE = TitleMode.AUTOHIDE_TITLE; - /** arrange nodes vertically */ - VERTICAL_LAYOUT = "vertical"; - /** used to redirect calls */ - proxy = null; - node_images_path = ""; - debug = false; - catch_exceptions = true; - throw_errors = true; - allow_scripts = false; - // if set to true some nodes like Formula would be allowed to evaluate code that comes from unsafe sources (like node configuration), which could lead to exploits - /** nodetypes by string */ - registered_node_types = {}; - /** used for dropping files in the canvas */ - node_types_by_file_extension = {}; - /** node types by classname */ - Nodes = {}; - /** used to store vars between graphs */ - Globals = {}; - /** used to add extra features to the search box */ - searchbox_extras = {}; - /** [true!] If set to true, will automatically sort node types / categories in the context menus */ - auto_sort_node_types = false; - /** [true!] this make the nodes box (top left circle) coloured when triggered (execute/action), visual feedback */ - node_box_coloured_when_on = false; - /** [true!] nodebox based on node mode, visual feedback */ - node_box_coloured_by_mode = false; - /** [false on mobile] better true if not touch device, TODO add an helper/listener to close if false */ - dialog_close_on_mouse_leave = false; - dialog_close_on_mouse_leave_delay = 500; - /** [false!] prefer false if results too easy to break links - implement with ALT or TODO custom keys */ - shift_click_do_break_link_from = false; - /** [false!]prefer false, way too easy to break links */ - click_do_break_link_to = false; - /** [true!] who accidentally ctrl-alt-clicks on an in/output? nobody! that's who! */ - ctrl_alt_click_do_break_link = true; - /** [true!] snaps links when dragging connections over valid targets */ - snaps_for_comfy = true; - /** [true!] renders a partial border to highlight when a dragged link is snapped to a node */ - snap_highlights_node = true; - /** - * If `true`, items always snap to the grid - modifier keys are ignored. - * When {@link snapToGrid} is falsy, a value of `1` is used. - * Default: `false` - */ - alwaysSnapToGrid; - /** - * When set to a positive number, when nodes are moved their positions will - * be rounded to the nearest multiple of this value. Half up. - * Default: `undefined` - * @todo Not implemented - see {@link LiteGraph.CANVAS_GRID_SIZE} - */ - snapToGrid; - /** [false on mobile] better true if not touch device, TODO add an helper/listener to close if false */ - search_hide_on_mouse_leave = true; - /** - * [true!] enable filtering slots type in the search widget - * !requires auto_load_slot_types or manual set registered_slot_[in/out]_types and slot_types_[in/out] - */ - search_filter_enabled = false; - /** [true!] opens the results list when opening the search widget */ - search_show_all_on_open = true; - /** - * [if want false, use true, run, get vars values to be statically set, than disable] - * nodes types and nodeclass association with node types need to be calculated, - * if dont want this, calculate once and set registered_slot_[in/out]_types and slot_types_[in/out] - */ - auto_load_slot_types = false; - // set these values if not using auto_load_slot_types - /** slot types for nodeclass */ - registered_slot_in_types = {}; - /** slot types for nodeclass */ - registered_slot_out_types = {}; - /** slot types IN */ - slot_types_in = []; - /** slot types OUT */ - slot_types_out = []; - /** - * specify for each IN slot type a(/many) default node(s), use single string, array, or object - * (with node, title, parameters, ..) like for search - */ - slot_types_default_in = {}; - /** - * specify for each OUT slot type a(/many) default node(s), use single string, array, or object - * (with node, title, parameters, ..) like for search - */ - slot_types_default_out = {}; - /** [true!] very handy, ALT click to clone and drag the new node */ - alt_drag_do_clone_nodes = false; - /** - * [true!] will create and connect event slots when using action/events connections, - * !WILL CHANGE node mode when using onTrigger (enable mode colors), onExecuted does not need this - */ - do_add_triggers_slots = false; - /** [false!] being events, it is strongly reccomended to use them sequentially, one by one */ - allow_multi_output_for_events = true; - /** [true!] allows to create and connect a ndoe clicking with the third button (wheel) */ - middle_click_slot_add_default_node = false; - /** [true!] dragging a link to empty space will open a menu, add from list, search or defaults */ - release_link_on_empty_shows_menu = false; - /** "mouse"|"pointer" use mouse for retrocompatibility issues? (none found @ now) */ - pointerevents_method = "pointer"; - /** - * [true!] allows ctrl + shift + v to paste nodes with the outputs of the unselected nodes connected - * with the inputs of the newly pasted nodes - */ - ctrl_shift_v_paste_connect_unselected_outputs = true; - // if true, all newly created nodes/links will use string UUIDs for their id fields instead of integers. - // use this if you must have node IDs that are unique across all graphs and subgraphs. - use_uuids = false; - // Whether to highlight the bounding box of selected groups - highlight_selected_group = true; - /** If `true`, the old "eye-melting-red" error indicator will be used for nodes */ - use_legacy_node_error_indicator = false; - // TODO: Remove legacy accessors - LGraph = LGraph$1; - LLink = LLink; - LGraphNode = LGraphNode; - LGraphGroup = LGraphGroup; - DragAndScale = DragAndScale; - LGraphCanvas = LGraphCanvas; - ContextMenu = ContextMenu; - CurveEditor = CurveEditor; - Reroute = Reroute; - static { - LGraphCanvas.link_type_colors = { - "-1": LiteGraphGlobal.DEFAULT_EVENT_LINK_COLOR, - "number": "#AAA", - "node": "#DCA" - }; - } - constructor() { - if (typeof performance != "undefined") { - this.getTime = performance.now.bind(performance); - } else if (typeof Date != "undefined" && Date.now) { - this.getTime = Date.now.bind(Date); - } else if (typeof process != "undefined") { - this.getTime = function() { - const t2 = process.hrtime(); - return t2[0] * 1e-3 + t2[1] * 1e-6; - }; - } else { - this.getTime = function() { - return (/* @__PURE__ */ new Date()).getTime(); - }; - } - } - /** - * Register a node class so it can be listed when the user wants to create a new one - * @param type name of the node and path - * @param base_class class containing the structure of a node - */ - registerNodeType(type, base_class) { - if (!base_class.prototype) - throw "Cannot register a simple object, it must be a class with a prototype"; - base_class.type = type; - if (this.debug) console.log("Node registered: " + type); - const classname = base_class.name; - const pos2 = type.lastIndexOf("/"); - base_class.category = type.substring(0, pos2); - base_class.title ||= classname; - for (const i2 in LGraphNode.prototype) { - base_class.prototype[i2] ||= LGraphNode.prototype[i2]; - } - const prev2 = this.registered_node_types[type]; - if (prev2) { - console.log("replacing node type: " + type); - } - if (!Object.prototype.hasOwnProperty.call(base_class.prototype, "shape")) { - Object.defineProperty(base_class.prototype, "shape", { - set(v2) { - switch (v2) { - case "default": - delete this._shape; - break; - case "box": - this._shape = RenderShape.BOX; - break; - case "round": - this._shape = RenderShape.ROUND; - break; - case "circle": - this._shape = RenderShape.CIRCLE; - break; - case "card": - this._shape = RenderShape.CARD; - break; - default: - this._shape = v2; - } - }, - get() { - return this._shape; - }, - enumerable: true, - configurable: true - }); - if (base_class.supported_extensions) { - for (const i2 in base_class.supported_extensions) { - const ext = base_class.supported_extensions[i2]; - if (ext && typeof ext === "string") { - this.node_types_by_file_extension[ext.toLowerCase()] = base_class; - } - } - } - } - this.registered_node_types[type] = base_class; - if (base_class.constructor.name) this.Nodes[classname] = base_class; - this.onNodeTypeRegistered?.(type, base_class); - if (prev2) this.onNodeTypeReplaced?.(type, base_class, prev2); - if (base_class.prototype.onPropertyChange) - console.warn(`LiteGraph node class ${type} has onPropertyChange method, it must be called onPropertyChanged with d at the end`); - if (this.auto_load_slot_types) new base_class(base_class.title || "tmpnode"); - } - /** - * removes a node type from the system - * @param type name of the node or the node constructor itself - */ - unregisterNodeType(type) { - const base_class = typeof type === "string" ? this.registered_node_types[type] : type; - if (!base_class) throw "node type not found: " + type; - delete this.registered_node_types[base_class.type]; - const name2 = base_class.constructor.name; - if (name2) delete this.Nodes[name2]; - } - /** - * Save a slot type and his node - * @param type name of the node or the node constructor itself - * @param slot_type name of the slot type (variable type), eg. string, number, array, boolean, .. - */ - registerNodeAndSlotType(type, slot_type, out) { - out ||= false; - const base_class = typeof type === "string" && this.registered_node_types[type] !== "anonymous" ? this.registered_node_types[type] : type; - const class_type = base_class.constructor.type; - let allTypes = []; - if (typeof slot_type === "string") { - allTypes = slot_type.split(","); - } else if (slot_type == this.EVENT || slot_type == this.ACTION) { - allTypes = ["_event_"]; - } else { - allTypes = ["*"]; - } - for (let i2 = 0; i2 < allTypes.length; ++i2) { - let slotType = allTypes[i2]; - if (slotType === "") slotType = "*"; - const registerTo = out ? "registered_slot_out_types" : "registered_slot_in_types"; - if (this[registerTo][slotType] === void 0) - this[registerTo][slotType] = { nodes: [] }; - if (!this[registerTo][slotType].nodes.includes(class_type)) - this[registerTo][slotType].nodes.push(class_type); - const types = out ? this.slot_types_out : this.slot_types_in; - if (!types.includes(slotType.toLowerCase())) { - types.push(slotType.toLowerCase()); - types.sort(); - } - } - } - /** - * Create a new nodetype by passing a function, it wraps it with a proper class and - * generates inputs according to the parameters of the function. - * Useful to wrap simple methods that do not require properties, and that only process some input to generate an output. - * @param name node name with namespace (p.e.: 'math/sum') - * @param func - * @param param_types [optional] an array containing the type of every parameter, - * otherwise parameters will accept any type - * @param return_type [optional] string with the return type, otherwise it will be generic - * @param properties [optional] properties to be configurable - */ - wrapFunctionAsNode(name2, func, param_types, return_type, properties) { - const params = Array(func.length); - let code2 = ""; - const names = this.getParameterNames(func); - for (let i2 = 0; i2 < names.length; ++i2) { - code2 += `this.addInput('${names[i2]}',${param_types && param_types[i2] ? `'${param_types[i2]}'` : "0"}); -`; - } - code2 += `this.addOutput('out',${return_type ? `'${return_type}'` : 0}); -`; - if (properties) code2 += `this.properties = ${JSON.stringify(properties)}; -`; - const classobj = Function(code2); - classobj.title = name2.split("/").pop(); - classobj.desc = "Generated from " + func.name; - classobj.prototype.onExecute = /* @__PURE__ */ __name(function onExecute() { - for (let i2 = 0; i2 < params.length; ++i2) { - params[i2] = this.getInputData(i2); - } - const r = func.apply(this, params); - this.setOutputData(0, r); - }, "onExecute"); - this.registerNodeType(name2, classobj); - } - /** - * Removes all previously registered node's types - */ - clearRegisteredTypes() { - this.registered_node_types = {}; - this.node_types_by_file_extension = {}; - this.Nodes = {}; - this.searchbox_extras = {}; - } - /** - * Adds this method to all nodetypes, existing and to be created - * (You can add it to LGraphNode.prototype but then existing node types wont have it) - */ - // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type - addNodeMethod(name2, func) { - LGraphNode.prototype[name2] = func; - for (const i2 in this.registered_node_types) { - const type = this.registered_node_types[i2]; - if (type.prototype[name2]) type.prototype["_" + name2] = type.prototype[name2]; - type.prototype[name2] = func; - } - } - /** - * Create a node of a given type with a name. The node is not attached to any graph yet. - * @param type full name of the node class. p.e. "math/sin" - * @param title a name to distinguish from other nodes - * @param options to set options - */ - createNode(type, title, options4) { - const base_class = this.registered_node_types[type]; - if (!base_class) { - if (this.debug) console.log(`GraphNode type "${type}" not registered.`); - return null; - } - title = title || base_class.title || type; - let node22 = null; - if (this.catch_exceptions) { - try { - node22 = new base_class(title); - } catch (err) { - console.error(err); - return null; - } - } else { - node22 = new base_class(title); - } - node22.type = type; - if (!node22.title && title) node22.title = title; - node22.properties ||= {}; - node22.properties_info ||= []; - node22.flags ||= {}; - node22.size ||= node22.computeSize(); - node22.pos ||= this.DEFAULT_POSITION.concat(); - node22.mode ||= LGraphEventMode.ALWAYS; - if (options4) { - for (const i2 in options4) { - node22[i2] = options4[i2]; - } - } - node22.onNodeCreated?.(); - return node22; - } - /** - * Returns a registered node type with a given name - * @param type full name of the node class. p.e. "math/sin" - * @returns the node class - */ - getNodeType(type) { - return this.registered_node_types[type]; - } - /** - * Returns a list of node types matching one category - * @param category category name - * @returns array with all the node classes - */ - getNodeTypesInCategory(category, filter4) { - const r = []; - for (const i2 in this.registered_node_types) { - const type = this.registered_node_types[i2]; - if (type.filter != filter4) continue; - if (category == "") { - if (type.category == null) r.push(type); - } else if (type.category == category) { - r.push(type); - } - } - if (this.auto_sort_node_types) { - r.sort(function(a, b) { - return a.title.localeCompare(b.title); - }); - } - return r; - } - /** - * Returns a list with all the node type categories - * @param filter only nodes with ctor.filter equal can be shown - * @returns array with all the names of the categories - */ - getNodeTypesCategories(filter4) { - const categories = { "": 1 }; - for (const i2 in this.registered_node_types) { - const type = this.registered_node_types[i2]; - if (type.category && !type.skip_list) { - if (type.filter != filter4) continue; - categories[type.category] = 1; - } - } - const result = []; - for (const i2 in categories) { - result.push(i2); - } - return this.auto_sort_node_types ? result.sort() : result; - } - // debug purposes: reloads all the js scripts that matches a wildcard - reloadNodes(folder_wildcard) { - const tmp = document.getElementsByTagName("script"); - const script_files = []; - for (let i2 = 0; i2 < tmp.length; i2++) { - script_files.push(tmp[i2]); - } - const docHeadObj = document.getElementsByTagName("head")[0]; - folder_wildcard = document.location.href + folder_wildcard; - for (let i2 = 0; i2 < script_files.length; i2++) { - const src = script_files[i2].src; - if (!src || src.substr(0, folder_wildcard.length) != folder_wildcard) - continue; - try { - if (this.debug) console.log("Reloading: " + src); - const dynamicScript = document.createElement("script"); - dynamicScript.type = "text/javascript"; - dynamicScript.src = src; - docHeadObj.appendChild(dynamicScript); - docHeadObj.removeChild(script_files[i2]); - } catch (err) { - if (this.throw_errors) throw err; - if (this.debug) console.log("Error while reloading " + src); - } - } - if (this.debug) console.log("Nodes reloaded"); - } - // separated just to improve if it doesn't work - cloneObject(obj, target) { - if (obj == null) return null; - const r = JSON.parse(JSON.stringify(obj)); - if (!target) return r; - for (const i2 in r) { - target[i2] = r[i2]; - } - return target; - } - /* - * https://gist.github.com/jed/982883?permalink_comment_id=852670#gistcomment-852670 - */ - uuidv4() { - return ("10000000-1000-4000-8000" + -1e11).replace(/[018]/g, (a) => (a ^ Math.random() * 16 >> a / 4).toString(16)); - } - /** - * Returns if the types of two slots are compatible (taking into account wildcards, etc) - * @param type_a output - * @param type_b input - * @returns true if they can be connected - */ - isValidConnection(type_a, type_b) { - if (type_a == "" || type_a === "*") type_a = 0; - if (type_b == "" || type_b === "*") type_b = 0; - if (!type_a || !type_b || type_a == type_b || type_a == this.EVENT && type_b == this.ACTION) - return true; - type_a = String(type_a); - type_b = String(type_b); - type_a = type_a.toLowerCase(); - type_b = type_b.toLowerCase(); - if (type_a.indexOf(",") == -1 && type_b.indexOf(",") == -1) - return type_a == type_b; - const supported_types_a = type_a.split(","); - const supported_types_b = type_b.split(","); - for (let i2 = 0; i2 < supported_types_a.length; ++i2) { - for (let j = 0; j < supported_types_b.length; ++j) { - if (this.isValidConnection(supported_types_a[i2], supported_types_b[j])) - return true; - } - } - return false; - } - /** - * Register a string in the search box so when the user types it it will recommend this node - * @param node_type the node recommended - * @param description text to show next to it - * @param data it could contain info of how the node should be configured - */ - registerSearchboxExtra(node_type, description, data24) { - this.searchbox_extras[description.toLowerCase()] = { - type: node_type, - desc: description, - data: data24 - }; - } - /** - * Wrapper to load files (from url using fetch or from file using FileReader) - * @param url the url of the file (or the file itself) - * @param type an string to know how to fetch it: "text","arraybuffer","json","blob" - * @param on_complete callback(data) - * @param on_error in case of an error - * @returns returns the object used to - */ - fetchFile(url, type, on_complete, on_error) { - if (!url) return null; - type = type || "text"; - if (typeof url === "string") { - if (url.substr(0, 4) == "http" && this.proxy) - url = this.proxy + url.substr(url.indexOf(":") + 3); - return fetch(url).then(function(response) { - if (!response.ok) - throw new Error("File not found"); - if (type == "arraybuffer") - return response.arrayBuffer(); - else if (type == "text" || type == "string") - return response.text(); - else if (type == "json") - return response.json(); - else if (type == "blob") - return response.blob(); - }).then(function(data24) { - on_complete?.(data24); - }).catch(function(error2) { - console.error("error fetching file:", url); - on_error?.(error2); - }); - } else if (url instanceof File || url instanceof Blob) { - const reader = new FileReader(); - reader.onload = function(e2) { - let v2 = e2.target.result; - if (type == "json") - v2 = JSON.parse(v2); - on_complete?.(v2); - }; - if (type == "arraybuffer") - return reader.readAsArrayBuffer(url); - else if (type == "text" || type == "json") - return reader.readAsText(url); - else if (type == "blob") - return reader.readAsBinaryString(url); - } - return null; - } - // used to create nodes from wrapping functions - getParameterNames(func) { - return (func + "").replace(/[/][/].*$/gm, "").replace(/\s+/g, "").replace(/[/][*][^/*]*[*][/]/g, "").split("){", 1)[0].replace(/^[^(]*[(]/, "").replace(/=[^,]+/g, "").split(",").filter(Boolean); - } - /* helper for interaction: pointer, touch, mouse Listeners - used by LGraphCanvas DragAndScale ContextMenu */ - pointerListenerAdd(oDOM, sEvIn, fCall, capture = false) { - if (!oDOM || !oDOM.addEventListener || !sEvIn || typeof fCall !== "function") return; - let sMethod = this.pointerevents_method; - let sEvent = sEvIn; - if (sMethod == "pointer" && !window.PointerEvent) { - console.warn("sMethod=='pointer' && !window.PointerEvent"); - console.log("Converting pointer[" + sEvent + "] : down move up cancel enter TO touchstart touchmove touchend, etc .."); - switch (sEvent) { - case "down": { - sMethod = "touch"; - sEvent = "start"; - break; - } - case "move": { - sMethod = "touch"; - break; - } - case "up": { - sMethod = "touch"; - sEvent = "end"; - break; - } - case "cancel": { - sMethod = "touch"; - break; - } - case "enter": { - console.log("debug: Should I send a move event?"); - break; - } - default: { - console.warn("PointerEvent not available in this browser ? The event " + sEvent + " would not be called"); - } - } - } - switch (sEvent) { - case "down": - case "up": - case "move": - case "over": - case "out": - case "enter": { - oDOM.addEventListener(sMethod + sEvent, fCall, capture); - } - case "leave": - case "cancel": - case "gotpointercapture": - case "lostpointercapture": { - if (sMethod != "mouse") { - return oDOM.addEventListener(sMethod + sEvent, fCall, capture); - } - } - default: - return oDOM.addEventListener(sEvent, fCall, capture); - } - } - pointerListenerRemove(oDOM, sEvent, fCall, capture = false) { - if (!oDOM || !oDOM.removeEventListener || !sEvent || typeof fCall !== "function") return; - switch (sEvent) { - case "down": - case "up": - case "move": - case "over": - case "out": - case "enter": { - if (this.pointerevents_method == "pointer" || this.pointerevents_method == "mouse") { - oDOM.removeEventListener(this.pointerevents_method + sEvent, fCall, capture); - } - } - case "leave": - case "cancel": - case "gotpointercapture": - case "lostpointercapture": { - if (this.pointerevents_method == "pointer") { - return oDOM.removeEventListener(this.pointerevents_method + sEvent, fCall, capture); - } - } - default: - return oDOM.removeEventListener(sEvent, fCall, capture); - } - } - getTime; - compareObjects(a, b) { - for (const i2 in a) { - if (a[i2] != b[i2]) return false; - } - return true; - } - distance = distance; - colorToString(c) { - return "rgba(" + Math.round(c[0] * 255).toFixed() + "," + Math.round(c[1] * 255).toFixed() + "," + Math.round(c[2] * 255).toFixed() + "," + (c.length == 4 ? c[3].toFixed(2) : "1.0") + ")"; - } - isInsideRectangle = isInsideRectangle; - // [minx,miny,maxx,maxy] - growBounding(bounding, x2, y2) { - if (x2 < bounding[0]) { - bounding[0] = x2; - } else if (x2 > bounding[2]) { - bounding[2] = x2; - } - if (y2 < bounding[1]) { - bounding[1] = y2; - } else if (y2 > bounding[3]) { - bounding[3] = y2; - } - } - overlapBounding = overlapBounding; - // point inside bounding box - isInsideBounding(p2, bb) { - if (p2[0] < bb[0][0] || p2[1] < bb[0][1] || p2[0] > bb[1][0] || p2[1] > bb[1][1]) { - return false; - } - return true; - } - // Convert a hex value to its decimal value - the inputted hex must be in the - // format of a hex triplet - the kind we use for HTML colours. The function - // will return an array with three values. - hex2num(hex) { - if (hex.charAt(0) == "#") { - hex = hex.slice(1); - } - hex = hex.toUpperCase(); - const hex_alphabets = "0123456789ABCDEF"; - const value4 = new Array(3); - let k = 0; - let int1, int2; - for (let i2 = 0; i2 < 6; i2 += 2) { - int1 = hex_alphabets.indexOf(hex.charAt(i2)); - int2 = hex_alphabets.indexOf(hex.charAt(i2 + 1)); - value4[k] = int1 * 16 + int2; - k++; - } - return value4; - } - // Give a array with three values as the argument and the function will return - // the corresponding hex triplet. - num2hex(triplet) { - const hex_alphabets = "0123456789ABCDEF"; - let hex = "#"; - let int1, int2; - for (let i2 = 0; i2 < 3; i2++) { - int1 = triplet[i2] / 16; - int2 = triplet[i2] % 16; - hex += hex_alphabets.charAt(int1) + hex_alphabets.charAt(int2); - } - return hex; - } - closeAllContextMenus(ref_window) { - ref_window = ref_window || window; - const elements = ref_window.document.querySelectorAll(".litecontextmenu"); - if (!elements.length) return; - const result = []; - for (let i2 = 0; i2 < elements.length; i2++) { - result.push(elements[i2]); - } - for (let i2 = 0; i2 < result.length; i2++) { - if (result[i2].close) { - result[i2].close(); - } else if (result[i2].parentNode) { - result[i2].parentNode.removeChild(result[i2]); - } - } - } - extendClass(target, origin2) { - for (const i2 in origin2) { - if (target.hasOwnProperty(i2)) continue; - target[i2] = origin2[i2]; - } - if (origin2.prototype) { - for (const i2 in origin2.prototype) { - if (!origin2.prototype.hasOwnProperty(i2)) continue; - if (target.prototype.hasOwnProperty(i2)) continue; - if (origin2.prototype.__lookupGetter__(i2)) { - target.prototype.__defineGetter__( - i2, - origin2.prototype.__lookupGetter__(i2) - ); - } else { - target.prototype[i2] = origin2.prototype[i2]; - } - if (origin2.prototype.__lookupSetter__(i2)) { - target.prototype.__defineSetter__( - i2, - origin2.prototype.__lookupSetter__(i2) - ); - } - } - } - } -} -function loadPolyfills() { - if (typeof window != "undefined" && window.CanvasRenderingContext2D && !window.CanvasRenderingContext2D.prototype.roundRect) { - window.CanvasRenderingContext2D.prototype.roundRect = function(x2, y2, w, h2, radius, radius_low) { - let top_left_radius = 0; - let top_right_radius = 0; - let bottom_left_radius = 0; - let bottom_right_radius = 0; - if (radius === 0) { - this.rect(x2, y2, w, h2); - return; - } - if (radius_low === void 0) radius_low = radius; - if (radius != null && radius.constructor === Array) { - if (radius.length == 1) - top_left_radius = top_right_radius = bottom_left_radius = bottom_right_radius = radius[0]; - else if (radius.length == 2) { - top_left_radius = bottom_right_radius = radius[0]; - top_right_radius = bottom_left_radius = radius[1]; - } else if (radius.length == 4) { - top_left_radius = radius[0]; - top_right_radius = radius[1]; - bottom_left_radius = radius[2]; - bottom_right_radius = radius[3]; - } else { - return; - } - } else { - top_left_radius = radius || 0; - top_right_radius = radius || 0; - bottom_left_radius = radius_low || 0; - bottom_right_radius = radius_low || 0; - } - this.moveTo(x2 + top_left_radius, y2); - this.lineTo(x2 + w - top_right_radius, y2); - this.quadraticCurveTo(x2 + w, y2, x2 + w, y2 + top_right_radius); - this.lineTo(x2 + w, y2 + h2 - bottom_right_radius); - this.quadraticCurveTo( - x2 + w, - y2 + h2, - x2 + w - bottom_right_radius, - y2 + h2 - ); - this.lineTo(x2 + bottom_right_radius, y2 + h2); - this.quadraticCurveTo(x2, y2 + h2, x2, y2 + h2 - bottom_left_radius); - this.lineTo(x2, y2 + bottom_left_radius); - this.quadraticCurveTo(x2, y2, x2 + top_left_radius, y2); - }; - } - if (typeof window != "undefined" && !window["requestAnimationFrame"]) { - window.requestAnimationFrame = // @ts-expect-error Legacy code - window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) { - window.setTimeout(callback, 1e3 / 60); - }; - } -} -__name(loadPolyfills, "loadPolyfills"); -const LiteGraph = new LiteGraphGlobal(); -function clamp$1(v2, a, b) { - return a > v2 ? a : b < v2 ? b : v2; -} -__name(clamp$1, "clamp$1"); -loadPolyfills(); const nodeSlotSchema = z.object({ CLIP: z.string(), CLIP_VISION: z.string(), @@ -44666,6 +70183,7 @@ const litegraphBaseSchema = z.object({ NODE_SELECTED_TITLE_COLOR: z.string(), NODE_TEXT_SIZE: z.number(), NODE_TEXT_COLOR: z.string(), + NODE_TEXT_HIGHLIGHT_COLOR: z.string(), NODE_SUBTEXT_SIZE: z.number(), NODE_DEFAULT_COLOR: z.string(), NODE_DEFAULT_BGCOLOR: z.string(), @@ -44725,7 +70243,8 @@ const partialColorsSchema = z.object({ const paletteSchema = z.object({ id: z.string(), name: z.string(), - colors: partialColorsSchema + colors: partialColorsSchema, + light_theme: z.boolean().optional() }).passthrough(); const completedPaletteSchema = z.object({ id: z.string(), @@ -44884,8 +70403,8 @@ const zComfyWorkflow1 = z.object({ const zWorkflowVersion = z.object({ version: z.number() }); -async function validateComfyWorkflow(data24, onError = console.warn) { - const versionResult = zWorkflowVersion.safeParse(data24); +async function validateComfyWorkflow(data25, onError = console.warn) { + const versionResult = zWorkflowVersion.safeParse(data25); let result; if (!versionResult.success) { const error22 = fromZodError(versionResult.error); @@ -44893,9 +70412,9 @@ async function validateComfyWorkflow(data24, onError = console.warn) { ${error22}`); return null; } else if (versionResult.data.version === 1) { - result = await zComfyWorkflow1.safeParseAsync(data24); + result = await zComfyWorkflow1.safeParseAsync(data25); } else { - result = await zComfyWorkflow.safeParseAsync(data24); + result = await zComfyWorkflow.safeParseAsync(data25); } if (result.success) return result.data; const error2 = fromZodError(result.error); @@ -44914,11 +70433,11 @@ const zKeyCombo = z.object({ const zKeybinding = z.object({ commandId: z.string(), combo: zKeyCombo, - // Optional target element CSS selector to limit keybinding to. + // Optional target element ID to limit keybinding to. // Note: Currently only used to distinguish between global keybindings // and litegraph canvas keybindings. // Do NOT use this field in extensions as it has no effect. - targetSelector: z.string().optional() + targetElementId: z.string().optional() }); var NodeSourceType = /* @__PURE__ */ ((NodeSourceType2) => { NodeSourceType2["Core"] = "core"; @@ -45272,12 +70791,12 @@ const zComfyNodeDef = z.object({ deprecated: z.boolean().optional(), experimental: z.boolean().optional() }); -function validateComfyNodeDef(data24, onError = console.warn) { - const result = zComfyNodeDef.safeParse(data24); +function validateComfyNodeDef(data25, onError = console.warn) { + const result = zComfyNodeDef.safeParse(data25); if (!result.success) { const zodError = fromZodError(result.error); onError( - `Invalid ComfyNodeDef: ${JSON.stringify(data24)} + `Invalid ComfyNodeDef: ${JSON.stringify(data25)} ${zodError.message}` ); return null; @@ -45355,6 +70874,9 @@ const zSettings = z.record(z.any()).and( "Comfy.EnableWorkflowViewRestore": z.boolean(), "Comfy.FloatRoundingPrecision": z.number(), "Comfy.Graph.CanvasInfo": z.boolean(), + "Comfy.Graph.CanvasMenu": z.boolean(), + "Comfy.Graph.CtrlShiftZoom": z.boolean(), + "Comfy.Graph.LinkMarkers": z.nativeEnum(LinkMarkerShape), "Comfy.Graph.ZoomSpeed": z.number(), "Comfy.Group.DoubleClickTitleToEdit": z.boolean(), "Comfy.GroupSelectedNodes.Padding": z.number(), @@ -45370,13 +70892,22 @@ const zSettings = z.record(z.any()).and( "Comfy.NodeInputConversionSubmenus": z.boolean(), "Comfy.LinkRelease.Action": zLinkReleaseTriggerAction, "Comfy.LinkRelease.ActionShift": zLinkReleaseTriggerAction, + "Comfy.ModelLibrary.AutoLoadAll": z.boolean(), + "Comfy.ModelLibrary.NameFormat": z.enum(["filename", "title"]), "Comfy.NodeSearchBoxImpl.NodePreview": z.boolean(), "Comfy.NodeSearchBoxImpl": z.enum(["default", "simple"]), "Comfy.NodeSearchBoxImpl.ShowCategory": z.boolean(), "Comfy.NodeSearchBoxImpl.ShowIdName": z.boolean(), + "Comfy.NodeSearchBoxImpl.ShowNodeFrequency": z.boolean(), "Comfy.NodeSuggestions.number": z.number(), + "Comfy.Node.BypassAllLinksOnDelete": z.boolean(), + "Comfy.Node.Opacity": z.number(), + "Comfy.Node.MiddleClickRerouteNode": z.boolean(), "Comfy.Node.ShowDeprecated": z.boolean(), "Comfy.Node.ShowExperimental": z.boolean(), + "Comfy.Pointer.ClickBufferTime": z.number(), + "Comfy.Pointer.ClickDrift": z.number(), + "Comfy.Pointer.DoubleClickTime": z.number(), "Comfy.PreviewFormat": z.string(), "Comfy.PromptFilename": z.boolean(), "Comfy.Sidebar.Location": z.enum(["left", "right"]), @@ -45388,15 +70919,22 @@ const zSettings = z.record(z.any()).and( "Comfy.UseNewMenu": z.enum(["Disabled", "Top", "Bottom"]), "Comfy.TreeExplorer.ItemPadding": z.number(), "Comfy.Validation.Workflows": z.boolean(), + "Comfy.Validation.NodeDefs": z.boolean(), "Comfy.Workflow.SortNodeIdOnSave": z.boolean(), "Comfy.Queue.ImageFit": z.enum(["contain", "cover"]), - "Comfy.Workflow.WorkflowTabsPosition": z.enum(["Sidebar", "Topbar"]), + "Comfy.Workflow.WorkflowTabsPosition": z.enum([ + "Sidebar", + "Topbar", + "Topbar (2nd-row)" + ]), "Comfy.Node.DoubleClickTitleToEdit": z.boolean(), + "Comfy.WidgetControlMode": z.enum(["before", "after"]), "Comfy.Window.UnloadConfirmation": z.boolean(), "Comfy.NodeBadge.NodeSourceBadgeMode": zNodeBadgeMode, "Comfy.NodeBadge.NodeIdBadgeMode": zNodeBadgeMode, "Comfy.NodeBadge.NodeLifeCycleBadgeMode": zNodeBadgeMode, "Comfy.QueueButton.BatchCountLimit": z.number(), + "Comfy.Queue.MaxHistoryItems": z.number(), "Comfy.Keybinding.UnsetBindings": z.array(zKeybinding), "Comfy.Keybinding.NewBindings": z.array(zKeybinding), "Comfy.Extension.Disabled": z.array(z.string()), @@ -45407,7 +70945,8 @@ const zSettings = z.record(z.any()).and( "Comfy.Server.ServerConfigValues": z.record(z.string(), z.any()), "Comfy.Server.LaunchArgs": z.record(z.string(), z.string()), "LiteGraph.Canvas.MaximumFps": z.number(), - "Comfy.Workflow.ConfirmDelete": z.boolean() + "Comfy.Workflow.ConfirmDelete": z.boolean(), + "Comfy.RerouteBeta": z.boolean() }).optional() ); class ComfyApi extends EventTarget { @@ -45584,6 +71123,7 @@ class ComfyApi extends EventTarget { break; case "execution_start": case "execution_error": + case "execution_interrupted": case "execution_cached": case "execution_success": case "progress": @@ -45771,15 +71311,15 @@ class ComfyApi extends EventTarget { async getQueue() { try { const res = await this.fetchApi("/queue"); - const data24 = await res.json(); + const data25 = await res.json(); return { // Running action uses a different endpoint for cancelling - Running: data24.queue_running.map((prompt) => ({ + Running: data25.queue_running.map((prompt) => ({ taskType: "Running", prompt, remove: { name: "Cancel", cb: /* @__PURE__ */ __name(() => api.interrupt(), "cb") } })), - Pending: data24.queue_pending.map((prompt) => ({ + Pending: data25.queue_pending.map((prompt) => ({ taskType: "Pending", prompt })) @@ -45921,7 +71461,7 @@ class ComfyApi extends EventTarget { * @param { RequestInit & { stringify?: boolean, throwOnError?: boolean } } [options] * @returns { Promise<Response> } */ - async storeUserData(file, data24, options4 = { + async storeUserData(file, data25, options4 = { overwrite: true, stringify: true, throwOnError: true, @@ -45931,7 +71471,7 @@ class ComfyApi extends EventTarget { `/userdata/${encodeURIComponent(file)}?overwrite=${options4.overwrite}&full_info=${options4.full_info}`, { method: "POST", - body: options4?.stringify ? JSON.stringify(data24) : data24, + body: options4?.stringify ? JSON.stringify(data25) : data25, ...options4 } ); @@ -46044,14 +71584,14 @@ const useUserStore = /* @__PURE__ */ defineStore("user", () => { __name(initialize2, "initialize"); async function createUser(username) { const resp = await api.createUser(username); - const data24 = await resp.json(); + const data25 = await resp.json(); if (resp.status >= 300) { throw new Error( - data24.error ?? "Error creating user: " + resp.status + " " + resp.statusText + data25.error ?? "Error creating user: " + resp.status + " " + resp.statusText ); } return { - userId: data24, + userId: data25, username }; } @@ -46088,11 +71628,11 @@ const useUserStore = /* @__PURE__ */ defineStore("user", () => { }; }); function isElectron() { - return "electronAPI" in window && window["electronAPI"] !== void 0; + return "electronAPI" in window && window.electronAPI !== void 0; } __name(isElectron, "isElectron"); function electronAPI() { - return window["electronAPI"]; + return window.electronAPI; } __name(electronAPI, "electronAPI"); function showNativeMenu(options4) { @@ -46123,7 +71663,7 @@ const router = createRouter({ { path: "", name: "GraphView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./GraphView-HVeNbkaW.js"), true ? __vite__mapDeps([0,1,2,3,4,5,6]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./GraphView-CDDCHVO0.js"), true ? __vite__mapDeps([0,1,2,3,4]) : void 0, import.meta.url), "component"), beforeEnter: /* @__PURE__ */ __name(async (to, from2, next2) => { const userStore = useUserStore(); await userStore.initialize(); @@ -46137,42 +71677,54 @@ const router = createRouter({ { path: "user-select", name: "UserSelectView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./UserSelectView-B3jYchWu.js"), true ? __vite__mapDeps([7,8]) : void 0, import.meta.url), "component") + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./UserSelectView-CXmVKOeK.js"), true ? __vite__mapDeps([5,6]) : void 0, import.meta.url), "component") }, { path: "server-start", name: "ServerStartView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./ServerStartView-CIDTUh4x.js"), true ? __vite__mapDeps([9,8,10]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./ServerStartView-48wfE1MS.js"), true ? __vite__mapDeps([7,6,8]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "install", name: "InstallView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./InstallView-CAcYt0HL.js"), true ? __vite__mapDeps([11,8,12]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./InstallView-By3hC1fC.js"), true ? __vite__mapDeps([9,6,10]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "welcome", name: "WelcomeView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./WelcomeView-N0ZXLjdi.js"), true ? __vite__mapDeps([13,8,14]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./WelcomeView-C8whKl15.js"), true ? __vite__mapDeps([11,6,12]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "not-supported", name: "NotSupportedView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./NotSupportedView-Drz3x2d-.js"), true ? __vite__mapDeps([15,8,16]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./NotSupportedView-Vc8_xWgH.js"), true ? __vite__mapDeps([13,6,14]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "download-git", name: "DownloadGitView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./DownloadGitView-DeC7MBzG.js"), true ? __vite__mapDeps([17,8]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./DownloadGitView-rPK_vYgU.js"), true ? __vite__mapDeps([15,6]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "manual-configuration", name: "ManualConfigurationView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./ManualConfigurationView-Bi_qHE-n.js"), true ? __vite__mapDeps([18,1,2,8,19]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./ManualConfigurationView-enyqGo0M.js"), true ? __vite__mapDeps([16,6,17]) : void 0, import.meta.url), "component"), + beforeEnter: guardElectronAccess + }, + { + path: "/metrics-consent", + name: "MetricsConsentView", + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./MetricsConsentView-lSfLu4nr.js"), true ? __vite__mapDeps([18,6]) : void 0, import.meta.url), "component"), + beforeEnter: guardElectronAccess + }, + { + path: "desktop-start", + name: "DesktopStartView", + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./DesktopStartView-le6AjGZr.js"), true ? __vite__mapDeps([19,6]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess } ] @@ -46269,7 +71821,7 @@ function createEventHook() { const off = /* @__PURE__ */ __name((fn) => { fns.delete(fn); }, "off"); - const on = /* @__PURE__ */ __name((fn) => { + const on2 = /* @__PURE__ */ __name((fn) => { fns.add(fn); const offFn = /* @__PURE__ */ __name(() => off(fn), "offFn"); tryOnScopeDispose(offFn); @@ -46281,7 +71833,7 @@ function createEventHook() { return Promise.all(Array.from(fns).map((fn) => fn(...args))); }, "trigger"); return { - on, + on: on2, off, trigger: trigger2 }; @@ -46414,8 +71966,8 @@ function makeDestructurable(obj, arr) { } } __name(makeDestructurable, "makeDestructurable"); -function toValue(r) { - return typeof r === "function" ? r() : unref(r); +function toValue(r2) { + return typeof r2 === "function" ? r2() : unref(r2); } __name(toValue, "toValue"); const resolveUnref = toValue; @@ -46489,7 +72041,7 @@ __name(reactiveComputed, "reactiveComputed"); function reactiveOmit(obj, ...keys2) { const flatKeys = keys2.flat(); const predicate = flatKeys[0]; - return reactiveComputed(() => typeof predicate === "function" ? Object.fromEntries(Object.entries(toRefs$1(obj)).filter(([k, v2]) => !predicate(toValue(v2), k))) : Object.fromEntries(Object.entries(toRefs$1(obj)).filter((e2) => !flatKeys.includes(e2[0])))); + return reactiveComputed(() => typeof predicate === "function" ? Object.fromEntries(Object.entries(toRefs$1(obj)).filter(([k2, v2]) => !predicate(toValue(v2), k2))) : Object.fromEntries(Object.entries(toRefs$1(obj)).filter((e2) => !flatKeys.includes(e2[0])))); } __name(reactiveOmit, "reactiveOmit"); const isClient = typeof window !== "undefined" && typeof document !== "undefined"; @@ -46501,10 +72053,10 @@ const assert = /* @__PURE__ */ __name((condition, ...infos) => { console.warn(...infos); }, "assert"); const toString$1 = Object.prototype.toString; -const isObject$4 = /* @__PURE__ */ __name((val) => toString$1.call(val) === "[object Object]", "isObject$4"); +const isObject$b = /* @__PURE__ */ __name((val) => toString$1.call(val) === "[object Object]", "isObject$b"); const now = /* @__PURE__ */ __name(() => Date.now(), "now"); const timestamp = /* @__PURE__ */ __name(() => +Date.now(), "timestamp"); -const clamp = /* @__PURE__ */ __name((n, min, max) => Math.min(max, Math.max(min, n)), "clamp"); +const clamp = /* @__PURE__ */ __name((n2, min, max) => Math.min(max, Math.max(min, n2)), "clamp"); const noop$1 = /* @__PURE__ */ __name(() => { }, "noop$1"); const rand = /* @__PURE__ */ __name((min, max) => { @@ -46663,7 +72215,7 @@ const hyphenateRE = /\B([A-Z])/g; const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase()); const camelizeRE = /-(\w)/g; const camelize = cacheStringFunction((str) => { - return str.replace(camelizeRE, (_2, c) => c ? c.toUpperCase() : ""); + return str.replace(camelizeRE, (_2, c2) => c2 ? c2.toUpperCase() : ""); }); function promiseTimeout(ms, throwOnTimeout = false, reason = "Timeout") { return new Promise((resolve2, reject3) => { @@ -46700,7 +72252,7 @@ function invoke(fn) { } __name(invoke, "invoke"); function containsProp(obj, ...props) { - return props.some((k) => k in obj); + return props.some((k2) => k2 in obj); } __name(containsProp, "containsProp"); function increaseWithUnit(target, delta2) { @@ -46716,12 +72268,12 @@ function increaseWithUnit(target, delta2) { } __name(increaseWithUnit, "increaseWithUnit"); function objectPick(obj, keys2, omitUndefined = false) { - return keys2.reduce((n, k) => { - if (k in obj) { - if (!omitUndefined || obj[k] !== void 0) - n[k] = obj[k]; + return keys2.reduce((n2, k2) => { + if (k2 in obj) { + if (!omitUndefined || obj[k2] !== void 0) + n2[k2] = obj[k2]; } - return n; + return n2; }, {}); } __name(objectPick, "objectPick"); @@ -46742,15 +72294,15 @@ __name(getLifeCycleTarget, "getLifeCycleTarget"); function toRef(...args) { if (args.length !== 1) return toRef$1(...args); - const r = args[0]; - return typeof r === "function" ? readonly(customRef(() => ({ get: r, set: noop$1 }))) : ref(r); + const r2 = args[0]; + return typeof r2 === "function" ? readonly(customRef(() => ({ get: r2, set: noop$1 }))) : ref(r2); } __name(toRef, "toRef"); const resolveRef = toRef; function reactivePick(obj, ...keys2) { const flatKeys = keys2.flat(); const predicate = flatKeys[0]; - return reactiveComputed(() => typeof predicate === "function" ? Object.fromEntries(Object.entries(toRefs$1(obj)).filter(([k, v2]) => predicate(toValue(v2), k))) : Object.fromEntries(flatKeys.map((k) => [k, toRef(obj, k)]))); + return reactiveComputed(() => typeof predicate === "function" ? Object.fromEntries(Object.entries(toRefs$1(obj)).filter(([k2, v2]) => predicate(toValue(v2), k2))) : Object.fromEntries(flatKeys.map((k2) => [k2, toRef(obj, k2)]))); } __name(reactivePick, "reactivePick"); function refAutoReset(defaultValue, afterMs = 1e4) { @@ -46928,7 +72480,7 @@ function watchPausable(source, cb, options4 = {}) { __name(watchPausable, "watchPausable"); function syncRef(left, right, ...[options4]) { const { - flush = "sync", + flush: flush2 = "sync", deep = false, immediate = true, direction = "both", @@ -46941,33 +72493,33 @@ function syncRef(left, right, ...[options4]) { watchers.push(watchPausable( left, (newValue2) => { - watchers.forEach((w) => w.pause()); + watchers.forEach((w2) => w2.pause()); right.value = transformLTR(newValue2); - watchers.forEach((w) => w.resume()); + watchers.forEach((w2) => w2.resume()); }, - { flush, deep, immediate } + { flush: flush2, deep, immediate } )); } if (direction === "both" || direction === "rtl") { watchers.push(watchPausable( right, (newValue2) => { - watchers.forEach((w) => w.pause()); + watchers.forEach((w2) => w2.pause()); left.value = transformRTL(newValue2); - watchers.forEach((w) => w.resume()); + watchers.forEach((w2) => w2.resume()); }, - { flush, deep, immediate } + { flush: flush2, deep, immediate } )); } const stop2 = /* @__PURE__ */ __name(() => { - watchers.forEach((w) => w.stop()); + watchers.forEach((w2) => w2.stop()); }, "stop"); return stop2; } __name(syncRef, "syncRef"); function syncRefs(source, targets, options4 = {}) { const { - flush = "sync", + flush: flush2 = "sync", deep = false, immediate = true } = options4; @@ -46976,7 +72528,7 @@ function syncRefs(source, targets, options4 = {}) { return watch( source, (newValue2) => targets.forEach((target) => target.value = newValue2), - { flush, deep, immediate } + { flush: flush2, deep, immediate } ); } __name(syncRefs, "syncRefs"); @@ -47043,12 +72595,12 @@ function tryOnUnmounted(fn, target) { onUnmounted(fn, target); } __name(tryOnUnmounted, "tryOnUnmounted"); -function createUntil(r, isNot = false) { - function toMatch(condition, { flush = "sync", deep = false, timeout, throwOnTimeout } = {}) { +function createUntil(r2, isNot = false) { + function toMatch(condition, { flush: flush2 = "sync", deep = false, timeout, throwOnTimeout } = {}) { let stop2 = null; const watcher = new Promise((resolve2) => { stop2 = watch( - r, + r2, (v2) => { if (condition(v2) !== isNot) { if (stop2) @@ -47059,7 +72611,7 @@ function createUntil(r, isNot = false) { } }, { - flush, + flush: flush2, deep, immediate: true } @@ -47068,7 +72620,7 @@ function createUntil(r, isNot = false) { const promises = [watcher]; if (timeout != null) { promises.push( - promiseTimeout(timeout, throwOnTimeout).then(() => toValue(r)).finally(() => stop2 == null ? void 0 : stop2()) + promiseTimeout(timeout, throwOnTimeout).then(() => toValue(r2)).finally(() => stop2 == null ? void 0 : stop2()) ); } return Promise.race(promises); @@ -47077,11 +72629,11 @@ function createUntil(r, isNot = false) { function toBe(value4, options4) { if (!isRef(value4)) return toMatch((v2) => v2 === value4, options4); - const { flush = "sync", deep = false, timeout, throwOnTimeout } = options4 != null ? options4 : {}; + const { flush: flush2 = "sync", deep = false, timeout, throwOnTimeout } = options4 != null ? options4 : {}; let stop2 = null; const watcher = new Promise((resolve2) => { stop2 = watch( - [r, value4], + [r2, value4], ([v1, v2]) => { if (isNot !== (v1 === v2)) { if (stop2) @@ -47092,7 +72644,7 @@ function createUntil(r, isNot = false) { } }, { - flush, + flush: flush2, deep, immediate: true } @@ -47101,9 +72653,9 @@ function createUntil(r, isNot = false) { const promises = [watcher]; if (timeout != null) { promises.push( - promiseTimeout(timeout, throwOnTimeout).then(() => toValue(r)).finally(() => { + promiseTimeout(timeout, throwOnTimeout).then(() => toValue(r2)).finally(() => { stop2 == null ? void 0 : stop2(); - return toValue(r); + return toValue(r2); }) ); } @@ -47137,22 +72689,22 @@ function createUntil(r, isNot = false) { return changedTimes(1, options4); } __name(changed, "changed"); - function changedTimes(n = 1, options4) { + function changedTimes(n2 = 1, options4) { let count = -1; return toMatch(() => { count += 1; - return count >= n; + return count >= n2; }, options4); } __name(changedTimes, "changedTimes"); - if (Array.isArray(toValue(r))) { + if (Array.isArray(toValue(r2))) { const instance = { toMatch, toContains, changed, changedTimes, get not() { - return createUntil(r, !isNot); + return createUntil(r2, !isNot); } }; return instance; @@ -47167,15 +72719,15 @@ function createUntil(r, isNot = false) { changed, changedTimes, get not() { - return createUntil(r, !isNot); + return createUntil(r2, !isNot); } }; return instance; } } __name(createUntil, "createUntil"); -function until(r) { - return createUntil(r); +function until(r2) { + return createUntil(r2); } __name(until, "until"); function defaultComparator(value4, othVal) { @@ -47228,7 +72780,7 @@ function useArrayFindLast(list2, fn) { } __name(useArrayFindLast, "useArrayFindLast"); function isArrayIncludesOptions(obj) { - return isObject$4(obj) && containsProp(obj, "formIndex", "comparator"); + return isObject$b(obj) && containsProp(obj, "formIndex", "comparator"); } __name(isArrayIncludesOptions, "isArrayIncludesOptions"); function useArrayIncludes(...args) { @@ -47314,10 +72866,10 @@ __name(useCounter, "useCounter"); const REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[T\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/i; const REGEX_FORMAT = /[YMDHhms]o|\[([^\]]+)\]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|Z{1,2}|SSS/g; function defaultMeridiem(hours, minutes, isLowercase, hasPeriod) { - let m = hours < 12 ? "AM" : "PM"; + let m2 = hours < 12 ? "AM" : "PM"; if (hasPeriod) - m = m.split("").reduce((acc, curr) => acc += `${curr}.`, ""); - return isLowercase ? m.toLowerCase() : m; + m2 = m2.split("").reduce((acc, curr) => acc += `${curr}.`, ""); + return isLowercase ? m2.toLowerCase() : m2; } __name(defaultMeridiem, "defaultMeridiem"); function formatOrdinal(num) { @@ -47385,11 +72937,11 @@ function normalizeDate(date) { if (date instanceof Date) return new Date(date); if (typeof date === "string" && !/Z$/i.test(date)) { - const d = date.match(REGEX_PARSE); - if (d) { - const m = d[2] - 1 || 0; - const ms = (d[7] || "0").substring(0, 3); - return new Date(d[1], m, d[3] || 1, d[4] || 0, d[5] || 0, d[6] || 0, ms); + const d2 = date.match(REGEX_PARSE); + if (d2) { + const m2 = d2[2] - 1 || 0; + const ms = (d2[7] || "0").substring(0, 3); + return new Date(d2[1], m2, d2[3] || 1, d2[4] || 0, d2[5] || 0, d2[6] || 0, ms); } } return new Date(date); @@ -47576,7 +73128,7 @@ function useToggle(initialValue = false, options4 = {}) { } = options4; const valueIsRef = isRef(initialValue); const _value = ref(initialValue); - function toggle4(value4) { + function toggle5(value4) { if (arguments.length) { _value.value = value4; return _value.value; @@ -47586,11 +73138,11 @@ function useToggle(initialValue = false, options4 = {}) { return _value.value; } } - __name(toggle4, "toggle"); + __name(toggle5, "toggle"); if (valueIsRef) - return toggle4; + return toggle5; else - return [_value, toggle4]; + return [_value, toggle5]; } __name(useToggle, "useToggle"); function watchArray(source, cb, options4) { @@ -47637,7 +73189,7 @@ function watchAtMost(source, cb, options4) { __name(watchAtMost, "watchAtMost"); function watchDebounced(source, cb, options4 = {}) { const { - debounce = 0, + debounce: debounce2 = 0, maxWait = void 0, ...watchOptions } = options4; @@ -47646,7 +73198,7 @@ function watchDebounced(source, cb, options4 = {}) { cb, { ...watchOptions, - eventFilter: debounceFilter(debounce, { maxWait }) + eventFilter: debounceFilter(debounce2, { maxWait }) } ); } @@ -48075,7 +73627,7 @@ function useEventListener(...args) { cleanup(); if (!el) return; - const optionsClone = isObject$4(options22) ? { ...options22 } : options22; + const optionsClone = isObject$b(options22) ? { ...options22 } : options22; cleanups.push( ...events2.flatMap((event) => { return listeners.map((listener) => register3(el, event, listener, optionsClone)); @@ -48448,7 +74000,7 @@ function useActiveElement(options4 = {}) { } if (triggerOnRemoval) { useMutationObserver(document2, (mutations) => { - mutations.filter((m) => m.removedNodes.length).map((n) => Array.from(n.removedNodes)).flat().forEach((node3) => { + mutations.filter((m2) => m2.removedNodes.length).map((n2) => Array.from(n2.removedNodes)).flat().forEach((node3) => { if (node3 === activeElement.value) trigger2(); }); @@ -48515,7 +74067,7 @@ __name(useRafFn, "useRafFn"); function useAnimate(target, keyframes, options4) { let config2; let animateOptions; - if (isObject$4(options4)) { + if (isObject$b(options4)) { config2 = options4; animateOptions = objectOmit(options4, ["window", "immediate", "commitStyles", "persist", "onReady", "onError"]); } else { @@ -48821,10 +74373,10 @@ function useAsyncState(promise, initialState, options4) { await promiseTimeout(delay2); const _promise = typeof promise === "function" ? promise(...args) : promise; try { - const data24 = await _promise; - state.value = data24; + const data25 = await _promise; + state.value = data25; isReady.value = true; - onSuccess(data24); + onSuccess(data25); } catch (e2) { error2.value = e2; onError(e2); @@ -49173,8 +74725,8 @@ const breakpointsPrimeFlex = { xl: 1200 }; function useBreakpoints(breakpoints, options4 = {}) { - function getValue2(k, delta2) { - let v2 = toValue(breakpoints[toValue(k)]); + function getValue2(k2, delta2) { + let v2 = toValue(breakpoints[toValue(k2)]); if (delta2 != null) v2 = increaseWithUnit(v2, delta2); if (typeof v2 === "number") @@ -49189,15 +74741,15 @@ function useBreakpoints(breakpoints, options4 = {}) { return window2.matchMedia(query).matches; } __name(match2, "match"); - const greaterOrEqual = /* @__PURE__ */ __name((k) => { - return useMediaQuery(() => `(min-width: ${getValue2(k)})`, options4); + const greaterOrEqual = /* @__PURE__ */ __name((k2) => { + return useMediaQuery(() => `(min-width: ${getValue2(k2)})`, options4); }, "greaterOrEqual"); - const smallerOrEqual = /* @__PURE__ */ __name((k) => { - return useMediaQuery(() => `(max-width: ${getValue2(k)})`, options4); + const smallerOrEqual = /* @__PURE__ */ __name((k2) => { + return useMediaQuery(() => `(max-width: ${getValue2(k2)})`, options4); }, "smallerOrEqual"); - const shortcutMethods = Object.keys(breakpoints).reduce((shortcuts, k) => { - Object.defineProperty(shortcuts, k, { - get: /* @__PURE__ */ __name(() => strategy === "min-width" ? greaterOrEqual(k) : smallerOrEqual(k), "get"), + const shortcutMethods = Object.keys(breakpoints).reduce((shortcuts, k2) => { + Object.defineProperty(shortcuts, k2, { + get: /* @__PURE__ */ __name(() => strategy === "min-width" ? greaterOrEqual(k2) : smallerOrEqual(k2), "get"), enumerable: true, configurable: true }); @@ -49205,35 +74757,35 @@ function useBreakpoints(breakpoints, options4 = {}) { }, {}); function current() { const points = Object.keys(breakpoints).map((i2) => [i2, greaterOrEqual(i2)]); - return computed(() => points.filter(([, v2]) => v2.value).map(([k]) => k)); + return computed(() => points.filter(([, v2]) => v2.value).map(([k2]) => k2)); } __name(current, "current"); return Object.assign(shortcutMethods, { greaterOrEqual, smallerOrEqual, - greater(k) { - return useMediaQuery(() => `(min-width: ${getValue2(k, 0.1)})`, options4); + greater(k2) { + return useMediaQuery(() => `(min-width: ${getValue2(k2, 0.1)})`, options4); }, - smaller(k) { - return useMediaQuery(() => `(max-width: ${getValue2(k, -0.1)})`, options4); + smaller(k2) { + return useMediaQuery(() => `(max-width: ${getValue2(k2, -0.1)})`, options4); }, - between(a, b) { - return useMediaQuery(() => `(min-width: ${getValue2(a)}) and (max-width: ${getValue2(b, -0.1)})`, options4); + between(a2, b2) { + return useMediaQuery(() => `(min-width: ${getValue2(a2)}) and (max-width: ${getValue2(b2, -0.1)})`, options4); }, - isGreater(k) { - return match2(`(min-width: ${getValue2(k, 0.1)})`); + isGreater(k2) { + return match2(`(min-width: ${getValue2(k2, 0.1)})`); }, - isGreaterOrEqual(k) { - return match2(`(min-width: ${getValue2(k)})`); + isGreaterOrEqual(k2) { + return match2(`(min-width: ${getValue2(k2)})`); }, - isSmaller(k) { - return match2(`(max-width: ${getValue2(k, -0.1)})`); + isSmaller(k2) { + return match2(`(max-width: ${getValue2(k2, -0.1)})`); }, - isSmallerOrEqual(k) { - return match2(`(max-width: ${getValue2(k)})`); + isSmallerOrEqual(k2) { + return match2(`(max-width: ${getValue2(k2)})`); }, - isInBetween(a, b) { - return match2(`(min-width: ${getValue2(a)}) and (max-width: ${getValue2(b, -0.1)})`); + isInBetween(a2, b2) { + return match2(`(min-width: ${getValue2(a2)}) and (max-width: ${getValue2(b2, -0.1)})`); }, current, active() { @@ -49251,11 +74803,11 @@ function useBroadcastChannel(options4) { const isSupported2 = useSupported(() => window2 && "BroadcastChannel" in window2); const isClosed = ref(false); const channel = ref(); - const data24 = ref(); + const data25 = ref(); const error2 = shallowRef(null); - const post = /* @__PURE__ */ __name((data25) => { + const post = /* @__PURE__ */ __name((data26) => { if (channel.value) - channel.value.postMessage(data25); + channel.value.postMessage(data26); }, "post"); const close5 = /* @__PURE__ */ __name(() => { if (channel.value) @@ -49267,7 +74819,7 @@ function useBroadcastChannel(options4) { error2.value = null; channel.value = new BroadcastChannel(name2); channel.value.addEventListener("message", (e2) => { - data24.value = e2.data; + data25.value = e2.data; }, { passive: true }); channel.value.addEventListener("messageerror", (e2) => { error2.value = e2; @@ -49283,7 +74835,7 @@ function useBroadcastChannel(options4) { return { isSupported: isSupported2, channel, - data: data24, + data: data25, post, close: close5, error: error2, @@ -49335,7 +74887,7 @@ function useBrowserLocation(options4 = {}) { return state; } __name(useBrowserLocation, "useBrowserLocation"); -function useCached(refValue, comparator2 = (a, b) => a === b, watchOptions) { +function useCached(refValue, comparator2 = (a2, b2) => a2 === b2, watchOptions) { const cachedValue = ref(refValue.value); watch(() => refValue.value, (value4) => { if (!comparator2(value4, cachedValue.value)) @@ -49576,7 +75128,7 @@ const customStorageEventName = "vueuse-storage"; function useStorage(key, defaults2, storage, options4 = {}) { var _a2; const { - flush = "pre", + flush: flush2 = "pre", deep = true, listenToStorageChanges = true, writeDefaults = true, @@ -49589,7 +75141,7 @@ function useStorage(key, defaults2, storage, options4 = {}) { }, "onError"), initOnMounted } = options4; - const data24 = (shallow ? shallowRef : ref)(typeof defaults2 === "function" ? defaults2() : defaults2); + const data25 = (shallow ? shallowRef : ref)(typeof defaults2 === "function" ? defaults2() : defaults2); if (!storage) { try { storage = getSSRHandler("getDefaultStorage", () => { @@ -49601,14 +75153,14 @@ function useStorage(key, defaults2, storage, options4 = {}) { } } if (!storage) - return data24; + return data25; const rawInit = toValue(defaults2); const type = guessSerializerType(rawInit); const serializer = (_a2 = options4.serializer) != null ? _a2 : StorageSerializers[type]; const { pause: pauseWatch, resume: resumeWatch } = watchPausable( - data24, - () => write(data24.value), - { flush, deep, eventFilter } + data25, + () => write(data25.value), + { flush: flush2, deep, eventFilter } ); if (window2 && listenToStorageChanges) { tryOnMounted(() => { @@ -49677,15 +75229,15 @@ function useStorage(key, defaults2, storage, options4 = {}) { if (event && event.storageArea !== storage) return; if (event && event.key == null) { - data24.value = rawInit; + data25.value = rawInit; return; } if (event && event.key !== key) return; pauseWatch(); try { - if ((event == null ? void 0 : event.newValue) !== serializer.write(data24.value)) - data24.value = read(event); + if ((event == null ? void 0 : event.newValue) !== serializer.write(data25.value)) + data25.value = read(event); } catch (e2) { onError(e2); } finally { @@ -49700,7 +75252,7 @@ function useStorage(key, defaults2, storage, options4 = {}) { update(event.detail); } __name(updateFromCustomEvent, "updateFromCustomEvent"); - return data24; + return data25; } __name(useStorage, "useStorage"); function usePreferredDark(options4) { @@ -49759,11 +75311,11 @@ function useColorMode(options4 = {}) { style2.appendChild(document.createTextNode(CSS_DISABLE_TRANS)); window2.document.head.appendChild(style2); } - for (const c of classesToAdd) { - el.classList.add(c); + for (const c2 of classesToAdd) { + el.classList.add(c2); } - for (const c of classesToRemove) { - el.classList.remove(c); + for (const c2 of classesToRemove) { + el.classList.remove(c2); } if (attributeToChange) { el.setAttribute(attributeToChange.key, attributeToChange.value); @@ -49808,22 +75360,22 @@ function useConfirmDialog(revealed = ref(false)) { const cancelHook = createEventHook(); const revealHook = createEventHook(); let _resolve = noop$1; - const reveal = /* @__PURE__ */ __name((data24) => { - revealHook.trigger(data24); + const reveal = /* @__PURE__ */ __name((data25) => { + revealHook.trigger(data25); revealed.value = true; return new Promise((resolve2) => { _resolve = resolve2; }); }, "reveal"); - const confirm2 = /* @__PURE__ */ __name((data24) => { + const confirm2 = /* @__PURE__ */ __name((data25) => { revealed.value = false; - confirmHook.trigger(data24); - _resolve({ data: data24, isCanceled: false }); + confirmHook.trigger(data25); + _resolve({ data: data25, isCanceled: false }); }, "confirm"); - const cancel = /* @__PURE__ */ __name((data24) => { + const cancel = /* @__PURE__ */ __name((data25) => { revealed.value = false; - cancelHook.trigger(data24); - _resolve({ data: data24, isCanceled: true }); + cancelHook.trigger(data25); + _resolve({ data: data25, isCanceled: true }); }, "cancel"); return { isRevealed: computed(() => revealed.value), @@ -49837,7 +75389,7 @@ function useConfirmDialog(revealed = ref(false)) { } __name(useConfirmDialog, "useConfirmDialog"); function useCssVar(prop2, target, options4 = {}) { - const { window: window2 = defaultWindow, initialValue, observe = false } = options4; + const { window: window2 = defaultWindow, initialValue, observe: observe2 = false } = options4; const variable = ref(initialValue); const elRef = computed(() => { var _a2; @@ -49853,7 +75405,7 @@ function useCssVar(prop2, target, options4 = {}) { } } __name(updateCssVar, "updateCssVar"); - if (observe) { + if (observe2) { useMutationObserver(elRef, updateCssVar, { attributeFilter: ["style", "class"], window: window2 @@ -49924,12 +75476,12 @@ function useCycleList(list2, options4) { return set22(index2.value + delta2); } __name(shift2, "shift"); - function next2(n = 1) { - return shift2(n); + function next2(n2 = 1) { + return shift2(n2); } __name(next2, "next"); - function prev2(n = 1) { - return shift2(-n); + function prev2(n2 = 1) { + return shift2(-n2); } __name(prev2, "prev"); function getInitialValue() { @@ -50023,9 +75575,9 @@ function useManualRefHistory(source, options4 = {}) { const last = ref(_createHistoryRecord()); const undoStack = ref([]); const redoStack = ref([]); - const _setSource = /* @__PURE__ */ __name((record) => { - setSource(source, parse2(record.snapshot)); - last.value = record; + const _setSource = /* @__PURE__ */ __name((record2) => { + setSource(source, parse2(record2.snapshot)); + last.value = record2; }, "_setSource"); const commit = /* @__PURE__ */ __name(() => { undoStack.value.unshift(last.value); @@ -50078,7 +75630,7 @@ __name(useManualRefHistory, "useManualRefHistory"); function useRefHistory(source, options4 = {}) { const { deep = false, - flush = "pre", + flush: flush2 = "pre", eventFilter } = options4; const { @@ -50094,7 +75646,7 @@ function useRefHistory(source, options4 = {}) { } = watchIgnorable( source, commit, - { deep, flush, eventFilter: composedFilter } + { deep, flush: flush2, eventFilter: composedFilter } ); function setSource(source2, value4) { ignorePrevAsyncUpdates(); @@ -50186,13 +75738,13 @@ __name(useDeviceMotion, "useDeviceMotion"); function useDeviceOrientation(options4 = {}) { const { window: window2 = defaultWindow } = options4; const isSupported2 = useSupported(() => window2 && "DeviceOrientationEvent" in window2); - const isAbsolute = ref(false); + const isAbsolute2 = ref(false); const alpha2 = ref(null); const beta = ref(null); const gamma = ref(null); if (window2 && isSupported2.value) { useEventListener(window2, "deviceorientation", (event) => { - isAbsolute.value = event.absolute; + isAbsolute2.value = event.absolute; alpha2.value = event.alpha; beta.value = event.beta; gamma.value = event.gamma; @@ -50200,7 +75752,7 @@ function useDeviceOrientation(options4 = {}) { } return { isSupported: isSupported2, - isAbsolute, + isAbsolute: isAbsolute2, alpha: alpha2, beta, gamma @@ -50664,7 +76216,7 @@ function useElementHover(el, options4 = {}) { } = options4; const isHovered = ref(false); let timer; - const toggle4 = /* @__PURE__ */ __name((entering) => { + const toggle5 = /* @__PURE__ */ __name((entering) => { const delay = entering ? delayEnter : delayLeave; if (timer) { clearTimeout(timer); @@ -50677,8 +76229,8 @@ function useElementHover(el, options4 = {}) { }, "toggle"); if (!window2) return isHovered; - useEventListener(el, "mouseenter", () => toggle4(true), { passive: true }); - useEventListener(el, "mouseleave", () => toggle4(false), { passive: true }); + useEventListener(el, "mouseenter", () => toggle5(true), { passive: true }); + useEventListener(el, "mouseleave", () => toggle5(false), { passive: true }); return isHovered; } __name(useElementHover, "useElementHover"); @@ -50742,7 +76294,7 @@ function useElementSize(target, initialSize = { width: 0, height: 0 }, options4 __name(useElementSize, "useElementSize"); function useIntersectionObserver(target, callback, options4 = {}) { const { - root: root24, + root: root27, rootMargin = "0px", threshold = 0, window: window2 = defaultWindow, @@ -50756,8 +76308,8 @@ function useIntersectionObserver(target, callback, options4 = {}) { let cleanup = noop$1; const isActive2 = ref(immediate); const stopWatch = isSupported2.value ? watch( - () => [targets.value, unrefElement(root24), isActive2.value], - ([targets2, root25]) => { + () => [targets.value, unrefElement(root27), isActive2.value], + ([targets2, root28]) => { cleanup(); if (!isActive2.value) return; @@ -50766,7 +76318,7 @@ function useIntersectionObserver(target, callback, options4 = {}) { const observer = new IntersectionObserver( callback, { - root: unrefElement(root25), + root: unrefElement(root28), rootMargin, threshold } @@ -50827,7 +76379,7 @@ __name(useElementVisibility, "useElementVisibility"); const events = /* @__PURE__ */ new Map(); function useEventBus(key) { const scope = getCurrentScope(); - function on(listener) { + function on2(listener) { var _a2; const listeners = events.get(key) || /* @__PURE__ */ new Set(); listeners.add(listener); @@ -50836,14 +76388,14 @@ function useEventBus(key) { (_a2 = scope == null ? void 0 : scope.cleanups) == null ? void 0 : _a2.push(_off); return _off; } - __name(on, "on"); + __name(on2, "on"); function once2(listener) { function _listener(...args) { off(_listener); listener(...args); } __name(_listener, "_listener"); - return on(_listener); + return on2(_listener); } __name(once2, "once"); function off(listener) { @@ -50864,7 +76416,7 @@ function useEventBus(key) { (_a2 = events.get(key)) == null ? void 0 : _a2.forEach((v2) => v2(event, payload)); } __name(emit2, "emit"); - return { on, once: once2, off, emit: emit2, reset: reset2 }; + return { on: on2, once: once2, off, emit: emit2, reset: reset2 }; } __name(useEventBus, "useEventBus"); function resolveNestedOptions$1(options4) { @@ -50875,12 +76427,12 @@ function resolveNestedOptions$1(options4) { __name(resolveNestedOptions$1, "resolveNestedOptions$1"); function useEventSource(url, events2 = [], options4 = {}) { const event = ref(null); - const data24 = ref(null); + const data25 = ref(null); const status = ref("CONNECTING"); const eventSource = ref(null); const error2 = shallowRef(null); const urlRef = toRef(url); - const lastEventId = shallowRef(null); + const lastEventId2 = shallowRef(null); let explicitlyClosed = false; let retried = 0; const { @@ -50926,13 +76478,13 @@ function useEventSource(url, events2 = [], options4 = {}) { }; es.onmessage = (e2) => { event.value = null; - data24.value = e2.data; - lastEventId.value = e2.lastEventId; + data25.value = e2.data; + lastEventId2.value = e2.lastEventId; }; for (const event_name of events2) { useEventListener(es, event_name, (e2) => { event.value = event_name; - data24.value = e2.data || null; + data25.value = e2.data || null; }); } }, "_init"); @@ -50950,12 +76502,12 @@ function useEventSource(url, events2 = [], options4 = {}) { return { eventSource, event, - data: data24, + data: data25, status, error: error2, open: open2, close: close5, - lastEventId + lastEventId: lastEventId2 }; } __name(useEventSource, "useEventSource"); @@ -50998,8 +76550,8 @@ function useFavicon(newIcon = null, options4 = {}) { }, "applyIcon"); watch( favicon, - (i2, o) => { - if (typeof i2 === "string" && i2 !== o) + (i2, o2) => { + if (typeof i2 === "string" && i2 !== o2) applyIcon(i2); }, { immediate: true } @@ -51131,7 +76683,7 @@ function useFetch(url, ...args) { const statusCode = ref(null); const response = shallowRef(null); const error2 = shallowRef(null); - const data24 = shallowRef(initialData || null); + const data25 = shallowRef(initialData || null); const canAbort = computed(() => supportsAbort && isFetching.value); let controller; let timer; @@ -51210,7 +76762,7 @@ function useFetch(url, ...args) { statusCode.value = fetchResponse.status; responseData = await fetchResponse.clone()[config2.type](); if (!fetchResponse.ok) { - data24.value = initialData || null; + data25.value = initialData || null; throw new Error(fetchResponse.statusText); } if (options4.afterFetch) { @@ -51219,7 +76771,7 @@ function useFetch(url, ...args) { response: fetchResponse })); } - data24.value = responseData; + data25.value = responseData; responseEvent.trigger(fetchResponse); return fetchResponse; }).catch(async (fetchError) => { @@ -51233,7 +76785,7 @@ function useFetch(url, ...args) { } error2.value = errorData; if (options4.updateDataOnError) - data24.value = responseData; + data25.value = responseData; errorEvent.trigger(fetchError); if (throwOnFailed) throw fetchError; @@ -51261,7 +76813,7 @@ function useFetch(url, ...args) { statusCode, response, error: error2, - data: data24, + data: data25, canAbort, aborted, abort, @@ -51410,7 +76962,7 @@ function useFileSystemAccess(options4 = {}) { const window2 = _window; const isSupported2 = useSupported(() => window2 && "showSaveFilePicker" in window2 && "showOpenFilePicker" in window2); const fileHandle = ref(); - const data24 = ref(); + const data25 = ref(); const file = ref(); const fileName = computed(() => { var _a2, _b; @@ -51440,7 +76992,7 @@ function useFileSystemAccess(options4 = {}) { if (!isSupported2.value) return; fileHandle.value = await window2.showSaveFilePicker({ ...options4, ..._options }); - data24.value = void 0; + data25.value = void 0; await updateData(); } __name(create3, "create"); @@ -51449,9 +77001,9 @@ function useFileSystemAccess(options4 = {}) { return; if (!fileHandle.value) return saveAs2(_options); - if (data24.value) { + if (data25.value) { const writableStream = await fileHandle.value.createWritable(); - await writableStream.write(data24.value); + await writableStream.write(data25.value); await writableStream.close(); } await updateFile(); @@ -51461,9 +77013,9 @@ function useFileSystemAccess(options4 = {}) { if (!isSupported2.value) return; fileHandle.value = await window2.showSaveFilePicker({ ...options4, ..._options }); - if (data24.value) { + if (data25.value) { const writableStream = await fileHandle.value.createWritable(); - await writableStream.write(data24.value); + await writableStream.write(data25.value); await writableStream.close(); } await updateFile(); @@ -51479,17 +77031,17 @@ function useFileSystemAccess(options4 = {}) { await updateFile(); const type = toValue(dataType); if (type === "Text") - data24.value = await ((_a2 = file.value) == null ? void 0 : _a2.text()); + data25.value = await ((_a2 = file.value) == null ? void 0 : _a2.text()); else if (type === "ArrayBuffer") - data24.value = await ((_b = file.value) == null ? void 0 : _b.arrayBuffer()); + data25.value = await ((_b = file.value) == null ? void 0 : _b.arrayBuffer()); else if (type === "Blob") - data24.value = file.value; + data25.value = file.value; } __name(updateData, "updateData"); watch(() => toValue(dataType), updateData); return { isSupported: isSupported2, - data: data24, + data: data25, file, fileName, fileMIME, @@ -51587,7 +77139,7 @@ function useFullscreen(target, options4 = {}) { "webkitRequestFullScreen", "mozRequestFullScreen", "msRequestFullscreen" - ].find((m) => document2 && m in document2 || targetRef.value && m in targetRef.value); + ].find((m2) => document2 && m2 in document2 || targetRef.value && m2 in targetRef.value); }); const exitMethod = computed(() => { return [ @@ -51597,7 +77149,7 @@ function useFullscreen(target, options4 = {}) { "webkitCancelFullScreen", "mozCancelFullScreen", "msExitFullscreen" - ].find((m) => document2 && m in document2 || targetRef.value && m in targetRef.value); + ].find((m2) => document2 && m2 in document2 || targetRef.value && m2 in targetRef.value); }); const fullscreenEnabled = computed(() => { return [ @@ -51606,14 +77158,14 @@ function useFullscreen(target, options4 = {}) { "webkitDisplayingFullscreen", "mozFullScreen", "msFullscreenElement" - ].find((m) => document2 && m in document2 || targetRef.value && m in targetRef.value); + ].find((m2) => document2 && m2 in document2 || targetRef.value && m2 in targetRef.value); }); const fullscreenElementMethod = [ "fullscreenElement", "webkitFullscreenElement", "mozFullScreenElement", "msFullscreenElement" - ].find((m) => document2 && m in document2); + ].find((m2) => document2 && m2 in document2); const isSupported2 = useSupported(() => targetRef.value && document2 && requestMethod.value !== void 0 && exitMethod.value !== void 0 && fullscreenEnabled.value !== void 0); const isCurrentElementFullScreen = /* @__PURE__ */ __name(() => { if (fullscreenElementMethod) @@ -51660,10 +77212,10 @@ function useFullscreen(target, options4 = {}) { } } __name(enter2, "enter"); - async function toggle4() { + async function toggle5() { await (isFullscreen.value ? exit() : enter2()); } - __name(toggle4, "toggle"); + __name(toggle5, "toggle"); const handlerCallback = /* @__PURE__ */ __name(() => { const isElementFullScreenValue = isElementFullScreen(); if (!isElementFullScreenValue || isElementFullScreenValue && isCurrentElementFullScreen()) @@ -51678,7 +77230,7 @@ function useFullscreen(target, options4 = {}) { isFullscreen, enter: enter2, exit, - toggle: toggle4 + toggle: toggle5 }; } __name(useFullscreen, "useFullscreen"); @@ -52285,8 +77837,8 @@ function useMagicKeys(options4 = {}) { refs[prop2] = ref(false); } } - const r = Reflect.get(target2, prop2, rec); - return useReactive ? toValue(r) : r; + const r2 = Reflect.get(target2, prop2, rec); + return useReactive ? toValue(r2) : r2; } } ); @@ -52386,7 +77938,7 @@ function useMediaControls(target, options4 = {}) { sources = [{ src }]; else if (Array.isArray(src)) sources = src; - else if (isObject$4(src)) + else if (isObject$b(src)) sources = [src]; el.querySelectorAll("source").forEach((e2) => { e2.removeEventListener("error", sourceErrorEvent.trigger); @@ -52528,15 +78080,15 @@ function useMediaControls(target, options4 = {}) { } __name(useMediaControls, "useMediaControls"); function getMapVue2Compat() { - const data24 = shallowReactive({}); + const data25 = shallowReactive({}); return { - get: /* @__PURE__ */ __name((key) => data24[key], "get"), - set: /* @__PURE__ */ __name((key, value4) => set(data24, key, value4), "set"), - has: /* @__PURE__ */ __name((key) => hasOwn$2(data24, key), "has"), - delete: /* @__PURE__ */ __name((key) => del$1(data24, key), "delete"), + get: /* @__PURE__ */ __name((key) => data25[key], "get"), + set: /* @__PURE__ */ __name((key, value4) => set(data25, key, value4), "set"), + has: /* @__PURE__ */ __name((key) => hasOwn$2(data25, key), "has"), + delete: /* @__PURE__ */ __name((key) => del$1(data25, key), "delete"), clear: /* @__PURE__ */ __name(() => { - Object.keys(data24).forEach((key) => { - del$1(data24, key); + Object.keys(data25).forEach((key) => { + del$1(data25, key); }); }, "clear") }; @@ -53131,7 +78683,7 @@ const defaultState = { twist: 0, pointerType: null }; -const keys$1 = /* @__PURE__ */ Object.keys(defaultState); +const keys$6 = /* @__PURE__ */ Object.keys(defaultState); function usePointer(options4 = {}) { const { target = defaultWindow @@ -53143,7 +78695,7 @@ function usePointer(options4 = {}) { isInside.value = true; if (options4.pointerTypes && !options4.pointerTypes.includes(event.pointerType)) return; - state.value = objectPick(event, keys$1, false); + state.value = objectPick(event, keys$6, false); }, "handler"); if (target) { const listenerOptions = { passive: true }; @@ -53292,7 +78844,7 @@ function usePointerSwipe(target, options4 = {}) { (_h = (_g = targetRef.value) == null ? void 0 : _g.style) == null ? void 0 : _h.setProperty("user-select", "none"); } }); - const stop2 = /* @__PURE__ */ __name(() => stops.forEach((s) => s()), "stop"); + const stop2 = /* @__PURE__ */ __name(() => stops.forEach((s2) => s2()), "stop"); return { isSwiping: readonly(isSwiping), direction: readonly(direction), @@ -53386,10 +78938,10 @@ function useScreenSafeArea() { useEventListener("resize", useDebounceFn(update)); } function update() { - top.value = getValue(topVarName); - right.value = getValue(rightVarName); - bottom.value = getValue(bottomVarName); - left.value = getValue(leftVarName); + top.value = getValue$2(topVarName); + right.value = getValue$2(rightVarName); + bottom.value = getValue$2(bottomVarName); + left.value = getValue$2(leftVarName); } __name(update, "update"); return { @@ -53401,10 +78953,10 @@ function useScreenSafeArea() { }; } __name(useScreenSafeArea, "useScreenSafeArea"); -function getValue(position3) { +function getValue$2(position3) { return getComputedStyle(document.documentElement).getPropertyValue(position3); } -__name(getValue, "getValue"); +__name(getValue$2, "getValue$2"); function useScriptTag(src, onLoaded = noop$1, options4 = {}) { const { immediate = true, @@ -53580,15 +79132,15 @@ function useShare(shareOptions = {}, options4 = {}) { const isSupported2 = useSupported(() => _navigator2 && "canShare" in _navigator2); const share = /* @__PURE__ */ __name(async (overrideOptions = {}) => { if (isSupported2.value) { - const data24 = { + const data25 = { ...toValue(shareOptions), ...toValue(overrideOptions) }; let granted = true; - if (data24.files && _navigator2.canShare) - granted = _navigator2.canShare({ files: data24.files }); + if (data25.files && _navigator2.canShare) + granted = _navigator2.canShare({ files: data25.files }); if (granted) - return _navigator2.share(data24); + return _navigator2.share(data25); } }, "share"); return { @@ -53598,7 +79150,7 @@ function useShare(shareOptions = {}, options4 = {}) { } __name(useShare, "useShare"); const defaultSortFn = /* @__PURE__ */ __name((source, compareFn) => source.sort(compareFn), "defaultSortFn"); -const defaultCompare = /* @__PURE__ */ __name((a, b) => a - b, "defaultCompare"); +const defaultCompare = /* @__PURE__ */ __name((a2, b2) => a2 - b2, "defaultCompare"); function useSorted(...args) { var _a2, _b, _c, _d; const [source] = args; @@ -53643,7 +79195,7 @@ function useSpeechRecognition(options4 = {}) { const isFinal = ref(false); const result = ref(""); const error2 = shallowRef(void 0); - const toggle4 = /* @__PURE__ */ __name((value4 = !isListening.value) => { + const toggle5 = /* @__PURE__ */ __name((value4 = !isListening.value) => { isListening.value = value4; }, "toggle"); const start2 = /* @__PURE__ */ __name(() => { @@ -53699,7 +79251,7 @@ function useSpeechRecognition(options4 = {}) { recognition, result, error: error2, - toggle: toggle4, + toggle: toggle5, start: start2, stop: stop2 }; @@ -53719,7 +79271,7 @@ function useSpeechSynthesis(text2, options4 = {}) { const spokenText = toRef(text2 || ""); const lang = toRef(options4.lang || "en-US"); const error2 = shallowRef(void 0); - const toggle4 = /* @__PURE__ */ __name((value4 = !isPlaying.value) => { + const toggle5 = /* @__PURE__ */ __name((value4 = !isPlaying.value) => { isPlaying.value = value4; }, "toggle"); const bindEventsForUtterance = /* @__PURE__ */ __name((utterance2) => { @@ -53792,7 +79344,7 @@ function useSpeechSynthesis(text2, options4 = {}) { utterance, error: error2, stop: stop2, - toggle: toggle4, + toggle: toggle5, speak }; } @@ -53886,7 +79438,7 @@ __name(useStepper, "useStepper"); function useStorageAsync(key, initialValue, storage, options4 = {}) { var _a2; const { - flush = "pre", + flush: flush2 = "pre", deep = true, listenToStorageChanges = true, writeDefaults = true, @@ -53900,7 +79452,7 @@ function useStorageAsync(key, initialValue, storage, options4 = {}) { } = options4; const rawInit = toValue(initialValue); const type = guessSerializerType(rawInit); - const data24 = (shallow ? shallowRef : ref)(initialValue); + const data25 = (shallow ? shallowRef : ref)(initialValue); const serializer = (_a2 = options4.serializer) != null ? _a2 : StorageSerializers[type]; if (!storage) { try { @@ -53918,18 +79470,18 @@ function useStorageAsync(key, initialValue, storage, options4 = {}) { try { const rawValue = event ? event.newValue : await storage.getItem(key); if (rawValue == null) { - data24.value = rawInit; + data25.value = rawInit; if (writeDefaults && rawInit !== null) await storage.setItem(key, await serializer.write(rawInit)); } else if (mergeDefaults2) { const value4 = await serializer.read(rawValue); if (typeof mergeDefaults2 === "function") - data24.value = mergeDefaults2(value4, rawInit); + data25.value = mergeDefaults2(value4, rawInit); else if (type === "object" && !Array.isArray(value4)) - data24.value = { ...rawInit, ...value4 }; - else data24.value = value4; + data25.value = { ...rawInit, ...value4 }; + else data25.value = value4; } else { - data24.value = await serializer.read(rawValue); + data25.value = await serializer.read(rawValue); } } catch (e2) { onError(e2); @@ -53941,25 +79493,25 @@ function useStorageAsync(key, initialValue, storage, options4 = {}) { useEventListener(window2, "storage", (e2) => Promise.resolve().then(() => read(e2))); if (storage) { watchWithFilter( - data24, + data25, async () => { try { - if (data24.value == null) + if (data25.value == null) await storage.removeItem(key); else - await storage.setItem(key, await serializer.write(data24.value)); + await storage.setItem(key, await serializer.write(data25.value)); } catch (e2) { onError(e2); } }, { - flush, + flush: flush2, deep, eventFilter } ); } - return data24; + return data25; } __name(useStorageAsync, "useStorageAsync"); let _id = 0; @@ -54083,7 +79635,7 @@ function useSwipe(target, options4 = {}) { }, listenerOptions), useEventListener(target, ["touchend", "touchcancel"], onTouchEnd4, listenerOptions) ]; - const stop2 = /* @__PURE__ */ __name(() => stops.forEach((s) => s()), "stop"); + const stop2 = /* @__PURE__ */ __name(() => stops.forEach((s2) => s2()), "stop"); return { isPassiveEventSupported, isSwiping, @@ -54127,7 +79679,7 @@ function useTextDirection(options4 = {}) { const { document: document2 = defaultDocument, selector = "html", - observe = false, + observe: observe2 = false, initialValue = "ltr" } = options4; function getValue2() { @@ -54137,7 +79689,7 @@ function useTextDirection(options4 = {}) { __name(getValue2, "getValue2"); const dir = ref(getValue2()); tryOnMounted(() => dir.value = getValue2()); - if (observe && document2) { + if (observe2 && document2) { useMutationObserver( document2.querySelector(selector), () => dir.value = getValue2(), @@ -54256,15 +79808,15 @@ const DEFAULT_UNITS = [ ]; const DEFAULT_MESSAGES = { justNow: "just now", - past: /* @__PURE__ */ __name((n) => n.match(/\d/) ? `${n} ago` : n, "past"), - future: /* @__PURE__ */ __name((n) => n.match(/\d/) ? `in ${n}` : n, "future"), - month: /* @__PURE__ */ __name((n, past) => n === 1 ? past ? "last month" : "next month" : `${n} month${n > 1 ? "s" : ""}`, "month"), - year: /* @__PURE__ */ __name((n, past) => n === 1 ? past ? "last year" : "next year" : `${n} year${n > 1 ? "s" : ""}`, "year"), - day: /* @__PURE__ */ __name((n, past) => n === 1 ? past ? "yesterday" : "tomorrow" : `${n} day${n > 1 ? "s" : ""}`, "day"), - week: /* @__PURE__ */ __name((n, past) => n === 1 ? past ? "last week" : "next week" : `${n} week${n > 1 ? "s" : ""}`, "week"), - hour: /* @__PURE__ */ __name((n) => `${n} hour${n > 1 ? "s" : ""}`, "hour"), - minute: /* @__PURE__ */ __name((n) => `${n} minute${n > 1 ? "s" : ""}`, "minute"), - second: /* @__PURE__ */ __name((n) => `${n} second${n > 1 ? "s" : ""}`, "second"), + past: /* @__PURE__ */ __name((n2) => n2.match(/\d/) ? `${n2} ago` : n2, "past"), + future: /* @__PURE__ */ __name((n2) => n2.match(/\d/) ? `in ${n2}` : n2, "future"), + month: /* @__PURE__ */ __name((n2, past) => n2 === 1 ? past ? "last month" : "next month" : `${n2} month${n2 > 1 ? "s" : ""}`, "month"), + year: /* @__PURE__ */ __name((n2, past) => n2 === 1 ? past ? "last year" : "next year" : `${n2} year${n2 > 1 ? "s" : ""}`, "year"), + day: /* @__PURE__ */ __name((n2, past) => n2 === 1 ? past ? "yesterday" : "tomorrow" : `${n2} day${n2 > 1 ? "s" : ""}`, "day"), + week: /* @__PURE__ */ __name((n2, past) => n2 === 1 ? past ? "last week" : "next week" : `${n2} week${n2 > 1 ? "s" : ""}`, "week"), + hour: /* @__PURE__ */ __name((n2) => `${n2} hour${n2 > 1 ? "s" : ""}`, "hour"), + minute: /* @__PURE__ */ __name((n2) => `${n2} minute${n2 > 1 ? "s" : ""}`, "minute"), + second: /* @__PURE__ */ __name((n2) => `${n2} second${n2 > 1 ? "s" : ""}`, "second"), invalid: "" }; function DEFAULT_FORMATTER(date) { @@ -54298,7 +79850,7 @@ function formatTimeAgo(from2, options4 = {}, now2 = Date.now()) { showSecond = false, rounding = "round" } = options4; - const roundFn = typeof rounding === "number" ? (n) => +n.toFixed(rounding) : Math[rounding]; + const roundFn = typeof rounding === "number" ? (n2) => +n2.toFixed(rounding) : Math[rounding]; const diff2 = +now2 - +from2; const absDiff = Math.abs(diff2); function getValue2(diff22, unit) { @@ -54412,8 +79964,8 @@ function useTitle(newTitle = null, options4 = {}) { __name(format2, "format"); watch( title, - (t2, o) => { - if (t2 !== o && document2) + (t2, o2) => { + if (t2 !== o2 && document2) document2.title = format2(typeof t2 === "string" ? t2 : ""); }, { immediate: true } @@ -54466,11 +80018,11 @@ const _TransitionPresets = { }; const TransitionPresets = /* @__PURE__ */ Object.assign({}, { linear: identity }, _TransitionPresets); function createEasingFunction([p0, p1, p2, p3]) { - const a = /* @__PURE__ */ __name((a1, a2) => 1 - 3 * a2 + 3 * a1, "a"); - const b = /* @__PURE__ */ __name((a1, a2) => 3 * a2 - 6 * a1, "b"); - const c = /* @__PURE__ */ __name((a1) => 3 * a1, "c"); - const calcBezier = /* @__PURE__ */ __name((t2, a1, a2) => ((a(a1, a2) * t2 + b(a1, a2)) * t2 + c(a1)) * t2, "calcBezier"); - const getSlope = /* @__PURE__ */ __name((t2, a1, a2) => 3 * a(a1, a2) * t2 * t2 + 2 * b(a1, a2) * t2 + c(a1), "getSlope"); + const a2 = /* @__PURE__ */ __name((a1, a22) => 1 - 3 * a22 + 3 * a1, "a"); + const b2 = /* @__PURE__ */ __name((a1, a22) => 3 * a22 - 6 * a1, "b"); + const c2 = /* @__PURE__ */ __name((a1) => 3 * a1, "c"); + const calcBezier = /* @__PURE__ */ __name((t2, a1, a22) => ((a2(a1, a22) * t2 + b2(a1, a22)) * t2 + c2(a1)) * t2, "calcBezier"); + const getSlope = /* @__PURE__ */ __name((t2, a1, a22) => 3 * a2(a1, a22) * t2 * t2 + 2 * b2(a1, a22) * t2 + c2(a1), "getSlope"); const getTforX = /* @__PURE__ */ __name((x2) => { let aGuessT = x2; for (let i2 = 0; i2 < 4; ++i2) { @@ -54485,8 +80037,8 @@ function createEasingFunction([p0, p1, p2, p3]) { return (x2) => p0 === p1 && p2 === p3 ? x2 : calcBezier(getTforX(x2), p1, p3); } __name(createEasingFunction, "createEasingFunction"); -function lerp(a, b, alpha2) { - return a + alpha2 * (b - a); +function lerp(a2, b2, alpha2) { + return a2 + alpha2 * (b2 - a2); } __name(lerp, "lerp"); function toVec(t2) { @@ -54514,9 +80066,9 @@ function executeTransition(source, from2, to, options4 = {}) { } const now2 = Date.now(); const alpha2 = ease((now2 - startedAt) / duration); - const arr = toVec(source.value).map((n, i2) => lerp(v1[i2], v2[i2], alpha2)); + const arr = toVec(source.value).map((n2, i2) => lerp(v1[i2], v2[i2], alpha2)); if (Array.isArray(source.value)) - source.value = arr.map((n, i2) => { + source.value = arr.map((n2, i2) => { var _a3, _b2; return lerp((_a3 = v1[i2]) != null ? _a3 : 0, (_b2 = v2[i2]) != null ? _b2 : 0, alpha2); }); @@ -55102,9 +80654,9 @@ function useWakeLock(options4 = {}) { __name(request, "request"); async function release() { requestedType.value = false; - const s = sentinel.value; + const s2 = sentinel.value; sentinel.value = null; - await (s == null ? void 0 : s.release()); + await (s2 == null ? void 0 : s2.release()); } __name(release, "release"); return { @@ -55208,7 +80760,7 @@ function useWebSocket(url, options4 = {}) { autoClose = true, protocols = [] } = options4; - const data24 = ref(null); + const data25 = ref(null); const status = ref("CLOSED"); const wsRef = ref(); const urlRef = toRef(url); @@ -55238,14 +80790,14 @@ function useWebSocket(url, options4 = {}) { wsRef.value.close(code2, reason); wsRef.value = void 0; }, "close"); - const send = /* @__PURE__ */ __name((data25, useBuffer = true) => { + const send = /* @__PURE__ */ __name((data26, useBuffer = true) => { if (!wsRef.value || status.value !== "OPEN") { if (useBuffer) - bufferedData.push(data25); + bufferedData.push(data26); return false; } _sendBuffer(); - wsRef.value.send(data25); + wsRef.value.send(data26); return true; }, "send"); const _init = /* @__PURE__ */ __name(() => { @@ -55291,7 +80843,7 @@ function useWebSocket(url, options4 = {}) { if (e2.data === responseMessage) return; } - data24.value = e2.data; + data25.value = e2.data; onMessage == null ? void 0 : onMessage(ws, e2); }; }, "_init"); @@ -55334,7 +80886,7 @@ function useWebSocket(url, options4 = {}) { open2(); watch(urlRef, open2); return { - data: data24, + data: data25, status, close: close5, send, @@ -55347,7 +80899,7 @@ function useWebWorker(arg0, workerOptions, options4) { const { window: window2 = defaultWindow } = options4 != null ? options4 : {}; - const data24 = ref(null); + const data25 = ref(null); const worker = shallowRef(); const post = /* @__PURE__ */ __name((...args) => { if (!worker.value) @@ -55367,7 +80919,7 @@ function useWebWorker(arg0, workerOptions, options4) { else worker.value = arg0; worker.value.onmessage = (e2) => { - data24.value = e2.data; + data25.value = e2.data; }; tryOnScopeDispose(() => { if (worker.value) @@ -55375,7 +80927,7 @@ function useWebWorker(arg0, workerOptions, options4) { }); } return { - data: data24, + data: data25, post, terminate, worker @@ -55594,115 +81146,115 @@ __name(useWindowSize, "useWindowSize"); var BaseComponentStyle$1 = BaseStyle.extend({ name: "common" }); -function _typeof$f(o) { +function _typeof$f(o2) { "@babel/helpers - typeof"; - return _typeof$f = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { - return typeof o2; - } : function(o2) { - return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; - }, _typeof$f(o); + return _typeof$f = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { + return typeof o3; + } : function(o3) { + return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; + }, _typeof$f(o2); } __name(_typeof$f, "_typeof$f"); -function _toArray(r) { - return _arrayWithHoles$1(r) || _iterableToArray$c(r) || _unsupportedIterableToArray$e(r) || _nonIterableRest$1(); +function _toArray(r2) { + return _arrayWithHoles$1(r2) || _iterableToArray$c(r2) || _unsupportedIterableToArray$e(r2) || _nonIterableRest$1(); } __name(_toArray, "_toArray"); -function _iterableToArray$c(r) { - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); +function _iterableToArray$c(r2) { + if ("undefined" != typeof Symbol && null != r2[Symbol.iterator] || null != r2["@@iterator"]) return Array.from(r2); } __name(_iterableToArray$c, "_iterableToArray$c"); -function _slicedToArray$1(r, e2) { - return _arrayWithHoles$1(r) || _iterableToArrayLimit$1(r, e2) || _unsupportedIterableToArray$e(r, e2) || _nonIterableRest$1(); +function _slicedToArray$1(r2, e2) { + return _arrayWithHoles$1(r2) || _iterableToArrayLimit$1(r2, e2) || _unsupportedIterableToArray$e(r2, e2) || _nonIterableRest$1(); } __name(_slicedToArray$1, "_slicedToArray$1"); function _nonIterableRest$1() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } __name(_nonIterableRest$1, "_nonIterableRest$1"); -function _unsupportedIterableToArray$e(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray$e(r, a); - var t2 = {}.toString.call(r).slice(8, -1); - return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$e(r, a) : void 0; +function _unsupportedIterableToArray$e(r2, a2) { + if (r2) { + if ("string" == typeof r2) return _arrayLikeToArray$e(r2, a2); + var t2 = {}.toString.call(r2).slice(8, -1); + return "Object" === t2 && r2.constructor && (t2 = r2.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r2) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$e(r2, a2) : void 0; } } __name(_unsupportedIterableToArray$e, "_unsupportedIterableToArray$e"); -function _arrayLikeToArray$e(r, a) { - (null == a || a > r.length) && (a = r.length); - for (var e2 = 0, n = Array(a); e2 < a; e2++) n[e2] = r[e2]; - return n; +function _arrayLikeToArray$e(r2, a2) { + (null == a2 || a2 > r2.length) && (a2 = r2.length); + for (var e2 = 0, n2 = Array(a2); e2 < a2; e2++) n2[e2] = r2[e2]; + return n2; } __name(_arrayLikeToArray$e, "_arrayLikeToArray$e"); -function _iterableToArrayLimit$1(r, l) { - var t2 = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; +function _iterableToArrayLimit$1(r2, l2) { + var t2 = null == r2 ? null : "undefined" != typeof Symbol && r2[Symbol.iterator] || r2["@@iterator"]; if (null != t2) { - var e2, n, i2, u, a = [], f = true, o = false; + var e2, n2, i2, u2, a2 = [], f2 = true, o2 = false; try { - if (i2 = (t2 = t2.call(r)).next, 0 === l) { + if (i2 = (t2 = t2.call(r2)).next, 0 === l2) { if (Object(t2) !== t2) return; - f = false; - } else for (; !(f = (e2 = i2.call(t2)).done) && (a.push(e2.value), a.length !== l); f = true) ; - } catch (r2) { - o = true, n = r2; + f2 = false; + } else for (; !(f2 = (e2 = i2.call(t2)).done) && (a2.push(e2.value), a2.length !== l2); f2 = true) ; + } catch (r3) { + o2 = true, n2 = r3; } finally { try { - if (!f && null != t2["return"] && (u = t2["return"](), Object(u) !== u)) return; + if (!f2 && null != t2["return"] && (u2 = t2["return"](), Object(u2) !== u2)) return; } finally { - if (o) throw n; + if (o2) throw n2; } } - return a; + return a2; } } __name(_iterableToArrayLimit$1, "_iterableToArrayLimit$1"); -function _arrayWithHoles$1(r) { - if (Array.isArray(r)) return r; +function _arrayWithHoles$1(r2) { + if (Array.isArray(r2)) return r2; } __name(_arrayWithHoles$1, "_arrayWithHoles$1"); -function ownKeys$f(e2, r) { +function ownKeys$f(e2, r2) { var t2 = Object.keys(e2); if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e2); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e2, r2).enumerable; - })), t2.push.apply(t2, o); + var o2 = Object.getOwnPropertySymbols(e2); + r2 && (o2 = o2.filter(function(r3) { + return Object.getOwnPropertyDescriptor(e2, r3).enumerable; + })), t2.push.apply(t2, o2); } return t2; } __name(ownKeys$f, "ownKeys$f"); function _objectSpread$f(e2) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$f(Object(t2), true).forEach(function(r2) { - _defineProperty$f(e2, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$f(Object(t2)).forEach(function(r2) { - Object.defineProperty(e2, r2, Object.getOwnPropertyDescriptor(t2, r2)); + for (var r2 = 1; r2 < arguments.length; r2++) { + var t2 = null != arguments[r2] ? arguments[r2] : {}; + r2 % 2 ? ownKeys$f(Object(t2), true).forEach(function(r3) { + _defineProperty$h(e2, r3, t2[r3]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$f(Object(t2)).forEach(function(r3) { + Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3)); }); } return e2; } __name(_objectSpread$f, "_objectSpread$f"); -function _defineProperty$f(e2, r, t2) { - return (r = _toPropertyKey$e(r)) in e2 ? Object.defineProperty(e2, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r] = t2, e2; +function _defineProperty$h(e2, r2, t2) { + return (r2 = _toPropertyKey$e(r2)) in e2 ? Object.defineProperty(e2, r2, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r2] = t2, e2; } -__name(_defineProperty$f, "_defineProperty$f"); +__name(_defineProperty$h, "_defineProperty$h"); function _toPropertyKey$e(t2) { var i2 = _toPrimitive$e(t2, "string"); return "symbol" == _typeof$f(i2) ? i2 : i2 + ""; } __name(_toPropertyKey$e, "_toPropertyKey$e"); -function _toPrimitive$e(t2, r) { +function _toPrimitive$e(t2, r2) { if ("object" != _typeof$f(t2) || !t2) return t2; var e2 = t2[Symbol.toPrimitive]; if (void 0 !== e2) { - var i2 = e2.call(t2, r || "default"); + var i2 = e2.call(t2, r2 || "default"); if ("object" != _typeof$f(i2)) return i2; throw new TypeError("@@toPrimitive must return a primitive value."); } - return ("string" === r ? String : Number)(t2); + return ("string" === r2 ? String : Number)(t2); } __name(_toPrimitive$e, "_toPrimitive$e"); -var script$_ = { +var script$11 = { name: "BaseComponent", props: { pt: { @@ -55808,7 +81360,7 @@ var script$_ = { for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key2 = 1; _key2 < _len; _key2++) { args[_key2 - 1] = arguments[_key2]; } - return isFunction$5(fn) ? fn.apply(void 0, args) : mergeProps.apply(void 0, args); + return isFunction$9(fn) ? fn.apply(void 0, args) : mergeProps.apply(void 0, args); }, "_mergeProps"), _loadStyles: /* @__PURE__ */ __name(function _loadStyles2() { var _this2 = this; @@ -55937,11 +81489,11 @@ var script$_ = { var key = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ""; var datasetPrefix = "data-pc-"; var isExtended = key === "root" && isNotEmpty((_this$pt4 = this.pt) === null || _this$pt4 === void 0 ? void 0 : _this$pt4["data-pc-section"]); - return key !== "transition" && _objectSpread$f(_objectSpread$f({}, key === "root" && _objectSpread$f(_defineProperty$f({}, "".concat(datasetPrefix, "name"), toFlatCase(isExtended ? (_this$pt5 = this.pt) === null || _this$pt5 === void 0 ? void 0 : _this$pt5["data-pc-section"] : this.$.type.name)), isExtended && _defineProperty$f({}, "".concat(datasetPrefix, "extend"), toFlatCase(this.$.type.name)))), {}, _defineProperty$f({}, "".concat(datasetPrefix, "section"), toFlatCase(key))); + return key !== "transition" && _objectSpread$f(_objectSpread$f({}, key === "root" && _objectSpread$f(_defineProperty$h({}, "".concat(datasetPrefix, "name"), toFlatCase(isExtended ? (_this$pt5 = this.pt) === null || _this$pt5 === void 0 ? void 0 : _this$pt5["data-pc-section"] : this.$.type.name)), isExtended && _defineProperty$h({}, "".concat(datasetPrefix, "extend"), toFlatCase(this.$.type.name)))), {}, _defineProperty$h({}, "".concat(datasetPrefix, "section"), toFlatCase(key))); }, "_getPTDatasets"), _getPTClassValue: /* @__PURE__ */ __name(function _getPTClassValue() { var value4 = this._getOptionValue.apply(this, arguments); - return isString$8(value4) || isArray$5(value4) ? { + return isString$9(value4) || isArray$a(value4) ? { "class": value4 } : value4; }, "_getPTClassValue"), @@ -55973,8 +81525,8 @@ var script$_ = { var originalValue = fn(pt.originalValue); var value4 = fn(pt.value); if (originalValue === void 0 && value4 === void 0) return void 0; - else if (isString$8(value4)) return value4; - else if (isString$8(originalValue)) return originalValue; + else if (isString$9(value4)) return value4; + else if (isString$9(originalValue)) return originalValue; return mergeSections || !mergeSections && value4 ? useMergeProps ? this._mergeProps(useMergeProps, originalValue, value4) : _objectSpread$f(_objectSpread$f({}, originalValue), value4) : value4; } return fn(pt); @@ -56024,7 +81576,7 @@ var script$_ = { globalPT: /* @__PURE__ */ __name(function globalPT() { var _this$$primevueConfig4, _this4 = this; return this._getPT((_this$$primevueConfig4 = this.$primevueConfig) === null || _this$$primevueConfig4 === void 0 ? void 0 : _this$$primevueConfig4.pt, void 0, function(value4) { - return resolve$1(value4, { + return resolve$2(value4, { instance: _this4 }); }); @@ -56032,7 +81584,7 @@ var script$_ = { defaultPT: /* @__PURE__ */ __name(function defaultPT() { var _this$$primevueConfig5, _this5 = this; return this._getPT((_this$$primevueConfig5 = this.$primevueConfig) === null || _this$$primevueConfig5 === void 0 ? void 0 : _this$$primevueConfig5.pt, void 0, function(value4) { - return _this5._getOptionValue(value4, _this5.$name, _objectSpread$f({}, _this5.$params)) || resolve$1(value4, _objectSpread$f({}, _this5.$params)); + return _this5._getOptionValue(value4, _this5.$name, _objectSpread$f({}, _this5.$params)) || resolve$2(value4, _objectSpread$f({}, _this5.$params)); }); }, "defaultPT"), isUnstyled: /* @__PURE__ */ __name(function isUnstyled() { @@ -56112,21 +81664,21 @@ var script$_ = { }, "$attrSelector") } }; -var theme$z = /* @__PURE__ */ __name(function theme4(_ref) { +var theme$B = /* @__PURE__ */ __name(function theme4(_ref) { var dt2 = _ref.dt; return "\n.p-blockui {\n position: relative;\n}\n\n.p-blockui-mask {\n border-radius: ".concat(dt2("blockui.border.radius"), ";\n}\n\n.p-blockui-mask.p-overlay-mask {\n position: absolute;\n}\n\n.p-blockui-mask-document.p-overlay-mask {\n position: fixed;\n}\n"); }, "theme"); -var classes$B = { +var classes$D = { root: "p-blockui" }; var BlockUIStyle = BaseStyle.extend({ name: "blockui", - theme: theme$z, - classes: classes$B + theme: theme$B, + classes: classes$D }); -var script$1$B = { +var script$1$D = { name: "BaseBlockUI", - "extends": script$_, + "extends": script$11, props: { blocked: { type: Boolean, @@ -56153,9 +81705,9 @@ var script$1$B = { }; }, "provide") }; -var script$Z = { +var script$10 = { name: "BlockUI", - "extends": script$1$B, + "extends": script$1$D, inheritAttrs: false, emits: ["block", "unblock"], mask: null, @@ -56239,33 +81791,33 @@ var script$Z = { }, "removeMask") } }; -var _hoisted_1$1q = ["aria-busy"]; -function render$X(_ctx, _cache, $props, $setup, $data, $options) { +var _hoisted_1$1v = ["aria-busy"]; +function render$_(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("div", mergeProps({ ref: "container", "class": _ctx.cx("root"), "aria-busy": $data.isBlocked - }, _ctx.ptmi("root")), [renderSlot(_ctx.$slots, "default")], 16, _hoisted_1$1q); + }, _ctx.ptmi("root")), [renderSlot(_ctx.$slots, "default")], 16, _hoisted_1$1v); } -__name(render$X, "render$X"); -script$Z.render = render$X; -var theme$y = /* @__PURE__ */ __name(function theme5(_ref) { +__name(render$_, "render$_"); +script$10.render = render$_; +var theme$A = /* @__PURE__ */ __name(function theme5(_ref) { var dt2 = _ref.dt; return '\n.p-progressspinner {\n position: relative;\n margin: 0 auto;\n width: 100px;\n height: 100px;\n display: inline-block;\n}\n\n.p-progressspinner::before {\n content: "";\n display: block;\n padding-top: 100%;\n}\n\n.p-progressspinner-spin {\n height: 100%;\n transform-origin: center center;\n width: 100%;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n margin: auto;\n animation: p-progressspinner-rotate 2s linear infinite;\n}\n\n.p-progressspinner-circle {\n stroke-dasharray: 89, 200;\n stroke-dashoffset: 0;\n stroke: '.concat(dt2("progressspinner.color.1"), ";\n animation: p-progressspinner-dash 1.5s ease-in-out infinite, p-progressspinner-color 6s ease-in-out infinite;\n stroke-linecap: round;\n}\n\n@keyframes p-progressspinner-rotate {\n 100% {\n transform: rotate(360deg);\n }\n}\n@keyframes p-progressspinner-dash {\n 0% {\n stroke-dasharray: 1, 200;\n stroke-dashoffset: 0;\n }\n 50% {\n stroke-dasharray: 89, 200;\n stroke-dashoffset: -35px;\n }\n 100% {\n stroke-dasharray: 89, 200;\n stroke-dashoffset: -124px;\n }\n}\n@keyframes p-progressspinner-color {\n 100%,\n 0% {\n stroke: ").concat(dt2("progressspinner.color.1"), ";\n }\n 40% {\n stroke: ").concat(dt2("progressspinner.color.2"), ";\n }\n 66% {\n stroke: ").concat(dt2("progressspinner.color.3"), ";\n }\n 80%,\n 90% {\n stroke: ").concat(dt2("progressspinner.color.4"), ";\n }\n}\n"); }, "theme"); -var classes$A = { +var classes$C = { root: "p-progressspinner", spin: "p-progressspinner-spin", circle: "p-progressspinner-circle" }; var ProgressSpinnerStyle = BaseStyle.extend({ name: "progressspinner", - theme: theme$y, - classes: classes$A + theme: theme$A, + classes: classes$C }); -var script$1$A = { +var script$1$C = { name: "BaseProgressSpinner", - "extends": script$_, + "extends": script$11, props: { strokeWidth: { type: String, @@ -56288,9 +81840,9 @@ var script$1$A = { }; }, "provide") }; -var script$Y = { +var script$$ = { name: "ProgressSpinner", - "extends": script$1$A, + "extends": script$1$C, inheritAttrs: false, computed: { svgStyle: /* @__PURE__ */ __name(function svgStyle() { @@ -56300,8 +81852,8 @@ var script$Y = { }, "svgStyle") } }; -var _hoisted_1$1p = ["fill", "stroke-width"]; -function render$W(_ctx, _cache, $props, $setup, $data, $options) { +var _hoisted_1$1u = ["fill", "stroke-width"]; +function render$Z(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("div", mergeProps({ "class": _ctx.cx("root"), role: "progressbar" @@ -56317,10 +81869,10 @@ function render$W(_ctx, _cache, $props, $setup, $data, $options) { fill: _ctx.fill, "stroke-width": _ctx.strokeWidth, strokeMiterlimit: "10" - }, _ctx.ptm("circle")), null, 16, _hoisted_1$1p)], 16))], 16); + }, _ctx.ptm("circle")), null, 16, _hoisted_1$1u)], 16))], 16); } -__name(render$W, "render$W"); -script$Y.render = render$W; +__name(render$Z, "render$Z"); +script$$.render = render$Z; var BaseComponentStyle = BaseStyle.extend({ name: "common" }); @@ -56329,61 +81881,61 @@ var BaseIconStyle = BaseStyle.extend({ name: "baseicon", css }); -function _typeof$e(o) { +function _typeof$e(o2) { "@babel/helpers - typeof"; - return _typeof$e = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { - return typeof o2; - } : function(o2) { - return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; - }, _typeof$e(o); + return _typeof$e = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { + return typeof o3; + } : function(o3) { + return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; + }, _typeof$e(o2); } __name(_typeof$e, "_typeof$e"); -function ownKeys$e(e2, r) { +function ownKeys$e(e2, r2) { var t2 = Object.keys(e2); if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e2); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e2, r2).enumerable; - })), t2.push.apply(t2, o); + var o2 = Object.getOwnPropertySymbols(e2); + r2 && (o2 = o2.filter(function(r3) { + return Object.getOwnPropertyDescriptor(e2, r3).enumerable; + })), t2.push.apply(t2, o2); } return t2; } __name(ownKeys$e, "ownKeys$e"); function _objectSpread$e(e2) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$e(Object(t2), true).forEach(function(r2) { - _defineProperty$e(e2, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$e(Object(t2)).forEach(function(r2) { - Object.defineProperty(e2, r2, Object.getOwnPropertyDescriptor(t2, r2)); + for (var r2 = 1; r2 < arguments.length; r2++) { + var t2 = null != arguments[r2] ? arguments[r2] : {}; + r2 % 2 ? ownKeys$e(Object(t2), true).forEach(function(r3) { + _defineProperty$g(e2, r3, t2[r3]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$e(Object(t2)).forEach(function(r3) { + Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3)); }); } return e2; } __name(_objectSpread$e, "_objectSpread$e"); -function _defineProperty$e(e2, r, t2) { - return (r = _toPropertyKey$d(r)) in e2 ? Object.defineProperty(e2, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r] = t2, e2; +function _defineProperty$g(e2, r2, t2) { + return (r2 = _toPropertyKey$d(r2)) in e2 ? Object.defineProperty(e2, r2, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r2] = t2, e2; } -__name(_defineProperty$e, "_defineProperty$e"); +__name(_defineProperty$g, "_defineProperty$g"); function _toPropertyKey$d(t2) { var i2 = _toPrimitive$d(t2, "string"); return "symbol" == _typeof$e(i2) ? i2 : i2 + ""; } __name(_toPropertyKey$d, "_toPropertyKey$d"); -function _toPrimitive$d(t2, r) { +function _toPrimitive$d(t2, r2) { if ("object" != _typeof$e(t2) || !t2) return t2; var e2 = t2[Symbol.toPrimitive]; if (void 0 !== e2) { - var i2 = e2.call(t2, r || "default"); + var i2 = e2.call(t2, r2 || "default"); if ("object" != _typeof$e(i2)) return i2; throw new TypeError("@@toPrimitive must return a primitive value."); } - return ("string" === r ? String : Number)(t2); + return ("string" === r2 ? String : Number)(t2); } __name(_toPrimitive$d, "_toPrimitive$d"); -var script$X = { +var script$_ = { name: "BaseIcon", - "extends": script$_, + "extends": script$11, props: { label: { type: String, @@ -56416,15 +81968,79 @@ var script$X = { }, "pti") } }; -var script$W = { +var script$Z = { name: "TimesIcon", - "extends": script$X + "extends": script$_ }; -var _hoisted_1$1o = /* @__PURE__ */ createBaseVNode("path", { +var _hoisted_1$1t = /* @__PURE__ */ createBaseVNode("path", { d: "M8.01186 7.00933L12.27 2.75116C12.341 2.68501 12.398 2.60524 12.4375 2.51661C12.4769 2.42798 12.4982 2.3323 12.4999 2.23529C12.5016 2.13827 12.4838 2.0419 12.4474 1.95194C12.4111 1.86197 12.357 1.78024 12.2884 1.71163C12.2198 1.64302 12.138 1.58893 12.0481 1.55259C11.9581 1.51625 11.8617 1.4984 11.7647 1.50011C11.6677 1.50182 11.572 1.52306 11.4834 1.56255C11.3948 1.60204 11.315 1.65898 11.2488 1.72997L6.99067 5.98814L2.7325 1.72997C2.59553 1.60234 2.41437 1.53286 2.22718 1.53616C2.03999 1.53946 1.8614 1.61529 1.72901 1.74767C1.59663 1.88006 1.5208 2.05865 1.5175 2.24584C1.5142 2.43303 1.58368 2.61419 1.71131 2.75116L5.96948 7.00933L1.71131 11.2675C1.576 11.403 1.5 11.5866 1.5 11.7781C1.5 11.9696 1.576 12.1532 1.71131 12.2887C1.84679 12.424 2.03043 12.5 2.2219 12.5C2.41338 12.5 2.59702 12.424 2.7325 12.2887L6.99067 8.03052L11.2488 12.2887C11.3843 12.424 11.568 12.5 11.7594 12.5C11.9509 12.5 12.1346 12.424 12.27 12.2887C12.4053 12.1532 12.4813 11.9696 12.4813 11.7781C12.4813 11.5866 12.4053 11.403 12.27 11.2675L8.01186 7.00933Z", fill: "currentColor" }, null, -1); -var _hoisted_2$11 = [_hoisted_1$1o]; +var _hoisted_2$14 = [_hoisted_1$1t]; +function render$Y(_ctx, _cache, $props, $setup, $data, $options) { + return openBlock(), createElementBlock("svg", mergeProps({ + width: "14", + height: "14", + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg" + }, _ctx.pti()), _hoisted_2$14, 16); +} +__name(render$Y, "render$Y"); +script$Z.render = render$Y; +var script$Y = { + name: "WindowMaximizeIcon", + "extends": script$_ +}; +var _hoisted_1$1s = /* @__PURE__ */ createBaseVNode("path", { + "fill-rule": "evenodd", + "clip-rule": "evenodd", + d: "M7 14H11.8C12.3835 14 12.9431 13.7682 13.3556 13.3556C13.7682 12.9431 14 12.3835 14 11.8V2.2C14 1.61652 13.7682 1.05694 13.3556 0.644365C12.9431 0.231785 12.3835 0 11.8 0H2.2C1.61652 0 1.05694 0.231785 0.644365 0.644365C0.231785 1.05694 0 1.61652 0 2.2V7C0 7.15913 0.063214 7.31174 0.175736 7.42426C0.288258 7.53679 0.44087 7.6 0.6 7.6C0.75913 7.6 0.911742 7.53679 1.02426 7.42426C1.13679 7.31174 1.2 7.15913 1.2 7V2.2C1.2 1.93478 1.30536 1.68043 1.49289 1.49289C1.68043 1.30536 1.93478 1.2 2.2 1.2H11.8C12.0652 1.2 12.3196 1.30536 12.5071 1.49289C12.6946 1.68043 12.8 1.93478 12.8 2.2V11.8C12.8 12.0652 12.6946 12.3196 12.5071 12.5071C12.3196 12.6946 12.0652 12.8 11.8 12.8H7C6.84087 12.8 6.68826 12.8632 6.57574 12.9757C6.46321 13.0883 6.4 13.2409 6.4 13.4C6.4 13.5591 6.46321 13.7117 6.57574 13.8243C6.68826 13.9368 6.84087 14 7 14ZM9.77805 7.42192C9.89013 7.534 10.0415 7.59788 10.2 7.59995C10.3585 7.59788 10.5099 7.534 10.622 7.42192C10.7341 7.30985 10.798 7.15844 10.8 6.99995V3.94242C10.8066 3.90505 10.8096 3.86689 10.8089 3.82843C10.8079 3.77159 10.7988 3.7157 10.7824 3.6623C10.756 3.55552 10.701 3.45698 10.622 3.37798C10.5099 3.2659 10.3585 3.20202 10.2 3.19995H7.00002C6.84089 3.19995 6.68828 3.26317 6.57576 3.37569C6.46324 3.48821 6.40002 3.64082 6.40002 3.79995C6.40002 3.95908 6.46324 4.11169 6.57576 4.22422C6.68828 4.33674 6.84089 4.39995 7.00002 4.39995H8.80006L6.19997 7.00005C6.10158 7.11005 6.04718 7.25246 6.04718 7.40005C6.04718 7.54763 6.10158 7.69004 6.19997 7.80005C6.30202 7.91645 6.44561 7.98824 6.59997 8.00005C6.75432 7.98824 6.89791 7.91645 6.99997 7.80005L9.60002 5.26841V6.99995C9.6021 7.15844 9.66598 7.30985 9.77805 7.42192ZM1.4 14H3.8C4.17066 13.9979 4.52553 13.8498 4.78763 13.5877C5.04973 13.3256 5.1979 12.9707 5.2 12.6V10.2C5.1979 9.82939 5.04973 9.47452 4.78763 9.21242C4.52553 8.95032 4.17066 8.80215 3.8 8.80005H1.4C1.02934 8.80215 0.674468 8.95032 0.412371 9.21242C0.150274 9.47452 0.00210008 9.82939 0 10.2V12.6C0.00210008 12.9707 0.150274 13.3256 0.412371 13.5877C0.674468 13.8498 1.02934 13.9979 1.4 14ZM1.25858 10.0586C1.29609 10.0211 1.34696 10 1.4 10H3.8C3.85304 10 3.90391 10.0211 3.94142 10.0586C3.97893 10.0961 4 10.147 4 10.2V12.6C4 12.6531 3.97893 12.704 3.94142 12.7415C3.90391 12.779 3.85304 12.8 3.8 12.8H1.4C1.34696 12.8 1.29609 12.779 1.25858 12.7415C1.22107 12.704 1.2 12.6531 1.2 12.6V10.2C1.2 10.147 1.22107 10.0961 1.25858 10.0586Z", + fill: "currentColor" +}, null, -1); +var _hoisted_2$13 = [_hoisted_1$1s]; +function render$X(_ctx, _cache, $props, $setup, $data, $options) { + return openBlock(), createElementBlock("svg", mergeProps({ + width: "14", + height: "14", + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg" + }, _ctx.pti()), _hoisted_2$13, 16); +} +__name(render$X, "render$X"); +script$Y.render = render$X; +var script$X = { + name: "WindowMinimizeIcon", + "extends": script$_ +}; +var _hoisted_1$1r = /* @__PURE__ */ createBaseVNode("path", { + "fill-rule": "evenodd", + "clip-rule": "evenodd", + d: "M11.8 0H2.2C1.61652 0 1.05694 0.231785 0.644365 0.644365C0.231785 1.05694 0 1.61652 0 2.2V7C0 7.15913 0.063214 7.31174 0.175736 7.42426C0.288258 7.53679 0.44087 7.6 0.6 7.6C0.75913 7.6 0.911742 7.53679 1.02426 7.42426C1.13679 7.31174 1.2 7.15913 1.2 7V2.2C1.2 1.93478 1.30536 1.68043 1.49289 1.49289C1.68043 1.30536 1.93478 1.2 2.2 1.2H11.8C12.0652 1.2 12.3196 1.30536 12.5071 1.49289C12.6946 1.68043 12.8 1.93478 12.8 2.2V11.8C12.8 12.0652 12.6946 12.3196 12.5071 12.5071C12.3196 12.6946 12.0652 12.8 11.8 12.8H7C6.84087 12.8 6.68826 12.8632 6.57574 12.9757C6.46321 13.0883 6.4 13.2409 6.4 13.4C6.4 13.5591 6.46321 13.7117 6.57574 13.8243C6.68826 13.9368 6.84087 14 7 14H11.8C12.3835 14 12.9431 13.7682 13.3556 13.3556C13.7682 12.9431 14 12.3835 14 11.8V2.2C14 1.61652 13.7682 1.05694 13.3556 0.644365C12.9431 0.231785 12.3835 0 11.8 0ZM6.368 7.952C6.44137 7.98326 6.52025 7.99958 6.6 8H9.8C9.95913 8 10.1117 7.93678 10.2243 7.82426C10.3368 7.71174 10.4 7.55913 10.4 7.4C10.4 7.24087 10.3368 7.08826 10.2243 6.97574C10.1117 6.86321 9.95913 6.8 9.8 6.8H8.048L10.624 4.224C10.73 4.11026 10.7877 3.95982 10.7849 3.80438C10.7822 3.64894 10.7192 3.50063 10.6093 3.3907C10.4994 3.28077 10.3511 3.2178 10.1956 3.21506C10.0402 3.21232 9.88974 3.27002 9.776 3.376L7.2 5.952V4.2C7.2 4.04087 7.13679 3.88826 7.02426 3.77574C6.91174 3.66321 6.75913 3.6 6.6 3.6C6.44087 3.6 6.28826 3.66321 6.17574 3.77574C6.06321 3.88826 6 4.04087 6 4.2V7.4C6.00042 7.47975 6.01674 7.55862 6.048 7.632C6.07656 7.70442 6.11971 7.7702 6.17475 7.82524C6.2298 7.88029 6.29558 7.92344 6.368 7.952ZM1.4 8.80005H3.8C4.17066 8.80215 4.52553 8.95032 4.78763 9.21242C5.04973 9.47452 5.1979 9.82939 5.2 10.2V12.6C5.1979 12.9707 5.04973 13.3256 4.78763 13.5877C4.52553 13.8498 4.17066 13.9979 3.8 14H1.4C1.02934 13.9979 0.674468 13.8498 0.412371 13.5877C0.150274 13.3256 0.00210008 12.9707 0 12.6V10.2C0.00210008 9.82939 0.150274 9.47452 0.412371 9.21242C0.674468 8.95032 1.02934 8.80215 1.4 8.80005ZM3.94142 12.7415C3.97893 12.704 4 12.6531 4 12.6V10.2C4 10.147 3.97893 10.0961 3.94142 10.0586C3.90391 10.0211 3.85304 10 3.8 10H1.4C1.34696 10 1.29609 10.0211 1.25858 10.0586C1.22107 10.0961 1.2 10.147 1.2 10.2V12.6C1.2 12.6531 1.22107 12.704 1.25858 12.7415C1.29609 12.779 1.34696 12.8 1.4 12.8H3.8C3.85304 12.8 3.90391 12.779 3.94142 12.7415Z", + fill: "currentColor" +}, null, -1); +var _hoisted_2$12 = [_hoisted_1$1r]; +function render$W(_ctx, _cache, $props, $setup, $data, $options) { + return openBlock(), createElementBlock("svg", mergeProps({ + width: "14", + height: "14", + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg" + }, _ctx.pti()), _hoisted_2$12, 16); +} +__name(render$W, "render$W"); +script$X.render = render$W; +var script$W = { + name: "SpinnerIcon", + "extends": script$_ +}; +var _hoisted_1$1q = /* @__PURE__ */ createBaseVNode("path", { + d: "M6.99701 14C5.85441 13.999 4.72939 13.7186 3.72012 13.1832C2.71084 12.6478 1.84795 11.8737 1.20673 10.9284C0.565504 9.98305 0.165424 8.89526 0.041387 7.75989C-0.0826496 6.62453 0.073125 5.47607 0.495122 4.4147C0.917119 3.35333 1.59252 2.4113 2.46241 1.67077C3.33229 0.930247 4.37024 0.413729 5.4857 0.166275C6.60117 -0.0811796 7.76026 -0.0520535 8.86188 0.251112C9.9635 0.554278 10.9742 1.12227 11.8057 1.90555C11.915 2.01493 11.9764 2.16319 11.9764 2.31778C11.9764 2.47236 11.915 2.62062 11.8057 2.73C11.7521 2.78503 11.688 2.82877 11.6171 2.85864C11.5463 2.8885 11.4702 2.90389 11.3933 2.90389C11.3165 2.90389 11.2404 2.8885 11.1695 2.85864C11.0987 2.82877 11.0346 2.78503 10.9809 2.73C9.9998 1.81273 8.73246 1.26138 7.39226 1.16876C6.05206 1.07615 4.72086 1.44794 3.62279 2.22152C2.52471 2.99511 1.72683 4.12325 1.36345 5.41602C1.00008 6.70879 1.09342 8.08723 1.62775 9.31926C2.16209 10.5513 3.10478 11.5617 4.29713 12.1803C5.48947 12.7989 6.85865 12.988 8.17414 12.7157C9.48963 12.4435 10.6711 11.7264 11.5196 10.6854C12.3681 9.64432 12.8319 8.34282 12.8328 7C12.8328 6.84529 12.8943 6.69692 13.0038 6.58752C13.1132 6.47812 13.2616 6.41667 13.4164 6.41667C13.5712 6.41667 13.7196 6.47812 13.8291 6.58752C13.9385 6.69692 14 6.84529 14 7C14 8.85651 13.2622 10.637 11.9489 11.9497C10.6356 13.2625 8.85432 14 6.99701 14Z", + fill: "currentColor" +}, null, -1); +var _hoisted_2$11 = [_hoisted_1$1q]; function render$V(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ width: "14", @@ -56436,76 +82052,12 @@ function render$V(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$V, "render$V"); script$W.render = render$V; -var script$V = { - name: "WindowMaximizeIcon", - "extends": script$X -}; -var _hoisted_1$1n = /* @__PURE__ */ createBaseVNode("path", { - "fill-rule": "evenodd", - "clip-rule": "evenodd", - d: "M7 14H11.8C12.3835 14 12.9431 13.7682 13.3556 13.3556C13.7682 12.9431 14 12.3835 14 11.8V2.2C14 1.61652 13.7682 1.05694 13.3556 0.644365C12.9431 0.231785 12.3835 0 11.8 0H2.2C1.61652 0 1.05694 0.231785 0.644365 0.644365C0.231785 1.05694 0 1.61652 0 2.2V7C0 7.15913 0.063214 7.31174 0.175736 7.42426C0.288258 7.53679 0.44087 7.6 0.6 7.6C0.75913 7.6 0.911742 7.53679 1.02426 7.42426C1.13679 7.31174 1.2 7.15913 1.2 7V2.2C1.2 1.93478 1.30536 1.68043 1.49289 1.49289C1.68043 1.30536 1.93478 1.2 2.2 1.2H11.8C12.0652 1.2 12.3196 1.30536 12.5071 1.49289C12.6946 1.68043 12.8 1.93478 12.8 2.2V11.8C12.8 12.0652 12.6946 12.3196 12.5071 12.5071C12.3196 12.6946 12.0652 12.8 11.8 12.8H7C6.84087 12.8 6.68826 12.8632 6.57574 12.9757C6.46321 13.0883 6.4 13.2409 6.4 13.4C6.4 13.5591 6.46321 13.7117 6.57574 13.8243C6.68826 13.9368 6.84087 14 7 14ZM9.77805 7.42192C9.89013 7.534 10.0415 7.59788 10.2 7.59995C10.3585 7.59788 10.5099 7.534 10.622 7.42192C10.7341 7.30985 10.798 7.15844 10.8 6.99995V3.94242C10.8066 3.90505 10.8096 3.86689 10.8089 3.82843C10.8079 3.77159 10.7988 3.7157 10.7824 3.6623C10.756 3.55552 10.701 3.45698 10.622 3.37798C10.5099 3.2659 10.3585 3.20202 10.2 3.19995H7.00002C6.84089 3.19995 6.68828 3.26317 6.57576 3.37569C6.46324 3.48821 6.40002 3.64082 6.40002 3.79995C6.40002 3.95908 6.46324 4.11169 6.57576 4.22422C6.68828 4.33674 6.84089 4.39995 7.00002 4.39995H8.80006L6.19997 7.00005C6.10158 7.11005 6.04718 7.25246 6.04718 7.40005C6.04718 7.54763 6.10158 7.69004 6.19997 7.80005C6.30202 7.91645 6.44561 7.98824 6.59997 8.00005C6.75432 7.98824 6.89791 7.91645 6.99997 7.80005L9.60002 5.26841V6.99995C9.6021 7.15844 9.66598 7.30985 9.77805 7.42192ZM1.4 14H3.8C4.17066 13.9979 4.52553 13.8498 4.78763 13.5877C5.04973 13.3256 5.1979 12.9707 5.2 12.6V10.2C5.1979 9.82939 5.04973 9.47452 4.78763 9.21242C4.52553 8.95032 4.17066 8.80215 3.8 8.80005H1.4C1.02934 8.80215 0.674468 8.95032 0.412371 9.21242C0.150274 9.47452 0.00210008 9.82939 0 10.2V12.6C0.00210008 12.9707 0.150274 13.3256 0.412371 13.5877C0.674468 13.8498 1.02934 13.9979 1.4 14ZM1.25858 10.0586C1.29609 10.0211 1.34696 10 1.4 10H3.8C3.85304 10 3.90391 10.0211 3.94142 10.0586C3.97893 10.0961 4 10.147 4 10.2V12.6C4 12.6531 3.97893 12.704 3.94142 12.7415C3.90391 12.779 3.85304 12.8 3.8 12.8H1.4C1.34696 12.8 1.29609 12.779 1.25858 12.7415C1.22107 12.704 1.2 12.6531 1.2 12.6V10.2C1.2 10.147 1.22107 10.0961 1.25858 10.0586Z", - fill: "currentColor" -}, null, -1); -var _hoisted_2$10 = [_hoisted_1$1n]; -function render$U(_ctx, _cache, $props, $setup, $data, $options) { - return openBlock(), createElementBlock("svg", mergeProps({ - width: "14", - height: "14", - viewBox: "0 0 14 14", - fill: "none", - xmlns: "http://www.w3.org/2000/svg" - }, _ctx.pti()), _hoisted_2$10, 16); -} -__name(render$U, "render$U"); -script$V.render = render$U; -var script$U = { - name: "WindowMinimizeIcon", - "extends": script$X -}; -var _hoisted_1$1m = /* @__PURE__ */ createBaseVNode("path", { - "fill-rule": "evenodd", - "clip-rule": "evenodd", - d: "M11.8 0H2.2C1.61652 0 1.05694 0.231785 0.644365 0.644365C0.231785 1.05694 0 1.61652 0 2.2V7C0 7.15913 0.063214 7.31174 0.175736 7.42426C0.288258 7.53679 0.44087 7.6 0.6 7.6C0.75913 7.6 0.911742 7.53679 1.02426 7.42426C1.13679 7.31174 1.2 7.15913 1.2 7V2.2C1.2 1.93478 1.30536 1.68043 1.49289 1.49289C1.68043 1.30536 1.93478 1.2 2.2 1.2H11.8C12.0652 1.2 12.3196 1.30536 12.5071 1.49289C12.6946 1.68043 12.8 1.93478 12.8 2.2V11.8C12.8 12.0652 12.6946 12.3196 12.5071 12.5071C12.3196 12.6946 12.0652 12.8 11.8 12.8H7C6.84087 12.8 6.68826 12.8632 6.57574 12.9757C6.46321 13.0883 6.4 13.2409 6.4 13.4C6.4 13.5591 6.46321 13.7117 6.57574 13.8243C6.68826 13.9368 6.84087 14 7 14H11.8C12.3835 14 12.9431 13.7682 13.3556 13.3556C13.7682 12.9431 14 12.3835 14 11.8V2.2C14 1.61652 13.7682 1.05694 13.3556 0.644365C12.9431 0.231785 12.3835 0 11.8 0ZM6.368 7.952C6.44137 7.98326 6.52025 7.99958 6.6 8H9.8C9.95913 8 10.1117 7.93678 10.2243 7.82426C10.3368 7.71174 10.4 7.55913 10.4 7.4C10.4 7.24087 10.3368 7.08826 10.2243 6.97574C10.1117 6.86321 9.95913 6.8 9.8 6.8H8.048L10.624 4.224C10.73 4.11026 10.7877 3.95982 10.7849 3.80438C10.7822 3.64894 10.7192 3.50063 10.6093 3.3907C10.4994 3.28077 10.3511 3.2178 10.1956 3.21506C10.0402 3.21232 9.88974 3.27002 9.776 3.376L7.2 5.952V4.2C7.2 4.04087 7.13679 3.88826 7.02426 3.77574C6.91174 3.66321 6.75913 3.6 6.6 3.6C6.44087 3.6 6.28826 3.66321 6.17574 3.77574C6.06321 3.88826 6 4.04087 6 4.2V7.4C6.00042 7.47975 6.01674 7.55862 6.048 7.632C6.07656 7.70442 6.11971 7.7702 6.17475 7.82524C6.2298 7.88029 6.29558 7.92344 6.368 7.952ZM1.4 8.80005H3.8C4.17066 8.80215 4.52553 8.95032 4.78763 9.21242C5.04973 9.47452 5.1979 9.82939 5.2 10.2V12.6C5.1979 12.9707 5.04973 13.3256 4.78763 13.5877C4.52553 13.8498 4.17066 13.9979 3.8 14H1.4C1.02934 13.9979 0.674468 13.8498 0.412371 13.5877C0.150274 13.3256 0.00210008 12.9707 0 12.6V10.2C0.00210008 9.82939 0.150274 9.47452 0.412371 9.21242C0.674468 8.95032 1.02934 8.80215 1.4 8.80005ZM3.94142 12.7415C3.97893 12.704 4 12.6531 4 12.6V10.2C4 10.147 3.97893 10.0961 3.94142 10.0586C3.90391 10.0211 3.85304 10 3.8 10H1.4C1.34696 10 1.29609 10.0211 1.25858 10.0586C1.22107 10.0961 1.2 10.147 1.2 10.2V12.6C1.2 12.6531 1.22107 12.704 1.25858 12.7415C1.29609 12.779 1.34696 12.8 1.4 12.8H3.8C3.85304 12.8 3.90391 12.779 3.94142 12.7415Z", - fill: "currentColor" -}, null, -1); -var _hoisted_2$$ = [_hoisted_1$1m]; -function render$T(_ctx, _cache, $props, $setup, $data, $options) { - return openBlock(), createElementBlock("svg", mergeProps({ - width: "14", - height: "14", - viewBox: "0 0 14 14", - fill: "none", - xmlns: "http://www.w3.org/2000/svg" - }, _ctx.pti()), _hoisted_2$$, 16); -} -__name(render$T, "render$T"); -script$U.render = render$T; -var script$T = { - name: "SpinnerIcon", - "extends": script$X -}; -var _hoisted_1$1l = /* @__PURE__ */ createBaseVNode("path", { - d: "M6.99701 14C5.85441 13.999 4.72939 13.7186 3.72012 13.1832C2.71084 12.6478 1.84795 11.8737 1.20673 10.9284C0.565504 9.98305 0.165424 8.89526 0.041387 7.75989C-0.0826496 6.62453 0.073125 5.47607 0.495122 4.4147C0.917119 3.35333 1.59252 2.4113 2.46241 1.67077C3.33229 0.930247 4.37024 0.413729 5.4857 0.166275C6.60117 -0.0811796 7.76026 -0.0520535 8.86188 0.251112C9.9635 0.554278 10.9742 1.12227 11.8057 1.90555C11.915 2.01493 11.9764 2.16319 11.9764 2.31778C11.9764 2.47236 11.915 2.62062 11.8057 2.73C11.7521 2.78503 11.688 2.82877 11.6171 2.85864C11.5463 2.8885 11.4702 2.90389 11.3933 2.90389C11.3165 2.90389 11.2404 2.8885 11.1695 2.85864C11.0987 2.82877 11.0346 2.78503 10.9809 2.73C9.9998 1.81273 8.73246 1.26138 7.39226 1.16876C6.05206 1.07615 4.72086 1.44794 3.62279 2.22152C2.52471 2.99511 1.72683 4.12325 1.36345 5.41602C1.00008 6.70879 1.09342 8.08723 1.62775 9.31926C2.16209 10.5513 3.10478 11.5617 4.29713 12.1803C5.48947 12.7989 6.85865 12.988 8.17414 12.7157C9.48963 12.4435 10.6711 11.7264 11.5196 10.6854C12.3681 9.64432 12.8319 8.34282 12.8328 7C12.8328 6.84529 12.8943 6.69692 13.0038 6.58752C13.1132 6.47812 13.2616 6.41667 13.4164 6.41667C13.5712 6.41667 13.7196 6.47812 13.8291 6.58752C13.9385 6.69692 14 6.84529 14 7C14 8.85651 13.2622 10.637 11.9489 11.9497C10.6356 13.2625 8.85432 14 6.99701 14Z", - fill: "currentColor" -}, null, -1); -var _hoisted_2$_ = [_hoisted_1$1l]; -function render$S(_ctx, _cache, $props, $setup, $data, $options) { - return openBlock(), createElementBlock("svg", mergeProps({ - width: "14", - height: "14", - viewBox: "0 0 14 14", - fill: "none", - xmlns: "http://www.w3.org/2000/svg" - }, _ctx.pti()), _hoisted_2$_, 16); -} -__name(render$S, "render$S"); -script$T.render = render$S; -var theme$x = /* @__PURE__ */ __name(function theme6(_ref) { +var theme$z = /* @__PURE__ */ __name(function theme6(_ref) { var dt2 = _ref.dt; return "\n.p-badge {\n display: inline-flex;\n border-radius: ".concat(dt2("badge.border.radius"), ";\n align-items: center;\n justify-content: center;\n padding: ").concat(dt2("badge.padding"), ";\n background: ").concat(dt2("badge.primary.background"), ";\n color: ").concat(dt2("badge.primary.color"), ";\n font-size: ").concat(dt2("badge.font.size"), ";\n font-weight: ").concat(dt2("badge.font.weight"), ";\n min-width: ").concat(dt2("badge.min.width"), ";\n height: ").concat(dt2("badge.height"), ";\n}\n\n.p-badge-dot {\n width: ").concat(dt2("badge.dot.size"), ";\n min-width: ").concat(dt2("badge.dot.size"), ";\n height: ").concat(dt2("badge.dot.size"), ";\n border-radius: 50%;\n padding: 0;\n}\n\n.p-badge-circle {\n padding: 0;\n border-radius: 50%;\n}\n\n.p-badge-secondary {\n background: ").concat(dt2("badge.secondary.background"), ";\n color: ").concat(dt2("badge.secondary.color"), ";\n}\n\n.p-badge-success {\n background: ").concat(dt2("badge.success.background"), ";\n color: ").concat(dt2("badge.success.color"), ";\n}\n\n.p-badge-info {\n background: ").concat(dt2("badge.info.background"), ";\n color: ").concat(dt2("badge.info.color"), ";\n}\n\n.p-badge-warn {\n background: ").concat(dt2("badge.warn.background"), ";\n color: ").concat(dt2("badge.warn.color"), ";\n}\n\n.p-badge-danger {\n background: ").concat(dt2("badge.danger.background"), ";\n color: ").concat(dt2("badge.danger.color"), ";\n}\n\n.p-badge-contrast {\n background: ").concat(dt2("badge.contrast.background"), ";\n color: ").concat(dt2("badge.contrast.color"), ";\n}\n\n.p-badge-sm {\n font-size: ").concat(dt2("badge.sm.font.size"), ";\n min-width: ").concat(dt2("badge.sm.min.width"), ";\n height: ").concat(dt2("badge.sm.height"), ";\n}\n\n.p-badge-lg {\n font-size: ").concat(dt2("badge.lg.font.size"), ";\n min-width: ").concat(dt2("badge.lg.min.width"), ";\n height: ").concat(dt2("badge.lg.height"), ";\n}\n\n.p-badge-xl {\n font-size: ").concat(dt2("badge.xl.font.size"), ";\n min-width: ").concat(dt2("badge.xl.min.width"), ";\n height: ").concat(dt2("badge.xl.height"), ";\n}\n"); }, "theme"); -var classes$z = { - root: /* @__PURE__ */ __name(function root(_ref2) { +var classes$B = { + root: /* @__PURE__ */ __name(function root2(_ref2) { var props = _ref2.props, instance = _ref2.instance; return ["p-badge p-component", { "p-badge-circle": isNotEmpty(props.value) && String(props.value).length === 1, @@ -56524,12 +82076,12 @@ var classes$z = { }; var BadgeStyle = BaseStyle.extend({ name: "badge", - theme: theme$x, - classes: classes$z + theme: theme$z, + classes: classes$B }); -var script$1$z = { +var script$1$B = { name: "BaseBadge", - "extends": script$_, + "extends": script$11, props: { value: { type: [String, Number], @@ -56552,92 +82104,92 @@ var script$1$z = { }; }, "provide") }; -var script$S = { +var script$V = { name: "Badge", - "extends": script$1$z, + "extends": script$1$B, inheritAttrs: false }; -function render$R(_ctx, _cache, $props, $setup, $data, $options) { +function render$U(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("span", mergeProps({ "class": _ctx.cx("root") }, _ctx.ptmi("root")), [renderSlot(_ctx.$slots, "default", {}, function() { return [createTextVNode(toDisplayString$1(_ctx.value), 1)]; })], 16); } -__name(render$R, "render$R"); -script$S.render = render$R; -var theme$w = /* @__PURE__ */ __name(function theme7(_ref) { +__name(render$U, "render$U"); +script$V.render = render$U; +var theme$y = /* @__PURE__ */ __name(function theme7(_ref) { var dt2 = _ref.dt; return "\n.p-ink {\n display: block;\n position: absolute;\n background: ".concat(dt2("ripple.background"), ";\n border-radius: 100%;\n transform: scale(0);\n pointer-events: none;\n}\n\n.p-ink-active {\n animation: ripple 0.4s linear;\n}\n\n@keyframes ripple {\n 100% {\n opacity: 0;\n transform: scale(2.5);\n }\n}\n"); }, "theme"); -var classes$y = { +var classes$A = { root: "p-ink" }; var RippleStyle = BaseStyle.extend({ name: "ripple-directive", - theme: theme$w, - classes: classes$y + theme: theme$y, + classes: classes$A }); var BaseRipple = BaseDirective.extend({ style: RippleStyle }); -function _typeof$d(o) { +function _typeof$d(o2) { "@babel/helpers - typeof"; - return _typeof$d = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { - return typeof o2; - } : function(o2) { - return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; - }, _typeof$d(o); + return _typeof$d = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { + return typeof o3; + } : function(o3) { + return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; + }, _typeof$d(o2); } __name(_typeof$d, "_typeof$d"); -function _toConsumableArray$b(r) { - return _arrayWithoutHoles$b(r) || _iterableToArray$b(r) || _unsupportedIterableToArray$d(r) || _nonIterableSpread$b(); +function _toConsumableArray$b(r2) { + return _arrayWithoutHoles$b(r2) || _iterableToArray$b(r2) || _unsupportedIterableToArray$d(r2) || _nonIterableSpread$b(); } __name(_toConsumableArray$b, "_toConsumableArray$b"); function _nonIterableSpread$b() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } __name(_nonIterableSpread$b, "_nonIterableSpread$b"); -function _unsupportedIterableToArray$d(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray$d(r, a); - var t2 = {}.toString.call(r).slice(8, -1); - return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$d(r, a) : void 0; +function _unsupportedIterableToArray$d(r2, a2) { + if (r2) { + if ("string" == typeof r2) return _arrayLikeToArray$d(r2, a2); + var t2 = {}.toString.call(r2).slice(8, -1); + return "Object" === t2 && r2.constructor && (t2 = r2.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r2) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$d(r2, a2) : void 0; } } __name(_unsupportedIterableToArray$d, "_unsupportedIterableToArray$d"); -function _iterableToArray$b(r) { - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); +function _iterableToArray$b(r2) { + if ("undefined" != typeof Symbol && null != r2[Symbol.iterator] || null != r2["@@iterator"]) return Array.from(r2); } __name(_iterableToArray$b, "_iterableToArray$b"); -function _arrayWithoutHoles$b(r) { - if (Array.isArray(r)) return _arrayLikeToArray$d(r); +function _arrayWithoutHoles$b(r2) { + if (Array.isArray(r2)) return _arrayLikeToArray$d(r2); } __name(_arrayWithoutHoles$b, "_arrayWithoutHoles$b"); -function _arrayLikeToArray$d(r, a) { - (null == a || a > r.length) && (a = r.length); - for (var e2 = 0, n = Array(a); e2 < a; e2++) n[e2] = r[e2]; - return n; +function _arrayLikeToArray$d(r2, a2) { + (null == a2 || a2 > r2.length) && (a2 = r2.length); + for (var e2 = 0, n2 = Array(a2); e2 < a2; e2++) n2[e2] = r2[e2]; + return n2; } __name(_arrayLikeToArray$d, "_arrayLikeToArray$d"); -function _defineProperty$d(e2, r, t2) { - return (r = _toPropertyKey$c(r)) in e2 ? Object.defineProperty(e2, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r] = t2, e2; +function _defineProperty$f(e2, r2, t2) { + return (r2 = _toPropertyKey$c(r2)) in e2 ? Object.defineProperty(e2, r2, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r2] = t2, e2; } -__name(_defineProperty$d, "_defineProperty$d"); +__name(_defineProperty$f, "_defineProperty$f"); function _toPropertyKey$c(t2) { var i2 = _toPrimitive$c(t2, "string"); return "symbol" == _typeof$d(i2) ? i2 : i2 + ""; } __name(_toPropertyKey$c, "_toPropertyKey$c"); -function _toPrimitive$c(t2, r) { +function _toPrimitive$c(t2, r2) { if ("object" != _typeof$d(t2) || !t2) return t2; var e2 = t2[Symbol.toPrimitive]; if (void 0 !== e2) { - var i2 = e2.call(t2, r || "default"); + var i2 = e2.call(t2, r2 || "default"); if ("object" != _typeof$d(i2)) return i2; throw new TypeError("@@toPrimitive must return a primitive value."); } - return ("string" === r ? String : Number)(t2); + return ("string" === r2 ? String : Number)(t2); } __name(_toPrimitive$c, "_toPrimitive$c"); var Ripple = BaseRipple.extend("ripple", { @@ -56667,7 +82219,7 @@ var Ripple = BaseRipple.extend("ripple", { el.removeEventListener("mousedown", this.onMouseDown.bind(this)); }, "unbindEvents"), createRipple: /* @__PURE__ */ __name(function createRipple(el) { - var ink = createElement("span", _defineProperty$d(_defineProperty$d({ + var ink = createElement("span", _defineProperty$f(_defineProperty$f({ role: "presentation", "aria-hidden": true, "data-p-ink": true, @@ -56698,9 +82250,9 @@ var Ripple = BaseRipple.extend("ripple", { !this.isUnstyled() && removeClass(ink, "p-ink-active"); ink.setAttribute("data-p-ink-active", "false"); if (!getHeight(ink) && !getWidth(ink)) { - var d = Math.max(getOuterWidth(target), getOuterHeight(target)); - ink.style.height = d + "px"; - ink.style.width = d + "px"; + var d2 = Math.max(getOuterWidth(target), getOuterHeight(target)); + ink.style.height = d2 + "px"; + ink.style.width = d2 + "px"; } var offset = getOffset(target); var x2 = event.pageX - offset.left + document.body.scrollTop - getWidth(ink) / 2; @@ -56730,43 +82282,43 @@ var Ripple = BaseRipple.extend("ripple", { }, "getInk") } }); -function _typeof$c(o) { +function _typeof$c(o2) { "@babel/helpers - typeof"; - return _typeof$c = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { - return typeof o2; - } : function(o2) { - return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; - }, _typeof$c(o); + return _typeof$c = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { + return typeof o3; + } : function(o3) { + return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; + }, _typeof$c(o2); } __name(_typeof$c, "_typeof$c"); -function _defineProperty$c(e2, r, t2) { - return (r = _toPropertyKey$b(r)) in e2 ? Object.defineProperty(e2, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r] = t2, e2; +function _defineProperty$e(e2, r2, t2) { + return (r2 = _toPropertyKey$b(r2)) in e2 ? Object.defineProperty(e2, r2, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r2] = t2, e2; } -__name(_defineProperty$c, "_defineProperty$c"); +__name(_defineProperty$e, "_defineProperty$e"); function _toPropertyKey$b(t2) { var i2 = _toPrimitive$b(t2, "string"); return "symbol" == _typeof$c(i2) ? i2 : i2 + ""; } __name(_toPropertyKey$b, "_toPropertyKey$b"); -function _toPrimitive$b(t2, r) { +function _toPrimitive$b(t2, r2) { if ("object" != _typeof$c(t2) || !t2) return t2; var e2 = t2[Symbol.toPrimitive]; if (void 0 !== e2) { - var i2 = e2.call(t2, r || "default"); + var i2 = e2.call(t2, r2 || "default"); if ("object" != _typeof$c(i2)) return i2; throw new TypeError("@@toPrimitive must return a primitive value."); } - return ("string" === r ? String : Number)(t2); + return ("string" === r2 ? String : Number)(t2); } __name(_toPrimitive$b, "_toPrimitive$b"); -var theme$v = /* @__PURE__ */ __name(function theme8(_ref) { +var theme$x = /* @__PURE__ */ __name(function theme8(_ref) { var dt2 = _ref.dt; return "\n.p-button {\n display: inline-flex;\n cursor: pointer;\n user-select: none;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n position: relative;\n color: ".concat(dt2("button.primary.color"), ";\n background: ").concat(dt2("button.primary.background"), ";\n border: 1px solid ").concat(dt2("button.primary.border.color"), ";\n padding: ").concat(dt2("button.padding.y"), " ").concat(dt2("button.padding.x"), ";\n font-size: 1rem;\n font-family: inherit;\n font-feature-settings: inherit;\n transition: background ").concat(dt2("button.transition.duration"), ", color ").concat(dt2("button.transition.duration"), ", border-color ").concat(dt2("button.transition.duration"), ",\n outline-color ").concat(dt2("button.transition.duration"), ", box-shadow ").concat(dt2("button.transition.duration"), ";\n border-radius: ").concat(dt2("button.border.radius"), ";\n outline-color: transparent;\n gap: ").concat(dt2("button.gap"), ";\n}\n\n.p-button:disabled {\n cursor: default;\n}\n\n.p-button-icon-right {\n order: 1;\n}\n\n.p-button-icon-bottom {\n order: 2;\n}\n\n.p-button-icon-only {\n width: ").concat(dt2("button.icon.only.width"), ";\n padding-left: 0;\n padding-right: 0;\n gap: 0;\n}\n\n.p-button-icon-only.p-button-rounded {\n border-radius: 50%;\n height: ").concat(dt2("button.icon.only.width"), ";\n}\n\n.p-button-icon-only .p-button-label {\n visibility: hidden;\n width: 0;\n}\n\n.p-button-sm {\n font-size: ").concat(dt2("button.sm.font.size"), ";\n padding: ").concat(dt2("button.sm.padding.y"), " ").concat(dt2("button.sm.padding.x"), ";\n}\n\n.p-button-sm .p-button-icon {\n font-size: ").concat(dt2("button.sm.font.size"), ";\n}\n\n.p-button-lg {\n font-size: ").concat(dt2("button.lg.font.size"), ";\n padding: ").concat(dt2("button.lg.padding.y"), " ").concat(dt2("button.lg.padding.x"), ";\n}\n\n.p-button-lg .p-button-icon {\n font-size: ").concat(dt2("button.lg.font.size"), ";\n}\n\n.p-button-vertical {\n flex-direction: column;\n}\n\n.p-button-label {\n font-weight: ").concat(dt2("button.label.font.weight"), ";\n}\n\n.p-button-fluid {\n width: 100%;\n}\n\n.p-button-fluid.p-button-icon-only {\n width: ").concat(dt2("button.icon.only.width"), ";\n}\n\n.p-button:not(:disabled):hover {\n background: ").concat(dt2("button.primary.hover.background"), ";\n border: 1px solid ").concat(dt2("button.primary.hover.border.color"), ";\n color: ").concat(dt2("button.primary.hover.color"), ";\n}\n\n.p-button:not(:disabled):active {\n background: ").concat(dt2("button.primary.active.background"), ";\n border: 1px solid ").concat(dt2("button.primary.active.border.color"), ";\n color: ").concat(dt2("button.primary.active.color"), ";\n}\n\n.p-button:focus-visible {\n box-shadow: ").concat(dt2("button.primary.focus.ring.shadow"), ";\n outline: ").concat(dt2("button.focus.ring.width"), " ").concat(dt2("button.focus.ring.style"), " ").concat(dt2("button.primary.focus.ring.color"), ";\n outline-offset: ").concat(dt2("button.focus.ring.offset"), ";\n}\n\n.p-button .p-badge {\n min-width: ").concat(dt2("button.badge.size"), ";\n height: ").concat(dt2("button.badge.size"), ";\n line-height: ").concat(dt2("button.badge.size"), ";\n}\n\n.p-button-raised {\n box-shadow: ").concat(dt2("button.raised.shadow"), ";\n}\n\n.p-button-rounded {\n border-radius: ").concat(dt2("button.rounded.border.radius"), ";\n}\n\n.p-button-secondary {\n background: ").concat(dt2("button.secondary.background"), ";\n border: 1px solid ").concat(dt2("button.secondary.border.color"), ";\n color: ").concat(dt2("button.secondary.color"), ";\n}\n\n.p-button-secondary:not(:disabled):hover {\n background: ").concat(dt2("button.secondary.hover.background"), ";\n border: 1px solid ").concat(dt2("button.secondary.hover.border.color"), ";\n color: ").concat(dt2("button.secondary.hover.color"), ";\n}\n\n.p-button-secondary:not(:disabled):active {\n background: ").concat(dt2("button.secondary.active.background"), ";\n border: 1px solid ").concat(dt2("button.secondary.active.border.color"), ";\n color: ").concat(dt2("button.secondary.active.color"), ";\n}\n\n.p-button-secondary:focus-visible {\n outline-color: ").concat(dt2("button.secondary.focus.ring.color"), ";\n box-shadow: ").concat(dt2("button.secondary.focus.ring.shadow"), ";\n}\n\n.p-button-success {\n background: ").concat(dt2("button.success.background"), ";\n border: 1px solid ").concat(dt2("button.success.border.color"), ";\n color: ").concat(dt2("button.success.color"), ";\n}\n\n.p-button-success:not(:disabled):hover {\n background: ").concat(dt2("button.success.hover.background"), ";\n border: 1px solid ").concat(dt2("button.success.hover.border.color"), ";\n color: ").concat(dt2("button.success.hover.color"), ";\n}\n\n.p-button-success:not(:disabled):active {\n background: ").concat(dt2("button.success.active.background"), ";\n border: 1px solid ").concat(dt2("button.success.active.border.color"), ";\n color: ").concat(dt2("button.success.active.color"), ";\n}\n\n.p-button-success:focus-visible {\n outline-color: ").concat(dt2("button.success.focus.ring.color"), ";\n box-shadow: ").concat(dt2("button.success.focus.ring.shadow"), ";\n}\n\n.p-button-info {\n background: ").concat(dt2("button.info.background"), ";\n border: 1px solid ").concat(dt2("button.info.border.color"), ";\n color: ").concat(dt2("button.info.color"), ";\n}\n\n.p-button-info:not(:disabled):hover {\n background: ").concat(dt2("button.info.hover.background"), ";\n border: 1px solid ").concat(dt2("button.info.hover.border.color"), ";\n color: ").concat(dt2("button.info.hover.color"), ";\n}\n\n.p-button-info:not(:disabled):active {\n background: ").concat(dt2("button.info.active.background"), ";\n border: 1px solid ").concat(dt2("button.info.active.border.color"), ";\n color: ").concat(dt2("button.info.active.color"), ";\n}\n\n.p-button-info:focus-visible {\n outline-color: ").concat(dt2("button.info.focus.ring.color"), ";\n box-shadow: ").concat(dt2("button.info.focus.ring.shadow"), ";\n}\n\n.p-button-warn {\n background: ").concat(dt2("button.warn.background"), ";\n border: 1px solid ").concat(dt2("button.warn.border.color"), ";\n color: ").concat(dt2("button.warn.color"), ";\n}\n\n.p-button-warn:not(:disabled):hover {\n background: ").concat(dt2("button.warn.hover.background"), ";\n border: 1px solid ").concat(dt2("button.warn.hover.border.color"), ";\n color: ").concat(dt2("button.warn.hover.color"), ";\n}\n\n.p-button-warn:not(:disabled):active {\n background: ").concat(dt2("button.warn.active.background"), ";\n border: 1px solid ").concat(dt2("button.warn.active.border.color"), ";\n color: ").concat(dt2("button.warn.active.color"), ";\n}\n\n.p-button-warn:focus-visible {\n outline-color: ").concat(dt2("button.warn.focus.ring.color"), ";\n box-shadow: ").concat(dt2("button.warn.focus.ring.shadow"), ";\n}\n\n.p-button-help {\n background: ").concat(dt2("button.help.background"), ";\n border: 1px solid ").concat(dt2("button.help.border.color"), ";\n color: ").concat(dt2("button.help.color"), ";\n}\n\n.p-button-help:not(:disabled):hover {\n background: ").concat(dt2("button.help.hover.background"), ";\n border: 1px solid ").concat(dt2("button.help.hover.border.color"), ";\n color: ").concat(dt2("button.help.hover.color"), ";\n}\n\n.p-button-help:not(:disabled):active {\n background: ").concat(dt2("button.help.active.background"), ";\n border: 1px solid ").concat(dt2("button.help.active.border.color"), ";\n color: ").concat(dt2("button.help.active.color"), ";\n}\n\n.p-button-help:focus-visible {\n outline-color: ").concat(dt2("button.help.focus.ring.color"), ";\n box-shadow: ").concat(dt2("button.help.focus.ring.shadow"), ";\n}\n\n.p-button-danger {\n background: ").concat(dt2("button.danger.background"), ";\n border: 1px solid ").concat(dt2("button.danger.border.color"), ";\n color: ").concat(dt2("button.danger.color"), ";\n}\n\n.p-button-danger:not(:disabled):hover {\n background: ").concat(dt2("button.danger.hover.background"), ";\n border: 1px solid ").concat(dt2("button.danger.hover.border.color"), ";\n color: ").concat(dt2("button.danger.hover.color"), ";\n}\n\n.p-button-danger:not(:disabled):active {\n background: ").concat(dt2("button.danger.active.background"), ";\n border: 1px solid ").concat(dt2("button.danger.active.border.color"), ";\n color: ").concat(dt2("button.danger.active.color"), ";\n}\n\n.p-button-danger:focus-visible {\n outline-color: ").concat(dt2("button.danger.focus.ring.color"), ";\n box-shadow: ").concat(dt2("button.danger.focus.ring.shadow"), ";\n}\n\n.p-button-contrast {\n background: ").concat(dt2("button.contrast.background"), ";\n border: 1px solid ").concat(dt2("button.contrast.border.color"), ";\n color: ").concat(dt2("button.contrast.color"), ";\n}\n\n.p-button-contrast:not(:disabled):hover {\n background: ").concat(dt2("button.contrast.hover.background"), ";\n border: 1px solid ").concat(dt2("button.contrast.hover.border.color"), ";\n color: ").concat(dt2("button.contrast.hover.color"), ";\n}\n\n.p-button-contrast:not(:disabled):active {\n background: ").concat(dt2("button.contrast.active.background"), ";\n border: 1px solid ").concat(dt2("button.contrast.active.border.color"), ";\n color: ").concat(dt2("button.contrast.active.color"), ";\n}\n\n.p-button-contrast:focus-visible {\n outline-color: ").concat(dt2("button.contrast.focus.ring.color"), ";\n box-shadow: ").concat(dt2("button.contrast.focus.ring.shadow"), ";\n}\n\n.p-button-outlined {\n background: transparent;\n border-color: ").concat(dt2("button.outlined.primary.border.color"), ";\n color: ").concat(dt2("button.outlined.primary.color"), ";\n}\n\n.p-button-outlined:not(:disabled):hover {\n background: ").concat(dt2("button.outlined.primary.hover.background"), ";\n border-color: ").concat(dt2("button.outlined.primary.border.color"), ";\n color: ").concat(dt2("button.outlined.primary.color"), ";\n}\n\n.p-button-outlined:not(:disabled):active {\n background: ").concat(dt2("button.outlined.primary.active.background"), ";\n border-color: ").concat(dt2("button.outlined.primary.border.color"), ";\n color: ").concat(dt2("button.outlined.primary.color"), ";\n}\n\n.p-button-outlined.p-button-secondary {\n border-color: ").concat(dt2("button.outlined.secondary.border.color"), ";\n color: ").concat(dt2("button.outlined.secondary.color"), ";\n}\n\n.p-button-outlined.p-button-secondary:not(:disabled):hover {\n background: ").concat(dt2("button.outlined.secondary.hover.background"), ";\n border-color: ").concat(dt2("button.outlined.secondary.border.color"), ";\n color: ").concat(dt2("button.outlined.secondary.color"), ";\n}\n\n.p-button-outlined.p-button-secondary:not(:disabled):active {\n background: ").concat(dt2("button.outlined.secondary.active.background"), ";\n border-color: ").concat(dt2("button.outlined.secondary.border.color"), ";\n color: ").concat(dt2("button.outlined.secondary.color"), ";\n}\n\n.p-button-outlined.p-button-success {\n border-color: ").concat(dt2("button.outlined.success.border.color"), ";\n color: ").concat(dt2("button.outlined.success.color"), ";\n}\n\n.p-button-outlined.p-button-success:not(:disabled):hover {\n background: ").concat(dt2("button.outlined.success.hover.background"), ";\n border-color: ").concat(dt2("button.outlined.success.border.color"), ";\n color: ").concat(dt2("button.outlined.success.color"), ";\n}\n\n.p-button-outlined.p-button-success:not(:disabled):active {\n background: ").concat(dt2("button.outlined.success.active.background"), ";\n border-color: ").concat(dt2("button.outlined.success.border.color"), ";\n color: ").concat(dt2("button.outlined.success.color"), ";\n}\n\n.p-button-outlined.p-button-info {\n border-color: ").concat(dt2("button.outlined.info.border.color"), ";\n color: ").concat(dt2("button.outlined.info.color"), ";\n}\n\n.p-button-outlined.p-button-info:not(:disabled):hover {\n background: ").concat(dt2("button.outlined.info.hover.background"), ";\n border-color: ").concat(dt2("button.outlined.info.border.color"), ";\n color: ").concat(dt2("button.outlined.info.color"), ";\n}\n\n.p-button-outlined.p-button-info:not(:disabled):active {\n background: ").concat(dt2("button.outlined.info.active.background"), ";\n border-color: ").concat(dt2("button.outlined.info.border.color"), ";\n color: ").concat(dt2("button.outlined.info.color"), ";\n}\n\n.p-button-outlined.p-button-warn {\n border-color: ").concat(dt2("button.outlined.warn.border.color"), ";\n color: ").concat(dt2("button.outlined.warn.color"), ";\n}\n\n.p-button-outlined.p-button-warn:not(:disabled):hover {\n background: ").concat(dt2("button.outlined.warn.hover.background"), ";\n border-color: ").concat(dt2("button.outlined.warn.border.color"), ";\n color: ").concat(dt2("button.outlined.warn.color"), ";\n}\n\n.p-button-outlined.p-button-warn:not(:disabled):active {\n background: ").concat(dt2("button.outlined.warn.active.background"), ";\n border-color: ").concat(dt2("button.outlined.warn.border.color"), ";\n color: ").concat(dt2("button.outlined.warn.color"), ";\n}\n\n.p-button-outlined.p-button-help {\n border-color: ").concat(dt2("button.outlined.help.border.color"), ";\n color: ").concat(dt2("button.outlined.help.color"), ";\n}\n\n.p-button-outlined.p-button-help:not(:disabled):hover {\n background: ").concat(dt2("button.outlined.help.hover.background"), ";\n border-color: ").concat(dt2("button.outlined.help.border.color"), ";\n color: ").concat(dt2("button.outlined.help.color"), ";\n}\n\n.p-button-outlined.p-button-help:not(:disabled):active {\n background: ").concat(dt2("button.outlined.help.active.background"), ";\n border-color: ").concat(dt2("button.outlined.help.border.color"), ";\n color: ").concat(dt2("button.outlined.help.color"), ";\n}\n\n.p-button-outlined.p-button-danger {\n border-color: ").concat(dt2("button.outlined.danger.border.color"), ";\n color: ").concat(dt2("button.outlined.danger.color"), ";\n}\n\n.p-button-outlined.p-button-danger:not(:disabled):hover {\n background: ").concat(dt2("button.outlined.danger.hover.background"), ";\n border-color: ").concat(dt2("button.outlined.danger.border.color"), ";\n color: ").concat(dt2("button.outlined.danger.color"), ";\n}\n\n.p-button-outlined.p-button-danger:not(:disabled):active {\n background: ").concat(dt2("button.outlined.danger.active.background"), ";\n border-color: ").concat(dt2("button.outlined.danger.border.color"), ";\n color: ").concat(dt2("button.outlined.danger.color"), ";\n}\n\n.p-button-outlined.p-button-contrast {\n border-color: ").concat(dt2("button.outlined.contrast.border.color"), ";\n color: ").concat(dt2("button.outlined.contrast.color"), ";\n}\n\n.p-button-outlined.p-button-contrast:not(:disabled):hover {\n background: ").concat(dt2("button.outlined.contrast.hover.background"), ";\n border-color: ").concat(dt2("button.outlined.contrast.border.color"), ";\n color: ").concat(dt2("button.outlined.contrast.color"), ";\n}\n\n.p-button-outlined.p-button-contrast:not(:disabled):active {\n background: ").concat(dt2("button.outlined.contrast.active.background"), ";\n border-color: ").concat(dt2("button.outlined.contrast.border.color"), ";\n color: ").concat(dt2("button.outlined.contrast.color"), ";\n}\n\n.p-button-outlined.p-button-plain {\n border-color: ").concat(dt2("button.outlined.plain.border.color"), ";\n color: ").concat(dt2("button.outlined.plain.color"), ";\n}\n\n.p-button-outlined.p-button-plain:not(:disabled):hover {\n background: ").concat(dt2("button.outlined.plain.hover.background"), ";\n border-color: ").concat(dt2("button.outlined.plain.border.color"), ";\n color: ").concat(dt2("button.outlined.plain.color"), ";\n}\n\n.p-button-outlined.p-button-plain:not(:disabled):active {\n background: ").concat(dt2("button.outlined.plain.active.background"), ";\n border-color: ").concat(dt2("button.outlined.plain.border.color"), ";\n color: ").concat(dt2("button.outlined.plain.color"), ";\n}\n\n.p-button-text {\n background: transparent;\n border-color: transparent;\n color: ").concat(dt2("button.text.primary.color"), ";\n}\n\n.p-button-text:not(:disabled):hover {\n background: ").concat(dt2("button.text.primary.hover.background"), ";\n border-color: transparent;\n color: ").concat(dt2("button.text.primary.color"), ";\n}\n\n.p-button-text:not(:disabled):active {\n background: ").concat(dt2("button.text.primary.active.background"), ";\n border-color: transparent;\n color: ").concat(dt2("button.text.primary.color"), ";\n}\n\n.p-button-text.p-button-secondary {\n background: transparent;\n border-color: transparent;\n color: ").concat(dt2("button.text.secondary.color"), ";\n}\n\n.p-button-text.p-button-secondary:not(:disabled):hover {\n background: ").concat(dt2("button.text.secondary.hover.background"), ";\n border-color: transparent;\n color: ").concat(dt2("button.text.secondary.color"), ";\n}\n\n.p-button-text.p-button-secondary:not(:disabled):active {\n background: ").concat(dt2("button.text.secondary.active.background"), ";\n border-color: transparent;\n color: ").concat(dt2("button.text.secondary.color"), ";\n}\n\n.p-button-text.p-button-success {\n background: transparent;\n border-color: transparent;\n color: ").concat(dt2("button.text.success.color"), ";\n}\n\n.p-button-text.p-button-success:not(:disabled):hover {\n background: ").concat(dt2("button.text.success.hover.background"), ";\n border-color: transparent;\n color: ").concat(dt2("button.text.success.color"), ";\n}\n\n.p-button-text.p-button-success:not(:disabled):active {\n background: ").concat(dt2("button.text.success.active.background"), ";\n border-color: transparent;\n color: ").concat(dt2("button.text.success.color"), ";\n}\n\n.p-button-text.p-button-info {\n background: transparent;\n border-color: transparent;\n color: ").concat(dt2("button.text.info.color"), ";\n}\n\n.p-button-text.p-button-info:not(:disabled):hover {\n background: ").concat(dt2("button.text.info.hover.background"), ";\n border-color: transparent;\n color: ").concat(dt2("button.text.info.color"), ";\n}\n\n.p-button-text.p-button-info:not(:disabled):active {\n background: ").concat(dt2("button.text.info.active.background"), ";\n border-color: transparent;\n color: ").concat(dt2("button.text.info.color"), ";\n}\n\n.p-button-text.p-button-warn {\n background: transparent;\n border-color: transparent;\n color: ").concat(dt2("button.text.warn.color"), ";\n}\n\n.p-button-text.p-button-warn:not(:disabled):hover {\n background: ").concat(dt2("button.text.warn.hover.background"), ";\n border-color: transparent;\n color: ").concat(dt2("button.text.warn.color"), ";\n}\n\n.p-button-text.p-button-warn:not(:disabled):active {\n background: ").concat(dt2("button.text.warn.active.background"), ";\n border-color: transparent;\n color: ").concat(dt2("button.text.warn.color"), ";\n}\n\n.p-button-text.p-button-help {\n background: transparent;\n border-color: transparent;\n color: ").concat(dt2("button.text.help.color"), ";\n}\n\n.p-button-text.p-button-help:not(:disabled):hover {\n background: ").concat(dt2("button.text.help.hover.background"), ";\n border-color: transparent;\n color: ").concat(dt2("button.text.help.color"), ";\n}\n\n.p-button-text.p-button-help:not(:disabled):active {\n background: ").concat(dt2("button.text.help.active.background"), ";\n border-color: transparent;\n color: ").concat(dt2("button.text.help.color"), ";\n}\n\n.p-button-text.p-button-danger {\n background: transparent;\n border-color: transparent;\n color: ").concat(dt2("button.text.danger.color"), ";\n}\n\n.p-button-text.p-button-danger:not(:disabled):hover {\n background: ").concat(dt2("button.text.danger.hover.background"), ";\n border-color: transparent;\n color: ").concat(dt2("button.text.danger.color"), ";\n}\n\n.p-button-text.p-button-danger:not(:disabled):active {\n background: ").concat(dt2("button.text.danger.active.background"), ";\n border-color: transparent;\n color: ").concat(dt2("button.text.danger.color"), ";\n}\n\n.p-button-text.p-button-plain {\n background: transparent;\n border-color: transparent;\n color: ").concat(dt2("button.text.plain.color"), ";\n}\n\n.p-button-text.p-button-plain:not(:disabled):hover {\n background: ").concat(dt2("button.text.plain.hover.background"), ";\n border-color: transparent;\n color: ").concat(dt2("button.text.plain.color"), ";\n}\n\n.p-button-text.p-button-plain:not(:disabled):active {\n background: ").concat(dt2("button.text.plain.active.background"), ";\n border-color: transparent;\n color: ").concat(dt2("button.text.plain.color"), ";\n}\n\n.p-button-link {\n background: transparent;\n border-color: transparent;\n color: ").concat(dt2("button.link.color"), ";\n}\n\n.p-button-link:not(:disabled):hover {\n background: transparent;\n border-color: transparent;\n color: ").concat(dt2("button.link.hover.color"), ";\n}\n\n.p-button-link:not(:disabled):hover .p-button-label {\n text-decoration: underline;\n}\n\n.p-button-link:not(:disabled):active {\n background: transparent;\n border-color: transparent;\n color: ").concat(dt2("button.link.active.color"), ";\n}\n"); }, "theme"); -var classes$x = { - root: /* @__PURE__ */ __name(function root2(_ref2) { +var classes$z = { + root: /* @__PURE__ */ __name(function root3(_ref2) { var instance = _ref2.instance, props = _ref2.props; - return ["p-button p-component", _defineProperty$c(_defineProperty$c(_defineProperty$c(_defineProperty$c(_defineProperty$c(_defineProperty$c(_defineProperty$c(_defineProperty$c(_defineProperty$c({ + return ["p-button p-component", _defineProperty$e(_defineProperty$e(_defineProperty$e(_defineProperty$e(_defineProperty$e(_defineProperty$e(_defineProperty$e(_defineProperty$e(_defineProperty$e({ "p-button-icon-only": instance.hasIcon && !props.label && !props.badge, "p-button-vertical": (props.iconPos === "top" || props.iconPos === "bottom") && props.label, "p-button-loading": props.loading, @@ -56776,18 +82328,18 @@ var classes$x = { loadingIcon: "p-button-loading-icon", icon: /* @__PURE__ */ __name(function icon2(_ref4) { var props = _ref4.props; - return ["p-button-icon", _defineProperty$c({}, "p-button-icon-".concat(props.iconPos), props.label)]; + return ["p-button-icon", _defineProperty$e({}, "p-button-icon-".concat(props.iconPos), props.label)]; }, "icon"), label: "p-button-label" }; var ButtonStyle = BaseStyle.extend({ name: "button", - theme: theme$v, - classes: classes$x + theme: theme$x, + classes: classes$z }); -var script$1$y = { +var script$1$A = { name: "BaseButton", - "extends": script$_, + "extends": script$11, props: { label: { type: String, @@ -56878,9 +82430,9 @@ var script$1$y = { }; }, "provide") }; -var script$R = { +var script$U = { name: "Button", - "extends": script$1$y, + "extends": script$1$A, inheritAttrs: false, inject: { $pcFluid: { @@ -56929,14 +82481,14 @@ var script$R = { }, "hasFluid") }, components: { - SpinnerIcon: script$T, - Badge: script$S + SpinnerIcon: script$W, + Badge: script$V }, directives: { ripple: Ripple } }; -function render$Q(_ctx, _cache, $props, $setup, $data, $options) { +function render$T(_ctx, _cache, $props, $setup, $data, $options) { var _component_SpinnerIcon = resolveComponent("SpinnerIcon"); var _component_Badge = resolveComponent("Badge"); var _directive_ripple = resolveDirective("ripple"); @@ -56984,64 +82536,64 @@ function render$Q(_ctx, _cache, $props, $setup, $data, $options) { a11yAttrs: $options.a11yAttrs }); } -__name(render$Q, "render$Q"); -script$R.render = render$Q; +__name(render$T, "render$T"); +script$U.render = render$T; var FocusTrapStyle = BaseStyle.extend({ name: "focustrap-directive" }); var BaseFocusTrap = BaseDirective.extend({ style: FocusTrapStyle }); -function _typeof$b(o) { +function _typeof$b(o2) { "@babel/helpers - typeof"; - return _typeof$b = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { - return typeof o2; - } : function(o2) { - return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; - }, _typeof$b(o); + return _typeof$b = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { + return typeof o3; + } : function(o3) { + return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; + }, _typeof$b(o2); } __name(_typeof$b, "_typeof$b"); -function ownKeys$d(e2, r) { +function ownKeys$d(e2, r2) { var t2 = Object.keys(e2); if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e2); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e2, r2).enumerable; - })), t2.push.apply(t2, o); + var o2 = Object.getOwnPropertySymbols(e2); + r2 && (o2 = o2.filter(function(r3) { + return Object.getOwnPropertyDescriptor(e2, r3).enumerable; + })), t2.push.apply(t2, o2); } return t2; } __name(ownKeys$d, "ownKeys$d"); function _objectSpread$d(e2) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$d(Object(t2), true).forEach(function(r2) { - _defineProperty$b(e2, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$d(Object(t2)).forEach(function(r2) { - Object.defineProperty(e2, r2, Object.getOwnPropertyDescriptor(t2, r2)); + for (var r2 = 1; r2 < arguments.length; r2++) { + var t2 = null != arguments[r2] ? arguments[r2] : {}; + r2 % 2 ? ownKeys$d(Object(t2), true).forEach(function(r3) { + _defineProperty$d(e2, r3, t2[r3]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$d(Object(t2)).forEach(function(r3) { + Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3)); }); } return e2; } __name(_objectSpread$d, "_objectSpread$d"); -function _defineProperty$b(e2, r, t2) { - return (r = _toPropertyKey$a(r)) in e2 ? Object.defineProperty(e2, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r] = t2, e2; +function _defineProperty$d(e2, r2, t2) { + return (r2 = _toPropertyKey$a(r2)) in e2 ? Object.defineProperty(e2, r2, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r2] = t2, e2; } -__name(_defineProperty$b, "_defineProperty$b"); +__name(_defineProperty$d, "_defineProperty$d"); function _toPropertyKey$a(t2) { var i2 = _toPrimitive$a(t2, "string"); return "symbol" == _typeof$b(i2) ? i2 : i2 + ""; } __name(_toPropertyKey$a, "_toPropertyKey$a"); -function _toPrimitive$a(t2, r) { +function _toPrimitive$a(t2, r2) { if ("object" != _typeof$b(t2) || !t2) return t2; var e2 = t2[Symbol.toPrimitive]; if (void 0 !== e2) { - var i2 = e2.call(t2, r || "default"); + var i2 = e2.call(t2, r2 || "default"); if ("object" != _typeof$b(i2)) return i2; throw new TypeError("@@toPrimitive must return a primitive value."); } - return ("string" === r ? String : Number)(t2); + return ("string" === r2 ? String : Number)(t2); } __name(_toPrimitive$a, "_toPrimitive$a"); var FocusTrap = BaseFocusTrap.extend("focustrap", { @@ -57150,7 +82702,7 @@ var FocusTrap = BaseFocusTrap.extend("focustrap", { }, "createHiddenFocusableElements") } }); -var script$Q = { +var script$T = { name: "Portal", props: { appendTo: { @@ -57176,7 +82728,7 @@ var script$Q = { }, "inline") } }; -function render$P(_ctx, _cache, $props, $setup, $data, $options) { +function render$S(_ctx, _cache, $props, $setup, $data, $options) { return $options.inline ? renderSlot(_ctx.$slots, "default", { key: 0 }) : $data.mounted ? (openBlock(), createBlock(Teleport, { @@ -57184,9 +82736,9 @@ function render$P(_ctx, _cache, $props, $setup, $data, $options) { to: $props.appendTo }, [renderSlot(_ctx.$slots, "default")], 8, ["to"])) : createCommentVNode("", true); } -__name(render$P, "render$P"); -script$Q.render = render$P; -var theme$u = /* @__PURE__ */ __name(function theme9(_ref) { +__name(render$S, "render$S"); +script$T.render = render$S; +var theme$w = /* @__PURE__ */ __name(function theme9(_ref) { var dt2 = _ref.dt; return "\n.p-dialog {\n max-height: 90%;\n transform: scale(1);\n border-radius: ".concat(dt2("dialog.border.radius"), ";\n box-shadow: ").concat(dt2("dialog.shadow"), ";\n background: ").concat(dt2("dialog.background"), ";\n border: 1px solid ").concat(dt2("dialog.border.color"), ";\n color: ").concat(dt2("dialog.color"), ";\n}\n\n.p-dialog-content {\n overflow-y: auto;\n padding: ").concat(dt2("dialog.content.padding"), ";\n}\n\n.p-dialog-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-shrink: 0;\n padding: ").concat(dt2("dialog.header.padding"), ";\n}\n\n.p-dialog-title {\n font-weight: ").concat(dt2("dialog.title.font.weight"), ";\n font-size: ").concat(dt2("dialog.title.font.size"), ";\n}\n\n.p-dialog-footer {\n flex-shrink: 0;\n padding: ").concat(dt2("dialog.footer.padding"), ";\n display: flex;\n justify-content: flex-end;\n gap: ").concat(dt2("dialog.footer.gap"), ";\n}\n\n.p-dialog-header-actions {\n display: flex;\n align-items: center;\n gap: ").concat(dt2("dialog.header.gap"), ";\n}\n.p-dialog-enter-active {\n transition: all 150ms cubic-bezier(0, 0, 0.2, 1);\n}\n\n.p-dialog-leave-active {\n transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);\n}\n\n.p-dialog-enter-from,\n.p-dialog-leave-to {\n opacity: 0;\n transform: scale(0.7);\n}\n\n.p-dialog-top .p-dialog,\n.p-dialog-bottom .p-dialog,\n.p-dialog-left .p-dialog,\n.p-dialog-right .p-dialog,\n.p-dialog-topleft .p-dialog,\n.p-dialog-topright .p-dialog,\n.p-dialog-bottomleft .p-dialog,\n.p-dialog-bottomright .p-dialog {\n margin: 0.75rem;\n transform: translate3d(0px, 0px, 0px);\n}\n\n.p-dialog-top .p-dialog-enter-active,\n.p-dialog-top .p-dialog-leave-active,\n.p-dialog-bottom .p-dialog-enter-active,\n.p-dialog-bottom .p-dialog-leave-active,\n.p-dialog-left .p-dialog-enter-active,\n.p-dialog-left .p-dialog-leave-active,\n.p-dialog-right .p-dialog-enter-active,\n.p-dialog-right .p-dialog-leave-active,\n.p-dialog-topleft .p-dialog-enter-active,\n.p-dialog-topleft .p-dialog-leave-active,\n.p-dialog-topright .p-dialog-enter-active,\n.p-dialog-topright .p-dialog-leave-active,\n.p-dialog-bottomleft .p-dialog-enter-active,\n.p-dialog-bottomleft .p-dialog-leave-active,\n.p-dialog-bottomright .p-dialog-enter-active,\n.p-dialog-bottomright .p-dialog-leave-active {\n transition: all 0.3s ease-out;\n}\n\n.p-dialog-top .p-dialog-enter-from,\n.p-dialog-top .p-dialog-leave-to {\n transform: translate3d(0px, -100%, 0px);\n}\n\n.p-dialog-bottom .p-dialog-enter-from,\n.p-dialog-bottom .p-dialog-leave-to {\n transform: translate3d(0px, 100%, 0px);\n}\n\n.p-dialog-left .p-dialog-enter-from,\n.p-dialog-left .p-dialog-leave-to,\n.p-dialog-topleft .p-dialog-enter-from,\n.p-dialog-topleft .p-dialog-leave-to,\n.p-dialog-bottomleft .p-dialog-enter-from,\n.p-dialog-bottomleft .p-dialog-leave-to {\n transform: translate3d(-100%, 0px, 0px);\n}\n\n.p-dialog-right .p-dialog-enter-from,\n.p-dialog-right .p-dialog-leave-to,\n.p-dialog-topright .p-dialog-enter-from,\n.p-dialog-topright .p-dialog-leave-to,\n.p-dialog-bottomright .p-dialog-enter-from,\n.p-dialog-bottomright .p-dialog-leave-to {\n transform: translate3d(100%, 0px, 0px);\n}\n\n.p-dialog-maximized {\n width: 100vw !important;\n height: 100vh !important;\n top: 0px !important;\n left: 0px !important;\n max-height: 100%;\n height: 100%;\n border-radius: 0;\n}\n\n.p-dialog-maximized .p-dialog-content {\n flex-grow: 1;\n}\n"); }, "theme"); @@ -57211,7 +82763,7 @@ var inlineStyles$3 = { pointerEvents: "auto" } }; -var classes$w = { +var classes$y = { mask: /* @__PURE__ */ __name(function mask2(_ref3) { var props = _ref3.props; var positions = ["left", "right", "top", "topleft", "topright", "bottom", "bottomleft", "bottomright"]; @@ -57222,7 +82774,7 @@ var classes$w = { "p-overlay-mask p-overlay-mask-enter": props.modal }, pos2 ? "p-dialog-".concat(pos2) : ""]; }, "mask"), - root: /* @__PURE__ */ __name(function root3(_ref4) { + root: /* @__PURE__ */ __name(function root4(_ref4) { var props = _ref4.props, instance = _ref4.instance; return ["p-dialog p-component", { "p-dialog-maximized": props.maximizable && instance.maximized @@ -57238,13 +82790,13 @@ var classes$w = { }; var DialogStyle = BaseStyle.extend({ name: "dialog", - theme: theme$u, - classes: classes$w, + theme: theme$w, + classes: classes$y, inlineStyles: inlineStyles$3 }); -var script$1$x = { +var script$1$z = { name: "BaseDialog", - "extends": script$_, + "extends": script$11, props: { header: { type: null, @@ -57376,9 +82928,9 @@ var script$1$x = { }; }, "provide") }; -var script$P = { +var script$S = { name: "Dialog", - "extends": script$1$x, + "extends": script$1$z, inheritAttrs: false, emits: ["update:visible", "show", "hide", "after-hide", "maximize", "unmaximize", "dragend"], provide: /* @__PURE__ */ __name(function provide8() { @@ -57702,68 +83254,68 @@ var script$P = { focustrap: FocusTrap }, components: { - Button: script$R, - Portal: script$Q, - WindowMinimizeIcon: script$U, - WindowMaximizeIcon: script$V, - TimesIcon: script$W + Button: script$U, + Portal: script$T, + WindowMinimizeIcon: script$X, + WindowMaximizeIcon: script$Y, + TimesIcon: script$Z } }; -function _typeof$a(o) { +function _typeof$a(o2) { "@babel/helpers - typeof"; - return _typeof$a = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { - return typeof o2; - } : function(o2) { - return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; - }, _typeof$a(o); + return _typeof$a = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { + return typeof o3; + } : function(o3) { + return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; + }, _typeof$a(o2); } __name(_typeof$a, "_typeof$a"); -function ownKeys$c(e2, r) { +function ownKeys$c(e2, r2) { var t2 = Object.keys(e2); if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e2); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e2, r2).enumerable; - })), t2.push.apply(t2, o); + var o2 = Object.getOwnPropertySymbols(e2); + r2 && (o2 = o2.filter(function(r3) { + return Object.getOwnPropertyDescriptor(e2, r3).enumerable; + })), t2.push.apply(t2, o2); } return t2; } __name(ownKeys$c, "ownKeys$c"); function _objectSpread$c(e2) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$c(Object(t2), true).forEach(function(r2) { - _defineProperty$a(e2, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$c(Object(t2)).forEach(function(r2) { - Object.defineProperty(e2, r2, Object.getOwnPropertyDescriptor(t2, r2)); + for (var r2 = 1; r2 < arguments.length; r2++) { + var t2 = null != arguments[r2] ? arguments[r2] : {}; + r2 % 2 ? ownKeys$c(Object(t2), true).forEach(function(r3) { + _defineProperty$c(e2, r3, t2[r3]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$c(Object(t2)).forEach(function(r3) { + Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3)); }); } return e2; } __name(_objectSpread$c, "_objectSpread$c"); -function _defineProperty$a(e2, r, t2) { - return (r = _toPropertyKey$9(r)) in e2 ? Object.defineProperty(e2, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r] = t2, e2; +function _defineProperty$c(e2, r2, t2) { + return (r2 = _toPropertyKey$9(r2)) in e2 ? Object.defineProperty(e2, r2, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r2] = t2, e2; } -__name(_defineProperty$a, "_defineProperty$a"); +__name(_defineProperty$c, "_defineProperty$c"); function _toPropertyKey$9(t2) { var i2 = _toPrimitive$9(t2, "string"); return "symbol" == _typeof$a(i2) ? i2 : i2 + ""; } __name(_toPropertyKey$9, "_toPropertyKey$9"); -function _toPrimitive$9(t2, r) { +function _toPrimitive$9(t2, r2) { if ("object" != _typeof$a(t2) || !t2) return t2; var e2 = t2[Symbol.toPrimitive]; if (void 0 !== e2) { - var i2 = e2.call(t2, r || "default"); + var i2 = e2.call(t2, r2 || "default"); if ("object" != _typeof$a(i2)) return i2; throw new TypeError("@@toPrimitive must return a primitive value."); } - return ("string" === r ? String : Number)(t2); + return ("string" === r2 ? String : Number)(t2); } __name(_toPrimitive$9, "_toPrimitive$9"); -var _hoisted_1$1k = ["aria-labelledby", "aria-modal"]; -var _hoisted_2$Z = ["id"]; -function render$O(_ctx, _cache, $props, $setup, $data, $options) { +var _hoisted_1$1p = ["aria-labelledby", "aria-modal"]; +var _hoisted_2$10 = ["id"]; +function render$R(_ctx, _cache, $props, $setup, $data, $options) { var _component_Button = resolveComponent("Button"); var _component_Portal = resolveComponent("Portal"); var _directive_focustrap = resolveDirective("focustrap"); @@ -57826,7 +83378,7 @@ function render$O(_ctx, _cache, $props, $setup, $data, $options) { key: 0, id: $options.ariaLabelledById, "class": _ctx.cx("title") - }, _ctx.ptm("title")), toDisplayString$1(_ctx.header), 17, _hoisted_2$Z)) : createCommentVNode("", true)]; + }, _ctx.ptm("title")), toDisplayString$1(_ctx.header), 17, _hoisted_2$10)) : createCommentVNode("", true)]; }), createBaseVNode("div", mergeProps({ "class": _ctx.cx("headerActions") }, _ctx.ptm("headerActions")), [_ctx.maximizable ? (openBlock(), createBlock(_component_Button, mergeProps({ @@ -57881,7 +83433,7 @@ function render$O(_ctx, _cache, $props, $setup, $data, $options) { "class": _ctx.cx("footer") }, _ctx.ptm("footer")), [renderSlot(_ctx.$slots, "footer", {}, function() { return [createTextVNode(toDisplayString$1(_ctx.footer), 1)]; - })], 16)) : createCommentVNode("", true)], 64))], 16, _hoisted_1$1k)), [[_directive_focustrap, { + })], 16)) : createCommentVNode("", true)], 64))], 16, _hoisted_1$1p)), [[_directive_focustrap, { disabled: !_ctx.modal }]]) : createCommentVNode("", true)]; }), @@ -57891,14 +83443,14 @@ function render$O(_ctx, _cache, $props, $setup, $data, $options) { _: 3 }, 8, ["appendTo"]); } -__name(render$O, "render$O"); -script$P.render = render$O; +__name(render$R, "render$R"); +script$S.render = render$R; const useDialogStore = /* @__PURE__ */ defineStore("dialog", () => { const dialogStack = ref([]); const genDialogKey = /* @__PURE__ */ __name(() => `dialog-${Math.random().toString(36).slice(2, 9)}`, "genDialogKey"); function riseDialog(options4) { const dialogKey = options4.key; - const index2 = dialogStack.value.findIndex((d) => d.key === dialogKey); + const index2 = dialogStack.value.findIndex((d2) => d2.key === dialogKey); if (index2 !== -1) { const dialogs = dialogStack.value.splice(index2, 1); dialogStack.value.push(...dialogs); @@ -57911,7 +83463,7 @@ const useDialogStore = /* @__PURE__ */ defineStore("dialog", () => { return; } const dialogKey = options4.key; - const index2 = dialogStack.value.findIndex((d) => d.key === dialogKey); + const index2 = dialogStack.value.findIndex((d2) => d2.key === dialogKey); if (index2 === -1) { return; } @@ -57962,7 +83514,7 @@ const useDialogStore = /* @__PURE__ */ defineStore("dialog", () => { __name(createDialog, "createDialog"); function showDialog(options4) { const dialogKey = options4.key || genDialogKey(); - let dialog = dialogStack.value.find((d) => d.key === dialogKey); + let dialog = dialogStack.value.find((d2) => d2.key === dialogKey); if (dialog) { dialog.visible = true; riseDialog(dialog); @@ -57979,8 +83531,8 @@ const useDialogStore = /* @__PURE__ */ defineStore("dialog", () => { closeDialog }; }); -const _hoisted_1$1j = ["id"]; -const _sfc_main$Z = /* @__PURE__ */ defineComponent({ +const _hoisted_1$1o = ["id"]; +const _sfc_main$_ = /* @__PURE__ */ defineComponent({ __name: "GlobalDialog", setup(__props) { const dialogStore = useDialogStore(); @@ -57994,7 +83546,7 @@ const _sfc_main$Z = /* @__PURE__ */ defineComponent({ }); return (_ctx, _cache) => { return openBlock(true), createElementBlock(Fragment$1, null, renderList(unref(dialogStore).dialogStack, (item3, index2) => { - return openBlock(), createBlock(unref(script$P), mergeProps({ + return openBlock(), createBlock(unref(script$S), mergeProps({ key: item3.key, visible: item3.visible, "onUpdate:visible": /* @__PURE__ */ __name(($event) => item3.visible = $event, "onUpdate:visible"), @@ -58012,7 +83564,7 @@ const _sfc_main$Z = /* @__PURE__ */ defineComponent({ }, null, 8, ["id"])) : (openBlock(), createElementBlock("h3", { key: 1, id: item3.key - }, toDisplayString$1(item3.title || " "), 9, _hoisted_1$1j)) + }, toDisplayString$1(item3.title || " "), 9, _hoisted_1$1o)) ]), default: withCtx(() => [ (openBlock(), createBlock(resolveDynamicComponent(item3.component), mergeProps({ ref_for: true }, item3.contentProps, { @@ -58027,7 +83579,7 @@ const _sfc_main$Z = /* @__PURE__ */ defineComponent({ }); const config$1 = { app_title: "ComfyUI", - app_version: "1.6.18" + app_version: "1.7.14" }; /*! * shared v9.13.1 @@ -58053,7 +83605,7 @@ if (false) { } const RE_ARGS$1 = /\{([0-9a-zA-Z]+)\}/g; function format$5(message3, ...args) { - if (args.length === 1 && isObject$3(args[0])) { + if (args.length === 1 && isObject$a(args[0])) { args = args[0]; } if (!args || !args.hasOwnProperty) { @@ -58080,30 +83632,30 @@ function escapeHtml$1(rawText) { return rawText.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"); } __name(escapeHtml$1, "escapeHtml$1"); -const hasOwnProperty = Object.prototype.hasOwnProperty; +const hasOwnProperty$a = Object.prototype.hasOwnProperty; function hasOwn$1(obj, key) { - return hasOwnProperty.call(obj, key); + return hasOwnProperty$a.call(obj, key); } __name(hasOwn$1, "hasOwn$1"); -const isArray$1 = Array.isArray; -const isFunction$2 = /* @__PURE__ */ __name((val) => typeof val === "function", "isFunction$2"); +const isArray$6 = Array.isArray; +const isFunction$6 = /* @__PURE__ */ __name((val) => typeof val === "function", "isFunction$6"); const isString$5 = /* @__PURE__ */ __name((val) => typeof val === "string", "isString$5"); const isBoolean$1 = /* @__PURE__ */ __name((val) => typeof val === "boolean", "isBoolean$1"); const isSymbol = /* @__PURE__ */ __name((val) => typeof val === "symbol", "isSymbol"); -const isObject$3 = /* @__PURE__ */ __name((val) => val !== null && typeof val === "object", "isObject$3"); +const isObject$a = /* @__PURE__ */ __name((val) => val !== null && typeof val === "object", "isObject$a"); const isPromise = /* @__PURE__ */ __name((val) => { - return isObject$3(val) && isFunction$2(val.then) && isFunction$2(val.catch); + return isObject$a(val) && isFunction$6(val.then) && isFunction$6(val.catch); }, "isPromise"); -const objectToString = Object.prototype.toString; -const toTypeString = /* @__PURE__ */ __name((value4) => objectToString.call(value4), "toTypeString"); +const objectToString$2 = Object.prototype.toString; +const toTypeString = /* @__PURE__ */ __name((value4) => objectToString$2.call(value4), "toTypeString"); const isPlainObject$1 = /* @__PURE__ */ __name((val) => { - if (!isObject$3(val)) + if (!isObject$a(val)) return false; const proto = Object.getPrototypeOf(val); return proto === null || proto.constructor === Object; }, "isPlainObject$1"); const toDisplayString = /* @__PURE__ */ __name((val) => { - return val == null ? "" : isArray$1(val) || isPlainObject$1(val) && val.toString === objectToString ? JSON.stringify(val, null, 2) : String(val); + return val == null ? "" : isArray$6(val) || isPlainObject$1(val) && val.toString === objectToString$2 ? JSON.stringify(val, null, 2) : String(val); }, "toDisplayString"); function join$2(items2, separator = "") { return items2.reduce((str, item3, index2) => index2 === 0 ? str + item3 : str + separator + item3, ""); @@ -58117,17 +83669,17 @@ function generateCodeFrame(source, start2 = 0, end = source.length) { for (let i2 = 0; i2 < lines.length; i2++) { count += lines[i2].length + 1; if (count >= start2) { - for (let j = i2 - RANGE; j <= i2 + RANGE || end > count; j++) { - if (j < 0 || j >= lines.length) + for (let j2 = i2 - RANGE; j2 <= i2 + RANGE || end > count; j2++) { + if (j2 < 0 || j2 >= lines.length) continue; - const line = j + 1; - res.push(`${line}${" ".repeat(3 - String(line).length)}| ${lines[j]}`); - const lineLength = lines[j].length; - if (j === i2) { + const line = j2 + 1; + res.push(`${line}${" ".repeat(3 - String(line).length)}| ${lines[j2]}`); + const lineLength = lines[j2].length; + if (j2 === i2) { const pad = start2 - (count - lineLength) + 1; const length = Math.max(1, end > count ? lineLength - pad : end - start2); res.push(` | ` + " ".repeat(pad) + "^".repeat(length)); - } else if (j > i2) { + } else if (j2 > i2) { if (end > count) { const length = Math.max(Math.min(end - count, lineLength), 1); res.push(` | ` + "^".repeat(length)); @@ -58188,7 +83740,7 @@ function createEmitter() { return emitter; } __name(createEmitter, "createEmitter"); -const isNotObjectOrIsArray = /* @__PURE__ */ __name((val) => !isObject$3(val) || isArray$1(val), "isNotObjectOrIsArray"); +const isNotObjectOrIsArray = /* @__PURE__ */ __name((val) => !isObject$a(val) || isArray$6(val), "isNotObjectOrIsArray"); function deepCopy(src, des) { if (isNotObjectOrIsArray(src) || isNotObjectOrIsArray(des)) { throw new Error("Invalid value"); @@ -58229,7 +83781,7 @@ function createLocation(start2, end, source) { __name(createLocation, "createLocation"); const RE_ARGS = /\{([0-9a-zA-Z]+)\}/g; function format$4(message3, ...args) { - if (args.length === 1 && isObject$2(args[0])) { + if (args.length === 1 && isObject$9(args[0])) { args = args[0]; } if (!args || !args.hasOwnProperty) { @@ -58242,7 +83794,7 @@ function format$4(message3, ...args) { __name(format$4, "format$4"); const assign$3 = Object.assign; const isString$4 = /* @__PURE__ */ __name((val) => typeof val === "string", "isString$4"); -const isObject$2 = /* @__PURE__ */ __name((val) => val !== null && typeof val === "object", "isObject$2"); +const isObject$9 = /* @__PURE__ */ __name((val) => val !== null && typeof val === "object", "isObject$9"); function join$1(items2, separator = "") { return items2.reduce((str, item3, index2) => index2 === 0 ? str + item3 : str + separator + item3, ""); } @@ -59523,7 +85075,7 @@ function optimize(ast) { if (body.type === 2) { optimizeMessageNode(body); } else { - body.cases.forEach((c) => optimizeMessageNode(c)); + body.cases.forEach((c2) => optimizeMessageNode(c2)); } return ast; } @@ -59658,13 +85210,13 @@ function createCodeGenerator(ast, options4) { _context.source = ast.loc.source; } const context = /* @__PURE__ */ __name(() => _context, "context"); - function push(code2, node3) { + function push2(code2, node3) { _context.code += code2; } - __name(push, "push"); - function _newline(n, withBreakLine = true) { + __name(push2, "push"); + function _newline(n2, withBreakLine = true) { const _breakLineCode = withBreakLine ? breakLineCode : ""; - push(_needIndent ? _breakLineCode + ` `.repeat(n) : _breakLineCode); + push2(_needIndent ? _breakLineCode + ` `.repeat(n2) : _breakLineCode); } __name(_newline, "_newline"); function indent(withNewLine = true) { @@ -59685,7 +85237,7 @@ function createCodeGenerator(ast, options4) { const needIndent = /* @__PURE__ */ __name(() => _context.needIndent, "needIndent"); return { context, - push, + push: push2, indent, deindent, newline: newline2, @@ -59830,7 +85382,7 @@ const generate = /* @__PURE__ */ __name((ast, options4 = {}) => { generator.push(mode2 === "normal" ? `function __msg__ (ctx) {` : `(ctx) => {`); generator.indent(needIndent); if (helpers2.length > 0) { - generator.push(`const { ${join$1(helpers2.map((s) => `${s}: _${s}`), ", ")} } = ctx`); + generator.push(`const { ${join$1(helpers2.map((s2) => `${s2}: _${s2}`), ", ")} } = ctx`); generator.newline(); } generator.push(`return `); @@ -60134,9 +85686,9 @@ function isLiteral(exp) { } __name(isLiteral, "isLiteral"); function stripQuotes(str) { - const a = str.charCodeAt(0); - const b = str.charCodeAt(str.length - 1); - return a === b && (a === 34 || a === 39) ? str.slice(1, -1) : str; + const a2 = str.charCodeAt(0); + const b2 = str.charCodeAt(str.length - 1); + return a2 === b2 && (a2 === 34 || a2 === 39) ? str.slice(1, -1) : str; } __name(stripQuotes, "stripQuotes"); function getPathCharType(ch) { @@ -60180,7 +85732,7 @@ function parse$1(path) { let index2 = -1; let mode2 = 0; let subPathDepth = 0; - let c; + let c2; let key; let newChar; let type; @@ -60259,11 +85811,11 @@ function parse$1(path) { __name(maybeUnescapeQuote, "maybeUnescapeQuote"); while (mode2 !== null) { index2++; - c = path[index2]; - if (c === "\\" && maybeUnescapeQuote()) { + c2 = path[index2]; + if (c2 === "\\" && maybeUnescapeQuote()) { continue; } - type = getPathCharType(c); + type = getPathCharType(c2); typeMap = pathStateMachine[mode2]; transition = typeMap[type] || typeMap[ "l" @@ -60276,7 +85828,7 @@ function parse$1(path) { if (transition[1] !== void 0) { action = actions[transition[1]]; if (action) { - newChar = c; + newChar = c2; if (action() === false) { return; } @@ -60290,11 +85842,11 @@ function parse$1(path) { __name(parse$1, "parse$1"); const cache = /* @__PURE__ */ new Map(); function resolveWithKeyValue(obj, path) { - return isObject$3(obj) ? obj[path] : null; + return isObject$a(obj) ? obj[path] : null; } __name(resolveWithKeyValue, "resolveWithKeyValue"); function resolveValue(obj, path) { - if (!isObject$3(obj)) { + if (!isObject$a(obj)) { return null; } let hit = cache.get(path); @@ -60315,7 +85867,7 @@ function resolveValue(obj, path) { if (val === void 0) { return null; } - if (isFunction$2(last)) { + if (isFunction$6(last)) { return null; } last = val; @@ -60354,8 +85906,8 @@ __name(normalizeNamed, "normalizeNamed"); function createMessageContext(options4 = {}) { const locale2 = options4.locale; const pluralIndex = getPluralIndex(options4); - const pluralRule = isObject$3(options4.pluralRules) && isString$5(locale2) && isFunction$2(options4.pluralRules[locale2]) ? options4.pluralRules[locale2] : pluralDefault; - const orgPluralRule = isObject$3(options4.pluralRules) && isString$5(locale2) && isFunction$2(options4.pluralRules[locale2]) ? pluralDefault : void 0; + const pluralRule = isObject$a(options4.pluralRules) && isString$5(locale2) && isFunction$6(options4.pluralRules[locale2]) ? options4.pluralRules[locale2] : pluralDefault; + const orgPluralRule = isObject$a(options4.pluralRules) && isString$5(locale2) && isFunction$6(options4.pluralRules[locale2]) ? pluralDefault : void 0; const plural = /* @__PURE__ */ __name((messages2) => { return messages2[pluralRule(pluralIndex, messages2.length, orgPluralRule)]; }, "plural"); @@ -60365,20 +85917,20 @@ function createMessageContext(options4 = {}) { isNumber$3(options4.pluralIndex) && normalizeNamed(pluralIndex, _named); const named = /* @__PURE__ */ __name((key) => _named[key], "named"); function message3(key) { - const msg = isFunction$2(options4.messages) ? options4.messages(key) : isObject$3(options4.messages) ? options4.messages[key] : false; + const msg = isFunction$6(options4.messages) ? options4.messages(key) : isObject$a(options4.messages) ? options4.messages[key] : false; return !msg ? options4.parent ? options4.parent.message(key) : DEFAULT_MESSAGE : msg; } __name(message3, "message"); const _modifier = /* @__PURE__ */ __name((name2) => options4.modifiers ? options4.modifiers[name2] : DEFAULT_MODIFIER, "_modifier"); - const normalize3 = isPlainObject$1(options4.processor) && isFunction$2(options4.processor.normalize) ? options4.processor.normalize : DEFAULT_NORMALIZE; - const interpolate = isPlainObject$1(options4.processor) && isFunction$2(options4.processor.interpolate) ? options4.processor.interpolate : DEFAULT_INTERPOLATE; + const normalize3 = isPlainObject$1(options4.processor) && isFunction$6(options4.processor.normalize) ? options4.processor.normalize : DEFAULT_NORMALIZE; + const interpolate = isPlainObject$1(options4.processor) && isFunction$6(options4.processor.interpolate) ? options4.processor.interpolate : DEFAULT_INTERPOLATE; const type = isPlainObject$1(options4.processor) && isString$5(options4.processor.type) ? options4.processor.type : DEFAULT_MESSAGE_DATA_TYPE; const linked = /* @__PURE__ */ __name((key, ...args) => { const [arg1, arg2] = args; let type2 = "text"; let modifier = ""; if (args.length === 1) { - if (isObject$3(arg1)) { + if (isObject$a(arg1)) { modifier = arg1.modifier || modifier; type2 = arg1.type || type2; } else if (isString$5(arg1)) { @@ -60395,7 +85947,7 @@ function createMessageContext(options4 = {}) { const ret = message3(key)(ctx); const msg = ( // The message in vnode resolved with linked are returned as an array by processor.nomalize - type2 === "vnode" && isArray$1(ret) && modifier ? ret[0] : ret + type2 === "vnode" && isArray$6(ret) && modifier ? ret[0] : ret ); return modifier ? _modifier(modifier)(msg, type2) : msg; }, "linked"); @@ -60541,7 +86093,7 @@ function resolveLocale(locale2) { if (isString$5(locale2)) { return locale2; } else { - if (isFunction$2(locale2)) { + if (isFunction$6(locale2)) { if (locale2.resolvedOnce && _resolveLocale != null) { return _resolveLocale; } else if (locale2.constructor.name === "Function") { @@ -60562,7 +86114,7 @@ __name(resolveLocale, "resolveLocale"); function fallbackWithSimple(ctx, fallback, start2) { return [.../* @__PURE__ */ new Set([ start2, - ...isArray$1(fallback) ? fallback : isObject$3(fallback) ? Object.keys(fallback) : isString$5(fallback) ? [fallback] : [start2] + ...isArray$6(fallback) ? fallback : isObject$a(fallback) ? Object.keys(fallback) : isString$5(fallback) ? [fallback] : [start2] ])]; } __name(fallbackWithSimple, "fallbackWithSimple"); @@ -60576,12 +86128,12 @@ function fallbackWithLocaleChain(ctx, fallback, start2) { if (!chain) { chain = []; let block3 = [start2]; - while (isArray$1(block3)) { + while (isArray$6(block3)) { block3 = appendBlockToChain(chain, block3, fallback); } - const defaults2 = isArray$1(fallback) || !isPlainObject$1(fallback) ? fallback : fallback["default"] ? fallback["default"] : null; + const defaults2 = isArray$6(fallback) || !isPlainObject$1(fallback) ? fallback : fallback["default"] ? fallback["default"] : null; block3 = isString$5(defaults2) ? [defaults2] : defaults2; - if (isArray$1(block3)) { + if (isArray$6(block3)) { appendBlockToChain(chain, block3, false); } context.__localeChainCache.set(startLocale, chain); @@ -60619,7 +86171,7 @@ function appendItemToChain(chain, target, blocks) { follow = target[target.length - 1] !== "!"; const locale2 = target.replace(/!/g, ""); chain.push(locale2); - if ((isArray$1(blocks) || isPlainObject$1(blocks)) && blocks[locale2]) { + if ((isArray$6(blocks) || isPlainObject$1(blocks)) && blocks[locale2]) { follow = blocks[locale2]; } } @@ -60635,13 +86187,13 @@ const capitalize = /* @__PURE__ */ __name((str) => `${str.charAt(0).toLocaleUppe function getDefaultLinkedModifiers() { return { upper: /* @__PURE__ */ __name((val, type) => { - return type === "text" && isString$5(val) ? val.toUpperCase() : type === "vnode" && isObject$3(val) && "__v_isVNode" in val ? val.children.toUpperCase() : val; + return type === "text" && isString$5(val) ? val.toUpperCase() : type === "vnode" && isObject$a(val) && "__v_isVNode" in val ? val.children.toUpperCase() : val; }, "upper"), lower: /* @__PURE__ */ __name((val, type) => { - return type === "text" && isString$5(val) ? val.toLowerCase() : type === "vnode" && isObject$3(val) && "__v_isVNode" in val ? val.children.toLowerCase() : val; + return type === "text" && isString$5(val) ? val.toLowerCase() : type === "vnode" && isObject$a(val) && "__v_isVNode" in val ? val.children.toLowerCase() : val; }, "lower"), capitalize: /* @__PURE__ */ __name((val, type) => { - return type === "text" && isString$5(val) ? capitalize(val) : type === "vnode" && isObject$3(val) && "__v_isVNode" in val ? capitalize(val.children) : val; + return type === "text" && isString$5(val) ? capitalize(val) : type === "vnode" && isObject$a(val) && "__v_isVNode" in val ? capitalize(val.children) : val; }, "capitalize") }; } @@ -60673,36 +86225,36 @@ const setFallbackContext = /* @__PURE__ */ __name((context) => { const getFallbackContext = /* @__PURE__ */ __name(() => _fallbackContext, "getFallbackContext"); let _cid = 0; function createCoreContext(options4 = {}) { - const onWarn = isFunction$2(options4.onWarn) ? options4.onWarn : warn$1; + const onWarn = isFunction$6(options4.onWarn) ? options4.onWarn : warn$1; const version2 = isString$5(options4.version) ? options4.version : VERSION$1; - const locale2 = isString$5(options4.locale) || isFunction$2(options4.locale) ? options4.locale : DEFAULT_LOCALE; - const _locale = isFunction$2(locale2) ? DEFAULT_LOCALE : locale2; - const fallbackLocale = isArray$1(options4.fallbackLocale) || isPlainObject$1(options4.fallbackLocale) || isString$5(options4.fallbackLocale) || options4.fallbackLocale === false ? options4.fallbackLocale : _locale; + const locale2 = isString$5(options4.locale) || isFunction$6(options4.locale) ? options4.locale : DEFAULT_LOCALE; + const _locale = isFunction$6(locale2) ? DEFAULT_LOCALE : locale2; + const fallbackLocale = isArray$6(options4.fallbackLocale) || isPlainObject$1(options4.fallbackLocale) || isString$5(options4.fallbackLocale) || options4.fallbackLocale === false ? options4.fallbackLocale : _locale; const messages2 = isPlainObject$1(options4.messages) ? options4.messages : { [_locale]: {} }; const datetimeFormats = isPlainObject$1(options4.datetimeFormats) ? options4.datetimeFormats : { [_locale]: {} }; const numberFormats = isPlainObject$1(options4.numberFormats) ? options4.numberFormats : { [_locale]: {} }; const modifiers2 = assign$4({}, options4.modifiers || {}, getDefaultLinkedModifiers()); const pluralRules = options4.pluralRules || {}; - const missing = isFunction$2(options4.missing) ? options4.missing : null; + const missing = isFunction$6(options4.missing) ? options4.missing : null; const missingWarn = isBoolean$1(options4.missingWarn) || isRegExp$2(options4.missingWarn) ? options4.missingWarn : true; const fallbackWarn = isBoolean$1(options4.fallbackWarn) || isRegExp$2(options4.fallbackWarn) ? options4.fallbackWarn : true; const fallbackFormat = !!options4.fallbackFormat; const unresolving = !!options4.unresolving; - const postTranslation = isFunction$2(options4.postTranslation) ? options4.postTranslation : null; + const postTranslation = isFunction$6(options4.postTranslation) ? options4.postTranslation : null; const processor = isPlainObject$1(options4.processor) ? options4.processor : null; const warnHtmlMessage = isBoolean$1(options4.warnHtmlMessage) ? options4.warnHtmlMessage : true; const escapeParameter = !!options4.escapeParameter; - const messageCompiler = isFunction$2(options4.messageCompiler) ? options4.messageCompiler : _compiler; + const messageCompiler = isFunction$6(options4.messageCompiler) ? options4.messageCompiler : _compiler; if (false) { warnOnce(getWarnMessage$1(CoreWarnCodes.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER)); } - const messageResolver = isFunction$2(options4.messageResolver) ? options4.messageResolver : _resolver || resolveWithKeyValue; - const localeFallbacker = isFunction$2(options4.localeFallbacker) ? options4.localeFallbacker : _fallbacker || fallbackWithSimple; - const fallbackContext = isObject$3(options4.fallbackContext) ? options4.fallbackContext : void 0; + const messageResolver = isFunction$6(options4.messageResolver) ? options4.messageResolver : _resolver || resolveWithKeyValue; + const localeFallbacker = isFunction$6(options4.localeFallbacker) ? options4.localeFallbacker : _fallbacker || fallbackWithSimple; + const fallbackContext = isObject$a(options4.fallbackContext) ? options4.fallbackContext : void 0; const internalOptions = options4; - const __datetimeFormatters = isObject$3(internalOptions.__datetimeFormatters) ? internalOptions.__datetimeFormatters : /* @__PURE__ */ new Map(); - const __numberFormatters = isObject$3(internalOptions.__numberFormatters) ? internalOptions.__numberFormatters : /* @__PURE__ */ new Map(); - const __meta = isObject$3(internalOptions.__meta) ? internalOptions.__meta : {}; + const __datetimeFormatters = isObject$a(internalOptions.__datetimeFormatters) ? internalOptions.__datetimeFormatters : /* @__PURE__ */ new Map(); + const __numberFormatters = isObject$a(internalOptions.__numberFormatters) ? internalOptions.__numberFormatters : /* @__PURE__ */ new Map(); + const __meta = isObject$a(internalOptions.__meta) ? internalOptions.__meta : {}; _cid++; const context = { version: version2, @@ -60810,9 +86362,9 @@ function formatParts(ctx, ast) { if ((body.t || body.type) === 1) { const plural = body; const cases = plural.c || plural.cases; - return ctx.plural(cases.reduce((messages2, c) => [ + return ctx.plural(cases.reduce((messages2, c2) => [ ...messages2, - formatMessageParts(ctx, c) + formatMessageParts(ctx, c2) ], [])); } else { return formatMessageParts(ctx, body); @@ -60824,7 +86376,7 @@ function formatMessageParts(ctx, node3) { if (_static) { return ctx.type === "text" ? _static : ctx.normalize([_static]); } else { - const messages2 = (node3.i || node3.items).reduce((acm, c) => [...acm, formatMessagePart(ctx, c)], []); + const messages2 = (node3.i || node3.items).reduce((acm, c2) => [...acm, formatMessagePart(ctx, c2)], []); return ctx.normalize(messages2); } } @@ -60887,7 +86439,7 @@ function clearCompileCache() { compileCache = /* @__PURE__ */ Object.create(null); } __name(clearCompileCache, "clearCompileCache"); -const isMessageAST = /* @__PURE__ */ __name((val) => isObject$3(val) && (val.t === 0 || val.type === 0) && ("b" in val || "body" in val), "isMessageAST"); +const isMessageAST = /* @__PURE__ */ __name((val) => isObject$a(val) && (val.t === 0 || val.type === 0) && ("b" in val || "body" in val), "isMessageAST"); function baseCompile(message3, options4 = {}) { let detectError = false; const onError = options4.onError || defaultOnError; @@ -60956,7 +86508,7 @@ function compile$1(message3, context) { } __name(compile$1, "compile$1"); const NOOP_MESSAGE_FUNCTION = /* @__PURE__ */ __name(() => "", "NOOP_MESSAGE_FUNCTION"); -const isMessageFunction = /* @__PURE__ */ __name((val) => isFunction$2(val), "isMessageFunction"); +const isMessageFunction = /* @__PURE__ */ __name((val) => isFunction$6(val), "isMessageFunction"); function translate(context, ...args) { const { fallbackFormat, postTranslation, unresolving, messageCompiler, fallbackLocale, messages: messages2 } = context; const [key, options4] = parseTranslateArgs(...args); @@ -61015,9 +86567,9 @@ function translate(context, ...args) { } __name(translate, "translate"); function escapeParams(options4) { - if (isArray$1(options4.list)) { + if (isArray$6(options4.list)) { options4.list = options4.list.map((item3) => isString$5(item3) ? escapeHtml$1(item3) : item3); - } else if (isObject$3(options4.named)) { + } else if (isObject$a(options4.named)) { Object.keys(options4.named).forEach((key) => { if (isString$5(options4.named[key])) { options4.named[key] = escapeHtml$1(options4.named[key]); @@ -61195,7 +86747,7 @@ function parseTranslateArgs(...args) { options4.default = arg2; } else if (isPlainObject$1(arg2) && !isEmptyObject$1(arg2)) { options4.named = arg2; - } else if (isArray$1(arg2)) { + } else if (isArray$6(arg2)) { options4.list = arg2; } if (isNumber$3(arg3)) { @@ -61722,7 +87274,7 @@ const InejctWithOptionSymbol = /* @__PURE__ */ makeSymbol("__injectWithOption"); const DisposeSymbol = /* @__PURE__ */ makeSymbol("__dispose"); const __VUE_I18N_BRIDGE__ = "__VUE_I18N_BRIDGE__"; function handleFlatJson(obj) { - if (!isObject$3(obj)) { + if (!isObject$a(obj)) { return obj; } for (const key in obj) { @@ -61730,7 +87282,7 @@ function handleFlatJson(obj) { continue; } if (!key.includes(".")) { - if (isObject$3(obj[key])) { + if (isObject$a(obj[key])) { handleFlatJson(obj[key]); } } else { @@ -61742,7 +87294,7 @@ function handleFlatJson(obj) { if (!(subKeys[i2] in currentObj)) { currentObj[subKeys[i2]] = {}; } - if (!isObject$3(currentObj[subKeys[i2]])) { + if (!isObject$a(currentObj[subKeys[i2]])) { hasStringValue = true; break; } @@ -61752,7 +87304,7 @@ function handleFlatJson(obj) { currentObj[subKeys[lastIndex2]] = obj[key]; delete obj[key]; } - if (isObject$3(currentObj[subKeys[lastIndex2]])) { + if (isObject$a(currentObj[subKeys[lastIndex2]])) { handleFlatJson(currentObj[subKeys[lastIndex2]]); } } @@ -61762,8 +87314,8 @@ function handleFlatJson(obj) { __name(handleFlatJson, "handleFlatJson"); function getLocaleMessages(locale2, options4) { const { messages: messages2, __i18n, messageResolver, flatJson } = options4; - const ret = isPlainObject$1(messages2) ? messages2 : isArray$1(__i18n) ? {} : { [locale2]: {} }; - if (isArray$1(__i18n)) { + const ret = isPlainObject$1(messages2) ? messages2 : isArray$6(__i18n) ? {} : { [locale2]: {} }; + if (isArray$6(__i18n)) { __i18n.forEach((custom2) => { if ("locale" in custom2 && "resource" in custom2) { const { locale: locale22, resource } = custom2; @@ -61793,7 +87345,7 @@ function getComponentOptions(instance) { } __name(getComponentOptions, "getComponentOptions"); function adjustI18nResources(gl, options4, componentOptions) { - let messages2 = isObject$3(options4.messages) ? options4.messages : {}; + let messages2 = isObject$a(options4.messages) ? options4.messages : {}; if ("__i18nGlobal" in componentOptions) { messages2 = getLocaleMessages(gl.locale.value, { messages: messages2, @@ -61807,7 +87359,7 @@ function adjustI18nResources(gl, options4, componentOptions) { }); } { - if (isObject$3(options4.datetimeFormats)) { + if (isObject$a(options4.datetimeFormats)) { const locales2 = Object.keys(options4.datetimeFormats); if (locales2.length) { locales2.forEach((locale2) => { @@ -61815,7 +87367,7 @@ function adjustI18nResources(gl, options4, componentOptions) { }); } } - if (isObject$3(options4.numberFormats)) { + if (isObject$a(options4.numberFormats)) { const locales2 = Object.keys(options4.numberFormats); if (locales2.length) { locales2.forEach((locale2) => { @@ -61863,7 +87415,7 @@ function createComposer(options4 = {}, VueI18nLegacy) { ); const _fallbackLocale = _ref( // prettier-ignore - __root && _inheritLocale ? __root.fallbackLocale.value : isString$5(options4.fallbackLocale) || isArray$1(options4.fallbackLocale) || isPlainObject$1(options4.fallbackLocale) || options4.fallbackLocale === false ? options4.fallbackLocale : _locale.value + __root && _inheritLocale ? __root.fallbackLocale.value : isString$5(options4.fallbackLocale) || isArray$6(options4.fallbackLocale) || isPlainObject$1(options4.fallbackLocale) || options4.fallbackLocale === false ? options4.fallbackLocale : _locale.value ); const _messages = _ref(getLocaleMessages(_locale.value, options4)); const _datetimeFormats = _ref(isPlainObject$1(options4.datetimeFormats) ? options4.datetimeFormats : { [_locale.value]: {} }); @@ -61872,9 +87424,9 @@ function createComposer(options4 = {}, VueI18nLegacy) { let _fallbackWarn = __root ? __root.fallbackWarn : isBoolean$1(options4.fallbackWarn) || isRegExp$2(options4.fallbackWarn) ? options4.fallbackWarn : true; let _fallbackRoot = __root ? __root.fallbackRoot : isBoolean$1(options4.fallbackRoot) ? options4.fallbackRoot : true; let _fallbackFormat = !!options4.fallbackFormat; - let _missing = isFunction$2(options4.missing) ? options4.missing : null; - let _runtimeMissing = isFunction$2(options4.missing) ? defineCoreMissingHandler(options4.missing) : null; - let _postTranslation = isFunction$2(options4.postTranslation) ? options4.postTranslation : null; + let _missing = isFunction$6(options4.missing) ? options4.missing : null; + let _runtimeMissing = isFunction$6(options4.missing) ? defineCoreMissingHandler(options4.missing) : null; + let _postTranslation = isFunction$6(options4.postTranslation) ? options4.postTranslation : null; let _warnHtmlMessage = __root ? __root.warnHtmlMessage : isBoolean$1(options4.warnHtmlMessage) ? options4.warnHtmlMessage : true; let _escapeParameter = !!options4.escapeParameter; const _modifiers = __root ? __root.modifiers : isPlainObject$1(options4.modifiers) ? options4.modifiers : {}; @@ -61945,7 +87497,7 @@ function createComposer(options4 = {}, VueI18nLegacy) { const datetimeFormats = /* @__PURE__ */ computed(() => _datetimeFormats.value); const numberFormats = /* @__PURE__ */ computed(() => _numberFormats.value); function getPostTranslationHandler() { - return isFunction$2(_postTranslation) ? _postTranslation : null; + return isFunction$6(_postTranslation) ? _postTranslation : null; } __name(getPostTranslationHandler, "getPostTranslationHandler"); function setPostTranslationHandler(handler6) { @@ -62018,25 +87570,25 @@ function createComposer(options4 = {}, VueI18nLegacy) { } }, "wrapWithDeps"); function t2(...args) { - return wrapWithDeps((context) => Reflect.apply(translate, null, [context, ...args]), () => parseTranslateArgs(...args), "translate", (root24) => Reflect.apply(root24.t, root24, [...args]), (key) => key, (val) => isString$5(val)); + return wrapWithDeps((context) => Reflect.apply(translate, null, [context, ...args]), () => parseTranslateArgs(...args), "translate", (root27) => Reflect.apply(root27.t, root27, [...args]), (key) => key, (val) => isString$5(val)); } __name(t2, "t"); function rt(...args) { const [arg1, arg2, arg3] = args; - if (arg3 && !isObject$3(arg3)) { + if (arg3 && !isObject$a(arg3)) { throw createI18nError(I18nErrorCodes.INVALID_ARGUMENT); } return t2(...[arg1, arg2, assign$4({ resolvedMessage: true }, arg3 || {})]); } __name(rt, "rt"); - function d(...args) { - return wrapWithDeps((context) => Reflect.apply(datetime, null, [context, ...args]), () => parseDateTimeArgs(...args), "datetime format", (root24) => Reflect.apply(root24.d, root24, [...args]), () => MISSING_RESOLVE_VALUE, (val) => isString$5(val)); + function d2(...args) { + return wrapWithDeps((context) => Reflect.apply(datetime, null, [context, ...args]), () => parseDateTimeArgs(...args), "datetime format", (root27) => Reflect.apply(root27.d, root27, [...args]), () => MISSING_RESOLVE_VALUE, (val) => isString$5(val)); } - __name(d, "d"); - function n(...args) { - return wrapWithDeps((context) => Reflect.apply(number, null, [context, ...args]), () => parseNumberArgs(...args), "number format", (root24) => Reflect.apply(root24.n, root24, [...args]), () => MISSING_RESOLVE_VALUE, (val) => isString$5(val)); + __name(d2, "d"); + function n2(...args) { + return wrapWithDeps((context) => Reflect.apply(number, null, [context, ...args]), () => parseNumberArgs(...args), "number format", (root27) => Reflect.apply(root27.n, root27, [...args]), () => MISSING_RESOLVE_VALUE, (val) => isString$5(val)); } - __name(n, "n"); + __name(n2, "n"); function normalize3(values) { return values.map((val) => isString$5(val) || isNumber$3(val) || isBoolean$1(val) ? createTextNode(String(val)) : val); } @@ -62063,9 +87615,9 @@ function createComposer(options4 = {}, VueI18nLegacy) { () => parseTranslateArgs(...args), "translate", // eslint-disable-next-line @typescript-eslint/no-explicit-any - (root24) => root24[TranslateVNodeSymbol](...args), + (root27) => root27[TranslateVNodeSymbol](...args), (key) => [createTextNode(key)], - (val) => isArray$1(val) + (val) => isArray$6(val) ); } __name(translateVNode, "translateVNode"); @@ -62075,9 +87627,9 @@ function createComposer(options4 = {}, VueI18nLegacy) { () => parseNumberArgs(...args), "number format", // eslint-disable-next-line @typescript-eslint/no-explicit-any - (root24) => root24[NumberPartsSymbol](...args), + (root27) => root27[NumberPartsSymbol](...args), NOOP_RETURN_ARRAY, - (val) => isString$5(val) || isArray$1(val) + (val) => isString$5(val) || isArray$6(val) ); } __name(numberParts, "numberParts"); @@ -62087,9 +87639,9 @@ function createComposer(options4 = {}, VueI18nLegacy) { () => parseDateTimeArgs(...args), "datetime format", // eslint-disable-next-line @typescript-eslint/no-explicit-any - (root24) => root24[DatetimePartsSymbol](...args), + (root27) => root27[DatetimePartsSymbol](...args), NOOP_RETURN_ARRAY, - (val) => isString$5(val) || isArray$1(val) + (val) => isString$5(val) || isArray$6(val) ); } __name(datetimeParts, "datetimeParts"); @@ -62107,8 +87659,8 @@ function createComposer(options4 = {}, VueI18nLegacy) { const message3 = getLocaleMessage(targetLocale); const resolved = _context.messageResolver(message3, key); return !translateExistCompatible ? isMessageAST(resolved) || isMessageFunction(resolved) || isString$5(resolved) : resolved != null; - }, () => [key], "translate exists", (root24) => { - return Reflect.apply(root24.te, root24, [key, locale22]); + }, () => [key], "translate exists", (root27) => { + return Reflect.apply(root27.te, root27, [key, locale22]); }, NOOP_RETURN_FALSE, (val) => isBoolean$1(val)); } __name(te2, "te"); @@ -62298,8 +87850,8 @@ function createComposer(options4 = {}, VueI18nLegacy) { composer.rt = rt; composer.te = te2; composer.tm = tm; - composer.d = d; - composer.n = n; + composer.d = d2; + composer.n = n2; composer.getDateTimeFormat = getDateTimeFormat; composer.setDateTimeFormat = setDateTimeFormat; composer.mergeDateTimeFormat = mergeDateTimeFormat; @@ -62324,15 +87876,15 @@ function createComposer(options4 = {}, VueI18nLegacy) { __name(createComposer, "createComposer"); function convertComposerOptions(options4) { const locale2 = isString$5(options4.locale) ? options4.locale : DEFAULT_LOCALE; - const fallbackLocale = isString$5(options4.fallbackLocale) || isArray$1(options4.fallbackLocale) || isPlainObject$1(options4.fallbackLocale) || options4.fallbackLocale === false ? options4.fallbackLocale : locale2; - const missing = isFunction$2(options4.missing) ? options4.missing : void 0; + const fallbackLocale = isString$5(options4.fallbackLocale) || isArray$6(options4.fallbackLocale) || isPlainObject$1(options4.fallbackLocale) || options4.fallbackLocale === false ? options4.fallbackLocale : locale2; + const missing = isFunction$6(options4.missing) ? options4.missing : void 0; const missingWarn = isBoolean$1(options4.silentTranslationWarn) || isRegExp$2(options4.silentTranslationWarn) ? !options4.silentTranslationWarn : true; const fallbackWarn = isBoolean$1(options4.silentFallbackWarn) || isRegExp$2(options4.silentFallbackWarn) ? !options4.silentFallbackWarn : true; const fallbackRoot = isBoolean$1(options4.fallbackRoot) ? options4.fallbackRoot : true; const fallbackFormat = !!options4.formatFallbackMessages; const modifiers2 = isPlainObject$1(options4.modifiers) ? options4.modifiers : {}; const pluralizationRules = options4.pluralizationRules; - const postTranslation = isFunction$2(options4.postTranslation) ? options4.postTranslation : void 0; + const postTranslation = isFunction$6(options4.postTranslation) ? options4.postTranslation : void 0; const warnHtmlMessage = isString$5(options4.warnHtmlInMessage) ? options4.warnHtmlInMessage !== "off" : true; const escapeParameter = !!options4.escapeParameterHtml; const inheritLocale = isBoolean$1(options4.sync) ? options4.sync : true; @@ -62514,12 +88066,12 @@ function createVueI18n(options4 = {}, VueI18nLegacy) { const key = arg1; if (isString$5(arg2)) { options22.locale = arg2; - } else if (isArray$1(arg2)) { + } else if (isArray$6(arg2)) { list2 = arg2; } else if (isPlainObject$1(arg2)) { named = arg2; } - if (isArray$1(arg3)) { + if (isArray$6(arg3)) { list2 = arg3; } else if (isPlainObject$1(arg3)) { named = arg3; @@ -62547,14 +88099,14 @@ function createVueI18n(options4 = {}, VueI18nLegacy) { options22.locale = arg2; } else if (isNumber$3(arg2)) { options22.plural = arg2; - } else if (isArray$1(arg2)) { + } else if (isArray$6(arg2)) { list2 = arg2; } else if (isPlainObject$1(arg2)) { named = arg2; } if (isString$5(arg3)) { options22.locale = arg3; - } else if (isArray$1(arg3)) { + } else if (isArray$6(arg3)) { list2 = arg3; } else if (isPlainObject$1(arg3)) { named = arg3; @@ -62715,7 +88267,7 @@ const TranslationImpl = /* @__PURE__ */ defineComponent({ const arg = getInterpolateArg(context, keys2); const children = i18n2[TranslateVNodeSymbol](props.keypath, arg, options4); const assignedAttrs = assign$4({}, attrs4); - const tag = isString$5(props.tag) || isObject$3(props.tag) ? props.tag : getFragmentableTag(); + const tag = isString$5(props.tag) || isObject$a(props.tag) ? props.tag : getFragmentableTag(); return h(tag, assignedAttrs, children); }; } @@ -62723,7 +88275,7 @@ const TranslationImpl = /* @__PURE__ */ defineComponent({ const Translation = TranslationImpl; const I18nT = Translation; function isVNode(target) { - return isArray$1(target) && !isString$5(target[0]); + return isArray$6(target) && !isString$5(target[0]); } __name(isVNode, "isVNode"); function renderFormatter(props, context, slotKeys, partFormatter) { @@ -62736,7 +88288,7 @@ function renderFormatter(props, context, slotKeys, partFormatter) { } if (isString$5(props.format)) { options4.key = props.format; - } else if (isObject$3(props.format)) { + } else if (isObject$a(props.format)) { if (isString$5(props.format.key)) { options4.key = props.format.key; } @@ -62746,7 +88298,7 @@ function renderFormatter(props, context, slotKeys, partFormatter) { } const parts2 = partFormatter(...[props.value, options4, overrides]); let children = [options4.key]; - if (isArray$1(parts2)) { + if (isArray$6(parts2)) { children = parts2.map((part, index2) => { const slot = slots[part.type]; const node3 = slot ? slot({ [part.type]: part.value, index: index2, parts: parts2 }) : [part.value]; @@ -62759,7 +88311,7 @@ function renderFormatter(props, context, slotKeys, partFormatter) { children = [parts2]; } const assignedAttrs = assign$4({}, attrs4); - const tag = isString$5(props.tag) || isObject$3(props.tag) ? props.tag : getFragmentableTag(); + const tag = isString$5(props.tag) || isObject$a(props.tag) ? props.tag : getFragmentableTag(); return h(tag, assignedAttrs, children); }; } @@ -63017,8 +88569,8 @@ async function enableDevTools(app2, i18n2) { inspectScope(payload, i18n2); if (payload.nodeId === "global") { if (!roots.has(payload.app)) { - const [root24] = await api2.getComponentInstances(payload.app); - roots.set(payload.app, root24); + const [root27] = await api2.getComponentInstances(payload.app); + roots.set(payload.app, root27); } api2.highlightElement(roots.get(payload.app)); } else { @@ -63122,11 +88674,11 @@ function getLocaleMessageValue(messages2) { const value4 = {}; Object.keys(messages2).forEach((key) => { const v2 = messages2[key]; - if (isFunction$2(v2) && "source" in v2) { + if (isFunction$6(v2) && "source" in v2) { value4[key] = getMessageFunctionDetails(v2); } else if (isMessageAST(v2) && v2.loc && v2.loc.source) { value4[key] = v2.loc.source; - } else if (isObject$3(v2)) { + } else if (isObject$a(v2)) { value4[key] = getLocaleMessageValue(v2); } else { value4[key] = v2; @@ -63141,12 +88693,12 @@ const ESC = { '"': """, "&": "&" }; -function escape$3(s) { - return s.replace(/[<>"&]/g, escapeChar); +function escape$3(s2) { + return s2.replace(/[<>"&]/g, escapeChar); } __name(escape$3, "escape$3"); -function escapeChar(a) { - return ESC[a] || a; +function escapeChar(a2) { + return ESC[a2] || a2; } __name(escapeChar, "escapeChar"); function getMessageFunctionDetails(func) { @@ -63303,7 +88855,7 @@ function editScope(payload, i18n2) { const [field] = payload.path; if (field === "locale" && isString$5(payload.state.value)) { composer.locale.value = payload.state.value; - } else if (field === "fallbackLocale" && (isString$5(payload.state.value) || isArray$1(payload.state.value) || isObject$3(payload.state.value))) { + } else if (field === "fallbackLocale" && (isString$5(payload.state.value) || isArray$6(payload.state.value) || isObject$a(payload.state.value))) { composer.fallbackLocale.value = payload.state.value; } else if (field === "inheritLocale" && isBoolean$1(payload.state.value)) { composer.inheritLocale = payload.state.value; @@ -63625,7 +89177,7 @@ function getGlobalComposer(i18n2) { __name(getGlobalComposer, "getGlobalComposer"); function getComposer(i18n2, target, useComponent = false) { let composer = null; - const root24 = target.root; + const root27 = target.root; let current = getParentComponentInstance(target, useComponent); while (current != null) { const i18nInternal = i18n2; @@ -63645,7 +89197,7 @@ function getComposer(i18n2, target, useComponent = false) { if (composer != null) { break; } - if (root24 === current) { + if (root27 === current) { break; } current = current.parent; @@ -63691,7 +89243,7 @@ function setupLifeCycle(i18n2, target, composer) { } } __name(setupLifeCycle, "setupLifeCycle"); -function useI18nForLegacy(instance, scope, root24, options4 = {}) { +function useI18nForLegacy(instance, scope, root27, options4 = {}) { const isLocalScope = scope === "local"; const _composer = shallowRef(null); if (isLocalScope && instance.proxy && !(instance.proxy.$options.i18n || instance.proxy.$options.__i18n)) { @@ -63700,25 +89252,25 @@ function useI18nForLegacy(instance, scope, root24, options4 = {}) { const _inheritLocale = isBoolean$1(options4.inheritLocale) ? options4.inheritLocale : !isString$5(options4.locale); const _locale = ref( // prettier-ignore - !isLocalScope || _inheritLocale ? root24.locale.value : isString$5(options4.locale) ? options4.locale : DEFAULT_LOCALE + !isLocalScope || _inheritLocale ? root27.locale.value : isString$5(options4.locale) ? options4.locale : DEFAULT_LOCALE ); const _fallbackLocale = ref( // prettier-ignore - !isLocalScope || _inheritLocale ? root24.fallbackLocale.value : isString$5(options4.fallbackLocale) || isArray$1(options4.fallbackLocale) || isPlainObject$1(options4.fallbackLocale) || options4.fallbackLocale === false ? options4.fallbackLocale : _locale.value + !isLocalScope || _inheritLocale ? root27.fallbackLocale.value : isString$5(options4.fallbackLocale) || isArray$6(options4.fallbackLocale) || isPlainObject$1(options4.fallbackLocale) || options4.fallbackLocale === false ? options4.fallbackLocale : _locale.value ); const _messages = ref(getLocaleMessages(_locale.value, options4)); const _datetimeFormats = ref(isPlainObject$1(options4.datetimeFormats) ? options4.datetimeFormats : { [_locale.value]: {} }); const _numberFormats = ref(isPlainObject$1(options4.numberFormats) ? options4.numberFormats : { [_locale.value]: {} }); - const _missingWarn = isLocalScope ? root24.missingWarn : isBoolean$1(options4.missingWarn) || isRegExp$2(options4.missingWarn) ? options4.missingWarn : true; - const _fallbackWarn = isLocalScope ? root24.fallbackWarn : isBoolean$1(options4.fallbackWarn) || isRegExp$2(options4.fallbackWarn) ? options4.fallbackWarn : true; - const _fallbackRoot = isLocalScope ? root24.fallbackRoot : isBoolean$1(options4.fallbackRoot) ? options4.fallbackRoot : true; + const _missingWarn = isLocalScope ? root27.missingWarn : isBoolean$1(options4.missingWarn) || isRegExp$2(options4.missingWarn) ? options4.missingWarn : true; + const _fallbackWarn = isLocalScope ? root27.fallbackWarn : isBoolean$1(options4.fallbackWarn) || isRegExp$2(options4.fallbackWarn) ? options4.fallbackWarn : true; + const _fallbackRoot = isLocalScope ? root27.fallbackRoot : isBoolean$1(options4.fallbackRoot) ? options4.fallbackRoot : true; const _fallbackFormat = !!options4.fallbackFormat; - const _missing = isFunction$2(options4.missing) ? options4.missing : null; - const _postTranslation = isFunction$2(options4.postTranslation) ? options4.postTranslation : null; - const _warnHtmlMessage = isLocalScope ? root24.warnHtmlMessage : isBoolean$1(options4.warnHtmlMessage) ? options4.warnHtmlMessage : true; + const _missing = isFunction$6(options4.missing) ? options4.missing : null; + const _postTranslation = isFunction$6(options4.postTranslation) ? options4.postTranslation : null; + const _warnHtmlMessage = isLocalScope ? root27.warnHtmlMessage : isBoolean$1(options4.warnHtmlMessage) ? options4.warnHtmlMessage : true; const _escapeParameter = !!options4.escapeParameter; - const _modifiers = isLocalScope ? root24.modifiers : isPlainObject$1(options4.modifiers) ? options4.modifiers : {}; - const _pluralRules = options4.pluralRules || isLocalScope && root24.pluralRules; + const _modifiers = isLocalScope ? root27.modifiers : isPlainObject$1(options4.modifiers) ? options4.modifiers : {}; + const _pluralRules = options4.pluralRules || isLocalScope && root27.pluralRules; function trackReactivityValues() { return [ _locale.value, @@ -63793,14 +89345,14 @@ function useI18nForLegacy(instance, scope, root24, options4 = {}) { return _composer.value ? Reflect.apply(_composer.value.rt, null, [...args]) : ""; } __name(rt, "rt"); - function d(...args) { + function d2(...args) { return _composer.value ? warpWithDeps(() => Reflect.apply(_composer.value.d, null, [...args])) : warpWithDeps(() => ""); } - __name(d, "d"); - function n(...args) { + __name(d2, "d"); + function n2(...args) { return _composer.value ? warpWithDeps(() => Reflect.apply(_composer.value.n, null, [...args])) : warpWithDeps(() => ""); } - __name(n, "n"); + __name(n2, "n"); function tm(key) { return _composer.value ? _composer.value.tm(key) : {}; } @@ -63943,8 +89495,8 @@ function useI18nForLegacy(instance, scope, root24, options4 = {}) { getMissingHandler, setMissingHandler, rt, - d, - n, + d: d2, + n: n2, tm, te: te2, getLocaleMessage, @@ -64176,6 +89728,9 @@ const Comfy_ToggleTheme$5 = { const Comfy_Undo$5 = { label: "Undo" }; +const Workspace_CloseWorkflow$5 = { + label: "Close Current Workflow" +}; const Workspace_NextOpenedWorkflow$5 = { label: "Next Opened Workflow" }; @@ -64273,6 +89828,7 @@ const enCommands = { Comfy_ShowSettingsDialog: Comfy_ShowSettingsDialog$5, Comfy_ToggleTheme: Comfy_ToggleTheme$5, Comfy_Undo: Comfy_Undo$5, + Workspace_CloseWorkflow: Workspace_CloseWorkflow$5, Workspace_NextOpenedWorkflow: Workspace_NextOpenedWorkflow$5, Workspace_PreviousOpenedWorkflow: Workspace_PreviousOpenedWorkflow$5, Workspace_SearchBox_Toggle: Workspace_SearchBox_Toggle$5, @@ -64364,7 +89920,21 @@ const g$5 = { disableAll: "Disable All", command: "Command", keybinding: "Keybinding", - upload: "Upload" + upload: "Upload", + "export": "Export", + workflow: "Workflow", + success: "Success", + ok: "OK" +}; +const issueReport$5 = { + submitErrorReport: "Submit Error Report (Optional)", + provideEmail: "Give us your email (Optional)", + provideAdditionalDetails: "Provide additional details (optional)", + stackTrace: "Stack Trace", + systemStats: "System Stats", + contactFollowUp: "Contact me for follow up", + notifyResolve: "Notify me when resolved", + helpFix: "Help Fix This" }; const color$5 = { "default": "Default", @@ -64435,7 +90005,7 @@ const install$5 = { appDataLocationTooltip: "ComfyUI's app data directory. Stores:\n- Logs\n- Server configs", appPathLocationTooltip: "ComfyUI's app asset directory. Stores the ComfyUI code and assets", migrateFromExistingInstallation: "Migrate from Existing Installation", - migrationSourcePathDescription: "If you have an existing ComfyUI installation, we can copy/link your existing user files and models to the new installation.", + migrationSourcePathDescription: "If you have an existing ComfyUI installation, we can copy/link your existing user files and models to the new installation. Your existing ComfyUI installation will not be affected.", selectItemsToMigrate: "Select Items to Migrate", migrationOptional: "Migration is optional. If you don't have an existing installation, you can skip this step.", desktopAppSettings: "Desktop App Settings", @@ -64465,25 +90035,38 @@ const install$5 = { }, settings: { autoUpdate: "Automatic Updates", - allowMetrics: "Crash Reports", - autoUpdateDescription: "Automatically download and install updates when they become available. You'll always be notified before updates are installed.", - allowMetricsDescription: "Help improve ComfyUI by sending anonymous crash reports. No personal information or workflow content will be collected. This can be disabled at any time in the settings menu.", + allowMetrics: "Usage Metrics", + errorUpdatingConsent: "Error Updating Consent", + errorUpdatingConsentDetail: "Failed to update metrics consent settings", + autoUpdateDescription: "Automatically download updates when they become available. You will be notified before updates are installed.", + allowMetricsDescription: "Help improve ComfyUI by sending anonymous usage metrics. No personal information or workflow content will be collected.", learnMoreAboutData: "Learn more about data collection", dataCollectionDialog: { title: "About Data Collection", whatWeCollect: "What we collect:", whatWeDoNotCollect: "What we don't collect:", - errorReports: "Error message and stack trace", - systemInfo: "Hardware, OS type, and app version", - personalInformation: "Personal information", - workflowContent: "Workflow content", - fileSystemInformation: "File system information", - workflowContents: "Workflow contents", - customNodeConfigurations: "Custom node configurations" + collect: { + errorReports: "Error message and stack trace", + systemInfo: "Hardware, OS type, and app version", + userJourneyEvents: "User journey events" + }, + doNotCollect: { + personalInformation: "Personal information", + fileSystemInformation: "File system information", + workflowContents: "Workflow contents", + customNodeConfigurations: "Custom node configurations" + }, + viewFullPolicy: "View full policy" } }, customNodes: "Custom Nodes", - customNodesDescription: "Reinstall custom nodes from existing ComfyUI installations." + customNodesDescription: "Reinstall custom nodes from existing ComfyUI installations.", + helpImprove: "Please help improve ComfyUI", + moreInfo: "For more info, please read our", + privacyPolicy: "privacy policy", + metricsEnabled: "Metrics Enabled", + metricsDisabled: "Metrics Disabled", + updateConsent: "You previously opted in to reporting crashes. We are now tracking event-based metrics to help identify bugs and improve the app. No personal identifiable information is collected." }; const serverStart$5 = { reinstall: "Reinstall", @@ -64574,7 +90157,9 @@ const tabMenu$5 = { closeTab: "Close Tab", closeTabsToLeft: "Close Tabs to Left", closeTabsToRight: "Close Tabs to Right", - closeOtherTabs: "Close Other Tabs" + closeOtherTabs: "Close Other Tabs", + addToBookmarks: "Add to Bookmarks", + removeFromBookmarks: "Remove from Bookmarks" }; const templateWorkflows$5 = { title: "Get Started with a Template", @@ -64670,6 +90255,7 @@ const menuLabels$5 = { "Show Settings Dialog": "Show Settings Dialog", "Toggle Theme (Dark/Light)": "Toggle Theme (Dark/Light)", Undo: "Undo", + "Close Current Workflow": "Close Current Workflow", "Next Opened Workflow": "Next Opened Workflow", "Previous Opened Workflow": "Previous Opened Workflow", "Toggle Search Box": "Toggle Search Box", @@ -64876,6 +90462,7 @@ const nodeCategories$5 = { combine: "combine", "cond single": "cond single", controlnet: "controlnet", + inpaint: "inpaint", scheduling: "scheduling", create: "create", mask: "mask", @@ -64895,7 +90482,6 @@ const nodeCategories$5 = { batch: "batch", video_models: "video_models", upscaling: "upscaling", - inpaint: "inpaint", instructpix2pix: "instructpix2pix", compositing: "compositing", samplers: "samplers", @@ -64950,6 +90536,7 @@ const dataTypes$5 = { }; const en = { g: g$5, + issueReport: issueReport$5, color: color$5, icon: icon$5, welcome: welcome$5, @@ -65154,13 +90741,16 @@ const CLIPAttentionMultiply$5 = { }; const CLIPLoader$5 = { display_name: "Load CLIP", - description: "[Recipes]\n\nstable_diffusion: clip-l\nstable_cascade: clip-g\nsd3: t5 / clip-g / clip-l\nstable_audio: t5\nmochi: t5", + description: "[Recipes]\n\nstable_diffusion: clip-l\nstable_cascade: clip-g\nsd3: t5 / clip-g / clip-l\nstable_audio: t5\nmochi: t5\ncosmos: old t5 xxl", inputs: { clip_name: { name: "clip_name" }, type: { name: "type" + }, + device: { + name: "device" } } }; @@ -65836,6 +91426,32 @@ const ControlNetLoader$5 = { } } }; +const CosmosImageToVideoLatent$5 = { + display_name: "CosmosImageToVideoLatent", + inputs: { + vae: { + name: "vae" + }, + width: { + name: "width" + }, + height: { + name: "height" + }, + length: { + name: "length" + }, + batch_size: { + name: "batch_size" + }, + start_image: { + name: "start_image" + }, + end_image: { + name: "end_image" + } + } +}; const CreateHookKeyframe$5 = { display_name: "Create Hook Keyframe", inputs: { @@ -66077,6 +91693,15 @@ const DevToolsNodeWithOutputList$5 = { } } }; +const DevToolsNodeWithSeedInput$5 = { + display_name: "Node With Seed Input", + description: "A node with a seed input", + inputs: { + seed: { + name: "seed" + } + } +}; const DevToolsNodeWithStringInput$5 = { display_name: "Node With String Input", description: "A node with a string input", @@ -66101,6 +91726,21 @@ const DevToolsNodeWithUnionInput$5 = { } } }; +const DevToolsObjectPatchNode$5 = { + display_name: "Object Patch Node", + description: "A node that applies an object patch", + inputs: { + model: { + name: "model" + }, + target_module: { + name: "target_module" + }, + dummy_float: { + name: "dummy_float" + } + } +}; const DevToolsSimpleSlider$5 = { display_name: "Simple Slider", inputs: { @@ -66174,6 +91814,26 @@ const DualCLIPLoader$5 = { }, type: { name: "type" + }, + device: { + name: "device" + } + } +}; +const EmptyCosmosLatentVideo$5 = { + display_name: "EmptyCosmosLatentVideo", + inputs: { + width: { + name: "width" + }, + height: { + name: "height" + }, + length: { + name: "length" + }, + batch_size: { + name: "batch_size" } } }; @@ -67270,6 +92930,9 @@ const Load3D$5 = { }, up_direction: { name: "up_direction" + }, + fov: { + name: "fov" } }, outputs: { @@ -67322,6 +92985,9 @@ const Load3DAnimation$5 = { }, animation_speed: { name: "animation_speed" + }, + fov: { + name: "fov" } }, outputs: { @@ -69226,6 +94892,9 @@ const Preview3D$5 = { }, up_direction: { name: "up_direction" + }, + fov: { + name: "fov" } } }; @@ -69683,6 +95352,17 @@ const SetClipHooks$5 = { } } }; +const SetFirstSigma$5 = { + display_name: "SetFirstSigma", + inputs: { + sigmas: { + name: "sigmas" + }, + sigma: { + name: "sigma" + } + } +}; const SetHookKeyframes$5 = { display_name: "Set Hook Keyframes", inputs: { @@ -70494,6 +96174,7 @@ const enNodes = { ControlNetApplySD3: ControlNetApplySD3$5, ControlNetInpaintingAliMamaApply: ControlNetInpaintingAliMamaApply$5, ControlNetLoader: ControlNetLoader$5, + CosmosImageToVideoLatent: CosmosImageToVideoLatent$5, CreateHookKeyframe: CreateHookKeyframe$5, CreateHookKeyframesFromFloats: CreateHookKeyframesFromFloats$5, CreateHookKeyframesInterpolated: CreateHookKeyframesInterpolated$5, @@ -70511,8 +96192,10 @@ const enNodes = { DevToolsNodeWithOnlyOptionalInput: DevToolsNodeWithOnlyOptionalInput$5, DevToolsNodeWithOptionalInput: DevToolsNodeWithOptionalInput$5, DevToolsNodeWithOutputList: DevToolsNodeWithOutputList$5, + DevToolsNodeWithSeedInput: DevToolsNodeWithSeedInput$5, DevToolsNodeWithStringInput: DevToolsNodeWithStringInput$5, DevToolsNodeWithUnionInput: DevToolsNodeWithUnionInput$5, + DevToolsObjectPatchNode: DevToolsObjectPatchNode$5, DevToolsSimpleSlider: DevToolsSimpleSlider$5, DiffControlNetLoader: DiffControlNetLoader$5, DifferentialDiffusion: DifferentialDiffusion$5, @@ -70520,6 +96203,7 @@ const enNodes = { DisableNoise: DisableNoise$5, DualCFGGuider: DualCFGGuider$5, DualCLIPLoader: DualCLIPLoader$5, + EmptyCosmosLatentVideo: EmptyCosmosLatentVideo$5, EmptyHunyuanLatentVideo: EmptyHunyuanLatentVideo$5, EmptyImage: EmptyImage$5, EmptyLatentAudio: EmptyLatentAudio$5, @@ -70666,6 +96350,7 @@ const enNodes = { SDTurboScheduler: SDTurboScheduler$5, SelfAttentionGuidance: SelfAttentionGuidance$5, SetClipHooks: SetClipHooks$5, + SetFirstSigma: SetFirstSigma$5, SetHookKeyframes: SetHookKeyframes$5, SetLatentNoiseMask: SetLatentNoiseMask$5, SetUnionControlNetType: SetUnionControlNetType$5, @@ -70765,9 +96450,6 @@ const Comfy_Group_DoubleClickTitleToEdit$5 = { const Comfy_GroupSelectedNodes_Padding$5 = { name: "Group selected nodes padding" }; -const Comfy_InvertMenuScrolling$5 = { - name: "Invert Context Menu Scrolling" -}; const Comfy_LinkRelease_Action$5 = { name: "Action on link release (No modifier)", options: { @@ -71001,7 +96683,8 @@ const Comfy_Workflow_WorkflowTabsPosition$5 = { name: "Opened workflows position", options: { Sidebar: "Sidebar", - Topbar: "Topbar" + Topbar: "Topbar", + "Topbar (2nd-row)": "Topbar (2nd-row)" } }; const LiteGraph_Canvas_MaximumFps$5 = { @@ -71016,7 +96699,15 @@ const enSettings = { name: "Automatically check for updates" }, "Comfy-Desktop_SendStatistics": { - name: "Send anonymous crash reports" + name: "Send anonymous usage metrics" + }, + "Comfy-Desktop_WindowStyle": { + name: "Window Style", + tooltip: "Choose custom option to hide the system title bar", + options: { + "default": "default", + custom: "custom" + } }, Comfy_ConfirmClear: Comfy_ConfirmClear$5, Comfy_DevMode: Comfy_DevMode$5, @@ -71034,7 +96725,6 @@ const enSettings = { Comfy_Graph_ZoomSpeed: Comfy_Graph_ZoomSpeed$5, Comfy_Group_DoubleClickTitleToEdit: Comfy_Group_DoubleClickTitleToEdit$5, Comfy_GroupSelectedNodes_Padding: Comfy_GroupSelectedNodes_Padding$5, - Comfy_InvertMenuScrolling: Comfy_InvertMenuScrolling$5, Comfy_LinkRelease_Action: Comfy_LinkRelease_Action$5, Comfy_LinkRelease_ActionShift: Comfy_LinkRelease_ActionShift$5, Comfy_LinkRenderMode: Comfy_LinkRenderMode$5, @@ -71209,6 +96899,9 @@ const Comfy_ToggleTheme$4 = { const Comfy_Undo$4 = { label: "Annuler" }; +const Workspace_CloseWorkflow$4 = { + label: "Fermer le flux de travail actuel" +}; const Workspace_NextOpenedWorkflow$4 = { label: "Flux de travail ouvert suivant" }; @@ -71306,6 +96999,7 @@ const frCommands = { Comfy_ShowSettingsDialog: Comfy_ShowSettingsDialog$4, Comfy_ToggleTheme: Comfy_ToggleTheme$4, Comfy_Undo: Comfy_Undo$4, + Workspace_CloseWorkflow: Workspace_CloseWorkflow$4, Workspace_NextOpenedWorkflow: Workspace_NextOpenedWorkflow$4, Workspace_PreviousOpenedWorkflow: Workspace_PreviousOpenedWorkflow$4, Workspace_SearchBox_Toggle: Workspace_SearchBox_Toggle$4, @@ -71414,6 +97108,7 @@ const g$4 = { enableAll: "Activer tout", error: "Erreur", experimental: "BETA", + "export": "Exportation", extensionName: "Nom de l'extension", findIssues: "Trouver des problèmes", firstTimeUIMessage: `C'est la première fois que vous utilisez la nouvelle interface utilisateur. Choisissez "Menu > Utiliser le nouveau menu > Désactivé" pour restaurer l'ancienne interface utilisateur.`, @@ -71435,6 +97130,7 @@ const g$4 = { noTasksFound: "Aucune tâche trouvée", noTasksFoundMessage: "Il n'y a pas de tâches dans la file d'attente.", noWorkflowsFound: "Aucun flux de travail trouvé.", + ok: "OK", openNewIssue: "Ouvrir un nouveau problème", overwrite: "Écraser", reconnected: "Reconnecté", @@ -71457,10 +97153,12 @@ const g$4 = { searchWorkflows: "Rechercher des flux de travail", settings: "Paramètres", showReport: "Afficher le rapport", + success: "Succès", systemInfo: "Informations système", terminal: "Terminal", upload: "Téléverser", - videoFailedToLoad: "Échec du chargement de la vidéo" + videoFailedToLoad: "Échec du chargement de la vidéo", + workflow: "Flux de travail" }; const graphCanvasMenu$4 = { fitView: "Adapter la vue", @@ -71513,6 +97211,7 @@ const install$4 = { selectGpu: "Sélectionnez le GPU", selectGpuDescription: "Sélectionnez le type de GPU que vous avez" }, + helpImprove: "Veuillez aider à améliorer ComfyUI", installLocation: "Emplacement d'installation", installLocationDescription: "Sélectionnez le répertoire pour les données utilisateur de ComfyUI. Un environnement python sera installé à l'emplacement sélectionné. Veuillez vous assurer que le disque sélectionné a suffisamment d'espace (~15GB) restant.", installLocationTooltip: "Répertoire des données utilisateur de ComfyUI. Stocke :\n- Environnement Python\n- Modèles\n- Nœuds personnalisés\n", @@ -71524,35 +97223,57 @@ const install$4 = { title: "Configuration manuelle", virtualEnvironmentPath: "Chemin de l'environnement virtuel" }, + metricsDisabled: "Métriques désactivées", + metricsEnabled: "Métriques activées", migrateFromExistingInstallation: "Migrer à partir d'une installation existante", migration: "Migration", migrationOptional: "La migration est facultative. Si vous n'avez pas d'installation existante, vous pouvez sauter cette étape.", - migrationSourcePathDescription: "Si vous avez une installation existante de ComfyUI, nous pouvons copier/lier vos fichiers utilisateur et modèles existants à la nouvelle installation.", + migrationSourcePathDescription: "Si vous avez une installation existante de ComfyUI, nous pouvons copier/lier vos fichiers utilisateur et modèles existants à la nouvelle installation. Votre installation existante de ComfyUI ne sera pas affectée.", + moreInfo: "Pour plus d'informations, veuillez lire notre", parentMissing: "Le chemin n'existe pas - créez d'abord le répertoire contenant", pathExists: "Le répertoire existe déjà - veuillez vous assurer que vous avez sauvegardé toutes les données", pathValidationFailed: "Échec de la validation du chemin", + privacyPolicy: "politique de confidentialité", selectItemsToMigrate: "Sélectionnez les éléments à migrer", settings: { - allowMetrics: "Rapports de plantage", - allowMetricsDescription: "Aidez à améliorer ComfyUI en envoyant des rapports de plantage anonymes. Aucune information personnelle ou contenu de flux de travail ne sera collecté. Cela peut être désactivé à tout moment dans le menu des paramètres.", + allowMetrics: "Métriques d'utilisation", + allowMetricsDescription: "Aidez à améliorer ComfyUI en envoyant des métriques d'utilisation anonymes. Aucune information personnelle ou contenu de flux de travail ne sera collecté.", autoUpdate: "Mises à jour automatiques", autoUpdateDescription: "Téléchargez et installez automatiquement les mises à jour lorsqu'elles deviennent disponibles. Vous serez toujours informé avant l'installation des mises à jour.", dataCollectionDialog: { - customNodeConfigurations: "Configurations de nœuds personnalisés", - errorReports: "Message d'erreur et trace de la pile", - fileSystemInformation: "Informations sur le système de fichiers", - personalInformation: "Informations personnelles", - systemInfo: "Matériel, type d'OS et version de l'application", + collect: { + errorReports: "Message d'erreur et trace de la pile", + systemInfo: "Matériel, type de système d'exploitation et version de l'application", + userJourneyEvents: "Événements du parcours utilisateur" + }, + doNotCollect: { + customNodeConfigurations: "Configurations de nœud personnalisées", + fileSystemInformation: "Informations sur le système de fichiers", + personalInformation: "Informations personnelles", + workflowContents: "Contenus du flux de travail" + }, title: "À propos de la collecte de données", + viewFullPolicy: "Voir la politique complète", whatWeCollect: "Ce que nous collectons :", - whatWeDoNotCollect: "Ce que nous ne collectons pas :", - workflowContent: "Contenu du flux de travail", - workflowContents: "Contenus du flux de travail" + whatWeDoNotCollect: "Ce que nous ne collectons pas :" }, + errorUpdatingConsent: "Erreur de mise à jour du consentement", + errorUpdatingConsentDetail: "Échec de la mise à jour des paramètres de consentement aux métriques", learnMoreAboutData: "En savoir plus sur la collecte de données" }, systemLocations: "Emplacements système", - unhandledError: "Erreur inconnue" + unhandledError: "Erreur inconnue", + updateConsent: "Vous avez précédemment accepté de signaler les plantages. Nous suivons maintenant des métriques basées sur les événements pour aider à identifier les bugs et améliorer l'application. Aucune information personnelle identifiable n'est collectée." +}; +const issueReport$4 = { + contactFollowUp: "Contactez-moi pour un suivi", + helpFix: "Aidez à résoudre cela", + notifyResolve: "Prévenez-moi lorsque résolu", + provideAdditionalDetails: "Fournir des détails supplémentaires (facultatif)", + provideEmail: "Donnez-nous votre email (Facultatif)", + stackTrace: "Trace de la pile", + submitErrorReport: "Soumettre un rapport d'erreur (Facultatif)", + systemStats: "Statistiques du système" }; const menu$4 = { autoQueue: "File d'attente automatique", @@ -71586,6 +97307,7 @@ const menuLabels$4 = { "Clear Pending Tasks": "Effacer les tâches en attente", "Clear Workflow": "Effacer le flux de travail", Clipspace: "Espace de clip", + "Close Current Workflow": "Fermer le flux de travail actuel", "Collapse/Expand Selected Nodes": "Réduire/Étendre les nœuds sélectionnés", "Comfy-Org Discord": "Discord de Comfy-Org", "ComfyUI Docs": "Docs de ComfyUI", @@ -71950,11 +97672,13 @@ const sideToolbar$4 = { workflows: "Flux de travail" }; const tabMenu$4 = { + addToBookmarks: "Ajouter aux Favoris", closeOtherTabs: "Fermer les autres onglets", closeTab: "Fermer l'onglet", closeTabsToLeft: "Fermer les onglets à gauche", closeTabsToRight: "Fermer les onglets à droite", - duplicateTab: "Dupliquer l'onglet" + duplicateTab: "Dupliquer l'onglet", + removeFromBookmarks: "Retirer des Favoris" }; const templateWorkflows$4 = { template: { @@ -71992,6 +97716,7 @@ const fr = { groupNode: groupNode$4, icon: icon$4, install: install$4, + issueReport: issueReport$4, menu: menu$4, menuLabels: menuLabels$4, nodeCategories: nodeCategories$4, @@ -72123,12 +97848,15 @@ const CLIPAttentionMultiply$4 = { } }; const CLIPLoader$4 = { - description: "[Recettes]\n\nstable_diffusion: clip-l\nstable_cascade: clip-g\nsd3: t5 / clip-g / clip-l\nstable_audio: t5\nmochi: t5", + description: "[Recettes]\n\nstable_diffusion: clip-l\nstable_cascade: clip-g\nsd3: t5 / clip-g / clip-l\nstable_audio: t5\nmochi: t5\ncosmos: old t5 xxl", display_name: "Charger CLIP", inputs: { clip_name: { name: "clip_name" }, + device: { + name: "appareil" + }, type: { name: "type" } @@ -72869,6 +98597,32 @@ const ControlNetLoader$4 = { } } }; +const CosmosImageToVideoLatent$4 = { + display_name: "CosmosImageVersVidéoLatent", + inputs: { + batch_size: { + name: "taille_du_lot" + }, + end_image: { + name: "image_de_fin" + }, + height: { + name: "hauteur" + }, + length: { + name: "longueur" + }, + start_image: { + name: "image_de_départ" + }, + vae: { + name: "vae" + }, + width: { + name: "largeur" + } + } +}; const CreateHookKeyframe$4 = { display_name: "Créer une image clé de crochet", inputs: { @@ -73110,6 +98864,15 @@ const DevToolsNodeWithOutputList$4 = { } } }; +const DevToolsNodeWithSeedInput$4 = { + description: "Un nœud avec une entrée de graine", + display_name: "Nœud Avec Entrée de Graine", + inputs: { + seed: { + name: "graine" + } + } +}; const DevToolsNodeWithStringInput$4 = { description: "Un nœud avec une entrée de chaîne", display_name: "Nœud avec entrée de chaîne", @@ -73134,6 +98897,21 @@ const DevToolsNodeWithUnionInput$4 = { } } }; +const DevToolsObjectPatchNode$4 = { + description: "Un nœud qui applique un patch d'objet", + display_name: "Nœud de Patch d'Objet", + inputs: { + dummy_float: { + name: "flottant_factice" + }, + model: { + name: "modèle" + }, + target_module: { + name: "module_cible" + } + } +}; const DevToolsSimpleSlider$4 = { display_name: "Curseur simple", inputs: { @@ -73205,11 +98983,31 @@ const DualCLIPLoader$4 = { clip_name2: { name: "nom_clip2" }, + device: { + name: "appareil" + }, type: { name: "type" } } }; +const EmptyCosmosLatentVideo$4 = { + display_name: "VidéoLatenteCosmosVide", + inputs: { + batch_size: { + name: "taille_du_lot" + }, + height: { + name: "hauteur" + }, + length: { + name: "longueur" + }, + width: { + name: "largeur" + } + } +}; const EmptyHunyuanLatentVideo$4 = { display_name: "EmptyHunyuanLatentVideo", inputs: { @@ -74368,6 +100166,9 @@ const Load3D$4 = { camera_type: { name: "type_de_caméra" }, + fov: { + name: "fov" + }, height: { name: "hauteur" }, @@ -74420,6 +100221,9 @@ const Load3DAnimation$4 = { camera_type: { name: "type_de_caméra" }, + fov: { + name: "fov" + }, height: { name: "hauteur" }, @@ -76242,6 +102046,9 @@ const Preview3D$4 = { camera_type: { name: "type_de_camera" }, + fov: { + name: "fov" + }, light_intensity: { name: "intensité_de_lumière" }, @@ -76796,6 +102603,17 @@ const SetClipHooks$4 = { } } }; +const SetFirstSigma$4 = { + display_name: "DéfinirPremierSigma", + inputs: { + sigma: { + name: "sigma" + }, + sigmas: { + name: "sigmas" + } + } +}; const SetHookKeyframes$4 = { display_name: "Définir les Images Clés de Crochet", inputs: { @@ -77527,6 +103345,7 @@ const frNodes = { ControlNetApplySD3: ControlNetApplySD3$4, ControlNetInpaintingAliMamaApply: ControlNetInpaintingAliMamaApply$4, ControlNetLoader: ControlNetLoader$4, + CosmosImageToVideoLatent: CosmosImageToVideoLatent$4, CreateHookKeyframe: CreateHookKeyframe$4, CreateHookKeyframesFromFloats: CreateHookKeyframesFromFloats$4, CreateHookKeyframesInterpolated: CreateHookKeyframesInterpolated$4, @@ -77544,8 +103363,10 @@ const frNodes = { DevToolsNodeWithOnlyOptionalInput: DevToolsNodeWithOnlyOptionalInput$4, DevToolsNodeWithOptionalInput: DevToolsNodeWithOptionalInput$4, DevToolsNodeWithOutputList: DevToolsNodeWithOutputList$4, + DevToolsNodeWithSeedInput: DevToolsNodeWithSeedInput$4, DevToolsNodeWithStringInput: DevToolsNodeWithStringInput$4, DevToolsNodeWithUnionInput: DevToolsNodeWithUnionInput$4, + DevToolsObjectPatchNode: DevToolsObjectPatchNode$4, DevToolsSimpleSlider: DevToolsSimpleSlider$4, DiffControlNetLoader: DiffControlNetLoader$4, DifferentialDiffusion: DifferentialDiffusion$4, @@ -77553,6 +103374,7 @@ const frNodes = { DisableNoise: DisableNoise$4, DualCFGGuider: DualCFGGuider$4, DualCLIPLoader: DualCLIPLoader$4, + EmptyCosmosLatentVideo: EmptyCosmosLatentVideo$4, EmptyHunyuanLatentVideo: EmptyHunyuanLatentVideo$4, EmptyImage: EmptyImage$4, EmptyLTXVLatentVideo: EmptyLTXVLatentVideo$4, @@ -77701,6 +103523,7 @@ const frNodes = { SaveLatent: SaveLatent$4, SelfAttentionGuidance: SelfAttentionGuidance$4, SetClipHooks: SetClipHooks$4, + SetFirstSigma: SetFirstSigma$4, SetHookKeyframes: SetHookKeyframes$4, SetLatentNoiseMask: SetLatentNoiseMask$4, SetUnionControlNetType: SetUnionControlNetType$4, @@ -77798,9 +103621,6 @@ const Comfy_GroupSelectedNodes_Padding$4 = { const Comfy_Group_DoubleClickTitleToEdit$4 = { name: "Double-cliquer sur le titre du groupe pour le modifier" }; -const Comfy_InvertMenuScrolling$4 = { - name: "Inverser le défilement du menu contextuel" -}; const Comfy_LinkRelease_Action$4 = { name: "Action lors du relâchement du lien (sans modificateur)", options: { @@ -78034,7 +103854,8 @@ const Comfy_Workflow_WorkflowTabsPosition$4 = { name: "Position des flux de travail ouverts", options: { Sidebar: "Barre latérale", - Topbar: "Barre supérieure" + Topbar: "Barre supérieure", + "Topbar (2nd-row)": "Barre supérieure (2ème rangée)" } }; const LiteGraph_Canvas_MaximumFps$4 = { @@ -78049,7 +103870,15 @@ const frSettings = { name: "Vérifier automatiquement les mises à jour" }, "Comfy-Desktop_SendStatistics": { - name: "Envoyer des rapports de plantage anonymes" + name: "Envoyer des métriques d'utilisation anonymes" + }, + "Comfy-Desktop_WindowStyle": { + name: "Style de fenêtre", + options: { + custom: "personnalisé", + "default": "défaut" + }, + tooltip: "Choisissez l'option personnalisée pour masquer la barre de titre du système" }, Comfy_ConfirmClear: Comfy_ConfirmClear$4, Comfy_DOMClippingEnabled: Comfy_DOMClippingEnabled$4, @@ -78067,7 +103896,6 @@ const frSettings = { Comfy_Graph_ZoomSpeed: Comfy_Graph_ZoomSpeed$4, Comfy_GroupSelectedNodes_Padding: Comfy_GroupSelectedNodes_Padding$4, Comfy_Group_DoubleClickTitleToEdit: Comfy_Group_DoubleClickTitleToEdit$4, - Comfy_InvertMenuScrolling: Comfy_InvertMenuScrolling$4, Comfy_LinkRelease_Action: Comfy_LinkRelease_Action$4, Comfy_LinkRelease_ActionShift: Comfy_LinkRelease_ActionShift$4, Comfy_LinkRenderMode: Comfy_LinkRenderMode$4, @@ -78242,6 +104070,9 @@ const Comfy_ToggleTheme$3 = { const Comfy_Undo$3 = { label: "元に戻す" }; +const Workspace_CloseWorkflow$3 = { + label: "現在のワークフローを閉じる" +}; const Workspace_NextOpenedWorkflow$3 = { label: "次の開いたワークフロー" }; @@ -78339,6 +104170,7 @@ const jaCommands = { Comfy_ShowSettingsDialog: Comfy_ShowSettingsDialog$3, Comfy_ToggleTheme: Comfy_ToggleTheme$3, Comfy_Undo: Comfy_Undo$3, + Workspace_CloseWorkflow: Workspace_CloseWorkflow$3, Workspace_NextOpenedWorkflow: Workspace_NextOpenedWorkflow$3, Workspace_PreviousOpenedWorkflow: Workspace_PreviousOpenedWorkflow$3, Workspace_SearchBox_Toggle: Workspace_SearchBox_Toggle$3, @@ -78447,6 +104279,7 @@ const g$3 = { enableAll: "すべて有効にする", error: "エラー", experimental: "ベータ", + "export": "エクスポート", extensionName: "拡張機能名", findIssues: "問題を見つける", firstTimeUIMessage: "新しいUIを初めて使用しています。「メニュー > 新しいメニューを使用 > 無効」を選択して古いUIに戻してください。", @@ -78468,6 +104301,7 @@ const g$3 = { noTasksFound: "タスクが見つかりません", noTasksFoundMessage: "キューにタスクがありません。", noWorkflowsFound: "ワークフローが見つかりません。", + ok: "OK", openNewIssue: "新しい問題を開く", overwrite: "上書き", reconnected: "再接続されました", @@ -78490,10 +104324,12 @@ const g$3 = { searchWorkflows: "ワークフローを検索", settings: "設定", showReport: "レポートを表示", + success: "成功", systemInfo: "システム情報", terminal: "ターミナル", upload: "アップロード", - videoFailedToLoad: "ビデオの読み込みに失敗しました" + videoFailedToLoad: "ビデオの読み込みに失敗しました", + workflow: "ワークフロー" }; const graphCanvasMenu$3 = { fitView: "ビューに合わせる", @@ -78546,6 +104382,7 @@ const install$3 = { selectGpu: "GPUを選択", selectGpuDescription: "所有しているGPUのタイプを選択してください" }, + helpImprove: "ComfyUIの改善にご協力ください", installLocation: "インストール先", installLocationDescription: "ComfyUIのユーザーデータを保存するディレクトリを選択してください。Python環境が選択した場所にインストールされます。選択したディスクに約15GBの空き容量が必要です。", installLocationTooltip: "ComfyUIのユーザーデータディレクトリ。保存内容:\n- Python環境\n- モデル\n- カスタムノード\n", @@ -78557,35 +104394,57 @@ const install$3 = { title: "マニュアル設定", virtualEnvironmentPath: "仮想環境のパス" }, + metricsDisabled: "メトリクス無効", + metricsEnabled: "メトリクス有効", migrateFromExistingInstallation: "既存のインストールから移行", migration: "移行", migrationOptional: "移行は任意です。既存のインストールがない場合、このステップをスキップできます。", - migrationSourcePathDescription: "既存のComfyUIインストールがある場合、既存のユーザーファイルやモデルを新しいインストールにコピー/リンクできます。", + migrationSourcePathDescription: "既存のComfyUIインストールがある場合、既存のユーザーファイルとモデルを新しいインストールにコピー/リンクすることができます。既存のComfyUIインストールは影響を受けません。", + moreInfo: "詳細は、私たちの", parentMissing: "パスが存在しません - 最初に含まれるディレクトリを作成してください", pathExists: "ディレクトリはすでに存在します - すべてのデータをバックアップしたことを確認してください", pathValidationFailed: "パスの検証に失敗しました", + privacyPolicy: "プライバシーポリシー", selectItemsToMigrate: "移行する項目を選択", settings: { - allowMetrics: "クラッシュレポート", - allowMetricsDescription: "ComfyUIの改善に協力してください。匿名のクラッシュレポートを送信します。個人情報やワークフロー内容は収集されません。この設定はいつでも無効にできます。", + allowMetrics: "使用状況のメトリクス", + allowMetricsDescription: "匿名の使用状況メトリクスを送信してComfyUIを改善します。個人情報やワークフローの内容は収集されません。", autoUpdate: "自動更新", autoUpdateDescription: "更新が利用可能になると、自動的にダウンロードおよびインストールを行います。インストール前に通知が表示されます。", dataCollectionDialog: { - customNodeConfigurations: "カスタムノード設定", - errorReports: "エラーメッセージとスタックトレース", - fileSystemInformation: "ファイルシステム情報", - personalInformation: "個人情報", - systemInfo: "ハードウェア、OSの種類、アプリのバージョン", + collect: { + errorReports: "エラーメッセージとスタックトレース", + systemInfo: "ハードウェア、OSタイプ、アプリバージョン", + userJourneyEvents: "ユーザージャーニーイベント" + }, + doNotCollect: { + customNodeConfigurations: "カスタムノードの設定", + fileSystemInformation: "ファイルシステム情報", + personalInformation: "個人情報", + workflowContents: "ワークフローの内容" + }, title: "データ収集について", + viewFullPolicy: "完全なポリシーを見る", whatWeCollect: "収集内容:", - whatWeDoNotCollect: "収集しない内容:", - workflowContent: "ワークフロー内容", - workflowContents: "ワークフロー内容" + whatWeDoNotCollect: "収集しない内容:" }, + errorUpdatingConsent: "同意の更新エラー", + errorUpdatingConsentDetail: "メトリクスの同意設定の更新に失敗しました", learnMoreAboutData: "データ収集の詳細を見る" }, systemLocations: "システムの場所", - unhandledError: "未知のエラー" + unhandledError: "未知のエラー", + updateConsent: "以前はクラッシュの報告に同意していました。現在、バグの特定とアプリの改善を助けるためにイベントベースのメトリクスを追跡しています。個人を特定できる情報は収集されません。" +}; +const issueReport$3 = { + contactFollowUp: "フォローアップのために私に連絡する", + helpFix: "これを修正するのを助ける", + notifyResolve: "解決したときに通知する", + provideAdditionalDetails: "追加の詳細を提供する(オプション)", + provideEmail: "あなたのメールアドレスを教えてください(オプション)", + stackTrace: "スタックトレース", + submitErrorReport: "エラーレポートを提出する(オプション)", + systemStats: "システム統計" }; const menu$3 = { autoQueue: "自動キュー", @@ -78619,6 +104478,7 @@ const menuLabels$3 = { "Clear Pending Tasks": "保留中のタスクをクリア", "Clear Workflow": "ワークフローをクリア", Clipspace: "クリップスペース", + "Close Current Workflow": "現在のワークフローを閉じる", "Collapse/Expand Selected Nodes": "選択したノードの折りたたみ/展開", "Comfy-Org Discord": "Comfy-Org Discord", "ComfyUI Docs": "ComfyUIのドキュメント", @@ -78983,11 +104843,13 @@ const sideToolbar$3 = { workflows: "ワークフロー" }; const tabMenu$3 = { + addToBookmarks: "ブックマークに追加", closeOtherTabs: "他のタブを閉じる", closeTab: "タブを閉じる", closeTabsToLeft: "左のタブを閉じる", closeTabsToRight: "右のタブを閉じる", - duplicateTab: "タブを複製" + duplicateTab: "タブを複製", + removeFromBookmarks: "ブックマークから削除" }; const templateWorkflows$3 = { template: { @@ -79025,6 +104887,7 @@ const ja = { groupNode: groupNode$3, icon: icon$3, install: install$3, + issueReport: issueReport$3, menu: menu$3, menuLabels: menuLabels$3, nodeCategories: nodeCategories$3, @@ -79156,12 +105019,15 @@ const CLIPAttentionMultiply$3 = { } }; const CLIPLoader$3 = { - description: "[レシピ]\n\nstable_diffusion: clip-l\nstable_cascade: clip-g\nsd3: t5 / clip-g / clip-l\nstable_audio: t5\nmochi: t5", + description: "[レシピ]\n\nstable_diffusion: clip-l\nstable_cascade: clip-g\nsd3: t5 / clip-g / clip-l\nstable_audio: t5\nmochi: t5\ncosmos: old t5 xxl", display_name: "CLIPを読み込む", inputs: { clip_name: { name: "clip名" }, + device: { + name: "デバイス" + }, type: { name: "タイプ" } @@ -79902,6 +105768,32 @@ const ControlNetLoader$3 = { } } }; +const CosmosImageToVideoLatent$3 = { + display_name: "CosmosImageToVideoLatent", + inputs: { + batch_size: { + name: "バッチサイズ" + }, + end_image: { + name: "終了画像" + }, + height: { + name: "高さ" + }, + length: { + name: "長さ" + }, + start_image: { + name: "開始画像" + }, + vae: { + name: "vae" + }, + width: { + name: "幅" + } + } +}; const CreateHookKeyframe$3 = { display_name: "フックキーフレームを作成", inputs: { @@ -80143,6 +106035,15 @@ const DevToolsNodeWithOutputList$3 = { } } }; +const DevToolsNodeWithSeedInput$3 = { + description: "シード入力付きのノード", + display_name: "シード入力付きノード", + inputs: { + seed: { + name: "シード" + } + } +}; const DevToolsNodeWithStringInput$3 = { description: "文字列入力を持つノード", display_name: "文字列入力ノード", @@ -80167,6 +106068,21 @@ const DevToolsNodeWithUnionInput$3 = { } } }; +const DevToolsObjectPatchNode$3 = { + description: "オブジェクトパッチを適用するノード", + display_name: "オブジェクトパッチノード", + inputs: { + dummy_float: { + name: "ダミーフロート" + }, + model: { + name: "モデル" + }, + target_module: { + name: "ターゲットモジュール" + } + } +}; const DevToolsSimpleSlider$3 = { display_name: "シンプルスライダー", inputs: { @@ -80238,11 +106154,31 @@ const DualCLIPLoader$3 = { clip_name2: { name: "clip_name2" }, + device: { + name: "デバイス" + }, type: { name: "タイプ" } } }; +const EmptyCosmosLatentVideo$3 = { + display_name: "EmptyCosmosLatentVideo", + inputs: { + batch_size: { + name: "バッチサイズ" + }, + height: { + name: "高さ" + }, + length: { + name: "長さ" + }, + width: { + name: "幅" + } + } +}; const EmptyHunyuanLatentVideo$3 = { display_name: "EmptyHunyuanLatentVideo", inputs: { @@ -81401,6 +107337,9 @@ const Load3D$3 = { camera_type: { name: "カメラタイプ" }, + fov: { + name: "fov" + }, height: { name: "高さ" }, @@ -81453,6 +107392,9 @@ const Load3DAnimation$3 = { camera_type: { name: "カメラタイプ" }, + fov: { + name: "fov" + }, height: { name: "高さ" }, @@ -83275,6 +109217,9 @@ const Preview3D$3 = { camera_type: { name: "カメラタイプ" }, + fov: { + name: "fov" + }, light_intensity: { name: "光の強度" }, @@ -83829,6 +109774,17 @@ const SetClipHooks$3 = { } } }; +const SetFirstSigma$3 = { + display_name: "SetFirstSigma", + inputs: { + sigma: { + name: "シグマ" + }, + sigmas: { + name: "シグマ" + } + } +}; const SetHookKeyframes$3 = { display_name: "フックキーフレームを設定", inputs: { @@ -84560,6 +110516,7 @@ const jaNodes = { ControlNetApplySD3: ControlNetApplySD3$3, ControlNetInpaintingAliMamaApply: ControlNetInpaintingAliMamaApply$3, ControlNetLoader: ControlNetLoader$3, + CosmosImageToVideoLatent: CosmosImageToVideoLatent$3, CreateHookKeyframe: CreateHookKeyframe$3, CreateHookKeyframesFromFloats: CreateHookKeyframesFromFloats$3, CreateHookKeyframesInterpolated: CreateHookKeyframesInterpolated$3, @@ -84577,8 +110534,10 @@ const jaNodes = { DevToolsNodeWithOnlyOptionalInput: DevToolsNodeWithOnlyOptionalInput$3, DevToolsNodeWithOptionalInput: DevToolsNodeWithOptionalInput$3, DevToolsNodeWithOutputList: DevToolsNodeWithOutputList$3, + DevToolsNodeWithSeedInput: DevToolsNodeWithSeedInput$3, DevToolsNodeWithStringInput: DevToolsNodeWithStringInput$3, DevToolsNodeWithUnionInput: DevToolsNodeWithUnionInput$3, + DevToolsObjectPatchNode: DevToolsObjectPatchNode$3, DevToolsSimpleSlider: DevToolsSimpleSlider$3, DiffControlNetLoader: DiffControlNetLoader$3, DifferentialDiffusion: DifferentialDiffusion$3, @@ -84586,6 +110545,7 @@ const jaNodes = { DisableNoise: DisableNoise$3, DualCFGGuider: DualCFGGuider$3, DualCLIPLoader: DualCLIPLoader$3, + EmptyCosmosLatentVideo: EmptyCosmosLatentVideo$3, EmptyHunyuanLatentVideo: EmptyHunyuanLatentVideo$3, EmptyImage: EmptyImage$3, EmptyLTXVLatentVideo: EmptyLTXVLatentVideo$3, @@ -84734,6 +110694,7 @@ const jaNodes = { SaveLatent: SaveLatent$3, SelfAttentionGuidance: SelfAttentionGuidance$3, SetClipHooks: SetClipHooks$3, + SetFirstSigma: SetFirstSigma$3, SetHookKeyframes: SetHookKeyframes$3, SetLatentNoiseMask: SetLatentNoiseMask$3, SetUnionControlNetType: SetUnionControlNetType$3, @@ -84831,9 +110792,6 @@ const Comfy_GroupSelectedNodes_Padding$3 = { const Comfy_Group_DoubleClickTitleToEdit$3 = { name: "グループタイトルをダブルクリックして編集" }; -const Comfy_InvertMenuScrolling$3 = { - name: "コンテキストメニューのスクロールを反転する" -}; const Comfy_LinkRelease_Action$3 = { name: "リンクリリース時のアクション(修飾子なし)", options: { @@ -85067,7 +111025,8 @@ const Comfy_Workflow_WorkflowTabsPosition$3 = { name: "開いているワークフローの位置", options: { Sidebar: "サイドバー", - Topbar: "トップバー" + Topbar: "トップバー", + "Topbar (2nd-row)": "トップバー(2行目)" } }; const LiteGraph_Canvas_MaximumFps$3 = { @@ -85082,7 +111041,15 @@ const jaSettings = { name: "自動的に更新を確認する" }, "Comfy-Desktop_SendStatistics": { - name: "匿名のクラッシュレポートを送信する" + name: "匿名の使用統計を送信する" + }, + "Comfy-Desktop_WindowStyle": { + name: "ウィンドウスタイル", + options: { + custom: "カスタム", + "default": "デフォルト" + }, + tooltip: "システムタイトルバーを非表示にするにはカスタムオプションを選択してください" }, Comfy_ConfirmClear: Comfy_ConfirmClear$3, Comfy_DOMClippingEnabled: Comfy_DOMClippingEnabled$3, @@ -85100,7 +111067,6 @@ const jaSettings = { Comfy_Graph_ZoomSpeed: Comfy_Graph_ZoomSpeed$3, Comfy_GroupSelectedNodes_Padding: Comfy_GroupSelectedNodes_Padding$3, Comfy_Group_DoubleClickTitleToEdit: Comfy_Group_DoubleClickTitleToEdit$3, - Comfy_InvertMenuScrolling: Comfy_InvertMenuScrolling$3, Comfy_LinkRelease_Action: Comfy_LinkRelease_Action$3, Comfy_LinkRelease_ActionShift: Comfy_LinkRelease_ActionShift$3, Comfy_LinkRenderMode: Comfy_LinkRenderMode$3, @@ -85275,6 +111241,9 @@ const Comfy_ToggleTheme$2 = { const Comfy_Undo$2 = { label: "실행 취소" }; +const Workspace_CloseWorkflow$2 = { + label: "현재 워크플로우 닫기" +}; const Workspace_NextOpenedWorkflow$2 = { label: "다음 열린 워크플로" }; @@ -85372,6 +111341,7 @@ const koCommands = { Comfy_ShowSettingsDialog: Comfy_ShowSettingsDialog$2, Comfy_ToggleTheme: Comfy_ToggleTheme$2, Comfy_Undo: Comfy_Undo$2, + Workspace_CloseWorkflow: Workspace_CloseWorkflow$2, Workspace_NextOpenedWorkflow: Workspace_NextOpenedWorkflow$2, Workspace_PreviousOpenedWorkflow: Workspace_PreviousOpenedWorkflow$2, Workspace_SearchBox_Toggle: Workspace_SearchBox_Toggle$2, @@ -85480,6 +111450,7 @@ const g$2 = { enableAll: "모두 활성화", error: "오류", experimental: "베타", + "export": "내보내기", extensionName: "확장 이름", findIssues: "문제 찾기", firstTimeUIMessage: '새 UI를 처음 사용합니다. "메뉴 > 새 메뉴 사용 > 비활성화"를 선택하여 이전 UI로 복원하세요.', @@ -85501,6 +111472,7 @@ const g$2 = { noTasksFound: "작업을 찾을 수 없습니다.", noTasksFoundMessage: "대기열에 작업이 없습니다.", noWorkflowsFound: "워크플로를 찾을 수 없습니다.", + ok: "확인", openNewIssue: "새 문제 열기", overwrite: "덮어쓰기", reconnected: "재연결됨", @@ -85523,10 +111495,12 @@ const g$2 = { searchWorkflows: "워크플로 검색", settings: "설정", showReport: "보고서 보기", + success: "성공", systemInfo: "시스템 정보", terminal: "터미널", upload: "업로드", - videoFailedToLoad: "비디오를 로드하지 못했습니다." + videoFailedToLoad: "비디오를 로드하지 못했습니다.", + workflow: "워크플로우" }; const graphCanvasMenu$2 = { fitView: "보기 맞춤", @@ -85579,6 +111553,7 @@ const install$2 = { selectGpu: "GPU 선택", selectGpuDescription: "소유한 GPU 유형을 선택하세요" }, + helpImprove: "ComfyUI 개선에 도움을 주세요", installLocation: "설치 위치", installLocationDescription: "ComfyUI의 사용자 데이터 디렉토리를 선택하십시오. 선택한 위치에 Python 환경이 설치됩니다. 선택한 디스크에 충분한 공간(~15GB)이 남아 있는지 확인하십시오.", installLocationTooltip: "ComfyUI의 사용자 데이터 디렉토리. 저장소:\n- Python 환경\n- 모델\n- 사용자 정의 노드\n", @@ -85590,35 +111565,57 @@ const install$2 = { title: "수동 구성", virtualEnvironmentPath: "가상 환경 경로" }, + metricsDisabled: "메트릭스 비활성화", + metricsEnabled: "메트릭스 활성화", migrateFromExistingInstallation: "기존 설치에서 마이그레이션", migration: "마이그레이션", migrationOptional: "마이그레이션은 선택 사항입니다. 기존에 설치된 것이 없다면, 이 단계를 건너뛸 수 있습니다.", - migrationSourcePathDescription: "기존에 설치된 ComfyUI가 있는 경우, 기존 사용자 파일과 모델을 새 설치에 복사하거나 링크할 수 있습니다", + migrationSourcePathDescription: "기존의 ComfyUI 설치가 있으면, 기존 사용자 파일과 모델을 새 설치로 복사/링크할 수 있습니다. 기존의 ComfyUI 설치는 영향을 받지 않습니다.", + moreInfo: "자세한 정보는 우리의", parentMissing: "경로가 존재하지 않습니다 - 먼저 포함하는 디렉토리를 생성하세요", pathExists: "디렉토리가 이미 존재합니다 - 모든 데이터를 백업했는지 확인해 주세요", pathValidationFailed: "경로 유효성 검사 실패", + privacyPolicy: "개인정보 보호정책", selectItemsToMigrate: "마이그레이션 항목 선택", settings: { - allowMetrics: "충돌 보고서", - allowMetricsDescription: "익명의 충돌 보고서를 보내 ComfyUI 개선에 도움을 줍니다. 개인 정보나 워크플로 내용은 수집되지 않습니다. 이는 설정 메뉴에서 언제든지 비활성화할 수 있습니다.", + allowMetrics: "사용 통계", + allowMetricsDescription: "익명의 사용 통계를 보내 ComfyUI를 개선하는 데 도움을 줍니다. 개인 정보나 워크플로우 내용은 수집되지 않습니다.", autoUpdate: "자동 업데이트", autoUpdateDescription: "업데이트가 가능해지면 자동으로 다운로드하고 설치합니다. 업데이트가 설치되기 전에 항상 알림을 받습니다.", dataCollectionDialog: { - customNodeConfigurations: "사용자 정의 노드 설정", - errorReports: "오류 메시지 및 스택 추적", - fileSystemInformation: "파일 시스템 정보", - personalInformation: "개인 정보", - systemInfo: "하드웨어, OS 유형 및 앱 버전", + collect: { + errorReports: "오류 메시지 및 스택 추적", + systemInfo: "하드웨어, OS 유형, 앱 버전", + userJourneyEvents: "사용자 여정 이벤트" + }, + doNotCollect: { + customNodeConfigurations: "사용자 정의 노드 구성", + fileSystemInformation: "파일 시스템 정보", + personalInformation: "개인 정보", + workflowContents: "워크플로우 내용" + }, title: "데이터 수집 안내", + viewFullPolicy: "전체 정책 보기", whatWeCollect: "수집하는 정보:", - whatWeDoNotCollect: "수집하지 않는 정보:", - workflowContent: "워크플로 내용", - workflowContents: "워크플로 내용" + whatWeDoNotCollect: "수집하지 않는 정보:" }, + errorUpdatingConsent: "동의 업데이트 오류", + errorUpdatingConsentDetail: "메트릭스 동의 설정 업데이트에 실패했습니다", learnMoreAboutData: "데이터 수집에 대해 더 알아보기" }, systemLocations: "시스템 위치", - unhandledError: "알 수 없는 오류" + unhandledError: "알 수 없는 오류", + updateConsent: "당신은 이전에 충돌 보고에 동의했습니다. 이제 버그를 식별하고 앱을 개선하기 위해 이벤트 기반 메트릭스를 추적하고 있습니다. 개인 식별 정보는 수집하지 않습니다." +}; +const issueReport$2 = { + contactFollowUp: "추적 조사를 위해 연락해 주세요", + helpFix: "이 문제 해결에 도움을 주세요", + notifyResolve: "해결되었을 때 알려주세요", + provideAdditionalDetails: "추가 세부 사항 제공 (선택 사항)", + provideEmail: "이메일을 알려주세요 (선택 사항)", + stackTrace: "스택 추적", + submitErrorReport: "오류 보고서 제출 (선택 사항)", + systemStats: "시스템 통계" }; const menu$2 = { autoQueue: "자동 실행 큐", @@ -85652,6 +111649,7 @@ const menuLabels$2 = { "Clear Pending Tasks": "보류 중인 작업 제거하기", "Clear Workflow": "워크플로 지우기", Clipspace: "클립스페이스", + "Close Current Workflow": "현재 워크플로우 닫기", "Collapse/Expand Selected Nodes": "선택한 노드 축소/확장", "Comfy-Org Discord": "Comfy-Org 디스코드", "ComfyUI Docs": "ComfyUI 문서", @@ -86016,11 +112014,13 @@ const sideToolbar$2 = { workflows: "워크플로" }; const tabMenu$2 = { + addToBookmarks: "북마크에 추가", closeOtherTabs: "다른 탭 닫기", closeTab: "탭 닫기", closeTabsToLeft: "왼쪽 탭 닫기", closeTabsToRight: "오른쪽 탭 닫기", - duplicateTab: "탭 복제" + duplicateTab: "탭 복제", + removeFromBookmarks: "북마크에서 제거" }; const templateWorkflows$2 = { template: { @@ -86058,6 +112058,7 @@ const ko = { groupNode: groupNode$2, icon: icon$2, install: install$2, + issueReport: issueReport$2, menu: menu$2, menuLabels: menuLabels$2, nodeCategories: nodeCategories$2, @@ -86189,12 +112190,15 @@ const CLIPAttentionMultiply$2 = { } }; const CLIPLoader$2 = { - description: "[조합법]\n\nstable_diffusion: clip-l\nstable_cascade: clip-g\nsd3: t5 / clip-g / clip-l\nstable_audio: t5\nmochi: t5", + description: "[조합법]\n\nstable_diffusion: clip-l\nstable_cascade: clip-g\nsd3: t5 / clip-g / clip-l\nstable_audio: t5\nmochi: t5\ncosmos: old t5 xxl", display_name: "CLIP 로드", inputs: { clip_name: { name: "CLIP 파일명" }, + device: { + name: "장치" + }, type: { name: "유형" } @@ -86935,6 +112939,32 @@ const ControlNetLoader$2 = { } } }; +const CosmosImageToVideoLatent$2 = { + display_name: "CosmosImageToVideoLatent", + inputs: { + batch_size: { + name: "배치 크기" + }, + end_image: { + name: "끝 이미지" + }, + height: { + name: "높이" + }, + length: { + name: "길이" + }, + start_image: { + name: "시작 이미지" + }, + vae: { + name: "vae" + }, + width: { + name: "너비" + } + } +}; const CreateHookKeyframe$2 = { display_name: "후크 키프레임 생성", inputs: { @@ -87176,6 +113206,15 @@ const DevToolsNodeWithOutputList$2 = { } } }; +const DevToolsNodeWithSeedInput$2 = { + description: "시드 입력이 있는 노드", + display_name: "시드 입력이 있는 노드", + inputs: { + seed: { + name: "시드" + } + } +}; const DevToolsNodeWithStringInput$2 = { description: "문자열 입력이 있는 노드", display_name: "문자열 입력이 있는 노드", @@ -87200,6 +113239,21 @@ const DevToolsNodeWithUnionInput$2 = { } } }; +const DevToolsObjectPatchNode$2 = { + description: "오브젝트 패치를 적용하는 노드", + display_name: "오브젝트 패치 노드", + inputs: { + dummy_float: { + name: "더미 플로트" + }, + model: { + name: "모델" + }, + target_module: { + name: "대상 모듈" + } + } +}; const DevToolsSimpleSlider$2 = { display_name: "간단한 슬라이더", inputs: { @@ -87271,11 +113325,31 @@ const DualCLIPLoader$2 = { clip_name2: { name: "CLIP 파일명2" }, + device: { + name: "장치" + }, type: { name: "유형" } } }; +const EmptyCosmosLatentVideo$2 = { + display_name: "EmptyCosmosLatentVideo", + inputs: { + batch_size: { + name: "배치 크기" + }, + height: { + name: "높이" + }, + length: { + name: "길이" + }, + width: { + name: "너비" + } + } +}; const EmptyHunyuanLatentVideo$2 = { display_name: "빈 잠재 비디오 (Hunyuan)", inputs: { @@ -88318,7 +114392,7 @@ const LatentFromBatch$2 = { name: "길이" }, samples: { - name: "샘플" + name: "잠재 데이터" } } }; @@ -88434,6 +114508,9 @@ const Load3D$2 = { camera_type: { name: "카메라 유형" }, + fov: { + name: "시야" + }, height: { name: "높이" }, @@ -88486,6 +114563,9 @@ const Load3DAnimation$2 = { camera_type: { name: "카메라 유형" }, + fov: { + name: "시야" + }, height: { name: "높이" }, @@ -90308,6 +116388,9 @@ const Preview3D$2 = { camera_type: { name: "카메라 유형" }, + fov: { + name: "시야" + }, light_intensity: { name: "조명 강도" }, @@ -90862,6 +116945,17 @@ const SetClipHooks$2 = { } } }; +const SetFirstSigma$2 = { + display_name: "SetFirstSigma", + inputs: { + sigma: { + name: "시그마" + }, + sigmas: { + name: "시그마들" + } + } +}; const SetHookKeyframes$2 = { display_name: "후크 키프레임 설정", inputs: { @@ -91329,7 +117423,7 @@ const VAEDecode$2 = { display_name: "VAE 디코드", inputs: { samples: { - name: "샘플", + name: "잠재 데이터", tooltip: "디코딩할 잠재입니다." }, vae: { @@ -91593,6 +117687,7 @@ const koNodes = { ControlNetApplySD3: ControlNetApplySD3$2, ControlNetInpaintingAliMamaApply: ControlNetInpaintingAliMamaApply$2, ControlNetLoader: ControlNetLoader$2, + CosmosImageToVideoLatent: CosmosImageToVideoLatent$2, CreateHookKeyframe: CreateHookKeyframe$2, CreateHookKeyframesFromFloats: CreateHookKeyframesFromFloats$2, CreateHookKeyframesInterpolated: CreateHookKeyframesInterpolated$2, @@ -91610,8 +117705,10 @@ const koNodes = { DevToolsNodeWithOnlyOptionalInput: DevToolsNodeWithOnlyOptionalInput$2, DevToolsNodeWithOptionalInput: DevToolsNodeWithOptionalInput$2, DevToolsNodeWithOutputList: DevToolsNodeWithOutputList$2, + DevToolsNodeWithSeedInput: DevToolsNodeWithSeedInput$2, DevToolsNodeWithStringInput: DevToolsNodeWithStringInput$2, DevToolsNodeWithUnionInput: DevToolsNodeWithUnionInput$2, + DevToolsObjectPatchNode: DevToolsObjectPatchNode$2, DevToolsSimpleSlider: DevToolsSimpleSlider$2, DiffControlNetLoader: DiffControlNetLoader$2, DifferentialDiffusion: DifferentialDiffusion$2, @@ -91619,6 +117716,7 @@ const koNodes = { DisableNoise: DisableNoise$2, DualCFGGuider: DualCFGGuider$2, DualCLIPLoader: DualCLIPLoader$2, + EmptyCosmosLatentVideo: EmptyCosmosLatentVideo$2, EmptyHunyuanLatentVideo: EmptyHunyuanLatentVideo$2, EmptyImage: EmptyImage$2, EmptyLTXVLatentVideo: EmptyLTXVLatentVideo$2, @@ -91767,6 +117865,7 @@ const koNodes = { SaveLatent: SaveLatent$2, SelfAttentionGuidance: SelfAttentionGuidance$2, SetClipHooks: SetClipHooks$2, + SetFirstSigma: SetFirstSigma$2, SetHookKeyframes: SetHookKeyframes$2, SetLatentNoiseMask: SetLatentNoiseMask$2, SetUnionControlNetType: SetUnionControlNetType$2, @@ -91864,9 +117963,6 @@ const Comfy_GroupSelectedNodes_Padding$2 = { const Comfy_Group_DoubleClickTitleToEdit$2 = { name: "그룹 제목을 두 번 클릭하여 편집" }; -const Comfy_InvertMenuScrolling$2 = { - name: "컨텍스트 메뉴 스크롤 반전" -}; const Comfy_LinkRelease_Action$2 = { name: "링크 해제 시 동작 (수정자 없음)", options: { @@ -92100,7 +118196,8 @@ const Comfy_Workflow_WorkflowTabsPosition$2 = { name: "열린 워크플로 위치", options: { Sidebar: "사이드바", - Topbar: "상단바" + Topbar: "상단바", + "Topbar (2nd-row)": "상단바 (2번째 행)" } }; const LiteGraph_Canvas_MaximumFps$2 = { @@ -92115,7 +118212,15 @@ const koSettings = { name: "자동 업데이트 확인" }, "Comfy-Desktop_SendStatistics": { - name: "익명으로 충돌 보고서 전송" + name: "익명 사용 통계 보내기" + }, + "Comfy-Desktop_WindowStyle": { + name: "창 스타일", + options: { + custom: "사용자 정의", + "default": "기본" + }, + tooltip: "시스템 제목 표시 줄을 숨기려면 사용자 정의 옵션을 선택하세요" }, Comfy_ConfirmClear: Comfy_ConfirmClear$2, Comfy_DOMClippingEnabled: Comfy_DOMClippingEnabled$2, @@ -92133,7 +118238,6 @@ const koSettings = { Comfy_Graph_ZoomSpeed: Comfy_Graph_ZoomSpeed$2, Comfy_GroupSelectedNodes_Padding: Comfy_GroupSelectedNodes_Padding$2, Comfy_Group_DoubleClickTitleToEdit: Comfy_Group_DoubleClickTitleToEdit$2, - Comfy_InvertMenuScrolling: Comfy_InvertMenuScrolling$2, Comfy_LinkRelease_Action: Comfy_LinkRelease_Action$2, Comfy_LinkRelease_ActionShift: Comfy_LinkRelease_ActionShift$2, Comfy_LinkRenderMode: Comfy_LinkRenderMode$2, @@ -92308,6 +118412,9 @@ const Comfy_ToggleTheme$1 = { const Comfy_Undo$1 = { label: "Отменить" }; +const Workspace_CloseWorkflow$1 = { + label: "Закрыть текущий рабочий процесс" +}; const Workspace_NextOpenedWorkflow$1 = { label: "Следующий открытый рабочий процесс" }; @@ -92405,6 +118512,7 @@ const ruCommands = { Comfy_ShowSettingsDialog: Comfy_ShowSettingsDialog$1, Comfy_ToggleTheme: Comfy_ToggleTheme$1, Comfy_Undo: Comfy_Undo$1, + Workspace_CloseWorkflow: Workspace_CloseWorkflow$1, Workspace_NextOpenedWorkflow: Workspace_NextOpenedWorkflow$1, Workspace_PreviousOpenedWorkflow: Workspace_PreviousOpenedWorkflow$1, Workspace_SearchBox_Toggle: Workspace_SearchBox_Toggle$1, @@ -92513,6 +118621,7 @@ const g$1 = { enableAll: "Включить все", error: "Ошибка", experimental: "БЕТА", + "export": "Экспорт", extensionName: "Имя расширения", findIssues: "Найти проблемы", firstTimeUIMessage: 'Вы впервые используете новый интерфейс. Выберите "Меню > Использовать новое меню > Отключено", чтобы восстановить старый интерфейс.', @@ -92534,6 +118643,7 @@ const g$1 = { noTasksFound: "Задачи не найдены", noTasksFoundMessage: "В очереди нет задач.", noWorkflowsFound: "Рабочие процессы не найдены.", + ok: "ОК", openNewIssue: "Открыть новую проблему", overwrite: "Перезаписать", reconnected: "Переподключено", @@ -92556,10 +118666,12 @@ const g$1 = { searchWorkflows: "Поиск рабочих процессов", settings: "Настройки", showReport: "Показать отчет", + success: "Успех", systemInfo: "Информация о системе", terminal: "Терминал", upload: "Загрузить", - videoFailedToLoad: "Не удалось загрузить видео" + videoFailedToLoad: "Не удалось загрузить видео", + workflow: "Рабочий процесс" }; const graphCanvasMenu$1 = { fitView: "Подгонять под выделенные", @@ -92612,6 +118724,7 @@ const install$1 = { selectGpu: "Выберите GPU", selectGpuDescription: "Выберите тип GPU, который у вас есть" }, + helpImprove: "Пожалуйста, помогите улучшить ComfyUI", installLocation: "Место установки", installLocationDescription: "Выберите директорию для пользовательских данных ComfyUI. В выбранном месте будет установлена среда Python. Пожалуйста, убедитесь, что на выбранном диске достаточно места (~15 ГБ).", installLocationTooltip: "Директория пользовательских данных ComfyUI. Хранит:\n- Среда Python\n- Модели\n- Пользовательские узлы\n", @@ -92623,35 +118736,57 @@ const install$1 = { title: "Ручная Конфигурация", virtualEnvironmentPath: "Путь виртуального окружения" }, + metricsDisabled: "Метрики отключены", + metricsEnabled: "Метрики включены", migrateFromExistingInstallation: "Миграция из существующей установки", migration: "Миграция", migrationOptional: "Миграция является необязательной. Если у вас нет существующей установки, вы можете пропустить этот шаг.", - migrationSourcePathDescription: "Если у вас есть существующая установка ComfyUI, мы можем скопировать/связать ваши существующие пользовательские файлы и модели в новую установку.", + migrationSourcePathDescription: "Если у вас уже есть установка ComfyUI, мы можем скопировать/связать ваши существующие пользовательские файлы и модели с новой установкой. Ваша существующая установка ComfyUI не будет затронута.", + moreInfo: "Для получения дополнительной информации, пожалуйста, прочтите нашу", parentMissing: "Путь не существует - сначала создайте родительский каталог", pathExists: "Директория уже существует - пожалуйста, убедитесь, что вы сделали резервное копирование всех данных", pathValidationFailed: "Не удалось проверить путь", + privacyPolicy: "политику конфиденциальности", selectItemsToMigrate: "Выберите элементы для миграции", settings: { - allowMetrics: "Отчеты о сбоях", - allowMetricsDescription: "Помогите улучшить ComfyUI, отправляя анонимные отчеты о сбоях. Личная информация или содержимое рабочего процесса не будут собираться. Это можно отключить в любое время в меню настроек.", + allowMetrics: "Метрики использования", + allowMetricsDescription: "Помогите улучшить ComfyUI, отправляя анонимные метрики использования. Личная информация или содержание рабочего процесса не будут собираться.", autoUpdate: "Автоматические обновления", autoUpdateDescription: "Автоматически загружать и устанавливать обновления, когда они становятся доступными. Вы всегда будете уведомлены перед установкой обновлений.", dataCollectionDialog: { - customNodeConfigurations: "Конфигурации пользовательских узлов", - errorReports: "Сообщения об ошибках и трассировка стека", - fileSystemInformation: "Информация о файловой системе", - personalInformation: "Личная информация", - systemInfo: "Аппаратное обеспечение, тип ОС и версия приложения", + collect: { + errorReports: "Сообщение об ошибке и трассировка стека", + systemInfo: "Аппаратное обеспечение, тип ОС и версия приложения", + userJourneyEvents: "События пользовательского пути" + }, + doNotCollect: { + customNodeConfigurations: "Пользовательские конфигурации узлов", + fileSystemInformation: "Информация о файловой системе", + personalInformation: "Личная информация", + workflowContents: "Содержание рабочего процесса" + }, title: "О сборе данных", + viewFullPolicy: "Просмотреть политику полностью", whatWeCollect: "Что мы собираем:", - whatWeDoNotCollect: "Что мы не собираем:", - workflowContent: "Содержимое рабочего процесса", - workflowContents: "Содержимое рабочего процесса" + whatWeDoNotCollect: "Что мы не собираем:" }, + errorUpdatingConsent: "Ошибка обновления согласия", + errorUpdatingConsentDetail: "Не удалось обновить настройки согласия на метрики", learnMoreAboutData: "Узнать больше о сборе данных" }, systemLocations: "Системные места", - unhandledError: "Неизвестная ошибка" + unhandledError: "Неизвестная ошибка", + updateConsent: "Вы ранее согласились на отчетность об ошибках. Теперь мы отслеживаем событийные метрики, чтобы помочь выявить ошибки и улучшить приложение. Личная идентифицируемая информация не собирается." +}; +const issueReport$1 = { + contactFollowUp: "Свяжитесь со мной для уточнения", + helpFix: "Помочь исправить это", + notifyResolve: "Уведомить меня, когда проблема будет решена", + provideAdditionalDetails: "Предоставьте дополнительные сведения (необязательно)", + provideEmail: "Укажите вашу электронную почту (необязательно)", + stackTrace: "Трассировка стека", + submitErrorReport: "Отправить отчет об ошибке (необязательно)", + systemStats: "Статистика системы" }; const menu$1 = { autoQueue: "Автоочередь", @@ -92685,6 +118820,7 @@ const menuLabels$1 = { "Clear Pending Tasks": "Очистить ожидающие задачи", "Clear Workflow": "Очистить рабочий процесс", Clipspace: "Клиппространство", + "Close Current Workflow": "Закрыть текущий рабочий процесс", "Collapse/Expand Selected Nodes": "Свернуть/развернуть выбранные узлы", "Comfy-Org Discord": "Discord Comfy-Org", "ComfyUI Docs": "Документация ComfyUI", @@ -93049,11 +119185,13 @@ const sideToolbar$1 = { workflows: "Рабочие процессы" }; const tabMenu$1 = { + addToBookmarks: "Добавить в закладки", closeOtherTabs: "Закрыть другие вкладки", closeTab: "Закрыть вкладку", closeTabsToLeft: "Закрыть вкладки слева", closeTabsToRight: "Закрыть вкладки справа", - duplicateTab: "Дублировать вкладку" + duplicateTab: "Дублировать вкладку", + removeFromBookmarks: "Удалить из закладок" }; const templateWorkflows$1 = { template: { @@ -93091,6 +119229,7 @@ const ru = { groupNode: groupNode$1, icon: icon$1, install: install$1, + issueReport: issueReport$1, menu: menu$1, menuLabels: menuLabels$1, nodeCategories: nodeCategories$1, @@ -93222,12 +119361,15 @@ const CLIPAttentionMultiply$1 = { } }; const CLIPLoader$1 = { - description: "[Рецепты]\n\nstable_diffusion: clip-l\nstable_cascade: clip-g\nsd3: t5 / clip-g / clip-l\nstable_audio: t5\nmochi: t5", + description: "[Рецепты]\n\nstable_diffusion: clip-l\nstable_cascade: clip-g\nsd3: t5 / clip-g / clip-l\nstable_audio: t5\nmochi: t5\ncosmos: old t5 xxl", display_name: "Загрузить CLIP", inputs: { clip_name: { name: "имя_clip" }, + device: { + name: "устройство" + }, type: { name: "тип" } @@ -93968,6 +120110,32 @@ const ControlNetLoader$1 = { } } }; +const CosmosImageToVideoLatent$1 = { + display_name: "CosmosImageToVideoLatent", + inputs: { + batch_size: { + name: "размер_пакета" + }, + end_image: { + name: "конечное_изображение" + }, + height: { + name: "высота" + }, + length: { + name: "длина" + }, + start_image: { + name: "начальное_изображение" + }, + vae: { + name: "vae" + }, + width: { + name: "ширина" + } + } +}; const CreateHookKeyframe$1 = { display_name: "Создать ключевой кадр хука", inputs: { @@ -94209,6 +120377,15 @@ const DevToolsNodeWithOutputList$1 = { } } }; +const DevToolsNodeWithSeedInput$1 = { + description: "Узел с входным сигналом seed", + display_name: "Узел с входным сигналом Seed", + inputs: { + seed: { + name: "seed" + } + } +}; const DevToolsNodeWithStringInput$1 = { description: "Узел со строковым вводом", display_name: "Узел со строковым вводом", @@ -94233,6 +120410,21 @@ const DevToolsNodeWithUnionInput$1 = { } } }; +const DevToolsObjectPatchNode$1 = { + description: "Узел, применяющий объектный патч", + display_name: "Узел объектного патча", + inputs: { + dummy_float: { + name: "фиктивное число с плавающей точкой" + }, + model: { + name: "модель" + }, + target_module: { + name: "целевой модуль" + } + } +}; const DevToolsSimpleSlider$1 = { display_name: "Простой Слайдер", inputs: { @@ -94304,11 +120496,31 @@ const DualCLIPLoader$1 = { clip_name2: { name: "clip_name2" }, + device: { + name: "устройство" + }, type: { name: "тип" } } }; +const EmptyCosmosLatentVideo$1 = { + display_name: "EmptyCosmosLatentVideo", + inputs: { + batch_size: { + name: "размер_пакета" + }, + height: { + name: "высота" + }, + length: { + name: "длина" + }, + width: { + name: "ширина" + } + } +}; const EmptyHunyuanLatentVideo$1 = { display_name: "ПустойHunyuanLatentVideo", inputs: { @@ -95467,6 +121679,9 @@ const Load3D$1 = { camera_type: { name: "тип_камеры" }, + fov: { + name: "поле зрения" + }, height: { name: "высота" }, @@ -95519,6 +121734,9 @@ const Load3DAnimation$1 = { camera_type: { name: "тип_камеры" }, + fov: { + name: "поле зрения" + }, height: { name: "высота" }, @@ -97341,6 +123559,9 @@ const Preview3D$1 = { camera_type: { name: "тип_камеры" }, + fov: { + name: "поле зрения" + }, light_intensity: { name: "интенсивность_света" }, @@ -97895,6 +124116,17 @@ const SetClipHooks$1 = { } } }; +const SetFirstSigma$1 = { + display_name: "SetFirstSigma", + inputs: { + sigma: { + name: "сигма" + }, + sigmas: { + name: "сигмы" + } + } +}; const SetHookKeyframes$1 = { display_name: "Установить ключевые кадры хука", inputs: { @@ -98626,6 +124858,7 @@ const ruNodes = { ControlNetApplySD3: ControlNetApplySD3$1, ControlNetInpaintingAliMamaApply: ControlNetInpaintingAliMamaApply$1, ControlNetLoader: ControlNetLoader$1, + CosmosImageToVideoLatent: CosmosImageToVideoLatent$1, CreateHookKeyframe: CreateHookKeyframe$1, CreateHookKeyframesFromFloats: CreateHookKeyframesFromFloats$1, CreateHookKeyframesInterpolated: CreateHookKeyframesInterpolated$1, @@ -98643,8 +124876,10 @@ const ruNodes = { DevToolsNodeWithOnlyOptionalInput: DevToolsNodeWithOnlyOptionalInput$1, DevToolsNodeWithOptionalInput: DevToolsNodeWithOptionalInput$1, DevToolsNodeWithOutputList: DevToolsNodeWithOutputList$1, + DevToolsNodeWithSeedInput: DevToolsNodeWithSeedInput$1, DevToolsNodeWithStringInput: DevToolsNodeWithStringInput$1, DevToolsNodeWithUnionInput: DevToolsNodeWithUnionInput$1, + DevToolsObjectPatchNode: DevToolsObjectPatchNode$1, DevToolsSimpleSlider: DevToolsSimpleSlider$1, DiffControlNetLoader: DiffControlNetLoader$1, DifferentialDiffusion: DifferentialDiffusion$1, @@ -98652,6 +124887,7 @@ const ruNodes = { DisableNoise: DisableNoise$1, DualCFGGuider: DualCFGGuider$1, DualCLIPLoader: DualCLIPLoader$1, + EmptyCosmosLatentVideo: EmptyCosmosLatentVideo$1, EmptyHunyuanLatentVideo: EmptyHunyuanLatentVideo$1, EmptyImage: EmptyImage$1, EmptyLTXVLatentVideo: EmptyLTXVLatentVideo$1, @@ -98800,6 +125036,7 @@ const ruNodes = { SaveLatent: SaveLatent$1, SelfAttentionGuidance: SelfAttentionGuidance$1, SetClipHooks: SetClipHooks$1, + SetFirstSigma: SetFirstSigma$1, SetHookKeyframes: SetHookKeyframes$1, SetLatentNoiseMask: SetLatentNoiseMask$1, SetUnionControlNetType: SetUnionControlNetType$1, @@ -98897,9 +125134,6 @@ const Comfy_GroupSelectedNodes_Padding$1 = { const Comfy_Group_DoubleClickTitleToEdit$1 = { name: "Дважды щелкните по заголовку группы, чтобы редактировать" }; -const Comfy_InvertMenuScrolling$1 = { - name: "Инвертировать прокрутку контекстного меню" -}; const Comfy_LinkRelease_Action$1 = { name: "Действие при отпускании ссылки (без модификатора)", options: { @@ -99133,7 +125367,8 @@ const Comfy_Workflow_WorkflowTabsPosition$1 = { name: "Положение открытых рабочих процессов", options: { Sidebar: "Боковая панель", - Topbar: "Верхняя панель" + Topbar: "Верхняя панель", + "Topbar (2nd-row)": "Топбар (2-й ряд)" } }; const LiteGraph_Canvas_MaximumFps$1 = { @@ -99148,7 +125383,15 @@ const ruSettings = { name: "Автоматически проверять обновления" }, "Comfy-Desktop_SendStatistics": { - name: "Отправлять анонимные отчеты о сбоях" + name: "Отправлять анонимную статистику использования" + }, + "Comfy-Desktop_WindowStyle": { + name: "Стиль окна", + options: { + custom: "пользовательский", + "default": "по умолчанию" + }, + tooltip: "Выберите пользовательский вариант, чтобы скрыть системную строку заголовка" }, Comfy_ConfirmClear: Comfy_ConfirmClear$1, Comfy_DOMClippingEnabled: Comfy_DOMClippingEnabled$1, @@ -99166,7 +125409,6 @@ const ruSettings = { Comfy_Graph_ZoomSpeed: Comfy_Graph_ZoomSpeed$1, Comfy_GroupSelectedNodes_Padding: Comfy_GroupSelectedNodes_Padding$1, Comfy_Group_DoubleClickTitleToEdit: Comfy_Group_DoubleClickTitleToEdit$1, - Comfy_InvertMenuScrolling: Comfy_InvertMenuScrolling$1, Comfy_LinkRelease_Action: Comfy_LinkRelease_Action$1, Comfy_LinkRelease_ActionShift: Comfy_LinkRelease_ActionShift$1, Comfy_LinkRenderMode: Comfy_LinkRenderMode$1, @@ -99341,6 +125583,9 @@ const Comfy_ToggleTheme = { const Comfy_Undo = { label: "撤销" }; +const Workspace_CloseWorkflow = { + label: "关闭当前工作流" +}; const Workspace_NextOpenedWorkflow = { label: "下一个打开的工作流" }; @@ -99438,6 +125683,7 @@ const zhCommands = { Comfy_ShowSettingsDialog, Comfy_ToggleTheme, Comfy_Undo, + Workspace_CloseWorkflow, Workspace_NextOpenedWorkflow, Workspace_PreviousOpenedWorkflow, Workspace_SearchBox_Toggle, @@ -99546,6 +125792,7 @@ const g = { enableAll: "启用全部", error: "错误", experimental: "测试版", + "export": "导出", extensionName: "扩展名称", findIssues: "查找问题", firstTimeUIMessage: '这是您第一次使用新界面。选择 "菜单 > 使用新菜单 > 禁用" 来恢复旧界面。', @@ -99567,6 +125814,7 @@ const g = { noTasksFound: "未找到任务", noTasksFoundMessage: "队列中没有任务。", noWorkflowsFound: "未找到工作流。", + ok: "确定", openNewIssue: "打开新问题", overwrite: "覆盖", reconnected: "已重新连接", @@ -99589,10 +125837,12 @@ const g = { searchWorkflows: "搜索工作流", settings: "设置", showReport: "显示报告", + success: "成功", systemInfo: "系统信息", terminal: "终端", upload: "上传", - videoFailedToLoad: "视频加载失败" + videoFailedToLoad: "视频加载失败", + workflow: "工作流" }; const graphCanvasMenu = { fitView: "适应视图", @@ -99645,6 +125895,7 @@ const install = { selectGpu: "选择 GPU", selectGpuDescription: "选择你拥有的 GPU 类型" }, + helpImprove: "请帮助我们改进ComfyUI", installLocation: "安装位置", installLocationDescription: "选择 ComfyUI 用户数据的存放目录。将安装一个 Python 环境到所选位置。请确保所选磁盘有足够的空间(约 15GB)。", installLocationTooltip: "ComfyUI 的用户数据目录。存储:\n- Python 环境\n- 模型\n- 自定义节点\n", @@ -99656,35 +125907,57 @@ const install = { title: "手动配置", virtualEnvironmentPath: "虚拟环境路径" }, + metricsDisabled: "禁用度量", + metricsEnabled: "启用度量", migrateFromExistingInstallation: "从现有安装迁移", migration: "迁移", migrationOptional: "迁移是可选的。如果您之前没有安装过 ComfyUI,可以跳过此步骤。", - migrationSourcePathDescription: "如果您有可用的 ComfyUI,我们可以将您的现有用户文件和模型复制/链接到新安装。", + migrationSourcePathDescription: "如果您已有现有的ComfyUI安装,我们可以复制/链接您现有的用户文件和模型到新的安装。您现有的ComfyUI安装将不会受到影响。", + moreInfo: "有关更多信息,请阅读我们的", parentMissing: "路径不存在 - 请先创建包含该路径的目录", pathExists: "目录已存在 - 请确保您已备份全部数据", pathValidationFailed: "路径验证失败", + privacyPolicy: "隐私政策", selectItemsToMigrate: "选择要迁移的项目", settings: { - allowMetrics: "崩溃报告", - allowMetricsDescription: "发送匿名崩溃报告帮助改善 ComfyUI。报告不会收集任何个人信息或工作流内容。您可以随时在设置菜单中禁用此功能。", + allowMetrics: "使用情况指标", + allowMetricsDescription: "通过发送匿名使用情况指标来帮助改进ComfyUI。不会收集任何个人信息或工作流内容。", autoUpdate: "自动更新", autoUpdateDescription: "更新可用时自动更新。您将在安装更新之前收到通知。", dataCollectionDialog: { - customNodeConfigurations: "自定义节点配置", - errorReports: "错误信息和堆栈跟踪", - fileSystemInformation: "文件系统信息", - personalInformation: "个人信息", - systemInfo: "硬件、操作系统类型和应用版本", + collect: { + errorReports: "错误报告和堆栈跟踪", + systemInfo: "硬件,操作系统类型和应用版本", + userJourneyEvents: "用户旅程事件" + }, + doNotCollect: { + customNodeConfigurations: "自定义节点配置", + fileSystemInformation: "文件系统信息", + personalInformation: "个人信息", + workflowContents: "工作流内容" + }, title: "关于数据收集", + viewFullPolicy: "查看完整政策", whatWeCollect: "我们收集的内容:", - whatWeDoNotCollect: "我们不收集的内容:", - workflowContent: "工作流内容", - workflowContents: "工作流内容" + whatWeDoNotCollect: "我们不收集的内容:" }, + errorUpdatingConsent: "更新同意错误", + errorUpdatingConsentDetail: "无法更新度量同意设置", learnMoreAboutData: "了解更多关于数据收集的信息" }, systemLocations: "系统位置", - unhandledError: "未知错误" + unhandledError: "未知错误", + updateConsent: "您之前选择了报告崩溃。我们现在正在跟踪基于事件的度量,以帮助识别错误并改进应用程序。我们不收集任何个人可识别信息。" +}; +const issueReport = { + contactFollowUp: "跟进联系我", + helpFix: "帮助修复这个", + notifyResolve: "解决时通知我", + provideAdditionalDetails: "提供额外的详细信息(可选)", + provideEmail: "提供您的电子邮件(可选)", + stackTrace: "堆栈跟踪", + submitErrorReport: "提交错误报告(可选)", + systemStats: "系统状态" }; const menu = { autoQueue: "自动执行", @@ -99718,6 +125991,7 @@ const menuLabels = { "Clear Pending Tasks": "清除待处理任务", "Clear Workflow": "清除工作流", Clipspace: "剪贴空间", + "Close Current Workflow": "关闭当前工作流", "Collapse/Expand Selected Nodes": "折叠/展开选定节点", "Comfy-Org Discord": "Comfy-Org Discord", "ComfyUI Docs": "ComfyUI 文档", @@ -100082,11 +126356,13 @@ const sideToolbar = { workflows: "工作流" }; const tabMenu = { + addToBookmarks: "添加到书签", closeOtherTabs: "关闭其他标签", closeTab: "关闭标签", closeTabsToLeft: "关闭左侧标签", closeTabsToRight: "关闭右侧标签", - duplicateTab: "复制标签" + duplicateTab: "复制标签", + removeFromBookmarks: "从书签中移除" }; const templateWorkflows = { template: { @@ -100124,6 +126400,7 @@ const zh = { groupNode, icon, install, + issueReport, menu, menuLabels, nodeCategories, @@ -100255,12 +126532,15 @@ const CLIPAttentionMultiply = { } }; const CLIPLoader = { - description: "[配方]\n\nStable Diffusion:clip-l\nStable Cascade:clip-g\nSD3:t5 / clip-g / clip-l\nStable Audio:t5\nMochi:t5", + description: "[配方]\n\nStable Diffusion:clip-l\nStable Cascade:clip-g\nSD3:t5 / clip-g / clip-l\nStable Audio:t5\nMochi:t5\ncosmos:old t5 xxl", display_name: "加载CLIP", inputs: { clip_name: { name: "CLIP名称" }, + device: { + name: "设备" + }, type: { name: "类型" } @@ -101001,6 +127281,32 @@ const ControlNetLoader = { } } }; +const CosmosImageToVideoLatent = { + display_name: "Cosmos图像到视频潜在", + inputs: { + batch_size: { + name: "批量大小" + }, + end_image: { + name: "结束图像" + }, + height: { + name: "高度" + }, + length: { + name: "长度" + }, + start_image: { + name: "开始图像" + }, + vae: { + name: "vae" + }, + width: { + name: "宽度" + } + } +}; const CreateHookKeyframe = { display_name: "创建约束关键帧", inputs: { @@ -101242,6 +127548,15 @@ const DevToolsNodeWithOutputList = { } } }; +const DevToolsNodeWithSeedInput = { + description: "一个带有种子输入的节点", + display_name: "带种子输入的节点", + inputs: { + seed: { + name: "种子" + } + } +}; const DevToolsNodeWithStringInput = { description: "一个具有字符串输入的节点", display_name: "具有字符串输入的节点", @@ -101266,6 +127581,21 @@ const DevToolsNodeWithUnionInput = { } } }; +const DevToolsObjectPatchNode = { + description: "一个应用对象补丁的节点", + display_name: "对象补丁节点", + inputs: { + dummy_float: { + name: "虚拟浮点数" + }, + model: { + name: "模型" + }, + target_module: { + name: "目标模块" + } + } +}; const DevToolsSimpleSlider = { display_name: "简单滑块", inputs: { @@ -101337,11 +127667,31 @@ const DualCLIPLoader = { clip_name2: { name: "CLIP名称2" }, + device: { + name: "设备" + }, type: { name: "类型" } } }; +const EmptyCosmosLatentVideo = { + display_name: "空的Cosmos潜在视频", + inputs: { + batch_size: { + name: "批量大小" + }, + height: { + name: "高度" + }, + length: { + name: "长度" + }, + width: { + name: "宽度" + } + } +}; const EmptyHunyuanLatentVideo = { display_name: "空Latent视频(混元)", inputs: { @@ -102500,6 +128850,9 @@ const Load3D = { camera_type: { name: "相机类型" }, + fov: { + name: "视场" + }, height: { name: "高度" }, @@ -102552,6 +128905,9 @@ const Load3DAnimation = { camera_type: { name: "相机类型" }, + fov: { + name: "视场" + }, height: { name: "高度" }, @@ -104374,6 +130730,9 @@ const Preview3D = { camera_type: { name: "相机类型" }, + fov: { + name: "视场" + }, light_intensity: { name: "光照强度" }, @@ -104928,6 +131287,17 @@ const SetClipHooks = { } } }; +const SetFirstSigma = { + display_name: "设置第一个Sigma", + inputs: { + sigma: { + name: "sigma" + }, + sigmas: { + name: "sigmas" + } + } +}; const SetHookKeyframes = { display_name: "设置约束关键帧", inputs: { @@ -105659,6 +132029,7 @@ const zhNodes = { ControlNetApplySD3, ControlNetInpaintingAliMamaApply, ControlNetLoader, + CosmosImageToVideoLatent, CreateHookKeyframe, CreateHookKeyframesFromFloats, CreateHookKeyframesInterpolated, @@ -105676,8 +132047,10 @@ const zhNodes = { DevToolsNodeWithOnlyOptionalInput, DevToolsNodeWithOptionalInput, DevToolsNodeWithOutputList, + DevToolsNodeWithSeedInput, DevToolsNodeWithStringInput, DevToolsNodeWithUnionInput, + DevToolsObjectPatchNode, DevToolsSimpleSlider, DiffControlNetLoader, DifferentialDiffusion, @@ -105685,6 +132058,7 @@ const zhNodes = { DisableNoise, DualCFGGuider, DualCLIPLoader, + EmptyCosmosLatentVideo, EmptyHunyuanLatentVideo, EmptyImage, EmptyLTXVLatentVideo, @@ -105833,6 +132207,7 @@ const zhNodes = { SaveLatent, SelfAttentionGuidance, SetClipHooks, + SetFirstSigma, SetHookKeyframes, SetLatentNoiseMask, SetUnionControlNetType, @@ -105930,9 +132305,6 @@ const Comfy_GroupSelectedNodes_Padding = { const Comfy_Group_DoubleClickTitleToEdit = { name: "双击组标题以编辑" }; -const Comfy_InvertMenuScrolling = { - name: "反转上下文菜单滚动" -}; const Comfy_LinkRelease_Action = { name: "释放连线时的操作", options: { @@ -106166,7 +132538,8 @@ const Comfy_Workflow_WorkflowTabsPosition = { name: "已打开工作流的位置", options: { Sidebar: "侧边栏", - Topbar: "顶部栏" + Topbar: "顶部栏", + "Topbar (2nd-row)": "顶部栏 (第二行)" } }; const LiteGraph_Canvas_MaximumFps = { @@ -106181,7 +132554,15 @@ const zhSettings = { name: "自动检查更新" }, "Comfy-Desktop_SendStatistics": { - name: "发送匿名崩溃报告" + name: "发送匿名使用情况统计" + }, + "Comfy-Desktop_WindowStyle": { + name: "窗口样式", + options: { + custom: "自定义", + "default": "默认" + }, + tooltip: "选择自定义选项以隐藏系统标题栏" }, Comfy_ConfirmClear, Comfy_DOMClippingEnabled, @@ -106199,7 +132580,6 @@ const zhSettings = { Comfy_Graph_ZoomSpeed, Comfy_GroupSelectedNodes_Padding, Comfy_Group_DoubleClickTitleToEdit, - Comfy_InvertMenuScrolling, Comfy_LinkRelease_Action, Comfy_LinkRelease_ActionShift, Comfy_LinkRenderMode, @@ -106326,22 +132706,22 @@ function useErrorHandling() { detail: error2.message }); }, "toastErrorHandler"); - const wrapWithErrorHandling = /* @__PURE__ */ __name((action, errorHandler, finallyHandler) => (...args) => { + const wrapWithErrorHandling = /* @__PURE__ */ __name((action, errorHandler2, finallyHandler) => (...args) => { try { return action(...args); } catch (e2) { ; - (errorHandler ?? toastErrorHandler)(e2); + (errorHandler2 ?? toastErrorHandler)(e2); } finally { finallyHandler?.(); } }, "wrapWithErrorHandling"); - const wrapWithErrorHandlingAsync = /* @__PURE__ */ __name((action, errorHandler, finallyHandler) => async (...args) => { + const wrapWithErrorHandlingAsync = /* @__PURE__ */ __name((action, errorHandler2, finallyHandler) => async (...args) => { try { return await action(...args); } catch (e2) { ; - (errorHandler ?? toastErrorHandler)(e2); + (errorHandler2 ?? toastErrorHandler)(e2); } finally { finallyHandler?.(); } @@ -106354,37 +132734,37 @@ function getDefaultExportFromCjs(x2) { return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2; } __name(getDefaultExportFromCjs, "getDefaultExportFromCjs"); -function getDefaultExportFromNamespaceIfPresent(n) { - return n && Object.prototype.hasOwnProperty.call(n, "default") ? n["default"] : n; +function getDefaultExportFromNamespaceIfPresent(n2) { + return n2 && Object.prototype.hasOwnProperty.call(n2, "default") ? n2["default"] : n2; } __name(getDefaultExportFromNamespaceIfPresent, "getDefaultExportFromNamespaceIfPresent"); -function getDefaultExportFromNamespaceIfNotNamed(n) { - return n && Object.prototype.hasOwnProperty.call(n, "default") && Object.keys(n).length === 1 ? n["default"] : n; +function getDefaultExportFromNamespaceIfNotNamed(n2) { + return n2 && Object.prototype.hasOwnProperty.call(n2, "default") && Object.keys(n2).length === 1 ? n2["default"] : n2; } __name(getDefaultExportFromNamespaceIfNotNamed, "getDefaultExportFromNamespaceIfNotNamed"); -function getAugmentedNamespace(n) { - if (n.__esModule) return n; - var f = n.default; - if (typeof f == "function") { - var a = /* @__PURE__ */ __name(function a2() { - if (this instanceof a2) { - return Reflect.construct(f, arguments, this.constructor); +function getAugmentedNamespace(n2) { + if (n2.__esModule) return n2; + var f2 = n2.default; + if (typeof f2 == "function") { + var a2 = /* @__PURE__ */ __name(function a3() { + if (this instanceof a3) { + return Reflect.construct(f2, arguments, this.constructor); } - return f.apply(this, arguments); + return f2.apply(this, arguments); }, "a"); - a.prototype = f.prototype; - } else a = {}; - Object.defineProperty(a, "__esModule", { value: true }); - Object.keys(n).forEach(function(k) { - var d = Object.getOwnPropertyDescriptor(n, k); - Object.defineProperty(a, k, d.get ? d : { + a2.prototype = f2.prototype; + } else a2 = {}; + Object.defineProperty(a2, "__esModule", { value: true }); + Object.keys(n2).forEach(function(k2) { + var d2 = Object.getOwnPropertyDescriptor(n2, k2); + Object.defineProperty(a2, k2, d2.get ? d2 : { enumerable: true, get: /* @__PURE__ */ __name(function() { - return n[k]; + return n2[k2]; }, "get") }); }); - return a; + return a2; } __name(getAugmentedNamespace, "getAugmentedNamespace"); var lodash$1 = { exports: {} }; @@ -106397,23 +132777,23 @@ var lodash$1 = { exports: {} }; * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ var lodash = lodash$1.exports; -(function(module, exports) { +(function(module2, exports) { ; (function() { var undefined$1; var VERSION2 = "4.17.21"; - var LARGE_ARRAY_SIZE = 200; + var LARGE_ARRAY_SIZE2 = 200; var CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", FUNC_ERROR_TEXT = "Expected a function", INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`"; - var HASH_UNDEFINED = "__lodash_hash_undefined__"; + var HASH_UNDEFINED2 = "__lodash_hash_undefined__"; var MAX_MEMOIZE_SIZE = 500; var PLACEHOLDER = "__lodash_placeholder__"; - var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4; + var CLONE_DEEP_FLAG2 = 1, CLONE_FLAT_FLAG2 = 2, CLONE_SYMBOLS_FLAG2 = 4; var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2; var WRAP_BIND_FLAG = 1, WRAP_BIND_KEY_FLAG = 2, WRAP_CURRY_BOUND_FLAG = 4, WRAP_CURRY_FLAG = 8, WRAP_CURRY_RIGHT_FLAG = 16, WRAP_PARTIAL_FLAG = 32, WRAP_PARTIAL_RIGHT_FLAG = 64, WRAP_ARY_FLAG = 128, WRAP_REARG_FLAG = 256, WRAP_FLIP_FLAG = 512; var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = "..."; var HOT_COUNT = 800, HOT_SPAN = 16; var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, LAZY_WHILE_FLAG = 3; - var INFINITY2 = 1 / 0, MAX_SAFE_INTEGER = 9007199254740991, MAX_INTEGER = 17976931348623157e292, NAN = 0 / 0; + var INFINITY2 = 1 / 0, MAX_SAFE_INTEGER2 = 9007199254740991, MAX_INTEGER = 17976931348623157e292, NAN = 0 / 0; var MAX_ARRAY_LENGTH = 4294967295, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; var wrapFlags = [ ["ary", WRAP_ARY_FLAG], @@ -106426,13 +132806,13 @@ var lodash = lodash$1.exports; ["partialRight", WRAP_PARTIAL_RIGHT_FLAG], ["rearg", WRAP_REARG_FLAG] ]; - var argsTag = "[object Arguments]", arrayTag = "[object Array]", asyncTag = "[object AsyncFunction]", boolTag = "[object Boolean]", dateTag = "[object Date]", domExcTag = "[object DOMException]", errorTag = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag = "[object Map]", numberTag = "[object Number]", nullTag = "[object Null]", objectTag = "[object Object]", promiseTag = "[object Promise]", proxyTag = "[object Proxy]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]", undefinedTag = "[object Undefined]", weakMapTag = "[object WeakMap]", weakSetTag = "[object WeakSet]"; - var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]"; + var argsTag2 = "[object Arguments]", arrayTag2 = "[object Array]", asyncTag2 = "[object AsyncFunction]", boolTag2 = "[object Boolean]", dateTag2 = "[object Date]", domExcTag = "[object DOMException]", errorTag2 = "[object Error]", funcTag2 = "[object Function]", genTag2 = "[object GeneratorFunction]", mapTag2 = "[object Map]", numberTag2 = "[object Number]", nullTag2 = "[object Null]", objectTag2 = "[object Object]", promiseTag2 = "[object Promise]", proxyTag2 = "[object Proxy]", regexpTag2 = "[object RegExp]", setTag2 = "[object Set]", stringTag2 = "[object String]", symbolTag2 = "[object Symbol]", undefinedTag2 = "[object Undefined]", weakMapTag2 = "[object WeakMap]", weakSetTag = "[object WeakSet]"; + var arrayBufferTag2 = "[object ArrayBuffer]", dataViewTag2 = "[object DataView]", float32Tag2 = "[object Float32Array]", float64Tag2 = "[object Float64Array]", int8Tag2 = "[object Int8Array]", int16Tag2 = "[object Int16Array]", int32Tag2 = "[object Int32Array]", uint8Tag2 = "[object Uint8Array]", uint8ClampedTag2 = "[object Uint8ClampedArray]", uint16Tag2 = "[object Uint16Array]", uint32Tag2 = "[object Uint32Array]"; var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, reUnescapedHtml = /[&<>"']/g, reHasEscapedHtml = RegExp(reEscapedHtml.source), reHasUnescapedHtml = RegExp(reUnescapedHtml.source); var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g; var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; - var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar.source); + var reRegExpChar2 = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar2.source); var reTrimStart = /^\s+/; var reWhitespace = /\s/; var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, reSplitDetails = /,? & /; @@ -106440,12 +132820,12 @@ var lodash = lodash$1.exports; var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/; var reEscapeChar = /\\(\\)?/g; var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; - var reFlags = /\w*$/; + var reFlags2 = /\w*$/; var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; var reIsBinary = /^0b[01]+$/i; - var reIsHostCtor = /^\[object .+?Constructor\]$/; + var reIsHostCtor2 = /^\[object .+?Constructor\]$/; var reIsOctal = /^0o[0-7]+$/i; - var reIsUint = /^(?:0|[1-9]\d*)$/; + var reIsUint2 = /^(?:0|[1-9]\d*)$/; var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; var reNoMatch = /($^)/; var reUnescapedString = /['\n\r\u2028\u2029\\]/g; @@ -106500,12 +132880,12 @@ var lodash = lodash$1.exports; "setTimeout" ]; var templateCounter = -1; - var typedArrayTags = {}; - typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; - typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; - var cloneableTags = {}; - cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; - cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false; + var typedArrayTags2 = {}; + typedArrayTags2[float32Tag2] = typedArrayTags2[float64Tag2] = typedArrayTags2[int8Tag2] = typedArrayTags2[int16Tag2] = typedArrayTags2[int32Tag2] = typedArrayTags2[uint8Tag2] = typedArrayTags2[uint8ClampedTag2] = typedArrayTags2[uint16Tag2] = typedArrayTags2[uint32Tag2] = true; + typedArrayTags2[argsTag2] = typedArrayTags2[arrayTag2] = typedArrayTags2[arrayBufferTag2] = typedArrayTags2[boolTag2] = typedArrayTags2[dataViewTag2] = typedArrayTags2[dateTag2] = typedArrayTags2[errorTag2] = typedArrayTags2[funcTag2] = typedArrayTags2[mapTag2] = typedArrayTags2[numberTag2] = typedArrayTags2[objectTag2] = typedArrayTags2[regexpTag2] = typedArrayTags2[setTag2] = typedArrayTags2[stringTag2] = typedArrayTags2[weakMapTag2] = false; + var cloneableTags2 = {}; + cloneableTags2[argsTag2] = cloneableTags2[arrayTag2] = cloneableTags2[arrayBufferTag2] = cloneableTags2[dataViewTag2] = cloneableTags2[boolTag2] = cloneableTags2[dateTag2] = cloneableTags2[float32Tag2] = cloneableTags2[float64Tag2] = cloneableTags2[int8Tag2] = cloneableTags2[int16Tag2] = cloneableTags2[int32Tag2] = cloneableTags2[mapTag2] = cloneableTags2[numberTag2] = cloneableTags2[objectTag2] = cloneableTags2[regexpTag2] = cloneableTags2[setTag2] = cloneableTags2[stringTag2] = cloneableTags2[symbolTag2] = cloneableTags2[uint8Tag2] = cloneableTags2[uint8ClampedTag2] = cloneableTags2[uint16Tag2] = cloneableTags2[uint32Tag2] = true; + cloneableTags2[errorTag2] = cloneableTags2[funcTag2] = cloneableTags2[weakMapTag2] = false; var deburredLetters = { // Latin-1 Supplement block. "À": "A", @@ -106723,14 +133103,14 @@ var lodash = lodash$1.exports; "\u2029": "u2029" }; var freeParseFloat = parseFloat, freeParseInt = parseInt; - var freeGlobal = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal; - var freeSelf = typeof self == "object" && self && self.Object === Object && self; - var root24 = freeGlobal || freeSelf || Function("return this")(); + var freeGlobal2 = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal; + var freeSelf2 = typeof self == "object" && self && self.Object === Object && self; + var root27 = freeGlobal2 || freeSelf2 || Function("return this")(); var freeExports = exports && !exports.nodeType && exports; - var freeModule = freeExports && true && module && !module.nodeType && module; + var freeModule = freeExports && true && module2 && !module2.nodeType && module2; var moduleExports = freeModule && freeModule.exports === freeExports; - var freeProcess = moduleExports && freeGlobal.process; - var nodeUtil = function() { + var freeProcess = moduleExports && freeGlobal2.process; + var nodeUtil2 = function() { try { var types = freeModule && freeModule.require && freeModule.require("util").types; if (types) { @@ -106740,7 +133120,7 @@ var lodash = lodash$1.exports; } catch (e2) { } }(); - var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer, nodeIsDate = nodeUtil && nodeUtil.isDate, nodeIsMap = nodeUtil && nodeUtil.isMap, nodeIsRegExp = nodeUtil && nodeUtil.isRegExp, nodeIsSet = nodeUtil && nodeUtil.isSet, nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; + var nodeIsArrayBuffer = nodeUtil2 && nodeUtil2.isArrayBuffer, nodeIsDate = nodeUtil2 && nodeUtil2.isDate, nodeIsMap2 = nodeUtil2 && nodeUtil2.isMap, nodeIsRegExp = nodeUtil2 && nodeUtil2.isRegExp, nodeIsSet2 = nodeUtil2 && nodeUtil2.isSet, nodeIsTypedArray2 = nodeUtil2 && nodeUtil2.isTypedArray; function apply2(func, thisArg, args) { switch (args.length) { case 0: @@ -106764,7 +133144,7 @@ var lodash = lodash$1.exports; return accumulator; } __name(arrayAggregator, "arrayAggregator"); - function arrayEach(array, iteratee) { + function arrayEach2(array, iteratee) { var index2 = -1, length = array == null ? 0 : array.length; while (++index2 < length) { if (iteratee(array[index2], index2, array) === false) { @@ -106773,7 +133153,7 @@ var lodash = lodash$1.exports; } return array; } - __name(arrayEach, "arrayEach"); + __name(arrayEach2, "arrayEach"); function arrayEachRight(array, iteratee) { var length = array == null ? 0 : array.length; while (length--) { @@ -106794,7 +133174,7 @@ var lodash = lodash$1.exports; return true; } __name(arrayEvery, "arrayEvery"); - function arrayFilter(array, predicate) { + function arrayFilter2(array, predicate) { var index2 = -1, length = array == null ? 0 : array.length, resIndex = 0, result = []; while (++index2 < length) { var value4 = array[index2]; @@ -106804,7 +133184,7 @@ var lodash = lodash$1.exports; } return result; } - __name(arrayFilter, "arrayFilter"); + __name(arrayFilter2, "arrayFilter"); function arrayIncludes(array, value4) { var length = array == null ? 0 : array.length; return !!length && baseIndexOf(array, value4, 0) > -1; @@ -106828,14 +133208,14 @@ var lodash = lodash$1.exports; return result; } __name(arrayMap, "arrayMap"); - function arrayPush(array, values) { + function arrayPush2(array, values) { var index2 = -1, length = values.length, offset = array.length; while (++index2 < length) { array[offset + index2] = values[index2]; } return array; } - __name(arrayPush, "arrayPush"); + __name(arrayPush2, "arrayPush"); function arrayReduce(array, iteratee, accumulator, initAccum) { var index2 = -1, length = array == null ? 0 : array.length; if (initAccum && length) { @@ -106960,14 +133340,14 @@ var lodash = lodash$1.exports; return result; } __name(baseSum, "baseSum"); - function baseTimes(n, iteratee) { - var index2 = -1, result = Array(n); - while (++index2 < n) { + function baseTimes2(n2, iteratee) { + var index2 = -1, result = Array(n2); + while (++index2 < n2) { result[index2] = iteratee(index2); } return result; } - __name(baseTimes, "baseTimes"); + __name(baseTimes2, "baseTimes"); function baseToPairs(object, props) { return arrayMap(props, function(key) { return [key, object[key]]; @@ -106978,12 +133358,12 @@ var lodash = lodash$1.exports; return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string; } __name(baseTrim, "baseTrim"); - function baseUnary(func) { + function baseUnary2(func) { return function(value4) { return func(value4); }; } - __name(baseUnary, "baseUnary"); + __name(baseUnary2, "baseUnary"); function baseValues(object, props) { return arrayMap(props, function(key) { return object[key]; @@ -107037,9 +133417,9 @@ var lodash = lodash$1.exports; } __name(hasUnicodeWord, "hasUnicodeWord"); function iteratorToArray(iterator) { - var data24, result = []; - while (!(data24 = iterator.next()).done) { - result.push(data24.value); + var data25, result = []; + while (!(data25 = iterator.next()).done) { + result.push(data25.value); } return result; } @@ -107052,12 +133432,12 @@ var lodash = lodash$1.exports; return result; } __name(mapToArray, "mapToArray"); - function overArg(func, transform2) { + function overArg2(func, transform2) { return function(arg) { return func(transform2(arg)); }; } - __name(overArg, "overArg"); + __name(overArg2, "overArg"); function replaceHolders(array, placeholder) { var index2 = -1, length = array.length, resIndex = 0, result = []; while (++index2 < length) { @@ -107139,39 +133519,39 @@ var lodash = lodash$1.exports; } __name(unicodeWords, "unicodeWords"); var runInContext = /* @__PURE__ */ __name(function runInContext2(context) { - context = context == null ? root24 : _2.defaults(root24.Object(), context, _2.pick(root24, contextProps)); + context = context == null ? root27 : _2.defaults(root27.Object(), context, _2.pick(root27, contextProps)); var Array2 = context.Array, Date2 = context.Date, Error2 = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String2 = context.String, TypeError2 = context.TypeError; - var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype; - var coreJsData = context["__core-js_shared__"]; - var funcToString = funcProto.toString; - var hasOwnProperty2 = objectProto.hasOwnProperty; + var arrayProto2 = Array2.prototype, funcProto2 = Function2.prototype, objectProto2 = Object2.prototype; + var coreJsData2 = context["__core-js_shared__"]; + var funcToString2 = funcProto2.toString; + var hasOwnProperty2 = objectProto2.hasOwnProperty; var idCounter = 0; - var maskSrcKey = function() { - var uid2 = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ""); + var maskSrcKey2 = function() { + var uid2 = /[^.]+$/.exec(coreJsData2 && coreJsData2.keys && coreJsData2.keys.IE_PROTO || ""); return uid2 ? "Symbol(src)_1." + uid2 : ""; }(); - var nativeObjectToString = objectProto.toString; - var objectCtorString = funcToString.call(Object2); - var oldDash = root24._; - var reIsNative = RegExp2( - "^" + funcToString.call(hasOwnProperty2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" + var nativeObjectToString2 = objectProto2.toString; + var objectCtorString = funcToString2.call(Object2); + var oldDash = root27._; + var reIsNative2 = RegExp2( + "^" + funcToString2.call(hasOwnProperty2).replace(reRegExpChar2, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" ); - var Buffer2 = moduleExports ? context.Buffer : undefined$1, Symbol2 = context.Symbol, Uint8Array2 = context.Uint8Array, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : undefined$1, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : undefined$1, symIterator = Symbol2 ? Symbol2.iterator : undefined$1, symToStringTag = Symbol2 ? Symbol2.toStringTag : undefined$1; - var defineProperty = function() { + var Buffer2 = moduleExports ? context.Buffer : undefined$1, Symbol2 = context.Symbol, Uint8Array2 = context.Uint8Array, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : undefined$1, getPrototype2 = overArg2(Object2.getPrototypeOf, Object2), objectCreate2 = Object2.create, propertyIsEnumerable2 = objectProto2.propertyIsEnumerable, splice2 = arrayProto2.splice, spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : undefined$1, symIterator = Symbol2 ? Symbol2.iterator : undefined$1, symToStringTag2 = Symbol2 ? Symbol2.toStringTag : undefined$1; + var defineProperty2 = function() { try { - var func = getNative(Object2, "defineProperty"); + var func = getNative2(Object2, "defineProperty"); func({}, "", {}); return func; } catch (e2) { } }(); - var ctxClearTimeout = context.clearTimeout !== root24.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root24.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root24.setTimeout && context.setTimeout; - var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : undefined$1, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax = Math2.max, nativeMin = Math2.min, nativeNow = Date2.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse; - var DataView2 = getNative(context, "DataView"), Map2 = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set2 = getNative(context, "Set"), WeakMap2 = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create"); + var ctxClearTimeout = context.clearTimeout !== root27.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root27.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root27.setTimeout && context.setTimeout; + var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols2 = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : undefined$1, nativeIsFinite = context.isFinite, nativeJoin = arrayProto2.join, nativeKeys2 = overArg2(Object2.keys, Object2), nativeMax = Math2.max, nativeMin = Math2.min, nativeNow = Date2.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto2.reverse; + var DataView2 = getNative2(context, "DataView"), Map2 = getNative2(context, "Map"), Promise2 = getNative2(context, "Promise"), Set2 = getNative2(context, "Set"), WeakMap2 = getNative2(context, "WeakMap"), nativeCreate2 = getNative2(Object2, "create"); var metaMap = WeakMap2 && new WeakMap2(); var realNames = {}; - var dataViewCtorString = toSource(DataView2), mapCtorString = toSource(Map2), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set2), weakMapCtorString = toSource(WeakMap2); - var symbolProto = Symbol2 ? Symbol2.prototype : undefined$1, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined$1, symbolToString = symbolProto ? symbolProto.toString : undefined$1; + var dataViewCtorString2 = toSource2(DataView2), mapCtorString2 = toSource2(Map2), promiseCtorString2 = toSource2(Promise2), setCtorString2 = toSource2(Set2), weakMapCtorString2 = toSource2(WeakMap2); + var symbolProto2 = Symbol2 ? Symbol2.prototype : undefined$1, symbolValueOf2 = symbolProto2 ? symbolProto2.valueOf : undefined$1, symbolToString = symbolProto2 ? symbolProto2.toString : undefined$1; function lodash2(value4) { if (isObjectLike2(value4) && !isArray2(value4) && !(value4 instanceof LazyWrapper)) { if (value4 instanceof LodashWrapper) { @@ -107184,7 +133564,7 @@ var lodash = lodash$1.exports; return new LodashWrapper(value4); } __name(lodash2, "lodash"); - var baseCreate = /* @__PURE__ */ function() { + var baseCreate2 = /* @__PURE__ */ function() { function object() { } __name(object, "object"); @@ -107192,8 +133572,8 @@ var lodash = lodash$1.exports; if (!isObject2(proto)) { return {}; } - if (objectCreate) { - return objectCreate(proto); + if (objectCreate2) { + return objectCreate2(proto); } object.prototype = proto; var result2 = new object(); @@ -107259,7 +133639,7 @@ var lodash = lodash$1.exports; }; lodash2.prototype = baseLodash.prototype; lodash2.prototype.constructor = lodash2; - LodashWrapper.prototype = baseCreate(baseLodash.prototype); + LodashWrapper.prototype = baseCreate2(baseLodash.prototype); LodashWrapper.prototype.constructor = LodashWrapper; function LazyWrapper(value4) { this.__wrapped__ = value4; @@ -107273,12 +133653,12 @@ var lodash = lodash$1.exports; __name(LazyWrapper, "LazyWrapper"); function lazyClone() { var result2 = new LazyWrapper(this.__wrapped__); - result2.__actions__ = copyArray(this.__actions__); + result2.__actions__ = copyArray2(this.__actions__); result2.__dir__ = this.__dir__; result2.__filtered__ = this.__filtered__; - result2.__iteratees__ = copyArray(this.__iteratees__); + result2.__iteratees__ = copyArray2(this.__iteratees__); result2.__takeCount__ = this.__takeCount__; - result2.__views__ = copyArray(this.__views__); + result2.__views__ = copyArray2(this.__views__); return result2; } __name(lazyClone, "lazyClone"); @@ -107305,7 +133685,7 @@ var lodash = lodash$1.exports; index2 += dir; var iterIndex = -1, value4 = array[index2]; while (++iterIndex < iterLength) { - var data24 = iteratees[iterIndex], iteratee2 = data24.iteratee, type = data24.type, computed2 = iteratee2(value4); + var data25 = iteratees[iterIndex], iteratee2 = data25.iteratee, type = data25.type, computed2 = iteratee2(value4); if (type == LAZY_MAP_FLAG) { value4 = computed2; } else if (!computed2) { @@ -107321,9 +133701,9 @@ var lodash = lodash$1.exports; return result2; } __name(lazyValue, "lazyValue"); - LazyWrapper.prototype = baseCreate(baseLodash.prototype); + LazyWrapper.prototype = baseCreate2(baseLodash.prototype); LazyWrapper.prototype.constructor = LazyWrapper; - function Hash(entries) { + function Hash2(entries) { var index2 = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index2 < length) { @@ -107331,45 +133711,45 @@ var lodash = lodash$1.exports; this.set(entry[0], entry[1]); } } - __name(Hash, "Hash"); - function hashClear() { - this.__data__ = nativeCreate ? nativeCreate(null) : {}; + __name(Hash2, "Hash"); + function hashClear2() { + this.__data__ = nativeCreate2 ? nativeCreate2(null) : {}; this.size = 0; } - __name(hashClear, "hashClear"); - function hashDelete(key) { + __name(hashClear2, "hashClear"); + function hashDelete2(key) { var result2 = this.has(key) && delete this.__data__[key]; this.size -= result2 ? 1 : 0; return result2; } - __name(hashDelete, "hashDelete"); - function hashGet(key) { - var data24 = this.__data__; - if (nativeCreate) { - var result2 = data24[key]; - return result2 === HASH_UNDEFINED ? undefined$1 : result2; + __name(hashDelete2, "hashDelete"); + function hashGet2(key) { + var data25 = this.__data__; + if (nativeCreate2) { + var result2 = data25[key]; + return result2 === HASH_UNDEFINED2 ? undefined$1 : result2; } - return hasOwnProperty2.call(data24, key) ? data24[key] : undefined$1; + return hasOwnProperty2.call(data25, key) ? data25[key] : undefined$1; } - __name(hashGet, "hashGet"); - function hashHas(key) { - var data24 = this.__data__; - return nativeCreate ? data24[key] !== undefined$1 : hasOwnProperty2.call(data24, key); + __name(hashGet2, "hashGet"); + function hashHas2(key) { + var data25 = this.__data__; + return nativeCreate2 ? data25[key] !== undefined$1 : hasOwnProperty2.call(data25, key); } - __name(hashHas, "hashHas"); - function hashSet(key, value4) { - var data24 = this.__data__; + __name(hashHas2, "hashHas"); + function hashSet2(key, value4) { + var data25 = this.__data__; this.size += this.has(key) ? 0 : 1; - data24[key] = nativeCreate && value4 === undefined$1 ? HASH_UNDEFINED : value4; + data25[key] = nativeCreate2 && value4 === undefined$1 ? HASH_UNDEFINED2 : value4; return this; } - __name(hashSet, "hashSet"); - Hash.prototype.clear = hashClear; - Hash.prototype["delete"] = hashDelete; - Hash.prototype.get = hashGet; - Hash.prototype.has = hashHas; - Hash.prototype.set = hashSet; - function ListCache(entries) { + __name(hashSet2, "hashSet"); + Hash2.prototype.clear = hashClear2; + Hash2.prototype["delete"] = hashDelete2; + Hash2.prototype.get = hashGet2; + Hash2.prototype.has = hashHas2; + Hash2.prototype.set = hashSet2; + function ListCache2(entries) { var index2 = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index2 < length) { @@ -107377,53 +133757,53 @@ var lodash = lodash$1.exports; this.set(entry[0], entry[1]); } } - __name(ListCache, "ListCache"); - function listCacheClear() { + __name(ListCache2, "ListCache"); + function listCacheClear2() { this.__data__ = []; this.size = 0; } - __name(listCacheClear, "listCacheClear"); - function listCacheDelete(key) { - var data24 = this.__data__, index2 = assocIndexOf(data24, key); + __name(listCacheClear2, "listCacheClear"); + function listCacheDelete2(key) { + var data25 = this.__data__, index2 = assocIndexOf2(data25, key); if (index2 < 0) { return false; } - var lastIndex2 = data24.length - 1; + var lastIndex2 = data25.length - 1; if (index2 == lastIndex2) { - data24.pop(); + data25.pop(); } else { - splice.call(data24, index2, 1); + splice2.call(data25, index2, 1); } --this.size; return true; } - __name(listCacheDelete, "listCacheDelete"); - function listCacheGet(key) { - var data24 = this.__data__, index2 = assocIndexOf(data24, key); - return index2 < 0 ? undefined$1 : data24[index2][1]; + __name(listCacheDelete2, "listCacheDelete"); + function listCacheGet2(key) { + var data25 = this.__data__, index2 = assocIndexOf2(data25, key); + return index2 < 0 ? undefined$1 : data25[index2][1]; } - __name(listCacheGet, "listCacheGet"); - function listCacheHas(key) { - return assocIndexOf(this.__data__, key) > -1; + __name(listCacheGet2, "listCacheGet"); + function listCacheHas2(key) { + return assocIndexOf2(this.__data__, key) > -1; } - __name(listCacheHas, "listCacheHas"); - function listCacheSet(key, value4) { - var data24 = this.__data__, index2 = assocIndexOf(data24, key); + __name(listCacheHas2, "listCacheHas"); + function listCacheSet2(key, value4) { + var data25 = this.__data__, index2 = assocIndexOf2(data25, key); if (index2 < 0) { ++this.size; - data24.push([key, value4]); + data25.push([key, value4]); } else { - data24[index2][1] = value4; + data25[index2][1] = value4; } return this; } - __name(listCacheSet, "listCacheSet"); - ListCache.prototype.clear = listCacheClear; - ListCache.prototype["delete"] = listCacheDelete; - ListCache.prototype.get = listCacheGet; - ListCache.prototype.has = listCacheHas; - ListCache.prototype.set = listCacheSet; - function MapCache(entries) { + __name(listCacheSet2, "listCacheSet"); + ListCache2.prototype.clear = listCacheClear2; + ListCache2.prototype["delete"] = listCacheDelete2; + ListCache2.prototype.get = listCacheGet2; + ListCache2.prototype.has = listCacheHas2; + ListCache2.prototype.set = listCacheSet2; + function MapCache2(entries) { var index2 = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index2 < length) { @@ -107431,52 +133811,52 @@ var lodash = lodash$1.exports; this.set(entry[0], entry[1]); } } - __name(MapCache, "MapCache"); - function mapCacheClear() { + __name(MapCache2, "MapCache"); + function mapCacheClear2() { this.size = 0; this.__data__ = { - "hash": new Hash(), - "map": new (Map2 || ListCache)(), - "string": new Hash() + "hash": new Hash2(), + "map": new (Map2 || ListCache2)(), + "string": new Hash2() }; } - __name(mapCacheClear, "mapCacheClear"); - function mapCacheDelete(key) { - var result2 = getMapData(this, key)["delete"](key); + __name(mapCacheClear2, "mapCacheClear"); + function mapCacheDelete2(key) { + var result2 = getMapData2(this, key)["delete"](key); this.size -= result2 ? 1 : 0; return result2; } - __name(mapCacheDelete, "mapCacheDelete"); - function mapCacheGet(key) { - return getMapData(this, key).get(key); + __name(mapCacheDelete2, "mapCacheDelete"); + function mapCacheGet2(key) { + return getMapData2(this, key).get(key); } - __name(mapCacheGet, "mapCacheGet"); - function mapCacheHas(key) { - return getMapData(this, key).has(key); + __name(mapCacheGet2, "mapCacheGet"); + function mapCacheHas2(key) { + return getMapData2(this, key).has(key); } - __name(mapCacheHas, "mapCacheHas"); - function mapCacheSet(key, value4) { - var data24 = getMapData(this, key), size3 = data24.size; - data24.set(key, value4); - this.size += data24.size == size3 ? 0 : 1; + __name(mapCacheHas2, "mapCacheHas"); + function mapCacheSet2(key, value4) { + var data25 = getMapData2(this, key), size3 = data25.size; + data25.set(key, value4); + this.size += data25.size == size3 ? 0 : 1; return this; } - __name(mapCacheSet, "mapCacheSet"); - MapCache.prototype.clear = mapCacheClear; - MapCache.prototype["delete"] = mapCacheDelete; - MapCache.prototype.get = mapCacheGet; - MapCache.prototype.has = mapCacheHas; - MapCache.prototype.set = mapCacheSet; + __name(mapCacheSet2, "mapCacheSet"); + MapCache2.prototype.clear = mapCacheClear2; + MapCache2.prototype["delete"] = mapCacheDelete2; + MapCache2.prototype.get = mapCacheGet2; + MapCache2.prototype.has = mapCacheHas2; + MapCache2.prototype.set = mapCacheSet2; function SetCache(values2) { var index2 = -1, length = values2 == null ? 0 : values2.length; - this.__data__ = new MapCache(); + this.__data__ = new MapCache2(); while (++index2 < length) { this.add(values2[index2]); } } __name(SetCache, "SetCache"); function setCacheAdd(value4) { - this.__data__.set(value4, HASH_UNDEFINED); + this.__data__.set(value4, HASH_UNDEFINED2); return this; } __name(setCacheAdd, "setCacheAdd"); @@ -107486,101 +133866,101 @@ var lodash = lodash$1.exports; __name(setCacheHas, "setCacheHas"); SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; SetCache.prototype.has = setCacheHas; - function Stack(entries) { - var data24 = this.__data__ = new ListCache(entries); - this.size = data24.size; + function Stack2(entries) { + var data25 = this.__data__ = new ListCache2(entries); + this.size = data25.size; } - __name(Stack, "Stack"); - function stackClear() { - this.__data__ = new ListCache(); + __name(Stack2, "Stack"); + function stackClear2() { + this.__data__ = new ListCache2(); this.size = 0; } - __name(stackClear, "stackClear"); - function stackDelete(key) { - var data24 = this.__data__, result2 = data24["delete"](key); - this.size = data24.size; + __name(stackClear2, "stackClear"); + function stackDelete2(key) { + var data25 = this.__data__, result2 = data25["delete"](key); + this.size = data25.size; return result2; } - __name(stackDelete, "stackDelete"); - function stackGet(key) { + __name(stackDelete2, "stackDelete"); + function stackGet2(key) { return this.__data__.get(key); } - __name(stackGet, "stackGet"); - function stackHas(key) { + __name(stackGet2, "stackGet"); + function stackHas2(key) { return this.__data__.has(key); } - __name(stackHas, "stackHas"); - function stackSet(key, value4) { - var data24 = this.__data__; - if (data24 instanceof ListCache) { - var pairs = data24.__data__; - if (!Map2 || pairs.length < LARGE_ARRAY_SIZE - 1) { + __name(stackHas2, "stackHas"); + function stackSet2(key, value4) { + var data25 = this.__data__; + if (data25 instanceof ListCache2) { + var pairs = data25.__data__; + if (!Map2 || pairs.length < LARGE_ARRAY_SIZE2 - 1) { pairs.push([key, value4]); - this.size = ++data24.size; + this.size = ++data25.size; return this; } - data24 = this.__data__ = new MapCache(pairs); + data25 = this.__data__ = new MapCache2(pairs); } - data24.set(key, value4); - this.size = data24.size; + data25.set(key, value4); + this.size = data25.size; return this; } - __name(stackSet, "stackSet"); - Stack.prototype.clear = stackClear; - Stack.prototype["delete"] = stackDelete; - Stack.prototype.get = stackGet; - Stack.prototype.has = stackHas; - Stack.prototype.set = stackSet; - function arrayLikeKeys(value4, inherited) { - var isArr = isArray2(value4), isArg = !isArr && isArguments(value4), isBuff = !isArr && !isArg && isBuffer2(value4), isType = !isArr && !isArg && !isBuff && isTypedArray2(value4), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes(value4.length, String2) : [], length = result2.length; + __name(stackSet2, "stackSet"); + Stack2.prototype.clear = stackClear2; + Stack2.prototype["delete"] = stackDelete2; + Stack2.prototype.get = stackGet2; + Stack2.prototype.has = stackHas2; + Stack2.prototype.set = stackSet2; + function arrayLikeKeys2(value4, inherited) { + var isArr = isArray2(value4), isArg = !isArr && isArguments2(value4), isBuff = !isArr && !isArg && isBuffer2(value4), isType = !isArr && !isArg && !isBuff && isTypedArray2(value4), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes2(value4.length, String2) : [], length = result2.length; for (var key in value4) { if ((inherited || hasOwnProperty2.call(value4, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode. (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties. - isIndex(key, length)))) { + isIndex2(key, length)))) { result2.push(key); } } return result2; } - __name(arrayLikeKeys, "arrayLikeKeys"); + __name(arrayLikeKeys2, "arrayLikeKeys"); function arraySample(array) { var length = array.length; return length ? array[baseRandom(0, length - 1)] : undefined$1; } __name(arraySample, "arraySample"); - function arraySampleSize(array, n) { - return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length)); + function arraySampleSize(array, n2) { + return shuffleSelf(copyArray2(array), baseClamp(n2, 0, array.length)); } __name(arraySampleSize, "arraySampleSize"); function arrayShuffle(array) { - return shuffleSelf(copyArray(array)); + return shuffleSelf(copyArray2(array)); } __name(arrayShuffle, "arrayShuffle"); function assignMergeValue(object, key, value4) { - if (value4 !== undefined$1 && !eq(object[key], value4) || value4 === undefined$1 && !(key in object)) { - baseAssignValue(object, key, value4); + if (value4 !== undefined$1 && !eq2(object[key], value4) || value4 === undefined$1 && !(key in object)) { + baseAssignValue2(object, key, value4); } } __name(assignMergeValue, "assignMergeValue"); - function assignValue(object, key, value4) { + function assignValue2(object, key, value4) { var objValue = object[key]; - if (!(hasOwnProperty2.call(object, key) && eq(objValue, value4)) || value4 === undefined$1 && !(key in object)) { - baseAssignValue(object, key, value4); + if (!(hasOwnProperty2.call(object, key) && eq2(objValue, value4)) || value4 === undefined$1 && !(key in object)) { + baseAssignValue2(object, key, value4); } } - __name(assignValue, "assignValue"); - function assocIndexOf(array, key) { + __name(assignValue2, "assignValue"); + function assocIndexOf2(array, key) { var length = array.length; while (length--) { - if (eq(array[length][0], key)) { + if (eq2(array[length][0], key)) { return length; } } return -1; } - __name(assocIndexOf, "assocIndexOf"); + __name(assocIndexOf2, "assocIndexOf"); function baseAggregator(collection, setter, iteratee2, accumulator) { baseEach(collection, function(value4, key, collection2) { setter(accumulator, value4, iteratee2(value4), collection2); @@ -107588,17 +133968,17 @@ var lodash = lodash$1.exports; return accumulator; } __name(baseAggregator, "baseAggregator"); - function baseAssign(object, source) { - return object && copyObject(source, keys2(source), object); + function baseAssign2(object, source) { + return object && copyObject2(source, keys2(source), object); } - __name(baseAssign, "baseAssign"); - function baseAssignIn(object, source) { - return object && copyObject(source, keysIn(source), object); + __name(baseAssign2, "baseAssign"); + function baseAssignIn2(object, source) { + return object && copyObject2(source, keysIn2(source), object); } - __name(baseAssignIn, "baseAssignIn"); - function baseAssignValue(object, key, value4) { - if (key == "__proto__" && defineProperty) { - defineProperty(object, key, { + __name(baseAssignIn2, "baseAssignIn"); + function baseAssignValue2(object, key, value4) { + if (key == "__proto__" && defineProperty2) { + defineProperty2(object, key, { "configurable": true, "enumerable": true, "value": value4, @@ -107608,7 +133988,7 @@ var lodash = lodash$1.exports; object[key] = value4; } } - __name(baseAssignValue, "baseAssignValue"); + __name(baseAssignValue2, "baseAssignValue"); function baseAt(object, paths) { var index2 = -1, length = paths.length, result2 = Array2(length), skip = object == null; while (++index2 < length) { @@ -107629,8 +134009,8 @@ var lodash = lodash$1.exports; return number2; } __name(baseClamp, "baseClamp"); - function baseClone(value4, bitmask, customizer, key, object, stack2) { - var result2, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG; + function baseClone2(value4, bitmask, customizer, key, object, stack2) { + var result2, isDeep = bitmask & CLONE_DEEP_FLAG2, isFlat = bitmask & CLONE_FLAT_FLAG2, isFull = bitmask & CLONE_SYMBOLS_FLAG2; if (customizer) { result2 = object ? customizer(value4, key, object, stack2) : customizer(value4); } @@ -107642,28 +134022,28 @@ var lodash = lodash$1.exports; } var isArr = isArray2(value4); if (isArr) { - result2 = initCloneArray(value4); + result2 = initCloneArray2(value4); if (!isDeep) { - return copyArray(value4, result2); + return copyArray2(value4, result2); } } else { - var tag = getTag2(value4), isFunc = tag == funcTag || tag == genTag; + var tag = getTag2(value4), isFunc = tag == funcTag2 || tag == genTag2; if (isBuffer2(value4)) { - return cloneBuffer(value4, isDeep); + return cloneBuffer2(value4, isDeep); } - if (tag == objectTag || tag == argsTag || isFunc && !object) { - result2 = isFlat || isFunc ? {} : initCloneObject(value4); + if (tag == objectTag2 || tag == argsTag2 || isFunc && !object) { + result2 = isFlat || isFunc ? {} : initCloneObject2(value4); if (!isDeep) { - return isFlat ? copySymbolsIn(value4, baseAssignIn(result2, value4)) : copySymbols(value4, baseAssign(result2, value4)); + return isFlat ? copySymbolsIn2(value4, baseAssignIn2(result2, value4)) : copySymbols2(value4, baseAssign2(result2, value4)); } } else { - if (!cloneableTags[tag]) { + if (!cloneableTags2[tag]) { return object ? value4 : {}; } - result2 = initCloneByTag(value4, tag, isDeep); + result2 = initCloneByTag2(value4, tag, isDeep); } } - stack2 || (stack2 = new Stack()); + stack2 || (stack2 = new Stack2()); var stacked = stack2.get(value4); if (stacked) { return stacked; @@ -107671,25 +134051,25 @@ var lodash = lodash$1.exports; stack2.set(value4, result2); if (isSet2(value4)) { value4.forEach(function(subValue) { - result2.add(baseClone(subValue, bitmask, customizer, subValue, value4, stack2)); + result2.add(baseClone2(subValue, bitmask, customizer, subValue, value4, stack2)); }); } else if (isMap2(value4)) { value4.forEach(function(subValue, key2) { - result2.set(key2, baseClone(subValue, bitmask, customizer, key2, value4, stack2)); + result2.set(key2, baseClone2(subValue, bitmask, customizer, key2, value4, stack2)); }); } - var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys2; + var keysFunc = isFull ? isFlat ? getAllKeysIn2 : getAllKeys2 : isFlat ? keysIn2 : keys2; var props = isArr ? undefined$1 : keysFunc(value4); - arrayEach(props || value4, function(subValue, key2) { + arrayEach2(props || value4, function(subValue, key2) { if (props) { key2 = subValue; subValue = value4[key2]; } - assignValue(result2, key2, baseClone(subValue, bitmask, customizer, key2, value4, stack2)); + assignValue2(result2, key2, baseClone2(subValue, bitmask, customizer, key2, value4, stack2)); }); return result2; } - __name(baseClone, "baseClone"); + __name(baseClone2, "baseClone"); function baseConforms(source) { var props = keys2(source); return function(object) { @@ -107727,12 +134107,12 @@ var lodash = lodash$1.exports; return result2; } if (iteratee2) { - values2 = arrayMap(values2, baseUnary(iteratee2)); + values2 = arrayMap(values2, baseUnary2(iteratee2)); } if (comparator2) { includes2 = arrayIncludesWith; isCommon = false; - } else if (values2.length >= LARGE_ARRAY_SIZE) { + } else if (values2.length >= LARGE_ARRAY_SIZE2) { includes2 = cacheHas; isCommon = false; values2 = new SetCache(values2); @@ -107815,7 +134195,7 @@ var lodash = lodash$1.exports; if (depth > 1) { baseFlatten(value4, depth - 1, predicate, isStrict, result2); } else { - arrayPush(result2, value4); + arrayPush2(result2, value4); } } else if (!isStrict) { result2[result2.length] = value4; @@ -107835,7 +134215,7 @@ var lodash = lodash$1.exports; } __name(baseForOwnRight, "baseForOwnRight"); function baseFunctions(object, props) { - return arrayFilter(props, function(key) { + return arrayFilter2(props, function(key) { return isFunction2(object[key]); }); } @@ -107849,18 +134229,18 @@ var lodash = lodash$1.exports; return index2 && index2 == length ? object : undefined$1; } __name(baseGet, "baseGet"); - function baseGetAllKeys(object, keysFunc, symbolsFunc) { + function baseGetAllKeys2(object, keysFunc, symbolsFunc) { var result2 = keysFunc(object); - return isArray2(object) ? result2 : arrayPush(result2, symbolsFunc(object)); + return isArray2(object) ? result2 : arrayPush2(result2, symbolsFunc(object)); } - __name(baseGetAllKeys, "baseGetAllKeys"); - function baseGetTag(value4) { + __name(baseGetAllKeys2, "baseGetAllKeys"); + function baseGetTag2(value4) { if (value4 == null) { - return value4 === undefined$1 ? undefinedTag : nullTag; + return value4 === undefined$1 ? undefinedTag2 : nullTag2; } - return symToStringTag && symToStringTag in Object2(value4) ? getRawTag(value4) : objectToString2(value4); + return symToStringTag2 && symToStringTag2 in Object2(value4) ? getRawTag2(value4) : objectToString2(value4); } - __name(baseGetTag, "baseGetTag"); + __name(baseGetTag2, "baseGetTag"); function baseGt(value4, other) { return value4 > other; } @@ -107882,7 +134262,7 @@ var lodash = lodash$1.exports; while (othIndex--) { var array = arrays[othIndex]; if (othIndex && iteratee2) { - array = arrayMap(array, baseUnary(iteratee2)); + array = arrayMap(array, baseUnary2(iteratee2)); } maxLength = nativeMin(array.length, maxLength); caches[othIndex] = !comparator2 && (iteratee2 || length >= 120 && array.length >= 120) ? new SetCache(othIndex && array) : undefined$1; @@ -107924,16 +134304,16 @@ var lodash = lodash$1.exports; return func == null ? undefined$1 : apply2(func, object, args); } __name(baseInvoke, "baseInvoke"); - function baseIsArguments(value4) { - return isObjectLike2(value4) && baseGetTag(value4) == argsTag; + function baseIsArguments2(value4) { + return isObjectLike2(value4) && baseGetTag2(value4) == argsTag2; } - __name(baseIsArguments, "baseIsArguments"); + __name(baseIsArguments2, "baseIsArguments"); function baseIsArrayBuffer(value4) { - return isObjectLike2(value4) && baseGetTag(value4) == arrayBufferTag; + return isObjectLike2(value4) && baseGetTag2(value4) == arrayBufferTag2; } __name(baseIsArrayBuffer, "baseIsArrayBuffer"); function baseIsDate(value4) { - return isObjectLike2(value4) && baseGetTag(value4) == dateTag; + return isObjectLike2(value4) && baseGetTag2(value4) == dateTag2; } __name(baseIsDate, "baseIsDate"); function baseIsEqual(value4, other, bitmask, customizer, stack2) { @@ -107947,10 +134327,10 @@ var lodash = lodash$1.exports; } __name(baseIsEqual, "baseIsEqual"); function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack2) { - var objIsArr = isArray2(object), othIsArr = isArray2(other), objTag = objIsArr ? arrayTag : getTag2(object), othTag = othIsArr ? arrayTag : getTag2(other); - objTag = objTag == argsTag ? objectTag : objTag; - othTag = othTag == argsTag ? objectTag : othTag; - var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag; + var objIsArr = isArray2(object), othIsArr = isArray2(other), objTag = objIsArr ? arrayTag2 : getTag2(object), othTag = othIsArr ? arrayTag2 : getTag2(other); + objTag = objTag == argsTag2 ? objectTag2 : objTag; + othTag = othTag == argsTag2 ? objectTag2 : othTag; + var objIsObj = objTag == objectTag2, othIsObj = othTag == objectTag2, isSameTag = objTag == othTag; if (isSameTag && isBuffer2(object)) { if (!isBuffer2(other)) { return false; @@ -107959,28 +134339,28 @@ var lodash = lodash$1.exports; objIsObj = false; } if (isSameTag && !objIsObj) { - stack2 || (stack2 = new Stack()); + stack2 || (stack2 = new Stack2()); return objIsArr || isTypedArray2(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack2) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack2); } if (!(bitmask & COMPARE_PARTIAL_FLAG)) { var objIsWrapped = objIsObj && hasOwnProperty2.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty2.call(other, "__wrapped__"); if (objIsWrapped || othIsWrapped) { var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other; - stack2 || (stack2 = new Stack()); + stack2 || (stack2 = new Stack2()); return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack2); } } if (!isSameTag) { return false; } - stack2 || (stack2 = new Stack()); + stack2 || (stack2 = new Stack2()); return equalObjects(object, other, bitmask, customizer, equalFunc, stack2); } __name(baseIsEqualDeep, "baseIsEqualDeep"); - function baseIsMap(value4) { - return isObjectLike2(value4) && getTag2(value4) == mapTag; + function baseIsMap2(value4) { + return isObjectLike2(value4) && getTag2(value4) == mapTag2; } - __name(baseIsMap, "baseIsMap"); + __name(baseIsMap2, "baseIsMap"); function baseIsMatch(object, source, matchData, customizer) { var index2 = matchData.length, length = index2, noCustomizer = !customizer; if (object == null) { @@ -107988,20 +134368,20 @@ var lodash = lodash$1.exports; } object = Object2(object); while (index2--) { - var data24 = matchData[index2]; - if (noCustomizer && data24[2] ? data24[1] !== object[data24[0]] : !(data24[0] in object)) { + var data25 = matchData[index2]; + if (noCustomizer && data25[2] ? data25[1] !== object[data25[0]] : !(data25[0] in object)) { return false; } } while (++index2 < length) { - data24 = matchData[index2]; - var key = data24[0], objValue = object[key], srcValue = data24[1]; - if (noCustomizer && data24[2]) { + data25 = matchData[index2]; + var key = data25[0], objValue = object[key], srcValue = data25[1]; + if (noCustomizer && data25[2]) { if (objValue === undefined$1 && !(key in object)) { return false; } } else { - var stack2 = new Stack(); + var stack2 = new Stack2(); if (customizer) { var result2 = customizer(objValue, srcValue, key, object, source, stack2); } @@ -108013,26 +134393,26 @@ var lodash = lodash$1.exports; return true; } __name(baseIsMatch, "baseIsMatch"); - function baseIsNative(value4) { - if (!isObject2(value4) || isMasked(value4)) { + function baseIsNative2(value4) { + if (!isObject2(value4) || isMasked2(value4)) { return false; } - var pattern = isFunction2(value4) ? reIsNative : reIsHostCtor; - return pattern.test(toSource(value4)); + var pattern = isFunction2(value4) ? reIsNative2 : reIsHostCtor2; + return pattern.test(toSource2(value4)); } - __name(baseIsNative, "baseIsNative"); + __name(baseIsNative2, "baseIsNative"); function baseIsRegExp(value4) { - return isObjectLike2(value4) && baseGetTag(value4) == regexpTag; + return isObjectLike2(value4) && baseGetTag2(value4) == regexpTag2; } __name(baseIsRegExp, "baseIsRegExp"); - function baseIsSet(value4) { - return isObjectLike2(value4) && getTag2(value4) == setTag; + function baseIsSet2(value4) { + return isObjectLike2(value4) && getTag2(value4) == setTag2; } - __name(baseIsSet, "baseIsSet"); - function baseIsTypedArray(value4) { - return isObjectLike2(value4) && isLength(value4.length) && !!typedArrayTags[baseGetTag(value4)]; + __name(baseIsSet2, "baseIsSet"); + function baseIsTypedArray2(value4) { + return isObjectLike2(value4) && isLength2(value4.length) && !!typedArrayTags2[baseGetTag2(value4)]; } - __name(baseIsTypedArray, "baseIsTypedArray"); + __name(baseIsTypedArray2, "baseIsTypedArray"); function baseIteratee(value4) { if (typeof value4 == "function") { return value4; @@ -108046,9 +134426,9 @@ var lodash = lodash$1.exports; return property(value4); } __name(baseIteratee, "baseIteratee"); - function baseKeys(object) { - if (!isPrototype(object)) { - return nativeKeys(object); + function baseKeys2(object) { + if (!isPrototype2(object)) { + return nativeKeys2(object); } var result2 = []; for (var key in Object2(object)) { @@ -108058,12 +134438,12 @@ var lodash = lodash$1.exports; } return result2; } - __name(baseKeys, "baseKeys"); - function baseKeysIn(object) { + __name(baseKeys2, "baseKeys"); + function baseKeysIn2(object) { if (!isObject2(object)) { - return nativeKeysIn(object); + return nativeKeysIn2(object); } - var isProto = isPrototype(object), result2 = []; + var isProto = isPrototype2(object), result2 = []; for (var key in object) { if (!(key == "constructor" && (isProto || !hasOwnProperty2.call(object, key)))) { result2.push(key); @@ -108071,13 +134451,13 @@ var lodash = lodash$1.exports; } return result2; } - __name(baseKeysIn, "baseKeysIn"); + __name(baseKeysIn2, "baseKeysIn"); function baseLt(value4, other) { return value4 < other; } __name(baseLt, "baseLt"); function baseMap(collection, iteratee2) { - var index2 = -1, result2 = isArrayLike(collection) ? Array2(collection.length) : []; + var index2 = -1, result2 = isArrayLike2(collection) ? Array2(collection.length) : []; baseEach(collection, function(value4, key, collection2) { result2[++index2] = iteratee2(value4, key, collection2); }); @@ -108109,7 +134489,7 @@ var lodash = lodash$1.exports; return; } baseFor(source, function(srcValue, key) { - stack2 || (stack2 = new Stack()); + stack2 || (stack2 = new Stack2()); if (isObject2(srcValue)) { baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack2); } else { @@ -108119,7 +134499,7 @@ var lodash = lodash$1.exports; } assignMergeValue(object, key, newValue2); } - }, keysIn); + }, keysIn2); } __name(baseMerge, "baseMerge"); function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack2) { @@ -108137,22 +134517,22 @@ var lodash = lodash$1.exports; if (isArray2(objValue)) { newValue2 = objValue; } else if (isArrayLikeObject(objValue)) { - newValue2 = copyArray(objValue); + newValue2 = copyArray2(objValue); } else if (isBuff) { isCommon = false; - newValue2 = cloneBuffer(srcValue, true); + newValue2 = cloneBuffer2(srcValue, true); } else if (isTyped) { isCommon = false; - newValue2 = cloneTypedArray(srcValue, true); + newValue2 = cloneTypedArray2(srcValue, true); } else { newValue2 = []; } - } else if (isPlainObject2(srcValue) || isArguments(srcValue)) { + } else if (isPlainObject2(srcValue) || isArguments2(srcValue)) { newValue2 = objValue; - if (isArguments(objValue)) { + if (isArguments2(objValue)) { newValue2 = toPlainObject(objValue); } else if (!isObject2(objValue) || isFunction2(objValue)) { - newValue2 = initCloneObject(srcValue); + newValue2 = initCloneObject2(srcValue); } } else { isCommon = false; @@ -108166,13 +134546,13 @@ var lodash = lodash$1.exports; assignMergeValue(object, key, newValue2); } __name(baseMergeDeep, "baseMergeDeep"); - function baseNth(array, n) { + function baseNth(array, n2) { var length = array.length; if (!length) { return; } - n += n < 0 ? length : 0; - return isIndex(n, length) ? array[n] : undefined$1; + n2 += n2 < 0 ? length : 0; + return isIndex2(n2, length) ? array[n2] : undefined$1; } __name(baseNth, "baseNth"); function baseOrderBy(collection, iteratees, orders) { @@ -108189,7 +134569,7 @@ var lodash = lodash$1.exports; iteratees = [identity2]; } var index2 = -1; - iteratees = arrayMap(iteratees, baseUnary(getIteratee())); + iteratees = arrayMap(iteratees, baseUnary2(getIteratee())); var result2 = baseMap(collection, function(value4, key, collection2) { var criteria = arrayMap(iteratees, function(iteratee2) { return iteratee2(value4); @@ -108227,18 +134607,18 @@ var lodash = lodash$1.exports; function basePullAll(array, values2, iteratee2, comparator2) { var indexOf2 = comparator2 ? baseIndexOfWith : baseIndexOf, index2 = -1, length = values2.length, seen2 = array; if (array === values2) { - values2 = copyArray(values2); + values2 = copyArray2(values2); } if (iteratee2) { - seen2 = arrayMap(array, baseUnary(iteratee2)); + seen2 = arrayMap(array, baseUnary2(iteratee2)); } while (++index2 < length) { var fromIndex = 0, value4 = values2[index2], computed2 = iteratee2 ? iteratee2(value4) : value4; while ((fromIndex = indexOf2(seen2, computed2, fromIndex, comparator2)) > -1) { if (seen2 !== array) { - splice.call(seen2, fromIndex, 1); + splice2.call(seen2, fromIndex, 1); } - splice.call(array, fromIndex, 1); + splice2.call(array, fromIndex, 1); } } return array; @@ -108250,8 +134630,8 @@ var lodash = lodash$1.exports; var index2 = indexes[length]; if (length == lastIndex2 || index2 !== previous) { var previous = index2; - if (isIndex(index2)) { - splice.call(array, index2, 1); + if (isIndex2(index2)) { + splice2.call(array, index2, 1); } else { baseUnset(array, index2); } @@ -108273,20 +134653,20 @@ var lodash = lodash$1.exports; return result2; } __name(baseRange, "baseRange"); - function baseRepeat(string, n) { + function baseRepeat(string, n2) { var result2 = ""; - if (!string || n < 1 || n > MAX_SAFE_INTEGER) { + if (!string || n2 < 1 || n2 > MAX_SAFE_INTEGER2) { return result2; } do { - if (n % 2) { + if (n2 % 2) { result2 += string; } - n = nativeFloor(n / 2); - if (n) { + n2 = nativeFloor(n2 / 2); + if (n2) { string += string; } - } while (n); + } while (n2); return result2; } __name(baseRepeat, "baseRepeat"); @@ -108298,9 +134678,9 @@ var lodash = lodash$1.exports; return arraySample(values(collection)); } __name(baseSample, "baseSample"); - function baseSampleSize(collection, n) { + function baseSampleSize(collection, n2) { var array = values(collection); - return shuffleSelf(array, baseClamp(n, 0, array.length)); + return shuffleSelf(array, baseClamp(n2, 0, array.length)); } __name(baseSampleSize, "baseSampleSize"); function baseSet(object, path, value4, customizer) { @@ -108318,21 +134698,21 @@ var lodash = lodash$1.exports; var objValue = nested[key]; newValue2 = customizer ? customizer(objValue, key, nested) : undefined$1; if (newValue2 === undefined$1) { - newValue2 = isObject2(objValue) ? objValue : isIndex(path[index2 + 1]) ? [] : {}; + newValue2 = isObject2(objValue) ? objValue : isIndex2(path[index2 + 1]) ? [] : {}; } } - assignValue(nested, key, newValue2); + assignValue2(nested, key, newValue2); nested = nested[key]; } return object; } __name(baseSet, "baseSet"); - var baseSetData = !metaMap ? identity2 : function(func, data24) { - metaMap.set(func, data24); + var baseSetData = !metaMap ? identity2 : function(func, data25) { + metaMap.set(func, data25); return func; }; - var baseSetToString = !defineProperty ? identity2 : function(func, string) { - return defineProperty(func, "toString", { + var baseSetToString = !defineProperty2 ? identity2 : function(func, string) { + return defineProperty2(func, "toString", { "configurable": true, "enumerable": false, "value": constant(string), @@ -108421,7 +134801,7 @@ var lodash = lodash$1.exports; var index2 = -1, length = array.length, resIndex = 0, result2 = []; while (++index2 < length) { var value4 = array[index2], computed2 = iteratee2 ? iteratee2(value4) : value4; - if (!index2 || !eq(computed2, seen2)) { + if (!index2 || !eq2(computed2, seen2)) { var seen2 = computed2; result2[resIndex++] = value4 === 0 ? 0 : value4; } @@ -108458,7 +134838,7 @@ var lodash = lodash$1.exports; if (comparator2) { isCommon = false; includes2 = arrayIncludesWith; - } else if (length >= LARGE_ARRAY_SIZE) { + } else if (length >= LARGE_ARRAY_SIZE2) { var set4 = iteratee2 ? null : createSet(array); if (set4) { return setToArray(set4); @@ -108517,7 +134897,7 @@ var lodash = lodash$1.exports; result2 = result2.value(); } return arrayReduce(actions, function(result3, action) { - return action.func.apply(action.thisArg, arrayPush([result3], action.args)); + return action.func.apply(action.thisArg, arrayPush2([result3], action.args)); }, result2); } __name(baseWrapperValue, "baseWrapperValue"); @@ -108570,9 +134950,9 @@ var lodash = lodash$1.exports; } __name(castSlice, "castSlice"); var clearTimeout2 = ctxClearTimeout || function(id3) { - return root24.clearTimeout(id3); + return root27.clearTimeout(id3); }; - function cloneBuffer(buffer2, isDeep) { + function cloneBuffer2(buffer2, isDeep) { if (isDeep) { return buffer2.slice(); } @@ -108580,33 +134960,33 @@ var lodash = lodash$1.exports; buffer2.copy(result2); return result2; } - __name(cloneBuffer, "cloneBuffer"); - function cloneArrayBuffer(arrayBuffer) { + __name(cloneBuffer2, "cloneBuffer"); + function cloneArrayBuffer2(arrayBuffer) { var result2 = new arrayBuffer.constructor(arrayBuffer.byteLength); new Uint8Array2(result2).set(new Uint8Array2(arrayBuffer)); return result2; } - __name(cloneArrayBuffer, "cloneArrayBuffer"); - function cloneDataView(dataView, isDeep) { - var buffer2 = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; + __name(cloneArrayBuffer2, "cloneArrayBuffer"); + function cloneDataView2(dataView, isDeep) { + var buffer2 = isDeep ? cloneArrayBuffer2(dataView.buffer) : dataView.buffer; return new dataView.constructor(buffer2, dataView.byteOffset, dataView.byteLength); } - __name(cloneDataView, "cloneDataView"); + __name(cloneDataView2, "cloneDataView"); function cloneRegExp2(regexp2) { - var result2 = new regexp2.constructor(regexp2.source, reFlags.exec(regexp2)); + var result2 = new regexp2.constructor(regexp2.source, reFlags2.exec(regexp2)); result2.lastIndex = regexp2.lastIndex; return result2; } __name(cloneRegExp2, "cloneRegExp"); - function cloneSymbol(symbol) { - return symbolValueOf ? Object2(symbolValueOf.call(symbol)) : {}; + function cloneSymbol2(symbol) { + return symbolValueOf2 ? Object2(symbolValueOf2.call(symbol)) : {}; } - __name(cloneSymbol, "cloneSymbol"); - function cloneTypedArray(typedArray, isDeep) { - var buffer2 = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; + __name(cloneSymbol2, "cloneSymbol"); + function cloneTypedArray2(typedArray, isDeep) { + var buffer2 = isDeep ? cloneArrayBuffer2(typedArray.buffer) : typedArray.buffer; return new typedArray.constructor(buffer2, typedArray.byteOffset, typedArray.length); } - __name(cloneTypedArray, "cloneTypedArray"); + __name(cloneTypedArray2, "cloneTypedArray"); function compareAscending(value4, other) { if (value4 !== other) { var valIsDefined = value4 !== undefined$1, valIsNull = value4 === null, valIsReflexive = value4 === value4, valIsSymbol = isSymbol2(value4); @@ -108669,7 +135049,7 @@ var lodash = lodash$1.exports; return result2; } __name(composeArgsRight, "composeArgsRight"); - function copyArray(source, array) { + function copyArray2(source, array) { var index2 = -1, length = source.length; array || (array = Array2(length)); while (++index2 < length) { @@ -108677,8 +135057,8 @@ var lodash = lodash$1.exports; } return array; } - __name(copyArray, "copyArray"); - function copyObject(source, props, object, customizer) { + __name(copyArray2, "copyArray"); + function copyObject2(source, props, object, customizer) { var isNew = !object; object || (object = {}); var index2 = -1, length = props.length; @@ -108689,22 +135069,22 @@ var lodash = lodash$1.exports; newValue2 = source[key]; } if (isNew) { - baseAssignValue(object, key, newValue2); + baseAssignValue2(object, key, newValue2); } else { - assignValue(object, key, newValue2); + assignValue2(object, key, newValue2); } } return object; } - __name(copyObject, "copyObject"); - function copySymbols(source, object) { - return copyObject(source, getSymbols(source), object); + __name(copyObject2, "copyObject"); + function copySymbols2(source, object) { + return copyObject2(source, getSymbols2(source), object); } - __name(copySymbols, "copySymbols"); - function copySymbolsIn(source, object) { - return copyObject(source, getSymbolsIn(source), object); + __name(copySymbols2, "copySymbols"); + function copySymbolsIn2(source, object) { + return copyObject2(source, getSymbolsIn2(source), object); } - __name(copySymbolsIn, "copySymbolsIn"); + __name(copySymbolsIn2, "copySymbolsIn"); function createAggregator(setter, initializer) { return function(collection, iteratee2) { var func = isArray2(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {}; @@ -108736,7 +135116,7 @@ var lodash = lodash$1.exports; if (collection == null) { return collection; } - if (!isArrayLike(collection)) { + if (!isArrayLike2(collection)) { return eachFunc(collection, iteratee2); } var length = collection.length, index2 = fromRight ? length : -1, iterable = Object2(collection); @@ -108765,7 +135145,7 @@ var lodash = lodash$1.exports; function createBind(func, bitmask, thisArg) { var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func); function wrapper() { - var fn = this && this !== root24 && this instanceof wrapper ? Ctor : func; + var fn = this && this !== root27 && this instanceof wrapper ? Ctor : func; return fn.apply(isBind ? thisArg : this, arguments); } __name(wrapper, "wrapper"); @@ -108809,7 +135189,7 @@ var lodash = lodash$1.exports; case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); } - var thisBinding = baseCreate(Ctor.prototype), result2 = Ctor.apply(thisBinding, args); + var thisBinding = baseCreate2(Ctor.prototype), result2 = Ctor.apply(thisBinding, args); return isObject2(result2) ? result2 : thisBinding; }; } @@ -108837,7 +135217,7 @@ var lodash = lodash$1.exports; arity - length ); } - var fn = this && this !== root24 && this instanceof wrapper ? Ctor : func; + var fn = this && this !== root27 && this instanceof wrapper ? Ctor : func; return apply2(fn, this, args); } __name(wrapper, "wrapper"); @@ -108847,7 +135227,7 @@ var lodash = lodash$1.exports; function createFind(findIndexFunc) { return function(collection, predicate, fromIndex) { var iterable = Object2(collection); - if (!isArrayLike(collection)) { + if (!isArrayLike2(collection)) { var iteratee2 = getIteratee(predicate, 3); collection = keys2(collection); predicate = /* @__PURE__ */ __name(function(key) { @@ -108877,9 +135257,9 @@ var lodash = lodash$1.exports; index2 = wrapper ? index2 : length; while (++index2 < length) { func = funcs[index2]; - var funcName = getFuncName(func), data24 = funcName == "wrapper" ? getData(func) : undefined$1; - if (data24 && isLaziable(data24[0]) && data24[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && !data24[4].length && data24[9] == 1) { - wrapper = wrapper[getFuncName(data24[0])].apply(wrapper, data24[3]); + var funcName = getFuncName(func), data25 = funcName == "wrapper" ? getData(func) : undefined$1; + if (data25 && isLaziable(data25[0]) && data25[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && !data25[4].length && data25[9] == 1) { + wrapper = wrapper[getFuncName(data25[0])].apply(wrapper, data25[3]); } else { wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func); } @@ -108940,7 +135320,7 @@ var lodash = lodash$1.exports; if (isAry && ary2 < length) { args.length = ary2; } - if (this && this !== root24 && this instanceof wrapper) { + if (this && this !== root27 && this instanceof wrapper) { fn = Ctor || createCtor(fn); } return fn.apply(thisBinding, args); @@ -108983,7 +135363,7 @@ var lodash = lodash$1.exports; __name(createMathOperation, "createMathOperation"); function createOver(arrayFunc) { return flatRest(function(iteratees) { - iteratees = arrayMap(iteratees, baseUnary(getIteratee())); + iteratees = arrayMap(iteratees, baseUnary2(getIteratee())); return baseRest(function(args) { var thisArg = this; return arrayFunc(iteratees, function(iteratee2) { @@ -108993,20 +135373,20 @@ var lodash = lodash$1.exports; }); } __name(createOver, "createOver"); - function createPadding(length, chars) { - chars = chars === undefined$1 ? " " : baseToString2(chars); - var charsLength = chars.length; + function createPadding(length, chars2) { + chars2 = chars2 === undefined$1 ? " " : baseToString2(chars2); + var charsLength = chars2.length; if (charsLength < 2) { - return charsLength ? baseRepeat(chars, length) : chars; + return charsLength ? baseRepeat(chars2, length) : chars2; } - var result2 = baseRepeat(chars, nativeCeil(length / stringSize(chars))); - return hasUnicode(chars) ? castSlice(stringToArray2(result2), 0, length).join("") : result2.slice(0, length); + var result2 = baseRepeat(chars2, nativeCeil(length / stringSize(chars2))); + return hasUnicode(chars2) ? castSlice(stringToArray2(result2), 0, length).join("") : result2.slice(0, length); } __name(createPadding, "createPadding"); function createPartial(func, bitmask, thisArg, partials) { var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func); function wrapper() { - var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array2(leftLength + argsLength), fn = this && this !== root24 && this instanceof wrapper ? Ctor : func; + var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array2(leftLength + argsLength), fn = this && this !== root27 && this instanceof wrapper ? Ctor : func; while (++leftIndex < leftLength) { args[leftIndex] = partials[leftIndex]; } @@ -109093,10 +135473,10 @@ var lodash = lodash$1.exports; function createToPairs(keysFunc) { return function(object) { var tag = getTag2(object); - if (tag == mapTag) { + if (tag == mapTag2) { return mapToArray(object); } - if (tag == setTag) { + if (tag == setTag2) { return setToPairs(object); } return baseToPairs(object, keysFunc(object)); @@ -109120,7 +135500,7 @@ var lodash = lodash$1.exports; var partialsRight = partials, holdersRight = holders; partials = holders = undefined$1; } - var data24 = isBindKey ? undefined$1 : getData(func); + var data25 = isBindKey ? undefined$1 : getData(func); var newData = [ func, bitmask, @@ -109133,8 +135513,8 @@ var lodash = lodash$1.exports; ary2, arity ]; - if (data24) { - mergeData(newData, data24); + if (data25) { + mergeData(newData, data25); } func = newData[0]; bitmask = newData[1]; @@ -109154,12 +135534,12 @@ var lodash = lodash$1.exports; } else { result2 = createHybrid.apply(undefined$1, newData); } - var setter = data24 ? baseSetData : setData; + var setter = data25 ? baseSetData : setData; return setWrapToString(setter(result2, newData), func, bitmask); } __name(createWrap, "createWrap"); function customDefaultsAssignIn(objValue, srcValue, key, object) { - if (objValue === undefined$1 || eq(objValue, objectProto[key]) && !hasOwnProperty2.call(object, key)) { + if (objValue === undefined$1 || eq2(objValue, objectProto2[key]) && !hasOwnProperty2.call(object, key)) { return srcValue; } return objValue; @@ -109224,29 +135604,29 @@ var lodash = lodash$1.exports; __name(equalArrays, "equalArrays"); function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack2) { switch (tag) { - case dataViewTag: + case dataViewTag2: if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) { return false; } object = object.buffer; other = other.buffer; - case arrayBufferTag: + case arrayBufferTag2: if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array2(object), new Uint8Array2(other))) { return false; } return true; - case boolTag: - case dateTag: - case numberTag: - return eq(+object, +other); - case errorTag: + case boolTag2: + case dateTag2: + case numberTag2: + return eq2(+object, +other); + case errorTag2: return object.name == other.name && object.message == other.message; - case regexpTag: - case stringTag: + case regexpTag2: + case stringTag2: return object == other + ""; - case mapTag: + case mapTag2: var convert = mapToArray; - case setTag: + case setTag2: var isPartial = bitmask & COMPARE_PARTIAL_FLAG; convert || (convert = setToArray); if (object.size != other.size && !isPartial) { @@ -109261,16 +135641,16 @@ var lodash = lodash$1.exports; var result2 = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack2); stack2["delete"](object); return result2; - case symbolTag: - if (symbolValueOf) { - return symbolValueOf.call(object) == symbolValueOf.call(other); + case symbolTag2: + if (symbolValueOf2) { + return symbolValueOf2.call(object) == symbolValueOf2.call(other); } } return false; } __name(equalByTag, "equalByTag"); function equalObjects(object, other, bitmask, customizer, equalFunc, stack2) { - var isPartial = bitmask & COMPARE_PARTIAL_FLAG, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length; + var isPartial = bitmask & COMPARE_PARTIAL_FLAG, objProps = getAllKeys2(object), objLength = objProps.length, othProps = getAllKeys2(other), othLength = othProps.length; if (objLength != othLength && !isPartial) { return false; } @@ -109314,26 +135694,26 @@ var lodash = lodash$1.exports; } __name(equalObjects, "equalObjects"); function flatRest(func) { - return setToString(overRest(func, undefined$1, flatten), func + ""); + return setToString(overRest(func, undefined$1, flatten2), func + ""); } __name(flatRest, "flatRest"); - function getAllKeys(object) { - return baseGetAllKeys(object, keys2, getSymbols); + function getAllKeys2(object) { + return baseGetAllKeys2(object, keys2, getSymbols2); } - __name(getAllKeys, "getAllKeys"); - function getAllKeysIn(object) { - return baseGetAllKeys(object, keysIn, getSymbolsIn); + __name(getAllKeys2, "getAllKeys"); + function getAllKeysIn2(object) { + return baseGetAllKeys2(object, keysIn2, getSymbolsIn2); } - __name(getAllKeysIn, "getAllKeysIn"); + __name(getAllKeysIn2, "getAllKeysIn"); var getData = !metaMap ? noop2 : function(func) { return metaMap.get(func); }; function getFuncName(func) { var result2 = func.name + "", array = realNames[result2], length = hasOwnProperty2.call(realNames, result2) ? array.length : 0; while (length--) { - var data24 = array[length], otherFunc = data24.func; + var data25 = array[length], otherFunc = data25.func; if (otherFunc == null || otherFunc == func) { - return data24.name; + return data25.name; } } return result2; @@ -109350,11 +135730,11 @@ var lodash = lodash$1.exports; return arguments.length ? result2(arguments[0], arguments[1]) : result2; } __name(getIteratee, "getIteratee"); - function getMapData(map4, key) { - var data24 = map4.__data__; - return isKeyable(key) ? data24[typeof key == "string" ? "string" : "hash"] : data24.map; + function getMapData2(map4, key) { + var data25 = map4.__data__; + return isKeyable2(key) ? data25[typeof key == "string" ? "string" : "hash"] : data25.map; } - __name(getMapData, "getMapData"); + __name(getMapData2, "getMapData"); function getMatchData(object) { var result2 = keys2(object), length = result2.length; while (length--) { @@ -109364,62 +135744,62 @@ var lodash = lodash$1.exports; return result2; } __name(getMatchData, "getMatchData"); - function getNative(object, key) { + function getNative2(object, key) { var value4 = getValue2(object, key); - return baseIsNative(value4) ? value4 : undefined$1; + return baseIsNative2(value4) ? value4 : undefined$1; } - __name(getNative, "getNative"); - function getRawTag(value4) { - var isOwn = hasOwnProperty2.call(value4, symToStringTag), tag = value4[symToStringTag]; + __name(getNative2, "getNative"); + function getRawTag2(value4) { + var isOwn = hasOwnProperty2.call(value4, symToStringTag2), tag = value4[symToStringTag2]; try { - value4[symToStringTag] = undefined$1; + value4[symToStringTag2] = undefined$1; var unmasked = true; } catch (e2) { } - var result2 = nativeObjectToString.call(value4); + var result2 = nativeObjectToString2.call(value4); if (unmasked) { if (isOwn) { - value4[symToStringTag] = tag; + value4[symToStringTag2] = tag; } else { - delete value4[symToStringTag]; + delete value4[symToStringTag2]; } } return result2; } - __name(getRawTag, "getRawTag"); - var getSymbols = !nativeGetSymbols ? stubArray : function(object) { + __name(getRawTag2, "getRawTag"); + var getSymbols2 = !nativeGetSymbols2 ? stubArray2 : function(object) { if (object == null) { return []; } object = Object2(object); - return arrayFilter(nativeGetSymbols(object), function(symbol) { - return propertyIsEnumerable.call(object, symbol); + return arrayFilter2(nativeGetSymbols2(object), function(symbol) { + return propertyIsEnumerable2.call(object, symbol); }); }; - var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) { + var getSymbolsIn2 = !nativeGetSymbols2 ? stubArray2 : function(object) { var result2 = []; while (object) { - arrayPush(result2, getSymbols(object)); - object = getPrototype(object); + arrayPush2(result2, getSymbols2(object)); + object = getPrototype2(object); } return result2; }; - var getTag2 = baseGetTag; - if (DataView2 && getTag2(new DataView2(new ArrayBuffer(1))) != dataViewTag || Map2 && getTag2(new Map2()) != mapTag || Promise2 && getTag2(Promise2.resolve()) != promiseTag || Set2 && getTag2(new Set2()) != setTag || WeakMap2 && getTag2(new WeakMap2()) != weakMapTag) { + var getTag2 = baseGetTag2; + if (DataView2 && getTag2(new DataView2(new ArrayBuffer(1))) != dataViewTag2 || Map2 && getTag2(new Map2()) != mapTag2 || Promise2 && getTag2(Promise2.resolve()) != promiseTag2 || Set2 && getTag2(new Set2()) != setTag2 || WeakMap2 && getTag2(new WeakMap2()) != weakMapTag2) { getTag2 = /* @__PURE__ */ __name(function(value4) { - var result2 = baseGetTag(value4), Ctor = result2 == objectTag ? value4.constructor : undefined$1, ctorString = Ctor ? toSource(Ctor) : ""; + var result2 = baseGetTag2(value4), Ctor = result2 == objectTag2 ? value4.constructor : undefined$1, ctorString = Ctor ? toSource2(Ctor) : ""; if (ctorString) { switch (ctorString) { - case dataViewCtorString: - return dataViewTag; - case mapCtorString: - return mapTag; - case promiseCtorString: - return promiseTag; - case setCtorString: - return setTag; - case weakMapCtorString: - return weakMapTag; + case dataViewCtorString2: + return dataViewTag2; + case mapCtorString2: + return mapTag2; + case promiseCtorString2: + return promiseTag2; + case setCtorString2: + return setTag2; + case weakMapCtorString2: + return weakMapTag2; } } return result2; @@ -109428,8 +135808,8 @@ var lodash = lodash$1.exports; function getView(start2, end, transforms) { var index2 = -1, length = transforms.length; while (++index2 < length) { - var data24 = transforms[index2], size3 = data24.size; - switch (data24.type) { + var data25 = transforms[index2], size3 = data25.size; + switch (data25.type) { case "drop": start2 += size3; break; @@ -109466,10 +135846,10 @@ var lodash = lodash$1.exports; return result2; } length = object == null ? 0 : object.length; - return !!length && isLength(length) && isIndex(key, length) && (isArray2(object) || isArguments(object)); + return !!length && isLength2(length) && isIndex2(key, length) && (isArray2(object) || isArguments2(object)); } __name(hasPath, "hasPath"); - function initCloneArray(array) { + function initCloneArray2(array) { var length = array.length, result2 = new array.constructor(length); if (length && typeof array[0] == "string" && hasOwnProperty2.call(array, "index")) { result2.index = array.index; @@ -109477,45 +135857,45 @@ var lodash = lodash$1.exports; } return result2; } - __name(initCloneArray, "initCloneArray"); - function initCloneObject(object) { - return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {}; + __name(initCloneArray2, "initCloneArray"); + function initCloneObject2(object) { + return typeof object.constructor == "function" && !isPrototype2(object) ? baseCreate2(getPrototype2(object)) : {}; } - __name(initCloneObject, "initCloneObject"); - function initCloneByTag(object, tag, isDeep) { + __name(initCloneObject2, "initCloneObject"); + function initCloneByTag2(object, tag, isDeep) { var Ctor = object.constructor; switch (tag) { - case arrayBufferTag: - return cloneArrayBuffer(object); - case boolTag: - case dateTag: + case arrayBufferTag2: + return cloneArrayBuffer2(object); + case boolTag2: + case dateTag2: return new Ctor(+object); - case dataViewTag: - return cloneDataView(object, isDeep); - case float32Tag: - case float64Tag: - case int8Tag: - case int16Tag: - case int32Tag: - case uint8Tag: - case uint8ClampedTag: - case uint16Tag: - case uint32Tag: - return cloneTypedArray(object, isDeep); - case mapTag: + case dataViewTag2: + return cloneDataView2(object, isDeep); + case float32Tag2: + case float64Tag2: + case int8Tag2: + case int16Tag2: + case int32Tag2: + case uint8Tag2: + case uint8ClampedTag2: + case uint16Tag2: + case uint32Tag2: + return cloneTypedArray2(object, isDeep); + case mapTag2: return new Ctor(); - case numberTag: - case stringTag: + case numberTag2: + case stringTag2: return new Ctor(object); - case regexpTag: + case regexpTag2: return cloneRegExp2(object); - case setTag: + case setTag2: return new Ctor(); - case symbolTag: - return cloneSymbol(object); + case symbolTag2: + return cloneSymbol2(object); } } - __name(initCloneByTag, "initCloneByTag"); + __name(initCloneByTag2, "initCloneByTag"); function insertWrapDetails(source, details) { var length = details.length; if (!length) { @@ -109528,22 +135908,22 @@ var lodash = lodash$1.exports; } __name(insertWrapDetails, "insertWrapDetails"); function isFlattenable(value4) { - return isArray2(value4) || isArguments(value4) || !!(spreadableSymbol && value4 && value4[spreadableSymbol]); + return isArray2(value4) || isArguments2(value4) || !!(spreadableSymbol && value4 && value4[spreadableSymbol]); } __name(isFlattenable, "isFlattenable"); - function isIndex(value4, length) { + function isIndex2(value4, length) { var type = typeof value4; - length = length == null ? MAX_SAFE_INTEGER : length; - return !!length && (type == "number" || type != "symbol" && reIsUint.test(value4)) && (value4 > -1 && value4 % 1 == 0 && value4 < length); + length = length == null ? MAX_SAFE_INTEGER2 : length; + return !!length && (type == "number" || type != "symbol" && reIsUint2.test(value4)) && (value4 > -1 && value4 % 1 == 0 && value4 < length); } - __name(isIndex, "isIndex"); + __name(isIndex2, "isIndex"); function isIterateeCall(value4, index2, object) { if (!isObject2(object)) { return false; } var type = typeof index2; - if (type == "number" ? isArrayLike(object) && isIndex(index2, object.length) : type == "string" && index2 in object) { - return eq(object[index2], value4); + if (type == "number" ? isArrayLike2(object) && isIndex2(index2, object.length) : type == "string" && index2 in object) { + return eq2(object[index2], value4); } return false; } @@ -109559,11 +135939,11 @@ var lodash = lodash$1.exports; return reIsPlainProp.test(value4) || !reIsDeepProp.test(value4) || object != null && value4 in Object2(object); } __name(isKey, "isKey"); - function isKeyable(value4) { + function isKeyable2(value4) { var type = typeof value4; return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value4 !== "__proto__" : value4 === null; } - __name(isKeyable, "isKeyable"); + __name(isKeyable2, "isKeyable"); function isLaziable(func) { var funcName = getFuncName(func), other = lodash2[funcName]; if (typeof other != "function" || !(funcName in LazyWrapper.prototype)) { @@ -109572,20 +135952,20 @@ var lodash = lodash$1.exports; if (func === other) { return true; } - var data24 = getData(other); - return !!data24 && func === data24[0]; + var data25 = getData(other); + return !!data25 && func === data25[0]; } __name(isLaziable, "isLaziable"); - function isMasked(func) { - return !!maskSrcKey && maskSrcKey in func; + function isMasked2(func) { + return !!maskSrcKey2 && maskSrcKey2 in func; } - __name(isMasked, "isMasked"); - var isMaskable = coreJsData ? isFunction2 : stubFalse; - function isPrototype(value4) { - var Ctor = value4 && value4.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto; + __name(isMasked2, "isMasked"); + var isMaskable = coreJsData2 ? isFunction2 : stubFalse2; + function isPrototype2(value4) { + var Ctor = value4 && value4.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto2; return value4 === proto; } - __name(isPrototype, "isPrototype"); + __name(isPrototype2, "isPrototype"); function isStrictComparable(value4) { return value4 === value4 && !isObject2(value4); } @@ -109610,44 +135990,44 @@ var lodash = lodash$1.exports; return result2; } __name(memoizeCapped, "memoizeCapped"); - function mergeData(data24, source) { - var bitmask = data24[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); - var isCombo = srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_CURRY_FLAG || srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_REARG_FLAG && data24[7].length <= source[8] || srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG) && source[7].length <= source[8] && bitmask == WRAP_CURRY_FLAG; + function mergeData(data25, source) { + var bitmask = data25[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); + var isCombo = srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_CURRY_FLAG || srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_REARG_FLAG && data25[7].length <= source[8] || srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG) && source[7].length <= source[8] && bitmask == WRAP_CURRY_FLAG; if (!(isCommon || isCombo)) { - return data24; + return data25; } if (srcBitmask & WRAP_BIND_FLAG) { - data24[2] = source[2]; + data25[2] = source[2]; newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG; } var value4 = source[3]; if (value4) { - var partials = data24[3]; - data24[3] = partials ? composeArgs(partials, value4, source[4]) : value4; - data24[4] = partials ? replaceHolders(data24[3], PLACEHOLDER) : source[4]; + var partials = data25[3]; + data25[3] = partials ? composeArgs(partials, value4, source[4]) : value4; + data25[4] = partials ? replaceHolders(data25[3], PLACEHOLDER) : source[4]; } value4 = source[5]; if (value4) { - partials = data24[5]; - data24[5] = partials ? composeArgsRight(partials, value4, source[6]) : value4; - data24[6] = partials ? replaceHolders(data24[5], PLACEHOLDER) : source[6]; + partials = data25[5]; + data25[5] = partials ? composeArgsRight(partials, value4, source[6]) : value4; + data25[6] = partials ? replaceHolders(data25[5], PLACEHOLDER) : source[6]; } value4 = source[7]; if (value4) { - data24[7] = value4; + data25[7] = value4; } if (srcBitmask & WRAP_ARY_FLAG) { - data24[8] = data24[8] == null ? source[8] : nativeMin(data24[8], source[8]); + data25[8] = data25[8] == null ? source[8] : nativeMin(data25[8], source[8]); } - if (data24[9] == null) { - data24[9] = source[9]; + if (data25[9] == null) { + data25[9] = source[9]; } - data24[0] = source[0]; - data24[1] = newBitmask; - return data24; + data25[0] = source[0]; + data25[1] = newBitmask; + return data25; } __name(mergeData, "mergeData"); - function nativeKeysIn(object) { + function nativeKeysIn2(object) { var result2 = []; if (object != null) { for (var key in Object2(object)) { @@ -109656,9 +136036,9 @@ var lodash = lodash$1.exports; } return result2; } - __name(nativeKeysIn, "nativeKeysIn"); + __name(nativeKeysIn2, "nativeKeysIn"); function objectToString2(value4) { - return nativeObjectToString.call(value4); + return nativeObjectToString2.call(value4); } __name(objectToString2, "objectToString"); function overRest(func, start2, transform3) { @@ -109683,10 +136063,10 @@ var lodash = lodash$1.exports; } __name(parent, "parent"); function reorder(array, indexes) { - var arrLength = array.length, length = nativeMin(indexes.length, arrLength), oldArray = copyArray(array); + var arrLength = array.length, length = nativeMin(indexes.length, arrLength), oldArray = copyArray2(array); while (length--) { var index2 = indexes[length]; - array[length] = isIndex(index2, arrLength) ? oldArray[index2] : undefined$1; + array[length] = isIndex2(index2, arrLength) ? oldArray[index2] : undefined$1; } return array; } @@ -109703,7 +136083,7 @@ var lodash = lodash$1.exports; __name(safeGet, "safeGet"); var setData = shortOut(baseSetData); var setTimeout2 = ctxSetTimeout || function(func, wait) { - return root24.setTimeout(func, wait); + return root27.setTimeout(func, wait); }; var setToString = shortOut(baseSetToString); function setWrapToString(wrapper, reference2, bitmask) { @@ -109757,10 +136137,10 @@ var lodash = lodash$1.exports; return result2 == "0" && 1 / value4 == -INFINITY2 ? "-0" : result2; } __name(toKey, "toKey"); - function toSource(func) { + function toSource2(func) { if (func != null) { try { - return funcToString.call(func); + return funcToString2.call(func); } catch (e2) { } try { @@ -109770,9 +136150,9 @@ var lodash = lodash$1.exports; } return ""; } - __name(toSource, "toSource"); + __name(toSource2, "toSource"); function updateWrapDetails(details, bitmask) { - arrayEach(wrapFlags, function(pair) { + arrayEach2(wrapFlags, function(pair) { var value4 = "_." + pair[0]; if (bitmask & pair[1] && !arrayIncludes(details, value4)) { details.push(value4); @@ -109786,7 +136166,7 @@ var lodash = lodash$1.exports; return wrapper.clone(); } var result2 = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__); - result2.__actions__ = copyArray(wrapper.__actions__); + result2.__actions__ = copyArray2(wrapper.__actions__); result2.__index__ = wrapper.__index__; result2.__values__ = wrapper.__values__; return result2; @@ -109829,7 +136209,7 @@ var lodash = lodash$1.exports; while (index2--) { args[index2 - 1] = arguments[index2]; } - return arrayPush(isArray2(array) ? copyArray(array) : [array], baseFlatten(args, 1)); + return arrayPush2(isArray2(array) ? copyArray2(array) : [array], baseFlatten(args, 1)); } __name(concat, "concat"); var difference = baseRest(function(array, values2) { @@ -109849,23 +136229,23 @@ var lodash = lodash$1.exports; } return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values2, 1, isArrayLikeObject, true), undefined$1, comparator2) : []; }); - function drop(array, n, guard) { + function drop(array, n2, guard) { var length = array == null ? 0 : array.length; if (!length) { return []; } - n = guard || n === undefined$1 ? 1 : toInteger(n); - return baseSlice(array, n < 0 ? 0 : n, length); + n2 = guard || n2 === undefined$1 ? 1 : toInteger(n2); + return baseSlice(array, n2 < 0 ? 0 : n2, length); } __name(drop, "drop"); - function dropRight(array, n, guard) { + function dropRight(array, n2, guard) { var length = array == null ? 0 : array.length; if (!length) { return []; } - n = guard || n === undefined$1 ? 1 : toInteger(n); - n = length - n; - return baseSlice(array, 0, n < 0 ? 0 : n); + n2 = guard || n2 === undefined$1 ? 1 : toInteger(n2); + n2 = length - n2; + return baseSlice(array, 0, n2 < 0 ? 0 : n2); } __name(dropRight, "dropRight"); function dropRightWhile(array, predicate) { @@ -109876,7 +136256,7 @@ var lodash = lodash$1.exports; return array && array.length ? baseWhile(array, getIteratee(predicate, 3), true) : []; } __name(dropWhile, "dropWhile"); - function fill(array, value4, start2, end) { + function fill2(array, value4, start2, end) { var length = array == null ? 0 : array.length; if (!length) { return []; @@ -109887,7 +136267,7 @@ var lodash = lodash$1.exports; } return baseFill(array, value4, start2, end); } - __name(fill, "fill"); + __name(fill2, "fill"); function findIndex(array, predicate, fromIndex) { var length = array == null ? 0 : array.length; if (!length) { @@ -109913,11 +136293,11 @@ var lodash = lodash$1.exports; return baseFindIndex(array, getIteratee(predicate, 3), index2, true); } __name(findLastIndex2, "findLastIndex"); - function flatten(array) { + function flatten2(array) { var length = array == null ? 0 : array.length; return length ? baseFlatten(array, 1) : []; } - __name(flatten, "flatten"); + __name(flatten2, "flatten"); function flattenDeep(array) { var length = array == null ? 0 : array.length; return length ? baseFlatten(array, INFINITY2) : []; @@ -110005,8 +136385,8 @@ var lodash = lodash$1.exports; return value4 === value4 ? strictLastIndexOf(array, value4, index2) : baseFindIndex(array, baseIsNaN, index2, true); } __name(lastIndexOf, "lastIndexOf"); - function nth(array, n) { - return array && array.length ? baseNth(array, toInteger(n)) : undefined$1; + function nth(array, n2) { + return array && array.length ? baseNth(array, toInteger(n2)) : undefined$1; } __name(nth, "nth"); var pull = baseRest(pullAll); @@ -110025,7 +136405,7 @@ var lodash = lodash$1.exports; var pullAt = flatRest(function(array, indexes) { var length = array == null ? 0 : array.length, result2 = baseAt(array, indexes); basePullAt(array, arrayMap(indexes, function(index2) { - return isIndex(index2, length) ? +index2 : index2; + return isIndex2(index2, length) ? +index2 : index2; }).sort(compareAscending)); return result2; }); @@ -110078,7 +136458,7 @@ var lodash = lodash$1.exports; var length = array == null ? 0 : array.length; if (length) { var index2 = baseSortedIndex(array, value4); - if (index2 < length && eq(array[index2], value4)) { + if (index2 < length && eq2(array[index2], value4)) { return index2; } } @@ -110097,7 +136477,7 @@ var lodash = lodash$1.exports; var length = array == null ? 0 : array.length; if (length) { var index2 = baseSortedIndex(array, value4, true) - 1; - if (eq(array[index2], value4)) { + if (eq2(array[index2], value4)) { return index2; } } @@ -110117,22 +136497,22 @@ var lodash = lodash$1.exports; return length ? baseSlice(array, 1, length) : []; } __name(tail, "tail"); - function take(array, n, guard) { + function take(array, n2, guard) { if (!(array && array.length)) { return []; } - n = guard || n === undefined$1 ? 1 : toInteger(n); - return baseSlice(array, 0, n < 0 ? 0 : n); + n2 = guard || n2 === undefined$1 ? 1 : toInteger(n2); + return baseSlice(array, 0, n2 < 0 ? 0 : n2); } __name(take, "take"); - function takeRight(array, n, guard) { + function takeRight(array, n2, guard) { var length = array == null ? 0 : array.length; if (!length) { return []; } - n = guard || n === undefined$1 ? 1 : toInteger(n); - n = length - n; - return baseSlice(array, n < 0 ? 0 : n, length); + n2 = guard || n2 === undefined$1 ? 1 : toInteger(n2); + n2 = length - n2; + return baseSlice(array, n2 < 0 ? 0 : n2, length); } __name(takeRight, "takeRight"); function takeRightWhile(array, predicate) { @@ -110176,13 +136556,13 @@ var lodash = lodash$1.exports; return []; } var length = 0; - array = arrayFilter(array, function(group) { + array = arrayFilter2(array, function(group) { if (isArrayLikeObject(group)) { length = nativeMax(group.length, length); return true; } }); - return baseTimes(length, function(index2) { + return baseTimes2(length, function(index2) { return arrayMap(array, baseProperty(index2)); }); } @@ -110204,23 +136584,23 @@ var lodash = lodash$1.exports; return isArrayLikeObject(array) ? baseDifference(array, values2) : []; }); var xor = baseRest(function(arrays) { - return baseXor(arrayFilter(arrays, isArrayLikeObject)); + return baseXor(arrayFilter2(arrays, isArrayLikeObject)); }); var xorBy = baseRest(function(arrays) { var iteratee2 = last(arrays); if (isArrayLikeObject(iteratee2)) { iteratee2 = undefined$1; } - return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee2, 2)); + return baseXor(arrayFilter2(arrays, isArrayLikeObject), getIteratee(iteratee2, 2)); }); var xorWith = baseRest(function(arrays) { var comparator2 = last(arrays); comparator2 = typeof comparator2 == "function" ? comparator2 : undefined$1; - return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined$1, comparator2); + return baseXor(arrayFilter2(arrays, isArrayLikeObject), undefined$1, comparator2); }); var zip = baseRest(unzip); function zipObject(props, values2) { - return baseZipObject(props || [], values2 || [], assignValue); + return baseZipObject(props || [], values2 || [], assignValue2); } __name(zipObject, "zipObject"); function zipObjectDeep(props, values2) { @@ -110251,7 +136631,7 @@ var lodash = lodash$1.exports; var length = paths.length, start2 = length ? paths[0] : 0, value4 = this.__wrapped__, interceptor = /* @__PURE__ */ __name(function(object) { return baseAt(object, paths); }, "interceptor"); - if (length > 1 || this.__actions__.length || !(value4 instanceof LazyWrapper) || !isIndex(start2)) { + if (length > 1 || this.__actions__.length || !(value4 instanceof LazyWrapper) || !isIndex2(start2)) { return this.thru(interceptor); } value4 = value4.slice(start2, +start2 + (length ? 1 : 0)); @@ -110331,7 +136711,7 @@ var lodash = lodash$1.exports; if (hasOwnProperty2.call(result2, key)) { ++result2[key]; } else { - baseAssignValue(result2, key, 1); + baseAssignValue2(result2, key, 1); } }); function every(collection, predicate, guard) { @@ -110343,7 +136723,7 @@ var lodash = lodash$1.exports; } __name(every, "every"); function filter4(collection, predicate) { - var func = isArray2(collection) ? arrayFilter : baseFilter; + var func = isArray2(collection) ? arrayFilter2 : baseFilter; return func(collection, getIteratee(predicate, 3)); } __name(filter4, "filter"); @@ -110363,7 +136743,7 @@ var lodash = lodash$1.exports; } __name(flatMapDepth, "flatMapDepth"); function forEach3(collection, iteratee2) { - var func = isArray2(collection) ? arrayEach : baseEach; + var func = isArray2(collection) ? arrayEach2 : baseEach; return func(collection, getIteratee(iteratee2, 3)); } __name(forEach3, "forEach"); @@ -110376,11 +136756,11 @@ var lodash = lodash$1.exports; if (hasOwnProperty2.call(result2, key)) { result2[key].push(value4); } else { - baseAssignValue(result2, key, [value4]); + baseAssignValue2(result2, key, [value4]); } }); function includes(collection, value4, fromIndex, guard) { - collection = isArrayLike(collection) ? collection : values(collection); + collection = isArrayLike2(collection) ? collection : values(collection); fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0; var length = collection.length; if (fromIndex < 0) { @@ -110390,14 +136770,14 @@ var lodash = lodash$1.exports; } __name(includes, "includes"); var invokeMap = baseRest(function(collection, path, args) { - var index2 = -1, isFunc = typeof path == "function", result2 = isArrayLike(collection) ? Array2(collection.length) : []; + var index2 = -1, isFunc = typeof path == "function", result2 = isArrayLike2(collection) ? Array2(collection.length) : []; baseEach(collection, function(value4) { result2[++index2] = isFunc ? apply2(path, value4, args) : baseInvoke(value4, path, args); }); return result2; }); var keyBy = createAggregator(function(result2, value4, key) { - baseAssignValue(result2, key, value4); + baseAssignValue2(result2, key, value4); }); function map3(collection, iteratee2) { var func = isArray2(collection) ? arrayMap : baseMap; @@ -110434,7 +136814,7 @@ var lodash = lodash$1.exports; } __name(reduceRight, "reduceRight"); function reject3(collection, predicate) { - var func = isArray2(collection) ? arrayFilter : baseFilter; + var func = isArray2(collection) ? arrayFilter2 : baseFilter; return func(collection, negate(getIteratee(predicate, 3))); } __name(reject3, "reject"); @@ -110443,14 +136823,14 @@ var lodash = lodash$1.exports; return func(collection); } __name(sample, "sample"); - function sampleSize(collection, n, guard) { - if (guard ? isIterateeCall(collection, n, guard) : n === undefined$1) { - n = 1; + function sampleSize(collection, n2, guard) { + if (guard ? isIterateeCall(collection, n2, guard) : n2 === undefined$1) { + n2 = 1; } else { - n = toInteger(n); + n2 = toInteger(n2); } var func = isArray2(collection) ? arraySampleSize : baseSampleSize; - return func(collection, n); + return func(collection, n2); } __name(sampleSize, "sampleSize"); function shuffle(collection) { @@ -110462,14 +136842,14 @@ var lodash = lodash$1.exports; if (collection == null) { return 0; } - if (isArrayLike(collection)) { + if (isArrayLike2(collection)) { return isString2(collection) ? stringSize(collection) : collection.length; } var tag = getTag2(collection); - if (tag == mapTag || tag == setTag) { + if (tag == mapTag2 || tag == setTag2) { return collection.size; } - return baseKeys(collection).length; + return baseKeys2(collection).length; } __name(size2, "size"); function some(collection, predicate, guard) { @@ -110493,37 +136873,37 @@ var lodash = lodash$1.exports; return baseOrderBy(collection, baseFlatten(iteratees, 1), []); }); var now2 = ctxNow || function() { - return root24.Date.now(); + return root27.Date.now(); }; - function after(n, func) { + function after(n2, func) { if (typeof func != "function") { throw new TypeError2(FUNC_ERROR_TEXT); } - n = toInteger(n); + n2 = toInteger(n2); return function() { - if (--n < 1) { + if (--n2 < 1) { return func.apply(this, arguments); } }; } __name(after, "after"); - function ary(func, n, guard) { - n = guard ? undefined$1 : n; - n = func && n == null ? func.length : n; - return createWrap(func, WRAP_ARY_FLAG, undefined$1, undefined$1, undefined$1, undefined$1, n); + function ary(func, n2, guard) { + n2 = guard ? undefined$1 : n2; + n2 = func && n2 == null ? func.length : n2; + return createWrap(func, WRAP_ARY_FLAG, undefined$1, undefined$1, undefined$1, undefined$1, n2); } __name(ary, "ary"); - function before(n, func) { + function before(n2, func) { var result2; if (typeof func != "function") { throw new TypeError2(FUNC_ERROR_TEXT); } - n = toInteger(n); + n2 = toInteger(n2); return function() { - if (--n > 0) { + if (--n2 > 0) { result2 = func.apply(this, arguments); } - if (n <= 1) { + if (n2 <= 1) { func = undefined$1; } return result2; @@ -110560,7 +136940,7 @@ var lodash = lodash$1.exports; return result2; } __name(curryRight, "curryRight"); - function debounce(func, wait, options4) { + function debounce2(func, wait, options4) { var lastArgs, lastThis, maxWait, result2, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true; if (typeof func != "function") { throw new TypeError2(FUNC_ERROR_TEXT); @@ -110621,10 +137001,10 @@ var lodash = lodash$1.exports; lastArgs = lastCallTime = lastThis = timerId = undefined$1; } __name(cancel, "cancel"); - function flush() { + function flush2() { return timerId === undefined$1 ? result2 : trailingEdge(now2()); } - __name(flush, "flush"); + __name(flush2, "flush"); function debounced() { var time = now2(), isInvoking = shouldInvoke(time); lastArgs = arguments; @@ -110647,10 +137027,10 @@ var lodash = lodash$1.exports; } __name(debounced, "debounced"); debounced.cancel = cancel; - debounced.flush = flush; + debounced.flush = flush2; return debounced; } - __name(debounce, "debounce"); + __name(debounce2, "debounce"); var defer = baseRest(function(func, args) { return baseDelay(func, 1, args); }); @@ -110674,11 +137054,11 @@ var lodash = lodash$1.exports; memoized.cache = cache2.set(key, result2) || cache2; return result2; }, "memoized"); - memoized.cache = new (memoize.Cache || MapCache)(); + memoized.cache = new (memoize.Cache || MapCache2)(); return memoized; } __name(memoize, "memoize"); - memoize.Cache = MapCache; + memoize.Cache = MapCache2; function negate(predicate) { if (typeof predicate != "function") { throw new TypeError2(FUNC_ERROR_TEXT); @@ -110704,7 +137084,7 @@ var lodash = lodash$1.exports; } __name(once2, "once"); var overArgs = castRest(function(func, transforms) { - transforms = transforms.length == 1 && isArray2(transforms[0]) ? arrayMap(transforms[0], baseUnary(getIteratee())) : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee())); + transforms = transforms.length == 1 && isArray2(transforms[0]) ? arrayMap(transforms[0], baseUnary2(getIteratee())) : arrayMap(baseFlatten(transforms, 1), baseUnary2(getIteratee())); var funcsLength = transforms.length; return baseRest(function(args) { var index2 = -1, length = nativeMin(args.length, funcsLength); @@ -110741,7 +137121,7 @@ var lodash = lodash$1.exports; return baseRest(function(args) { var array = args[start2], otherArgs = castSlice(args, 0, start2); if (array) { - arrayPush(otherArgs, array); + arrayPush2(otherArgs, array); } return apply2(func, this, otherArgs); }); @@ -110756,7 +137136,7 @@ var lodash = lodash$1.exports; leading = "leading" in options4 ? !!options4.leading : leading; trailing = "trailing" in options4 ? !!options4.trailing : trailing; } - return debounce(func, wait, { + return debounce2(func, wait, { "leading": leading, "maxWait": wait, "trailing": trailing @@ -110780,56 +137160,56 @@ var lodash = lodash$1.exports; } __name(castArray, "castArray"); function clone2(value4) { - return baseClone(value4, CLONE_SYMBOLS_FLAG); + return baseClone2(value4, CLONE_SYMBOLS_FLAG2); } __name(clone2, "clone"); function cloneWith(value4, customizer) { customizer = typeof customizer == "function" ? customizer : undefined$1; - return baseClone(value4, CLONE_SYMBOLS_FLAG, customizer); + return baseClone2(value4, CLONE_SYMBOLS_FLAG2, customizer); } __name(cloneWith, "cloneWith"); - function cloneDeep(value4) { - return baseClone(value4, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG); + function cloneDeep2(value4) { + return baseClone2(value4, CLONE_DEEP_FLAG2 | CLONE_SYMBOLS_FLAG2); } - __name(cloneDeep, "cloneDeep"); + __name(cloneDeep2, "cloneDeep"); function cloneDeepWith(value4, customizer) { customizer = typeof customizer == "function" ? customizer : undefined$1; - return baseClone(value4, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer); + return baseClone2(value4, CLONE_DEEP_FLAG2 | CLONE_SYMBOLS_FLAG2, customizer); } __name(cloneDeepWith, "cloneDeepWith"); function conformsTo(object, source) { return source == null || baseConformsTo(object, source, keys2(source)); } __name(conformsTo, "conformsTo"); - function eq(value4, other) { + function eq2(value4, other) { return value4 === other || value4 !== value4 && other !== other; } - __name(eq, "eq"); + __name(eq2, "eq"); var gt2 = createRelationalOperation(baseGt); var gte2 = createRelationalOperation(function(value4, other) { return value4 >= other; }); - var isArguments = baseIsArguments(/* @__PURE__ */ function() { + var isArguments2 = baseIsArguments2(/* @__PURE__ */ function() { return arguments; - }()) ? baseIsArguments : function(value4) { - return isObjectLike2(value4) && hasOwnProperty2.call(value4, "callee") && !propertyIsEnumerable.call(value4, "callee"); + }()) ? baseIsArguments2 : function(value4) { + return isObjectLike2(value4) && hasOwnProperty2.call(value4, "callee") && !propertyIsEnumerable2.call(value4, "callee"); }; var isArray2 = Array2.isArray; - var isArrayBuffer2 = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer; - function isArrayLike(value4) { - return value4 != null && isLength(value4.length) && !isFunction2(value4); + var isArrayBuffer2 = nodeIsArrayBuffer ? baseUnary2(nodeIsArrayBuffer) : baseIsArrayBuffer; + function isArrayLike2(value4) { + return value4 != null && isLength2(value4.length) && !isFunction2(value4); } - __name(isArrayLike, "isArrayLike"); + __name(isArrayLike2, "isArrayLike"); function isArrayLikeObject(value4) { - return isObjectLike2(value4) && isArrayLike(value4); + return isObjectLike2(value4) && isArrayLike2(value4); } __name(isArrayLikeObject, "isArrayLikeObject"); function isBoolean2(value4) { - return value4 === true || value4 === false || isObjectLike2(value4) && baseGetTag(value4) == boolTag; + return value4 === true || value4 === false || isObjectLike2(value4) && baseGetTag2(value4) == boolTag2; } __name(isBoolean2, "isBoolean"); - var isBuffer2 = nativeIsBuffer || stubFalse; - var isDate2 = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate; + var isBuffer2 = nativeIsBuffer || stubFalse2; + var isDate2 = nodeIsDate ? baseUnary2(nodeIsDate) : baseIsDate; function isElement2(value4) { return isObjectLike2(value4) && value4.nodeType === 1 && !isPlainObject2(value4); } @@ -110838,15 +137218,15 @@ var lodash = lodash$1.exports; if (value4 == null) { return true; } - if (isArrayLike(value4) && (isArray2(value4) || typeof value4 == "string" || typeof value4.splice == "function" || isBuffer2(value4) || isTypedArray2(value4) || isArguments(value4))) { + if (isArrayLike2(value4) && (isArray2(value4) || typeof value4 == "string" || typeof value4.splice == "function" || isBuffer2(value4) || isTypedArray2(value4) || isArguments2(value4))) { return !value4.length; } var tag = getTag2(value4); - if (tag == mapTag || tag == setTag) { + if (tag == mapTag2 || tag == setTag2) { return !value4.size; } - if (isPrototype(value4)) { - return !baseKeys(value4).length; + if (isPrototype2(value4)) { + return !baseKeys2(value4).length; } for (var key in value4) { if (hasOwnProperty2.call(value4, key)) { @@ -110866,14 +137246,14 @@ var lodash = lodash$1.exports; return result2 === undefined$1 ? baseIsEqual(value4, other, undefined$1, customizer) : !!result2; } __name(isEqualWith, "isEqualWith"); - function isError(value4) { + function isError2(value4) { if (!isObjectLike2(value4)) { return false; } - var tag = baseGetTag(value4); - return tag == errorTag || tag == domExcTag || typeof value4.message == "string" && typeof value4.name == "string" && !isPlainObject2(value4); + var tag = baseGetTag2(value4); + return tag == errorTag2 || tag == domExcTag || typeof value4.message == "string" && typeof value4.name == "string" && !isPlainObject2(value4); } - __name(isError, "isError"); + __name(isError2, "isError"); function isFinite2(value4) { return typeof value4 == "number" && nativeIsFinite(value4); } @@ -110882,18 +137262,18 @@ var lodash = lodash$1.exports; if (!isObject2(value4)) { return false; } - var tag = baseGetTag(value4); - return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; + var tag = baseGetTag2(value4); + return tag == funcTag2 || tag == genTag2 || tag == asyncTag2 || tag == proxyTag2; } __name(isFunction2, "isFunction"); function isInteger(value4) { return typeof value4 == "number" && value4 == toInteger(value4); } __name(isInteger, "isInteger"); - function isLength(value4) { - return typeof value4 == "number" && value4 > -1 && value4 % 1 == 0 && value4 <= MAX_SAFE_INTEGER; + function isLength2(value4) { + return typeof value4 == "number" && value4 > -1 && value4 % 1 == 0 && value4 <= MAX_SAFE_INTEGER2; } - __name(isLength, "isLength"); + __name(isLength2, "isLength"); function isObject2(value4) { var type = typeof value4; return value4 != null && (type == "object" || type == "function"); @@ -110903,7 +137283,7 @@ var lodash = lodash$1.exports; return value4 != null && typeof value4 == "object"; } __name(isObjectLike2, "isObjectLike"); - var isMap2 = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap; + var isMap2 = nodeIsMap2 ? baseUnary2(nodeIsMap2) : baseIsMap2; function isMatch(object, source) { return object === source || baseIsMatch(object, source, getMatchData(source)); } @@ -110921,7 +137301,7 @@ var lodash = lodash$1.exports; if (isMaskable(value4)) { throw new Error2(CORE_ERROR_TEXT); } - return baseIsNative(value4); + return baseIsNative2(value4); } __name(isNative, "isNative"); function isNull(value4) { @@ -110933,46 +137313,46 @@ var lodash = lodash$1.exports; } __name(isNil, "isNil"); function isNumber2(value4) { - return typeof value4 == "number" || isObjectLike2(value4) && baseGetTag(value4) == numberTag; + return typeof value4 == "number" || isObjectLike2(value4) && baseGetTag2(value4) == numberTag2; } __name(isNumber2, "isNumber"); function isPlainObject2(value4) { - if (!isObjectLike2(value4) || baseGetTag(value4) != objectTag) { + if (!isObjectLike2(value4) || baseGetTag2(value4) != objectTag2) { return false; } - var proto = getPrototype(value4); + var proto = getPrototype2(value4); if (proto === null) { return true; } var Ctor = hasOwnProperty2.call(proto, "constructor") && proto.constructor; - return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString; + return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString2.call(Ctor) == objectCtorString; } __name(isPlainObject2, "isPlainObject"); - var isRegExp2 = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp; + var isRegExp2 = nodeIsRegExp ? baseUnary2(nodeIsRegExp) : baseIsRegExp; function isSafeInteger(value4) { - return isInteger(value4) && value4 >= -MAX_SAFE_INTEGER && value4 <= MAX_SAFE_INTEGER; + return isInteger(value4) && value4 >= -MAX_SAFE_INTEGER2 && value4 <= MAX_SAFE_INTEGER2; } __name(isSafeInteger, "isSafeInteger"); - var isSet2 = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet; + var isSet2 = nodeIsSet2 ? baseUnary2(nodeIsSet2) : baseIsSet2; function isString2(value4) { - return typeof value4 == "string" || !isArray2(value4) && isObjectLike2(value4) && baseGetTag(value4) == stringTag; + return typeof value4 == "string" || !isArray2(value4) && isObjectLike2(value4) && baseGetTag2(value4) == stringTag2; } __name(isString2, "isString"); function isSymbol2(value4) { - return typeof value4 == "symbol" || isObjectLike2(value4) && baseGetTag(value4) == symbolTag; + return typeof value4 == "symbol" || isObjectLike2(value4) && baseGetTag2(value4) == symbolTag2; } __name(isSymbol2, "isSymbol"); - var isTypedArray2 = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; + var isTypedArray2 = nodeIsTypedArray2 ? baseUnary2(nodeIsTypedArray2) : baseIsTypedArray2; function isUndefined2(value4) { return value4 === undefined$1; } __name(isUndefined2, "isUndefined"); function isWeakMap(value4) { - return isObjectLike2(value4) && getTag2(value4) == weakMapTag; + return isObjectLike2(value4) && getTag2(value4) == weakMapTag2; } __name(isWeakMap, "isWeakMap"); function isWeakSet(value4) { - return isObjectLike2(value4) && baseGetTag(value4) == weakSetTag; + return isObjectLike2(value4) && baseGetTag2(value4) == weakSetTag; } __name(isWeakSet, "isWeakSet"); var lt2 = createRelationalOperation(baseLt); @@ -110983,13 +137363,13 @@ var lodash = lodash$1.exports; if (!value4) { return []; } - if (isArrayLike(value4)) { - return isString2(value4) ? stringToArray2(value4) : copyArray(value4); + if (isArrayLike2(value4)) { + return isString2(value4) ? stringToArray2(value4) : copyArray2(value4); } if (symIterator && value4[symIterator]) { return iteratorToArray(value4[symIterator]()); } - var tag = getTag2(value4), func = tag == mapTag ? mapToArray : tag == setTag ? setToArray : values; + var tag = getTag2(value4), func = tag == mapTag2 ? mapToArray : tag == setTag2 ? setToArray : values; return func(value4); } __name(toArray2, "toArray"); @@ -111034,11 +137414,11 @@ var lodash = lodash$1.exports; } __name(toNumber2, "toNumber"); function toPlainObject(value4) { - return copyObject(value4, keysIn(value4)); + return copyObject2(value4, keysIn2(value4)); } __name(toPlainObject, "toPlainObject"); function toSafeInteger(value4) { - return value4 ? baseClamp(toInteger(value4), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) : value4 === 0 ? value4 : 0; + return value4 ? baseClamp(toInteger(value4), -MAX_SAFE_INTEGER2, MAX_SAFE_INTEGER2) : value4 === 0 ? value4 : 0; } __name(toSafeInteger, "toSafeInteger"); function toString3(value4) { @@ -111046,29 +137426,29 @@ var lodash = lodash$1.exports; } __name(toString3, "toString"); var assign2 = createAssigner(function(object, source) { - if (isPrototype(source) || isArrayLike(source)) { - copyObject(source, keys2(source), object); + if (isPrototype2(source) || isArrayLike2(source)) { + copyObject2(source, keys2(source), object); return; } for (var key in source) { if (hasOwnProperty2.call(source, key)) { - assignValue(object, key, source[key]); + assignValue2(object, key, source[key]); } } }); var assignIn = createAssigner(function(object, source) { - copyObject(source, keysIn(source), object); + copyObject2(source, keysIn2(source), object); }); var assignInWith = createAssigner(function(object, source, srcIndex, customizer) { - copyObject(source, keysIn(source), object, customizer); + copyObject2(source, keysIn2(source), object, customizer); }); var assignWith = createAssigner(function(object, source, srcIndex, customizer) { - copyObject(source, keys2(source), object, customizer); + copyObject2(source, keys2(source), object, customizer); }); var at = flatRest(baseAt); function create3(prototype2, properties) { - var result2 = baseCreate(prototype2); - return properties == null ? result2 : baseAssign(result2, properties); + var result2 = baseCreate2(prototype2); + return properties == null ? result2 : baseAssign2(result2, properties); } __name(create3, "create"); var defaults2 = baseRest(function(object, sources) { @@ -111081,13 +137461,13 @@ var lodash = lodash$1.exports; } while (++index2 < length) { var source = sources[index2]; - var props = keysIn(source); + var props = keysIn2(source); var propsIndex = -1; var propsLength = props.length; while (++propsIndex < propsLength) { var key = props[propsIndex]; var value4 = object[key]; - if (value4 === undefined$1 || eq(value4, objectProto[key]) && !hasOwnProperty2.call(object, key)) { + if (value4 === undefined$1 || eq2(value4, objectProto2[key]) && !hasOwnProperty2.call(object, key)) { object[key] = source[key]; } } @@ -111107,11 +137487,11 @@ var lodash = lodash$1.exports; } __name(findLastKey, "findLastKey"); function forIn(object, iteratee2) { - return object == null ? object : baseFor(object, getIteratee(iteratee2, 3), keysIn); + return object == null ? object : baseFor(object, getIteratee(iteratee2, 3), keysIn2); } __name(forIn, "forIn"); function forInRight(object, iteratee2) { - return object == null ? object : baseForRight(object, getIteratee(iteratee2, 3), keysIn); + return object == null ? object : baseForRight(object, getIteratee(iteratee2, 3), keysIn2); } __name(forInRight, "forInRight"); function forOwn(object, iteratee2) { @@ -111127,7 +137507,7 @@ var lodash = lodash$1.exports; } __name(functions, "functions"); function functionsIn(object) { - return object == null ? [] : baseFunctions(object, keysIn(object)); + return object == null ? [] : baseFunctions(object, keysIn2(object)); } __name(functionsIn, "functionsIn"); function get3(object, path, defaultValue) { @@ -111145,13 +137525,13 @@ var lodash = lodash$1.exports; __name(hasIn, "hasIn"); var invert = createInverter(function(result2, value4, key) { if (value4 != null && typeof value4.toString != "function") { - value4 = nativeObjectToString.call(value4); + value4 = nativeObjectToString2.call(value4); } result2[value4] = key; }, constant(identity2)); var invertBy = createInverter(function(result2, value4, key) { if (value4 != null && typeof value4.toString != "function") { - value4 = nativeObjectToString.call(value4); + value4 = nativeObjectToString2.call(value4); } if (hasOwnProperty2.call(result2, value4)) { result2[value4].push(key); @@ -111161,18 +137541,18 @@ var lodash = lodash$1.exports; }, getIteratee); var invoke2 = baseRest(baseInvoke); function keys2(object) { - return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); + return isArrayLike2(object) ? arrayLikeKeys2(object) : baseKeys2(object); } __name(keys2, "keys"); - function keysIn(object) { - return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); + function keysIn2(object) { + return isArrayLike2(object) ? arrayLikeKeys2(object, true) : baseKeysIn2(object); } - __name(keysIn, "keysIn"); + __name(keysIn2, "keysIn"); function mapKeys(object, iteratee2) { var result2 = {}; iteratee2 = getIteratee(iteratee2, 3); baseForOwn(object, function(value4, key, object2) { - baseAssignValue(result2, iteratee2(value4, key, object2), value4); + baseAssignValue2(result2, iteratee2(value4, key, object2), value4); }); return result2; } @@ -111181,7 +137561,7 @@ var lodash = lodash$1.exports; var result2 = {}; iteratee2 = getIteratee(iteratee2, 3); baseForOwn(object, function(value4, key, object2) { - baseAssignValue(result2, key, iteratee2(value4, key, object2)); + baseAssignValue2(result2, key, iteratee2(value4, key, object2)); }); return result2; } @@ -111203,9 +137583,9 @@ var lodash = lodash$1.exports; isDeep || (isDeep = path.length > 1); return path; }); - copyObject(object, getAllKeysIn(object), result2); + copyObject2(object, getAllKeysIn2(object), result2); if (isDeep) { - result2 = baseClone(result2, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone); + result2 = baseClone2(result2, CLONE_DEEP_FLAG2 | CLONE_FLAT_FLAG2 | CLONE_SYMBOLS_FLAG2, customOmitClone); } var length = paths.length; while (length--) { @@ -111224,7 +137604,7 @@ var lodash = lodash$1.exports; if (object == null) { return {}; } - var props = arrayMap(getAllKeysIn(object), function(prop2) { + var props = arrayMap(getAllKeysIn2(object), function(prop2) { return [prop2]; }); predicate = getIteratee(predicate); @@ -111261,7 +137641,7 @@ var lodash = lodash$1.exports; } __name(setWith, "setWith"); var toPairs = createToPairs(keys2); - var toPairsIn = createToPairs(keysIn); + var toPairsIn = createToPairs(keysIn2); function transform2(object, iteratee2, accumulator) { var isArr = isArray2(object), isArrLike = isArr || isBuffer2(object) || isTypedArray2(object); iteratee2 = getIteratee(iteratee2, 4); @@ -111270,12 +137650,12 @@ var lodash = lodash$1.exports; if (isArrLike) { accumulator = isArr ? new Ctor() : []; } else if (isObject2(object)) { - accumulator = isFunction2(Ctor) ? baseCreate(getPrototype(object)) : {}; + accumulator = isFunction2(Ctor) ? baseCreate2(getPrototype2(object)) : {}; } else { accumulator = {}; } } - (isArrLike ? arrayEach : baseForOwn)(object, function(value4, index2, object2) { + (isArrLike ? arrayEach2 : baseForOwn)(object, function(value4, index2, object2) { return iteratee2(accumulator, value4, index2, object2); }); return accumulator; @@ -111299,7 +137679,7 @@ var lodash = lodash$1.exports; } __name(values, "values"); function valuesIn(object) { - return object == null ? [] : baseValues(object, keysIn(object)); + return object == null ? [] : baseValues(object, keysIn2(object)); } __name(valuesIn, "valuesIn"); function clamp2(number2, lower, upper) { @@ -111397,7 +137777,7 @@ var lodash = lodash$1.exports; __name(escape2, "escape"); function escapeRegExp2(string) { string = toString3(string); - return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar, "\\$&") : string; + return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar2, "\\$&") : string; } __name(escapeRegExp2, "escapeRegExp"); var kebabCase = createCompounder(function(result2, word, index2) { @@ -111407,7 +137787,7 @@ var lodash = lodash$1.exports; return result2 + (index2 ? " " : "") + word.toLowerCase(); }); var lowerFirst = createCaseFirst("toLowerCase"); - function pad(string, length, chars) { + function pad(string, length, chars2) { string = toString3(string); length = toInteger(length); var strLength = length ? stringSize(string) : 0; @@ -111415,21 +137795,21 @@ var lodash = lodash$1.exports; return string; } var mid = (length - strLength) / 2; - return createPadding(nativeFloor(mid), chars) + string + createPadding(nativeCeil(mid), chars); + return createPadding(nativeFloor(mid), chars2) + string + createPadding(nativeCeil(mid), chars2); } __name(pad, "pad"); - function padEnd(string, length, chars) { + function padEnd(string, length, chars2) { string = toString3(string); length = toInteger(length); var strLength = length ? stringSize(string) : 0; - return length && strLength < length ? string + createPadding(length - strLength, chars) : string; + return length && strLength < length ? string + createPadding(length - strLength, chars2) : string; } __name(padEnd, "padEnd"); - function padStart(string, length, chars) { + function padStart(string, length, chars2) { string = toString3(string); length = toInteger(length); var strLength = length ? stringSize(string) : 0; - return length && strLength < length ? createPadding(length - strLength, chars) + string : string; + return length && strLength < length ? createPadding(length - strLength, chars2) + string : string; } __name(padStart, "padStart"); function parseInt2(string, radix, guard) { @@ -111441,15 +137821,15 @@ var lodash = lodash$1.exports; return nativeParseInt(toString3(string).replace(reTrimStart, ""), radix || 0); } __name(parseInt2, "parseInt"); - function repeat3(string, n, guard) { - if (guard ? isIterateeCall(string, n, guard) : n === undefined$1) { - n = 1; + function repeat4(string, n2, guard) { + if (guard ? isIterateeCall(string, n2, guard) : n2 === undefined$1) { + n2 = 1; } else { - n = toInteger(n); + n2 = toInteger(n2); } - return baseRepeat(toString3(string), n); + return baseRepeat(toString3(string), n2); } - __name(repeat3, "repeat"); + __name(repeat4, "repeat"); function replace2() { var args = arguments, string = toString3(args[0]); return args.length < 3 ? string : string.replace(args[1], args[2]); @@ -111530,7 +137910,7 @@ var lodash = lodash$1.exports; return Function2(importsKeys, sourceURL + "return " + source).apply(undefined$1, importsValues); }); result2.source = source; - if (isError(result2)) { + if (isError2(result2)) { throw result2; } return result2; @@ -111544,43 +137924,43 @@ var lodash = lodash$1.exports; return toString3(value4).toUpperCase(); } __name(toUpper, "toUpper"); - function trim2(string, chars, guard) { + function trim2(string, chars2, guard) { string = toString3(string); - if (string && (guard || chars === undefined$1)) { + if (string && (guard || chars2 === undefined$1)) { return baseTrim(string); } - if (!string || !(chars = baseToString2(chars))) { + if (!string || !(chars2 = baseToString2(chars2))) { return string; } - var strSymbols = stringToArray2(string), chrSymbols = stringToArray2(chars), start2 = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1; + var strSymbols = stringToArray2(string), chrSymbols = stringToArray2(chars2), start2 = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1; return castSlice(strSymbols, start2, end).join(""); } __name(trim2, "trim"); - function trimEnd2(string, chars, guard) { + function trimEnd2(string, chars2, guard) { string = toString3(string); - if (string && (guard || chars === undefined$1)) { + if (string && (guard || chars2 === undefined$1)) { return string.slice(0, trimmedEndIndex(string) + 1); } - if (!string || !(chars = baseToString2(chars))) { + if (!string || !(chars2 = baseToString2(chars2))) { return string; } - var strSymbols = stringToArray2(string), end = charsEndIndex(strSymbols, stringToArray2(chars)) + 1; + var strSymbols = stringToArray2(string), end = charsEndIndex(strSymbols, stringToArray2(chars2)) + 1; return castSlice(strSymbols, 0, end).join(""); } __name(trimEnd2, "trimEnd"); - function trimStart2(string, chars, guard) { + function trimStart2(string, chars2, guard) { string = toString3(string); - if (string && (guard || chars === undefined$1)) { + if (string && (guard || chars2 === undefined$1)) { return string.replace(reTrimStart, ""); } - if (!string || !(chars = baseToString2(chars))) { + if (!string || !(chars2 = baseToString2(chars2))) { return string; } - var strSymbols = stringToArray2(string), start2 = charsStartIndex(strSymbols, stringToArray2(chars)); + var strSymbols = stringToArray2(string), start2 = charsStartIndex(strSymbols, stringToArray2(chars2)); return castSlice(strSymbols, start2).join(""); } __name(trimStart2, "trimStart"); - function truncate(string, options4) { + function truncate2(string, options4) { var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION; if (isObject2(options4)) { var separator = "separator" in options4 ? options4.separator : separator; @@ -111611,7 +137991,7 @@ var lodash = lodash$1.exports; if (string.slice(end).search(separator)) { var match2, substring = result2; if (!separator.global) { - separator = RegExp2(separator.source, toString3(reFlags.exec(separator)) + "g"); + separator = RegExp2(separator.source, toString3(reFlags2.exec(separator)) + "g"); } separator.lastIndex = 0; while (match2 = separator.exec(substring)) { @@ -111627,7 +138007,7 @@ var lodash = lodash$1.exports; } return result2 + omission; } - __name(truncate, "truncate"); + __name(truncate2, "truncate"); function unescape2(string) { string = toString3(string); return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar) : string; @@ -111650,13 +138030,13 @@ var lodash = lodash$1.exports; try { return apply2(func, undefined$1, args); } catch (e2) { - return isError(e2) ? e2 : new Error2(e2); + return isError2(e2) ? e2 : new Error2(e2); } }); var bindAll2 = flatRest(function(object, methodNames) { - arrayEach(methodNames, function(key) { + arrayEach2(methodNames, function(key) { key = toKey(key); - baseAssignValue(object, key, bind3(object[key], object)); + baseAssignValue2(object, key, bind3(object[key], object)); }); return object; }); @@ -111680,7 +138060,7 @@ var lodash = lodash$1.exports; } __name(cond, "cond"); function conforms(source) { - return baseConforms(baseClone(source, CLONE_DEEP_FLAG)); + return baseConforms(baseClone2(source, CLONE_DEEP_FLAG2)); } __name(conforms, "conforms"); function constant(value4) { @@ -111700,15 +138080,15 @@ var lodash = lodash$1.exports; } __name(identity2, "identity"); function iteratee(func) { - return baseIteratee(typeof func == "function" ? func : baseClone(func, CLONE_DEEP_FLAG)); + return baseIteratee(typeof func == "function" ? func : baseClone2(func, CLONE_DEEP_FLAG2)); } __name(iteratee, "iteratee"); function matches2(source) { - return baseMatches(baseClone(source, CLONE_DEEP_FLAG)); + return baseMatches(baseClone2(source, CLONE_DEEP_FLAG2)); } __name(matches2, "matches"); function matchesProperty(path, srcValue) { - return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG)); + return baseMatchesProperty(path, baseClone2(srcValue, CLONE_DEEP_FLAG2)); } __name(matchesProperty, "matchesProperty"); var method = baseRest(function(path, args) { @@ -111730,19 +138110,19 @@ var lodash = lodash$1.exports; methodNames = baseFunctions(source, keys2(source)); } var chain2 = !(isObject2(options4) && "chain" in options4) || !!options4.chain, isFunc = isFunction2(object); - arrayEach(methodNames, function(methodName) { + arrayEach2(methodNames, function(methodName) { var func = source[methodName]; object[methodName] = func; if (isFunc) { object.prototype[methodName] = function() { var chainAll = this.__chain__; if (chain2 || chainAll) { - var result2 = object(this.__wrapped__), actions = result2.__actions__ = copyArray(this.__actions__); + var result2 = object(this.__wrapped__), actions = result2.__actions__ = copyArray2(this.__actions__); actions.push({ "func": func, "args": arguments, "thisArg": object }); result2.__chain__ = chainAll; return result2; } - return func.apply(object, arrayPush([this.value()], arguments)); + return func.apply(object, arrayPush2([this.value()], arguments)); }; } }); @@ -111750,8 +138130,8 @@ var lodash = lodash$1.exports; } __name(mixin, "mixin"); function noConflict() { - if (root24._ === this) { - root24._ = oldDash; + if (root27._ === this) { + root27._ = oldDash; } return this; } @@ -111759,10 +138139,10 @@ var lodash = lodash$1.exports; function noop2() { } __name(noop2, "noop"); - function nthArg(n) { - n = toInteger(n); + function nthArg(n2) { + n2 = toInteger(n2); return baseRest(function(args) { - return baseNth(args, n); + return baseNth(args, n2); }); } __name(nthArg, "nthArg"); @@ -111781,14 +138161,14 @@ var lodash = lodash$1.exports; __name(propertyOf, "propertyOf"); var range2 = createRange(); var rangeRight = createRange(true); - function stubArray() { + function stubArray2() { return []; } - __name(stubArray, "stubArray"); - function stubFalse() { + __name(stubArray2, "stubArray"); + function stubFalse2() { return false; } - __name(stubFalse, "stubFalse"); + __name(stubFalse2, "stubFalse"); function stubObject() { return {}; } @@ -111801,16 +138181,16 @@ var lodash = lodash$1.exports; return true; } __name(stubTrue, "stubTrue"); - function times(n, iteratee2) { - n = toInteger(n); - if (n < 1 || n > MAX_SAFE_INTEGER) { + function times(n2, iteratee2) { + n2 = toInteger(n2); + if (n2 < 1 || n2 > MAX_SAFE_INTEGER2) { return []; } - var index2 = MAX_ARRAY_LENGTH, length = nativeMin(n, MAX_ARRAY_LENGTH); + var index2 = MAX_ARRAY_LENGTH, length = nativeMin(n2, MAX_ARRAY_LENGTH); iteratee2 = getIteratee(iteratee2); - n -= MAX_ARRAY_LENGTH; - var result2 = baseTimes(length, iteratee2); - while (++index2 < n) { + n2 -= MAX_ARRAY_LENGTH; + var result2 = baseTimes2(length, iteratee2); + while (++index2 < n2) { iteratee2(index2); } return result2; @@ -111820,7 +138200,7 @@ var lodash = lodash$1.exports; if (isArray2(value4)) { return arrayMap(value4, toKey); } - return isSymbol2(value4) ? [value4] : copyArray(stringToPath(toString3(value4))); + return isSymbol2(value4) ? [value4] : copyArray2(stringToPath(toString3(value4))); } __name(toPath, "toPath"); function uniqueId(prefix2) { @@ -111898,7 +138278,7 @@ var lodash = lodash$1.exports; lodash2.create = create3; lodash2.curry = curry; lodash2.curryRight = curryRight; - lodash2.debounce = debounce; + lodash2.debounce = debounce2; lodash2.defaults = defaults2; lodash2.defaultsDeep = defaultsDeep; lodash2.defer = defer; @@ -111910,12 +138290,12 @@ var lodash = lodash$1.exports; lodash2.dropRight = dropRight; lodash2.dropRightWhile = dropRightWhile; lodash2.dropWhile = dropWhile; - lodash2.fill = fill; + lodash2.fill = fill2; lodash2.filter = filter4; lodash2.flatMap = flatMap; lodash2.flatMapDeep = flatMapDeep; lodash2.flatMapDepth = flatMapDepth; - lodash2.flatten = flatten; + lodash2.flatten = flatten2; lodash2.flattenDeep = flattenDeep; lodash2.flattenDepth = flattenDepth; lodash2.flip = flip; @@ -111935,7 +138315,7 @@ var lodash = lodash$1.exports; lodash2.iteratee = iteratee; lodash2.keyBy = keyBy; lodash2.keys = keys2; - lodash2.keysIn = keysIn; + lodash2.keysIn = keysIn2; lodash2.map = map3; lodash2.mapKeys = mapKeys; lodash2.mapValues = mapValues; @@ -112036,7 +138416,7 @@ var lodash = lodash$1.exports; lodash2.ceil = ceil; lodash2.clamp = clamp2; lodash2.clone = clone2; - lodash2.cloneDeep = cloneDeep; + lodash2.cloneDeep = cloneDeep2; lodash2.cloneDeepWith = cloneDeepWith; lodash2.cloneWith = cloneWith; lodash2.conformsTo = conformsTo; @@ -112044,7 +138424,7 @@ var lodash = lodash$1.exports; lodash2.defaultTo = defaultTo; lodash2.divide = divide; lodash2.endsWith = endsWith3; - lodash2.eq = eq; + lodash2.eq = eq2; lodash2.escape = escape2; lodash2.escapeRegExp = escapeRegExp2; lodash2.every = every; @@ -112072,10 +138452,10 @@ var lodash = lodash$1.exports; lodash2.indexOf = indexOf; lodash2.inRange = inRange; lodash2.invoke = invoke2; - lodash2.isArguments = isArguments; + lodash2.isArguments = isArguments2; lodash2.isArray = isArray2; lodash2.isArrayBuffer = isArrayBuffer2; - lodash2.isArrayLike = isArrayLike; + lodash2.isArrayLike = isArrayLike2; lodash2.isArrayLikeObject = isArrayLikeObject; lodash2.isBoolean = isBoolean2; lodash2.isBuffer = isBuffer2; @@ -112084,11 +138464,11 @@ var lodash = lodash$1.exports; lodash2.isEmpty = isEmpty3; lodash2.isEqual = isEqual; lodash2.isEqualWith = isEqualWith; - lodash2.isError = isError; + lodash2.isError = isError2; lodash2.isFinite = isFinite2; lodash2.isFunction = isFunction2; lodash2.isInteger = isInteger; - lodash2.isLength = isLength; + lodash2.isLength = isLength2; lodash2.isMap = isMap2; lodash2.isMatch = isMatch; lodash2.isMatchWith = isMatchWith; @@ -112123,8 +138503,8 @@ var lodash = lodash$1.exports; lodash2.meanBy = meanBy; lodash2.min = min; lodash2.minBy = minBy; - lodash2.stubArray = stubArray; - lodash2.stubFalse = stubFalse; + lodash2.stubArray = stubArray2; + lodash2.stubFalse = stubFalse2; lodash2.stubObject = stubObject; lodash2.stubString = stubString; lodash2.stubTrue = stubTrue; @@ -112140,7 +138520,7 @@ var lodash = lodash$1.exports; lodash2.random = random; lodash2.reduce = reduce; lodash2.reduceRight = reduceRight; - lodash2.repeat = repeat3; + lodash2.repeat = repeat4; lodash2.replace = replace2; lodash2.result = result; lodash2.round = round; @@ -112173,7 +138553,7 @@ var lodash = lodash$1.exports; lodash2.trim = trim2; lodash2.trimEnd = trimEnd2; lodash2.trimStart = trimStart2; - lodash2.truncate = truncate; + lodash2.truncate = truncate2; lodash2.unescape = unescape2; lodash2.uniqueId = uniqueId; lodash2.upperCase = upperCase; @@ -112191,28 +138571,28 @@ var lodash = lodash$1.exports; return source; }(), { "chain": false }); lodash2.VERSION = VERSION2; - arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) { + arrayEach2(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) { lodash2[methodName].placeholder = lodash2; }); - arrayEach(["drop", "take"], function(methodName, index2) { - LazyWrapper.prototype[methodName] = function(n) { - n = n === undefined$1 ? 1 : nativeMax(toInteger(n), 0); + arrayEach2(["drop", "take"], function(methodName, index2) { + LazyWrapper.prototype[methodName] = function(n2) { + n2 = n2 === undefined$1 ? 1 : nativeMax(toInteger(n2), 0); var result2 = this.__filtered__ && !index2 ? new LazyWrapper(this) : this.clone(); if (result2.__filtered__) { - result2.__takeCount__ = nativeMin(n, result2.__takeCount__); + result2.__takeCount__ = nativeMin(n2, result2.__takeCount__); } else { result2.__views__.push({ - "size": nativeMin(n, MAX_ARRAY_LENGTH), + "size": nativeMin(n2, MAX_ARRAY_LENGTH), "type": methodName + (result2.__dir__ < 0 ? "Right" : "") }); } return result2; }; - LazyWrapper.prototype[methodName + "Right"] = function(n) { - return this.reverse()[methodName](n).reverse(); + LazyWrapper.prototype[methodName + "Right"] = function(n2) { + return this.reverse()[methodName](n2).reverse(); }; }); - arrayEach(["filter", "map", "takeWhile"], function(methodName, index2) { + arrayEach2(["filter", "map", "takeWhile"], function(methodName, index2) { var type = index2 + 1, isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG; LazyWrapper.prototype[methodName] = function(iteratee2) { var result2 = this.clone(); @@ -112224,13 +138604,13 @@ var lodash = lodash$1.exports; return result2; }; }); - arrayEach(["head", "last"], function(methodName, index2) { + arrayEach2(["head", "last"], function(methodName, index2) { var takeName = "take" + (index2 ? "Right" : ""); LazyWrapper.prototype[methodName] = function() { return this[takeName](1).value()[0]; }; }); - arrayEach(["initial", "tail"], function(methodName, index2) { + arrayEach2(["initial", "tail"], function(methodName, index2) { var dropName = "drop" + (index2 ? "" : "Right"); LazyWrapper.prototype[methodName] = function() { return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1); @@ -112287,7 +138667,7 @@ var lodash = lodash$1.exports; lodash2.prototype[methodName] = function() { var value4 = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value4 instanceof LazyWrapper, iteratee2 = args[0], useLazy = isLazy || isArray2(value4); var interceptor = /* @__PURE__ */ __name(function(value5) { - var result3 = lodashFunc.apply(lodash2, arrayPush([value5], args)); + var result3 = lodashFunc.apply(lodash2, arrayPush2([value5], args)); return isTaker && chainAll ? result3[0] : result3; }, "interceptor"); if (useLazy && checkIteratee && typeof iteratee2 == "function" && iteratee2.length != 1) { @@ -112307,8 +138687,8 @@ var lodash = lodash$1.exports; return isUnwrapped ? isTaker ? result2.value()[0] : result2.value() : result2; }; }); - arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) { - var func = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName); + arrayEach2(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) { + var func = arrayProto2[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName); lodash2.prototype[methodName] = function() { var args = arguments; if (retUnwrapped && !this.__chain__) { @@ -112352,7 +138732,7 @@ var lodash = lodash$1.exports; }, "runInContext"); var _2 = runInContext(); if (typeof undefined$1 == "function" && typeof undefined$1.amd == "object" && undefined$1.amd) { - root24._ = _2; + root27._ = _2; undefined$1(function() { return _2; }); @@ -112360,20 +138740,20 @@ var lodash = lodash$1.exports; (freeModule.exports = _2)._ = _2; freeExports._ = _2; } else { - root24._ = _2; + root27._ = _2; } }).call(commonjsGlobal); })(lodash$1, lodash$1.exports); var lodashExports = lodash$1.exports; const _ = /* @__PURE__ */ getDefaultExportFromCjs(lodashExports); -const _withScopeId$n = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-3df70997"), n = n(), popScopeId(), n), "_withScopeId$n"); -const _hoisted_1$1i = { class: "prompt-dialog-content flex flex-col gap-6 m-2 mt-4" }; -const _hoisted_2$Y = { +const _withScopeId$n = /* @__PURE__ */ __name((n2) => (pushScopeId("data-v-3df70997"), n2 = n2(), popScopeId(), n2), "_withScopeId$n"); +const _hoisted_1$1n = { class: "prompt-dialog-content flex flex-col gap-6 m-2 mt-4" }; +const _hoisted_2$$ = { key: 0, class: "pl-4 m-0 flex flex-col gap-2" }; -const _hoisted_3$u = { class: "flex gap-4 justify-end" }; -const _sfc_main$Y = /* @__PURE__ */ defineComponent({ +const _hoisted_3$v = { class: "flex gap-4 justify-end" }; +const _sfc_main$Z = /* @__PURE__ */ defineComponent({ __name: "ConfirmationDialogContent", props: { message: {}, @@ -112393,58 +138773,58 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({ useDialogStore().closeDialog(); }, "onConfirm"); return (_ctx, _cache) => { - return openBlock(), createElementBlock("section", _hoisted_1$1i, [ + return openBlock(), createElementBlock("section", _hoisted_1$1n, [ createBaseVNode("span", null, toDisplayString$1(_ctx.message), 1), - _ctx.itemList?.length ? (openBlock(), createElementBlock("ul", _hoisted_2$Y, [ + _ctx.itemList?.length ? (openBlock(), createElementBlock("ul", _hoisted_2$$, [ (openBlock(true), createElementBlock(Fragment$1, null, renderList(_ctx.itemList, (item3) => { return openBlock(), createElementBlock("li", { key: item3 }, toDisplayString$1(item3), 1); }), 128)) ])) : createCommentVNode("", true), - createBaseVNode("div", _hoisted_3$u, [ - createVNode(unref(script$R), { + createBaseVNode("div", _hoisted_3$v, [ + createVNode(unref(script$U), { label: _ctx.$t("g.cancel"), icon: "pi pi-undo", severity: "secondary", onClick: onCancel, autofocus: "" }, null, 8, ["label"]), - _ctx.type === "default" ? (openBlock(), createBlock(unref(script$R), { + _ctx.type === "default" ? (openBlock(), createBlock(unref(script$U), { key: 0, label: _ctx.$t("g.confirm"), severity: "primary", onClick: onConfirm, icon: "pi pi-check" - }, null, 8, ["label"])) : _ctx.type === "delete" ? (openBlock(), createBlock(unref(script$R), { + }, null, 8, ["label"])) : _ctx.type === "delete" ? (openBlock(), createBlock(unref(script$U), { key: 1, label: _ctx.$t("g.delete"), severity: "danger", onClick: onConfirm, icon: "pi pi-trash" - }, null, 8, ["label"])) : _ctx.type === "overwrite" ? (openBlock(), createBlock(unref(script$R), { + }, null, 8, ["label"])) : _ctx.type === "overwrite" ? (openBlock(), createBlock(unref(script$U), { key: 2, label: _ctx.$t("g.overwrite"), severity: "warn", onClick: onConfirm, icon: "pi pi-save" }, null, 8, ["label"])) : _ctx.type === "dirtyClose" ? (openBlock(), createElementBlock(Fragment$1, { key: 3 }, [ - createVNode(unref(script$R), { + createVNode(unref(script$U), { label: _ctx.$t("g.no"), severity: "secondary", onClick: onDeny, icon: "pi pi-times" }, null, 8, ["label"]), - createVNode(unref(script$R), { + createVNode(unref(script$U), { label: _ctx.$t("g.save"), onClick: onConfirm, icon: "pi pi-save" }, null, 8, ["label"]) - ], 64)) : _ctx.type === "reinstall" ? (openBlock(), createBlock(unref(script$R), { + ], 64)) : _ctx.type === "reinstall" ? (openBlock(), createBlock(unref(script$U), { key: 4, label: _ctx.$t("desktopMenu.reinstall"), severity: "warn", onClick: onConfirm, icon: "pi pi-eraser" - }, null, 8, ["label"])) : (openBlock(), createBlock(unref(script$R), { + }, null, 8, ["label"])) : (openBlock(), createBlock(unref(script$U), { key: 5, label: _ctx.$t("g.close"), severity: "primary", @@ -112456,13 +138836,13 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({ }; } }); -const ConfirmationDialogContent = /* @__PURE__ */ _export_sfc(_sfc_main$Y, [["__scopeId", "data-v-3df70997"]]); -var theme$t = /* @__PURE__ */ __name(function theme10(_ref) { +const ConfirmationDialogContent = /* @__PURE__ */ _export_sfc(_sfc_main$Z, [["__scopeId", "data-v-3df70997"]]); +var theme$v = /* @__PURE__ */ __name(function theme10(_ref) { var dt2 = _ref.dt; return "\n.p-divider-horizontal {\n display: flex;\n width: 100%;\n position: relative;\n align-items: center;\n margin: ".concat(dt2("divider.horizontal.margin"), ";\n padding: ").concat(dt2("divider.horizontal.padding"), ';\n}\n\n.p-divider-horizontal:before {\n position: absolute;\n display: block;\n top: 50%;\n left: 0;\n width: 100%;\n content: "";\n border-top: 1px solid ').concat(dt2("divider.border.color"), ";\n}\n\n.p-divider-horizontal .p-divider-content {\n padding: ").concat(dt2("divider.horizontal.content.padding"), ";\n}\n\n.p-divider-vertical {\n min-height: 100%;\n margin: 0 1rem;\n display: flex;\n position: relative;\n justify-content: center;\n margin: ").concat(dt2("divider.vertical.margin"), ";\n padding: ").concat(dt2("divider.vertical.padding"), ';\n}\n\n.p-divider-vertical:before {\n position: absolute;\n display: block;\n top: 0;\n left: 50%;\n height: 100%;\n content: "";\n border-left: 1px solid ').concat(dt2("divider.border.color"), ";\n}\n\n.p-divider.p-divider-vertical .p-divider-content {\n padding: ").concat(dt2("divider.vertical.content.padding"), ";\n}\n\n.p-divider-content {\n z-index: 1;\n background: ").concat(dt2("divider.content.background"), ";\n color: ").concat(dt2("divider.content.color"), ";\n}\n\n.p-divider-solid.p-divider-horizontal:before {\n border-top-style: solid;\n}\n\n.p-divider-solid.p-divider-vertical:before {\n border-left-style: solid;\n}\n\n.p-divider-dashed.p-divider-horizontal:before {\n border-top-style: dashed;\n}\n\n.p-divider-dashed.p-divider-vertical:before {\n border-left-style: dashed;\n}\n\n.p-divider-dotted.p-divider-horizontal:before {\n border-top-style: dotted;\n}\n\n.p-divider-dotted.p-divider-vertical:before {\n border-left-style: dotted;\n}\n"); }, "theme"); var inlineStyles$2 = { - root: /* @__PURE__ */ __name(function root4(_ref2) { + root: /* @__PURE__ */ __name(function root5(_ref2) { var props = _ref2.props; return { justifyContent: props.layout === "horizontal" ? props.align === "center" || props.align === null ? "center" : props.align === "left" ? "flex-start" : props.align === "right" ? "flex-end" : null : null, @@ -112470,8 +138850,8 @@ var inlineStyles$2 = { }; }, "root") }; -var classes$v = { - root: /* @__PURE__ */ __name(function root5(_ref3) { +var classes$x = { + root: /* @__PURE__ */ __name(function root6(_ref3) { var props = _ref3.props; return ["p-divider p-component", "p-divider-" + props.layout, "p-divider-" + props.type, { "p-divider-left": props.layout === "horizontal" && (!props.align || props.align === "left") @@ -112491,13 +138871,13 @@ var classes$v = { }; var DividerStyle = BaseStyle.extend({ name: "divider", - theme: theme$t, - classes: classes$v, + theme: theme$v, + classes: classes$x, inlineStyles: inlineStyles$2 }); -var script$1$w = { +var script$1$y = { name: "BaseDivider", - "extends": script$_, + "extends": script$11, props: { align: { type: String, @@ -112520,13 +138900,13 @@ var script$1$w = { }; }, "provide") }; -var script$O = { +var script$R = { name: "Divider", - "extends": script$1$w, + "extends": script$1$y, inheritAttrs: false }; -var _hoisted_1$1h = ["aria-orientation"]; -function render$N(_ctx, _cache, $props, $setup, $data, $options) { +var _hoisted_1$1m = ["aria-orientation"]; +function render$Q(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("div", mergeProps({ "class": _ctx.cx("root"), style: _ctx.sx("root"), @@ -112535,15 +138915,15 @@ function render$N(_ctx, _cache, $props, $setup, $data, $options) { }, _ctx.ptmi("root")), [_ctx.$slots["default"] ? (openBlock(), createElementBlock("div", mergeProps({ key: 0, "class": _ctx.cx("content") - }, _ctx.ptm("content")), [renderSlot(_ctx.$slots, "default")], 16)) : createCommentVNode("", true)], 16, _hoisted_1$1h); + }, _ctx.ptm("content")), [renderSlot(_ctx.$slots, "default")], 16)) : createCommentVNode("", true)], 16, _hoisted_1$1m); } -__name(render$N, "render$N"); -script$O.render = render$N; -var theme$s = /* @__PURE__ */ __name(function theme11(_ref) { +__name(render$Q, "render$Q"); +script$R.render = render$Q; +var theme$u = /* @__PURE__ */ __name(function theme11(_ref) { var dt2 = _ref.dt; return "\n.p-scrollpanel-content-container {\n overflow: hidden;\n width: 100%;\n height: 100%;\n position: relative;\n z-index: 1;\n float: left;\n}\n\n.p-scrollpanel-content {\n height: calc(100% + calc(2 * ".concat(dt2("scrollpanel.bar.size"), "));\n width: calc(100% + calc(2 * ").concat(dt2("scrollpanel.bar.size"), "));\n padding: 0 calc(2 * ").concat(dt2("scrollpanel.bar.size"), ") calc(2 * ").concat(dt2("scrollpanel.bar.size"), ") 0;\n position: relative;\n overflow: auto;\n box-sizing: border-box;\n scrollbar-width: none;\n}\n\n.p-scrollpanel-content::-webkit-scrollbar {\n display: none;\n}\n\n.p-scrollpanel-bar {\n position: relative;\n border-radius: ").concat(dt2("scrollpanel.bar.border.radius"), ";\n z-index: 2;\n cursor: pointer;\n opacity: 0;\n outline-color: transparent;\n transition: outline-color ").concat(dt2("scrollpanel.transition.duration"), ";\n background: ").concat(dt2("scrollpanel.bar.background"), ";\n border: 0 none;\n transition: outline-color ").concat(dt2("scrollpanel.transition.duration"), ", opacity ").concat(dt2("scrollpanel.transition.duration"), ";\n}\n\n.p-scrollpanel-bar:focus-visible {\n box-shadow: ").concat(dt2("scrollpanel.bar.focus.ring.shadow"), ";\n outline: ").concat(dt2("scrollpanel.barfocus.ring.width"), " ").concat(dt2("scrollpanel.bar.focus.ring.style"), " ").concat(dt2("scrollpanel.bar.focus.ring.color"), ";\n outline-offset: ").concat(dt2("scrollpanel.barfocus.ring.offset"), ";\n}\n\n.p-scrollpanel-bar-y {\n width: ").concat(dt2("scrollpanel.bar.size"), ";\n top: 0;\n}\n\n.p-scrollpanel-bar-x {\n height: ").concat(dt2("scrollpanel.bar.size"), ";\n bottom: 0;\n}\n\n.p-scrollpanel-hidden {\n visibility: hidden;\n}\n\n.p-scrollpanel:hover .p-scrollpanel-bar,\n.p-scrollpanel:active .p-scrollpanel-bar {\n opacity: 1;\n}\n\n.p-scrollpanel-grabbed {\n user-select: none;\n}\n"); }, "theme"); -var classes$u = { +var classes$w = { root: "p-scrollpanel p-component", contentContainer: "p-scrollpanel-content-container", content: "p-scrollpanel-content", @@ -112552,12 +138932,12 @@ var classes$u = { }; var ScrollPanelStyle = BaseStyle.extend({ name: "scrollpanel", - theme: theme$s, - classes: classes$u + theme: theme$u, + classes: classes$w }); -var script$1$v = { +var script$1$x = { name: "BaseScrollPanel", - "extends": script$_, + "extends": script$11, props: { step: { type: Number, @@ -112572,9 +138952,9 @@ var script$1$v = { }; }, "provide") }; -var script$N = { +var script$Q = { name: "ScrollPanel", - "extends": script$1$v, + "extends": script$1$x, inheritAttrs: false, initialized: false, documentResizeListener: null, @@ -112744,7 +139124,7 @@ var script$N = { onKeyUp: /* @__PURE__ */ __name(function onKeyUp2() { this.clearTimer(); }, "onKeyUp"), - repeat: /* @__PURE__ */ __name(function repeat(bar, step3) { + repeat: /* @__PURE__ */ __name(function repeat2(bar, step3) { this.$refs.content[bar] += step3; this.moveBar(); }, "repeat"), @@ -112809,9 +139189,9 @@ var script$N = { this.isXBarClicked = false; this.isYBarClicked = false; }, "onDocumentMouseUp"), - requestAnimationFrame: /* @__PURE__ */ __name(function requestAnimationFrame2(f) { + requestAnimationFrame: /* @__PURE__ */ __name(function requestAnimationFrame2(f2) { var frame = window.requestAnimationFrame || this.timeoutFrame; - return frame(f); + return frame(f2); }, "requestAnimationFrame"), refresh: /* @__PURE__ */ __name(function refresh() { this.moveBar(); @@ -112871,10 +139251,10 @@ var script$N = { }, "contentId") } }; -var _hoisted_1$1g = ["id"]; -var _hoisted_2$X = ["aria-controls", "aria-valuenow"]; -var _hoisted_3$t = ["aria-controls", "aria-valuenow"]; -function render$M(_ctx, _cache, $props, $setup, $data, $options) { +var _hoisted_1$1l = ["id"]; +var _hoisted_2$_ = ["aria-controls", "aria-valuenow"]; +var _hoisted_3$u = ["aria-controls", "aria-valuenow"]; +function render$P(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("div", mergeProps({ "class": _ctx.cx("root") }, _ctx.ptmi("root")), [createBaseVNode("div", mergeProps({ @@ -112889,7 +139269,7 @@ function render$M(_ctx, _cache, $props, $setup, $data, $options) { onMouseenter: _cache[1] || (_cache[1] = function() { return $options.moveBar && $options.moveBar.apply($options, arguments); }) - }, _ctx.ptm("content")), [renderSlot(_ctx.$slots, "default")], 16, _hoisted_1$1g)], 16), createBaseVNode("div", mergeProps({ + }, _ctx.ptm("content")), [renderSlot(_ctx.$slots, "default")], 16, _hoisted_1$1l)], 16), createBaseVNode("div", mergeProps({ ref: "xBar", "class": _ctx.cx("barx"), tabindex: "0", @@ -112914,7 +139294,7 @@ function render$M(_ctx, _cache, $props, $setup, $data, $options) { }) }, _ctx.ptm("barx"), { "data-pc-group-section": "bar" - }), null, 16, _hoisted_2$X), createBaseVNode("div", mergeProps({ + }), null, 16, _hoisted_2$_), createBaseVNode("div", mergeProps({ ref: "yBar", "class": _ctx.cx("bary"), tabindex: "0", @@ -112936,15 +139316,15 @@ function render$M(_ctx, _cache, $props, $setup, $data, $options) { }) }, _ctx.ptm("bary"), { "data-pc-group-section": "bar" - }), null, 16, _hoisted_3$t)], 16); + }), null, 16, _hoisted_3$u)], 16); } -__name(render$M, "render$M"); -script$N.render = render$M; -var theme$r = /* @__PURE__ */ __name(function theme12(_ref) { +__name(render$P, "render$P"); +script$Q.render = render$P; +var theme$t = /* @__PURE__ */ __name(function theme12(_ref) { var dt2 = _ref.dt; return "\n.p-card {\n background: ".concat(dt2("card.background"), ";\n color: ").concat(dt2("card.color"), ";\n box-shadow: ").concat(dt2("card.shadow"), ";\n border-radius: ").concat(dt2("card.border.radius"), ";\n display: flex;\n flex-direction: column;\n}\n\n.p-card-caption {\n display: flex;\n flex-direction: column;\n gap: ").concat(dt2("card.caption.gap"), ";\n}\n\n.p-card-body {\n padding: ").concat(dt2("card.body.padding"), ";\n display: flex;\n flex-direction: column;\n gap: ").concat(dt2("card.body.gap"), ";\n}\n\n.p-card-title {\n font-size: ").concat(dt2("card.title.font.size"), ";\n font-weight: ").concat(dt2("card.title.font.weight"), ";\n}\n\n.p-card-subtitle {\n color: ").concat(dt2("card.subtitle.color"), ";\n}\n"); }, "theme"); -var classes$t = { +var classes$v = { root: "p-card p-component", header: "p-card-header", body: "p-card-body", @@ -112956,12 +139336,12 @@ var classes$t = { }; var CardStyle = BaseStyle.extend({ name: "card", - theme: theme$r, - classes: classes$t + theme: theme$t, + classes: classes$v }); -var script$1$u = { +var script$1$w = { name: "BaseCard", - "extends": script$_, + "extends": script$11, style: CardStyle, provide: /* @__PURE__ */ __name(function provide11() { return { @@ -112970,12 +139350,12 @@ var script$1$u = { }; }, "provide") }; -var script$M = { +var script$P = { name: "Card", - "extends": script$1$u, + "extends": script$1$w, inheritAttrs: false }; -function render$L(_ctx, _cache, $props, $setup, $data, $options) { +function render$O(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("div", mergeProps({ "class": _ctx.cx("root") }, _ctx.ptmi("root")), [_ctx.$slots.header ? (openBlock(), createElementBlock("div", mergeProps({ @@ -112999,12 +139379,12 @@ function render$L(_ctx, _cache, $props, $setup, $data, $options) { "class": _ctx.cx("footer") }, _ctx.ptm("footer")), [renderSlot(_ctx.$slots, "footer")], 16)) : createCommentVNode("", true)], 16)], 16); } -__name(render$L, "render$L"); -script$M.render = render$L; -const _withScopeId$m = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-f2b77816"), n = n(), popScopeId(), n), "_withScopeId$m"); -const _hoisted_1$1f = { class: "flex flex-col items-center" }; -const _hoisted_2$W = { class: "whitespace-pre-line text-center" }; -const _sfc_main$X = /* @__PURE__ */ defineComponent({ +__name(render$O, "render$O"); +script$P.render = render$O; +const _withScopeId$m = /* @__PURE__ */ __name((n2) => (pushScopeId("data-v-f2b77816"), n2 = n2(), popScopeId(), n2), "_withScopeId$m"); +const _hoisted_1$1k = { class: "flex flex-col items-center" }; +const _hoisted_2$Z = { class: "whitespace-pre-line text-center" }; +const _sfc_main$Y = /* @__PURE__ */ defineComponent({ __name: "NoResultsPlaceholder", props: { class: {}, @@ -113020,16 +139400,16 @@ const _sfc_main$X = /* @__PURE__ */ defineComponent({ return openBlock(), createElementBlock("div", { class: normalizeClass(["no-results-placeholder p-8 h-full", props.class]) }, [ - createVNode(unref(script$M), null, { + createVNode(unref(script$P), null, { content: withCtx(() => [ - createBaseVNode("div", _hoisted_1$1f, [ + createBaseVNode("div", _hoisted_1$1k, [ createBaseVNode("i", { class: normalizeClass(_ctx.icon), style: { "font-size": "3rem", "margin-bottom": "1rem" } }, null, 2), createBaseVNode("h3", null, toDisplayString$1(_ctx.title), 1), - createBaseVNode("p", _hoisted_2$W, toDisplayString$1(_ctx.message), 1), - _ctx.buttonLabel ? (openBlock(), createBlock(unref(script$R), { + createBaseVNode("p", _hoisted_2$Z, toDisplayString$1(_ctx.message), 1), + _ctx.buttonLabel ? (openBlock(), createBlock(unref(script$U), { key: 0, label: _ctx.buttonLabel, onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("action")), @@ -113043,8 +139423,8 @@ const _sfc_main$X = /* @__PURE__ */ defineComponent({ }; } }); -const NoResultsPlaceholder = /* @__PURE__ */ _export_sfc(_sfc_main$X, [["__scopeId", "data-v-f2b77816"]]); -const _sfc_main$W = /* @__PURE__ */ defineComponent({ +const NoResultsPlaceholder = /* @__PURE__ */ _export_sfc(_sfc_main$Y, [["__scopeId", "data-v-f2b77816"]]); +const _sfc_main$X = /* @__PURE__ */ defineComponent({ __name: "FindIssueButton", props: { errorMessage: {}, @@ -113060,7 +139440,7 @@ const _sfc_main$W = /* @__PURE__ */ defineComponent({ window.open(url, "_blank"); }, "openGitHubIssues"); return (_ctx, _cache) => { - return openBlock(), createBlock(unref(script$R), { + return openBlock(), createBlock(unref(script$U), { onClick: openGitHubIssues, label: _ctx.$t("g.findIssues"), severity: "secondary", @@ -113069,52 +139449,6 @@ const _sfc_main$W = /* @__PURE__ */ defineComponent({ }; } }); -const _sfc_main$V = /* @__PURE__ */ defineComponent({ - __name: "ReportIssueButton", - props: { - error: {} - }, - setup(__props) { - const { error: error2 } = __props; - const { t: t2 } = useI18n(); - const toast = useToast(); - const submitting = ref(false); - const submitted = ref(false); - const icon3 = computed( - () => `pi ${submitting.value ? "pi-spin pi-spinner" : "pi-send"}` - ); - const reportIssue = /* @__PURE__ */ __name(async () => { - if (submitting.value) return; - submitting.value = true; - try { - await electronAPI().sendErrorToSentry(error2.exception_message, { - stackTrace: error2.traceback?.join("\n"), - nodeType: error2.node_type - }); - submitted.value = true; - toast.add({ - severity: "success", - summary: t2("g.reportSent"), - life: 3e3 - }); - } finally { - submitting.value = false; - } - }, "reportIssue"); - return (_ctx, _cache) => { - const _directive_tooltip = resolveDirective("tooltip"); - return withDirectives((openBlock(), createBlock(unref(script$R), { - onClick: reportIssue, - label: _ctx.$t("g.reportIssue"), - severity: submitted.value ? "success" : "secondary", - icon: icon3.value, - disabled: submitted.value - }, null, 8, ["label", "severity", "icon", "disabled"])), [ - [_directive_tooltip, _ctx.$t("g.reportIssueTooltip")] - ]); - }; - } -}); function useCopyToClipboard() { const { copy: copy2, isSupported: isSupported2 } = useClipboard(); const toast = useToast(); @@ -113148,10 +139482,2080 @@ function useCopyToClipboard() { }; } __name(useCopyToClipboard, "useCopyToClipboard"); -const _withScopeId$l = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-ddf3e2da"), n = n(), popScopeId(), n), "_withScopeId$l"); -const _hoisted_1$1e = { class: "comfy-error-report" }; -const _hoisted_2$V = { class: "wrapper-pre" }; -const _hoisted_3$s = { class: "action-container" }; +function listCacheClear$1() { + this.__data__ = []; + this.size = 0; +} +__name(listCacheClear$1, "listCacheClear$1"); +var _listCacheClear = listCacheClear$1; +const _listCacheClear$1 = /* @__PURE__ */ getDefaultExportFromCjs(_listCacheClear); +function eq$2(value4, other) { + return value4 === other || value4 !== value4 && other !== other; +} +__name(eq$2, "eq$2"); +var eq_1 = eq$2; +const eq$3 = /* @__PURE__ */ getDefaultExportFromCjs(eq_1); +var eq$1 = eq_1; +function assocIndexOf$4(array, key) { + var length = array.length; + while (length--) { + if (eq$1(array[length][0], key)) { + return length; + } + } + return -1; +} +__name(assocIndexOf$4, "assocIndexOf$4"); +var _assocIndexOf = assocIndexOf$4; +const _assocIndexOf$1 = /* @__PURE__ */ getDefaultExportFromCjs(_assocIndexOf); +var assocIndexOf$3 = _assocIndexOf; +var arrayProto = Array.prototype; +var splice = arrayProto.splice; +function listCacheDelete$1(key) { + var data25 = this.__data__, index2 = assocIndexOf$3(data25, key); + if (index2 < 0) { + return false; + } + var lastIndex2 = data25.length - 1; + if (index2 == lastIndex2) { + data25.pop(); + } else { + splice.call(data25, index2, 1); + } + --this.size; + return true; +} +__name(listCacheDelete$1, "listCacheDelete$1"); +var _listCacheDelete = listCacheDelete$1; +const _listCacheDelete$1 = /* @__PURE__ */ getDefaultExportFromCjs(_listCacheDelete); +var assocIndexOf$2 = _assocIndexOf; +function listCacheGet$1(key) { + var data25 = this.__data__, index2 = assocIndexOf$2(data25, key); + return index2 < 0 ? void 0 : data25[index2][1]; +} +__name(listCacheGet$1, "listCacheGet$1"); +var _listCacheGet = listCacheGet$1; +const _listCacheGet$1 = /* @__PURE__ */ getDefaultExportFromCjs(_listCacheGet); +var assocIndexOf$1 = _assocIndexOf; +function listCacheHas$1(key) { + return assocIndexOf$1(this.__data__, key) > -1; +} +__name(listCacheHas$1, "listCacheHas$1"); +var _listCacheHas = listCacheHas$1; +const _listCacheHas$1 = /* @__PURE__ */ getDefaultExportFromCjs(_listCacheHas); +var assocIndexOf = _assocIndexOf; +function listCacheSet$1(key, value4) { + var data25 = this.__data__, index2 = assocIndexOf(data25, key); + if (index2 < 0) { + ++this.size; + data25.push([key, value4]); + } else { + data25[index2][1] = value4; + } + return this; +} +__name(listCacheSet$1, "listCacheSet$1"); +var _listCacheSet = listCacheSet$1; +const _listCacheSet$1 = /* @__PURE__ */ getDefaultExportFromCjs(_listCacheSet); +var listCacheClear = _listCacheClear, listCacheDelete = _listCacheDelete, listCacheGet = _listCacheGet, listCacheHas = _listCacheHas, listCacheSet = _listCacheSet; +function ListCache$4(entries) { + var index2 = -1, length = entries == null ? 0 : entries.length; + this.clear(); + while (++index2 < length) { + var entry = entries[index2]; + this.set(entry[0], entry[1]); + } +} +__name(ListCache$4, "ListCache$4"); +ListCache$4.prototype.clear = listCacheClear; +ListCache$4.prototype["delete"] = listCacheDelete; +ListCache$4.prototype.get = listCacheGet; +ListCache$4.prototype.has = listCacheHas; +ListCache$4.prototype.set = listCacheSet; +var _ListCache = ListCache$4; +const _ListCache$1 = /* @__PURE__ */ getDefaultExportFromCjs(_ListCache); +var ListCache$3 = _ListCache; +function stackClear$1() { + this.__data__ = new ListCache$3(); + this.size = 0; +} +__name(stackClear$1, "stackClear$1"); +var _stackClear = stackClear$1; +const _stackClear$1 = /* @__PURE__ */ getDefaultExportFromCjs(_stackClear); +function stackDelete$1(key) { + var data25 = this.__data__, result = data25["delete"](key); + this.size = data25.size; + return result; +} +__name(stackDelete$1, "stackDelete$1"); +var _stackDelete = stackDelete$1; +const _stackDelete$1 = /* @__PURE__ */ getDefaultExportFromCjs(_stackDelete); +function stackGet$1(key) { + return this.__data__.get(key); +} +__name(stackGet$1, "stackGet$1"); +var _stackGet = stackGet$1; +const _stackGet$1 = /* @__PURE__ */ getDefaultExportFromCjs(_stackGet); +function stackHas$1(key) { + return this.__data__.has(key); +} +__name(stackHas$1, "stackHas$1"); +var _stackHas = stackHas$1; +const _stackHas$1 = /* @__PURE__ */ getDefaultExportFromCjs(_stackHas); +var freeGlobal$1 = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal; +var _freeGlobal = freeGlobal$1; +const _freeGlobal$1 = /* @__PURE__ */ getDefaultExportFromCjs(_freeGlobal); +var freeGlobal = _freeGlobal; +var freeSelf = typeof self == "object" && self && self.Object === Object && self; +var root$8 = freeGlobal || freeSelf || Function("return this")(); +var _root = root$8; +const _root$1 = /* @__PURE__ */ getDefaultExportFromCjs(_root); +var root$7 = _root; +var Symbol$4 = root$7.Symbol; +var _Symbol = Symbol$4; +const _Symbol$1 = /* @__PURE__ */ getDefaultExportFromCjs(_Symbol); +var Symbol$3 = _Symbol; +var objectProto$c = Object.prototype; +var hasOwnProperty$9 = objectProto$c.hasOwnProperty; +var nativeObjectToString$1 = objectProto$c.toString; +var symToStringTag$1 = Symbol$3 ? Symbol$3.toStringTag : void 0; +function getRawTag$1(value4) { + var isOwn = hasOwnProperty$9.call(value4, symToStringTag$1), tag = value4[symToStringTag$1]; + try { + value4[symToStringTag$1] = void 0; + var unmasked = true; + } catch (e2) { + } + var result = nativeObjectToString$1.call(value4); + if (unmasked) { + if (isOwn) { + value4[symToStringTag$1] = tag; + } else { + delete value4[symToStringTag$1]; + } + } + return result; +} +__name(getRawTag$1, "getRawTag$1"); +var _getRawTag = getRawTag$1; +const _getRawTag$1 = /* @__PURE__ */ getDefaultExportFromCjs(_getRawTag); +var objectProto$b = Object.prototype; +var nativeObjectToString = objectProto$b.toString; +function objectToString$1(value4) { + return nativeObjectToString.call(value4); +} +__name(objectToString$1, "objectToString$1"); +var _objectToString = objectToString$1; +const _objectToString$1 = /* @__PURE__ */ getDefaultExportFromCjs(_objectToString); +var Symbol$2 = _Symbol, getRawTag = _getRawTag, objectToString = _objectToString; +var nullTag = "[object Null]", undefinedTag = "[object Undefined]"; +var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0; +function baseGetTag$4(value4) { + if (value4 == null) { + return value4 === void 0 ? undefinedTag : nullTag; + } + return symToStringTag && symToStringTag in Object(value4) ? getRawTag(value4) : objectToString(value4); +} +__name(baseGetTag$4, "baseGetTag$4"); +var _baseGetTag = baseGetTag$4; +const _baseGetTag$1 = /* @__PURE__ */ getDefaultExportFromCjs(_baseGetTag); +function isObject$7(value4) { + var type = typeof value4; + return value4 != null && (type == "object" || type == "function"); +} +__name(isObject$7, "isObject$7"); +var isObject_1 = isObject$7; +const isObject$8 = /* @__PURE__ */ getDefaultExportFromCjs(isObject_1); +var baseGetTag$3 = _baseGetTag, isObject$6 = isObject_1; +var asyncTag = "[object AsyncFunction]", funcTag$2 = "[object Function]", genTag$1 = "[object GeneratorFunction]", proxyTag = "[object Proxy]"; +function isFunction$4(value4) { + if (!isObject$6(value4)) { + return false; + } + var tag = baseGetTag$3(value4); + return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag; +} +__name(isFunction$4, "isFunction$4"); +var isFunction_1 = isFunction$4; +const isFunction$5 = /* @__PURE__ */ getDefaultExportFromCjs(isFunction_1); +var root$6 = _root; +var coreJsData$1 = root$6["__core-js_shared__"]; +var _coreJsData = coreJsData$1; +const _coreJsData$1 = /* @__PURE__ */ getDefaultExportFromCjs(_coreJsData); +var coreJsData = _coreJsData; +var maskSrcKey = function() { + var uid2 = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ""); + return uid2 ? "Symbol(src)_1." + uid2 : ""; +}(); +function isMasked$1(func) { + return !!maskSrcKey && maskSrcKey in func; +} +__name(isMasked$1, "isMasked$1"); +var _isMasked = isMasked$1; +const _isMasked$1 = /* @__PURE__ */ getDefaultExportFromCjs(_isMasked); +var funcProto$1 = Function.prototype; +var funcToString$1 = funcProto$1.toString; +function toSource$2(func) { + if (func != null) { + try { + return funcToString$1.call(func); + } catch (e2) { + } + try { + return func + ""; + } catch (e2) { + } + } + return ""; +} +__name(toSource$2, "toSource$2"); +var _toSource = toSource$2; +const _toSource$1 = /* @__PURE__ */ getDefaultExportFromCjs(_toSource); +var isFunction$3 = isFunction_1, isMasked = _isMasked, isObject$5 = isObject_1, toSource$1 = _toSource; +var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; +var reIsHostCtor = /^\[object .+?Constructor\]$/; +var funcProto = Function.prototype, objectProto$a = Object.prototype; +var funcToString = funcProto.toString; +var hasOwnProperty$8 = objectProto$a.hasOwnProperty; +var reIsNative = RegExp( + "^" + funcToString.call(hasOwnProperty$8).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" +); +function baseIsNative$1(value4) { + if (!isObject$5(value4) || isMasked(value4)) { + return false; + } + var pattern = isFunction$3(value4) ? reIsNative : reIsHostCtor; + return pattern.test(toSource$1(value4)); +} +__name(baseIsNative$1, "baseIsNative$1"); +var _baseIsNative = baseIsNative$1; +const _baseIsNative$1 = /* @__PURE__ */ getDefaultExportFromCjs(_baseIsNative); +function getValue$1(object, key) { + return object == null ? void 0 : object[key]; +} +__name(getValue$1, "getValue$1"); +var _getValue = getValue$1; +const _getValue$1 = /* @__PURE__ */ getDefaultExportFromCjs(_getValue); +var baseIsNative = _baseIsNative, getValue = _getValue; +function getNative$7(object, key) { + var value4 = getValue(object, key); + return baseIsNative(value4) ? value4 : void 0; +} +__name(getNative$7, "getNative$7"); +var _getNative = getNative$7; +const _getNative$1 = /* @__PURE__ */ getDefaultExportFromCjs(_getNative); +var getNative$6 = _getNative, root$5 = _root; +var Map$4 = getNative$6(root$5, "Map"); +var _Map = Map$4; +const _Map$1 = /* @__PURE__ */ getDefaultExportFromCjs(_Map); +var getNative$5 = _getNative; +var nativeCreate$4 = getNative$5(Object, "create"); +var _nativeCreate = nativeCreate$4; +const _nativeCreate$1 = /* @__PURE__ */ getDefaultExportFromCjs(_nativeCreate); +var nativeCreate$3 = _nativeCreate; +function hashClear$1() { + this.__data__ = nativeCreate$3 ? nativeCreate$3(null) : {}; + this.size = 0; +} +__name(hashClear$1, "hashClear$1"); +var _hashClear = hashClear$1; +const _hashClear$1 = /* @__PURE__ */ getDefaultExportFromCjs(_hashClear); +function hashDelete$1(key) { + var result = this.has(key) && delete this.__data__[key]; + this.size -= result ? 1 : 0; + return result; +} +__name(hashDelete$1, "hashDelete$1"); +var _hashDelete = hashDelete$1; +const _hashDelete$1 = /* @__PURE__ */ getDefaultExportFromCjs(_hashDelete); +var nativeCreate$2 = _nativeCreate; +var HASH_UNDEFINED$1 = "__lodash_hash_undefined__"; +var objectProto$9 = Object.prototype; +var hasOwnProperty$7 = objectProto$9.hasOwnProperty; +function hashGet$1(key) { + var data25 = this.__data__; + if (nativeCreate$2) { + var result = data25[key]; + return result === HASH_UNDEFINED$1 ? void 0 : result; + } + return hasOwnProperty$7.call(data25, key) ? data25[key] : void 0; +} +__name(hashGet$1, "hashGet$1"); +var _hashGet = hashGet$1; +const _hashGet$1 = /* @__PURE__ */ getDefaultExportFromCjs(_hashGet); +var nativeCreate$1 = _nativeCreate; +var objectProto$8 = Object.prototype; +var hasOwnProperty$6 = objectProto$8.hasOwnProperty; +function hashHas$1(key) { + var data25 = this.__data__; + return nativeCreate$1 ? data25[key] !== void 0 : hasOwnProperty$6.call(data25, key); +} +__name(hashHas$1, "hashHas$1"); +var _hashHas = hashHas$1; +const _hashHas$1 = /* @__PURE__ */ getDefaultExportFromCjs(_hashHas); +var nativeCreate = _nativeCreate; +var HASH_UNDEFINED = "__lodash_hash_undefined__"; +function hashSet$1(key, value4) { + var data25 = this.__data__; + this.size += this.has(key) ? 0 : 1; + data25[key] = nativeCreate && value4 === void 0 ? HASH_UNDEFINED : value4; + return this; +} +__name(hashSet$1, "hashSet$1"); +var _hashSet = hashSet$1; +const _hashSet$1 = /* @__PURE__ */ getDefaultExportFromCjs(_hashSet); +var hashClear = _hashClear, hashDelete = _hashDelete, hashGet = _hashGet, hashHas = _hashHas, hashSet = _hashSet; +function Hash$1(entries) { + var index2 = -1, length = entries == null ? 0 : entries.length; + this.clear(); + while (++index2 < length) { + var entry = entries[index2]; + this.set(entry[0], entry[1]); + } +} +__name(Hash$1, "Hash$1"); +Hash$1.prototype.clear = hashClear; +Hash$1.prototype["delete"] = hashDelete; +Hash$1.prototype.get = hashGet; +Hash$1.prototype.has = hashHas; +Hash$1.prototype.set = hashSet; +var _Hash = Hash$1; +const _Hash$1 = /* @__PURE__ */ getDefaultExportFromCjs(_Hash); +var Hash = _Hash, ListCache$2 = _ListCache, Map$3 = _Map; +function mapCacheClear$1() { + this.size = 0; + this.__data__ = { + "hash": new Hash(), + "map": new (Map$3 || ListCache$2)(), + "string": new Hash() + }; +} +__name(mapCacheClear$1, "mapCacheClear$1"); +var _mapCacheClear = mapCacheClear$1; +const _mapCacheClear$1 = /* @__PURE__ */ getDefaultExportFromCjs(_mapCacheClear); +function isKeyable$1(value4) { + var type = typeof value4; + return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value4 !== "__proto__" : value4 === null; +} +__name(isKeyable$1, "isKeyable$1"); +var _isKeyable = isKeyable$1; +const _isKeyable$1 = /* @__PURE__ */ getDefaultExportFromCjs(_isKeyable); +var isKeyable = _isKeyable; +function getMapData$4(map3, key) { + var data25 = map3.__data__; + return isKeyable(key) ? data25[typeof key == "string" ? "string" : "hash"] : data25.map; +} +__name(getMapData$4, "getMapData$4"); +var _getMapData = getMapData$4; +const _getMapData$1 = /* @__PURE__ */ getDefaultExportFromCjs(_getMapData); +var getMapData$3 = _getMapData; +function mapCacheDelete$1(key) { + var result = getMapData$3(this, key)["delete"](key); + this.size -= result ? 1 : 0; + return result; +} +__name(mapCacheDelete$1, "mapCacheDelete$1"); +var _mapCacheDelete = mapCacheDelete$1; +const _mapCacheDelete$1 = /* @__PURE__ */ getDefaultExportFromCjs(_mapCacheDelete); +var getMapData$2 = _getMapData; +function mapCacheGet$1(key) { + return getMapData$2(this, key).get(key); +} +__name(mapCacheGet$1, "mapCacheGet$1"); +var _mapCacheGet = mapCacheGet$1; +const _mapCacheGet$1 = /* @__PURE__ */ getDefaultExportFromCjs(_mapCacheGet); +var getMapData$1 = _getMapData; +function mapCacheHas$1(key) { + return getMapData$1(this, key).has(key); +} +__name(mapCacheHas$1, "mapCacheHas$1"); +var _mapCacheHas = mapCacheHas$1; +const _mapCacheHas$1 = /* @__PURE__ */ getDefaultExportFromCjs(_mapCacheHas); +var getMapData = _getMapData; +function mapCacheSet$1(key, value4) { + var data25 = getMapData(this, key), size2 = data25.size; + data25.set(key, value4); + this.size += data25.size == size2 ? 0 : 1; + return this; +} +__name(mapCacheSet$1, "mapCacheSet$1"); +var _mapCacheSet = mapCacheSet$1; +const _mapCacheSet$1 = /* @__PURE__ */ getDefaultExportFromCjs(_mapCacheSet); +var mapCacheClear = _mapCacheClear, mapCacheDelete = _mapCacheDelete, mapCacheGet = _mapCacheGet, mapCacheHas = _mapCacheHas, mapCacheSet = _mapCacheSet; +function MapCache$1(entries) { + var index2 = -1, length = entries == null ? 0 : entries.length; + this.clear(); + while (++index2 < length) { + var entry = entries[index2]; + this.set(entry[0], entry[1]); + } +} +__name(MapCache$1, "MapCache$1"); +MapCache$1.prototype.clear = mapCacheClear; +MapCache$1.prototype["delete"] = mapCacheDelete; +MapCache$1.prototype.get = mapCacheGet; +MapCache$1.prototype.has = mapCacheHas; +MapCache$1.prototype.set = mapCacheSet; +var _MapCache = MapCache$1; +const _MapCache$1 = /* @__PURE__ */ getDefaultExportFromCjs(_MapCache); +var ListCache$1 = _ListCache, Map$2 = _Map, MapCache = _MapCache; +var LARGE_ARRAY_SIZE = 200; +function stackSet$1(key, value4) { + var data25 = this.__data__; + if (data25 instanceof ListCache$1) { + var pairs = data25.__data__; + if (!Map$2 || pairs.length < LARGE_ARRAY_SIZE - 1) { + pairs.push([key, value4]); + this.size = ++data25.size; + return this; + } + data25 = this.__data__ = new MapCache(pairs); + } + data25.set(key, value4); + this.size = data25.size; + return this; +} +__name(stackSet$1, "stackSet$1"); +var _stackSet = stackSet$1; +const _stackSet$1 = /* @__PURE__ */ getDefaultExportFromCjs(_stackSet); +var ListCache = _ListCache, stackClear = _stackClear, stackDelete = _stackDelete, stackGet = _stackGet, stackHas = _stackHas, stackSet = _stackSet; +function Stack$1(entries) { + var data25 = this.__data__ = new ListCache(entries); + this.size = data25.size; +} +__name(Stack$1, "Stack$1"); +Stack$1.prototype.clear = stackClear; +Stack$1.prototype["delete"] = stackDelete; +Stack$1.prototype.get = stackGet; +Stack$1.prototype.has = stackHas; +Stack$1.prototype.set = stackSet; +var _Stack = Stack$1; +const _Stack$1 = /* @__PURE__ */ getDefaultExportFromCjs(_Stack); +function arrayEach$1(array, iteratee) { + var index2 = -1, length = array == null ? 0 : array.length; + while (++index2 < length) { + if (iteratee(array[index2], index2, array) === false) { + break; + } + } + return array; +} +__name(arrayEach$1, "arrayEach$1"); +var _arrayEach = arrayEach$1; +const _arrayEach$1 = /* @__PURE__ */ getDefaultExportFromCjs(_arrayEach); +var getNative$4 = _getNative; +var defineProperty$1 = function() { + try { + var func = getNative$4(Object, "defineProperty"); + func({}, "", {}); + return func; + } catch (e2) { + } +}(); +var _defineProperty$a = defineProperty$1; +const _defineProperty$b = /* @__PURE__ */ getDefaultExportFromCjs(_defineProperty$a); +var defineProperty = _defineProperty$a; +function baseAssignValue$2(object, key, value4) { + if (key == "__proto__" && defineProperty) { + defineProperty(object, key, { + "configurable": true, + "enumerable": true, + "value": value4, + "writable": true + }); + } else { + object[key] = value4; + } +} +__name(baseAssignValue$2, "baseAssignValue$2"); +var _baseAssignValue = baseAssignValue$2; +const _baseAssignValue$1 = /* @__PURE__ */ getDefaultExportFromCjs(_baseAssignValue); +var baseAssignValue$1 = _baseAssignValue, eq = eq_1; +var objectProto$7 = Object.prototype; +var hasOwnProperty$5 = objectProto$7.hasOwnProperty; +function assignValue$2(object, key, value4) { + var objValue = object[key]; + if (!(hasOwnProperty$5.call(object, key) && eq(objValue, value4)) || value4 === void 0 && !(key in object)) { + baseAssignValue$1(object, key, value4); + } +} +__name(assignValue$2, "assignValue$2"); +var _assignValue = assignValue$2; +const _assignValue$1 = /* @__PURE__ */ getDefaultExportFromCjs(_assignValue); +var assignValue$1 = _assignValue, baseAssignValue = _baseAssignValue; +function copyObject$4(source, props, object, customizer) { + var isNew = !object; + object || (object = {}); + var index2 = -1, length = props.length; + while (++index2 < length) { + var key = props[index2]; + var newValue2 = customizer ? customizer(object[key], source[key], key, object, source) : void 0; + if (newValue2 === void 0) { + newValue2 = source[key]; + } + if (isNew) { + baseAssignValue(object, key, newValue2); + } else { + assignValue$1(object, key, newValue2); + } + } + return object; +} +__name(copyObject$4, "copyObject$4"); +var _copyObject = copyObject$4; +const _copyObject$1 = /* @__PURE__ */ getDefaultExportFromCjs(_copyObject); +function baseTimes$1(n2, iteratee) { + var index2 = -1, result = Array(n2); + while (++index2 < n2) { + result[index2] = iteratee(index2); + } + return result; +} +__name(baseTimes$1, "baseTimes$1"); +var _baseTimes = baseTimes$1; +const _baseTimes$1 = /* @__PURE__ */ getDefaultExportFromCjs(_baseTimes); +function isObjectLike$6(value4) { + return value4 != null && typeof value4 == "object"; +} +__name(isObjectLike$6, "isObjectLike$6"); +var isObjectLike_1 = isObjectLike$6; +const isObjectLike$7 = /* @__PURE__ */ getDefaultExportFromCjs(isObjectLike_1); +var baseGetTag$2 = _baseGetTag, isObjectLike$5 = isObjectLike_1; +var argsTag$2 = "[object Arguments]"; +function baseIsArguments$1(value4) { + return isObjectLike$5(value4) && baseGetTag$2(value4) == argsTag$2; +} +__name(baseIsArguments$1, "baseIsArguments$1"); +var _baseIsArguments = baseIsArguments$1; +const _baseIsArguments$1 = /* @__PURE__ */ getDefaultExportFromCjs(_baseIsArguments); +var baseIsArguments = _baseIsArguments, isObjectLike$4 = isObjectLike_1; +var objectProto$6 = Object.prototype; +var hasOwnProperty$4 = objectProto$6.hasOwnProperty; +var propertyIsEnumerable$1 = objectProto$6.propertyIsEnumerable; +var isArguments$1 = baseIsArguments(/* @__PURE__ */ function() { + return arguments; +}()) ? baseIsArguments : function(value4) { + return isObjectLike$4(value4) && hasOwnProperty$4.call(value4, "callee") && !propertyIsEnumerable$1.call(value4, "callee"); +}; +var isArguments_1 = isArguments$1; +const isArguments$2 = /* @__PURE__ */ getDefaultExportFromCjs(isArguments_1); +var isArray$4 = Array.isArray; +var isArray_1 = isArray$4; +const isArray$5 = /* @__PURE__ */ getDefaultExportFromCjs(isArray_1); +var isBuffer$3 = { exports: {} }; +function stubFalse() { + return false; +} +__name(stubFalse, "stubFalse"); +var stubFalse_1 = stubFalse; +const stubFalse$1 = /* @__PURE__ */ getDefaultExportFromCjs(stubFalse_1); +var isBuffer_1 = isBuffer$3.exports; +(function(module2, exports) { + var root27 = _root, stubFalse2 = stubFalse_1; + var freeExports = exports && !exports.nodeType && exports; + var freeModule = freeExports && true && module2 && !module2.nodeType && module2; + var moduleExports = freeModule && freeModule.exports === freeExports; + var Buffer2 = moduleExports ? root27.Buffer : void 0; + var nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0; + var isBuffer2 = nativeIsBuffer || stubFalse2; + module2.exports = isBuffer2; +})(isBuffer$3, isBuffer$3.exports); +var isBufferExports = isBuffer$3.exports; +const isBuffer$2 = /* @__PURE__ */ getDefaultExportFromCjs(isBufferExports); +var MAX_SAFE_INTEGER$1 = 9007199254740991; +var reIsUint = /^(?:0|[1-9]\d*)$/; +function isIndex$1(value4, length) { + var type = typeof value4; + length = length == null ? MAX_SAFE_INTEGER$1 : length; + return !!length && (type == "number" || type != "symbol" && reIsUint.test(value4)) && (value4 > -1 && value4 % 1 == 0 && value4 < length); +} +__name(isIndex$1, "isIndex$1"); +var _isIndex = isIndex$1; +const _isIndex$1 = /* @__PURE__ */ getDefaultExportFromCjs(_isIndex); +var MAX_SAFE_INTEGER = 9007199254740991; +function isLength$2(value4) { + return typeof value4 == "number" && value4 > -1 && value4 % 1 == 0 && value4 <= MAX_SAFE_INTEGER; +} +__name(isLength$2, "isLength$2"); +var isLength_1 = isLength$2; +const isLength$3 = /* @__PURE__ */ getDefaultExportFromCjs(isLength_1); +var baseGetTag$1 = _baseGetTag, isLength$1 = isLength_1, isObjectLike$3 = isObjectLike_1; +var argsTag$1 = "[object Arguments]", arrayTag$1 = "[object Array]", boolTag$2 = "[object Boolean]", dateTag$2 = "[object Date]", errorTag$1 = "[object Error]", funcTag$1 = "[object Function]", mapTag$4 = "[object Map]", numberTag$2 = "[object Number]", objectTag$2 = "[object Object]", regexpTag$2 = "[object RegExp]", setTag$4 = "[object Set]", stringTag$2 = "[object String]", weakMapTag$2 = "[object WeakMap]"; +var arrayBufferTag$2 = "[object ArrayBuffer]", dataViewTag$3 = "[object DataView]", float32Tag$2 = "[object Float32Array]", float64Tag$2 = "[object Float64Array]", int8Tag$2 = "[object Int8Array]", int16Tag$2 = "[object Int16Array]", int32Tag$2 = "[object Int32Array]", uint8Tag$2 = "[object Uint8Array]", uint8ClampedTag$2 = "[object Uint8ClampedArray]", uint16Tag$2 = "[object Uint16Array]", uint32Tag$2 = "[object Uint32Array]"; +var typedArrayTags = {}; +typedArrayTags[float32Tag$2] = typedArrayTags[float64Tag$2] = typedArrayTags[int8Tag$2] = typedArrayTags[int16Tag$2] = typedArrayTags[int32Tag$2] = typedArrayTags[uint8Tag$2] = typedArrayTags[uint8ClampedTag$2] = typedArrayTags[uint16Tag$2] = typedArrayTags[uint32Tag$2] = true; +typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag$2] = typedArrayTags[boolTag$2] = typedArrayTags[dataViewTag$3] = typedArrayTags[dateTag$2] = typedArrayTags[errorTag$1] = typedArrayTags[funcTag$1] = typedArrayTags[mapTag$4] = typedArrayTags[numberTag$2] = typedArrayTags[objectTag$2] = typedArrayTags[regexpTag$2] = typedArrayTags[setTag$4] = typedArrayTags[stringTag$2] = typedArrayTags[weakMapTag$2] = false; +function baseIsTypedArray$1(value4) { + return isObjectLike$3(value4) && isLength$1(value4.length) && !!typedArrayTags[baseGetTag$1(value4)]; +} +__name(baseIsTypedArray$1, "baseIsTypedArray$1"); +var _baseIsTypedArray = baseIsTypedArray$1; +const _baseIsTypedArray$1 = /* @__PURE__ */ getDefaultExportFromCjs(_baseIsTypedArray); +function baseUnary$3(func) { + return function(value4) { + return func(value4); + }; +} +__name(baseUnary$3, "baseUnary$3"); +var _baseUnary = baseUnary$3; +const _baseUnary$1 = /* @__PURE__ */ getDefaultExportFromCjs(_baseUnary); +var _nodeUtil$2 = { exports: {} }; +var _nodeUtil = _nodeUtil$2.exports; +(function(module2, exports) { + var freeGlobal2 = _freeGlobal; + var freeExports = exports && !exports.nodeType && exports; + var freeModule = freeExports && true && module2 && !module2.nodeType && module2; + var moduleExports = freeModule && freeModule.exports === freeExports; + var freeProcess = moduleExports && freeGlobal2.process; + var nodeUtil2 = function() { + try { + var types = freeModule && freeModule.require && freeModule.require("util").types; + if (types) { + return types; + } + return freeProcess && freeProcess.binding && freeProcess.binding("util"); + } catch (e2) { + } + }(); + module2.exports = nodeUtil2; +})(_nodeUtil$2, _nodeUtil$2.exports); +var _nodeUtilExports = _nodeUtil$2.exports; +const _nodeUtil$1 = /* @__PURE__ */ getDefaultExportFromCjs(_nodeUtilExports); +var baseIsTypedArray = _baseIsTypedArray, baseUnary$2 = _baseUnary, nodeUtil$2 = _nodeUtilExports; +var nodeIsTypedArray = nodeUtil$2 && nodeUtil$2.isTypedArray; +var isTypedArray$1 = nodeIsTypedArray ? baseUnary$2(nodeIsTypedArray) : baseIsTypedArray; +var isTypedArray_1 = isTypedArray$1; +const isTypedArray$2 = /* @__PURE__ */ getDefaultExportFromCjs(isTypedArray_1); +var baseTimes = _baseTimes, isArguments = isArguments_1, isArray$3 = isArray_1, isBuffer$1 = isBufferExports, isIndex = _isIndex, isTypedArray = isTypedArray_1; +var objectProto$5 = Object.prototype; +var hasOwnProperty$3 = objectProto$5.hasOwnProperty; +function arrayLikeKeys$2(value4, inherited) { + var isArr = isArray$3(value4), isArg = !isArr && isArguments(value4), isBuff = !isArr && !isArg && isBuffer$1(value4), isType = !isArr && !isArg && !isBuff && isTypedArray(value4), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value4.length, String) : [], length = result.length; + for (var key in value4) { + if ((inherited || hasOwnProperty$3.call(value4, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode. + (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. + isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. + isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties. + isIndex(key, length)))) { + result.push(key); + } + } + return result; +} +__name(arrayLikeKeys$2, "arrayLikeKeys$2"); +var _arrayLikeKeys = arrayLikeKeys$2; +const _arrayLikeKeys$1 = /* @__PURE__ */ getDefaultExportFromCjs(_arrayLikeKeys); +var objectProto$4 = Object.prototype; +function isPrototype$3(value4) { + var Ctor = value4 && value4.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$4; + return value4 === proto; +} +__name(isPrototype$3, "isPrototype$3"); +var _isPrototype = isPrototype$3; +const _isPrototype$1 = /* @__PURE__ */ getDefaultExportFromCjs(_isPrototype); +function overArg$2(func, transform2) { + return function(arg) { + return func(transform2(arg)); + }; +} +__name(overArg$2, "overArg$2"); +var _overArg = overArg$2; +const _overArg$1 = /* @__PURE__ */ getDefaultExportFromCjs(_overArg); +var overArg$1 = _overArg; +var nativeKeys$1 = overArg$1(Object.keys, Object); +var _nativeKeys = nativeKeys$1; +const _nativeKeys$1 = /* @__PURE__ */ getDefaultExportFromCjs(_nativeKeys); +var isPrototype$2 = _isPrototype, nativeKeys = _nativeKeys; +var objectProto$3 = Object.prototype; +var hasOwnProperty$2 = objectProto$3.hasOwnProperty; +function baseKeys$1(object) { + if (!isPrototype$2(object)) { + return nativeKeys(object); + } + var result = []; + for (var key in Object(object)) { + if (hasOwnProperty$2.call(object, key) && key != "constructor") { + result.push(key); + } + } + return result; +} +__name(baseKeys$1, "baseKeys$1"); +var _baseKeys = baseKeys$1; +const _baseKeys$1 = /* @__PURE__ */ getDefaultExportFromCjs(_baseKeys); +var isFunction$2 = isFunction_1, isLength = isLength_1; +function isArrayLike$2(value4) { + return value4 != null && isLength(value4.length) && !isFunction$2(value4); +} +__name(isArrayLike$2, "isArrayLike$2"); +var isArrayLike_1 = isArrayLike$2; +const isArrayLike$3 = /* @__PURE__ */ getDefaultExportFromCjs(isArrayLike_1); +var arrayLikeKeys$1 = _arrayLikeKeys, baseKeys = _baseKeys, isArrayLike$1 = isArrayLike_1; +function keys$4(object) { + return isArrayLike$1(object) ? arrayLikeKeys$1(object) : baseKeys(object); +} +__name(keys$4, "keys$4"); +var keys_1 = keys$4; +const keys$5 = /* @__PURE__ */ getDefaultExportFromCjs(keys_1); +var copyObject$3 = _copyObject, keys$3 = keys_1; +function baseAssign$1(object, source) { + return object && copyObject$3(source, keys$3(source), object); +} +__name(baseAssign$1, "baseAssign$1"); +var _baseAssign = baseAssign$1; +const _baseAssign$1 = /* @__PURE__ */ getDefaultExportFromCjs(_baseAssign); +function nativeKeysIn$1(object) { + var result = []; + if (object != null) { + for (var key in Object(object)) { + result.push(key); + } + } + return result; +} +__name(nativeKeysIn$1, "nativeKeysIn$1"); +var _nativeKeysIn = nativeKeysIn$1; +const _nativeKeysIn$1 = /* @__PURE__ */ getDefaultExportFromCjs(_nativeKeysIn); +var isObject$4 = isObject_1, isPrototype$1 = _isPrototype, nativeKeysIn = _nativeKeysIn; +var objectProto$2 = Object.prototype; +var hasOwnProperty$1 = objectProto$2.hasOwnProperty; +function baseKeysIn$1(object) { + if (!isObject$4(object)) { + return nativeKeysIn(object); + } + var isProto = isPrototype$1(object), result = []; + for (var key in object) { + if (!(key == "constructor" && (isProto || !hasOwnProperty$1.call(object, key)))) { + result.push(key); + } + } + return result; +} +__name(baseKeysIn$1, "baseKeysIn$1"); +var _baseKeysIn = baseKeysIn$1; +const _baseKeysIn$1 = /* @__PURE__ */ getDefaultExportFromCjs(_baseKeysIn); +var arrayLikeKeys = _arrayLikeKeys, baseKeysIn = _baseKeysIn, isArrayLike = isArrayLike_1; +function keysIn$3(object) { + return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); +} +__name(keysIn$3, "keysIn$3"); +var keysIn_1 = keysIn$3; +const keysIn$4 = /* @__PURE__ */ getDefaultExportFromCjs(keysIn_1); +var copyObject$2 = _copyObject, keysIn$2 = keysIn_1; +function baseAssignIn$1(object, source) { + return object && copyObject$2(source, keysIn$2(source), object); +} +__name(baseAssignIn$1, "baseAssignIn$1"); +var _baseAssignIn = baseAssignIn$1; +const _baseAssignIn$1 = /* @__PURE__ */ getDefaultExportFromCjs(_baseAssignIn); +var _cloneBuffer$2 = { exports: {} }; +var _cloneBuffer = _cloneBuffer$2.exports; +(function(module2, exports) { + var root27 = _root; + var freeExports = exports && !exports.nodeType && exports; + var freeModule = freeExports && true && module2 && !module2.nodeType && module2; + var moduleExports = freeModule && freeModule.exports === freeExports; + var Buffer2 = moduleExports ? root27.Buffer : void 0, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : void 0; + function cloneBuffer2(buffer2, isDeep) { + if (isDeep) { + return buffer2.slice(); + } + var length = buffer2.length, result = allocUnsafe ? allocUnsafe(length) : new buffer2.constructor(length); + buffer2.copy(result); + return result; + } + __name(cloneBuffer2, "cloneBuffer"); + module2.exports = cloneBuffer2; +})(_cloneBuffer$2, _cloneBuffer$2.exports); +var _cloneBufferExports = _cloneBuffer$2.exports; +const _cloneBuffer$1 = /* @__PURE__ */ getDefaultExportFromCjs(_cloneBufferExports); +function copyArray$1(source, array) { + var index2 = -1, length = source.length; + array || (array = Array(length)); + while (++index2 < length) { + array[index2] = source[index2]; + } + return array; +} +__name(copyArray$1, "copyArray$1"); +var _copyArray = copyArray$1; +const _copyArray$1 = /* @__PURE__ */ getDefaultExportFromCjs(_copyArray); +function arrayFilter$1(array, predicate) { + var index2 = -1, length = array == null ? 0 : array.length, resIndex = 0, result = []; + while (++index2 < length) { + var value4 = array[index2]; + if (predicate(value4, index2, array)) { + result[resIndex++] = value4; + } + } + return result; +} +__name(arrayFilter$1, "arrayFilter$1"); +var _arrayFilter = arrayFilter$1; +const _arrayFilter$1 = /* @__PURE__ */ getDefaultExportFromCjs(_arrayFilter); +function stubArray$2() { + return []; +} +__name(stubArray$2, "stubArray$2"); +var stubArray_1 = stubArray$2; +const stubArray$3 = /* @__PURE__ */ getDefaultExportFromCjs(stubArray_1); +var arrayFilter = _arrayFilter, stubArray$1 = stubArray_1; +var objectProto$1 = Object.prototype; +var propertyIsEnumerable = objectProto$1.propertyIsEnumerable; +var nativeGetSymbols$1 = Object.getOwnPropertySymbols; +var getSymbols$3 = !nativeGetSymbols$1 ? stubArray$1 : function(object) { + if (object == null) { + return []; + } + object = Object(object); + return arrayFilter(nativeGetSymbols$1(object), function(symbol) { + return propertyIsEnumerable.call(object, symbol); + }); +}; +var _getSymbols = getSymbols$3; +const _getSymbols$1 = /* @__PURE__ */ getDefaultExportFromCjs(_getSymbols); +var copyObject$1 = _copyObject, getSymbols$2 = _getSymbols; +function copySymbols$1(source, object) { + return copyObject$1(source, getSymbols$2(source), object); +} +__name(copySymbols$1, "copySymbols$1"); +var _copySymbols = copySymbols$1; +const _copySymbols$1 = /* @__PURE__ */ getDefaultExportFromCjs(_copySymbols); +function arrayPush$2(array, values) { + var index2 = -1, length = values.length, offset = array.length; + while (++index2 < length) { + array[offset + index2] = values[index2]; + } + return array; +} +__name(arrayPush$2, "arrayPush$2"); +var _arrayPush = arrayPush$2; +const _arrayPush$1 = /* @__PURE__ */ getDefaultExportFromCjs(_arrayPush); +var overArg = _overArg; +var getPrototype$2 = overArg(Object.getPrototypeOf, Object); +var _getPrototype = getPrototype$2; +const _getPrototype$1 = /* @__PURE__ */ getDefaultExportFromCjs(_getPrototype); +var arrayPush$1 = _arrayPush, getPrototype$1 = _getPrototype, getSymbols$1 = _getSymbols, stubArray = stubArray_1; +var nativeGetSymbols = Object.getOwnPropertySymbols; +var getSymbolsIn$2 = !nativeGetSymbols ? stubArray : function(object) { + var result = []; + while (object) { + arrayPush$1(result, getSymbols$1(object)); + object = getPrototype$1(object); + } + return result; +}; +var _getSymbolsIn = getSymbolsIn$2; +const _getSymbolsIn$1 = /* @__PURE__ */ getDefaultExportFromCjs(_getSymbolsIn); +var copyObject = _copyObject, getSymbolsIn$1 = _getSymbolsIn; +function copySymbolsIn$1(source, object) { + return copyObject(source, getSymbolsIn$1(source), object); +} +__name(copySymbolsIn$1, "copySymbolsIn$1"); +var _copySymbolsIn = copySymbolsIn$1; +const _copySymbolsIn$1 = /* @__PURE__ */ getDefaultExportFromCjs(_copySymbolsIn); +var arrayPush = _arrayPush, isArray$2 = isArray_1; +function baseGetAllKeys$2(object, keysFunc, symbolsFunc) { + var result = keysFunc(object); + return isArray$2(object) ? result : arrayPush(result, symbolsFunc(object)); +} +__name(baseGetAllKeys$2, "baseGetAllKeys$2"); +var _baseGetAllKeys = baseGetAllKeys$2; +const _baseGetAllKeys$1 = /* @__PURE__ */ getDefaultExportFromCjs(_baseGetAllKeys); +var baseGetAllKeys$1 = _baseGetAllKeys, getSymbols = _getSymbols, keys$2 = keys_1; +function getAllKeys$1(object) { + return baseGetAllKeys$1(object, keys$2, getSymbols); +} +__name(getAllKeys$1, "getAllKeys$1"); +var _getAllKeys = getAllKeys$1; +const _getAllKeys$1 = /* @__PURE__ */ getDefaultExportFromCjs(_getAllKeys); +var baseGetAllKeys = _baseGetAllKeys, getSymbolsIn = _getSymbolsIn, keysIn$1 = keysIn_1; +function getAllKeysIn$1(object) { + return baseGetAllKeys(object, keysIn$1, getSymbolsIn); +} +__name(getAllKeysIn$1, "getAllKeysIn$1"); +var _getAllKeysIn = getAllKeysIn$1; +const _getAllKeysIn$1 = /* @__PURE__ */ getDefaultExportFromCjs(_getAllKeysIn); +var getNative$3 = _getNative, root$4 = _root; +var DataView$2 = getNative$3(root$4, "DataView"); +var _DataView = DataView$2; +const _DataView$1 = /* @__PURE__ */ getDefaultExportFromCjs(_DataView); +var getNative$2 = _getNative, root$3 = _root; +var Promise$2 = getNative$2(root$3, "Promise"); +var _Promise = Promise$2; +const _Promise$1 = /* @__PURE__ */ getDefaultExportFromCjs(_Promise); +var getNative$1 = _getNative, root$2 = _root; +var Set$2 = getNative$1(root$2, "Set"); +var _Set = Set$2; +const _Set$1 = /* @__PURE__ */ getDefaultExportFromCjs(_Set); +var getNative = _getNative, root$1 = _root; +var WeakMap$2 = getNative(root$1, "WeakMap"); +var _WeakMap = WeakMap$2; +const _WeakMap$1 = /* @__PURE__ */ getDefaultExportFromCjs(_WeakMap); +var DataView$1 = _DataView, Map$1 = _Map, Promise$1 = _Promise, Set$1 = _Set, WeakMap$1 = _WeakMap, baseGetTag = _baseGetTag, toSource = _toSource; +var mapTag$3 = "[object Map]", objectTag$1 = "[object Object]", promiseTag = "[object Promise]", setTag$3 = "[object Set]", weakMapTag$1 = "[object WeakMap]"; +var dataViewTag$2 = "[object DataView]"; +var dataViewCtorString = toSource(DataView$1), mapCtorString = toSource(Map$1), promiseCtorString = toSource(Promise$1), setCtorString = toSource(Set$1), weakMapCtorString = toSource(WeakMap$1); +var getTag$4 = baseGetTag; +if (DataView$1 && getTag$4(new DataView$1(new ArrayBuffer(1))) != dataViewTag$2 || Map$1 && getTag$4(new Map$1()) != mapTag$3 || Promise$1 && getTag$4(Promise$1.resolve()) != promiseTag || Set$1 && getTag$4(new Set$1()) != setTag$3 || WeakMap$1 && getTag$4(new WeakMap$1()) != weakMapTag$1) { + getTag$4 = /* @__PURE__ */ __name(function(value4) { + var result = baseGetTag(value4), Ctor = result == objectTag$1 ? value4.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : ""; + if (ctorString) { + switch (ctorString) { + case dataViewCtorString: + return dataViewTag$2; + case mapCtorString: + return mapTag$3; + case promiseCtorString: + return promiseTag; + case setCtorString: + return setTag$3; + case weakMapCtorString: + return weakMapTag$1; + } + } + return result; + }, "getTag$4"); +} +var _getTag = getTag$4; +const _getTag$1 = /* @__PURE__ */ getDefaultExportFromCjs(_getTag); +var objectProto = Object.prototype; +var hasOwnProperty = objectProto.hasOwnProperty; +function initCloneArray$1(array) { + var length = array.length, result = new array.constructor(length); + if (length && typeof array[0] == "string" && hasOwnProperty.call(array, "index")) { + result.index = array.index; + result.input = array.input; + } + return result; +} +__name(initCloneArray$1, "initCloneArray$1"); +var _initCloneArray = initCloneArray$1; +const _initCloneArray$1 = /* @__PURE__ */ getDefaultExportFromCjs(_initCloneArray); +var root = _root; +var Uint8Array$2 = root.Uint8Array; +var _Uint8Array = Uint8Array$2; +const _Uint8Array$1 = /* @__PURE__ */ getDefaultExportFromCjs(_Uint8Array); +var Uint8Array$1 = _Uint8Array; +function cloneArrayBuffer$3(arrayBuffer) { + var result = new arrayBuffer.constructor(arrayBuffer.byteLength); + new Uint8Array$1(result).set(new Uint8Array$1(arrayBuffer)); + return result; +} +__name(cloneArrayBuffer$3, "cloneArrayBuffer$3"); +var _cloneArrayBuffer = cloneArrayBuffer$3; +const _cloneArrayBuffer$1 = /* @__PURE__ */ getDefaultExportFromCjs(_cloneArrayBuffer); +var cloneArrayBuffer$2 = _cloneArrayBuffer; +function cloneDataView$1(dataView, isDeep) { + var buffer2 = isDeep ? cloneArrayBuffer$2(dataView.buffer) : dataView.buffer; + return new dataView.constructor(buffer2, dataView.byteOffset, dataView.byteLength); +} +__name(cloneDataView$1, "cloneDataView$1"); +var _cloneDataView = cloneDataView$1; +const _cloneDataView$1 = /* @__PURE__ */ getDefaultExportFromCjs(_cloneDataView); +var reFlags = /\w*$/; +function cloneRegExp$2(regexp2) { + var result = new regexp2.constructor(regexp2.source, reFlags.exec(regexp2)); + result.lastIndex = regexp2.lastIndex; + return result; +} +__name(cloneRegExp$2, "cloneRegExp$2"); +var _cloneRegExp = cloneRegExp$2; +const _cloneRegExp$1 = /* @__PURE__ */ getDefaultExportFromCjs(_cloneRegExp); +var Symbol$1 = _Symbol; +var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0; +function cloneSymbol$1(symbol) { + return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; +} +__name(cloneSymbol$1, "cloneSymbol$1"); +var _cloneSymbol = cloneSymbol$1; +const _cloneSymbol$1 = /* @__PURE__ */ getDefaultExportFromCjs(_cloneSymbol); +var cloneArrayBuffer$1 = _cloneArrayBuffer; +function cloneTypedArray$1(typedArray, isDeep) { + var buffer2 = isDeep ? cloneArrayBuffer$1(typedArray.buffer) : typedArray.buffer; + return new typedArray.constructor(buffer2, typedArray.byteOffset, typedArray.length); +} +__name(cloneTypedArray$1, "cloneTypedArray$1"); +var _cloneTypedArray = cloneTypedArray$1; +const _cloneTypedArray$1 = /* @__PURE__ */ getDefaultExportFromCjs(_cloneTypedArray); +var cloneArrayBuffer = _cloneArrayBuffer, cloneDataView = _cloneDataView, cloneRegExp$1 = _cloneRegExp, cloneSymbol = _cloneSymbol, cloneTypedArray = _cloneTypedArray; +var boolTag$1 = "[object Boolean]", dateTag$1 = "[object Date]", mapTag$2 = "[object Map]", numberTag$1 = "[object Number]", regexpTag$1 = "[object RegExp]", setTag$2 = "[object Set]", stringTag$1 = "[object String]", symbolTag$1 = "[object Symbol]"; +var arrayBufferTag$1 = "[object ArrayBuffer]", dataViewTag$1 = "[object DataView]", float32Tag$1 = "[object Float32Array]", float64Tag$1 = "[object Float64Array]", int8Tag$1 = "[object Int8Array]", int16Tag$1 = "[object Int16Array]", int32Tag$1 = "[object Int32Array]", uint8Tag$1 = "[object Uint8Array]", uint8ClampedTag$1 = "[object Uint8ClampedArray]", uint16Tag$1 = "[object Uint16Array]", uint32Tag$1 = "[object Uint32Array]"; +function initCloneByTag$1(object, tag, isDeep) { + var Ctor = object.constructor; + switch (tag) { + case arrayBufferTag$1: + return cloneArrayBuffer(object); + case boolTag$1: + case dateTag$1: + return new Ctor(+object); + case dataViewTag$1: + return cloneDataView(object, isDeep); + case float32Tag$1: + case float64Tag$1: + case int8Tag$1: + case int16Tag$1: + case int32Tag$1: + case uint8Tag$1: + case uint8ClampedTag$1: + case uint16Tag$1: + case uint32Tag$1: + return cloneTypedArray(object, isDeep); + case mapTag$2: + return new Ctor(); + case numberTag$1: + case stringTag$1: + return new Ctor(object); + case regexpTag$1: + return cloneRegExp$1(object); + case setTag$2: + return new Ctor(); + case symbolTag$1: + return cloneSymbol(object); + } +} +__name(initCloneByTag$1, "initCloneByTag$1"); +var _initCloneByTag = initCloneByTag$1; +const _initCloneByTag$1 = /* @__PURE__ */ getDefaultExportFromCjs(_initCloneByTag); +var isObject$3 = isObject_1; +var objectCreate = Object.create; +var baseCreate$1 = /* @__PURE__ */ function() { + function object() { + } + __name(object, "object"); + return function(proto) { + if (!isObject$3(proto)) { + return {}; + } + if (objectCreate) { + return objectCreate(proto); + } + object.prototype = proto; + var result = new object(); + object.prototype = void 0; + return result; + }; +}(); +var _baseCreate = baseCreate$1; +const _baseCreate$1 = /* @__PURE__ */ getDefaultExportFromCjs(_baseCreate); +var baseCreate = _baseCreate, getPrototype = _getPrototype, isPrototype = _isPrototype; +function initCloneObject$1(object) { + return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {}; +} +__name(initCloneObject$1, "initCloneObject$1"); +var _initCloneObject = initCloneObject$1; +const _initCloneObject$1 = /* @__PURE__ */ getDefaultExportFromCjs(_initCloneObject); +var getTag$3 = _getTag, isObjectLike$2 = isObjectLike_1; +var mapTag$1 = "[object Map]"; +function baseIsMap$1(value4) { + return isObjectLike$2(value4) && getTag$3(value4) == mapTag$1; +} +__name(baseIsMap$1, "baseIsMap$1"); +var _baseIsMap = baseIsMap$1; +const _baseIsMap$1 = /* @__PURE__ */ getDefaultExportFromCjs(_baseIsMap); +var baseIsMap = _baseIsMap, baseUnary$1 = _baseUnary, nodeUtil$1 = _nodeUtilExports; +var nodeIsMap = nodeUtil$1 && nodeUtil$1.isMap; +var isMap$1 = nodeIsMap ? baseUnary$1(nodeIsMap) : baseIsMap; +var isMap_1 = isMap$1; +const isMap$2 = /* @__PURE__ */ getDefaultExportFromCjs(isMap_1); +var getTag$2 = _getTag, isObjectLike$1 = isObjectLike_1; +var setTag$1 = "[object Set]"; +function baseIsSet$1(value4) { + return isObjectLike$1(value4) && getTag$2(value4) == setTag$1; +} +__name(baseIsSet$1, "baseIsSet$1"); +var _baseIsSet = baseIsSet$1; +const _baseIsSet$1 = /* @__PURE__ */ getDefaultExportFromCjs(_baseIsSet); +var baseIsSet = _baseIsSet, baseUnary = _baseUnary, nodeUtil = _nodeUtilExports; +var nodeIsSet = nodeUtil && nodeUtil.isSet; +var isSet$1 = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet; +var isSet_1 = isSet$1; +const isSet$2 = /* @__PURE__ */ getDefaultExportFromCjs(isSet_1); +var Stack = _Stack, arrayEach = _arrayEach, assignValue = _assignValue, baseAssign = _baseAssign, baseAssignIn = _baseAssignIn, cloneBuffer = _cloneBufferExports, copyArray = _copyArray, copySymbols = _copySymbols, copySymbolsIn = _copySymbolsIn, getAllKeys = _getAllKeys, getAllKeysIn = _getAllKeysIn, getTag$1 = _getTag, initCloneArray = _initCloneArray, initCloneByTag = _initCloneByTag, initCloneObject = _initCloneObject, isArray$1 = isArray_1, isBuffer = isBufferExports, isMap = isMap_1, isObject$2 = isObject_1, isSet = isSet_1, keys$1 = keys_1, keysIn = keysIn_1; +var CLONE_DEEP_FLAG$1 = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG$1 = 4; +var argsTag = "[object Arguments]", arrayTag = "[object Array]", boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag = "[object Map]", numberTag = "[object Number]", objectTag = "[object Object]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]", weakMapTag = "[object WeakMap]"; +var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]"; +var cloneableTags = {}; +cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; +cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false; +function baseClone$1(value4, bitmask, customizer, key, object, stack2) { + var result, isDeep = bitmask & CLONE_DEEP_FLAG$1, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG$1; + if (customizer) { + result = object ? customizer(value4, key, object, stack2) : customizer(value4); + } + if (result !== void 0) { + return result; + } + if (!isObject$2(value4)) { + return value4; + } + var isArr = isArray$1(value4); + if (isArr) { + result = initCloneArray(value4); + if (!isDeep) { + return copyArray(value4, result); + } + } else { + var tag = getTag$1(value4), isFunc = tag == funcTag || tag == genTag; + if (isBuffer(value4)) { + return cloneBuffer(value4, isDeep); + } + if (tag == objectTag || tag == argsTag || isFunc && !object) { + result = isFlat || isFunc ? {} : initCloneObject(value4); + if (!isDeep) { + return isFlat ? copySymbolsIn(value4, baseAssignIn(result, value4)) : copySymbols(value4, baseAssign(result, value4)); + } + } else { + if (!cloneableTags[tag]) { + return object ? value4 : {}; + } + result = initCloneByTag(value4, tag, isDeep); + } + } + stack2 || (stack2 = new Stack()); + var stacked = stack2.get(value4); + if (stacked) { + return stacked; + } + stack2.set(value4, result); + if (isSet(value4)) { + value4.forEach(function(subValue) { + result.add(baseClone$1(subValue, bitmask, customizer, subValue, value4, stack2)); + }); + } else if (isMap(value4)) { + value4.forEach(function(subValue, key2) { + result.set(key2, baseClone$1(subValue, bitmask, customizer, key2, value4, stack2)); + }); + } + var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys$1; + var props = isArr ? void 0 : keysFunc(value4); + arrayEach(props || value4, function(subValue, key2) { + if (props) { + key2 = subValue; + subValue = value4[key2]; + } + assignValue(result, key2, baseClone$1(subValue, bitmask, customizer, key2, value4, stack2)); + }); + return result; +} +__name(baseClone$1, "baseClone$1"); +var _baseClone = baseClone$1; +const _baseClone$1 = /* @__PURE__ */ getDefaultExportFromCjs(_baseClone); +var baseClone = _baseClone; +var CLONE_DEEP_FLAG = 1, CLONE_SYMBOLS_FLAG = 4; +function cloneDeep(value4) { + return baseClone(value4, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG); +} +__name(cloneDeep, "cloneDeep"); +var cloneDeep_1 = cloneDeep; +const cloneDeep$1 = /* @__PURE__ */ getDefaultExportFromCjs(cloneDeep_1); +var theme$s = /* @__PURE__ */ __name(function theme13(_ref) { + var dt2 = _ref.dt; + return "\n.p-inputtext {\n font-family: inherit;\n font-feature-settings: inherit;\n font-size: 1rem;\n color: ".concat(dt2("inputtext.color"), ";\n background: ").concat(dt2("inputtext.background"), ";\n padding: ").concat(dt2("inputtext.padding.y"), " ").concat(dt2("inputtext.padding.x"), ";\n border: 1px solid ").concat(dt2("inputtext.border.color"), ";\n transition: background ").concat(dt2("inputtext.transition.duration"), ", color ").concat(dt2("inputtext.transition.duration"), ", border-color ").concat(dt2("inputtext.transition.duration"), ", outline-color ").concat(dt2("inputtext.transition.duration"), ", box-shadow ").concat(dt2("inputtext.transition.duration"), ";\n appearance: none;\n border-radius: ").concat(dt2("inputtext.border.radius"), ";\n outline-color: transparent;\n box-shadow: ").concat(dt2("inputtext.shadow"), ";\n}\n\n.p-inputtext:enabled:hover {\n border-color: ").concat(dt2("inputtext.hover.border.color"), ";\n}\n\n.p-inputtext:enabled:focus {\n border-color: ").concat(dt2("inputtext.focus.border.color"), ";\n box-shadow: ").concat(dt2("inputtext.focus.ring.shadow"), ";\n outline: ").concat(dt2("inputtext.focus.ring.width"), " ").concat(dt2("inputtext.focus.ring.style"), " ").concat(dt2("inputtext.focus.ring.color"), ";\n outline-offset: ").concat(dt2("inputtext.focus.ring.offset"), ";\n}\n\n.p-inputtext.p-invalid {\n border-color: ").concat(dt2("inputtext.invalid.border.color"), ";\n}\n\n.p-inputtext.p-variant-filled {\n background: ").concat(dt2("inputtext.filled.background"), ";\n}\n\n.p-inputtext.p-variant-filled:enabled:focus {\n background: ").concat(dt2("inputtext.filled.focus.background"), ";\n}\n\n.p-inputtext:disabled {\n opacity: 1;\n background: ").concat(dt2("inputtext.disabled.background"), ";\n color: ").concat(dt2("inputtext.disabled.color"), ";\n}\n\n.p-inputtext::placeholder {\n color: ").concat(dt2("inputtext.placeholder.color"), ";\n}\n\n.p-inputtext-sm {\n font-size: ").concat(dt2("inputtext.sm.font.size"), ";\n padding: ").concat(dt2("inputtext.sm.padding.y"), " ").concat(dt2("inputtext.sm.padding.x"), ";\n}\n\n.p-inputtext-lg {\n font-size: ").concat(dt2("inputtext.lg.font.size"), ";\n padding: ").concat(dt2("inputtext.lg.padding.y"), " ").concat(dt2("inputtext.lg.padding.x"), ";\n}\n\n.p-inputtext-fluid {\n width: 100%;\n}\n"); +}, "theme"); +var classes$u = { + root: /* @__PURE__ */ __name(function root7(_ref2) { + var instance = _ref2.instance, props = _ref2.props; + return ["p-inputtext p-component", { + "p-filled": instance.filled, + "p-inputtext-sm": props.size === "small", + "p-inputtext-lg": props.size === "large", + "p-invalid": props.invalid, + "p-variant-filled": props.variant ? props.variant === "filled" : instance.$primevue.config.inputStyle === "filled" || instance.$primevue.config.inputVariant === "filled", + "p-inputtext-fluid": instance.hasFluid + }]; + }, "root") +}; +var InputTextStyle = BaseStyle.extend({ + name: "inputtext", + theme: theme$s, + classes: classes$u +}); +var script$1$v = { + name: "BaseInputText", + "extends": script$11, + props: { + modelValue: null, + size: { + type: String, + "default": null + }, + invalid: { + type: Boolean, + "default": false + }, + variant: { + type: String, + "default": null + }, + fluid: { + type: Boolean, + "default": null + } + }, + style: InputTextStyle, + provide: /* @__PURE__ */ __name(function provide12() { + return { + $pcInputText: this, + $parentInstance: this + }; + }, "provide") +}; +var script$O = { + name: "InputText", + "extends": script$1$v, + inheritAttrs: false, + emits: ["update:modelValue"], + inject: { + $pcFluid: { + "default": null + } + }, + methods: { + getPTOptions: /* @__PURE__ */ __name(function getPTOptions2(key) { + var _ptm = key === "root" ? this.ptmi : this.ptm; + return _ptm(key, { + context: { + filled: this.filled, + disabled: this.$attrs.disabled || this.$attrs.disabled === "" + } + }); + }, "getPTOptions"), + onInput: /* @__PURE__ */ __name(function onInput(event) { + this.$emit("update:modelValue", event.target.value); + }, "onInput") + }, + computed: { + filled: /* @__PURE__ */ __name(function filled() { + return this.modelValue != null && this.modelValue.toString().length > 0; + }, "filled"), + hasFluid: /* @__PURE__ */ __name(function hasFluid2() { + return isEmpty$1(this.fluid) ? !!this.$pcFluid : this.fluid; + }, "hasFluid") + } +}; +var _hoisted_1$1j = ["value", "aria-invalid"]; +function render$N(_ctx, _cache, $props, $setup, $data, $options) { + return openBlock(), createElementBlock("input", mergeProps({ + type: "text", + "class": _ctx.cx("root"), + value: _ctx.modelValue, + "aria-invalid": _ctx.invalid || void 0, + onInput: _cache[0] || (_cache[0] = function() { + return $options.onInput && $options.onInput.apply($options, arguments); + }) + }, $options.getPTOptions("root")), null, 16, _hoisted_1$1j); +} +__name(render$N, "render$N"); +script$O.render = render$N; +var script$N = { + name: "MinusIcon", + "extends": script$_ +}; +var _hoisted_1$1i = /* @__PURE__ */ createBaseVNode("path", { + d: "M13.2222 7.77778H0.777778C0.571498 7.77778 0.373667 7.69584 0.227806 7.54998C0.0819442 7.40412 0 7.20629 0 7.00001C0 6.79373 0.0819442 6.5959 0.227806 6.45003C0.373667 6.30417 0.571498 6.22223 0.777778 6.22223H13.2222C13.4285 6.22223 13.6263 6.30417 13.7722 6.45003C13.9181 6.5959 14 6.79373 14 7.00001C14 7.20629 13.9181 7.40412 13.7722 7.54998C13.6263 7.69584 13.4285 7.77778 13.2222 7.77778Z", + fill: "currentColor" +}, null, -1); +var _hoisted_2$Y = [_hoisted_1$1i]; +function render$M(_ctx, _cache, $props, $setup, $data, $options) { + return openBlock(), createElementBlock("svg", mergeProps({ + width: "14", + height: "14", + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg" + }, _ctx.pti()), _hoisted_2$Y, 16); +} +__name(render$M, "render$M"); +script$N.render = render$M; +var script$M = { + name: "PlusIcon", + "extends": script$_ +}; +var _hoisted_1$1h = /* @__PURE__ */ createBaseVNode("path", { + d: "M7.67742 6.32258V0.677419C7.67742 0.497757 7.60605 0.325452 7.47901 0.198411C7.35197 0.0713707 7.17966 0 7 0C6.82034 0 6.64803 0.0713707 6.52099 0.198411C6.39395 0.325452 6.32258 0.497757 6.32258 0.677419V6.32258H0.677419C0.497757 6.32258 0.325452 6.39395 0.198411 6.52099C0.0713707 6.64803 0 6.82034 0 7C0 7.17966 0.0713707 7.35197 0.198411 7.47901C0.325452 7.60605 0.497757 7.67742 0.677419 7.67742H6.32258V13.3226C6.32492 13.5015 6.39704 13.6725 6.52358 13.799C6.65012 13.9255 6.82106 13.9977 7 14C7.17966 14 7.35197 13.9286 7.47901 13.8016C7.60605 13.6745 7.67742 13.5022 7.67742 13.3226V7.67742H13.3226C13.5022 7.67742 13.6745 7.60605 13.8016 7.47901C13.9286 7.35197 14 7.17966 14 7C13.9977 6.82106 13.9255 6.65012 13.799 6.52358C13.6725 6.39704 13.5015 6.32492 13.3226 6.32258H7.67742Z", + fill: "currentColor" +}, null, -1); +var _hoisted_2$X = [_hoisted_1$1h]; +function render$L(_ctx, _cache, $props, $setup, $data, $options) { + return openBlock(), createElementBlock("svg", mergeProps({ + width: "14", + height: "14", + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg" + }, _ctx.pti()), _hoisted_2$X, 16); +} +__name(render$L, "render$L"); +script$M.render = render$L; +var theme$r = /* @__PURE__ */ __name(function theme14(_ref) { + var dt2 = _ref.dt; + return "\n.p-panel {\n border: 1px solid ".concat(dt2("panel.border.color"), ";\n border-radius: ").concat(dt2("panel.border.radius"), ";\n background: ").concat(dt2("panel.background"), ";\n color: ").concat(dt2("panel.color"), ";\n}\n\n.p-panel-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: ").concat(dt2("panel.header.padding"), ";\n background: ").concat(dt2("panel.header.background"), ";\n color: ").concat(dt2("panel.header.color"), ";\n border-style: solid;\n border-width: ").concat(dt2("panel.header.border.width"), ";\n border-color: ").concat(dt2("panel.header.border.color"), ";\n border-radius: ").concat(dt2("panel.header.border.radius"), ";\n}\n\n.p-panel-toggleable .p-panel-header {\n padding: ").concat(dt2("panel.toggleable.header.padding"), ";\n}\n\n.p-panel-title {\n line-height: 1;\n font-weight: ").concat(dt2("panel.title.font.weight"), ";\n}\n\n.p-panel-content {\n padding: ").concat(dt2("panel.content.padding"), ";\n}\n\n.p-panel-footer {\n padding: ").concat(dt2("panel.footer.padding"), ";\n}\n"); +}, "theme"); +var classes$t = { + root: /* @__PURE__ */ __name(function root8(_ref2) { + var props = _ref2.props; + return ["p-panel p-component", { + "p-panel-toggleable": props.toggleable + }]; + }, "root"), + header: "p-panel-header", + title: "p-panel-title", + headerActions: "p-panel-header-actions", + pcToggleButton: "p-panel-toggle-button", + contentContainer: "p-panel-content-container", + content: "p-panel-content", + footer: "p-panel-footer" +}; +var PanelStyle = BaseStyle.extend({ + name: "panel", + theme: theme$r, + classes: classes$t +}); +var script$1$u = { + name: "BasePanel", + "extends": script$11, + props: { + header: String, + toggleable: Boolean, + collapsed: Boolean, + toggleButtonProps: { + type: Object, + "default": /* @__PURE__ */ __name(function _default4() { + return { + severity: "secondary", + text: true, + rounded: true + }; + }, "_default") + } + }, + style: PanelStyle, + provide: /* @__PURE__ */ __name(function provide13() { + return { + $pcPanel: this, + $parentInstance: this + }; + }, "provide") +}; +var script$L = { + name: "Panel", + "extends": script$1$u, + inheritAttrs: false, + emits: ["update:collapsed", "toggle"], + data: /* @__PURE__ */ __name(function data5() { + return { + id: this.$attrs.id, + d_collapsed: this.collapsed + }; + }, "data"), + watch: { + "$attrs.id": /* @__PURE__ */ __name(function $attrsId3(newValue2) { + this.id = newValue2 || UniqueComponentId(); + }, "$attrsId"), + collapsed: /* @__PURE__ */ __name(function collapsed(newValue2) { + this.d_collapsed = newValue2; + }, "collapsed") + }, + mounted: /* @__PURE__ */ __name(function mounted7() { + this.id = this.id || UniqueComponentId(); + }, "mounted"), + methods: { + toggle: /* @__PURE__ */ __name(function toggle(event) { + this.d_collapsed = !this.d_collapsed; + this.$emit("update:collapsed", this.d_collapsed); + this.$emit("toggle", { + originalEvent: event, + value: this.d_collapsed + }); + }, "toggle"), + onKeyDown: /* @__PURE__ */ __name(function onKeyDown4(event) { + if (event.code === "Enter" || event.code === "NumpadEnter" || event.code === "Space") { + this.toggle(event); + event.preventDefault(); + } + }, "onKeyDown") + }, + computed: { + buttonAriaLabel: /* @__PURE__ */ __name(function buttonAriaLabel() { + return this.toggleButtonProps && this.toggleButtonProps.ariaLabel ? this.toggleButtonProps.ariaLabel : this.header; + }, "buttonAriaLabel") + }, + components: { + PlusIcon: script$M, + MinusIcon: script$N, + Button: script$U + }, + directives: { + ripple: Ripple + } +}; +var _hoisted_1$1g = ["id"]; +var _hoisted_2$W = ["id", "aria-labelledby"]; +function render$K(_ctx, _cache, $props, $setup, $data, $options) { + var _component_Button = resolveComponent("Button"); + return openBlock(), createElementBlock("div", mergeProps({ + "class": _ctx.cx("root") + }, _ctx.ptmi("root")), [createBaseVNode("div", mergeProps({ + "class": _ctx.cx("header") + }, _ctx.ptm("header")), [renderSlot(_ctx.$slots, "header", { + id: $data.id + "_header", + "class": normalizeClass(_ctx.cx("title")) + }, function() { + return [_ctx.header ? (openBlock(), createElementBlock("span", mergeProps({ + key: 0, + id: $data.id + "_header", + "class": _ctx.cx("title") + }, _ctx.ptm("title")), toDisplayString$1(_ctx.header), 17, _hoisted_1$1g)) : createCommentVNode("", true)]; + }), createBaseVNode("div", mergeProps({ + "class": _ctx.cx("headerActions") + }, _ctx.ptm("headerActions")), [renderSlot(_ctx.$slots, "icons"), _ctx.toggleable ? (openBlock(), createBlock(_component_Button, mergeProps({ + key: 0, + id: $data.id + "_header", + "class": _ctx.cx("pcToggleButton"), + "aria-label": $options.buttonAriaLabel, + "aria-controls": $data.id + "_content", + "aria-expanded": !$data.d_collapsed, + unstyled: _ctx.unstyled, + onClick: $options.toggle, + onKeydown: $options.onKeyDown + }, _ctx.toggleButtonProps, { + pt: _ctx.ptm("pcToggleButton") + }), { + icon: withCtx(function(slotProps) { + return [renderSlot(_ctx.$slots, _ctx.$slots.toggleicon ? "toggleicon" : "togglericon", { + collapsed: $data.d_collapsed + }, function() { + return [(openBlock(), createBlock(resolveDynamicComponent($data.d_collapsed ? "PlusIcon" : "MinusIcon"), mergeProps({ + "class": slotProps["class"] + }, _ctx.ptm("pcToggleButton")["icon"]), null, 16, ["class"]))]; + })]; + }), + _: 3 + }, 16, ["id", "class", "aria-label", "aria-controls", "aria-expanded", "unstyled", "onClick", "onKeydown", "pt"])) : createCommentVNode("", true)], 16)], 16), createVNode(Transition, mergeProps({ + name: "p-toggleable-content" + }, _ctx.ptm("transition")), { + "default": withCtx(function() { + return [withDirectives(createBaseVNode("div", mergeProps({ + id: $data.id + "_content", + "class": _ctx.cx("contentContainer"), + role: "region", + "aria-labelledby": $data.id + "_header" + }, _ctx.ptm("contentContainer")), [createBaseVNode("div", mergeProps({ + "class": _ctx.cx("content") + }, _ctx.ptm("content")), [renderSlot(_ctx.$slots, "default")], 16), _ctx.$slots.footer ? (openBlock(), createElementBlock("div", mergeProps({ + key: 0, + "class": _ctx.cx("footer") + }, _ctx.ptm("footer")), [renderSlot(_ctx.$slots, "footer")], 16)) : createCommentVNode("", true)], 16, _hoisted_2$W), [[vShow, !$data.d_collapsed]])]; + }), + _: 3 + }, 16)], 16); +} +__name(render$K, "render$K"); +script$L.render = render$K; +var theme$q = /* @__PURE__ */ __name(function theme15(_ref) { + var dt2 = _ref.dt; + return "\n.p-textarea {\n font-family: inherit;\n font-feature-settings: inherit;\n font-size: 1rem;\n color: ".concat(dt2("textarea.color"), ";\n background: ").concat(dt2("textarea.background"), ";\n padding: ").concat(dt2("textarea.padding.y"), " ").concat(dt2("textarea.padding.x"), ";\n border: 1px solid ").concat(dt2("textarea.border.color"), ";\n transition: background ").concat(dt2("textarea.transition.duration"), ", color ").concat(dt2("textarea.transition.duration"), ", border-color ").concat(dt2("textarea.transition.duration"), ", outline-color ").concat(dt2("textarea.transition.duration"), ", box-shadow ").concat(dt2("textarea.transition.duration"), ";\n appearance: none;\n border-radius: ").concat(dt2("textarea.border.radius"), ";\n outline-color: transparent;\n box-shadow: ").concat(dt2("textarea.shadow"), ";\n}\n\n.p-textarea:enabled:hover {\n border-color: ").concat(dt2("textarea.hover.border.color"), ";\n}\n\n.p-textarea:enabled:focus {\n border-color: ").concat(dt2("textarea.focus.border.color"), ";\n box-shadow: ").concat(dt2("textarea.focus.ring.shadow"), ";\n outline: ").concat(dt2("textarea.focus.ring.width"), " ").concat(dt2("textarea.focus.ring.style"), " ").concat(dt2("textarea.focus.ring.color"), ";\n outline-offset: ").concat(dt2("textarea.focus.ring.offset"), ";\n}\n\n.p-textarea.p-invalid {\n border-color: ").concat(dt2("textarea.invalid.border.color"), ";\n}\n\n.p-textarea.p-variant-filled {\n background: ").concat(dt2("textarea.filled.background"), ";\n}\n\n.p-textarea.p-variant-filled:enabled:focus {\n background: ").concat(dt2("textarea.filled.focus.background"), ";\n}\n\n.p-textarea:disabled {\n opacity: 1;\n background: ").concat(dt2("textarea.disabled.background"), ";\n color: ").concat(dt2("textarea.disabled.color"), ";\n}\n\n.p-textarea::placeholder {\n color: ").concat(dt2("textarea.placeholder.color"), ";\n}\n\n.p-textarea-fluid {\n width: 100%;\n}\n\n.p-textarea-resizable {\n overflow: hidden;\n resize: none;\n}\n"); +}, "theme"); +var classes$s = { + root: /* @__PURE__ */ __name(function root9(_ref2) { + var instance = _ref2.instance, props = _ref2.props; + return ["p-textarea p-component", { + "p-filled": instance.filled, + "p-textarea-resizable ": props.autoResize, + "p-invalid": props.invalid, + "p-variant-filled": props.variant ? props.variant === "filled" : instance.$primevue.config.inputStyle === "filled" || instance.$primevue.config.inputVariant === "filled", + "p-textarea-fluid": instance.hasFluid + }]; + }, "root") +}; +var TextareaStyle = BaseStyle.extend({ + name: "textarea", + theme: theme$q, + classes: classes$s +}); +var script$1$t = { + name: "BaseTextarea", + "extends": script$11, + props: { + modelValue: null, + autoResize: Boolean, + invalid: { + type: Boolean, + "default": false + }, + variant: { + type: String, + "default": null + }, + fluid: { + type: Boolean, + "default": null + } + }, + style: TextareaStyle, + provide: /* @__PURE__ */ __name(function provide14() { + return { + $pcTextarea: this, + $parentInstance: this + }; + }, "provide") +}; +var script$K = { + name: "Textarea", + "extends": script$1$t, + inheritAttrs: false, + emits: ["update:modelValue"], + inject: { + $pcFluid: { + "default": null + } + }, + mounted: /* @__PURE__ */ __name(function mounted8() { + if (this.$el.offsetParent && this.autoResize) { + this.resize(); + } + }, "mounted"), + updated: /* @__PURE__ */ __name(function updated6() { + if (this.$el.offsetParent && this.autoResize) { + this.resize(); + } + }, "updated"), + methods: { + resize: /* @__PURE__ */ __name(function resize() { + this.$el.style.height = "auto"; + this.$el.style.height = this.$el.scrollHeight + "px"; + if (parseFloat(this.$el.style.height) >= parseFloat(this.$el.style.maxHeight)) { + this.$el.style.overflowY = "scroll"; + this.$el.style.height = this.$el.style.maxHeight; + } else { + this.$el.style.overflow = "hidden"; + } + }, "resize"), + onInput: /* @__PURE__ */ __name(function onInput2(event) { + if (this.autoResize) { + this.resize(); + } + this.$emit("update:modelValue", event.target.value); + }, "onInput") + }, + computed: { + filled: /* @__PURE__ */ __name(function filled2() { + return this.modelValue != null && this.modelValue.toString().length > 0; + }, "filled"), + ptmParams: /* @__PURE__ */ __name(function ptmParams() { + return { + context: { + disabled: this.$attrs.disabled || this.$attrs.disabled === "" + } + }; + }, "ptmParams"), + hasFluid: /* @__PURE__ */ __name(function hasFluid3() { + return isEmpty$1(this.fluid) ? !!this.$pcFluid : this.fluid; + }, "hasFluid") + } +}; +var _hoisted_1$1f = ["value", "aria-invalid"]; +function render$J(_ctx, _cache, $props, $setup, $data, $options) { + return openBlock(), createElementBlock("textarea", mergeProps({ + "class": _ctx.cx("root"), + value: _ctx.modelValue, + "aria-invalid": _ctx.invalid || void 0, + onInput: _cache[0] || (_cache[0] = function() { + return $options.onInput && $options.onInput.apply($options, arguments); + }) + }, _ctx.ptmi("root", $options.ptmParams)), null, 16, _hoisted_1$1f); +} +__name(render$J, "render$J"); +script$K.render = render$J; +var script$J = { + name: "CheckIcon", + "extends": script$_ +}; +var _hoisted_1$1e = /* @__PURE__ */ createBaseVNode("path", { + d: "M4.86199 11.5948C4.78717 11.5923 4.71366 11.5745 4.64596 11.5426C4.57826 11.5107 4.51779 11.4652 4.46827 11.4091L0.753985 7.69483C0.683167 7.64891 0.623706 7.58751 0.580092 7.51525C0.536478 7.44299 0.509851 7.36177 0.502221 7.27771C0.49459 7.19366 0.506156 7.10897 0.536046 7.03004C0.565935 6.95111 0.613367 6.88 0.674759 6.82208C0.736151 6.76416 0.8099 6.72095 0.890436 6.69571C0.970973 6.67046 1.05619 6.66385 1.13966 6.67635C1.22313 6.68886 1.30266 6.72017 1.37226 6.76792C1.44186 6.81567 1.4997 6.8786 1.54141 6.95197L4.86199 10.2503L12.6397 2.49483C12.7444 2.42694 12.8689 2.39617 12.9932 2.40745C13.1174 2.41873 13.2343 2.47141 13.3251 2.55705C13.4159 2.64268 13.4753 2.75632 13.4938 2.87973C13.5123 3.00315 13.4888 3.1292 13.4271 3.23768L5.2557 11.4091C5.20618 11.4652 5.14571 11.5107 5.07801 11.5426C5.01031 11.5745 4.9368 11.5923 4.86199 11.5948Z", + fill: "currentColor" +}, null, -1); +var _hoisted_2$V = [_hoisted_1$1e]; +function render$I(_ctx, _cache, $props, $setup, $data, $options) { + return openBlock(), createElementBlock("svg", mergeProps({ + width: "14", + height: "14", + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg" + }, _ctx.pti()), _hoisted_2$V, 16); +} +__name(render$I, "render$I"); +script$J.render = render$I; +var theme$p = /* @__PURE__ */ __name(function theme16(_ref) { + var dt2 = _ref.dt; + return "\n.p-checkbox {\n position: relative;\n display: inline-flex;\n user-select: none;\n vertical-align: bottom;\n width: ".concat(dt2("checkbox.width"), ";\n height: ").concat(dt2("checkbox.height"), ";\n}\n\n.p-checkbox-input {\n cursor: pointer;\n appearance: none;\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n padding: 0;\n margin: 0;\n opacity: 0;\n z-index: 1;\n outline: 0 none;\n border: 1px solid transparent;\n border-radius: ").concat(dt2("checkbox.border.radius"), ";\n}\n\n.p-checkbox-box {\n display: flex;\n justify-content: center;\n align-items: center;\n border-radius: ").concat(dt2("checkbox.border.radius"), ";\n border: 1px solid ").concat(dt2("checkbox.border.color"), ";\n background: ").concat(dt2("checkbox.background"), ";\n width: ").concat(dt2("checkbox.width"), ";\n height: ").concat(dt2("checkbox.height"), ";\n transition: background ").concat(dt2("checkbox.transition.duration"), ", color ").concat(dt2("checkbox.transition.duration"), ", border-color ").concat(dt2("checkbox.transition.duration"), ", box-shadow ").concat(dt2("checkbox.transition.duration"), ", outline-color ").concat(dt2("checkbox.transition.duration"), ";\n outline-color: transparent;\n box-shadow: ").concat(dt2("checkbox.shadow"), ";\n}\n\n.p-checkbox-icon {\n transition-duration: ").concat(dt2("checkbox.transition.duration"), ";\n color: ").concat(dt2("checkbox.icon.color"), ";\n font-size: ").concat(dt2("checkbox.icon.size"), ";\n width: ").concat(dt2("checkbox.icon.size"), ";\n height: ").concat(dt2("checkbox.icon.size"), ";\n}\n\n.p-checkbox:not(.p-disabled):has(.p-checkbox-input:hover) .p-checkbox-box {\n border-color: ").concat(dt2("checkbox.hover.border.color"), ";\n}\n\n.p-checkbox-checked .p-checkbox-box {\n border-color: ").concat(dt2("checkbox.checked.border.color"), ";\n background: ").concat(dt2("checkbox.checked.background"), ";\n}\n\n.p-checkbox-checked .p-checkbox-icon {\n color: ").concat(dt2("checkbox.icon.checked.color"), ";\n}\n\n.p-checkbox-checked:not(.p-disabled):has(.p-checkbox-input:hover) .p-checkbox-box {\n background: ").concat(dt2("checkbox.checked.hover.background"), ";\n border-color: ").concat(dt2("checkbox.checked.hover.border.color"), ";\n}\n\n.p-checkbox-checked:not(.p-disabled):has(.p-checkbox-input:hover) .p-checkbox-icon {\n color: ").concat(dt2("checkbox.icon.checked.hover.color"), ";\n}\n\n.p-checkbox:not(.p-disabled):has(.p-checkbox-input:focus-visible) .p-checkbox-box {\n border-color: ").concat(dt2("checkbox.focus.border.color"), ";\n box-shadow: ").concat(dt2("checkbox.focus.ring.shadow"), ";\n outline: ").concat(dt2("checkbox.focus.ring.width"), " ").concat(dt2("checkbox.focus.ring.style"), " ").concat(dt2("checkbox.focus.ring.color"), ";\n outline-offset: ").concat(dt2("checkbox.focus.ring.offset"), ";\n}\n\n.p-checkbox-checked:not(.p-disabled):has(.p-checkbox-input:focus-visible) .p-checkbox-box {\n border-color: ").concat(dt2("checkbox.checked.focus.border.color"), ";\n}\n\n.p-checkbox.p-invalid > .p-checkbox-box {\n border-color: ").concat(dt2("checkbox.invalid.border.color"), ";\n}\n\n.p-checkbox.p-variant-filled .p-checkbox-box {\n background: ").concat(dt2("checkbox.filled.background"), ";\n}\n\n.p-checkbox-checked.p-variant-filled .p-checkbox-box {\n background: ").concat(dt2("checkbox.checked.background"), ";\n}\n\n.p-checkbox-checked.p-variant-filled:not(.p-disabled):has(.p-checkbox-input:hover) .p-checkbox-box {\n background: ").concat(dt2("checkbox.checked.hover.background"), ";\n}\n\n.p-checkbox.p-disabled {\n opacity: 1;\n}\n\n.p-checkbox.p-disabled .p-checkbox-box {\n background: ").concat(dt2("checkbox.disabled.background"), ";\n border-color: ").concat(dt2("checkbox.checked.disabled.border.color"), ";\n}\n\n.p-checkbox.p-disabled .p-checkbox-box .p-checkbox-icon {\n color: ").concat(dt2("checkbox.icon.disabled.color"), ";\n}\n"); +}, "theme"); +var classes$r = { + root: /* @__PURE__ */ __name(function root10(_ref2) { + var instance = _ref2.instance, props = _ref2.props; + return ["p-checkbox p-component", { + "p-checkbox-checked": instance.checked, + "p-disabled": props.disabled, + "p-invalid": props.invalid, + "p-variant-filled": props.variant ? props.variant === "filled" : instance.$primevue.config.inputStyle === "filled" || instance.$primevue.config.inputVariant === "filled" + }]; + }, "root"), + box: "p-checkbox-box", + input: "p-checkbox-input", + icon: "p-checkbox-icon" +}; +var CheckboxStyle = BaseStyle.extend({ + name: "checkbox", + theme: theme$p, + classes: classes$r +}); +var script$1$s = { + name: "BaseCheckbox", + "extends": script$11, + props: { + value: null, + modelValue: null, + binary: Boolean, + name: { + type: String, + "default": null + }, + indeterminate: { + type: Boolean, + "default": false + }, + trueValue: { + type: null, + "default": true + }, + falseValue: { + type: null, + "default": false + }, + variant: { + type: String, + "default": null + }, + invalid: { + type: Boolean, + "default": false + }, + disabled: { + type: Boolean, + "default": false + }, + readonly: { + type: Boolean, + "default": false + }, + required: { + type: Boolean, + "default": false + }, + tabindex: { + type: Number, + "default": null + }, + inputId: { + type: String, + "default": null + }, + inputClass: { + type: [String, Object], + "default": null + }, + inputStyle: { + type: Object, + "default": null + }, + ariaLabelledby: { + type: String, + "default": null + }, + ariaLabel: { + type: String, + "default": null + } + }, + style: CheckboxStyle, + provide: /* @__PURE__ */ __name(function provide15() { + return { + $pcCheckbox: this, + $parentInstance: this + }; + }, "provide") +}; +function _toConsumableArray$a(r2) { + return _arrayWithoutHoles$a(r2) || _iterableToArray$a(r2) || _unsupportedIterableToArray$c(r2) || _nonIterableSpread$a(); +} +__name(_toConsumableArray$a, "_toConsumableArray$a"); +function _nonIterableSpread$a() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +__name(_nonIterableSpread$a, "_nonIterableSpread$a"); +function _unsupportedIterableToArray$c(r2, a2) { + if (r2) { + if ("string" == typeof r2) return _arrayLikeToArray$c(r2, a2); + var t2 = {}.toString.call(r2).slice(8, -1); + return "Object" === t2 && r2.constructor && (t2 = r2.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r2) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$c(r2, a2) : void 0; + } +} +__name(_unsupportedIterableToArray$c, "_unsupportedIterableToArray$c"); +function _iterableToArray$a(r2) { + if ("undefined" != typeof Symbol && null != r2[Symbol.iterator] || null != r2["@@iterator"]) return Array.from(r2); +} +__name(_iterableToArray$a, "_iterableToArray$a"); +function _arrayWithoutHoles$a(r2) { + if (Array.isArray(r2)) return _arrayLikeToArray$c(r2); +} +__name(_arrayWithoutHoles$a, "_arrayWithoutHoles$a"); +function _arrayLikeToArray$c(r2, a2) { + (null == a2 || a2 > r2.length) && (a2 = r2.length); + for (var e2 = 0, n2 = Array(a2); e2 < a2; e2++) n2[e2] = r2[e2]; + return n2; +} +__name(_arrayLikeToArray$c, "_arrayLikeToArray$c"); +var script$I = { + name: "Checkbox", + "extends": script$1$s, + inheritAttrs: false, + emits: ["update:modelValue", "change", "focus", "blur", "update:indeterminate"], + data: /* @__PURE__ */ __name(function data6() { + return { + d_indeterminate: this.indeterminate + }; + }, "data"), + watch: { + indeterminate: /* @__PURE__ */ __name(function indeterminate(newValue2) { + this.d_indeterminate = newValue2; + }, "indeterminate") + }, + methods: { + getPTOptions: /* @__PURE__ */ __name(function getPTOptions3(key) { + var _ptm = key === "root" ? this.ptmi : this.ptm; + return _ptm(key, { + context: { + checked: this.checked, + indeterminate: this.d_indeterminate, + disabled: this.disabled + } + }); + }, "getPTOptions"), + onChange: /* @__PURE__ */ __name(function onChange2(event) { + var _this = this; + if (!this.disabled && !this.readonly) { + var newModelValue; + if (this.binary) { + newModelValue = this.d_indeterminate ? this.trueValue : this.checked ? this.falseValue : this.trueValue; + } else { + if (this.checked || this.d_indeterminate) newModelValue = this.modelValue.filter(function(val) { + return !equals(val, _this.value); + }); + else newModelValue = this.modelValue ? [].concat(_toConsumableArray$a(this.modelValue), [this.value]) : [this.value]; + } + if (this.d_indeterminate) { + this.d_indeterminate = false; + this.$emit("update:indeterminate", this.d_indeterminate); + } + this.$emit("update:modelValue", newModelValue); + this.$emit("change", event); + } + }, "onChange"), + onFocus: /* @__PURE__ */ __name(function onFocus3(event) { + this.$emit("focus", event); + }, "onFocus"), + onBlur: /* @__PURE__ */ __name(function onBlur3(event) { + this.$emit("blur", event); + }, "onBlur") + }, + computed: { + checked: /* @__PURE__ */ __name(function checked() { + return this.d_indeterminate ? false : this.binary ? this.modelValue === this.trueValue : contains(this.value, this.modelValue); + }, "checked") + }, + components: { + CheckIcon: script$J, + MinusIcon: script$N + } +}; +var _hoisted_1$1d = ["data-p-checked", "data-p-indeterminate", "data-p-disabled"]; +var _hoisted_2$U = ["id", "value", "name", "checked", "tabindex", "disabled", "readonly", "required", "aria-labelledby", "aria-label", "aria-invalid", "aria-checked"]; +function render$H(_ctx, _cache, $props, $setup, $data, $options) { + var _component_CheckIcon = resolveComponent("CheckIcon"); + var _component_MinusIcon = resolveComponent("MinusIcon"); + return openBlock(), createElementBlock("div", mergeProps({ + "class": _ctx.cx("root") + }, $options.getPTOptions("root"), { + "data-p-checked": $options.checked, + "data-p-indeterminate": $data.d_indeterminate || void 0, + "data-p-disabled": _ctx.disabled + }), [createBaseVNode("input", mergeProps({ + id: _ctx.inputId, + type: "checkbox", + "class": [_ctx.cx("input"), _ctx.inputClass], + style: _ctx.inputStyle, + value: _ctx.value, + name: _ctx.name, + checked: $options.checked, + tabindex: _ctx.tabindex, + disabled: _ctx.disabled, + readonly: _ctx.readonly, + required: _ctx.required, + "aria-labelledby": _ctx.ariaLabelledby, + "aria-label": _ctx.ariaLabel, + "aria-invalid": _ctx.invalid || void 0, + "aria-checked": $data.d_indeterminate ? "mixed" : void 0, + onFocus: _cache[0] || (_cache[0] = function() { + return $options.onFocus && $options.onFocus.apply($options, arguments); + }), + onBlur: _cache[1] || (_cache[1] = function() { + return $options.onBlur && $options.onBlur.apply($options, arguments); + }), + onChange: _cache[2] || (_cache[2] = function() { + return $options.onChange && $options.onChange.apply($options, arguments); + }) + }, $options.getPTOptions("input")), null, 16, _hoisted_2$U), createBaseVNode("div", mergeProps({ + "class": _ctx.cx("box") + }, $options.getPTOptions("box")), [renderSlot(_ctx.$slots, "icon", { + checked: $options.checked, + indeterminate: $data.d_indeterminate, + "class": normalizeClass(_ctx.cx("icon")) + }, function() { + return [$options.checked ? (openBlock(), createBlock(_component_CheckIcon, mergeProps({ + key: 0, + "class": _ctx.cx("icon") + }, $options.getPTOptions("icon")), null, 16, ["class"])) : $data.d_indeterminate ? (openBlock(), createBlock(_component_MinusIcon, mergeProps({ + key: 1, + "class": _ctx.cx("icon") + }, $options.getPTOptions("icon")), null, 16, ["class"])) : createCommentVNode("", true)]; + })], 16)], 16, _hoisted_1$1d); +} +__name(render$H, "render$H"); +script$I.render = render$H; +const _hoisted_1$1c = ["for"]; +const _sfc_main$W = /* @__PURE__ */ defineComponent({ + __name: "CheckboxGroup", + props: { + checkboxes: {}, + modelValue: {} + }, + emits: ["update:modelValue"], + setup(__props, { emit: __emit }) { + const props = __props; + const emit2 = __emit; + const internalSelection = computed({ + get: /* @__PURE__ */ __name(() => props.modelValue, "get"), + set: /* @__PURE__ */ __name((value4) => emit2("update:modelValue", value4), "set") + }); + return (_ctx, _cache) => { + return openBlock(), createElementBlock("div", { + class: normalizeClass(["flex flex-wrap", _ctx.$attrs.class]) + }, [ + (openBlock(true), createElementBlock(Fragment$1, null, renderList(_ctx.checkboxes, (checkbox) => { + return openBlock(), createElementBlock("div", { + key: checkbox.value, + class: "flex items-center gap-2" + }, [ + createVNode(unref(script$I), { + modelValue: internalSelection.value, + "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => internalSelection.value = $event), + inputId: checkbox.value, + value: checkbox.value + }, null, 8, ["modelValue", "inputId", "value"]), + createBaseVNode("label", { + for: checkbox.value, + class: "ml-2" + }, toDisplayString$1(checkbox.label), 9, _hoisted_1$1c) + ]); + }), 128)) + ], 2); + }; + } +}); +const _hoisted_1$1b = { class: "flex items-center gap-2" }; +const _hoisted_2$T = { class: "font-bold" }; +const _hoisted_3$t = { class: "flex justify-end" }; +const _hoisted_4$m = { class: "p-4 mt-4 border border-round surface-border shadow-1" }; +const _hoisted_5$g = { class: "mb-4" }; +const _hoisted_6$c = { class: "mb-4" }; +const ISSUE_NAME = "User reported issue"; +const DETAILS_MAX_LEN = 5e3; +const CONTACT_MAX_LEN = 320; +const _sfc_main$V = /* @__PURE__ */ defineComponent({ + __name: "ReportIssuePanel", + props: { + errorType: {}, + defaultFields: {}, + extraFields: {}, + tags: {} + }, + setup(__props) { + const props = __props; + const { + defaultFields = ["Workflow", "Logs", "SystemStats", "Settings"], + tags = {} + } = props; + const { t: t2 } = useI18n(); + const toast = useToast(); + const selection = ref([]); + const contactPrefs = ref([]); + const contactInfo = ref(""); + const details = ref(""); + const submitting = ref(false); + const submitted = ref(false); + const followUp = computed(() => contactPrefs.value.includes("FollowUp")); + const notifyResolve = computed(() => contactPrefs.value.includes("Resolution")); + const icon3 = computed(() => { + if (submitting.value) return "pi pi-spin pi-spinner"; + if (submitted.value) return "pi pi-check"; + return "pi pi-send"; + }); + const isFormEmpty = computed(() => !selection.value.length && !details.value); + const isButtonDisabled = computed( + () => submitted.value || submitting.value || isFormEmpty.value + ); + const contactCheckboxes = [ + { label: t2("issueReport.contactFollowUp"), value: "FollowUp" }, + { label: t2("issueReport.notifyResolve"), value: "Resolution" } + ]; + const defaultReportCheckboxes = [ + { label: t2("g.workflow"), value: "Workflow" }, + { label: t2("g.logs"), value: "Logs" }, + { label: t2("issueReport.systemStats"), value: "SystemStats" }, + { label: t2("g.settings"), value: "Settings" } + ]; + const reportCheckboxes = computed(() => [ + ...props.extraFields?.map(({ label: label5, value: value4 }) => ({ label: label5, value: value4 })) ?? [], + ...defaultReportCheckboxes.filter( + ({ value: value4 }) => defaultFields.includes(value4) + ) + ]); + const getUserInfo = /* @__PURE__ */ __name(() => ({ email: contactInfo.value }), "getUserInfo"); + const getLogs = /* @__PURE__ */ __name(async () => selection.value.includes("Logs") ? api.getLogs() : null, "getLogs"); + const getSystemStats = /* @__PURE__ */ __name(async () => selection.value.includes("SystemStats") ? api.getSystemStats() : null, "getSystemStats"); + const getSettings = /* @__PURE__ */ __name(async () => selection.value.includes("Settings") ? api.getSettings() : null, "getSettings"); + const getWorkflow = /* @__PURE__ */ __name(() => selection.value.includes("Workflow") ? cloneDeep$1(app$1.graph.asSerialisable()) : null, "getWorkflow"); + const createDefaultFields = /* @__PURE__ */ __name(async () => { + const [settings, systemStats, logs, workflow] = await Promise.all([ + getSettings(), + getSystemStats(), + getLogs(), + getWorkflow() + ]); + return { settings, systemStats, logs, workflow }; + }, "createDefaultFields"); + const createExtraFields = /* @__PURE__ */ __name(() => { + if (!props.extraFields) return void 0; + return props.extraFields.filter((field) => !field.optIn || selection.value.includes(field.value)).reduce((acc, field) => ({ ...acc, ...cloneDeep$1(field.data) }), {}); + }, "createExtraFields"); + const createFeedback = /* @__PURE__ */ __name(() => { + return { + details: details.value, + contactPreferences: { + followUp: followUp.value, + notifyOnResolution: notifyResolve.value + } + }; + }, "createFeedback"); + const createCaptureContext = /* @__PURE__ */ __name(async () => { + return { + user: getUserInfo(), + level: "error", + tags: { + errorType: props.errorType, + ...tags + }, + extra: { + ...createFeedback(), + ...await createDefaultFields(), + ...createExtraFields() + } + }; + }, "createCaptureContext"); + const reportIssue = /* @__PURE__ */ __name(async () => { + if (isButtonDisabled.value) return; + submitting.value = true; + try { + captureMessage(ISSUE_NAME, await createCaptureContext()); + submitted.value = true; + toast.add({ + severity: "success", + summary: t2("g.reportSent"), + life: 3e3 + }); + } finally { + submitting.value = false; + } + }, "reportIssue"); + return (_ctx, _cache) => { + const _directive_tooltip = resolveDirective("tooltip"); + return openBlock(), createBlock(unref(script$L), null, { + header: withCtx(() => [ + createBaseVNode("div", _hoisted_1$1b, [ + createBaseVNode("span", _hoisted_2$T, toDisplayString$1(_ctx.$t("issueReport.submitErrorReport")), 1) + ]) + ]), + footer: withCtx(() => [ + createBaseVNode("div", _hoisted_3$t, [ + withDirectives(createVNode(unref(script$U), { + label: submitted.value ? _ctx.$t("g.reportSent") : _ctx.$t("g.reportIssue"), + severity: isButtonDisabled.value ? "secondary" : "primary", + icon: icon3.value, + disabled: isButtonDisabled.value, + onClick: reportIssue + }, null, 8, ["label", "severity", "icon", "disabled"]), [ + [_directive_tooltip, _ctx.$t("g.reportIssueTooltip")] + ]) + ]) + ]), + default: withCtx(() => [ + createBaseVNode("div", _hoisted_4$m, [ + createVNode(_sfc_main$W, { + modelValue: selection.value, + "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => selection.value = $event), + class: "gap-4 mb-4", + checkboxes: reportCheckboxes.value + }, null, 8, ["modelValue", "checkboxes"]), + createBaseVNode("div", _hoisted_5$g, [ + createVNode(unref(script$O), { + modelValue: contactInfo.value, + "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => contactInfo.value = $event), + class: "w-full", + placeholder: _ctx.$t("issueReport.provideEmail"), + maxlength: CONTACT_MAX_LEN + }, null, 8, ["modelValue", "placeholder"]), + createVNode(_sfc_main$W, { + modelValue: contactPrefs.value, + "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => contactPrefs.value = $event), + class: "gap-3 mt-2", + checkboxes: contactCheckboxes + }, null, 8, ["modelValue"]) + ]), + createBaseVNode("div", _hoisted_6$c, [ + createVNode(unref(script$K), { + modelValue: details.value, + "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => details.value = $event), + class: "w-full", + rows: "4", + maxlength: DETAILS_MAX_LEN, + placeholder: _ctx.$t("issueReport.provideAdditionalDetails"), + "aria-label": _ctx.$t("issueReport.provideAdditionalDetails") + }, null, 8, ["modelValue", "placeholder", "aria-label"]) + ]) + ]) + ]), + _: 1 + }); + }; + } +}); +const _withScopeId$l = /* @__PURE__ */ __name((n2) => (pushScopeId("data-v-09b72a20"), n2 = n2(), popScopeId(), n2), "_withScopeId$l"); +const _hoisted_1$1a = { class: "comfy-error-report" }; +const _hoisted_2$S = { class: "flex gap-2 justify-center" }; +const _hoisted_3$s = { class: "wrapper-pre" }; +const _hoisted_4$l = { class: "action-container" }; const repoOwner = "comfyanonymous"; const repoName = "ComfyUI"; const _sfc_main$U = /* @__PURE__ */ defineComponent({ @@ -113166,8 +141570,23 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({ const showReport = /* @__PURE__ */ __name(() => { reportOpen.value = true; }, "showReport"); - const showSendError = isElectron(); + const sendReportOpen = ref(false); + const showSendReport = /* @__PURE__ */ __name(() => { + sendReportOpen.value = true; + }, "showSendReport"); const toast = useToast(); + const { t: t2 } = useI18n(); + const stackTraceField = computed(() => { + return { + label: t2("issueReport.stackTrace"), + value: "StackTrace", + optIn: true, + data: { + nodeType: props.error.node_type, + stackTrace: props.error.traceback?.join("\n") + } + }; + }); onMounted(async () => { try { const [systemStats, logs] = await Promise.all([ @@ -113254,36 +141673,47 @@ ${workflowText} title: props.error.node_type, message: props.error.exception_message }, null, 8, ["title", "message"]), - createBaseVNode("div", _hoisted_1$1e, [ - withDirectives(createVNode(unref(script$R), { - label: _ctx.$t("g.showReport"), - onClick: showReport, - text: "" - }, null, 8, ["label"]), [ - [vShow, !reportOpen.value] + createBaseVNode("div", _hoisted_1$1a, [ + createBaseVNode("div", _hoisted_2$S, [ + withDirectives(createVNode(unref(script$U), { + text: "", + label: _ctx.$t("g.showReport"), + onClick: showReport + }, null, 8, ["label"]), [ + [vShow, !reportOpen.value] + ]), + withDirectives(createVNode(unref(script$U), { + text: "", + label: _ctx.$t("issueReport.helpFix"), + onClick: showSendReport + }, null, 8, ["label"]), [ + [vShow, !sendReportOpen.value] + ]) ]), reportOpen.value ? (openBlock(), createElementBlock(Fragment$1, { key: 0 }, [ - createVNode(unref(script$O)), - createVNode(unref(script$N), { style: { "width": "100%", "height": "400px", "max-width": "80vw" } }, { + createVNode(unref(script$R)), + createVNode(unref(script$Q), { style: { "width": "100%", "height": "400px", "max-width": "80vw" } }, { default: withCtx(() => [ - createBaseVNode("pre", _hoisted_2$V, toDisplayString$1(reportContent.value), 1) + createBaseVNode("pre", _hoisted_3$s, toDisplayString$1(reportContent.value), 1) ]), _: 1 }), - createVNode(unref(script$O)) + createVNode(unref(script$R)) ], 64)) : createCommentVNode("", true), - createBaseVNode("div", _hoisted_3$s, [ - unref(showSendError) ? (openBlock(), createBlock(_sfc_main$V, { - key: 0, - error: props.error - }, null, 8, ["error"])) : createCommentVNode("", true), - createVNode(_sfc_main$W, { + sendReportOpen.value ? (openBlock(), createBlock(_sfc_main$V, { + key: 1, + "error-type": "graphExecutionError", + "extra-fields": [stackTraceField.value], + tags: { exceptionMessage: props.error.exception_message } + }, null, 8, ["extra-fields", "tags"])) : createCommentVNode("", true), + createBaseVNode("div", _hoisted_4$l, [ + createVNode(_sfc_main$X, { errorMessage: props.error.exception_message, repoOwner, repoName }, null, 8, ["errorMessage"]), - reportOpen.value ? (openBlock(), createBlock(unref(script$R), { - key: 1, + reportOpen.value ? (openBlock(), createBlock(unref(script$U), { + key: 0, label: _ctx.$t("g.copyToClipboard"), icon: "pi pi-copy", onClick: copyReportToClipboard @@ -113294,130 +141724,110 @@ ${workflowText} }; } }); -const ExecutionErrorDialogContent = /* @__PURE__ */ _export_sfc(_sfc_main$U, [["__scopeId", "data-v-ddf3e2da"]]); -var script$L = { +const ExecutionErrorDialogContent = /* @__PURE__ */ _export_sfc(_sfc_main$U, [["__scopeId", "data-v-09b72a20"]]); +var script$H = { name: "BlankIcon", - "extends": script$X + "extends": script$_ }; -var _hoisted_1$1d = /* @__PURE__ */ createBaseVNode("rect", { +var _hoisted_1$19 = /* @__PURE__ */ createBaseVNode("rect", { width: "1", height: "1", fill: "currentColor", "fill-opacity": "0" }, null, -1); -var _hoisted_2$U = [_hoisted_1$1d]; -function render$K(_ctx, _cache, $props, $setup, $data, $options) { +var _hoisted_2$R = [_hoisted_1$19]; +function render$G(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" - }, _ctx.pti()), _hoisted_2$U, 16); + }, _ctx.pti()), _hoisted_2$R, 16); } -__name(render$K, "render$K"); -script$L.render = render$K; -var script$K = { - name: "CheckIcon", - "extends": script$X -}; -var _hoisted_1$1c = /* @__PURE__ */ createBaseVNode("path", { - d: "M4.86199 11.5948C4.78717 11.5923 4.71366 11.5745 4.64596 11.5426C4.57826 11.5107 4.51779 11.4652 4.46827 11.4091L0.753985 7.69483C0.683167 7.64891 0.623706 7.58751 0.580092 7.51525C0.536478 7.44299 0.509851 7.36177 0.502221 7.27771C0.49459 7.19366 0.506156 7.10897 0.536046 7.03004C0.565935 6.95111 0.613367 6.88 0.674759 6.82208C0.736151 6.76416 0.8099 6.72095 0.890436 6.69571C0.970973 6.67046 1.05619 6.66385 1.13966 6.67635C1.22313 6.68886 1.30266 6.72017 1.37226 6.76792C1.44186 6.81567 1.4997 6.8786 1.54141 6.95197L4.86199 10.2503L12.6397 2.49483C12.7444 2.42694 12.8689 2.39617 12.9932 2.40745C13.1174 2.41873 13.2343 2.47141 13.3251 2.55705C13.4159 2.64268 13.4753 2.75632 13.4938 2.87973C13.5123 3.00315 13.4888 3.1292 13.4271 3.23768L5.2557 11.4091C5.20618 11.4652 5.14571 11.5107 5.07801 11.5426C5.01031 11.5745 4.9368 11.5923 4.86199 11.5948Z", - fill: "currentColor" -}, null, -1); -var _hoisted_2$T = [_hoisted_1$1c]; -function render$J(_ctx, _cache, $props, $setup, $data, $options) { - return openBlock(), createElementBlock("svg", mergeProps({ - width: "14", - height: "14", - viewBox: "0 0 14 14", - fill: "none", - xmlns: "http://www.w3.org/2000/svg" - }, _ctx.pti()), _hoisted_2$T, 16); -} -__name(render$J, "render$J"); -script$K.render = render$J; -var script$J = { +__name(render$G, "render$G"); +script$H.render = render$G; +var script$G = { name: "SearchIcon", - "extends": script$X + "extends": script$_ }; -var _hoisted_1$1b = /* @__PURE__ */ createBaseVNode("path", { +var _hoisted_1$18 = /* @__PURE__ */ createBaseVNode("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M2.67602 11.0265C3.6661 11.688 4.83011 12.0411 6.02086 12.0411C6.81149 12.0411 7.59438 11.8854 8.32483 11.5828C8.87005 11.357 9.37808 11.0526 9.83317 10.6803L12.9769 13.8241C13.0323 13.8801 13.0983 13.9245 13.171 13.9548C13.2438 13.985 13.3219 14.0003 13.4007 14C13.4795 14.0003 13.5575 13.985 13.6303 13.9548C13.7031 13.9245 13.7691 13.8801 13.8244 13.8241C13.9367 13.7116 13.9998 13.5592 13.9998 13.4003C13.9998 13.2414 13.9367 13.089 13.8244 12.9765L10.6807 9.8328C11.053 9.37773 11.3573 8.86972 11.5831 8.32452C11.8857 7.59408 12.0414 6.81119 12.0414 6.02056C12.0414 4.8298 11.6883 3.66579 11.0268 2.67572C10.3652 1.68564 9.42494 0.913972 8.32483 0.45829C7.22472 0.00260857 6.01418 -0.116618 4.84631 0.115686C3.67844 0.34799 2.60568 0.921393 1.76369 1.76338C0.921698 2.60537 0.348296 3.67813 0.115991 4.84601C-0.116313 6.01388 0.00291375 7.22441 0.458595 8.32452C0.914277 9.42464 1.68595 10.3649 2.67602 11.0265ZM3.35565 2.0158C4.14456 1.48867 5.07206 1.20731 6.02086 1.20731C7.29317 1.20731 8.51338 1.71274 9.41304 2.6124C10.3127 3.51206 10.8181 4.73226 10.8181 6.00457C10.8181 6.95337 10.5368 7.88088 10.0096 8.66978C9.48251 9.45868 8.73328 10.0736 7.85669 10.4367C6.98011 10.7997 6.01554 10.8947 5.08496 10.7096C4.15439 10.5245 3.2996 10.0676 2.62869 9.39674C1.95778 8.72583 1.50089 7.87104 1.31579 6.94046C1.13068 6.00989 1.22568 5.04532 1.58878 4.16874C1.95187 3.29215 2.56675 2.54292 3.35565 2.0158Z", fill: "currentColor" }, null, -1); -var _hoisted_2$S = [_hoisted_1$1b]; -function render$I(_ctx, _cache, $props, $setup, $data, $options) { +var _hoisted_2$Q = [_hoisted_1$18]; +function render$F(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" - }, _ctx.pti()), _hoisted_2$S, 16); + }, _ctx.pti()), _hoisted_2$Q, 16); } -__name(render$I, "render$I"); -script$J.render = render$I; -var theme$q = /* @__PURE__ */ __name(function theme13(_ref) { +__name(render$F, "render$F"); +script$G.render = render$F; +var theme$o = /* @__PURE__ */ __name(function theme17(_ref) { var dt2 = _ref.dt; return "\n.p-iconfield {\n position: relative;\n}\n\n.p-inputicon {\n position: absolute;\n top: 50%;\n margin-top: calc(-1 * (".concat(dt2("icon.size"), " / 2));\n color: ").concat(dt2("iconfield.icon.color"), ";\n line-height: 1;\n}\n\n.p-iconfield .p-inputicon:first-child {\n left: ").concat(dt2("form.field.padding.x"), ";\n}\n\n.p-iconfield .p-inputicon:last-child {\n right: ").concat(dt2("form.field.padding.x"), ";\n}\n\n.p-iconfield .p-inputtext:not(:first-child) {\n padding-left: calc((").concat(dt2("form.field.padding.x"), " * 2) + ").concat(dt2("icon.size"), ");\n}\n\n.p-iconfield .p-inputtext:not(:last-child) {\n padding-right: calc((").concat(dt2("form.field.padding.x"), " * 2) + ").concat(dt2("icon.size"), ");\n}\n"); }, "theme"); -var classes$s = { +var classes$q = { root: "p-iconfield" }; var IconFieldStyle = BaseStyle.extend({ name: "iconfield", - theme: theme$q, - classes: classes$s + theme: theme$o, + classes: classes$q }); -var script$1$t = { +var script$1$r = { name: "BaseIconField", - "extends": script$_, + "extends": script$11, style: IconFieldStyle, - provide: /* @__PURE__ */ __name(function provide12() { + provide: /* @__PURE__ */ __name(function provide16() { return { $pcIconField: this, $parentInstance: this }; }, "provide") }; -var script$I = { +var script$F = { name: "IconField", - "extends": script$1$t, + "extends": script$1$r, inheritAttrs: false }; -function render$H(_ctx, _cache, $props, $setup, $data, $options) { +function render$E(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("div", mergeProps({ "class": _ctx.cx("root") }, _ctx.ptmi("root")), [renderSlot(_ctx.$slots, "default")], 16); } -__name(render$H, "render$H"); -script$I.render = render$H; -var classes$r = { +__name(render$E, "render$E"); +script$F.render = render$E; +var classes$p = { root: "p-inputicon" }; var InputIconStyle = BaseStyle.extend({ name: "inputicon", - classes: classes$r + classes: classes$p }); -var script$1$s = { +var script$1$q = { name: "BaseInputIcon", - "extends": script$_, + "extends": script$11, style: InputIconStyle, props: { "class": null }, - provide: /* @__PURE__ */ __name(function provide13() { + provide: /* @__PURE__ */ __name(function provide17() { return { $pcInputIcon: this, $parentInstance: this }; }, "provide") }; -var script$H = { +var script$E = { name: "InputIcon", - "extends": script$1$s, + "extends": script$1$q, inheritAttrs: false, computed: { containerClass: /* @__PURE__ */ __name(function containerClass() { @@ -113425,123 +141835,24 @@ var script$H = { }, "containerClass") } }; -function render$G(_ctx, _cache, $props, $setup, $data, $options) { +function render$D(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("span", mergeProps({ "class": $options.containerClass }, _ctx.ptmi("root")), [renderSlot(_ctx.$slots, "default")], 16); } -__name(render$G, "render$G"); -script$H.render = render$G; -var theme$p = /* @__PURE__ */ __name(function theme14(_ref) { - var dt2 = _ref.dt; - return "\n.p-inputtext {\n font-family: inherit;\n font-feature-settings: inherit;\n font-size: 1rem;\n color: ".concat(dt2("inputtext.color"), ";\n background: ").concat(dt2("inputtext.background"), ";\n padding: ").concat(dt2("inputtext.padding.y"), " ").concat(dt2("inputtext.padding.x"), ";\n border: 1px solid ").concat(dt2("inputtext.border.color"), ";\n transition: background ").concat(dt2("inputtext.transition.duration"), ", color ").concat(dt2("inputtext.transition.duration"), ", border-color ").concat(dt2("inputtext.transition.duration"), ", outline-color ").concat(dt2("inputtext.transition.duration"), ", box-shadow ").concat(dt2("inputtext.transition.duration"), ";\n appearance: none;\n border-radius: ").concat(dt2("inputtext.border.radius"), ";\n outline-color: transparent;\n box-shadow: ").concat(dt2("inputtext.shadow"), ";\n}\n\n.p-inputtext:enabled:hover {\n border-color: ").concat(dt2("inputtext.hover.border.color"), ";\n}\n\n.p-inputtext:enabled:focus {\n border-color: ").concat(dt2("inputtext.focus.border.color"), ";\n box-shadow: ").concat(dt2("inputtext.focus.ring.shadow"), ";\n outline: ").concat(dt2("inputtext.focus.ring.width"), " ").concat(dt2("inputtext.focus.ring.style"), " ").concat(dt2("inputtext.focus.ring.color"), ";\n outline-offset: ").concat(dt2("inputtext.focus.ring.offset"), ";\n}\n\n.p-inputtext.p-invalid {\n border-color: ").concat(dt2("inputtext.invalid.border.color"), ";\n}\n\n.p-inputtext.p-variant-filled {\n background: ").concat(dt2("inputtext.filled.background"), ";\n}\n\n.p-inputtext.p-variant-filled:enabled:focus {\n background: ").concat(dt2("inputtext.filled.focus.background"), ";\n}\n\n.p-inputtext:disabled {\n opacity: 1;\n background: ").concat(dt2("inputtext.disabled.background"), ";\n color: ").concat(dt2("inputtext.disabled.color"), ";\n}\n\n.p-inputtext::placeholder {\n color: ").concat(dt2("inputtext.placeholder.color"), ";\n}\n\n.p-inputtext-sm {\n font-size: ").concat(dt2("inputtext.sm.font.size"), ";\n padding: ").concat(dt2("inputtext.sm.padding.y"), " ").concat(dt2("inputtext.sm.padding.x"), ";\n}\n\n.p-inputtext-lg {\n font-size: ").concat(dt2("inputtext.lg.font.size"), ";\n padding: ").concat(dt2("inputtext.lg.padding.y"), " ").concat(dt2("inputtext.lg.padding.x"), ";\n}\n\n.p-inputtext-fluid {\n width: 100%;\n}\n"); -}, "theme"); -var classes$q = { - root: /* @__PURE__ */ __name(function root6(_ref2) { - var instance = _ref2.instance, props = _ref2.props; - return ["p-inputtext p-component", { - "p-filled": instance.filled, - "p-inputtext-sm": props.size === "small", - "p-inputtext-lg": props.size === "large", - "p-invalid": props.invalid, - "p-variant-filled": props.variant ? props.variant === "filled" : instance.$primevue.config.inputStyle === "filled" || instance.$primevue.config.inputVariant === "filled", - "p-inputtext-fluid": instance.hasFluid - }]; - }, "root") -}; -var InputTextStyle = BaseStyle.extend({ - name: "inputtext", - theme: theme$p, - classes: classes$q -}); -var script$1$r = { - name: "BaseInputText", - "extends": script$_, - props: { - modelValue: null, - size: { - type: String, - "default": null - }, - invalid: { - type: Boolean, - "default": false - }, - variant: { - type: String, - "default": null - }, - fluid: { - type: Boolean, - "default": null - } - }, - style: InputTextStyle, - provide: /* @__PURE__ */ __name(function provide14() { - return { - $pcInputText: this, - $parentInstance: this - }; - }, "provide") -}; -var script$G = { - name: "InputText", - "extends": script$1$r, - inheritAttrs: false, - emits: ["update:modelValue"], - inject: { - $pcFluid: { - "default": null - } - }, - methods: { - getPTOptions: /* @__PURE__ */ __name(function getPTOptions2(key) { - var _ptm = key === "root" ? this.ptmi : this.ptm; - return _ptm(key, { - context: { - filled: this.filled, - disabled: this.$attrs.disabled || this.$attrs.disabled === "" - } - }); - }, "getPTOptions"), - onInput: /* @__PURE__ */ __name(function onInput(event) { - this.$emit("update:modelValue", event.target.value); - }, "onInput") - }, - computed: { - filled: /* @__PURE__ */ __name(function filled() { - return this.modelValue != null && this.modelValue.toString().length > 0; - }, "filled"), - hasFluid: /* @__PURE__ */ __name(function hasFluid2() { - return isEmpty$1(this.fluid) ? !!this.$pcFluid : this.fluid; - }, "hasFluid") - } -}; -var _hoisted_1$1a = ["value", "aria-invalid"]; -function render$F(_ctx, _cache, $props, $setup, $data, $options) { - return openBlock(), createElementBlock("input", mergeProps({ - type: "text", - "class": _ctx.cx("root"), - value: _ctx.modelValue, - "aria-invalid": _ctx.invalid || void 0, - onInput: _cache[0] || (_cache[0] = function() { - return $options.onInput && $options.onInput.apply($options, arguments); - }) - }, $options.getPTOptions("root")), null, 16, _hoisted_1$1a); -} -__name(render$F, "render$F"); -script$G.render = render$F; -var theme$o = /* @__PURE__ */ __name(function theme15(_ref) { +__name(render$D, "render$D"); +script$E.render = render$D; +var theme$n = /* @__PURE__ */ __name(function theme18(_ref) { var dt2 = _ref.dt; return "\n.p-virtualscroller {\n position: relative;\n overflow: auto;\n contain: strict;\n transform: translateZ(0);\n will-change: scroll-position;\n outline: 0 none;\n}\n\n.p-virtualscroller-content {\n position: absolute;\n top: 0;\n left: 0;\n min-height: 100%;\n min-width: 100%;\n will-change: transform;\n}\n\n.p-virtualscroller-spacer {\n position: absolute;\n top: 0;\n left: 0;\n height: 1px;\n width: 1px;\n transform-origin: 0 0;\n pointer-events: none;\n}\n\n.p-virtualscroller-loader {\n position: sticky;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: ".concat(dt2("virtualscroller.loader.mask.background"), ";\n color: ").concat(dt2("virtualscroller.loader.mask.color"), ";\n}\n\n.p-virtualscroller-loader-mask {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.p-virtualscroller-loading-icon {\n font-size: ").concat(dt2("virtualscroller.loader.icon.size"), ";\n width: ").concat(dt2("virtualscroller.loader.icon.size"), ";\n height: ").concat(dt2("virtualscroller.loader.icon.size"), ";\n}\n\n.p-virtualscroller-horizontal > .p-virtualscroller-content {\n display: flex;\n}\n\n.p-virtualscroller-inline .p-virtualscroller-content {\n position: static;\n}\n"); }, "theme"); var VirtualScrollerStyle = BaseStyle.extend({ name: "virtualscroller", - theme: theme$o + theme: theme$n }); -var script$1$q = { +var script$1$p = { name: "BaseVirtualScroller", - "extends": script$_, + "extends": script$11, props: { id: { type: String, @@ -113625,7 +141936,7 @@ var script$1$q = { } }, style: VirtualScrollerStyle, - provide: /* @__PURE__ */ __name(function provide15() { + provide: /* @__PURE__ */ __name(function provide18() { return { $pcVirtualScroller: this, $parentInstance: this @@ -113638,40 +141949,40 @@ var script$1$q = { }); }, "beforeMount") }; -function _typeof$9(o) { +function _typeof$9(o2) { "@babel/helpers - typeof"; - return _typeof$9 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { - return typeof o2; - } : function(o2) { - return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; - }, _typeof$9(o); + return _typeof$9 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { + return typeof o3; + } : function(o3) { + return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; + }, _typeof$9(o2); } __name(_typeof$9, "_typeof$9"); -function ownKeys$b(e2, r) { +function ownKeys$b(e2, r2) { var t2 = Object.keys(e2); if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e2); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e2, r2).enumerable; - })), t2.push.apply(t2, o); + var o2 = Object.getOwnPropertySymbols(e2); + r2 && (o2 = o2.filter(function(r3) { + return Object.getOwnPropertyDescriptor(e2, r3).enumerable; + })), t2.push.apply(t2, o2); } return t2; } __name(ownKeys$b, "ownKeys$b"); function _objectSpread$b(e2) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$b(Object(t2), true).forEach(function(r2) { - _defineProperty$9(e2, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$b(Object(t2)).forEach(function(r2) { - Object.defineProperty(e2, r2, Object.getOwnPropertyDescriptor(t2, r2)); + for (var r2 = 1; r2 < arguments.length; r2++) { + var t2 = null != arguments[r2] ? arguments[r2] : {}; + r2 % 2 ? ownKeys$b(Object(t2), true).forEach(function(r3) { + _defineProperty$9(e2, r3, t2[r3]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$b(Object(t2)).forEach(function(r3) { + Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3)); }); } return e2; } __name(_objectSpread$b, "_objectSpread$b"); -function _defineProperty$9(e2, r, t2) { - return (r = _toPropertyKey$8(r)) in e2 ? Object.defineProperty(e2, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r] = t2, e2; +function _defineProperty$9(e2, r2, t2) { + return (r2 = _toPropertyKey$8(r2)) in e2 ? Object.defineProperty(e2, r2, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r2] = t2, e2; } __name(_defineProperty$9, "_defineProperty$9"); function _toPropertyKey$8(t2) { @@ -113679,23 +141990,23 @@ function _toPropertyKey$8(t2) { return "symbol" == _typeof$9(i2) ? i2 : i2 + ""; } __name(_toPropertyKey$8, "_toPropertyKey$8"); -function _toPrimitive$8(t2, r) { +function _toPrimitive$8(t2, r2) { if ("object" != _typeof$9(t2) || !t2) return t2; var e2 = t2[Symbol.toPrimitive]; if (void 0 !== e2) { - var i2 = e2.call(t2, r || "default"); + var i2 = e2.call(t2, r2 || "default"); if ("object" != _typeof$9(i2)) return i2; throw new TypeError("@@toPrimitive must return a primitive value."); } - return ("string" === r ? String : Number)(t2); + return ("string" === r2 ? String : Number)(t2); } __name(_toPrimitive$8, "_toPrimitive$8"); -var script$F = { +var script$D = { name: "VirtualScroller", - "extends": script$1$q, + "extends": script$1$p, inheritAttrs: false, emits: ["update:numToleratedItems", "scroll", "scroll-index-change", "lazy-load"], - data: /* @__PURE__ */ __name(function data5() { + data: /* @__PURE__ */ __name(function data7() { var both = this.isBoth(); return { first: both ? { @@ -113772,7 +142083,7 @@ var script$F = { this.calculateAutoSize(); }, "scrollWidth") }, - mounted: /* @__PURE__ */ __name(function mounted7() { + mounted: /* @__PURE__ */ __name(function mounted9() { this.viewInit(); this.lastScrollPos = this.isBoth() ? { top: 0, @@ -113780,7 +142091,7 @@ var script$F = { } : 0; this.lazyLoadState = this.lazyLoadState || {}; }, "mounted"), - updated: /* @__PURE__ */ __name(function updated6() { + updated: /* @__PURE__ */ __name(function updated7() { !this.initialized && this.viewInit(); }, "updated"), unmounted: /* @__PURE__ */ __name(function unmounted5() { @@ -114308,7 +142619,7 @@ var script$F = { this.resizeListener = null; } }, "unbindResizeListener"), - getOptions: /* @__PURE__ */ __name(function getOptions(renderedIndex) { + getOptions: /* @__PURE__ */ __name(function getOptions2(renderedIndex) { var count = (this.items || []).length; var index2 = this.isBoth() ? this.first.rows + renderedIndex : this.first + renderedIndex; return { @@ -114391,11 +142702,11 @@ var script$F = { }, "loadedColumns") }, components: { - SpinnerIcon: script$T + SpinnerIcon: script$W } }; -var _hoisted_1$19 = ["tabindex"]; -function render$E(_ctx, _cache, $props, $setup, $data, $options) { +var _hoisted_1$17 = ["tabindex"]; +function render$C(_ctx, _cache, $props, $setup, $data, $options) { var _component_SpinnerIcon = resolveComponent("SpinnerIcon"); return !_ctx.disabled ? (openBlock(), createElementBlock("div", mergeProps({ key: 0, @@ -114454,7 +142765,7 @@ function render$E(_ctx, _cache, $props, $setup, $data, $options) { spin: "", "class": "p-virtualscroller-loading-icon" }, _ctx.ptm("loadingIcon")), null, 16)]; - })], 16)) : createCommentVNode("", true)], 16, _hoisted_1$19)) : (openBlock(), createElementBlock(Fragment$1, { + })], 16)) : createCommentVNode("", true)], 16, _hoisted_1$17)) : (openBlock(), createElementBlock(Fragment$1, { key: 1 }, [renderSlot(_ctx.$slots, "default"), renderSlot(_ctx.$slots, "content", { items: _ctx.items, @@ -114462,14 +142773,14 @@ function render$E(_ctx, _cache, $props, $setup, $data, $options) { columns: $options.loadedColumns })], 64)); } -__name(render$E, "render$E"); -script$F.render = render$E; -var theme$n = /* @__PURE__ */ __name(function theme16(_ref) { +__name(render$C, "render$C"); +script$D.render = render$C; +var theme$m = /* @__PURE__ */ __name(function theme19(_ref) { var dt2 = _ref.dt; return "\n.p-listbox {\n background: ".concat(dt2("listbox.background"), ";\n color: ").concat(dt2("listbox.color"), ";\n border: 1px solid ").concat(dt2("listbox.border.color"), ";\n border-radius: ").concat(dt2("listbox.border.radius"), ";\n transition: background ").concat(dt2("listbox.transition.duration"), ", color ").concat(dt2("listbox.transition.duration"), ", border-color ").concat(dt2("listbox.transition.duration"), ",\n box-shadow ").concat(dt2("listbox.transition.duration"), ", outline-color ").concat(dt2("listbox.transition.duration"), ";\n outline-color: transparent;\n box-shadow: ").concat(dt2("listbox.shadow"), ";\n}\n\n.p-listbox.p-focus {\n border-color: ").concat(dt2("listbox.focus.border.color"), ";\n box-shadow: ").concat(dt2("listbox.focus.ring.shadow"), ";\n outline: ").concat(dt2("listbox.focus.ring.width"), " ").concat(dt2("listbox.focus.ring.style"), " ").concat(dt2("listbox.focus.ring.color"), ";\n outline-offset: ").concat(dt2("listbox.focus.ring.offset"), ";\n}\n\n.p-listbox.p-disabled {\n opacity: 1;\n background: ").concat(dt2("listbox.disabled.background"), ";\n color: ").concat(dt2("listbox.disabled.color"), ";\n}\n\n.p-listbox.p-disabled .p-listbox-option {\n color: ").concat(dt2("listbox.disabled.color"), ";\n}\n\n.p-listbox.p-invalid {\n border-color: ").concat(dt2("listbox.invalid.border.color"), ";\n}\n\n.p-listbox-header {\n padding: ").concat(dt2("listbox.list.header.padding"), ";\n}\n\n.p-listbox-filter {\n width: 100%;\n}\n\n.p-listbox-list-container {\n overflow: auto;\n}\n\n.p-listbox-list {\n list-style-type: none;\n margin: 0;\n padding: ").concat(dt2("listbox.list.padding"), ";\n outline: 0 none;\n display: flex;\n flex-direction: column;\n gap: ").concat(dt2("listbox.list.gap"), ";\n}\n\n.p-listbox-option {\n display: flex;\n align-items: center;\n cursor: pointer;\n position: relative;\n overflow: hidden;\n padding: ").concat(dt2("listbox.option.padding"), ";\n border: 0 none;\n border-radius: ").concat(dt2("listbox.option.border.radius"), ";\n color: ").concat(dt2("listbox.option.color"), ";\n transition: background ").concat(dt2("listbox.transition.duration"), ", color ").concat(dt2("listbox.transition.duration"), ", border-color ").concat(dt2("listbox.transition.duration"), ",\n box-shadow ").concat(dt2("listbox.transition.duration"), ", outline-color ").concat(dt2("listbox.transition.duration"), ";\n}\n\n.p-listbox-striped li:nth-child(even of .p-listbox-option) {\n background: ").concat(dt2("listbox.option.striped.background"), ";\n}\n\n.p-listbox .p-listbox-list .p-listbox-option.p-listbox-option-selected {\n background: ").concat(dt2("listbox.option.selected.background"), ";\n color: ").concat(dt2("listbox.option.selected.color"), ";\n}\n\n.p-listbox:not(.p-disabled) .p-listbox-option.p-listbox-option-selected.p-focus {\n background: ").concat(dt2("listbox.option.selected.focus.background"), ";\n color: ").concat(dt2("listbox.option.selected.focus.color"), ";\n}\n\n.p-listbox:not(.p-disabled) .p-listbox-option:not(.p-listbox-option-selected):not(.p-disabled).p-focus {\n background: ").concat(dt2("listbox.option.focus.background"), ";\n color: ").concat(dt2("listbox.option.focus.color"), ";\n}\n\n.p-listbox:not(.p-disabled) .p-listbox-option:not(.p-listbox-option-selected):not(.p-disabled):hover {\n background: ").concat(dt2("listbox.option.focus.background"), ";\n color: ").concat(dt2("listbox.option.focus.color"), ";\n}\n\n.p-listbox-option-check-icon {\n position: relative;\n margin-inline-start: ").concat(dt2("listbox.checkmark.gutter.start"), ";\n margin-inline-end: ").concat(dt2("listbox.checkmark.gutter.end"), ";\n color: ").concat(dt2("listbox.checkmark.color"), ";\n}\n\n.p-listbox-option-group {\n margin: 0;\n padding: ").concat(dt2("listbox.option.group.padding"), ";\n color: ").concat(dt2("listbox.option.group.color"), ";\n background: ").concat(dt2("listbox.option.group.background"), ";\n font-weight: ").concat(dt2("listbox.option.group.font.weight"), ";\n}\n\n.p-listbox-empty-message {\n padding: ").concat(dt2("listbox.empty.message.padding"), ";\n}\n"); }, "theme"); -var classes$p = { - root: /* @__PURE__ */ __name(function root7(_ref2) { +var classes$o = { + root: /* @__PURE__ */ __name(function root11(_ref2) { var props = _ref2.props; return ["p-listbox p-component", { "p-listbox-striped": props.striped, @@ -114496,12 +142807,12 @@ var classes$p = { }; var ListboxStyle = BaseStyle.extend({ name: "listbox", - theme: theme$n, - classes: classes$p + theme: theme$m, + classes: classes$o }); -var script$1$p = { +var script$1$o = { name: "BaseListbox", - "extends": script$_, + "extends": script$11, props: { modelValue: null, options: Array, @@ -114609,46 +142920,46 @@ var script$1$p = { } }, style: ListboxStyle, - provide: /* @__PURE__ */ __name(function provide16() { + provide: /* @__PURE__ */ __name(function provide19() { return { $pcListbox: this, $parentInstance: this }; }, "provide") }; -function _toConsumableArray$a(r) { - return _arrayWithoutHoles$a(r) || _iterableToArray$a(r) || _unsupportedIterableToArray$c(r) || _nonIterableSpread$a(); +function _toConsumableArray$9(r2) { + return _arrayWithoutHoles$9(r2) || _iterableToArray$9(r2) || _unsupportedIterableToArray$b(r2) || _nonIterableSpread$9(); } -__name(_toConsumableArray$a, "_toConsumableArray$a"); -function _nonIterableSpread$a() { +__name(_toConsumableArray$9, "_toConsumableArray$9"); +function _nonIterableSpread$9() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -__name(_nonIterableSpread$a, "_nonIterableSpread$a"); -function _unsupportedIterableToArray$c(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray$c(r, a); - var t2 = {}.toString.call(r).slice(8, -1); - return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$c(r, a) : void 0; +__name(_nonIterableSpread$9, "_nonIterableSpread$9"); +function _unsupportedIterableToArray$b(r2, a2) { + if (r2) { + if ("string" == typeof r2) return _arrayLikeToArray$b(r2, a2); + var t2 = {}.toString.call(r2).slice(8, -1); + return "Object" === t2 && r2.constructor && (t2 = r2.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r2) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$b(r2, a2) : void 0; } } -__name(_unsupportedIterableToArray$c, "_unsupportedIterableToArray$c"); -function _iterableToArray$a(r) { - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); +__name(_unsupportedIterableToArray$b, "_unsupportedIterableToArray$b"); +function _iterableToArray$9(r2) { + if ("undefined" != typeof Symbol && null != r2[Symbol.iterator] || null != r2["@@iterator"]) return Array.from(r2); } -__name(_iterableToArray$a, "_iterableToArray$a"); -function _arrayWithoutHoles$a(r) { - if (Array.isArray(r)) return _arrayLikeToArray$c(r); +__name(_iterableToArray$9, "_iterableToArray$9"); +function _arrayWithoutHoles$9(r2) { + if (Array.isArray(r2)) return _arrayLikeToArray$b(r2); } -__name(_arrayWithoutHoles$a, "_arrayWithoutHoles$a"); -function _arrayLikeToArray$c(r, a) { - (null == a || a > r.length) && (a = r.length); - for (var e2 = 0, n = Array(a); e2 < a; e2++) n[e2] = r[e2]; - return n; +__name(_arrayWithoutHoles$9, "_arrayWithoutHoles$9"); +function _arrayLikeToArray$b(r2, a2) { + (null == a2 || a2 > r2.length) && (a2 = r2.length); + for (var e2 = 0, n2 = Array(a2); e2 < a2; e2++) n2[e2] = r2[e2]; + return n2; } -__name(_arrayLikeToArray$c, "_arrayLikeToArray$c"); -var script$E = { +__name(_arrayLikeToArray$b, "_arrayLikeToArray$b"); +var script$C = { name: "Listbox", - "extends": script$1$p, + "extends": script$1$o, inheritAttrs: false, emits: ["update:modelValue", "change", "focus", "blur", "filter", "item-dblclick", "option-dblclick"], list: null, @@ -114657,7 +142968,7 @@ var script$E = { startRangeIndex: -1, searchTimeout: null, searchValue: "", - data: /* @__PURE__ */ __name(function data6() { + data: /* @__PURE__ */ __name(function data8() { return { id: this.$attrs.id, filterValue: null, @@ -114666,14 +142977,14 @@ var script$E = { }; }, "data"), watch: { - "$attrs.id": /* @__PURE__ */ __name(function $attrsId3(newValue2) { + "$attrs.id": /* @__PURE__ */ __name(function $attrsId4(newValue2) { this.id = newValue2 || UniqueComponentId(); }, "$attrsId"), options: /* @__PURE__ */ __name(function options2() { this.autoUpdateModel(); }, "options") }, - mounted: /* @__PURE__ */ __name(function mounted8() { + mounted: /* @__PURE__ */ __name(function mounted10() { this.id = this.id || UniqueComponentId(); this.autoUpdateModel(); }, "mounted"), @@ -114690,7 +143001,7 @@ var script$E = { getOptionRenderKey: /* @__PURE__ */ __name(function getOptionRenderKey(option3, index2) { return (this.dataKey ? resolveFieldData(option3, this.dataKey) : this.getOptionLabel(option3)) + "_" + index2; }, "getOptionRenderKey"), - getPTOptions: /* @__PURE__ */ __name(function getPTOptions3(option3, itemOptions, index2, key) { + getPTOptions: /* @__PURE__ */ __name(function getPTOptions4(option3, itemOptions, index2, key) { return this.ptm(key, { context: { selected: this.isSelected(option3), @@ -114869,10 +143180,10 @@ var script$E = { value4 = metaKey ? this.removeOption(option3) : [this.getOptionValue(option3)]; } else { value4 = metaKey ? this.modelValue || [] : []; - value4 = [].concat(_toConsumableArray$a(value4), [this.getOptionValue(option3)]); + value4 = [].concat(_toConsumableArray$9(value4), [this.getOptionValue(option3)]); } } else { - value4 = selected2 ? this.removeOption(option3) : [].concat(_toConsumableArray$a(this.modelValue || []), [this.getOptionValue(option3)]); + value4 = selected2 ? this.removeOption(option3) : [].concat(_toConsumableArray$9(this.modelValue || []), [this.getOptionValue(option3)]); } this.updateModel(event, value4); }, "onOptionSelectMultiple"), @@ -115219,8 +143530,8 @@ var script$E = { index: index2 }); var optionGroupChildren = _this17.getOptionGroupChildren(option3); - optionGroupChildren && optionGroupChildren.forEach(function(o) { - return result.push(o); + optionGroupChildren && optionGroupChildren.forEach(function(o2) { + return result.push(o2); }); return result; }, []); @@ -115285,22 +143596,22 @@ var script$E = { ripple: Ripple }, components: { - InputText: script$G, - VirtualScroller: script$F, - InputIcon: script$H, - IconField: script$I, - SearchIcon: script$J, - CheckIcon: script$K, - BlankIcon: script$L + InputText: script$O, + VirtualScroller: script$D, + InputIcon: script$E, + IconField: script$F, + SearchIcon: script$G, + CheckIcon: script$J, + BlankIcon: script$H } }; -var _hoisted_1$18 = ["id"]; -var _hoisted_2$R = ["tabindex"]; +var _hoisted_1$16 = ["id"]; +var _hoisted_2$P = ["tabindex"]; var _hoisted_3$r = ["id", "aria-multiselectable", "aria-label", "aria-labelledby", "aria-activedescendant", "aria-disabled"]; var _hoisted_4$k = ["id"]; var _hoisted_5$f = ["id", "aria-label", "aria-selected", "aria-disabled", "aria-setsize", "aria-posinset", "onClick", "onMousedown", "onMousemove", "onDblclick", "data-p-selected", "data-p-focused", "data-p-disabled"]; var _hoisted_6$b = ["tabindex"]; -function render$D(_ctx, _cache, $props, $setup, $data, $options) { +function render$B(_ctx, _cache, $props, $setup, $data, $options) { var _component_InputText = resolveComponent("InputText"); var _component_SearchIcon = resolveComponent("SearchIcon"); var _component_InputIcon = resolveComponent("InputIcon"); @@ -115327,7 +143638,7 @@ function render$D(_ctx, _cache, $props, $setup, $data, $options) { }, _ctx.ptm("hiddenFirstFocusableEl"), { "data-p-hidden-accessible": true, "data-p-hidden-focusable": true - }), null, 16, _hoisted_2$R), _ctx.$slots.header ? (openBlock(), createElementBlock("div", { + }), null, 16, _hoisted_2$P), _ctx.$slots.header ? (openBlock(), createElementBlock("div", { key: 0, "class": normalizeClass(_ctx.cx("header")) }, [renderSlot(_ctx.$slots, "header", { @@ -115547,13 +143858,13 @@ function render$D(_ctx, _cache, $props, $setup, $data, $options) { }, _ctx.ptm("hiddenLastFocusableEl"), { "data-p-hidden-accessible": true, "data-p-hidden-focusable": true - }), null, 16, _hoisted_6$b)], 16, _hoisted_1$18); + }), null, 16, _hoisted_6$b)], 16, _hoisted_1$16); } -__name(render$D, "render$D"); -script$E.render = render$D; -const _withScopeId$k = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-425cc3ac"), n = n(), popScopeId(), n), "_withScopeId$k"); -const _hoisted_1$17 = { class: "flex align-items-center" }; -const _hoisted_2$Q = { class: "node-type" }; +__name(render$B, "render$B"); +script$C.render = render$B; +const _withScopeId$k = /* @__PURE__ */ __name((n2) => (pushScopeId("data-v-425cc3ac"), n2 = n2(), popScopeId(), n2), "_withScopeId$k"); +const _hoisted_1$15 = { class: "flex align-items-center" }; +const _hoisted_2$O = { class: "node-type" }; const _hoisted_3$q = { key: 0, class: "node-hint" @@ -115591,7 +143902,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({ title: "Missing Node Types", message: "When loading the graph, the following node types were not found" }), - createVNode(unref(script$E), { + createVNode(unref(script$C), { options: uniqueNodes.value, optionLabel: "label", scrollHeight: "100%", @@ -115601,10 +143912,10 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({ } }, { option: withCtx((slotProps) => [ - createBaseVNode("div", _hoisted_1$17, [ - createBaseVNode("span", _hoisted_2$Q, toDisplayString$1(slotProps.option.label), 1), + createBaseVNode("div", _hoisted_1$15, [ + createBaseVNode("span", _hoisted_2$O, toDisplayString$1(slotProps.option.label), 1), slotProps.option.hint ? (openBlock(), createElementBlock("span", _hoisted_3$q, toDisplayString$1(slotProps.option.hint), 1)) : createCommentVNode("", true), - slotProps.option.action ? (openBlock(), createBlock(unref(script$R), { + slotProps.option.action ? (openBlock(), createBlock(unref(script$U), { key: 1, onClick: slotProps.option.action.callback, label: slotProps.option.action.text, @@ -115620,12 +143931,12 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({ } }); const LoadWorkflowWarning = /* @__PURE__ */ _export_sfc(_sfc_main$T, [["__scopeId", "data-v-425cc3ac"]]); -var theme$m = /* @__PURE__ */ __name(function theme17(_ref) { +var theme$l = /* @__PURE__ */ __name(function theme20(_ref) { var dt2 = _ref.dt; return "\n.p-progressbar {\n position: relative;\n overflow: hidden;\n height: ".concat(dt2("progressbar.height"), ";\n background: ").concat(dt2("progressbar.background"), ";\n border-radius: ").concat(dt2("progressbar.border.radius"), ";\n}\n\n.p-progressbar-value {\n margin: 0;\n background: ").concat(dt2("progressbar.value.background"), ";\n}\n\n.p-progressbar-label {\n color: ").concat(dt2("progressbar.label.color"), ";\n font-size: ").concat(dt2("progressbar.label.font.size"), ";\n font-weight: ").concat(dt2("progressbar.label.font.weight"), ';\n}\n\n.p-progressbar-determinate .p-progressbar-value {\n height: 100%;\n width: 0%;\n position: absolute;\n display: none;\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n transition: width 1s ease-in-out;\n}\n\n.p-progressbar-determinate .p-progressbar-label {\n display: inline-flex;\n}\n\n.p-progressbar-indeterminate .p-progressbar-value::before {\n content: "";\n position: absolute;\n background: inherit;\n top: 0;\n left: 0;\n bottom: 0;\n will-change: left, right;\n animation: p-progressbar-indeterminate-anim 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;\n}\n\n.p-progressbar-indeterminate .p-progressbar-value::after {\n content: "";\n position: absolute;\n background: inherit;\n top: 0;\n left: 0;\n bottom: 0;\n will-change: left, right;\n animation: p-progressbar-indeterminate-anim-short 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) infinite;\n animation-delay: 1.15s;\n}\n\n@-webkit-keyframes p-progressbar-indeterminate-anim {\n 0% {\n left: -35%;\n right: 100%;\n }\n 60% {\n left: 100%;\n right: -90%;\n }\n 100% {\n left: 100%;\n right: -90%;\n }\n}\n@keyframes p-progressbar-indeterminate-anim {\n 0% {\n left: -35%;\n right: 100%;\n }\n 60% {\n left: 100%;\n right: -90%;\n }\n 100% {\n left: 100%;\n right: -90%;\n }\n}\n@-webkit-keyframes p-progressbar-indeterminate-anim-short {\n 0% {\n left: -200%;\n right: 100%;\n }\n 60% {\n left: 107%;\n right: -8%;\n }\n 100% {\n left: 107%;\n right: -8%;\n }\n}\n@keyframes p-progressbar-indeterminate-anim-short {\n 0% {\n left: -200%;\n right: 100%;\n }\n 60% {\n left: 107%;\n right: -8%;\n }\n 100% {\n left: 107%;\n right: -8%;\n }\n}\n'); }, "theme"); -var classes$o = { - root: /* @__PURE__ */ __name(function root8(_ref2) { +var classes$n = { + root: /* @__PURE__ */ __name(function root12(_ref2) { var instance = _ref2.instance; return ["p-progressbar p-component", { "p-progressbar-determinate": instance.determinate, @@ -115637,12 +143948,12 @@ var classes$o = { }; var ProgressBarStyle = BaseStyle.extend({ name: "progressbar", - theme: theme$m, - classes: classes$o + theme: theme$l, + classes: classes$n }); -var script$1$o = { +var script$1$n = { name: "BaseProgressBar", - "extends": script$_, + "extends": script$11, props: { value: { type: Number, @@ -115658,16 +143969,16 @@ var script$1$o = { } }, style: ProgressBarStyle, - provide: /* @__PURE__ */ __name(function provide17() { + provide: /* @__PURE__ */ __name(function provide20() { return { $pcProgressBar: this, $parentInstance: this }; }, "provide") }; -var script$D = { +var script$B = { name: "ProgressBar", - "extends": script$1$o, + "extends": script$1$n, inheritAttrs: false, computed: { progressStyle: /* @__PURE__ */ __name(function progressStyle() { @@ -115676,7 +143987,7 @@ var script$D = { display: "flex" }; }, "progressStyle"), - indeterminate: /* @__PURE__ */ __name(function indeterminate() { + indeterminate: /* @__PURE__ */ __name(function indeterminate2() { return this.mode === "indeterminate"; }, "indeterminate"), determinate: /* @__PURE__ */ __name(function determinate() { @@ -115684,8 +143995,8 @@ var script$D = { }, "determinate") } }; -var _hoisted_1$16 = ["aria-valuenow"]; -function render$C(_ctx, _cache, $props, $setup, $data, $options) { +var _hoisted_1$14 = ["aria-valuenow"]; +function render$A(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("div", mergeProps({ role: "progressbar", "class": _ctx.cx("root"), @@ -115704,10 +144015,10 @@ function render$C(_ctx, _cache, $props, $setup, $data, $options) { })], 16)) : createCommentVNode("", true)], 16)) : $options.indeterminate ? (openBlock(), createElementBlock("div", mergeProps({ key: 1, "class": _ctx.cx("value") - }, _ctx.ptm("value")), null, 16)) : createCommentVNode("", true)], 16, _hoisted_1$16); + }, _ctx.ptm("value")), null, 16)) : createCommentVNode("", true)], 16, _hoisted_1$14); } -__name(render$C, "render$C"); -script$D.render = render$C; +__name(render$A, "render$A"); +script$B.render = render$A; function useDownload(url, fileName) { const fileSize = ref(null); const fetchFileSize = /* @__PURE__ */ __name(async () => { @@ -115759,8 +144070,8 @@ const IPC_CHANNELS = { DELETE_MODEL: "delete-model", GET_ALL_DOWNLOADS: "get-all-downloads", GET_ELECTRON_VERSION: "get-electron-version", - SEND_ERROR_TO_SENTRY: "send-error-to-sentry", GET_BASE_PATH: "get-base-path", + SET_BASE_PATH: "set-base-path", GET_MODEL_CONFIG_PATH: "get-model-config-path", OPEN_PATH: "open-path", OPEN_LOGS_PATH: "open-logs-path", @@ -115775,9 +144086,23 @@ const IPC_CHANNELS = { VALIDATE_COMFYUI_SOURCE: "validate-comfyui-source", SHOW_DIRECTORY_PICKER: "show-directory-picker", INSTALL_COMFYUI: "install-comfyui", + CHANGE_THEME: "change-theme", SHOW_CONTEXT_MENU: "show-context-menu", RESTART_CORE: "restart-core", - GET_GPU: "get-gpu" + GET_GPU: "get-gpu", + SET_WINDOW_STYLE: "set-window-style", + GET_VALIDATION_STATE: "get-validation-state", + VALIDATION_UPDATE: "validation-update", + COMPLETE_VALIDATION: "complete-validation", + CANCEL_VALIDATION: "cancel-validation", + VALIDATE_INSTALLATION: "start-validation", + UV_INSTALL_REQUIREMENTS: "uv-install-requirements", + GET_WINDOW_STYLE: "get-window-style", + TRACK_EVENT: "track-event", + SET_METRICS_CONSENT: "set-metrics-consent", + INCREMENT_USER_PROPERTY: "increment-user-property", + UV_CLEAR_CACHE: "uv-clear-cache", + UV_RESET_VENV: "uv-delete-venv" }; var ProgressStatus = /* @__PURE__ */ ((ProgressStatus2) => { ProgressStatus2["INITIAL_STATE"] = "initial-state"; @@ -115787,28 +144112,6 @@ var ProgressStatus = /* @__PURE__ */ ((ProgressStatus2) => { ProgressStatus2["ERROR"] = "error"; return ProgressStatus2; })(ProgressStatus || {}); -const ProgressMessages = { - [ - "initial-state" - /* INITIAL_STATE */ - ]: "Loading...", - [ - "python-setup" - /* PYTHON_SETUP */ - ]: "Setting up Python Environment...", - [ - "starting-server" - /* STARTING_SERVER */ - ]: "Starting ComfyUI server...", - [ - "ready" - /* READY */ - ]: "Finishing...", - [ - "error" - /* ERROR */ - ]: "Was not able to start ComfyUI. Please check the logs for more details. You can open it from the Help menu. Please report issues to: https://forum.comfy.org" -}; const ELECTRON_BRIDGE_API = "electronAPI"; const SENTRY_URL_ENDPOINT = "https://942cadba58d247c9cab96f45221aa813@o4507954455314432.ingest.us.sentry.io/4508007940685824"; const MigrationItems = [ @@ -115855,16 +144158,16 @@ const useElectronDownloadStore = /* @__PURE__ */ defineStore("downloads", () => for (const download2 of allDownloads) { downloads.value.push(download2); } - DownloadManager.onDownloadProgress((data24) => { - if (!findByUrl(data24.url)) { - downloads.value.push(data24); + DownloadManager.onDownloadProgress((data25) => { + if (!findByUrl(data25.url)) { + downloads.value.push(data25); } - const download2 = findByUrl(data24.url); + const download2 = findByUrl(data25.url); if (download2) { - download2.progress = data24.progress; - download2.status = data24.status; - download2.filename = data24.filename; - download2.savePath = data24.savePath; + download2.progress = data25.progress; + download2.status = data25.status; + download2.filename = data25.filename; + download2.savePath = data25.savePath; } }); } @@ -115945,10 +144248,10 @@ function formatSize(value4) { } const bytes = value4; if (bytes === 0) return "0 B"; - const k = 1024; + const k2 = 1024; const sizes = ["B", "KB", "MB", "GB"]; - const i2 = Math.floor(Math.log(bytes) / Math.log(k)); - return `${parseFloat((bytes / Math.pow(k, i2)).toFixed(2))} ${sizes[i2]}`; + const i2 = Math.floor(Math.log(bytes) / Math.log(k2)); + return `${parseFloat((bytes / Math.pow(k2, i2)).toFixed(2))} ${sizes[i2]}`; } __name(formatSize, "formatSize"); function findCommonPrefix(path1, path2) { @@ -116039,8 +144342,8 @@ function processDynamicPrompt(input) { return result.replace(/\\([{}|])/g, "$1"); } __name(processDynamicPrompt, "processDynamicPrompt"); -const _hoisted_1$15 = { class: "flex flex-col" }; -const _hoisted_2$P = { class: "flex flex-row items-center gap-2" }; +const _hoisted_1$13 = { class: "flex flex-col" }; +const _hoisted_2$N = { class: "flex flex-row items-center gap-2" }; const _hoisted_3$p = { key: 0, class: "pi pi-check text-green-500" @@ -116097,8 +144400,8 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({ const triggerResumeDownload = /* @__PURE__ */ __name(() => electronDownloadStore.resume(props.url), "triggerResumeDownload"); return (_ctx, _cache) => { const _directive_tooltip = resolveDirective("tooltip"); - return openBlock(), createElementBlock("div", _hoisted_1$15, [ - createBaseVNode("div", _hoisted_2$P, [ + return openBlock(), createElementBlock("div", _hoisted_1$13, [ + createBaseVNode("div", _hoisted_2$N, [ status.value === "completed" ? (openBlock(), createElementBlock("i", _hoisted_3$p)) : createCommentVNode("", true), createBaseVNode("div", _hoisted_4$j, [ createBaseVNode("div", _hoisted_5$e, [ @@ -116110,7 +144413,7 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({ props.error ? (openBlock(), createElementBlock("div", _hoisted_7$5, toDisplayString$1(props.error), 1)) : createCommentVNode("", true) ]), createBaseVNode("div", _hoisted_8$3, [ - status.value === null || status.value === "error" ? (openBlock(), createBlock(unref(script$R), { + status.value === null || status.value === "error" ? (openBlock(), createBlock(unref(script$U), { key: 0, class: "file-action-button", label: _ctx.$t("g.download") + " (" + fileSize.value + ")", @@ -116123,12 +144426,12 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({ ]) ]), status.value === "in_progress" || status.value === "paused" ? (openBlock(), createElementBlock("div", _hoisted_9$3, [ - createVNode(unref(script$D), { + createVNode(unref(script$B), { class: "flex-1", value: downloadProgress.value, "show-value": downloadProgress.value > 10 }, null, 8, ["value", "show-value"]), - status.value === "in_progress" ? withDirectives((openBlock(), createBlock(unref(script$R), { + status.value === "in_progress" ? withDirectives((openBlock(), createBlock(unref(script$U), { key: 0, class: "file-action-button", size: "small", @@ -116144,7 +144447,7 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({ { top: true } ] ]) : createCommentVNode("", true), - status.value === "paused" ? withDirectives((openBlock(), createBlock(unref(script$R), { + status.value === "paused" ? withDirectives((openBlock(), createBlock(unref(script$U), { key: 1, class: "file-action-button", size: "small", @@ -116160,7 +144463,7 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({ { top: true } ] ]) : createCommentVNode("", true), - withDirectives(createVNode(unref(script$R), { + withDirectives(createVNode(unref(script$U), { class: "file-action-button", size: "small", outlined: "", @@ -116181,8 +144484,8 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({ }; } }); -const _hoisted_1$14 = { class: "flex flex-row items-center gap-2" }; -const _hoisted_2$O = { class: "file-info" }; +const _hoisted_1$12 = { class: "flex flex-row items-center gap-2" }; +const _hoisted_2$M = { class: "file-info" }; const _hoisted_3$o = { class: "file-details" }; const _hoisted_4$i = ["title"]; const _hoisted_5$d = { @@ -116207,8 +144510,8 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({ () => download2.fileSize.value ? formatSize(download2.fileSize.value) : "?" ); return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1$14, [ - createBaseVNode("div", _hoisted_2$O, [ + return openBlock(), createElementBlock("div", _hoisted_1$12, [ + createBaseVNode("div", _hoisted_2$M, [ createBaseVNode("div", _hoisted_3$o, [ createBaseVNode("span", { class: "file-type", @@ -116218,7 +144521,7 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({ props.error ? (openBlock(), createElementBlock("div", _hoisted_5$d, toDisplayString$1(props.error), 1)) : createCommentVNode("", true) ]), createBaseVNode("div", _hoisted_6$9, [ - createVNode(unref(script$R), { + createVNode(unref(script$U), { class: "file-action-button", label: _ctx.$t("g.download") + " (" + fileSize.value + ")", size: "small", @@ -116305,7 +144608,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({ title: "Missing Models", message: "When loading the graph, the following models were not found" }), - createVNode(unref(script$E), { + createVNode(unref(script$C), { options: missingModels.value, class: "comfy-missing-models" }, { @@ -116333,43 +144636,43 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({ } }); const MissingModelsWarning = /* @__PURE__ */ _export_sfc(_sfc_main$Q, [["__scopeId", "data-v-ebf9fccc"]]); -var theme$l = /* @__PURE__ */ __name(function theme18(_ref) { +var theme$k = /* @__PURE__ */ __name(function theme21(_ref) { var dt2 = _ref.dt; return "\n.p-floatlabel {\n display: block;\n position: relative;\n}\n\n.p-floatlabel label {\n position: absolute;\n pointer-events: none;\n top: 50%;\n margin-top: -.5rem;\n transition-property: all;\n transition-timing-function: ease;\n line-height: 1;\n left: 0.75rem;\n color: ".concat(dt2("floatlabel.color"), ";\n transition-duration: ").concat(dt2("floatlabel.transition.duration"), ";\n}\n\n.p-floatlabel:has(textarea) label {\n top: 1rem;\n}\n\n.p-floatlabel:has(input:focus) label,\n.p-floatlabel:has(input.p-filled) label,\n.p-floatlabel:has(input:-webkit-autofill) label,\n.p-floatlabel:has(textarea:focus) label,\n.p-floatlabel:has(textarea.p-filled) label,\n.p-floatlabel:has(.p-inputwrapper-focus) label,\n.p-floatlabel:has(.p-inputwrapper-filled) label {\n top: -.75rem;\n font-size: 12px;\n color: ").concat(dt2("floatlabel.focus.color"), ";\n}\n\n.p-floatlabel .p-placeholder,\n.p-floatlabel input::placeholder,\n.p-floatlabel .p-inputtext::placeholder {\n opacity: 0;\n transition-property: all;\n transition-timing-function: ease;\n}\n\n.p-floatlabel .p-focus .p-placeholder,\n.p-floatlabel input:focus::placeholder,\n.p-floatlabel .p-inputtext:focus::placeholder {\n opacity: 1;\n transition-property: all;\n transition-timing-function: ease;\n}\n\n.p-floatlabel > .p-invalid + label {\n color: ").concat(dt2("floatlabel.invalid.color"), ";\n}\n"); }, "theme"); -var classes$n = { +var classes$m = { root: "p-floatlabel" }; var FloatLabelStyle = BaseStyle.extend({ name: "floatlabel", - theme: theme$l, - classes: classes$n + theme: theme$k, + classes: classes$m }); -var script$1$n = { +var script$1$m = { name: "BaseFloatLabel", - "extends": script$_, + "extends": script$11, props: {}, style: FloatLabelStyle, - provide: /* @__PURE__ */ __name(function provide18() { + provide: /* @__PURE__ */ __name(function provide21() { return { $pcFloatLabel: this, $parentInstance: this }; }, "provide") }; -var script$C = { +var script$A = { name: "FloatLabel", - "extends": script$1$n, + "extends": script$1$m, inheritAttrs: false }; -function render$B(_ctx, _cache, $props, $setup, $data, $options) { +function render$z(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("span", mergeProps({ "class": _ctx.cx("root") }, _ctx.ptmi("root")), [renderSlot(_ctx.$slots, "default")], 16); } -__name(render$B, "render$B"); -script$C.render = render$B; -const _hoisted_1$13 = { class: "prompt-dialog-content flex flex-col gap-2 pt-8" }; +__name(render$z, "render$z"); +script$A.render = render$z; +const _hoisted_1$11 = { class: "prompt-dialog-content flex flex-col gap-2 pt-8" }; const _sfc_main$P = /* @__PURE__ */ defineComponent({ __name: "PromptDialogContent", props: { @@ -116391,10 +144694,10 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({ inputElement.setSelectionRange(0, inputElement.value.length); }, "selectAllText"); return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1$13, [ - createVNode(unref(script$C), null, { + return openBlock(), createElementBlock("div", _hoisted_1$11, [ + createVNode(unref(script$A), null, { default: withCtx(() => [ - createVNode(unref(script$G), { + createVNode(unref(script$O), { ref_key: "inputRef", ref: inputRef, modelValue: inputValue.value, @@ -116407,7 +144710,7 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({ ]), _: 1 }), - createVNode(unref(script$R), { onClick: onConfirm }, { + createVNode(unref(script$U), { onClick: onConfirm }, { default: withCtx(() => [ createTextVNode(toDisplayString$1(_ctx.$t("g.confirm")), 1) ]), @@ -116417,44 +144720,44 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({ }; } }); -var classes$m = { +var classes$l = { root: "p-tabpanels" }; var TabPanelsStyle = BaseStyle.extend({ name: "tabpanels", - classes: classes$m + classes: classes$l }); -var script$1$m = { +var script$1$l = { name: "BaseTabPanels", - "extends": script$_, + "extends": script$11, props: {}, style: TabPanelsStyle, - provide: /* @__PURE__ */ __name(function provide19() { + provide: /* @__PURE__ */ __name(function provide22() { return { $pcTabPanels: this, $parentInstance: this }; }, "provide") }; -var script$B = { +var script$z = { name: "TabPanels", - "extends": script$1$m, + "extends": script$1$l, inheritAttrs: false }; -function render$A(_ctx, _cache, $props, $setup, $data, $options) { +function render$y(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("div", mergeProps({ "class": _ctx.cx("root"), role: "presentation" }, _ctx.ptmi("root")), [renderSlot(_ctx.$slots, "default")], 16); } -__name(render$A, "render$A"); -script$B.render = render$A; -var theme$k = /* @__PURE__ */ __name(function theme19(_ref) { +__name(render$y, "render$y"); +script$z.render = render$y; +var theme$j = /* @__PURE__ */ __name(function theme22(_ref) { var dt2 = _ref.dt; return "\n.p-tabs {\n display: flex;\n flex-direction: column;\n}\n\n.p-tablist {\n display: flex;\n position: relative;\n}\n\n.p-tabs-scrollable > .p-tablist {\n overflow: hidden;\n}\n\n.p-tablist-viewport {\n overflow-x: auto;\n overflow-y: hidden;\n scroll-behavior: smooth;\n scrollbar-width: none;\n overscroll-behavior: contain auto;\n}\n\n.p-tablist-viewport::-webkit-scrollbar {\n display: none;\n}\n\n.p-tablist-tab-list {\n position: relative;\n display: flex;\n background: ".concat(dt2("tabs.tablist.background"), ";\n border-style: solid;\n border-color: ").concat(dt2("tabs.tablist.border.color"), ";\n border-width: ").concat(dt2("tabs.tablist.border.width"), ";\n}\n\n.p-tablist-content {\n flex-grow: 1;\n}\n\n.p-tablist-nav-button {\n all: unset;\n position: absolute !important;\n flex-shrink: 0;\n top: 0;\n z-index: 2;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n background: ").concat(dt2("tabs.nav.button.background"), ";\n color: ").concat(dt2("tabs.nav.button.color"), ";\n width: ").concat(dt2("tabs.nav.button.width"), ";\n transition: color ").concat(dt2("tabs.transition.duration"), ", outline-color ").concat(dt2("tabs.transition.duration"), ", box-shadow ").concat(dt2("tabs.transition.duration"), ";\n box-shadow: ").concat(dt2("tabs.nav.button.shadow"), ";\n outline-color: transparent;\n cursor: pointer;\n}\n\n.p-tablist-nav-button:focus-visible {\n z-index: 1;\n box-shadow: ").concat(dt2("tabs.nav.button.focus.ring.shadow"), ";\n outline: ").concat(dt2("tabs.nav.button.focus.ring.width"), " ").concat(dt2("tabs.nav.button.focus.ring.style"), " ").concat(dt2("tabs.nav.button.focus.ring.color"), ";\n outline-offset: ").concat(dt2("tabs.nav.button.focus.ring.offset"), ";\n}\n\n.p-tablist-nav-button:hover {\n color: ").concat(dt2("tabs.nav.button.hover.color"), ";\n}\n\n.p-tablist-prev-button {\n left: 0;\n}\n\n.p-tablist-next-button {\n right: 0;\n}\n\n.p-tab {\n flex-shrink: 0;\n cursor: pointer;\n user-select: none;\n position: relative;\n border-style: solid;\n white-space: nowrap;\n background: ").concat(dt2("tabs.tab.background"), ";\n border-width: ").concat(dt2("tabs.tab.border.width"), ";\n border-color: ").concat(dt2("tabs.tab.border.color"), ";\n color: ").concat(dt2("tabs.tab.color"), ";\n padding: ").concat(dt2("tabs.tab.padding"), ";\n font-weight: ").concat(dt2("tabs.tab.font.weight"), ";\n transition: background ").concat(dt2("tabs.transition.duration"), ", border-color ").concat(dt2("tabs.transition.duration"), ", color ").concat(dt2("tabs.transition.duration"), ", outline-color ").concat(dt2("tabs.transition.duration"), ", box-shadow ").concat(dt2("tabs.transition.duration"), ";\n margin: ").concat(dt2("tabs.tab.margin"), ";\n outline-color: transparent;\n}\n\n.p-tab:not(.p-disabled):focus-visible {\n z-index: 1;\n box-shadow: ").concat(dt2("tabs.tab.focus.ring.shadow"), ";\n outline: ").concat(dt2("tabs.tab.focus.ring.width"), " ").concat(dt2("tabs.tab.focus.ring.style"), " ").concat(dt2("tabs.tab.focus.ring.color"), ";\n outline-offset: ").concat(dt2("tabs.tab.focus.ring.offset"), ";\n}\n\n.p-tab:not(.p-tab-active):not(.p-disabled):hover {\n background: ").concat(dt2("tabs.tab.hover.background"), ";\n border-color: ").concat(dt2("tabs.tab.hover.border.color"), ";\n color: ").concat(dt2("tabs.tab.hover.color"), ";\n}\n\n.p-tab-active {\n background: ").concat(dt2("tabs.tab.active.background"), ";\n border-color: ").concat(dt2("tabs.tab.active.border.color"), ";\n color: ").concat(dt2("tabs.tab.active.color"), ";\n}\n\n.p-tabpanels {\n background: ").concat(dt2("tabs.tabpanel.background"), ";\n color: ").concat(dt2("tabs.tabpanel.color"), ";\n padding: ").concat(dt2("tabs.tabpanel.padding"), ";\n outline: 0 none;\n}\n\n.p-tabpanel:focus-visible {\n box-shadow: ").concat(dt2("tabs.tabpanel.focus.ring.shadow"), ";\n outline: ").concat(dt2("tabs.tabpanel.focus.ring.width"), " ").concat(dt2("tabs.tabpanel.focus.ring.style"), " ").concat(dt2("tabs.tabpanel.focus.ring.color"), ";\n outline-offset: ").concat(dt2("tabs.tabpanel.focus.ring.offset"), ";\n}\n\n.p-tablist-active-bar {\n z-index: 1;\n display: block;\n position: absolute;\n bottom: ").concat(dt2("tabs.active.bar.bottom"), ";\n height: ").concat(dt2("tabs.active.bar.height"), ";\n background: ").concat(dt2("tabs.active.bar.background"), ";\n transition: 250ms cubic-bezier(0.35, 0, 0.25, 1);\n}\n"); }, "theme"); -var classes$l = { - root: /* @__PURE__ */ __name(function root9(_ref2) { +var classes$k = { + root: /* @__PURE__ */ __name(function root13(_ref2) { var props = _ref2.props; return ["p-tabs p-component", { "p-tabs-scrollable": props.scrollable @@ -116463,12 +144766,12 @@ var classes$l = { }; var TabsStyle = BaseStyle.extend({ name: "tabs", - theme: theme$k, - classes: classes$l + theme: theme$j, + classes: classes$k }); -var script$1$l = { +var script$1$k = { name: "BaseTabs", - "extends": script$_, + "extends": script$11, props: { value: { type: [String, Number], @@ -116496,33 +144799,33 @@ var script$1$l = { } }, style: TabsStyle, - provide: /* @__PURE__ */ __name(function provide20() { + provide: /* @__PURE__ */ __name(function provide23() { return { $pcTabs: this, $parentInstance: this }; }, "provide") }; -var script$A = { +var script$y = { name: "Tabs", - "extends": script$1$l, + "extends": script$1$k, inheritAttrs: false, emits: ["update:value"], - data: /* @__PURE__ */ __name(function data7() { + data: /* @__PURE__ */ __name(function data9() { return { id: this.$attrs.id, d_value: this.value }; }, "data"), watch: { - "$attrs.id": /* @__PURE__ */ __name(function $attrsId4(newValue2) { + "$attrs.id": /* @__PURE__ */ __name(function $attrsId5(newValue2) { this.id = newValue2 || UniqueComponentId(); }, "$attrsId"), value: /* @__PURE__ */ __name(function value(newValue2) { this.d_value = newValue2; }, "value") }, - mounted: /* @__PURE__ */ __name(function mounted9() { + mounted: /* @__PURE__ */ __name(function mounted11() { this.id = this.id || UniqueComponentId(); }, "mounted"), methods: { @@ -116537,40 +144840,40 @@ var script$A = { }, "isVertical") } }; -function render$z(_ctx, _cache, $props, $setup, $data, $options) { +function render$x(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("div", mergeProps({ "class": _ctx.cx("root") }, _ctx.ptmi("root")), [renderSlot(_ctx.$slots, "default")], 16); } -__name(render$z, "render$z"); -script$A.render = render$z; -var script$z = { +__name(render$x, "render$x"); +script$y.render = render$x; +var script$x = { name: "TimesCircleIcon", - "extends": script$X + "extends": script$_ }; -var _hoisted_1$12 = /* @__PURE__ */ createBaseVNode("path", { +var _hoisted_1$10 = /* @__PURE__ */ createBaseVNode("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M7 14C5.61553 14 4.26215 13.5895 3.11101 12.8203C1.95987 12.0511 1.06266 10.9579 0.532846 9.67879C0.00303296 8.3997 -0.13559 6.99224 0.134506 5.63437C0.404603 4.2765 1.07129 3.02922 2.05026 2.05026C3.02922 1.07129 4.2765 0.404603 5.63437 0.134506C6.99224 -0.13559 8.3997 0.00303296 9.67879 0.532846C10.9579 1.06266 12.0511 1.95987 12.8203 3.11101C13.5895 4.26215 14 5.61553 14 7C14 8.85652 13.2625 10.637 11.9497 11.9497C10.637 13.2625 8.85652 14 7 14ZM7 1.16667C5.84628 1.16667 4.71846 1.50879 3.75918 2.14976C2.79989 2.79074 2.05222 3.70178 1.61071 4.76768C1.16919 5.83358 1.05367 7.00647 1.27876 8.13803C1.50384 9.26958 2.05941 10.309 2.87521 11.1248C3.69102 11.9406 4.73042 12.4962 5.86198 12.7212C6.99353 12.9463 8.16642 12.8308 9.23232 12.3893C10.2982 11.9478 11.2093 11.2001 11.8502 10.2408C12.4912 9.28154 12.8333 8.15373 12.8333 7C12.8333 5.45291 12.2188 3.96918 11.1248 2.87521C10.0308 1.78125 8.5471 1.16667 7 1.16667ZM4.66662 9.91668C4.58998 9.91704 4.51404 9.90209 4.44325 9.87271C4.37246 9.84333 4.30826 9.8001 4.2544 9.74557C4.14516 9.6362 4.0838 9.48793 4.0838 9.33335C4.0838 9.17876 4.14516 9.0305 4.2544 8.92113L6.17553 7L4.25443 5.07891C4.15139 4.96832 4.09529 4.82207 4.09796 4.67094C4.10063 4.51982 4.16185 4.37563 4.26872 4.26876C4.3756 4.16188 4.51979 4.10066 4.67091 4.09799C4.82204 4.09532 4.96829 4.15142 5.07887 4.25446L6.99997 6.17556L8.92106 4.25446C9.03164 4.15142 9.1779 4.09532 9.32903 4.09799C9.48015 4.10066 9.62434 4.16188 9.73121 4.26876C9.83809 4.37563 9.89931 4.51982 9.90198 4.67094C9.90464 4.82207 9.84855 4.96832 9.74551 5.07891L7.82441 7L9.74554 8.92113C9.85478 9.0305 9.91614 9.17876 9.91614 9.33335C9.91614 9.48793 9.85478 9.6362 9.74554 9.74557C9.69168 9.8001 9.62748 9.84333 9.55669 9.87271C9.4859 9.90209 9.40996 9.91704 9.33332 9.91668C9.25668 9.91704 9.18073 9.90209 9.10995 9.87271C9.03916 9.84333 8.97495 9.8001 8.9211 9.74557L6.99997 7.82444L5.07884 9.74557C5.02499 9.8001 4.96078 9.84333 4.88999 9.87271C4.81921 9.90209 4.74326 9.91704 4.66662 9.91668Z", fill: "currentColor" }, null, -1); -var _hoisted_2$N = [_hoisted_1$12]; -function render$y(_ctx, _cache, $props, $setup, $data, $options) { +var _hoisted_2$L = [_hoisted_1$10]; +function render$w(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" - }, _ctx.pti()), _hoisted_2$N, 16); + }, _ctx.pti()), _hoisted_2$L, 16); } -__name(render$y, "render$y"); -script$z.render = render$y; -var theme$j = /* @__PURE__ */ __name(function theme20(_ref) { +__name(render$w, "render$w"); +script$x.render = render$w; +var theme$i = /* @__PURE__ */ __name(function theme23(_ref) { var dt2 = _ref.dt; return "\n.p-chip {\n display: inline-flex;\n align-items: center;\n background: ".concat(dt2("chip.background"), ";\n color: ").concat(dt2("chip.color"), ";\n border-radius: ").concat(dt2("chip.border.radius"), ";\n padding: ").concat(dt2("chip.padding.y"), " ").concat(dt2("chip.padding.x"), ";\n gap: ").concat(dt2("chip.gap"), ";\n}\n\n.p-chip-icon {\n color: ").concat(dt2("chip.icon.color"), ";\n font-size: ").concat(dt2("chip.icon.font.size"), ";\n width: ").concat(dt2("chip.icon.size"), ";\n height: ").concat(dt2("chip.icon.size"), ";\n}\n\n.p-chip-image {\n border-radius: 50%;\n width: ").concat(dt2("chip.image.width"), ";\n height: ").concat(dt2("chip.image.height"), ";\n margin-left: calc(-1 * ").concat(dt2("chip.padding.y"), ");\n}\n\n.p-chip:has(.p-chip-remove-icon) {\n padding-right: ").concat(dt2("chip.padding.y"), ";\n}\n\n.p-chip:has(.p-chip-image) {\n padding-top: calc(").concat(dt2("chip.padding.y"), " / 2);\n padding-bottom: calc(").concat(dt2("chip.padding.y"), " / 2);\n}\n\n.p-chip-remove-icon {\n cursor: pointer;\n font-size: ").concat(dt2("chip.remove.icon.size"), ";\n width: ").concat(dt2("chip.remove.icon.size"), ";\n height: ").concat(dt2("chip.remove.icon.size"), ";\n color: ").concat(dt2("chip.remove.icon.color"), ";\n border-radius: 50%;\n transition: outline-color ").concat(dt2("chip.transition.duration"), ", box-shadow ").concat(dt2("chip.transition.duration"), ";\n outline-color: transparent;\n}\n\n.p-chip-remove-icon:focus-visible {\n box-shadow: ").concat(dt2("chip.remove.icon.focus.ring.shadow"), ";\n outline: ").concat(dt2("chip.remove.icon.focus.ring.width"), " ").concat(dt2("chip.remove.icon.focus.ring.style"), " ").concat(dt2("chip.remove.icon.focus.ring.color"), ";\n outline-offset: ").concat(dt2("chip.remove.icon.focus.ring.offset"), ";\n}\n"); }, "theme"); -var classes$k = { +var classes$j = { root: "p-chip p-component", image: "p-chip-image", icon: "p-chip-icon", @@ -116579,12 +144882,12 @@ var classes$k = { }; var ChipStyle = BaseStyle.extend({ name: "chip", - theme: theme$j, - classes: classes$k + theme: theme$i, + classes: classes$j }); -var script$1$k = { +var script$1$j = { name: "BaseChip", - "extends": script$_, + "extends": script$11, props: { label: { type: String, @@ -116608,19 +144911,19 @@ var script$1$k = { } }, style: ChipStyle, - provide: /* @__PURE__ */ __name(function provide21() { + provide: /* @__PURE__ */ __name(function provide24() { return { $pcChip: this, $parentInstance: this }; }, "provide") }; -var script$y = { +var script$w = { name: "Chip", - "extends": script$1$k, + "extends": script$1$j, inheritAttrs: false, emits: ["remove"], - data: /* @__PURE__ */ __name(function data8() { + data: /* @__PURE__ */ __name(function data10() { return { visible: true }; @@ -116637,12 +144940,12 @@ var script$y = { }, "close") }, components: { - TimesCircleIcon: script$z + TimesCircleIcon: script$x } }; -var _hoisted_1$11 = ["aria-label"]; -var _hoisted_2$M = ["src"]; -function render$x(_ctx, _cache, $props, $setup, $data, $options) { +var _hoisted_1$$ = ["aria-label"]; +var _hoisted_2$K = ["src"]; +function render$v(_ctx, _cache, $props, $setup, $data, $options) { return $data.visible ? (openBlock(), createElementBlock("div", mergeProps({ key: 0, "class": _ctx.cx("root"), @@ -116653,7 +144956,7 @@ function render$x(_ctx, _cache, $props, $setup, $data, $options) { src: _ctx.image }, _ctx.ptm("image"), { "class": _ctx.cx("image") - }), null, 16, _hoisted_2$M)) : _ctx.$slots.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.$slots.icon), mergeProps({ + }), null, 16, _hoisted_2$K)) : _ctx.$slots.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.$slots.icon), mergeProps({ key: 1, "class": _ctx.cx("icon") }, _ctx.ptm("icon")), null, 16, ["class"])) : _ctx.icon ? (openBlock(), createElementBlock("span", mergeProps({ @@ -116674,10 +144977,10 @@ function render$x(_ctx, _cache, $props, $setup, $data, $options) { onClick: $options.close, onKeydown: $options.onKeydown }, _ctx.ptm("removeIcon")), null, 16, ["class", "onClick", "onKeydown"]))]; - }) : createCommentVNode("", true)], 16, _hoisted_1$11)) : createCommentVNode("", true); + }) : createCommentVNode("", true)], 16, _hoisted_1$$)) : createCommentVNode("", true); } -__name(render$x, "render$x"); -script$y.render = render$x; +__name(render$v, "render$v"); +script$w.render = render$v; const _sfc_main$O = /* @__PURE__ */ defineComponent({ __name: "SearchFilterChip", props: { @@ -116688,12 +144991,12 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({ emits: ["remove"], setup(__props) { return (_ctx, _cache) => { - return openBlock(), createBlock(unref(script$y), { + return openBlock(), createBlock(unref(script$w), { removable: "", onRemove: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("remove", $event)) }, { default: withCtx(() => [ - createVNode(unref(script$S), { + createVNode(unref(script$V), { size: "small", class: normalizeClass(_ctx.badgeClass) }, { @@ -116710,8 +145013,8 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({ } }); const SearchFilterChip = /* @__PURE__ */ _export_sfc(_sfc_main$O, [["__scopeId", "data-v-53692f7e"]]); -const _withScopeId$j = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-ba13476b"), n = n(), popScopeId(), n), "_withScopeId$j"); -const _hoisted_1$10 = { +const _withScopeId$j = /* @__PURE__ */ __name((n2) => (pushScopeId("data-v-ba13476b"), n2 = n2(), popScopeId(), n2), "_withScopeId$j"); +const _hoisted_1$_ = { key: 0, class: "search-filters pt-2 flex flex-wrap gap-2" }; @@ -116752,9 +145055,9 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({ return openBlock(), createElementBlock("div", { class: normalizeClass(props.class) }, [ - createVNode(unref(script$I), null, { + createVNode(unref(script$F), null, { default: withCtx(() => [ - props.filterIcon ? (openBlock(), createBlock(unref(script$R), { + props.filterIcon ? (openBlock(), createBlock(unref(script$U), { key: 0, class: "p-inputicon filter-button", icon: props.filterIcon, @@ -116762,17 +145065,17 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({ severity: "contrast", onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("showFilter", $event)) }, null, 8, ["icon"])) : createCommentVNode("", true), - createVNode(unref(script$G), { + createVNode(unref(script$O), { class: "search-box-input w-full", onInput: handleInput, modelValue: props.modelValue, placeholder: props.placeholder }, null, 8, ["modelValue", "placeholder"]), - !props.modelValue ? (openBlock(), createBlock(unref(script$H), { + !props.modelValue ? (openBlock(), createBlock(unref(script$E), { key: 1, class: normalizeClass(props.icon) }, null, 8, ["class"])) : createCommentVNode("", true), - props.modelValue ? (openBlock(), createBlock(unref(script$R), { + props.modelValue ? (openBlock(), createBlock(unref(script$U), { key: 2, class: "p-inputicon clear-button", icon: "pi pi-times", @@ -116783,7 +145086,7 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({ ]), _: 1 }), - unref(filters)?.length ? (openBlock(), createElementBlock("div", _hoisted_1$10, [ + unref(filters)?.length ? (openBlock(), createElementBlock("div", _hoisted_1$_, [ (openBlock(true), createElementBlock(Fragment$1, null, renderList(unref(filters), (filter4) => { return openBlock(), createBlock(SearchFilterChip, { key: filter4.id, @@ -116800,25 +145103,25 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({ }); const SearchBox = /* @__PURE__ */ _export_sfc(_sfc_main$N, [["__scopeId", "data-v-ba13476b"]]); function buildTree$1(items2, key) { - const root24 = { + const root27 = { key: "root", label: "root", children: [] }; const map3 = { - root: root24 + root: root27 }; for (const item3 of items2) { const keys2 = key(item3); - let parent = root24; + let parent = root27; for (let i2 = 0; i2 < keys2.length; i2++) { - const k = keys2[i2]; - if (k === "" && i2 === keys2.length - 1) break; - const id3 = parent.key + "/" + k; + const k2 = keys2[i2]; + if (k2 === "" && i2 === keys2.length - 1) break; + const id3 = parent.key + "/" + k2; if (!map3[id3]) { const node3 = { key: id3, - label: k, + label: k2, leaf: false, children: [] }; @@ -116830,7 +145133,7 @@ function buildTree$1(items2, key) { parent.leaf = keys2[keys2.length - 1] !== ""; parent.data = item3; } - return root24; + return root27; } __name(buildTree$1, "buildTree$1"); function flattenTree(tree) { @@ -116855,10 +145158,10 @@ function sortedTree(node3, { const folders = node3.children.filter((child) => !child.leaf); const files = node3.children.filter((child) => child.leaf); const sortedFolders = folders.sort( - (a, b) => (a.label ?? "").localeCompare(b.label ?? "") + (a2, b2) => (a2.label ?? "").localeCompare(b2.label ?? "") ); const sortedFiles = files.sort( - (a, b) => (a.label ?? "").localeCompare(b.label ?? "") + (a2, b2) => (a2.label ?? "").localeCompare(b2.label ?? "") ); newNode.children = [ ...sortedFolders.map( @@ -116868,7 +145171,7 @@ function sortedTree(node3, { ]; } else { const sortedChildren = [...node3.children].sort( - (a, b) => (a.label ?? "").localeCompare(b.label ?? "") + (a2, b2) => (a2.label ?? "").localeCompare(b2.label ?? "") ); newNode.children = [ ...sortedChildren.map( @@ -116880,14 +145183,14 @@ function sortedTree(node3, { return newNode; } __name(sortedTree, "sortedTree"); -const findNodeByKey = /* @__PURE__ */ __name((root24, key) => { - if (root24.key === key) { - return root24; +const findNodeByKey = /* @__PURE__ */ __name((root27, key) => { + if (root27.key === key) { + return root27; } - if (!root24.children) { + if (!root27.children) { return null; } - for (const child of root24.children) { + for (const child of root27.children) { const result = findNodeByKey(child, key); if (result) { return result; @@ -116917,23 +145220,23 @@ const useSettingStore = /* @__PURE__ */ defineStore("setting", () => { const settingValues = ref({}); const settingsById = ref({}); const settingTree = computed(() => { - const root24 = buildTree$1( + const root27 = buildTree$1( Object.values(settingsById.value).filter( (setting) => setting.type !== "hidden" ), (setting) => setting.category || setting.id.split(".") ); - const floatingSettings = (root24.children ?? []).filter((node3) => node3.leaf); + const floatingSettings = (root27.children ?? []).filter((node3) => node3.leaf); if (floatingSettings.length) { - root24.children = (root24.children ?? []).filter((node3) => !node3.leaf); - root24.children.push({ + root27.children = (root27.children ?? []).filter((node3) => !node3.leaf); + root27.children.push({ key: "Other", label: "Other", leaf: false, children: floatingSettings }); } - return root24; + return root27; }); function exists(key) { return settingValues.value[key] !== void 0; @@ -116999,12 +145302,12 @@ const useSettingStore = /* @__PURE__ */ defineStore("setting", () => { getDefaultValue }; }); -var theme$i = /* @__PURE__ */ __name(function theme21(_ref) { +var theme$h = /* @__PURE__ */ __name(function theme24(_ref) { var dt2 = _ref.dt; return "\n.p-tag {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n background: ".concat(dt2("tag.primary.background"), ";\n color: ").concat(dt2("tag.primary.color"), ";\n font-size: ").concat(dt2("tag.font.size"), ";\n font-weight: ").concat(dt2("tag.font.weight"), ";\n padding: ").concat(dt2("tag.padding"), ";\n border-radius: ").concat(dt2("tag.border.radius"), ";\n gap: ").concat(dt2("tag.gap"), ";\n}\n\n.p-tag-icon {\n font-size: ").concat(dt2("tag.icon.size"), ";\n width: ").concat(dt2("tag.icon.size"), ";\n height:").concat(dt2("tag.icon.size"), ";\n}\n\n.p-tag-rounded {\n border-radius: ").concat(dt2("tag.rounded.border.radius"), ";\n}\n\n.p-tag-success {\n background: ").concat(dt2("tag.success.background"), ";\n color: ").concat(dt2("tag.success.color"), ";\n}\n\n.p-tag-info {\n background: ").concat(dt2("tag.info.background"), ";\n color: ").concat(dt2("tag.info.color"), ";\n}\n\n.p-tag-warn {\n background: ").concat(dt2("tag.warn.background"), ";\n color: ").concat(dt2("tag.warn.color"), ";\n}\n\n.p-tag-danger {\n background: ").concat(dt2("tag.danger.background"), ";\n color: ").concat(dt2("tag.danger.color"), ";\n}\n\n.p-tag-secondary {\n background: ").concat(dt2("tag.secondary.background"), ";\n color: ").concat(dt2("tag.secondary.color"), ";\n}\n\n.p-tag-contrast {\n background: ").concat(dt2("tag.contrast.background"), ";\n color: ").concat(dt2("tag.contrast.color"), ";\n}\n"); }, "theme"); -var classes$j = { - root: /* @__PURE__ */ __name(function root10(_ref2) { +var classes$i = { + root: /* @__PURE__ */ __name(function root14(_ref2) { var props = _ref2.props; return ["p-tag p-component", { "p-tag-info": props.severity === "info", @@ -117021,12 +145324,12 @@ var classes$j = { }; var TagStyle = BaseStyle.extend({ name: "tag", - theme: theme$i, - classes: classes$j + theme: theme$h, + classes: classes$i }); -var script$1$j = { +var script$1$i = { name: "BaseTag", - "extends": script$_, + "extends": script$11, props: { value: null, severity: null, @@ -117034,19 +145337,19 @@ var script$1$j = { icon: String }, style: TagStyle, - provide: /* @__PURE__ */ __name(function provide22() { + provide: /* @__PURE__ */ __name(function provide25() { return { $pcTag: this, $parentInstance: this }; }, "provide") }; -var script$x = { +var script$v = { name: "Tag", - "extends": script$1$j, + "extends": script$1$i, inheritAttrs: false }; -function render$w(_ctx, _cache, $props, $setup, $data, $options) { +function render$u(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("span", mergeProps({ "class": _ctx.cx("root") }, _ctx.ptmi("root")), [_ctx.$slots.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.$slots.icon), mergeProps({ @@ -117063,10 +145366,10 @@ function render$w(_ctx, _cache, $props, $setup, $data, $options) { }, _ctx.ptm("label")), toDisplayString$1(_ctx.value), 17)]; }) : createCommentVNode("", true)], 16); } -__name(render$w, "render$w"); -script$x.render = render$w; -var classes$i = { - root: /* @__PURE__ */ __name(function root11(_ref) { +__name(render$u, "render$u"); +script$v.render = render$u; +var classes$h = { + root: /* @__PURE__ */ __name(function root15(_ref) { var instance = _ref.instance; return ["p-tabpanel", { "p-tabpanel-active": instance.active @@ -117075,11 +145378,11 @@ var classes$i = { }; var TabPanelStyle = BaseStyle.extend({ name: "tabpanel", - classes: classes$i + classes: classes$h }); -var script$1$i = { +var script$1$h = { name: "BaseTabPanel", - "extends": script$_, + "extends": script$11, props: { // in Tabs value: { @@ -117106,16 +145409,16 @@ var script$1$i = { disabled: Boolean }, style: TabPanelStyle, - provide: /* @__PURE__ */ __name(function provide23() { + provide: /* @__PURE__ */ __name(function provide26() { return { $pcTabPanel: this, $parentInstance: this }; }, "provide") }; -var script$w = { +var script$u = { name: "TabPanel", - "extends": script$1$i, + "extends": script$1$h, inheritAttrs: false, inject: ["$pcTabs"], computed: { @@ -117154,7 +145457,7 @@ var script$w = { }, "ptParams") } }; -function render$v(_ctx, _cache, $props, $setup, $data, $options) { +function render$t(_ctx, _cache, $props, $setup, $data, $options) { var _$options$$pcTabs, _$options$$pcTabs2; return !$options.$pcTabs ? renderSlot(_ctx.$slots, "default", { key: 0 @@ -117177,54 +145480,54 @@ function render$v(_ctx, _cache, $props, $setup, $data, $options) { a11yAttrs: $options.a11yAttrs })], 64)); } -__name(render$v, "render$v"); -script$w.render = render$v; -var script$v = { +__name(render$t, "render$t"); +script$u.render = render$t; +var script$t = { name: "ChevronLeftIcon", - "extends": script$X + "extends": script$_ }; -var _hoisted_1$$ = /* @__PURE__ */ createBaseVNode("path", { +var _hoisted_1$Z = /* @__PURE__ */ createBaseVNode("path", { d: "M9.61296 13C9.50997 13.0005 9.40792 12.9804 9.3128 12.9409C9.21767 12.9014 9.13139 12.8433 9.05902 12.7701L3.83313 7.54416C3.68634 7.39718 3.60388 7.19795 3.60388 6.99022C3.60388 6.78249 3.68634 6.58325 3.83313 6.43628L9.05902 1.21039C9.20762 1.07192 9.40416 0.996539 9.60724 1.00012C9.81032 1.00371 10.0041 1.08597 10.1477 1.22959C10.2913 1.37322 10.3736 1.56698 10.3772 1.77005C10.3808 1.97313 10.3054 2.16968 10.1669 2.31827L5.49496 6.99022L10.1669 11.6622C10.3137 11.8091 10.3962 12.0084 10.3962 12.2161C10.3962 12.4238 10.3137 12.6231 10.1669 12.7701C10.0945 12.8433 10.0083 12.9014 9.91313 12.9409C9.81801 12.9804 9.71596 13.0005 9.61296 13Z", fill: "currentColor" }, null, -1); -var _hoisted_2$L = [_hoisted_1$$]; -function render$u(_ctx, _cache, $props, $setup, $data, $options) { +var _hoisted_2$J = [_hoisted_1$Z]; +function render$s(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" - }, _ctx.pti()), _hoisted_2$L, 16); + }, _ctx.pti()), _hoisted_2$J, 16); } -__name(render$u, "render$u"); -script$v.render = render$u; -var script$u = { +__name(render$s, "render$s"); +script$t.render = render$s; +var script$s = { name: "ChevronRightIcon", - "extends": script$X + "extends": script$_ }; -var _hoisted_1$_ = /* @__PURE__ */ createBaseVNode("path", { +var _hoisted_1$Y = /* @__PURE__ */ createBaseVNode("path", { d: "M4.38708 13C4.28408 13.0005 4.18203 12.9804 4.08691 12.9409C3.99178 12.9014 3.9055 12.8433 3.83313 12.7701C3.68634 12.6231 3.60388 12.4238 3.60388 12.2161C3.60388 12.0084 3.68634 11.8091 3.83313 11.6622L8.50507 6.99022L3.83313 2.31827C3.69467 2.16968 3.61928 1.97313 3.62287 1.77005C3.62645 1.56698 3.70872 1.37322 3.85234 1.22959C3.99596 1.08597 4.18972 1.00371 4.3928 1.00012C4.59588 0.996539 4.79242 1.07192 4.94102 1.21039L10.1669 6.43628C10.3137 6.58325 10.3962 6.78249 10.3962 6.99022C10.3962 7.19795 10.3137 7.39718 10.1669 7.54416L4.94102 12.7701C4.86865 12.8433 4.78237 12.9014 4.68724 12.9409C4.59212 12.9804 4.49007 13.0005 4.38708 13Z", fill: "currentColor" }, null, -1); -var _hoisted_2$K = [_hoisted_1$_]; -function render$t(_ctx, _cache, $props, $setup, $data, $options) { +var _hoisted_2$I = [_hoisted_1$Y]; +function render$r(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" - }, _ctx.pti()), _hoisted_2$K, 16); + }, _ctx.pti()), _hoisted_2$I, 16); } -__name(render$t, "render$t"); -script$u.render = render$t; -var theme$h = /* @__PURE__ */ __name(function theme22(_ref) { +__name(render$r, "render$r"); +script$s.render = render$r; +var theme$g = /* @__PURE__ */ __name(function theme25(_ref) { var dt2 = _ref.dt; return "\n.p-tabview-tablist-container {\n position: relative;\n}\n\n.p-tabview-scrollable > .p-tabview-tablist-container {\n overflow: hidden;\n}\n\n.p-tabview-tablist-scroll-container {\n overflow-x: auto;\n overflow-y: hidden;\n scroll-behavior: smooth;\n scrollbar-width: none;\n overscroll-behavior: contain auto;\n}\n\n.p-tabview-tablist-scroll-container::-webkit-scrollbar {\n display: none;\n}\n\n.p-tabview-tablist {\n display: flex;\n margin: 0;\n padding: 0;\n list-style-type: none;\n flex: 1 1 auto;\n background: ".concat(dt2("tabview.tab.list.background"), ";\n border: 1px solid ").concat(dt2("tabview.tab.list.border.color"), ";\n border-width: 0 0 1px 0;\n position: relative;\n}\n\n.p-tabview-tab-header {\n cursor: pointer;\n user-select: none;\n display: flex;\n align-items: center;\n text-decoration: none;\n position: relative;\n overflow: hidden;\n border-style: solid;\n border-width: 0 0 1px 0;\n border-color: transparent transparent ").concat(dt2("tabview.tab.border.color"), " transparent;\n color: ").concat(dt2("tabview.tab.color"), ";\n padding: 1rem 1.125rem;\n font-weight: 600;\n border-top-right-radius: ").concat(dt2("border.radius.md"), ";\n border-top-left-radius: ").concat(dt2("border.radius.md"), ";\n transition: color ").concat(dt2("tabview.transition.duration"), ", outline-color ").concat(dt2("tabview.transition.duration"), ";\n margin: 0 0 -1px 0;\n outline-color: transparent;\n}\n\n.p-tabview-tablist-item:not(.p-disabled) .p-tabview-tab-header:focus-visible {\n outline: ").concat(dt2("focus.ring.width"), " ").concat(dt2("focus.ring.style"), " ").concat(dt2("focus.ring.color"), ";\n outline-offset: -1px;\n}\n\n.p-tabview-tablist-item:not(.p-highlight):not(.p-disabled):hover > .p-tabview-tab-header {\n color: ").concat(dt2("tabview.tab.hover.color"), ";\n}\n\n.p-tabview-tablist-item.p-highlight > .p-tabview-tab-header {\n color: ").concat(dt2("tabview.tab.active.color"), ";\n}\n\n.p-tabview-tab-title {\n line-height: 1;\n white-space: nowrap;\n}\n\n.p-tabview-next-button,\n.p-tabview-prev-button {\n position: absolute;\n top: 0;\n margin: 0;\n padding: 0;\n z-index: 2;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n background: ").concat(dt2("tabview.nav.button.background"), ";\n color: ").concat(dt2("tabview.nav.button.color"), ";\n width: 2.5rem;\n border-radius: 0;\n outline-color: transparent;\n transition: color ").concat(dt2("tabview.transition.duration"), ", outline-color ").concat(dt2("tabview.transition.duration"), ";\n box-shadow: ").concat(dt2("tabview.nav.button.shadow"), ";\n border: none;\n cursor: pointer;\n user-select: none;\n}\n\n.p-tabview-next-button:focus-visible,\n.p-tabview-prev-button:focus-visible {\n outline: ").concat(dt2("focus.ring.width"), " ").concat(dt2("focus.ring.style"), " ").concat(dt2("focus.ring.color"), ";\n outline-offset: ").concat(dt2("focus.ring.offset"), ";\n}\n\n.p-tabview-next-button:hover,\n.p-tabview-prev-button:hover {\n color: ").concat(dt2("tabview.nav.button.hover.color"), ";\n}\n\n.p-tabview-prev-button {\n left: 0;\n}\n\n.p-tabview-next-button {\n right: 0;\n}\n\n.p-tabview-panels {\n background: ").concat(dt2("tabview.tab.panel.background"), ";\n color: ").concat(dt2("tabview.tab.panel.color"), ";\n padding: 0.875rem 1.125rem 1.125rem 1.125rem;\n}\n\n.p-tabview-ink-bar {\n z-index: 1;\n display: block;\n position: absolute;\n bottom: -1px;\n height: 1px;\n background: ").concat(dt2("tabview.tab.active.border.color"), ";\n transition: 250ms cubic-bezier(0.35, 0, 0.25, 1);\n}\n"); }, "theme"); -var classes$h = { - root: /* @__PURE__ */ __name(function root12(_ref2) { +var classes$g = { + root: /* @__PURE__ */ __name(function root16(_ref2) { var props = _ref2.props; return ["p-tabview p-component", { "p-tabview-scrollable": props.scrollable @@ -117255,12 +145558,12 @@ var classes$h = { }; var TabViewStyle = BaseStyle.extend({ name: "tabview", - theme: theme$h, - classes: classes$h + theme: theme$g, + classes: classes$g }); -var script$1$h = { +var script$1$g = { name: "BaseTabView", - "extends": script$_, + "extends": script$11, props: { activeIndex: { type: Number, @@ -117300,7 +145603,7 @@ var script$1$h = { } }, style: TabViewStyle, - provide: /* @__PURE__ */ __name(function provide24() { + provide: /* @__PURE__ */ __name(function provide27() { return { $pcTabs: void 0, // Backwards compatible to prevent <TabPanel> component from breaking @@ -117309,12 +145612,12 @@ var script$1$h = { }; }, "provide") }; -var script$t = { +var script$r = { name: "TabView", - "extends": script$1$h, + "extends": script$1$g, inheritAttrs: false, emits: ["update:activeIndex", "tab-change", "tab-click"], - data: /* @__PURE__ */ __name(function data9() { + data: /* @__PURE__ */ __name(function data11() { return { id: this.$attrs.id, d_activeIndex: this.activeIndex, @@ -117323,7 +145626,7 @@ var script$t = { }; }, "data"), watch: { - "$attrs.id": /* @__PURE__ */ __name(function $attrsId5(newValue2) { + "$attrs.id": /* @__PURE__ */ __name(function $attrsId6(newValue2) { this.id = newValue2 || UniqueComponentId(); }, "$attrsId"), activeIndex: /* @__PURE__ */ __name(function activeIndex(newValue2) { @@ -117333,13 +145636,13 @@ var script$t = { }); }, "activeIndex") }, - mounted: /* @__PURE__ */ __name(function mounted10() { + mounted: /* @__PURE__ */ __name(function mounted12() { console.warn("Deprecated since v4. Use Tabs component instead."); this.id = this.id || UniqueComponentId(); this.updateInkBar(); this.scrollable && this.updateButtonState(); }, "mounted"), - updated: /* @__PURE__ */ __name(function updated7() { + updated: /* @__PURE__ */ __name(function updated8() { this.updateInkBar(); this.scrollable && this.updateButtonState(); }, "updated"), @@ -117567,44 +145870,44 @@ var script$t = { ripple: Ripple }, components: { - ChevronLeftIcon: script$v, - ChevronRightIcon: script$u + ChevronLeftIcon: script$t, + ChevronRightIcon: script$s } }; -function _typeof$8(o) { +function _typeof$8(o2) { "@babel/helpers - typeof"; - return _typeof$8 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { - return typeof o2; - } : function(o2) { - return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; - }, _typeof$8(o); + return _typeof$8 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { + return typeof o3; + } : function(o3) { + return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; + }, _typeof$8(o2); } __name(_typeof$8, "_typeof$8"); -function ownKeys$a(e2, r) { +function ownKeys$a(e2, r2) { var t2 = Object.keys(e2); if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e2); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e2, r2).enumerable; - })), t2.push.apply(t2, o); + var o2 = Object.getOwnPropertySymbols(e2); + r2 && (o2 = o2.filter(function(r3) { + return Object.getOwnPropertyDescriptor(e2, r3).enumerable; + })), t2.push.apply(t2, o2); } return t2; } __name(ownKeys$a, "ownKeys$a"); function _objectSpread$a(e2) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$a(Object(t2), true).forEach(function(r2) { - _defineProperty$8(e2, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$a(Object(t2)).forEach(function(r2) { - Object.defineProperty(e2, r2, Object.getOwnPropertyDescriptor(t2, r2)); + for (var r2 = 1; r2 < arguments.length; r2++) { + var t2 = null != arguments[r2] ? arguments[r2] : {}; + r2 % 2 ? ownKeys$a(Object(t2), true).forEach(function(r3) { + _defineProperty$8(e2, r3, t2[r3]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$a(Object(t2)).forEach(function(r3) { + Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3)); }); } return e2; } __name(_objectSpread$a, "_objectSpread$a"); -function _defineProperty$8(e2, r, t2) { - return (r = _toPropertyKey$7(r)) in e2 ? Object.defineProperty(e2, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r] = t2, e2; +function _defineProperty$8(e2, r2, t2) { + return (r2 = _toPropertyKey$7(r2)) in e2 ? Object.defineProperty(e2, r2, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r2] = t2, e2; } __name(_defineProperty$8, "_defineProperty$8"); function _toPropertyKey$7(t2) { @@ -117612,23 +145915,23 @@ function _toPropertyKey$7(t2) { return "symbol" == _typeof$8(i2) ? i2 : i2 + ""; } __name(_toPropertyKey$7, "_toPropertyKey$7"); -function _toPrimitive$7(t2, r) { +function _toPrimitive$7(t2, r2) { if ("object" != _typeof$8(t2) || !t2) return t2; var e2 = t2[Symbol.toPrimitive]; if (void 0 !== e2) { - var i2 = e2.call(t2, r || "default"); + var i2 = e2.call(t2, r2 || "default"); if ("object" != _typeof$8(i2)) return i2; throw new TypeError("@@toPrimitive must return a primitive value."); } - return ("string" === r ? String : Number)(t2); + return ("string" === r2 ? String : Number)(t2); } __name(_toPrimitive$7, "_toPrimitive$7"); -var _hoisted_1$Z = ["tabindex", "aria-label"]; -var _hoisted_2$J = ["data-p-active", "data-p-disabled", "data-pc-index"]; +var _hoisted_1$X = ["tabindex", "aria-label"]; +var _hoisted_2$H = ["data-p-active", "data-p-disabled", "data-pc-index"]; var _hoisted_3$n = ["id", "tabindex", "aria-disabled", "aria-selected", "aria-controls", "onClick", "onKeydown"]; var _hoisted_4$h = ["tabindex", "aria-label"]; var _hoisted_5$c = ["id", "aria-labelledby", "data-pc-index", "data-p-active"]; -function render$s(_ctx, _cache, $props, $setup, $data, $options) { +function render$q(_ctx, _cache, $props, $setup, $data, $options) { var _directive_ripple = resolveDirective("ripple"); return openBlock(), createElementBlock("div", mergeProps({ "class": _ctx.cx("root"), @@ -117652,7 +145955,7 @@ function render$s(_ctx, _cache, $props, $setup, $data, $options) { "aria-hidden": "true", "class": _ctx.prevIcon }, _ctx.ptm("prevIcon")), null, 16, ["class"]))]; - })], 16, _hoisted_1$Z)), [[_directive_ripple]]) : createCommentVNode("", true), createBaseVNode("div", mergeProps({ + })], 16, _hoisted_1$X)), [[_directive_ripple]]) : createCommentVNode("", true), createBaseVNode("div", mergeProps({ ref: "content", "class": _ctx.cx("navContent"), onScroll: _cache[1] || (_cache[1] = function() { @@ -117697,7 +146000,7 @@ function render$s(_ctx, _cache, $props, $setup, $data, $options) { ref_for: true }, $options.getTabPT(tab, "headerTitle", index2)), toDisplayString$1(tab.props.header), 17)) : createCommentVNode("", true), tab.children && tab.children.header ? (openBlock(), createBlock(resolveDynamicComponent(tab.children.header), { key: 1 - })) : createCommentVNode("", true)], 16, _hoisted_3$n)), [[_directive_ripple]])], 16, _hoisted_2$J); + })) : createCommentVNode("", true)], 16, _hoisted_3$n)), [[_directive_ripple]])], 16, _hoisted_2$H); }), 128)), createBaseVNode("li", mergeProps({ ref: "inkbar", "class": _ctx.cx("inkbar"), @@ -117742,10 +146045,10 @@ function render$s(_ctx, _cache, $props, $setup, $data, $options) { }), [(openBlock(), createBlock(resolveDynamicComponent(tab)))], 16, _hoisted_5$c)), [[vShow, _ctx.lazy ? true : $options.isTabActive(index2)]]) : createCommentVNode("", true)], 64); }), 128))], 16)], 16); } -__name(render$s, "render$s"); -script$t.render = render$s; -const _hoisted_1$Y = { class: "grid grid-cols-2 gap-2" }; -const _hoisted_2$I = { class: "font-medium" }; +__name(render$q, "render$q"); +script$r.render = render$q; +const _hoisted_1$W = { class: "grid grid-cols-2 gap-2" }; +const _hoisted_2$G = { class: "font-medium" }; const _sfc_main$M = /* @__PURE__ */ defineComponent({ __name: "DeviceInfo", props: { @@ -117770,12 +146073,12 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({ return value4; }, "formatValue"); return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1$Y, [ + return openBlock(), createElementBlock("div", _hoisted_1$W, [ (openBlock(), createElementBlock(Fragment$1, null, renderList(deviceColumns, (col) => { return openBlock(), createElementBlock(Fragment$1, { key: col.field }, [ - createBaseVNode("div", _hoisted_2$I, toDisplayString$1(col.header), 1), + createBaseVNode("div", _hoisted_2$G, toDisplayString$1(col.header), 1), createBaseVNode("div", null, toDisplayString$1(formatValue2(props.device[col.field], col.field)), 1) ], 64); }), 64)) @@ -117783,8 +146086,8 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({ }; } }); -const _hoisted_1$X = { class: "system-stats" }; -const _hoisted_2$H = { class: "mb-6" }; +const _hoisted_1$V = { class: "system-stats" }; +const _hoisted_2$F = { class: "mb-6" }; const _hoisted_3$m = { class: "text-2xl font-semibold mb-4" }; const _hoisted_4$g = { class: "grid grid-cols-2 gap-2" }; const _hoisted_5$b = { class: "font-medium" }; @@ -117816,8 +146119,8 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({ return value4; }, "formatValue"); return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1$X, [ - createBaseVNode("div", _hoisted_2$H, [ + return openBlock(), createElementBlock("div", _hoisted_1$V, [ + createBaseVNode("div", _hoisted_2$F, [ createBaseVNode("h2", _hoisted_3$m, toDisplayString$1(_ctx.$t("g.systemInfo")), 1), createBaseVNode("div", _hoisted_4$g, [ (openBlock(), createElementBlock(Fragment$1, null, renderList(systemColumns, (col) => { @@ -117830,13 +146133,13 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({ }), 64)) ]) ]), - createVNode(unref(script$O)), + createVNode(unref(script$R)), createBaseVNode("div", null, [ createBaseVNode("h2", _hoisted_6$8, toDisplayString$1(_ctx.$t("g.devices")), 1), - props.stats.devices.length > 1 ? (openBlock(), createBlock(unref(script$t), { key: 0 }, { + props.stats.devices.length > 1 ? (openBlock(), createBlock(unref(script$r), { key: 0 }, { default: withCtx(() => [ (openBlock(true), createElementBlock(Fragment$1, null, renderList(props.stats.devices, (device) => { - return openBlock(), createBlock(unref(script$w), { + return openBlock(), createBlock(unref(script$u), { key: device.index, header: device.name }, { @@ -117958,7 +146261,7 @@ const useSystemStatsStore = /* @__PURE__ */ defineStore("systemStats", () => { }; }); const useAboutPanelStore = /* @__PURE__ */ defineStore("aboutPanel", () => { - const frontendVersion = "1.6.18"; + const frontendVersion = "1.7.14"; const extensionStore = useExtensionStore(); const systemStatsStore = useSystemStatsStore(); const coreVersion = computed( @@ -117992,7 +146295,7 @@ const useAboutPanelStore = /* @__PURE__ */ defineStore("aboutPanel", () => { badges: allBadges }; }); -const _hoisted_1$W = { class: "flex flex-col h-full w-full gap-2" }; +const _hoisted_1$U = { class: "flex flex-col h-full w-full gap-2" }; const _sfc_main$K = /* @__PURE__ */ defineComponent({ __name: "PanelTemplate", props: { @@ -118002,14 +146305,14 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({ setup(__props) { const props = __props; return (_ctx, _cache) => { - return openBlock(), createBlock(unref(script$w), { + return openBlock(), createBlock(unref(script$u), { value: props.value, class: normalizeClass(["h-full w-full", props.class]) }, { default: withCtx(() => [ - createBaseVNode("div", _hoisted_1$W, [ + createBaseVNode("div", _hoisted_1$U, [ renderSlot(_ctx.$slots, "header"), - createVNode(unref(script$N), { class: "flex-grow h-0 pr-2" }, { + createVNode(unref(script$Q), { class: "flex-grow h-0 pr-2" }, { default: withCtx(() => [ renderSlot(_ctx.$slots, "default") ]), @@ -118023,8 +146326,8 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({ }; } }); -const _hoisted_1$V = { class: "text-2xl font-bold mb-2" }; -const _hoisted_2$G = { class: "space-y-2" }; +const _hoisted_1$T = { class: "text-2xl font-bold mb-2" }; +const _hoisted_2$E = { class: "space-y-2" }; const _hoisted_3$l = ["href", "title"]; const _sfc_main$J = /* @__PURE__ */ defineComponent({ __name: "AboutPanel", @@ -118042,8 +146345,8 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({ class: "about-container" }, { default: withCtx(() => [ - createBaseVNode("h2", _hoisted_1$V, toDisplayString$1(_ctx.$t("g.about")), 1), - createBaseVNode("div", _hoisted_2$G, [ + createBaseVNode("h2", _hoisted_1$T, toDisplayString$1(_ctx.$t("g.about")), 1), + createBaseVNode("div", _hoisted_2$E, [ (openBlock(true), createElementBlock(Fragment$1, null, renderList(unref(aboutPanelStore).badges, (badge) => { return openBlock(), createElementBlock("a", { key: badge.url, @@ -118053,7 +146356,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({ class: "about-badge inline-flex items-center no-underline", title: badge.url }, [ - createVNode(unref(script$x), { class: "mr-2" }, { + createVNode(unref(script$v), { class: "mr-2" }, { icon: withCtx(() => [ createBaseVNode("i", { class: normalizeClass([badge.icon, "mr-2 text-xl"]) @@ -118067,7 +146370,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({ ], 8, _hoisted_3$l); }), 128)) ]), - createVNode(unref(script$O)), + createVNode(unref(script$R)), unref(systemStatsStore).systemStats ? (openBlock(), createBlock(_sfc_main$L, { key: 0, stats: unref(systemStatsStore).systemStats @@ -118078,15 +146381,15 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({ }; } }); -var script$s = { +var script$q = { name: "ExclamationTriangleIcon", - "extends": script$X + "extends": script$_ }; -var _hoisted_1$U = /* @__PURE__ */ createBaseVNode("path", { +var _hoisted_1$S = /* @__PURE__ */ createBaseVNode("path", { d: "M13.4018 13.1893H0.598161C0.49329 13.189 0.390283 13.1615 0.299143 13.1097C0.208003 13.0578 0.131826 12.9832 0.0780112 12.8932C0.0268539 12.8015 0 12.6982 0 12.5931C0 12.4881 0.0268539 12.3848 0.0780112 12.293L6.47985 1.08982C6.53679 1.00399 6.61408 0.933574 6.70484 0.884867C6.7956 0.836159 6.897 0.810669 7 0.810669C7.103 0.810669 7.2044 0.836159 7.29516 0.884867C7.38592 0.933574 7.46321 1.00399 7.52015 1.08982L13.922 12.293C13.9731 12.3848 14 12.4881 14 12.5931C14 12.6982 13.9731 12.8015 13.922 12.8932C13.8682 12.9832 13.792 13.0578 13.7009 13.1097C13.6097 13.1615 13.5067 13.189 13.4018 13.1893ZM1.63046 11.989H12.3695L7 2.59425L1.63046 11.989Z", fill: "currentColor" }, null, -1); -var _hoisted_2$F = /* @__PURE__ */ createBaseVNode("path", { +var _hoisted_2$D = /* @__PURE__ */ createBaseVNode("path", { d: "M6.99996 8.78801C6.84143 8.78594 6.68997 8.72204 6.57787 8.60993C6.46576 8.49782 6.40186 8.34637 6.39979 8.18784V5.38703C6.39979 5.22786 6.46302 5.0752 6.57557 4.96265C6.68813 4.85009 6.84078 4.78686 6.99996 4.78686C7.15914 4.78686 7.31179 4.85009 7.42435 4.96265C7.5369 5.0752 7.60013 5.22786 7.60013 5.38703V8.18784C7.59806 8.34637 7.53416 8.49782 7.42205 8.60993C7.30995 8.72204 7.15849 8.78594 6.99996 8.78801Z", fill: "currentColor" }, null, -1); @@ -118094,8 +146397,8 @@ var _hoisted_3$k = /* @__PURE__ */ createBaseVNode("path", { d: "M6.99996 11.1887C6.84143 11.1866 6.68997 11.1227 6.57787 11.0106C6.46576 10.8985 6.40186 10.7471 6.39979 10.5885V10.1884C6.39979 10.0292 6.46302 9.87658 6.57557 9.76403C6.68813 9.65147 6.84078 9.58824 6.99996 9.58824C7.15914 9.58824 7.31179 9.65147 7.42435 9.76403C7.5369 9.87658 7.60013 10.0292 7.60013 10.1884V10.5885C7.59806 10.7471 7.53416 10.8985 7.42205 11.0106C7.30995 11.1227 7.15849 11.1866 6.99996 11.1887Z", fill: "currentColor" }, null, -1); -var _hoisted_4$f = [_hoisted_1$U, _hoisted_2$F, _hoisted_3$k]; -function render$r(_ctx, _cache, $props, $setup, $data, $options) { +var _hoisted_4$f = [_hoisted_1$S, _hoisted_2$D, _hoisted_3$k]; +function render$p(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ width: "14", height: "14", @@ -118104,36 +146407,36 @@ function render$r(_ctx, _cache, $props, $setup, $data, $options) { xmlns: "http://www.w3.org/2000/svg" }, _ctx.pti()), _hoisted_4$f, 16); } -__name(render$r, "render$r"); -script$s.render = render$r; -var script$r = { +__name(render$p, "render$p"); +script$q.render = render$p; +var script$p = { name: "InfoCircleIcon", - "extends": script$X + "extends": script$_ }; -var _hoisted_1$T = /* @__PURE__ */ createBaseVNode("path", { +var _hoisted_1$R = /* @__PURE__ */ createBaseVNode("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M3.11101 12.8203C4.26215 13.5895 5.61553 14 7 14C8.85652 14 10.637 13.2625 11.9497 11.9497C13.2625 10.637 14 8.85652 14 7C14 5.61553 13.5895 4.26215 12.8203 3.11101C12.0511 1.95987 10.9579 1.06266 9.67879 0.532846C8.3997 0.00303296 6.99224 -0.13559 5.63437 0.134506C4.2765 0.404603 3.02922 1.07129 2.05026 2.05026C1.07129 3.02922 0.404603 4.2765 0.134506 5.63437C-0.13559 6.99224 0.00303296 8.3997 0.532846 9.67879C1.06266 10.9579 1.95987 12.0511 3.11101 12.8203ZM3.75918 2.14976C4.71846 1.50879 5.84628 1.16667 7 1.16667C8.5471 1.16667 10.0308 1.78125 11.1248 2.87521C12.2188 3.96918 12.8333 5.45291 12.8333 7C12.8333 8.15373 12.4912 9.28154 11.8502 10.2408C11.2093 11.2001 10.2982 11.9478 9.23232 12.3893C8.16642 12.8308 6.99353 12.9463 5.86198 12.7212C4.73042 12.4962 3.69102 11.9406 2.87521 11.1248C2.05941 10.309 1.50384 9.26958 1.27876 8.13803C1.05367 7.00647 1.16919 5.83358 1.61071 4.76768C2.05222 3.70178 2.79989 2.79074 3.75918 2.14976ZM7.00002 4.8611C6.84594 4.85908 6.69873 4.79698 6.58977 4.68801C6.48081 4.57905 6.4187 4.43185 6.41669 4.27776V3.88888C6.41669 3.73417 6.47815 3.58579 6.58754 3.4764C6.69694 3.367 6.84531 3.30554 7.00002 3.30554C7.15473 3.30554 7.3031 3.367 7.4125 3.4764C7.52189 3.58579 7.58335 3.73417 7.58335 3.88888V4.27776C7.58134 4.43185 7.51923 4.57905 7.41027 4.68801C7.30131 4.79698 7.1541 4.85908 7.00002 4.8611ZM7.00002 10.6945C6.84594 10.6925 6.69873 10.6304 6.58977 10.5214C6.48081 10.4124 6.4187 10.2652 6.41669 10.1111V6.22225C6.41669 6.06754 6.47815 5.91917 6.58754 5.80977C6.69694 5.70037 6.84531 5.63892 7.00002 5.63892C7.15473 5.63892 7.3031 5.70037 7.4125 5.80977C7.52189 5.91917 7.58335 6.06754 7.58335 6.22225V10.1111C7.58134 10.2652 7.51923 10.4124 7.41027 10.5214C7.30131 10.6304 7.1541 10.6925 7.00002 10.6945Z", fill: "currentColor" }, null, -1); -var _hoisted_2$E = [_hoisted_1$T]; -function render$q(_ctx, _cache, $props, $setup, $data, $options) { +var _hoisted_2$C = [_hoisted_1$R]; +function render$o(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" - }, _ctx.pti()), _hoisted_2$E, 16); + }, _ctx.pti()), _hoisted_2$C, 16); } -__name(render$q, "render$q"); -script$r.render = render$q; -var theme$g = /* @__PURE__ */ __name(function theme23(_ref) { +__name(render$o, "render$o"); +script$p.render = render$o; +var theme$f = /* @__PURE__ */ __name(function theme26(_ref) { var dt2 = _ref.dt; return "\n.p-message {\n border-radius: ".concat(dt2("message.border.radius"), ";\n outline-width: ").concat(dt2("message.border.width"), ";\n outline-style: solid;\n}\n\n.p-message-content {\n display: flex;\n align-items: center;\n padding: ").concat(dt2("message.content.padding"), ";\n gap: ").concat(dt2("message.content.gap"), ";\n height: 100%;\n}\n\n.p-message-icon {\n flex-shrink: 0;\n}\n\n.p-message-close-button {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n margin: 0 0 0 auto;\n overflow: hidden;\n position: relative;\n width: ").concat(dt2("message.close.button.width"), ";\n height: ").concat(dt2("message.close.button.height"), ";\n border-radius: ").concat(dt2("message.close.button.border.radius"), ";\n background: transparent;\n transition: background ").concat(dt2("message.transition.duration"), ", color ").concat(dt2("message.transition.duration"), ", outline-color ").concat(dt2("message.transition.duration"), ", box-shadow ").concat(dt2("message.transition.duration"), ", opacity 0.3s;\n outline-color: transparent;\n color: inherit;\n padding: 0;\n border: none;\n cursor: pointer;\n user-select: none;\n}\n\n.p-message-close-icon {\n font-size: ").concat(dt2("message.close.icon.size"), ";\n width: ").concat(dt2("message.close.icon.size"), ";\n height: ").concat(dt2("message.close.icon.size"), ";\n}\n\n.p-message-close-button:focus-visible {\n outline-width: ").concat(dt2("message.close.button.focus.ring.width"), ";\n outline-style: ").concat(dt2("message.close.button.focus.ring.style"), ";\n outline-offset: ").concat(dt2("message.close.button.focus.ring.offset"), ";\n}\n\n.p-message-info {\n background: ").concat(dt2("message.info.background"), ";\n outline-color: ").concat(dt2("message.info.border.color"), ";\n color: ").concat(dt2("message.info.color"), ";\n box-shadow: ").concat(dt2("message.info.shadow"), ";\n}\n\n.p-message-info .p-message-close-button:focus-visible {\n outline-color: ").concat(dt2("message.info.close.button.focus.ring.color"), ";\n box-shadow: ").concat(dt2("message.info.close.button.focus.ring.shadow"), ";\n}\n\n.p-message-info .p-message-close-button:hover {\n background: ").concat(dt2("message.info.close.button.hover.background"), ";\n}\n\n.p-message-success {\n background: ").concat(dt2("message.success.background"), ";\n outline-color: ").concat(dt2("message.success.border.color"), ";\n color: ").concat(dt2("message.success.color"), ";\n box-shadow: ").concat(dt2("message.success.shadow"), ";\n}\n\n.p-message-success .p-message-close-button:focus-visible {\n outline-color: ").concat(dt2("message.success.close.button.focus.ring.color"), ";\n box-shadow: ").concat(dt2("message.success.close.button.focus.ring.shadow"), ";\n}\n\n.p-message-success .p-message-close-button:hover {\n background: ").concat(dt2("message.success.close.button.hover.background"), ";\n}\n\n.p-message-warn {\n background: ").concat(dt2("message.warn.background"), ";\n outline-color: ").concat(dt2("message.warn.border.color"), ";\n color: ").concat(dt2("message.warn.color"), ";\n box-shadow: ").concat(dt2("message.warn.shadow"), ";\n}\n\n.p-message-warn .p-message-close-button:focus-visible {\n outline-color: ").concat(dt2("message.warn.close.button.focus.ring.color"), ";\n box-shadow: ").concat(dt2("message.warn.close.button.focus.ring.shadow"), ";\n}\n\n.p-message-warn .p-message-close-button:hover {\n background: ").concat(dt2("message.warn.close.button.hover.background"), ";\n}\n\n.p-message-error {\n background: ").concat(dt2("message.error.background"), ";\n outline-color: ").concat(dt2("message.error.border.color"), ";\n color: ").concat(dt2("message.error.color"), ";\n box-shadow: ").concat(dt2("message.error.shadow"), ";\n}\n\n.p-message-error .p-message-close-button:focus-visible {\n outline-color: ").concat(dt2("message.error.close.button.focus.ring.color"), ";\n box-shadow: ").concat(dt2("message.error.close.button.focus.ring.shadow"), ";\n}\n\n.p-message-error .p-message-close-button:hover {\n background: ").concat(dt2("message.error.close.button.hover.background"), ";\n}\n\n.p-message-secondary {\n background: ").concat(dt2("message.secondary.background"), ";\n outline-color: ").concat(dt2("message.secondary.border.color"), ";\n color: ").concat(dt2("message.secondary.color"), ";\n box-shadow: ").concat(dt2("message.secondary.shadow"), ";\n}\n\n.p-message-secondary .p-message-close-button:focus-visible {\n outline-color: ").concat(dt2("message.secondary.close.button.focus.ring.color"), ";\n box-shadow: ").concat(dt2("message.secondary.close.button.focus.ring.shadow"), ";\n}\n\n.p-message-secondary .p-message-close-button:hover {\n background: ").concat(dt2("message.secondary.close.button.hover.background"), ";\n}\n\n.p-message-contrast {\n background: ").concat(dt2("message.contrast.background"), ";\n outline-color: ").concat(dt2("message.contrast.border.color"), ";\n color: ").concat(dt2("message.contrast.color"), ";\n box-shadow: ").concat(dt2("message.contrast.shadow"), ";\n}\n\n.p-message-contrast .p-message-close-button:focus-visible {\n outline-color: ").concat(dt2("message.contrast.close.button.focus.ring.color"), ";\n box-shadow: ").concat(dt2("message.contrast.close.button.focus.ring.shadow"), ";\n}\n\n.p-message-contrast .p-message-close-button:hover {\n background: ").concat(dt2("message.contrast.close.button.hover.background"), ";\n}\n\n.p-message-text {\n font-size: ").concat(dt2("message.text.font.size"), ";\n font-weight: ").concat(dt2("message.text.font.weight"), ";\n}\n\n.p-message-icon {\n font-size: ").concat(dt2("message.icon.size"), ";\n width: ").concat(dt2("message.icon.size"), ";\n height: ").concat(dt2("message.icon.size"), ";\n}\n\n.p-message-enter-from {\n opacity: 0;\n}\n\n.p-message-enter-active {\n transition: opacity 0.3s;\n}\n\n.p-message.p-message-leave-from {\n max-height: 1000px;\n}\n\n.p-message.p-message-leave-to {\n max-height: 0;\n opacity: 0;\n margin: 0;\n}\n\n.p-message-leave-active {\n overflow: hidden;\n transition: max-height 0.45s cubic-bezier(0, 1, 0, 1), opacity 0.3s, margin 0.3s;\n}\n\n.p-message-leave-active .p-message-close-button {\n opacity: 0;\n}\n"); }, "theme"); -var classes$g = { - root: /* @__PURE__ */ __name(function root13(_ref2) { +var classes$f = { + root: /* @__PURE__ */ __name(function root17(_ref2) { var props = _ref2.props; return "p-message p-component p-message-" + props.severity; }, "root"), @@ -118145,12 +146448,12 @@ var classes$g = { }; var MessageStyle = BaseStyle.extend({ name: "message", - theme: theme$g, - classes: classes$g + theme: theme$f, + classes: classes$f }); -var script$1$g = { +var script$1$f = { name: "BaseMessage", - "extends": script$_, + "extends": script$11, props: { severity: { type: String, @@ -118178,25 +146481,25 @@ var script$1$g = { } }, style: MessageStyle, - provide: /* @__PURE__ */ __name(function provide25() { + provide: /* @__PURE__ */ __name(function provide28() { return { $pcMessage: this, $parentInstance: this }; }, "provide") }; -var script$q = { +var script$o = { name: "Message", - "extends": script$1$g, + "extends": script$1$f, inheritAttrs: false, emits: ["close", "life-end"], timeout: null, - data: /* @__PURE__ */ __name(function data10() { + data: /* @__PURE__ */ __name(function data12() { return { visible: true }; }, "data"), - mounted: /* @__PURE__ */ __name(function mounted11() { + mounted: /* @__PURE__ */ __name(function mounted13() { var _this = this; if (this.life) { setTimeout(function() { @@ -118214,10 +146517,10 @@ var script$q = { computed: { iconComponent: /* @__PURE__ */ __name(function iconComponent() { return { - info: script$r, - success: script$K, - warn: script$s, - error: script$z + info: script$p, + success: script$J, + warn: script$q, + error: script$x }[this.severity]; }, "iconComponent"), closeAriaLabel: /* @__PURE__ */ __name(function closeAriaLabel2() { @@ -118228,47 +146531,47 @@ var script$q = { ripple: Ripple }, components: { - TimesIcon: script$W, - InfoCircleIcon: script$r, - CheckIcon: script$K, - ExclamationTriangleIcon: script$s, - TimesCircleIcon: script$z + TimesIcon: script$Z, + InfoCircleIcon: script$p, + CheckIcon: script$J, + ExclamationTriangleIcon: script$q, + TimesCircleIcon: script$x } }; -function _typeof$7(o) { +function _typeof$7(o2) { "@babel/helpers - typeof"; - return _typeof$7 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { - return typeof o2; - } : function(o2) { - return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; - }, _typeof$7(o); + return _typeof$7 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { + return typeof o3; + } : function(o3) { + return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; + }, _typeof$7(o2); } __name(_typeof$7, "_typeof$7"); -function ownKeys$9(e2, r) { +function ownKeys$9(e2, r2) { var t2 = Object.keys(e2); if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e2); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e2, r2).enumerable; - })), t2.push.apply(t2, o); + var o2 = Object.getOwnPropertySymbols(e2); + r2 && (o2 = o2.filter(function(r3) { + return Object.getOwnPropertyDescriptor(e2, r3).enumerable; + })), t2.push.apply(t2, o2); } return t2; } __name(ownKeys$9, "ownKeys$9"); function _objectSpread$9(e2) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$9(Object(t2), true).forEach(function(r2) { - _defineProperty$7(e2, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$9(Object(t2)).forEach(function(r2) { - Object.defineProperty(e2, r2, Object.getOwnPropertyDescriptor(t2, r2)); + for (var r2 = 1; r2 < arguments.length; r2++) { + var t2 = null != arguments[r2] ? arguments[r2] : {}; + r2 % 2 ? ownKeys$9(Object(t2), true).forEach(function(r3) { + _defineProperty$7(e2, r3, t2[r3]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$9(Object(t2)).forEach(function(r3) { + Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3)); }); } return e2; } __name(_objectSpread$9, "_objectSpread$9"); -function _defineProperty$7(e2, r, t2) { - return (r = _toPropertyKey$6(r)) in e2 ? Object.defineProperty(e2, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r] = t2, e2; +function _defineProperty$7(e2, r2, t2) { + return (r2 = _toPropertyKey$6(r2)) in e2 ? Object.defineProperty(e2, r2, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r2] = t2, e2; } __name(_defineProperty$7, "_defineProperty$7"); function _toPropertyKey$6(t2) { @@ -118276,19 +146579,19 @@ function _toPropertyKey$6(t2) { return "symbol" == _typeof$7(i2) ? i2 : i2 + ""; } __name(_toPropertyKey$6, "_toPropertyKey$6"); -function _toPrimitive$6(t2, r) { +function _toPrimitive$6(t2, r2) { if ("object" != _typeof$7(t2) || !t2) return t2; var e2 = t2[Symbol.toPrimitive]; if (void 0 !== e2) { - var i2 = e2.call(t2, r || "default"); + var i2 = e2.call(t2, r2 || "default"); if ("object" != _typeof$7(i2)) return i2; throw new TypeError("@@toPrimitive must return a primitive value."); } - return ("string" === r ? String : Number)(t2); + return ("string" === r2 ? String : Number)(t2); } __name(_toPrimitive$6, "_toPrimitive$6"); -var _hoisted_1$S = ["aria-label"]; -function render$p(_ctx, _cache, $props, $setup, $data, $options) { +var _hoisted_1$Q = ["aria-label"]; +function render$n(_ctx, _cache, $props, $setup, $data, $options) { var _component_TimesIcon = resolveComponent("TimesIcon"); var _directive_ripple = resolveDirective("ripple"); return openBlock(), createBlock(Transition, mergeProps({ @@ -118332,40 +146635,40 @@ function render$p(_ctx, _cache, $props, $setup, $data, $options) { key: 1, "class": [_ctx.cx("closeIcon"), _ctx.closeIcon] }, _ctx.ptm("closeIcon")), null, 16, ["class"]))]; - })], 16, _hoisted_1$S)), [[_directive_ripple]]) : createCommentVNode("", true)], 16))], 16), [[vShow, $data.visible]])]; + })], 16, _hoisted_1$Q)), [[_directive_ripple]]) : createCommentVNode("", true)], 16))], 16), [[vShow, $data.visible]])]; }), _: 3 }, 16); } -__name(render$p, "render$p"); -script$q.render = render$p; -var script$p = { +__name(render$n, "render$n"); +script$o.render = render$n; +var script$n = { name: "ChevronDownIcon", - "extends": script$X + "extends": script$_ }; -var _hoisted_1$R = /* @__PURE__ */ createBaseVNode("path", { +var _hoisted_1$P = /* @__PURE__ */ createBaseVNode("path", { d: "M7.01744 10.398C6.91269 10.3985 6.8089 10.378 6.71215 10.3379C6.61541 10.2977 6.52766 10.2386 6.45405 10.1641L1.13907 4.84913C1.03306 4.69404 0.985221 4.5065 1.00399 4.31958C1.02276 4.13266 1.10693 3.95838 1.24166 3.82747C1.37639 3.69655 1.55301 3.61742 1.74039 3.60402C1.92777 3.59062 2.11386 3.64382 2.26584 3.75424L7.01744 8.47394L11.769 3.75424C11.9189 3.65709 12.097 3.61306 12.2748 3.62921C12.4527 3.64535 12.6199 3.72073 12.7498 3.84328C12.8797 3.96582 12.9647 4.12842 12.9912 4.30502C13.0177 4.48162 12.9841 4.662 12.8958 4.81724L7.58083 10.1322C7.50996 10.2125 7.42344 10.2775 7.32656 10.3232C7.22968 10.3689 7.12449 10.3944 7.01744 10.398Z", fill: "currentColor" }, null, -1); -var _hoisted_2$D = [_hoisted_1$R]; -function render$o(_ctx, _cache, $props, $setup, $data, $options) { +var _hoisted_2$B = [_hoisted_1$P]; +function render$m(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" - }, _ctx.pti()), _hoisted_2$D, 16); + }, _ctx.pti()), _hoisted_2$B, 16); } -__name(render$o, "render$o"); -script$p.render = render$o; +__name(render$m, "render$m"); +script$n.render = render$m; var OverlayEventBus = EventBus(); -var theme$f = /* @__PURE__ */ __name(function theme24(_ref) { +var theme$e = /* @__PURE__ */ __name(function theme27(_ref) { var dt2 = _ref.dt; return "\n.p-select {\n display: inline-flex;\n cursor: pointer;\n position: relative;\n user-select: none;\n background: ".concat(dt2("select.background"), ";\n border: 1px solid ").concat(dt2("select.border.color"), ";\n transition: background ").concat(dt2("select.transition.duration"), ", color ").concat(dt2("select.transition.duration"), ", border-color ").concat(dt2("select.transition.duration"), ",\n outline-color ").concat(dt2("select.transition.duration"), ", box-shadow ").concat(dt2("select.transition.duration"), ";\n border-radius: ").concat(dt2("select.border.radius"), ";\n outline-color: transparent;\n box-shadow: ").concat(dt2("select.shadow"), ";\n}\n\n.p-select:not(.p-disabled):hover {\n border-color: ").concat(dt2("select.hover.border.color"), ";\n}\n\n.p-select:not(.p-disabled).p-focus {\n border-color: ").concat(dt2("select.focus.border.color"), ";\n box-shadow: ").concat(dt2("select.focus.ring.shadow"), ";\n outline: ").concat(dt2("select.focus.ring.width"), " ").concat(dt2("select.focus.ring.style"), " ").concat(dt2("select.focus.ring.color"), ";\n outline-offset: ").concat(dt2("select.focus.ring.offset"), ";\n}\n\n.p-select.p-variant-filled {\n background: ").concat(dt2("select.filled.background"), ";\n}\n\n.p-select.p-variant-filled.p-focus {\n background: ").concat(dt2("select.filled.focus.background"), ";\n}\n\n.p-select.p-invalid {\n border-color: ").concat(dt2("select.invalid.border.color"), ";\n}\n\n.p-select.p-disabled {\n opacity: 1;\n background: ").concat(dt2("select.disabled.background"), ";\n}\n\n.p-select-clear-icon {\n position: absolute;\n top: 50%;\n margin-top: -0.5rem;\n color: ").concat(dt2("select.clear.icon.color"), ";\n right: ").concat(dt2("select.dropdown.width"), ";\n}\n\n.p-select-dropdown {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n background: transparent;\n color: ").concat(dt2("select.dropdown.color"), ";\n width: ").concat(dt2("select.dropdown.width"), ";\n border-top-right-radius: ").concat(dt2("select.border.radius"), ";\n border-bottom-right-radius: ").concat(dt2("select.border.radius"), ";\n}\n\n.p-select-label {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n flex: 1 1 auto;\n width: 1%;\n padding: ").concat(dt2("select.padding.y"), " ").concat(dt2("select.padding.x"), ";\n text-overflow: ellipsis;\n cursor: pointer;\n color: ").concat(dt2("select.color"), ";\n background: transparent;\n border: 0 none;\n outline: 0 none;\n}\n\n.p-select-label.p-placeholder {\n color: ").concat(dt2("select.placeholder.color"), ";\n}\n\n.p-select:has(.p-select-clear-icon) .p-select-label {\n padding-right: calc(1rem + ").concat(dt2("select.padding.x"), ");\n}\n\n.p-select.p-disabled .p-select-label {\n color: ").concat(dt2("select.disabled.color"), ";\n}\n\n.p-select-label-empty {\n overflow: hidden;\n opacity: 0;\n}\n\ninput.p-select-label {\n cursor: default;\n}\n\n.p-select .p-select-overlay {\n min-width: 100%;\n}\n\n.p-select-overlay {\n position: absolute;\n top: 0;\n left: 0;\n background: ").concat(dt2("select.overlay.background"), ";\n color: ").concat(dt2("select.overlay.color"), ";\n border: 1px solid ").concat(dt2("select.overlay.border.color"), ";\n border-radius: ").concat(dt2("select.overlay.border.radius"), ";\n box-shadow: ").concat(dt2("select.overlay.shadow"), ";\n}\n\n.p-select-header {\n padding: ").concat(dt2("select.list.header.padding"), ";\n}\n\n.p-select-filter {\n width: 100%;\n}\n\n.p-select-list-container {\n overflow: auto;\n}\n\n.p-select-option-group {\n cursor: auto;\n margin: 0;\n padding: ").concat(dt2("select.option.group.padding"), ";\n background: ").concat(dt2("select.option.group.background"), ";\n color: ").concat(dt2("select.option.group.color"), ";\n font-weight: ").concat(dt2("select.option.group.font.weight"), ";\n}\n\n.p-select-list {\n margin: 0;\n padding: 0;\n list-style-type: none;\n padding: ").concat(dt2("select.list.padding"), ";\n gap: ").concat(dt2("select.list.gap"), ";\n display: flex;\n flex-direction: column;\n}\n\n.p-select-option {\n cursor: pointer;\n font-weight: normal;\n white-space: nowrap;\n position: relative;\n overflow: hidden;\n display: flex;\n align-items: center;\n padding: ").concat(dt2("select.option.padding"), ";\n border: 0 none;\n color: ").concat(dt2("select.option.color"), ";\n background: transparent;\n transition: background ").concat(dt2("select.transition.duration"), ", color ").concat(dt2("select.transition.duration"), ", border-color ").concat(dt2("select.transition.duration"), ",\n box-shadow ").concat(dt2("select.transition.duration"), ", outline-color ").concat(dt2("select.transition.duration"), ";\n border-radius: ").concat(dt2("select.option.border.radius"), ";\n}\n\n.p-select-option:not(.p-select-option-selected):not(.p-disabled).p-focus {\n background: ").concat(dt2("select.option.focus.background"), ";\n color: ").concat(dt2("select.option.focus.color"), ";\n}\n\n.p-select-option.p-select-option-selected {\n background: ").concat(dt2("select.option.selected.background"), ";\n color: ").concat(dt2("select.option.selected.color"), ";\n}\n\n.p-select-option.p-select-option-selected.p-focus {\n background: ").concat(dt2("select.option.selected.focus.background"), ";\n color: ").concat(dt2("select.option.selected.focus.color"), ";\n}\n\n.p-select-option-check-icon {\n position: relative;\n margin-inline-start: ").concat(dt2("select.checkmark.gutter.start"), ";\n margin-inline-end: ").concat(dt2("select.checkmark.gutter.end"), ";\n color: ").concat(dt2("select.checkmark.color"), ";\n}\n\n.p-select-empty-message {\n padding: ").concat(dt2("select.empty.message.padding"), ";\n}\n\n.p-select-fluid {\n display: flex;\n}\n"); }, "theme"); -var classes$f = { - root: /* @__PURE__ */ __name(function root14(_ref2) { +var classes$e = { + root: /* @__PURE__ */ __name(function root18(_ref2) { var instance = _ref2.instance, props = _ref2.props, state = _ref2.state; return ["p-select p-component p-inputwrapper", { "p-disabled": props.disabled, @@ -118411,12 +146714,12 @@ var classes$f = { }; var SelectStyle = BaseStyle.extend({ name: "select", - theme: theme$f, - classes: classes$f + theme: theme$e, + classes: classes$e }); -var script$1$f = { +var script$1$e = { name: "BaseSelect", - "extends": script$_, + "extends": script$11, props: { modelValue: null, options: Array, @@ -118600,77 +146903,77 @@ var script$1$f = { } }, style: SelectStyle, - provide: /* @__PURE__ */ __name(function provide26() { + provide: /* @__PURE__ */ __name(function provide29() { return { $pcSelect: this, $parentInstance: this }; }, "provide") }; -function _typeof$6(o) { +function _typeof$6(o2) { "@babel/helpers - typeof"; - return _typeof$6 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { - return typeof o2; - } : function(o2) { - return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; - }, _typeof$6(o); + return _typeof$6 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { + return typeof o3; + } : function(o3) { + return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; + }, _typeof$6(o2); } __name(_typeof$6, "_typeof$6"); -function _toConsumableArray$9(r) { - return _arrayWithoutHoles$9(r) || _iterableToArray$9(r) || _unsupportedIterableToArray$b(r) || _nonIterableSpread$9(); +function _toConsumableArray$8(r2) { + return _arrayWithoutHoles$8(r2) || _iterableToArray$8(r2) || _unsupportedIterableToArray$a(r2) || _nonIterableSpread$8(); } -__name(_toConsumableArray$9, "_toConsumableArray$9"); -function _nonIterableSpread$9() { +__name(_toConsumableArray$8, "_toConsumableArray$8"); +function _nonIterableSpread$8() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -__name(_nonIterableSpread$9, "_nonIterableSpread$9"); -function _unsupportedIterableToArray$b(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray$b(r, a); - var t2 = {}.toString.call(r).slice(8, -1); - return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$b(r, a) : void 0; +__name(_nonIterableSpread$8, "_nonIterableSpread$8"); +function _unsupportedIterableToArray$a(r2, a2) { + if (r2) { + if ("string" == typeof r2) return _arrayLikeToArray$a(r2, a2); + var t2 = {}.toString.call(r2).slice(8, -1); + return "Object" === t2 && r2.constructor && (t2 = r2.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r2) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$a(r2, a2) : void 0; } } -__name(_unsupportedIterableToArray$b, "_unsupportedIterableToArray$b"); -function _iterableToArray$9(r) { - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); +__name(_unsupportedIterableToArray$a, "_unsupportedIterableToArray$a"); +function _iterableToArray$8(r2) { + if ("undefined" != typeof Symbol && null != r2[Symbol.iterator] || null != r2["@@iterator"]) return Array.from(r2); } -__name(_iterableToArray$9, "_iterableToArray$9"); -function _arrayWithoutHoles$9(r) { - if (Array.isArray(r)) return _arrayLikeToArray$b(r); +__name(_iterableToArray$8, "_iterableToArray$8"); +function _arrayWithoutHoles$8(r2) { + if (Array.isArray(r2)) return _arrayLikeToArray$a(r2); } -__name(_arrayWithoutHoles$9, "_arrayWithoutHoles$9"); -function _arrayLikeToArray$b(r, a) { - (null == a || a > r.length) && (a = r.length); - for (var e2 = 0, n = Array(a); e2 < a; e2++) n[e2] = r[e2]; - return n; +__name(_arrayWithoutHoles$8, "_arrayWithoutHoles$8"); +function _arrayLikeToArray$a(r2, a2) { + (null == a2 || a2 > r2.length) && (a2 = r2.length); + for (var e2 = 0, n2 = Array(a2); e2 < a2; e2++) n2[e2] = r2[e2]; + return n2; } -__name(_arrayLikeToArray$b, "_arrayLikeToArray$b"); -function ownKeys$8(e2, r) { +__name(_arrayLikeToArray$a, "_arrayLikeToArray$a"); +function ownKeys$8(e2, r2) { var t2 = Object.keys(e2); if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e2); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e2, r2).enumerable; - })), t2.push.apply(t2, o); + var o2 = Object.getOwnPropertySymbols(e2); + r2 && (o2 = o2.filter(function(r3) { + return Object.getOwnPropertyDescriptor(e2, r3).enumerable; + })), t2.push.apply(t2, o2); } return t2; } __name(ownKeys$8, "ownKeys$8"); function _objectSpread$8(e2) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$8(Object(t2), true).forEach(function(r2) { - _defineProperty$6(e2, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$8(Object(t2)).forEach(function(r2) { - Object.defineProperty(e2, r2, Object.getOwnPropertyDescriptor(t2, r2)); + for (var r2 = 1; r2 < arguments.length; r2++) { + var t2 = null != arguments[r2] ? arguments[r2] : {}; + r2 % 2 ? ownKeys$8(Object(t2), true).forEach(function(r3) { + _defineProperty$6(e2, r3, t2[r3]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$8(Object(t2)).forEach(function(r3) { + Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3)); }); } return e2; } __name(_objectSpread$8, "_objectSpread$8"); -function _defineProperty$6(e2, r, t2) { - return (r = _toPropertyKey$5(r)) in e2 ? Object.defineProperty(e2, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r] = t2, e2; +function _defineProperty$6(e2, r2, t2) { + return (r2 = _toPropertyKey$5(r2)) in e2 ? Object.defineProperty(e2, r2, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r2] = t2, e2; } __name(_defineProperty$6, "_defineProperty$6"); function _toPropertyKey$5(t2) { @@ -118678,20 +146981,20 @@ function _toPropertyKey$5(t2) { return "symbol" == _typeof$6(i2) ? i2 : i2 + ""; } __name(_toPropertyKey$5, "_toPropertyKey$5"); -function _toPrimitive$5(t2, r) { +function _toPrimitive$5(t2, r2) { if ("object" != _typeof$6(t2) || !t2) return t2; var e2 = t2[Symbol.toPrimitive]; if (void 0 !== e2) { - var i2 = e2.call(t2, r || "default"); + var i2 = e2.call(t2, r2 || "default"); if ("object" != _typeof$6(i2)) return i2; throw new TypeError("@@toPrimitive must return a primitive value."); } - return ("string" === r ? String : Number)(t2); + return ("string" === r2 ? String : Number)(t2); } __name(_toPrimitive$5, "_toPrimitive$5"); -var script$o = { +var script$m = { name: "Select", - "extends": script$1$f, + "extends": script$1$e, inheritAttrs: false, emits: ["update:modelValue", "change", "focus", "blur", "before-show", "before-hide", "show", "hide", "filter"], inject: { @@ -118709,7 +147012,7 @@ var script$o = { searchTimeout: null, searchValue: null, isModelValueChanged: false, - data: /* @__PURE__ */ __name(function data11() { + data: /* @__PURE__ */ __name(function data13() { return { id: this.$attrs.id, clicked: false, @@ -118720,7 +147023,7 @@ var script$o = { }; }, "data"), watch: { - "$attrs.id": /* @__PURE__ */ __name(function $attrsId6(newValue2) { + "$attrs.id": /* @__PURE__ */ __name(function $attrsId7(newValue2) { this.id = newValue2 || UniqueComponentId(); }, "$attrsId"), modelValue: /* @__PURE__ */ __name(function modelValue() { @@ -118730,12 +147033,12 @@ var script$o = { this.autoUpdateModel(); }, "options") }, - mounted: /* @__PURE__ */ __name(function mounted12() { + mounted: /* @__PURE__ */ __name(function mounted14() { this.id = this.id || UniqueComponentId(); this.autoUpdateModel(); this.bindLabelClickListener(); }, "mounted"), - updated: /* @__PURE__ */ __name(function updated8() { + updated: /* @__PURE__ */ __name(function updated9() { if (this.overlayVisible && this.isModelValueChanged) { this.scrollInView(this.findSelectedOptionIndex()); } @@ -118817,7 +147120,7 @@ var script$o = { _hide(); }, 0); }, "hide"), - onFocus: /* @__PURE__ */ __name(function onFocus3(event) { + onFocus: /* @__PURE__ */ __name(function onFocus4(event) { if (this.disabled) { return; } @@ -118828,13 +147131,13 @@ var script$o = { } this.$emit("focus", event); }, "onFocus"), - onBlur: /* @__PURE__ */ __name(function onBlur3(event) { + onBlur: /* @__PURE__ */ __name(function onBlur4(event) { this.focused = false; this.focusedOptionIndex = -1; this.searchValue = ""; this.$emit("blur", event); }, "onBlur"), - onKeyDown: /* @__PURE__ */ __name(function onKeyDown4(event) { + onKeyDown: /* @__PURE__ */ __name(function onKeyDown5(event) { if (this.disabled || isAndroid$2()) { event.preventDefault(); return; @@ -119351,8 +147654,8 @@ var script$o = { index: index2 }); var optionGroupChildren = _this14.getOptionGroupChildren(option3); - optionGroupChildren && optionGroupChildren.forEach(function(o) { - return result.push(o); + optionGroupChildren && optionGroupChildren.forEach(function(o2) { + return result.push(o2); }); return result; }, []); @@ -119382,7 +147685,7 @@ var script$o = { var filteredItems = groupChildren.filter(function(item3) { return filteredOptions.includes(item3); }); - if (filteredItems.length > 0) filtered.push(_objectSpread$8(_objectSpread$8({}, group), {}, _defineProperty$6({}, typeof _this15.optionGroupChildren === "string" ? _this15.optionGroupChildren : "items", _toConsumableArray$9(filteredItems)))); + if (filteredItems.length > 0) filtered.push(_objectSpread$8(_objectSpread$8({}, group), {}, _defineProperty$6({}, typeof _this15.optionGroupChildren === "string" ? _this15.optionGroupChildren : "items", _toConsumableArray$8(filteredItems)))); }); return this.flatOptions(filtered); } @@ -119443,7 +147746,7 @@ var script$o = { virtualScrollerDisabled: /* @__PURE__ */ __name(function virtualScrollerDisabled2() { return !this.virtualScrollerOptions; }, "virtualScrollerDisabled"), - hasFluid: /* @__PURE__ */ __name(function hasFluid3() { + hasFluid: /* @__PURE__ */ __name(function hasFluid4() { return isEmpty$1(this.fluid) ? !!this.$pcFluid : this.fluid; }, "hasFluid") }, @@ -119451,26 +147754,26 @@ var script$o = { ripple: Ripple }, components: { - InputText: script$G, - VirtualScroller: script$F, - Portal: script$Q, - InputIcon: script$H, - IconField: script$I, - TimesIcon: script$W, - ChevronDownIcon: script$p, - SpinnerIcon: script$T, - SearchIcon: script$J, - CheckIcon: script$K, - BlankIcon: script$L + InputText: script$O, + VirtualScroller: script$D, + Portal: script$T, + InputIcon: script$E, + IconField: script$F, + TimesIcon: script$Z, + ChevronDownIcon: script$n, + SpinnerIcon: script$W, + SearchIcon: script$G, + CheckIcon: script$J, + BlankIcon: script$H } }; -var _hoisted_1$Q = ["id"]; -var _hoisted_2$C = ["id", "value", "placeholder", "tabindex", "disabled", "aria-label", "aria-labelledby", "aria-expanded", "aria-controls", "aria-activedescendant", "aria-invalid"]; +var _hoisted_1$O = ["id"]; +var _hoisted_2$A = ["id", "value", "placeholder", "tabindex", "disabled", "aria-label", "aria-labelledby", "aria-expanded", "aria-controls", "aria-activedescendant", "aria-invalid"]; var _hoisted_3$j = ["id", "tabindex", "aria-label", "aria-labelledby", "aria-expanded", "aria-controls", "aria-activedescendant", "aria-disabled"]; var _hoisted_4$e = ["id"]; var _hoisted_5$a = ["id"]; var _hoisted_6$7 = ["id", "aria-label", "aria-selected", "aria-disabled", "aria-setsize", "aria-posinset", "onClick", "onMousemove", "data-p-selected", "data-p-focused", "data-p-disabled"]; -function render$n(_ctx, _cache, $props, $setup, $data, $options) { +function render$l(_ctx, _cache, $props, $setup, $data, $options) { var _component_SpinnerIcon = resolveComponent("SpinnerIcon"); var _component_InputText = resolveComponent("InputText"); var _component_SearchIcon = resolveComponent("SearchIcon"); @@ -119520,7 +147823,7 @@ function render$n(_ctx, _cache, $props, $setup, $data, $options) { onInput: _cache[3] || (_cache[3] = function() { return $options.onEditableInput && $options.onEditableInput.apply($options, arguments); }) - }, _ctx.ptm("label")), null, 16, _hoisted_2$C)) : (openBlock(), createElementBlock("span", mergeProps({ + }, _ctx.ptm("label")), null, 16, _hoisted_2$A)) : (openBlock(), createElementBlock("span", mergeProps({ key: 1, ref: "focusInput", id: _ctx.labelId || _ctx.inputId, @@ -119826,10 +148129,10 @@ function render$n(_ctx, _cache, $props, $setup, $data, $options) { }, 16, ["onEnter", "onAfterEnter", "onLeave", "onAfterLeave"])]; }), _: 3 - }, 8, ["appendTo"])], 16, _hoisted_1$Q); + }, 8, ["appendTo"])], 16, _hoisted_1$O); } -__name(render$n, "render$n"); -script$o.render = render$n; +__name(render$l, "render$l"); +script$m.render = render$l; const id$5 = "arc"; const name$5 = "Arc"; const colors$5 = { @@ -119938,6 +148241,7 @@ const colors$4 = { NODE_SELECTED_TITLE_COLOR: "#FFF", NODE_TEXT_SIZE: 14, NODE_TEXT_COLOR: "#AAA", + NODE_TEXT_HIGHLIGHT_COLOR: "#FFF", NODE_SUBTEXT_SIZE: 12, NODE_DEFAULT_COLOR: "#333", NODE_DEFAULT_BGCOLOR: "#353535", @@ -120065,6 +148369,7 @@ const github = { }; const id$2 = "light"; const name$2 = "Light"; +const light_theme = true; const colors$2 = { node_slot: { CLIP: "#FFA726", @@ -120077,7 +148382,12 @@ const colors$2 = { MASK: "#9CCC65", MODEL: "#7E57C2", STYLE_MODEL: "#D4E157", - VAE: "#FF7043" + VAE: "#FF7043", + NOISE: "#B0B0B0", + GUIDER: "#66FFFF", + SAMPLER: "#ECB4B4", + SIGMAS: "#CDFFCD", + TAESD: "#DCC274" }, litegraph_base: { BACKGROUND_IMAGE: "data:image/gif;base64,R0lGODlhZABkALMAAAAAAP///+vr6+rq6ujo6Ofn5+bm5uXl5d3d3f///wAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAAkALAAAAABkAGQAAAT/UMhJq7046827HkcoHkYxjgZhnGG6si5LqnIM0/fL4qwwIMAg0CAsEovBIxKhRDaNy2GUOX0KfVFrssrNdpdaqTeKBX+dZ+jYvEaTf+y4W66mC8PUdrE879f9d2mBeoNLfH+IhYBbhIx2jkiHiomQlGKPl4uZe3CaeZifnnijgkESBqipqqusra6vsLGys62SlZO4t7qbuby7CLa+wqGWxL3Gv3jByMOkjc2lw8vOoNSi0czAncXW3Njdx9Pf48/Z4Kbbx+fQ5evZ4u3k1fKR6cn03vHlp7T9/v8A/8Gbp4+gwXoFryXMB2qgwoMMHyKEqA5fxX322FG8tzBcRnMW/zlulPbRncmQGidKjMjyYsOSKEF2FBlJQMCbOHP6c9iSZs+UnGYCdbnSo1CZI5F64kn0p1KnTH02nSoV3dGTV7FFHVqVq1dtWcMmVQZTbNGu72zqXMuW7danVL+6e4t1bEy6MeueBYLXrNO5Ze36jQtWsOG97wIj1vt3St/DjTEORss4nNq2mDP3e7w4r1bFkSET5hy6s2TRlD2/mSxXtSHQhCunXo26NevCpmvD/UU6tuullzULH76q92zdZG/Ltv1a+W+osI/nRmyc+fRi1Xdbh+68+0vv10dH3+77KD/i6IdnX669/frn5Zsjh4/2PXju8+8bzc9/6fj27LFnX11/+IUnXWl7BJfegm79FyB9JOl3oHgSklefgxAC+FmFGpqHIYcCfkhgfCohSKKJVo044YUMttggiBkmp6KFXw1oII24oYhjiDByaKOOHcp3Y5BD/njikSkO+eBREQAAOw==", @@ -120086,6 +148396,7 @@ const colors$2 = { NODE_SELECTED_TITLE_COLOR: "#000", NODE_TEXT_SIZE: 14, NODE_TEXT_COLOR: "#444", + NODE_TEXT_HIGHLIGHT_COLOR: "#1e293b", NODE_SUBTEXT_SIZE: 12, NODE_DEFAULT_COLOR: "#F7F7F7", NODE_DEFAULT_BGCOLOR: "#F5F5F5", @@ -120130,6 +148441,7 @@ const colors$2 = { const light = { id: id$2, name: name$2, + light_theme, colors: colors$2 }; const id$1 = "nord"; @@ -120286,6 +148598,8 @@ const CORE_COLOR_PALETTES = { github }; const DEFAULT_COLOR_PALETTE = dark; +const DEFAULT_DARK_COLOR_PALETTE = dark; +const DEFAULT_LIGHT_COLOR_PALETTE = light; const useColorPaletteStore = /* @__PURE__ */ defineStore("colorPalette", () => { const customPalettes = ref({}); const activePaletteId = ref(DEFAULT_COLOR_PALETTE.id); @@ -120318,20 +148632,21 @@ const useColorPaletteStore = /* @__PURE__ */ defineStore("colorPalette", () => { if (palette.colors.comfy_base["comfy-menu-bg"] && !palette.colors.comfy_base["comfy-menu-secondary-bg"]) { palette.colors.comfy_base["comfy-menu-secondary-bg"] = palette.colors.comfy_base["comfy-menu-bg"]; } + const defaultPalette = palette.light_theme ? DEFAULT_LIGHT_COLOR_PALETTE : DEFAULT_DARK_COLOR_PALETTE; return { ...palette, colors: { ...palette.colors, node_slot: { - ...DEFAULT_COLOR_PALETTE.colors.node_slot, + ...defaultPalette.colors.node_slot, ...palette.colors.node_slot }, litegraph_base: { - ...DEFAULT_COLOR_PALETTE.colors.litegraph_base, + ...defaultPalette.colors.litegraph_base, ...palette.colors.litegraph_base }, comfy_base: { - ...DEFAULT_COLOR_PALETTE.colors.comfy_base, + ...defaultPalette.colors.comfy_base, ...palette.colors.comfy_base } } @@ -120352,8 +148667,8 @@ const useColorPaletteStore = /* @__PURE__ */ defineStore("colorPalette", () => { completePalette }; }); -const _hoisted_1$P = { class: "flex items-center justify-between" }; -const _hoisted_2$B = { class: "actions" }; +const _hoisted_1$N = { class: "flex items-center justify-between" }; +const _hoisted_2$z = { class: "actions" }; const _sfc_main$I = /* @__PURE__ */ defineComponent({ __name: "ColorPaletteMessage", setup(__props) { @@ -120368,16 +148683,16 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({ } }, "importCustomPalette"); return (_ctx, _cache) => { - return openBlock(), createBlock(unref(script$q), { + return openBlock(), createBlock(unref(script$o), { severity: "info", icon: "pi pi-palette", "pt:text": "w-full" }, { default: withCtx(() => [ - createBaseVNode("div", _hoisted_1$P, [ + createBaseVNode("div", _hoisted_1$N, [ createBaseVNode("div", null, toDisplayString$1(_ctx.$t("settingsCategories.ColorPalette")), 1), - createBaseVNode("div", _hoisted_2$B, [ - createVNode(unref(script$o), { + createBaseVNode("div", _hoisted_2$z, [ + createVNode(unref(script$m), { class: "w-44", modelValue: unref(activePaletteId), "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(activePaletteId) ? activePaletteId.value = $event : null), @@ -120385,19 +148700,19 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({ optionLabel: "name", optionValue: "id" }, null, 8, ["modelValue", "options"]), - createVNode(unref(script$R), { - icon: "pi pi-download", + createVNode(unref(script$U), { + icon: "pi pi-upload", text: "", - title: _ctx.$t("g.download"), + title: _ctx.$t("g.export"), onClick: _cache[1] || (_cache[1] = ($event) => unref(colorPaletteService).exportColorPalette(unref(activePaletteId))) }, null, 8, ["title"]), - createVNode(unref(script$R), { - icon: "pi pi-upload", + createVNode(unref(script$U), { + icon: "pi pi-download", text: "", title: _ctx.$t("g.import"), onClick: importCustomPalette }, null, 8, ["title"]), - createVNode(unref(script$R), { + createVNode(unref(script$U), { icon: "pi pi-trash", severity: "danger", text: "", @@ -120413,7 +148728,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({ }; } }); -const _hoisted_1$O = { class: "flex items-center justify-between" }; +const _hoisted_1$M = { class: "flex items-center justify-between" }; const _sfc_main$H = /* @__PURE__ */ defineComponent({ __name: "CurrentUserMessage", setup(__props) { @@ -120423,16 +148738,16 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({ window.location.reload(); }, "logout"); return (_ctx, _cache) => { - return unref(userStore).isMultiUserServer ? (openBlock(), createBlock(unref(script$q), { + return unref(userStore).isMultiUserServer ? (openBlock(), createBlock(unref(script$o), { key: 0, severity: "info", icon: "pi pi-user", "pt:text": "w-full" }, { default: withCtx(() => [ - createBaseVNode("div", _hoisted_1$O, [ + createBaseVNode("div", _hoisted_1$M, [ createBaseVNode("div", null, toDisplayString$1(_ctx.$t("g.currentUser")) + ": " + toDisplayString$1(unref(userStore).currentUser?.username), 1), - createVNode(unref(script$R), { + createVNode(unref(script$U), { icon: "pi pi-sign-out", onClick: logout, text: "" @@ -120454,7 +148769,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({ settingStore.set("Comfy.UseNewMenu", currentValue); }, "handleClose"); return (_ctx, _cache) => { - return show5.value ? (openBlock(), createBlock(unref(script$q), { + return show5.value ? (openBlock(), createBlock(unref(script$o), { key: 0, class: "first-time-ui-message", severity: "info", @@ -120469,52 +148784,52 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({ }; } }); -var script$n = { +var script$l = { name: "AngleDownIcon", - "extends": script$X + "extends": script$_ }; -var _hoisted_1$N = /* @__PURE__ */ createBaseVNode("path", { +var _hoisted_1$L = /* @__PURE__ */ createBaseVNode("path", { d: "M3.58659 4.5007C3.68513 4.50023 3.78277 4.51945 3.87379 4.55723C3.9648 4.59501 4.04735 4.65058 4.11659 4.7207L7.11659 7.7207L10.1166 4.7207C10.2619 4.65055 10.4259 4.62911 10.5843 4.65956C10.7427 4.69002 10.8871 4.77074 10.996 4.88976C11.1049 5.00877 11.1726 5.15973 11.1889 5.32022C11.2052 5.48072 11.1693 5.6422 11.0866 5.7807L7.58659 9.2807C7.44597 9.42115 7.25534 9.50004 7.05659 9.50004C6.85784 9.50004 6.66722 9.42115 6.52659 9.2807L3.02659 5.7807C2.88614 5.64007 2.80725 5.44945 2.80725 5.2507C2.80725 5.05195 2.88614 4.86132 3.02659 4.7207C3.09932 4.64685 3.18675 4.58911 3.28322 4.55121C3.37969 4.51331 3.48305 4.4961 3.58659 4.5007Z", fill: "currentColor" }, null, -1); -var _hoisted_2$A = [_hoisted_1$N]; -function render$m(_ctx, _cache, $props, $setup, $data, $options) { +var _hoisted_2$y = [_hoisted_1$L]; +function render$k(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" - }, _ctx.pti()), _hoisted_2$A, 16); + }, _ctx.pti()), _hoisted_2$y, 16); } -__name(render$m, "render$m"); -script$n.render = render$m; -var script$m = { +__name(render$k, "render$k"); +script$l.render = render$k; +var script$k = { name: "AngleUpIcon", - "extends": script$X + "extends": script$_ }; -var _hoisted_1$M = /* @__PURE__ */ createBaseVNode("path", { +var _hoisted_1$K = /* @__PURE__ */ createBaseVNode("path", { d: "M10.4134 9.49931C10.3148 9.49977 10.2172 9.48055 10.1262 9.44278C10.0352 9.405 9.95263 9.34942 9.88338 9.27931L6.88338 6.27931L3.88338 9.27931C3.73811 9.34946 3.57409 9.3709 3.41567 9.34044C3.25724 9.30999 3.11286 9.22926 3.00395 9.11025C2.89504 8.99124 2.82741 8.84028 2.8111 8.67978C2.79478 8.51928 2.83065 8.35781 2.91338 8.21931L6.41338 4.71931C6.55401 4.57886 6.74463 4.49997 6.94338 4.49997C7.14213 4.49997 7.33276 4.57886 7.47338 4.71931L10.9734 8.21931C11.1138 8.35994 11.1927 8.55056 11.1927 8.74931C11.1927 8.94806 11.1138 9.13868 10.9734 9.27931C10.9007 9.35315 10.8132 9.41089 10.7168 9.44879C10.6203 9.48669 10.5169 9.5039 10.4134 9.49931Z", fill: "currentColor" }, null, -1); -var _hoisted_2$z = [_hoisted_1$M]; -function render$l(_ctx, _cache, $props, $setup, $data, $options) { +var _hoisted_2$x = [_hoisted_1$K]; +function render$j(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" - }, _ctx.pti()), _hoisted_2$z, 16); + }, _ctx.pti()), _hoisted_2$x, 16); } -__name(render$l, "render$l"); -script$m.render = render$l; -var theme$e = /* @__PURE__ */ __name(function theme25(_ref) { +__name(render$j, "render$j"); +script$k.render = render$j; +var theme$d = /* @__PURE__ */ __name(function theme28(_ref) { var dt2 = _ref.dt; return "\n.p-inputnumber {\n display: inline-flex;\n position: relative;\n}\n\n.p-inputnumber-button {\n display: flex;\n align-items: center;\n justify-content: center;\n flex: 0 0 auto;\n cursor: pointer;\n background: ".concat(dt2("inputnumber.button.background"), ";\n color: ").concat(dt2("inputnumber.button.color"), ";\n width: ").concat(dt2("inputnumber.button.width"), ";\n transition: background ").concat(dt2("inputnumber.transition.duration"), ", color ").concat(dt2("inputnumber.transition.duration"), ", border-color ").concat(dt2("inputnumber.transition.duration"), ", outline-color ").concat(dt2("inputnumber.transition.duration"), ";\n}\n\n.p-inputnumber-button:hover {\n background: ").concat(dt2("inputnumber.button.hover.background"), ";\n color: ").concat(dt2("inputnumber.button.hover.color"), ";\n}\n\n.p-inputnumber-button:active {\n background: ").concat(dt2("inputnumber.button.active.background"), ";\n color: ").concat(dt2("inputnumber.button.active.color"), ";\n}\n\n.p-inputnumber-stacked .p-inputnumber-button {\n position: relative;\n border: 0 none;\n}\n\n.p-inputnumber-stacked .p-inputnumber-button-group {\n display: flex;\n flex-direction: column;\n position: absolute;\n top: 1px;\n right: 1px;\n height: calc(100% - 2px);\n z-index: 1;\n}\n\n.p-inputnumber-stacked .p-inputnumber-increment-button {\n padding: 0;\n border-top-right-radius: calc(").concat(dt2("inputnumber.button.border.radius"), " - 1px);\n}\n\n.p-inputnumber-stacked .p-inputnumber-decrement-button {\n padding: 0;\n border-bottom-right-radius: calc(").concat(dt2("inputnumber.button.border.radius"), " - 1px);\n}\n\n.p-inputnumber-stacked .p-inputnumber-button {\n flex: 1 1 auto;\n border: 0 none;\n}\n\n.p-inputnumber-horizontal .p-inputnumber-button {\n border: 1px solid ").concat(dt2("inputnumber.button.border.color"), ";\n}\n\n.p-inputnumber-horizontal .p-inputnumber-button:hover {\n border-color: ").concat(dt2("inputnumber.button.hover.border.color"), ";\n}\n\n.p-inputnumber-horizontal .p-inputnumber-button:active {\n border-color: ").concat(dt2("inputnumber.button.active.border.color"), ";\n}\n\n.p-inputnumber-horizontal .p-inputnumber-increment-button {\n order: 3;\n border-top-right-radius: ").concat(dt2("inputnumber.button.border.radius"), ";\n border-bottom-right-radius: ").concat(dt2("inputnumber.button.border.radius"), ";\n border-left: 0 none;\n}\n\n.p-inputnumber-horizontal .p-inputnumber-input {\n order: 2;\n border-radius: 0;\n}\n\n.p-inputnumber-horizontal .p-inputnumber-decrement-button {\n order: 1;\n border-top-left-radius: ").concat(dt2("inputnumber.button.border.radius"), ";\n border-bottom-left-radius: ").concat(dt2("inputnumber.button.border.radius"), ";\n border-right: 0 none;\n}\n\n.p-inputnumber-vertical {\n flex-direction: column;\n}\n\n.p-inputnumber-vertical .p-inputnumber-button {\n border: 1px solid ").concat(dt2("inputnumber.button.border.color"), ";\n padding: ").concat(dt2("inputnumber.button.vertical.padding"), "; 0;\n}\n\n.p-inputnumber-vertical .p-inputnumber-button:hover {\n border-color: ").concat(dt2("inputnumber.button.hover.border.color"), ";\n}\n\n.p-inputnumber-vertical .p-inputnumber-button:active {\n border-color: ").concat(dt2("inputnumber.button.active.border.color"), ";\n}\n\n.p-inputnumber-vertical .p-inputnumber-increment-button {\n order: 1;\n border-top-left-radius: ").concat(dt2("inputnumber.button.border.radius"), ";\n border-top-right-radius: ").concat(dt2("inputnumber.button.border.radius"), ";\n width: 100%;\n border-bottom: 0 none;\n}\n\n.p-inputnumber-vertical .p-inputnumber-input {\n order: 2;\n border-radius: 0;\n text-align: center;\n}\n\n.p-inputnumber-vertical .p-inputnumber-decrement-button {\n order: 3;\n border-bottom-left-radius: ").concat(dt2("inputnumber.button.border.radius"), ";\n border-bottom-right-radius: ").concat(dt2("inputnumber.button.border.radius"), ";\n width: 100%;\n border-top: 0 none;\n}\n\n.p-inputnumber-input {\n flex: 1 1 auto;\n}\n\n.p-inputnumber-fluid {\n width: 100%;\n}\n\n.p-inputnumber-fluid .p-inputnumber-input {\n width: 1%;\n}\n\n.p-inputnumber-fluid.p-inputnumber-vertical .p-inputnumber-input {\n width: 100%;\n}\n"); }, "theme"); -var classes$e = { - root: /* @__PURE__ */ __name(function root15(_ref2) { +var classes$d = { + root: /* @__PURE__ */ __name(function root19(_ref2) { var instance = _ref2.instance, props = _ref2.props; return ["p-inputnumber p-component p-inputwrapper", { "p-inputwrapper-filled": instance.filled || props.allowEmpty === false, @@ -120542,12 +148857,12 @@ var classes$e = { }; var InputNumberStyle = BaseStyle.extend({ name: "inputnumber", - theme: theme$e, - classes: classes$e + theme: theme$d, + classes: classes$d }); -var script$1$e = { +var script$1$d = { name: "BaseInputNumber", - "extends": script$_, + "extends": script$11, props: { modelValue: { type: Number, @@ -120702,47 +149017,47 @@ var script$1$e = { } }, style: InputNumberStyle, - provide: /* @__PURE__ */ __name(function provide27() { + provide: /* @__PURE__ */ __name(function provide30() { return { $pcInputNumber: this, $parentInstance: this }; }, "provide") }; -function _typeof$5(o) { +function _typeof$5(o2) { "@babel/helpers - typeof"; - return _typeof$5 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { - return typeof o2; - } : function(o2) { - return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; - }, _typeof$5(o); + return _typeof$5 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { + return typeof o3; + } : function(o3) { + return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; + }, _typeof$5(o2); } __name(_typeof$5, "_typeof$5"); -function ownKeys$7(e2, r) { +function ownKeys$7(e2, r2) { var t2 = Object.keys(e2); if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e2); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e2, r2).enumerable; - })), t2.push.apply(t2, o); + var o2 = Object.getOwnPropertySymbols(e2); + r2 && (o2 = o2.filter(function(r3) { + return Object.getOwnPropertyDescriptor(e2, r3).enumerable; + })), t2.push.apply(t2, o2); } return t2; } __name(ownKeys$7, "ownKeys$7"); function _objectSpread$7(e2) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$7(Object(t2), true).forEach(function(r2) { - _defineProperty$5(e2, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$7(Object(t2)).forEach(function(r2) { - Object.defineProperty(e2, r2, Object.getOwnPropertyDescriptor(t2, r2)); + for (var r2 = 1; r2 < arguments.length; r2++) { + var t2 = null != arguments[r2] ? arguments[r2] : {}; + r2 % 2 ? ownKeys$7(Object(t2), true).forEach(function(r3) { + _defineProperty$5(e2, r3, t2[r3]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$7(Object(t2)).forEach(function(r3) { + Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3)); }); } return e2; } __name(_objectSpread$7, "_objectSpread$7"); -function _defineProperty$5(e2, r, t2) { - return (r = _toPropertyKey$4(r)) in e2 ? Object.defineProperty(e2, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r] = t2, e2; +function _defineProperty$5(e2, r2, t2) { + return (r2 = _toPropertyKey$4(r2)) in e2 ? Object.defineProperty(e2, r2, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r2] = t2, e2; } __name(_defineProperty$5, "_defineProperty$5"); function _toPropertyKey$4(t2) { @@ -120750,50 +149065,50 @@ function _toPropertyKey$4(t2) { return "symbol" == _typeof$5(i2) ? i2 : i2 + ""; } __name(_toPropertyKey$4, "_toPropertyKey$4"); -function _toPrimitive$4(t2, r) { +function _toPrimitive$4(t2, r2) { if ("object" != _typeof$5(t2) || !t2) return t2; var e2 = t2[Symbol.toPrimitive]; if (void 0 !== e2) { - var i2 = e2.call(t2, r || "default"); + var i2 = e2.call(t2, r2 || "default"); if ("object" != _typeof$5(i2)) return i2; throw new TypeError("@@toPrimitive must return a primitive value."); } - return ("string" === r ? String : Number)(t2); + return ("string" === r2 ? String : Number)(t2); } __name(_toPrimitive$4, "_toPrimitive$4"); -function _toConsumableArray$8(r) { - return _arrayWithoutHoles$8(r) || _iterableToArray$8(r) || _unsupportedIterableToArray$a(r) || _nonIterableSpread$8(); +function _toConsumableArray$7(r2) { + return _arrayWithoutHoles$7(r2) || _iterableToArray$7(r2) || _unsupportedIterableToArray$9(r2) || _nonIterableSpread$7(); } -__name(_toConsumableArray$8, "_toConsumableArray$8"); -function _nonIterableSpread$8() { +__name(_toConsumableArray$7, "_toConsumableArray$7"); +function _nonIterableSpread$7() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -__name(_nonIterableSpread$8, "_nonIterableSpread$8"); -function _unsupportedIterableToArray$a(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray$a(r, a); - var t2 = {}.toString.call(r).slice(8, -1); - return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$a(r, a) : void 0; +__name(_nonIterableSpread$7, "_nonIterableSpread$7"); +function _unsupportedIterableToArray$9(r2, a2) { + if (r2) { + if ("string" == typeof r2) return _arrayLikeToArray$9(r2, a2); + var t2 = {}.toString.call(r2).slice(8, -1); + return "Object" === t2 && r2.constructor && (t2 = r2.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r2) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$9(r2, a2) : void 0; } } -__name(_unsupportedIterableToArray$a, "_unsupportedIterableToArray$a"); -function _iterableToArray$8(r) { - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); +__name(_unsupportedIterableToArray$9, "_unsupportedIterableToArray$9"); +function _iterableToArray$7(r2) { + if ("undefined" != typeof Symbol && null != r2[Symbol.iterator] || null != r2["@@iterator"]) return Array.from(r2); } -__name(_iterableToArray$8, "_iterableToArray$8"); -function _arrayWithoutHoles$8(r) { - if (Array.isArray(r)) return _arrayLikeToArray$a(r); +__name(_iterableToArray$7, "_iterableToArray$7"); +function _arrayWithoutHoles$7(r2) { + if (Array.isArray(r2)) return _arrayLikeToArray$9(r2); } -__name(_arrayWithoutHoles$8, "_arrayWithoutHoles$8"); -function _arrayLikeToArray$a(r, a) { - (null == a || a > r.length) && (a = r.length); - for (var e2 = 0, n = Array(a); e2 < a; e2++) n[e2] = r[e2]; - return n; +__name(_arrayWithoutHoles$7, "_arrayWithoutHoles$7"); +function _arrayLikeToArray$9(r2, a2) { + (null == a2 || a2 > r2.length) && (a2 = r2.length); + for (var e2 = 0, n2 = Array(a2); e2 < a2; e2++) n2[e2] = r2[e2]; + return n2; } -__name(_arrayLikeToArray$a, "_arrayLikeToArray$a"); -var script$l = { +__name(_arrayLikeToArray$9, "_arrayLikeToArray$9"); +var script$j = { name: "InputNumber", - "extends": script$1$e, + "extends": script$1$d, inheritAttrs: false, emits: ["update:modelValue", "input", "focus", "blur"], inject: { @@ -120815,7 +149130,7 @@ var script$l = { prefixChar: null, suffixChar: null, timer: null, - data: /* @__PURE__ */ __name(function data12() { + data: /* @__PURE__ */ __name(function data14() { return { d_modelValue: this.modelValue, focused: false @@ -120860,7 +149175,7 @@ var script$l = { this.constructParser(); }, "created"), methods: { - getOptions: /* @__PURE__ */ __name(function getOptions2() { + getOptions: /* @__PURE__ */ __name(function getOptions3() { return { localeMatcher: this.localeMatcher, style: this.mode, @@ -120874,11 +149189,11 @@ var script$l = { }, "getOptions"), constructParser: /* @__PURE__ */ __name(function constructParser() { this.numberFormat = new Intl.NumberFormat(this.locale, this.getOptions()); - var numerals = _toConsumableArray$8(new Intl.NumberFormat(this.locale, { + var numerals = _toConsumableArray$7(new Intl.NumberFormat(this.locale, { useGrouping: false }).format(9876543210)).reverse(); - var index2 = new Map(numerals.map(function(d, i2) { - return [d, i2]; + var index2 = new Map(numerals.map(function(d2, i2) { + return [d2, i2]; })); this._numeral = new RegExp("[".concat(numerals.join(""), "]"), "g"); this._group = this.getGroupingExpression(); @@ -120887,8 +149202,8 @@ var script$l = { this._decimal = this.getDecimalExpression(); this._suffix = this.getSuffixExpression(); this._prefix = this.getPrefixExpression(); - this._index = function(d) { - return index2.get(d); + this._index = function(d2) { + return index2.get(d2); }; }, "constructParser"), updateConstructParser: /* @__PURE__ */ __name(function updateConstructParser(newValue2, oldValue2) { @@ -120991,7 +149306,7 @@ var script$l = { } return null; }, "parseValue"), - repeat: /* @__PURE__ */ __name(function repeat2(event, interval, dir) { + repeat: /* @__PURE__ */ __name(function repeat3(event, interval, dir) { var _this = this; if (this.readonly) { return; @@ -121214,9 +149529,9 @@ var script$l = { }, "onInputKeyPress"), onPaste: /* @__PURE__ */ __name(function onPaste(event) { event.preventDefault(); - var data24 = (event.clipboardData || window["clipboardData"]).getData("Text"); - if (data24) { - var filteredData = this.parseValue(data24); + var data25 = (event.clipboardData || window["clipboardData"]).getData("Text"); + if (data25) { + var filteredData = this.parseValue(data25); if (filteredData != null) { this.insert(event, filteredData.toString()); } @@ -121564,7 +149879,7 @@ var script$l = { }, "minBoundry") }, computed: { - filled: /* @__PURE__ */ __name(function filled2() { + filled: /* @__PURE__ */ __name(function filled3() { return this.modelValue != null && this.modelValue.toString().length > 0; }, "filled"), upButtonListeners: /* @__PURE__ */ __name(function upButtonListeners() { @@ -121614,21 +149929,21 @@ var script$l = { getFormatter: /* @__PURE__ */ __name(function getFormatter() { return this.numberFormat; }, "getFormatter"), - hasFluid: /* @__PURE__ */ __name(function hasFluid4() { + hasFluid: /* @__PURE__ */ __name(function hasFluid5() { return isEmpty$1(this.fluid) ? !!this.$pcFluid : this.fluid; }, "hasFluid") }, components: { - InputText: script$G, - AngleUpIcon: script$m, - AngleDownIcon: script$n + InputText: script$O, + AngleUpIcon: script$k, + AngleDownIcon: script$l } }; -var _hoisted_1$L = ["disabled"]; -var _hoisted_2$y = ["disabled"]; +var _hoisted_1$J = ["disabled"]; +var _hoisted_2$w = ["disabled"]; var _hoisted_3$i = ["disabled"]; var _hoisted_4$d = ["disabled"]; -function render$k(_ctx, _cache, $props, $setup, $data, $options) { +function render$i(_ctx, _cache, $props, $setup, $data, $options) { var _component_InputText = resolveComponent("InputText"); return openBlock(), createElementBlock("span", mergeProps({ "class": _ctx.cx("root") @@ -121678,7 +149993,7 @@ function render$k(_ctx, _cache, $props, $setup, $data, $options) { }, _ctx.ptm("incrementIcon"), { "data-pc-section": "incrementicon" }), null, 16, ["class"]))]; - })], 16, _hoisted_1$L)]; + })], 16, _hoisted_1$J)]; }), renderSlot(_ctx.$slots, "decrementbutton", { listeners: $options.downButtonListeners }, function() { @@ -121695,7 +150010,7 @@ function render$k(_ctx, _cache, $props, $setup, $data, $options) { }, _ctx.ptm("decrementIcon"), { "data-pc-section": "decrementicon" }), null, 16, ["class"]))]; - })], 16, _hoisted_2$y)]; + })], 16, _hoisted_2$w)]; })], 16)) : createCommentVNode("", true), renderSlot(_ctx.$slots, "incrementbutton", { listeners: $options.upButtonListeners }, function() { @@ -121734,9 +150049,9 @@ function render$k(_ctx, _cache, $props, $setup, $data, $options) { })], 16, _hoisted_4$d)) : createCommentVNode("", true)]; })], 16); } -__name(render$k, "render$k"); -script$l.render = render$k; -var theme$d = /* @__PURE__ */ __name(function theme26(_ref) { +__name(render$i, "render$i"); +script$j.render = render$i; +var theme$c = /* @__PURE__ */ __name(function theme29(_ref) { var dt2 = _ref.dt; return "\n.p-toggleswitch {\n display: inline-block;\n width: ".concat(dt2("toggleswitch.width"), ";\n height: ").concat(dt2("toggleswitch.height"), ";\n}\n\n.p-toggleswitch-input {\n cursor: pointer;\n appearance: none;\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n padding: 0;\n margin: 0;\n opacity: 0;\n z-index: 1;\n outline: 0 none;\n border-radius: ").concat(dt2("toggleswitch.border.radius"), ";\n}\n\n.p-toggleswitch-slider {\n display: inline-block;\n cursor: pointer;\n width: 100%;\n height: 100%;\n border-width: ").concat(dt2("toggleswitch.border.width"), ";\n border-style: solid;\n border-color: ").concat(dt2("toggleswitch.border.color"), ";\n background: ").concat(dt2("toggleswitch.background"), ";\n transition: background ").concat(dt2("toggleswitch.transition.duration"), ", color ").concat(dt2("toggleswitch.transition.duration"), ", border-color ").concat(dt2("toggleswitch.transition.duration"), ", outline-color ").concat(dt2("toggleswitch.transition.duration"), ", box-shadow ").concat(dt2("toggleswitch.transition.duration"), ";\n border-radius: ").concat(dt2("toggleswitch.border.radius"), ";\n outline-color: transparent;\n box-shadow: ").concat(dt2("toggleswitch.shadow"), ';\n}\n\n.p-toggleswitch-slider:before {\n position: absolute;\n content: "";\n top: 50%;\n background: ').concat(dt2("toggleswitch.handle.background"), ";\n width: ").concat(dt2("toggleswitch.handle.size"), ";\n height: ").concat(dt2("toggleswitch.handle.size"), ";\n left: ").concat(dt2("toggleswitch.gap"), ";\n margin-top: calc(-1 * calc(").concat(dt2("toggleswitch.handle.size"), " / 2));\n border-radius: ").concat(dt2("toggleswitch.handle.border.radius"), ";\n transition: background ").concat(dt2("toggleswitch.transition.duration"), ", left ").concat(dt2("toggleswitch.slide.duration"), ";\n}\n\n.p-toggleswitch.p-toggleswitch-checked .p-toggleswitch-slider {\n background: ").concat(dt2("toggleswitch.checked.background"), ";\n border-color: ").concat(dt2("toggleswitch.checked.border.color"), ";\n}\n\n.p-toggleswitch.p-toggleswitch-checked .p-toggleswitch-slider:before {\n background: ").concat(dt2("toggleswitch.handle.checked.background"), ";\n left: calc(").concat(dt2("toggleswitch.width"), " - calc(").concat(dt2("toggleswitch.handle.size"), " + ").concat(dt2("toggleswitch.gap"), "));\n}\n\n.p-toggleswitch:not(.p-disabled):has(.p-toggleswitch-input:hover) .p-toggleswitch-slider {\n background: ").concat(dt2("toggleswitch.hover.background"), ";\n border-color: ").concat(dt2("toggleswitch.hover.border.color"), ";\n}\n\n.p-toggleswitch:not(.p-disabled):has(.p-toggleswitch-input:hover) .p-toggleswitch-slider:before {\n background: ").concat(dt2("toggleswitch.handle.hover.background"), ";\n}\n\n.p-toggleswitch:not(.p-disabled):has(.p-toggleswitch-input:hover).p-toggleswitch-checked .p-toggleswitch-slider {\n background: ").concat(dt2("toggleswitch.checked.hover.background"), ";\n border-color: ").concat(dt2("toggleswitch.checked.hover.border.color"), ";\n}\n\n.p-toggleswitch:not(.p-disabled):has(.p-toggleswitch-input:hover).p-toggleswitch-checked .p-toggleswitch-slider:before {\n background: ").concat(dt2("toggleswitch.handle.checked.hover.background"), ";\n}\n\n.p-toggleswitch:not(.p-disabled):has(.p-toggleswitch-input:focus-visible) .p-toggleswitch-slider {\n box-shadow: ").concat(dt2("toggleswitch.focus.ring.shadow"), ";\n outline: ").concat(dt2("toggleswitch.focus.ring.width"), " ").concat(dt2("toggleswitch.focus.ring.style"), " ").concat(dt2("toggleswitch.focus.ring.color"), ";\n outline-offset: ").concat(dt2("toggleswitch.focus.ring.offset"), ";\n}\n\n.p-toggleswitch.p-invalid > .p-toggleswitch-slider {\n border-color: ").concat(dt2("toggleswitch.invalid.border.color"), ";\n}\n\n.p-toggleswitch.p-disabled {\n opacity: 1;\n}\n\n.p-toggleswitch.p-disabled .p-toggleswitch-slider {\n background: ").concat(dt2("toggleswitch.disabled.background"), ";\n}\n\n.p-toggleswitch.p-disabled .p-toggleswitch-slider:before {\n background: ").concat(dt2("toggleswitch.handle.disabled.background"), ";\n}\n"); }, "theme"); @@ -121745,8 +150060,8 @@ var inlineStyles$1 = { position: "relative" } }; -var classes$d = { - root: /* @__PURE__ */ __name(function root16(_ref2) { +var classes$c = { + root: /* @__PURE__ */ __name(function root20(_ref2) { var instance = _ref2.instance, props = _ref2.props; return ["p-toggleswitch p-component", { "p-toggleswitch-checked": instance.checked, @@ -121759,13 +150074,13 @@ var classes$d = { }; var ToggleSwitchStyle = BaseStyle.extend({ name: "toggleswitch", - theme: theme$d, - classes: classes$d, + theme: theme$c, + classes: classes$c, inlineStyles: inlineStyles$1 }); -var script$1$d = { +var script$1$c = { name: "BaseToggleSwitch", - "extends": script$_, + "extends": script$11, props: { modelValue: { type: null, @@ -121817,20 +150132,20 @@ var script$1$d = { } }, style: ToggleSwitchStyle, - provide: /* @__PURE__ */ __name(function provide28() { + provide: /* @__PURE__ */ __name(function provide31() { return { $pcToggleSwitch: this, $parentInstance: this }; }, "provide") }; -var script$k = { +var script$i = { name: "ToggleSwitch", - "extends": script$1$d, + "extends": script$1$c, inheritAttrs: false, emits: ["update:modelValue", "change", "focus", "blur"], methods: { - getPTOptions: /* @__PURE__ */ __name(function getPTOptions4(key) { + getPTOptions: /* @__PURE__ */ __name(function getPTOptions5(key) { var _ptm = key === "root" ? this.ptmi : this.ptm; return _ptm(key, { context: { @@ -121839,29 +150154,29 @@ var script$k = { } }); }, "getPTOptions"), - onChange: /* @__PURE__ */ __name(function onChange2(event) { + onChange: /* @__PURE__ */ __name(function onChange3(event) { if (!this.disabled && !this.readonly) { var newValue2 = this.checked ? this.falseValue : this.trueValue; this.$emit("update:modelValue", newValue2); this.$emit("change", event); } }, "onChange"), - onFocus: /* @__PURE__ */ __name(function onFocus4(event) { + onFocus: /* @__PURE__ */ __name(function onFocus5(event) { this.$emit("focus", event); }, "onFocus"), - onBlur: /* @__PURE__ */ __name(function onBlur4(event) { + onBlur: /* @__PURE__ */ __name(function onBlur5(event) { this.$emit("blur", event); }, "onBlur") }, computed: { - checked: /* @__PURE__ */ __name(function checked() { + checked: /* @__PURE__ */ __name(function checked2() { return this.modelValue === this.trueValue; }, "checked") } }; -var _hoisted_1$K = ["data-p-checked", "data-p-disabled"]; -var _hoisted_2$x = ["id", "checked", "tabindex", "disabled", "readonly", "aria-checked", "aria-labelledby", "aria-label", "aria-invalid"]; -function render$j(_ctx, _cache, $props, $setup, $data, $options) { +var _hoisted_1$I = ["data-p-checked", "data-p-disabled"]; +var _hoisted_2$v = ["id", "checked", "tabindex", "disabled", "readonly", "aria-checked", "aria-labelledby", "aria-label", "aria-invalid"]; +function render$h(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("div", mergeProps({ "class": _ctx.cx("root"), style: _ctx.sx("root") @@ -121891,12 +150206,12 @@ function render$j(_ctx, _cache, $props, $setup, $data, $options) { onChange: _cache[2] || (_cache[2] = function() { return $options.onChange && $options.onChange.apply($options, arguments); }) - }, $options.getPTOptions("input")), null, 16, _hoisted_2$x), createBaseVNode("span", mergeProps({ + }, $options.getPTOptions("input")), null, 16, _hoisted_2$v), createBaseVNode("span", mergeProps({ "class": _ctx.cx("slider") - }, $options.getPTOptions("slider")), null, 16)], 16, _hoisted_1$K); + }, $options.getPTOptions("slider")), null, 16)], 16, _hoisted_1$I); } -__name(render$j, "render$j"); -script$k.render = render$j; +__name(render$h, "render$h"); +script$i.render = render$h; const _sfc_main$F = /* @__PURE__ */ defineComponent({ __name: "CustomFormValue", props: { @@ -121923,11 +150238,11 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({ }; } }); -var theme$c = /* @__PURE__ */ __name(function theme27(_ref) { +var theme$b = /* @__PURE__ */ __name(function theme30(_ref) { var dt2 = _ref.dt; return "\n.p-colorpicker {\n display: inline-block;\n position: relative;\n}\n\n.p-colorpicker-dragging {\n cursor: pointer;\n}\n\n.p-colorpicker-preview {\n width: ".concat(dt2("colorpicker.preview.width"), ";\n height: ").concat(dt2("colorpicker.preview.height"), ";\n padding: 0;\n border: 0 none;\n border-radius: ").concat(dt2("colorpicker.preview.border.radius"), ";\n transition: background ").concat(dt2("colorpicker.transition.duration"), ", color ").concat(dt2("colorpicker.transition.duration"), ", border-color ").concat(dt2("colorpicker.transition.duration"), ", outline-color ").concat(dt2("colorpicker.transition.duration"), ", box-shadow ").concat(dt2("colorpicker.transition.duration"), ";\n outline-color: transparent;\n cursor: pointer;\n}\n\n.p-colorpicker-preview:enabled:focus-visible {\n border-color: ").concat(dt2("colorpicker.preview.focus.border.color"), ";\n box-shadow: ").concat(dt2("colorpicker.preview.focus.ring.shadow"), ";\n outline: ").concat(dt2("colorpicker.preview.focus.ring.width"), " ").concat(dt2("colorpicker.preview.focus.ring.style"), " ").concat(dt2("colorpicker.preview.focus.ring.color"), ";\n outline-offset: ").concat(dt2("colorpicker.preview.focus.ring.offset"), ";\n}\n\n.p-colorpicker-panel {\n background: ").concat(dt2("colorpicker.panel.background"), ";\n border: 1px solid ").concat(dt2("colorpicker.panel.border.color"), ";\n border-radius: ").concat(dt2("colorpicker.panel.border.radius"), ";\n box-shadow: ").concat(dt2("colorpicker.panel.shadow"), ";\n width: 193px;\n height: 166px;\n position: absolute;\n top: 0;\n left: 0;\n}\n\n.p-colorpicker-panel-inline {\n box-shadow: none;\n position: static;\n}\n\n.p-colorpicker-content {\n position: relative;\n}\n\n.p-colorpicker-color-selector {\n width: 150px;\n height: 150px;\n top: 8px;\n left: 8px;\n position: absolute;\n}\n\n.p-colorpicker-color-background {\n width: 100%;\n height: 100%;\n background: linear-gradient(to top, #000 0%, rgba(0, 0, 0, 0) 100%), linear-gradient(to right, #fff 0%, rgba(255, 255, 255, 0) 100%);\n}\n\n.p-colorpicker-color-handle {\n position: absolute;\n top: 0px;\n left: 150px;\n border-radius: 100%;\n width: 10px;\n height: 10px;\n border-width: 1px;\n border-style: solid;\n margin: -5px 0 0 -5px;\n cursor: pointer;\n opacity: 0.85;\n border-color: ").concat(dt2("colorpicker.handle.color"), ";\n}\n\n.p-colorpicker-hue {\n width: 17px;\n height: 150px;\n top: 8px;\n left: 167px;\n position: absolute;\n opacity: 0.85;\n background: linear-gradient(0deg,\n red 0,\n #ff0 17%,\n #0f0 33%,\n #0ff 50%,\n #00f 67%,\n #f0f 83%,\n red);\n}\n\n.p-colorpicker-hue-handle {\n position: absolute;\n top: 150px;\n left: 0px;\n width: 21px;\n margin-left: -2px;\n margin-top: -5px;\n height: 10px;\n border-width: 2px;\n border-style: solid;\n opacity: 0.85;\n cursor: pointer;\n border-color: ").concat(dt2("colorpicker.handle.color"), ";\n}\n"); }, "theme"); -var classes$c = { +var classes$b = { root: "p-colorpicker p-component", preview: /* @__PURE__ */ __name(function preview(_ref2) { var props = _ref2.props; @@ -121950,12 +150265,12 @@ var classes$c = { }; var ColorPickerStyle = BaseStyle.extend({ name: "colorpicker", - theme: theme$c, - classes: classes$c + theme: theme$b, + classes: classes$b }); -var script$1$c = { +var script$1$b = { name: "BaseColorPicker", - "extends": script$_, + "extends": script$11, props: { modelValue: { type: null, @@ -122000,19 +150315,19 @@ var script$1$c = { panelClass: null }, style: ColorPickerStyle, - provide: /* @__PURE__ */ __name(function provide29() { + provide: /* @__PURE__ */ __name(function provide32() { return { $pcColorPicker: this, $parentInstance: this }; }, "provide") }; -var script$j = { +var script$h = { name: "ColorPicker", - "extends": script$1$c, + "extends": script$1$b, inheritAttrs: false, emits: ["update:modelValue", "change", "show", "hide"], - data: /* @__PURE__ */ __name(function data13() { + data: /* @__PURE__ */ __name(function data15() { return { overlayVisible: false }; @@ -122054,7 +150369,7 @@ var script$j = { } this.clearRefs(); }, "beforeUnmount"), - mounted: /* @__PURE__ */ __name(function mounted13() { + mounted: /* @__PURE__ */ __name(function mounted15() { this.updateUI(); }, "mounted"), methods: { @@ -122155,12 +150470,12 @@ var script$j = { validateHEX: /* @__PURE__ */ __name(function validateHEX(hex) { var len = 6 - hex.length; if (len > 0) { - var o = []; + var o2 = []; for (var i2 = 0; i2 < len; i2++) { - o.push("0"); + o2.push("0"); } - o.push(hex); - hex = o.join(""); + o2.push(hex); + hex = o2.join(""); } return hex; }, "validateHEX"), @@ -122212,9 +150527,9 @@ var script$j = { b: null }; var h2 = Math.round(hsb.h); - var s = Math.round(hsb.s * 255 / 100); + var s2 = Math.round(hsb.s * 255 / 100); var v2 = Math.round(hsb.b * 255 / 100); - if (s === 0) { + if (s2 === 0) { rgb = { r: v2, g: v2, @@ -122222,7 +150537,7 @@ var script$j = { }; } else { var t1 = v2; - var t2 = (255 - s) * v2 / 255; + var t2 = (255 - s2) * v2 / 255; var t3 = (t1 - t2) * (h2 % 60) / 60; if (h2 === 360) h2 = 0; if (h2 < 60) { @@ -122501,11 +150816,11 @@ var script$j = { }, "onOverlayClick") }, components: { - Portal: script$Q + Portal: script$T } }; -var _hoisted_1$J = ["id", "tabindex", "disabled"]; -function render$i(_ctx, _cache, $props, $setup, $data, $options) { +var _hoisted_1$H = ["id", "tabindex", "disabled"]; +function render$g(_ctx, _cache, $props, $setup, $data, $options) { var _component_Portal = resolveComponent("Portal"); return openBlock(), createElementBlock("div", mergeProps({ ref: "container", @@ -122525,7 +150840,7 @@ function render$i(_ctx, _cache, $props, $setup, $data, $options) { onKeydown: _cache[1] || (_cache[1] = function() { return $options.onInputKeydown && $options.onInputKeydown.apply($options, arguments); }) - }, _ctx.ptm("preview")), null, 16, _hoisted_1$J)) : createCommentVNode("", true), createVNode(_component_Portal, { + }, _ctx.ptm("preview")), null, 16, _hoisted_1$H)) : createCommentVNode("", true), createVNode(_component_Portal, { appendTo: _ctx.appendTo, disabled: _ctx.inline }, { @@ -122592,10 +150907,10 @@ function render$i(_ctx, _cache, $props, $setup, $data, $options) { _: 1 }, 8, ["appendTo", "disabled"])], 16); } -__name(render$i, "render$i"); -script$j.render = render$i; -const _hoisted_1$I = { class: "color-picker-wrapper flex items-center gap-2" }; -const _hoisted_2$w = { class: "flex items-center justify-between p-2" }; +__name(render$g, "render$g"); +script$h.render = render$g; +const _hoisted_1$G = { class: "color-picker-wrapper flex items-center gap-2" }; +const _hoisted_2$u = { class: "flex items-center justify-between p-2" }; const _sfc_main$E = /* @__PURE__ */ defineComponent({ __name: "FormColorPicker", props: /* @__PURE__ */ mergeModels({ @@ -122613,15 +150928,15 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({ modelValue3.value = props.defaultValue || "#000000"; }, "resetColor"); return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1$I, [ - createVNode(unref(script$j), { + return openBlock(), createElementBlock("div", _hoisted_1$G, [ + createVNode(unref(script$h), { modelValue: modelValue3.value, "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue3.value = $event) }, { header: withCtx(() => [ - createBaseVNode("div", _hoisted_2$w, [ + createBaseVNode("div", _hoisted_2$u, [ createBaseVNode("span", null, toDisplayString$1(props.label), 1), - props.defaultValue ? (openBlock(), createBlock(unref(script$R), { + props.defaultValue ? (openBlock(), createBlock(unref(script$U), { key: 0, icon: "pi pi-refresh", text: "", @@ -122632,7 +150947,7 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({ ]), _: 1 }, 8, ["modelValue"]), - createVNode(unref(script$G), { + createVNode(unref(script$O), { modelValue: modelValue3.value, "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => modelValue3.value = $event), class: "w-28", @@ -122642,8 +150957,8 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({ }; } }); -const _hoisted_1$H = { class: "image-upload-wrapper" }; -const _hoisted_2$v = { class: "flex gap-2 items-center" }; +const _hoisted_1$F = { class: "image-upload-wrapper" }; +const _hoisted_2$t = { class: "flex gap-2 items-center" }; const _hoisted_3$h = ["src"]; const _hoisted_4$c = { key: 1, @@ -122681,8 +150996,8 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({ } }, "clearImage"); return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1$H, [ - createBaseVNode("div", _hoisted_2$v, [ + return openBlock(), createElementBlock("div", _hoisted_1$F, [ + createBaseVNode("div", _hoisted_2$t, [ createBaseVNode("div", { class: normalizeClass(["preview-box border rounded p-2 w-16 h-16 flex items-center justify-center", { "bg-gray-100 dark:bg-gray-800": !_ctx.modelValue }]) }, [ @@ -122693,13 +151008,13 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({ }, null, 8, _hoisted_3$h)) : (openBlock(), createElementBlock("i", _hoisted_4$c)) ], 2), createBaseVNode("div", _hoisted_5$9, [ - createVNode(unref(script$R), { + createVNode(unref(script$U), { icon: "pi pi-upload", label: _ctx.$t("g.upload"), size: "small", onClick: triggerFileInput }, null, 8, ["label"]), - _ctx.modelValue ? (openBlock(), createBlock(unref(script$R), { + _ctx.modelValue ? (openBlock(), createBlock(unref(script$U), { key: 0, class: "w-full", outlined: "", @@ -122722,7 +151037,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({ }; } }); -var theme$b = /* @__PURE__ */ __name(function theme28(_ref) { +var theme$a = /* @__PURE__ */ __name(function theme31(_ref) { var dt2 = _ref.dt; return "\n.p-slider {\n position: relative;\n background: ".concat(dt2("slider.track.background"), ";\n border-radius: ").concat(dt2("slider.border.radius"), ";\n}\n\n.p-slider-handle {\n cursor: grab;\n touch-action: none;\n display: flex;\n justify-content: center;\n align-items: center;\n height: ").concat(dt2("slider.handle.height"), ";\n width: ").concat(dt2("slider.handle.width"), ";\n background: ").concat(dt2("slider.handle.background"), ";\n border-radius: ").concat(dt2("slider.handle.border.radius"), ";\n transition: background ").concat(dt2("slider.transition.duration"), ", color ").concat(dt2("slider.transition.duration"), ", border-color ").concat(dt2("slider.transition.duration"), ", box-shadow ").concat(dt2("slider.transition.duration"), ", outline-color ").concat(dt2("slider.transition.duration"), ';\n outline-color: transparent;\n}\n\n.p-slider-handle::before {\n content: "";\n width: ').concat(dt2("slider.handle.content.width"), ";\n height: ").concat(dt2("slider.handle.content.height"), ";\n display: block;\n background: ").concat(dt2("slider.handle.content.background"), ";\n border-radius: ").concat(dt2("slider.handle.content.border.radius"), ";\n box-shadow: ").concat(dt2("slider.handle.content.shadow"), ";\n transition: background ").concat(dt2("slider.transition.duration"), ";\n}\n\n.p-slider:not(.p-disabled) .p-slider-handle:hover {\n background: ").concat(dt2("slider.handle.hover.background"), ";\n}\n\n.p-slider:not(.p-disabled) .p-slider-handle:hover::before {\n background: ").concat(dt2("slider.handle.content.hover.background"), ";\n}\n\n.p-slider-handle:focus-visible {\n border-color: ").concat(dt2("slider.handle.focus.border.color"), ";\n box-shadow: ").concat(dt2("slider.handle.focus.ring.shadow"), ";\n outline: ").concat(dt2("slider.handle.focus.ring.width"), " ").concat(dt2("slider.handle.focus.ring.style"), " ").concat(dt2("slider.handle.focus.ring.color"), ";\n outline-offset: ").concat(dt2("slider.handle.focus.ring.offset"), ";\n}\n\n.p-slider-range {\n display: block;\n background: ").concat(dt2("slider.range.background"), ";\n border-radius: ").concat(dt2("slider.border.radius"), ";\n}\n\n.p-slider.p-slider-horizontal {\n height: ").concat(dt2("slider.track.size"), ";\n}\n\n.p-slider-horizontal .p-slider-range {\n top: 0;\n left: 0;\n height: 100%;\n}\n\n.p-slider-horizontal .p-slider-handle {\n top: 50%;\n margin-top: calc(-1 * calc(").concat(dt2("slider.handle.height"), " / 2));\n margin-left: calc(-1 * calc(").concat(dt2("slider.handle.width"), " / 2));\n}\n\n.p-slider-vertical {\n min-height: 100px;\n width: ").concat(dt2("slider.track.size"), ";\n}\n\n.p-slider-vertical .p-slider-handle {\n left: 50%;\n margin-left: calc(-1 * calc(").concat(dt2("slider.handle.width"), " / 2));\n margin-bottom: calc(-1 * calc(").concat(dt2("slider.handle.height"), " / 2));\n}\n\n.p-slider-vertical .p-slider-range {\n bottom: 0;\n left: 0;\n width: 100%;\n}\n"); }, "theme"); @@ -122734,8 +151049,8 @@ var inlineStyles = { position: "absolute" } }; -var classes$b = { - root: /* @__PURE__ */ __name(function root17(_ref2) { +var classes$a = { + root: /* @__PURE__ */ __name(function root21(_ref2) { var props = _ref2.props; return ["p-slider p-component", { "p-disabled": props.disabled, @@ -122748,13 +151063,13 @@ var classes$b = { }; var SliderStyle = BaseStyle.extend({ name: "slider", - theme: theme$b, - classes: classes$b, + theme: theme$a, + classes: classes$a, inlineStyles }); -var script$1$b = { +var script$1$a = { name: "BaseSlider", - "extends": script$_, + "extends": script$11, props: { modelValue: [Number, Array], min: { @@ -122795,46 +151110,46 @@ var script$1$b = { } }, style: SliderStyle, - provide: /* @__PURE__ */ __name(function provide30() { + provide: /* @__PURE__ */ __name(function provide33() { return { $pcSlider: this, $parentInstance: this }; }, "provide") }; -function _toConsumableArray$7(r) { - return _arrayWithoutHoles$7(r) || _iterableToArray$7(r) || _unsupportedIterableToArray$9(r) || _nonIterableSpread$7(); +function _toConsumableArray$6(r2) { + return _arrayWithoutHoles$6(r2) || _iterableToArray$6(r2) || _unsupportedIterableToArray$8(r2) || _nonIterableSpread$6(); } -__name(_toConsumableArray$7, "_toConsumableArray$7"); -function _nonIterableSpread$7() { +__name(_toConsumableArray$6, "_toConsumableArray$6"); +function _nonIterableSpread$6() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -__name(_nonIterableSpread$7, "_nonIterableSpread$7"); -function _unsupportedIterableToArray$9(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray$9(r, a); - var t2 = {}.toString.call(r).slice(8, -1); - return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$9(r, a) : void 0; +__name(_nonIterableSpread$6, "_nonIterableSpread$6"); +function _unsupportedIterableToArray$8(r2, a2) { + if (r2) { + if ("string" == typeof r2) return _arrayLikeToArray$8(r2, a2); + var t2 = {}.toString.call(r2).slice(8, -1); + return "Object" === t2 && r2.constructor && (t2 = r2.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r2) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$8(r2, a2) : void 0; } } -__name(_unsupportedIterableToArray$9, "_unsupportedIterableToArray$9"); -function _iterableToArray$7(r) { - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); +__name(_unsupportedIterableToArray$8, "_unsupportedIterableToArray$8"); +function _iterableToArray$6(r2) { + if ("undefined" != typeof Symbol && null != r2[Symbol.iterator] || null != r2["@@iterator"]) return Array.from(r2); } -__name(_iterableToArray$7, "_iterableToArray$7"); -function _arrayWithoutHoles$7(r) { - if (Array.isArray(r)) return _arrayLikeToArray$9(r); +__name(_iterableToArray$6, "_iterableToArray$6"); +function _arrayWithoutHoles$6(r2) { + if (Array.isArray(r2)) return _arrayLikeToArray$8(r2); } -__name(_arrayWithoutHoles$7, "_arrayWithoutHoles$7"); -function _arrayLikeToArray$9(r, a) { - (null == a || a > r.length) && (a = r.length); - for (var e2 = 0, n = Array(a); e2 < a; e2++) n[e2] = r[e2]; - return n; +__name(_arrayWithoutHoles$6, "_arrayWithoutHoles$6"); +function _arrayLikeToArray$8(r2, a2) { + (null == a2 || a2 > r2.length) && (a2 = r2.length); + for (var e2 = 0, n2 = Array(a2); e2 < a2; e2++) n2[e2] = r2[e2]; + return n2; } -__name(_arrayLikeToArray$9, "_arrayLikeToArray$9"); -var script$i = { +__name(_arrayLikeToArray$8, "_arrayLikeToArray$8"); +var script$g = { name: "Slider", - "extends": script$1$b, + "extends": script$1$a, inheritAttrs: false, emits: ["update:modelValue", "change", "slideend"], dragging: false, @@ -122877,7 +151192,7 @@ var script$i = { var newValue2 = parseFloat(value4.toFixed(10)); var modelValue3; if (this.range) { - modelValue3 = this.value ? _toConsumableArray$7(this.value) : []; + modelValue3 = this.value ? _toConsumableArray$6(this.value) : []; if (this.handleIndex == 0) { if (newValue2 < this.min) newValue2 = this.min; else if (newValue2 >= this.max) newValue2 = this.max; @@ -122939,7 +151254,7 @@ var script$i = { this.bindDragListeners(); this.onDragStart(event, index2); }, "onMouseDown"), - onKeyDown: /* @__PURE__ */ __name(function onKeyDown5(event, index2) { + onKeyDown: /* @__PURE__ */ __name(function onKeyDown6(event, index2) { this.handleIndex = index2; switch (event.code) { case "ArrowDown": @@ -123094,10 +151409,10 @@ var script$i = { }, "rangeEndHandleStyle") } }; -var _hoisted_1$G = ["tabindex", "aria-valuemin", "aria-valuenow", "aria-valuemax", "aria-labelledby", "aria-label", "aria-orientation"]; -var _hoisted_2$u = ["tabindex", "aria-valuemin", "aria-valuenow", "aria-valuemax", "aria-labelledby", "aria-label", "aria-orientation"]; +var _hoisted_1$E = ["tabindex", "aria-valuemin", "aria-valuenow", "aria-valuemax", "aria-labelledby", "aria-label", "aria-orientation"]; +var _hoisted_2$s = ["tabindex", "aria-valuemin", "aria-valuenow", "aria-valuemax", "aria-labelledby", "aria-label", "aria-orientation"]; var _hoisted_3$g = ["tabindex", "aria-valuemin", "aria-valuenow", "aria-valuemax", "aria-labelledby", "aria-label", "aria-orientation"]; -function render$h(_ctx, _cache, $props, $setup, $data, $options) { +function render$f(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("div", mergeProps({ "class": _ctx.cx("root"), onClick: _cache[15] || (_cache[15] = function() { @@ -123135,7 +151450,7 @@ function render$h(_ctx, _cache, $props, $setup, $data, $options) { "aria-labelledby": _ctx.ariaLabelledby, "aria-label": _ctx.ariaLabel, "aria-orientation": _ctx.orientation - }, _ctx.ptm("handle")), null, 16, _hoisted_1$G)) : createCommentVNode("", true), _ctx.range ? (openBlock(), createElementBlock("span", mergeProps({ + }, _ctx.ptm("handle")), null, 16, _hoisted_1$E)) : createCommentVNode("", true), _ctx.range ? (openBlock(), createElementBlock("span", mergeProps({ key: 1, "class": _ctx.cx("handle"), style: [_ctx.sx("handle"), $options.rangeStartHandleStyle], @@ -123162,7 +151477,7 @@ function render$h(_ctx, _cache, $props, $setup, $data, $options) { "aria-labelledby": _ctx.ariaLabelledby, "aria-label": _ctx.ariaLabel, "aria-orientation": _ctx.orientation - }, _ctx.ptm("startHandler")), null, 16, _hoisted_2$u)) : createCommentVNode("", true), _ctx.range ? (openBlock(), createElementBlock("span", mergeProps({ + }, _ctx.ptm("startHandler")), null, 16, _hoisted_2$s)) : createCommentVNode("", true), _ctx.range ? (openBlock(), createElementBlock("span", mergeProps({ key: 2, "class": _ctx.cx("handle"), style: [_ctx.sx("handle"), $options.rangeEndHandleStyle], @@ -123191,9 +151506,9 @@ function render$h(_ctx, _cache, $props, $setup, $data, $options) { "aria-orientation": _ctx.orientation }, _ctx.ptm("endHandler")), null, 16, _hoisted_3$g)) : createCommentVNode("", true)], 16); } -__name(render$h, "render$h"); -script$i.render = render$h; -const _hoisted_1$F = { class: "input-slider flex flex-row items-center gap-2" }; +__name(render$f, "render$f"); +script$g.render = render$f; +const _hoisted_1$D = { class: "input-slider flex flex-row items-center gap-2" }; const _sfc_main$C = /* @__PURE__ */ defineComponent({ __name: "InputSlider", props: { @@ -123228,8 +151543,8 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({ emit2("update:modelValue", newValue2); }, "updateValue"); return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1$F, [ - createVNode(unref(script$i), { + return openBlock(), createElementBlock("div", _hoisted_1$D, [ + createVNode(unref(script$g), { modelValue: _ctx.modelValue, "onUpdate:modelValue": updateValue3, class: normalizeClass(["slider-part", _ctx.sliderClass]), @@ -123237,7 +151552,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({ max: _ctx.max, step: _ctx.step }, null, 8, ["modelValue", "class", "min", "max", "step"]), - createVNode(unref(script$l), { + createVNode(unref(script$j), { modelValue: _ctx.modelValue, "onUpdate:modelValue": updateValue3, class: normalizeClass(["input-part", _ctx.inputClass]), @@ -123251,9 +151566,9 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({ }; } }); -const _withScopeId$i = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-e4e3022d"), n = n(), popScopeId(), n), "_withScopeId$i"); -const _hoisted_1$E = { class: "flex flex-row items-center gap-2" }; -const _hoisted_2$t = { class: "form-label flex flex-grow items-center" }; +const _withScopeId$i = /* @__PURE__ */ __name((n2) => (pushScopeId("data-v-e4e3022d"), n2 = n2(), popScopeId(), n2), "_withScopeId$i"); +const _hoisted_1$C = { class: "flex flex-row items-center gap-2" }; +const _hoisted_2$r = { class: "form-label flex flex-grow items-center" }; const _hoisted_3$f = { key: 0, class: "pi pi-info-circle bg-transparent" @@ -123306,26 +151621,26 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({ } switch (item3.type) { case "boolean": - return script$k; + return script$i; case "number": - return script$l; + return script$j; case "slider": return _sfc_main$C; case "combo": - return script$o; + return script$m; case "image": return _sfc_main$D; case "color": return _sfc_main$E; default: - return script$G; + return script$O; } } __name(getFormComponent, "getFormComponent"); return (_ctx, _cache) => { const _directive_tooltip = resolveDirective("tooltip"); - return openBlock(), createElementBlock("div", _hoisted_1$E, [ - createBaseVNode("div", _hoisted_2$t, [ + return openBlock(), createElementBlock("div", _hoisted_1$C, [ + createBaseVNode("div", _hoisted_2$r, [ createBaseVNode("span", { class: normalizeClass(["text-muted", props.labelClass]) }, [ @@ -123393,11 +151708,11 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({ "onUpdate:formValue": updateSettingValue }, { "name-prefix": withCtx(() => [ - _ctx.setting.experimental ? (openBlock(), createBlock(unref(script$x), { + _ctx.setting.experimental ? (openBlock(), createBlock(unref(script$v), { key: 0, value: _ctx.$t("g.experimental") }, null, 8, ["value"])) : createCommentVNode("", true), - _ctx.setting.deprecated ? (openBlock(), createBlock(unref(script$x), { + _ctx.setting.deprecated ? (openBlock(), createBlock(unref(script$v), { key: 1, value: _ctx.$t("g.deprecated"), severity: "danger" @@ -123408,7 +151723,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({ }; } }); -const _hoisted_1$D = { class: "setting-group" }; +const _hoisted_1$B = { class: "setting-group" }; const _sfc_main$z = /* @__PURE__ */ defineComponent({ __name: "SettingGroup", props: { @@ -123417,8 +151732,8 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({ }, setup(__props) { return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1$D, [ - _ctx.divider ? (openBlock(), createBlock(unref(script$O), { key: 0 })) : createCommentVNode("", true), + return openBlock(), createElementBlock("div", _hoisted_1$B, [ + _ctx.divider ? (openBlock(), createBlock(unref(script$R), { key: 0 })) : createCommentVNode("", true), createBaseVNode("h3", null, toDisplayString$1(_ctx.$t(`settingsCategories.${unref(normalizeI18nKey)(_ctx.group.label)}`, _ctx.group.label)), 1), (openBlock(true), createElementBlock(Fragment$1, null, renderList(_ctx.group.settings, (setting) => { return openBlock(), createElementBlock("div", { @@ -123432,7 +151747,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({ }; } }); -const _hoisted_1$C = { key: 0 }; +const _hoisted_1$A = { key: 0 }; const _sfc_main$y = /* @__PURE__ */ defineComponent({ __name: "SettingsPanel", props: { @@ -123441,7 +151756,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({ setup(__props) { const props = __props; return (_ctx, _cache) => { - return props.settingGroups.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_1$C, [ + return props.settingGroups.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_1$A, [ (openBlock(true), createElementBlock(Fragment$1, null, renderList(props.settingGroups, (group, i2) => { return openBlock(), createBlock(_sfc_main$z, { key: group.label, @@ -123458,9 +151773,9 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({ }; } }); -const _withScopeId$h = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-67f71ae9"), n = n(), popScopeId(), n), "_withScopeId$h"); -const _hoisted_1$B = { class: "settings-container" }; -const _hoisted_2$s = /* @__PURE__ */ _withScopeId$h(() => /* @__PURE__ */ createBaseVNode("div", null, "Loading keybinding panel...", -1)); +const _withScopeId$h = /* @__PURE__ */ __name((n2) => (pushScopeId("data-v-2e21278f"), n2 = n2(), popScopeId(), n2), "_withScopeId$h"); +const _hoisted_1$z = { class: "settings-container" }; +const _hoisted_2$q = /* @__PURE__ */ _withScopeId$h(() => /* @__PURE__ */ createBaseVNode("div", null, "Loading keybinding panel...", -1)); const _hoisted_3$e = /* @__PURE__ */ _withScopeId$h(() => /* @__PURE__ */ createBaseVNode("div", null, "Loading extension panel...", -1)); const _hoisted_4$a = /* @__PURE__ */ _withScopeId$h(() => /* @__PURE__ */ createBaseVNode("div", null, "Loading server config panel...", -1)); const _sfc_main$x = /* @__PURE__ */ defineComponent({ @@ -123471,13 +151786,13 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({ setup(__props) { const props = __props; const KeybindingPanel = /* @__PURE__ */ defineAsyncComponent( - () => __vitePreload(() => import("./KeybindingPanel-Dc3C4lG1.js"), true ? __vite__mapDeps([20,21,3,2,4,22]) : void 0, import.meta.url) + () => __vitePreload(() => import("./KeybindingPanel-D6O16W_1.js"), true ? __vite__mapDeps([20,21,1,2,22]) : void 0, import.meta.url) ); const ExtensionPanel = /* @__PURE__ */ defineAsyncComponent( - () => __vitePreload(() => import("./ExtensionPanel-D4Phn0Zr.js"), true ? __vite__mapDeps([23,21,3,2]) : void 0, import.meta.url) + () => __vitePreload(() => import("./ExtensionPanel-3jWrm6Zi.js"), true ? __vite__mapDeps([23,21,1]) : void 0, import.meta.url) ); const ServerConfigPanel = /* @__PURE__ */ defineAsyncComponent( - () => __vitePreload(() => import("./ServerConfigPanel-Be4StJmv.js"), true ? __vite__mapDeps([24,5]) : void 0, import.meta.url) + () => __vitePreload(() => import("./ServerConfigPanel-B-w0HFlz.js"), true ? __vite__mapDeps([24,3]) : void 0, import.meta.url) ); const aboutPanelNode = { key: "about", @@ -123531,7 +151846,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({ activeCategory.value = getDefaultCategory(); }); const sortedGroups = /* @__PURE__ */ __name((category) => { - return [...category.children ?? []].sort((a, b) => a.label.localeCompare(b.label)).map((group) => ({ + return [...category.children ?? []].sort((a2, b2) => a2.label.localeCompare(b2.label)).map((group) => ({ label: group.label, settings: flattenTree(group) })); @@ -123595,9 +151910,8 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({ searchInProgress.value = false; activeCategory.value = null; }, "handleSearch"); - const inSearch = computed( - () => searchQuery.value.length > 0 && !searchInProgress.value - ); + const queryIsEmpty = computed(() => searchQuery.value.length === 0); + const inSearch = computed(() => !queryIsEmpty.value && !searchInProgress.value); const tabValue = computed( () => inSearch.value ? "Search Results" : activeCategory.value?.label ); @@ -123607,43 +151921,44 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({ } }); return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1$B, [ - createVNode(unref(script$N), { class: "settings-sidebar flex-shrink-0 p-2 w-48 2xl:w-64" }, { + return openBlock(), createElementBlock("div", _hoisted_1$z, [ + createVNode(unref(script$Q), { class: "settings-sidebar flex-shrink-0 p-2 w-48 2xl:w-64" }, { default: withCtx(() => [ createVNode(SearchBox, { class: "settings-search-box w-full mb-2", modelValue: searchQuery.value, "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchQuery.value = $event), onSearch: handleSearch, - placeholder: _ctx.$t("g.searchSettings") + "..." + placeholder: _ctx.$t("g.searchSettings") + "...", + "debounce-time": 128 }, null, 8, ["modelValue", "placeholder"]), - createVNode(unref(script$E), { + createVNode(unref(script$C), { modelValue: activeCategory.value, "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => activeCategory.value = $event), options: categories.value, optionLabel: "translatedLabel", scrollHeight: "100%", - optionDisabled: /* @__PURE__ */ __name((option3) => inSearch.value && !searchResultsCategories.value.has(option3.label), "optionDisabled"), + optionDisabled: /* @__PURE__ */ __name((option3) => !queryIsEmpty.value && !searchResultsCategories.value.has(option3.label), "optionDisabled"), class: "border-none w-full" }, null, 8, ["modelValue", "options", "optionDisabled"]) ]), _: 1 }), - createVNode(unref(script$O), { + createVNode(unref(script$R), { layout: "vertical", class: "mx-1 2xl:mx-4 hidden md:flex" }), - createVNode(unref(script$O), { + createVNode(unref(script$R), { layout: "horizontal", class: "flex md:hidden" }), - createVNode(unref(script$A), { + createVNode(unref(script$y), { value: tabValue.value, lazy: true, class: "settings-content h-full w-full" }, { default: withCtx(() => [ - createVNode(unref(script$B), { class: "settings-tab-panels h-full w-full pr-0" }, { + createVNode(unref(script$z), { class: "settings-tab-panels h-full w-full pr-0" }, { default: withCtx(() => [ createVNode(_sfc_main$K, { value: "Search Results" }, { default: withCtx(() => [ @@ -123672,7 +151987,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({ createVNode(_sfc_main$J), (openBlock(), createBlock(Suspense, null, { fallback: withCtx(() => [ - _hoisted_2$s + _hoisted_2$q ]), default: withCtx(() => [ createVNode(unref(KeybindingPanel)) @@ -123707,47 +152022,47 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({ }; } }); -const SettingDialogContent = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["__scopeId", "data-v-67f71ae9"]]); +const SettingDialogContent = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["__scopeId", "data-v-2e21278f"]]); const _sfc_main$w = {}; -const _withScopeId$g = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-43089afc"), n = n(), popScopeId(), n), "_withScopeId$g"); -const _hoisted_1$A = { class: "px-4" }; -const _hoisted_2$r = /* @__PURE__ */ _withScopeId$g(() => /* @__PURE__ */ createBaseVNode("i", { class: "pi pi-cog" }, null, -1)); +const _withScopeId$g = /* @__PURE__ */ __name((n2) => (pushScopeId("data-v-43089afc"), n2 = n2(), popScopeId(), n2), "_withScopeId$g"); +const _hoisted_1$y = { class: "px-4" }; +const _hoisted_2$p = /* @__PURE__ */ _withScopeId$g(() => /* @__PURE__ */ createBaseVNode("i", { class: "pi pi-cog" }, null, -1)); function _sfc_render(_ctx, _cache) { return openBlock(), createElementBlock("div", null, [ - createBaseVNode("h2", _hoisted_1$A, [ - _hoisted_2$r, + createBaseVNode("h2", _hoisted_1$y, [ + _hoisted_2$p, createBaseVNode("span", null, toDisplayString$1(_ctx.$t("g.settings")), 1) ]) ]); } __name(_sfc_render, "_sfc_render"); const SettingDialogHeader = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["render", _sfc_render], ["__scopeId", "data-v-43089afc"]]); -var script$h = { +var script$f = { name: "ChevronUpIcon", - "extends": script$X + "extends": script$_ }; -var _hoisted_1$z = /* @__PURE__ */ createBaseVNode("path", { +var _hoisted_1$x = /* @__PURE__ */ createBaseVNode("path", { d: "M12.2097 10.4113C12.1057 10.4118 12.0027 10.3915 11.9067 10.3516C11.8107 10.3118 11.7237 10.2532 11.6506 10.1792L6.93602 5.46461L2.22139 10.1476C2.07272 10.244 1.89599 10.2877 1.71953 10.2717C1.54307 10.2556 1.3771 10.1808 1.24822 10.0593C1.11933 9.93766 1.035 9.77633 1.00874 9.6011C0.982477 9.42587 1.0158 9.2469 1.10338 9.09287L6.37701 3.81923C6.52533 3.6711 6.72639 3.58789 6.93602 3.58789C7.14565 3.58789 7.3467 3.6711 7.49502 3.81923L12.7687 9.09287C12.9168 9.24119 13 9.44225 13 9.65187C13 9.8615 12.9168 10.0626 12.7687 10.2109C12.616 10.3487 12.4151 10.4207 12.2097 10.4113Z", fill: "currentColor" }, null, -1); -var _hoisted_2$q = [_hoisted_1$z]; -function render$g(_ctx, _cache, $props, $setup, $data, $options) { +var _hoisted_2$o = [_hoisted_1$x]; +function render$e(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" - }, _ctx.pti()), _hoisted_2$q, 16); + }, _ctx.pti()), _hoisted_2$o, 16); } -__name(render$g, "render$g"); -script$h.render = render$g; -var theme$a = /* @__PURE__ */ __name(function theme29(_ref) { +__name(render$e, "render$e"); +script$f.render = render$e; +var theme$9 = /* @__PURE__ */ __name(function theme32(_ref) { var dt2 = _ref.dt; return "\n.p-carousel {\n display: flex;\n flex-direction: column;\n}\n\n.p-carousel-content-container {\n display: flex;\n flex-direction: column;\n overflow: auto;\n}\n\n.p-carousel-content {\n display: flex;\n flex-direction: row;\n gap: ".concat(dt2("carousel.content.gap"), ";\n}\n\n.p-carousel-viewport {\n overflow: hidden;\n width: 100%;\n}\n\n.p-carousel-item-list {\n display: flex;\n flex-direction: row;\n}\n\n.p-carousel-prev-button,\n.p-carousel-next-button {\n align-self: center;\n}\n\n.p-carousel-indicator-list {\n display: flex;\n flex-direction: row;\n justify-content: center;\n flex-wrap: wrap;\n padding: ").concat(dt2("carousel.indicator.list.padding"), ";\n gap: ").concat(dt2("carousel.indicator.list.gap"), ";\n margin: 0;\n list-style: none;\n}\n\n.p-carousel-indicator-button {\n display: flex;\n align-items: center;\n justify-content: center;\n background: ").concat(dt2("carousel.indicator.background"), ";\n width: ").concat(dt2("carousel.indicator.width"), ";\n height: ").concat(dt2("carousel.indicator.height"), ";\n border: 0 none;\n transition: background ").concat(dt2("carousel.transition.duration"), ", color ").concat(dt2("carousel.transition.duration"), ", outline-color ").concat(dt2("carousel.transition.duration"), ", box-shadow ").concat(dt2("carousel.transition.duration"), ";\n outline-color: transparent;\n border-radius: ").concat(dt2("carousel.indicator.border.radius"), ";\n padding: 0;\n margin: 0;\n user-select: none;\n cursor: pointer;\n}\n\n.p-carousel-indicator-button:focus-visible {\n box-shadow: ").concat(dt2("carousel.indicator.focus.ring.shadow"), ";\n outline: ").concat(dt2("carousel.indicator.focus.ring.width"), " ").concat(dt2("carousel.indicator.focus.ring.style"), " ").concat(dt2("carousel.indicator.focus.ring.color"), ";\n outline-offset: ").concat(dt2("carousel.indicator.focus.ring.offset"), ";\n}\n\n.p-carousel-indicator-button:hover {\n background: ").concat(dt2("carousel.indicator.hover.background"), ";\n}\n\n.p-carousel-indicator-active .p-carousel-indicator-button {\n background: ").concat(dt2("carousel.indicator.active.background"), ";\n}\n\n.p-carousel-vertical .p-carousel-content {\n flex-direction: column;\n}\n\n.p-carousel-vertical .p-carousel-item-list {\n flex-direction: column;\n height: 100%;\n}\n\n.p-items-hidden .p-carousel-item {\n visibility: hidden;\n}\n\n.p-items-hidden .p-carousel-item.p-carousel-item-active {\n visibility: visible;\n}\n"); }, "theme"); -var classes$a = { - root: /* @__PURE__ */ __name(function root18(_ref2) { +var classes$9 = { + root: /* @__PURE__ */ __name(function root22(_ref2) { var instance = _ref2.instance; return ["p-carousel p-component", { "p-carousel-vertical": instance.isVertical(), @@ -123799,12 +152114,12 @@ var classes$a = { }; var CarouselStyle = BaseStyle.extend({ name: "carousel", - theme: theme$a, - classes: classes$a + theme: theme$9, + classes: classes$9 }); -var script$1$a = { +var script$1$9 = { name: "BaseCarousel", - "extends": script$_, + "extends": script$11, props: { value: null, page: { @@ -123849,7 +152164,7 @@ var script$1$a = { }, prevButtonProps: { type: Object, - "default": /* @__PURE__ */ __name(function _default4() { + "default": /* @__PURE__ */ __name(function _default5() { return { severity: "secondary", text: true, @@ -123859,7 +152174,7 @@ var script$1$a = { }, nextButtonProps: { type: Object, - "default": /* @__PURE__ */ __name(function _default5() { + "default": /* @__PURE__ */ __name(function _default6() { return { severity: "secondary", text: true, @@ -123869,50 +152184,50 @@ var script$1$a = { } }, style: CarouselStyle, - provide: /* @__PURE__ */ __name(function provide31() { + provide: /* @__PURE__ */ __name(function provide34() { return { $pcCarousel: this, $parentInstance: this }; }, "provide") }; -function _toConsumableArray$6(r) { - return _arrayWithoutHoles$6(r) || _iterableToArray$6(r) || _unsupportedIterableToArray$8(r) || _nonIterableSpread$6(); +function _toConsumableArray$5(r2) { + return _arrayWithoutHoles$5(r2) || _iterableToArray$5(r2) || _unsupportedIterableToArray$7(r2) || _nonIterableSpread$5(); } -__name(_toConsumableArray$6, "_toConsumableArray$6"); -function _nonIterableSpread$6() { +__name(_toConsumableArray$5, "_toConsumableArray$5"); +function _nonIterableSpread$5() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -__name(_nonIterableSpread$6, "_nonIterableSpread$6"); -function _unsupportedIterableToArray$8(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray$8(r, a); - var t2 = {}.toString.call(r).slice(8, -1); - return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$8(r, a) : void 0; +__name(_nonIterableSpread$5, "_nonIterableSpread$5"); +function _unsupportedIterableToArray$7(r2, a2) { + if (r2) { + if ("string" == typeof r2) return _arrayLikeToArray$7(r2, a2); + var t2 = {}.toString.call(r2).slice(8, -1); + return "Object" === t2 && r2.constructor && (t2 = r2.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r2) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$7(r2, a2) : void 0; } } -__name(_unsupportedIterableToArray$8, "_unsupportedIterableToArray$8"); -function _iterableToArray$6(r) { - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); +__name(_unsupportedIterableToArray$7, "_unsupportedIterableToArray$7"); +function _iterableToArray$5(r2) { + if ("undefined" != typeof Symbol && null != r2[Symbol.iterator] || null != r2["@@iterator"]) return Array.from(r2); } -__name(_iterableToArray$6, "_iterableToArray$6"); -function _arrayWithoutHoles$6(r) { - if (Array.isArray(r)) return _arrayLikeToArray$8(r); +__name(_iterableToArray$5, "_iterableToArray$5"); +function _arrayWithoutHoles$5(r2) { + if (Array.isArray(r2)) return _arrayLikeToArray$7(r2); } -__name(_arrayWithoutHoles$6, "_arrayWithoutHoles$6"); -function _arrayLikeToArray$8(r, a) { - (null == a || a > r.length) && (a = r.length); - for (var e2 = 0, n = Array(a); e2 < a; e2++) n[e2] = r[e2]; - return n; +__name(_arrayWithoutHoles$5, "_arrayWithoutHoles$5"); +function _arrayLikeToArray$7(r2, a2) { + (null == a2 || a2 > r2.length) && (a2 = r2.length); + for (var e2 = 0, n2 = Array(a2); e2 < a2; e2++) n2[e2] = r2[e2]; + return n2; } -__name(_arrayLikeToArray$8, "_arrayLikeToArray$8"); -var script$g = { +__name(_arrayLikeToArray$7, "_arrayLikeToArray$7"); +var script$e = { name: "Carousel", - "extends": script$1$a, + "extends": script$1$9, inheritAttrs: false, emits: ["update:page"], isRemainingItemsAdded: false, - data: /* @__PURE__ */ __name(function data14() { + data: /* @__PURE__ */ __name(function data16() { return { remainingItems: 0, d_numVisible: this.numVisible, @@ -123951,7 +152266,7 @@ var script$g = { this.d_oldValue = oldValue2; }, "value") }, - mounted: /* @__PURE__ */ __name(function mounted14() { + mounted: /* @__PURE__ */ __name(function mounted16() { var stateChanged = false; this.$el.setAttribute(this.attributeSelector, ""); this.createStyle(); @@ -123978,7 +152293,7 @@ var script$g = { this.startAutoplay(); } }, "mounted"), - updated: /* @__PURE__ */ __name(function updated9() { + updated: /* @__PURE__ */ __name(function updated10() { if (!this.empty) { var isCircular2 = this.isCircular(); var stateChanged = false; @@ -124219,7 +152534,7 @@ var script$g = { } }, "onIndicatorKeydown"), onRightKey: /* @__PURE__ */ __name(function onRightKey() { - var indicators = _toConsumableArray$6(find$1(this.$refs.indicatorContent, '[data-pc-section="indicator"]')); + var indicators = _toConsumableArray$5(find$1(this.$refs.indicatorContent, '[data-pc-section="indicator"]')); var activeIndex3 = this.findFocusedIndicatorIndex(); this.changedFocusedIndicator(activeIndex3, activeIndex3 + 1 === indicators.length ? indicators.length - 1 : activeIndex3 + 1); }, "onRightKey"), @@ -124232,12 +152547,12 @@ var script$g = { this.changedFocusedIndicator(activeIndex3, 0); }, "onHomeKey"), onEndKey: /* @__PURE__ */ __name(function onEndKey3() { - var indicators = _toConsumableArray$6(find$1(this.$refs.indicatorContent, '[data-pc-section="indicator"]')); + var indicators = _toConsumableArray$5(find$1(this.$refs.indicatorContent, '[data-pc-section="indicator"]')); var activeIndex3 = this.findFocusedIndicatorIndex(); this.changedFocusedIndicator(activeIndex3, indicators.length - 1); }, "onEndKey"), onTabKey: /* @__PURE__ */ __name(function onTabKey2() { - var indicators = _toConsumableArray$6(find$1(this.$refs.indicatorContent, '[data-pc-section="indicator"]')); + var indicators = _toConsumableArray$5(find$1(this.$refs.indicatorContent, '[data-pc-section="indicator"]')); var highlightedIndex = indicators.findIndex(function(ind) { return getAttribute(ind, "data-p-active") === true; }); @@ -124249,14 +152564,14 @@ var script$g = { indicators[highlightedIndex].children[0].tabIndex = "0"; }, "onTabKey"), findFocusedIndicatorIndex: /* @__PURE__ */ __name(function findFocusedIndicatorIndex() { - var indicators = _toConsumableArray$6(find$1(this.$refs.indicatorContent, '[data-pc-section="indicator"]')); + var indicators = _toConsumableArray$5(find$1(this.$refs.indicatorContent, '[data-pc-section="indicator"]')); var activeIndicator = findSingle(this.$refs.indicatorContent, '[data-pc-section="indicator"] > button[tabindex="0"]'); return indicators.findIndex(function(ind) { return ind === activeIndicator.parentElement; }); }, "findFocusedIndicatorIndex"), changedFocusedIndicator: /* @__PURE__ */ __name(function changedFocusedIndicator(prevInd, nextInd) { - var indicators = _toConsumableArray$6(find$1(this.$refs.indicatorContent, '[data-pc-section="indicator"]')); + var indicators = _toConsumableArray$5(find$1(this.$refs.indicatorContent, '[data-pc-section="indicator"]')); indicators[prevInd].children[0].tabIndex = "-1"; indicators[nextInd].children[0].tabIndex = "0"; indicators[nextInd].children[0].focus(); @@ -124301,11 +152616,11 @@ var script$g = { } var innerHTML = "\n .p-carousel[".concat(this.attributeSelector, "] .p-carousel-item {\n flex: 1 0 ").concat(100 / this.d_numVisible, "%\n }\n "); if (this.responsiveOptions && !this.isUnstyled) { - var _responsiveOptions = _toConsumableArray$6(this.responsiveOptions); + var _responsiveOptions = _toConsumableArray$5(this.responsiveOptions); var comparer = localeComparator(); - _responsiveOptions.sort(function(data1, data24) { + _responsiveOptions.sort(function(data1, data25) { var value1 = data1.breakpoint; - var value22 = data24.breakpoint; + var value22 = data25.breakpoint; return sort(value1, value22, -1, comparer); }); for (var i2 = 0; i2 < _responsiveOptions.length; i2++) { @@ -124368,22 +152683,22 @@ var script$g = { }, "emptyMessageText") }, components: { - Button: script$R, - ChevronRightIcon: script$u, - ChevronDownIcon: script$p, - ChevronLeftIcon: script$v, - ChevronUpIcon: script$h + Button: script$U, + ChevronRightIcon: script$s, + ChevronDownIcon: script$n, + ChevronLeftIcon: script$t, + ChevronUpIcon: script$f }, directives: { ripple: Ripple } }; -var _hoisted_1$y = ["aria-live"]; -var _hoisted_2$p = ["data-p-carousel-item-active", "data-p-carousel-item-start", "data-p-carousel-item-end"]; +var _hoisted_1$w = ["aria-live"]; +var _hoisted_2$n = ["data-p-carousel-item-active", "data-p-carousel-item-start", "data-p-carousel-item-end"]; var _hoisted_3$d = ["aria-hidden", "aria-label", "aria-roledescription", "data-p-carousel-item-active", "data-p-carousel-item-start", "data-p-carousel-item-end"]; var _hoisted_4$9 = ["data-p-active"]; var _hoisted_5$8 = ["tabindex", "aria-label", "aria-current", "onClick"]; -function render$f(_ctx, _cache, $props, $setup, $data, $options) { +function render$d(_ctx, _cache, $props, $setup, $data, $options) { var _component_Button = resolveComponent("Button"); return openBlock(), createElementBlock("div", mergeProps({ "class": _ctx.cx("root"), @@ -124455,7 +152770,7 @@ function render$f(_ctx, _cache, $props, $setup, $data, $options) { }), [renderSlot(_ctx.$slots, "item", { data: item3, index: index2 - })], 16, _hoisted_2$p); + })], 16, _hoisted_2$n); }), 128)) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment$1, null, renderList(_ctx.value, function(item3, index2) { return openBlock(), createElementBlock("div", mergeProps({ key: index2, @@ -124510,7 +152825,7 @@ function render$f(_ctx, _cache, $props, $setup, $data, $options) { })]; }), _: 3 - }, 16, ["class", "disabled", "aria-label", "unstyled", "onClick", "pt"])) : createCommentVNode("", true)], 16, _hoisted_1$y), $options.totalIndicators >= 0 && _ctx.showIndicators ? (openBlock(), createElementBlock("ul", mergeProps({ + }, 16, ["class", "disabled", "aria-label", "unstyled", "onClick", "pt"])) : createCommentVNode("", true)], 16, _hoisted_1$w), $options.totalIndicators >= 0 && _ctx.showIndicators ? (openBlock(), createElementBlock("ul", mergeProps({ key: 0, ref: "indicatorContent", "class": [_ctx.cx("indicatorList"), _ctx.indicatorsContentClass], @@ -124546,11 +152861,11 @@ function render$f(_ctx, _cache, $props, $setup, $data, $options) { "class": _ctx.cx("footer") }, _ctx.ptm("footer")), [renderSlot(_ctx.$slots, "footer")], 16)) : createCommentVNode("", true)], 16); } -__name(render$f, "render$f"); -script$g.render = render$f; -const _withScopeId$f = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-d65acb9a"), n = n(), popScopeId(), n), "_withScopeId$f"); -const _hoisted_1$x = { class: "flex items-center justify-center" }; -const _hoisted_2$o = { class: "relative overflow-hidden rounded-lg cursor-pointer w-64 h-64" }; +__name(render$d, "render$d"); +script$e.render = render$d; +const _withScopeId$f = /* @__PURE__ */ __name((n2) => (pushScopeId("data-v-ffc83afa"), n2 = n2(), popScopeId(), n2), "_withScopeId$f"); +const _hoisted_1$v = { class: "flex items-center justify-center" }; +const _hoisted_2$m = { class: "relative overflow-hidden rounded-t-lg cursor-pointer w-64 h-64" }; const _hoisted_3$c = ["src"]; const _hoisted_4$8 = { key: 1, @@ -124582,20 +152897,20 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({ const props = __props; const imageError = ref(false); return (_ctx, _cache) => { - return openBlock(), createBlock(unref(script$M), { + return openBlock(), createBlock(unref(script$P), { "data-testid": `template-workflow-${props.workflowName}` }, { header: withCtx(() => [ - createBaseVNode("div", _hoisted_1$x, [ - createBaseVNode("div", _hoisted_2$o, [ + createBaseVNode("div", _hoisted_1$v, [ + createBaseVNode("div", _hoisted_2$m, [ !imageError.value ? (openBlock(), createElementBlock("img", { key: 0, src: props.moduleName === "default" ? `templates/${props.workflowName}.jpg` : `api/workflow_templates/${props.moduleName}/${props.workflowName}.jpg`, onError: _cache[0] || (_cache[0] = ($event) => imageError.value = true), - class: "w-64 h-64 rounded-lg object-cover thumbnail" + class: "w-64 h-64 rounded-t-lg object-cover thumbnail" }, null, 40, _hoisted_3$c)) : (openBlock(), createElementBlock("div", _hoisted_4$8, _hoisted_6$6)), _hoisted_7$4, - _ctx.loading ? (openBlock(), createBlock(unref(script$Y), { + _ctx.loading ? (openBlock(), createBlock(unref(script$$), { key: 2, class: "absolute inset-0 z-1 w-3/12 h-full" })) : createCommentVNode("", true) @@ -124617,7 +152932,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({ }; } }); -const TemplateWorkflowCard = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__scopeId", "data-v-d65acb9a"]]); +const TemplateWorkflowCard = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__scopeId", "data-v-ffc83afa"]]); const useWorkflowTemplatesStore = /* @__PURE__ */ defineStore( "workflowTemplates", () => { @@ -124641,12 +152956,12 @@ const useWorkflowTemplatesStore = /* @__PURE__ */ defineStore( }; } ); -const _withScopeId$e = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-fc26284b"), n = n(), popScopeId(), n), "_withScopeId$e"); -const _hoisted_1$w = { +const _withScopeId$e = /* @__PURE__ */ __name((n2) => (pushScopeId("data-v-d9962275"), n2 = n2(), popScopeId(), n2), "_withScopeId$e"); +const _hoisted_1$u = { class: "flex h-96", "data-testid": "template-workflows-content" }; -const _hoisted_2$n = { class: "relative" }; +const _hoisted_2$l = { class: "relative" }; const _hoisted_3$b = ["onClick"]; const _sfc_main$u = /* @__PURE__ */ defineComponent({ __name: "TemplateWorkflowsContent", @@ -124699,14 +153014,14 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({ let json; if (selectedTab.value.moduleName === "default") { json = await fetch(api.fileURL(`/templates/${id3}.json`)).then( - (r) => r.json() + (r2) => r2.json() ); } else { json = await fetch( api.apiURL( `/workflow_templates/${selectedTab.value.moduleName}/${id3}.json` ) - ).then((r) => r.json()); + ).then((r2) => r2.json()); } useDialogStore().closeDialog(); const workflowName = selectedTab.value.moduleName === "default" ? t2(`templateWorkflows.template.${id3}`, id3) : id3; @@ -124714,13 +153029,13 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({ return false; }, "loadWorkflow"); return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1$w, [ - createBaseVNode("div", _hoisted_2$n, [ - !unref(workflowTemplatesStore).isLoaded ? (openBlock(), createBlock(unref(script$Y), { + return openBlock(), createElementBlock("div", _hoisted_1$u, [ + createBaseVNode("div", _hoisted_2$l, [ + !unref(workflowTemplatesStore).isLoaded ? (openBlock(), createBlock(unref(script$$), { key: 0, class: "absolute w-8 h-full inset-0" })) : createCommentVNode("", true), - createVNode(unref(script$E), { + createVNode(unref(script$C), { "model-value": selectedTab.value, "onUpdate:modelValue": handleTabSelection, options: tabs2.value, @@ -124730,7 +153045,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({ listStyle: "max-height:unset" }, null, 8, ["model-value", "options"]) ]), - (openBlock(), createBlock(unref(script$g), { + (openBlock(), createBlock(unref(script$e), { class: "carousel justify-center", value: selectedTab.value.templates, "responsive-options": responsiveOptions.value, @@ -124740,7 +153055,8 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({ }, { item: withCtx((slotProps) => [ createBaseVNode("div", { - onClick: /* @__PURE__ */ __name(($event) => loadWorkflow(slotProps.data), "onClick") + onClick: /* @__PURE__ */ __name(($event) => loadWorkflow(slotProps.data), "onClick"), + class: "p-2" }, [ createVNode(TemplateWorkflowCard, { moduleName: selectedTab.value.moduleName, @@ -124755,7 +153071,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({ }; } }); -const TemplateWorkflowsContent = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__scopeId", "data-v-fc26284b"]]); +const TemplateWorkflowsContent = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__scopeId", "data-v-d9962275"]]); const useDialogService = /* @__PURE__ */ __name(() => { const dialogStore = useDialogStore(); function showLoadWorkflowWarning(props) { @@ -124881,15 +153197,15 @@ class KeybindingImpl { } commandId; combo; - targetSelector; + targetElementId; constructor(obj) { this.commandId = obj.commandId; this.combo = new KeyComboImpl(obj.combo); - this.targetSelector = obj.targetSelector; + this.targetElementId = obj.targetElementId; } equals(other) { const raw = toRaw(other); - return raw instanceof KeybindingImpl ? this.commandId === raw.commandId && this.combo.equals(raw.combo) && this.targetSelector === raw.targetSelector : false; + return raw instanceof KeybindingImpl ? this.commandId === raw.commandId && this.combo.equals(raw.combo) && this.targetElementId === raw.targetElementId : false; } } class KeyComboImpl { @@ -124980,20 +153296,9 @@ const useKeybindingStore = /* @__PURE__ */ defineStore("keybinding", () => { return keybindingByKeyCombo.value[combo.serialize()]; } __name(getKeybinding, "getKeybinding"); - function createKeybindingsByCommandId(keybindings2) { - const result = {}; - for (const keybinding of keybindings2) { - if (!(keybinding.commandId in result)) { - result[keybinding.commandId] = []; - } - result[keybinding.commandId].push(keybinding); - } - return result; - } - __name(createKeybindingsByCommandId, "createKeybindingsByCommandId"); const keybindingsByCommandId = computed( () => { - return createKeybindingsByCommandId(keybindings.value); + return _.groupBy(keybindings.value, "commandId"); } ); function getKeybindingsByCommandId(commandId) { @@ -125001,7 +153306,7 @@ const useKeybindingStore = /* @__PURE__ */ defineStore("keybinding", () => { } __name(getKeybindingsByCommandId, "getKeybindingsByCommandId"); const defaultKeybindingsByCommandId = computed(() => { - return createKeybindingsByCommandId(Object.values(defaultKeybindings.value)); + return _.groupBy(Object.values(defaultKeybindings.value), "commandId"); }); function getKeybindingByCommandId(commandId) { return getKeybindingsByCommandId(commandId)[0]; @@ -125049,7 +153354,7 @@ const useKeybindingStore = /* @__PURE__ */ defineStore("keybinding", () => { addKeybinding(userUnsetKeybindings, keybinding, { existOk: false }); return; } - throw new Error(`Unknown keybinding: ${JSON.stringify(keybinding)}`); + console.warn(`Unset unknown keybinding: ${JSON.stringify(keybinding)}`); } __name(unsetKeybinding, "unsetKeybinding"); function updateKeybindingOnCommand(keybinding) { @@ -125146,10 +153451,10 @@ const useCommandStore = /* @__PURE__ */ defineStore("command", () => { return commandsById.value[command2]; }, "getCommand"); const { wrapWithErrorHandlingAsync } = useErrorHandling(); - const execute = /* @__PURE__ */ __name(async (commandId, errorHandler) => { + const execute = /* @__PURE__ */ __name(async (commandId, errorHandler2) => { const command2 = getCommand(commandId); if (command2) { - await wrapWithErrorHandlingAsync(command2.function, errorHandler)(); + await wrapWithErrorHandlingAsync(command2.function, errorHandler2)(); } else { throw new Error(`Command ${commandId} not found`); } @@ -125334,9 +153639,9 @@ OrderedMap.prototype = { // :: ((key: string, value: any)) // Call the given function for each key/value pair in the map, in // order. - forEach: /* @__PURE__ */ __name(function(f) { + forEach: /* @__PURE__ */ __name(function(f2) { for (var i2 = 0; i2 < this.content.length; i2 += 2) - f(this.content[i2], this.content[i2 + 1]); + f2(this.content[i2], this.content[i2 + 1]); }, "forEach"), // :: (union<Object, OrderedMap>) → OrderedMap // Create a new map by prepending the keys in this map that don't @@ -125385,11 +153690,11 @@ OrderedMap.from = function(value4) { if (value4) for (var prop2 in value4) content2.push(prop2, value4[prop2]); return new OrderedMap(content2); }; -function findDiffStart(a, b, pos2) { +function findDiffStart(a2, b2, pos2) { for (let i2 = 0; ; i2++) { - if (i2 == a.childCount || i2 == b.childCount) - return a.childCount == b.childCount ? null : pos2; - let childA = a.child(i2), childB = b.child(i2); + if (i2 == a2.childCount || i2 == b2.childCount) + return a2.childCount == b2.childCount ? null : pos2; + let childA = a2.child(i2), childB = b2.child(i2); if (childA == childB) { pos2 += childA.nodeSize; continue; @@ -125397,7 +153702,7 @@ function findDiffStart(a, b, pos2) { if (!childA.sameMarkup(childB)) return pos2; if (childA.isText && childA.text != childB.text) { - for (let j = 0; childA.text[j] == childB.text[j]; j++) + for (let j2 = 0; childA.text[j2] == childB.text[j2]; j2++) pos2++; return pos2; } @@ -125410,11 +153715,11 @@ function findDiffStart(a, b, pos2) { } } __name(findDiffStart, "findDiffStart"); -function findDiffEnd(a, b, posA, posB) { - for (let iA = a.childCount, iB = b.childCount; ; ) { +function findDiffEnd(a2, b2, posA, posB) { + for (let iA = a2.childCount, iB = b2.childCount; ; ) { if (iA == 0 || iB == 0) return iA == iB ? null : { a: posA, b: posB }; - let childA = a.child(--iA), childB = b.child(--iB), size2 = childA.nodeSize; + let childA = a2.child(--iA), childB = b2.child(--iB), size2 = childA.nodeSize; if (childA == childB) { posA -= size2; posB -= size2; @@ -125460,12 +153765,12 @@ class Fragment { positions (relative to start of this fragment). Doesn't descend into a node when the callback returns `false`. */ - nodesBetween(from2, to, f, nodeStart = 0, parent) { + nodesBetween(from2, to, f2, nodeStart = 0, parent) { for (let i2 = 0, pos2 = 0; pos2 < to; i2++) { let child = this.content[i2], end = pos2 + child.nodeSize; - if (end > from2 && f(child, nodeStart + pos2, parent || null, i2) !== false && child.content.size) { + if (end > from2 && f2(child, nodeStart + pos2, parent || null, i2) !== false && child.content.size) { let start2 = pos2 + 1; - child.nodesBetween(Math.max(0, from2 - start2), Math.min(child.content.size, to - start2), f, nodeStart + start2); + child.nodesBetween(Math.max(0, from2 - start2), Math.min(child.content.size, to - start2), f2, nodeStart + start2); } pos2 = end; } @@ -125475,8 +153780,8 @@ class Fragment { relative to the start of the fragment. The callback may return `false` to prevent traversal of a given node's children. */ - descendants(f) { - this.nodesBetween(0, this.size, f); + descendants(f2) { + this.nodesBetween(0, this.size, f2); } /** Extract the text between `from` and `to`. See the same method on @@ -125624,10 +153929,10 @@ class Fragment { Call `f` for every child node, passing the node, its offset into this parent node, and its index. */ - forEach(f) { + forEach(f2) { for (let i2 = 0, p2 = 0; i2 < this.content.length; i2++) { let child = this.content[i2]; - f(child, p2, i2); + f2(child, p2, i2); p2 += child.nodeSize; } } @@ -125685,7 +153990,7 @@ class Fragment { Create a JSON-serializeable representation of this fragment. */ toJSON() { - return this.content.length ? this.content.map((n) => n.toJSON()) : null; + return this.content.length ? this.content.map((n2) => n2.toJSON()) : null; } /** Deserialize a fragment from its JSON representation. @@ -125744,26 +154049,26 @@ function retIndex(index2, offset) { return found; } __name(retIndex, "retIndex"); -function compareDeep(a, b) { - if (a === b) +function compareDeep(a2, b2) { + if (a2 === b2) return true; - if (!(a && typeof a == "object") || !(b && typeof b == "object")) + if (!(a2 && typeof a2 == "object") || !(b2 && typeof b2 == "object")) return false; - let array = Array.isArray(a); - if (Array.isArray(b) != array) + let array = Array.isArray(a2); + if (Array.isArray(b2) != array) return false; if (array) { - if (a.length != b.length) + if (a2.length != b2.length) return false; - for (let i2 = 0; i2 < a.length; i2++) - if (!compareDeep(a[i2], b[i2])) + for (let i2 = 0; i2 < a2.length; i2++) + if (!compareDeep(a2[i2], b2[i2])) return false; } else { - for (let p2 in a) - if (!(p2 in b) || !compareDeep(a[p2], b[p2])) + for (let p2 in a2) + if (!(p2 in b2) || !compareDeep(a2[p2], b2[p2])) return false; - for (let p2 in b) - if (!(p2 in a)) + for (let p2 in b2) + if (!(p2 in a2)) return false; } return true; @@ -125868,13 +154173,13 @@ let Mark$1 = class Mark2 { /** Test whether two sets of marks are identical. */ - static sameSet(a, b) { - if (a == b) + static sameSet(a2, b2) { + if (a2 == b2) return true; - if (a.length != b.length) + if (a2.length != b2.length) return false; - for (let i2 = 0; i2 < a.length; i2++) - if (!a[i2].eq(b[i2])) + for (let i2 = 0; i2 < a2.length; i2++) + if (!a2[i2].eq(b2[i2])) return false; return true; } @@ -125888,7 +154193,7 @@ let Mark$1 = class Mark2 { if (marks instanceof Mark2) return [marks]; let copy2 = marks.slice(); - copy2.sort((a, b) => a.type.rank - b.type.rank); + copy2.sort((a2, b2) => a2.type.rank - b2.type.rank); return copy2; } }; @@ -125980,9 +154285,9 @@ class Slice { */ static maxOpen(fragment, openIsolating = true) { let openStart = 0, openEnd = 0; - for (let n = fragment.firstChild; n && !n.isLeaf && (openIsolating || !n.type.spec.isolating); n = n.firstChild) + for (let n2 = fragment.firstChild; n2 && !n2.isLeaf && (openIsolating || !n2.type.spec.isolating); n2 = n2.firstChild) openStart++; - for (let n = fragment.lastChild; n && !n.isLeaf && (openIsolating || !n.type.spec.isolating); n = n.lastChild) + for (let n2 = fragment.lastChild; n2 && !n2.isLeaf && (openIsolating || !n2.type.spec.isolating); n2 = n2.lastChild) openEnd++; return new Slice(fragment, openStart, openEnd); } @@ -126323,9 +154628,9 @@ class ResolvedPos { blockRange(other = this, pred) { if (other.pos < this.pos) return other.blockRange(this); - for (let d = this.depth - (this.parent.inlineContent || this.pos == other.pos ? 1 : 0); d >= 0; d--) - if (other.pos <= this.end(d) && (!pred || pred(this.node(d)))) - return new NodeRange(this, other, d); + for (let d2 = this.depth - (this.parent.inlineContent || this.pos == other.pos ? 1 : 0); d2 >= 0; d2--) + if (other.pos <= this.end(d2) && (!pred || pred(this.node(d2)))) + return new NodeRange(this, other, d2); return null; } /** @@ -126504,8 +154809,8 @@ let Node$2 = class Node2 { Call `f` for every child node, passing the node, its offset into this parent node, and its index. */ - forEach(f) { - this.content.forEach(f); + forEach(f2) { + this.content.forEach(f2); } /** Invoke a callback for all descendant nodes recursively between @@ -126517,15 +154822,15 @@ let Node$2 = class Node2 { recursed over. The last parameter can be used to specify a starting position to count from. */ - nodesBetween(from2, to, f, startPos = 0) { - this.content.nodesBetween(from2, to, f, startPos, this); + nodesBetween(from2, to, f2, startPos = 0) { + this.content.nodesBetween(from2, to, f2, startPos, this); } /** Call the given callback for every descendant node. Doesn't descend into a node when the callback returns `false`. */ - descendants(f) { - this.nodesBetween(0, this.content.size, f); + descendants(f2) { + this.nodesBetween(0, this.content.size, f2); } /** Concatenates all the text nodes found in this fragment and its @@ -126815,7 +155120,7 @@ let Node$2 = class Node2 { copy2 = mark2.addToSet(copy2); } if (!Mark$1.sameSet(copy2, this.marks)) - throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((m) => m.type.name)}`); + throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((m2) => m2.type.name)}`); this.content.forEach((node3) => node3.check()); } /** @@ -126830,7 +155135,7 @@ let Node$2 = class Node2 { if (this.content.size) obj.content = this.content.toJSON(); if (this.marks.length) - obj.marks = this.marks.map((n) => n.toJSON()); + obj.marks = this.marks.map((n2) => n2.toJSON()); return obj; } /** @@ -126981,8 +155286,8 @@ class ContentMatch { */ compatible(other) { for (let i2 = 0; i2 < this.next.length; i2++) - for (let j = 0; j < other.next.length; j++) - if (this.next[i2].type == other.next[j].type) + for (let j2 = 0; j2 < other.next.length; j2++) + if (this.next[i2].type == other.next[j2].type) return true; return false; } @@ -127062,28 +155367,28 @@ class ContentMatch { Get the _n_th outgoing edge from this node in the finite automaton that describes the content expression. */ - edge(n) { - if (n >= this.next.length) - throw new RangeError(`There's no ${n}th edge in this content match`); - return this.next[n]; + edge(n2) { + if (n2 >= this.next.length) + throw new RangeError(`There's no ${n2}th edge in this content match`); + return this.next[n2]; } /** @internal */ toString() { let seen2 = []; - function scan(m) { - seen2.push(m); - for (let i2 = 0; i2 < m.next.length; i2++) - if (seen2.indexOf(m.next[i2].next) == -1) - scan(m.next[i2].next); + function scan(m2) { + seen2.push(m2); + for (let i2 = 0; i2 < m2.next.length; i2++) + if (seen2.indexOf(m2.next[i2].next) == -1) + scan(m2.next[i2].next); } __name(scan, "scan"); scan(this); - return seen2.map((m, i2) => { - let out = i2 + (m.validEnd ? "*" : " ") + " "; - for (let i3 = 0; i3 < m.next.length; i3++) - out += (i3 ? ", " : "") + m.next[i3].type.name + "->" + seen2.indexOf(m.next[i3].next); + return seen2.map((m2, i2) => { + let out = i2 + (m2.validEnd ? "*" : " ") + " "; + for (let i3 = 0; i3 < m2.next.length; i3++) + out += (i3 ? ", " : "") + m2.next[i3].type.name + "->" + seen2.indexOf(m2.next[i3].next); return out; }).join("\n"); } @@ -127271,8 +155576,8 @@ function nfa(expr) { __name(compile2, "compile"); } __name(nfa, "nfa"); -function cmp(a, b) { - return b - a; +function cmp(a2, b2) { + return b2 - a2; } __name(cmp, "cmp"); function nullFrom(nfa2, node3) { @@ -127327,8 +155632,8 @@ __name(dfa, "dfa"); function checkForDeadEnds(match2, stream) { for (let i2 = 0, work = [match2]; i2 < work.length; i2++) { let state = work[i2], dead = !state.validEnd, nodes = []; - for (let j = 0; j < state.next.length; j++) { - let { type, next: next2 } = state.next[j]; + for (let j2 = 0; j2 < state.next.length; j2++) { + let { type, next: next2 } = state.next[j2]; nodes.push(type.name); if (dead && !(type.isText || type.hasRequiredAttrs())) dead = false; @@ -127449,8 +155754,8 @@ let NodeType$1 = class NodeType2 { Tells you whether this node type has any required attributes. */ hasRequiredAttrs() { - for (let n in this.attrs) - if (this.attrs[n].isRequired) + for (let n2 in this.attrs) + if (this.attrs[n2].isRequired) return true; return false; } @@ -127831,10 +156136,10 @@ class DOMParser { this.styles.push(rule); } }); - this.normalizeLists = !this.tags.some((r) => { - if (!/^(ul|ol)\b/.test(r.tag) || !r.node) + this.normalizeLists = !this.tags.some((r2) => { + if (!/^(ul|ol)\b/.test(r2.tag) || !r2.node) return false; - let node3 = schema2.nodes[r.node]; + let node3 = schema2.nodes[r2.node]; return node3.contentMatch.matchType(node3); }); } @@ -128008,9 +156313,9 @@ class NodeContext { if (!this.match) { if (!this.type) return []; - let fill = this.type.contentMatch.fillBefore(Fragment.from(node3)); - if (fill) { - this.match = this.type.contentMatch.matchFragment(fill); + let fill2 = this.type.contentMatch.fillBefore(Fragment.from(node3)); + if (fill2) { + this.match = this.type.contentMatch.matchFragment(fill2); } else { let start2 = this.type.contentMatch, wrap2; if (wrap2 = start2.findWrapping(node3.type)) { @@ -128025,13 +156330,13 @@ class NodeContext { } finish(openEnd) { if (!(this.options & OPT_PRESERVE_WS)) { - let last = this.content[this.content.length - 1], m; - if (last && last.isText && (m = /[ \t\r\n\u000c]+$/.exec(last.text))) { + let last = this.content[this.content.length - 1], m2; + if (last && last.isText && (m2 = /[ \t\r\n\u000c]+$/.exec(last.text))) { let text2 = last; - if (last.text.length == m[0].length) + if (last.text.length == m2[0].length) this.content.pop(); else - this.content[this.content.length - 1] = text2.withText(text2.text.slice(0, text2.text.length - m[0].length)); + this.content[this.content.length - 1] = text2.withText(text2.text.slice(0, text2.text.length - m2[0].length)); } } let content2 = Fragment.from(this.content); @@ -128175,7 +156480,7 @@ class ParseContext { if (rule.ignore) return null; if (rule.clearMark) - marks = marks.filter((m) => !rule.clearMark(m)); + marks = marks.filter((m2) => !rule.clearMark(m2)); else marks = marks.concat(this.parser.schema.marks[rule.mark].create(rule.attrs)); if (rule.consuming === false) @@ -128278,9 +156583,9 @@ class ParseContext { if (top.match) top.match = top.match.matchType(node3.type); let nodeMarks = Mark$1.none; - for (let m of innerMarks.concat(node3.marks)) - if (top.type ? top.type.allowsMarkType(m.type) : markMayApply(m.type, node3.type)) - nodeMarks = m.addToSet(nodeMarks); + for (let m2 of innerMarks.concat(node3.marks)) + if (top.type ? top.type.allowsMarkType(m2.type) : markMayApply(m2.type, node3.type)) + nodeMarks = m2.addToSet(nodeMarks); top.content.push(node3.mark(nodeMarks)); return true; } @@ -128303,9 +156608,9 @@ class ParseContext { if (top.options & OPT_OPEN_LEFT && top.content.length == 0) options4 |= OPT_OPEN_LEFT; let applyMarks = Mark$1.none; - marks = marks.filter((m) => { - if (top.type ? top.type.allowsMarkType(m.type) : markMayApply(m.type, type)) { - applyMarks = m.addToSet(applyMarks); + marks = marks.filter((m2) => { + if (top.type ? top.type.allowsMarkType(m2.type) : markMayApply(m2.type, type)) { + applyMarks = m2.addToSet(applyMarks); return false; } return true; @@ -128345,8 +156650,8 @@ class ParseContext { let pos2 = 0; for (let i2 = this.open; i2 >= 0; i2--) { let content2 = this.nodes[i2].content; - for (let j = content2.length - 1; j >= 0; j--) - pos2 += content2[j].nodeSize; + for (let j2 = content2.length - 1; j2 >= 0; j2--) + pos2 += content2[j2].nodeSize; if (i2) pos2++; } @@ -128415,8 +156720,8 @@ class ParseContext { textblockFromContext() { let $context = this.options.context; if ($context) - for (let d = $context.depth; d >= 0; d--) { - let deflt = $context.node(d).contentMatchAt($context.indexAfter(d)).defaultType; + for (let d2 = $context.depth; d2 >= 0; d2--) { + let deflt = $context.node(d2).contentMatchAt($context.indexAfter(d2)).defaultType; if (deflt && deflt.isTextblock && deflt.defaultAttrs) return deflt; } @@ -128823,12 +157128,12 @@ class StepMap { Calls the given function on each of the changed ranges included in this map. */ - forEach(f) { + forEach(f2) { let oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2; for (let i2 = 0, diff2 = 0; i2 < this.ranges.length; i2 += 3) { let start2 = this.ranges[i2], oldStart = start2 - (this.inverted ? diff2 : 0), newStart = start2 + (this.inverted ? 0 : diff2); let oldSize = this.ranges[i2 + oldIndex], newSize = this.ranges[i2 + newIndex]; - f(oldStart, oldStart + oldSize, newStart, newStart + newSize); + f2(oldStart, oldStart + oldSize, newStart, newStart + newSize); diff2 += newSize - oldSize; } } @@ -128850,8 +157155,8 @@ class StepMap { negative). This can be useful when applying steps meant for a sub-document to a larger document, or vice-versa. */ - static offset(n) { - return n == 0 ? StepMap.empty : new StepMap(n < 0 ? [0, -n, 0] : [0, 0, n]); + static offset(n2) { + return n2 == 0 ? StepMap.empty : new StepMap(n2 < 0 ? [0, -n2, 0] : [0, 0, n2]); } } StepMap.empty = new StepMap([]); @@ -128862,9 +157167,9 @@ class Mapping { /** Create a new mapping with the given position maps. */ - constructor(maps = [], mirror, from2 = 0, to = maps.length) { + constructor(maps = [], mirror2, from2 = 0, to = maps.length) { this.maps = maps; - this.mirror = mirror; + this.mirror = mirror2; this.from = from2; this.to = to; } @@ -128905,20 +157210,20 @@ class Mapping { given offset, in this mapping (as per the second argument to `appendMap`). */ - getMirror(n) { + getMirror(n2) { if (this.mirror) { for (let i2 = 0; i2 < this.mirror.length; i2++) - if (this.mirror[i2] == n) + if (this.mirror[i2] == n2) return this.mirror[i2 + (i2 % 2 ? -1 : 1)]; } } /** @internal */ - setMirror(n, m) { + setMirror(n2, m2) { if (!this.mirror) this.mirror = []; - this.mirror.push(n, m); + this.mirror.push(n2, m2); } /** Append the inverse of the given mapping to this one. @@ -129060,14 +157365,14 @@ class StepResult { } } } -function mapFragment(fragment, f, parent) { +function mapFragment(fragment, f2, parent) { let mapped = []; for (let i2 = 0; i2 < fragment.childCount; i2++) { let child = fragment.child(i2); if (child.content.size) - child = child.copy(mapFragment(child.content, f, child)); + child = child.copy(mapFragment(child.content, f2, child)); if (child.isInline) - child = f(child, parent, i2); + child = f2(child, parent, i2); mapped.push(child); } return Fragment.fromArray(mapped); @@ -129196,8 +157501,8 @@ class AddNodeMarkStep extends Step { let node3 = doc2.nodeAt(this.pos); if (!node3) return StepResult.fail("No node at mark step's position"); - let updated13 = node3.type.create(node3.attrs, null, this.mark.addToSet(node3.marks)); - return StepResult.fromReplace(doc2, this.pos, this.pos + 1, new Slice(Fragment.from(updated13), 0, node3.isLeaf ? 0 : 1)); + let updated14 = node3.type.create(node3.attrs, null, this.mark.addToSet(node3.marks)); + return StepResult.fromReplace(doc2, this.pos, this.pos + 1, new Slice(Fragment.from(updated14), 0, node3.isLeaf ? 0 : 1)); } invert(doc2) { let node3 = doc2.nodeAt(this.pos); @@ -129245,8 +157550,8 @@ class RemoveNodeMarkStep extends Step { let node3 = doc2.nodeAt(this.pos); if (!node3) return StepResult.fail("No node at mark step's position"); - let updated13 = node3.type.create(node3.attrs, null, this.mark.removeFromSet(node3.marks)); - return StepResult.fromReplace(doc2, this.pos, this.pos + 1, new Slice(Fragment.from(updated13), 0, node3.isLeaf ? 0 : 1)); + let updated14 = node3.type.create(node3.attrs, null, this.mark.removeFromSet(node3.marks)); + return StepResult.fromReplace(doc2, this.pos, this.pos + 1, new Slice(Fragment.from(updated14), 0, node3.isLeaf ? 0 : 1)); } invert(doc2) { let node3 = doc2.nodeAt(this.pos); @@ -129459,8 +157764,8 @@ function addMark(tr2, from2, to, mark2) { added.push(adding = new AddMarkStep(start2, end, mark2)); } }); - removed.forEach((s) => tr2.step(s)); - added.forEach((s) => tr2.step(s)); + removed.forEach((s2) => tr2.step(s2)); + added.forEach((s2) => tr2.step(s2)); } __name(addMark, "addMark"); function removeMark(tr2, from2, to, mark2) { @@ -129486,10 +157791,10 @@ function removeMark(tr2, from2, to, mark2) { let end = Math.min(pos2 + node3.nodeSize, to); for (let i2 = 0; i2 < toRemove.length; i2++) { let style2 = toRemove[i2], found2; - for (let j = 0; j < matched.length; j++) { - let m = matched[j]; - if (m.step == step3 - 1 && style2.eq(matched[j].style)) - found2 = m; + for (let j2 = 0; j2 < matched.length; j2++) { + let m2 = matched[j2]; + if (m2.step == step3 - 1 && style2.eq(matched[j2].style)) + found2 = m2; } if (found2) { found2.to = end; @@ -129500,7 +157805,7 @@ function removeMark(tr2, from2, to, mark2) { } } }); - matched.forEach((m) => tr2.step(new RemoveMarkStep(m.from, m.to, m.style))); + matched.forEach((m2) => tr2.step(new RemoveMarkStep(m2.from, m2.to, m2.style))); } __name(removeMark, "removeMark"); function clearIncompatible(tr2, pos2, parentType, match2 = parentType.contentMatch, clearNewlines = true) { @@ -129513,23 +157818,23 @@ function clearIncompatible(tr2, pos2, parentType, match2 = parentType.contentMat replSteps.push(new ReplaceStep(cur, end, Slice.empty)); } else { match2 = allowed; - for (let j = 0; j < child.marks.length; j++) - if (!parentType.allowsMarkType(child.marks[j].type)) - tr2.step(new RemoveMarkStep(cur, end, child.marks[j])); + for (let j2 = 0; j2 < child.marks.length; j2++) + if (!parentType.allowsMarkType(child.marks[j2].type)) + tr2.step(new RemoveMarkStep(cur, end, child.marks[j2])); if (clearNewlines && child.isText && parentType.whitespace != "pre") { - let m, newline2 = /\r?\n|\r/g, slice2; - while (m = newline2.exec(child.text)) { + let m2, newline2 = /\r?\n|\r/g, slice2; + while (m2 = newline2.exec(child.text)) { if (!slice2) slice2 = new Slice(Fragment.from(parentType.schema.text(" ", parentType.allowedMarks(child.marks))), 0, 0); - replSteps.push(new ReplaceStep(cur + m.index, cur + m.index + m[0].length, slice2)); + replSteps.push(new ReplaceStep(cur + m2.index, cur + m2.index + m2[0].length, slice2)); } } } cur = end; } if (!match2.validEnd) { - let fill = match2.fillBefore(Fragment.empty, true); - tr2.replace(cur, cur, new Slice(fill, 0, 0)); + let fill2 = match2.fillBefore(Fragment.empty, true); + tr2.replace(cur, cur, new Slice(fill2, 0, 0)); } for (let i2 = replSteps.length - 1; i2 >= 0; i2--) tr2.step(replSteps[i2]); @@ -129558,19 +157863,19 @@ function lift$2(tr2, range2, target) { let gapStart = $from.before(depth + 1), gapEnd = $to.after(depth + 1); let start2 = gapStart, end = gapEnd; let before = Fragment.empty, openStart = 0; - for (let d = depth, splitting = false; d > target; d--) - if (splitting || $from.index(d) > 0) { + for (let d2 = depth, splitting = false; d2 > target; d2--) + if (splitting || $from.index(d2) > 0) { splitting = true; - before = Fragment.from($from.node(d).copy(before)); + before = Fragment.from($from.node(d2).copy(before)); openStart++; } else { start2--; } let after = Fragment.empty, openEnd = 0; - for (let d = depth, splitting = false; d > target; d--) - if (splitting || $to.after(d + 1) < $to.end(d)) { + for (let d2 = depth, splitting = false; d2 > target; d2--) + if (splitting || $to.after(d2 + 1) < $to.end(d2)) { splitting = true; - after = Fragment.from($to.node(d).copy(after)); + after = Fragment.from($to.node(d2).copy(after)); openEnd++; } else { end++; @@ -129659,9 +157964,9 @@ __name(setBlockType$1, "setBlockType$1"); function replaceNewlines(tr2, node3, pos2, mapFrom) { node3.forEach((child, offset) => { if (child.isText) { - let m, newline2 = /\r?\n|\r/g; - while (m = newline2.exec(child.text)) { - let start2 = tr2.mapping.slice(mapFrom).map(pos2 + 1 + offset + m.index); + let m2, newline2 = /\r?\n|\r/g; + while (m2 = newline2.exec(child.text)) { + let start2 = tr2.mapping.slice(mapFrom).map(pos2 + 1 + offset + m2.index); tr2.replaceWith(start2, start2 + 1, node3.type.schema.linebreakReplacement.create()); } } @@ -129701,8 +158006,8 @@ function canSplit(doc2, pos2, depth = 1, typesAfter) { let innerType = typesAfter && typesAfter[typesAfter.length - 1] || $pos.parent; if (base2 < 0 || $pos.parent.type.spec.isolating || !$pos.parent.canReplace($pos.index(), $pos.parent.childCount) || !innerType.type.validContent($pos.parent.content.cutByIndex($pos.index(), $pos.parent.childCount))) return false; - for (let d = $pos.depth - 1, i2 = depth - 2; d > base2; d--, i2--) { - let node3 = $pos.node(d), index3 = $pos.index(d); + for (let d2 = $pos.depth - 1, i2 = depth - 2; d2 > base2; d2--, i2--) { + let node3 = $pos.node(d2), index3 = $pos.index(d2); if (node3.type.spec.isolating) return false; let rest = node3.content.cutByIndex(index3, node3.childCount); @@ -129720,10 +158025,10 @@ function canSplit(doc2, pos2, depth = 1, typesAfter) { __name(canSplit, "canSplit"); function split(tr2, pos2, depth = 1, typesAfter) { let $pos = tr2.doc.resolve(pos2), before = Fragment.empty, after = Fragment.empty; - for (let d = $pos.depth, e2 = $pos.depth - depth, i2 = depth - 1; d > e2; d--, i2--) { - before = Fragment.from($pos.node(d).copy(before)); + for (let d2 = $pos.depth, e2 = $pos.depth - depth, i2 = depth - 1; d2 > e2; d2--, i2--) { + before = Fragment.from($pos.node(d2).copy(before)); let typeAfter = typesAfter && typesAfter[i2]; - after = Fragment.from(typeAfter ? typeAfter.type.create(typeAfter.attrs, after) : $pos.node(d).copy(after)); + after = Fragment.from(typeAfter ? typeAfter.type.create(typeAfter.attrs, after) : $pos.node(d2).copy(after)); } tr2.step(new ReplaceStep(pos2, pos2, new Slice(before.append(after), depth, depth), true)); } @@ -129733,47 +158038,47 @@ function canJoin(doc2, pos2) { return joinable($pos.nodeBefore, $pos.nodeAfter) && $pos.parent.canReplace(index2, index2 + 1); } __name(canJoin, "canJoin"); -function canAppendWithSubstitutedLinebreaks(a, b) { - if (!b.content.size) - a.type.compatibleContent(b.type); - let match2 = a.contentMatchAt(a.childCount); - let { linebreakReplacement } = a.type.schema; - for (let i2 = 0; i2 < b.childCount; i2++) { - let child = b.child(i2); - let type = child.type == linebreakReplacement ? a.type.schema.nodes.text : child.type; +function canAppendWithSubstitutedLinebreaks(a2, b2) { + if (!b2.content.size) + a2.type.compatibleContent(b2.type); + let match2 = a2.contentMatchAt(a2.childCount); + let { linebreakReplacement } = a2.type.schema; + for (let i2 = 0; i2 < b2.childCount; i2++) { + let child = b2.child(i2); + let type = child.type == linebreakReplacement ? a2.type.schema.nodes.text : child.type; match2 = match2.matchType(type); if (!match2) return false; - if (!a.type.allowsMarks(child.marks)) + if (!a2.type.allowsMarks(child.marks)) return false; } return match2.validEnd; } __name(canAppendWithSubstitutedLinebreaks, "canAppendWithSubstitutedLinebreaks"); -function joinable(a, b) { - return !!(a && b && !a.isLeaf && canAppendWithSubstitutedLinebreaks(a, b)); +function joinable(a2, b2) { + return !!(a2 && b2 && !a2.isLeaf && canAppendWithSubstitutedLinebreaks(a2, b2)); } __name(joinable, "joinable"); function joinPoint(doc2, pos2, dir = -1) { let $pos = doc2.resolve(pos2); - for (let d = $pos.depth; ; d--) { - let before, after, index2 = $pos.index(d); - if (d == $pos.depth) { + for (let d2 = $pos.depth; ; d2--) { + let before, after, index2 = $pos.index(d2); + if (d2 == $pos.depth) { before = $pos.nodeBefore; after = $pos.nodeAfter; } else if (dir > 0) { - before = $pos.node(d + 1); + before = $pos.node(d2 + 1); index2++; - after = $pos.node(d).maybeChild(index2); + after = $pos.node(d2).maybeChild(index2); } else { - before = $pos.node(d).maybeChild(index2 - 1); - after = $pos.node(d + 1); + before = $pos.node(d2).maybeChild(index2 - 1); + after = $pos.node(d2 + 1); } - if (before && !before.isTextblock && joinable(before, after) && $pos.node(d).canReplace(index2, index2 + 1)) + if (before && !before.isTextblock && joinable(before, after) && $pos.node(d2).canReplace(index2, index2 + 1)) return pos2; - if (d == 0) + if (d2 == 0) break; - pos2 = dir < 0 ? $pos.before(d) : $pos.after(d); + pos2 = dir < 0 ? $pos.before(d2) : $pos.after(d2); } } __name(joinPoint, "joinPoint"); @@ -129810,19 +158115,19 @@ function insertPoint(doc2, pos2, nodeType) { if ($pos.parent.canReplaceWith($pos.index(), $pos.index(), nodeType)) return pos2; if ($pos.parentOffset == 0) - for (let d = $pos.depth - 1; d >= 0; d--) { - let index2 = $pos.index(d); - if ($pos.node(d).canReplaceWith(index2, index2, nodeType)) - return $pos.before(d + 1); + for (let d2 = $pos.depth - 1; d2 >= 0; d2--) { + let index2 = $pos.index(d2); + if ($pos.node(d2).canReplaceWith(index2, index2, nodeType)) + return $pos.before(d2 + 1); if (index2 > 0) return null; } if ($pos.parentOffset == $pos.parent.content.size) - for (let d = $pos.depth - 1; d >= 0; d--) { - let index2 = $pos.indexAfter(d); - if ($pos.node(d).canReplaceWith(index2, index2, nodeType)) - return $pos.after(d + 1); - if (index2 < $pos.node(d).childCount) + for (let d2 = $pos.depth - 1; d2 >= 0; d2--) { + let index2 = $pos.indexAfter(d2); + if ($pos.node(d2).canReplaceWith(index2, index2, nodeType)) + return $pos.after(d2 + 1); + if (index2 < $pos.node(d2).childCount) return null; } return null; @@ -129836,10 +158141,10 @@ function dropPoint(doc2, pos2, slice2) { for (let i2 = 0; i2 < slice2.openStart; i2++) content2 = content2.firstChild.content; for (let pass = 1; pass <= (slice2.openStart == 0 && slice2.size ? 2 : 1); pass++) { - for (let d = $pos.depth; d >= 0; d--) { - let bias = d == $pos.depth ? 0 : $pos.pos <= ($pos.start(d + 1) + $pos.end(d + 1)) / 2 ? -1 : 1; - let insertPos = $pos.index(d) + (bias > 0 ? 1 : 0); - let parent = $pos.node(d), fits = false; + for (let d2 = $pos.depth; d2 >= 0; d2--) { + let bias = d2 == $pos.depth ? 0 : $pos.pos <= ($pos.start(d2 + 1) + $pos.end(d2 + 1)) / 2 ? -1 : 1; + let insertPos = $pos.index(d2) + (bias > 0 ? 1 : 0); + let parent = $pos.node(d2), fits = false; if (pass == 1) { fits = parent.canReplace(insertPos, insertPos, content2); } else { @@ -129847,7 +158152,7 @@ function dropPoint(doc2, pos2, slice2) { fits = wrapping && parent.canReplaceWith(insertPos, insertPos, wrapping[0]); } if (fits) - return bias == 0 ? $pos.pos : bias < 0 ? $pos.before(d + 1) : $pos.after(d + 1); + return bias == 0 ? $pos.pos : bias < 0 ? $pos.before(d2 + 1) : $pos.after(d2 + 1); } } return null; @@ -129919,12 +158224,12 @@ class Fitter { // depths, one for the slice and one for the frontier. findFittable() { let startDepth = this.unplaced.openStart; - for (let cur = this.unplaced.content, d = 0, openEnd = this.unplaced.openEnd; d < startDepth; d++) { + for (let cur = this.unplaced.content, d2 = 0, openEnd = this.unplaced.openEnd; d2 < startDepth; d2++) { let node3 = cur.firstChild; if (cur.childCount > 1) openEnd = 0; - if (node3.type.spec.isolating && openEnd <= d) { - startDepth = d; + if (node3.type.spec.isolating && openEnd <= d2) { + startDepth = d2; break; } cur = node3.content; @@ -130030,9 +158335,9 @@ class Fitter { let fit = contentAfterFits($to, i2, type, match2, dropInner); if (!fit) continue; - for (let d = i2 - 1; d >= 0; d--) { - let { match: match3, type: type2 } = this.frontier[d]; - let matches2 = contentAfterFits($to, d, type2, match3, true); + for (let d2 = i2 - 1; d2 >= 0; d2--) { + let { match: match3, type: type2 } = this.frontier[d2]; + let matches2 = contentAfterFits($to, d2, type2, match3, true); if (!matches2 || matches2.childCount) continue scan; } @@ -130048,8 +158353,8 @@ class Fitter { if (close5.fit.childCount) this.placed = addToFragment(this.placed, close5.depth, close5.fit); $to = close5.move; - for (let d = close5.depth + 1; d <= $to.depth; d++) { - let node3 = $to.node(d), add3 = node3.type.contentMatch.fillBefore(node3.content, true, $to.index(d)); + for (let d2 = close5.depth + 1; d2 <= $to.depth; d2++) { + let node3 = $to.node(d2), add3 = node3.type.contentMatch.fillBefore(node3.content, true, $to.index(d2)); this.openFrontierNode(node3.type, node3.attrs, add3); } return $to; @@ -130129,14 +158434,14 @@ function replaceRange(tr2, from2, to, slice2) { targetDepths.pop(); let preferredTarget = -($from.depth + 1); targetDepths.unshift(preferredTarget); - for (let d = $from.depth, pos2 = $from.pos - 1; d > 0; d--, pos2--) { - let spec = $from.node(d).type.spec; + for (let d2 = $from.depth, pos2 = $from.pos - 1; d2 > 0; d2--, pos2--) { + let spec = $from.node(d2).type.spec; if (spec.defining || spec.definingAsContext || spec.isolating) break; - if (targetDepths.indexOf(d) > -1) - preferredTarget = d; - else if ($from.before(d) == pos2) - targetDepths.splice(1, 0, -d); + if (targetDepths.indexOf(d2) > -1) + preferredTarget = d2; + else if ($from.before(d2) == pos2) + targetDepths.splice(1, 0, -d2); } let preferredTargetIndex = targetDepths.indexOf(preferredTarget); let leftNodes = [], preferredDepth = slice2.openStart; @@ -130147,15 +158452,15 @@ function replaceRange(tr2, from2, to, slice2) { break; content2 = node3.content; } - for (let d = preferredDepth - 1; d >= 0; d--) { - let leftNode = leftNodes[d], def2 = definesContent(leftNode.type); + for (let d2 = preferredDepth - 1; d2 >= 0; d2--) { + let leftNode = leftNodes[d2], def2 = definesContent(leftNode.type); if (def2 && !leftNode.sameMarkup($from.node(Math.abs(preferredTarget) - 1))) - preferredDepth = d; + preferredDepth = d2; else if (def2 || !leftNode.type.isTextblock) break; } - for (let j = slice2.openStart; j >= 0; j--) { - let openDepth = (j + preferredDepth + 1) % (slice2.openStart + 1); + for (let j2 = slice2.openStart; j2 >= 0; j2--) { + let openDepth = (j2 + preferredDepth + 1) % (slice2.openStart + 1); let insert2 = leftNodes[openDepth]; if (!insert2) continue; @@ -130215,21 +158520,21 @@ function deleteRange$1(tr2, from2, to) { if (depth > 0 && (last || $from.node(depth - 1).canReplace($from.index(depth - 1), $to.indexAfter(depth - 1)))) return tr2.delete($from.before(depth), $to.after(depth)); } - for (let d = 1; d <= $from.depth && d <= $to.depth; d++) { - if (from2 - $from.start(d) == $from.depth - d && to > $from.end(d) && $to.end(d) - to != $to.depth - d && $from.start(d - 1) == $to.start(d - 1) && $from.node(d - 1).canReplace($from.index(d - 1), $to.index(d - 1))) - return tr2.delete($from.before(d), to); + for (let d2 = 1; d2 <= $from.depth && d2 <= $to.depth; d2++) { + if (from2 - $from.start(d2) == $from.depth - d2 && to > $from.end(d2) && $to.end(d2) - to != $to.depth - d2 && $from.start(d2 - 1) == $to.start(d2 - 1) && $from.node(d2 - 1).canReplace($from.index(d2 - 1), $to.index(d2 - 1))) + return tr2.delete($from.before(d2), to); } tr2.delete(from2, to); } __name(deleteRange$1, "deleteRange$1"); function coveredDepths($from, $to) { let result = [], minDepth = Math.min($from.depth, $to.depth); - for (let d = minDepth; d >= 0; d--) { - let start2 = $from.start(d); - if (start2 < $from.pos - ($from.depth - d) || $to.end(d) > $to.pos + ($to.depth - d) || $from.node(d).type.spec.isolating || $to.node(d).type.spec.isolating) + for (let d2 = minDepth; d2 >= 0; d2--) { + let start2 = $from.start(d2); + if (start2 < $from.pos - ($from.depth - d2) || $to.end(d2) > $to.pos + ($to.depth - d2) || $from.node(d2).type.spec.isolating || $to.node(d2).type.spec.isolating) break; - if (start2 == $to.start(d) || d == $from.depth && d == $to.depth && $from.parent.inlineContent && $to.parent.inlineContent && d && $to.start(d - 1) == start2 - 1) - result.push(d); + if (start2 == $to.start(d2) || d2 == $from.depth && d2 == $to.depth && $from.parent.inlineContent && $to.parent.inlineContent && d2 && $to.start(d2 - 1) == start2 - 1) + result.push(d2); } return result; } @@ -130255,8 +158560,8 @@ class AttrStep extends Step { for (let name2 in node3.attrs) attrs4[name2] = node3.attrs[name2]; attrs4[this.attr] = this.value; - let updated13 = node3.type.create(attrs4, null, node3.marks); - return StepResult.fromReplace(doc2, this.pos, this.pos + 1, new Slice(Fragment.from(updated13), 0, node3.isLeaf ? 0 : 1)); + let updated14 = node3.type.create(attrs4, null, node3.marks); + return StepResult.fromReplace(doc2, this.pos, this.pos + 1, new Slice(Fragment.from(updated14), 0, node3.isLeaf ? 0 : 1)); } getMap() { return StepMap.empty; @@ -130295,8 +158600,8 @@ class DocAttrStep extends Step { for (let name2 in doc2.attrs) attrs4[name2] = doc2.attrs[name2]; attrs4[this.attr] = this.value; - let updated13 = doc2.type.create(attrs4, doc2.content, doc2.marks); - return StepResult.ok(updated13); + let updated14 = doc2.type.create(attrs4, doc2.content, doc2.marks); + return StepResult.ok(updated14); } getMap() { return StepMap.empty; @@ -131234,8 +159539,8 @@ class Transaction extends Transform { return (this.updated & UPDATED_SCROLL) > 0; } } -function bind$2(f, self2) { - return !self2 || !f ? f : f.bind(self2); +function bind$2(f2, self2) { + return !self2 || !f2 ? f2 : f2.bind(self2); } __name(bind$2, "bind$2"); class FieldDesc { @@ -131358,14 +159663,14 @@ class EditorState { for (let i2 = 0; i2 < this.config.plugins.length; i2++) { let plugin = this.config.plugins[i2]; if (plugin.spec.appendTransaction) { - let n = seen2 ? seen2[i2].n : 0, oldState = seen2 ? seen2[i2].state : this; - let tr2 = n < trs.length && plugin.spec.appendTransaction.call(plugin, n ? trs.slice(n) : trs, oldState, newState); + let n2 = seen2 ? seen2[i2].n : 0, oldState = seen2 ? seen2[i2].state : this; + let tr2 = n2 < trs.length && plugin.spec.appendTransaction.call(plugin, n2 ? trs.slice(n2) : trs, oldState, newState); if (tr2 && newState.filterTransaction(tr2, i2)) { tr2.setMeta("appendedTransaction", rootTr); if (!seen2) { seen2 = []; - for (let j = 0; j < this.config.plugins.length; j++) - seen2.push(j < i2 ? { state: newState, n: trs.length } : { state: this, n: 0 }); + for (let j2 = 0; j2 < this.config.plugins.length; j2++) + seen2.push(j2 < i2 ? { state: newState, n: trs.length } : { state: this, n: 0 }); } trs.push(tr2); newState = newState.applyInner(tr2); @@ -131435,7 +159740,7 @@ class EditorState { toJSON(pluginFields) { let result = { doc: this.doc.toJSON(), selection: this.selection.toJSON() }; if (this.storedMarks) - result.storedMarks = this.storedMarks.map((m) => m.toJSON()); + result.storedMarks = this.storedMarks.map((m2) => m2.toJSON()); if (pluginFields && typeof pluginFields == "object") for (let prop2 in pluginFields) { if (prop2 == "doc" || prop2 == "selection") @@ -131959,8 +160264,8 @@ function elementFromPoint(element, coords, box) { let child = element.childNodes[i2]; if (child.nodeType == 1) { let rects = child.getClientRects(); - for (let j = 0; j < rects.length; j++) { - let rect = rects[j]; + for (let j2 = 0; j2 < rects.length; j2++) { + let rect = rects[j2]; if (inRect(coords, rect)) return elementFromPoint(child, coords, rect); } @@ -132107,14 +160412,14 @@ function flattenH(rect, top) { return { top: y2, bottom: y2, left: rect.left, right: rect.right }; } __name(flattenH, "flattenH"); -function withFlushedState(view, state, f) { +function withFlushedState(view, state, f2) { let viewState = view.state, active3 = view.root.activeElement; if (viewState != state) view.updateState(state); if (active3 != view.dom) view.focus(); try { - return f(); + return f2(); } finally { if (viewState != state) view.updateState(viewState); @@ -132421,8 +160726,8 @@ class ViewDesc { if (from2 >= childBase && to <= end - child.border && child.node && child.contentDOM && this.contentDOM.contains(child.contentDOM)) return child.parseRange(from2, to, childBase); from2 = offset; - for (let j = i2; j > 0; j--) { - let prev2 = this.children[j - 1]; + for (let j2 = i2; j2 > 0; j2--) { + let prev2 = this.children[j2 - 1]; if (prev2.size && prev2.dom.parentNode == this.contentDOM && !prev2.emptyChildAt(1)) { fromOffset = domIndex(prev2.dom) + 1; break; @@ -132434,8 +160739,8 @@ class ViewDesc { } if (fromOffset > -1 && (end > to || i2 == this.children.length - 1)) { to = end; - for (let j = i2 + 1; j < this.children.length; j++) { - let next2 = this.children[j]; + for (let j2 = i2 + 1; j2 < this.children.length; j2++) { + let next2 = this.children[j2]; if (next2.size && next2.dom.parentNode == this.contentDOM && !next2.emptyChildAt(-1)) { toOffset = domIndex(next2.dom); break; @@ -132948,8 +161253,8 @@ class TextViewDesc extends NodeViewDesc { } inParent() { let parentDOM = this.parent.contentDOM; - for (let n = this.nodeDOM; n; n = n.parentNode) - if (n == parentDOM) + for (let n2 = this.nodeDOM; n2; n2 = n2.parentNode) + if (n2 == parentDOM) return true; return false; } @@ -133148,9 +161453,9 @@ function patchAttributes(dom, prev2, cur) { } if (prev2.style != cur.style) { if (prev2.style) { - let prop2 = /\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g, m; - while (m = prop2.exec(prev2.style)) - dom.style.removeProperty(m[1]); + let prop2 = /\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g, m2; + while (m2 = prop2.exec(prev2.style)) + dom.style.removeProperty(m2[1]); } if (cur.style) dom.style.cssText += cur.style; @@ -133161,11 +161466,11 @@ function applyOuterDeco(dom, deco, node3) { return patchOuterDeco(dom, dom, noDeco, computeOuterDeco(deco, node3, dom.nodeType != 1)); } __name(applyOuterDeco, "applyOuterDeco"); -function sameOuterDeco(a, b) { - if (a.length != b.length) +function sameOuterDeco(a2, b2) { + if (a2.length != b2.length) return false; - for (let i2 = 0; i2 < a.length; i2++) - if (!a[i2].type.eq(b[i2].type)) + for (let i2 = 0; i2 < a2.length; i2++) + if (!a2[i2].type.eq(b2[i2].type)) return false; return true; } @@ -133300,7 +161605,7 @@ class ViewTreeUpdater { let preMatch2 = this.preMatch.matched.get(next2); if (preMatch2 != null && preMatch2 != index2) return false; - let nextDOM = next2.dom, updated13; + let nextDOM = next2.dom, updated14; let locked = this.isLocked(nextDOM) && !(node3.isText && next2.node && next2.node.isText && next2.nodeDOM.nodeValue == node3.text && next2.dirty != NODE_DIRTY && sameOuterDeco(outerDeco, next2.outerDeco)); if (!locked && next2.update(node3, outerDeco, innerDeco, view)) { this.destroyBetween(this.index, i2); @@ -133308,13 +161613,13 @@ class ViewTreeUpdater { this.changed = true; this.index++; return true; - } else if (!locked && (updated13 = this.recreateWrapper(next2, node3, outerDeco, innerDeco, view, pos2))) { + } else if (!locked && (updated14 = this.recreateWrapper(next2, node3, outerDeco, innerDeco, view, pos2))) { this.destroyBetween(this.index, i2); - this.top.children[this.index] = updated13; - if (updated13.contentDOM) { - updated13.dirty = CONTENT_DIRTY; - updated13.updateChildren(view, pos2 + 1); - updated13.dirty = NOT_DIRTY; + this.top.children[this.index] = updated14; + if (updated14.contentDOM) { + updated14.dirty = CONTENT_DIRTY; + updated14.updateChildren(view, pos2 + 1); + updated14.dirty = NOT_DIRTY; } this.changed = true; this.index++; @@ -133431,8 +161736,8 @@ function preMatch(frag, parentDesc) { return { index: fI, matched, matches: matches2.reverse() }; } __name(preMatch, "preMatch"); -function compareSide(a, b) { - return a.type.side - b.type.side; +function compareSide(a2, b2) { + return a2.type.side - b2.type.side; } __name(compareSide, "compareSide"); function iterDeco(parent, deco, onWidget, onNode) { @@ -133500,7 +161805,7 @@ function iterDeco(parent, deco, onWidget, onNode) { while (decoIndex < locals.length && locals[decoIndex].to < end) decoIndex++; } - let outerDeco = child.isInline && !child.isLeaf ? active3.filter((d) => !d.inline) : active3.slice(); + let outerDeco = child.isInline && !child.isLeaf ? active3.filter((d2) => !d2.inline) : active3.slice(); onNode(child, outerDeco, deco.forChild(offset, child), index2); offset = end; } @@ -133742,7 +162047,7 @@ function clearNodeSelection(view) { } __name(clearNodeSelection, "clearNodeSelection"); function selectionBetween(view, $anchor, $head, bias) { - return view.someProp("createSelectionBetween", (f) => f(view, $anchor, $head)) || TextSelection.between($anchor, $head, bias); + return view.someProp("createSelectionBetween", (f2) => f2(view, $anchor, $head)) || TextSelection.between($anchor, $head, bias); } __name(selectionBetween, "selectionBetween"); function hasFocusAndSelection(view) { @@ -134113,8 +162418,8 @@ function captureKeyDown(view, event) { } __name(captureKeyDown, "captureKeyDown"); function serializeForClipboard(view, slice2) { - view.someProp("transformCopied", (f) => { - slice2 = f(slice2, view); + view.someProp("transformCopied", (f2) => { + slice2 = f2(slice2, view); }); let context = [], { content: content2, openStart, openEnd } = slice2; while (openStart > 1 && openEnd > 1 && content2.childCount == 1 && content2.firstChild.childCount == 1) { @@ -134140,7 +162445,7 @@ function serializeForClipboard(view, slice2) { } if (firstChild && firstChild.nodeType == 1) firstChild.setAttribute("data-pm-slice", `${openStart} ${openEnd}${wrappers ? ` -${wrappers}` : ""} ${JSON.stringify(context)}`); - let text2 = view.someProp("clipboardTextSerializer", (f) => f(slice2, view)) || slice2.content.textBetween(0, slice2.content.size, "\n\n"); + let text2 = view.someProp("clipboardTextSerializer", (f2) => f2(slice2, view)) || slice2.content.textBetween(0, slice2.content.size, "\n\n"); return { dom: wrap2, text: text2, slice: slice2 }; } __name(serializeForClipboard, "serializeForClipboard"); @@ -134151,12 +162456,12 @@ function parseFromClipboard(view, text2, html, plainText, $context) { return null; let asText = text2 && (plainText || inCode || !html); if (asText) { - view.someProp("transformPastedText", (f) => { - text2 = f(text2, inCode || plainText, view); + view.someProp("transformPastedText", (f2) => { + text2 = f2(text2, inCode || plainText, view); }); if (inCode) return text2 ? new Slice(Fragment.from(view.state.schema.text(text2.replace(/\r\n?/g, "\n"))), 0, 0) : Slice.empty; - let parsed = view.someProp("clipboardTextParser", (f) => f(text2, $context, plainText, view)); + let parsed = view.someProp("clipboardTextParser", (f2) => f2(text2, $context, plainText, view)); if (parsed) { slice2 = parsed; } else { @@ -134170,8 +162475,8 @@ function parseFromClipboard(view, text2, html, plainText, $context) { }); } } else { - view.someProp("transformPastedHTML", (f) => { - html = f(html, view); + view.someProp("transformPastedHTML", (f2) => { + html = f2(html, view); }); dom = readHTML(html); if (webkit) @@ -134213,8 +162518,8 @@ function parseFromClipboard(view, text2, html, plainText, $context) { slice2 = closeSlice(slice2, openStart, openEnd); } } - view.someProp("transformPasted", (f) => { - slice2 = f(slice2, view); + view.someProp("transformPasted", (f2) => { + slice2 = f2(slice2, view); }); return slice2; } @@ -134223,9 +162528,9 @@ const inlineParents = /^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|outpu function normalizeSiblings(fragment, $context) { if (fragment.childCount < 2) return fragment; - for (let d = $context.depth; d >= 0; d--) { - let parent = $context.node(d); - let match2 = parent.contentMatchAt($context.index(d)); + for (let d2 = $context.depth; d2 >= 0; d2--) { + let parent = $context.node(d2); + let match2 = parent.contentMatchAt($context.index(d2)); let lastWrap, result = []; fragment.forEach((node3) => { if (!result) @@ -134271,8 +162576,8 @@ function closeRight(node3, depth) { if (depth == 0) return node3; let fragment = node3.content.replaceChild(node3.childCount - 1, closeRight(node3.lastChild, depth - 1)); - let fill = node3.contentMatchAt(node3.childCount).fillBefore(Fragment.empty, true); - return node3.copy(fragment.append(fill)); + let fill2 = node3.contentMatchAt(node3.childCount).fillBefore(Fragment.empty, true); + return node3.copy(fragment.append(fill2)); } __name(closeRight, "closeRight"); function closeRange(fragment, side, from2, to, depth, openEnd) { @@ -134316,7 +162621,7 @@ function maybeWrapTrusted(html) { if (!trustedTypes) return html; if (!_policy) - _policy = trustedTypes.createPolicy("ProseMirrorClipboard", { createHTML: /* @__PURE__ */ __name((s) => s, "createHTML") }); + _policy = trustedTypes.createPolicy("ProseMirrorClipboard", { createHTML: /* @__PURE__ */ __name((s2) => s2, "createHTML") }); return _policy.createHTML(html); } __name(maybeWrapTrusted, "maybeWrapTrusted"); @@ -134327,7 +162632,7 @@ function readHTML(html) { let elt = detachedDoc().createElement("div"); let firstTag = /<([a-z][^>\s]+)/i.exec(html), wrap2; if (wrap2 = firstTag && wrapMap[firstTag[1].toLowerCase()]) - html = wrap2.map((n) => "<" + n + ">").join("") + html + wrap2.map((n) => "</" + n + ">").reverse().join(""); + html = wrap2.map((n2) => "<" + n2 + ">").join("") + html + wrap2.map((n2) => "</" + n2 + ">").reverse().join(""); elt.innerHTML = maybeWrapTrusted(html); if (wrap2) for (let i2 = 0; i2 < wrap2.length; i2++) @@ -134470,11 +162775,11 @@ editHandlers.keydown = (view, _event) => { view.input.lastIOSEnter = now2; view.input.lastIOSEnterFallbackTimeout = setTimeout(() => { if (view.input.lastIOSEnter == now2) { - view.someProp("handleKeyDown", (f) => f(view, keyEvent(13, "Enter"))); + view.someProp("handleKeyDown", (f2) => f2(view, keyEvent(13, "Enter"))); view.input.lastIOSEnter = 0; } }, 200); - } else if (view.someProp("handleKeyDown", (f) => f(view, event)) || captureKeyDown(view, event)) { + } else if (view.someProp("handleKeyDown", (f2) => f2(view, event)) || captureKeyDown(view, event)) { event.preventDefault(); } else { setSelectionOrigin(view, "key"); @@ -134488,14 +162793,14 @@ editHandlers.keypress = (view, _event) => { let event = _event; if (inOrNearComposition(view, event) || !event.charCode || event.ctrlKey && !event.altKey || mac$3 && event.metaKey) return; - if (view.someProp("handleKeyPress", (f) => f(view, event))) { + if (view.someProp("handleKeyPress", (f2) => f2(view, event))) { event.preventDefault(); return; } let sel = view.state.selection; if (!(sel instanceof TextSelection) || !sel.$from.sameParent(sel.$to)) { let text2 = String.fromCharCode(event.charCode); - if (!/[\r\n]/.test(text2) && !view.someProp("handleTextInput", (f) => f(view, sel.$from.pos, sel.$to.pos, text2))) + if (!/[\r\n]/.test(text2) && !view.someProp("handleTextInput", (f2) => f2(view, sel.$from.pos, sel.$to.pos, text2))) view.dispatch(view.state.tr.insertText(text2).scrollIntoView()); event.preventDefault(); } @@ -134514,7 +162819,7 @@ function runHandlerOnContext(view, propName, pos2, inside, event) { return false; let $pos = view.state.doc.resolve(inside); for (let i2 = $pos.depth + 1; i2 > 0; i2--) { - if (view.someProp(propName, (f) => i2 > $pos.depth ? f(view, pos2, $pos.nodeAfter, $pos.before(i2), event, true) : f(view, pos2, $pos.node(i2), $pos.before(i2), event, false))) + if (view.someProp(propName, (f2) => i2 > $pos.depth ? f2(view, pos2, $pos.nodeAfter, $pos.before(i2), event, true) : f2(view, pos2, $pos.node(i2), $pos.before(i2), event, false))) return true; } return false; @@ -134568,15 +162873,15 @@ function selectClickedNode(view, inside) { } __name(selectClickedNode, "selectClickedNode"); function handleSingleClick(view, pos2, inside, event, selectNode) { - return runHandlerOnContext(view, "handleClickOn", pos2, inside, event) || view.someProp("handleClick", (f) => f(view, pos2, event)) || (selectNode ? selectClickedNode(view, inside) : selectClickedLeaf(view, inside)); + return runHandlerOnContext(view, "handleClickOn", pos2, inside, event) || view.someProp("handleClick", (f2) => f2(view, pos2, event)) || (selectNode ? selectClickedNode(view, inside) : selectClickedLeaf(view, inside)); } __name(handleSingleClick, "handleSingleClick"); function handleDoubleClick(view, pos2, inside, event) { - return runHandlerOnContext(view, "handleDoubleClickOn", pos2, inside, event) || view.someProp("handleDoubleClick", (f) => f(view, pos2, event)); + return runHandlerOnContext(view, "handleDoubleClickOn", pos2, inside, event) || view.someProp("handleDoubleClick", (f2) => f2(view, pos2, event)); } __name(handleDoubleClick, "handleDoubleClick"); function handleTripleClick$1(view, pos2, inside, event) { - return runHandlerOnContext(view, "handleTripleClickOn", pos2, inside, event) || view.someProp("handleTripleClick", (f) => f(view, pos2, event)) || defaultTripleClick(view, inside, event); + return runHandlerOnContext(view, "handleTripleClickOn", pos2, inside, event) || view.someProp("handleTripleClick", (f2) => f2(view, pos2, event)) || defaultTripleClick(view, inside, event); } __name(handleTripleClick$1, "handleTripleClick$1"); function defaultTripleClick(view, inside, event) { @@ -134761,7 +163066,7 @@ editHandlers.compositionstart = editHandlers.compositionupdate = (view) => { if (!view.composing) { view.domObserver.flush(); let { state } = view, $pos = state.selection.$to; - if (state.selection instanceof TextSelection && (state.storedMarks || !$pos.textOffset && $pos.parentOffset && $pos.nodeBefore.marks.some((m) => m.type.spec.inclusive === false))) { + if (state.selection instanceof TextSelection && (state.storedMarks || !$pos.textOffset && $pos.parentOffset && $pos.nodeBefore.marks.some((m2) => m2.type.spec.inclusive === false))) { view.markCursor = view.state.storedMarks || $pos.marks(); endComposition(view, true); view.markCursor = null; @@ -134885,13 +163190,13 @@ handlers.copy = editHandlers.cut = (view, _event) => { let sel = view.state.selection, cut2 = event.type == "cut"; if (sel.empty) return; - let data24 = brokenClipboardAPI ? null : event.clipboardData; + let data25 = brokenClipboardAPI ? null : event.clipboardData; let slice2 = sel.content(), { dom, text: text2 } = serializeForClipboard(view, slice2); - if (data24) { + if (data25) { event.preventDefault(); - data24.clearData(); - data24.setData("text/html", dom.innerHTML); - data24.setData("text/plain", text2); + data25.clearData(); + data25.setData("text/html", dom.innerHTML); + data25.setData("text/plain", text2); } else { captureCopy(view, dom); } @@ -134925,7 +163230,7 @@ function capturePaste(view, event) { __name(capturePaste, "capturePaste"); function doPaste(view, text2, html, preferPlain, event) { let slice2 = parseFromClipboard(view, text2, html, preferPlain, view.state.selection.$from); - if (view.someProp("handlePaste", (f) => f(view, event, slice2 || Slice.empty))) + if (view.someProp("handlePaste", (f2) => f2(view, event, slice2 || Slice.empty))) return true; if (!slice2) return false; @@ -134947,9 +163252,9 @@ editHandlers.paste = (view, _event) => { let event = _event; if (view.composing && !android) return; - let data24 = brokenClipboardAPI ? null : event.clipboardData; + let data25 = brokenClipboardAPI ? null : event.clipboardData; let plain = view.input.shiftKey && view.input.lastKeyCode != 45; - if (data24 && doPaste(view, getText$1(data24), data24.getData("text/html"), plain, event)) + if (data25 && doPaste(view, getText$1(data25), data25.getData("text/html"), plain, event)) event.preventDefault(); else capturePaste(view, event); @@ -135013,14 +163318,14 @@ editHandlers.drop = (view, _event) => { let $mouse = view.state.doc.resolve(eventPos.pos); let slice2 = dragging && dragging.slice; if (slice2) { - view.someProp("transformPasted", (f) => { - slice2 = f(slice2, view); + view.someProp("transformPasted", (f2) => { + slice2 = f2(slice2, view); }); } else { slice2 = parseFromClipboard(view, getText$1(event.dataTransfer), brokenClipboardAPI ? null : event.dataTransfer.getData("text/html"), false, $mouse); } let move = !!(dragging && !event[dragCopyModifier]); - if (view.someProp("handleDrop", (f) => f(view, event, slice2 || Slice.empty, move))) { + if (view.someProp("handleDrop", (f2) => f2(view, event, slice2 || Slice.empty, move))) { event.preventDefault(); return; } @@ -135092,7 +163397,7 @@ handlers.beforeinput = (view, _event) => { return; view.dom.blur(); view.focus(); - if (view.someProp("handleKeyDown", (f) => f(view, keyEvent(8, "Backspace")))) + if (view.someProp("handleKeyDown", (f2) => f2(view, keyEvent(8, "Backspace")))) return; let { $cursor } = view.state.selection; if ($cursor && $cursor.pos > 0) @@ -135102,14 +163407,14 @@ handlers.beforeinput = (view, _event) => { }; for (let prop2 in editHandlers) handlers[prop2] = editHandlers[prop2]; -function compareObjs(a, b) { - if (a == b) +function compareObjs(a2, b2) { + if (a2 == b2) return true; - for (let p2 in a) - if (a[p2] !== b[p2]) + for (let p2 in a2) + if (a2[p2] !== b2[p2]) return false; - for (let p2 in b) - if (!(p2 in a)) + for (let p2 in b2) + if (!(p2 in a2)) return false; return true; } @@ -135387,10 +163692,10 @@ class DecorationSet { for (let i2 = 0; i2 < children.length; i2 += 3) { let found2; let from2 = children[i2] + offset, to = children[i2 + 1] + offset; - for (let j = 0, span; j < decorations.length; j++) - if (span = decorations[j]) { + for (let j2 = 0, span; j2 < decorations.length; j2++) + if (span = decorations[j2]) { if (span.from > from2 && span.to < to) { - decorations[j] = null; + decorations[j2] = null; (found2 || (found2 = [])).push(span); } } @@ -135409,11 +163714,11 @@ class DecorationSet { if (local.length) { for (let i2 = 0, span; i2 < decorations.length; i2++) if (span = decorations[i2]) { - for (let j = 0; j < local.length; j++) - if (local[j].eq(span, offset)) { + for (let j2 = 0; j2 < local.length; j2++) + if (local[j2].eq(span, offset)) { if (local == this.local) local = this.local.slice(); - local.splice(j--, 1); + local.splice(j2--, 1); } } } @@ -135485,8 +163790,8 @@ class DecorationSet { } return result; } - forEachSet(f) { - f(this); + forEachSet(f2) { + f2(this); } } DecorationSet.empty = new DecorationSet([], []); @@ -135539,8 +163844,8 @@ class DecorationGroup { result = result.slice(); sorted = false; } - for (let j = 0; j < locals.length; j++) - result.push(locals[j]); + for (let j2 = 0; j2 < locals.length; j2++) + result.push(locals[j2]); } } return result ? removeOverlap(sorted ? result : result.sort(byPos)) : none; @@ -135554,12 +163859,12 @@ class DecorationGroup { case 1: return members[0]; default: - return new DecorationGroup(members.every((m) => m instanceof DecorationSet) ? members : members.reduce((r, m) => r.concat(m instanceof DecorationSet ? m : m.members), [])); + return new DecorationGroup(members.every((m2) => m2 instanceof DecorationSet) ? members : members.reduce((r2, m2) => r2.concat(m2 instanceof DecorationSet ? m2 : m2.members), [])); } } - forEachSet(f) { + forEachSet(f2) { for (let i2 = 0; i2 < this.members.length; i2++) - this.members[i2].forEachSet(f); + this.members[i2].forEachSet(f2); } } function mapChildren(oldChildren, newLocal, mapping, node3, offset, oldOffset, options4) { @@ -135623,11 +163928,11 @@ function mapChildren(oldChildren, newLocal, mapping, node3, offset, oldOffset, o children.splice(i2, 3); i2 -= 3; } - for (let i2 = 0, j = 0; i2 < built.children.length; i2 += 3) { + for (let i2 = 0, j2 = 0; i2 < built.children.length; i2 += 3) { let from2 = built.children[i2]; - while (j < children.length && children[j] < from2) - j += 3; - children.splice(j, 0, built.children[i2], built.children[i2 + 1], built.children[i2 + 2]); + while (j2 < children.length && children[j2] < from2) + j2 += 3; + children.splice(j2, 0, built.children[i2], built.children[i2 + 1], built.children[i2 + 2]); } } return new DecorationSet(newLocal.sort(byPos), children); @@ -135705,8 +164010,8 @@ function buildTree(spans, node3, offset, options4) { return locals.length || children.length ? new DecorationSet(locals, children) : empty; } __name(buildTree, "buildTree"); -function byPos(a, b) { - return a.from - b.from || a.to - b.to; +function byPos(a2, b2) { + return a2.from - b2.from || a2.to - b2.to; } __name(byPos, "byPos"); function removeOverlap(spans) { @@ -135714,14 +164019,14 @@ function removeOverlap(spans) { for (let i2 = 0; i2 < working.length - 1; i2++) { let span = working[i2]; if (span.from != span.to) - for (let j = i2 + 1; j < working.length; j++) { - let next2 = working[j]; + for (let j2 = i2 + 1; j2 < working.length; j2++) { + let next2 = working[j2]; if (next2.from == span.from) { if (next2.to != span.to) { if (working == spans) working = spans.slice(); - working[j] = next2.copy(next2.from, span.to); - insertAhead(working, j + 1, next2.copy(span.to, next2.to)); + working[j2] = next2.copy(next2.from, span.to); + insertAhead(working, j2 + 1, next2.copy(span.to, next2.to)); } continue; } else { @@ -135729,7 +164034,7 @@ function removeOverlap(spans) { if (working == spans) working = spans.slice(); working[i2] = span.copy(span.from, next2.from); - insertAhead(working, j, span.copy(next2.from, span.to)); + insertAhead(working, j2, span.copy(next2.from, span.to)); } break; } @@ -135746,8 +164051,8 @@ function insertAhead(array, i2, deco) { __name(insertAhead, "insertAhead"); function viewDecorations(view) { let found2 = []; - view.someProp("decorations", (f) => { - let result = f(view.state); + view.someProp("decorations", (f2) => { + let result = f2(view.state); if (result && result != empty) found2.push(result); }); @@ -135805,7 +164110,7 @@ class DOMObserver { this.observer = window.MutationObserver && new window.MutationObserver((mutations) => { for (let i2 = 0; i2 < mutations.length; i2++) this.queue.push(mutations[i2]); - if (ie$1 && ie_version <= 11 && mutations.some((m) => m.type == "childList" && m.removedNodes.length || m.type == "characterData" && m.oldValue.length > m.target.nodeValue.length)) + if (ie$1 && ie_version <= 11 && mutations.some((m2) => m2.type == "childList" && m2.removedNodes.length || m2.type == "characterData" && m2.oldValue.length > m2.target.nodeValue.length)) this.flushSoon(); else this.flush(); @@ -135928,13 +164233,13 @@ class DOMObserver { } } if (gecko && added.length) { - let brs = added.filter((n) => n.nodeName == "BR"); + let brs = added.filter((n2) => n2.nodeName == "BR"); if (brs.length == 2) { - let [a, b] = brs; - if (a.parentNode && a.parentNode.parentNode == b.parentNode) - b.remove(); + let [a2, b2] = brs; + if (a2.parentNode && a2.parentNode.parentNode == b2.parentNode) + b2.remove(); else - a.remove(); + a2.remove(); } else { let { focusNode: focusNode2 } = this.currentSelection; for (let br of brs) { @@ -136134,7 +164439,7 @@ function readDOMChange(view, from2, to, typeOver, addedNodes) { let origin2 = view.input.lastSelectionTime > Date.now() - 50 ? view.input.lastSelectionOrigin : null; let newSel = selectionFromDOM(view, origin2); if (newSel && !view.state.selection.eq(newSel)) { - if (chrome && android && view.input.lastKeyCode === 13 && Date.now() - 100 < view.input.lastKeyCodeTime && view.someProp("handleKeyDown", (f) => f(view, keyEvent(13, "Enter")))) + if (chrome && android && view.input.lastKeyCode === 13 && Date.now() - 100 < view.input.lastKeyCodeTime && view.someProp("handleKeyDown", (f2) => f2(view, keyEvent(13, "Enter")))) return; let tr3 = view.state.tr.setSelection(newSel); if (origin2 == "pointer") @@ -136166,7 +164471,7 @@ function readDOMChange(view, from2, to, typeOver, addedNodes) { let change = findDiff(compare2.content, parse2.doc.content, parse2.from, preferredPos, preferredSide); if (change) view.input.domChangeCount++; - if ((ios && view.input.lastIOSEnter > Date.now() - 225 || android) && addedNodes.some((n) => n.nodeType == 1 && !isInline$1.test(n.nodeName)) && (!change || change.endA >= change.endB) && view.someProp("handleKeyDown", (f) => f(view, keyEvent(13, "Enter")))) { + if ((ios && view.input.lastIOSEnter > Date.now() - 225 || android) && addedNodes.some((n2) => n2.nodeType == 1 && !isInline$1.test(n2.nodeName)) && (!change || change.endA >= change.endB) && view.someProp("handleKeyDown", (f2) => f2(view, keyEvent(13, "Enter")))) { view.input.lastIOSEnter = 0; return; } @@ -136204,11 +164509,11 @@ function readDOMChange(view, from2, to, typeOver, addedNodes) { let $fromA = doc2.resolve(change.start); let inlineChange = $from.sameParent($to) && $from.parent.inlineContent && $fromA.end() >= change.endA; let nextSel; - if ((ios && view.input.lastIOSEnter > Date.now() - 225 && (!inlineChange || addedNodes.some((n) => n.nodeName == "DIV" || n.nodeName == "P")) || !inlineChange && $from.pos < parse2.doc.content.size && !$from.sameParent($to) && (nextSel = Selection.findFrom(parse2.doc.resolve($from.pos + 1), 1, true)) && nextSel.head == $to.pos) && view.someProp("handleKeyDown", (f) => f(view, keyEvent(13, "Enter")))) { + if ((ios && view.input.lastIOSEnter > Date.now() - 225 && (!inlineChange || addedNodes.some((n2) => n2.nodeName == "DIV" || n2.nodeName == "P")) || !inlineChange && $from.pos < parse2.doc.content.size && !$from.sameParent($to) && (nextSel = Selection.findFrom(parse2.doc.resolve($from.pos + 1), 1, true)) && nextSel.head == $to.pos) && view.someProp("handleKeyDown", (f2) => f2(view, keyEvent(13, "Enter")))) { view.input.lastIOSEnter = 0; return; } - if (view.state.selection.anchor > change.start && looksLikeBackspace(doc2, change.start, change.endA, $from, $to) && view.someProp("handleKeyDown", (f) => f(view, keyEvent(8, "Backspace")))) { + if (view.state.selection.anchor > change.start && looksLikeBackspace(doc2, change.start, change.endA, $from, $to) && view.someProp("handleKeyDown", (f2) => f2(view, keyEvent(8, "Backspace")))) { if (android && chrome) view.domObserver.suppressSelectionUpdates(); return; @@ -136219,8 +164524,8 @@ function readDOMChange(view, from2, to, typeOver, addedNodes) { change.endB -= 2; $to = parse2.doc.resolveNoCache(change.endB - parse2.from); setTimeout(() => { - view.someProp("handleKeyDown", function(f) { - return f(view, keyEvent(13, "Enter")); + view.someProp("handleKeyDown", function(f2) { + return f2(view, keyEvent(13, "Enter")); }); }, 20); } @@ -136245,7 +164550,7 @@ function readDOMChange(view, from2, to, typeOver, addedNodes) { tr2.removeMark(chFrom, chTo, markChange.mark); } else if ($from.parent.child($from.index()).isText && $from.index() == $to.index() - ($to.textOffset ? 0 : 1)) { let text2 = $from.parent.textBetween($from.parentOffset, $to.parentOffset); - if (view.someProp("handleTextInput", (f) => f(view, chFrom, chTo, text2))) + if (view.someProp("handleTextInput", (f2) => f2(view, chFrom, chTo, text2))) return; tr2 = view.state.tr.insertText(text2, chFrom, chTo); } @@ -136288,10 +164593,10 @@ function isMarkChange(cur, prev2) { } else { return null; } - let updated13 = []; + let updated14 = []; for (let i2 = 0; i2 < prev2.childCount; i2++) - updated13.push(update(prev2.child(i2))); - if (Fragment.from(updated13).eq(cur)) + updated14.push(update(prev2.child(i2))); + if (Fragment.from(updated14).eq(cur)) return { mark: mark2, type }; } __name(isMarkChange, "isMarkChange"); @@ -136332,26 +164637,26 @@ function skipClosingAndOpening($pos, fromEnd, mayOpen) { return end; } __name(skipClosingAndOpening, "skipClosingAndOpening"); -function findDiff(a, b, pos2, preferredPos, preferredSide) { - let start2 = a.findDiffStart(b, pos2); +function findDiff(a2, b2, pos2, preferredPos, preferredSide) { + let start2 = a2.findDiffStart(b2, pos2); if (start2 == null) return null; - let { a: endA, b: endB } = a.findDiffEnd(b, pos2 + a.size, pos2 + b.size); + let { a: endA, b: endB } = a2.findDiffEnd(b2, pos2 + a2.size, pos2 + b2.size); if (preferredSide == "end") { let adjust = Math.max(0, start2 - Math.min(endA, endB)); preferredPos -= endA + adjust - start2; } - if (endA < start2 && a.size < b.size) { + if (endA < start2 && a2.size < b2.size) { let move = preferredPos <= start2 && preferredPos >= endA ? start2 - preferredPos : 0; start2 -= move; - if (start2 && start2 < b.size && isSurrogatePair(b.textBetween(start2 - 1, start2 + 1))) + if (start2 && start2 < b2.size && isSurrogatePair(b2.textBetween(start2 - 1, start2 + 1))) start2 += move ? 1 : -1; endB = start2 + (endB - endA); endA = start2; } else if (endB < start2) { let move = preferredPos <= start2 && preferredPos >= endB ? start2 - preferredPos : 0; start2 -= move; - if (start2 && start2 < a.size && isSurrogatePair(a.textBetween(start2 - 1, start2 + 1))) + if (start2 && start2 < a2.size && isSurrogatePair(a2.textBetween(start2 - 1, start2 + 1))) start2 += move ? 1 : -1; endA = start2 + (endA - endB); endB = start2; @@ -136362,8 +164667,8 @@ __name(findDiff, "findDiff"); function isSurrogatePair(str) { if (str.length != 2) return false; - let a = str.charCodeAt(0), b = str.charCodeAt(1); - return a >= 56320 && a <= 57343 && b >= 55296 && b <= 56319; + let a2 = str.charCodeAt(0), b2 = str.charCodeAt(1); + return a2 >= 56320 && a2 <= 57343 && b2 >= 55296 && b2 <= 56319; } __name(isSurrogatePair, "isSurrogatePair"); const __serializeForClipboard = serializeForClipboard; @@ -136458,13 +164763,13 @@ class EditorView { view.props, props))`. */ setProps(props) { - let updated13 = {}; + let updated14 = {}; for (let name2 in this._props) - updated13[name2] = this._props[name2]; - updated13.state = this.state; + updated14[name2] = this._props[name2]; + updated14.state = this.state; for (let name2 in props) - updated13[name2] = props[name2]; - this.update(updated13); + updated14[name2] = props[name2]; + this.update(updated14); } /** Update the editor's `state` prop, without touching any of the @@ -136539,7 +164844,7 @@ class EditorView { */ scrollToSelection() { let startDOM = this.domSelectionRange().focusNode; - if (this.someProp("handleScrollToSelection", (f) => f(this))) ; + if (this.someProp("handleScrollToSelection", (f2) => f2(this))) ; else if (this.state.selection instanceof NodeSelection) { let target = this.docView.domAfterPos(this.state.selection.from); if (target.nodeType == 1) @@ -136588,20 +164893,20 @@ class EditorView { } this.dragging = new Dragging(dragging.slice, dragging.move, found2 < 0 ? void 0 : NodeSelection.create(this.state.doc, found2)); } - someProp(propName, f) { + someProp(propName, f2) { let prop2 = this._props && this._props[propName], value4; - if (prop2 != null && (value4 = f ? f(prop2) : prop2)) + if (prop2 != null && (value4 = f2 ? f2(prop2) : prop2)) return value4; for (let i2 = 0; i2 < this.directPlugins.length; i2++) { let prop3 = this.directPlugins[i2].props[propName]; - if (prop3 != null && (value4 = f ? f(prop3) : prop3)) + if (prop3 != null && (value4 = f2 ? f2(prop3) : prop3)) return value4; } let plugins = this.state.plugins; if (plugins) for (let i2 = 0; i2 < plugins.length; i2++) { let prop3 = plugins[i2].props[propName]; - if (prop3 != null && (value4 = f ? f(prop3) : prop3)) + if (prop3 != null && (value4 = f2 ? f2(prop3) : prop3)) return value4; } } @@ -136871,14 +165176,14 @@ function buildNodeViews(view) { return result; } __name(buildNodeViews, "buildNodeViews"); -function changedNodeViews(a, b) { +function changedNodeViews(a2, b2) { let nA = 0, nB = 0; - for (let prop2 in a) { - if (a[prop2] != b[prop2]) + for (let prop2 in a2) { + if (a2[prop2] != b2[prop2]) return true; nA++; } - for (let _2 in b) + for (let _2 in b2) nB++; return nA != nB; } @@ -137387,18 +165692,18 @@ function splitBlockAs(splitNode) { return false; let types = []; let splitDepth, deflt, atEnd = false, atStart = false; - for (let d = $from.depth; ; d--) { - let node3 = $from.node(d); + for (let d2 = $from.depth; ; d2--) { + let node3 = $from.node(d2); if (node3.isBlock) { - atEnd = $from.end(d) == $from.pos + ($from.depth - d); - atStart = $from.start(d) == $from.pos - ($from.depth - d); - deflt = defaultBlockAt$1($from.node(d - 1).contentMatchAt($from.indexAfter(d - 1))); + atEnd = $from.end(d2) == $from.pos + ($from.depth - d2); + atStart = $from.start(d2) == $from.pos - ($from.depth - d2); + deflt = defaultBlockAt$1($from.node(d2 - 1).contentMatchAt($from.indexAfter(d2 - 1))); let splitType = splitNode && splitNode($to.parent, atEnd, $from); types.unshift(splitType || (atEnd && deflt ? { type: deflt } : null)); - splitDepth = d; + splitDepth = d2; break; } else { - if (d == 1) + if (d2 == 1) return false; types.unshift(null); } @@ -137630,14 +165935,14 @@ function toggleMark$1(markType, attrs4 = null, options4) { if (!enterAtoms) ranges = removeInlineAtoms(ranges); if (removeWhenPresent) { - add3 = !ranges.some((r) => state.doc.rangeHasMark(r.$from.pos, r.$to.pos, markType)); + add3 = !ranges.some((r2) => state.doc.rangeHasMark(r2.$from.pos, r2.$to.pos, markType)); } else { - add3 = !ranges.every((r) => { + add3 = !ranges.every((r2) => { let missing = false; - tr2.doc.nodesBetween(r.$from.pos, r.$to.pos, (node3, pos2, parent) => { + tr2.doc.nodesBetween(r2.$from.pos, r2.$to.pos, (node3, pos2, parent) => { if (missing) return false; - missing = !markType.isInSet(node3.marks) && !!parent && parent.type.allowsMarkType(markType) && !(node3.isText && /^\s*$/.test(node3.textBetween(Math.max(0, r.$from.pos - pos2), Math.min(node3.nodeSize, r.$to.pos - pos2)))); + missing = !markType.isInSet(node3.marks) && !!parent && parent.type.allowsMarkType(markType) && !(node3.isText && /^\s*$/.test(node3.textBetween(Math.max(0, r2.$from.pos - pos2), Math.min(node3.nodeSize, r2.$to.pos - pos2)))); }); return !missing; }); @@ -137671,8 +165976,8 @@ function wrapDispatchForJoin(dispatch, isJoinable) { let ranges = []; for (let i2 = 0; i2 < tr2.mapping.maps.length; i2++) { let map3 = tr2.mapping.maps[i2]; - for (let j = 0; j < ranges.length; j++) - ranges[j] = map3.map(ranges[j]); + for (let j2 = 0; j2 < ranges.length; j2++) + ranges[j2] = map3.map(ranges[j2]); map3.forEach((_s, _e, from2, to) => ranges.push(from2, to)); } let joinable2 = []; @@ -137691,7 +165996,7 @@ function wrapDispatchForJoin(dispatch, isJoinable) { pos2 += after.nodeSize; } } - joinable2.sort((a, b) => a - b); + joinable2.sort((a2, b2) => a2 - b2); for (let i2 = joinable2.length - 1; i2 >= 0; i2--) { if (canJoin(tr2.doc, joinable2[i2])) tr2.join(joinable2[i2]); @@ -137849,8 +166154,8 @@ function splitListItem$1(itemType, itemAttrs) { if (dispatch) { let wrap2 = Fragment.empty; let depthBefore = $from.index(-1) ? 1 : $from.index(-2) ? 2 : 3; - for (let d = $from.depth - depthBefore; d >= $from.depth - 3; d--) - wrap2 = Fragment.from($from.node(d).copy(wrap2)); + for (let d2 = $from.depth - depthBefore; d2 >= $from.depth - 3; d2--) + wrap2 = Fragment.from($from.node(d2).copy(wrap2)); let depthAfter = $from.indexAfter(-1) < $from.node(-2).childCount ? 1 : $from.indexAfter(-2) < $from.node(-3).childCount ? 2 : 3; wrap2 = wrap2.append(Fragment.from(itemType.createAndFill())); let start2 = $from.before($from.depth - (depthBefore - 1)); @@ -138350,10 +166655,10 @@ function injectExtensionAttributesToParseRule(parseRule, extensionAttributes) { }; } __name(injectExtensionAttributesToParseRule, "injectExtensionAttributesToParseRule"); -function cleanUpSchemaItem(data24) { +function cleanUpSchemaItem(data25) { return Object.fromEntries( // @ts-ignore - Object.entries(data24).filter(([key, value4]) => { + Object.entries(data25).filter(([key, value4]) => { if (key === "attrs" && isEmptyObject(value4)) { return false; } @@ -138781,11 +167086,11 @@ class Mark { const isAtEnd = currentPos.pos === currentPos.end(); if (isAtEnd) { const currentMarks = currentPos.marks(); - const isInMark = !!currentMarks.find((m) => (m === null || m === void 0 ? void 0 : m.type.name) === mark2.name); + const isInMark = !!currentMarks.find((m2) => (m2 === null || m2 === void 0 ? void 0 : m2.type.name) === mark2.name); if (!isInMark) { return false; } - const removeMark2 = currentMarks.find((m) => (m === null || m === void 0 ? void 0 : m.type.name) === mark2.name); + const removeMark2 = currentMarks.find((m2) => (m2 === null || m2 === void 0 ? void 0 : m2.type.name) === mark2.name); if (removeMark2) { tr2.removeStoredMark(removeMark2); } @@ -139051,9 +167356,9 @@ class ExtensionManager { */ static sort(extensions) { const defaultPriority = 100; - return extensions.sort((a, b) => { - const priorityA = getExtensionField(a, "priority") || defaultPriority; - const priorityB = getExtensionField(b, "priority") || defaultPriority; + return extensions.sort((a2, b2) => { + const priorityA = getExtensionField(a2, "priority") || defaultPriority; + const priorityB = getExtensionField(b2, "priority") || defaultPriority; if (priorityA > priorityB) { return -1; } @@ -139503,7 +167808,7 @@ function findMarkInSet(marks, type, attributes = {}) { return marks.find((item3) => { return item3.type === type && objectIncludes( // Only check equality for the attributes that are provided - Object.fromEntries(Object.keys(attributes).map((k) => [k, item3.attrs[k]])), + Object.fromEntries(Object.keys(attributes).map((k2) => [k2, item3.attrs[k2]])), attributes ); }); @@ -139969,7 +168274,7 @@ const keyboardShortcut = /* @__PURE__ */ __name((name2) => ({ editor, view, tr: cancelable: true }); const capturedTransaction = editor.captureTransaction(() => { - view.someProp("handleKeyDown", (f) => f(view, event)); + view.someProp("handleKeyDown", (f2) => f2(view, event)); }); capturedTransaction === null || capturedTransaction === void 0 ? void 0 : capturedTransaction.steps.forEach((step3) => { const newStep = step3.map(tr2.mapping); @@ -140337,7 +168642,7 @@ function getChangedRanges(transform2) { __name(getChangedRanges, "getChangedRanges"); function getDebugJSON(node3, startOffset = 0) { const isTopNode = node3.type === node3.type.schema.topNodeType; - const increment = isTopNode ? 0 : 1; + const increment2 = isTopNode ? 0 : 1; const from2 = startOffset; const to = from2 + node3.nodeSize; const marks = node3.marks.map((mark2) => { @@ -140365,7 +168670,7 @@ function getDebugJSON(node3, startOffset = 0) { output.content = []; node3.forEach((child, offset) => { var _a2; - (_a2 = output.content) === null || _a2 === void 0 ? void 0 : _a2.push(getDebugJSON(child, startOffset + offset + increment)); + (_a2 = output.content) === null || _a2 === void 0 ? void 0 : _a2.push(getDebugJSON(child, startOffset + offset + increment2)); }); } if (node3.text) { @@ -140589,7 +168894,7 @@ function posToDOMRect(view, from2, to) { const height = bottom - top; const x2 = left; const y2 = top; - const data24 = { + const data25 = { top, bottom, left, @@ -140600,8 +168905,8 @@ function posToDOMRect(view, from2, to) { y: y2 }; return { - ...data24, - toJSON: /* @__PURE__ */ __name(() => data24, "toJSON") + ...data25, + toJSON: /* @__PURE__ */ __name(() => data25, "toJSON") }; } __name(posToDOMRect, "posToDOMRect"); @@ -140808,8 +169113,8 @@ const splitListItem = /* @__PURE__ */ __name((typeOrName, overrideAttrs = {}) => if (dispatch) { let wrap2 = Fragment.empty; const depthBefore = $from.index(-1) ? 1 : $from.index(-2) ? 2 : 3; - for (let d = $from.depth - depthBefore; d >= $from.depth - 3; d -= 1) { - wrap2 = Fragment.from($from.node(d).copy(wrap2)); + for (let d2 = $from.depth - depthBefore; d2 >= $from.depth - 3; d2 -= 1) { + wrap2 = Fragment.from($from.node(d2).copy(wrap2)); } const depthAfter = $from.indexAfter(-1) < $from.node(-2).childCount ? 1 : $from.indexAfter(-2) < $from.node(-3).childCount ? 2 : 3; const newNextTypeAttributes2 = { @@ -140821,11 +169126,11 @@ const splitListItem = /* @__PURE__ */ __name((typeOrName, overrideAttrs = {}) => const start2 = $from.before($from.depth - (depthBefore - 1)); tr2.replace(start2, $from.after(-depthAfter), new Slice(wrap2, 4 - depthBefore, 0)); let sel = -1; - tr2.doc.nodesBetween(start2, tr2.doc.content.size, (n, pos2) => { + tr2.doc.nodesBetween(start2, tr2.doc.content.size, (n2, pos2) => { if (sel > -1) { return false; } - if (n.isTextblock && n.content.size === 0) { + if (n2.isTextblock && n2.content.size === 0) { sel = pos2 + 1; } }); @@ -140981,8 +169286,8 @@ const undoInputRule = /* @__PURE__ */ __name(() => ({ state, dispatch }) => { if (dispatch) { const tr2 = state.tr; const toUndo = undoable.transform; - for (let j = toUndo.steps.length - 1; j >= 0; j -= 1) { - tr2.step(toUndo.steps[j].invert(toUndo.docs[j])); + for (let j2 = toUndo.steps.length - 1; j2 >= 0; j2 -= 1) { + tr2.step(toUndo.steps[j2].invert(toUndo.docs[j2])); } if (undoable.text) { const marks = tr2.doc.resolve(undoable.from).marks(); @@ -142646,8 +170951,8 @@ function addToGroups(t2, flags, groups) { if (flags[emoji]) { flags[domain] = true; } - for (const k in flags) { - const group = registerGroup(k, groups); + for (const k2 in flags) { + const group = registerGroup(k2, groups); if (group.indexOf(t2) < 0) { group.push(t2); } @@ -142656,9 +170961,9 @@ function addToGroups(t2, flags, groups) { __name(addToGroups, "addToGroups"); function flagsForToken(t2, groups) { const result = {}; - for (const c in groups) { - if (groups[c].indexOf(t2) >= 0) { - result[c] = true; + for (const c2 in groups) { + if (groups[c2].indexOf(t2) >= 0) { + result[c2] = true; } } return result; @@ -143094,7 +171399,7 @@ function init$2(customSchemes = []) { slashscheme: true, ascii: true }, groups); - customSchemes = customSchemes.sort((a, b) => a[0] > b[0] ? 1 : -1); + customSchemes = customSchemes.sort((a2, b2) => a2[0] > b2[0] ? 1 : -1); for (let i2 = 0; i2 < customSchemes.length; i2++) { const sch = customSchemes[i2][0]; const optionalSlashSlash = customSchemes[i2][1]; @@ -143127,7 +171432,7 @@ function init$2(customSchemes = []) { } __name(init$2, "init$2"); function run$1(start2, str) { - const iterable = stringToArray(str.replace(/[A-Z]/g, (c) => c.toLowerCase())); + const iterable = stringToArray(str.replace(/[A-Z]/g, (c2) => c2.toLowerCase())); const charCount = iterable.length; const tokens = []; let cursor = 0; @@ -143245,16 +171550,16 @@ const defaults = { render: null }; function Options(opts, defaultRender = null) { - let o = assign$2({}, defaults); + let o2 = assign$2({}, defaults); if (opts) { - o = assign$2(o, opts instanceof Options ? opts.o : opts); + o2 = assign$2(o2, opts instanceof Options ? opts.o : opts); } - const ignoredTags = o.ignoreTags; + const ignoredTags = o2.ignoreTags; const uppercaseIgnoredTags = []; for (let i2 = 0; i2 < ignoredTags.length; i2++) { uppercaseIgnoredTags.push(ignoredTags[i2].toUpperCase()); } - this.o = o; + this.o = o2; if (defaultRender) { this.defaultRender = defaultRender; } @@ -143378,9 +171683,9 @@ MultiToken.prototype = { */ toFormattedString(options4) { const val = this.toString(); - const truncate = options4.get("truncate", val, this); + const truncate2 = options4.get("truncate", val, this); const formatted = options4.get("format", val, this); - return truncate && formatted.length > truncate ? formatted.substring(0, truncate) + "…" : formatted; + return truncate2 && formatted.length > truncate2 ? formatted.substring(0, truncate2) + "…" : formatted; }, /** * @@ -143875,7 +172180,7 @@ function autolink$1(options4) { textBeforeWhitespace = newState.doc.textBetween(textBlock.pos, newRange.to, void 0, " "); } if (textBlock && textBeforeWhitespace) { - const wordsBeforeWhitespace = textBeforeWhitespace.split(" ").filter((s) => s !== ""); + const wordsBeforeWhitespace = textBeforeWhitespace.split(" ").filter((s2) => s2 !== ""); if (wordsBeforeWhitespace.length <= 0) { return false; } @@ -143927,11 +172232,11 @@ function clickHandler(options4) { if (!view.editable) { return false; } - let a = event.target; + let a2 = event.target; const els = []; - while (a.nodeName !== "DIV") { - els.push(a); - a = a.parentNode; + while (a2.nodeName !== "DIV") { + els.push(a2); + a2 = a2.parentNode; } if (!els.find((value4) => value4.nodeName === "A")) { return false; @@ -144238,10 +172543,10 @@ var TableMap = class { const top = i2 / this.width | 0; let right = left + 1; let bottom = top + 1; - for (let j = 1; right < this.width && this.map[i2 + j] == curPos; j++) { + for (let j2 = 1; right < this.width && this.map[i2 + j2] == curPos; j2++) { right++; } - for (let j = 1; bottom < this.height && this.map[i2 + this.width * j] == curPos; j++) { + for (let j2 = 1; bottom < this.height && this.map[i2 + this.width * j2] == curPos; j2++) { bottom++; } return { left, top, right, bottom }; @@ -144272,19 +172577,19 @@ var TableMap = class { } } // Get the rectangle spanning the two given cells. - rectBetween(a, b) { + rectBetween(a2, b2) { const { left: leftA, right: rightA, top: topA, bottom: bottomA - } = this.findCell(a); + } = this.findCell(a2); const { left: leftB, right: rightB, top: topB, bottom: bottomB - } = this.findCell(b); + } = this.findCell(b2); return { left: Math.min(leftA, leftB), top: Math.min(topA, topB), @@ -144362,19 +172667,19 @@ function computeMap(table2) { break; } const start2 = mapPos + h2 * width2; - for (let w = 0; w < colspan; w++) { - if (map3[start2 + w] == 0) - map3[start2 + w] = pos2; + for (let w2 = 0; w2 < colspan; w2++) { + if (map3[start2 + w2] == 0) + map3[start2 + w2] = pos2; else (problems || (problems = [])).push({ type: "collision", row, pos: pos2, - n: colspan - w + n: colspan - w2 }); - const colW = colwidth && colwidth[w]; + const colW = colwidth && colwidth[w2]; if (colW) { - const widthIndex = (start2 + w) % width2 * 2, prev2 = colWidths[widthIndex]; + const widthIndex = (start2 + w2) % width2 * 2, prev2 = colWidths[widthIndex]; if (prev2 == null || prev2 != colW && colWidths[widthIndex + 1] == 1) { colWidths[widthIndex] = colW; colWidths[widthIndex + 1] = 1; @@ -144413,11 +172718,11 @@ function findWidth(table2) { const rowNode = table2.child(row); let rowWidth = 0; if (hasRowSpan) - for (let j = 0; j < row; j++) { - const prevRow = table2.child(j); + for (let j2 = 0; j2 < row; j2++) { + const prevRow = table2.child(j2); for (let i2 = 0; i2 < prevRow.childCount; i2++) { const cell = prevRow.child(i2); - if (j + cell.attrs.rowspan > row) + if (j2 + cell.attrs.rowspan > row) rowWidth += cell.attrs.colspan; } } @@ -144448,19 +172753,19 @@ function findBadColWidths(map3, colWidths, table2) { if (!node3) { throw new RangeError(`No cell with offset ${pos2} found`); } - let updated13 = null; + let updated14 = null; const attrs4 = node3.attrs; - for (let j = 0; j < attrs4.colspan; j++) { - const col = (i2 + j) % map3.width; + for (let j2 = 0; j2 < attrs4.colspan; j2++) { + const col = (i2 + j2) % map3.width; const colWidth = colWidths[col * 2]; - if (colWidth != null && (!attrs4.colwidth || attrs4.colwidth[j] != colWidth)) - (updated13 || (updated13 = freshColWidth(attrs4)))[j] = colWidth; + if (colWidth != null && (!attrs4.colwidth || attrs4.colwidth[j2] != colWidth)) + (updated14 || (updated14 = freshColWidth(attrs4)))[j2] = colWidth; } - if (updated13) + if (updated14) map3.problems.unshift({ type: "colwidth mismatch", pos: pos2, - colwidth: updated13 + colwidth: updated14 }); } } @@ -144479,7 +172784,7 @@ function getCellAttrs(dom, extraAttrs) { return {}; } const widthAttr = dom.getAttribute("data-colwidth"); - const widths = widthAttr && /^\d+(,\d+)*$/.test(widthAttr) ? widthAttr.split(",").map((s) => Number(s)) : null; + const widths = widthAttr && /^\d+(,\d+)*$/.test(widthAttr) ? widthAttr.split(",").map((s2) => Number(s2)) : null; const colspan = Number(dom.getAttribute("colspan") || 1); const result = { colspan, @@ -144582,25 +172887,25 @@ function tableNodeTypes(schema2) { __name(tableNodeTypes, "tableNodeTypes"); var tableEditingKey = new PluginKey("selectingCells"); function cellAround($pos) { - for (let d = $pos.depth - 1; d > 0; d--) - if ($pos.node(d).type.spec.tableRole == "row") - return $pos.node(0).resolve($pos.before(d + 1)); + for (let d2 = $pos.depth - 1; d2 > 0; d2--) + if ($pos.node(d2).type.spec.tableRole == "row") + return $pos.node(0).resolve($pos.before(d2 + 1)); return null; } __name(cellAround, "cellAround"); function cellWrapping($pos) { - for (let d = $pos.depth; d > 0; d--) { - const role = $pos.node(d).type.spec.tableRole; + for (let d2 = $pos.depth; d2 > 0; d2--) { + const role = $pos.node(d2).type.spec.tableRole; if (role === "cell" || role === "header_cell") - return $pos.node(d); + return $pos.node(d2); } return null; } __name(cellWrapping, "cellWrapping"); function isInTable(state) { const $head = state.selection.$head; - for (let d = $head.depth; d > 0; d--) - if ($head.node(d).type.spec.tableRole == "row") + for (let d2 = $head.depth; d2 > 0; d2--) + if ($head.node(d2).type.spec.tableRole == "row") return true; return false; } @@ -144660,22 +172965,22 @@ function nextCell($pos, axis, dir) { return moved == null ? null : $pos.node(0).resolve(tableStart + moved); } __name(nextCell, "nextCell"); -function removeColSpan(attrs4, pos2, n = 1) { - const result = { ...attrs4, colspan: attrs4.colspan - n }; +function removeColSpan(attrs4, pos2, n2 = 1) { + const result = { ...attrs4, colspan: attrs4.colspan - n2 }; if (result.colwidth) { result.colwidth = result.colwidth.slice(); - result.colwidth.splice(pos2, n); - if (!result.colwidth.some((w) => w > 0)) + result.colwidth.splice(pos2, n2); + if (!result.colwidth.some((w2) => w2 > 0)) result.colwidth = null; } return result; } __name(removeColSpan, "removeColSpan"); -function addColSpan(attrs4, pos2, n = 1) { - const result = { ...attrs4, colspan: attrs4.colspan + n }; +function addColSpan(attrs4, pos2, n2 = 1) { + const result = { ...attrs4, colspan: attrs4.colspan + n2 }; if (result.colwidth) { result.colwidth = result.colwidth.slice(); - for (let i2 = 0; i2 < n; i2++) + for (let i2 = 0; i2 < n2; i2++) result.colwidth.splice(pos2, 0, 0); } return result; @@ -144824,7 +173129,7 @@ var CellSelection = class _CellSelection extends Selection { replaceWith(tr2, node3) { this.replace(tr2, new Slice(Fragment.from(node3), 0, 0)); } - forEachCell(f) { + forEachCell(f2) { const table2 = this.$anchorCell.node(-1); const map3 = TableMap.get(table2); const tableStart = this.$anchorCell.start(-1); @@ -144835,7 +173140,7 @@ var CellSelection = class _CellSelection extends Selection { ) ); for (let i2 = 0; i2 < cells.length; i2++) { - f(table2.nodeAt(cells[i2]), tableStart + cells[i2]); + f2(table2.nodeAt(cells[i2]), tableStart + cells[i2]); } } // True if this selection goes all the way from the top to the @@ -144979,8 +173284,8 @@ function isCellBoundarySelection({ $from, $to }) { for (; depth >= 0; depth--, afterFrom++) if ($from.after(depth + 1) < $from.end(depth)) break; - for (let d = $to.depth; d >= 0; d--, beforeTo--) - if ($to.before(d + 1) > $to.start(d)) + for (let d2 = $to.depth; d2 >= 0; d2--, beforeTo--) + if ($to.before(d2 + 1) > $to.start(d2)) break; return afterFrom == beforeTo && /row|table/.test($from.node(depth).type.spec.tableRole); } @@ -145033,23 +173338,23 @@ function normalizeSelection(state, tr2, allowTableNodeSelection) { } __name(normalizeSelection, "normalizeSelection"); var fixTablesKey = new PluginKey("fix-tables"); -function changedDescendants(old, cur, offset, f) { +function changedDescendants(old, cur, offset, f2) { const oldSize = old.childCount, curSize = cur.childCount; outer: - for (let i2 = 0, j = 0; i2 < curSize; i2++) { + for (let i2 = 0, j2 = 0; i2 < curSize; i2++) { const child = cur.child(i2); - for (let scan = j, e2 = Math.min(oldSize, i2 + 3); scan < e2; scan++) { + for (let scan = j2, e2 = Math.min(oldSize, i2 + 3); scan < e2; scan++) { if (old.child(scan) == child) { - j = scan + 1; + j2 = scan + 1; offset += child.nodeSize; continue outer; } } - f(child, offset); - if (j < oldSize && old.child(j).sameMarkup(child)) - changedDescendants(old.child(j), child, offset + 1, f); + f2(child, offset); + if (j2 < oldSize && old.child(j2).sameMarkup(child)) + changedDescendants(old.child(j2), child, offset + 1, f2); else - child.nodesBetween(0, child.content.size, f, offset + 1); + child.nodesBetween(0, child.content.size, f2, offset + 1); offset += child.nodeSize; } } @@ -145083,8 +173388,8 @@ function fixTable(state, table2, tablePos, tr2) { if (!cell) continue; const attrs4 = cell.attrs; - for (let j = 0; j < attrs4.rowspan; j++) - mustAdd[prob.row + j] += prob.n; + for (let j2 = 0; j2 < attrs4.rowspan; j2++) + mustAdd[prob.row + j2] += prob.n; tr2.setNodeMarkup( tr2.mapping.map(tablePos + 1 + prob.pos), null, @@ -145127,7 +173432,7 @@ function fixTable(state, table2, tablePos, tr2) { role = row.firstChild.type.spec.tableRole; } const nodes = []; - for (let j = 0; j < add3; j++) { + for (let j2 = 0; j2 < add3; j2++) { const node3 = tableNodeTypes(state.schema)[role].createAndFill(); if (node3) nodes.push(node3); @@ -145359,8 +173664,8 @@ function deleteRow(state, dispatch) { } __name(deleteRow, "deleteRow"); function isEmpty(cell) { - const c = cell.content; - return c.childCount == 1 && c.child(0).isTextblock && c.child(0).childCount == 0; + const c2 = cell.content; + return c2.childCount == 1 && c2.child(0).isTextblock && c2.child(0).childCount == 0; } __name(isEmpty, "isEmpty"); function cellsOverlapRectangle({ width: width2, height, map: map3 }, rect) { @@ -145698,12 +174003,12 @@ function goToNextCell(direction) { __name(goToNextCell, "goToNextCell"); function deleteTable(state, dispatch) { const $pos = state.selection.$anchor; - for (let d = $pos.depth; d > 0; d--) { - const node3 = $pos.node(d); + for (let d2 = $pos.depth; d2 > 0; d2--) { + const node3 = $pos.node(d2); if (node3.type.spec.tableRole == "table") { if (dispatch) dispatch( - state.tr.delete($pos.before(d), $pos.after(d)).scrollIntoView() + state.tr.delete($pos.before(d2), $pos.after(d2)).scrollIntoView() ); return true; } @@ -145773,25 +174078,25 @@ function ensureRectangular(schema2, rows) { const widths = []; for (let i2 = 0; i2 < rows.length; i2++) { const row = rows[i2]; - for (let j = row.childCount - 1; j >= 0; j--) { - const { rowspan, colspan } = row.child(j).attrs; - for (let r = i2; r < i2 + rowspan; r++) - widths[r] = (widths[r] || 0) + colspan; + for (let j2 = row.childCount - 1; j2 >= 0; j2--) { + const { rowspan, colspan } = row.child(j2).attrs; + for (let r2 = i2; r2 < i2 + rowspan; r2++) + widths[r2] = (widths[r2] || 0) + colspan; } } let width2 = 0; - for (let r = 0; r < widths.length; r++) - width2 = Math.max(width2, widths[r]); - for (let r = 0; r < widths.length; r++) { - if (r >= rows.length) + for (let r2 = 0; r2 < widths.length; r2++) + width2 = Math.max(width2, widths[r2]); + for (let r2 = 0; r2 < widths.length; r2++) { + if (r2 >= rows.length) rows.push(Fragment.empty); - if (widths[r] < width2) { + if (widths[r2] < width2) { const empty3 = tableNodeTypes(schema2).cell.createAndFill(); const cells = []; - for (let i2 = widths[r]; i2 < width2; i2++) { + for (let i2 = widths[r2]; i2 < width2; i2++) { cells.push(empty3); } - rows[r] = rows[r].append(Fragment.from(cells)); + rows[r2] = rows[r2].append(Fragment.from(cells)); } } return { height: rows.length, width: width2, rows }; @@ -145822,8 +174127,8 @@ function clipCells({ width: width2, height, rows }, newWidth, newHeight) { ); cells.push(cell); col += cell.attrs.colspan; - for (let j = 1; j < cell.attrs.rowspan; j++) - added[row + j] = (added[row + j] || 0) + cell.attrs.colspan; + for (let j2 = 1; j2 < cell.attrs.rowspan; j2++) + added[row + j2] = (added[row + j2] || 0) + cell.attrs.colspan; } newRows.push(Fragment.from(cells)); } @@ -145834,8 +174139,8 @@ function clipCells({ width: width2, height, rows }, newWidth, newHeight) { const newRows = []; for (let row = 0, i2 = 0; row < newHeight; row++, i2++) { const cells = [], source = rows[i2 % height]; - for (let j = 0; j < source.childCount; j++) { - let cell = source.child(j); + for (let j2 = 0; j2 < source.childCount; j2++) { + let cell = source.child(j2); if (row + cell.attrs.rowspan > newHeight) cell = cell.type.create( { @@ -146195,12 +174500,12 @@ function atEndOfCell(view, axis, dir) { if (!(view.state.selection instanceof TextSelection)) return null; const { $head } = view.state.selection; - for (let d = $head.depth - 1; d >= 0; d--) { - const parent = $head.node(d), index2 = dir < 0 ? $head.index(d) : $head.indexAfter(d); + for (let d2 = $head.depth - 1; d2 >= 0; d2--) { + const parent = $head.node(d2), index2 = dir < 0 ? $head.index(d2) : $head.indexAfter(d2); if (index2 != (dir < 0 ? 0 : parent.childCount)) return null; if (parent.type.spec.tableRole == "cell" || parent.type.spec.tableRole == "header_cell") { - const cellPos = $head.before(d); + const cellPos = $head.before(d2); const dirStr = axis == "vert" ? dir > 0 ? "down" : "up" : dir > 0 ? "right" : "left"; return view.endOfTextblock(dirStr) ? cellPos : null; } @@ -146257,8 +174562,8 @@ var TableView$1 = class TableView2 { ); return true; } - ignoreMutation(record) { - return record.type == "attributes" && (record.target == this.table || this.colgroup.contains(record.target)); + ignoreMutation(record2) { + return record2.type == "attributes" && (record2.target == this.table || this.colgroup.contains(record2.target)); } }; function updateColumnsOnResize(node3, colgroup, table2, defaultCellMinWidth, overrideCol, overrideValue) { @@ -146271,8 +174576,8 @@ function updateColumnsOnResize(node3, colgroup, table2, defaultCellMinWidth, ove return; for (let i2 = 0, col = 0; i2 < row.childCount; i2++) { const { colspan, colwidth } = row.child(i2).attrs; - for (let j = 0; j < colspan; j++, col++) { - const hasWidth = overrideCol == col ? overrideValue : colwidth && colwidth[j]; + for (let j2 = 0; j2 < colspan; j2++, col++) { + const hasWidth = overrideCol == col ? overrideValue : colwidth && colwidth[j2]; const cssWidth = hasWidth ? hasWidth + "px" : ""; totalWidth += hasWidth || defaultCellMinWidth; if (!hasWidth) @@ -146573,8 +174878,8 @@ function displayColumnWidth(view, cell, width2, defaultCellMinWidth) { ); } __name(displayColumnWidth, "displayColumnWidth"); -function zeroes(n) { - return Array(n).fill(0); +function zeroes(n2) { + return Array(n2).fill(0); } __name(zeroes, "zeroes"); function handleDecorations(state, cell) { @@ -146672,8 +174977,8 @@ function updateColumns(node3, colgroup, table2, cellMinWidth, overrideCol, overr if (row !== null) { for (let i2 = 0, col = 0; i2 < row.childCount; i2 += 1) { const { colspan, colwidth } = row.child(i2).attrs; - for (let j = 0; j < colspan; j += 1, col += 1) { - const hasWidth = overrideCol === col ? overrideValue : colwidth && colwidth[j]; + for (let j2 = 0; j2 < colspan; j2 += 1, col += 1) { + const hasWidth = overrideCol === col ? overrideValue : colwidth && colwidth[j2]; const cssWidth = hasWidth ? `${hasWidth}px` : ""; totalWidth += hasWidth || cellMinWidth; if (!hasWidth) { @@ -146744,8 +175049,8 @@ function createColGroup(node3, cellMinWidth, overrideCol, overrideValue) { } for (let i2 = 0, col = 0; i2 < row.childCount; i2 += 1) { const { colspan, colwidth } = row.child(i2).attrs; - for (let j = 0; j < colspan; j += 1, col += 1) { - const hasWidth = overrideCol === col ? overrideValue : colwidth && colwidth[j]; + for (let j2 = 0; j2 < colspan; j2 += 1, col += 1) { + const hasWidth = overrideCol === col ? overrideValue : colwidth && colwidth[j2]; totalWidth += hasWidth || cellMinWidth; if (!hasWidth) { fixedWidth = false; @@ -147720,12 +176025,12 @@ class GapCursor extends Selection { if (!mustMove && GapCursor.valid($pos)) return $pos; let pos2 = $pos.pos, next2 = null; - for (let d = $pos.depth; ; d--) { - let parent = $pos.node(d); - if (dir > 0 ? $pos.indexAfter(d) < parent.childCount : $pos.index(d) > 0) { - next2 = parent.child(dir > 0 ? $pos.indexAfter(d) : $pos.index(d) - 1); + for (let d2 = $pos.depth; ; d2--) { + let parent = $pos.node(d2); + if (dir > 0 ? $pos.indexAfter(d2) < parent.childCount : $pos.index(d2) > 0) { + next2 = parent.child(dir > 0 ? $pos.indexAfter(d2) : $pos.index(d2) - 1); break; - } else if (d == 0) { + } else if (d2 == 0) { return null; } pos2 += dir; @@ -147772,8 +176077,8 @@ class GapBookmark { } } function closedBefore($pos) { - for (let d = $pos.depth; d >= 0; d--) { - let index2 = $pos.index(d), parent = $pos.node(d); + for (let d2 = $pos.depth; d2 >= 0; d2--) { + let index2 = $pos.index(d2), parent = $pos.node(d2); if (index2 == 0) { if (parent.type.spec.isolating) return true; @@ -147790,8 +176095,8 @@ function closedBefore($pos) { } __name(closedBefore, "closedBefore"); function closedAfter($pos) { - for (let d = $pos.depth; d >= 0; d--) { - let index2 = $pos.indexAfter(d), parent = $pos.node(d); + for (let d2 = $pos.depth; d2 >= 0; d2--) { + let index2 = $pos.indexAfter(d2), parent = $pos.node(d2); if (index2 == parent.childCount) { if (parent.type.spec.isolating) return true; @@ -148057,21 +176362,21 @@ RopeSequence.prototype.get = /* @__PURE__ */ __name(function get2(i2) { } return this.getInner(i2); }, "get"); -RopeSequence.prototype.forEach = /* @__PURE__ */ __name(function forEach2(f, from2, to) { +RopeSequence.prototype.forEach = /* @__PURE__ */ __name(function forEach2(f2, from2, to) { if (from2 === void 0) from2 = 0; if (to === void 0) to = this.length; if (from2 <= to) { - this.forEachInner(f, from2, to, 0); + this.forEachInner(f2, from2, to, 0); } else { - this.forEachInvertedInner(f, from2, to, 0); + this.forEachInvertedInner(f2, from2, to, 0); } }, "forEach"); -RopeSequence.prototype.map = /* @__PURE__ */ __name(function map2(f, from2, to) { +RopeSequence.prototype.map = /* @__PURE__ */ __name(function map2(f2, from2, to) { if (from2 === void 0) from2 = 0; if (to === void 0) to = this.length; var result = []; this.forEach(function(elt, i2) { - return result.push(f(elt, i2)); + return result.push(f2(elt, i2)); }, from2, to); return result; }, "map"); @@ -148091,7 +176396,7 @@ var Leaf = /* @__PURE__ */ function(RopeSequence3) { Leaf2.prototype = Object.create(RopeSequence3 && RopeSequence3.prototype); Leaf2.prototype.constructor = Leaf2; var prototypeAccessors = { length: { configurable: true }, depth: { configurable: true } }; - Leaf2.prototype.flatten = /* @__PURE__ */ __name(function flatten() { + Leaf2.prototype.flatten = /* @__PURE__ */ __name(function flatten2() { return this.values; }, "flatten"); Leaf2.prototype.sliceInner = /* @__PURE__ */ __name(function sliceInner(from2, to) { @@ -148103,16 +176408,16 @@ var Leaf = /* @__PURE__ */ function(RopeSequence3) { Leaf2.prototype.getInner = /* @__PURE__ */ __name(function getInner(i2) { return this.values[i2]; }, "getInner"); - Leaf2.prototype.forEachInner = /* @__PURE__ */ __name(function forEachInner(f, from2, to, start2) { + Leaf2.prototype.forEachInner = /* @__PURE__ */ __name(function forEachInner(f2, from2, to, start2) { for (var i2 = from2; i2 < to; i2++) { - if (f(this.values[i2], start2 + i2) === false) { + if (f2(this.values[i2], start2 + i2) === false) { return false; } } }, "forEachInner"); - Leaf2.prototype.forEachInvertedInner = /* @__PURE__ */ __name(function forEachInvertedInner(f, from2, to, start2) { + Leaf2.prototype.forEachInvertedInner = /* @__PURE__ */ __name(function forEachInvertedInner(f2, from2, to, start2) { for (var i2 = from2 - 1; i2 >= to; i2--) { - if (f(this.values[i2], start2 + i2) === false) { + if (f2(this.values[i2], start2 + i2) === false) { return false; } } @@ -148149,27 +176454,27 @@ var Append = /* @__PURE__ */ function(RopeSequence3) { if (RopeSequence3) Append2.__proto__ = RopeSequence3; Append2.prototype = Object.create(RopeSequence3 && RopeSequence3.prototype); Append2.prototype.constructor = Append2; - Append2.prototype.flatten = /* @__PURE__ */ __name(function flatten() { + Append2.prototype.flatten = /* @__PURE__ */ __name(function flatten2() { return this.left.flatten().concat(this.right.flatten()); }, "flatten"); Append2.prototype.getInner = /* @__PURE__ */ __name(function getInner(i2) { return i2 < this.left.length ? this.left.get(i2) : this.right.get(i2 - this.left.length); }, "getInner"); - Append2.prototype.forEachInner = /* @__PURE__ */ __name(function forEachInner(f, from2, to, start2) { + Append2.prototype.forEachInner = /* @__PURE__ */ __name(function forEachInner(f2, from2, to, start2) { var leftLen = this.left.length; - if (from2 < leftLen && this.left.forEachInner(f, from2, Math.min(to, leftLen), start2) === false) { + if (from2 < leftLen && this.left.forEachInner(f2, from2, Math.min(to, leftLen), start2) === false) { return false; } - if (to > leftLen && this.right.forEachInner(f, Math.max(from2 - leftLen, 0), Math.min(this.length, to) - leftLen, start2 + leftLen) === false) { + if (to > leftLen && this.right.forEachInner(f2, Math.max(from2 - leftLen, 0), Math.min(this.length, to) - leftLen, start2 + leftLen) === false) { return false; } }, "forEachInner"); - Append2.prototype.forEachInvertedInner = /* @__PURE__ */ __name(function forEachInvertedInner(f, from2, to, start2) { + Append2.prototype.forEachInvertedInner = /* @__PURE__ */ __name(function forEachInvertedInner(f2, from2, to, start2) { var leftLen = this.left.length; - if (from2 > leftLen && this.right.forEachInvertedInner(f, from2 - leftLen, Math.max(to, leftLen) - leftLen, start2 + leftLen) === false) { + if (from2 > leftLen && this.right.forEachInvertedInner(f2, from2 - leftLen, Math.max(to, leftLen) - leftLen, start2 + leftLen) === false) { return false; } - if (to < leftLen && this.left.forEachInvertedInner(f, Math.min(from2, leftLen), to, start2) === false) { + if (to < leftLen && this.left.forEachInvertedInner(f2, Math.min(from2, leftLen), to, start2) === false) { return false; } }, "forEachInvertedInner"); @@ -148395,10 +176700,10 @@ class Branch { } } Branch.empty = new Branch(RopeSequence.empty, 0); -function cutOffEvents(items2, n) { +function cutOffEvents(items2, n2) { let cutPoint; items2.forEach((item3, i2) => { - if (item3.selection && n-- == 0) { + if (item3.selection && n2-- == 0) { cutPoint = i2; return false; } @@ -149064,13 +177369,13 @@ function decode$2(string, exclude) { const cache2 = getDecodeCache(exclude); return string.replace(/(%[a-f0-9]{2})+/gi, function(seq) { let result = ""; - for (let i2 = 0, l = seq.length; i2 < l; i2 += 3) { + for (let i2 = 0, l2 = seq.length; i2 < l2; i2 += 3) { const b1 = parseInt(seq.slice(i2 + 1, i2 + 3), 16); if (b1 < 128) { result += cache2[b1]; continue; } - if ((b1 & 224) === 192 && i2 + 3 < l) { + if ((b1 & 224) === 192 && i2 + 3 < l2) { const b2 = parseInt(seq.slice(i2 + 4, i2 + 6), 16); if ((b2 & 192) === 128) { const chr = b1 << 6 & 1984 | b2 & 63; @@ -149083,7 +177388,7 @@ function decode$2(string, exclude) { continue; } } - if ((b1 & 240) === 224 && i2 + 6 < l) { + if ((b1 & 240) === 224 && i2 + 6 < l2) { const b2 = parseInt(seq.slice(i2 + 4, i2 + 6), 16); const b3 = parseInt(seq.slice(i2 + 7, i2 + 9), 16); if ((b2 & 192) === 128 && (b3 & 192) === 128) { @@ -149097,7 +177402,7 @@ function decode$2(string, exclude) { continue; } } - if ((b1 & 248) === 240 && i2 + 9 < l) { + if ((b1 & 248) === 240 && i2 + 9 < l2) { const b2 = parseInt(seq.slice(i2 + 4, i2 + 6), 16); const b3 = parseInt(seq.slice(i2 + 7, i2 + 9), 16); const b4 = parseInt(seq.slice(i2 + 10, i2 + 12), 16); @@ -149152,9 +177457,9 @@ function encode$2(string, exclude, keepEscaped) { } const cache2 = getEncodeCache(exclude); let result = ""; - for (let i2 = 0, l = string.length; i2 < l; i2++) { + for (let i2 = 0, l2 = string.length; i2 < l2; i2++) { const code2 = string.charCodeAt(i2); - if (keepEscaped && code2 === 37 && i2 + 2 < l) { + if (keepEscaped && code2 === 37 && i2 + 2 < l2) { if (/^[0-9a-f]{2}$/i.test(string.slice(i2 + 1, i2 + 3))) { result += string.slice(i2, i2 + 3); i2 += 2; @@ -149166,7 +177471,7 @@ function encode$2(string, exclude, keepEscaped) { continue; } if (code2 >= 55296 && code2 <= 57343) { - if (code2 >= 55296 && code2 <= 56319 && i2 + 1 < l) { + if (code2 >= 55296 && code2 <= 56319 && i2 + 1 < l2) { const nextCode = string.charCodeAt(i2 + 1); if (nextCode >= 56320 && nextCode <= 57343) { result += encodeURIComponent(string[i2] + string[i2 + 1]); @@ -149242,9 +177547,9 @@ const slashedProtocol = { }; function urlParse(url, slashesDenoteHost) { if (url && url instanceof Url) return url; - const u = new Url(); - u.parse(url, slashesDenoteHost); - return u; + const u2 = new Url(); + u2.parse(url, slashesDenoteHost); + return u2; } __name(urlParse, "urlParse"); Url.prototype.parse = function(url, slashesDenoteHost) { @@ -149314,18 +177619,18 @@ Url.prototype.parse = function(url, slashesDenoteHost) { const ipv6Hostname = this.hostname[0] === "[" && this.hostname[this.hostname.length - 1] === "]"; if (!ipv6Hostname) { const hostparts = this.hostname.split(/\./); - for (let i2 = 0, l = hostparts.length; i2 < l; i2++) { + for (let i2 = 0, l2 = hostparts.length; i2 < l2; i2++) { const part = hostparts[i2]; if (!part) { continue; } if (!part.match(hostnamePartPattern)) { let newpart = ""; - for (let j = 0, k = part.length; j < k; j++) { - if (part.charCodeAt(j) > 127) { + for (let j2 = 0, k2 = part.length; j2 < k2; j2++) { + if (part.charCodeAt(j2) > 127) { newpart += "x"; } else { - newpart += part[j]; + newpart += part[j2]; } } if (!newpart.match(hostnamePartPattern)) { @@ -149407,11 +177712,11 @@ const ucmicro = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope }, Symbol.toStringTag, { value: "Module" })); const htmlDecodeTree = new Uint16Array( // prettier-ignore - 'ᵁ<Õıʊҝջאٵ۞ޢߖࠏઑඡ༉༦ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲϏϢϸontourIntegraìȹoɴ\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲy;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱còJTabcdfgorstרׯؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ߂ߐĀiyޱrc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣসে্ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४ĀnrࢃgleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpwਖਛgȀLRlr৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼અઋp;椅y;䐜Ādl੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑඞcy;䐊cute;䅃ƀaeyહાron;䅇dil;䅅;䐝ƀgswે૰ativeƀMTV૨ediumSpace;怋hiĀcn૦ëeryThiîtedĀGLଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷreak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪௫ఄ಄ದൡඅ櫬Āoungruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater;EFGLSTஶஷ扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨setĀ;Eೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂෛ෧ขภยา฿ไlig;䅒cute耻Ó䃓Āiyීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲcr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬืde耻Õ䃕es;樷ml耻Ö䃖erĀBP๋Āar๐๓r;怾acĀek๚;揞et;掴arenthesis;揜ҀacfhilorsງຊຏຒດຝະrtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ檻cedesȀ;EST່້扺qual;檯lantEqual;扼ilde;找me;怳Ādpuct;戏ortionĀ;aȥl;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL憒ar;懥eftArrow;懄eiling;按oǵ\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄቕቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHcቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗ĀeiቻDzኀ\0ኇefore;戴a;䎘ĀcnኘkSpace;쀀 Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtèa;䎖r;愨pf;愤cr;쀀𝒵ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒;Eaeiopᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;eᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;eᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰᝃᝈ០៦ᠹᡐᜍ᥈ᥰot;櫭ĀcrᛶkȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;tbrk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯᝳ;䎲;愶een;扬r;쀀𝔟gcostuvwឍឝឳេ៕៛ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀakoᠦᠵĀcn៲ᠣkƀlst֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ;敛;敘;攘;攔;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģbar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;elƀ;bhᥨᥩᥫ䁜;槅sub;柈ŬᥴlĀ;e怢t»pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭒\0᯽\0ᰌƀcprᦲute;䄇̀;abcdsᦿᧀᧄ᧕᧙戩nd;橄rcup;橉Āau᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r;Ecefms᩠ᩢᩫ᪤᪪旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ\0\0aĀ;t䀬;䁀ƀ;fl戁îᅠeĀmxent»eóɍǧ\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯delprvw᭠᭬᭷ᮂᮬᯔarrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;pᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰻᰿ᱝᱩᱵᲞᲬᲷᴍᵻᶑᶫᶻ᷆᷍ròar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂᳖᳜᳠mƀ;oș᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄĀDoḆᴴoôĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»ṺƀaeiἒἚls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧\0耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₥₰₴⃰℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽ƀ;qsؾٌlanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqrⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0proør;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼ròòΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonóquigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roøurĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨íistĀ;sடr;쀀𝔫ȀEest⩦⩹⩼ƀ;qs⩭ƀ;qs⩴lanôií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast⭕⭚⭟lleìl;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖchimpqu⮽⯍⯙⬄⯤⯯Ȁ;cerല⯆ഷ⯉uå;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭ååഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñĀ;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;cⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācrir;榿;쀀𝔬ͯ\0\0\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕⶥⶨrò᪀Āirⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔǒr;榷rp;榹;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ\0\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ脀¶;l䂶leìЃɩ\0\0m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳ᤈ⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t⾴ïrel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⋢⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔ABHabcdefhilmnoprstuxけさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstwガクシスゼゾダッデナp;極Ā;fゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ìâヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘rrowĀ;tㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowóarpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓ròaòՑ;怏oustĀ;a㈞掱che»mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì耻䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;qኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫwar;椪lig耻ß䃟㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rëƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproøim»ኬsðኞĀas㚺㚮ðrn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈadempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xôheadĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roðtré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜtré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map((c) => c.charCodeAt(0)) + 'ᵁ<Õıʊҝջאٵ۞ޢߖࠏઑඡ༉༦ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲϏϢϸontourIntegraìȹoɴ\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲy;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱còJTabcdfgorstרׯؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ߂ߐĀiyޱrc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣসে্ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४ĀnrࢃgleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpwਖਛgȀLRlr৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼અઋp;椅y;䐜Ādl੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑඞcy;䐊cute;䅃ƀaeyહાron;䅇dil;䅅;䐝ƀgswે૰ativeƀMTV૨ediumSpace;怋hiĀcn૦ëeryThiîtedĀGLଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷreak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪௫ఄ಄ದൡඅ櫬Āoungruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater;EFGLSTஶஷ扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨setĀ;Eೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂෛ෧ขภยา฿ไlig;䅒cute耻Ó䃓Āiyීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲcr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬืde耻Õ䃕es;樷ml耻Ö䃖erĀBP๋Āar๐๓r;怾acĀek๚;揞et;掴arenthesis;揜ҀacfhilorsງຊຏຒດຝະrtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ檻cedesȀ;EST່້扺qual;檯lantEqual;扼ilde;找me;怳Ādpuct;戏ortionĀ;aȥl;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL憒ar;懥eftArrow;懄eiling;按oǵ\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄቕቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHcቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗ĀeiቻDzኀ\0ኇefore;戴a;䎘ĀcnኘkSpace;쀀 Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtèa;䎖r;愨pf;愤cr;쀀𝒵ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒;Eaeiopᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;eᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;eᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰᝃᝈ០៦ᠹᡐᜍ᥈ᥰot;櫭ĀcrᛶkȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;tbrk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯᝳ;䎲;愶een;扬r;쀀𝔟gcostuvwឍឝឳេ៕៛ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀakoᠦᠵĀcn៲ᠣkƀlst֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ;敛;敘;攘;攔;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģbar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;elƀ;bhᥨᥩᥫ䁜;槅sub;柈ŬᥴlĀ;e怢t»pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭒\0᯽\0ᰌƀcprᦲute;䄇̀;abcdsᦿᧀᧄ᧕᧙戩nd;橄rcup;橉Āau᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r;Ecefms᩠ᩢᩫ᪤᪪旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ\0\0aĀ;t䀬;䁀ƀ;fl戁îᅠeĀmxent»eóɍǧ\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯delprvw᭠᭬᭷ᮂᮬᯔarrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;pᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰻᰿ᱝᱩᱵᲞᲬᲷᴍᵻᶑᶫᶻ᷆᷍ròar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂᳖᳜᳠mƀ;oș᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄĀDoḆᴴoôĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»ṺƀaeiἒἚls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧\0耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₥₰₴⃰℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽ƀ;qsؾٌlanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqrⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0proør;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼ròòΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonóquigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roøurĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨íistĀ;sடr;쀀𝔫ȀEest⩦⩹⩼ƀ;qs⩭ƀ;qs⩴lanôií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast⭕⭚⭟lleìl;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖchimpqu⮽⯍⯙⬄⯤⯯Ȁ;cerല⯆ഷ⯉uå;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭ååഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñĀ;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;cⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācrir;榿;쀀𝔬ͯ\0\0\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕⶥⶨrò᪀Āirⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔǒr;榷rp;榹;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ\0\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ脀¶;l䂶leìЃɩ\0\0m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳ᤈ⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t⾴ïrel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⋢⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔ABHabcdefhilmnoprstuxけさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstwガクシスゼゾダッデナp;極Ā;fゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ìâヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘rrowĀ;tㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowóarpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓ròaòՑ;怏oustĀ;a㈞掱che»mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì耻䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;qኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫwar;椪lig耻ß䃟㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rëƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproøim»ኬsðኞĀas㚺㚮ðrn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈadempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xôheadĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roðtré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜtré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map((c2) => c2.charCodeAt(0)) ); const xmlDecodeTree = new Uint16Array( // prettier-ignore - "Ȁaglq \x1Bɭ\0\0p;䀦os;䀧t;䀾t;䀼uot;䀢".split("").map((c) => c.charCodeAt(0)) + "Ȁaglq \x1Bɭ\0\0p;䀦os;䀧t;䀾t;䀼uot;䀢".split("").map((c2) => c2.charCodeAt(0)) ); var _a; const decodeMap = /* @__PURE__ */ new Map([ @@ -149876,7 +178181,7 @@ const getCodePoint = ( // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition String.prototype.codePointAt != null ? (str, index2) => str.codePointAt(index2) : ( // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae - (c, index2) => (c.charCodeAt(index2) & 64512) === 55296 ? (c.charCodeAt(index2) - 55296) * 1024 + c.charCodeAt(index2 + 1) - 56320 + 65536 : c.charCodeAt(index2) + (c2, index2) => (c2.charCodeAt(index2) & 64512) === 55296 ? (c2.charCodeAt(index2) - 55296) * 1024 + c2.charCodeAt(index2 + 1) - 56320 + 65536 : c2.charCodeAt(index2) ) ); function encodeXML(str) { @@ -149900,18 +178205,18 @@ function encodeXML(str) { __name(encodeXML, "encodeXML"); const escape$2 = encodeXML; function getEscaper(regex2, map3) { - return /* @__PURE__ */ __name(function escape2(data24) { + return /* @__PURE__ */ __name(function escape2(data25) { let match2; let lastIdx = 0; let result = ""; - while (match2 = regex2.exec(data24)) { + while (match2 = regex2.exec(data25)) { if (lastIdx !== match2.index) { - result += data24.substring(lastIdx, match2.index); + result += data25.substring(lastIdx, match2.index); } result += map3.get(match2[0].charCodeAt(0)); lastIdx = match2.index + 1; } - return result + data24.substring(lastIdx); + return result + data25.substring(lastIdx); }, "escape"); } __name(getEscaper, "getEscaper"); @@ -149928,12 +178233,12 @@ const escapeText = getEscaper(/[&<>\u00A0]/g, /* @__PURE__ */ new Map([ [160, " "] ])); const htmlReplacer = /[\t\n!-,./:-@[-`\f{-}$\x80-\uFFFF]/g; -function encodeHTML(data24) { - return encodeHTMLTrieRe(htmlReplacer, data24); +function encodeHTML(data25) { + return encodeHTMLTrieRe(htmlReplacer, data25); } __name(encodeHTML, "encodeHTML"); -function encodeNonAsciiHTML(data24) { - return encodeHTMLTrieRe(xmlReplacer, data24); +function encodeNonAsciiHTML(data25) { + return encodeHTMLTrieRe(xmlReplacer, data25); } __name(encodeNonAsciiHTML, "encodeNonAsciiHTML"); function encodeHTMLTrieRe(regExp, str) { @@ -149982,37 +178287,37 @@ var EncodingMode; EncodingMode2[EncodingMode2["Attribute"] = 3] = "Attribute"; EncodingMode2[EncodingMode2["Text"] = 4] = "Text"; })(EncodingMode || (EncodingMode = {})); -function decode$1(data24, options4 = EntityLevel.XML) { +function decode$1(data25, options4 = EntityLevel.XML) { const level = typeof options4 === "number" ? options4 : options4.level; if (level === EntityLevel.HTML) { const mode2 = typeof options4 === "object" ? options4.mode : void 0; - return decodeHTML(data24, mode2); + return decodeHTML(data25, mode2); } - return decodeXML(data24); + return decodeXML(data25); } __name(decode$1, "decode$1"); -function decodeStrict(data24, options4 = EntityLevel.XML) { +function decodeStrict(data25, options4 = EntityLevel.XML) { var _a2; const opts = typeof options4 === "number" ? { level: options4 } : options4; (_a2 = opts.mode) !== null && _a2 !== void 0 ? _a2 : opts.mode = DecodingMode.Strict; - return decode$1(data24, opts); + return decode$1(data25, opts); } __name(decodeStrict, "decodeStrict"); -function encode$1(data24, options4 = EntityLevel.XML) { +function encode$1(data25, options4 = EntityLevel.XML) { const opts = typeof options4 === "number" ? { level: options4 } : options4; if (opts.mode === EncodingMode.UTF8) - return escapeUTF8(data24); + return escapeUTF8(data25); if (opts.mode === EncodingMode.Attribute) - return escapeAttribute(data24); + return escapeAttribute(data25); if (opts.mode === EncodingMode.Text) - return escapeText(data24); + return escapeText(data25); if (opts.level === EntityLevel.HTML) { if (opts.mode === EncodingMode.ASCII) { - return encodeNonAsciiHTML(data24); + return encodeNonAsciiHTML(data25); } - return encodeHTML(data24); + return encodeHTML(data25); } - return encodeXML(data24); + return encodeXML(data25); } __name(encode$1, "encode$1"); function _class$1(obj) { @@ -150048,42 +178353,42 @@ function arrayReplaceAt(src, pos2, newElements) { return [].concat(src.slice(0, pos2), newElements, src.slice(pos2 + 1)); } __name(arrayReplaceAt, "arrayReplaceAt"); -function isValidEntityCode(c) { - if (c >= 55296 && c <= 57343) { +function isValidEntityCode(c2) { + if (c2 >= 55296 && c2 <= 57343) { return false; } - if (c >= 64976 && c <= 65007) { + if (c2 >= 64976 && c2 <= 65007) { return false; } - if ((c & 65535) === 65535 || (c & 65535) === 65534) { + if ((c2 & 65535) === 65535 || (c2 & 65535) === 65534) { return false; } - if (c >= 0 && c <= 8) { + if (c2 >= 0 && c2 <= 8) { return false; } - if (c === 11) { + if (c2 === 11) { return false; } - if (c >= 14 && c <= 31) { + if (c2 >= 14 && c2 <= 31) { return false; } - if (c >= 127 && c <= 159) { + if (c2 >= 127 && c2 <= 159) { return false; } - if (c > 1114111) { + if (c2 > 1114111) { return false; } return true; } __name(isValidEntityCode, "isValidEntityCode"); -function fromCodePoint(c) { - if (c > 65535) { - c -= 65536; - const surrogate1 = 55296 + (c >> 10); - const surrogate2 = 56320 + (c & 1023); +function fromCodePoint(c2) { + if (c2 > 65535) { + c2 -= 65536; + const surrogate1 = 55296 + (c2 >> 10); + const surrogate2 = 56320 + (c2 & 1023); return String.fromCharCode(surrogate1, surrogate2); } - return String.fromCharCode(c); + return String.fromCharCode(c2); } __name(fromCodePoint, "fromCodePoint"); const UNESCAPE_MD_RE = /\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g; @@ -150487,12 +178792,12 @@ function Renderer() { } __name(Renderer, "Renderer"); Renderer.prototype.renderAttrs = /* @__PURE__ */ __name(function renderAttrs(token) { - let i2, l, result; + let i2, l2, result; if (!token.attrs) { return ""; } result = ""; - for (i2 = 0, l = token.attrs.length; i2 < l; i2++) { + for (i2 = 0, l2 = token.attrs.length; i2 < l2; i2++) { result += " " + escapeHtml(token.attrs[i2][0]) + '="' + escapeHtml(token.attrs[i2][1]) + '"'; } return result; @@ -150813,7 +179118,7 @@ function block(state) { __name(block, "block"); function inline(state) { const tokens = state.tokens; - for (let i2 = 0, l = tokens.length; i2 < l; i2++) { + for (let i2 = 0, l2 = tokens.length; i2 < l2; i2++) { const tok = tokens[i2]; if (tok.type === "inline") { state.md.inline.parse(tok.content, state.md, state.env, tok.children); @@ -150834,11 +179139,11 @@ function linkify$1(state) { if (!state.md.options.linkify) { return; } - for (let j = 0, l = blockTokens.length; j < l; j++) { - if (blockTokens[j].type !== "inline" || !state.md.linkify.pretest(blockTokens[j].content)) { + for (let j2 = 0, l2 = blockTokens.length; j2 < l2; j2++) { + if (blockTokens[j2].type !== "inline" || !state.md.linkify.pretest(blockTokens[j2].content)) { continue; } - let tokens = blockTokens[j].children; + let tokens = blockTokens[j2].children; let htmlLinkLevel = 0; for (let i2 = tokens.length - 1; i2 >= 0; i2--) { const currentToken = tokens[i2]; @@ -150913,7 +179218,7 @@ function linkify$1(state) { token.level = level; nodes.push(token); } - blockTokens[j].children = tokens = arrayReplaceAt(tokens, i2, nodes); + blockTokens[j2].children = tokens = arrayReplaceAt(tokens, i2, nodes); } } } @@ -150991,17 +179296,17 @@ function replaceAt(str, index2, ch) { } __name(replaceAt, "replaceAt"); function process_inlines(tokens, state) { - let j; + let j2; const stack2 = []; for (let i2 = 0; i2 < tokens.length; i2++) { const token = tokens[i2]; const thisLevel = tokens[i2].level; - for (j = stack2.length - 1; j >= 0; j--) { - if (stack2[j].level <= thisLevel) { + for (j2 = stack2.length - 1; j2 >= 0; j2--) { + if (stack2[j2].level <= thisLevel) { break; } } - stack2.length = j + 1; + stack2.length = j2 + 1; if (token.type !== "text") { continue; } @@ -151023,10 +179328,10 @@ function process_inlines(tokens, state) { if (t2.index - 1 >= 0) { lastChar = text2.charCodeAt(t2.index - 1); } else { - for (j = i2 - 1; j >= 0; j--) { - if (tokens[j].type === "softbreak" || tokens[j].type === "hardbreak") break; - if (!tokens[j].content) continue; - lastChar = tokens[j].content.charCodeAt(tokens[j].content.length - 1); + for (j2 = i2 - 1; j2 >= 0; j2--) { + if (tokens[j2].type === "softbreak" || tokens[j2].type === "hardbreak") break; + if (!tokens[j2].content) continue; + lastChar = tokens[j2].content.charCodeAt(tokens[j2].content.length - 1); break; } } @@ -151034,10 +179339,10 @@ function process_inlines(tokens, state) { if (pos2 < max) { nextChar = text2.charCodeAt(pos2); } else { - for (j = i2 + 1; j < tokens.length; j++) { - if (tokens[j].type === "softbreak" || tokens[j].type === "hardbreak") break; - if (!tokens[j].content) continue; - nextChar = tokens[j].content.charCodeAt(0); + for (j2 = i2 + 1; j2 < tokens.length; j2++) { + if (tokens[j2].type === "softbreak" || tokens[j2].type === "hardbreak") break; + if (!tokens[j2].content) continue; + nextChar = tokens[j2].content.charCodeAt(0); break; } } @@ -151075,13 +179380,13 @@ function process_inlines(tokens, state) { continue; } if (canClose) { - for (j = stack2.length - 1; j >= 0; j--) { - let item3 = stack2[j]; - if (stack2[j].level < thisLevel) { + for (j2 = stack2.length - 1; j2 >= 0; j2--) { + let item3 = stack2[j2]; + if (stack2[j2].level < thisLevel) { break; } - if (item3.single === isSingle && stack2[j].level === thisLevel) { - item3 = stack2[j]; + if (item3.single === isSingle && stack2[j2].level === thisLevel) { + item3 = stack2[j2]; let openQuote; let closeQuote; if (isSingle) { @@ -151103,7 +179408,7 @@ function process_inlines(tokens, state) { } text2 = token.content; max = text2.length; - stack2.length = j; + stack2.length = j2; continue OUTER; } } @@ -151137,10 +179442,10 @@ __name(smartquotes, "smartquotes"); function text_join(state) { let curr, last; const blockTokens = state.tokens; - const l = blockTokens.length; - for (let j = 0; j < l; j++) { - if (blockTokens[j].type !== "inline") continue; - const tokens = blockTokens[j].children; + const l2 = blockTokens.length; + for (let j2 = 0; j2 < l2; j2++) { + if (blockTokens[j2].type !== "inline") continue; + const tokens = blockTokens[j2].children; const max = tokens.length; for (curr = 0; curr < max; curr++) { if (tokens[curr].type === "text_special") { @@ -151183,7 +179488,7 @@ function Core() { __name(Core, "Core"); Core.prototype.process = function(state) { const rules = this.ruler.getRules(""); - for (let i2 = 0, l = rules.length; i2 < l; i2++) { + for (let i2 = 0, l2 = rules.length; i2 < l2; i2++) { rules[i2](state); } }; @@ -151206,9 +179511,9 @@ function StateBlock(src, md2, env, tokens) { this.listIndent = -1; this.parentType = "root"; this.level = 0; - const s = this.src; - for (let start2 = 0, pos2 = 0, indent = 0, offset = 0, len = s.length, indent_found = false; pos2 < len; pos2++) { - const ch = s.charCodeAt(pos2); + const s2 = this.src; + for (let start2 = 0, pos2 = 0, indent = 0, offset = 0, len = s2.length, indent_found = false; pos2 < len; pos2++) { + const ch = s2.charCodeAt(pos2); if (!indent_found) { if (isSpace(ch)) { indent++; @@ -151237,8 +179542,8 @@ function StateBlock(src, md2, env, tokens) { start2 = pos2 + 1; } } - this.bMarks.push(s.length); - this.eMarks.push(s.length); + this.bMarks.push(s2.length); + this.eMarks.push(s2.length); this.tShift.push(0); this.sCount.push(0); this.bsCount.push(0); @@ -151482,7 +179787,7 @@ function table(state, startLine, endLine, silent) { break; } let terminate = false; - for (let i2 = 0, l = terminatorRules.length; i2 < l; i2++) { + for (let i2 = 0, l2 = terminatorRules.length; i2 < l2; i2++) { if (terminatorRules[i2](state, nextLine, endLine, true)) { terminate = true; break; @@ -151706,7 +180011,7 @@ function blockquote(state, startLine, endLine, silent) { break; } let terminate = false; - for (let i2 = 0, l = terminatorRules.length; i2 < l; i2++) { + for (let i2 = 0, l2 = terminatorRules.length; i2 < l2; i2++) { if (terminatorRules[i2](state, nextLine, endLine, true)) { terminate = true; break; @@ -151838,7 +180143,7 @@ function skipOrderedListMarker(state, startLine) { __name(skipOrderedListMarker, "skipOrderedListMarker"); function markTightParagraphs(state, idx) { const level = state.level + 2; - for (let i2 = idx + 2, l = state.tokens.length - 2; i2 < l; i2++) { + for (let i2 = idx + 2, l2 = state.tokens.length - 2; i2 < l2; i2++) { if (state.tokens[i2].level === level && state.tokens[i2].type === "paragraph_open") { state.tokens[i2 + 2].hidden = true; state.tokens[i2].hidden = true; @@ -151970,7 +180275,7 @@ function list(state, startLine, endLine, silent) { break; } let terminate = false; - for (let i2 = 0, l = terminatorRules.length; i2 < l; i2++) { + for (let i2 = 0, l2 = terminatorRules.length; i2 < l2; i2++) { if (terminatorRules[i2](state, nextLine, endLine, true)) { terminate = true; break; @@ -152037,7 +180342,7 @@ function reference(state, startLine, _endLine, silent) { const oldParentType = state.parentType; state.parentType = "reference"; let terminate = false; - for (let i2 = 0, l = terminatorRules.length; i2 < l; i2++) { + for (let i2 = 0, l2 = terminatorRules.length; i2 < l2; i2++) { if (terminatorRules[i2](state, nextLine2, endLine, true)) { terminate = true; break; @@ -152394,7 +180699,7 @@ function lheading(state, startLine, endLine) { continue; } let terminate = false; - for (let i2 = 0, l = terminatorRules.length; i2 < l; i2++) { + for (let i2 = 0, l2 = terminatorRules.length; i2 < l2; i2++) { if (terminatorRules[i2](state, nextLine, endLine, true)) { terminate = true; break; @@ -152435,7 +180740,7 @@ function paragraph(state, startLine, endLine) { continue; } let terminate = false; - for (let i2 = 0, l = terminatorRules.length; i2 < l; i2++) { + for (let i2 = 0, l2 = terminatorRules.length; i2 < l2; i2++) { if (terminatorRules[i2](state, nextLine, endLine, true)) { terminate = true; break; @@ -152875,14 +181180,14 @@ function postProcess$1(state, delimiters) { } while (loneMarkers.length) { const i2 = loneMarkers.pop(); - let j = i2 + 1; - while (j < state.tokens.length && state.tokens[j].type === "s_close") { - j++; + let j2 = i2 + 1; + while (j2 < state.tokens.length && state.tokens[j2].type === "s_close") { + j2++; } - j--; - if (i2 !== j) { - token = state.tokens[j]; - state.tokens[j] = state.tokens[i2]; + j2--; + if (i2 !== j2) { + token = state.tokens[j2]; + state.tokens[j2] = state.tokens[i2]; state.tokens[i2] = token; } } @@ -153623,8 +181928,8 @@ const defaultOptions = { fuzzyIP: false }; function isOptionsObj(obj) { - return Object.keys(obj || {}).reduce(function(acc, k) { - return acc || defaultOptions.hasOwnProperty(k); + return Object.keys(obj || {}).reduce(function(acc, k2) { + return acc || defaultOptions.hasOwnProperty(k2); }, false); } __name(isOptionsObj, "isOptionsObj"); @@ -153838,16 +182143,16 @@ LinkifyIt.prototype.test = /* @__PURE__ */ __name(function test2(text2) { if (!text2.length) { return false; } - let m, ml, me, len, shift2, next2, re, tld_pos, at_pos; + let m2, ml, me, len, shift2, next2, re, tld_pos, at_pos; if (this.re.schema_test.test(text2)) { re = this.re.schema_search; re.lastIndex = 0; - while ((m = re.exec(text2)) !== null) { - len = this.testSchemaAt(text2, m[2], re.lastIndex); + while ((m2 = re.exec(text2)) !== null) { + len = this.testSchemaAt(text2, m2[2], re.lastIndex); if (len) { - this.__schema__ = m[2]; - this.__index__ = m.index + m[1].length; - this.__last_index__ = m.index + m[0].length + len; + this.__schema__ = m2[2]; + this.__index__ = m2.index + m2[1].length; + this.__last_index__ = m2.index + m2[0].length + len; break; } } @@ -153914,13 +182219,13 @@ LinkifyIt.prototype.matchAtStart = /* @__PURE__ */ __name(function matchAtStart( this.__text_cache__ = text2; this.__index__ = -1; if (!text2.length) return null; - const m = this.re.schema_at_start.exec(text2); - if (!m) return null; - const len = this.testSchemaAt(text2, m[2], m[0].length); + const m2 = this.re.schema_at_start.exec(text2); + if (!m2) return null; + const len = this.testSchemaAt(text2, m2[2], m2[0].length); if (!len) return null; - this.__schema__ = m[2]; - this.__index__ = m.index + m[1].length; - this.__last_index__ = m.index + m[0].length + len; + this.__schema__ = m2[2]; + this.__index__ = m2.index + m2[1].length; + this.__last_index__ = m2.index + m2[0].length + len; return createMatch(this, 0); }, "matchAtStart"); LinkifyIt.prototype.tlds = /* @__PURE__ */ __name(function tlds2(list2, keepOld) { @@ -154032,33 +182337,33 @@ const digitToBasic = /* @__PURE__ */ __name(function(digit, flag) { return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); }, "digitToBasic"); const adapt = /* @__PURE__ */ __name(function(delta2, numPoints, firstTime) { - let k = 0; + let k2 = 0; delta2 = firstTime ? floor(delta2 / damp) : delta2 >> 1; delta2 += floor(delta2 / numPoints); - for (; delta2 > baseMinusTMin * tMax >> 1; k += base) { + for (; delta2 > baseMinusTMin * tMax >> 1; k2 += base) { delta2 = floor(delta2 / baseMinusTMin); } - return floor(k + (baseMinusTMin + 1) * delta2 / (delta2 + skew)); + return floor(k2 + (baseMinusTMin + 1) * delta2 / (delta2 + skew)); }, "adapt"); const decode = /* @__PURE__ */ __name(function(input) { const output = []; const inputLength = input.length; let i2 = 0; - let n = initialN; + let n2 = initialN; let bias = initialBias; let basic = input.lastIndexOf(delimiter); if (basic < 0) { basic = 0; } - for (let j = 0; j < basic; ++j) { - if (input.charCodeAt(j) >= 128) { + for (let j2 = 0; j2 < basic; ++j2) { + if (input.charCodeAt(j2) >= 128) { error("not-basic"); } - output.push(input.charCodeAt(j)); + output.push(input.charCodeAt(j2)); } for (let index2 = basic > 0 ? basic + 1 : 0; index2 < inputLength; ) { const oldi = i2; - for (let w = 1, k = base; ; k += base) { + for (let w2 = 1, k2 = base; ; k2 += base) { if (index2 >= inputLength) { error("invalid-input"); } @@ -154066,28 +182371,28 @@ const decode = /* @__PURE__ */ __name(function(input) { if (digit >= base) { error("invalid-input"); } - if (digit > floor((maxInt - i2) / w)) { + if (digit > floor((maxInt - i2) / w2)) { error("overflow"); } - i2 += digit * w; - const t2 = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias; + i2 += digit * w2; + const t2 = k2 <= bias ? tMin : k2 >= bias + tMax ? tMax : k2 - bias; if (digit < t2) { break; } const baseMinusT = base - t2; - if (w > floor(maxInt / baseMinusT)) { + if (w2 > floor(maxInt / baseMinusT)) { error("overflow"); } - w *= baseMinusT; + w2 *= baseMinusT; } const out = output.length + 1; bias = adapt(i2 - oldi, out, oldi == 0); - if (floor(i2 / out) > maxInt - n) { + if (floor(i2 / out) > maxInt - n2) { error("overflow"); } - n += floor(i2 / out); + n2 += floor(i2 / out); i2 %= out; - output.splice(i2++, 0, n); + output.splice(i2++, 0, n2); } return String.fromCodePoint(...output); }, "decode"); @@ -154095,7 +182400,7 @@ const encode = /* @__PURE__ */ __name(function(input) { const output = []; input = ucs2decode(input); const inputLength = input.length; - let n = initialN; + let n2 = initialN; let delta2 = 0; let bias = initialBias; for (const currentValue of input) { @@ -154109,44 +182414,44 @@ const encode = /* @__PURE__ */ __name(function(input) { output.push(delimiter); } while (handledCPCount < inputLength) { - let m = maxInt; + let m2 = maxInt; for (const currentValue of input) { - if (currentValue >= n && currentValue < m) { - m = currentValue; + if (currentValue >= n2 && currentValue < m2) { + m2 = currentValue; } } const handledCPCountPlusOne = handledCPCount + 1; - if (m - n > floor((maxInt - delta2) / handledCPCountPlusOne)) { + if (m2 - n2 > floor((maxInt - delta2) / handledCPCountPlusOne)) { error("overflow"); } - delta2 += (m - n) * handledCPCountPlusOne; - n = m; + delta2 += (m2 - n2) * handledCPCountPlusOne; + n2 = m2; for (const currentValue of input) { - if (currentValue < n && ++delta2 > maxInt) { + if (currentValue < n2 && ++delta2 > maxInt) { error("overflow"); } - if (currentValue === n) { - let q = delta2; - for (let k = base; ; k += base) { - const t2 = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias; - if (q < t2) { + if (currentValue === n2) { + let q2 = delta2; + for (let k2 = base; ; k2 += base) { + const t2 = k2 <= bias ? tMin : k2 >= bias + tMax ? tMax : k2 - bias; + if (q2 < t2) { break; } - const qMinusT = q - t2; + const qMinusT = q2 - t2; const baseMinusT = base - t2; output.push( stringFromCharCode(digitToBasic(t2 + qMinusT % baseMinusT, 0)) ); - q = floor(qMinusT / baseMinusT); + q2 = floor(qMinusT / baseMinusT); } - output.push(stringFromCharCode(digitToBasic(q, 0))); + output.push(stringFromCharCode(digitToBasic(q2, 0))); bias = adapt(delta2, handledCPCountPlusOne, handledCPCount === basicLength); delta2 = 0; ++handledCPCount; } } ++delta2; - ++n; + ++n2; } return output.join(""); }, "encode"); @@ -154639,7 +182944,7 @@ const schema = new Schema({ { tag: "i" }, { tag: "em" }, { style: "font-style=italic" }, - { style: "font-style=normal", clearMark: /* @__PURE__ */ __name((m) => m.type.name == "em", "clearMark") } + { style: "font-style=normal", clearMark: /* @__PURE__ */ __name((m2) => m2.type.name == "em", "clearMark") } ], toDOM() { return ["em"]; @@ -154649,7 +182954,7 @@ const schema = new Schema({ parseDOM: [ { tag: "strong" }, { tag: "b", getAttrs: /* @__PURE__ */ __name((node3) => node3.style.fontWeight != "normal" && null, "getAttrs") }, - { style: "font-weight=400", clearMark: /* @__PURE__ */ __name((m) => m.type.name == "strong", "clearMark") }, + { style: "font-weight=400", clearMark: /* @__PURE__ */ __name((m2) => m2.type.name == "strong", "clearMark") }, { style: "font-weight", getAttrs: /* @__PURE__ */ __name((value4) => /^(bold(er)?|[5-9]\d{2,})$/.test(value4) && null, "getAttrs") } ], toDOM() { @@ -154677,9 +182982,9 @@ const schema = new Schema({ } } }); -function maybeMerge(a, b) { - if (a.isText && b.isText && Mark$1.sameSet(a.marks, b.marks)) - return a.withText(a.text + b.text); +function maybeMerge(a2, b2) { + if (a2.isText && b2.isText && Mark$1.sameSet(a2.marks, b2.marks)) + return a2.withText(a2.text + b2.text); } __name(maybeMerge, "maybeMerge"); class MarkdownParseState { @@ -154992,10 +183297,10 @@ const defaultMarkdownSerializer = new MarkdownSerializer$1({ } }); function backticksFor(node3, side) { - let ticks = /`+/g, m, len = 0; + let ticks = /`+/g, m2, len = 0; if (node3.isText) - while (m = ticks.exec(node3.text)) - len = Math.max(len, m[0].length); + while (m2 = ticks.exec(node3.text)) + len = Math.max(len, m2[0].length); let result = len > 0 && side > 0 ? " `" : "`"; for (let i2 = 0; i2 < len; i2++) result += "`"; @@ -155071,11 +183376,11 @@ let MarkdownSerializerState$1 = class MarkdownSerializerState2 { the end of the block, and `f` is a function that renders the content of the block. */ - wrapBlock(delim, firstDelim, node3, f) { + wrapBlock(delim, firstDelim, node3, f2) { let old = this.delim; this.write(firstDelim != null ? firstDelim : delim); this.delim += delim; - f(); + f2(); this.delim = old; this.closeBlock(node3); } @@ -155159,11 +183464,11 @@ let MarkdownSerializerState$1 = class MarkdownSerializerState2 { let progress = /* @__PURE__ */ __name((node3, offset, index2) => { let marks = node3 ? node3.marks : []; if (node3 && node3.type.name === this.options.hardBreakNodeName) - marks = marks.filter((m) => { + marks = marks.filter((m2) => { if (index2 + 1 == parent.childCount) return false; let next2 = parent.child(index2 + 1); - return m.isInSet(next2.marks) && (!next2.isText || /\S/.test(next2.text)); + return m2.isInSet(next2.marks) && (!next2.isText || /\S/.test(next2.text)); }); let leading = trailing; trailing = ""; @@ -155198,15 +183503,15 @@ let MarkdownSerializerState$1 = class MarkdownSerializerState2 { let mark2 = marks[i2]; if (!this.getMark(mark2.type.name).mixable) break; - for (let j = 0; j < active3.length; j++) { - let other = active3[j]; + for (let j2 = 0; j2 < active3.length; j2++) { + let other = active3[j2]; if (!this.getMark(other.type.name).mixable) break; if (mark2.eq(other)) { - if (i2 > j) - marks = marks.slice(0, j).concat(mark2).concat(marks.slice(j, i2)).concat(marks.slice(i2 + 1, len)); - else if (j > i2) - marks = marks.slice(0, i2).concat(marks.slice(i2 + 1, j)).concat(mark2).concat(marks.slice(j, len)); + if (i2 > j2) + marks = marks.slice(0, j2).concat(mark2).concat(marks.slice(j2, i2)).concat(marks.slice(i2 + 1, len)); + else if (j2 > i2) + marks = marks.slice(0, i2).concat(marks.slice(i2 + 1, j2)).concat(mark2).concat(marks.slice(j2, len)); continue outer; } } @@ -155266,7 +183571,7 @@ let MarkdownSerializerState$1 = class MarkdownSerializerState2 { have special meaning only at the start of the line. */ esc(str, startOfLine = false) { - str = str.replace(/[`*\\~\[\]_]/g, (m, i2) => m == "_" && i2 > 0 && i2 + 1 < str.length && str[i2 - 1].match(/\w/) && str[i2 + 1].match(/\w/) ? m : "\\" + m); + str = str.replace(/[`*\\~\[\]_]/g, (m2, i2) => m2 == "_" && i2 > 0 && i2 + 1 < str.length && str[i2 - 1].match(/\w/) && str[i2 + 1].match(/\w/) ? m2 : "\\" + m2); if (startOfLine) str = str.replace(/^(\+[ ]|[\-*>])/, "\\$&").replace(/^(\s*)(#{1,6})(\s|$)/, "$1\\$2$3").replace(/^(\s*\d+)\.\s/, "$1\\. "); if (this.options.escapeExtraCharacters) @@ -155283,9 +183588,9 @@ let MarkdownSerializerState$1 = class MarkdownSerializerState2 { /** Repeat the given string `n` times. */ - repeat(str, n) { + repeat(str, n2) { let out = ""; - for (let i2 = 0; i2 < n; i2++) + for (let i2 = 0; i2 < n2; i2++) out += str; return out; } @@ -155945,8 +184250,8 @@ const Table$1 = Table.extend({ state.inTable = true; node3.forEach((row, p2, i2) => { state.write("| "); - row.forEach((col, p22, j) => { - if (j) { + row.forEach((col, p22, j2) => { + if (j2) { state.write(" | "); } const cellContent = col.firstChild; @@ -156446,11 +184751,11 @@ const Markdown = Extension.create({ } }); const SIZE = Symbol(); -function intersect(a, b) { - const x2 = Math.max(a.x, b.x); - const num1 = Math.min(a.x + a.width, b.x + b.width); - const y2 = Math.max(a.y, b.y); - const num2 = Math.min(a.y + a.height, b.y + b.height); +function intersect(a2, b2) { + const x2 = Math.max(a2.x, b2.x); + const num1 = Math.min(a2.x + a2.width, b2.x + b2.width); + const y2 = Math.max(a2.y, b2.y); + const num2 = Math.min(a2.y + a2.height, b2.y + b2.height); if (num1 >= x2 && num2 >= y2) return [x2, y2, num1 - x2, num2 - y2]; else return null; } @@ -156497,16 +184802,16 @@ function computeSize(size2) { let freeSpace = size2[1] - y2; let widgetHeight = 0; let dom = []; - for (const w of this.widgets) { - if (w.type === "converted-widget") { - delete w.computedHeight; - } else if (w.computeSize) { - widgetHeight += w.computeSize()[1] + 4; - } else if (w.element) { - const styles = getComputedStyle(w.element); - let minHeight = w.options.getMinHeight?.() ?? parseInt(styles.getPropertyValue("--comfy-widget-min-height")); - let maxHeight = w.options.getMaxHeight?.() ?? parseInt(styles.getPropertyValue("--comfy-widget-max-height")); - let prefHeight = w.options.getHeight?.() ?? styles.getPropertyValue("--comfy-widget-height"); + for (const w2 of this.widgets) { + if (w2.type === "converted-widget") { + delete w2.computedHeight; + } else if (w2.computeSize) { + widgetHeight += w2.computeSize()[1] + 4; + } else if (w2.element) { + const styles = getComputedStyle(w2.element); + let minHeight = w2.options.getMinHeight?.() ?? parseInt(styles.getPropertyValue("--comfy-widget-min-height")); + let maxHeight = w2.options.getMaxHeight?.() ?? parseInt(styles.getPropertyValue("--comfy-widget-max-height")); + let prefHeight = w2.options.getHeight?.() ?? styles.getPropertyValue("--comfy-widget-height"); if (prefHeight.endsWith?.("%")) { prefHeight = size2[1] * (parseFloat(prefHeight.substring(0, prefHeight.length - 1)) / 100); } else { @@ -156528,7 +184833,7 @@ function computeSize(size2) { dom.push({ minHeight, prefHeight, - w + w: w2 }); } else { widgetHeight += LiteGraph.NODE_WIDGET_HEIGHT + 4; @@ -156538,23 +184843,23 @@ function computeSize(size2) { const prefGrow = []; const canGrow = []; let growBy = 0; - for (const d of dom) { - freeSpace -= d.minHeight; - if (isNaN(d.prefHeight)) { - canGrow.push(d); - d.w.computedHeight = d.minHeight; + for (const d2 of dom) { + freeSpace -= d2.minHeight; + if (isNaN(d2.prefHeight)) { + canGrow.push(d2); + d2.w.computedHeight = d2.minHeight; } else { - const diff2 = d.prefHeight - d.minHeight; + const diff2 = d2.prefHeight - d2.minHeight; if (diff2 > 0) { - prefGrow.push(d); + prefGrow.push(d2); growBy += diff2; - d.diff = diff2; + d2.diff = diff2; } else { - d.w.computedHeight = d.minHeight; + d2.w.computedHeight = d2.minHeight; } } } - if (this.imgs && !this.widgets.find((w) => w.name === ANIM_PREVIEW_WIDGET)) { + if (this.imgs && !this.widgets.find((w2) => w2.name === ANIM_PREVIEW_WIDGET)) { freeSpace -= 220; } this.freeWidgetSpace = freeSpace; @@ -156565,29 +184870,29 @@ function computeSize(size2) { const growDiff = freeSpace - growBy; if (growDiff > 0) { freeSpace = growDiff; - for (const d of prefGrow) { - d.w.computedHeight = d.prefHeight; + for (const d2 of prefGrow) { + d2.w.computedHeight = d2.prefHeight; } } else { const shared = -growDiff / prefGrow.length; - for (const d of prefGrow) { - d.w.computedHeight = d.prefHeight - shared; + for (const d2 of prefGrow) { + d2.w.computedHeight = d2.prefHeight - shared; } freeSpace = 0; } if (freeSpace > 0 && canGrow.length) { const shared = freeSpace / canGrow.length; - for (const d of canGrow) { - d.w.computedHeight += shared; + for (const d2 of canGrow) { + d2.w.computedHeight += shared; } } } - for (const w of this.widgets) { - w.y = y2; - if (w.computedHeight) { - y2 += w.computedHeight; - } else if (w.computeSize) { - y2 += w.computeSize()[1] + 4; + for (const w2 of this.widgets) { + w2.y = y2; + if (w2.computedHeight) { + y2 += w2.computedHeight; + } else if (w2.computeSize) { + y2 += w2.computeSize()[1] + 4; } else { y2 += LiteGraph.NODE_WIDGET_HEIGHT + 4; } @@ -156601,17 +184906,17 @@ LGraphCanvas.prototype.computeVisibleNodes = function() { for (const node3 of app$1.graph.nodes) { if (elementWidgets.has(node3)) { const hidden = visibleNodes.indexOf(node3) === -1; - for (const w of node3.widgets) { - if (w.element) { - w.element.dataset.isInVisibleNodes = hidden ? "false" : "true"; - const shouldOtherwiseHide = w.element.dataset.shouldHide === "true"; - const isCollapsed = w.element.dataset.collapsed === "true"; - const wasHidden = w.element.hidden; + for (const w2 of node3.widgets) { + if (w2.element) { + w2.element.dataset.isInVisibleNodes = hidden ? "false" : "true"; + const shouldOtherwiseHide = w2.element.dataset.shouldHide === "true"; + const isCollapsed = w2.element.dataset.collapsed === "true"; + const wasHidden = w2.element.hidden; const actualHidden = hidden || shouldOtherwiseHide || isCollapsed; - w.element.hidden = actualHidden; - w.element.style.display = actualHidden ? "none" : null; + w2.element.hidden = actualHidden; + w2.element.style.display = actualHidden ? "none" : null; if (actualHidden && !wasHidden) { - w.options.onHide?.(w); + w2.options.onHide?.(w2); } } } @@ -156720,6 +185025,11 @@ LGraphNode.prototype.addDOMWidget = function(name2, type, element, options4 = {} } element.dataset.collapsed = this.flags?.collapsed ? "true" : "false"; }; + const { onConfigure } = this; + this.onConfigure = function() { + onConfigure?.apply(this, arguments); + element.dataset.collapsed = this.flags?.collapsed ? "true" : "false"; + }; const onRemoved = this.onRemoved; this.onRemoved = function() { element.remove(); @@ -156978,12 +185288,12 @@ function createIntWidget(node3, inputName, inputData, app2, isSeedInput = false) inputName, val, function(v2) { - const s = this.options.step / 10; - let sh = this.options.min % s; + const s2 = this.options.step / 10; + let sh = this.options.min % s2; if (isNaN(sh)) { sh = 0; } - this.value = Math.round((v2 - sh) / s) * s + sh; + this.value = Math.round((v2 - sh) / s2) * s2 + sh; }, config2 ) @@ -157223,7 +185533,7 @@ const ComfyWidgets = { }, IMAGEUPLOAD(node3, inputName, inputData, app2) { const imageWidget = node3.widgets.find( - (w) => w.name === (inputData[1]?.widget ?? "image") + (w2) => w2.name === (inputData[1]?.widget ?? "image") ); let uploadWidget; function showImage(name2) { @@ -157289,9 +185599,9 @@ const ComfyWidgets = { body }); if (resp.status === 200) { - const data24 = await resp.json(); - let path = data24.name; - if (data24.subfolder) path = data24.subfolder + "/" + path; + const data25 = await resp.json(); + let path = data25.name; + if (data25.subfolder) path = data25.subfolder + "/" + path; if (!imageWidget.options.values.includes(path)) { imageWidget.options.values.push(path); } @@ -157326,7 +185636,7 @@ const ComfyWidgets = { uploadWidget.serialize = false; node3.onDragOver = function(e2) { if (e2.dataTransfer && e2.dataTransfer.items) { - const image2 = [...e2.dataTransfer.items].find((f) => f.kind === "file"); + const image2 = [...e2.dataTransfer.items].find((f2) => f2.kind === "file"); return !!image2; } return false; @@ -157399,9 +185709,9 @@ const useWidgetStore = /* @__PURE__ */ defineStore("widget", () => { }); var addonFit$2 = { exports: {} }; var addonFit = addonFit$2.exports; -(function(module, exports) { +(function(module2, exports) { !function(e2, t2) { - true ? module.exports = t2() : false ? (void 0)([], t2) : true ? exports.FitAddon = t2() : e2.FitAddon = t2(); + true ? module2.exports = t2() : false ? (void 0)([], t2) : true ? exports.FitAddon = t2() : e2.FitAddon = t2(); }(self, () => (() => { "use strict"; var e2 = {}; @@ -157424,8 +185734,8 @@ var addonFit = addonFit$2.exports; if (!this._terminal.element || !this._terminal.element.parentElement) return; const e3 = this._terminal._core, t3 = e3._renderService.dimensions; if (0 === t3.css.cell.width || 0 === t3.css.cell.height) return; - const r = 0 === this._terminal.options.scrollback ? 0 : e3.viewport.scrollBarWidth, i2 = window.getComputedStyle(this._terminal.element.parentElement), o = parseInt(i2.getPropertyValue("height")), s = Math.max(0, parseInt(i2.getPropertyValue("width"))), n = window.getComputedStyle(this._terminal.element), l = o - (parseInt(n.getPropertyValue("padding-top")) + parseInt(n.getPropertyValue("padding-bottom"))), a = s - (parseInt(n.getPropertyValue("padding-right")) + parseInt(n.getPropertyValue("padding-left"))) - r; - return { cols: Math.max(2, Math.floor(a / t3.css.cell.width)), rows: Math.max(1, Math.floor(l / t3.css.cell.height)) }; + const r2 = 0 === this._terminal.options.scrollback ? 0 : e3.viewport.scrollBarWidth, i2 = window.getComputedStyle(this._terminal.element.parentElement), o2 = parseInt(i2.getPropertyValue("height")), s2 = Math.max(0, parseInt(i2.getPropertyValue("width"))), n2 = window.getComputedStyle(this._terminal.element), l2 = o2 - (parseInt(n2.getPropertyValue("padding-top")) + parseInt(n2.getPropertyValue("padding-bottom"))), a2 = s2 - (parseInt(n2.getPropertyValue("padding-right")) + parseInt(n2.getPropertyValue("padding-left"))) - r2; + return { cols: Math.max(2, Math.floor(a2 / t3.css.cell.width)), rows: Math.max(1, Math.floor(l2 / t3.css.cell.height)) }; } }; })(), e2; @@ -157435,35 +185745,35 @@ var addonFitExports = addonFit$2.exports; const addonFit$1 = /* @__PURE__ */ getDefaultExportFromCjs(addonFitExports); var xterm$2 = { exports: {} }; var xterm = xterm$2.exports; -(function(module, exports) { +(function(module2, exports) { !function(e2, t2) { - if (true) module.exports = t2(); + if (true) module2.exports = t2(); else if (false) (void 0)([], t2); else { var i2 = t2(); - for (var s in i2) (true ? exports : e2)[s] = i2[s]; + for (var s2 in i2) (true ? exports : e2)[s2] = i2[s2]; } }(globalThis, () => (() => { "use strict"; var e2 = { 4567: function(e3, t3, i3) { - var s2 = this && this.__decorate || function(e4, t4, i4, s3) { - var r2, n2 = arguments.length, o2 = n2 < 3 ? t4 : null === s3 ? s3 = Object.getOwnPropertyDescriptor(t4, i4) : s3; - if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o2 = Reflect.decorate(e4, t4, i4, s3); - else for (var a2 = e4.length - 1; a2 >= 0; a2--) (r2 = e4[a2]) && (o2 = (n2 < 3 ? r2(o2) : n2 > 3 ? r2(t4, i4, o2) : r2(t4, i4)) || o2); - return n2 > 3 && o2 && Object.defineProperty(t4, i4, o2), o2; - }, r = this && this.__param || function(e4, t4) { - return function(i4, s3) { - t4(i4, s3, e4); + var s3 = this && this.__decorate || function(e4, t4, i4, s4) { + var r3, n3 = arguments.length, o3 = n3 < 3 ? t4 : null === s4 ? s4 = Object.getOwnPropertyDescriptor(t4, i4) : s4; + if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o3 = Reflect.decorate(e4, t4, i4, s4); + else for (var a3 = e4.length - 1; a3 >= 0; a3--) (r3 = e4[a3]) && (o3 = (n3 < 3 ? r3(o3) : n3 > 3 ? r3(t4, i4, o3) : r3(t4, i4)) || o3); + return n3 > 3 && o3 && Object.defineProperty(t4, i4, o3), o3; + }, r2 = this && this.__param || function(e4, t4) { + return function(i4, s4) { + t4(i4, s4, e4); }; }; Object.defineProperty(t3, "__esModule", { value: true }), t3.AccessibilityManager = void 0; - const n = i3(9042), o = i3(9924), a = i3(844), h2 = i3(4725), c = i3(2585), l = i3(3656); - let d = t3.AccessibilityManager = class extends a.Disposable { - constructor(e4, t4, i4, s3) { - super(), this._terminal = e4, this._coreBrowserService = i4, this._renderService = s3, this._rowColumns = /* @__PURE__ */ new WeakMap(), this._liveRegionLineCount = 0, this._charsToConsume = [], this._charsToAnnounce = "", this._accessibilityContainer = this._coreBrowserService.mainDocument.createElement("div"), this._accessibilityContainer.classList.add("xterm-accessibility"), this._rowContainer = this._coreBrowserService.mainDocument.createElement("div"), this._rowContainer.setAttribute("role", "list"), this._rowContainer.classList.add("xterm-accessibility-tree"), this._rowElements = []; + const n2 = i3(9042), o2 = i3(9924), a2 = i3(844), h2 = i3(4725), c2 = i3(2585), l2 = i3(3656); + let d2 = t3.AccessibilityManager = class extends a2.Disposable { + constructor(e4, t4, i4, s4) { + super(), this._terminal = e4, this._coreBrowserService = i4, this._renderService = s4, this._rowColumns = /* @__PURE__ */ new WeakMap(), this._liveRegionLineCount = 0, this._charsToConsume = [], this._charsToAnnounce = "", this._accessibilityContainer = this._coreBrowserService.mainDocument.createElement("div"), this._accessibilityContainer.classList.add("xterm-accessibility"), this._rowContainer = this._coreBrowserService.mainDocument.createElement("div"), this._rowContainer.setAttribute("role", "list"), this._rowContainer.classList.add("xterm-accessibility-tree"), this._rowElements = []; for (let e5 = 0; e5 < this._terminal.rows; e5++) this._rowElements[e5] = this._createAccessibilityTreeNode(), this._rowContainer.appendChild(this._rowElements[e5]); - if (this._topBoundaryFocusListener = (e5) => this._handleBoundaryFocus(e5, 0), this._bottomBoundaryFocusListener = (e5) => this._handleBoundaryFocus(e5, 1), this._rowElements[0].addEventListener("focus", this._topBoundaryFocusListener), this._rowElements[this._rowElements.length - 1].addEventListener("focus", this._bottomBoundaryFocusListener), this._refreshRowsDimensions(), this._accessibilityContainer.appendChild(this._rowContainer), this._liveRegion = this._coreBrowserService.mainDocument.createElement("div"), this._liveRegion.classList.add("live-region"), this._liveRegion.setAttribute("aria-live", "assertive"), this._accessibilityContainer.appendChild(this._liveRegion), this._liveRegionDebouncer = this.register(new o.TimeBasedDebouncer(this._renderRows.bind(this))), !this._terminal.element) throw new Error("Cannot enable accessibility before Terminal.open"); - this._terminal.element.insertAdjacentElement("afterbegin", this._accessibilityContainer), this.register(this._terminal.onResize((e5) => this._handleResize(e5.rows))), this.register(this._terminal.onRender((e5) => this._refreshRows(e5.start, e5.end))), this.register(this._terminal.onScroll(() => this._refreshRows())), this.register(this._terminal.onA11yChar((e5) => this._handleChar(e5))), this.register(this._terminal.onLineFeed(() => this._handleChar("\n"))), this.register(this._terminal.onA11yTab((e5) => this._handleTab(e5))), this.register(this._terminal.onKey((e5) => this._handleKey(e5.key))), this.register(this._terminal.onBlur(() => this._clearLiveRegion())), this.register(this._renderService.onDimensionsChange(() => this._refreshRowsDimensions())), this.register((0, l.addDisposableDomListener)(document, "selectionchange", () => this._handleSelectionChange())), this.register(this._coreBrowserService.onDprChange(() => this._refreshRowsDimensions())), this._refreshRows(), this.register((0, a.toDisposable)(() => { + if (this._topBoundaryFocusListener = (e5) => this._handleBoundaryFocus(e5, 0), this._bottomBoundaryFocusListener = (e5) => this._handleBoundaryFocus(e5, 1), this._rowElements[0].addEventListener("focus", this._topBoundaryFocusListener), this._rowElements[this._rowElements.length - 1].addEventListener("focus", this._bottomBoundaryFocusListener), this._refreshRowsDimensions(), this._accessibilityContainer.appendChild(this._rowContainer), this._liveRegion = this._coreBrowserService.mainDocument.createElement("div"), this._liveRegion.classList.add("live-region"), this._liveRegion.setAttribute("aria-live", "assertive"), this._accessibilityContainer.appendChild(this._liveRegion), this._liveRegionDebouncer = this.register(new o2.TimeBasedDebouncer(this._renderRows.bind(this))), !this._terminal.element) throw new Error("Cannot enable accessibility before Terminal.open"); + this._terminal.element.insertAdjacentElement("afterbegin", this._accessibilityContainer), this.register(this._terminal.onResize((e5) => this._handleResize(e5.rows))), this.register(this._terminal.onRender((e5) => this._refreshRows(e5.start, e5.end))), this.register(this._terminal.onScroll(() => this._refreshRows())), this.register(this._terminal.onA11yChar((e5) => this._handleChar(e5))), this.register(this._terminal.onLineFeed(() => this._handleChar("\n"))), this.register(this._terminal.onA11yTab((e5) => this._handleTab(e5))), this.register(this._terminal.onKey((e5) => this._handleKey(e5.key))), this.register(this._terminal.onBlur(() => this._clearLiveRegion())), this.register(this._renderService.onDimensionsChange(() => this._refreshRowsDimensions())), this.register((0, l2.addDisposableDomListener)(document, "selectionchange", () => this._handleSelectionChange())), this.register(this._coreBrowserService.onDprChange(() => this._refreshRowsDimensions())), this._refreshRows(), this.register((0, a2.toDisposable)(() => { this._accessibilityContainer.remove(), this._rowElements.length = 0; })); } @@ -157471,7 +185781,7 @@ var xterm = xterm$2.exports; for (let t4 = 0; t4 < e4; t4++) this._handleChar(" "); } _handleChar(e4) { - this._liveRegionLineCount < 21 && (this._charsToConsume.length > 0 ? this._charsToConsume.shift() !== e4 && (this._charsToAnnounce += e4) : this._charsToAnnounce += e4, "\n" === e4 && (this._liveRegionLineCount++, 21 === this._liveRegionLineCount && (this._liveRegion.textContent += n.tooMuchOutput))); + this._liveRegionLineCount < 21 && (this._charsToConsume.length > 0 ? this._charsToConsume.shift() !== e4 && (this._charsToAnnounce += e4) : this._charsToAnnounce += e4, "\n" === e4 && (this._liveRegionLineCount++, 21 === this._liveRegionLineCount && (this._liveRegion.textContent += n2.tooMuchOutput))); } _clearLiveRegion() { this._liveRegion.textContent = "", this._liveRegionLineCount = 0; @@ -157483,10 +185793,10 @@ var xterm = xterm$2.exports; this._liveRegionDebouncer.refresh(e4, t4, this._terminal.rows); } _renderRows(e4, t4) { - const i4 = this._terminal.buffer, s3 = i4.lines.length.toString(); - for (let r2 = e4; r2 <= t4; r2++) { - const e5 = i4.lines.get(i4.ydisp + r2), t5 = [], n2 = e5?.translateToString(true, void 0, void 0, t5) || "", o2 = (i4.ydisp + r2 + 1).toString(), a2 = this._rowElements[r2]; - a2 && (0 === n2.length ? (a2.innerText = " ", this._rowColumns.set(a2, [0, 1])) : (a2.textContent = n2, this._rowColumns.set(a2, t5)), a2.setAttribute("aria-posinset", o2), a2.setAttribute("aria-setsize", s3)); + const i4 = this._terminal.buffer, s4 = i4.lines.length.toString(); + for (let r3 = e4; r3 <= t4; r3++) { + const e5 = i4.lines.get(i4.ydisp + r3), t5 = [], n3 = e5?.translateToString(true, void 0, void 0, t5) || "", o3 = (i4.ydisp + r3 + 1).toString(), a3 = this._rowElements[r3]; + a3 && (0 === n3.length ? (a3.innerText = " ", this._rowColumns.set(a3, [0, 1])) : (a3.textContent = n3, this._rowColumns.set(a3, t5)), a3.setAttribute("aria-posinset", o3), a3.setAttribute("aria-setsize", s4)); } this._announceCharacters(); } @@ -157494,11 +185804,11 @@ var xterm = xterm$2.exports; 0 !== this._charsToAnnounce.length && (this._liveRegion.textContent += this._charsToAnnounce, this._charsToAnnounce = ""); } _handleBoundaryFocus(e4, t4) { - const i4 = e4.target, s3 = this._rowElements[0 === t4 ? 1 : this._rowElements.length - 2]; + const i4 = e4.target, s4 = this._rowElements[0 === t4 ? 1 : this._rowElements.length - 2]; if (i4.getAttribute("aria-posinset") === (0 === t4 ? "1" : `${this._terminal.buffer.lines.length}`)) return; - if (e4.relatedTarget !== s3) return; - let r2, n2; - if (0 === t4 ? (r2 = i4, n2 = this._rowElements.pop(), this._rowContainer.removeChild(n2)) : (r2 = this._rowElements.shift(), n2 = i4, this._rowContainer.removeChild(r2)), r2.removeEventListener("focus", this._topBoundaryFocusListener), n2.removeEventListener("focus", this._bottomBoundaryFocusListener), 0 === t4) { + if (e4.relatedTarget !== s4) return; + let r3, n3; + if (0 === t4 ? (r3 = i4, n3 = this._rowElements.pop(), this._rowContainer.removeChild(n3)) : (r3 = this._rowElements.shift(), n3 = i4, this._rowContainer.removeChild(r3)), r3.removeEventListener("focus", this._topBoundaryFocusListener), n3.removeEventListener("focus", this._bottomBoundaryFocusListener), 0 === t4) { const e5 = this._createAccessibilityTreeNode(); this._rowElements.unshift(e5), this._rowContainer.insertAdjacentElement("afterbegin", e5); } else { @@ -157515,20 +185825,20 @@ var xterm = xterm$2.exports; if (!e4.anchorNode || !e4.focusNode) return void console.error("anchorNode and/or focusNode are null"); let t4 = { node: e4.anchorNode, offset: e4.anchorOffset }, i4 = { node: e4.focusNode, offset: e4.focusOffset }; if ((t4.node.compareDocumentPosition(i4.node) & Node.DOCUMENT_POSITION_PRECEDING || t4.node === i4.node && t4.offset > i4.offset) && ([t4, i4] = [i4, t4]), t4.node.compareDocumentPosition(this._rowElements[0]) & (Node.DOCUMENT_POSITION_CONTAINED_BY | Node.DOCUMENT_POSITION_FOLLOWING) && (t4 = { node: this._rowElements[0].childNodes[0], offset: 0 }), !this._rowContainer.contains(t4.node)) return; - const s3 = this._rowElements.slice(-1)[0]; - if (i4.node.compareDocumentPosition(s3) & (Node.DOCUMENT_POSITION_CONTAINED_BY | Node.DOCUMENT_POSITION_PRECEDING) && (i4 = { node: s3, offset: s3.textContent?.length ?? 0 }), !this._rowContainer.contains(i4.node)) return; - const r2 = /* @__PURE__ */ __name(({ node: e5, offset: t5 }) => { + const s4 = this._rowElements.slice(-1)[0]; + if (i4.node.compareDocumentPosition(s4) & (Node.DOCUMENT_POSITION_CONTAINED_BY | Node.DOCUMENT_POSITION_PRECEDING) && (i4 = { node: s4, offset: s4.textContent?.length ?? 0 }), !this._rowContainer.contains(i4.node)) return; + const r3 = /* @__PURE__ */ __name(({ node: e5, offset: t5 }) => { const i5 = e5 instanceof Text ? e5.parentNode : e5; - let s4 = parseInt(i5?.getAttribute("aria-posinset"), 10) - 1; - if (isNaN(s4)) return console.warn("row is invalid. Race condition?"), null; - const r3 = this._rowColumns.get(i5); - if (!r3) return console.warn("columns is null. Race condition?"), null; - let n3 = t5 < r3.length ? r3[t5] : r3.slice(-1)[0] + 1; - return n3 >= this._terminal.cols && (++s4, n3 = 0), { row: s4, column: n3 }; - }, "r"), n2 = r2(t4), o2 = r2(i4); - if (n2 && o2) { - if (n2.row > o2.row || n2.row === o2.row && n2.column >= o2.column) throw new Error("invalid range"); - this._terminal.select(n2.column, n2.row, (o2.row - n2.row) * this._terminal.cols - n2.column + o2.column); + let s5 = parseInt(i5?.getAttribute("aria-posinset"), 10) - 1; + if (isNaN(s5)) return console.warn("row is invalid. Race condition?"), null; + const r4 = this._rowColumns.get(i5); + if (!r4) return console.warn("columns is null. Race condition?"), null; + let n4 = t5 < r4.length ? r4[t5] : r4.slice(-1)[0] + 1; + return n4 >= this._terminal.cols && (++s5, n4 = 0), { row: s5, column: n4 }; + }, "r"), n3 = r3(t4), o3 = r3(i4); + if (n3 && o3) { + if (n3.row > o3.row || n3.row === o3.row && n3.column >= o3.column) throw new Error("invalid range"); + this._terminal.select(n3.column, n3.row, (o3.row - n3.row) * this._terminal.cols - n3.column + o3.column); } } _handleResize(e4) { @@ -157551,38 +185861,38 @@ var xterm = xterm$2.exports; e4.style.height = `${this._renderService.dimensions.css.cell.height}px`; } }; - t3.AccessibilityManager = d = s2([r(1, c.IInstantiationService), r(2, h2.ICoreBrowserService), r(3, h2.IRenderService)], d); + t3.AccessibilityManager = d2 = s3([r2(1, c2.IInstantiationService), r2(2, h2.ICoreBrowserService), r2(3, h2.IRenderService)], d2); }, 3614: (e3, t3) => { function i3(e4) { return e4.replace(/\r?\n/g, "\r"); } __name(i3, "i"); - function s2(e4, t4) { + function s3(e4, t4) { return t4 ? "\x1B[200~" + e4 + "\x1B[201~" : e4; } - __name(s2, "s"); - function r(e4, t4, r2, n2) { - e4 = s2(e4 = i3(e4), r2.decPrivateModes.bracketedPasteMode && true !== n2.rawOptions.ignoreBracketedPasteMode), r2.triggerDataEvent(e4, true), t4.value = ""; + __name(s3, "s"); + function r2(e4, t4, r3, n3) { + e4 = s3(e4 = i3(e4), r3.decPrivateModes.bracketedPasteMode && true !== n3.rawOptions.ignoreBracketedPasteMode), r3.triggerDataEvent(e4, true), t4.value = ""; } - __name(r, "r"); - function n(e4, t4, i4) { - const s3 = i4.getBoundingClientRect(), r2 = e4.clientX - s3.left - 10, n2 = e4.clientY - s3.top - 10; - t4.style.width = "20px", t4.style.height = "20px", t4.style.left = `${r2}px`, t4.style.top = `${n2}px`, t4.style.zIndex = "1000", t4.focus(); + __name(r2, "r"); + function n2(e4, t4, i4) { + const s4 = i4.getBoundingClientRect(), r3 = e4.clientX - s4.left - 10, n3 = e4.clientY - s4.top - 10; + t4.style.width = "20px", t4.style.height = "20px", t4.style.left = `${r3}px`, t4.style.top = `${n3}px`, t4.style.zIndex = "1000", t4.focus(); } - __name(n, "n"); - Object.defineProperty(t3, "__esModule", { value: true }), t3.rightClickHandler = t3.moveTextAreaUnderMouseCursor = t3.paste = t3.handlePasteEvent = t3.copyHandler = t3.bracketTextForPaste = t3.prepareTextForTerminal = void 0, t3.prepareTextForTerminal = i3, t3.bracketTextForPaste = s2, t3.copyHandler = function(e4, t4) { + __name(n2, "n"); + Object.defineProperty(t3, "__esModule", { value: true }), t3.rightClickHandler = t3.moveTextAreaUnderMouseCursor = t3.paste = t3.handlePasteEvent = t3.copyHandler = t3.bracketTextForPaste = t3.prepareTextForTerminal = void 0, t3.prepareTextForTerminal = i3, t3.bracketTextForPaste = s3, t3.copyHandler = function(e4, t4) { e4.clipboardData && e4.clipboardData.setData("text/plain", t4.selectionText), e4.preventDefault(); - }, t3.handlePasteEvent = function(e4, t4, i4, s3) { - e4.stopPropagation(), e4.clipboardData && r(e4.clipboardData.getData("text/plain"), t4, i4, s3); - }, t3.paste = r, t3.moveTextAreaUnderMouseCursor = n, t3.rightClickHandler = function(e4, t4, i4, s3, r2) { - n(e4, t4, i4), r2 && s3.rightClickSelect(e4), t4.value = s3.selectionText, t4.select(); + }, t3.handlePasteEvent = function(e4, t4, i4, s4) { + e4.stopPropagation(), e4.clipboardData && r2(e4.clipboardData.getData("text/plain"), t4, i4, s4); + }, t3.paste = r2, t3.moveTextAreaUnderMouseCursor = n2, t3.rightClickHandler = function(e4, t4, i4, s4, r3) { + n2(e4, t4, i4), r3 && s4.rightClickSelect(e4), t4.value = s4.selectionText, t4.select(); }; }, 7239: (e3, t3, i3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.ColorContrastCache = void 0; - const s2 = i3(1505); + const s3 = i3(1505); t3.ColorContrastCache = class { constructor() { - this._color = new s2.TwoKeyMap(), this._css = new s2.TwoKeyMap(); + this._color = new s3.TwoKeyMap(), this._css = new s3.TwoKeyMap(); } setCss(e4, t4, i4) { this._css.set(e4, t4, i4); @@ -157601,38 +185911,38 @@ var xterm = xterm$2.exports; } }; }, 3656: (e3, t3) => { - Object.defineProperty(t3, "__esModule", { value: true }), t3.addDisposableDomListener = void 0, t3.addDisposableDomListener = function(e4, t4, i3, s2) { - e4.addEventListener(t4, i3, s2); - let r = false; + Object.defineProperty(t3, "__esModule", { value: true }), t3.addDisposableDomListener = void 0, t3.addDisposableDomListener = function(e4, t4, i3, s3) { + e4.addEventListener(t4, i3, s3); + let r2 = false; return { dispose: /* @__PURE__ */ __name(() => { - r || (r = true, e4.removeEventListener(t4, i3, s2)); + r2 || (r2 = true, e4.removeEventListener(t4, i3, s3)); }, "dispose") }; }; }, 3551: function(e3, t3, i3) { - var s2 = this && this.__decorate || function(e4, t4, i4, s3) { - var r2, n2 = arguments.length, o2 = n2 < 3 ? t4 : null === s3 ? s3 = Object.getOwnPropertyDescriptor(t4, i4) : s3; - if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o2 = Reflect.decorate(e4, t4, i4, s3); - else for (var a2 = e4.length - 1; a2 >= 0; a2--) (r2 = e4[a2]) && (o2 = (n2 < 3 ? r2(o2) : n2 > 3 ? r2(t4, i4, o2) : r2(t4, i4)) || o2); - return n2 > 3 && o2 && Object.defineProperty(t4, i4, o2), o2; - }, r = this && this.__param || function(e4, t4) { - return function(i4, s3) { - t4(i4, s3, e4); + var s3 = this && this.__decorate || function(e4, t4, i4, s4) { + var r3, n3 = arguments.length, o3 = n3 < 3 ? t4 : null === s4 ? s4 = Object.getOwnPropertyDescriptor(t4, i4) : s4; + if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o3 = Reflect.decorate(e4, t4, i4, s4); + else for (var a3 = e4.length - 1; a3 >= 0; a3--) (r3 = e4[a3]) && (o3 = (n3 < 3 ? r3(o3) : n3 > 3 ? r3(t4, i4, o3) : r3(t4, i4)) || o3); + return n3 > 3 && o3 && Object.defineProperty(t4, i4, o3), o3; + }, r2 = this && this.__param || function(e4, t4) { + return function(i4, s4) { + t4(i4, s4, e4); }; }; Object.defineProperty(t3, "__esModule", { value: true }), t3.Linkifier = void 0; - const n = i3(3656), o = i3(8460), a = i3(844), h2 = i3(2585), c = i3(4725); - let l = t3.Linkifier = class extends a.Disposable { + const n2 = i3(3656), o2 = i3(8460), a2 = i3(844), h2 = i3(2585), c2 = i3(4725); + let l2 = t3.Linkifier = class extends a2.Disposable { get currentLink() { return this._currentLink; } - constructor(e4, t4, i4, s3, r2) { - super(), this._element = e4, this._mouseService = t4, this._renderService = i4, this._bufferService = s3, this._linkProviderService = r2, this._linkCacheDisposables = [], this._isMouseOut = true, this._wasResized = false, this._activeLine = -1, this._onShowLinkUnderline = this.register(new o.EventEmitter()), this.onShowLinkUnderline = this._onShowLinkUnderline.event, this._onHideLinkUnderline = this.register(new o.EventEmitter()), this.onHideLinkUnderline = this._onHideLinkUnderline.event, this.register((0, a.getDisposeArrayDisposable)(this._linkCacheDisposables)), this.register((0, a.toDisposable)(() => { + constructor(e4, t4, i4, s4, r3) { + super(), this._element = e4, this._mouseService = t4, this._renderService = i4, this._bufferService = s4, this._linkProviderService = r3, this._linkCacheDisposables = [], this._isMouseOut = true, this._wasResized = false, this._activeLine = -1, this._onShowLinkUnderline = this.register(new o2.EventEmitter()), this.onShowLinkUnderline = this._onShowLinkUnderline.event, this._onHideLinkUnderline = this.register(new o2.EventEmitter()), this.onHideLinkUnderline = this._onHideLinkUnderline.event, this.register((0, a2.getDisposeArrayDisposable)(this._linkCacheDisposables)), this.register((0, a2.toDisposable)(() => { this._lastMouseEvent = void 0, this._activeProviderReplies?.clear(); })), this.register(this._bufferService.onResize(() => { this._clearCurrentLink(), this._wasResized = true; - })), this.register((0, n.addDisposableDomListener)(this._element, "mouseleave", () => { + })), this.register((0, n2.addDisposableDomListener)(this._element, "mouseleave", () => { this._isMouseOut = true, this._clearCurrentLink(); - })), this.register((0, n.addDisposableDomListener)(this._element, "mousemove", this._handleMouseMove.bind(this))), this.register((0, n.addDisposableDomListener)(this._element, "mousedown", this._handleMouseDown.bind(this))), this.register((0, n.addDisposableDomListener)(this._element, "mouseup", this._handleMouseUp.bind(this))); + })), this.register((0, n2.addDisposableDomListener)(this._element, "mousemove", this._handleMouseMove.bind(this))), this.register((0, n2.addDisposableDomListener)(this._element, "mousedown", this._handleMouseDown.bind(this))), this.register((0, n2.addDisposableDomListener)(this._element, "mouseup", this._handleMouseUp.bind(this))); } _handleMouseMove(e4) { this._lastMouseEvent = e4; @@ -157658,24 +185968,24 @@ var xterm = xterm$2.exports; }); }), this._activeProviderReplies = /* @__PURE__ */ new Map(), this._activeLine = e4.y); let i4 = false; - for (const [s3, r2] of this._linkProviderService.linkProviders.entries()) if (t4) { - const t5 = this._activeProviderReplies?.get(s3); - t5 && (i4 = this._checkLinkProviderResult(s3, e4, i4)); - } else r2.provideLinks(e4.y, (t5) => { + for (const [s4, r3] of this._linkProviderService.linkProviders.entries()) if (t4) { + const t5 = this._activeProviderReplies?.get(s4); + t5 && (i4 = this._checkLinkProviderResult(s4, e4, i4)); + } else r3.provideLinks(e4.y, (t5) => { if (this._isMouseOut) return; - const r3 = t5?.map((e5) => ({ link: e5 })); - this._activeProviderReplies?.set(s3, r3), i4 = this._checkLinkProviderResult(s3, e4, i4), this._activeProviderReplies?.size === this._linkProviderService.linkProviders.length && this._removeIntersectingLinks(e4.y, this._activeProviderReplies); + const r4 = t5?.map((e5) => ({ link: e5 })); + this._activeProviderReplies?.set(s4, r4), i4 = this._checkLinkProviderResult(s4, e4, i4), this._activeProviderReplies?.size === this._linkProviderService.linkProviders.length && this._removeIntersectingLinks(e4.y, this._activeProviderReplies); }); } _removeIntersectingLinks(e4, t4) { const i4 = /* @__PURE__ */ new Set(); - for (let s3 = 0; s3 < t4.size; s3++) { - const r2 = t4.get(s3); - if (r2) for (let t5 = 0; t5 < r2.length; t5++) { - const s4 = r2[t5], n2 = s4.link.range.start.y < e4 ? 0 : s4.link.range.start.x, o2 = s4.link.range.end.y > e4 ? this._bufferService.cols : s4.link.range.end.x; - for (let e5 = n2; e5 <= o2; e5++) { + for (let s4 = 0; s4 < t4.size; s4++) { + const r3 = t4.get(s4); + if (r3) for (let t5 = 0; t5 < r3.length; t5++) { + const s5 = r3[t5], n3 = s5.link.range.start.y < e4 ? 0 : s5.link.range.start.x, o3 = s5.link.range.end.y > e4 ? this._bufferService.cols : s5.link.range.end.x; + for (let e5 = n3; e5 <= o3; e5++) { if (i4.has(e5)) { - r2.splice(t5--, 1); + r3.splice(t5--, 1); break; } i4.add(e5); @@ -157685,17 +185995,17 @@ var xterm = xterm$2.exports; } _checkLinkProviderResult(e4, t4, i4) { if (!this._activeProviderReplies) return i4; - const s3 = this._activeProviderReplies.get(e4); - let r2 = false; - for (let t5 = 0; t5 < e4; t5++) this._activeProviderReplies.has(t5) && !this._activeProviderReplies.get(t5) || (r2 = true); - if (!r2 && s3) { - const e5 = s3.find((e6) => this._linkAtPosition(e6.link, t4)); + const s4 = this._activeProviderReplies.get(e4); + let r3 = false; + for (let t5 = 0; t5 < e4; t5++) this._activeProviderReplies.has(t5) && !this._activeProviderReplies.get(t5) || (r3 = true); + if (!r3 && s4) { + const e5 = s4.find((e6) => this._linkAtPosition(e6.link, t4)); e5 && (i4 = true, this._handleNewLink(e5)); } if (this._activeProviderReplies.size === this._linkProviderService.linkProviders.length && !i4) for (let e5 = 0; e5 < this._activeProviderReplies.size; e5++) { - const s4 = this._activeProviderReplies.get(e5)?.find((e6) => this._linkAtPosition(e6.link, t4)); - if (s4) { - i4 = true, this._handleNewLink(s4); + const s5 = this._activeProviderReplies.get(e5)?.find((e6) => this._linkAtPosition(e6.link, t4)); + if (s5) { + i4 = true, this._handleNewLink(s5); break; } } @@ -157710,7 +186020,7 @@ var xterm = xterm$2.exports; t4 && this._mouseDownLink === this._currentLink && this._linkAtPosition(this._currentLink.link, t4) && this._currentLink.link.activate(e4, this._currentLink.link.text); } _clearCurrentLink(e4, t4) { - this._currentLink && this._lastMouseEvent && (!e4 || !t4 || this._currentLink.link.range.start.y >= e4 && this._currentLink.link.range.end.y <= t4) && (this._linkLeave(this._element, this._currentLink.link, this._lastMouseEvent), this._currentLink = void 0, (0, a.disposeArray)(this._linkCacheDisposables)); + this._currentLink && this._lastMouseEvent && (!e4 || !t4 || this._currentLink.link.range.start.y >= e4 && this._currentLink.link.range.end.y <= t4) && (this._linkLeave(this._element, this._currentLink.link, this._lastMouseEvent), this._currentLink = void 0, (0, a2.disposeArray)(this._linkCacheDisposables)); } _handleNewLink(e4) { if (!this._lastMouseEvent) return; @@ -157732,74 +186042,74 @@ var xterm = xterm$2.exports; this._currentLink?.state && (this._currentLink.state.isHovered = true, this._currentLink.state.decorations.underline && this._fireUnderlineEvent(t4, true), this._currentLink.state.decorations.pointerCursor && e4.classList.add("xterm-cursor-pointer")), t4.hover && t4.hover(i4, t4.text); } _fireUnderlineEvent(e4, t4) { - const i4 = e4.range, s3 = this._bufferService.buffer.ydisp, r2 = this._createLinkUnderlineEvent(i4.start.x - 1, i4.start.y - s3 - 1, i4.end.x, i4.end.y - s3 - 1, void 0); - (t4 ? this._onShowLinkUnderline : this._onHideLinkUnderline).fire(r2); + const i4 = e4.range, s4 = this._bufferService.buffer.ydisp, r3 = this._createLinkUnderlineEvent(i4.start.x - 1, i4.start.y - s4 - 1, i4.end.x, i4.end.y - s4 - 1, void 0); + (t4 ? this._onShowLinkUnderline : this._onHideLinkUnderline).fire(r3); } _linkLeave(e4, t4, i4) { this._currentLink?.state && (this._currentLink.state.isHovered = false, this._currentLink.state.decorations.underline && this._fireUnderlineEvent(t4, false), this._currentLink.state.decorations.pointerCursor && e4.classList.remove("xterm-cursor-pointer")), t4.leave && t4.leave(i4, t4.text); } _linkAtPosition(e4, t4) { - const i4 = e4.range.start.y * this._bufferService.cols + e4.range.start.x, s3 = e4.range.end.y * this._bufferService.cols + e4.range.end.x, r2 = t4.y * this._bufferService.cols + t4.x; - return i4 <= r2 && r2 <= s3; + const i4 = e4.range.start.y * this._bufferService.cols + e4.range.start.x, s4 = e4.range.end.y * this._bufferService.cols + e4.range.end.x, r3 = t4.y * this._bufferService.cols + t4.x; + return i4 <= r3 && r3 <= s4; } _positionFromMouseEvent(e4, t4, i4) { - const s3 = i4.getCoords(e4, t4, this._bufferService.cols, this._bufferService.rows); - if (s3) return { x: s3[0], y: s3[1] + this._bufferService.buffer.ydisp }; + const s4 = i4.getCoords(e4, t4, this._bufferService.cols, this._bufferService.rows); + if (s4) return { x: s4[0], y: s4[1] + this._bufferService.buffer.ydisp }; } - _createLinkUnderlineEvent(e4, t4, i4, s3, r2) { - return { x1: e4, y1: t4, x2: i4, y2: s3, cols: this._bufferService.cols, fg: r2 }; + _createLinkUnderlineEvent(e4, t4, i4, s4, r3) { + return { x1: e4, y1: t4, x2: i4, y2: s4, cols: this._bufferService.cols, fg: r3 }; } }; - t3.Linkifier = l = s2([r(1, c.IMouseService), r(2, c.IRenderService), r(3, h2.IBufferService), r(4, c.ILinkProviderService)], l); + t3.Linkifier = l2 = s3([r2(1, c2.IMouseService), r2(2, c2.IRenderService), r2(3, h2.IBufferService), r2(4, c2.ILinkProviderService)], l2); }, 9042: (e3, t3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.tooMuchOutput = t3.promptLabel = void 0, t3.promptLabel = "Terminal input", t3.tooMuchOutput = "Too much output to announce, navigate to rows manually to read"; }, 3730: function(e3, t3, i3) { - var s2 = this && this.__decorate || function(e4, t4, i4, s3) { - var r2, n2 = arguments.length, o2 = n2 < 3 ? t4 : null === s3 ? s3 = Object.getOwnPropertyDescriptor(t4, i4) : s3; - if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o2 = Reflect.decorate(e4, t4, i4, s3); - else for (var a2 = e4.length - 1; a2 >= 0; a2--) (r2 = e4[a2]) && (o2 = (n2 < 3 ? r2(o2) : n2 > 3 ? r2(t4, i4, o2) : r2(t4, i4)) || o2); - return n2 > 3 && o2 && Object.defineProperty(t4, i4, o2), o2; - }, r = this && this.__param || function(e4, t4) { - return function(i4, s3) { - t4(i4, s3, e4); + var s3 = this && this.__decorate || function(e4, t4, i4, s4) { + var r3, n3 = arguments.length, o3 = n3 < 3 ? t4 : null === s4 ? s4 = Object.getOwnPropertyDescriptor(t4, i4) : s4; + if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o3 = Reflect.decorate(e4, t4, i4, s4); + else for (var a3 = e4.length - 1; a3 >= 0; a3--) (r3 = e4[a3]) && (o3 = (n3 < 3 ? r3(o3) : n3 > 3 ? r3(t4, i4, o3) : r3(t4, i4)) || o3); + return n3 > 3 && o3 && Object.defineProperty(t4, i4, o3), o3; + }, r2 = this && this.__param || function(e4, t4) { + return function(i4, s4) { + t4(i4, s4, e4); }; }; Object.defineProperty(t3, "__esModule", { value: true }), t3.OscLinkProvider = void 0; - const n = i3(511), o = i3(2585); - let a = t3.OscLinkProvider = class { + const n2 = i3(511), o2 = i3(2585); + let a2 = t3.OscLinkProvider = class { constructor(e4, t4, i4) { this._bufferService = e4, this._optionsService = t4, this._oscLinkService = i4; } provideLinks(e4, t4) { const i4 = this._bufferService.buffer.lines.get(e4 - 1); if (!i4) return void t4(void 0); - const s3 = [], r2 = this._optionsService.rawOptions.linkHandler, o2 = new n.CellData(), a2 = i4.getTrimmedLength(); - let c = -1, l = -1, d = false; - for (let t5 = 0; t5 < a2; t5++) if (-1 !== l || i4.hasContent(t5)) { - if (i4.loadCell(t5, o2), o2.hasExtendedAttrs() && o2.extended.urlId) { - if (-1 === l) { - l = t5, c = o2.extended.urlId; + const s4 = [], r3 = this._optionsService.rawOptions.linkHandler, o3 = new n2.CellData(), a3 = i4.getTrimmedLength(); + let c2 = -1, l2 = -1, d2 = false; + for (let t5 = 0; t5 < a3; t5++) if (-1 !== l2 || i4.hasContent(t5)) { + if (i4.loadCell(t5, o3), o3.hasExtendedAttrs() && o3.extended.urlId) { + if (-1 === l2) { + l2 = t5, c2 = o3.extended.urlId; continue; } - d = o2.extended.urlId !== c; - } else -1 !== l && (d = true); - if (d || -1 !== l && t5 === a2 - 1) { - const i5 = this._oscLinkService.getLinkData(c)?.uri; + d2 = o3.extended.urlId !== c2; + } else -1 !== l2 && (d2 = true); + if (d2 || -1 !== l2 && t5 === a3 - 1) { + const i5 = this._oscLinkService.getLinkData(c2)?.uri; if (i5) { - const n2 = { start: { x: l + 1, y: e4 }, end: { x: t5 + (d || t5 !== a2 - 1 ? 0 : 1), y: e4 } }; - let o3 = false; - if (!r2?.allowNonHttpProtocols) try { + const n3 = { start: { x: l2 + 1, y: e4 }, end: { x: t5 + (d2 || t5 !== a3 - 1 ? 0 : 1), y: e4 } }; + let o4 = false; + if (!r3?.allowNonHttpProtocols) try { const e5 = new URL(i5); - ["http:", "https:"].includes(e5.protocol) || (o3 = true); + ["http:", "https:"].includes(e5.protocol) || (o4 = true); } catch (e5) { - o3 = true; + o4 = true; } - o3 || s3.push({ text: i5, range: n2, activate: /* @__PURE__ */ __name((e5, t6) => r2 ? r2.activate(e5, t6, n2) : h2(0, t6), "activate"), hover: /* @__PURE__ */ __name((e5, t6) => r2?.hover?.(e5, t6, n2), "hover"), leave: /* @__PURE__ */ __name((e5, t6) => r2?.leave?.(e5, t6, n2), "leave") }); + o4 || s4.push({ text: i5, range: n3, activate: /* @__PURE__ */ __name((e5, t6) => r3 ? r3.activate(e5, t6, n3) : h2(0, t6), "activate"), hover: /* @__PURE__ */ __name((e5, t6) => r3?.hover?.(e5, t6, n3), "hover"), leave: /* @__PURE__ */ __name((e5, t6) => r3?.leave?.(e5, t6, n3), "leave") }); } - d = false, o2.hasExtendedAttrs() && o2.extended.urlId ? (l = t5, c = o2.extended.urlId) : (l = -1, c = -1); + d2 = false, o3.hasExtendedAttrs() && o3.extended.urlId ? (l2 = t5, c2 = o3.extended.urlId) : (l2 = -1, c2 = -1); } } - t4(s3); + t4(s4); } }; function h2(e4, t4) { @@ -157817,7 +186127,7 @@ WARNING: This link could potentially be dangerous`)) { } } __name(h2, "h"); - t3.OscLinkProvider = a = s2([r(0, o.IBufferService), r(1, o.IOptionsService), r(2, o.IOscLinkService)], a); + t3.OscLinkProvider = a2 = s3([r2(0, o2.IBufferService), r2(1, o2.IOptionsService), r2(2, o2.IOscLinkService)], a2); }, 6193: (e3, t3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.RenderDebouncer = void 0, t3.RenderDebouncer = class { constructor(e4, t4) { @@ -157844,8 +186154,8 @@ WARNING: This link could potentially be dangerous`)) { }; }, 3236: (e3, t3, i3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.Terminal = void 0; - const s2 = i3(3614), r = i3(3656), n = i3(3551), o = i3(9042), a = i3(3730), h2 = i3(1680), c = i3(3107), l = i3(5744), d = i3(2950), _2 = i3(1296), u = i3(428), f = i3(4269), v2 = i3(5114), p2 = i3(8934), g2 = i3(3230), m = i3(9312), S = i3(4725), C = i3(6731), b = i3(8055), w = i3(8969), y2 = i3(8460), E = i3(844), k = i3(6114), L = i3(8437), D = i3(2584), R = i3(7399), x2 = i3(5941), A = i3(9074), B = i3(2585), T = i3(5435), M = i3(4567), O = i3(779); - class P2 extends w.CoreTerminal { + const s3 = i3(3614), r2 = i3(3656), n2 = i3(3551), o2 = i3(9042), a2 = i3(3730), h2 = i3(1680), c2 = i3(3107), l2 = i3(5744), d2 = i3(2950), _2 = i3(1296), u2 = i3(428), f2 = i3(4269), v2 = i3(5114), p2 = i3(8934), g2 = i3(3230), m2 = i3(9312), S2 = i3(4725), C2 = i3(6731), b2 = i3(8055), w2 = i3(8969), y2 = i3(8460), E = i3(844), k2 = i3(6114), L2 = i3(8437), D2 = i3(2584), R = i3(7399), x2 = i3(5941), A2 = i3(9074), B2 = i3(2585), T2 = i3(5435), M2 = i3(4567), O2 = i3(779); + class P2 extends w2.CoreTerminal { static { __name(this, "P"); } @@ -157865,7 +186175,7 @@ WARNING: This link could potentially be dangerous`)) { return this._onWillOpen.event; } constructor(e4 = {}) { - super(e4), this.browser = k, this._keyDownHandled = false, this._keyDownSeen = false, this._keyPressHandled = false, this._unprocessedDeadKey = false, this._accessibilityManager = this.register(new E.MutableDisposable()), this._onCursorMove = this.register(new y2.EventEmitter()), this.onCursorMove = this._onCursorMove.event, this._onKey = this.register(new y2.EventEmitter()), this.onKey = this._onKey.event, this._onRender = this.register(new y2.EventEmitter()), this.onRender = this._onRender.event, this._onSelectionChange = this.register(new y2.EventEmitter()), this.onSelectionChange = this._onSelectionChange.event, this._onTitleChange = this.register(new y2.EventEmitter()), this.onTitleChange = this._onTitleChange.event, this._onBell = this.register(new y2.EventEmitter()), this.onBell = this._onBell.event, this._onFocus = this.register(new y2.EventEmitter()), this._onBlur = this.register(new y2.EventEmitter()), this._onA11yCharEmitter = this.register(new y2.EventEmitter()), this._onA11yTabEmitter = this.register(new y2.EventEmitter()), this._onWillOpen = this.register(new y2.EventEmitter()), this._setup(), this._decorationService = this._instantiationService.createInstance(A.DecorationService), this._instantiationService.setService(B.IDecorationService, this._decorationService), this._linkProviderService = this._instantiationService.createInstance(O.LinkProviderService), this._instantiationService.setService(S.ILinkProviderService, this._linkProviderService), this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(a.OscLinkProvider)), this.register(this._inputHandler.onRequestBell(() => this._onBell.fire())), this.register(this._inputHandler.onRequestRefreshRows((e5, t4) => this.refresh(e5, t4))), this.register(this._inputHandler.onRequestSendFocus(() => this._reportFocus())), this.register(this._inputHandler.onRequestReset(() => this.reset())), this.register(this._inputHandler.onRequestWindowsOptionsReport((e5) => this._reportWindowsOptions(e5))), this.register(this._inputHandler.onColor((e5) => this._handleColorEvent(e5))), this.register((0, y2.forwardEvent)(this._inputHandler.onCursorMove, this._onCursorMove)), this.register((0, y2.forwardEvent)(this._inputHandler.onTitleChange, this._onTitleChange)), this.register((0, y2.forwardEvent)(this._inputHandler.onA11yChar, this._onA11yCharEmitter)), this.register((0, y2.forwardEvent)(this._inputHandler.onA11yTab, this._onA11yTabEmitter)), this.register(this._bufferService.onResize((e5) => this._afterResize(e5.cols, e5.rows))), this.register((0, E.toDisposable)(() => { + super(e4), this.browser = k2, this._keyDownHandled = false, this._keyDownSeen = false, this._keyPressHandled = false, this._unprocessedDeadKey = false, this._accessibilityManager = this.register(new E.MutableDisposable()), this._onCursorMove = this.register(new y2.EventEmitter()), this.onCursorMove = this._onCursorMove.event, this._onKey = this.register(new y2.EventEmitter()), this.onKey = this._onKey.event, this._onRender = this.register(new y2.EventEmitter()), this.onRender = this._onRender.event, this._onSelectionChange = this.register(new y2.EventEmitter()), this.onSelectionChange = this._onSelectionChange.event, this._onTitleChange = this.register(new y2.EventEmitter()), this.onTitleChange = this._onTitleChange.event, this._onBell = this.register(new y2.EventEmitter()), this.onBell = this._onBell.event, this._onFocus = this.register(new y2.EventEmitter()), this._onBlur = this.register(new y2.EventEmitter()), this._onA11yCharEmitter = this.register(new y2.EventEmitter()), this._onA11yTabEmitter = this.register(new y2.EventEmitter()), this._onWillOpen = this.register(new y2.EventEmitter()), this._setup(), this._decorationService = this._instantiationService.createInstance(A2.DecorationService), this._instantiationService.setService(B2.IDecorationService, this._decorationService), this._linkProviderService = this._instantiationService.createInstance(O2.LinkProviderService), this._instantiationService.setService(S2.ILinkProviderService, this._linkProviderService), this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(a2.OscLinkProvider)), this.register(this._inputHandler.onRequestBell(() => this._onBell.fire())), this.register(this._inputHandler.onRequestRefreshRows((e5, t4) => this.refresh(e5, t4))), this.register(this._inputHandler.onRequestSendFocus(() => this._reportFocus())), this.register(this._inputHandler.onRequestReset(() => this.reset())), this.register(this._inputHandler.onRequestWindowsOptionsReport((e5) => this._reportWindowsOptions(e5))), this.register(this._inputHandler.onColor((e5) => this._handleColorEvent(e5))), this.register((0, y2.forwardEvent)(this._inputHandler.onCursorMove, this._onCursorMove)), this.register((0, y2.forwardEvent)(this._inputHandler.onTitleChange, this._onTitleChange)), this.register((0, y2.forwardEvent)(this._inputHandler.onA11yChar, this._onA11yCharEmitter)), this.register((0, y2.forwardEvent)(this._inputHandler.onA11yTab, this._onA11yTabEmitter)), this.register(this._bufferService.onResize((e5) => this._afterResize(e5.cols, e5.rows))), this.register((0, E.toDisposable)(() => { this._customKeyEventHandler = void 0, this.element?.parentNode?.removeChild(this.element); })); } @@ -157887,14 +186197,14 @@ WARNING: This link could potentially be dangerous`)) { } switch (t4.type) { case 0: - const s3 = b.color.toColorRGB("ansi" === e5 ? this._themeService.colors.ansi[t4.index] : this._themeService.colors[e5]); - this.coreService.triggerDataEvent(`${D.C0.ESC}]${i4};${(0, x2.toRgbString)(s3)}${D.C1_ESCAPED.ST}`); + const s4 = b2.color.toColorRGB("ansi" === e5 ? this._themeService.colors.ansi[t4.index] : this._themeService.colors[e5]); + this.coreService.triggerDataEvent(`${D2.C0.ESC}]${i4};${(0, x2.toRgbString)(s4)}${D2.C1_ESCAPED.ST}`); break; case 1: - if ("ansi" === e5) this._themeService.modifyColors((e6) => e6.ansi[t4.index] = b.channels.toColor(...t4.color)); + if ("ansi" === e5) this._themeService.modifyColors((e6) => e6.ansi[t4.index] = b2.channels.toColor(...t4.color)); else { const i5 = e5; - this._themeService.modifyColors((e6) => e6[i5] = b.channels.toColor(...t4.color)); + this._themeService.modifyColors((e6) => e6[i5] = b2.channels.toColor(...t4.color)); } break; case 2: @@ -157912,58 +186222,58 @@ WARNING: This link could potentially be dangerous`)) { this.textarea && this.textarea.focus({ preventScroll: true }); } _handleScreenReaderModeOptionChange(e4) { - e4 ? !this._accessibilityManager.value && this._renderService && (this._accessibilityManager.value = this._instantiationService.createInstance(M.AccessibilityManager, this)) : this._accessibilityManager.clear(); + e4 ? !this._accessibilityManager.value && this._renderService && (this._accessibilityManager.value = this._instantiationService.createInstance(M2.AccessibilityManager, this)) : this._accessibilityManager.clear(); } _handleTextAreaFocus(e4) { - this.coreService.decPrivateModes.sendFocus && this.coreService.triggerDataEvent(D.C0.ESC + "[I"), this.element.classList.add("focus"), this._showCursor(), this._onFocus.fire(); + this.coreService.decPrivateModes.sendFocus && this.coreService.triggerDataEvent(D2.C0.ESC + "[I"), this.element.classList.add("focus"), this._showCursor(), this._onFocus.fire(); } blur() { return this.textarea?.blur(); } _handleTextAreaBlur() { - this.textarea.value = "", this.refresh(this.buffer.y, this.buffer.y), this.coreService.decPrivateModes.sendFocus && this.coreService.triggerDataEvent(D.C0.ESC + "[O"), this.element.classList.remove("focus"), this._onBlur.fire(); + this.textarea.value = "", this.refresh(this.buffer.y, this.buffer.y), this.coreService.decPrivateModes.sendFocus && this.coreService.triggerDataEvent(D2.C0.ESC + "[O"), this.element.classList.remove("focus"), this._onBlur.fire(); } _syncTextArea() { if (!this.textarea || !this.buffer.isCursorInViewport || this._compositionHelper.isComposing || !this._renderService) return; const e4 = this.buffer.ybase + this.buffer.y, t4 = this.buffer.lines.get(e4); if (!t4) return; - const i4 = Math.min(this.buffer.x, this.cols - 1), s3 = this._renderService.dimensions.css.cell.height, r2 = t4.getWidth(i4), n2 = this._renderService.dimensions.css.cell.width * r2, o2 = this.buffer.y * this._renderService.dimensions.css.cell.height, a2 = i4 * this._renderService.dimensions.css.cell.width; - this.textarea.style.left = a2 + "px", this.textarea.style.top = o2 + "px", this.textarea.style.width = n2 + "px", this.textarea.style.height = s3 + "px", this.textarea.style.lineHeight = s3 + "px", this.textarea.style.zIndex = "-5"; + const i4 = Math.min(this.buffer.x, this.cols - 1), s4 = this._renderService.dimensions.css.cell.height, r3 = t4.getWidth(i4), n3 = this._renderService.dimensions.css.cell.width * r3, o3 = this.buffer.y * this._renderService.dimensions.css.cell.height, a3 = i4 * this._renderService.dimensions.css.cell.width; + this.textarea.style.left = a3 + "px", this.textarea.style.top = o3 + "px", this.textarea.style.width = n3 + "px", this.textarea.style.height = s4 + "px", this.textarea.style.lineHeight = s4 + "px", this.textarea.style.zIndex = "-5"; } _initGlobal() { - this._bindKeys(), this.register((0, r.addDisposableDomListener)(this.element, "copy", (e5) => { - this.hasSelection() && (0, s2.copyHandler)(e5, this._selectionService); + this._bindKeys(), this.register((0, r2.addDisposableDomListener)(this.element, "copy", (e5) => { + this.hasSelection() && (0, s3.copyHandler)(e5, this._selectionService); })); - const e4 = /* @__PURE__ */ __name((e5) => (0, s2.handlePasteEvent)(e5, this.textarea, this.coreService, this.optionsService), "e"); - this.register((0, r.addDisposableDomListener)(this.textarea, "paste", e4)), this.register((0, r.addDisposableDomListener)(this.element, "paste", e4)), k.isFirefox ? this.register((0, r.addDisposableDomListener)(this.element, "mousedown", (e5) => { - 2 === e5.button && (0, s2.rightClickHandler)(e5, this.textarea, this.screenElement, this._selectionService, this.options.rightClickSelectsWord); - })) : this.register((0, r.addDisposableDomListener)(this.element, "contextmenu", (e5) => { - (0, s2.rightClickHandler)(e5, this.textarea, this.screenElement, this._selectionService, this.options.rightClickSelectsWord); - })), k.isLinux && this.register((0, r.addDisposableDomListener)(this.element, "auxclick", (e5) => { - 1 === e5.button && (0, s2.moveTextAreaUnderMouseCursor)(e5, this.textarea, this.screenElement); + const e4 = /* @__PURE__ */ __name((e5) => (0, s3.handlePasteEvent)(e5, this.textarea, this.coreService, this.optionsService), "e"); + this.register((0, r2.addDisposableDomListener)(this.textarea, "paste", e4)), this.register((0, r2.addDisposableDomListener)(this.element, "paste", e4)), k2.isFirefox ? this.register((0, r2.addDisposableDomListener)(this.element, "mousedown", (e5) => { + 2 === e5.button && (0, s3.rightClickHandler)(e5, this.textarea, this.screenElement, this._selectionService, this.options.rightClickSelectsWord); + })) : this.register((0, r2.addDisposableDomListener)(this.element, "contextmenu", (e5) => { + (0, s3.rightClickHandler)(e5, this.textarea, this.screenElement, this._selectionService, this.options.rightClickSelectsWord); + })), k2.isLinux && this.register((0, r2.addDisposableDomListener)(this.element, "auxclick", (e5) => { + 1 === e5.button && (0, s3.moveTextAreaUnderMouseCursor)(e5, this.textarea, this.screenElement); })); } _bindKeys() { - this.register((0, r.addDisposableDomListener)(this.textarea, "keyup", (e4) => this._keyUp(e4), true)), this.register((0, r.addDisposableDomListener)(this.textarea, "keydown", (e4) => this._keyDown(e4), true)), this.register((0, r.addDisposableDomListener)(this.textarea, "keypress", (e4) => this._keyPress(e4), true)), this.register((0, r.addDisposableDomListener)(this.textarea, "compositionstart", () => this._compositionHelper.compositionstart())), this.register((0, r.addDisposableDomListener)(this.textarea, "compositionupdate", (e4) => this._compositionHelper.compositionupdate(e4))), this.register((0, r.addDisposableDomListener)(this.textarea, "compositionend", () => this._compositionHelper.compositionend())), this.register((0, r.addDisposableDomListener)(this.textarea, "input", (e4) => this._inputEvent(e4), true)), this.register(this.onRender(() => this._compositionHelper.updateCompositionElements())); + this.register((0, r2.addDisposableDomListener)(this.textarea, "keyup", (e4) => this._keyUp(e4), true)), this.register((0, r2.addDisposableDomListener)(this.textarea, "keydown", (e4) => this._keyDown(e4), true)), this.register((0, r2.addDisposableDomListener)(this.textarea, "keypress", (e4) => this._keyPress(e4), true)), this.register((0, r2.addDisposableDomListener)(this.textarea, "compositionstart", () => this._compositionHelper.compositionstart())), this.register((0, r2.addDisposableDomListener)(this.textarea, "compositionupdate", (e4) => this._compositionHelper.compositionupdate(e4))), this.register((0, r2.addDisposableDomListener)(this.textarea, "compositionend", () => this._compositionHelper.compositionend())), this.register((0, r2.addDisposableDomListener)(this.textarea, "input", (e4) => this._inputEvent(e4), true)), this.register(this.onRender(() => this._compositionHelper.updateCompositionElements())); } open(e4) { if (!e4) throw new Error("Terminal requires a parent element."); if (e4.isConnected || this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"), this.element?.ownerDocument.defaultView && this._coreBrowserService) return void (this.element.ownerDocument.defaultView !== this._coreBrowserService.window && (this._coreBrowserService.window = this.element.ownerDocument.defaultView)); this._document = e4.ownerDocument, this.options.documentOverride && this.options.documentOverride instanceof Document && (this._document = this.optionsService.rawOptions.documentOverride), this.element = this._document.createElement("div"), this.element.dir = "ltr", this.element.classList.add("terminal"), this.element.classList.add("xterm"), e4.appendChild(this.element); const t4 = this._document.createDocumentFragment(); - this._viewportElement = this._document.createElement("div"), this._viewportElement.classList.add("xterm-viewport"), t4.appendChild(this._viewportElement), this._viewportScrollArea = this._document.createElement("div"), this._viewportScrollArea.classList.add("xterm-scroll-area"), this._viewportElement.appendChild(this._viewportScrollArea), this.screenElement = this._document.createElement("div"), this.screenElement.classList.add("xterm-screen"), this.register((0, r.addDisposableDomListener)(this.screenElement, "mousemove", (e5) => this.updateCursorStyle(e5))), this._helperContainer = this._document.createElement("div"), this._helperContainer.classList.add("xterm-helpers"), this.screenElement.appendChild(this._helperContainer), t4.appendChild(this.screenElement), this.textarea = this._document.createElement("textarea"), this.textarea.classList.add("xterm-helper-textarea"), this.textarea.setAttribute("aria-label", o.promptLabel), k.isChromeOS || this.textarea.setAttribute("aria-multiline", "false"), this.textarea.setAttribute("autocorrect", "off"), this.textarea.setAttribute("autocapitalize", "off"), this.textarea.setAttribute("spellcheck", "false"), this.textarea.tabIndex = 0, this._coreBrowserService = this.register(this._instantiationService.createInstance(v2.CoreBrowserService, this.textarea, e4.ownerDocument.defaultView ?? window, this._document ?? "undefined" != typeof window ? window.document : null)), this._instantiationService.setService(S.ICoreBrowserService, this._coreBrowserService), this.register((0, r.addDisposableDomListener)(this.textarea, "focus", (e5) => this._handleTextAreaFocus(e5))), this.register((0, r.addDisposableDomListener)(this.textarea, "blur", () => this._handleTextAreaBlur())), this._helperContainer.appendChild(this.textarea), this._charSizeService = this._instantiationService.createInstance(u.CharSizeService, this._document, this._helperContainer), this._instantiationService.setService(S.ICharSizeService, this._charSizeService), this._themeService = this._instantiationService.createInstance(C.ThemeService), this._instantiationService.setService(S.IThemeService, this._themeService), this._characterJoinerService = this._instantiationService.createInstance(f.CharacterJoinerService), this._instantiationService.setService(S.ICharacterJoinerService, this._characterJoinerService), this._renderService = this.register(this._instantiationService.createInstance(g2.RenderService, this.rows, this.screenElement)), this._instantiationService.setService(S.IRenderService, this._renderService), this.register(this._renderService.onRenderedViewportChange((e5) => this._onRender.fire(e5))), this.onResize((e5) => this._renderService.resize(e5.cols, e5.rows)), this._compositionView = this._document.createElement("div"), this._compositionView.classList.add("composition-view"), this._compositionHelper = this._instantiationService.createInstance(d.CompositionHelper, this.textarea, this._compositionView), this._helperContainer.appendChild(this._compositionView), this._mouseService = this._instantiationService.createInstance(p2.MouseService), this._instantiationService.setService(S.IMouseService, this._mouseService), this.linkifier = this.register(this._instantiationService.createInstance(n.Linkifier, this.screenElement)), this.element.appendChild(t4); + this._viewportElement = this._document.createElement("div"), this._viewportElement.classList.add("xterm-viewport"), t4.appendChild(this._viewportElement), this._viewportScrollArea = this._document.createElement("div"), this._viewportScrollArea.classList.add("xterm-scroll-area"), this._viewportElement.appendChild(this._viewportScrollArea), this.screenElement = this._document.createElement("div"), this.screenElement.classList.add("xterm-screen"), this.register((0, r2.addDisposableDomListener)(this.screenElement, "mousemove", (e5) => this.updateCursorStyle(e5))), this._helperContainer = this._document.createElement("div"), this._helperContainer.classList.add("xterm-helpers"), this.screenElement.appendChild(this._helperContainer), t4.appendChild(this.screenElement), this.textarea = this._document.createElement("textarea"), this.textarea.classList.add("xterm-helper-textarea"), this.textarea.setAttribute("aria-label", o2.promptLabel), k2.isChromeOS || this.textarea.setAttribute("aria-multiline", "false"), this.textarea.setAttribute("autocorrect", "off"), this.textarea.setAttribute("autocapitalize", "off"), this.textarea.setAttribute("spellcheck", "false"), this.textarea.tabIndex = 0, this._coreBrowserService = this.register(this._instantiationService.createInstance(v2.CoreBrowserService, this.textarea, e4.ownerDocument.defaultView ?? window, this._document ?? "undefined" != typeof window ? window.document : null)), this._instantiationService.setService(S2.ICoreBrowserService, this._coreBrowserService), this.register((0, r2.addDisposableDomListener)(this.textarea, "focus", (e5) => this._handleTextAreaFocus(e5))), this.register((0, r2.addDisposableDomListener)(this.textarea, "blur", () => this._handleTextAreaBlur())), this._helperContainer.appendChild(this.textarea), this._charSizeService = this._instantiationService.createInstance(u2.CharSizeService, this._document, this._helperContainer), this._instantiationService.setService(S2.ICharSizeService, this._charSizeService), this._themeService = this._instantiationService.createInstance(C2.ThemeService), this._instantiationService.setService(S2.IThemeService, this._themeService), this._characterJoinerService = this._instantiationService.createInstance(f2.CharacterJoinerService), this._instantiationService.setService(S2.ICharacterJoinerService, this._characterJoinerService), this._renderService = this.register(this._instantiationService.createInstance(g2.RenderService, this.rows, this.screenElement)), this._instantiationService.setService(S2.IRenderService, this._renderService), this.register(this._renderService.onRenderedViewportChange((e5) => this._onRender.fire(e5))), this.onResize((e5) => this._renderService.resize(e5.cols, e5.rows)), this._compositionView = this._document.createElement("div"), this._compositionView.classList.add("composition-view"), this._compositionHelper = this._instantiationService.createInstance(d2.CompositionHelper, this.textarea, this._compositionView), this._helperContainer.appendChild(this._compositionView), this._mouseService = this._instantiationService.createInstance(p2.MouseService), this._instantiationService.setService(S2.IMouseService, this._mouseService), this.linkifier = this.register(this._instantiationService.createInstance(n2.Linkifier, this.screenElement)), this.element.appendChild(t4); try { this._onWillOpen.fire(this.element); } catch { } this._renderService.hasRenderer() || this._renderService.setRenderer(this._createRenderer()), this.viewport = this._instantiationService.createInstance(h2.Viewport, this._viewportElement, this._viewportScrollArea), this.viewport.onRequestScrollLines((e5) => this.scrollLines(e5.amount, e5.suppressScrollEvent, 1)), this.register(this._inputHandler.onRequestSyncScrollBar(() => this.viewport.syncScrollArea())), this.register(this.viewport), this.register(this.onCursorMove(() => { this._renderService.handleCursorMove(), this._syncTextArea(); - })), this.register(this.onResize(() => this._renderService.handleResize(this.cols, this.rows))), this.register(this.onBlur(() => this._renderService.handleBlur())), this.register(this.onFocus(() => this._renderService.handleFocus())), this.register(this._renderService.onDimensionsChange(() => this.viewport.syncScrollArea())), this._selectionService = this.register(this._instantiationService.createInstance(m.SelectionService, this.element, this.screenElement, this.linkifier)), this._instantiationService.setService(S.ISelectionService, this._selectionService), this.register(this._selectionService.onRequestScrollLines((e5) => this.scrollLines(e5.amount, e5.suppressScrollEvent))), this.register(this._selectionService.onSelectionChange(() => this._onSelectionChange.fire())), this.register(this._selectionService.onRequestRedraw((e5) => this._renderService.handleSelectionChanged(e5.start, e5.end, e5.columnSelectMode))), this.register(this._selectionService.onLinuxMouseSelection((e5) => { + })), this.register(this.onResize(() => this._renderService.handleResize(this.cols, this.rows))), this.register(this.onBlur(() => this._renderService.handleBlur())), this.register(this.onFocus(() => this._renderService.handleFocus())), this.register(this._renderService.onDimensionsChange(() => this.viewport.syncScrollArea())), this._selectionService = this.register(this._instantiationService.createInstance(m2.SelectionService, this.element, this.screenElement, this.linkifier)), this._instantiationService.setService(S2.ISelectionService, this._selectionService), this.register(this._selectionService.onRequestScrollLines((e5) => this.scrollLines(e5.amount, e5.suppressScrollEvent))), this.register(this._selectionService.onSelectionChange(() => this._onSelectionChange.fire())), this.register(this._selectionService.onRequestRedraw((e5) => this._renderService.handleSelectionChanged(e5.start, e5.end, e5.columnSelectMode))), this.register(this._selectionService.onLinuxMouseSelection((e5) => { this.textarea.value = e5, this.textarea.focus(), this.textarea.select(); })), this.register(this._onScroll.event((e5) => { this.viewport.syncScrollArea(), this._selectionService.refresh(); - })), this.register((0, r.addDisposableDomListener)(this._viewportElement, "scroll", () => this._selectionService.refresh())), this.register(this._instantiationService.createInstance(c.BufferDecorationRenderer, this.screenElement)), this.register((0, r.addDisposableDomListener)(this.element, "mousedown", (e5) => this._selectionService.handleMouseDown(e5))), this.coreMouseService.areMouseEventsActive ? (this._selectionService.disable(), this.element.classList.add("enable-mouse-events")) : this._selectionService.enable(), this.options.screenReaderMode && (this._accessibilityManager.value = this._instantiationService.createInstance(M.AccessibilityManager, this)), this.register(this.optionsService.onSpecificOptionChange("screenReaderMode", (e5) => this._handleScreenReaderModeOptionChange(e5))), this.options.overviewRulerWidth && (this._overviewRulerRenderer = this.register(this._instantiationService.createInstance(l.OverviewRulerRenderer, this._viewportElement, this.screenElement))), this.optionsService.onSpecificOptionChange("overviewRulerWidth", (e5) => { - !this._overviewRulerRenderer && e5 && this._viewportElement && this.screenElement && (this._overviewRulerRenderer = this.register(this._instantiationService.createInstance(l.OverviewRulerRenderer, this._viewportElement, this.screenElement))); + })), this.register((0, r2.addDisposableDomListener)(this._viewportElement, "scroll", () => this._selectionService.refresh())), this.register(this._instantiationService.createInstance(c2.BufferDecorationRenderer, this.screenElement)), this.register((0, r2.addDisposableDomListener)(this.element, "mousedown", (e5) => this._selectionService.handleMouseDown(e5))), this.coreMouseService.areMouseEventsActive ? (this._selectionService.disable(), this.element.classList.add("enable-mouse-events")) : this._selectionService.enable(), this.options.screenReaderMode && (this._accessibilityManager.value = this._instantiationService.createInstance(M2.AccessibilityManager, this)), this.register(this.optionsService.onSpecificOptionChange("screenReaderMode", (e5) => this._handleScreenReaderModeOptionChange(e5))), this.options.overviewRulerWidth && (this._overviewRulerRenderer = this.register(this._instantiationService.createInstance(l2.OverviewRulerRenderer, this._viewportElement, this.screenElement))), this.optionsService.onSpecificOptionChange("overviewRulerWidth", (e5) => { + !this._overviewRulerRenderer && e5 && this._viewportElement && this.screenElement && (this._overviewRulerRenderer = this.register(this._instantiationService.createInstance(l2.OverviewRulerRenderer, this._viewportElement, this.screenElement))); }), this._charSizeService.measure(), this.refresh(0, this.rows - 1), this._initGlobal(), this.bindMouse(); } _createRenderer() { @@ -157974,53 +186284,53 @@ WARNING: This link could potentially be dangerous`)) { function i4(t5) { const i5 = e4._mouseService.getMouseReportCoords(t5, e4.screenElement); if (!i5) return false; - let s4, r2; + let s5, r3; switch (t5.overrideType || t5.type) { case "mousemove": - r2 = 32, void 0 === t5.buttons ? (s4 = 3, void 0 !== t5.button && (s4 = t5.button < 3 ? t5.button : 3)) : s4 = 1 & t5.buttons ? 0 : 4 & t5.buttons ? 1 : 2 & t5.buttons ? 2 : 3; + r3 = 32, void 0 === t5.buttons ? (s5 = 3, void 0 !== t5.button && (s5 = t5.button < 3 ? t5.button : 3)) : s5 = 1 & t5.buttons ? 0 : 4 & t5.buttons ? 1 : 2 & t5.buttons ? 2 : 3; break; case "mouseup": - r2 = 0, s4 = t5.button < 3 ? t5.button : 3; + r3 = 0, s5 = t5.button < 3 ? t5.button : 3; break; case "mousedown": - r2 = 1, s4 = t5.button < 3 ? t5.button : 3; + r3 = 1, s5 = t5.button < 3 ? t5.button : 3; break; case "wheel": if (e4._customWheelEventHandler && false === e4._customWheelEventHandler(t5)) return false; if (0 === e4.viewport.getLinesScrolled(t5)) return false; - r2 = t5.deltaY < 0 ? 0 : 1, s4 = 4; + r3 = t5.deltaY < 0 ? 0 : 1, s5 = 4; break; default: return false; } - return !(void 0 === r2 || void 0 === s4 || s4 > 4) && e4.coreMouseService.triggerMouseEvent({ col: i5.col, row: i5.row, x: i5.x, y: i5.y, button: s4, action: r2, ctrl: t5.ctrlKey, alt: t5.altKey, shift: t5.shiftKey }); + return !(void 0 === r3 || void 0 === s5 || s5 > 4) && e4.coreMouseService.triggerMouseEvent({ col: i5.col, row: i5.row, x: i5.x, y: i5.y, button: s5, action: r3, ctrl: t5.ctrlKey, alt: t5.altKey, shift: t5.shiftKey }); } __name(i4, "i"); - const s3 = { mouseup: null, wheel: null, mousedrag: null, mousemove: null }, n2 = { mouseup: /* @__PURE__ */ __name((e5) => (i4(e5), e5.buttons || (this._document.removeEventListener("mouseup", s3.mouseup), s3.mousedrag && this._document.removeEventListener("mousemove", s3.mousedrag)), this.cancel(e5)), "mouseup"), wheel: /* @__PURE__ */ __name((e5) => (i4(e5), this.cancel(e5, true)), "wheel"), mousedrag: /* @__PURE__ */ __name((e5) => { + const s4 = { mouseup: null, wheel: null, mousedrag: null, mousemove: null }, n3 = { mouseup: /* @__PURE__ */ __name((e5) => (i4(e5), e5.buttons || (this._document.removeEventListener("mouseup", s4.mouseup), s4.mousedrag && this._document.removeEventListener("mousemove", s4.mousedrag)), this.cancel(e5)), "mouseup"), wheel: /* @__PURE__ */ __name((e5) => (i4(e5), this.cancel(e5, true)), "wheel"), mousedrag: /* @__PURE__ */ __name((e5) => { e5.buttons && i4(e5); }, "mousedrag"), mousemove: /* @__PURE__ */ __name((e5) => { e5.buttons || i4(e5); }, "mousemove") }; this.register(this.coreMouseService.onProtocolChange((e5) => { - e5 ? ("debug" === this.optionsService.rawOptions.logLevel && this._logService.debug("Binding to mouse events:", this.coreMouseService.explainEvents(e5)), this.element.classList.add("enable-mouse-events"), this._selectionService.disable()) : (this._logService.debug("Unbinding from mouse events."), this.element.classList.remove("enable-mouse-events"), this._selectionService.enable()), 8 & e5 ? s3.mousemove || (t4.addEventListener("mousemove", n2.mousemove), s3.mousemove = n2.mousemove) : (t4.removeEventListener("mousemove", s3.mousemove), s3.mousemove = null), 16 & e5 ? s3.wheel || (t4.addEventListener("wheel", n2.wheel, { passive: false }), s3.wheel = n2.wheel) : (t4.removeEventListener("wheel", s3.wheel), s3.wheel = null), 2 & e5 ? s3.mouseup || (s3.mouseup = n2.mouseup) : (this._document.removeEventListener("mouseup", s3.mouseup), s3.mouseup = null), 4 & e5 ? s3.mousedrag || (s3.mousedrag = n2.mousedrag) : (this._document.removeEventListener("mousemove", s3.mousedrag), s3.mousedrag = null); - })), this.coreMouseService.activeProtocol = this.coreMouseService.activeProtocol, this.register((0, r.addDisposableDomListener)(t4, "mousedown", (e5) => { - if (e5.preventDefault(), this.focus(), this.coreMouseService.areMouseEventsActive && !this._selectionService.shouldForceSelection(e5)) return i4(e5), s3.mouseup && this._document.addEventListener("mouseup", s3.mouseup), s3.mousedrag && this._document.addEventListener("mousemove", s3.mousedrag), this.cancel(e5); - })), this.register((0, r.addDisposableDomListener)(t4, "wheel", (e5) => { - if (!s3.wheel) { + e5 ? ("debug" === this.optionsService.rawOptions.logLevel && this._logService.debug("Binding to mouse events:", this.coreMouseService.explainEvents(e5)), this.element.classList.add("enable-mouse-events"), this._selectionService.disable()) : (this._logService.debug("Unbinding from mouse events."), this.element.classList.remove("enable-mouse-events"), this._selectionService.enable()), 8 & e5 ? s4.mousemove || (t4.addEventListener("mousemove", n3.mousemove), s4.mousemove = n3.mousemove) : (t4.removeEventListener("mousemove", s4.mousemove), s4.mousemove = null), 16 & e5 ? s4.wheel || (t4.addEventListener("wheel", n3.wheel, { passive: false }), s4.wheel = n3.wheel) : (t4.removeEventListener("wheel", s4.wheel), s4.wheel = null), 2 & e5 ? s4.mouseup || (s4.mouseup = n3.mouseup) : (this._document.removeEventListener("mouseup", s4.mouseup), s4.mouseup = null), 4 & e5 ? s4.mousedrag || (s4.mousedrag = n3.mousedrag) : (this._document.removeEventListener("mousemove", s4.mousedrag), s4.mousedrag = null); + })), this.coreMouseService.activeProtocol = this.coreMouseService.activeProtocol, this.register((0, r2.addDisposableDomListener)(t4, "mousedown", (e5) => { + if (e5.preventDefault(), this.focus(), this.coreMouseService.areMouseEventsActive && !this._selectionService.shouldForceSelection(e5)) return i4(e5), s4.mouseup && this._document.addEventListener("mouseup", s4.mouseup), s4.mousedrag && this._document.addEventListener("mousemove", s4.mousedrag), this.cancel(e5); + })), this.register((0, r2.addDisposableDomListener)(t4, "wheel", (e5) => { + if (!s4.wheel) { if (this._customWheelEventHandler && false === this._customWheelEventHandler(e5)) return false; if (!this.buffer.hasScrollback) { const t5 = this.viewport.getLinesScrolled(e5); if (0 === t5) return; - const i5 = D.C0.ESC + (this.coreService.decPrivateModes.applicationCursorKeys ? "O" : "[") + (e5.deltaY < 0 ? "A" : "B"); - let s4 = ""; - for (let e6 = 0; e6 < Math.abs(t5); e6++) s4 += i5; - return this.coreService.triggerDataEvent(s4, true), this.cancel(e5, true); + const i5 = D2.C0.ESC + (this.coreService.decPrivateModes.applicationCursorKeys ? "O" : "[") + (e5.deltaY < 0 ? "A" : "B"); + let s5 = ""; + for (let e6 = 0; e6 < Math.abs(t5); e6++) s5 += i5; + return this.coreService.triggerDataEvent(s5, true), this.cancel(e5, true); } return this.viewport.handleWheel(e5) ? this.cancel(e5) : void 0; } - }, { passive: false })), this.register((0, r.addDisposableDomListener)(t4, "touchstart", (e5) => { + }, { passive: false })), this.register((0, r2.addDisposableDomListener)(t4, "touchstart", (e5) => { if (!this.coreMouseService.areMouseEventsActive) return this.viewport.handleTouchStart(e5), this.cancel(e5); - }, { passive: true })), this.register((0, r.addDisposableDomListener)(t4, "touchmove", (e5) => { + }, { passive: true })), this.register((0, r2.addDisposableDomListener)(t4, "touchmove", (e5) => { if (!this.coreMouseService.areMouseEventsActive) return this.viewport.handleTouchMove(e5) ? void 0 : this.cancel(e5); }, { passive: false })); } @@ -158037,7 +186347,7 @@ WARNING: This link could potentially be dangerous`)) { 1 === i4 ? (super.scrollLines(e4, t4, i4), this.refresh(0, this.rows - 1)) : this.viewport?.scrollLines(e4); } paste(e4) { - (0, s2.paste)(e4, this.textarea, this.coreService, this.optionsService); + (0, s3.paste)(e4, this.textarea, this.coreService, this.optionsService); } attachCustomKeyEventHandler(e4) { this._customKeyEventHandler = e4; @@ -158097,7 +186407,7 @@ WARNING: This link could potentially be dangerous`)) { const t5 = this.rows - 1; return this.scrollLines(2 === i4.type ? -t5 : t5), this.cancel(e4, true); } - return 1 === i4.type && this.selectAll(), !!this._isThirdLevelShift(this.browser, e4) || (i4.cancel && this.cancel(e4, true), !i4.key || !!(e4.key && !e4.ctrlKey && !e4.altKey && !e4.metaKey && 1 === e4.key.length && e4.key.charCodeAt(0) >= 65 && e4.key.charCodeAt(0) <= 90) || (this._unprocessedDeadKey ? (this._unprocessedDeadKey = false, true) : (i4.key !== D.C0.ETX && i4.key !== D.C0.CR || (this.textarea.value = ""), this._onKey.fire({ key: i4.key, domEvent: e4 }), this._showCursor(), this.coreService.triggerDataEvent(i4.key, true), !this.optionsService.rawOptions.screenReaderMode || e4.altKey || e4.ctrlKey ? this.cancel(e4, true) : void (this._keyDownHandled = true)))); + return 1 === i4.type && this.selectAll(), !!this._isThirdLevelShift(this.browser, e4) || (i4.cancel && this.cancel(e4, true), !i4.key || !!(e4.key && !e4.ctrlKey && !e4.altKey && !e4.metaKey && 1 === e4.key.length && e4.key.charCodeAt(0) >= 65 && e4.key.charCodeAt(0) <= 90) || (this._unprocessedDeadKey ? (this._unprocessedDeadKey = false, true) : (i4.key !== D2.C0.ETX && i4.key !== D2.C0.CR || (this.textarea.value = ""), this._onKey.fire({ key: i4.key, domEvent: e4 }), this._showCursor(), this.coreService.triggerDataEvent(i4.key, true), !this.optionsService.rawOptions.screenReaderMode || e4.altKey || e4.ctrlKey ? this.cancel(e4, true) : void (this._keyDownHandled = true)))); } _isThirdLevelShift(e4, t4) { const i4 = e4.isMac && !this.options.macOptionIsMeta && t4.altKey && !t4.ctrlKey && !t4.metaKey || e4.isWindows && t4.altKey && t4.ctrlKey && !t4.metaKey || e4.isWindows && t4.getModifierState("AltGraph"); @@ -158138,7 +186448,7 @@ WARNING: This link could potentially be dangerous`)) { clear() { if (0 !== this.buffer.ybase || 0 !== this.buffer.y) { this.buffer.clearAllMarkers(), this.buffer.lines.set(0, this.buffer.lines.get(this.buffer.ybase + this.buffer.y)), this.buffer.lines.length = 1, this.buffer.ydisp = 0, this.buffer.ybase = 0, this.buffer.y = 0; - for (let e4 = 1; e4 < this.rows; e4++) this.buffer.lines.push(this.buffer.getBlankLine(L.DEFAULT_ATTR_DATA)); + for (let e4 = 1; e4 < this.rows; e4++) this.buffer.lines.push(this.buffer.getBlankLine(L2.DEFAULT_ATTR_DATA)); this._onScroll.fire({ position: this.buffer.ydisp, source: 0 }), this.viewport?.reset(), this.refresh(0, this.rows - 1); } } @@ -158151,17 +186461,17 @@ WARNING: This link could potentially be dangerous`)) { this._renderService?.clearTextureAtlas(); } _reportFocus() { - this.element?.classList.contains("focus") ? this.coreService.triggerDataEvent(D.C0.ESC + "[I") : this.coreService.triggerDataEvent(D.C0.ESC + "[O"); + this.element?.classList.contains("focus") ? this.coreService.triggerDataEvent(D2.C0.ESC + "[I") : this.coreService.triggerDataEvent(D2.C0.ESC + "[O"); } _reportWindowsOptions(e4) { if (this._renderService) switch (e4) { - case T.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS: + case T2.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS: const e5 = this._renderService.dimensions.css.canvas.width.toFixed(0), t4 = this._renderService.dimensions.css.canvas.height.toFixed(0); - this.coreService.triggerDataEvent(`${D.C0.ESC}[4;${t4};${e5}t`); + this.coreService.triggerDataEvent(`${D2.C0.ESC}[4;${t4};${e5}t`); break; - case T.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS: - const i4 = this._renderService.dimensions.css.cell.width.toFixed(0), s3 = this._renderService.dimensions.css.cell.height.toFixed(0); - this.coreService.triggerDataEvent(`${D.C0.ESC}[6;${s3};${i4}t`); + case T2.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS: + const i4 = this._renderService.dimensions.css.cell.width.toFixed(0), s4 = this._renderService.dimensions.css.cell.height.toFixed(0); + this.coreService.triggerDataEvent(`${D2.C0.ESC}[6;${s4};${i4}t`); } } cancel(e4, t4) { @@ -158179,10 +186489,10 @@ WARNING: This link could potentially be dangerous`)) { } refresh(e4, t4, i3) { this._rowCount = i3, e4 = void 0 !== e4 ? e4 : 0, t4 = void 0 !== t4 ? t4 : this._rowCount - 1, this._rowStart = void 0 !== this._rowStart ? Math.min(this._rowStart, e4) : e4, this._rowEnd = void 0 !== this._rowEnd ? Math.max(this._rowEnd, t4) : t4; - const s2 = Date.now(); - if (s2 - this._lastRefreshMs >= this._debounceThresholdMS) this._lastRefreshMs = s2, this._innerRefresh(); + const s3 = Date.now(); + if (s3 - this._lastRefreshMs >= this._debounceThresholdMS) this._lastRefreshMs = s3, this._innerRefresh(); else if (!this._additionalRefreshRequested) { - const e5 = s2 - this._lastRefreshMs, t5 = this._debounceThresholdMS - e5; + const e5 = s3 - this._lastRefreshMs, t5 = this._debounceThresholdMS - e5; this._additionalRefreshRequested = true, this._refreshTimeoutID = window.setTimeout(() => { this._lastRefreshMs = Date.now(), this._innerRefresh(), this._additionalRefreshRequested = false, this._refreshTimeoutID = void 0; }, t5); @@ -158195,21 +186505,21 @@ WARNING: This link could potentially be dangerous`)) { } }; }, 1680: function(e3, t3, i3) { - var s2 = this && this.__decorate || function(e4, t4, i4, s3) { - var r2, n2 = arguments.length, o2 = n2 < 3 ? t4 : null === s3 ? s3 = Object.getOwnPropertyDescriptor(t4, i4) : s3; - if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o2 = Reflect.decorate(e4, t4, i4, s3); - else for (var a2 = e4.length - 1; a2 >= 0; a2--) (r2 = e4[a2]) && (o2 = (n2 < 3 ? r2(o2) : n2 > 3 ? r2(t4, i4, o2) : r2(t4, i4)) || o2); - return n2 > 3 && o2 && Object.defineProperty(t4, i4, o2), o2; - }, r = this && this.__param || function(e4, t4) { - return function(i4, s3) { - t4(i4, s3, e4); + var s3 = this && this.__decorate || function(e4, t4, i4, s4) { + var r3, n3 = arguments.length, o3 = n3 < 3 ? t4 : null === s4 ? s4 = Object.getOwnPropertyDescriptor(t4, i4) : s4; + if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o3 = Reflect.decorate(e4, t4, i4, s4); + else for (var a3 = e4.length - 1; a3 >= 0; a3--) (r3 = e4[a3]) && (o3 = (n3 < 3 ? r3(o3) : n3 > 3 ? r3(t4, i4, o3) : r3(t4, i4)) || o3); + return n3 > 3 && o3 && Object.defineProperty(t4, i4, o3), o3; + }, r2 = this && this.__param || function(e4, t4) { + return function(i4, s4) { + t4(i4, s4, e4); }; }; Object.defineProperty(t3, "__esModule", { value: true }), t3.Viewport = void 0; - const n = i3(3656), o = i3(4725), a = i3(8460), h2 = i3(844), c = i3(2585); - let l = t3.Viewport = class extends h2.Disposable { - constructor(e4, t4, i4, s3, r2, o2, h3, c2) { - super(), this._viewportElement = e4, this._scrollArea = t4, this._bufferService = i4, this._optionsService = s3, this._charSizeService = r2, this._renderService = o2, this._coreBrowserService = h3, this.scrollBarWidth = 0, this._currentRowHeight = 0, this._currentDeviceCellHeight = 0, this._lastRecordedBufferLength = 0, this._lastRecordedViewportHeight = 0, this._lastRecordedBufferHeight = 0, this._lastTouchY = 0, this._lastScrollTop = 0, this._wheelPartialScroll = 0, this._refreshAnimationFrame = null, this._ignoreNextScrollEvent = false, this._smoothScrollState = { startTime: 0, origin: -1, target: -1 }, this._onRequestScrollLines = this.register(new a.EventEmitter()), this.onRequestScrollLines = this._onRequestScrollLines.event, this.scrollBarWidth = this._viewportElement.offsetWidth - this._scrollArea.offsetWidth || 15, this.register((0, n.addDisposableDomListener)(this._viewportElement, "scroll", this._handleScroll.bind(this))), this._activeBuffer = this._bufferService.buffer, this.register(this._bufferService.buffers.onBufferActivate((e5) => this._activeBuffer = e5.activeBuffer)), this._renderDimensions = this._renderService.dimensions, this.register(this._renderService.onDimensionsChange((e5) => this._renderDimensions = e5)), this._handleThemeChange(c2.colors), this.register(c2.onChangeColors((e5) => this._handleThemeChange(e5))), this.register(this._optionsService.onSpecificOptionChange("scrollback", () => this.syncScrollArea())), setTimeout(() => this.syncScrollArea()); + const n2 = i3(3656), o2 = i3(4725), a2 = i3(8460), h2 = i3(844), c2 = i3(2585); + let l2 = t3.Viewport = class extends h2.Disposable { + constructor(e4, t4, i4, s4, r3, o3, h3, c3) { + super(), this._viewportElement = e4, this._scrollArea = t4, this._bufferService = i4, this._optionsService = s4, this._charSizeService = r3, this._renderService = o3, this._coreBrowserService = h3, this.scrollBarWidth = 0, this._currentRowHeight = 0, this._currentDeviceCellHeight = 0, this._lastRecordedBufferLength = 0, this._lastRecordedViewportHeight = 0, this._lastRecordedBufferHeight = 0, this._lastTouchY = 0, this._lastScrollTop = 0, this._wheelPartialScroll = 0, this._refreshAnimationFrame = null, this._ignoreNextScrollEvent = false, this._smoothScrollState = { startTime: 0, origin: -1, target: -1 }, this._onRequestScrollLines = this.register(new a2.EventEmitter()), this.onRequestScrollLines = this._onRequestScrollLines.event, this.scrollBarWidth = this._viewportElement.offsetWidth - this._scrollArea.offsetWidth || 15, this.register((0, n2.addDisposableDomListener)(this._viewportElement, "scroll", this._handleScroll.bind(this))), this._activeBuffer = this._bufferService.buffer, this.register(this._bufferService.buffers.onBufferActivate((e5) => this._activeBuffer = e5.activeBuffer)), this._renderDimensions = this._renderService.dimensions, this.register(this._renderService.onDimensionsChange((e5) => this._renderDimensions = e5)), this._handleThemeChange(c3.colors), this.register(c3.onChangeColors((e5) => this._handleThemeChange(e5))), this.register(this._optionsService.onSpecificOptionChange("scrollback", () => this.syncScrollArea())), setTimeout(() => this.syncScrollArea()); } _handleThemeChange(e4) { this._viewportElement.style.backgroundColor = e4.background.css; @@ -158271,18 +186581,18 @@ WARNING: This link could potentially be dangerous`)) { return e4.deltaMode === WheelEvent.DOM_DELTA_LINE ? t4 *= this._currentRowHeight : e4.deltaMode === WheelEvent.DOM_DELTA_PAGE && (t4 *= this._currentRowHeight * this._bufferService.rows), t4; } getBufferElements(e4, t4) { - let i4, s3 = ""; - const r2 = [], n2 = t4 ?? this._bufferService.buffer.lines.length, o2 = this._bufferService.buffer.lines; - for (let t5 = e4; t5 < n2; t5++) { - const e5 = o2.get(t5); + let i4, s4 = ""; + const r3 = [], n3 = t4 ?? this._bufferService.buffer.lines.length, o3 = this._bufferService.buffer.lines; + for (let t5 = e4; t5 < n3; t5++) { + const e5 = o3.get(t5); if (!e5) continue; - const n3 = o2.get(t5 + 1)?.isWrapped; - if (s3 += e5.translateToString(!n3), !n3 || t5 === o2.length - 1) { + const n4 = o3.get(t5 + 1)?.isWrapped; + if (s4 += e5.translateToString(!n4), !n4 || t5 === o3.length - 1) { const e6 = document.createElement("div"); - e6.textContent = s3, r2.push(e6), s3.length > 0 && (i4 = e6), s3 = ""; + e6.textContent = s4, r3.push(e6), s4.length > 0 && (i4 = e6), s4 = ""; } } - return { bufferElements: r2, cursorElement: i4 }; + return { bufferElements: r3, cursorElement: i4 }; } getLinesScrolled(e4) { if (0 === e4.deltaY || e4.shiftKey) return 0; @@ -158301,27 +186611,27 @@ WARNING: This link could potentially be dangerous`)) { return this._lastTouchY = e4.touches[0].pageY, 0 !== t4 && (this._viewportElement.scrollTop += t4, this._bubbleScroll(e4, t4)); } }; - t3.Viewport = l = s2([r(2, c.IBufferService), r(3, c.IOptionsService), r(4, o.ICharSizeService), r(5, o.IRenderService), r(6, o.ICoreBrowserService), r(7, o.IThemeService)], l); + t3.Viewport = l2 = s3([r2(2, c2.IBufferService), r2(3, c2.IOptionsService), r2(4, o2.ICharSizeService), r2(5, o2.IRenderService), r2(6, o2.ICoreBrowserService), r2(7, o2.IThemeService)], l2); }, 3107: function(e3, t3, i3) { - var s2 = this && this.__decorate || function(e4, t4, i4, s3) { - var r2, n2 = arguments.length, o2 = n2 < 3 ? t4 : null === s3 ? s3 = Object.getOwnPropertyDescriptor(t4, i4) : s3; - if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o2 = Reflect.decorate(e4, t4, i4, s3); - else for (var a2 = e4.length - 1; a2 >= 0; a2--) (r2 = e4[a2]) && (o2 = (n2 < 3 ? r2(o2) : n2 > 3 ? r2(t4, i4, o2) : r2(t4, i4)) || o2); - return n2 > 3 && o2 && Object.defineProperty(t4, i4, o2), o2; - }, r = this && this.__param || function(e4, t4) { - return function(i4, s3) { - t4(i4, s3, e4); + var s3 = this && this.__decorate || function(e4, t4, i4, s4) { + var r3, n3 = arguments.length, o3 = n3 < 3 ? t4 : null === s4 ? s4 = Object.getOwnPropertyDescriptor(t4, i4) : s4; + if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o3 = Reflect.decorate(e4, t4, i4, s4); + else for (var a3 = e4.length - 1; a3 >= 0; a3--) (r3 = e4[a3]) && (o3 = (n3 < 3 ? r3(o3) : n3 > 3 ? r3(t4, i4, o3) : r3(t4, i4)) || o3); + return n3 > 3 && o3 && Object.defineProperty(t4, i4, o3), o3; + }, r2 = this && this.__param || function(e4, t4) { + return function(i4, s4) { + t4(i4, s4, e4); }; }; Object.defineProperty(t3, "__esModule", { value: true }), t3.BufferDecorationRenderer = void 0; - const n = i3(4725), o = i3(844), a = i3(2585); - let h2 = t3.BufferDecorationRenderer = class extends o.Disposable { - constructor(e4, t4, i4, s3, r2) { - super(), this._screenElement = e4, this._bufferService = t4, this._coreBrowserService = i4, this._decorationService = s3, this._renderService = r2, this._decorationElements = /* @__PURE__ */ new Map(), this._altBufferIsActive = false, this._dimensionsChanged = false, this._container = document.createElement("div"), this._container.classList.add("xterm-decoration-container"), this._screenElement.appendChild(this._container), this.register(this._renderService.onRenderedViewportChange(() => this._doRefreshDecorations())), this.register(this._renderService.onDimensionsChange(() => { + const n2 = i3(4725), o2 = i3(844), a2 = i3(2585); + let h2 = t3.BufferDecorationRenderer = class extends o2.Disposable { + constructor(e4, t4, i4, s4, r3) { + super(), this._screenElement = e4, this._bufferService = t4, this._coreBrowserService = i4, this._decorationService = s4, this._renderService = r3, this._decorationElements = /* @__PURE__ */ new Map(), this._altBufferIsActive = false, this._dimensionsChanged = false, this._container = document.createElement("div"), this._container.classList.add("xterm-decoration-container"), this._screenElement.appendChild(this._container), this.register(this._renderService.onRenderedViewportChange(() => this._doRefreshDecorations())), this.register(this._renderService.onDimensionsChange(() => { this._dimensionsChanged = true, this._queueRefresh(); })), this.register(this._coreBrowserService.onDprChange(() => this._queueRefresh())), this.register(this._bufferService.buffers.onBufferActivate(() => { this._altBufferIsActive = this._bufferService.buffer === this._bufferService.buffers.alt; - })), this.register(this._decorationService.onDecorationRegistered(() => this._queueRefresh())), this.register(this._decorationService.onDecorationRemoved((e5) => this._removeDecoration(e5))), this.register((0, o.toDisposable)(() => { + })), this.register(this._decorationService.onDecorationRegistered(() => this._queueRefresh())), this.register(this._decorationService.onDecorationRemoved((e5) => this._removeDecoration(e5))), this.register((0, o2.toDisposable)(() => { this._container.remove(), this._decorationElements.clear(); })); } @@ -158362,7 +186672,7 @@ WARNING: This link could potentially be dangerous`)) { this._decorationElements.get(e4)?.remove(), this._decorationElements.delete(e4), e4.dispose(); } }; - t3.BufferDecorationRenderer = h2 = s2([r(1, a.IBufferService), r(2, n.ICoreBrowserService), r(3, a.IDecorationService), r(4, n.IRenderService)], h2); + t3.BufferDecorationRenderer = h2 = s3([r2(1, a2.IBufferService), r2(2, n2.ICoreBrowserService), r2(3, a2.IDecorationService), r2(4, n2.IRenderService)], h2); }, 5871: (e3, t3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.ColorZoneStore = void 0, t3.ColorZoneStore = class { constructor() { @@ -158398,27 +186708,27 @@ WARNING: This link could potentially be dangerous`)) { } }; }, 5744: function(e3, t3, i3) { - var s2 = this && this.__decorate || function(e4, t4, i4, s3) { - var r2, n2 = arguments.length, o2 = n2 < 3 ? t4 : null === s3 ? s3 = Object.getOwnPropertyDescriptor(t4, i4) : s3; - if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o2 = Reflect.decorate(e4, t4, i4, s3); - else for (var a2 = e4.length - 1; a2 >= 0; a2--) (r2 = e4[a2]) && (o2 = (n2 < 3 ? r2(o2) : n2 > 3 ? r2(t4, i4, o2) : r2(t4, i4)) || o2); - return n2 > 3 && o2 && Object.defineProperty(t4, i4, o2), o2; - }, r = this && this.__param || function(e4, t4) { - return function(i4, s3) { - t4(i4, s3, e4); + var s3 = this && this.__decorate || function(e4, t4, i4, s4) { + var r3, n3 = arguments.length, o3 = n3 < 3 ? t4 : null === s4 ? s4 = Object.getOwnPropertyDescriptor(t4, i4) : s4; + if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o3 = Reflect.decorate(e4, t4, i4, s4); + else for (var a3 = e4.length - 1; a3 >= 0; a3--) (r3 = e4[a3]) && (o3 = (n3 < 3 ? r3(o3) : n3 > 3 ? r3(t4, i4, o3) : r3(t4, i4)) || o3); + return n3 > 3 && o3 && Object.defineProperty(t4, i4, o3), o3; + }, r2 = this && this.__param || function(e4, t4) { + return function(i4, s4) { + t4(i4, s4, e4); }; }; Object.defineProperty(t3, "__esModule", { value: true }), t3.OverviewRulerRenderer = void 0; - const n = i3(5871), o = i3(4725), a = i3(844), h2 = i3(2585), c = { full: 0, left: 0, center: 0, right: 0 }, l = { full: 0, left: 0, center: 0, right: 0 }, d = { full: 0, left: 0, center: 0, right: 0 }; - let _2 = t3.OverviewRulerRenderer = class extends a.Disposable { + const n2 = i3(5871), o2 = i3(4725), a2 = i3(844), h2 = i3(2585), c2 = { full: 0, left: 0, center: 0, right: 0 }, l2 = { full: 0, left: 0, center: 0, right: 0 }, d2 = { full: 0, left: 0, center: 0, right: 0 }; + let _2 = t3.OverviewRulerRenderer = class extends a2.Disposable { get _width() { return this._optionsService.options.overviewRulerWidth || 0; } - constructor(e4, t4, i4, s3, r2, o2, h3) { - super(), this._viewportElement = e4, this._screenElement = t4, this._bufferService = i4, this._decorationService = s3, this._renderService = r2, this._optionsService = o2, this._coreBrowserService = h3, this._colorZoneStore = new n.ColorZoneStore(), this._shouldUpdateDimensions = true, this._shouldUpdateAnchor = true, this._lastKnownBufferLength = 0, this._canvas = this._coreBrowserService.mainDocument.createElement("canvas"), this._canvas.classList.add("xterm-decoration-overview-ruler"), this._refreshCanvasDimensions(), this._viewportElement.parentElement?.insertBefore(this._canvas, this._viewportElement); - const c2 = this._canvas.getContext("2d"); - if (!c2) throw new Error("Ctx cannot be null"); - this._ctx = c2, this._registerDecorationListeners(), this._registerBufferChangeListeners(), this._registerDimensionChangeListeners(), this.register((0, a.toDisposable)(() => { + constructor(e4, t4, i4, s4, r3, o3, h3) { + super(), this._viewportElement = e4, this._screenElement = t4, this._bufferService = i4, this._decorationService = s4, this._renderService = r3, this._optionsService = o3, this._coreBrowserService = h3, this._colorZoneStore = new n2.ColorZoneStore(), this._shouldUpdateDimensions = true, this._shouldUpdateAnchor = true, this._lastKnownBufferLength = 0, this._canvas = this._coreBrowserService.mainDocument.createElement("canvas"), this._canvas.classList.add("xterm-decoration-overview-ruler"), this._refreshCanvasDimensions(), this._viewportElement.parentElement?.insertBefore(this._canvas, this._viewportElement); + const c3 = this._canvas.getContext("2d"); + if (!c3) throw new Error("Ctx cannot be null"); + this._ctx = c3, this._registerDecorationListeners(), this._registerBufferChangeListeners(), this._registerDimensionChangeListeners(), this.register((0, a2.toDisposable)(() => { this._canvas?.remove(); })); } @@ -158439,15 +186749,15 @@ WARNING: This link could potentially be dangerous`)) { } _refreshDrawConstants() { const e4 = Math.floor(this._canvas.width / 3), t4 = Math.ceil(this._canvas.width / 3); - l.full = this._canvas.width, l.left = e4, l.center = t4, l.right = e4, this._refreshDrawHeightConstants(), d.full = 0, d.left = 0, d.center = l.left, d.right = l.left + l.center; + l2.full = this._canvas.width, l2.left = e4, l2.center = t4, l2.right = e4, this._refreshDrawHeightConstants(), d2.full = 0, d2.left = 0, d2.center = l2.left, d2.right = l2.left + l2.center; } _refreshDrawHeightConstants() { - c.full = Math.round(2 * this._coreBrowserService.dpr); + c2.full = Math.round(2 * this._coreBrowserService.dpr); const e4 = this._canvas.height / this._bufferService.buffer.lines.length, t4 = Math.round(Math.max(Math.min(e4, 12), 6) * this._coreBrowserService.dpr); - c.left = t4, c.center = t4, c.right = t4; + c2.left = t4, c2.center = t4, c2.right = t4; } _refreshColorZonePadding() { - this._colorZoneStore.setPadding({ full: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * c.full), left: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * c.left), center: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * c.center), right: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * c.right) }), this._lastKnownBufferLength = this._bufferService.buffers.normal.lines.length; + this._colorZoneStore.setPadding({ full: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * c2.full), left: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * c2.left), center: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * c2.center), right: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * c2.right) }), this._lastKnownBufferLength = this._bufferService.buffers.normal.lines.length; } _refreshCanvasDimensions() { this._canvas.style.width = `${this._width}px`, this._canvas.width = Math.round(this._width * this._coreBrowserService.dpr), this._canvas.style.height = `${this._screenElement.clientHeight}px`, this._canvas.height = Math.round(this._screenElement.clientHeight * this._coreBrowserService.dpr), this._refreshDrawConstants(), this._refreshColorZonePadding(); @@ -158462,7 +186772,7 @@ WARNING: This link could potentially be dangerous`)) { this._shouldUpdateDimensions = false, this._shouldUpdateAnchor = false; } _renderColorZone(e4) { - this._ctx.fillStyle = e4.color, this._ctx.fillRect(d[e4.position || "full"], Math.round((this._canvas.height - 1) * (e4.startBufferLine / this._bufferService.buffers.active.lines.length) - c[e4.position || "full"] / 2), l[e4.position || "full"], Math.round((this._canvas.height - 1) * ((e4.endBufferLine - e4.startBufferLine) / this._bufferService.buffers.active.lines.length) + c[e4.position || "full"])); + this._ctx.fillStyle = e4.color, this._ctx.fillRect(d2[e4.position || "full"], Math.round((this._canvas.height - 1) * (e4.startBufferLine / this._bufferService.buffers.active.lines.length) - c2[e4.position || "full"] / 2), l2[e4.position || "full"], Math.round((this._canvas.height - 1) * ((e4.endBufferLine - e4.startBufferLine) / this._bufferService.buffers.active.lines.length) + c2[e4.position || "full"])); } _queueRefresh(e4, t4) { this._shouldUpdateDimensions = e4 || this._shouldUpdateDimensions, this._shouldUpdateAnchor = t4 || this._shouldUpdateAnchor, void 0 === this._animationFrame && (this._animationFrame = this._coreBrowserService.window.requestAnimationFrame(() => { @@ -158470,26 +186780,26 @@ WARNING: This link could potentially be dangerous`)) { })); } }; - t3.OverviewRulerRenderer = _2 = s2([r(2, h2.IBufferService), r(3, h2.IDecorationService), r(4, o.IRenderService), r(5, h2.IOptionsService), r(6, o.ICoreBrowserService)], _2); + t3.OverviewRulerRenderer = _2 = s3([r2(2, h2.IBufferService), r2(3, h2.IDecorationService), r2(4, o2.IRenderService), r2(5, h2.IOptionsService), r2(6, o2.ICoreBrowserService)], _2); }, 2950: function(e3, t3, i3) { - var s2 = this && this.__decorate || function(e4, t4, i4, s3) { - var r2, n2 = arguments.length, o2 = n2 < 3 ? t4 : null === s3 ? s3 = Object.getOwnPropertyDescriptor(t4, i4) : s3; - if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o2 = Reflect.decorate(e4, t4, i4, s3); - else for (var a2 = e4.length - 1; a2 >= 0; a2--) (r2 = e4[a2]) && (o2 = (n2 < 3 ? r2(o2) : n2 > 3 ? r2(t4, i4, o2) : r2(t4, i4)) || o2); - return n2 > 3 && o2 && Object.defineProperty(t4, i4, o2), o2; - }, r = this && this.__param || function(e4, t4) { - return function(i4, s3) { - t4(i4, s3, e4); + var s3 = this && this.__decorate || function(e4, t4, i4, s4) { + var r3, n3 = arguments.length, o3 = n3 < 3 ? t4 : null === s4 ? s4 = Object.getOwnPropertyDescriptor(t4, i4) : s4; + if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o3 = Reflect.decorate(e4, t4, i4, s4); + else for (var a3 = e4.length - 1; a3 >= 0; a3--) (r3 = e4[a3]) && (o3 = (n3 < 3 ? r3(o3) : n3 > 3 ? r3(t4, i4, o3) : r3(t4, i4)) || o3); + return n3 > 3 && o3 && Object.defineProperty(t4, i4, o3), o3; + }, r2 = this && this.__param || function(e4, t4) { + return function(i4, s4) { + t4(i4, s4, e4); }; }; Object.defineProperty(t3, "__esModule", { value: true }), t3.CompositionHelper = void 0; - const n = i3(4725), o = i3(2585), a = i3(2584); + const n2 = i3(4725), o2 = i3(2585), a2 = i3(2584); let h2 = t3.CompositionHelper = class { get isComposing() { return this._isComposing; } - constructor(e4, t4, i4, s3, r2, n2) { - this._textarea = e4, this._compositionView = t4, this._bufferService = i4, this._optionsService = s3, this._coreService = r2, this._renderService = n2, this._isComposing = false, this._isSendingComposition = false, this._compositionPosition = { start: 0, end: 0 }, this._dataAlreadySent = ""; + constructor(e4, t4, i4, s4, r3, n3) { + this._textarea = e4, this._compositionView = t4, this._bufferService = i4, this._optionsService = s4, this._coreService = r3, this._renderService = n3, this._isComposing = false, this._isSendingComposition = false, this._compositionPosition = { start: 0, end: 0 }, this._dataAlreadySent = ""; } compositionstart() { this._isComposing = true, this._compositionPosition.start = this._textarea.value.length, this._compositionView.textContent = "", this._dataAlreadySent = "", this._compositionView.classList.add("active"); @@ -158530,117 +186840,117 @@ WARNING: This link could potentially be dangerous`)) { setTimeout(() => { if (!this._isComposing) { const t4 = this._textarea.value, i4 = t4.replace(e4, ""); - this._dataAlreadySent = i4, t4.length > e4.length ? this._coreService.triggerDataEvent(i4, true) : t4.length < e4.length ? this._coreService.triggerDataEvent(`${a.C0.DEL}`, true) : t4.length === e4.length && t4 !== e4 && this._coreService.triggerDataEvent(t4, true); + this._dataAlreadySent = i4, t4.length > e4.length ? this._coreService.triggerDataEvent(i4, true) : t4.length < e4.length ? this._coreService.triggerDataEvent(`${a2.C0.DEL}`, true) : t4.length === e4.length && t4 !== e4 && this._coreService.triggerDataEvent(t4, true); } }, 0); } updateCompositionElements(e4) { if (this._isComposing) { if (this._bufferService.buffer.isCursorInViewport) { - const e5 = Math.min(this._bufferService.buffer.x, this._bufferService.cols - 1), t4 = this._renderService.dimensions.css.cell.height, i4 = this._bufferService.buffer.y * this._renderService.dimensions.css.cell.height, s3 = e5 * this._renderService.dimensions.css.cell.width; - this._compositionView.style.left = s3 + "px", this._compositionView.style.top = i4 + "px", this._compositionView.style.height = t4 + "px", this._compositionView.style.lineHeight = t4 + "px", this._compositionView.style.fontFamily = this._optionsService.rawOptions.fontFamily, this._compositionView.style.fontSize = this._optionsService.rawOptions.fontSize + "px"; - const r2 = this._compositionView.getBoundingClientRect(); - this._textarea.style.left = s3 + "px", this._textarea.style.top = i4 + "px", this._textarea.style.width = Math.max(r2.width, 1) + "px", this._textarea.style.height = Math.max(r2.height, 1) + "px", this._textarea.style.lineHeight = r2.height + "px"; + const e5 = Math.min(this._bufferService.buffer.x, this._bufferService.cols - 1), t4 = this._renderService.dimensions.css.cell.height, i4 = this._bufferService.buffer.y * this._renderService.dimensions.css.cell.height, s4 = e5 * this._renderService.dimensions.css.cell.width; + this._compositionView.style.left = s4 + "px", this._compositionView.style.top = i4 + "px", this._compositionView.style.height = t4 + "px", this._compositionView.style.lineHeight = t4 + "px", this._compositionView.style.fontFamily = this._optionsService.rawOptions.fontFamily, this._compositionView.style.fontSize = this._optionsService.rawOptions.fontSize + "px"; + const r3 = this._compositionView.getBoundingClientRect(); + this._textarea.style.left = s4 + "px", this._textarea.style.top = i4 + "px", this._textarea.style.width = Math.max(r3.width, 1) + "px", this._textarea.style.height = Math.max(r3.height, 1) + "px", this._textarea.style.lineHeight = r3.height + "px"; } e4 || setTimeout(() => this.updateCompositionElements(true), 0); } } }; - t3.CompositionHelper = h2 = s2([r(2, o.IBufferService), r(3, o.IOptionsService), r(4, o.ICoreService), r(5, n.IRenderService)], h2); + t3.CompositionHelper = h2 = s3([r2(2, o2.IBufferService), r2(3, o2.IOptionsService), r2(4, o2.ICoreService), r2(5, n2.IRenderService)], h2); }, 9806: (e3, t3) => { function i3(e4, t4, i4) { - const s2 = i4.getBoundingClientRect(), r = e4.getComputedStyle(i4), n = parseInt(r.getPropertyValue("padding-left")), o = parseInt(r.getPropertyValue("padding-top")); - return [t4.clientX - s2.left - n, t4.clientY - s2.top - o]; + const s3 = i4.getBoundingClientRect(), r2 = e4.getComputedStyle(i4), n2 = parseInt(r2.getPropertyValue("padding-left")), o2 = parseInt(r2.getPropertyValue("padding-top")); + return [t4.clientX - s3.left - n2, t4.clientY - s3.top - o2]; } __name(i3, "i"); - Object.defineProperty(t3, "__esModule", { value: true }), t3.getCoords = t3.getCoordsRelativeToElement = void 0, t3.getCoordsRelativeToElement = i3, t3.getCoords = function(e4, t4, s2, r, n, o, a, h2, c) { - if (!o) return; - const l = i3(e4, t4, s2); - return l ? (l[0] = Math.ceil((l[0] + (c ? a / 2 : 0)) / a), l[1] = Math.ceil(l[1] / h2), l[0] = Math.min(Math.max(l[0], 1), r + (c ? 1 : 0)), l[1] = Math.min(Math.max(l[1], 1), n), l) : void 0; + Object.defineProperty(t3, "__esModule", { value: true }), t3.getCoords = t3.getCoordsRelativeToElement = void 0, t3.getCoordsRelativeToElement = i3, t3.getCoords = function(e4, t4, s3, r2, n2, o2, a2, h2, c2) { + if (!o2) return; + const l2 = i3(e4, t4, s3); + return l2 ? (l2[0] = Math.ceil((l2[0] + (c2 ? a2 / 2 : 0)) / a2), l2[1] = Math.ceil(l2[1] / h2), l2[0] = Math.min(Math.max(l2[0], 1), r2 + (c2 ? 1 : 0)), l2[1] = Math.min(Math.max(l2[1], 1), n2), l2) : void 0; }; }, 9504: (e3, t3, i3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.moveToCellSequence = void 0; - const s2 = i3(2584); - function r(e4, t4, i4, s3) { - const r2 = e4 - n(e4, i4), a2 = t4 - n(t4, i4), l = Math.abs(r2 - a2) - function(e5, t5, i5) { - let s4 = 0; - const r3 = e5 - n(e5, i5), a3 = t5 - n(t5, i5); - for (let n2 = 0; n2 < Math.abs(r3 - a3); n2++) { - const a4 = "A" === o(e5, t5) ? -1 : 1, h3 = i5.buffer.lines.get(r3 + a4 * n2); - h3?.isWrapped && s4++; + const s3 = i3(2584); + function r2(e4, t4, i4, s4) { + const r3 = e4 - n2(e4, i4), a3 = t4 - n2(t4, i4), l2 = Math.abs(r3 - a3) - function(e5, t5, i5) { + let s5 = 0; + const r4 = e5 - n2(e5, i5), a4 = t5 - n2(t5, i5); + for (let n3 = 0; n3 < Math.abs(r4 - a4); n3++) { + const a5 = "A" === o2(e5, t5) ? -1 : 1, h3 = i5.buffer.lines.get(r4 + a5 * n3); + h3?.isWrapped && s5++; } - return s4; + return s5; }(e4, t4, i4); - return c(l, h2(o(e4, t4), s3)); + return c2(l2, h2(o2(e4, t4), s4)); } - __name(r, "r"); - function n(e4, t4) { - let i4 = 0, s3 = t4.buffer.lines.get(e4), r2 = s3?.isWrapped; - for (; r2 && e4 >= 0 && e4 < t4.rows; ) i4++, s3 = t4.buffer.lines.get(--e4), r2 = s3?.isWrapped; + __name(r2, "r"); + function n2(e4, t4) { + let i4 = 0, s4 = t4.buffer.lines.get(e4), r3 = s4?.isWrapped; + for (; r3 && e4 >= 0 && e4 < t4.rows; ) i4++, s4 = t4.buffer.lines.get(--e4), r3 = s4?.isWrapped; return i4; } - __name(n, "n"); - function o(e4, t4) { + __name(n2, "n"); + function o2(e4, t4) { return e4 > t4 ? "A" : "B"; } - __name(o, "o"); - function a(e4, t4, i4, s3, r2, n2) { - let o2 = e4, a2 = t4, h3 = ""; - for (; o2 !== i4 || a2 !== s3; ) o2 += r2 ? 1 : -1, r2 && o2 > n2.cols - 1 ? (h3 += n2.buffer.translateBufferLineToString(a2, false, e4, o2), o2 = 0, e4 = 0, a2++) : !r2 && o2 < 0 && (h3 += n2.buffer.translateBufferLineToString(a2, false, 0, e4 + 1), o2 = n2.cols - 1, e4 = o2, a2--); - return h3 + n2.buffer.translateBufferLineToString(a2, false, e4, o2); + __name(o2, "o"); + function a2(e4, t4, i4, s4, r3, n3) { + let o3 = e4, a3 = t4, h3 = ""; + for (; o3 !== i4 || a3 !== s4; ) o3 += r3 ? 1 : -1, r3 && o3 > n3.cols - 1 ? (h3 += n3.buffer.translateBufferLineToString(a3, false, e4, o3), o3 = 0, e4 = 0, a3++) : !r3 && o3 < 0 && (h3 += n3.buffer.translateBufferLineToString(a3, false, 0, e4 + 1), o3 = n3.cols - 1, e4 = o3, a3--); + return h3 + n3.buffer.translateBufferLineToString(a3, false, e4, o3); } - __name(a, "a"); + __name(a2, "a"); function h2(e4, t4) { const i4 = t4 ? "O" : "["; - return s2.C0.ESC + i4 + e4; + return s3.C0.ESC + i4 + e4; } __name(h2, "h"); - function c(e4, t4) { + function c2(e4, t4) { e4 = Math.floor(e4); let i4 = ""; - for (let s3 = 0; s3 < e4; s3++) i4 += t4; + for (let s4 = 0; s4 < e4; s4++) i4 += t4; return i4; } - __name(c, "c"); - t3.moveToCellSequence = function(e4, t4, i4, s3) { - const o2 = i4.buffer.x, l = i4.buffer.y; - if (!i4.buffer.hasScrollback) return function(e5, t5, i5, s4, o3, l2) { - return 0 === r(t5, s4, o3, l2).length ? "" : c(a(e5, t5, e5, t5 - n(t5, o3), false, o3).length, h2("D", l2)); - }(o2, l, 0, t4, i4, s3) + r(l, t4, i4, s3) + function(e5, t5, i5, s4, o3, l2) { - let d2; - d2 = r(t5, s4, o3, l2).length > 0 ? s4 - n(s4, o3) : t5; - const _3 = s4, u = function(e6, t6, i6, s5, o4, a2) { + __name(c2, "c"); + t3.moveToCellSequence = function(e4, t4, i4, s4) { + const o3 = i4.buffer.x, l2 = i4.buffer.y; + if (!i4.buffer.hasScrollback) return function(e5, t5, i5, s5, o4, l3) { + return 0 === r2(t5, s5, o4, l3).length ? "" : c2(a2(e5, t5, e5, t5 - n2(t5, o4), false, o4).length, h2("D", l3)); + }(o3, l2, 0, t4, i4, s4) + r2(l2, t4, i4, s4) + function(e5, t5, i5, s5, o4, l3) { + let d3; + d3 = r2(t5, s5, o4, l3).length > 0 ? s5 - n2(s5, o4) : t5; + const _3 = s5, u2 = function(e6, t6, i6, s6, o5, a3) { let h3; - return h3 = r(i6, s5, o4, a2).length > 0 ? s5 - n(s5, o4) : t6, e6 < i6 && h3 <= s5 || e6 >= i6 && h3 < s5 ? "C" : "D"; - }(e5, t5, i5, s4, o3, l2); - return c(a(e5, d2, i5, _3, "C" === u, o3).length, h2(u, l2)); - }(o2, l, e4, t4, i4, s3); - let d; - if (l === t4) return d = o2 > e4 ? "D" : "C", c(Math.abs(o2 - e4), h2(d, s3)); - d = l > t4 ? "D" : "C"; - const _2 = Math.abs(l - t4); - return c(function(e5, t5) { + return h3 = r2(i6, s6, o5, a3).length > 0 ? s6 - n2(s6, o5) : t6, e6 < i6 && h3 <= s6 || e6 >= i6 && h3 < s6 ? "C" : "D"; + }(e5, t5, i5, s5, o4, l3); + return c2(a2(e5, d3, i5, _3, "C" === u2, o4).length, h2(u2, l3)); + }(o3, l2, e4, t4, i4, s4); + let d2; + if (l2 === t4) return d2 = o3 > e4 ? "D" : "C", c2(Math.abs(o3 - e4), h2(d2, s4)); + d2 = l2 > t4 ? "D" : "C"; + const _2 = Math.abs(l2 - t4); + return c2(function(e5, t5) { return t5.cols - e5; - }(l > t4 ? e4 : o2, i4) + (_2 - 1) * i4.cols + 1 + ((l > t4 ? o2 : e4) - 1), h2(d, s3)); + }(l2 > t4 ? e4 : o3, i4) + (_2 - 1) * i4.cols + 1 + ((l2 > t4 ? o3 : e4) - 1), h2(d2, s4)); }; }, 1296: function(e3, t3, i3) { - var s2 = this && this.__decorate || function(e4, t4, i4, s3) { - var r2, n2 = arguments.length, o2 = n2 < 3 ? t4 : null === s3 ? s3 = Object.getOwnPropertyDescriptor(t4, i4) : s3; - if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o2 = Reflect.decorate(e4, t4, i4, s3); - else for (var a2 = e4.length - 1; a2 >= 0; a2--) (r2 = e4[a2]) && (o2 = (n2 < 3 ? r2(o2) : n2 > 3 ? r2(t4, i4, o2) : r2(t4, i4)) || o2); - return n2 > 3 && o2 && Object.defineProperty(t4, i4, o2), o2; - }, r = this && this.__param || function(e4, t4) { - return function(i4, s3) { - t4(i4, s3, e4); + var s3 = this && this.__decorate || function(e4, t4, i4, s4) { + var r3, n3 = arguments.length, o3 = n3 < 3 ? t4 : null === s4 ? s4 = Object.getOwnPropertyDescriptor(t4, i4) : s4; + if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o3 = Reflect.decorate(e4, t4, i4, s4); + else for (var a3 = e4.length - 1; a3 >= 0; a3--) (r3 = e4[a3]) && (o3 = (n3 < 3 ? r3(o3) : n3 > 3 ? r3(t4, i4, o3) : r3(t4, i4)) || o3); + return n3 > 3 && o3 && Object.defineProperty(t4, i4, o3), o3; + }, r2 = this && this.__param || function(e4, t4) { + return function(i4, s4) { + t4(i4, s4, e4); }; }; Object.defineProperty(t3, "__esModule", { value: true }), t3.DomRenderer = void 0; - const n = i3(3787), o = i3(2550), a = i3(2223), h2 = i3(6171), c = i3(6052), l = i3(4725), d = i3(8055), _2 = i3(8460), u = i3(844), f = i3(2585), v2 = "xterm-dom-renderer-owner-", p2 = "xterm-rows", g2 = "xterm-fg-", m = "xterm-bg-", S = "xterm-focus", C = "xterm-selection"; - let b = 1, w = t3.DomRenderer = class extends u.Disposable { - constructor(e4, t4, i4, s3, r2, a2, l2, d2, f2, g3, m2, S2, w2) { - super(), this._terminal = e4, this._document = t4, this._element = i4, this._screenElement = s3, this._viewportElement = r2, this._helperContainer = a2, this._linkifier2 = l2, this._charSizeService = f2, this._optionsService = g3, this._bufferService = m2, this._coreBrowserService = S2, this._themeService = w2, this._terminalClass = b++, this._rowElements = [], this._selectionRenderModel = (0, c.createSelectionRenderModel)(), this.onRequestRedraw = this.register(new _2.EventEmitter()).event, this._rowContainer = this._document.createElement("div"), this._rowContainer.classList.add(p2), this._rowContainer.style.lineHeight = "normal", this._rowContainer.setAttribute("aria-hidden", "true"), this._refreshRowElements(this._bufferService.cols, this._bufferService.rows), this._selectionContainer = this._document.createElement("div"), this._selectionContainer.classList.add(C), this._selectionContainer.setAttribute("aria-hidden", "true"), this.dimensions = (0, h2.createRenderDimensions)(), this._updateDimensions(), this.register(this._optionsService.onOptionChange(() => this._handleOptionsChanged())), this.register(this._themeService.onChangeColors((e5) => this._injectCss(e5))), this._injectCss(this._themeService.colors), this._rowFactory = d2.createInstance(n.DomRendererRowFactory, document), this._element.classList.add(v2 + this._terminalClass), this._screenElement.appendChild(this._rowContainer), this._screenElement.appendChild(this._selectionContainer), this.register(this._linkifier2.onShowLinkUnderline((e5) => this._handleLinkHover(e5))), this.register(this._linkifier2.onHideLinkUnderline((e5) => this._handleLinkLeave(e5))), this.register((0, u.toDisposable)(() => { + const n2 = i3(3787), o2 = i3(2550), a2 = i3(2223), h2 = i3(6171), c2 = i3(6052), l2 = i3(4725), d2 = i3(8055), _2 = i3(8460), u2 = i3(844), f2 = i3(2585), v2 = "xterm-dom-renderer-owner-", p2 = "xterm-rows", g2 = "xterm-fg-", m2 = "xterm-bg-", S2 = "xterm-focus", C2 = "xterm-selection"; + let b2 = 1, w2 = t3.DomRenderer = class extends u2.Disposable { + constructor(e4, t4, i4, s4, r3, a3, l3, d3, f3, g3, m3, S3, w3) { + super(), this._terminal = e4, this._document = t4, this._element = i4, this._screenElement = s4, this._viewportElement = r3, this._helperContainer = a3, this._linkifier2 = l3, this._charSizeService = f3, this._optionsService = g3, this._bufferService = m3, this._coreBrowserService = S3, this._themeService = w3, this._terminalClass = b2++, this._rowElements = [], this._selectionRenderModel = (0, c2.createSelectionRenderModel)(), this.onRequestRedraw = this.register(new _2.EventEmitter()).event, this._rowContainer = this._document.createElement("div"), this._rowContainer.classList.add(p2), this._rowContainer.style.lineHeight = "normal", this._rowContainer.setAttribute("aria-hidden", "true"), this._refreshRowElements(this._bufferService.cols, this._bufferService.rows), this._selectionContainer = this._document.createElement("div"), this._selectionContainer.classList.add(C2), this._selectionContainer.setAttribute("aria-hidden", "true"), this.dimensions = (0, h2.createRenderDimensions)(), this._updateDimensions(), this.register(this._optionsService.onOptionChange(() => this._handleOptionsChanged())), this.register(this._themeService.onChangeColors((e5) => this._injectCss(e5))), this._injectCss(this._themeService.colors), this._rowFactory = d3.createInstance(n2.DomRendererRowFactory, document), this._element.classList.add(v2 + this._terminalClass), this._screenElement.appendChild(this._rowContainer), this._screenElement.appendChild(this._selectionContainer), this.register(this._linkifier2.onShowLinkUnderline((e5) => this._handleLinkHover(e5))), this.register(this._linkifier2.onHideLinkUnderline((e5) => this._handleLinkLeave(e5))), this.register((0, u2.toDisposable)(() => { this._element.classList.remove(v2 + this._terminalClass), this._rowContainer.remove(), this._selectionContainer.remove(), this._widthCache.dispose(), this._themeStyleElement.remove(), this._dimensionsStyleElement.remove(); - })), this._widthCache = new o.WidthCache(this._document, this._helperContainer), this._widthCache.setFont(this._optionsService.rawOptions.fontFamily, this._optionsService.rawOptions.fontSize, this._optionsService.rawOptions.fontWeight, this._optionsService.rawOptions.fontWeightBold), this._setDefaultSpacing(); + })), this._widthCache = new o2.WidthCache(this._document, this._helperContainer), this._widthCache.setFont(this._optionsService.rawOptions.fontFamily, this._optionsService.rawOptions.fontSize, this._optionsService.rawOptions.fontWeight, this._optionsService.rawOptions.fontWeightBold), this._setDefaultSpacing(); } _updateDimensions() { const e4 = this._coreBrowserService.dpr; @@ -158653,11 +186963,11 @@ WARNING: This link could potentially be dangerous`)) { _injectCss(e4) { this._themeStyleElement || (this._themeStyleElement = this._document.createElement("style"), this._screenElement.appendChild(this._themeStyleElement)); let t4 = `${this._terminalSelector} .${p2} { color: ${e4.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`; - t4 += `${this._terminalSelector} .${p2} .xterm-dim { color: ${d.color.multiplyOpacity(e4.foreground, 0.5).css};}`, t4 += `${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`; - const i4 = `blink_underline_${this._terminalClass}`, s3 = `blink_bar_${this._terminalClass}`, r2 = `blink_block_${this._terminalClass}`; - t4 += `@keyframes ${i4} { 50% { border-bottom-style: hidden; }}`, t4 += `@keyframes ${s3} { 50% { box-shadow: none; }}`, t4 += `@keyframes ${r2} { 0% { background-color: ${e4.cursor.css}; color: ${e4.cursorAccent.css}; } 50% { background-color: inherit; color: ${e4.cursor.css}; }}`, t4 += `${this._terminalSelector} .${p2}.${S} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${i4} 1s step-end infinite;}${this._terminalSelector} .${p2}.${S} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${s3} 1s step-end infinite;}${this._terminalSelector} .${p2}.${S} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${r2} 1s step-end infinite;}${this._terminalSelector} .${p2} .xterm-cursor.xterm-cursor-block { background-color: ${e4.cursor.css}; color: ${e4.cursorAccent.css};}${this._terminalSelector} .${p2} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e4.cursor.css} !important; color: ${e4.cursorAccent.css} !important;}${this._terminalSelector} .${p2} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e4.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${p2} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e4.cursor.css} inset;}${this._terminalSelector} .${p2} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e4.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`, t4 += `${this._terminalSelector} .${C} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${C} div { position: absolute; background-color: ${e4.selectionBackgroundOpaque.css};}${this._terminalSelector} .${C} div { position: absolute; background-color: ${e4.selectionInactiveBackgroundOpaque.css};}`; - for (const [i5, s4] of e4.ansi.entries()) t4 += `${this._terminalSelector} .${g2}${i5} { color: ${s4.css}; }${this._terminalSelector} .${g2}${i5}.xterm-dim { color: ${d.color.multiplyOpacity(s4, 0.5).css}; }${this._terminalSelector} .${m}${i5} { background-color: ${s4.css}; }`; - t4 += `${this._terminalSelector} .${g2}${a.INVERTED_DEFAULT_COLOR} { color: ${d.color.opaque(e4.background).css}; }${this._terminalSelector} .${g2}${a.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${d.color.multiplyOpacity(d.color.opaque(e4.background), 0.5).css}; }${this._terminalSelector} .${m}${a.INVERTED_DEFAULT_COLOR} { background-color: ${e4.foreground.css}; }`, this._themeStyleElement.textContent = t4; + t4 += `${this._terminalSelector} .${p2} .xterm-dim { color: ${d2.color.multiplyOpacity(e4.foreground, 0.5).css};}`, t4 += `${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`; + const i4 = `blink_underline_${this._terminalClass}`, s4 = `blink_bar_${this._terminalClass}`, r3 = `blink_block_${this._terminalClass}`; + t4 += `@keyframes ${i4} { 50% { border-bottom-style: hidden; }}`, t4 += `@keyframes ${s4} { 50% { box-shadow: none; }}`, t4 += `@keyframes ${r3} { 0% { background-color: ${e4.cursor.css}; color: ${e4.cursorAccent.css}; } 50% { background-color: inherit; color: ${e4.cursor.css}; }}`, t4 += `${this._terminalSelector} .${p2}.${S2} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${i4} 1s step-end infinite;}${this._terminalSelector} .${p2}.${S2} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${s4} 1s step-end infinite;}${this._terminalSelector} .${p2}.${S2} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${r3} 1s step-end infinite;}${this._terminalSelector} .${p2} .xterm-cursor.xterm-cursor-block { background-color: ${e4.cursor.css}; color: ${e4.cursorAccent.css};}${this._terminalSelector} .${p2} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e4.cursor.css} !important; color: ${e4.cursorAccent.css} !important;}${this._terminalSelector} .${p2} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e4.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${p2} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e4.cursor.css} inset;}${this._terminalSelector} .${p2} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e4.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`, t4 += `${this._terminalSelector} .${C2} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${C2} div { position: absolute; background-color: ${e4.selectionBackgroundOpaque.css};}${this._terminalSelector} .${C2} div { position: absolute; background-color: ${e4.selectionInactiveBackgroundOpaque.css};}`; + for (const [i5, s5] of e4.ansi.entries()) t4 += `${this._terminalSelector} .${g2}${i5} { color: ${s5.css}; }${this._terminalSelector} .${g2}${i5}.xterm-dim { color: ${d2.color.multiplyOpacity(s5, 0.5).css}; }${this._terminalSelector} .${m2}${i5} { background-color: ${s5.css}; }`; + t4 += `${this._terminalSelector} .${g2}${a2.INVERTED_DEFAULT_COLOR} { color: ${d2.color.opaque(e4.background).css}; }${this._terminalSelector} .${g2}${a2.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${d2.color.multiplyOpacity(d2.color.opaque(e4.background), 0.5).css}; }${this._terminalSelector} .${m2}${a2.INVERTED_DEFAULT_COLOR} { background-color: ${e4.foreground.css}; }`, this._themeStyleElement.textContent = t4; } _setDefaultSpacing() { const e4 = this.dimensions.css.cell.width - this._widthCache.get("W", false, false); @@ -158680,35 +186990,35 @@ WARNING: This link could potentially be dangerous`)) { this._updateDimensions(), this._widthCache.clear(), this._setDefaultSpacing(); } handleBlur() { - this._rowContainer.classList.remove(S), this.renderRows(0, this._bufferService.rows - 1); + this._rowContainer.classList.remove(S2), this.renderRows(0, this._bufferService.rows - 1); } handleFocus() { - this._rowContainer.classList.add(S), this.renderRows(this._bufferService.buffer.y, this._bufferService.buffer.y); + this._rowContainer.classList.add(S2), this.renderRows(this._bufferService.buffer.y, this._bufferService.buffer.y); } handleSelectionChanged(e4, t4, i4) { if (this._selectionContainer.replaceChildren(), this._rowFactory.handleSelectionChanged(e4, t4, i4), this.renderRows(0, this._bufferService.rows - 1), !e4 || !t4) return; this._selectionRenderModel.update(this._terminal, e4, t4, i4); - const s3 = this._selectionRenderModel.viewportStartRow, r2 = this._selectionRenderModel.viewportEndRow, n2 = this._selectionRenderModel.viewportCappedStartRow, o2 = this._selectionRenderModel.viewportCappedEndRow; - if (n2 >= this._bufferService.rows || o2 < 0) return; - const a2 = this._document.createDocumentFragment(); + const s4 = this._selectionRenderModel.viewportStartRow, r3 = this._selectionRenderModel.viewportEndRow, n3 = this._selectionRenderModel.viewportCappedStartRow, o3 = this._selectionRenderModel.viewportCappedEndRow; + if (n3 >= this._bufferService.rows || o3 < 0) return; + const a3 = this._document.createDocumentFragment(); if (i4) { const i5 = e4[0] > t4[0]; - a2.appendChild(this._createSelectionElement(n2, i5 ? t4[0] : e4[0], i5 ? e4[0] : t4[0], o2 - n2 + 1)); + a3.appendChild(this._createSelectionElement(n3, i5 ? t4[0] : e4[0], i5 ? e4[0] : t4[0], o3 - n3 + 1)); } else { - const i5 = s3 === n2 ? e4[0] : 0, h3 = n2 === r2 ? t4[0] : this._bufferService.cols; - a2.appendChild(this._createSelectionElement(n2, i5, h3)); - const c2 = o2 - n2 - 1; - if (a2.appendChild(this._createSelectionElement(n2 + 1, 0, this._bufferService.cols, c2)), n2 !== o2) { - const e5 = r2 === o2 ? t4[0] : this._bufferService.cols; - a2.appendChild(this._createSelectionElement(o2, 0, e5)); + const i5 = s4 === n3 ? e4[0] : 0, h3 = n3 === r3 ? t4[0] : this._bufferService.cols; + a3.appendChild(this._createSelectionElement(n3, i5, h3)); + const c3 = o3 - n3 - 1; + if (a3.appendChild(this._createSelectionElement(n3 + 1, 0, this._bufferService.cols, c3)), n3 !== o3) { + const e5 = r3 === o3 ? t4[0] : this._bufferService.cols; + a3.appendChild(this._createSelectionElement(o3, 0, e5)); } } - this._selectionContainer.appendChild(a2); + this._selectionContainer.appendChild(a3); } - _createSelectionElement(e4, t4, i4, s3 = 1) { - const r2 = this._document.createElement("div"), n2 = t4 * this.dimensions.css.cell.width; - let o2 = this.dimensions.css.cell.width * (i4 - t4); - return n2 + o2 > this.dimensions.css.canvas.width && (o2 = this.dimensions.css.canvas.width - n2), r2.style.height = s3 * this.dimensions.css.cell.height + "px", r2.style.top = e4 * this.dimensions.css.cell.height + "px", r2.style.left = `${n2}px`, r2.style.width = `${o2}px`, r2; + _createSelectionElement(e4, t4, i4, s4 = 1) { + const r3 = this._document.createElement("div"), n3 = t4 * this.dimensions.css.cell.width; + let o3 = this.dimensions.css.cell.width * (i4 - t4); + return n3 + o3 > this.dimensions.css.canvas.width && (o3 = this.dimensions.css.canvas.width - n3), r3.style.height = s4 * this.dimensions.css.cell.height + "px", r3.style.top = e4 * this.dimensions.css.cell.height + "px", r3.style.left = `${n3}px`, r3.style.width = `${o3}px`, r3; } handleCursorMove() { } @@ -158719,11 +187029,11 @@ WARNING: This link could potentially be dangerous`)) { for (const e4 of this._rowElements) e4.replaceChildren(); } renderRows(e4, t4) { - const i4 = this._bufferService.buffer, s3 = i4.ybase + i4.y, r2 = Math.min(i4.x, this._bufferService.cols - 1), n2 = this._optionsService.rawOptions.cursorBlink, o2 = this._optionsService.rawOptions.cursorStyle, a2 = this._optionsService.rawOptions.cursorInactiveStyle; + const i4 = this._bufferService.buffer, s4 = i4.ybase + i4.y, r3 = Math.min(i4.x, this._bufferService.cols - 1), n3 = this._optionsService.rawOptions.cursorBlink, o3 = this._optionsService.rawOptions.cursorStyle, a3 = this._optionsService.rawOptions.cursorInactiveStyle; for (let h3 = e4; h3 <= t4; h3++) { - const e5 = h3 + i4.ydisp, t5 = this._rowElements[h3], c2 = i4.lines.get(e5); - if (!t5 || !c2) break; - t5.replaceChildren(...this._rowFactory.createRow(c2, e5, e5 === s3, o2, a2, r2, n2, this.dimensions.css.cell.width, this._widthCache, -1, -1)); + const e5 = h3 + i4.ydisp, t5 = this._rowElements[h3], c3 = i4.lines.get(e5); + if (!t5 || !c3) break; + t5.replaceChildren(...this._rowFactory.createRow(c3, e5, e5 === s4, o3, a3, r3, n3, this.dimensions.css.cell.width, this._widthCache, -1, -1)); } } get _terminalSelector() { @@ -158735,137 +187045,137 @@ WARNING: This link could potentially be dangerous`)) { _handleLinkLeave(e4) { this._setCellUnderline(e4.x1, e4.x2, e4.y1, e4.y2, e4.cols, false); } - _setCellUnderline(e4, t4, i4, s3, r2, n2) { - i4 < 0 && (e4 = 0), s3 < 0 && (t4 = 0); - const o2 = this._bufferService.rows - 1; - i4 = Math.max(Math.min(i4, o2), 0), s3 = Math.max(Math.min(s3, o2), 0), r2 = Math.min(r2, this._bufferService.cols); - const a2 = this._bufferService.buffer, h3 = a2.ybase + a2.y, c2 = Math.min(a2.x, r2 - 1), l2 = this._optionsService.rawOptions.cursorBlink, d2 = this._optionsService.rawOptions.cursorStyle, _3 = this._optionsService.rawOptions.cursorInactiveStyle; - for (let o3 = i4; o3 <= s3; ++o3) { - const u2 = o3 + a2.ydisp, f2 = this._rowElements[o3], v3 = a2.lines.get(u2); - if (!f2 || !v3) break; - f2.replaceChildren(...this._rowFactory.createRow(v3, u2, u2 === h3, d2, _3, c2, l2, this.dimensions.css.cell.width, this._widthCache, n2 ? o3 === i4 ? e4 : 0 : -1, n2 ? (o3 === s3 ? t4 : r2) - 1 : -1)); + _setCellUnderline(e4, t4, i4, s4, r3, n3) { + i4 < 0 && (e4 = 0), s4 < 0 && (t4 = 0); + const o3 = this._bufferService.rows - 1; + i4 = Math.max(Math.min(i4, o3), 0), s4 = Math.max(Math.min(s4, o3), 0), r3 = Math.min(r3, this._bufferService.cols); + const a3 = this._bufferService.buffer, h3 = a3.ybase + a3.y, c3 = Math.min(a3.x, r3 - 1), l3 = this._optionsService.rawOptions.cursorBlink, d3 = this._optionsService.rawOptions.cursorStyle, _3 = this._optionsService.rawOptions.cursorInactiveStyle; + for (let o4 = i4; o4 <= s4; ++o4) { + const u3 = o4 + a3.ydisp, f3 = this._rowElements[o4], v3 = a3.lines.get(u3); + if (!f3 || !v3) break; + f3.replaceChildren(...this._rowFactory.createRow(v3, u3, u3 === h3, d3, _3, c3, l3, this.dimensions.css.cell.width, this._widthCache, n3 ? o4 === i4 ? e4 : 0 : -1, n3 ? (o4 === s4 ? t4 : r3) - 1 : -1)); } } }; - t3.DomRenderer = w = s2([r(7, f.IInstantiationService), r(8, l.ICharSizeService), r(9, f.IOptionsService), r(10, f.IBufferService), r(11, l.ICoreBrowserService), r(12, l.IThemeService)], w); + t3.DomRenderer = w2 = s3([r2(7, f2.IInstantiationService), r2(8, l2.ICharSizeService), r2(9, f2.IOptionsService), r2(10, f2.IBufferService), r2(11, l2.ICoreBrowserService), r2(12, l2.IThemeService)], w2); }, 3787: function(e3, t3, i3) { - var s2 = this && this.__decorate || function(e4, t4, i4, s3) { - var r2, n2 = arguments.length, o2 = n2 < 3 ? t4 : null === s3 ? s3 = Object.getOwnPropertyDescriptor(t4, i4) : s3; - if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o2 = Reflect.decorate(e4, t4, i4, s3); - else for (var a2 = e4.length - 1; a2 >= 0; a2--) (r2 = e4[a2]) && (o2 = (n2 < 3 ? r2(o2) : n2 > 3 ? r2(t4, i4, o2) : r2(t4, i4)) || o2); - return n2 > 3 && o2 && Object.defineProperty(t4, i4, o2), o2; - }, r = this && this.__param || function(e4, t4) { - return function(i4, s3) { - t4(i4, s3, e4); + var s3 = this && this.__decorate || function(e4, t4, i4, s4) { + var r3, n3 = arguments.length, o3 = n3 < 3 ? t4 : null === s4 ? s4 = Object.getOwnPropertyDescriptor(t4, i4) : s4; + if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o3 = Reflect.decorate(e4, t4, i4, s4); + else for (var a3 = e4.length - 1; a3 >= 0; a3--) (r3 = e4[a3]) && (o3 = (n3 < 3 ? r3(o3) : n3 > 3 ? r3(t4, i4, o3) : r3(t4, i4)) || o3); + return n3 > 3 && o3 && Object.defineProperty(t4, i4, o3), o3; + }, r2 = this && this.__param || function(e4, t4) { + return function(i4, s4) { + t4(i4, s4, e4); }; }; Object.defineProperty(t3, "__esModule", { value: true }), t3.DomRendererRowFactory = void 0; - const n = i3(2223), o = i3(643), a = i3(511), h2 = i3(2585), c = i3(8055), l = i3(4725), d = i3(4269), _2 = i3(6171), u = i3(3734); - let f = t3.DomRendererRowFactory = class { - constructor(e4, t4, i4, s3, r2, n2, o2) { - this._document = e4, this._characterJoinerService = t4, this._optionsService = i4, this._coreBrowserService = s3, this._coreService = r2, this._decorationService = n2, this._themeService = o2, this._workCell = new a.CellData(), this._columnSelectMode = false, this.defaultSpacing = 0; + const n2 = i3(2223), o2 = i3(643), a2 = i3(511), h2 = i3(2585), c2 = i3(8055), l2 = i3(4725), d2 = i3(4269), _2 = i3(6171), u2 = i3(3734); + let f2 = t3.DomRendererRowFactory = class { + constructor(e4, t4, i4, s4, r3, n3, o3) { + this._document = e4, this._characterJoinerService = t4, this._optionsService = i4, this._coreBrowserService = s4, this._coreService = r3, this._decorationService = n3, this._themeService = o3, this._workCell = new a2.CellData(), this._columnSelectMode = false, this.defaultSpacing = 0; } handleSelectionChanged(e4, t4, i4) { this._selectionStart = e4, this._selectionEnd = t4, this._columnSelectMode = i4; } - createRow(e4, t4, i4, s3, r2, a2, h3, l2, _3, f2, p2) { - const g2 = [], m = this._characterJoinerService.getJoinedCharacters(t4), S = this._themeService.colors; - let C, b = e4.getNoBgTrimmedLength(); - i4 && b < a2 + 1 && (b = a2 + 1); - let w = 0, y2 = "", E = 0, k = 0, L = 0, D = false, R = 0, x2 = false, A = 0; - const B = [], T = -1 !== f2 && -1 !== p2; - for (let M = 0; M < b; M++) { - e4.loadCell(M, this._workCell); - let b2 = this._workCell.getWidth(); - if (0 === b2) continue; - let O = false, P2 = M, I = this._workCell; - if (m.length > 0 && M === m[0][0]) { - O = true; - const t5 = m.shift(); - I = new d.JoinedCellData(this._workCell, e4.translateToString(true, t5[0], t5[1]), t5[1] - t5[0]), P2 = t5[1] - 1, b2 = I.getWidth(); + createRow(e4, t4, i4, s4, r3, a3, h3, l3, _3, f3, p2) { + const g2 = [], m2 = this._characterJoinerService.getJoinedCharacters(t4), S2 = this._themeService.colors; + let C2, b2 = e4.getNoBgTrimmedLength(); + i4 && b2 < a3 + 1 && (b2 = a3 + 1); + let w2 = 0, y2 = "", E = 0, k2 = 0, L2 = 0, D2 = false, R = 0, x2 = false, A2 = 0; + const B2 = [], T2 = -1 !== f3 && -1 !== p2; + for (let M2 = 0; M2 < b2; M2++) { + e4.loadCell(M2, this._workCell); + let b3 = this._workCell.getWidth(); + if (0 === b3) continue; + let O2 = false, P2 = M2, I2 = this._workCell; + if (m2.length > 0 && M2 === m2[0][0]) { + O2 = true; + const t5 = m2.shift(); + I2 = new d2.JoinedCellData(this._workCell, e4.translateToString(true, t5[0], t5[1]), t5[1] - t5[0]), P2 = t5[1] - 1, b3 = I2.getWidth(); } - const H = this._isCellInSelection(M, t4), F = i4 && M === a2, W = T && M >= f2 && M <= p2; + const H = this._isCellInSelection(M2, t4), F2 = i4 && M2 === a3, W = T2 && M2 >= f3 && M2 <= p2; let U = false; - this._decorationService.forEachDecorationAtCell(M, t4, void 0, (e5) => { + this._decorationService.forEachDecorationAtCell(M2, t4, void 0, (e5) => { U = true; }); - let N = I.getChars() || o.WHITESPACE_CELL_CHAR; - if (" " === N && (I.isUnderline() || I.isOverline()) && (N = " "), A = b2 * l2 - _3.get(N, I.isBold(), I.isItalic()), C) { - if (w && (H && x2 || !H && !x2 && I.bg === E) && (H && x2 && S.selectionForeground || I.fg === k) && I.extended.ext === L && W === D && A === R && !F && !O && !U) { - I.isInvisible() ? y2 += o.WHITESPACE_CELL_CHAR : y2 += N, w++; + let N2 = I2.getChars() || o2.WHITESPACE_CELL_CHAR; + if (" " === N2 && (I2.isUnderline() || I2.isOverline()) && (N2 = " "), A2 = b3 * l3 - _3.get(N2, I2.isBold(), I2.isItalic()), C2) { + if (w2 && (H && x2 || !H && !x2 && I2.bg === E) && (H && x2 && S2.selectionForeground || I2.fg === k2) && I2.extended.ext === L2 && W === D2 && A2 === R && !F2 && !O2 && !U) { + I2.isInvisible() ? y2 += o2.WHITESPACE_CELL_CHAR : y2 += N2, w2++; continue; } - w && (C.textContent = y2), C = this._document.createElement("span"), w = 0, y2 = ""; - } else C = this._document.createElement("span"); - if (E = I.bg, k = I.fg, L = I.extended.ext, D = W, R = A, x2 = H, O && a2 >= M && a2 <= P2 && (a2 = M), !this._coreService.isCursorHidden && F && this._coreService.isCursorInitialized) { - if (B.push("xterm-cursor"), this._coreBrowserService.isFocused) h3 && B.push("xterm-cursor-blink"), B.push("bar" === s3 ? "xterm-cursor-bar" : "underline" === s3 ? "xterm-cursor-underline" : "xterm-cursor-block"); - else if (r2) switch (r2) { + w2 && (C2.textContent = y2), C2 = this._document.createElement("span"), w2 = 0, y2 = ""; + } else C2 = this._document.createElement("span"); + if (E = I2.bg, k2 = I2.fg, L2 = I2.extended.ext, D2 = W, R = A2, x2 = H, O2 && a3 >= M2 && a3 <= P2 && (a3 = M2), !this._coreService.isCursorHidden && F2 && this._coreService.isCursorInitialized) { + if (B2.push("xterm-cursor"), this._coreBrowserService.isFocused) h3 && B2.push("xterm-cursor-blink"), B2.push("bar" === s4 ? "xterm-cursor-bar" : "underline" === s4 ? "xterm-cursor-underline" : "xterm-cursor-block"); + else if (r3) switch (r3) { case "outline": - B.push("xterm-cursor-outline"); + B2.push("xterm-cursor-outline"); break; case "block": - B.push("xterm-cursor-block"); + B2.push("xterm-cursor-block"); break; case "bar": - B.push("xterm-cursor-bar"); + B2.push("xterm-cursor-bar"); break; case "underline": - B.push("xterm-cursor-underline"); + B2.push("xterm-cursor-underline"); } } - if (I.isBold() && B.push("xterm-bold"), I.isItalic() && B.push("xterm-italic"), I.isDim() && B.push("xterm-dim"), y2 = I.isInvisible() ? o.WHITESPACE_CELL_CHAR : I.getChars() || o.WHITESPACE_CELL_CHAR, I.isUnderline() && (B.push(`xterm-underline-${I.extended.underlineStyle}`), " " === y2 && (y2 = " "), !I.isUnderlineColorDefault())) if (I.isUnderlineColorRGB()) C.style.textDecorationColor = `rgb(${u.AttributeData.toColorRGB(I.getUnderlineColor()).join(",")})`; + if (I2.isBold() && B2.push("xterm-bold"), I2.isItalic() && B2.push("xterm-italic"), I2.isDim() && B2.push("xterm-dim"), y2 = I2.isInvisible() ? o2.WHITESPACE_CELL_CHAR : I2.getChars() || o2.WHITESPACE_CELL_CHAR, I2.isUnderline() && (B2.push(`xterm-underline-${I2.extended.underlineStyle}`), " " === y2 && (y2 = " "), !I2.isUnderlineColorDefault())) if (I2.isUnderlineColorRGB()) C2.style.textDecorationColor = `rgb(${u2.AttributeData.toColorRGB(I2.getUnderlineColor()).join(",")})`; else { - let e5 = I.getUnderlineColor(); - this._optionsService.rawOptions.drawBoldTextInBrightColors && I.isBold() && e5 < 8 && (e5 += 8), C.style.textDecorationColor = S.ansi[e5].css; + let e5 = I2.getUnderlineColor(); + this._optionsService.rawOptions.drawBoldTextInBrightColors && I2.isBold() && e5 < 8 && (e5 += 8), C2.style.textDecorationColor = S2.ansi[e5].css; } - I.isOverline() && (B.push("xterm-overline"), " " === y2 && (y2 = " ")), I.isStrikethrough() && B.push("xterm-strikethrough"), W && (C.style.textDecoration = "underline"); - let $ = I.getFgColor(), j = I.getFgColorMode(), z2 = I.getBgColor(), K = I.getBgColorMode(); - const q = !!I.isInverse(); - if (q) { - const e5 = $; - $ = z2, z2 = e5; - const t5 = j; - j = K, K = t5; + I2.isOverline() && (B2.push("xterm-overline"), " " === y2 && (y2 = " ")), I2.isStrikethrough() && B2.push("xterm-strikethrough"), W && (C2.style.textDecoration = "underline"); + let $2 = I2.getFgColor(), j2 = I2.getFgColorMode(), z2 = I2.getBgColor(), K = I2.getBgColorMode(); + const q2 = !!I2.isInverse(); + if (q2) { + const e5 = $2; + $2 = z2, z2 = e5; + const t5 = j2; + j2 = K, K = t5; } - let V, G, X, J = false; - switch (this._decorationService.forEachDecorationAtCell(M, t4, void 0, (e5) => { - "top" !== e5.options.layer && J || (e5.backgroundColorRGB && (K = 50331648, z2 = e5.backgroundColorRGB.rgba >> 8 & 16777215, V = e5.backgroundColorRGB), e5.foregroundColorRGB && (j = 50331648, $ = e5.foregroundColorRGB.rgba >> 8 & 16777215, G = e5.foregroundColorRGB), J = "top" === e5.options.layer); - }), !J && H && (V = this._coreBrowserService.isFocused ? S.selectionBackgroundOpaque : S.selectionInactiveBackgroundOpaque, z2 = V.rgba >> 8 & 16777215, K = 50331648, J = true, S.selectionForeground && (j = 50331648, $ = S.selectionForeground.rgba >> 8 & 16777215, G = S.selectionForeground)), J && B.push("xterm-decoration-top"), K) { + let V2, G, X, J = false; + switch (this._decorationService.forEachDecorationAtCell(M2, t4, void 0, (e5) => { + "top" !== e5.options.layer && J || (e5.backgroundColorRGB && (K = 50331648, z2 = e5.backgroundColorRGB.rgba >> 8 & 16777215, V2 = e5.backgroundColorRGB), e5.foregroundColorRGB && (j2 = 50331648, $2 = e5.foregroundColorRGB.rgba >> 8 & 16777215, G = e5.foregroundColorRGB), J = "top" === e5.options.layer); + }), !J && H && (V2 = this._coreBrowserService.isFocused ? S2.selectionBackgroundOpaque : S2.selectionInactiveBackgroundOpaque, z2 = V2.rgba >> 8 & 16777215, K = 50331648, J = true, S2.selectionForeground && (j2 = 50331648, $2 = S2.selectionForeground.rgba >> 8 & 16777215, G = S2.selectionForeground)), J && B2.push("xterm-decoration-top"), K) { case 16777216: case 33554432: - X = S.ansi[z2], B.push(`xterm-bg-${z2}`); + X = S2.ansi[z2], B2.push(`xterm-bg-${z2}`); break; case 50331648: - X = c.channels.toColor(z2 >> 16, z2 >> 8 & 255, 255 & z2), this._addStyle(C, `background-color:#${v2((z2 >>> 0).toString(16), "0", 6)}`); + X = c2.channels.toColor(z2 >> 16, z2 >> 8 & 255, 255 & z2), this._addStyle(C2, `background-color:#${v2((z2 >>> 0).toString(16), "0", 6)}`); break; default: - q ? (X = S.foreground, B.push(`xterm-bg-${n.INVERTED_DEFAULT_COLOR}`)) : X = S.background; + q2 ? (X = S2.foreground, B2.push(`xterm-bg-${n2.INVERTED_DEFAULT_COLOR}`)) : X = S2.background; } - switch (V || I.isDim() && (V = c.color.multiplyOpacity(X, 0.5)), j) { + switch (V2 || I2.isDim() && (V2 = c2.color.multiplyOpacity(X, 0.5)), j2) { case 16777216: case 33554432: - I.isBold() && $ < 8 && this._optionsService.rawOptions.drawBoldTextInBrightColors && ($ += 8), this._applyMinimumContrast(C, X, S.ansi[$], I, V, void 0) || B.push(`xterm-fg-${$}`); + I2.isBold() && $2 < 8 && this._optionsService.rawOptions.drawBoldTextInBrightColors && ($2 += 8), this._applyMinimumContrast(C2, X, S2.ansi[$2], I2, V2, void 0) || B2.push(`xterm-fg-${$2}`); break; case 50331648: - const e5 = c.channels.toColor($ >> 16 & 255, $ >> 8 & 255, 255 & $); - this._applyMinimumContrast(C, X, e5, I, V, G) || this._addStyle(C, `color:#${v2($.toString(16), "0", 6)}`); + const e5 = c2.channels.toColor($2 >> 16 & 255, $2 >> 8 & 255, 255 & $2); + this._applyMinimumContrast(C2, X, e5, I2, V2, G) || this._addStyle(C2, `color:#${v2($2.toString(16), "0", 6)}`); break; default: - this._applyMinimumContrast(C, X, S.foreground, I, V, G) || q && B.push(`xterm-fg-${n.INVERTED_DEFAULT_COLOR}`); + this._applyMinimumContrast(C2, X, S2.foreground, I2, V2, G) || q2 && B2.push(`xterm-fg-${n2.INVERTED_DEFAULT_COLOR}`); } - B.length && (C.className = B.join(" "), B.length = 0), F || O || U ? C.textContent = y2 : w++, A !== this.defaultSpacing && (C.style.letterSpacing = `${A}px`), g2.push(C), M = P2; + B2.length && (C2.className = B2.join(" "), B2.length = 0), F2 || O2 || U ? C2.textContent = y2 : w2++, A2 !== this.defaultSpacing && (C2.style.letterSpacing = `${A2}px`), g2.push(C2), M2 = P2; } - return C && w && (C.textContent = y2), g2; + return C2 && w2 && (C2.textContent = y2), g2; } - _applyMinimumContrast(e4, t4, i4, s3, r2, n2) { - if (1 === this._optionsService.rawOptions.minimumContrastRatio || (0, _2.treatGlyphAsBackgroundColor)(s3.getCode())) return false; - const o2 = this._getContrastCache(s3); - let a2; - if (r2 || n2 || (a2 = o2.getColor(t4.rgba, i4.rgba)), void 0 === a2) { - const e5 = this._optionsService.rawOptions.minimumContrastRatio / (s3.isDim() ? 2 : 1); - a2 = c.color.ensureContrastRatio(r2 || t4, n2 || i4, e5), o2.setColor((r2 || t4).rgba, (n2 || i4).rgba, a2 ?? null); + _applyMinimumContrast(e4, t4, i4, s4, r3, n3) { + if (1 === this._optionsService.rawOptions.minimumContrastRatio || (0, _2.treatGlyphAsBackgroundColor)(s4.getCode())) return false; + const o3 = this._getContrastCache(s4); + let a3; + if (r3 || n3 || (a3 = o3.getColor(t4.rgba, i4.rgba)), void 0 === a3) { + const e5 = this._optionsService.rawOptions.minimumContrastRatio / (s4.isDim() ? 2 : 1); + a3 = c2.color.ensureContrastRatio(r3 || t4, n3 || i4, e5), o3.setColor((r3 || t4).rgba, (n3 || i4).rgba, a3 ?? null); } - return !!a2 && (this._addStyle(e4, `color:${a2.css}`), true); + return !!a3 && (this._addStyle(e4, `color:${a3.css}`), true); } _getContrastCache(e4) { return e4.isDim() ? this._themeService.colors.halfContrastCache : this._themeService.colors.contrastCache; @@ -158874,8 +187184,8 @@ WARNING: This link could potentially be dangerous`)) { e4.setAttribute("style", `${e4.getAttribute("style") || ""}${t4};`); } _isCellInSelection(e4, t4) { - const i4 = this._selectionStart, s3 = this._selectionEnd; - return !(!i4 || !s3) && (this._columnSelectMode ? i4[0] <= s3[0] ? e4 >= i4[0] && t4 >= i4[1] && e4 < s3[0] && t4 <= s3[1] : e4 < i4[0] && t4 >= i4[1] && e4 >= s3[0] && t4 <= s3[1] : t4 > i4[1] && t4 < s3[1] || i4[1] === s3[1] && t4 === i4[1] && e4 >= i4[0] && e4 < s3[0] || i4[1] < s3[1] && t4 === s3[1] && e4 < s3[0] || i4[1] < s3[1] && t4 === i4[1] && e4 >= i4[0]); + const i4 = this._selectionStart, s4 = this._selectionEnd; + return !(!i4 || !s4) && (this._columnSelectMode ? i4[0] <= s4[0] ? e4 >= i4[0] && t4 >= i4[1] && e4 < s4[0] && t4 <= s4[1] : e4 < i4[0] && t4 >= i4[1] && e4 >= s4[0] && t4 <= s4[1] : t4 > i4[1] && t4 < s4[1] || i4[1] === s4[1] && t4 === i4[1] && e4 >= i4[0] && e4 < s4[0] || i4[1] < s4[1] && t4 === s4[1] && e4 < s4[0] || i4[1] < s4[1] && t4 === i4[1] && e4 >= i4[0]); } }; function v2(e4, t4, i4) { @@ -158883,19 +187193,19 @@ WARNING: This link could potentially be dangerous`)) { return e4; } __name(v2, "v"); - t3.DomRendererRowFactory = f = s2([r(1, l.ICharacterJoinerService), r(2, h2.IOptionsService), r(3, l.ICoreBrowserService), r(4, h2.ICoreService), r(5, h2.IDecorationService), r(6, l.IThemeService)], f); + t3.DomRendererRowFactory = f2 = s3([r2(1, l2.ICharacterJoinerService), r2(2, h2.IOptionsService), r2(3, l2.ICoreBrowserService), r2(4, h2.ICoreService), r2(5, h2.IDecorationService), r2(6, l2.IThemeService)], f2); }, 2550: (e3, t3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.WidthCache = void 0, t3.WidthCache = class { constructor(e4, t4) { this._flat = new Float32Array(256), this._font = "", this._fontSize = 0, this._weight = "normal", this._weightBold = "bold", this._measureElements = [], this._container = e4.createElement("div"), this._container.classList.add("xterm-width-cache-measure-container"), this._container.setAttribute("aria-hidden", "true"), this._container.style.whiteSpace = "pre", this._container.style.fontKerning = "none"; const i3 = e4.createElement("span"); i3.classList.add("xterm-char-measure-element"); - const s2 = e4.createElement("span"); - s2.classList.add("xterm-char-measure-element"), s2.style.fontWeight = "bold"; - const r = e4.createElement("span"); - r.classList.add("xterm-char-measure-element"), r.style.fontStyle = "italic"; - const n = e4.createElement("span"); - n.classList.add("xterm-char-measure-element"), n.style.fontWeight = "bold", n.style.fontStyle = "italic", this._measureElements = [i3, s2, r, n], this._container.appendChild(i3), this._container.appendChild(s2), this._container.appendChild(r), this._container.appendChild(n), t4.appendChild(this._container), this.clear(); + const s3 = e4.createElement("span"); + s3.classList.add("xterm-char-measure-element"), s3.style.fontWeight = "bold"; + const r2 = e4.createElement("span"); + r2.classList.add("xterm-char-measure-element"), r2.style.fontStyle = "italic"; + const n2 = e4.createElement("span"); + n2.classList.add("xterm-char-measure-element"), n2.style.fontWeight = "bold", n2.style.fontStyle = "italic", this._measureElements = [i3, s3, r2, n2], this._container.appendChild(i3), this._container.appendChild(s3), this._container.appendChild(r2), this._container.appendChild(n2), t4.appendChild(this._container), this.clear(); } dispose() { this._container.remove(), this._measureElements.length = 0, this._holey = void 0; @@ -158903,24 +187213,24 @@ WARNING: This link could potentially be dangerous`)) { clear() { this._flat.fill(-9999), this._holey = /* @__PURE__ */ new Map(); } - setFont(e4, t4, i3, s2) { - e4 === this._font && t4 === this._fontSize && i3 === this._weight && s2 === this._weightBold || (this._font = e4, this._fontSize = t4, this._weight = i3, this._weightBold = s2, this._container.style.fontFamily = this._font, this._container.style.fontSize = `${this._fontSize}px`, this._measureElements[0].style.fontWeight = `${i3}`, this._measureElements[1].style.fontWeight = `${s2}`, this._measureElements[2].style.fontWeight = `${i3}`, this._measureElements[3].style.fontWeight = `${s2}`, this.clear()); + setFont(e4, t4, i3, s3) { + e4 === this._font && t4 === this._fontSize && i3 === this._weight && s3 === this._weightBold || (this._font = e4, this._fontSize = t4, this._weight = i3, this._weightBold = s3, this._container.style.fontFamily = this._font, this._container.style.fontSize = `${this._fontSize}px`, this._measureElements[0].style.fontWeight = `${i3}`, this._measureElements[1].style.fontWeight = `${s3}`, this._measureElements[2].style.fontWeight = `${i3}`, this._measureElements[3].style.fontWeight = `${s3}`, this.clear()); } get(e4, t4, i3) { - let s2 = 0; - if (!t4 && !i3 && 1 === e4.length && (s2 = e4.charCodeAt(0)) < 256) { - if (-9999 !== this._flat[s2]) return this._flat[s2]; + let s3 = 0; + if (!t4 && !i3 && 1 === e4.length && (s3 = e4.charCodeAt(0)) < 256) { + if (-9999 !== this._flat[s3]) return this._flat[s3]; const t5 = this._measure(e4, 0); - return t5 > 0 && (this._flat[s2] = t5), t5; + return t5 > 0 && (this._flat[s3] = t5), t5; } - let r = e4; - t4 && (r += "B"), i3 && (r += "I"); - let n = this._holey.get(r); - if (void 0 === n) { - let s3 = 0; - t4 && (s3 |= 1), i3 && (s3 |= 2), n = this._measure(e4, s3), n > 0 && this._holey.set(r, n); + let r2 = e4; + t4 && (r2 += "B"), i3 && (r2 += "I"); + let n2 = this._holey.get(r2); + if (void 0 === n2) { + let s4 = 0; + t4 && (s4 |= 1), i3 && (s4 |= 2), n2 = this._measure(e4, s4), n2 > 0 && this._holey.set(r2, n2); } - return n; + return n2; } _measure(e4, t4) { const i3 = this._measureElements[t4]; @@ -158929,24 +187239,24 @@ WARNING: This link could potentially be dangerous`)) { }; }, 2223: (e3, t3, i3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.TEXT_BASELINE = t3.DIM_OPACITY = t3.INVERTED_DEFAULT_COLOR = void 0; - const s2 = i3(6114); - t3.INVERTED_DEFAULT_COLOR = 257, t3.DIM_OPACITY = 0.5, t3.TEXT_BASELINE = s2.isFirefox || s2.isLegacyEdge ? "bottom" : "ideographic"; + const s3 = i3(6114); + t3.INVERTED_DEFAULT_COLOR = 257, t3.DIM_OPACITY = 0.5, t3.TEXT_BASELINE = s3.isFirefox || s3.isLegacyEdge ? "bottom" : "ideographic"; }, 6171: (e3, t3) => { function i3(e4) { return 57508 <= e4 && e4 <= 57558; } __name(i3, "i"); - function s2(e4) { + function s3(e4) { return e4 >= 128512 && e4 <= 128591 || e4 >= 127744 && e4 <= 128511 || e4 >= 128640 && e4 <= 128767 || e4 >= 9728 && e4 <= 9983 || e4 >= 9984 && e4 <= 10175 || e4 >= 65024 && e4 <= 65039 || e4 >= 129280 && e4 <= 129535 || e4 >= 127462 && e4 <= 127487; } - __name(s2, "s"); + __name(s3, "s"); Object.defineProperty(t3, "__esModule", { value: true }), t3.computeNextVariantOffset = t3.createRenderDimensions = t3.treatGlyphAsBackgroundColor = t3.allowRescaling = t3.isEmoji = t3.isRestrictedPowerlineGlyph = t3.isPowerlineGlyph = t3.throwIfFalsy = void 0, t3.throwIfFalsy = function(e4) { if (!e4) throw new Error("value must not be falsy"); return e4; }, t3.isPowerlineGlyph = i3, t3.isRestrictedPowerlineGlyph = function(e4) { return 57520 <= e4 && e4 <= 57527; - }, t3.isEmoji = s2, t3.allowRescaling = function(e4, t4, r, n) { - return 1 === t4 && r > Math.ceil(1.5 * n) && void 0 !== e4 && e4 > 255 && !s2(e4) && !i3(e4) && !function(e5) { + }, t3.isEmoji = s3, t3.allowRescaling = function(e4, t4, r2, n2) { + return 1 === t4 && r2 > Math.ceil(1.5 * n2) && void 0 !== e4 && e4 > 255 && !s3(e4) && !i3(e4) && !function(e5) { return 57344 <= e5 && e5 <= 63743; }(e4); }, t3.treatGlyphAsBackgroundColor = function(e4) { @@ -158970,10 +187280,10 @@ WARNING: This link could potentially be dangerous`)) { clear() { this.hasSelection = false, this.columnSelectMode = false, this.viewportStartRow = 0, this.viewportEndRow = 0, this.viewportCappedStartRow = 0, this.viewportCappedEndRow = 0, this.startCol = 0, this.endCol = 0, this.selectionStart = void 0, this.selectionEnd = void 0; } - update(e4, t4, i4, s2 = false) { + update(e4, t4, i4, s3 = false) { if (this.selectionStart = t4, this.selectionEnd = i4, !t4 || !i4 || t4[0] === i4[0] && t4[1] === i4[1]) return void this.clear(); - const r = e4.buffers.active.ydisp, n = t4[1] - r, o = i4[1] - r, a = Math.max(n, 0), h2 = Math.min(o, e4.rows - 1); - a >= e4.rows || h2 < 0 ? this.clear() : (this.hasSelection = true, this.columnSelectMode = s2, this.viewportStartRow = n, this.viewportEndRow = o, this.viewportCappedStartRow = a, this.viewportCappedEndRow = h2, this.startCol = t4[0], this.endCol = i4[0]); + const r2 = e4.buffers.active.ydisp, n2 = t4[1] - r2, o2 = i4[1] - r2, a2 = Math.max(n2, 0), h2 = Math.min(o2, e4.rows - 1); + a2 >= e4.rows || h2 < 0 ? this.clear() : (this.hasSelection = true, this.columnSelectMode = s3, this.viewportStartRow = n2, this.viewportEndRow = o2, this.viewportCappedStartRow = a2, this.viewportCappedEndRow = h2, this.startCol = t4[0], this.endCol = i4[0]); } isCellSelected(e4, t4, i4) { return !!this.hasSelection && (i4 -= e4.buffer.active.viewportY, this.columnSelectMode ? this.startCol <= this.endCol ? t4 >= this.startCol && i4 >= this.viewportCappedStartRow && t4 < this.endCol && i4 <= this.viewportCappedEndRow : t4 < this.startCol && i4 >= this.viewportCappedStartRow && t4 >= this.endCol && i4 <= this.viewportCappedEndRow : i4 > this.viewportStartRow && i4 < this.viewportEndRow || this.viewportStartRow === this.viewportEndRow && i4 === this.viewportStartRow && t4 >= this.startCol && t4 < this.endCol || this.viewportStartRow < this.viewportEndRow && i4 === this.viewportEndRow && t4 < this.endCol || this.viewportStartRow < this.viewportEndRow && i4 === this.viewportStartRow && t4 >= this.startCol); @@ -159016,28 +187326,28 @@ WARNING: This link could potentially be dangerous`)) { } }; }, 428: function(e3, t3, i3) { - var s2 = this && this.__decorate || function(e4, t4, i4, s3) { - var r2, n2 = arguments.length, o2 = n2 < 3 ? t4 : null === s3 ? s3 = Object.getOwnPropertyDescriptor(t4, i4) : s3; - if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o2 = Reflect.decorate(e4, t4, i4, s3); - else for (var a2 = e4.length - 1; a2 >= 0; a2--) (r2 = e4[a2]) && (o2 = (n2 < 3 ? r2(o2) : n2 > 3 ? r2(t4, i4, o2) : r2(t4, i4)) || o2); - return n2 > 3 && o2 && Object.defineProperty(t4, i4, o2), o2; - }, r = this && this.__param || function(e4, t4) { - return function(i4, s3) { - t4(i4, s3, e4); + var s3 = this && this.__decorate || function(e4, t4, i4, s4) { + var r3, n3 = arguments.length, o3 = n3 < 3 ? t4 : null === s4 ? s4 = Object.getOwnPropertyDescriptor(t4, i4) : s4; + if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o3 = Reflect.decorate(e4, t4, i4, s4); + else for (var a3 = e4.length - 1; a3 >= 0; a3--) (r3 = e4[a3]) && (o3 = (n3 < 3 ? r3(o3) : n3 > 3 ? r3(t4, i4, o3) : r3(t4, i4)) || o3); + return n3 > 3 && o3 && Object.defineProperty(t4, i4, o3), o3; + }, r2 = this && this.__param || function(e4, t4) { + return function(i4, s4) { + t4(i4, s4, e4); }; }; Object.defineProperty(t3, "__esModule", { value: true }), t3.CharSizeService = void 0; - const n = i3(2585), o = i3(8460), a = i3(844); - let h2 = t3.CharSizeService = class extends a.Disposable { + const n2 = i3(2585), o2 = i3(8460), a2 = i3(844); + let h2 = t3.CharSizeService = class extends a2.Disposable { get hasValidSize() { return this.width > 0 && this.height > 0; } constructor(e4, t4, i4) { - super(), this._optionsService = i4, this.width = 0, this.height = 0, this._onCharSizeChange = this.register(new o.EventEmitter()), this.onCharSizeChange = this._onCharSizeChange.event; + super(), this._optionsService = i4, this.width = 0, this.height = 0, this._onCharSizeChange = this.register(new o2.EventEmitter()), this.onCharSizeChange = this._onCharSizeChange.event; try { - this._measureStrategy = this.register(new d(this._optionsService)); + this._measureStrategy = this.register(new d2(this._optionsService)); } catch { - this._measureStrategy = this.register(new l(e4, t4, this._optionsService)); + this._measureStrategy = this.register(new l2(e4, t4, this._optionsService)); } this.register(this._optionsService.onMultipleOptionChange(["fontFamily", "fontSize"], () => this.measure())); } @@ -159046,8 +187356,8 @@ WARNING: This link could potentially be dangerous`)) { e4.width === this.width && e4.height === this.height || (this.width = e4.width, this.height = e4.height, this._onCharSizeChange.fire()); } }; - t3.CharSizeService = h2 = s2([r(2, n.IOptionsService)], h2); - class c extends a.Disposable { + t3.CharSizeService = h2 = s3([r2(2, n2.IOptionsService)], h2); + class c2 extends a2.Disposable { static { __name(this, "c"); } @@ -159058,7 +187368,7 @@ WARNING: This link could potentially be dangerous`)) { void 0 !== e4 && e4 > 0 && void 0 !== t4 && t4 > 0 && (this._result.width = e4, this._result.height = t4); } } - class l extends c { + class l2 extends c2 { static { __name(this, "l"); } @@ -159069,7 +187379,7 @@ WARNING: This link could potentially be dangerous`)) { return this._measureElement.style.fontFamily = this._optionsService.rawOptions.fontFamily, this._measureElement.style.fontSize = `${this._optionsService.rawOptions.fontSize}px`, this._validateAndSet(Number(this._measureElement.offsetWidth) / 32, Number(this._measureElement.offsetHeight)), this._result; } } - class d extends c { + class d2 extends c2 { static { __name(this, "d"); } @@ -159085,19 +187395,19 @@ WARNING: This link could potentially be dangerous`)) { } } }, 4269: function(e3, t3, i3) { - var s2 = this && this.__decorate || function(e4, t4, i4, s3) { - var r2, n2 = arguments.length, o2 = n2 < 3 ? t4 : null === s3 ? s3 = Object.getOwnPropertyDescriptor(t4, i4) : s3; - if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o2 = Reflect.decorate(e4, t4, i4, s3); - else for (var a2 = e4.length - 1; a2 >= 0; a2--) (r2 = e4[a2]) && (o2 = (n2 < 3 ? r2(o2) : n2 > 3 ? r2(t4, i4, o2) : r2(t4, i4)) || o2); - return n2 > 3 && o2 && Object.defineProperty(t4, i4, o2), o2; - }, r = this && this.__param || function(e4, t4) { - return function(i4, s3) { - t4(i4, s3, e4); + var s3 = this && this.__decorate || function(e4, t4, i4, s4) { + var r3, n3 = arguments.length, o3 = n3 < 3 ? t4 : null === s4 ? s4 = Object.getOwnPropertyDescriptor(t4, i4) : s4; + if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o3 = Reflect.decorate(e4, t4, i4, s4); + else for (var a3 = e4.length - 1; a3 >= 0; a3--) (r3 = e4[a3]) && (o3 = (n3 < 3 ? r3(o3) : n3 > 3 ? r3(t4, i4, o3) : r3(t4, i4)) || o3); + return n3 > 3 && o3 && Object.defineProperty(t4, i4, o3), o3; + }, r2 = this && this.__param || function(e4, t4) { + return function(i4, s4) { + t4(i4, s4, e4); }; }; Object.defineProperty(t3, "__esModule", { value: true }), t3.CharacterJoinerService = t3.JoinedCellData = void 0; - const n = i3(3734), o = i3(643), a = i3(511), h2 = i3(2585); - class c extends n.AttributeData { + const n2 = i3(3734), o2 = i3(643), a2 = i3(511), h2 = i3(2585); + class c2 extends n2.AttributeData { static { __name(this, "c"); } @@ -159123,13 +187433,13 @@ WARNING: This link could potentially be dangerous`)) { return [this.fg, this.getChars(), this.getWidth(), this.getCode()]; } } - t3.JoinedCellData = c; - let l = t3.CharacterJoinerService = class e4 { + t3.JoinedCellData = c2; + let l2 = t3.CharacterJoinerService = class e4 { static { __name(this, "e"); } constructor(e5) { - this._bufferService = e5, this._characterJoiners = [], this._nextCharacterJoinerId = 0, this._workCell = new a.CellData(); + this._bufferService = e5, this._characterJoiners = [], this._nextCharacterJoinerId = 0, this._workCell = new a2.CellData(); } register(e5) { const t4 = { id: this._nextCharacterJoinerId++, handler: e5 }; @@ -159143,83 +187453,83 @@ WARNING: This link could potentially be dangerous`)) { if (0 === this._characterJoiners.length) return []; const t4 = this._bufferService.buffer.lines.get(e5); if (!t4 || 0 === t4.length) return []; - const i4 = [], s3 = t4.translateToString(true); - let r2 = 0, n2 = 0, a2 = 0, h3 = t4.getFg(0), c2 = t4.getBg(0); + const i4 = [], s4 = t4.translateToString(true); + let r3 = 0, n3 = 0, a3 = 0, h3 = t4.getFg(0), c3 = t4.getBg(0); for (let e6 = 0; e6 < t4.getTrimmedLength(); e6++) if (t4.loadCell(e6, this._workCell), 0 !== this._workCell.getWidth()) { - if (this._workCell.fg !== h3 || this._workCell.bg !== c2) { - if (e6 - r2 > 1) { - const e7 = this._getJoinedRanges(s3, a2, n2, t4, r2); + if (this._workCell.fg !== h3 || this._workCell.bg !== c3) { + if (e6 - r3 > 1) { + const e7 = this._getJoinedRanges(s4, a3, n3, t4, r3); for (let t5 = 0; t5 < e7.length; t5++) i4.push(e7[t5]); } - r2 = e6, a2 = n2, h3 = this._workCell.fg, c2 = this._workCell.bg; + r3 = e6, a3 = n3, h3 = this._workCell.fg, c3 = this._workCell.bg; } - n2 += this._workCell.getChars().length || o.WHITESPACE_CELL_CHAR.length; + n3 += this._workCell.getChars().length || o2.WHITESPACE_CELL_CHAR.length; } - if (this._bufferService.cols - r2 > 1) { - const e6 = this._getJoinedRanges(s3, a2, n2, t4, r2); + if (this._bufferService.cols - r3 > 1) { + const e6 = this._getJoinedRanges(s4, a3, n3, t4, r3); for (let t5 = 0; t5 < e6.length; t5++) i4.push(e6[t5]); } return i4; } - _getJoinedRanges(t4, i4, s3, r2, n2) { - const o2 = t4.substring(i4, s3); - let a2 = []; + _getJoinedRanges(t4, i4, s4, r3, n3) { + const o3 = t4.substring(i4, s4); + let a3 = []; try { - a2 = this._characterJoiners[0].handler(o2); + a3 = this._characterJoiners[0].handler(o3); } catch (e5) { console.error(e5); } for (let t5 = 1; t5 < this._characterJoiners.length; t5++) try { - const i5 = this._characterJoiners[t5].handler(o2); - for (let t6 = 0; t6 < i5.length; t6++) e4._mergeRanges(a2, i5[t6]); + const i5 = this._characterJoiners[t5].handler(o3); + for (let t6 = 0; t6 < i5.length; t6++) e4._mergeRanges(a3, i5[t6]); } catch (e5) { console.error(e5); } - return this._stringRangesToCellRanges(a2, r2, n2), a2; + return this._stringRangesToCellRanges(a3, r3, n3), a3; } _stringRangesToCellRanges(e5, t4, i4) { - let s3 = 0, r2 = false, n2 = 0, a2 = e5[s3]; - if (a2) { + let s4 = 0, r3 = false, n3 = 0, a3 = e5[s4]; + if (a3) { for (let h3 = i4; h3 < this._bufferService.cols; h3++) { - const i5 = t4.getWidth(h3), c2 = t4.getString(h3).length || o.WHITESPACE_CELL_CHAR.length; + const i5 = t4.getWidth(h3), c3 = t4.getString(h3).length || o2.WHITESPACE_CELL_CHAR.length; if (0 !== i5) { - if (!r2 && a2[0] <= n2 && (a2[0] = h3, r2 = true), a2[1] <= n2) { - if (a2[1] = h3, a2 = e5[++s3], !a2) break; - a2[0] <= n2 ? (a2[0] = h3, r2 = true) : r2 = false; + if (!r3 && a3[0] <= n3 && (a3[0] = h3, r3 = true), a3[1] <= n3) { + if (a3[1] = h3, a3 = e5[++s4], !a3) break; + a3[0] <= n3 ? (a3[0] = h3, r3 = true) : r3 = false; } - n2 += c2; + n3 += c3; } } - a2 && (a2[1] = this._bufferService.cols); + a3 && (a3[1] = this._bufferService.cols); } } static _mergeRanges(e5, t4) { let i4 = false; - for (let s3 = 0; s3 < e5.length; s3++) { - const r2 = e5[s3]; + for (let s4 = 0; s4 < e5.length; s4++) { + const r3 = e5[s4]; if (i4) { - if (t4[1] <= r2[0]) return e5[s3 - 1][1] = t4[1], e5; - if (t4[1] <= r2[1]) return e5[s3 - 1][1] = Math.max(t4[1], r2[1]), e5.splice(s3, 1), e5; - e5.splice(s3, 1), s3--; + if (t4[1] <= r3[0]) return e5[s4 - 1][1] = t4[1], e5; + if (t4[1] <= r3[1]) return e5[s4 - 1][1] = Math.max(t4[1], r3[1]), e5.splice(s4, 1), e5; + e5.splice(s4, 1), s4--; } else { - if (t4[1] <= r2[0]) return e5.splice(s3, 0, t4), e5; - if (t4[1] <= r2[1]) return r2[0] = Math.min(t4[0], r2[0]), e5; - t4[0] < r2[1] && (r2[0] = Math.min(t4[0], r2[0]), i4 = true); + if (t4[1] <= r3[0]) return e5.splice(s4, 0, t4), e5; + if (t4[1] <= r3[1]) return r3[0] = Math.min(t4[0], r3[0]), e5; + t4[0] < r3[1] && (r3[0] = Math.min(t4[0], r3[0]), i4 = true); } } return i4 ? e5[e5.length - 1][1] = t4[1] : e5.push(t4), e5; } }; - t3.CharacterJoinerService = l = s2([r(0, h2.IBufferService)], l); + t3.CharacterJoinerService = l2 = s3([r2(0, h2.IBufferService)], l2); }, 5114: (e3, t3, i3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.CoreBrowserService = void 0; - const s2 = i3(844), r = i3(8460), n = i3(3656); - class o extends s2.Disposable { + const s3 = i3(844), r2 = i3(8460), n2 = i3(3656); + class o2 extends s3.Disposable { static { __name(this, "o"); } constructor(e4, t4, i4) { - super(), this._textarea = e4, this._window = t4, this.mainDocument = i4, this._isFocused = false, this._cachedIsFocused = void 0, this._screenDprMonitor = new a(this._window), this._onDprChange = this.register(new r.EventEmitter()), this.onDprChange = this._onDprChange.event, this._onWindowChange = this.register(new r.EventEmitter()), this.onWindowChange = this._onWindowChange.event, this.register(this.onWindowChange((e5) => this._screenDprMonitor.setWindow(e5))), this.register((0, r.forwardEvent)(this._screenDprMonitor.onDprChange, this._onDprChange)), this._textarea.addEventListener("focus", () => this._isFocused = true), this._textarea.addEventListener("blur", () => this._isFocused = false); + super(), this._textarea = e4, this._window = t4, this.mainDocument = i4, this._isFocused = false, this._cachedIsFocused = void 0, this._screenDprMonitor = new a2(this._window), this._onDprChange = this.register(new r2.EventEmitter()), this.onDprChange = this._onDprChange.event, this._onWindowChange = this.register(new r2.EventEmitter()), this.onWindowChange = this._onWindowChange.event, this.register(this.onWindowChange((e5) => this._screenDprMonitor.setWindow(e5))), this.register((0, r2.forwardEvent)(this._screenDprMonitor.onDprChange, this._onDprChange)), this._textarea.addEventListener("focus", () => this._isFocused = true), this._textarea.addEventListener("blur", () => this._isFocused = false); } get window() { return this._window; @@ -159234,19 +187544,19 @@ WARNING: This link could potentially be dangerous`)) { return void 0 === this._cachedIsFocused && (this._cachedIsFocused = this._isFocused && this._textarea.ownerDocument.hasFocus(), queueMicrotask(() => this._cachedIsFocused = void 0)), this._cachedIsFocused; } } - t3.CoreBrowserService = o; - class a extends s2.Disposable { + t3.CoreBrowserService = o2; + class a2 extends s3.Disposable { static { __name(this, "a"); } constructor(e4) { - super(), this._parentWindow = e4, this._windowResizeListener = this.register(new s2.MutableDisposable()), this._onDprChange = this.register(new r.EventEmitter()), this.onDprChange = this._onDprChange.event, this._outerListener = () => this._setDprAndFireIfDiffers(), this._currentDevicePixelRatio = this._parentWindow.devicePixelRatio, this._updateDpr(), this._setWindowResizeListener(), this.register((0, s2.toDisposable)(() => this.clearListener())); + super(), this._parentWindow = e4, this._windowResizeListener = this.register(new s3.MutableDisposable()), this._onDprChange = this.register(new r2.EventEmitter()), this.onDprChange = this._onDprChange.event, this._outerListener = () => this._setDprAndFireIfDiffers(), this._currentDevicePixelRatio = this._parentWindow.devicePixelRatio, this._updateDpr(), this._setWindowResizeListener(), this.register((0, s3.toDisposable)(() => this.clearListener())); } setWindow(e4) { this._parentWindow = e4, this._setWindowResizeListener(), this._setDprAndFireIfDiffers(); } _setWindowResizeListener() { - this._windowResizeListener.value = (0, n.addDisposableDomListener)(this._parentWindow, "resize", () => this._setDprAndFireIfDiffers()); + this._windowResizeListener.value = (0, n2.addDisposableDomListener)(this._parentWindow, "resize", () => this._setDprAndFireIfDiffers()); } _setDprAndFireIfDiffers() { this._parentWindow.devicePixelRatio !== this._currentDevicePixelRatio && this._onDprChange.fire(this._parentWindow.devicePixelRatio), this._updateDpr(); @@ -159260,13 +187570,13 @@ WARNING: This link could potentially be dangerous`)) { } }, 779: (e3, t3, i3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.LinkProviderService = void 0; - const s2 = i3(844); - class r extends s2.Disposable { + const s3 = i3(844); + class r2 extends s3.Disposable { static { __name(this, "r"); } constructor() { - super(), this.linkProviders = [], this.register((0, s2.toDisposable)(() => this.linkProviders.length = 0)); + super(), this.linkProviders = [], this.register((0, s3.toDisposable)(() => this.linkProviders.length = 0)); } registerLinkProvider(e4) { return this.linkProviders.push(e4), { dispose: /* @__PURE__ */ __name(() => { @@ -159275,54 +187585,54 @@ WARNING: This link could potentially be dangerous`)) { }, "dispose") }; } } - t3.LinkProviderService = r; + t3.LinkProviderService = r2; }, 8934: function(e3, t3, i3) { - var s2 = this && this.__decorate || function(e4, t4, i4, s3) { - var r2, n2 = arguments.length, o2 = n2 < 3 ? t4 : null === s3 ? s3 = Object.getOwnPropertyDescriptor(t4, i4) : s3; - if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o2 = Reflect.decorate(e4, t4, i4, s3); - else for (var a2 = e4.length - 1; a2 >= 0; a2--) (r2 = e4[a2]) && (o2 = (n2 < 3 ? r2(o2) : n2 > 3 ? r2(t4, i4, o2) : r2(t4, i4)) || o2); - return n2 > 3 && o2 && Object.defineProperty(t4, i4, o2), o2; - }, r = this && this.__param || function(e4, t4) { - return function(i4, s3) { - t4(i4, s3, e4); + var s3 = this && this.__decorate || function(e4, t4, i4, s4) { + var r3, n3 = arguments.length, o3 = n3 < 3 ? t4 : null === s4 ? s4 = Object.getOwnPropertyDescriptor(t4, i4) : s4; + if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o3 = Reflect.decorate(e4, t4, i4, s4); + else for (var a3 = e4.length - 1; a3 >= 0; a3--) (r3 = e4[a3]) && (o3 = (n3 < 3 ? r3(o3) : n3 > 3 ? r3(t4, i4, o3) : r3(t4, i4)) || o3); + return n3 > 3 && o3 && Object.defineProperty(t4, i4, o3), o3; + }, r2 = this && this.__param || function(e4, t4) { + return function(i4, s4) { + t4(i4, s4, e4); }; }; Object.defineProperty(t3, "__esModule", { value: true }), t3.MouseService = void 0; - const n = i3(4725), o = i3(9806); - let a = t3.MouseService = class { + const n2 = i3(4725), o2 = i3(9806); + let a2 = t3.MouseService = class { constructor(e4, t4) { this._renderService = e4, this._charSizeService = t4; } - getCoords(e4, t4, i4, s3, r2) { - return (0, o.getCoords)(window, e4, t4, i4, s3, this._charSizeService.hasValidSize, this._renderService.dimensions.css.cell.width, this._renderService.dimensions.css.cell.height, r2); + getCoords(e4, t4, i4, s4, r3) { + return (0, o2.getCoords)(window, e4, t4, i4, s4, this._charSizeService.hasValidSize, this._renderService.dimensions.css.cell.width, this._renderService.dimensions.css.cell.height, r3); } getMouseReportCoords(e4, t4) { - const i4 = (0, o.getCoordsRelativeToElement)(window, e4, t4); + const i4 = (0, o2.getCoordsRelativeToElement)(window, e4, t4); if (this._charSizeService.hasValidSize) return i4[0] = Math.min(Math.max(i4[0], 0), this._renderService.dimensions.css.canvas.width - 1), i4[1] = Math.min(Math.max(i4[1], 0), this._renderService.dimensions.css.canvas.height - 1), { col: Math.floor(i4[0] / this._renderService.dimensions.css.cell.width), row: Math.floor(i4[1] / this._renderService.dimensions.css.cell.height), x: Math.floor(i4[0]), y: Math.floor(i4[1]) }; } }; - t3.MouseService = a = s2([r(0, n.IRenderService), r(1, n.ICharSizeService)], a); + t3.MouseService = a2 = s3([r2(0, n2.IRenderService), r2(1, n2.ICharSizeService)], a2); }, 3230: function(e3, t3, i3) { - var s2 = this && this.__decorate || function(e4, t4, i4, s3) { - var r2, n2 = arguments.length, o2 = n2 < 3 ? t4 : null === s3 ? s3 = Object.getOwnPropertyDescriptor(t4, i4) : s3; - if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o2 = Reflect.decorate(e4, t4, i4, s3); - else for (var a2 = e4.length - 1; a2 >= 0; a2--) (r2 = e4[a2]) && (o2 = (n2 < 3 ? r2(o2) : n2 > 3 ? r2(t4, i4, o2) : r2(t4, i4)) || o2); - return n2 > 3 && o2 && Object.defineProperty(t4, i4, o2), o2; - }, r = this && this.__param || function(e4, t4) { - return function(i4, s3) { - t4(i4, s3, e4); + var s3 = this && this.__decorate || function(e4, t4, i4, s4) { + var r3, n3 = arguments.length, o3 = n3 < 3 ? t4 : null === s4 ? s4 = Object.getOwnPropertyDescriptor(t4, i4) : s4; + if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o3 = Reflect.decorate(e4, t4, i4, s4); + else for (var a3 = e4.length - 1; a3 >= 0; a3--) (r3 = e4[a3]) && (o3 = (n3 < 3 ? r3(o3) : n3 > 3 ? r3(t4, i4, o3) : r3(t4, i4)) || o3); + return n3 > 3 && o3 && Object.defineProperty(t4, i4, o3), o3; + }, r2 = this && this.__param || function(e4, t4) { + return function(i4, s4) { + t4(i4, s4, e4); }; }; Object.defineProperty(t3, "__esModule", { value: true }), t3.RenderService = void 0; - const n = i3(6193), o = i3(4725), a = i3(8460), h2 = i3(844), c = i3(7226), l = i3(2585); - let d = t3.RenderService = class extends h2.Disposable { + const n2 = i3(6193), o2 = i3(4725), a2 = i3(8460), h2 = i3(844), c2 = i3(7226), l2 = i3(2585); + let d2 = t3.RenderService = class extends h2.Disposable { get dimensions() { return this._renderer.value.dimensions; } - constructor(e4, t4, i4, s3, r2, o2, l2, d2) { - super(), this._rowCount = e4, this._charSizeService = s3, this._renderer = this.register(new h2.MutableDisposable()), this._pausedResizeTask = new c.DebouncedIdleTask(), this._observerDisposable = this.register(new h2.MutableDisposable()), this._isPaused = false, this._needsFullRefresh = false, this._isNextRenderRedrawOnly = true, this._needsSelectionRefresh = false, this._canvasWidth = 0, this._canvasHeight = 0, this._selectionState = { start: void 0, end: void 0, columnSelectMode: false }, this._onDimensionsChange = this.register(new a.EventEmitter()), this.onDimensionsChange = this._onDimensionsChange.event, this._onRenderedViewportChange = this.register(new a.EventEmitter()), this.onRenderedViewportChange = this._onRenderedViewportChange.event, this._onRender = this.register(new a.EventEmitter()), this.onRender = this._onRender.event, this._onRefreshRequest = this.register(new a.EventEmitter()), this.onRefreshRequest = this._onRefreshRequest.event, this._renderDebouncer = new n.RenderDebouncer((e5, t5) => this._renderRows(e5, t5), l2), this.register(this._renderDebouncer), this.register(l2.onDprChange(() => this.handleDevicePixelRatioChange())), this.register(o2.onResize(() => this._fullRefresh())), this.register(o2.buffers.onBufferActivate(() => this._renderer.value?.clear())), this.register(i4.onOptionChange(() => this._handleOptionsChanged())), this.register(this._charSizeService.onCharSizeChange(() => this.handleCharSizeChanged())), this.register(r2.onDecorationRegistered(() => this._fullRefresh())), this.register(r2.onDecorationRemoved(() => this._fullRefresh())), this.register(i4.onMultipleOptionChange(["customGlyphs", "drawBoldTextInBrightColors", "letterSpacing", "lineHeight", "fontFamily", "fontSize", "fontWeight", "fontWeightBold", "minimumContrastRatio", "rescaleOverlappingGlyphs"], () => { - this.clear(), this.handleResize(o2.cols, o2.rows), this._fullRefresh(); - })), this.register(i4.onMultipleOptionChange(["cursorBlink", "cursorStyle"], () => this.refreshRows(o2.buffer.y, o2.buffer.y, true))), this.register(d2.onChangeColors(() => this._fullRefresh())), this._registerIntersectionObserver(l2.window, t4), this.register(l2.onWindowChange((e5) => this._registerIntersectionObserver(e5, t4))); + constructor(e4, t4, i4, s4, r3, o3, l3, d3) { + super(), this._rowCount = e4, this._charSizeService = s4, this._renderer = this.register(new h2.MutableDisposable()), this._pausedResizeTask = new c2.DebouncedIdleTask(), this._observerDisposable = this.register(new h2.MutableDisposable()), this._isPaused = false, this._needsFullRefresh = false, this._isNextRenderRedrawOnly = true, this._needsSelectionRefresh = false, this._canvasWidth = 0, this._canvasHeight = 0, this._selectionState = { start: void 0, end: void 0, columnSelectMode: false }, this._onDimensionsChange = this.register(new a2.EventEmitter()), this.onDimensionsChange = this._onDimensionsChange.event, this._onRenderedViewportChange = this.register(new a2.EventEmitter()), this.onRenderedViewportChange = this._onRenderedViewportChange.event, this._onRender = this.register(new a2.EventEmitter()), this.onRender = this._onRender.event, this._onRefreshRequest = this.register(new a2.EventEmitter()), this.onRefreshRequest = this._onRefreshRequest.event, this._renderDebouncer = new n2.RenderDebouncer((e5, t5) => this._renderRows(e5, t5), l3), this.register(this._renderDebouncer), this.register(l3.onDprChange(() => this.handleDevicePixelRatioChange())), this.register(o3.onResize(() => this._fullRefresh())), this.register(o3.buffers.onBufferActivate(() => this._renderer.value?.clear())), this.register(i4.onOptionChange(() => this._handleOptionsChanged())), this.register(this._charSizeService.onCharSizeChange(() => this.handleCharSizeChanged())), this.register(r3.onDecorationRegistered(() => this._fullRefresh())), this.register(r3.onDecorationRemoved(() => this._fullRefresh())), this.register(i4.onMultipleOptionChange(["customGlyphs", "drawBoldTextInBrightColors", "letterSpacing", "lineHeight", "fontFamily", "fontSize", "fontWeight", "fontWeightBold", "minimumContrastRatio", "rescaleOverlappingGlyphs"], () => { + this.clear(), this.handleResize(o3.cols, o3.rows), this._fullRefresh(); + })), this.register(i4.onMultipleOptionChange(["cursorBlink", "cursorStyle"], () => this.refreshRows(o3.buffer.y, o3.buffer.y, true))), this.register(d3.onChangeColors(() => this._fullRefresh())), this._registerIntersectionObserver(l3.window, t4), this.register(l3.onWindowChange((e5) => this._registerIntersectionObserver(e5, t4))); } _registerIntersectionObserver(e4, t4) { if ("IntersectionObserver" in e4) { @@ -159388,25 +187698,25 @@ WARNING: This link could potentially be dangerous`)) { this._renderer.value?.clear(); } }; - t3.RenderService = d = s2([r(2, l.IOptionsService), r(3, o.ICharSizeService), r(4, l.IDecorationService), r(5, l.IBufferService), r(6, o.ICoreBrowserService), r(7, o.IThemeService)], d); + t3.RenderService = d2 = s3([r2(2, l2.IOptionsService), r2(3, o2.ICharSizeService), r2(4, l2.IDecorationService), r2(5, l2.IBufferService), r2(6, o2.ICoreBrowserService), r2(7, o2.IThemeService)], d2); }, 9312: function(e3, t3, i3) { - var s2 = this && this.__decorate || function(e4, t4, i4, s3) { - var r2, n2 = arguments.length, o2 = n2 < 3 ? t4 : null === s3 ? s3 = Object.getOwnPropertyDescriptor(t4, i4) : s3; - if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o2 = Reflect.decorate(e4, t4, i4, s3); - else for (var a2 = e4.length - 1; a2 >= 0; a2--) (r2 = e4[a2]) && (o2 = (n2 < 3 ? r2(o2) : n2 > 3 ? r2(t4, i4, o2) : r2(t4, i4)) || o2); - return n2 > 3 && o2 && Object.defineProperty(t4, i4, o2), o2; - }, r = this && this.__param || function(e4, t4) { - return function(i4, s3) { - t4(i4, s3, e4); + var s3 = this && this.__decorate || function(e4, t4, i4, s4) { + var r3, n3 = arguments.length, o3 = n3 < 3 ? t4 : null === s4 ? s4 = Object.getOwnPropertyDescriptor(t4, i4) : s4; + if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o3 = Reflect.decorate(e4, t4, i4, s4); + else for (var a3 = e4.length - 1; a3 >= 0; a3--) (r3 = e4[a3]) && (o3 = (n3 < 3 ? r3(o3) : n3 > 3 ? r3(t4, i4, o3) : r3(t4, i4)) || o3); + return n3 > 3 && o3 && Object.defineProperty(t4, i4, o3), o3; + }, r2 = this && this.__param || function(e4, t4) { + return function(i4, s4) { + t4(i4, s4, e4); }; }; Object.defineProperty(t3, "__esModule", { value: true }), t3.SelectionService = void 0; - const n = i3(9806), o = i3(9504), a = i3(456), h2 = i3(4725), c = i3(8460), l = i3(844), d = i3(6114), _2 = i3(4841), u = i3(511), f = i3(2585), v2 = String.fromCharCode(160), p2 = new RegExp(v2, "g"); - let g2 = t3.SelectionService = class extends l.Disposable { - constructor(e4, t4, i4, s3, r2, n2, o2, h3, d2) { - super(), this._element = e4, this._screenElement = t4, this._linkifier = i4, this._bufferService = s3, this._coreService = r2, this._mouseService = n2, this._optionsService = o2, this._renderService = h3, this._coreBrowserService = d2, this._dragScrollAmount = 0, this._enabled = true, this._workCell = new u.CellData(), this._mouseDownTimeStamp = 0, this._oldHasSelection = false, this._oldSelectionStart = void 0, this._oldSelectionEnd = void 0, this._onLinuxMouseSelection = this.register(new c.EventEmitter()), this.onLinuxMouseSelection = this._onLinuxMouseSelection.event, this._onRedrawRequest = this.register(new c.EventEmitter()), this.onRequestRedraw = this._onRedrawRequest.event, this._onSelectionChange = this.register(new c.EventEmitter()), this.onSelectionChange = this._onSelectionChange.event, this._onRequestScrollLines = this.register(new c.EventEmitter()), this.onRequestScrollLines = this._onRequestScrollLines.event, this._mouseMoveListener = (e5) => this._handleMouseMove(e5), this._mouseUpListener = (e5) => this._handleMouseUp(e5), this._coreService.onUserInput(() => { + const n2 = i3(9806), o2 = i3(9504), a2 = i3(456), h2 = i3(4725), c2 = i3(8460), l2 = i3(844), d2 = i3(6114), _2 = i3(4841), u2 = i3(511), f2 = i3(2585), v2 = String.fromCharCode(160), p2 = new RegExp(v2, "g"); + let g2 = t3.SelectionService = class extends l2.Disposable { + constructor(e4, t4, i4, s4, r3, n3, o3, h3, d3) { + super(), this._element = e4, this._screenElement = t4, this._linkifier = i4, this._bufferService = s4, this._coreService = r3, this._mouseService = n3, this._optionsService = o3, this._renderService = h3, this._coreBrowserService = d3, this._dragScrollAmount = 0, this._enabled = true, this._workCell = new u2.CellData(), this._mouseDownTimeStamp = 0, this._oldHasSelection = false, this._oldSelectionStart = void 0, this._oldSelectionEnd = void 0, this._onLinuxMouseSelection = this.register(new c2.EventEmitter()), this.onLinuxMouseSelection = this._onLinuxMouseSelection.event, this._onRedrawRequest = this.register(new c2.EventEmitter()), this.onRequestRedraw = this._onRedrawRequest.event, this._onSelectionChange = this.register(new c2.EventEmitter()), this.onSelectionChange = this._onSelectionChange.event, this._onRequestScrollLines = this.register(new c2.EventEmitter()), this.onRequestScrollLines = this._onRequestScrollLines.event, this._mouseMoveListener = (e5) => this._handleMouseMove(e5), this._mouseUpListener = (e5) => this._handleMouseUp(e5), this._coreService.onUserInput(() => { this.hasSelection && this.clearSelection(); - }), this._trimListener = this._bufferService.buffer.lines.onTrim((e5) => this._handleTrim(e5)), this.register(this._bufferService.buffers.onBufferActivate((e5) => this._handleBufferActivate(e5))), this.enable(), this._model = new a.SelectionModel(this._bufferService), this._activeSelectionMode = 0, this.register((0, l.toDisposable)(() => { + }), this._trimListener = this._bufferService.buffer.lines.onTrim((e5) => this._handleTrim(e5)), this.register(this._bufferService.buffers.onBufferActivate((e5) => this._handleBufferActivate(e5))), this.enable(), this._model = new a2.SelectionModel(this._bufferService), this._activeSelectionMode = 0, this.register((0, l2.toDisposable)(() => { this._removeMouseDownListeners(); })); } @@ -159432,44 +187742,44 @@ WARNING: This link could potentially be dangerous`)) { get selectionText() { const e4 = this._model.finalSelectionStart, t4 = this._model.finalSelectionEnd; if (!e4 || !t4) return ""; - const i4 = this._bufferService.buffer, s3 = []; + const i4 = this._bufferService.buffer, s4 = []; if (3 === this._activeSelectionMode) { if (e4[0] === t4[0]) return ""; - const r2 = e4[0] < t4[0] ? e4[0] : t4[0], n2 = e4[0] < t4[0] ? t4[0] : e4[0]; - for (let o2 = e4[1]; o2 <= t4[1]; o2++) { - const e5 = i4.translateBufferLineToString(o2, true, r2, n2); - s3.push(e5); + const r3 = e4[0] < t4[0] ? e4[0] : t4[0], n3 = e4[0] < t4[0] ? t4[0] : e4[0]; + for (let o3 = e4[1]; o3 <= t4[1]; o3++) { + const e5 = i4.translateBufferLineToString(o3, true, r3, n3); + s4.push(e5); } } else { - const r2 = e4[1] === t4[1] ? t4[0] : void 0; - s3.push(i4.translateBufferLineToString(e4[1], true, e4[0], r2)); - for (let r3 = e4[1] + 1; r3 <= t4[1] - 1; r3++) { - const e5 = i4.lines.get(r3), t5 = i4.translateBufferLineToString(r3, true); - e5?.isWrapped ? s3[s3.length - 1] += t5 : s3.push(t5); + const r3 = e4[1] === t4[1] ? t4[0] : void 0; + s4.push(i4.translateBufferLineToString(e4[1], true, e4[0], r3)); + for (let r4 = e4[1] + 1; r4 <= t4[1] - 1; r4++) { + const e5 = i4.lines.get(r4), t5 = i4.translateBufferLineToString(r4, true); + e5?.isWrapped ? s4[s4.length - 1] += t5 : s4.push(t5); } if (e4[1] !== t4[1]) { - const e5 = i4.lines.get(t4[1]), r3 = i4.translateBufferLineToString(t4[1], true, 0, t4[0]); - e5 && e5.isWrapped ? s3[s3.length - 1] += r3 : s3.push(r3); + const e5 = i4.lines.get(t4[1]), r4 = i4.translateBufferLineToString(t4[1], true, 0, t4[0]); + e5 && e5.isWrapped ? s4[s4.length - 1] += r4 : s4.push(r4); } } - return s3.map((e5) => e5.replace(p2, " ")).join(d.isWindows ? "\r\n" : "\n"); + return s4.map((e5) => e5.replace(p2, " ")).join(d2.isWindows ? "\r\n" : "\n"); } clearSelection() { this._model.clearSelection(), this._removeMouseDownListeners(), this.refresh(), this._onSelectionChange.fire(); } refresh(e4) { - this._refreshAnimationFrame || (this._refreshAnimationFrame = this._coreBrowserService.window.requestAnimationFrame(() => this._refresh())), d.isLinux && e4 && this.selectionText.length && this._onLinuxMouseSelection.fire(this.selectionText); + this._refreshAnimationFrame || (this._refreshAnimationFrame = this._coreBrowserService.window.requestAnimationFrame(() => this._refresh())), d2.isLinux && e4 && this.selectionText.length && this._onLinuxMouseSelection.fire(this.selectionText); } _refresh() { this._refreshAnimationFrame = void 0, this._onRedrawRequest.fire({ start: this._model.finalSelectionStart, end: this._model.finalSelectionEnd, columnSelectMode: 3 === this._activeSelectionMode }); } _isClickInSelection(e4) { - const t4 = this._getMouseBufferCoords(e4), i4 = this._model.finalSelectionStart, s3 = this._model.finalSelectionEnd; - return !!(i4 && s3 && t4) && this._areCoordsInSelection(t4, i4, s3); + const t4 = this._getMouseBufferCoords(e4), i4 = this._model.finalSelectionStart, s4 = this._model.finalSelectionEnd; + return !!(i4 && s4 && t4) && this._areCoordsInSelection(t4, i4, s4); } isCellInSelection(e4, t4) { - const i4 = this._model.finalSelectionStart, s3 = this._model.finalSelectionEnd; - return !(!i4 || !s3) && this._areCoordsInSelection([e4, t4], i4, s3); + const i4 = this._model.finalSelectionStart, s4 = this._model.finalSelectionEnd; + return !(!i4 || !s4) && this._areCoordsInSelection([e4, t4], i4, s4); } _areCoordsInSelection(e4, t4, i4) { return e4[1] > t4[1] && e4[1] < i4[1] || t4[1] === i4[1] && e4[1] === t4[1] && e4[0] >= t4[0] && e4[0] < i4[0] || t4[1] < i4[1] && e4[1] === i4[1] && e4[0] < i4[0] || t4[1] < i4[1] && e4[1] === t4[1] && e4[0] >= t4[0]; @@ -159477,8 +187787,8 @@ WARNING: This link could potentially be dangerous`)) { _selectWordAtCursor(e4, t4) { const i4 = this._linkifier.currentLink?.link?.range; if (i4) return this._model.selectionStart = [i4.start.x - 1, i4.start.y - 1], this._model.selectionStartLength = (0, _2.getRangeLength)(i4, this._bufferService.cols), this._model.selectionEnd = void 0, true; - const s3 = this._getMouseBufferCoords(e4); - return !!s3 && (this._selectWordAt(s3, t4), this._model.selectionEnd = void 0, true); + const s4 = this._getMouseBufferCoords(e4); + return !!s4 && (this._selectWordAt(s4, t4), this._model.selectionEnd = void 0, true); } selectAll() { this._model.isSelectAllActive = true, this.refresh(), this._onSelectionChange.fire(); @@ -159494,12 +187804,12 @@ WARNING: This link could potentially be dangerous`)) { if (t4) return t4[0]--, t4[1]--, t4[1] += this._bufferService.buffer.ydisp, t4; } _getMouseEventScrollAmount(e4) { - let t4 = (0, n.getCoordsRelativeToElement)(this._coreBrowserService.window, e4, this._screenElement)[1]; + let t4 = (0, n2.getCoordsRelativeToElement)(this._coreBrowserService.window, e4, this._screenElement)[1]; const i4 = this._renderService.dimensions.css.canvas.height; return t4 >= 0 && t4 <= i4 ? 0 : (t4 > i4 && (t4 -= i4), t4 = Math.min(Math.max(t4, -50), 50), t4 /= 50, t4 / Math.abs(t4) + Math.round(14 * t4)); } shouldForceSelection(e4) { - return d.isMac ? e4.altKey && this._optionsService.rawOptions.macOptionClickForcesSelection : e4.shiftKey; + return d2.isMac ? e4.altKey && this._optionsService.rawOptions.macOptionClickForcesSelection : e4.shiftKey; } handleMouseDown(e4) { if (this._mouseDownTimeStamp = e4.timeStamp, (2 !== e4.button || !this.hasSelection) && 0 === e4.button) { @@ -159533,7 +187843,7 @@ WARNING: This link could potentially be dangerous`)) { t4 && (this._activeSelectionMode = 2, this._selectLineAt(t4[1])); } shouldColumnSelect(e4) { - return e4.altKey && !(d.isMac && this._optionsService.rawOptions.macOptionClickForcesSelection); + return e4.altKey && !(d2.isMac && this._optionsService.rawOptions.macOptionClickForcesSelection); } _handleMouseMove(e4) { if (e4.stopImmediatePropagation(), !this._model.selectionStart) return; @@ -159560,7 +187870,7 @@ WARNING: This link could potentially be dangerous`)) { if (this._bufferService.buffer.ybase === this._bufferService.buffer.ydisp) { const t5 = this._mouseService.getCoords(e4, this._element, this._bufferService.cols, this._bufferService.rows, false); if (t5 && void 0 !== t5[0] && void 0 !== t5[1]) { - const e5 = (0, o.moveToCellSequence)(t5[0] - 1, t5[1] - 1, this._bufferService, this._coreService.decPrivateModes.applicationCursorKeys); + const e5 = (0, o2.moveToCellSequence)(t5[0] - 1, t5[1] - 1, this._bufferService, this._coreService.decPrivateModes.applicationCursorKeys); this._coreService.triggerDataEvent(e5, true); } } @@ -159578,9 +187888,9 @@ WARNING: This link could potentially be dangerous`)) { } _convertViewportColToCharacterIndex(e4, t4) { let i4 = t4; - for (let s3 = 0; t4 >= s3; s3++) { - const r2 = e4.loadCell(s3, this._workCell).getChars().length; - 0 === this._workCell.getWidth() ? i4-- : r2 > 1 && t4 !== s3 && (i4 += r2 - 1); + for (let s4 = 0; t4 >= s4; s4++) { + const r3 = e4.loadCell(s4, this._workCell).getChars().length; + 0 === this._workCell.getWidth() ? i4-- : r3 > 1 && t4 !== s4 && (i4 += r3 - 1); } return i4; } @@ -159590,53 +187900,53 @@ WARNING: This link could potentially be dangerous`)) { rightClickSelect(e4) { this._isClickInSelection(e4) || (this._selectWordAtCursor(e4, false) && this.refresh(true), this._fireEventIfSelectionChanged()); } - _getWordAt(e4, t4, i4 = true, s3 = true) { + _getWordAt(e4, t4, i4 = true, s4 = true) { if (e4[0] >= this._bufferService.cols) return; - const r2 = this._bufferService.buffer, n2 = r2.lines.get(e4[1]); - if (!n2) return; - const o2 = r2.translateBufferLineToString(e4[1], false); - let a2 = this._convertViewportColToCharacterIndex(n2, e4[0]), h3 = a2; - const c2 = e4[0] - a2; - let l2 = 0, d2 = 0, _3 = 0, u2 = 0; - if (" " === o2.charAt(a2)) { - for (; a2 > 0 && " " === o2.charAt(a2 - 1); ) a2--; - for (; h3 < o2.length && " " === o2.charAt(h3 + 1); ) h3++; + const r3 = this._bufferService.buffer, n3 = r3.lines.get(e4[1]); + if (!n3) return; + const o3 = r3.translateBufferLineToString(e4[1], false); + let a3 = this._convertViewportColToCharacterIndex(n3, e4[0]), h3 = a3; + const c3 = e4[0] - a3; + let l3 = 0, d3 = 0, _3 = 0, u3 = 0; + if (" " === o3.charAt(a3)) { + for (; a3 > 0 && " " === o3.charAt(a3 - 1); ) a3--; + for (; h3 < o3.length && " " === o3.charAt(h3 + 1); ) h3++; } else { let t5 = e4[0], i5 = e4[0]; - 0 === n2.getWidth(t5) && (l2++, t5--), 2 === n2.getWidth(i5) && (d2++, i5++); - const s4 = n2.getString(i5).length; - for (s4 > 1 && (u2 += s4 - 1, h3 += s4 - 1); t5 > 0 && a2 > 0 && !this._isCharWordSeparator(n2.loadCell(t5 - 1, this._workCell)); ) { - n2.loadCell(t5 - 1, this._workCell); + 0 === n3.getWidth(t5) && (l3++, t5--), 2 === n3.getWidth(i5) && (d3++, i5++); + const s5 = n3.getString(i5).length; + for (s5 > 1 && (u3 += s5 - 1, h3 += s5 - 1); t5 > 0 && a3 > 0 && !this._isCharWordSeparator(n3.loadCell(t5 - 1, this._workCell)); ) { + n3.loadCell(t5 - 1, this._workCell); const e5 = this._workCell.getChars().length; - 0 === this._workCell.getWidth() ? (l2++, t5--) : e5 > 1 && (_3 += e5 - 1, a2 -= e5 - 1), a2--, t5--; + 0 === this._workCell.getWidth() ? (l3++, t5--) : e5 > 1 && (_3 += e5 - 1, a3 -= e5 - 1), a3--, t5--; } - for (; i5 < n2.length && h3 + 1 < o2.length && !this._isCharWordSeparator(n2.loadCell(i5 + 1, this._workCell)); ) { - n2.loadCell(i5 + 1, this._workCell); + for (; i5 < n3.length && h3 + 1 < o3.length && !this._isCharWordSeparator(n3.loadCell(i5 + 1, this._workCell)); ) { + n3.loadCell(i5 + 1, this._workCell); const e5 = this._workCell.getChars().length; - 2 === this._workCell.getWidth() ? (d2++, i5++) : e5 > 1 && (u2 += e5 - 1, h3 += e5 - 1), h3++, i5++; + 2 === this._workCell.getWidth() ? (d3++, i5++) : e5 > 1 && (u3 += e5 - 1, h3 += e5 - 1), h3++, i5++; } } h3++; - let f2 = a2 + c2 - l2 + _3, v3 = Math.min(this._bufferService.cols, h3 - a2 + l2 + d2 - _3 - u2); - if (t4 || "" !== o2.slice(a2, h3).trim()) { - if (i4 && 0 === f2 && 32 !== n2.getCodePoint(0)) { - const t5 = r2.lines.get(e4[1] - 1); - if (t5 && n2.isWrapped && 32 !== t5.getCodePoint(this._bufferService.cols - 1)) { + let f3 = a3 + c3 - l3 + _3, v3 = Math.min(this._bufferService.cols, h3 - a3 + l3 + d3 - _3 - u3); + if (t4 || "" !== o3.slice(a3, h3).trim()) { + if (i4 && 0 === f3 && 32 !== n3.getCodePoint(0)) { + const t5 = r3.lines.get(e4[1] - 1); + if (t5 && n3.isWrapped && 32 !== t5.getCodePoint(this._bufferService.cols - 1)) { const t6 = this._getWordAt([this._bufferService.cols - 1, e4[1] - 1], false, true, false); if (t6) { const e5 = this._bufferService.cols - t6.start; - f2 -= e5, v3 += e5; + f3 -= e5, v3 += e5; } } } - if (s3 && f2 + v3 === this._bufferService.cols && 32 !== n2.getCodePoint(this._bufferService.cols - 1)) { - const t5 = r2.lines.get(e4[1] + 1); + if (s4 && f3 + v3 === this._bufferService.cols && 32 !== n3.getCodePoint(this._bufferService.cols - 1)) { + const t5 = r3.lines.get(e4[1] + 1); if (t5?.isWrapped && 32 !== t5.getCodePoint(0)) { const t6 = this._getWordAt([0, e4[1] + 1], false, false, true); t6 && (v3 += t6.length); } } - return { start: f2, length: v3 }; + return { start: f3, length: v3 }; } } _selectWordAt(e4, t4) { @@ -159663,33 +187973,33 @@ WARNING: This link could potentially be dangerous`)) { this._model.selectionStart = [0, t4.first], this._model.selectionEnd = void 0, this._model.selectionStartLength = (0, _2.getRangeLength)(i4, this._bufferService.cols); } }; - t3.SelectionService = g2 = s2([r(3, f.IBufferService), r(4, f.ICoreService), r(5, h2.IMouseService), r(6, f.IOptionsService), r(7, h2.IRenderService), r(8, h2.ICoreBrowserService)], g2); + t3.SelectionService = g2 = s3([r2(3, f2.IBufferService), r2(4, f2.ICoreService), r2(5, h2.IMouseService), r2(6, f2.IOptionsService), r2(7, h2.IRenderService), r2(8, h2.ICoreBrowserService)], g2); }, 4725: (e3, t3, i3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.ILinkProviderService = t3.IThemeService = t3.ICharacterJoinerService = t3.ISelectionService = t3.IRenderService = t3.IMouseService = t3.ICoreBrowserService = t3.ICharSizeService = void 0; - const s2 = i3(8343); - t3.ICharSizeService = (0, s2.createDecorator)("CharSizeService"), t3.ICoreBrowserService = (0, s2.createDecorator)("CoreBrowserService"), t3.IMouseService = (0, s2.createDecorator)("MouseService"), t3.IRenderService = (0, s2.createDecorator)("RenderService"), t3.ISelectionService = (0, s2.createDecorator)("SelectionService"), t3.ICharacterJoinerService = (0, s2.createDecorator)("CharacterJoinerService"), t3.IThemeService = (0, s2.createDecorator)("ThemeService"), t3.ILinkProviderService = (0, s2.createDecorator)("LinkProviderService"); + const s3 = i3(8343); + t3.ICharSizeService = (0, s3.createDecorator)("CharSizeService"), t3.ICoreBrowserService = (0, s3.createDecorator)("CoreBrowserService"), t3.IMouseService = (0, s3.createDecorator)("MouseService"), t3.IRenderService = (0, s3.createDecorator)("RenderService"), t3.ISelectionService = (0, s3.createDecorator)("SelectionService"), t3.ICharacterJoinerService = (0, s3.createDecorator)("CharacterJoinerService"), t3.IThemeService = (0, s3.createDecorator)("ThemeService"), t3.ILinkProviderService = (0, s3.createDecorator)("LinkProviderService"); }, 6731: function(e3, t3, i3) { - var s2 = this && this.__decorate || function(e4, t4, i4, s3) { - var r2, n2 = arguments.length, o2 = n2 < 3 ? t4 : null === s3 ? s3 = Object.getOwnPropertyDescriptor(t4, i4) : s3; - if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o2 = Reflect.decorate(e4, t4, i4, s3); - else for (var a2 = e4.length - 1; a2 >= 0; a2--) (r2 = e4[a2]) && (o2 = (n2 < 3 ? r2(o2) : n2 > 3 ? r2(t4, i4, o2) : r2(t4, i4)) || o2); - return n2 > 3 && o2 && Object.defineProperty(t4, i4, o2), o2; - }, r = this && this.__param || function(e4, t4) { - return function(i4, s3) { - t4(i4, s3, e4); + var s3 = this && this.__decorate || function(e4, t4, i4, s4) { + var r3, n3 = arguments.length, o3 = n3 < 3 ? t4 : null === s4 ? s4 = Object.getOwnPropertyDescriptor(t4, i4) : s4; + if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o3 = Reflect.decorate(e4, t4, i4, s4); + else for (var a3 = e4.length - 1; a3 >= 0; a3--) (r3 = e4[a3]) && (o3 = (n3 < 3 ? r3(o3) : n3 > 3 ? r3(t4, i4, o3) : r3(t4, i4)) || o3); + return n3 > 3 && o3 && Object.defineProperty(t4, i4, o3), o3; + }, r2 = this && this.__param || function(e4, t4) { + return function(i4, s4) { + t4(i4, s4, e4); }; }; Object.defineProperty(t3, "__esModule", { value: true }), t3.ThemeService = t3.DEFAULT_ANSI_COLORS = void 0; - const n = i3(7239), o = i3(8055), a = i3(8460), h2 = i3(844), c = i3(2585), l = o.css.toColor("#ffffff"), d = o.css.toColor("#000000"), _2 = o.css.toColor("#ffffff"), u = o.css.toColor("#000000"), f = { css: "rgba(255, 255, 255, 0.3)", rgba: 4294967117 }; + const n2 = i3(7239), o2 = i3(8055), a2 = i3(8460), h2 = i3(844), c2 = i3(2585), l2 = o2.css.toColor("#ffffff"), d2 = o2.css.toColor("#000000"), _2 = o2.css.toColor("#ffffff"), u2 = o2.css.toColor("#000000"), f2 = { css: "rgba(255, 255, 255, 0.3)", rgba: 4294967117 }; t3.DEFAULT_ANSI_COLORS = Object.freeze((() => { - const e4 = [o.css.toColor("#2e3436"), o.css.toColor("#cc0000"), o.css.toColor("#4e9a06"), o.css.toColor("#c4a000"), o.css.toColor("#3465a4"), o.css.toColor("#75507b"), o.css.toColor("#06989a"), o.css.toColor("#d3d7cf"), o.css.toColor("#555753"), o.css.toColor("#ef2929"), o.css.toColor("#8ae234"), o.css.toColor("#fce94f"), o.css.toColor("#729fcf"), o.css.toColor("#ad7fa8"), o.css.toColor("#34e2e2"), o.css.toColor("#eeeeec")], t4 = [0, 95, 135, 175, 215, 255]; + const e4 = [o2.css.toColor("#2e3436"), o2.css.toColor("#cc0000"), o2.css.toColor("#4e9a06"), o2.css.toColor("#c4a000"), o2.css.toColor("#3465a4"), o2.css.toColor("#75507b"), o2.css.toColor("#06989a"), o2.css.toColor("#d3d7cf"), o2.css.toColor("#555753"), o2.css.toColor("#ef2929"), o2.css.toColor("#8ae234"), o2.css.toColor("#fce94f"), o2.css.toColor("#729fcf"), o2.css.toColor("#ad7fa8"), o2.css.toColor("#34e2e2"), o2.css.toColor("#eeeeec")], t4 = [0, 95, 135, 175, 215, 255]; for (let i4 = 0; i4 < 216; i4++) { - const s3 = t4[i4 / 36 % 6 | 0], r2 = t4[i4 / 6 % 6 | 0], n2 = t4[i4 % 6]; - e4.push({ css: o.channels.toCss(s3, r2, n2), rgba: o.channels.toRgba(s3, r2, n2) }); + const s4 = t4[i4 / 36 % 6 | 0], r3 = t4[i4 / 6 % 6 | 0], n3 = t4[i4 % 6]; + e4.push({ css: o2.channels.toCss(s4, r3, n3), rgba: o2.channels.toRgba(s4, r3, n3) }); } for (let t5 = 0; t5 < 24; t5++) { const i4 = 8 + 10 * t5; - e4.push({ css: o.channels.toCss(i4, i4, i4), rgba: o.channels.toRgba(i4, i4, i4) }); + e4.push({ css: o2.channels.toCss(i4, i4, i4), rgba: o2.channels.toRgba(i4, i4, i4) }); } return e4; })()); @@ -159698,21 +188008,21 @@ WARNING: This link could potentially be dangerous`)) { return this._colors; } constructor(e4) { - super(), this._optionsService = e4, this._contrastCache = new n.ColorContrastCache(), this._halfContrastCache = new n.ColorContrastCache(), this._onChangeColors = this.register(new a.EventEmitter()), this.onChangeColors = this._onChangeColors.event, this._colors = { foreground: l, background: d, cursor: _2, cursorAccent: u, selectionForeground: void 0, selectionBackgroundTransparent: f, selectionBackgroundOpaque: o.color.blend(d, f), selectionInactiveBackgroundTransparent: f, selectionInactiveBackgroundOpaque: o.color.blend(d, f), ansi: t3.DEFAULT_ANSI_COLORS.slice(), contrastCache: this._contrastCache, halfContrastCache: this._halfContrastCache }, this._updateRestoreColors(), this._setTheme(this._optionsService.rawOptions.theme), this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio", () => this._contrastCache.clear())), this.register(this._optionsService.onSpecificOptionChange("theme", () => this._setTheme(this._optionsService.rawOptions.theme))); + super(), this._optionsService = e4, this._contrastCache = new n2.ColorContrastCache(), this._halfContrastCache = new n2.ColorContrastCache(), this._onChangeColors = this.register(new a2.EventEmitter()), this.onChangeColors = this._onChangeColors.event, this._colors = { foreground: l2, background: d2, cursor: _2, cursorAccent: u2, selectionForeground: void 0, selectionBackgroundTransparent: f2, selectionBackgroundOpaque: o2.color.blend(d2, f2), selectionInactiveBackgroundTransparent: f2, selectionInactiveBackgroundOpaque: o2.color.blend(d2, f2), ansi: t3.DEFAULT_ANSI_COLORS.slice(), contrastCache: this._contrastCache, halfContrastCache: this._halfContrastCache }, this._updateRestoreColors(), this._setTheme(this._optionsService.rawOptions.theme), this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio", () => this._contrastCache.clear())), this.register(this._optionsService.onSpecificOptionChange("theme", () => this._setTheme(this._optionsService.rawOptions.theme))); } _setTheme(e4 = {}) { const i4 = this._colors; - if (i4.foreground = p2(e4.foreground, l), i4.background = p2(e4.background, d), i4.cursor = p2(e4.cursor, _2), i4.cursorAccent = p2(e4.cursorAccent, u), i4.selectionBackgroundTransparent = p2(e4.selectionBackground, f), i4.selectionBackgroundOpaque = o.color.blend(i4.background, i4.selectionBackgroundTransparent), i4.selectionInactiveBackgroundTransparent = p2(e4.selectionInactiveBackground, i4.selectionBackgroundTransparent), i4.selectionInactiveBackgroundOpaque = o.color.blend(i4.background, i4.selectionInactiveBackgroundTransparent), i4.selectionForeground = e4.selectionForeground ? p2(e4.selectionForeground, o.NULL_COLOR) : void 0, i4.selectionForeground === o.NULL_COLOR && (i4.selectionForeground = void 0), o.color.isOpaque(i4.selectionBackgroundTransparent)) { + if (i4.foreground = p2(e4.foreground, l2), i4.background = p2(e4.background, d2), i4.cursor = p2(e4.cursor, _2), i4.cursorAccent = p2(e4.cursorAccent, u2), i4.selectionBackgroundTransparent = p2(e4.selectionBackground, f2), i4.selectionBackgroundOpaque = o2.color.blend(i4.background, i4.selectionBackgroundTransparent), i4.selectionInactiveBackgroundTransparent = p2(e4.selectionInactiveBackground, i4.selectionBackgroundTransparent), i4.selectionInactiveBackgroundOpaque = o2.color.blend(i4.background, i4.selectionInactiveBackgroundTransparent), i4.selectionForeground = e4.selectionForeground ? p2(e4.selectionForeground, o2.NULL_COLOR) : void 0, i4.selectionForeground === o2.NULL_COLOR && (i4.selectionForeground = void 0), o2.color.isOpaque(i4.selectionBackgroundTransparent)) { const e5 = 0.3; - i4.selectionBackgroundTransparent = o.color.opacity(i4.selectionBackgroundTransparent, e5); + i4.selectionBackgroundTransparent = o2.color.opacity(i4.selectionBackgroundTransparent, e5); } - if (o.color.isOpaque(i4.selectionInactiveBackgroundTransparent)) { + if (o2.color.isOpaque(i4.selectionInactiveBackgroundTransparent)) { const e5 = 0.3; - i4.selectionInactiveBackgroundTransparent = o.color.opacity(i4.selectionInactiveBackgroundTransparent, e5); + i4.selectionInactiveBackgroundTransparent = o2.color.opacity(i4.selectionInactiveBackgroundTransparent, e5); } if (i4.ansi = t3.DEFAULT_ANSI_COLORS.slice(), i4.ansi[0] = p2(e4.black, t3.DEFAULT_ANSI_COLORS[0]), i4.ansi[1] = p2(e4.red, t3.DEFAULT_ANSI_COLORS[1]), i4.ansi[2] = p2(e4.green, t3.DEFAULT_ANSI_COLORS[2]), i4.ansi[3] = p2(e4.yellow, t3.DEFAULT_ANSI_COLORS[3]), i4.ansi[4] = p2(e4.blue, t3.DEFAULT_ANSI_COLORS[4]), i4.ansi[5] = p2(e4.magenta, t3.DEFAULT_ANSI_COLORS[5]), i4.ansi[6] = p2(e4.cyan, t3.DEFAULT_ANSI_COLORS[6]), i4.ansi[7] = p2(e4.white, t3.DEFAULT_ANSI_COLORS[7]), i4.ansi[8] = p2(e4.brightBlack, t3.DEFAULT_ANSI_COLORS[8]), i4.ansi[9] = p2(e4.brightRed, t3.DEFAULT_ANSI_COLORS[9]), i4.ansi[10] = p2(e4.brightGreen, t3.DEFAULT_ANSI_COLORS[10]), i4.ansi[11] = p2(e4.brightYellow, t3.DEFAULT_ANSI_COLORS[11]), i4.ansi[12] = p2(e4.brightBlue, t3.DEFAULT_ANSI_COLORS[12]), i4.ansi[13] = p2(e4.brightMagenta, t3.DEFAULT_ANSI_COLORS[13]), i4.ansi[14] = p2(e4.brightCyan, t3.DEFAULT_ANSI_COLORS[14]), i4.ansi[15] = p2(e4.brightWhite, t3.DEFAULT_ANSI_COLORS[15]), e4.extendedAnsi) { - const s3 = Math.min(i4.ansi.length - 16, e4.extendedAnsi.length); - for (let r2 = 0; r2 < s3; r2++) i4.ansi[r2 + 16] = p2(e4.extendedAnsi[r2], t3.DEFAULT_ANSI_COLORS[r2 + 16]); + const s4 = Math.min(i4.ansi.length - 16, e4.extendedAnsi.length); + for (let r3 = 0; r3 < s4; r3++) i4.ansi[r3 + 16] = p2(e4.extendedAnsi[r3], t3.DEFAULT_ANSI_COLORS[r3 + 16]); } this._contrastCache.clear(), this._halfContrastCache.clear(), this._updateRestoreColors(), this._onChangeColors.fire(this.colors); } @@ -159744,22 +188054,22 @@ WARNING: This link could potentially be dangerous`)) { }; function p2(e4, t4) { if (void 0 !== e4) try { - return o.css.toColor(e4); + return o2.css.toColor(e4); } catch { } return t4; } __name(p2, "p"); - t3.ThemeService = v2 = s2([r(0, c.IOptionsService)], v2); + t3.ThemeService = v2 = s3([r2(0, c2.IOptionsService)], v2); }, 6349: (e3, t3, i3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.CircularList = void 0; - const s2 = i3(8460), r = i3(844); - class n extends r.Disposable { + const s3 = i3(8460), r2 = i3(844); + class n2 extends r2.Disposable { static { __name(this, "n"); } constructor(e4) { - super(), this._maxLength = e4, this.onDeleteEmitter = this.register(new s2.EventEmitter()), this.onDelete = this.onDeleteEmitter.event, this.onInsertEmitter = this.register(new s2.EventEmitter()), this.onInsert = this.onInsertEmitter.event, this.onTrimEmitter = this.register(new s2.EventEmitter()), this.onTrim = this.onTrimEmitter.event, this._array = new Array(this._maxLength), this._startIndex = 0, this._length = 0; + super(), this._maxLength = e4, this.onDeleteEmitter = this.register(new s3.EventEmitter()), this.onDelete = this.onDeleteEmitter.event, this.onInsertEmitter = this.register(new s3.EventEmitter()), this.onInsert = this.onInsertEmitter.event, this.onTrimEmitter = this.register(new s3.EventEmitter()), this.onTrim = this.onTrimEmitter.event, this._array = new Array(this._maxLength), this._startIndex = 0, this._length = 0; } get maxLength() { return this._maxLength; @@ -159816,154 +188126,154 @@ WARNING: This link could potentially be dangerous`)) { if (e4 < 0 || e4 >= this._length) throw new Error("start argument out of range"); if (e4 + i4 < 0) throw new Error("Cannot shift elements in list beyond index 0"); if (i4 > 0) { - for (let s4 = t4 - 1; s4 >= 0; s4--) this.set(e4 + s4 + i4, this.get(e4 + s4)); - const s3 = e4 + t4 + i4 - this._length; - if (s3 > 0) for (this._length += s3; this._length > this._maxLength; ) this._length--, this._startIndex++, this.onTrimEmitter.fire(1); - } else for (let s3 = 0; s3 < t4; s3++) this.set(e4 + s3 + i4, this.get(e4 + s3)); + for (let s5 = t4 - 1; s5 >= 0; s5--) this.set(e4 + s5 + i4, this.get(e4 + s5)); + const s4 = e4 + t4 + i4 - this._length; + if (s4 > 0) for (this._length += s4; this._length > this._maxLength; ) this._length--, this._startIndex++, this.onTrimEmitter.fire(1); + } else for (let s4 = 0; s4 < t4; s4++) this.set(e4 + s4 + i4, this.get(e4 + s4)); } } _getCyclicIndex(e4) { return (this._startIndex + e4) % this._maxLength; } } - t3.CircularList = n; + t3.CircularList = n2; }, 1439: (e3, t3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.clone = void 0, t3.clone = /* @__PURE__ */ __name(function e4(t4, i3 = 5) { if ("object" != typeof t4) return t4; - const s2 = Array.isArray(t4) ? [] : {}; - for (const r in t4) s2[r] = i3 <= 1 ? t4[r] : t4[r] && e4(t4[r], i3 - 1); - return s2; + const s3 = Array.isArray(t4) ? [] : {}; + for (const r2 in t4) s3[r2] = i3 <= 1 ? t4[r2] : t4[r2] && e4(t4[r2], i3 - 1); + return s3; }, "e"); }, 8055: (e3, t3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.contrastRatio = t3.toPaddedHex = t3.rgba = t3.rgb = t3.css = t3.color = t3.channels = t3.NULL_COLOR = void 0; - let i3 = 0, s2 = 0, r = 0, n = 0; - var o, a, h2, c, l; - function d(e4) { + let i3 = 0, s3 = 0, r2 = 0, n2 = 0; + var o2, a2, h2, c2, l2; + function d2(e4) { const t4 = e4.toString(16); return t4.length < 2 ? "0" + t4 : t4; } - __name(d, "d"); + __name(d2, "d"); function _2(e4, t4) { return e4 < t4 ? (t4 + 0.05) / (e4 + 0.05) : (e4 + 0.05) / (t4 + 0.05); } __name(_2, "_"); t3.NULL_COLOR = { css: "#00000000", rgba: 0 }, function(e4) { - e4.toCss = function(e5, t4, i4, s3) { - return void 0 !== s3 ? `#${d(e5)}${d(t4)}${d(i4)}${d(s3)}` : `#${d(e5)}${d(t4)}${d(i4)}`; - }, e4.toRgba = function(e5, t4, i4, s3 = 255) { - return (e5 << 24 | t4 << 16 | i4 << 8 | s3) >>> 0; - }, e4.toColor = function(t4, i4, s3, r2) { - return { css: e4.toCss(t4, i4, s3, r2), rgba: e4.toRgba(t4, i4, s3, r2) }; + e4.toCss = function(e5, t4, i4, s4) { + return void 0 !== s4 ? `#${d2(e5)}${d2(t4)}${d2(i4)}${d2(s4)}` : `#${d2(e5)}${d2(t4)}${d2(i4)}`; + }, e4.toRgba = function(e5, t4, i4, s4 = 255) { + return (e5 << 24 | t4 << 16 | i4 << 8 | s4) >>> 0; + }, e4.toColor = function(t4, i4, s4, r3) { + return { css: e4.toCss(t4, i4, s4, r3), rgba: e4.toRgba(t4, i4, s4, r3) }; }; - }(o || (t3.channels = o = {})), function(e4) { + }(o2 || (t3.channels = o2 = {})), function(e4) { function t4(e5, t5) { - return n = Math.round(255 * t5), [i3, s2, r] = l.toChannels(e5.rgba), { css: o.toCss(i3, s2, r, n), rgba: o.toRgba(i3, s2, r, n) }; + return n2 = Math.round(255 * t5), [i3, s3, r2] = l2.toChannels(e5.rgba), { css: o2.toCss(i3, s3, r2, n2), rgba: o2.toRgba(i3, s3, r2, n2) }; } __name(t4, "t"); e4.blend = function(e5, t5) { - if (n = (255 & t5.rgba) / 255, 1 === n) return { css: t5.css, rgba: t5.rgba }; - const a2 = t5.rgba >> 24 & 255, h3 = t5.rgba >> 16 & 255, c2 = t5.rgba >> 8 & 255, l2 = e5.rgba >> 24 & 255, d2 = e5.rgba >> 16 & 255, _3 = e5.rgba >> 8 & 255; - return i3 = l2 + Math.round((a2 - l2) * n), s2 = d2 + Math.round((h3 - d2) * n), r = _3 + Math.round((c2 - _3) * n), { css: o.toCss(i3, s2, r), rgba: o.toRgba(i3, s2, r) }; + if (n2 = (255 & t5.rgba) / 255, 1 === n2) return { css: t5.css, rgba: t5.rgba }; + const a3 = t5.rgba >> 24 & 255, h3 = t5.rgba >> 16 & 255, c3 = t5.rgba >> 8 & 255, l3 = e5.rgba >> 24 & 255, d3 = e5.rgba >> 16 & 255, _3 = e5.rgba >> 8 & 255; + return i3 = l3 + Math.round((a3 - l3) * n2), s3 = d3 + Math.round((h3 - d3) * n2), r2 = _3 + Math.round((c3 - _3) * n2), { css: o2.toCss(i3, s3, r2), rgba: o2.toRgba(i3, s3, r2) }; }, e4.isOpaque = function(e5) { return 255 == (255 & e5.rgba); }, e4.ensureContrastRatio = function(e5, t5, i4) { - const s3 = l.ensureContrastRatio(e5.rgba, t5.rgba, i4); - if (s3) return o.toColor(s3 >> 24 & 255, s3 >> 16 & 255, s3 >> 8 & 255); + const s4 = l2.ensureContrastRatio(e5.rgba, t5.rgba, i4); + if (s4) return o2.toColor(s4 >> 24 & 255, s4 >> 16 & 255, s4 >> 8 & 255); }, e4.opaque = function(e5) { const t5 = (255 | e5.rgba) >>> 0; - return [i3, s2, r] = l.toChannels(t5), { css: o.toCss(i3, s2, r), rgba: t5 }; + return [i3, s3, r2] = l2.toChannels(t5), { css: o2.toCss(i3, s3, r2), rgba: t5 }; }, e4.opacity = t4, e4.multiplyOpacity = function(e5, i4) { - return n = 255 & e5.rgba, t4(e5, n * i4 / 255); + return n2 = 255 & e5.rgba, t4(e5, n2 * i4 / 255); }, e4.toColorRGB = function(e5) { return [e5.rgba >> 24 & 255, e5.rgba >> 16 & 255, e5.rgba >> 8 & 255]; }; - }(a || (t3.color = a = {})), function(e4) { - let t4, a2; + }(a2 || (t3.color = a2 = {})), function(e4) { + let t4, a3; try { const e5 = document.createElement("canvas"); e5.width = 1, e5.height = 1; const i4 = e5.getContext("2d", { willReadFrequently: true }); - i4 && (t4 = i4, t4.globalCompositeOperation = "copy", a2 = t4.createLinearGradient(0, 0, 1, 1)); + i4 && (t4 = i4, t4.globalCompositeOperation = "copy", a3 = t4.createLinearGradient(0, 0, 1, 1)); } catch { } e4.toColor = function(e5) { if (e5.match(/#[\da-f]{3,8}/i)) switch (e5.length) { case 4: - return i3 = parseInt(e5.slice(1, 2).repeat(2), 16), s2 = parseInt(e5.slice(2, 3).repeat(2), 16), r = parseInt(e5.slice(3, 4).repeat(2), 16), o.toColor(i3, s2, r); + return i3 = parseInt(e5.slice(1, 2).repeat(2), 16), s3 = parseInt(e5.slice(2, 3).repeat(2), 16), r2 = parseInt(e5.slice(3, 4).repeat(2), 16), o2.toColor(i3, s3, r2); case 5: - return i3 = parseInt(e5.slice(1, 2).repeat(2), 16), s2 = parseInt(e5.slice(2, 3).repeat(2), 16), r = parseInt(e5.slice(3, 4).repeat(2), 16), n = parseInt(e5.slice(4, 5).repeat(2), 16), o.toColor(i3, s2, r, n); + return i3 = parseInt(e5.slice(1, 2).repeat(2), 16), s3 = parseInt(e5.slice(2, 3).repeat(2), 16), r2 = parseInt(e5.slice(3, 4).repeat(2), 16), n2 = parseInt(e5.slice(4, 5).repeat(2), 16), o2.toColor(i3, s3, r2, n2); case 7: return { css: e5, rgba: (parseInt(e5.slice(1), 16) << 8 | 255) >>> 0 }; case 9: return { css: e5, rgba: parseInt(e5.slice(1), 16) >>> 0 }; } const h3 = e5.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/); - if (h3) return i3 = parseInt(h3[1]), s2 = parseInt(h3[2]), r = parseInt(h3[3]), n = Math.round(255 * (void 0 === h3[5] ? 1 : parseFloat(h3[5]))), o.toColor(i3, s2, r, n); - if (!t4 || !a2) throw new Error("css.toColor: Unsupported css format"); - if (t4.fillStyle = a2, t4.fillStyle = e5, "string" != typeof t4.fillStyle) throw new Error("css.toColor: Unsupported css format"); - if (t4.fillRect(0, 0, 1, 1), [i3, s2, r, n] = t4.getImageData(0, 0, 1, 1).data, 255 !== n) throw new Error("css.toColor: Unsupported css format"); - return { rgba: o.toRgba(i3, s2, r, n), css: e5 }; + if (h3) return i3 = parseInt(h3[1]), s3 = parseInt(h3[2]), r2 = parseInt(h3[3]), n2 = Math.round(255 * (void 0 === h3[5] ? 1 : parseFloat(h3[5]))), o2.toColor(i3, s3, r2, n2); + if (!t4 || !a3) throw new Error("css.toColor: Unsupported css format"); + if (t4.fillStyle = a3, t4.fillStyle = e5, "string" != typeof t4.fillStyle) throw new Error("css.toColor: Unsupported css format"); + if (t4.fillRect(0, 0, 1, 1), [i3, s3, r2, n2] = t4.getImageData(0, 0, 1, 1).data, 255 !== n2) throw new Error("css.toColor: Unsupported css format"); + return { rgba: o2.toRgba(i3, s3, r2, n2), css: e5 }; }; }(h2 || (t3.css = h2 = {})), function(e4) { function t4(e5, t5, i4) { - const s3 = e5 / 255, r2 = t5 / 255, n2 = i4 / 255; - return 0.2126 * (s3 <= 0.03928 ? s3 / 12.92 : Math.pow((s3 + 0.055) / 1.055, 2.4)) + 0.7152 * (r2 <= 0.03928 ? r2 / 12.92 : Math.pow((r2 + 0.055) / 1.055, 2.4)) + 0.0722 * (n2 <= 0.03928 ? n2 / 12.92 : Math.pow((n2 + 0.055) / 1.055, 2.4)); + const s4 = e5 / 255, r3 = t5 / 255, n3 = i4 / 255; + return 0.2126 * (s4 <= 0.03928 ? s4 / 12.92 : Math.pow((s4 + 0.055) / 1.055, 2.4)) + 0.7152 * (r3 <= 0.03928 ? r3 / 12.92 : Math.pow((r3 + 0.055) / 1.055, 2.4)) + 0.0722 * (n3 <= 0.03928 ? n3 / 12.92 : Math.pow((n3 + 0.055) / 1.055, 2.4)); } __name(t4, "t"); e4.relativeLuminance = function(e5) { return t4(e5 >> 16 & 255, e5 >> 8 & 255, 255 & e5); }, e4.relativeLuminance2 = t4; - }(c || (t3.rgb = c = {})), function(e4) { + }(c2 || (t3.rgb = c2 = {})), function(e4) { function t4(e5, t5, i4) { - const s3 = e5 >> 24 & 255, r2 = e5 >> 16 & 255, n2 = e5 >> 8 & 255; - let o2 = t5 >> 24 & 255, a3 = t5 >> 16 & 255, h3 = t5 >> 8 & 255, l2 = _2(c.relativeLuminance2(o2, a3, h3), c.relativeLuminance2(s3, r2, n2)); - for (; l2 < i4 && (o2 > 0 || a3 > 0 || h3 > 0); ) o2 -= Math.max(0, Math.ceil(0.1 * o2)), a3 -= Math.max(0, Math.ceil(0.1 * a3)), h3 -= Math.max(0, Math.ceil(0.1 * h3)), l2 = _2(c.relativeLuminance2(o2, a3, h3), c.relativeLuminance2(s3, r2, n2)); - return (o2 << 24 | a3 << 16 | h3 << 8 | 255) >>> 0; + const s4 = e5 >> 24 & 255, r3 = e5 >> 16 & 255, n3 = e5 >> 8 & 255; + let o3 = t5 >> 24 & 255, a4 = t5 >> 16 & 255, h3 = t5 >> 8 & 255, l3 = _2(c2.relativeLuminance2(o3, a4, h3), c2.relativeLuminance2(s4, r3, n3)); + for (; l3 < i4 && (o3 > 0 || a4 > 0 || h3 > 0); ) o3 -= Math.max(0, Math.ceil(0.1 * o3)), a4 -= Math.max(0, Math.ceil(0.1 * a4)), h3 -= Math.max(0, Math.ceil(0.1 * h3)), l3 = _2(c2.relativeLuminance2(o3, a4, h3), c2.relativeLuminance2(s4, r3, n3)); + return (o3 << 24 | a4 << 16 | h3 << 8 | 255) >>> 0; } __name(t4, "t"); - function a2(e5, t5, i4) { - const s3 = e5 >> 24 & 255, r2 = e5 >> 16 & 255, n2 = e5 >> 8 & 255; - let o2 = t5 >> 24 & 255, a3 = t5 >> 16 & 255, h3 = t5 >> 8 & 255, l2 = _2(c.relativeLuminance2(o2, a3, h3), c.relativeLuminance2(s3, r2, n2)); - for (; l2 < i4 && (o2 < 255 || a3 < 255 || h3 < 255); ) o2 = Math.min(255, o2 + Math.ceil(0.1 * (255 - o2))), a3 = Math.min(255, a3 + Math.ceil(0.1 * (255 - a3))), h3 = Math.min(255, h3 + Math.ceil(0.1 * (255 - h3))), l2 = _2(c.relativeLuminance2(o2, a3, h3), c.relativeLuminance2(s3, r2, n2)); - return (o2 << 24 | a3 << 16 | h3 << 8 | 255) >>> 0; + function a3(e5, t5, i4) { + const s4 = e5 >> 24 & 255, r3 = e5 >> 16 & 255, n3 = e5 >> 8 & 255; + let o3 = t5 >> 24 & 255, a4 = t5 >> 16 & 255, h3 = t5 >> 8 & 255, l3 = _2(c2.relativeLuminance2(o3, a4, h3), c2.relativeLuminance2(s4, r3, n3)); + for (; l3 < i4 && (o3 < 255 || a4 < 255 || h3 < 255); ) o3 = Math.min(255, o3 + Math.ceil(0.1 * (255 - o3))), a4 = Math.min(255, a4 + Math.ceil(0.1 * (255 - a4))), h3 = Math.min(255, h3 + Math.ceil(0.1 * (255 - h3))), l3 = _2(c2.relativeLuminance2(o3, a4, h3), c2.relativeLuminance2(s4, r3, n3)); + return (o3 << 24 | a4 << 16 | h3 << 8 | 255) >>> 0; } - __name(a2, "a"); + __name(a3, "a"); e4.blend = function(e5, t5) { - if (n = (255 & t5) / 255, 1 === n) return t5; - const a3 = t5 >> 24 & 255, h3 = t5 >> 16 & 255, c2 = t5 >> 8 & 255, l2 = e5 >> 24 & 255, d2 = e5 >> 16 & 255, _3 = e5 >> 8 & 255; - return i3 = l2 + Math.round((a3 - l2) * n), s2 = d2 + Math.round((h3 - d2) * n), r = _3 + Math.round((c2 - _3) * n), o.toRgba(i3, s2, r); - }, e4.ensureContrastRatio = function(e5, i4, s3) { - const r2 = c.relativeLuminance(e5 >> 8), n2 = c.relativeLuminance(i4 >> 8); - if (_2(r2, n2) < s3) { - if (n2 < r2) { - const n3 = t4(e5, i4, s3), o3 = _2(r2, c.relativeLuminance(n3 >> 8)); - if (o3 < s3) { - const t5 = a2(e5, i4, s3); - return o3 > _2(r2, c.relativeLuminance(t5 >> 8)) ? n3 : t5; + if (n2 = (255 & t5) / 255, 1 === n2) return t5; + const a4 = t5 >> 24 & 255, h3 = t5 >> 16 & 255, c3 = t5 >> 8 & 255, l3 = e5 >> 24 & 255, d3 = e5 >> 16 & 255, _3 = e5 >> 8 & 255; + return i3 = l3 + Math.round((a4 - l3) * n2), s3 = d3 + Math.round((h3 - d3) * n2), r2 = _3 + Math.round((c3 - _3) * n2), o2.toRgba(i3, s3, r2); + }, e4.ensureContrastRatio = function(e5, i4, s4) { + const r3 = c2.relativeLuminance(e5 >> 8), n3 = c2.relativeLuminance(i4 >> 8); + if (_2(r3, n3) < s4) { + if (n3 < r3) { + const n4 = t4(e5, i4, s4), o4 = _2(r3, c2.relativeLuminance(n4 >> 8)); + if (o4 < s4) { + const t5 = a3(e5, i4, s4); + return o4 > _2(r3, c2.relativeLuminance(t5 >> 8)) ? n4 : t5; } - return n3; + return n4; } - const o2 = a2(e5, i4, s3), h3 = _2(r2, c.relativeLuminance(o2 >> 8)); - if (h3 < s3) { - const n3 = t4(e5, i4, s3); - return h3 > _2(r2, c.relativeLuminance(n3 >> 8)) ? o2 : n3; + const o3 = a3(e5, i4, s4), h3 = _2(r3, c2.relativeLuminance(o3 >> 8)); + if (h3 < s4) { + const n4 = t4(e5, i4, s4); + return h3 > _2(r3, c2.relativeLuminance(n4 >> 8)) ? o3 : n4; } - return o2; + return o3; } - }, e4.reduceLuminance = t4, e4.increaseLuminance = a2, e4.toChannels = function(e5) { + }, e4.reduceLuminance = t4, e4.increaseLuminance = a3, e4.toChannels = function(e5) { return [e5 >> 24 & 255, e5 >> 16 & 255, e5 >> 8 & 255, 255 & e5]; }; - }(l || (t3.rgba = l = {})), t3.toPaddedHex = d, t3.contrastRatio = _2; + }(l2 || (t3.rgba = l2 = {})), t3.toPaddedHex = d2, t3.contrastRatio = _2; }, 8969: (e3, t3, i3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.CoreTerminal = void 0; - const s2 = i3(844), r = i3(2585), n = i3(4348), o = i3(7866), a = i3(744), h2 = i3(7302), c = i3(6975), l = i3(8460), d = i3(1753), _2 = i3(1480), u = i3(7994), f = i3(9282), v2 = i3(5435), p2 = i3(5981), g2 = i3(2660); - let m = false; - class S extends s2.Disposable { + const s3 = i3(844), r2 = i3(2585), n2 = i3(4348), o2 = i3(7866), a2 = i3(744), h2 = i3(7302), c2 = i3(6975), l2 = i3(8460), d2 = i3(1753), _2 = i3(1480), u2 = i3(7994), f2 = i3(9282), v2 = i3(5435), p2 = i3(5981), g2 = i3(2660); + let m2 = false; + class S2 extends s3.Disposable { static { __name(this, "S"); } get onScroll() { - return this._onScrollApi || (this._onScrollApi = this.register(new l.EventEmitter()), this._onScroll.event((e4) => { + return this._onScrollApi || (this._onScrollApi = this.register(new l2.EventEmitter()), this._onScroll.event((e4) => { this._onScrollApi?.fire(e4.position); })), this._onScrollApi.event; } @@ -159983,23 +188293,23 @@ WARNING: This link could potentially be dangerous`)) { for (const t4 in e4) this.optionsService.options[t4] = e4[t4]; } constructor(e4) { - super(), this._windowsWrappingHeuristics = this.register(new s2.MutableDisposable()), this._onBinary = this.register(new l.EventEmitter()), this.onBinary = this._onBinary.event, this._onData = this.register(new l.EventEmitter()), this.onData = this._onData.event, this._onLineFeed = this.register(new l.EventEmitter()), this.onLineFeed = this._onLineFeed.event, this._onResize = this.register(new l.EventEmitter()), this.onResize = this._onResize.event, this._onWriteParsed = this.register(new l.EventEmitter()), this.onWriteParsed = this._onWriteParsed.event, this._onScroll = this.register(new l.EventEmitter()), this._instantiationService = new n.InstantiationService(), this.optionsService = this.register(new h2.OptionsService(e4)), this._instantiationService.setService(r.IOptionsService, this.optionsService), this._bufferService = this.register(this._instantiationService.createInstance(a.BufferService)), this._instantiationService.setService(r.IBufferService, this._bufferService), this._logService = this.register(this._instantiationService.createInstance(o.LogService)), this._instantiationService.setService(r.ILogService, this._logService), this.coreService = this.register(this._instantiationService.createInstance(c.CoreService)), this._instantiationService.setService(r.ICoreService, this.coreService), this.coreMouseService = this.register(this._instantiationService.createInstance(d.CoreMouseService)), this._instantiationService.setService(r.ICoreMouseService, this.coreMouseService), this.unicodeService = this.register(this._instantiationService.createInstance(_2.UnicodeService)), this._instantiationService.setService(r.IUnicodeService, this.unicodeService), this._charsetService = this._instantiationService.createInstance(u.CharsetService), this._instantiationService.setService(r.ICharsetService, this._charsetService), this._oscLinkService = this._instantiationService.createInstance(g2.OscLinkService), this._instantiationService.setService(r.IOscLinkService, this._oscLinkService), this._inputHandler = this.register(new v2.InputHandler(this._bufferService, this._charsetService, this.coreService, this._logService, this.optionsService, this._oscLinkService, this.coreMouseService, this.unicodeService)), this.register((0, l.forwardEvent)(this._inputHandler.onLineFeed, this._onLineFeed)), this.register(this._inputHandler), this.register((0, l.forwardEvent)(this._bufferService.onResize, this._onResize)), this.register((0, l.forwardEvent)(this.coreService.onData, this._onData)), this.register((0, l.forwardEvent)(this.coreService.onBinary, this._onBinary)), this.register(this.coreService.onRequestScrollToBottom(() => this.scrollToBottom())), this.register(this.coreService.onUserInput(() => this._writeBuffer.handleUserInput())), this.register(this.optionsService.onMultipleOptionChange(["windowsMode", "windowsPty"], () => this._handleWindowsPtyOptionChange())), this.register(this._bufferService.onScroll((e5) => { + super(), this._windowsWrappingHeuristics = this.register(new s3.MutableDisposable()), this._onBinary = this.register(new l2.EventEmitter()), this.onBinary = this._onBinary.event, this._onData = this.register(new l2.EventEmitter()), this.onData = this._onData.event, this._onLineFeed = this.register(new l2.EventEmitter()), this.onLineFeed = this._onLineFeed.event, this._onResize = this.register(new l2.EventEmitter()), this.onResize = this._onResize.event, this._onWriteParsed = this.register(new l2.EventEmitter()), this.onWriteParsed = this._onWriteParsed.event, this._onScroll = this.register(new l2.EventEmitter()), this._instantiationService = new n2.InstantiationService(), this.optionsService = this.register(new h2.OptionsService(e4)), this._instantiationService.setService(r2.IOptionsService, this.optionsService), this._bufferService = this.register(this._instantiationService.createInstance(a2.BufferService)), this._instantiationService.setService(r2.IBufferService, this._bufferService), this._logService = this.register(this._instantiationService.createInstance(o2.LogService)), this._instantiationService.setService(r2.ILogService, this._logService), this.coreService = this.register(this._instantiationService.createInstance(c2.CoreService)), this._instantiationService.setService(r2.ICoreService, this.coreService), this.coreMouseService = this.register(this._instantiationService.createInstance(d2.CoreMouseService)), this._instantiationService.setService(r2.ICoreMouseService, this.coreMouseService), this.unicodeService = this.register(this._instantiationService.createInstance(_2.UnicodeService)), this._instantiationService.setService(r2.IUnicodeService, this.unicodeService), this._charsetService = this._instantiationService.createInstance(u2.CharsetService), this._instantiationService.setService(r2.ICharsetService, this._charsetService), this._oscLinkService = this._instantiationService.createInstance(g2.OscLinkService), this._instantiationService.setService(r2.IOscLinkService, this._oscLinkService), this._inputHandler = this.register(new v2.InputHandler(this._bufferService, this._charsetService, this.coreService, this._logService, this.optionsService, this._oscLinkService, this.coreMouseService, this.unicodeService)), this.register((0, l2.forwardEvent)(this._inputHandler.onLineFeed, this._onLineFeed)), this.register(this._inputHandler), this.register((0, l2.forwardEvent)(this._bufferService.onResize, this._onResize)), this.register((0, l2.forwardEvent)(this.coreService.onData, this._onData)), this.register((0, l2.forwardEvent)(this.coreService.onBinary, this._onBinary)), this.register(this.coreService.onRequestScrollToBottom(() => this.scrollToBottom())), this.register(this.coreService.onUserInput(() => this._writeBuffer.handleUserInput())), this.register(this.optionsService.onMultipleOptionChange(["windowsMode", "windowsPty"], () => this._handleWindowsPtyOptionChange())), this.register(this._bufferService.onScroll((e5) => { this._onScroll.fire({ position: this._bufferService.buffer.ydisp, source: 0 }), this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop, this._bufferService.buffer.scrollBottom); })), this.register(this._inputHandler.onScroll((e5) => { this._onScroll.fire({ position: this._bufferService.buffer.ydisp, source: 0 }), this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop, this._bufferService.buffer.scrollBottom); - })), this._writeBuffer = this.register(new p2.WriteBuffer((e5, t4) => this._inputHandler.parse(e5, t4))), this.register((0, l.forwardEvent)(this._writeBuffer.onWriteParsed, this._onWriteParsed)); + })), this._writeBuffer = this.register(new p2.WriteBuffer((e5, t4) => this._inputHandler.parse(e5, t4))), this.register((0, l2.forwardEvent)(this._writeBuffer.onWriteParsed, this._onWriteParsed)); } write(e4, t4) { this._writeBuffer.write(e4, t4); } writeSync(e4, t4) { - this._logService.logLevel <= r.LogLevelEnum.WARN && !m && (this._logService.warn("writeSync is unreliable and will be removed soon."), m = true), this._writeBuffer.writeSync(e4, t4); + this._logService.logLevel <= r2.LogLevelEnum.WARN && !m2 && (this._logService.warn("writeSync is unreliable and will be removed soon."), m2 = true), this._writeBuffer.writeSync(e4, t4); } input(e4, t4 = true) { this.coreService.triggerDataEvent(e4, t4); } resize(e4, t4) { - isNaN(e4) || isNaN(t4) || (e4 = Math.max(e4, a.MINIMUM_COLS), t4 = Math.max(t4, a.MINIMUM_ROWS), this._bufferService.resize(e4, t4)); + isNaN(e4) || isNaN(t4) || (e4 = Math.max(e4, a2.MINIMUM_COLS), t4 = Math.max(t4, a2.MINIMUM_ROWS), this._bufferService.resize(e4, t4)); } scroll(e4, t4 = false) { this._bufferService.scroll(e4, t4); @@ -160046,13 +188356,13 @@ WARNING: This link could potentially be dangerous`)) { _enableWindowsWrappingHeuristics() { if (!this._windowsWrappingHeuristics.value) { const e4 = []; - e4.push(this.onLineFeed(f.updateWindowsModeWrappedState.bind(null, this._bufferService))), e4.push(this.registerCsiHandler({ final: "H" }, () => ((0, f.updateWindowsModeWrappedState)(this._bufferService), false))), this._windowsWrappingHeuristics.value = (0, s2.toDisposable)(() => { + e4.push(this.onLineFeed(f2.updateWindowsModeWrappedState.bind(null, this._bufferService))), e4.push(this.registerCsiHandler({ final: "H" }, () => ((0, f2.updateWindowsModeWrappedState)(this._bufferService), false))), this._windowsWrappingHeuristics.value = (0, s3.toDisposable)(() => { for (const t4 of e4) t4.dispose(); }); } } } - t3.CoreTerminal = S; + t3.CoreTerminal = S2; }, 8460: (e3, t3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.runAndSubscribe = t3.forwardEvent = t3.EventEmitter = void 0, t3.EventEmitter = class { constructor() { @@ -160068,7 +188378,7 @@ WARNING: This link could potentially be dangerous`)) { fire(e4, t4) { const i3 = []; for (let e5 = 0; e5 < this._listeners.length; e5++) i3.push(this._listeners[e5]); - for (let s2 = 0; s2 < i3.length; s2++) i3[s2].call(void 0, e4, t4); + for (let s3 = 0; s3 < i3.length; s3++) i3[s3].call(void 0, e4, t4); } dispose() { this.clearListeners(), this._disposed = true; @@ -160082,19 +188392,19 @@ WARNING: This link could potentially be dangerous`)) { return t4(void 0), e4((e5) => t4(e5)); }; }, 5435: function(e3, t3, i3) { - var s2 = this && this.__decorate || function(e4, t4, i4, s3) { - var r2, n2 = arguments.length, o2 = n2 < 3 ? t4 : null === s3 ? s3 = Object.getOwnPropertyDescriptor(t4, i4) : s3; - if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o2 = Reflect.decorate(e4, t4, i4, s3); - else for (var a2 = e4.length - 1; a2 >= 0; a2--) (r2 = e4[a2]) && (o2 = (n2 < 3 ? r2(o2) : n2 > 3 ? r2(t4, i4, o2) : r2(t4, i4)) || o2); - return n2 > 3 && o2 && Object.defineProperty(t4, i4, o2), o2; - }, r = this && this.__param || function(e4, t4) { - return function(i4, s3) { - t4(i4, s3, e4); + var s3 = this && this.__decorate || function(e4, t4, i4, s4) { + var r3, n3 = arguments.length, o3 = n3 < 3 ? t4 : null === s4 ? s4 = Object.getOwnPropertyDescriptor(t4, i4) : s4; + if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o3 = Reflect.decorate(e4, t4, i4, s4); + else for (var a3 = e4.length - 1; a3 >= 0; a3--) (r3 = e4[a3]) && (o3 = (n3 < 3 ? r3(o3) : n3 > 3 ? r3(t4, i4, o3) : r3(t4, i4)) || o3); + return n3 > 3 && o3 && Object.defineProperty(t4, i4, o3), o3; + }, r2 = this && this.__param || function(e4, t4) { + return function(i4, s4) { + t4(i4, s4, e4); }; }; Object.defineProperty(t3, "__esModule", { value: true }), t3.InputHandler = t3.WindowsOptionsReportType = void 0; - const n = i3(2584), o = i3(7116), a = i3(2015), h2 = i3(844), c = i3(482), l = i3(8437), d = i3(8460), _2 = i3(643), u = i3(511), f = i3(3734), v2 = i3(2585), p2 = i3(1480), g2 = i3(6242), m = i3(6351), S = i3(5941), C = { "(": 0, ")": 1, "*": 2, "+": 3, "-": 1, ".": 2 }, b = 131072; - function w(e4, t4) { + const n2 = i3(2584), o2 = i3(7116), a2 = i3(2015), h2 = i3(844), c2 = i3(482), l2 = i3(8437), d2 = i3(8460), _2 = i3(643), u2 = i3(511), f2 = i3(3734), v2 = i3(2585), p2 = i3(1480), g2 = i3(6242), m2 = i3(6351), S2 = i3(5941), C2 = { "(": 0, ")": 1, "*": 2, "+": 3, "-": 1, ".": 2 }, b2 = 131072; + function w2(e4, t4) { if (e4 > 24) return t4.setWinLines || false; switch (e4) { case 1: @@ -160144,21 +188454,21 @@ WARNING: This link could potentially be dangerous`)) { } return false; } - __name(w, "w"); + __name(w2, "w"); var y2; !function(e4) { e4[e4.GET_WIN_SIZE_PIXELS = 0] = "GET_WIN_SIZE_PIXELS", e4[e4.GET_CELL_SIZE_PIXELS = 1] = "GET_CELL_SIZE_PIXELS"; }(y2 || (t3.WindowsOptionsReportType = y2 = {})); let E = 0; - class k extends h2.Disposable { + class k2 extends h2.Disposable { static { __name(this, "k"); } getAttrData() { return this._curAttrData; } - constructor(e4, t4, i4, s3, r2, h3, _3, f2, v3 = new a.EscapeSequenceParser()) { - super(), this._bufferService = e4, this._charsetService = t4, this._coreService = i4, this._logService = s3, this._optionsService = r2, this._oscLinkService = h3, this._coreMouseService = _3, this._unicodeService = f2, this._parser = v3, this._parseBuffer = new Uint32Array(4096), this._stringDecoder = new c.StringToUtf32(), this._utf8Decoder = new c.Utf8ToUtf32(), this._workCell = new u.CellData(), this._windowTitle = "", this._iconName = "", this._windowTitleStack = [], this._iconNameStack = [], this._curAttrData = l.DEFAULT_ATTR_DATA.clone(), this._eraseAttrDataInternal = l.DEFAULT_ATTR_DATA.clone(), this._onRequestBell = this.register(new d.EventEmitter()), this.onRequestBell = this._onRequestBell.event, this._onRequestRefreshRows = this.register(new d.EventEmitter()), this.onRequestRefreshRows = this._onRequestRefreshRows.event, this._onRequestReset = this.register(new d.EventEmitter()), this.onRequestReset = this._onRequestReset.event, this._onRequestSendFocus = this.register(new d.EventEmitter()), this.onRequestSendFocus = this._onRequestSendFocus.event, this._onRequestSyncScrollBar = this.register(new d.EventEmitter()), this.onRequestSyncScrollBar = this._onRequestSyncScrollBar.event, this._onRequestWindowsOptionsReport = this.register(new d.EventEmitter()), this.onRequestWindowsOptionsReport = this._onRequestWindowsOptionsReport.event, this._onA11yChar = this.register(new d.EventEmitter()), this.onA11yChar = this._onA11yChar.event, this._onA11yTab = this.register(new d.EventEmitter()), this.onA11yTab = this._onA11yTab.event, this._onCursorMove = this.register(new d.EventEmitter()), this.onCursorMove = this._onCursorMove.event, this._onLineFeed = this.register(new d.EventEmitter()), this.onLineFeed = this._onLineFeed.event, this._onScroll = this.register(new d.EventEmitter()), this.onScroll = this._onScroll.event, this._onTitleChange = this.register(new d.EventEmitter()), this.onTitleChange = this._onTitleChange.event, this._onColor = this.register(new d.EventEmitter()), this.onColor = this._onColor.event, this._parseStack = { paused: false, cursorStartX: 0, cursorStartY: 0, decodedLength: 0, position: 0 }, this._specialColors = [256, 257, 258], this.register(this._parser), this._dirtyRowTracker = new L(this._bufferService), this._activeBuffer = this._bufferService.buffer, this.register(this._bufferService.buffers.onBufferActivate((e5) => this._activeBuffer = e5.activeBuffer)), this._parser.setCsiHandlerFallback((e5, t5) => { + constructor(e4, t4, i4, s4, r3, h3, _3, f3, v3 = new a2.EscapeSequenceParser()) { + super(), this._bufferService = e4, this._charsetService = t4, this._coreService = i4, this._logService = s4, this._optionsService = r3, this._oscLinkService = h3, this._coreMouseService = _3, this._unicodeService = f3, this._parser = v3, this._parseBuffer = new Uint32Array(4096), this._stringDecoder = new c2.StringToUtf32(), this._utf8Decoder = new c2.Utf8ToUtf32(), this._workCell = new u2.CellData(), this._windowTitle = "", this._iconName = "", this._windowTitleStack = [], this._iconNameStack = [], this._curAttrData = l2.DEFAULT_ATTR_DATA.clone(), this._eraseAttrDataInternal = l2.DEFAULT_ATTR_DATA.clone(), this._onRequestBell = this.register(new d2.EventEmitter()), this.onRequestBell = this._onRequestBell.event, this._onRequestRefreshRows = this.register(new d2.EventEmitter()), this.onRequestRefreshRows = this._onRequestRefreshRows.event, this._onRequestReset = this.register(new d2.EventEmitter()), this.onRequestReset = this._onRequestReset.event, this._onRequestSendFocus = this.register(new d2.EventEmitter()), this.onRequestSendFocus = this._onRequestSendFocus.event, this._onRequestSyncScrollBar = this.register(new d2.EventEmitter()), this.onRequestSyncScrollBar = this._onRequestSyncScrollBar.event, this._onRequestWindowsOptionsReport = this.register(new d2.EventEmitter()), this.onRequestWindowsOptionsReport = this._onRequestWindowsOptionsReport.event, this._onA11yChar = this.register(new d2.EventEmitter()), this.onA11yChar = this._onA11yChar.event, this._onA11yTab = this.register(new d2.EventEmitter()), this.onA11yTab = this._onA11yTab.event, this._onCursorMove = this.register(new d2.EventEmitter()), this.onCursorMove = this._onCursorMove.event, this._onLineFeed = this.register(new d2.EventEmitter()), this.onLineFeed = this._onLineFeed.event, this._onScroll = this.register(new d2.EventEmitter()), this.onScroll = this._onScroll.event, this._onTitleChange = this.register(new d2.EventEmitter()), this.onTitleChange = this._onTitleChange.event, this._onColor = this.register(new d2.EventEmitter()), this.onColor = this._onColor.event, this._parseStack = { paused: false, cursorStartX: 0, cursorStartY: 0, decodedLength: 0, position: 0 }, this._specialColors = [256, 257, 258], this.register(this._parser), this._dirtyRowTracker = new L2(this._bufferService), this._activeBuffer = this._bufferService.buffer, this.register(this._bufferService.buffers.onBufferActivate((e5) => this._activeBuffer = e5.activeBuffer)), this._parser.setCsiHandlerFallback((e5, t5) => { this._logService.debug("Unknown CSI code: ", { identifier: this._parser.identToString(e5), params: t5.toArray() }); }), this._parser.setEscHandlerFallback((e5) => { this._logService.debug("Unknown ESC code: ", { identifier: this._parser.identToString(e5) }); @@ -160168,12 +188478,12 @@ WARNING: This link could potentially be dangerous`)) { this._logService.debug("Unknown OSC code: ", { identifier: e5, action: t5, data: i5 }); }), this._parser.setDcsHandlerFallback((e5, t5, i5) => { "HOOK" === t5 && (i5 = i5.toArray()), this._logService.debug("Unknown DCS code: ", { identifier: this._parser.identToString(e5), action: t5, payload: i5 }); - }), this._parser.setPrintHandler((e5, t5, i5) => this.print(e5, t5, i5)), this._parser.registerCsiHandler({ final: "@" }, (e5) => this.insertChars(e5)), this._parser.registerCsiHandler({ intermediates: " ", final: "@" }, (e5) => this.scrollLeft(e5)), this._parser.registerCsiHandler({ final: "A" }, (e5) => this.cursorUp(e5)), this._parser.registerCsiHandler({ intermediates: " ", final: "A" }, (e5) => this.scrollRight(e5)), this._parser.registerCsiHandler({ final: "B" }, (e5) => this.cursorDown(e5)), this._parser.registerCsiHandler({ final: "C" }, (e5) => this.cursorForward(e5)), this._parser.registerCsiHandler({ final: "D" }, (e5) => this.cursorBackward(e5)), this._parser.registerCsiHandler({ final: "E" }, (e5) => this.cursorNextLine(e5)), this._parser.registerCsiHandler({ final: "F" }, (e5) => this.cursorPrecedingLine(e5)), this._parser.registerCsiHandler({ final: "G" }, (e5) => this.cursorCharAbsolute(e5)), this._parser.registerCsiHandler({ final: "H" }, (e5) => this.cursorPosition(e5)), this._parser.registerCsiHandler({ final: "I" }, (e5) => this.cursorForwardTab(e5)), this._parser.registerCsiHandler({ final: "J" }, (e5) => this.eraseInDisplay(e5, false)), this._parser.registerCsiHandler({ prefix: "?", final: "J" }, (e5) => this.eraseInDisplay(e5, true)), this._parser.registerCsiHandler({ final: "K" }, (e5) => this.eraseInLine(e5, false)), this._parser.registerCsiHandler({ prefix: "?", final: "K" }, (e5) => this.eraseInLine(e5, true)), this._parser.registerCsiHandler({ final: "L" }, (e5) => this.insertLines(e5)), this._parser.registerCsiHandler({ final: "M" }, (e5) => this.deleteLines(e5)), this._parser.registerCsiHandler({ final: "P" }, (e5) => this.deleteChars(e5)), this._parser.registerCsiHandler({ final: "S" }, (e5) => this.scrollUp(e5)), this._parser.registerCsiHandler({ final: "T" }, (e5) => this.scrollDown(e5)), this._parser.registerCsiHandler({ final: "X" }, (e5) => this.eraseChars(e5)), this._parser.registerCsiHandler({ final: "Z" }, (e5) => this.cursorBackwardTab(e5)), this._parser.registerCsiHandler({ final: "`" }, (e5) => this.charPosAbsolute(e5)), this._parser.registerCsiHandler({ final: "a" }, (e5) => this.hPositionRelative(e5)), this._parser.registerCsiHandler({ final: "b" }, (e5) => this.repeatPrecedingCharacter(e5)), this._parser.registerCsiHandler({ final: "c" }, (e5) => this.sendDeviceAttributesPrimary(e5)), this._parser.registerCsiHandler({ prefix: ">", final: "c" }, (e5) => this.sendDeviceAttributesSecondary(e5)), this._parser.registerCsiHandler({ final: "d" }, (e5) => this.linePosAbsolute(e5)), this._parser.registerCsiHandler({ final: "e" }, (e5) => this.vPositionRelative(e5)), this._parser.registerCsiHandler({ final: "f" }, (e5) => this.hVPosition(e5)), this._parser.registerCsiHandler({ final: "g" }, (e5) => this.tabClear(e5)), this._parser.registerCsiHandler({ final: "h" }, (e5) => this.setMode(e5)), this._parser.registerCsiHandler({ prefix: "?", final: "h" }, (e5) => this.setModePrivate(e5)), this._parser.registerCsiHandler({ final: "l" }, (e5) => this.resetMode(e5)), this._parser.registerCsiHandler({ prefix: "?", final: "l" }, (e5) => this.resetModePrivate(e5)), this._parser.registerCsiHandler({ final: "m" }, (e5) => this.charAttributes(e5)), this._parser.registerCsiHandler({ final: "n" }, (e5) => this.deviceStatus(e5)), this._parser.registerCsiHandler({ prefix: "?", final: "n" }, (e5) => this.deviceStatusPrivate(e5)), this._parser.registerCsiHandler({ intermediates: "!", final: "p" }, (e5) => this.softReset(e5)), this._parser.registerCsiHandler({ intermediates: " ", final: "q" }, (e5) => this.setCursorStyle(e5)), this._parser.registerCsiHandler({ final: "r" }, (e5) => this.setScrollRegion(e5)), this._parser.registerCsiHandler({ final: "s" }, (e5) => this.saveCursor(e5)), this._parser.registerCsiHandler({ final: "t" }, (e5) => this.windowOptions(e5)), this._parser.registerCsiHandler({ final: "u" }, (e5) => this.restoreCursor(e5)), this._parser.registerCsiHandler({ intermediates: "'", final: "}" }, (e5) => this.insertColumns(e5)), this._parser.registerCsiHandler({ intermediates: "'", final: "~" }, (e5) => this.deleteColumns(e5)), this._parser.registerCsiHandler({ intermediates: '"', final: "q" }, (e5) => this.selectProtected(e5)), this._parser.registerCsiHandler({ intermediates: "$", final: "p" }, (e5) => this.requestMode(e5, true)), this._parser.registerCsiHandler({ prefix: "?", intermediates: "$", final: "p" }, (e5) => this.requestMode(e5, false)), this._parser.setExecuteHandler(n.C0.BEL, () => this.bell()), this._parser.setExecuteHandler(n.C0.LF, () => this.lineFeed()), this._parser.setExecuteHandler(n.C0.VT, () => this.lineFeed()), this._parser.setExecuteHandler(n.C0.FF, () => this.lineFeed()), this._parser.setExecuteHandler(n.C0.CR, () => this.carriageReturn()), this._parser.setExecuteHandler(n.C0.BS, () => this.backspace()), this._parser.setExecuteHandler(n.C0.HT, () => this.tab()), this._parser.setExecuteHandler(n.C0.SO, () => this.shiftOut()), this._parser.setExecuteHandler(n.C0.SI, () => this.shiftIn()), this._parser.setExecuteHandler(n.C1.IND, () => this.index()), this._parser.setExecuteHandler(n.C1.NEL, () => this.nextLine()), this._parser.setExecuteHandler(n.C1.HTS, () => this.tabSet()), this._parser.registerOscHandler(0, new g2.OscHandler((e5) => (this.setTitle(e5), this.setIconName(e5), true))), this._parser.registerOscHandler(1, new g2.OscHandler((e5) => this.setIconName(e5))), this._parser.registerOscHandler(2, new g2.OscHandler((e5) => this.setTitle(e5))), this._parser.registerOscHandler(4, new g2.OscHandler((e5) => this.setOrReportIndexedColor(e5))), this._parser.registerOscHandler(8, new g2.OscHandler((e5) => this.setHyperlink(e5))), this._parser.registerOscHandler(10, new g2.OscHandler((e5) => this.setOrReportFgColor(e5))), this._parser.registerOscHandler(11, new g2.OscHandler((e5) => this.setOrReportBgColor(e5))), this._parser.registerOscHandler(12, new g2.OscHandler((e5) => this.setOrReportCursorColor(e5))), this._parser.registerOscHandler(104, new g2.OscHandler((e5) => this.restoreIndexedColor(e5))), this._parser.registerOscHandler(110, new g2.OscHandler((e5) => this.restoreFgColor(e5))), this._parser.registerOscHandler(111, new g2.OscHandler((e5) => this.restoreBgColor(e5))), this._parser.registerOscHandler(112, new g2.OscHandler((e5) => this.restoreCursorColor(e5))), this._parser.registerEscHandler({ final: "7" }, () => this.saveCursor()), this._parser.registerEscHandler({ final: "8" }, () => this.restoreCursor()), this._parser.registerEscHandler({ final: "D" }, () => this.index()), this._parser.registerEscHandler({ final: "E" }, () => this.nextLine()), this._parser.registerEscHandler({ final: "H" }, () => this.tabSet()), this._parser.registerEscHandler({ final: "M" }, () => this.reverseIndex()), this._parser.registerEscHandler({ final: "=" }, () => this.keypadApplicationMode()), this._parser.registerEscHandler({ final: ">" }, () => this.keypadNumericMode()), this._parser.registerEscHandler({ final: "c" }, () => this.fullReset()), this._parser.registerEscHandler({ final: "n" }, () => this.setgLevel(2)), this._parser.registerEscHandler({ final: "o" }, () => this.setgLevel(3)), this._parser.registerEscHandler({ final: "|" }, () => this.setgLevel(3)), this._parser.registerEscHandler({ final: "}" }, () => this.setgLevel(2)), this._parser.registerEscHandler({ final: "~" }, () => this.setgLevel(1)), this._parser.registerEscHandler({ intermediates: "%", final: "@" }, () => this.selectDefaultCharset()), this._parser.registerEscHandler({ intermediates: "%", final: "G" }, () => this.selectDefaultCharset()); - for (const e5 in o.CHARSETS) this._parser.registerEscHandler({ intermediates: "(", final: e5 }, () => this.selectCharset("(" + e5)), this._parser.registerEscHandler({ intermediates: ")", final: e5 }, () => this.selectCharset(")" + e5)), this._parser.registerEscHandler({ intermediates: "*", final: e5 }, () => this.selectCharset("*" + e5)), this._parser.registerEscHandler({ intermediates: "+", final: e5 }, () => this.selectCharset("+" + e5)), this._parser.registerEscHandler({ intermediates: "-", final: e5 }, () => this.selectCharset("-" + e5)), this._parser.registerEscHandler({ intermediates: ".", final: e5 }, () => this.selectCharset("." + e5)), this._parser.registerEscHandler({ intermediates: "/", final: e5 }, () => this.selectCharset("/" + e5)); - this._parser.registerEscHandler({ intermediates: "#", final: "8" }, () => this.screenAlignmentPattern()), this._parser.setErrorHandler((e5) => (this._logService.error("Parsing error: ", e5), e5)), this._parser.registerDcsHandler({ intermediates: "$", final: "q" }, new m.DcsHandler((e5, t5) => this.requestStatusString(e5, t5))); + }), this._parser.setPrintHandler((e5, t5, i5) => this.print(e5, t5, i5)), this._parser.registerCsiHandler({ final: "@" }, (e5) => this.insertChars(e5)), this._parser.registerCsiHandler({ intermediates: " ", final: "@" }, (e5) => this.scrollLeft(e5)), this._parser.registerCsiHandler({ final: "A" }, (e5) => this.cursorUp(e5)), this._parser.registerCsiHandler({ intermediates: " ", final: "A" }, (e5) => this.scrollRight(e5)), this._parser.registerCsiHandler({ final: "B" }, (e5) => this.cursorDown(e5)), this._parser.registerCsiHandler({ final: "C" }, (e5) => this.cursorForward(e5)), this._parser.registerCsiHandler({ final: "D" }, (e5) => this.cursorBackward(e5)), this._parser.registerCsiHandler({ final: "E" }, (e5) => this.cursorNextLine(e5)), this._parser.registerCsiHandler({ final: "F" }, (e5) => this.cursorPrecedingLine(e5)), this._parser.registerCsiHandler({ final: "G" }, (e5) => this.cursorCharAbsolute(e5)), this._parser.registerCsiHandler({ final: "H" }, (e5) => this.cursorPosition(e5)), this._parser.registerCsiHandler({ final: "I" }, (e5) => this.cursorForwardTab(e5)), this._parser.registerCsiHandler({ final: "J" }, (e5) => this.eraseInDisplay(e5, false)), this._parser.registerCsiHandler({ prefix: "?", final: "J" }, (e5) => this.eraseInDisplay(e5, true)), this._parser.registerCsiHandler({ final: "K" }, (e5) => this.eraseInLine(e5, false)), this._parser.registerCsiHandler({ prefix: "?", final: "K" }, (e5) => this.eraseInLine(e5, true)), this._parser.registerCsiHandler({ final: "L" }, (e5) => this.insertLines(e5)), this._parser.registerCsiHandler({ final: "M" }, (e5) => this.deleteLines(e5)), this._parser.registerCsiHandler({ final: "P" }, (e5) => this.deleteChars(e5)), this._parser.registerCsiHandler({ final: "S" }, (e5) => this.scrollUp(e5)), this._parser.registerCsiHandler({ final: "T" }, (e5) => this.scrollDown(e5)), this._parser.registerCsiHandler({ final: "X" }, (e5) => this.eraseChars(e5)), this._parser.registerCsiHandler({ final: "Z" }, (e5) => this.cursorBackwardTab(e5)), this._parser.registerCsiHandler({ final: "`" }, (e5) => this.charPosAbsolute(e5)), this._parser.registerCsiHandler({ final: "a" }, (e5) => this.hPositionRelative(e5)), this._parser.registerCsiHandler({ final: "b" }, (e5) => this.repeatPrecedingCharacter(e5)), this._parser.registerCsiHandler({ final: "c" }, (e5) => this.sendDeviceAttributesPrimary(e5)), this._parser.registerCsiHandler({ prefix: ">", final: "c" }, (e5) => this.sendDeviceAttributesSecondary(e5)), this._parser.registerCsiHandler({ final: "d" }, (e5) => this.linePosAbsolute(e5)), this._parser.registerCsiHandler({ final: "e" }, (e5) => this.vPositionRelative(e5)), this._parser.registerCsiHandler({ final: "f" }, (e5) => this.hVPosition(e5)), this._parser.registerCsiHandler({ final: "g" }, (e5) => this.tabClear(e5)), this._parser.registerCsiHandler({ final: "h" }, (e5) => this.setMode(e5)), this._parser.registerCsiHandler({ prefix: "?", final: "h" }, (e5) => this.setModePrivate(e5)), this._parser.registerCsiHandler({ final: "l" }, (e5) => this.resetMode(e5)), this._parser.registerCsiHandler({ prefix: "?", final: "l" }, (e5) => this.resetModePrivate(e5)), this._parser.registerCsiHandler({ final: "m" }, (e5) => this.charAttributes(e5)), this._parser.registerCsiHandler({ final: "n" }, (e5) => this.deviceStatus(e5)), this._parser.registerCsiHandler({ prefix: "?", final: "n" }, (e5) => this.deviceStatusPrivate(e5)), this._parser.registerCsiHandler({ intermediates: "!", final: "p" }, (e5) => this.softReset(e5)), this._parser.registerCsiHandler({ intermediates: " ", final: "q" }, (e5) => this.setCursorStyle(e5)), this._parser.registerCsiHandler({ final: "r" }, (e5) => this.setScrollRegion(e5)), this._parser.registerCsiHandler({ final: "s" }, (e5) => this.saveCursor(e5)), this._parser.registerCsiHandler({ final: "t" }, (e5) => this.windowOptions(e5)), this._parser.registerCsiHandler({ final: "u" }, (e5) => this.restoreCursor(e5)), this._parser.registerCsiHandler({ intermediates: "'", final: "}" }, (e5) => this.insertColumns(e5)), this._parser.registerCsiHandler({ intermediates: "'", final: "~" }, (e5) => this.deleteColumns(e5)), this._parser.registerCsiHandler({ intermediates: '"', final: "q" }, (e5) => this.selectProtected(e5)), this._parser.registerCsiHandler({ intermediates: "$", final: "p" }, (e5) => this.requestMode(e5, true)), this._parser.registerCsiHandler({ prefix: "?", intermediates: "$", final: "p" }, (e5) => this.requestMode(e5, false)), this._parser.setExecuteHandler(n2.C0.BEL, () => this.bell()), this._parser.setExecuteHandler(n2.C0.LF, () => this.lineFeed()), this._parser.setExecuteHandler(n2.C0.VT, () => this.lineFeed()), this._parser.setExecuteHandler(n2.C0.FF, () => this.lineFeed()), this._parser.setExecuteHandler(n2.C0.CR, () => this.carriageReturn()), this._parser.setExecuteHandler(n2.C0.BS, () => this.backspace()), this._parser.setExecuteHandler(n2.C0.HT, () => this.tab()), this._parser.setExecuteHandler(n2.C0.SO, () => this.shiftOut()), this._parser.setExecuteHandler(n2.C0.SI, () => this.shiftIn()), this._parser.setExecuteHandler(n2.C1.IND, () => this.index()), this._parser.setExecuteHandler(n2.C1.NEL, () => this.nextLine()), this._parser.setExecuteHandler(n2.C1.HTS, () => this.tabSet()), this._parser.registerOscHandler(0, new g2.OscHandler((e5) => (this.setTitle(e5), this.setIconName(e5), true))), this._parser.registerOscHandler(1, new g2.OscHandler((e5) => this.setIconName(e5))), this._parser.registerOscHandler(2, new g2.OscHandler((e5) => this.setTitle(e5))), this._parser.registerOscHandler(4, new g2.OscHandler((e5) => this.setOrReportIndexedColor(e5))), this._parser.registerOscHandler(8, new g2.OscHandler((e5) => this.setHyperlink(e5))), this._parser.registerOscHandler(10, new g2.OscHandler((e5) => this.setOrReportFgColor(e5))), this._parser.registerOscHandler(11, new g2.OscHandler((e5) => this.setOrReportBgColor(e5))), this._parser.registerOscHandler(12, new g2.OscHandler((e5) => this.setOrReportCursorColor(e5))), this._parser.registerOscHandler(104, new g2.OscHandler((e5) => this.restoreIndexedColor(e5))), this._parser.registerOscHandler(110, new g2.OscHandler((e5) => this.restoreFgColor(e5))), this._parser.registerOscHandler(111, new g2.OscHandler((e5) => this.restoreBgColor(e5))), this._parser.registerOscHandler(112, new g2.OscHandler((e5) => this.restoreCursorColor(e5))), this._parser.registerEscHandler({ final: "7" }, () => this.saveCursor()), this._parser.registerEscHandler({ final: "8" }, () => this.restoreCursor()), this._parser.registerEscHandler({ final: "D" }, () => this.index()), this._parser.registerEscHandler({ final: "E" }, () => this.nextLine()), this._parser.registerEscHandler({ final: "H" }, () => this.tabSet()), this._parser.registerEscHandler({ final: "M" }, () => this.reverseIndex()), this._parser.registerEscHandler({ final: "=" }, () => this.keypadApplicationMode()), this._parser.registerEscHandler({ final: ">" }, () => this.keypadNumericMode()), this._parser.registerEscHandler({ final: "c" }, () => this.fullReset()), this._parser.registerEscHandler({ final: "n" }, () => this.setgLevel(2)), this._parser.registerEscHandler({ final: "o" }, () => this.setgLevel(3)), this._parser.registerEscHandler({ final: "|" }, () => this.setgLevel(3)), this._parser.registerEscHandler({ final: "}" }, () => this.setgLevel(2)), this._parser.registerEscHandler({ final: "~" }, () => this.setgLevel(1)), this._parser.registerEscHandler({ intermediates: "%", final: "@" }, () => this.selectDefaultCharset()), this._parser.registerEscHandler({ intermediates: "%", final: "G" }, () => this.selectDefaultCharset()); + for (const e5 in o2.CHARSETS) this._parser.registerEscHandler({ intermediates: "(", final: e5 }, () => this.selectCharset("(" + e5)), this._parser.registerEscHandler({ intermediates: ")", final: e5 }, () => this.selectCharset(")" + e5)), this._parser.registerEscHandler({ intermediates: "*", final: e5 }, () => this.selectCharset("*" + e5)), this._parser.registerEscHandler({ intermediates: "+", final: e5 }, () => this.selectCharset("+" + e5)), this._parser.registerEscHandler({ intermediates: "-", final: e5 }, () => this.selectCharset("-" + e5)), this._parser.registerEscHandler({ intermediates: ".", final: e5 }, () => this.selectCharset("." + e5)), this._parser.registerEscHandler({ intermediates: "/", final: e5 }, () => this.selectCharset("/" + e5)); + this._parser.registerEscHandler({ intermediates: "#", final: "8" }, () => this.screenAlignmentPattern()), this._parser.setErrorHandler((e5) => (this._logService.error("Parsing error: ", e5), e5)), this._parser.registerDcsHandler({ intermediates: "$", final: "q" }, new m2.DcsHandler((e5, t5) => this.requestStatusString(e5, t5))); } - _preserveStack(e4, t4, i4, s3) { - this._parseStack.paused = true, this._parseStack.cursorStartX = e4, this._parseStack.cursorStartY = t4, this._parseStack.decodedLength = i4, this._parseStack.position = s3; + _preserveStack(e4, t4, i4, s4) { + this._parseStack.paused = true, this._parseStack.cursorStartX = e4, this._parseStack.cursorStartY = t4, this._parseStack.decodedLength = i4, this._parseStack.position = s4; } _logSlowResolvingAsync(e4) { this._logService.logLevel <= v2.LogLevelEnum.WARN && Promise.race([e4, new Promise((e5, t4) => setTimeout(() => t4("#SLOW_TIMEOUT"), 5e3))]).catch((e5) => { @@ -160185,58 +188495,58 @@ WARNING: This link could potentially be dangerous`)) { return this._curAttrData.extended.urlId; } parse(e4, t4) { - let i4, s3 = this._activeBuffer.x, r2 = this._activeBuffer.y, n2 = 0; - const o2 = this._parseStack.paused; - if (o2) { + let i4, s4 = this._activeBuffer.x, r3 = this._activeBuffer.y, n3 = 0; + const o3 = this._parseStack.paused; + if (o3) { if (i4 = this._parser.parse(this._parseBuffer, this._parseStack.decodedLength, t4)) return this._logSlowResolvingAsync(i4), i4; - s3 = this._parseStack.cursorStartX, r2 = this._parseStack.cursorStartY, this._parseStack.paused = false, e4.length > b && (n2 = this._parseStack.position + b); + s4 = this._parseStack.cursorStartX, r3 = this._parseStack.cursorStartY, this._parseStack.paused = false, e4.length > b2 && (n3 = this._parseStack.position + b2); } - if (this._logService.logLevel <= v2.LogLevelEnum.DEBUG && this._logService.debug("parsing data" + ("string" == typeof e4 ? ` "${e4}"` : ` "${Array.prototype.map.call(e4, (e5) => String.fromCharCode(e5)).join("")}"`), "string" == typeof e4 ? e4.split("").map((e5) => e5.charCodeAt(0)) : e4), this._parseBuffer.length < e4.length && this._parseBuffer.length < b && (this._parseBuffer = new Uint32Array(Math.min(e4.length, b))), o2 || this._dirtyRowTracker.clearRange(), e4.length > b) for (let t5 = n2; t5 < e4.length; t5 += b) { - const n3 = t5 + b < e4.length ? t5 + b : e4.length, o3 = "string" == typeof e4 ? this._stringDecoder.decode(e4.substring(t5, n3), this._parseBuffer) : this._utf8Decoder.decode(e4.subarray(t5, n3), this._parseBuffer); - if (i4 = this._parser.parse(this._parseBuffer, o3)) return this._preserveStack(s3, r2, o3, t5), this._logSlowResolvingAsync(i4), i4; + if (this._logService.logLevel <= v2.LogLevelEnum.DEBUG && this._logService.debug("parsing data" + ("string" == typeof e4 ? ` "${e4}"` : ` "${Array.prototype.map.call(e4, (e5) => String.fromCharCode(e5)).join("")}"`), "string" == typeof e4 ? e4.split("").map((e5) => e5.charCodeAt(0)) : e4), this._parseBuffer.length < e4.length && this._parseBuffer.length < b2 && (this._parseBuffer = new Uint32Array(Math.min(e4.length, b2))), o3 || this._dirtyRowTracker.clearRange(), e4.length > b2) for (let t5 = n3; t5 < e4.length; t5 += b2) { + const n4 = t5 + b2 < e4.length ? t5 + b2 : e4.length, o4 = "string" == typeof e4 ? this._stringDecoder.decode(e4.substring(t5, n4), this._parseBuffer) : this._utf8Decoder.decode(e4.subarray(t5, n4), this._parseBuffer); + if (i4 = this._parser.parse(this._parseBuffer, o4)) return this._preserveStack(s4, r3, o4, t5), this._logSlowResolvingAsync(i4), i4; } - else if (!o2) { + else if (!o3) { const t5 = "string" == typeof e4 ? this._stringDecoder.decode(e4, this._parseBuffer) : this._utf8Decoder.decode(e4, this._parseBuffer); - if (i4 = this._parser.parse(this._parseBuffer, t5)) return this._preserveStack(s3, r2, t5, 0), this._logSlowResolvingAsync(i4), i4; + if (i4 = this._parser.parse(this._parseBuffer, t5)) return this._preserveStack(s4, r3, t5, 0), this._logSlowResolvingAsync(i4), i4; } - this._activeBuffer.x === s3 && this._activeBuffer.y === r2 || this._onCursorMove.fire(); - const a2 = this._dirtyRowTracker.end + (this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp), h3 = this._dirtyRowTracker.start + (this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp); - h3 < this._bufferService.rows && this._onRequestRefreshRows.fire(Math.min(h3, this._bufferService.rows - 1), Math.min(a2, this._bufferService.rows - 1)); + this._activeBuffer.x === s4 && this._activeBuffer.y === r3 || this._onCursorMove.fire(); + const a3 = this._dirtyRowTracker.end + (this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp), h3 = this._dirtyRowTracker.start + (this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp); + h3 < this._bufferService.rows && this._onRequestRefreshRows.fire(Math.min(h3, this._bufferService.rows - 1), Math.min(a3, this._bufferService.rows - 1)); } print(e4, t4, i4) { - let s3, r2; - const n2 = this._charsetService.charset, o2 = this._optionsService.rawOptions.screenReaderMode, a2 = this._bufferService.cols, h3 = this._coreService.decPrivateModes.wraparound, d2 = this._coreService.modes.insertMode, u2 = this._curAttrData; - let f2 = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y); - this._dirtyRowTracker.markDirty(this._activeBuffer.y), this._activeBuffer.x && i4 - t4 > 0 && 2 === f2.getWidth(this._activeBuffer.x - 1) && f2.setCellFromCodepoint(this._activeBuffer.x - 1, 0, 1, u2); + let s4, r3; + const n3 = this._charsetService.charset, o3 = this._optionsService.rawOptions.screenReaderMode, a3 = this._bufferService.cols, h3 = this._coreService.decPrivateModes.wraparound, d3 = this._coreService.modes.insertMode, u3 = this._curAttrData; + let f3 = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y); + this._dirtyRowTracker.markDirty(this._activeBuffer.y), this._activeBuffer.x && i4 - t4 > 0 && 2 === f3.getWidth(this._activeBuffer.x - 1) && f3.setCellFromCodepoint(this._activeBuffer.x - 1, 0, 1, u3); let v3 = this._parser.precedingJoinState; for (let g3 = t4; g3 < i4; ++g3) { - if (s3 = e4[g3], s3 < 127 && n2) { - const e5 = n2[String.fromCharCode(s3)]; - e5 && (s3 = e5.charCodeAt(0)); + if (s4 = e4[g3], s4 < 127 && n3) { + const e5 = n3[String.fromCharCode(s4)]; + e5 && (s4 = e5.charCodeAt(0)); } - const t5 = this._unicodeService.charProperties(s3, v3); - r2 = p2.UnicodeService.extractWidth(t5); - const i5 = p2.UnicodeService.extractShouldJoin(t5), m2 = i5 ? p2.UnicodeService.extractWidth(v3) : 0; - if (v3 = t5, o2 && this._onA11yChar.fire((0, c.stringFromCodePoint)(s3)), this._getCurrentLinkId() && this._oscLinkService.addLineToLink(this._getCurrentLinkId(), this._activeBuffer.ybase + this._activeBuffer.y), this._activeBuffer.x + r2 - m2 > a2) { + const t5 = this._unicodeService.charProperties(s4, v3); + r3 = p2.UnicodeService.extractWidth(t5); + const i5 = p2.UnicodeService.extractShouldJoin(t5), m3 = i5 ? p2.UnicodeService.extractWidth(v3) : 0; + if (v3 = t5, o3 && this._onA11yChar.fire((0, c2.stringFromCodePoint)(s4)), this._getCurrentLinkId() && this._oscLinkService.addLineToLink(this._getCurrentLinkId(), this._activeBuffer.ybase + this._activeBuffer.y), this._activeBuffer.x + r3 - m3 > a3) { if (h3) { - const e5 = f2; - let t6 = this._activeBuffer.x - m2; - for (this._activeBuffer.x = m2, this._activeBuffer.y++, this._activeBuffer.y === this._activeBuffer.scrollBottom + 1 ? (this._activeBuffer.y--, this._bufferService.scroll(this._eraseAttrData(), true)) : (this._activeBuffer.y >= this._bufferService.rows && (this._activeBuffer.y = this._bufferService.rows - 1), this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y).isWrapped = true), f2 = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y), m2 > 0 && f2 instanceof l.BufferLine && f2.copyCellsFrom(e5, t6, 0, m2, false); t6 < a2; ) e5.setCellFromCodepoint(t6++, 0, 1, u2); - } else if (this._activeBuffer.x = a2 - 1, 2 === r2) continue; + const e5 = f3; + let t6 = this._activeBuffer.x - m3; + for (this._activeBuffer.x = m3, this._activeBuffer.y++, this._activeBuffer.y === this._activeBuffer.scrollBottom + 1 ? (this._activeBuffer.y--, this._bufferService.scroll(this._eraseAttrData(), true)) : (this._activeBuffer.y >= this._bufferService.rows && (this._activeBuffer.y = this._bufferService.rows - 1), this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y).isWrapped = true), f3 = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y), m3 > 0 && f3 instanceof l2.BufferLine && f3.copyCellsFrom(e5, t6, 0, m3, false); t6 < a3; ) e5.setCellFromCodepoint(t6++, 0, 1, u3); + } else if (this._activeBuffer.x = a3 - 1, 2 === r3) continue; } if (i5 && this._activeBuffer.x) { - const e5 = f2.getWidth(this._activeBuffer.x - 1) ? 1 : 2; - f2.addCodepointToCell(this._activeBuffer.x - e5, s3, r2); - for (let e6 = r2 - m2; --e6 >= 0; ) f2.setCellFromCodepoint(this._activeBuffer.x++, 0, 0, u2); - } else if (d2 && (f2.insertCells(this._activeBuffer.x, r2 - m2, this._activeBuffer.getNullCell(u2)), 2 === f2.getWidth(a2 - 1) && f2.setCellFromCodepoint(a2 - 1, _2.NULL_CELL_CODE, _2.NULL_CELL_WIDTH, u2)), f2.setCellFromCodepoint(this._activeBuffer.x++, s3, r2, u2), r2 > 0) for (; --r2; ) f2.setCellFromCodepoint(this._activeBuffer.x++, 0, 0, u2); + const e5 = f3.getWidth(this._activeBuffer.x - 1) ? 1 : 2; + f3.addCodepointToCell(this._activeBuffer.x - e5, s4, r3); + for (let e6 = r3 - m3; --e6 >= 0; ) f3.setCellFromCodepoint(this._activeBuffer.x++, 0, 0, u3); + } else if (d3 && (f3.insertCells(this._activeBuffer.x, r3 - m3, this._activeBuffer.getNullCell(u3)), 2 === f3.getWidth(a3 - 1) && f3.setCellFromCodepoint(a3 - 1, _2.NULL_CELL_CODE, _2.NULL_CELL_WIDTH, u3)), f3.setCellFromCodepoint(this._activeBuffer.x++, s4, r3, u3), r3 > 0) for (; --r3; ) f3.setCellFromCodepoint(this._activeBuffer.x++, 0, 0, u3); } - this._parser.precedingJoinState = v3, this._activeBuffer.x < a2 && i4 - t4 > 0 && 0 === f2.getWidth(this._activeBuffer.x) && !f2.hasContent(this._activeBuffer.x) && f2.setCellFromCodepoint(this._activeBuffer.x, 0, 1, u2), this._dirtyRowTracker.markDirty(this._activeBuffer.y); + this._parser.precedingJoinState = v3, this._activeBuffer.x < a3 && i4 - t4 > 0 && 0 === f3.getWidth(this._activeBuffer.x) && !f3.hasContent(this._activeBuffer.x) && f3.setCellFromCodepoint(this._activeBuffer.x, 0, 1, u3), this._dirtyRowTracker.markDirty(this._activeBuffer.y); } registerCsiHandler(e4, t4) { - return "t" !== e4.final || e4.prefix || e4.intermediates ? this._parser.registerCsiHandler(e4, t4) : this._parser.registerCsiHandler(e4, (e5) => !w(e5.params[0], this._optionsService.rawOptions.windowOptions) || t4(e5)); + return "t" !== e4.final || e4.prefix || e4.intermediates ? this._parser.registerCsiHandler(e4, t4) : this._parser.registerCsiHandler(e4, (e5) => !w2(e5.params[0], this._optionsService.rawOptions.windowOptions) || t4(e5)); } registerDcsHandler(e4, t4) { - return this._parser.registerDcsHandler(e4, new m.DcsHandler(t4)); + return this._parser.registerDcsHandler(e4, new m2.DcsHandler(t4)); } registerEscHandler(e4, t4) { return this._parser.registerEscHandler(e4, t4); @@ -160344,9 +188654,9 @@ WARNING: This link could potentially be dangerous`)) { const t4 = e4.params[0]; return 1 === t4 && (this._curAttrData.bg |= 536870912), 2 !== t4 && 0 !== t4 || (this._curAttrData.bg &= -536870913), true; } - _eraseInBufferLine(e4, t4, i4, s3 = false, r2 = false) { - const n2 = this._activeBuffer.lines.get(this._activeBuffer.ybase + e4); - n2.replaceCells(t4, i4, this._activeBuffer.getNullCell(this._eraseAttrData()), r2), s3 && (n2.isWrapped = false); + _eraseInBufferLine(e4, t4, i4, s4 = false, r3 = false) { + const n3 = this._activeBuffer.lines.get(this._activeBuffer.ybase + e4); + n3.replaceCells(t4, i4, this._activeBuffer.getNullCell(this._eraseAttrData()), r3), s4 && (n3.isWrapped = false); } _resetBufferLine(e4, t4 = false) { const i4 = this._activeBuffer.lines.get(this._activeBuffer.ybase + e4); @@ -160390,8 +188700,8 @@ WARNING: This link could potentially be dangerous`)) { this._restrictCursor(); let t4 = e4.params[0] || 1; if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) return true; - const i4 = this._activeBuffer.ybase + this._activeBuffer.y, s3 = this._bufferService.rows - 1 - this._activeBuffer.scrollBottom, r2 = this._bufferService.rows - 1 + this._activeBuffer.ybase - s3 + 1; - for (; t4--; ) this._activeBuffer.lines.splice(r2 - 1, 1), this._activeBuffer.lines.splice(i4, 0, this._activeBuffer.getBlankLine(this._eraseAttrData())); + const i4 = this._activeBuffer.ybase + this._activeBuffer.y, s4 = this._bufferService.rows - 1 - this._activeBuffer.scrollBottom, r3 = this._bufferService.rows - 1 + this._activeBuffer.ybase - s4 + 1; + for (; t4--; ) this._activeBuffer.lines.splice(r3 - 1, 1), this._activeBuffer.lines.splice(i4, 0, this._activeBuffer.getBlankLine(this._eraseAttrData())); return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y, this._activeBuffer.scrollBottom), this._activeBuffer.x = 0, true; } deleteLines(e4) { @@ -160399,8 +188709,8 @@ WARNING: This link could potentially be dangerous`)) { let t4 = e4.params[0] || 1; if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) return true; const i4 = this._activeBuffer.ybase + this._activeBuffer.y; - let s3; - for (s3 = this._bufferService.rows - 1 - this._activeBuffer.scrollBottom, s3 = this._bufferService.rows - 1 + this._activeBuffer.ybase - s3; t4--; ) this._activeBuffer.lines.splice(i4, 1), this._activeBuffer.lines.splice(s3, 0, this._activeBuffer.getBlankLine(this._eraseAttrData())); + let s4; + for (s4 = this._bufferService.rows - 1 - this._activeBuffer.scrollBottom, s4 = this._bufferService.rows - 1 + this._activeBuffer.ybase - s4; t4--; ) this._activeBuffer.lines.splice(i4, 1), this._activeBuffer.lines.splice(s4, 0, this._activeBuffer.getBlankLine(this._eraseAttrData())); return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y, this._activeBuffer.scrollBottom), this._activeBuffer.x = 0, true; } insertChars(e4) { @@ -160420,7 +188730,7 @@ WARNING: This link could potentially be dangerous`)) { } scrollDown(e4) { let t4 = e4.params[0] || 1; - for (; t4--; ) this._activeBuffer.lines.splice(this._activeBuffer.ybase + this._activeBuffer.scrollBottom, 1), this._activeBuffer.lines.splice(this._activeBuffer.ybase + this._activeBuffer.scrollTop, 0, this._activeBuffer.getBlankLine(l.DEFAULT_ATTR_DATA)); + for (; t4--; ) this._activeBuffer.lines.splice(this._activeBuffer.ybase + this._activeBuffer.scrollBottom, 1), this._activeBuffer.lines.splice(this._activeBuffer.ybase + this._activeBuffer.scrollTop, 0, this._activeBuffer.getBlankLine(l2.DEFAULT_ATTR_DATA)); return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom), true; } scrollLeft(e4) { @@ -160467,21 +188777,21 @@ WARNING: This link could potentially be dangerous`)) { repeatPrecedingCharacter(e4) { const t4 = this._parser.precedingJoinState; if (!t4) return true; - const i4 = e4.params[0] || 1, s3 = p2.UnicodeService.extractWidth(t4), r2 = this._activeBuffer.x - s3, n2 = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y).getString(r2), o2 = new Uint32Array(n2.length * i4); - let a2 = 0; - for (let e5 = 0; e5 < n2.length; ) { - const t5 = n2.codePointAt(e5) || 0; - o2[a2++] = t5, e5 += t5 > 65535 ? 2 : 1; + const i4 = e4.params[0] || 1, s4 = p2.UnicodeService.extractWidth(t4), r3 = this._activeBuffer.x - s4, n3 = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y).getString(r3), o3 = new Uint32Array(n3.length * i4); + let a3 = 0; + for (let e5 = 0; e5 < n3.length; ) { + const t5 = n3.codePointAt(e5) || 0; + o3[a3++] = t5, e5 += t5 > 65535 ? 2 : 1; } - let h3 = a2; - for (let e5 = 1; e5 < i4; ++e5) o2.copyWithin(h3, 0, a2), h3 += a2; - return this.print(o2, 0, h3), true; + let h3 = a3; + for (let e5 = 1; e5 < i4; ++e5) o3.copyWithin(h3, 0, a3), h3 += a3; + return this.print(o3, 0, h3), true; } sendDeviceAttributesPrimary(e4) { - return e4.params[0] > 0 || (this._is("xterm") || this._is("rxvt-unicode") || this._is("screen") ? this._coreService.triggerDataEvent(n.C0.ESC + "[?1;2c") : this._is("linux") && this._coreService.triggerDataEvent(n.C0.ESC + "[?6c")), true; + return e4.params[0] > 0 || (this._is("xterm") || this._is("rxvt-unicode") || this._is("screen") ? this._coreService.triggerDataEvent(n2.C0.ESC + "[?1;2c") : this._is("linux") && this._coreService.triggerDataEvent(n2.C0.ESC + "[?6c")), true; } sendDeviceAttributesSecondary(e4) { - return e4.params[0] > 0 || (this._is("xterm") ? this._coreService.triggerDataEvent(n.C0.ESC + "[>0;276;0c") : this._is("rxvt-unicode") ? this._coreService.triggerDataEvent(n.C0.ESC + "[>85;95;0c") : this._is("linux") ? this._coreService.triggerDataEvent(e4.params[0] + "c") : this._is("screen") && this._coreService.triggerDataEvent(n.C0.ESC + "[>83;40003;0c")), true; + return e4.params[0] > 0 || (this._is("xterm") ? this._coreService.triggerDataEvent(n2.C0.ESC + "[>0;276;0c") : this._is("rxvt-unicode") ? this._coreService.triggerDataEvent(n2.C0.ESC + "[>85;95;0c") : this._is("linux") ? this._coreService.triggerDataEvent(e4.params[0] + "c") : this._is("screen") && this._coreService.triggerDataEvent(n2.C0.ESC + "[>83;40003;0c")), true; } _is(e4) { return 0 === (this._optionsService.rawOptions.termName + "").indexOf(e4); @@ -160502,7 +188812,7 @@ WARNING: This link could potentially be dangerous`)) { this._coreService.decPrivateModes.applicationCursorKeys = true; break; case 2: - this._charsetService.setgCharset(0, o.DEFAULT_CHARSET), this._charsetService.setgCharset(1, o.DEFAULT_CHARSET), this._charsetService.setgCharset(2, o.DEFAULT_CHARSET), this._charsetService.setgCharset(3, o.DEFAULT_CHARSET); + this._charsetService.setgCharset(0, o2.DEFAULT_CHARSET), this._charsetService.setgCharset(1, o2.DEFAULT_CHARSET), this._charsetService.setgCharset(2, o2.DEFAULT_CHARSET), this._charsetService.setgCharset(3, o2.DEFAULT_CHARSET); break; case 3: this._optionsService.rawOptions.windowOptions.setWinLines && (this._bufferService.resize(132, this._bufferService.rows), this._onRequestReset.fire()); @@ -160635,75 +188945,75 @@ WARNING: This link could potentially be dangerous`)) { return true; } requestMode(e4, t4) { - const i4 = this._coreService.decPrivateModes, { activeProtocol: s3, activeEncoding: r2 } = this._coreMouseService, o2 = this._coreService, { buffers: a2, cols: h3 } = this._bufferService, { active: c2, alt: l2 } = a2, d2 = this._optionsService.rawOptions, _3 = /* @__PURE__ */ __name((e5) => e5 ? 1 : 2, "_"), u2 = e4.params[0]; - return f2 = u2, v3 = t4 ? 2 === u2 ? 4 : 4 === u2 ? _3(o2.modes.insertMode) : 12 === u2 ? 3 : 20 === u2 ? _3(d2.convertEol) : 0 : 1 === u2 ? _3(i4.applicationCursorKeys) : 3 === u2 ? d2.windowOptions.setWinLines ? 80 === h3 ? 2 : 132 === h3 ? 1 : 0 : 0 : 6 === u2 ? _3(i4.origin) : 7 === u2 ? _3(i4.wraparound) : 8 === u2 ? 3 : 9 === u2 ? _3("X10" === s3) : 12 === u2 ? _3(d2.cursorBlink) : 25 === u2 ? _3(!o2.isCursorHidden) : 45 === u2 ? _3(i4.reverseWraparound) : 66 === u2 ? _3(i4.applicationKeypad) : 67 === u2 ? 4 : 1e3 === u2 ? _3("VT200" === s3) : 1002 === u2 ? _3("DRAG" === s3) : 1003 === u2 ? _3("ANY" === s3) : 1004 === u2 ? _3(i4.sendFocus) : 1005 === u2 ? 4 : 1006 === u2 ? _3("SGR" === r2) : 1015 === u2 ? 4 : 1016 === u2 ? _3("SGR_PIXELS" === r2) : 1048 === u2 ? 1 : 47 === u2 || 1047 === u2 || 1049 === u2 ? _3(c2 === l2) : 2004 === u2 ? _3(i4.bracketedPasteMode) : 0, o2.triggerDataEvent(`${n.C0.ESC}[${t4 ? "" : "?"}${f2};${v3}$y`), true; - var f2, v3; + const i4 = this._coreService.decPrivateModes, { activeProtocol: s4, activeEncoding: r3 } = this._coreMouseService, o3 = this._coreService, { buffers: a3, cols: h3 } = this._bufferService, { active: c3, alt: l3 } = a3, d3 = this._optionsService.rawOptions, _3 = /* @__PURE__ */ __name((e5) => e5 ? 1 : 2, "_"), u3 = e4.params[0]; + return f3 = u3, v3 = t4 ? 2 === u3 ? 4 : 4 === u3 ? _3(o3.modes.insertMode) : 12 === u3 ? 3 : 20 === u3 ? _3(d3.convertEol) : 0 : 1 === u3 ? _3(i4.applicationCursorKeys) : 3 === u3 ? d3.windowOptions.setWinLines ? 80 === h3 ? 2 : 132 === h3 ? 1 : 0 : 0 : 6 === u3 ? _3(i4.origin) : 7 === u3 ? _3(i4.wraparound) : 8 === u3 ? 3 : 9 === u3 ? _3("X10" === s4) : 12 === u3 ? _3(d3.cursorBlink) : 25 === u3 ? _3(!o3.isCursorHidden) : 45 === u3 ? _3(i4.reverseWraparound) : 66 === u3 ? _3(i4.applicationKeypad) : 67 === u3 ? 4 : 1e3 === u3 ? _3("VT200" === s4) : 1002 === u3 ? _3("DRAG" === s4) : 1003 === u3 ? _3("ANY" === s4) : 1004 === u3 ? _3(i4.sendFocus) : 1005 === u3 ? 4 : 1006 === u3 ? _3("SGR" === r3) : 1015 === u3 ? 4 : 1016 === u3 ? _3("SGR_PIXELS" === r3) : 1048 === u3 ? 1 : 47 === u3 || 1047 === u3 || 1049 === u3 ? _3(c3 === l3) : 2004 === u3 ? _3(i4.bracketedPasteMode) : 0, o3.triggerDataEvent(`${n2.C0.ESC}[${t4 ? "" : "?"}${f3};${v3}$y`), true; + var f3, v3; } - _updateAttrColor(e4, t4, i4, s3, r2) { - return 2 === t4 ? (e4 |= 50331648, e4 &= -16777216, e4 |= f.AttributeData.fromColorRGB([i4, s3, r2])) : 5 === t4 && (e4 &= -50331904, e4 |= 33554432 | 255 & i4), e4; + _updateAttrColor(e4, t4, i4, s4, r3) { + return 2 === t4 ? (e4 |= 50331648, e4 &= -16777216, e4 |= f2.AttributeData.fromColorRGB([i4, s4, r3])) : 5 === t4 && (e4 &= -50331904, e4 |= 33554432 | 255 & i4), e4; } _extractColor(e4, t4, i4) { - const s3 = [0, 0, -1, 0, 0, 0]; - let r2 = 0, n2 = 0; + const s4 = [0, 0, -1, 0, 0, 0]; + let r3 = 0, n3 = 0; do { - if (s3[n2 + r2] = e4.params[t4 + n2], e4.hasSubParams(t4 + n2)) { - const i5 = e4.getSubParams(t4 + n2); - let o2 = 0; + if (s4[n3 + r3] = e4.params[t4 + n3], e4.hasSubParams(t4 + n3)) { + const i5 = e4.getSubParams(t4 + n3); + let o3 = 0; do { - 5 === s3[1] && (r2 = 1), s3[n2 + o2 + 1 + r2] = i5[o2]; - } while (++o2 < i5.length && o2 + n2 + 1 + r2 < s3.length); + 5 === s4[1] && (r3 = 1), s4[n3 + o3 + 1 + r3] = i5[o3]; + } while (++o3 < i5.length && o3 + n3 + 1 + r3 < s4.length); break; } - if (5 === s3[1] && n2 + r2 >= 2 || 2 === s3[1] && n2 + r2 >= 5) break; - s3[1] && (r2 = 1); - } while (++n2 + t4 < e4.length && n2 + r2 < s3.length); - for (let e5 = 2; e5 < s3.length; ++e5) -1 === s3[e5] && (s3[e5] = 0); - switch (s3[0]) { + if (5 === s4[1] && n3 + r3 >= 2 || 2 === s4[1] && n3 + r3 >= 5) break; + s4[1] && (r3 = 1); + } while (++n3 + t4 < e4.length && n3 + r3 < s4.length); + for (let e5 = 2; e5 < s4.length; ++e5) -1 === s4[e5] && (s4[e5] = 0); + switch (s4[0]) { case 38: - i4.fg = this._updateAttrColor(i4.fg, s3[1], s3[3], s3[4], s3[5]); + i4.fg = this._updateAttrColor(i4.fg, s4[1], s4[3], s4[4], s4[5]); break; case 48: - i4.bg = this._updateAttrColor(i4.bg, s3[1], s3[3], s3[4], s3[5]); + i4.bg = this._updateAttrColor(i4.bg, s4[1], s4[3], s4[4], s4[5]); break; case 58: - i4.extended = i4.extended.clone(), i4.extended.underlineColor = this._updateAttrColor(i4.extended.underlineColor, s3[1], s3[3], s3[4], s3[5]); + i4.extended = i4.extended.clone(), i4.extended.underlineColor = this._updateAttrColor(i4.extended.underlineColor, s4[1], s4[3], s4[4], s4[5]); } - return n2; + return n3; } _processUnderline(e4, t4) { t4.extended = t4.extended.clone(), (!~e4 || e4 > 5) && (e4 = 1), t4.extended.underlineStyle = e4, t4.fg |= 268435456, 0 === e4 && (t4.fg &= -268435457), t4.updateExtended(); } _processSGR0(e4) { - e4.fg = l.DEFAULT_ATTR_DATA.fg, e4.bg = l.DEFAULT_ATTR_DATA.bg, e4.extended = e4.extended.clone(), e4.extended.underlineStyle = 0, e4.extended.underlineColor &= -67108864, e4.updateExtended(); + e4.fg = l2.DEFAULT_ATTR_DATA.fg, e4.bg = l2.DEFAULT_ATTR_DATA.bg, e4.extended = e4.extended.clone(), e4.extended.underlineStyle = 0, e4.extended.underlineColor &= -67108864, e4.updateExtended(); } charAttributes(e4) { if (1 === e4.length && 0 === e4.params[0]) return this._processSGR0(this._curAttrData), true; const t4 = e4.length; let i4; - const s3 = this._curAttrData; - for (let r2 = 0; r2 < t4; r2++) i4 = e4.params[r2], i4 >= 30 && i4 <= 37 ? (s3.fg &= -50331904, s3.fg |= 16777216 | i4 - 30) : i4 >= 40 && i4 <= 47 ? (s3.bg &= -50331904, s3.bg |= 16777216 | i4 - 40) : i4 >= 90 && i4 <= 97 ? (s3.fg &= -50331904, s3.fg |= 16777224 | i4 - 90) : i4 >= 100 && i4 <= 107 ? (s3.bg &= -50331904, s3.bg |= 16777224 | i4 - 100) : 0 === i4 ? this._processSGR0(s3) : 1 === i4 ? s3.fg |= 134217728 : 3 === i4 ? s3.bg |= 67108864 : 4 === i4 ? (s3.fg |= 268435456, this._processUnderline(e4.hasSubParams(r2) ? e4.getSubParams(r2)[0] : 1, s3)) : 5 === i4 ? s3.fg |= 536870912 : 7 === i4 ? s3.fg |= 67108864 : 8 === i4 ? s3.fg |= 1073741824 : 9 === i4 ? s3.fg |= 2147483648 : 2 === i4 ? s3.bg |= 134217728 : 21 === i4 ? this._processUnderline(2, s3) : 22 === i4 ? (s3.fg &= -134217729, s3.bg &= -134217729) : 23 === i4 ? s3.bg &= -67108865 : 24 === i4 ? (s3.fg &= -268435457, this._processUnderline(0, s3)) : 25 === i4 ? s3.fg &= -536870913 : 27 === i4 ? s3.fg &= -67108865 : 28 === i4 ? s3.fg &= -1073741825 : 29 === i4 ? s3.fg &= 2147483647 : 39 === i4 ? (s3.fg &= -67108864, s3.fg |= 16777215 & l.DEFAULT_ATTR_DATA.fg) : 49 === i4 ? (s3.bg &= -67108864, s3.bg |= 16777215 & l.DEFAULT_ATTR_DATA.bg) : 38 === i4 || 48 === i4 || 58 === i4 ? r2 += this._extractColor(e4, r2, s3) : 53 === i4 ? s3.bg |= 1073741824 : 55 === i4 ? s3.bg &= -1073741825 : 59 === i4 ? (s3.extended = s3.extended.clone(), s3.extended.underlineColor = -1, s3.updateExtended()) : 100 === i4 ? (s3.fg &= -67108864, s3.fg |= 16777215 & l.DEFAULT_ATTR_DATA.fg, s3.bg &= -67108864, s3.bg |= 16777215 & l.DEFAULT_ATTR_DATA.bg) : this._logService.debug("Unknown SGR attribute: %d.", i4); + const s4 = this._curAttrData; + for (let r3 = 0; r3 < t4; r3++) i4 = e4.params[r3], i4 >= 30 && i4 <= 37 ? (s4.fg &= -50331904, s4.fg |= 16777216 | i4 - 30) : i4 >= 40 && i4 <= 47 ? (s4.bg &= -50331904, s4.bg |= 16777216 | i4 - 40) : i4 >= 90 && i4 <= 97 ? (s4.fg &= -50331904, s4.fg |= 16777224 | i4 - 90) : i4 >= 100 && i4 <= 107 ? (s4.bg &= -50331904, s4.bg |= 16777224 | i4 - 100) : 0 === i4 ? this._processSGR0(s4) : 1 === i4 ? s4.fg |= 134217728 : 3 === i4 ? s4.bg |= 67108864 : 4 === i4 ? (s4.fg |= 268435456, this._processUnderline(e4.hasSubParams(r3) ? e4.getSubParams(r3)[0] : 1, s4)) : 5 === i4 ? s4.fg |= 536870912 : 7 === i4 ? s4.fg |= 67108864 : 8 === i4 ? s4.fg |= 1073741824 : 9 === i4 ? s4.fg |= 2147483648 : 2 === i4 ? s4.bg |= 134217728 : 21 === i4 ? this._processUnderline(2, s4) : 22 === i4 ? (s4.fg &= -134217729, s4.bg &= -134217729) : 23 === i4 ? s4.bg &= -67108865 : 24 === i4 ? (s4.fg &= -268435457, this._processUnderline(0, s4)) : 25 === i4 ? s4.fg &= -536870913 : 27 === i4 ? s4.fg &= -67108865 : 28 === i4 ? s4.fg &= -1073741825 : 29 === i4 ? s4.fg &= 2147483647 : 39 === i4 ? (s4.fg &= -67108864, s4.fg |= 16777215 & l2.DEFAULT_ATTR_DATA.fg) : 49 === i4 ? (s4.bg &= -67108864, s4.bg |= 16777215 & l2.DEFAULT_ATTR_DATA.bg) : 38 === i4 || 48 === i4 || 58 === i4 ? r3 += this._extractColor(e4, r3, s4) : 53 === i4 ? s4.bg |= 1073741824 : 55 === i4 ? s4.bg &= -1073741825 : 59 === i4 ? (s4.extended = s4.extended.clone(), s4.extended.underlineColor = -1, s4.updateExtended()) : 100 === i4 ? (s4.fg &= -67108864, s4.fg |= 16777215 & l2.DEFAULT_ATTR_DATA.fg, s4.bg &= -67108864, s4.bg |= 16777215 & l2.DEFAULT_ATTR_DATA.bg) : this._logService.debug("Unknown SGR attribute: %d.", i4); return true; } deviceStatus(e4) { switch (e4.params[0]) { case 5: - this._coreService.triggerDataEvent(`${n.C0.ESC}[0n`); + this._coreService.triggerDataEvent(`${n2.C0.ESC}[0n`); break; case 6: const e5 = this._activeBuffer.y + 1, t4 = this._activeBuffer.x + 1; - this._coreService.triggerDataEvent(`${n.C0.ESC}[${e5};${t4}R`); + this._coreService.triggerDataEvent(`${n2.C0.ESC}[${e5};${t4}R`); } return true; } deviceStatusPrivate(e4) { if (6 === e4.params[0]) { const e5 = this._activeBuffer.y + 1, t4 = this._activeBuffer.x + 1; - this._coreService.triggerDataEvent(`${n.C0.ESC}[?${e5};${t4}R`); + this._coreService.triggerDataEvent(`${n2.C0.ESC}[?${e5};${t4}R`); } return true; } softReset(e4) { - return this._coreService.isCursorHidden = false, this._onRequestSyncScrollBar.fire(), this._activeBuffer.scrollTop = 0, this._activeBuffer.scrollBottom = this._bufferService.rows - 1, this._curAttrData = l.DEFAULT_ATTR_DATA.clone(), this._coreService.reset(), this._charsetService.reset(), this._activeBuffer.savedX = 0, this._activeBuffer.savedY = this._activeBuffer.ybase, this._activeBuffer.savedCurAttrData.fg = this._curAttrData.fg, this._activeBuffer.savedCurAttrData.bg = this._curAttrData.bg, this._activeBuffer.savedCharset = this._charsetService.charset, this._coreService.decPrivateModes.origin = false, true; + return this._coreService.isCursorHidden = false, this._onRequestSyncScrollBar.fire(), this._activeBuffer.scrollTop = 0, this._activeBuffer.scrollBottom = this._bufferService.rows - 1, this._curAttrData = l2.DEFAULT_ATTR_DATA.clone(), this._coreService.reset(), this._charsetService.reset(), this._activeBuffer.savedX = 0, this._activeBuffer.savedY = this._activeBuffer.ybase, this._activeBuffer.savedCurAttrData.fg = this._curAttrData.fg, this._activeBuffer.savedCurAttrData.bg = this._curAttrData.bg, this._activeBuffer.savedCharset = this._charsetService.charset, this._coreService.decPrivateModes.origin = false, true; } setCursorStyle(e4) { const t4 = e4.params[0] || 1; @@ -160729,7 +189039,7 @@ WARNING: This link could potentially be dangerous`)) { return (e4.length < 2 || (i4 = e4.params[1]) > this._bufferService.rows || 0 === i4) && (i4 = this._bufferService.rows), i4 > t4 && (this._activeBuffer.scrollTop = t4 - 1, this._activeBuffer.scrollBottom = i4 - 1, this._setCursor(0, 0)), true; } windowOptions(e4) { - if (!w(e4.params[0], this._optionsService.rawOptions.windowOptions)) return true; + if (!w2(e4.params[0], this._optionsService.rawOptions.windowOptions)) return true; const t4 = e4.length > 1 ? e4.params[1] : 0; switch (e4.params[0]) { case 14: @@ -160739,7 +189049,7 @@ WARNING: This link could potentially be dangerous`)) { this._onRequestWindowsOptionsReport.fire(y2.GET_CELL_SIZE_PIXELS); break; case 18: - this._bufferService && this._coreService.triggerDataEvent(`${n.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`); + this._bufferService && this._coreService.triggerDataEvent(`${n2.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`); break; case 22: 0 !== t4 && 2 !== t4 || (this._windowTitleStack.push(this._windowTitle), this._windowTitleStack.length > 10 && this._windowTitleStack.shift()), 0 !== t4 && 1 !== t4 || (this._iconNameStack.push(this._iconName), this._iconNameStack.length > 10 && this._iconNameStack.shift()); @@ -160764,12 +189074,12 @@ WARNING: This link could potentially be dangerous`)) { setOrReportIndexedColor(e4) { const t4 = [], i4 = e4.split(";"); for (; i4.length > 1; ) { - const e5 = i4.shift(), s3 = i4.shift(); + const e5 = i4.shift(), s4 = i4.shift(); if (/^\d+$/.exec(e5)) { const i5 = parseInt(e5); - if (D(i5)) if ("?" === s3) t4.push({ type: 0, index: i5 }); + if (D2(i5)) if ("?" === s4) t4.push({ type: 0, index: i5 }); else { - const e6 = (0, S.parseColor)(s3); + const e6 = (0, S2.parseColor)(s4); e6 && t4.push({ type: 1, index: i5, color: e6 }); } } @@ -160783,9 +189093,9 @@ WARNING: This link could potentially be dangerous`)) { _createHyperlink(e4, t4) { this._getCurrentLinkId() && this._finishHyperlink(); const i4 = e4.split(":"); - let s3; - const r2 = i4.findIndex((e5) => e5.startsWith("id=")); - return -1 !== r2 && (s3 = i4[r2].slice(3) || void 0), this._curAttrData.extended = this._curAttrData.extended.clone(), this._curAttrData.extended.urlId = this._oscLinkService.registerLink({ id: s3, uri: t4 }), this._curAttrData.updateExtended(), true; + let s4; + const r3 = i4.findIndex((e5) => e5.startsWith("id=")); + return -1 !== r3 && (s4 = i4[r3].slice(3) || void 0), this._curAttrData.extended = this._curAttrData.extended.clone(), this._curAttrData.extended.urlId = this._oscLinkService.registerLink({ id: s4, uri: t4 }), this._curAttrData.updateExtended(), true; } _finishHyperlink() { return this._curAttrData.extended = this._curAttrData.extended.clone(), this._curAttrData.extended.urlId = 0, this._curAttrData.updateExtended(), true; @@ -160794,8 +189104,8 @@ WARNING: This link could potentially be dangerous`)) { const i4 = e4.split(";"); for (let e5 = 0; e5 < i4.length && !(t4 >= this._specialColors.length); ++e5, ++t4) if ("?" === i4[e5]) this._onColor.fire([{ type: 0, index: this._specialColors[t4] }]); else { - const s3 = (0, S.parseColor)(i4[e5]); - s3 && this._onColor.fire([{ type: 1, index: this._specialColors[t4], color: s3 }]); + const s4 = (0, S2.parseColor)(i4[e5]); + s4 && this._onColor.fire([{ type: 1, index: this._specialColors[t4], color: s4 }]); } return true; } @@ -160812,8 +189122,8 @@ WARNING: This link could potentially be dangerous`)) { if (!e4) return this._onColor.fire([{ type: 2 }]), true; const t4 = [], i4 = e4.split(";"); for (let e5 = 0; e5 < i4.length; ++e5) if (/^\d+$/.exec(i4[e5])) { - const s3 = parseInt(i4[e5]); - D(s3) && t4.push({ type: 2, index: s3 }); + const s4 = parseInt(i4[e5]); + D2(s4) && t4.push({ type: 2, index: s4 }); } return t4.length && this._onColor.fire(t4), true; } @@ -160836,10 +189146,10 @@ WARNING: This link could potentially be dangerous`)) { return this._logService.debug("Switching back to normal keypad."), this._coreService.decPrivateModes.applicationKeypad = false, this._onRequestSyncScrollBar.fire(), true; } selectDefaultCharset() { - return this._charsetService.setgLevel(0), this._charsetService.setgCharset(0, o.DEFAULT_CHARSET), true; + return this._charsetService.setgLevel(0), this._charsetService.setgCharset(0, o2.DEFAULT_CHARSET), true; } selectCharset(e4) { - return 2 !== e4.length ? (this.selectDefaultCharset(), true) : ("/" === e4[0] || this._charsetService.setgCharset(C[e4[0]], o.CHARSETS[e4[1]] || o.DEFAULT_CHARSET), true); + return 2 !== e4.length ? (this.selectDefaultCharset(), true) : ("/" === e4[0] || this._charsetService.setgCharset(C2[e4[0]], o2.CHARSETS[e4[1]] || o2.DEFAULT_CHARSET), true); } index() { return this._restrictCursor(), this._activeBuffer.y++, this._activeBuffer.y === this._activeBuffer.scrollBottom + 1 ? (this._activeBuffer.y--, this._bufferService.scroll(this._eraseAttrData())) : this._activeBuffer.y >= this._bufferService.rows && (this._activeBuffer.y = this._bufferService.rows - 1), this._restrictCursor(), true; @@ -160858,7 +189168,7 @@ WARNING: This link could potentially be dangerous`)) { return this._parser.reset(), this._onRequestReset.fire(), true; } reset() { - this._curAttrData = l.DEFAULT_ATTR_DATA.clone(), this._eraseAttrDataInternal = l.DEFAULT_ATTR_DATA.clone(); + this._curAttrData = l2.DEFAULT_ATTR_DATA.clone(), this._eraseAttrDataInternal = l2.DEFAULT_ATTR_DATA.clone(); } _eraseAttrData() { return this._eraseAttrDataInternal.bg &= -67108864, this._eraseAttrDataInternal.bg |= 67108863 & this._curAttrData.bg, this._eraseAttrDataInternal; @@ -160867,24 +189177,24 @@ WARNING: This link could potentially be dangerous`)) { return this._charsetService.setgLevel(e4), true; } screenAlignmentPattern() { - const e4 = new u.CellData(); + const e4 = new u2.CellData(); e4.content = 1 << 22 | "E".charCodeAt(0), e4.fg = this._curAttrData.fg, e4.bg = this._curAttrData.bg, this._setCursor(0, 0); for (let t4 = 0; t4 < this._bufferService.rows; ++t4) { - const i4 = this._activeBuffer.ybase + this._activeBuffer.y + t4, s3 = this._activeBuffer.lines.get(i4); - s3 && (s3.fill(e4), s3.isWrapped = false); + const i4 = this._activeBuffer.ybase + this._activeBuffer.y + t4, s4 = this._activeBuffer.lines.get(i4); + s4 && (s4.fill(e4), s4.isWrapped = false); } return this._dirtyRowTracker.markAllDirty(), this._setCursor(0, 0), true; } requestStatusString(e4, t4) { - const i4 = this._bufferService.buffer, s3 = this._optionsService.rawOptions; - return ((e5) => (this._coreService.triggerDataEvent(`${n.C0.ESC}${e5}${n.C0.ESC}\\`), true))('"q' === e4 ? `P1$r${this._curAttrData.isProtected() ? 1 : 0}"q` : '"p' === e4 ? 'P1$r61;1"p' : "r" === e4 ? `P1$r${i4.scrollTop + 1};${i4.scrollBottom + 1}r` : "m" === e4 ? "P1$r0m" : " q" === e4 ? `P1$r${{ block: 2, underline: 4, bar: 6 }[s3.cursorStyle] - (s3.cursorBlink ? 1 : 0)} q` : "P0$r"); + const i4 = this._bufferService.buffer, s4 = this._optionsService.rawOptions; + return ((e5) => (this._coreService.triggerDataEvent(`${n2.C0.ESC}${e5}${n2.C0.ESC}\\`), true))('"q' === e4 ? `P1$r${this._curAttrData.isProtected() ? 1 : 0}"q` : '"p' === e4 ? 'P1$r61;1"p' : "r" === e4 ? `P1$r${i4.scrollTop + 1};${i4.scrollBottom + 1}r` : "m" === e4 ? "P1$r0m" : " q" === e4 ? `P1$r${{ block: 2, underline: 4, bar: 6 }[s4.cursorStyle] - (s4.cursorBlink ? 1 : 0)} q` : "P0$r"); } markRangeDirty(e4, t4) { this._dirtyRowTracker.markRangeDirty(e4, t4); } } - t3.InputHandler = k; - let L = class { + t3.InputHandler = k2; + let L2 = class { static { __name(this, "L"); } @@ -160904,11 +189214,11 @@ WARNING: This link could potentially be dangerous`)) { this.markRangeDirty(0, this._bufferService.rows - 1); } }; - function D(e4) { + function D2(e4) { return 0 <= e4 && e4 < 256; } - __name(D, "D"); - L = s2([r(0, v2.IBufferService)], L); + __name(D2, "D"); + L2 = s3([r2(0, v2.IBufferService)], L2); }, 844: (e3, t3) => { function i3(e4) { for (const t4 of e4) t4.dispose(); @@ -160975,11 +189285,11 @@ WARNING: This link could potentially be dangerous`)) { constructor() { this._data = new i3(); } - set(e4, t4, s2, r, n) { - this._data.get(e4, t4) || this._data.set(e4, t4, new i3()), this._data.get(e4, t4).set(s2, r, n); + set(e4, t4, s3, r2, n2) { + this._data.get(e4, t4) || this._data.set(e4, t4, new i3()), this._data.get(e4, t4).set(s3, r2, n2); } - get(e4, t4, i4, s2) { - return this._data.get(e4, t4)?.get(i4, s2); + get(e4, t4, i4, s3) { + return this._data.get(e4, t4)?.get(i4, s3); } clear() { this._data.clear(); @@ -160987,12 +189297,12 @@ WARNING: This link could potentially be dangerous`)) { }; }, 6114: (e3, t3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.isChromeOS = t3.isLinux = t3.isWindows = t3.isIphone = t3.isIpad = t3.isMac = t3.getSafariVersion = t3.isSafari = t3.isLegacyEdge = t3.isFirefox = t3.isNode = void 0, t3.isNode = "undefined" != typeof process && "title" in process; - const i3 = t3.isNode ? "node" : navigator.userAgent, s2 = t3.isNode ? "node" : navigator.platform; + const i3 = t3.isNode ? "node" : navigator.userAgent, s3 = t3.isNode ? "node" : navigator.platform; t3.isFirefox = i3.includes("Firefox"), t3.isLegacyEdge = i3.includes("Edge"), t3.isSafari = /^((?!chrome|android).)*safari/i.test(i3), t3.getSafariVersion = function() { if (!t3.isSafari) return 0; const e4 = i3.match(/Version\/(\d+)/); return null === e4 || e4.length < 2 ? 0 : parseInt(e4[1]); - }, t3.isMac = ["Macintosh", "MacIntel", "MacPPC", "Mac68K"].includes(s2), t3.isIpad = "iPad" === s2, t3.isIphone = "iPhone" === s2, t3.isWindows = ["Windows", "Win16", "Win32", "WinCE"].includes(s2), t3.isLinux = s2.indexOf("Linux") >= 0, t3.isChromeOS = /\bCrOS\b/.test(i3); + }, t3.isMac = ["Macintosh", "MacIntel", "MacPPC", "Mac68K"].includes(s3), t3.isIpad = "iPad" === s3, t3.isIphone = "iPhone" === s3, t3.isWindows = ["Windows", "Win16", "Win32", "WinCE"].includes(s3), t3.isLinux = s3.indexOf("Linux") >= 0, t3.isChromeOS = /\bCrOS\b/.test(i3); }, 6106: (e3, t3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.SortedList = void 0; let i3 = 0; @@ -161033,15 +189343,15 @@ WARNING: This link could potentially be dangerous`)) { _search(e4) { let t4 = 0, i4 = this._array.length - 1; for (; i4 >= t4; ) { - let s2 = t4 + i4 >> 1; - const r = this._getKey(this._array[s2]); - if (r > e4) i4 = s2 - 1; + let s3 = t4 + i4 >> 1; + const r2 = this._getKey(this._array[s3]); + if (r2 > e4) i4 = s3 - 1; else { - if (!(r < e4)) { - for (; s2 > 0 && this._getKey(this._array[s2 - 1]) === e4; ) s2--; - return s2; + if (!(r2 < e4)) { + for (; s3 > 0 && this._getKey(this._array[s3 - 1]) === e4; ) s3--; + return s3; } - t4 = s2 + 1; + t4 = s3 + 1; } } return t4; @@ -161049,8 +189359,8 @@ WARNING: This link could potentially be dangerous`)) { }; }, 7226: (e3, t3, i3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.DebouncedIdleTask = t3.IdleTaskQueue = t3.PriorityTaskQueue = void 0; - const s2 = i3(6114); - class r { + const s3 = i3(6114); + class r2 { static { __name(this, "r"); } @@ -161072,15 +189382,15 @@ WARNING: This link could potentially be dangerous`)) { } _process(e4) { this._idleCallback = void 0; - let t4 = 0, i4 = 0, s3 = e4.timeRemaining(), r2 = 0; + let t4 = 0, i4 = 0, s4 = e4.timeRemaining(), r3 = 0; for (; this._i < this._tasks.length; ) { - if (t4 = Date.now(), this._tasks[this._i]() || this._i++, t4 = Math.max(1, Date.now() - t4), i4 = Math.max(t4, i4), r2 = e4.timeRemaining(), 1.5 * i4 > r2) return s3 - t4 < -20 && console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s3 - t4))}ms`), void this._start(); - s3 = r2; + if (t4 = Date.now(), this._tasks[this._i]() || this._i++, t4 = Math.max(1, Date.now() - t4), i4 = Math.max(t4, i4), r3 = e4.timeRemaining(), 1.5 * i4 > r3) return s4 - t4 < -20 && console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s4 - t4))}ms`), void this._start(); + s4 = r3; } this.clear(); } } - class n extends r { + class n2 extends r2 { static { __name(this, "n"); } @@ -161095,14 +189405,14 @@ WARNING: This link could potentially be dangerous`)) { return { timeRemaining: /* @__PURE__ */ __name(() => Math.max(0, t4 - Date.now()), "timeRemaining") }; } } - t3.PriorityTaskQueue = n, t3.IdleTaskQueue = !s2.isNode && "requestIdleCallback" in window ? class extends r { + t3.PriorityTaskQueue = n2, t3.IdleTaskQueue = !s3.isNode && "requestIdleCallback" in window ? class extends r2 { _requestCallback(e4) { return requestIdleCallback(e4); } _cancelCallback(e4) { cancelIdleCallback(e4); } - } : n, t3.DebouncedIdleTask = class { + } : n2, t3.DebouncedIdleTask = class { constructor() { this._queue = new t3.IdleTaskQueue(); } @@ -161115,10 +189425,10 @@ WARNING: This link could potentially be dangerous`)) { }; }, 9282: (e3, t3, i3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.updateWindowsModeWrappedState = void 0; - const s2 = i3(643); + const s3 = i3(643); t3.updateWindowsModeWrappedState = function(e4) { - const t4 = e4.buffer.lines.get(e4.buffer.ybase + e4.buffer.y - 1), i4 = t4?.get(e4.cols - 1), r = e4.buffer.lines.get(e4.buffer.ybase + e4.buffer.y); - r && i4 && (r.isWrapped = i4[s2.CHAR_DATA_CODE_INDEX] !== s2.NULL_CELL_CODE && i4[s2.CHAR_DATA_CODE_INDEX] !== s2.WHITESPACE_CELL_CODE); + const t4 = e4.buffer.lines.get(e4.buffer.ybase + e4.buffer.y - 1), i4 = t4?.get(e4.cols - 1), r2 = e4.buffer.lines.get(e4.buffer.ybase + e4.buffer.y); + r2 && i4 && (r2.isWrapped = i4[s3.CHAR_DATA_CODE_INDEX] !== s3.NULL_CELL_CODE && i4[s3.CHAR_DATA_CODE_INDEX] !== s3.WHITESPACE_CELL_CODE); }; }, 3734: (e3, t3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.ExtendedAttrs = t3.AttributeData = void 0; @@ -161127,7 +189437,7 @@ WARNING: This link could potentially be dangerous`)) { __name(this, "i"); } constructor() { - this.fg = 0, this.bg = 0, this.extended = new s2(); + this.fg = 0, this.bg = 0, this.extended = new s3(); } static toColorRGB(e4) { return [e4 >>> 16 & 255, e4 >>> 8 & 255, 255 & e4]; @@ -161256,7 +189566,7 @@ WARNING: This link could potentially be dangerous`)) { } } t3.AttributeData = i3; - class s2 { + class s3 { static { __name(this, "s"); } @@ -161295,28 +189605,28 @@ WARNING: This link could potentially be dangerous`)) { this._ext = 0, this._urlId = 0, this._ext = e4, this._urlId = t4; } clone() { - return new s2(this._ext, this._urlId); + return new s3(this._ext, this._urlId); } isEmpty() { return 0 === this.underlineStyle && 0 === this._urlId; } } - t3.ExtendedAttrs = s2; + t3.ExtendedAttrs = s3; }, 9092: (e3, t3, i3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.Buffer = t3.MAX_BUFFER_SIZE = void 0; - const s2 = i3(6349), r = i3(7226), n = i3(3734), o = i3(8437), a = i3(4634), h2 = i3(511), c = i3(643), l = i3(4863), d = i3(7116); + const s3 = i3(6349), r2 = i3(7226), n2 = i3(3734), o2 = i3(8437), a2 = i3(4634), h2 = i3(511), c2 = i3(643), l2 = i3(4863), d2 = i3(7116); t3.MAX_BUFFER_SIZE = 4294967295, t3.Buffer = class { constructor(e4, t4, i4) { - this._hasScrollback = e4, this._optionsService = t4, this._bufferService = i4, this.ydisp = 0, this.ybase = 0, this.y = 0, this.x = 0, this.tabs = {}, this.savedY = 0, this.savedX = 0, this.savedCurAttrData = o.DEFAULT_ATTR_DATA.clone(), this.savedCharset = d.DEFAULT_CHARSET, this.markers = [], this._nullCell = h2.CellData.fromCharData([0, c.NULL_CELL_CHAR, c.NULL_CELL_WIDTH, c.NULL_CELL_CODE]), this._whitespaceCell = h2.CellData.fromCharData([0, c.WHITESPACE_CELL_CHAR, c.WHITESPACE_CELL_WIDTH, c.WHITESPACE_CELL_CODE]), this._isClearing = false, this._memoryCleanupQueue = new r.IdleTaskQueue(), this._memoryCleanupPosition = 0, this._cols = this._bufferService.cols, this._rows = this._bufferService.rows, this.lines = new s2.CircularList(this._getCorrectBufferLength(this._rows)), this.scrollTop = 0, this.scrollBottom = this._rows - 1, this.setupTabStops(); + this._hasScrollback = e4, this._optionsService = t4, this._bufferService = i4, this.ydisp = 0, this.ybase = 0, this.y = 0, this.x = 0, this.tabs = {}, this.savedY = 0, this.savedX = 0, this.savedCurAttrData = o2.DEFAULT_ATTR_DATA.clone(), this.savedCharset = d2.DEFAULT_CHARSET, this.markers = [], this._nullCell = h2.CellData.fromCharData([0, c2.NULL_CELL_CHAR, c2.NULL_CELL_WIDTH, c2.NULL_CELL_CODE]), this._whitespaceCell = h2.CellData.fromCharData([0, c2.WHITESPACE_CELL_CHAR, c2.WHITESPACE_CELL_WIDTH, c2.WHITESPACE_CELL_CODE]), this._isClearing = false, this._memoryCleanupQueue = new r2.IdleTaskQueue(), this._memoryCleanupPosition = 0, this._cols = this._bufferService.cols, this._rows = this._bufferService.rows, this.lines = new s3.CircularList(this._getCorrectBufferLength(this._rows)), this.scrollTop = 0, this.scrollBottom = this._rows - 1, this.setupTabStops(); } getNullCell(e4) { - return e4 ? (this._nullCell.fg = e4.fg, this._nullCell.bg = e4.bg, this._nullCell.extended = e4.extended) : (this._nullCell.fg = 0, this._nullCell.bg = 0, this._nullCell.extended = new n.ExtendedAttrs()), this._nullCell; + return e4 ? (this._nullCell.fg = e4.fg, this._nullCell.bg = e4.bg, this._nullCell.extended = e4.extended) : (this._nullCell.fg = 0, this._nullCell.bg = 0, this._nullCell.extended = new n2.ExtendedAttrs()), this._nullCell; } getWhitespaceCell(e4) { - return e4 ? (this._whitespaceCell.fg = e4.fg, this._whitespaceCell.bg = e4.bg, this._whitespaceCell.extended = e4.extended) : (this._whitespaceCell.fg = 0, this._whitespaceCell.bg = 0, this._whitespaceCell.extended = new n.ExtendedAttrs()), this._whitespaceCell; + return e4 ? (this._whitespaceCell.fg = e4.fg, this._whitespaceCell.bg = e4.bg, this._whitespaceCell.extended = e4.extended) : (this._whitespaceCell.fg = 0, this._whitespaceCell.bg = 0, this._whitespaceCell.extended = new n2.ExtendedAttrs()), this._whitespaceCell; } getBlankLine(e4, t4) { - return new o.BufferLine(this._bufferService.cols, this.getNullCell(e4), t4); + return new o2.BufferLine(this._bufferService.cols, this.getNullCell(e4), t4); } get hasScrollback() { return this._hasScrollback && this.lines.maxLength > this._rows; @@ -161332,31 +189642,31 @@ WARNING: This link could potentially be dangerous`)) { } fillViewportRows(e4) { if (0 === this.lines.length) { - void 0 === e4 && (e4 = o.DEFAULT_ATTR_DATA); + void 0 === e4 && (e4 = o2.DEFAULT_ATTR_DATA); let t4 = this._rows; for (; t4--; ) this.lines.push(this.getBlankLine(e4)); } } clear() { - this.ydisp = 0, this.ybase = 0, this.y = 0, this.x = 0, this.lines = new s2.CircularList(this._getCorrectBufferLength(this._rows)), this.scrollTop = 0, this.scrollBottom = this._rows - 1, this.setupTabStops(); + this.ydisp = 0, this.ybase = 0, this.y = 0, this.x = 0, this.lines = new s3.CircularList(this._getCorrectBufferLength(this._rows)), this.scrollTop = 0, this.scrollBottom = this._rows - 1, this.setupTabStops(); } resize(e4, t4) { - const i4 = this.getNullCell(o.DEFAULT_ATTR_DATA); - let s3 = 0; - const r2 = this._getCorrectBufferLength(t4); - if (r2 > this.lines.maxLength && (this.lines.maxLength = r2), this.lines.length > 0) { - if (this._cols < e4) for (let t5 = 0; t5 < this.lines.length; t5++) s3 += +this.lines.get(t5).resize(e4, i4); - let n2 = 0; - if (this._rows < t4) for (let s4 = this._rows; s4 < t4; s4++) this.lines.length < t4 + this.ybase && (this._optionsService.rawOptions.windowsMode || void 0 !== this._optionsService.rawOptions.windowsPty.backend || void 0 !== this._optionsService.rawOptions.windowsPty.buildNumber ? this.lines.push(new o.BufferLine(e4, i4)) : this.ybase > 0 && this.lines.length <= this.ybase + this.y + n2 + 1 ? (this.ybase--, n2++, this.ydisp > 0 && this.ydisp--) : this.lines.push(new o.BufferLine(e4, i4))); + const i4 = this.getNullCell(o2.DEFAULT_ATTR_DATA); + let s4 = 0; + const r3 = this._getCorrectBufferLength(t4); + if (r3 > this.lines.maxLength && (this.lines.maxLength = r3), this.lines.length > 0) { + if (this._cols < e4) for (let t5 = 0; t5 < this.lines.length; t5++) s4 += +this.lines.get(t5).resize(e4, i4); + let n3 = 0; + if (this._rows < t4) for (let s5 = this._rows; s5 < t4; s5++) this.lines.length < t4 + this.ybase && (this._optionsService.rawOptions.windowsMode || void 0 !== this._optionsService.rawOptions.windowsPty.backend || void 0 !== this._optionsService.rawOptions.windowsPty.buildNumber ? this.lines.push(new o2.BufferLine(e4, i4)) : this.ybase > 0 && this.lines.length <= this.ybase + this.y + n3 + 1 ? (this.ybase--, n3++, this.ydisp > 0 && this.ydisp--) : this.lines.push(new o2.BufferLine(e4, i4))); else for (let e5 = this._rows; e5 > t4; e5--) this.lines.length > t4 + this.ybase && (this.lines.length > this.ybase + this.y + 1 ? this.lines.pop() : (this.ybase++, this.ydisp++)); - if (r2 < this.lines.maxLength) { - const e5 = this.lines.length - r2; - e5 > 0 && (this.lines.trimStart(e5), this.ybase = Math.max(this.ybase - e5, 0), this.ydisp = Math.max(this.ydisp - e5, 0), this.savedY = Math.max(this.savedY - e5, 0)), this.lines.maxLength = r2; + if (r3 < this.lines.maxLength) { + const e5 = this.lines.length - r3; + e5 > 0 && (this.lines.trimStart(e5), this.ybase = Math.max(this.ybase - e5, 0), this.ydisp = Math.max(this.ydisp - e5, 0), this.savedY = Math.max(this.savedY - e5, 0)), this.lines.maxLength = r3; } - this.x = Math.min(this.x, e4 - 1), this.y = Math.min(this.y, t4 - 1), n2 && (this.y += n2), this.savedX = Math.min(this.savedX, e4 - 1), this.scrollTop = 0; + this.x = Math.min(this.x, e4 - 1), this.y = Math.min(this.y, t4 - 1), n3 && (this.y += n3), this.savedX = Math.min(this.savedX, e4 - 1), this.scrollTop = 0; } - if (this.scrollBottom = t4 - 1, this._isReflowEnabled && (this._reflow(e4, t4), this._cols > e4)) for (let t5 = 0; t5 < this.lines.length; t5++) s3 += +this.lines.get(t5).resize(e4, i4); - this._cols = e4, this._rows = t4, this._memoryCleanupQueue.clear(), s3 > 0.1 * this.lines.length && (this._memoryCleanupPosition = 0, this._memoryCleanupQueue.enqueue(() => this._batchedMemoryCleanup())); + if (this.scrollBottom = t4 - 1, this._isReflowEnabled && (this._reflow(e4, t4), this._cols > e4)) for (let t5 = 0; t5 < this.lines.length; t5++) s4 += +this.lines.get(t5).resize(e4, i4); + this._cols = e4, this._rows = t4, this._memoryCleanupQueue.clear(), s4 > 0.1 * this.lines.length && (this._memoryCleanupPosition = 0, this._memoryCleanupQueue.enqueue(() => this._batchedMemoryCleanup())); } _batchedMemoryCleanup() { let e4 = true; @@ -161373,74 +189683,74 @@ WARNING: This link could potentially be dangerous`)) { this._cols !== e4 && (e4 > this._cols ? this._reflowLarger(e4, t4) : this._reflowSmaller(e4, t4)); } _reflowLarger(e4, t4) { - const i4 = (0, a.reflowLargerGetLinesToRemove)(this.lines, this._cols, e4, this.ybase + this.y, this.getNullCell(o.DEFAULT_ATTR_DATA)); + const i4 = (0, a2.reflowLargerGetLinesToRemove)(this.lines, this._cols, e4, this.ybase + this.y, this.getNullCell(o2.DEFAULT_ATTR_DATA)); if (i4.length > 0) { - const s3 = (0, a.reflowLargerCreateNewLayout)(this.lines, i4); - (0, a.reflowLargerApplyNewLayout)(this.lines, s3.layout), this._reflowLargerAdjustViewport(e4, t4, s3.countRemoved); + const s4 = (0, a2.reflowLargerCreateNewLayout)(this.lines, i4); + (0, a2.reflowLargerApplyNewLayout)(this.lines, s4.layout), this._reflowLargerAdjustViewport(e4, t4, s4.countRemoved); } } _reflowLargerAdjustViewport(e4, t4, i4) { - const s3 = this.getNullCell(o.DEFAULT_ATTR_DATA); - let r2 = i4; - for (; r2-- > 0; ) 0 === this.ybase ? (this.y > 0 && this.y--, this.lines.length < t4 && this.lines.push(new o.BufferLine(e4, s3))) : (this.ydisp === this.ybase && this.ydisp--, this.ybase--); + const s4 = this.getNullCell(o2.DEFAULT_ATTR_DATA); + let r3 = i4; + for (; r3-- > 0; ) 0 === this.ybase ? (this.y > 0 && this.y--, this.lines.length < t4 && this.lines.push(new o2.BufferLine(e4, s4))) : (this.ydisp === this.ybase && this.ydisp--, this.ybase--); this.savedY = Math.max(this.savedY - i4, 0); } _reflowSmaller(e4, t4) { - const i4 = this.getNullCell(o.DEFAULT_ATTR_DATA), s3 = []; - let r2 = 0; - for (let n2 = this.lines.length - 1; n2 >= 0; n2--) { - let h3 = this.lines.get(n2); + const i4 = this.getNullCell(o2.DEFAULT_ATTR_DATA), s4 = []; + let r3 = 0; + for (let n3 = this.lines.length - 1; n3 >= 0; n3--) { + let h3 = this.lines.get(n3); if (!h3 || !h3.isWrapped && h3.getTrimmedLength() <= e4) continue; - const c2 = [h3]; - for (; h3.isWrapped && n2 > 0; ) h3 = this.lines.get(--n2), c2.unshift(h3); - const l2 = this.ybase + this.y; - if (l2 >= n2 && l2 < n2 + c2.length) continue; - const d2 = c2[c2.length - 1].getTrimmedLength(), _2 = (0, a.reflowSmallerGetNewLineLengths)(c2, this._cols, e4), u = _2.length - c2.length; - let f; - f = 0 === this.ybase && this.y !== this.lines.length - 1 ? Math.max(0, this.y - this.lines.maxLength + u) : Math.max(0, this.lines.length - this.lines.maxLength + u); + const c3 = [h3]; + for (; h3.isWrapped && n3 > 0; ) h3 = this.lines.get(--n3), c3.unshift(h3); + const l3 = this.ybase + this.y; + if (l3 >= n3 && l3 < n3 + c3.length) continue; + const d3 = c3[c3.length - 1].getTrimmedLength(), _2 = (0, a2.reflowSmallerGetNewLineLengths)(c3, this._cols, e4), u2 = _2.length - c3.length; + let f2; + f2 = 0 === this.ybase && this.y !== this.lines.length - 1 ? Math.max(0, this.y - this.lines.maxLength + u2) : Math.max(0, this.lines.length - this.lines.maxLength + u2); const v2 = []; - for (let e5 = 0; e5 < u; e5++) { - const e6 = this.getBlankLine(o.DEFAULT_ATTR_DATA, true); + for (let e5 = 0; e5 < u2; e5++) { + const e6 = this.getBlankLine(o2.DEFAULT_ATTR_DATA, true); v2.push(e6); } - v2.length > 0 && (s3.push({ start: n2 + c2.length + r2, newLines: v2 }), r2 += v2.length), c2.push(...v2); + v2.length > 0 && (s4.push({ start: n3 + c3.length + r3, newLines: v2 }), r3 += v2.length), c3.push(...v2); let p2 = _2.length - 1, g2 = _2[p2]; 0 === g2 && (p2--, g2 = _2[p2]); - let m = c2.length - u - 1, S = d2; - for (; m >= 0; ) { - const e5 = Math.min(S, g2); - if (void 0 === c2[p2]) break; - if (c2[p2].copyCellsFrom(c2[m], S - e5, g2 - e5, e5, true), g2 -= e5, 0 === g2 && (p2--, g2 = _2[p2]), S -= e5, 0 === S) { - m--; - const e6 = Math.max(m, 0); - S = (0, a.getWrappedLineTrimmedLength)(c2, e6, this._cols); + let m2 = c3.length - u2 - 1, S2 = d3; + for (; m2 >= 0; ) { + const e5 = Math.min(S2, g2); + if (void 0 === c3[p2]) break; + if (c3[p2].copyCellsFrom(c3[m2], S2 - e5, g2 - e5, e5, true), g2 -= e5, 0 === g2 && (p2--, g2 = _2[p2]), S2 -= e5, 0 === S2) { + m2--; + const e6 = Math.max(m2, 0); + S2 = (0, a2.getWrappedLineTrimmedLength)(c3, e6, this._cols); } } - for (let t5 = 0; t5 < c2.length; t5++) _2[t5] < e4 && c2[t5].setCell(_2[t5], i4); - let C = u - f; - for (; C-- > 0; ) 0 === this.ybase ? this.y < t4 - 1 ? (this.y++, this.lines.pop()) : (this.ybase++, this.ydisp++) : this.ybase < Math.min(this.lines.maxLength, this.lines.length + r2) - t4 && (this.ybase === this.ydisp && this.ydisp++, this.ybase++); - this.savedY = Math.min(this.savedY + u, this.ybase + t4 - 1); + for (let t5 = 0; t5 < c3.length; t5++) _2[t5] < e4 && c3[t5].setCell(_2[t5], i4); + let C2 = u2 - f2; + for (; C2-- > 0; ) 0 === this.ybase ? this.y < t4 - 1 ? (this.y++, this.lines.pop()) : (this.ybase++, this.ydisp++) : this.ybase < Math.min(this.lines.maxLength, this.lines.length + r3) - t4 && (this.ybase === this.ydisp && this.ydisp++, this.ybase++); + this.savedY = Math.min(this.savedY + u2, this.ybase + t4 - 1); } - if (s3.length > 0) { + if (s4.length > 0) { const e5 = [], t5 = []; for (let e6 = 0; e6 < this.lines.length; e6++) t5.push(this.lines.get(e6)); const i5 = this.lines.length; - let n2 = i5 - 1, o2 = 0, a2 = s3[o2]; - this.lines.length = Math.min(this.lines.maxLength, this.lines.length + r2); + let n3 = i5 - 1, o3 = 0, a3 = s4[o3]; + this.lines.length = Math.min(this.lines.maxLength, this.lines.length + r3); let h3 = 0; - for (let c3 = Math.min(this.lines.maxLength - 1, i5 + r2 - 1); c3 >= 0; c3--) if (a2 && a2.start > n2 + h3) { - for (let e6 = a2.newLines.length - 1; e6 >= 0; e6--) this.lines.set(c3--, a2.newLines[e6]); - c3++, e5.push({ index: n2 + 1, amount: a2.newLines.length }), h3 += a2.newLines.length, a2 = s3[++o2]; - } else this.lines.set(c3, t5[n2--]); - let c2 = 0; - for (let t6 = e5.length - 1; t6 >= 0; t6--) e5[t6].index += c2, this.lines.onInsertEmitter.fire(e5[t6]), c2 += e5[t6].amount; - const l2 = Math.max(0, i5 + r2 - this.lines.maxLength); - l2 > 0 && this.lines.onTrimEmitter.fire(l2); + for (let c4 = Math.min(this.lines.maxLength - 1, i5 + r3 - 1); c4 >= 0; c4--) if (a3 && a3.start > n3 + h3) { + for (let e6 = a3.newLines.length - 1; e6 >= 0; e6--) this.lines.set(c4--, a3.newLines[e6]); + c4++, e5.push({ index: n3 + 1, amount: a3.newLines.length }), h3 += a3.newLines.length, a3 = s4[++o3]; + } else this.lines.set(c4, t5[n3--]); + let c3 = 0; + for (let t6 = e5.length - 1; t6 >= 0; t6--) e5[t6].index += c3, this.lines.onInsertEmitter.fire(e5[t6]), c3 += e5[t6].amount; + const l3 = Math.max(0, i5 + r3 - this.lines.maxLength); + l3 > 0 && this.lines.onTrimEmitter.fire(l3); } } - translateBufferLineToString(e4, t4, i4 = 0, s3) { - const r2 = this.lines.get(e4); - return r2 ? r2.translateToString(t4, i4, s3) : ""; + translateBufferLineToString(e4, t4, i4 = 0, s4) { + const r3 = this.lines.get(e4); + return r3 ? r3.translateToString(t4, i4, s4) : ""; } getWrappedRangeForLine(e4) { let t4 = e4, i4 = e4; @@ -161470,7 +189780,7 @@ WARNING: This link could potentially be dangerous`)) { this._isClearing = false; } addMarker(e4) { - const t4 = new l.Marker(e4); + const t4 = new l2.Marker(e4); return this.markers.push(t4), t4.register(this.lines.onTrim((e5) => { t4.line -= e5, t4.line < 0 && t4.dispose(); })), t4.register(this.lines.onInsert((e5) => { @@ -161485,25 +189795,25 @@ WARNING: This link could potentially be dangerous`)) { }; }, 8437: (e3, t3, i3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.BufferLine = t3.DEFAULT_ATTR_DATA = void 0; - const s2 = i3(3734), r = i3(511), n = i3(643), o = i3(482); - t3.DEFAULT_ATTR_DATA = Object.freeze(new s2.AttributeData()); - let a = 0; + const s3 = i3(3734), r2 = i3(511), n2 = i3(643), o2 = i3(482); + t3.DEFAULT_ATTR_DATA = Object.freeze(new s3.AttributeData()); + let a2 = 0; class h2 { static { __name(this, "h"); } constructor(e4, t4, i4 = false) { this.isWrapped = i4, this._combined = {}, this._extendedAttrs = {}, this._data = new Uint32Array(3 * e4); - const s3 = t4 || r.CellData.fromCharData([0, n.NULL_CELL_CHAR, n.NULL_CELL_WIDTH, n.NULL_CELL_CODE]); - for (let t5 = 0; t5 < e4; ++t5) this.setCell(t5, s3); + const s4 = t4 || r2.CellData.fromCharData([0, n2.NULL_CELL_CHAR, n2.NULL_CELL_WIDTH, n2.NULL_CELL_CODE]); + for (let t5 = 0; t5 < e4; ++t5) this.setCell(t5, s4); this.length = e4; } get(e4) { const t4 = this._data[3 * e4 + 0], i4 = 2097151 & t4; - return [this._data[3 * e4 + 1], 2097152 & t4 ? this._combined[e4] : i4 ? (0, o.stringFromCodePoint)(i4) : "", t4 >> 22, 2097152 & t4 ? this._combined[e4].charCodeAt(this._combined[e4].length - 1) : i4]; + return [this._data[3 * e4 + 1], 2097152 & t4 ? this._combined[e4] : i4 ? (0, o2.stringFromCodePoint)(i4) : "", t4 >> 22, 2097152 & t4 ? this._combined[e4].charCodeAt(this._combined[e4].length - 1) : i4]; } set(e4, t4) { - this._data[3 * e4 + 1] = t4[n.CHAR_DATA_ATTR_INDEX], t4[n.CHAR_DATA_CHAR_INDEX].length > 1 ? (this._combined[e4] = t4[1], this._data[3 * e4 + 0] = 2097152 | e4 | t4[n.CHAR_DATA_WIDTH_INDEX] << 22) : this._data[3 * e4 + 0] = t4[n.CHAR_DATA_CHAR_INDEX].charCodeAt(0) | t4[n.CHAR_DATA_WIDTH_INDEX] << 22; + this._data[3 * e4 + 1] = t4[n2.CHAR_DATA_ATTR_INDEX], t4[n2.CHAR_DATA_CHAR_INDEX].length > 1 ? (this._combined[e4] = t4[1], this._data[3 * e4 + 0] = 2097152 | e4 | t4[n2.CHAR_DATA_WIDTH_INDEX] << 22) : this._data[3 * e4 + 0] = t4[n2.CHAR_DATA_CHAR_INDEX].charCodeAt(0) | t4[n2.CHAR_DATA_WIDTH_INDEX] << 22; } getWidth(e4) { return this._data[3 * e4 + 0] >> 22; @@ -161529,42 +189839,42 @@ WARNING: This link could potentially be dangerous`)) { } getString(e4) { const t4 = this._data[3 * e4 + 0]; - return 2097152 & t4 ? this._combined[e4] : 2097151 & t4 ? (0, o.stringFromCodePoint)(2097151 & t4) : ""; + return 2097152 & t4 ? this._combined[e4] : 2097151 & t4 ? (0, o2.stringFromCodePoint)(2097151 & t4) : ""; } isProtected(e4) { return 536870912 & this._data[3 * e4 + 2]; } loadCell(e4, t4) { - return a = 3 * e4, t4.content = this._data[a + 0], t4.fg = this._data[a + 1], t4.bg = this._data[a + 2], 2097152 & t4.content && (t4.combinedData = this._combined[e4]), 268435456 & t4.bg && (t4.extended = this._extendedAttrs[e4]), t4; + return a2 = 3 * e4, t4.content = this._data[a2 + 0], t4.fg = this._data[a2 + 1], t4.bg = this._data[a2 + 2], 2097152 & t4.content && (t4.combinedData = this._combined[e4]), 268435456 & t4.bg && (t4.extended = this._extendedAttrs[e4]), t4; } setCell(e4, t4) { 2097152 & t4.content && (this._combined[e4] = t4.combinedData), 268435456 & t4.bg && (this._extendedAttrs[e4] = t4.extended), this._data[3 * e4 + 0] = t4.content, this._data[3 * e4 + 1] = t4.fg, this._data[3 * e4 + 2] = t4.bg; } - setCellFromCodepoint(e4, t4, i4, s3) { - 268435456 & s3.bg && (this._extendedAttrs[e4] = s3.extended), this._data[3 * e4 + 0] = t4 | i4 << 22, this._data[3 * e4 + 1] = s3.fg, this._data[3 * e4 + 2] = s3.bg; + setCellFromCodepoint(e4, t4, i4, s4) { + 268435456 & s4.bg && (this._extendedAttrs[e4] = s4.extended), this._data[3 * e4 + 0] = t4 | i4 << 22, this._data[3 * e4 + 1] = s4.fg, this._data[3 * e4 + 2] = s4.bg; } addCodepointToCell(e4, t4, i4) { - let s3 = this._data[3 * e4 + 0]; - 2097152 & s3 ? this._combined[e4] += (0, o.stringFromCodePoint)(t4) : 2097151 & s3 ? (this._combined[e4] = (0, o.stringFromCodePoint)(2097151 & s3) + (0, o.stringFromCodePoint)(t4), s3 &= -2097152, s3 |= 2097152) : s3 = t4 | 1 << 22, i4 && (s3 &= -12582913, s3 |= i4 << 22), this._data[3 * e4 + 0] = s3; + let s4 = this._data[3 * e4 + 0]; + 2097152 & s4 ? this._combined[e4] += (0, o2.stringFromCodePoint)(t4) : 2097151 & s4 ? (this._combined[e4] = (0, o2.stringFromCodePoint)(2097151 & s4) + (0, o2.stringFromCodePoint)(t4), s4 &= -2097152, s4 |= 2097152) : s4 = t4 | 1 << 22, i4 && (s4 &= -12582913, s4 |= i4 << 22), this._data[3 * e4 + 0] = s4; } insertCells(e4, t4, i4) { if ((e4 %= this.length) && 2 === this.getWidth(e4 - 1) && this.setCellFromCodepoint(e4 - 1, 0, 1, i4), t4 < this.length - e4) { - const s3 = new r.CellData(); - for (let i5 = this.length - e4 - t4 - 1; i5 >= 0; --i5) this.setCell(e4 + t4 + i5, this.loadCell(e4 + i5, s3)); - for (let s4 = 0; s4 < t4; ++s4) this.setCell(e4 + s4, i4); + const s4 = new r2.CellData(); + for (let i5 = this.length - e4 - t4 - 1; i5 >= 0; --i5) this.setCell(e4 + t4 + i5, this.loadCell(e4 + i5, s4)); + for (let s5 = 0; s5 < t4; ++s5) this.setCell(e4 + s5, i4); } else for (let t5 = e4; t5 < this.length; ++t5) this.setCell(t5, i4); 2 === this.getWidth(this.length - 1) && this.setCellFromCodepoint(this.length - 1, 0, 1, i4); } deleteCells(e4, t4, i4) { if (e4 %= this.length, t4 < this.length - e4) { - const s3 = new r.CellData(); - for (let i5 = 0; i5 < this.length - e4 - t4; ++i5) this.setCell(e4 + i5, this.loadCell(e4 + t4 + i5, s3)); + const s4 = new r2.CellData(); + for (let i5 = 0; i5 < this.length - e4 - t4; ++i5) this.setCell(e4 + i5, this.loadCell(e4 + t4 + i5, s4)); for (let e5 = this.length - t4; e5 < this.length; ++e5) this.setCell(e5, i4); } else for (let t5 = e4; t5 < this.length; ++t5) this.setCell(t5, i4); e4 && 2 === this.getWidth(e4 - 1) && this.setCellFromCodepoint(e4 - 1, 0, 1, i4), 0 !== this.getWidth(e4) || this.hasContent(e4) || this.setCellFromCodepoint(e4, 0, 1, i4); } - replaceCells(e4, t4, i4, s3 = false) { - if (s3) for (e4 && 2 === this.getWidth(e4 - 1) && !this.isProtected(e4 - 1) && this.setCellFromCodepoint(e4 - 1, 0, 1, i4), t4 < this.length && 2 === this.getWidth(t4 - 1) && !this.isProtected(t4) && this.setCellFromCodepoint(t4, 0, 1, i4); e4 < t4 && e4 < this.length; ) this.isProtected(e4) || this.setCell(e4, i4), e4++; + replaceCells(e4, t4, i4, s4 = false) { + if (s4) for (e4 && 2 === this.getWidth(e4 - 1) && !this.isProtected(e4 - 1) && this.setCellFromCodepoint(e4 - 1, 0, 1, i4), t4 < this.length && 2 === this.getWidth(t4 - 1) && !this.isProtected(t4) && this.setCellFromCodepoint(t4, 0, 1, i4); e4 < t4 && e4 < this.length; ) this.isProtected(e4) || this.setCell(e4, i4), e4++; else for (e4 && 2 === this.getWidth(e4 - 1) && this.setCellFromCodepoint(e4 - 1, 0, 1, i4), t4 < this.length && 2 === this.getWidth(t4 - 1) && this.setCellFromCodepoint(t4, 0, 1, i4); e4 < t4 && e4 < this.length; ) this.setCell(e4++, i4); } resize(e4, t4) { @@ -161581,12 +189891,12 @@ WARNING: This link could potentially be dangerous`)) { this._data = this._data.subarray(0, i4); const t5 = Object.keys(this._combined); for (let i5 = 0; i5 < t5.length; i5++) { - const s4 = parseInt(t5[i5], 10); - s4 >= e4 && delete this._combined[s4]; + const s5 = parseInt(t5[i5], 10); + s5 >= e4 && delete this._combined[s5]; } - const s3 = Object.keys(this._extendedAttrs); - for (let t6 = 0; t6 < s3.length; t6++) { - const i5 = parseInt(s3[t6], 10); + const s4 = Object.keys(this._extendedAttrs); + for (let t6 = 0; t6 < s4.length; t6++) { + const i5 = parseInt(s4[t6], 10); i5 >= e4 && delete this._extendedAttrs[i5]; } } @@ -161628,31 +189938,31 @@ WARNING: This link could potentially be dangerous`)) { for (let e4 = this.length - 1; e4 >= 0; --e4) if (4194303 & this._data[3 * e4 + 0] || 50331648 & this._data[3 * e4 + 2]) return e4 + (this._data[3 * e4 + 0] >> 22); return 0; } - copyCellsFrom(e4, t4, i4, s3, r2) { - const n2 = e4._data; - if (r2) for (let r3 = s3 - 1; r3 >= 0; r3--) { - for (let e5 = 0; e5 < 3; e5++) this._data[3 * (i4 + r3) + e5] = n2[3 * (t4 + r3) + e5]; - 268435456 & n2[3 * (t4 + r3) + 2] && (this._extendedAttrs[i4 + r3] = e4._extendedAttrs[t4 + r3]); + copyCellsFrom(e4, t4, i4, s4, r3) { + const n3 = e4._data; + if (r3) for (let r4 = s4 - 1; r4 >= 0; r4--) { + for (let e5 = 0; e5 < 3; e5++) this._data[3 * (i4 + r4) + e5] = n3[3 * (t4 + r4) + e5]; + 268435456 & n3[3 * (t4 + r4) + 2] && (this._extendedAttrs[i4 + r4] = e4._extendedAttrs[t4 + r4]); } - else for (let r3 = 0; r3 < s3; r3++) { - for (let e5 = 0; e5 < 3; e5++) this._data[3 * (i4 + r3) + e5] = n2[3 * (t4 + r3) + e5]; - 268435456 & n2[3 * (t4 + r3) + 2] && (this._extendedAttrs[i4 + r3] = e4._extendedAttrs[t4 + r3]); + else for (let r4 = 0; r4 < s4; r4++) { + for (let e5 = 0; e5 < 3; e5++) this._data[3 * (i4 + r4) + e5] = n3[3 * (t4 + r4) + e5]; + 268435456 & n3[3 * (t4 + r4) + 2] && (this._extendedAttrs[i4 + r4] = e4._extendedAttrs[t4 + r4]); } - const o2 = Object.keys(e4._combined); - for (let s4 = 0; s4 < o2.length; s4++) { - const r3 = parseInt(o2[s4], 10); - r3 >= t4 && (this._combined[r3 - t4 + i4] = e4._combined[r3]); + const o3 = Object.keys(e4._combined); + for (let s5 = 0; s5 < o3.length; s5++) { + const r4 = parseInt(o3[s5], 10); + r4 >= t4 && (this._combined[r4 - t4 + i4] = e4._combined[r4]); } } - translateToString(e4, t4, i4, s3) { - t4 = t4 ?? 0, i4 = i4 ?? this.length, e4 && (i4 = Math.min(i4, this.getTrimmedLength())), s3 && (s3.length = 0); - let r2 = ""; + translateToString(e4, t4, i4, s4) { + t4 = t4 ?? 0, i4 = i4 ?? this.length, e4 && (i4 = Math.min(i4, this.getTrimmedLength())), s4 && (s4.length = 0); + let r3 = ""; for (; t4 < i4; ) { - const e5 = this._data[3 * t4 + 0], i5 = 2097151 & e5, a2 = 2097152 & e5 ? this._combined[t4] : i5 ? (0, o.stringFromCodePoint)(i5) : n.WHITESPACE_CELL_CHAR; - if (r2 += a2, s3) for (let e6 = 0; e6 < a2.length; ++e6) s3.push(t4); + const e5 = this._data[3 * t4 + 0], i5 = 2097151 & e5, a3 = 2097152 & e5 ? this._combined[t4] : i5 ? (0, o2.stringFromCodePoint)(i5) : n2.WHITESPACE_CELL_CHAR; + if (r3 += a3, s4) for (let e6 = 0; e6 < a3.length; ++e6) s4.push(t4); t4 += e5 >> 22 || 1; } - return s3 && s3.push(t4), r2; + return s4 && s4.push(t4), r3; } } t3.BufferLine = h2; @@ -161664,75 +189974,75 @@ WARNING: This link could potentially be dangerous`)) { }, 4634: (e3, t3) => { function i3(e4, t4, i4) { if (t4 === e4.length - 1) return e4[t4].getTrimmedLength(); - const s2 = !e4[t4].hasContent(i4 - 1) && 1 === e4[t4].getWidth(i4 - 1), r = 2 === e4[t4 + 1].getWidth(0); - return s2 && r ? i4 - 1 : i4; + const s3 = !e4[t4].hasContent(i4 - 1) && 1 === e4[t4].getWidth(i4 - 1), r2 = 2 === e4[t4 + 1].getWidth(0); + return s3 && r2 ? i4 - 1 : i4; } __name(i3, "i"); - Object.defineProperty(t3, "__esModule", { value: true }), t3.getWrappedLineTrimmedLength = t3.reflowSmallerGetNewLineLengths = t3.reflowLargerApplyNewLayout = t3.reflowLargerCreateNewLayout = t3.reflowLargerGetLinesToRemove = void 0, t3.reflowLargerGetLinesToRemove = function(e4, t4, s2, r, n) { - const o = []; - for (let a = 0; a < e4.length - 1; a++) { - let h2 = a, c = e4.get(++h2); - if (!c.isWrapped) continue; - const l = [e4.get(a)]; - for (; h2 < e4.length && c.isWrapped; ) l.push(c), c = e4.get(++h2); - if (r >= a && r < h2) { - a += l.length - 1; + Object.defineProperty(t3, "__esModule", { value: true }), t3.getWrappedLineTrimmedLength = t3.reflowSmallerGetNewLineLengths = t3.reflowLargerApplyNewLayout = t3.reflowLargerCreateNewLayout = t3.reflowLargerGetLinesToRemove = void 0, t3.reflowLargerGetLinesToRemove = function(e4, t4, s3, r2, n2) { + const o2 = []; + for (let a2 = 0; a2 < e4.length - 1; a2++) { + let h2 = a2, c2 = e4.get(++h2); + if (!c2.isWrapped) continue; + const l2 = [e4.get(a2)]; + for (; h2 < e4.length && c2.isWrapped; ) l2.push(c2), c2 = e4.get(++h2); + if (r2 >= a2 && r2 < h2) { + a2 += l2.length - 1; continue; } - let d = 0, _2 = i3(l, d, t4), u = 1, f = 0; - for (; u < l.length; ) { - const e5 = i3(l, u, t4), r2 = e5 - f, o2 = s2 - _2, a2 = Math.min(r2, o2); - l[d].copyCellsFrom(l[u], f, _2, a2, false), _2 += a2, _2 === s2 && (d++, _2 = 0), f += a2, f === e5 && (u++, f = 0), 0 === _2 && 0 !== d && 2 === l[d - 1].getWidth(s2 - 1) && (l[d].copyCellsFrom(l[d - 1], s2 - 1, _2++, 1, false), l[d - 1].setCell(s2 - 1, n)); + let d2 = 0, _2 = i3(l2, d2, t4), u2 = 1, f2 = 0; + for (; u2 < l2.length; ) { + const e5 = i3(l2, u2, t4), r3 = e5 - f2, o3 = s3 - _2, a3 = Math.min(r3, o3); + l2[d2].copyCellsFrom(l2[u2], f2, _2, a3, false), _2 += a3, _2 === s3 && (d2++, _2 = 0), f2 += a3, f2 === e5 && (u2++, f2 = 0), 0 === _2 && 0 !== d2 && 2 === l2[d2 - 1].getWidth(s3 - 1) && (l2[d2].copyCellsFrom(l2[d2 - 1], s3 - 1, _2++, 1, false), l2[d2 - 1].setCell(s3 - 1, n2)); } - l[d].replaceCells(_2, s2, n); + l2[d2].replaceCells(_2, s3, n2); let v2 = 0; - for (let e5 = l.length - 1; e5 > 0 && (e5 > d || 0 === l[e5].getTrimmedLength()); e5--) v2++; - v2 > 0 && (o.push(a + l.length - v2), o.push(v2)), a += l.length - 1; + for (let e5 = l2.length - 1; e5 > 0 && (e5 > d2 || 0 === l2[e5].getTrimmedLength()); e5--) v2++; + v2 > 0 && (o2.push(a2 + l2.length - v2), o2.push(v2)), a2 += l2.length - 1; } - return o; + return o2; }, t3.reflowLargerCreateNewLayout = function(e4, t4) { const i4 = []; - let s2 = 0, r = t4[s2], n = 0; - for (let o = 0; o < e4.length; o++) if (r === o) { - const i5 = t4[++s2]; - e4.onDeleteEmitter.fire({ index: o - n, amount: i5 }), o += i5 - 1, n += i5, r = t4[++s2]; - } else i4.push(o); - return { layout: i4, countRemoved: n }; + let s3 = 0, r2 = t4[s3], n2 = 0; + for (let o2 = 0; o2 < e4.length; o2++) if (r2 === o2) { + const i5 = t4[++s3]; + e4.onDeleteEmitter.fire({ index: o2 - n2, amount: i5 }), o2 += i5 - 1, n2 += i5, r2 = t4[++s3]; + } else i4.push(o2); + return { layout: i4, countRemoved: n2 }; }, t3.reflowLargerApplyNewLayout = function(e4, t4) { const i4 = []; - for (let s2 = 0; s2 < t4.length; s2++) i4.push(e4.get(t4[s2])); + for (let s3 = 0; s3 < t4.length; s3++) i4.push(e4.get(t4[s3])); for (let t5 = 0; t5 < i4.length; t5++) e4.set(t5, i4[t5]); e4.length = t4.length; - }, t3.reflowSmallerGetNewLineLengths = function(e4, t4, s2) { - const r = [], n = e4.map((s3, r2) => i3(e4, r2, t4)).reduce((e5, t5) => e5 + t5); - let o = 0, a = 0, h2 = 0; - for (; h2 < n; ) { - if (n - h2 < s2) { - r.push(n - h2); + }, t3.reflowSmallerGetNewLineLengths = function(e4, t4, s3) { + const r2 = [], n2 = e4.map((s4, r3) => i3(e4, r3, t4)).reduce((e5, t5) => e5 + t5); + let o2 = 0, a2 = 0, h2 = 0; + for (; h2 < n2; ) { + if (n2 - h2 < s3) { + r2.push(n2 - h2); break; } - o += s2; - const c = i3(e4, a, t4); - o > c && (o -= c, a++); - const l = 2 === e4[a].getWidth(o - 1); - l && o--; - const d = l ? s2 - 1 : s2; - r.push(d), h2 += d; + o2 += s3; + const c2 = i3(e4, a2, t4); + o2 > c2 && (o2 -= c2, a2++); + const l2 = 2 === e4[a2].getWidth(o2 - 1); + l2 && o2--; + const d2 = l2 ? s3 - 1 : s3; + r2.push(d2), h2 += d2; } - return r; + return r2; }, t3.getWrappedLineTrimmedLength = i3; }, 5295: (e3, t3, i3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.BufferSet = void 0; - const s2 = i3(8460), r = i3(844), n = i3(9092); - class o extends r.Disposable { + const s3 = i3(8460), r2 = i3(844), n2 = i3(9092); + class o2 extends r2.Disposable { static { __name(this, "o"); } constructor(e4, t4) { - super(), this._optionsService = e4, this._bufferService = t4, this._onBufferActivate = this.register(new s2.EventEmitter()), this.onBufferActivate = this._onBufferActivate.event, this.reset(), this.register(this._optionsService.onSpecificOptionChange("scrollback", () => this.resize(this._bufferService.cols, this._bufferService.rows))), this.register(this._optionsService.onSpecificOptionChange("tabStopWidth", () => this.setupTabStops())); + super(), this._optionsService = e4, this._bufferService = t4, this._onBufferActivate = this.register(new s3.EventEmitter()), this.onBufferActivate = this._onBufferActivate.event, this.reset(), this.register(this._optionsService.onSpecificOptionChange("scrollback", () => this.resize(this._bufferService.cols, this._bufferService.rows))), this.register(this._optionsService.onSpecificOptionChange("tabStopWidth", () => this.setupTabStops())); } reset() { - this._normal = new n.Buffer(true, this._optionsService, this._bufferService), this._normal.fillViewportRows(), this._alt = new n.Buffer(false, this._optionsService, this._bufferService), this._activeBuffer = this._normal, this._onBufferActivate.fire({ activeBuffer: this._normal, inactiveBuffer: this._alt }), this.setupTabStops(); + this._normal = new n2.Buffer(true, this._optionsService, this._bufferService), this._normal.fillViewportRows(), this._alt = new n2.Buffer(false, this._optionsService, this._bufferService), this._activeBuffer = this._normal, this._onBufferActivate.fire({ activeBuffer: this._normal, inactiveBuffer: this._alt }), this.setupTabStops(); } get alt() { return this._alt; @@ -161756,19 +190066,19 @@ WARNING: This link could potentially be dangerous`)) { this._normal.setupTabStops(e4), this._alt.setupTabStops(e4); } } - t3.BufferSet = o; + t3.BufferSet = o2; }, 511: (e3, t3, i3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.CellData = void 0; - const s2 = i3(482), r = i3(643), n = i3(3734); - class o extends n.AttributeData { + const s3 = i3(482), r2 = i3(643), n2 = i3(3734); + class o2 extends n2.AttributeData { static { __name(this, "o"); } constructor() { - super(...arguments), this.content = 0, this.fg = 0, this.bg = 0, this.extended = new n.ExtendedAttrs(), this.combinedData = ""; + super(...arguments), this.content = 0, this.fg = 0, this.bg = 0, this.extended = new n2.ExtendedAttrs(), this.combinedData = ""; } static fromCharData(e4) { - const t4 = new o(); + const t4 = new o2(); return t4.setFromCharData(e4), t4; } isCombined() { @@ -161778,35 +190088,35 @@ WARNING: This link could potentially be dangerous`)) { return this.content >> 22; } getChars() { - return 2097152 & this.content ? this.combinedData : 2097151 & this.content ? (0, s2.stringFromCodePoint)(2097151 & this.content) : ""; + return 2097152 & this.content ? this.combinedData : 2097151 & this.content ? (0, s3.stringFromCodePoint)(2097151 & this.content) : ""; } getCode() { return this.isCombined() ? this.combinedData.charCodeAt(this.combinedData.length - 1) : 2097151 & this.content; } setFromCharData(e4) { - this.fg = e4[r.CHAR_DATA_ATTR_INDEX], this.bg = 0; + this.fg = e4[r2.CHAR_DATA_ATTR_INDEX], this.bg = 0; let t4 = false; - if (e4[r.CHAR_DATA_CHAR_INDEX].length > 2) t4 = true; - else if (2 === e4[r.CHAR_DATA_CHAR_INDEX].length) { - const i4 = e4[r.CHAR_DATA_CHAR_INDEX].charCodeAt(0); + if (e4[r2.CHAR_DATA_CHAR_INDEX].length > 2) t4 = true; + else if (2 === e4[r2.CHAR_DATA_CHAR_INDEX].length) { + const i4 = e4[r2.CHAR_DATA_CHAR_INDEX].charCodeAt(0); if (55296 <= i4 && i4 <= 56319) { - const s3 = e4[r.CHAR_DATA_CHAR_INDEX].charCodeAt(1); - 56320 <= s3 && s3 <= 57343 ? this.content = 1024 * (i4 - 55296) + s3 - 56320 + 65536 | e4[r.CHAR_DATA_WIDTH_INDEX] << 22 : t4 = true; + const s4 = e4[r2.CHAR_DATA_CHAR_INDEX].charCodeAt(1); + 56320 <= s4 && s4 <= 57343 ? this.content = 1024 * (i4 - 55296) + s4 - 56320 + 65536 | e4[r2.CHAR_DATA_WIDTH_INDEX] << 22 : t4 = true; } else t4 = true; - } else this.content = e4[r.CHAR_DATA_CHAR_INDEX].charCodeAt(0) | e4[r.CHAR_DATA_WIDTH_INDEX] << 22; - t4 && (this.combinedData = e4[r.CHAR_DATA_CHAR_INDEX], this.content = 2097152 | e4[r.CHAR_DATA_WIDTH_INDEX] << 22); + } else this.content = e4[r2.CHAR_DATA_CHAR_INDEX].charCodeAt(0) | e4[r2.CHAR_DATA_WIDTH_INDEX] << 22; + t4 && (this.combinedData = e4[r2.CHAR_DATA_CHAR_INDEX], this.content = 2097152 | e4[r2.CHAR_DATA_WIDTH_INDEX] << 22); } getAsCharData() { return [this.fg, this.getChars(), this.getWidth(), this.getCode()]; } } - t3.CellData = o; + t3.CellData = o2; }, 643: (e3, t3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.WHITESPACE_CELL_CODE = t3.WHITESPACE_CELL_WIDTH = t3.WHITESPACE_CELL_CHAR = t3.NULL_CELL_CODE = t3.NULL_CELL_WIDTH = t3.NULL_CELL_CHAR = t3.CHAR_DATA_CODE_INDEX = t3.CHAR_DATA_WIDTH_INDEX = t3.CHAR_DATA_CHAR_INDEX = t3.CHAR_DATA_ATTR_INDEX = t3.DEFAULT_EXT = t3.DEFAULT_ATTR = t3.DEFAULT_COLOR = void 0, t3.DEFAULT_COLOR = 0, t3.DEFAULT_ATTR = 256 | t3.DEFAULT_COLOR << 9, t3.DEFAULT_EXT = 0, t3.CHAR_DATA_ATTR_INDEX = 0, t3.CHAR_DATA_CHAR_INDEX = 1, t3.CHAR_DATA_WIDTH_INDEX = 2, t3.CHAR_DATA_CODE_INDEX = 3, t3.NULL_CELL_CHAR = "", t3.NULL_CELL_WIDTH = 1, t3.NULL_CELL_CODE = 0, t3.WHITESPACE_CELL_CHAR = " ", t3.WHITESPACE_CELL_WIDTH = 1, t3.WHITESPACE_CELL_CODE = 32; }, 4863: (e3, t3, i3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.Marker = void 0; - const s2 = i3(8460), r = i3(844); - class n { + const s3 = i3(8460), r2 = i3(844); + class n2 { static { __name(this, "n"); } @@ -161814,151 +190124,151 @@ WARNING: This link could potentially be dangerous`)) { return this._id; } constructor(e4) { - this.line = e4, this.isDisposed = false, this._disposables = [], this._id = n._nextId++, this._onDispose = this.register(new s2.EventEmitter()), this.onDispose = this._onDispose.event; + this.line = e4, this.isDisposed = false, this._disposables = [], this._id = n2._nextId++, this._onDispose = this.register(new s3.EventEmitter()), this.onDispose = this._onDispose.event; } dispose() { - this.isDisposed || (this.isDisposed = true, this.line = -1, this._onDispose.fire(), (0, r.disposeArray)(this._disposables), this._disposables.length = 0); + this.isDisposed || (this.isDisposed = true, this.line = -1, this._onDispose.fire(), (0, r2.disposeArray)(this._disposables), this._disposables.length = 0); } register(e4) { return this._disposables.push(e4), e4; } } - t3.Marker = n, n._nextId = 1; + t3.Marker = n2, n2._nextId = 1; }, 7116: (e3, t3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.DEFAULT_CHARSET = t3.CHARSETS = void 0, t3.CHARSETS = {}, t3.DEFAULT_CHARSET = t3.CHARSETS.B, t3.CHARSETS[0] = { "`": "◆", a: "▒", b: "␉", c: "␌", d: "␍", e: "␊", f: "°", g: "±", h: "", i: "␋", j: "┘", k: "┐", l: "┌", m: "└", n: "┼", o: "⎺", p: "⎻", q: "─", r: "⎼", s: "⎽", t: "├", u: "┤", v: "┴", w: "┬", x: "│", y: "≤", z: "≥", "{": "π", "|": "≠", "}": "£", "~": "·" }, t3.CHARSETS.A = { "#": "£" }, t3.CHARSETS.B = void 0, t3.CHARSETS[4] = { "#": "£", "@": "¾", "[": "ij", "\\": "½", "]": "|", "{": "¨", "|": "f", "}": "¼", "~": "´" }, t3.CHARSETS.C = t3.CHARSETS[5] = { "[": "Ä", "\\": "Ö", "]": "Å", "^": "Ü", "`": "é", "{": "ä", "|": "ö", "}": "å", "~": "ü" }, t3.CHARSETS.R = { "#": "£", "@": "à", "[": "°", "\\": "ç", "]": "§", "{": "é", "|": "ù", "}": "è", "~": "¨" }, t3.CHARSETS.Q = { "@": "à", "[": "â", "\\": "ç", "]": "ê", "^": "î", "`": "ô", "{": "é", "|": "ù", "}": "è", "~": "û" }, t3.CHARSETS.K = { "@": "§", "[": "Ä", "\\": "Ö", "]": "Ü", "{": "ä", "|": "ö", "}": "ü", "~": "ß" }, t3.CHARSETS.Y = { "#": "£", "@": "§", "[": "°", "\\": "ç", "]": "é", "`": "ù", "{": "à", "|": "ò", "}": "è", "~": "ì" }, t3.CHARSETS.E = t3.CHARSETS[6] = { "@": "Ä", "[": "Æ", "\\": "Ø", "]": "Å", "^": "Ü", "`": "ä", "{": "æ", "|": "ø", "}": "å", "~": "ü" }, t3.CHARSETS.Z = { "#": "£", "@": "§", "[": "¡", "\\": "Ñ", "]": "¿", "{": "°", "|": "ñ", "}": "ç" }, t3.CHARSETS.H = t3.CHARSETS[7] = { "@": "É", "[": "Ä", "\\": "Ö", "]": "Å", "^": "Ü", "`": "é", "{": "ä", "|": "ö", "}": "å", "~": "ü" }, t3.CHARSETS["="] = { "#": "ù", "@": "à", "[": "é", "\\": "ç", "]": "ê", "^": "î", _: "è", "`": "ô", "{": "ä", "|": "ö", "}": "ü", "~": "û" }; }, 2584: (e3, t3) => { - var i3, s2, r; + var i3, s3, r2; Object.defineProperty(t3, "__esModule", { value: true }), t3.C1_ESCAPED = t3.C1 = t3.C0 = void 0, function(e4) { e4.NUL = "\0", e4.SOH = "", e4.STX = "", e4.ETX = "", e4.EOT = "", e4.ENQ = "", e4.ACK = "", e4.BEL = "\x07", e4.BS = "\b", e4.HT = " ", e4.LF = "\n", e4.VT = "\v", e4.FF = "\f", e4.CR = "\r", e4.SO = "", e4.SI = "", e4.DLE = "", e4.DC1 = "", e4.DC2 = "", e4.DC3 = "", e4.DC4 = "", e4.NAK = "", e4.SYN = "", e4.ETB = "", e4.CAN = "", e4.EM = "", e4.SUB = "", e4.ESC = "\x1B", e4.FS = "", e4.GS = "", e4.RS = "", e4.US = "", e4.SP = " ", e4.DEL = ""; }(i3 || (t3.C0 = i3 = {})), function(e4) { e4.PAD = "", e4.HOP = "", e4.BPH = "", e4.NBH = "", e4.IND = "", e4.NEL = " ", e4.SSA = "", e4.ESA = "", e4.HTS = "", e4.HTJ = "", e4.VTS = "", e4.PLD = "", e4.PLU = "", e4.RI = "", e4.SS2 = "", e4.SS3 = "", e4.DCS = "", e4.PU1 = "", e4.PU2 = "", e4.STS = "", e4.CCH = "", e4.MW = "", e4.SPA = "", e4.EPA = "", e4.SOS = "", e4.SGCI = "", e4.SCI = "", e4.CSI = "", e4.ST = "", e4.OSC = "", e4.PM = "", e4.APC = ""; - }(s2 || (t3.C1 = s2 = {})), function(e4) { + }(s3 || (t3.C1 = s3 = {})), function(e4) { e4.ST = `${i3.ESC}\\`; - }(r || (t3.C1_ESCAPED = r = {})); + }(r2 || (t3.C1_ESCAPED = r2 = {})); }, 7399: (e3, t3, i3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.evaluateKeyboardEvent = void 0; - const s2 = i3(2584), r = { 48: ["0", ")"], 49: ["1", "!"], 50: ["2", "@"], 51: ["3", "#"], 52: ["4", "$"], 53: ["5", "%"], 54: ["6", "^"], 55: ["7", "&"], 56: ["8", "*"], 57: ["9", "("], 186: [";", ":"], 187: ["=", "+"], 188: [",", "<"], 189: ["-", "_"], 190: [".", ">"], 191: ["/", "?"], 192: ["`", "~"], 219: ["[", "{"], 220: ["\\", "|"], 221: ["]", "}"], 222: ["'", '"'] }; - t3.evaluateKeyboardEvent = function(e4, t4, i4, n) { - const o = { type: 0, cancel: false, key: void 0 }, a = (e4.shiftKey ? 1 : 0) | (e4.altKey ? 2 : 0) | (e4.ctrlKey ? 4 : 0) | (e4.metaKey ? 8 : 0); + const s3 = i3(2584), r2 = { 48: ["0", ")"], 49: ["1", "!"], 50: ["2", "@"], 51: ["3", "#"], 52: ["4", "$"], 53: ["5", "%"], 54: ["6", "^"], 55: ["7", "&"], 56: ["8", "*"], 57: ["9", "("], 186: [";", ":"], 187: ["=", "+"], 188: [",", "<"], 189: ["-", "_"], 190: [".", ">"], 191: ["/", "?"], 192: ["`", "~"], 219: ["[", "{"], 220: ["\\", "|"], 221: ["]", "}"], 222: ["'", '"'] }; + t3.evaluateKeyboardEvent = function(e4, t4, i4, n2) { + const o2 = { type: 0, cancel: false, key: void 0 }, a2 = (e4.shiftKey ? 1 : 0) | (e4.altKey ? 2 : 0) | (e4.ctrlKey ? 4 : 0) | (e4.metaKey ? 8 : 0); switch (e4.keyCode) { case 0: - "UIKeyInputUpArrow" === e4.key ? o.key = t4 ? s2.C0.ESC + "OA" : s2.C0.ESC + "[A" : "UIKeyInputLeftArrow" === e4.key ? o.key = t4 ? s2.C0.ESC + "OD" : s2.C0.ESC + "[D" : "UIKeyInputRightArrow" === e4.key ? o.key = t4 ? s2.C0.ESC + "OC" : s2.C0.ESC + "[C" : "UIKeyInputDownArrow" === e4.key && (o.key = t4 ? s2.C0.ESC + "OB" : s2.C0.ESC + "[B"); + "UIKeyInputUpArrow" === e4.key ? o2.key = t4 ? s3.C0.ESC + "OA" : s3.C0.ESC + "[A" : "UIKeyInputLeftArrow" === e4.key ? o2.key = t4 ? s3.C0.ESC + "OD" : s3.C0.ESC + "[D" : "UIKeyInputRightArrow" === e4.key ? o2.key = t4 ? s3.C0.ESC + "OC" : s3.C0.ESC + "[C" : "UIKeyInputDownArrow" === e4.key && (o2.key = t4 ? s3.C0.ESC + "OB" : s3.C0.ESC + "[B"); break; case 8: - o.key = e4.ctrlKey ? "\b" : s2.C0.DEL, e4.altKey && (o.key = s2.C0.ESC + o.key); + o2.key = e4.ctrlKey ? "\b" : s3.C0.DEL, e4.altKey && (o2.key = s3.C0.ESC + o2.key); break; case 9: if (e4.shiftKey) { - o.key = s2.C0.ESC + "[Z"; + o2.key = s3.C0.ESC + "[Z"; break; } - o.key = s2.C0.HT, o.cancel = true; + o2.key = s3.C0.HT, o2.cancel = true; break; case 13: - o.key = e4.altKey ? s2.C0.ESC + s2.C0.CR : s2.C0.CR, o.cancel = true; + o2.key = e4.altKey ? s3.C0.ESC + s3.C0.CR : s3.C0.CR, o2.cancel = true; break; case 27: - o.key = s2.C0.ESC, e4.altKey && (o.key = s2.C0.ESC + s2.C0.ESC), o.cancel = true; + o2.key = s3.C0.ESC, e4.altKey && (o2.key = s3.C0.ESC + s3.C0.ESC), o2.cancel = true; break; case 37: if (e4.metaKey) break; - a ? (o.key = s2.C0.ESC + "[1;" + (a + 1) + "D", o.key === s2.C0.ESC + "[1;3D" && (o.key = s2.C0.ESC + (i4 ? "b" : "[1;5D"))) : o.key = t4 ? s2.C0.ESC + "OD" : s2.C0.ESC + "[D"; + a2 ? (o2.key = s3.C0.ESC + "[1;" + (a2 + 1) + "D", o2.key === s3.C0.ESC + "[1;3D" && (o2.key = s3.C0.ESC + (i4 ? "b" : "[1;5D"))) : o2.key = t4 ? s3.C0.ESC + "OD" : s3.C0.ESC + "[D"; break; case 39: if (e4.metaKey) break; - a ? (o.key = s2.C0.ESC + "[1;" + (a + 1) + "C", o.key === s2.C0.ESC + "[1;3C" && (o.key = s2.C0.ESC + (i4 ? "f" : "[1;5C"))) : o.key = t4 ? s2.C0.ESC + "OC" : s2.C0.ESC + "[C"; + a2 ? (o2.key = s3.C0.ESC + "[1;" + (a2 + 1) + "C", o2.key === s3.C0.ESC + "[1;3C" && (o2.key = s3.C0.ESC + (i4 ? "f" : "[1;5C"))) : o2.key = t4 ? s3.C0.ESC + "OC" : s3.C0.ESC + "[C"; break; case 38: if (e4.metaKey) break; - a ? (o.key = s2.C0.ESC + "[1;" + (a + 1) + "A", i4 || o.key !== s2.C0.ESC + "[1;3A" || (o.key = s2.C0.ESC + "[1;5A")) : o.key = t4 ? s2.C0.ESC + "OA" : s2.C0.ESC + "[A"; + a2 ? (o2.key = s3.C0.ESC + "[1;" + (a2 + 1) + "A", i4 || o2.key !== s3.C0.ESC + "[1;3A" || (o2.key = s3.C0.ESC + "[1;5A")) : o2.key = t4 ? s3.C0.ESC + "OA" : s3.C0.ESC + "[A"; break; case 40: if (e4.metaKey) break; - a ? (o.key = s2.C0.ESC + "[1;" + (a + 1) + "B", i4 || o.key !== s2.C0.ESC + "[1;3B" || (o.key = s2.C0.ESC + "[1;5B")) : o.key = t4 ? s2.C0.ESC + "OB" : s2.C0.ESC + "[B"; + a2 ? (o2.key = s3.C0.ESC + "[1;" + (a2 + 1) + "B", i4 || o2.key !== s3.C0.ESC + "[1;3B" || (o2.key = s3.C0.ESC + "[1;5B")) : o2.key = t4 ? s3.C0.ESC + "OB" : s3.C0.ESC + "[B"; break; case 45: - e4.shiftKey || e4.ctrlKey || (o.key = s2.C0.ESC + "[2~"); + e4.shiftKey || e4.ctrlKey || (o2.key = s3.C0.ESC + "[2~"); break; case 46: - o.key = a ? s2.C0.ESC + "[3;" + (a + 1) + "~" : s2.C0.ESC + "[3~"; + o2.key = a2 ? s3.C0.ESC + "[3;" + (a2 + 1) + "~" : s3.C0.ESC + "[3~"; break; case 36: - o.key = a ? s2.C0.ESC + "[1;" + (a + 1) + "H" : t4 ? s2.C0.ESC + "OH" : s2.C0.ESC + "[H"; + o2.key = a2 ? s3.C0.ESC + "[1;" + (a2 + 1) + "H" : t4 ? s3.C0.ESC + "OH" : s3.C0.ESC + "[H"; break; case 35: - o.key = a ? s2.C0.ESC + "[1;" + (a + 1) + "F" : t4 ? s2.C0.ESC + "OF" : s2.C0.ESC + "[F"; + o2.key = a2 ? s3.C0.ESC + "[1;" + (a2 + 1) + "F" : t4 ? s3.C0.ESC + "OF" : s3.C0.ESC + "[F"; break; case 33: - e4.shiftKey ? o.type = 2 : e4.ctrlKey ? o.key = s2.C0.ESC + "[5;" + (a + 1) + "~" : o.key = s2.C0.ESC + "[5~"; + e4.shiftKey ? o2.type = 2 : e4.ctrlKey ? o2.key = s3.C0.ESC + "[5;" + (a2 + 1) + "~" : o2.key = s3.C0.ESC + "[5~"; break; case 34: - e4.shiftKey ? o.type = 3 : e4.ctrlKey ? o.key = s2.C0.ESC + "[6;" + (a + 1) + "~" : o.key = s2.C0.ESC + "[6~"; + e4.shiftKey ? o2.type = 3 : e4.ctrlKey ? o2.key = s3.C0.ESC + "[6;" + (a2 + 1) + "~" : o2.key = s3.C0.ESC + "[6~"; break; case 112: - o.key = a ? s2.C0.ESC + "[1;" + (a + 1) + "P" : s2.C0.ESC + "OP"; + o2.key = a2 ? s3.C0.ESC + "[1;" + (a2 + 1) + "P" : s3.C0.ESC + "OP"; break; case 113: - o.key = a ? s2.C0.ESC + "[1;" + (a + 1) + "Q" : s2.C0.ESC + "OQ"; + o2.key = a2 ? s3.C0.ESC + "[1;" + (a2 + 1) + "Q" : s3.C0.ESC + "OQ"; break; case 114: - o.key = a ? s2.C0.ESC + "[1;" + (a + 1) + "R" : s2.C0.ESC + "OR"; + o2.key = a2 ? s3.C0.ESC + "[1;" + (a2 + 1) + "R" : s3.C0.ESC + "OR"; break; case 115: - o.key = a ? s2.C0.ESC + "[1;" + (a + 1) + "S" : s2.C0.ESC + "OS"; + o2.key = a2 ? s3.C0.ESC + "[1;" + (a2 + 1) + "S" : s3.C0.ESC + "OS"; break; case 116: - o.key = a ? s2.C0.ESC + "[15;" + (a + 1) + "~" : s2.C0.ESC + "[15~"; + o2.key = a2 ? s3.C0.ESC + "[15;" + (a2 + 1) + "~" : s3.C0.ESC + "[15~"; break; case 117: - o.key = a ? s2.C0.ESC + "[17;" + (a + 1) + "~" : s2.C0.ESC + "[17~"; + o2.key = a2 ? s3.C0.ESC + "[17;" + (a2 + 1) + "~" : s3.C0.ESC + "[17~"; break; case 118: - o.key = a ? s2.C0.ESC + "[18;" + (a + 1) + "~" : s2.C0.ESC + "[18~"; + o2.key = a2 ? s3.C0.ESC + "[18;" + (a2 + 1) + "~" : s3.C0.ESC + "[18~"; break; case 119: - o.key = a ? s2.C0.ESC + "[19;" + (a + 1) + "~" : s2.C0.ESC + "[19~"; + o2.key = a2 ? s3.C0.ESC + "[19;" + (a2 + 1) + "~" : s3.C0.ESC + "[19~"; break; case 120: - o.key = a ? s2.C0.ESC + "[20;" + (a + 1) + "~" : s2.C0.ESC + "[20~"; + o2.key = a2 ? s3.C0.ESC + "[20;" + (a2 + 1) + "~" : s3.C0.ESC + "[20~"; break; case 121: - o.key = a ? s2.C0.ESC + "[21;" + (a + 1) + "~" : s2.C0.ESC + "[21~"; + o2.key = a2 ? s3.C0.ESC + "[21;" + (a2 + 1) + "~" : s3.C0.ESC + "[21~"; break; case 122: - o.key = a ? s2.C0.ESC + "[23;" + (a + 1) + "~" : s2.C0.ESC + "[23~"; + o2.key = a2 ? s3.C0.ESC + "[23;" + (a2 + 1) + "~" : s3.C0.ESC + "[23~"; break; case 123: - o.key = a ? s2.C0.ESC + "[24;" + (a + 1) + "~" : s2.C0.ESC + "[24~"; + o2.key = a2 ? s3.C0.ESC + "[24;" + (a2 + 1) + "~" : s3.C0.ESC + "[24~"; break; default: - if (!e4.ctrlKey || e4.shiftKey || e4.altKey || e4.metaKey) if (i4 && !n || !e4.altKey || e4.metaKey) !i4 || e4.altKey || e4.ctrlKey || e4.shiftKey || !e4.metaKey ? e4.key && !e4.ctrlKey && !e4.altKey && !e4.metaKey && e4.keyCode >= 48 && 1 === e4.key.length ? o.key = e4.key : e4.key && e4.ctrlKey && ("_" === e4.key && (o.key = s2.C0.US), "@" === e4.key && (o.key = s2.C0.NUL)) : 65 === e4.keyCode && (o.type = 1); + if (!e4.ctrlKey || e4.shiftKey || e4.altKey || e4.metaKey) if (i4 && !n2 || !e4.altKey || e4.metaKey) !i4 || e4.altKey || e4.ctrlKey || e4.shiftKey || !e4.metaKey ? e4.key && !e4.ctrlKey && !e4.altKey && !e4.metaKey && e4.keyCode >= 48 && 1 === e4.key.length ? o2.key = e4.key : e4.key && e4.ctrlKey && ("_" === e4.key && (o2.key = s3.C0.US), "@" === e4.key && (o2.key = s3.C0.NUL)) : 65 === e4.keyCode && (o2.type = 1); else { - const t5 = r[e4.keyCode], i5 = t5?.[e4.shiftKey ? 1 : 0]; - if (i5) o.key = s2.C0.ESC + i5; + const t5 = r2[e4.keyCode], i5 = t5?.[e4.shiftKey ? 1 : 0]; + if (i5) o2.key = s3.C0.ESC + i5; else if (e4.keyCode >= 65 && e4.keyCode <= 90) { const t6 = e4.ctrlKey ? e4.keyCode - 64 : e4.keyCode + 32; let i6 = String.fromCharCode(t6); - e4.shiftKey && (i6 = i6.toUpperCase()), o.key = s2.C0.ESC + i6; - } else if (32 === e4.keyCode) o.key = s2.C0.ESC + (e4.ctrlKey ? s2.C0.NUL : " "); + e4.shiftKey && (i6 = i6.toUpperCase()), o2.key = s3.C0.ESC + i6; + } else if (32 === e4.keyCode) o2.key = s3.C0.ESC + (e4.ctrlKey ? s3.C0.NUL : " "); else if ("Dead" === e4.key && e4.code.startsWith("Key")) { let t6 = e4.code.slice(3, 4); - e4.shiftKey || (t6 = t6.toLowerCase()), o.key = s2.C0.ESC + t6, o.cancel = true; + e4.shiftKey || (t6 = t6.toLowerCase()), o2.key = s3.C0.ESC + t6, o2.cancel = true; } } - else e4.keyCode >= 65 && e4.keyCode <= 90 ? o.key = String.fromCharCode(e4.keyCode - 64) : 32 === e4.keyCode ? o.key = s2.C0.NUL : e4.keyCode >= 51 && e4.keyCode <= 55 ? o.key = String.fromCharCode(e4.keyCode - 51 + 27) : 56 === e4.keyCode ? o.key = s2.C0.DEL : 219 === e4.keyCode ? o.key = s2.C0.ESC : 220 === e4.keyCode ? o.key = s2.C0.FS : 221 === e4.keyCode && (o.key = s2.C0.GS); + else e4.keyCode >= 65 && e4.keyCode <= 90 ? o2.key = String.fromCharCode(e4.keyCode - 64) : 32 === e4.keyCode ? o2.key = s3.C0.NUL : e4.keyCode >= 51 && e4.keyCode <= 55 ? o2.key = String.fromCharCode(e4.keyCode - 51 + 27) : 56 === e4.keyCode ? o2.key = s3.C0.DEL : 219 === e4.keyCode ? o2.key = s3.C0.ESC : 220 === e4.keyCode ? o2.key = s3.C0.FS : 221 === e4.keyCode && (o2.key = s3.C0.GS); } - return o; + return o2; }; }, 482: (e3, t3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.Utf8ToUtf32 = t3.StringToUtf32 = t3.utf32ToString = t3.stringFromCodePoint = void 0, t3.stringFromCodePoint = function(e4) { return e4 > 65535 ? (e4 -= 65536, String.fromCharCode(55296 + (e4 >> 10)) + String.fromCharCode(e4 % 1024 + 56320)) : String.fromCharCode(e4); }, t3.utf32ToString = function(e4, t4 = 0, i3 = e4.length) { - let s2 = ""; - for (let r = t4; r < i3; ++r) { - let t5 = e4[r]; - t5 > 65535 ? (t5 -= 65536, s2 += String.fromCharCode(55296 + (t5 >> 10)) + String.fromCharCode(t5 % 1024 + 56320)) : s2 += String.fromCharCode(t5); + let s3 = ""; + for (let r2 = t4; r2 < i3; ++r2) { + let t5 = e4[r2]; + t5 > 65535 ? (t5 -= 65536, s3 += String.fromCharCode(55296 + (t5 >> 10)) + String.fromCharCode(t5 % 1024 + 56320)) : s3 += String.fromCharCode(t5); } - return s2; + return s3; }, t3.StringToUtf32 = class { constructor() { this._interim = 0; @@ -161969,20 +190279,20 @@ WARNING: This link could potentially be dangerous`)) { decode(e4, t4) { const i3 = e4.length; if (!i3) return 0; - let s2 = 0, r = 0; + let s3 = 0, r2 = 0; if (this._interim) { - const i4 = e4.charCodeAt(r++); - 56320 <= i4 && i4 <= 57343 ? t4[s2++] = 1024 * (this._interim - 55296) + i4 - 56320 + 65536 : (t4[s2++] = this._interim, t4[s2++] = i4), this._interim = 0; + const i4 = e4.charCodeAt(r2++); + 56320 <= i4 && i4 <= 57343 ? t4[s3++] = 1024 * (this._interim - 55296) + i4 - 56320 + 65536 : (t4[s3++] = this._interim, t4[s3++] = i4), this._interim = 0; } - for (let n = r; n < i3; ++n) { - const r2 = e4.charCodeAt(n); - if (55296 <= r2 && r2 <= 56319) { - if (++n >= i3) return this._interim = r2, s2; - const o = e4.charCodeAt(n); - 56320 <= o && o <= 57343 ? t4[s2++] = 1024 * (r2 - 55296) + o - 56320 + 65536 : (t4[s2++] = r2, t4[s2++] = o); - } else 65279 !== r2 && (t4[s2++] = r2); + for (let n2 = r2; n2 < i3; ++n2) { + const r3 = e4.charCodeAt(n2); + if (55296 <= r3 && r3 <= 56319) { + if (++n2 >= i3) return this._interim = r3, s3; + const o2 = e4.charCodeAt(n2); + 56320 <= o2 && o2 <= 57343 ? t4[s3++] = 1024 * (r3 - 55296) + o2 - 56320 + 65536 : (t4[s3++] = r3, t4[s3++] = o2); + } else 65279 !== r3 && (t4[s3++] = r3); } - return s2; + return s3; } }, t3.Utf8ToUtf32 = class { constructor() { @@ -161994,116 +190304,116 @@ WARNING: This link could potentially be dangerous`)) { decode(e4, t4) { const i3 = e4.length; if (!i3) return 0; - let s2, r, n, o, a = 0, h2 = 0, c = 0; + let s3, r2, n2, o2, a2 = 0, h2 = 0, c2 = 0; if (this.interim[0]) { - let s3 = false, r2 = this.interim[0]; - r2 &= 192 == (224 & r2) ? 31 : 224 == (240 & r2) ? 15 : 7; - let n2, o2 = 0; - for (; (n2 = 63 & this.interim[++o2]) && o2 < 4; ) r2 <<= 6, r2 |= n2; - const h3 = 192 == (224 & this.interim[0]) ? 2 : 224 == (240 & this.interim[0]) ? 3 : 4, l2 = h3 - o2; - for (; c < l2; ) { - if (c >= i3) return 0; - if (n2 = e4[c++], 128 != (192 & n2)) { - c--, s3 = true; + let s4 = false, r3 = this.interim[0]; + r3 &= 192 == (224 & r3) ? 31 : 224 == (240 & r3) ? 15 : 7; + let n3, o3 = 0; + for (; (n3 = 63 & this.interim[++o3]) && o3 < 4; ) r3 <<= 6, r3 |= n3; + const h3 = 192 == (224 & this.interim[0]) ? 2 : 224 == (240 & this.interim[0]) ? 3 : 4, l3 = h3 - o3; + for (; c2 < l3; ) { + if (c2 >= i3) return 0; + if (n3 = e4[c2++], 128 != (192 & n3)) { + c2--, s4 = true; break; } - this.interim[o2++] = n2, r2 <<= 6, r2 |= 63 & n2; + this.interim[o3++] = n3, r3 <<= 6, r3 |= 63 & n3; } - s3 || (2 === h3 ? r2 < 128 ? c-- : t4[a++] = r2 : 3 === h3 ? r2 < 2048 || r2 >= 55296 && r2 <= 57343 || 65279 === r2 || (t4[a++] = r2) : r2 < 65536 || r2 > 1114111 || (t4[a++] = r2)), this.interim.fill(0); + s4 || (2 === h3 ? r3 < 128 ? c2-- : t4[a2++] = r3 : 3 === h3 ? r3 < 2048 || r3 >= 55296 && r3 <= 57343 || 65279 === r3 || (t4[a2++] = r3) : r3 < 65536 || r3 > 1114111 || (t4[a2++] = r3)), this.interim.fill(0); } - const l = i3 - 4; - let d = c; - for (; d < i3; ) { - for (; !(!(d < l) || 128 & (s2 = e4[d]) || 128 & (r = e4[d + 1]) || 128 & (n = e4[d + 2]) || 128 & (o = e4[d + 3])); ) t4[a++] = s2, t4[a++] = r, t4[a++] = n, t4[a++] = o, d += 4; - if (s2 = e4[d++], s2 < 128) t4[a++] = s2; - else if (192 == (224 & s2)) { - if (d >= i3) return this.interim[0] = s2, a; - if (r = e4[d++], 128 != (192 & r)) { - d--; + const l2 = i3 - 4; + let d2 = c2; + for (; d2 < i3; ) { + for (; !(!(d2 < l2) || 128 & (s3 = e4[d2]) || 128 & (r2 = e4[d2 + 1]) || 128 & (n2 = e4[d2 + 2]) || 128 & (o2 = e4[d2 + 3])); ) t4[a2++] = s3, t4[a2++] = r2, t4[a2++] = n2, t4[a2++] = o2, d2 += 4; + if (s3 = e4[d2++], s3 < 128) t4[a2++] = s3; + else if (192 == (224 & s3)) { + if (d2 >= i3) return this.interim[0] = s3, a2; + if (r2 = e4[d2++], 128 != (192 & r2)) { + d2--; continue; } - if (h2 = (31 & s2) << 6 | 63 & r, h2 < 128) { - d--; + if (h2 = (31 & s3) << 6 | 63 & r2, h2 < 128) { + d2--; continue; } - t4[a++] = h2; - } else if (224 == (240 & s2)) { - if (d >= i3) return this.interim[0] = s2, a; - if (r = e4[d++], 128 != (192 & r)) { - d--; + t4[a2++] = h2; + } else if (224 == (240 & s3)) { + if (d2 >= i3) return this.interim[0] = s3, a2; + if (r2 = e4[d2++], 128 != (192 & r2)) { + d2--; continue; } - if (d >= i3) return this.interim[0] = s2, this.interim[1] = r, a; - if (n = e4[d++], 128 != (192 & n)) { - d--; + if (d2 >= i3) return this.interim[0] = s3, this.interim[1] = r2, a2; + if (n2 = e4[d2++], 128 != (192 & n2)) { + d2--; continue; } - if (h2 = (15 & s2) << 12 | (63 & r) << 6 | 63 & n, h2 < 2048 || h2 >= 55296 && h2 <= 57343 || 65279 === h2) continue; - t4[a++] = h2; - } else if (240 == (248 & s2)) { - if (d >= i3) return this.interim[0] = s2, a; - if (r = e4[d++], 128 != (192 & r)) { - d--; + if (h2 = (15 & s3) << 12 | (63 & r2) << 6 | 63 & n2, h2 < 2048 || h2 >= 55296 && h2 <= 57343 || 65279 === h2) continue; + t4[a2++] = h2; + } else if (240 == (248 & s3)) { + if (d2 >= i3) return this.interim[0] = s3, a2; + if (r2 = e4[d2++], 128 != (192 & r2)) { + d2--; continue; } - if (d >= i3) return this.interim[0] = s2, this.interim[1] = r, a; - if (n = e4[d++], 128 != (192 & n)) { - d--; + if (d2 >= i3) return this.interim[0] = s3, this.interim[1] = r2, a2; + if (n2 = e4[d2++], 128 != (192 & n2)) { + d2--; continue; } - if (d >= i3) return this.interim[0] = s2, this.interim[1] = r, this.interim[2] = n, a; - if (o = e4[d++], 128 != (192 & o)) { - d--; + if (d2 >= i3) return this.interim[0] = s3, this.interim[1] = r2, this.interim[2] = n2, a2; + if (o2 = e4[d2++], 128 != (192 & o2)) { + d2--; continue; } - if (h2 = (7 & s2) << 18 | (63 & r) << 12 | (63 & n) << 6 | 63 & o, h2 < 65536 || h2 > 1114111) continue; - t4[a++] = h2; + if (h2 = (7 & s3) << 18 | (63 & r2) << 12 | (63 & n2) << 6 | 63 & o2, h2 < 65536 || h2 > 1114111) continue; + t4[a2++] = h2; } } - return a; + return a2; } }; }, 225: (e3, t3, i3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.UnicodeV6 = void 0; - const s2 = i3(1480), r = [[768, 879], [1155, 1158], [1160, 1161], [1425, 1469], [1471, 1471], [1473, 1474], [1476, 1477], [1479, 1479], [1536, 1539], [1552, 1557], [1611, 1630], [1648, 1648], [1750, 1764], [1767, 1768], [1770, 1773], [1807, 1807], [1809, 1809], [1840, 1866], [1958, 1968], [2027, 2035], [2305, 2306], [2364, 2364], [2369, 2376], [2381, 2381], [2385, 2388], [2402, 2403], [2433, 2433], [2492, 2492], [2497, 2500], [2509, 2509], [2530, 2531], [2561, 2562], [2620, 2620], [2625, 2626], [2631, 2632], [2635, 2637], [2672, 2673], [2689, 2690], [2748, 2748], [2753, 2757], [2759, 2760], [2765, 2765], [2786, 2787], [2817, 2817], [2876, 2876], [2879, 2879], [2881, 2883], [2893, 2893], [2902, 2902], [2946, 2946], [3008, 3008], [3021, 3021], [3134, 3136], [3142, 3144], [3146, 3149], [3157, 3158], [3260, 3260], [3263, 3263], [3270, 3270], [3276, 3277], [3298, 3299], [3393, 3395], [3405, 3405], [3530, 3530], [3538, 3540], [3542, 3542], [3633, 3633], [3636, 3642], [3655, 3662], [3761, 3761], [3764, 3769], [3771, 3772], [3784, 3789], [3864, 3865], [3893, 3893], [3895, 3895], [3897, 3897], [3953, 3966], [3968, 3972], [3974, 3975], [3984, 3991], [3993, 4028], [4038, 4038], [4141, 4144], [4146, 4146], [4150, 4151], [4153, 4153], [4184, 4185], [4448, 4607], [4959, 4959], [5906, 5908], [5938, 5940], [5970, 5971], [6002, 6003], [6068, 6069], [6071, 6077], [6086, 6086], [6089, 6099], [6109, 6109], [6155, 6157], [6313, 6313], [6432, 6434], [6439, 6440], [6450, 6450], [6457, 6459], [6679, 6680], [6912, 6915], [6964, 6964], [6966, 6970], [6972, 6972], [6978, 6978], [7019, 7027], [7616, 7626], [7678, 7679], [8203, 8207], [8234, 8238], [8288, 8291], [8298, 8303], [8400, 8431], [12330, 12335], [12441, 12442], [43014, 43014], [43019, 43019], [43045, 43046], [64286, 64286], [65024, 65039], [65056, 65059], [65279, 65279], [65529, 65531]], n = [[68097, 68099], [68101, 68102], [68108, 68111], [68152, 68154], [68159, 68159], [119143, 119145], [119155, 119170], [119173, 119179], [119210, 119213], [119362, 119364], [917505, 917505], [917536, 917631], [917760, 917999]]; - let o; + const s3 = i3(1480), r2 = [[768, 879], [1155, 1158], [1160, 1161], [1425, 1469], [1471, 1471], [1473, 1474], [1476, 1477], [1479, 1479], [1536, 1539], [1552, 1557], [1611, 1630], [1648, 1648], [1750, 1764], [1767, 1768], [1770, 1773], [1807, 1807], [1809, 1809], [1840, 1866], [1958, 1968], [2027, 2035], [2305, 2306], [2364, 2364], [2369, 2376], [2381, 2381], [2385, 2388], [2402, 2403], [2433, 2433], [2492, 2492], [2497, 2500], [2509, 2509], [2530, 2531], [2561, 2562], [2620, 2620], [2625, 2626], [2631, 2632], [2635, 2637], [2672, 2673], [2689, 2690], [2748, 2748], [2753, 2757], [2759, 2760], [2765, 2765], [2786, 2787], [2817, 2817], [2876, 2876], [2879, 2879], [2881, 2883], [2893, 2893], [2902, 2902], [2946, 2946], [3008, 3008], [3021, 3021], [3134, 3136], [3142, 3144], [3146, 3149], [3157, 3158], [3260, 3260], [3263, 3263], [3270, 3270], [3276, 3277], [3298, 3299], [3393, 3395], [3405, 3405], [3530, 3530], [3538, 3540], [3542, 3542], [3633, 3633], [3636, 3642], [3655, 3662], [3761, 3761], [3764, 3769], [3771, 3772], [3784, 3789], [3864, 3865], [3893, 3893], [3895, 3895], [3897, 3897], [3953, 3966], [3968, 3972], [3974, 3975], [3984, 3991], [3993, 4028], [4038, 4038], [4141, 4144], [4146, 4146], [4150, 4151], [4153, 4153], [4184, 4185], [4448, 4607], [4959, 4959], [5906, 5908], [5938, 5940], [5970, 5971], [6002, 6003], [6068, 6069], [6071, 6077], [6086, 6086], [6089, 6099], [6109, 6109], [6155, 6157], [6313, 6313], [6432, 6434], [6439, 6440], [6450, 6450], [6457, 6459], [6679, 6680], [6912, 6915], [6964, 6964], [6966, 6970], [6972, 6972], [6978, 6978], [7019, 7027], [7616, 7626], [7678, 7679], [8203, 8207], [8234, 8238], [8288, 8291], [8298, 8303], [8400, 8431], [12330, 12335], [12441, 12442], [43014, 43014], [43019, 43019], [43045, 43046], [64286, 64286], [65024, 65039], [65056, 65059], [65279, 65279], [65529, 65531]], n2 = [[68097, 68099], [68101, 68102], [68108, 68111], [68152, 68154], [68159, 68159], [119143, 119145], [119155, 119170], [119173, 119179], [119210, 119213], [119362, 119364], [917505, 917505], [917536, 917631], [917760, 917999]]; + let o2; t3.UnicodeV6 = class { constructor() { - if (this.version = "6", !o) { - o = new Uint8Array(65536), o.fill(1), o[0] = 0, o.fill(0, 1, 32), o.fill(0, 127, 160), o.fill(2, 4352, 4448), o[9001] = 2, o[9002] = 2, o.fill(2, 11904, 42192), o[12351] = 1, o.fill(2, 44032, 55204), o.fill(2, 63744, 64256), o.fill(2, 65040, 65050), o.fill(2, 65072, 65136), o.fill(2, 65280, 65377), o.fill(2, 65504, 65511); - for (let e4 = 0; e4 < r.length; ++e4) o.fill(0, r[e4][0], r[e4][1] + 1); + if (this.version = "6", !o2) { + o2 = new Uint8Array(65536), o2.fill(1), o2[0] = 0, o2.fill(0, 1, 32), o2.fill(0, 127, 160), o2.fill(2, 4352, 4448), o2[9001] = 2, o2[9002] = 2, o2.fill(2, 11904, 42192), o2[12351] = 1, o2.fill(2, 44032, 55204), o2.fill(2, 63744, 64256), o2.fill(2, 65040, 65050), o2.fill(2, 65072, 65136), o2.fill(2, 65280, 65377), o2.fill(2, 65504, 65511); + for (let e4 = 0; e4 < r2.length; ++e4) o2.fill(0, r2[e4][0], r2[e4][1] + 1); } } wcwidth(e4) { - return e4 < 32 ? 0 : e4 < 127 ? 1 : e4 < 65536 ? o[e4] : function(e5, t4) { - let i4, s3 = 0, r2 = t4.length - 1; - if (e5 < t4[0][0] || e5 > t4[r2][1]) return false; - for (; r2 >= s3; ) if (i4 = s3 + r2 >> 1, e5 > t4[i4][1]) s3 = i4 + 1; + return e4 < 32 ? 0 : e4 < 127 ? 1 : e4 < 65536 ? o2[e4] : function(e5, t4) { + let i4, s4 = 0, r3 = t4.length - 1; + if (e5 < t4[0][0] || e5 > t4[r3][1]) return false; + for (; r3 >= s4; ) if (i4 = s4 + r3 >> 1, e5 > t4[i4][1]) s4 = i4 + 1; else { if (!(e5 < t4[i4][0])) return true; - r2 = i4 - 1; + r3 = i4 - 1; } return false; - }(e4, n) ? 0 : e4 >= 131072 && e4 <= 196605 || e4 >= 196608 && e4 <= 262141 ? 2 : 1; + }(e4, n2) ? 0 : e4 >= 131072 && e4 <= 196605 || e4 >= 196608 && e4 <= 262141 ? 2 : 1; } charProperties(e4, t4) { - let i4 = this.wcwidth(e4), r2 = 0 === i4 && 0 !== t4; - if (r2) { - const e5 = s2.UnicodeService.extractWidth(t4); - 0 === e5 ? r2 = false : e5 > i4 && (i4 = e5); + let i4 = this.wcwidth(e4), r3 = 0 === i4 && 0 !== t4; + if (r3) { + const e5 = s3.UnicodeService.extractWidth(t4); + 0 === e5 ? r3 = false : e5 > i4 && (i4 = e5); } - return s2.UnicodeService.createPropertyValue(0, i4, r2); + return s3.UnicodeService.createPropertyValue(0, i4, r3); } }; }, 5981: (e3, t3, i3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.WriteBuffer = void 0; - const s2 = i3(8460), r = i3(844); - class n extends r.Disposable { + const s3 = i3(8460), r2 = i3(844); + class n2 extends r2.Disposable { static { __name(this, "n"); } constructor(e4) { - super(), this._action = e4, this._writeBuffer = [], this._callbacks = [], this._pendingData = 0, this._bufferOffset = 0, this._isSyncWriting = false, this._syncCalls = 0, this._didUserInput = false, this._onWriteParsed = this.register(new s2.EventEmitter()), this.onWriteParsed = this._onWriteParsed.event; + super(), this._action = e4, this._writeBuffer = [], this._callbacks = [], this._pendingData = 0, this._bufferOffset = 0, this._isSyncWriting = false, this._syncCalls = 0, this._didUserInput = false, this._onWriteParsed = this.register(new s3.EventEmitter()), this.onWriteParsed = this._onWriteParsed.event; } handleUserInput() { this._didUserInput = true; @@ -162130,37 +190440,37 @@ WARNING: This link could potentially be dangerous`)) { _innerWrite(e4 = 0, t4 = true) { const i4 = e4 || Date.now(); for (; this._writeBuffer.length > this._bufferOffset; ) { - const e5 = this._writeBuffer[this._bufferOffset], s3 = this._action(e5, t4); - if (s3) { + const e5 = this._writeBuffer[this._bufferOffset], s4 = this._action(e5, t4); + if (s4) { const e6 = /* @__PURE__ */ __name((e7) => Date.now() - i4 >= 12 ? setTimeout(() => this._innerWrite(0, e7)) : this._innerWrite(i4, e7), "e"); - return void s3.catch((e7) => (queueMicrotask(() => { + return void s4.catch((e7) => (queueMicrotask(() => { throw e7; }), Promise.resolve(false))).then(e6); } - const r2 = this._callbacks[this._bufferOffset]; - if (r2 && r2(), this._bufferOffset++, this._pendingData -= e5.length, Date.now() - i4 >= 12) break; + const r3 = this._callbacks[this._bufferOffset]; + if (r3 && r3(), this._bufferOffset++, this._pendingData -= e5.length, Date.now() - i4 >= 12) break; } this._writeBuffer.length > this._bufferOffset ? (this._bufferOffset > 50 && (this._writeBuffer = this._writeBuffer.slice(this._bufferOffset), this._callbacks = this._callbacks.slice(this._bufferOffset), this._bufferOffset = 0), setTimeout(() => this._innerWrite())) : (this._writeBuffer.length = 0, this._callbacks.length = 0, this._pendingData = 0, this._bufferOffset = 0), this._onWriteParsed.fire(); } } - t3.WriteBuffer = n; + t3.WriteBuffer = n2; }, 5941: (e3, t3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.toRgbString = t3.parseColor = void 0; - const i3 = /^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/, s2 = /^[\da-f]+$/; - function r(e4, t4) { - const i4 = e4.toString(16), s3 = i4.length < 2 ? "0" + i4 : i4; + const i3 = /^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/, s3 = /^[\da-f]+$/; + function r2(e4, t4) { + const i4 = e4.toString(16), s4 = i4.length < 2 ? "0" + i4 : i4; switch (t4) { case 4: return i4[0]; case 8: - return s3; + return s4; case 12: - return (s3 + s3).slice(0, 3); + return (s4 + s4).slice(0, 3); default: - return s3 + s3; + return s4 + s4; } } - __name(r, "r"); + __name(r2, "r"); t3.parseColor = function(e4) { if (!e4) return; let t4 = e4.toLowerCase(); @@ -162171,31 +190481,31 @@ WARNING: This link could potentially be dangerous`)) { const t5 = e5[1] ? 15 : e5[4] ? 255 : e5[7] ? 4095 : 65535; return [Math.round(parseInt(e5[1] || e5[4] || e5[7] || e5[10], 16) / t5 * 255), Math.round(parseInt(e5[2] || e5[5] || e5[8] || e5[11], 16) / t5 * 255), Math.round(parseInt(e5[3] || e5[6] || e5[9] || e5[12], 16) / t5 * 255)]; } - } else if (0 === t4.indexOf("#") && (t4 = t4.slice(1), s2.exec(t4) && [3, 6, 9, 12].includes(t4.length))) { + } else if (0 === t4.indexOf("#") && (t4 = t4.slice(1), s3.exec(t4) && [3, 6, 9, 12].includes(t4.length))) { const e5 = t4.length / 3, i4 = [0, 0, 0]; - for (let s3 = 0; s3 < 3; ++s3) { - const r2 = parseInt(t4.slice(e5 * s3, e5 * s3 + e5), 16); - i4[s3] = 1 === e5 ? r2 << 4 : 2 === e5 ? r2 : 3 === e5 ? r2 >> 4 : r2 >> 8; + for (let s4 = 0; s4 < 3; ++s4) { + const r3 = parseInt(t4.slice(e5 * s4, e5 * s4 + e5), 16); + i4[s4] = 1 === e5 ? r3 << 4 : 2 === e5 ? r3 : 3 === e5 ? r3 >> 4 : r3 >> 8; } return i4; } }, t3.toRgbString = function(e4, t4 = 16) { - const [i4, s3, n] = e4; - return `rgb:${r(i4, t4)}/${r(s3, t4)}/${r(n, t4)}`; + const [i4, s4, n2] = e4; + return `rgb:${r2(i4, t4)}/${r2(s4, t4)}/${r2(n2, t4)}`; }; }, 5770: (e3, t3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.PAYLOAD_LIMIT = void 0, t3.PAYLOAD_LIMIT = 1e7; }, 6351: (e3, t3, i3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.DcsHandler = t3.DcsParser = void 0; - const s2 = i3(482), r = i3(8742), n = i3(5770), o = []; + const s3 = i3(482), r2 = i3(8742), n2 = i3(5770), o2 = []; t3.DcsParser = class { constructor() { - this._handlers = /* @__PURE__ */ Object.create(null), this._active = o, this._ident = 0, this._handlerFb = () => { + this._handlers = /* @__PURE__ */ Object.create(null), this._active = o2, this._ident = 0, this._handlerFb = () => { }, this._stack = { paused: false, loopPosition: 0, fallThrough: false }; } dispose() { this._handlers = /* @__PURE__ */ Object.create(null), this._handlerFb = () => { - }, this._active = o; + }, this._active = o2; } registerHandler(e4, t4) { void 0 === this._handlers[e4] && (this._handlers[e4] = []); @@ -162213,50 +190523,50 @@ WARNING: This link could potentially be dangerous`)) { } reset() { if (this._active.length) for (let e4 = this._stack.paused ? this._stack.loopPosition - 1 : this._active.length - 1; e4 >= 0; --e4) this._active[e4].unhook(false); - this._stack.paused = false, this._active = o, this._ident = 0; + this._stack.paused = false, this._active = o2, this._ident = 0; } hook(e4, t4) { - if (this.reset(), this._ident = e4, this._active = this._handlers[e4] || o, this._active.length) for (let e5 = this._active.length - 1; e5 >= 0; e5--) this._active[e5].hook(t4); + if (this.reset(), this._ident = e4, this._active = this._handlers[e4] || o2, this._active.length) for (let e5 = this._active.length - 1; e5 >= 0; e5--) this._active[e5].hook(t4); else this._handlerFb(this._ident, "HOOK", t4); } put(e4, t4, i4) { - if (this._active.length) for (let s3 = this._active.length - 1; s3 >= 0; s3--) this._active[s3].put(e4, t4, i4); - else this._handlerFb(this._ident, "PUT", (0, s2.utf32ToString)(e4, t4, i4)); + if (this._active.length) for (let s4 = this._active.length - 1; s4 >= 0; s4--) this._active[s4].put(e4, t4, i4); + else this._handlerFb(this._ident, "PUT", (0, s3.utf32ToString)(e4, t4, i4)); } unhook(e4, t4 = true) { if (this._active.length) { - let i4 = false, s3 = this._active.length - 1, r2 = false; - if (this._stack.paused && (s3 = this._stack.loopPosition - 1, i4 = t4, r2 = this._stack.fallThrough, this._stack.paused = false), !r2 && false === i4) { - for (; s3 >= 0 && (i4 = this._active[s3].unhook(e4), true !== i4); s3--) if (i4 instanceof Promise) return this._stack.paused = true, this._stack.loopPosition = s3, this._stack.fallThrough = false, i4; - s3--; + let i4 = false, s4 = this._active.length - 1, r3 = false; + if (this._stack.paused && (s4 = this._stack.loopPosition - 1, i4 = t4, r3 = this._stack.fallThrough, this._stack.paused = false), !r3 && false === i4) { + for (; s4 >= 0 && (i4 = this._active[s4].unhook(e4), true !== i4); s4--) if (i4 instanceof Promise) return this._stack.paused = true, this._stack.loopPosition = s4, this._stack.fallThrough = false, i4; + s4--; } - for (; s3 >= 0; s3--) if (i4 = this._active[s3].unhook(false), i4 instanceof Promise) return this._stack.paused = true, this._stack.loopPosition = s3, this._stack.fallThrough = true, i4; + for (; s4 >= 0; s4--) if (i4 = this._active[s4].unhook(false), i4 instanceof Promise) return this._stack.paused = true, this._stack.loopPosition = s4, this._stack.fallThrough = true, i4; } else this._handlerFb(this._ident, "UNHOOK", e4); - this._active = o, this._ident = 0; + this._active = o2, this._ident = 0; } }; - const a = new r.Params(); - a.addParam(0), t3.DcsHandler = class { + const a2 = new r2.Params(); + a2.addParam(0), t3.DcsHandler = class { constructor(e4) { - this._handler = e4, this._data = "", this._params = a, this._hitLimit = false; + this._handler = e4, this._data = "", this._params = a2, this._hitLimit = false; } hook(e4) { - this._params = e4.length > 1 || e4.params[0] ? e4.clone() : a, this._data = "", this._hitLimit = false; + this._params = e4.length > 1 || e4.params[0] ? e4.clone() : a2, this._data = "", this._hitLimit = false; } put(e4, t4, i4) { - this._hitLimit || (this._data += (0, s2.utf32ToString)(e4, t4, i4), this._data.length > n.PAYLOAD_LIMIT && (this._data = "", this._hitLimit = true)); + this._hitLimit || (this._data += (0, s3.utf32ToString)(e4, t4, i4), this._data.length > n2.PAYLOAD_LIMIT && (this._data = "", this._hitLimit = true)); } unhook(e4) { let t4 = false; if (this._hitLimit) t4 = false; - else if (e4 && (t4 = this._handler(this._data, this._params), t4 instanceof Promise)) return t4.then((e5) => (this._params = a, this._data = "", this._hitLimit = false, e5)); - return this._params = a, this._data = "", this._hitLimit = false, t4; + else if (e4 && (t4 = this._handler(this._data, this._params), t4 instanceof Promise)) return t4.then((e5) => (this._params = a2, this._data = "", this._hitLimit = false, e5)); + return this._params = a2, this._data = "", this._hitLimit = false, t4; } }; }, 2015: (e3, t3, i3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.EscapeSequenceParser = t3.VT500_TRANSITION_TABLE = t3.TransitionTable = void 0; - const s2 = i3(844), r = i3(8742), n = i3(6242), o = i3(6351); - class a { + const s3 = i3(844), r2 = i3(8742), n2 = i3(6242), o2 = i3(6351); + class a2 { static { __name(this, "a"); } @@ -162266,35 +190576,35 @@ WARNING: This link could potentially be dangerous`)) { setDefault(e4, t4) { this.table.fill(e4 << 4 | t4); } - add(e4, t4, i4, s3) { - this.table[t4 << 8 | e4] = i4 << 4 | s3; + add(e4, t4, i4, s4) { + this.table[t4 << 8 | e4] = i4 << 4 | s4; } - addMany(e4, t4, i4, s3) { - for (let r2 = 0; r2 < e4.length; r2++) this.table[t4 << 8 | e4[r2]] = i4 << 4 | s3; + addMany(e4, t4, i4, s4) { + for (let r3 = 0; r3 < e4.length; r3++) this.table[t4 << 8 | e4[r3]] = i4 << 4 | s4; } } - t3.TransitionTable = a; + t3.TransitionTable = a2; const h2 = 160; t3.VT500_TRANSITION_TABLE = function() { - const e4 = new a(4095), t4 = Array.apply(null, Array(256)).map((e5, t5) => t5), i4 = /* @__PURE__ */ __name((e5, i5) => t4.slice(e5, i5), "i"), s3 = i4(32, 127), r2 = i4(0, 24); - r2.push(25), r2.push.apply(r2, i4(28, 32)); - const n2 = i4(0, 14); - let o2; - for (o2 in e4.setDefault(1, 0), e4.addMany(s3, 0, 2, 0), n2) e4.addMany([24, 26, 153, 154], o2, 3, 0), e4.addMany(i4(128, 144), o2, 3, 0), e4.addMany(i4(144, 152), o2, 3, 0), e4.add(156, o2, 0, 0), e4.add(27, o2, 11, 1), e4.add(157, o2, 4, 8), e4.addMany([152, 158, 159], o2, 0, 7), e4.add(155, o2, 11, 3), e4.add(144, o2, 11, 9); - return e4.addMany(r2, 0, 3, 0), e4.addMany(r2, 1, 3, 1), e4.add(127, 1, 0, 1), e4.addMany(r2, 8, 0, 8), e4.addMany(r2, 3, 3, 3), e4.add(127, 3, 0, 3), e4.addMany(r2, 4, 3, 4), e4.add(127, 4, 0, 4), e4.addMany(r2, 6, 3, 6), e4.addMany(r2, 5, 3, 5), e4.add(127, 5, 0, 5), e4.addMany(r2, 2, 3, 2), e4.add(127, 2, 0, 2), e4.add(93, 1, 4, 8), e4.addMany(s3, 8, 5, 8), e4.add(127, 8, 5, 8), e4.addMany([156, 27, 24, 26, 7], 8, 6, 0), e4.addMany(i4(28, 32), 8, 0, 8), e4.addMany([88, 94, 95], 1, 0, 7), e4.addMany(s3, 7, 0, 7), e4.addMany(r2, 7, 0, 7), e4.add(156, 7, 0, 0), e4.add(127, 7, 0, 7), e4.add(91, 1, 11, 3), e4.addMany(i4(64, 127), 3, 7, 0), e4.addMany(i4(48, 60), 3, 8, 4), e4.addMany([60, 61, 62, 63], 3, 9, 4), e4.addMany(i4(48, 60), 4, 8, 4), e4.addMany(i4(64, 127), 4, 7, 0), e4.addMany([60, 61, 62, 63], 4, 0, 6), e4.addMany(i4(32, 64), 6, 0, 6), e4.add(127, 6, 0, 6), e4.addMany(i4(64, 127), 6, 0, 0), e4.addMany(i4(32, 48), 3, 9, 5), e4.addMany(i4(32, 48), 5, 9, 5), e4.addMany(i4(48, 64), 5, 0, 6), e4.addMany(i4(64, 127), 5, 7, 0), e4.addMany(i4(32, 48), 4, 9, 5), e4.addMany(i4(32, 48), 1, 9, 2), e4.addMany(i4(32, 48), 2, 9, 2), e4.addMany(i4(48, 127), 2, 10, 0), e4.addMany(i4(48, 80), 1, 10, 0), e4.addMany(i4(81, 88), 1, 10, 0), e4.addMany([89, 90, 92], 1, 10, 0), e4.addMany(i4(96, 127), 1, 10, 0), e4.add(80, 1, 11, 9), e4.addMany(r2, 9, 0, 9), e4.add(127, 9, 0, 9), e4.addMany(i4(28, 32), 9, 0, 9), e4.addMany(i4(32, 48), 9, 9, 12), e4.addMany(i4(48, 60), 9, 8, 10), e4.addMany([60, 61, 62, 63], 9, 9, 10), e4.addMany(r2, 11, 0, 11), e4.addMany(i4(32, 128), 11, 0, 11), e4.addMany(i4(28, 32), 11, 0, 11), e4.addMany(r2, 10, 0, 10), e4.add(127, 10, 0, 10), e4.addMany(i4(28, 32), 10, 0, 10), e4.addMany(i4(48, 60), 10, 8, 10), e4.addMany([60, 61, 62, 63], 10, 0, 11), e4.addMany(i4(32, 48), 10, 9, 12), e4.addMany(r2, 12, 0, 12), e4.add(127, 12, 0, 12), e4.addMany(i4(28, 32), 12, 0, 12), e4.addMany(i4(32, 48), 12, 9, 12), e4.addMany(i4(48, 64), 12, 0, 11), e4.addMany(i4(64, 127), 12, 12, 13), e4.addMany(i4(64, 127), 10, 12, 13), e4.addMany(i4(64, 127), 9, 12, 13), e4.addMany(r2, 13, 13, 13), e4.addMany(s3, 13, 13, 13), e4.add(127, 13, 0, 13), e4.addMany([27, 156, 24, 26], 13, 14, 0), e4.add(h2, 0, 2, 0), e4.add(h2, 8, 5, 8), e4.add(h2, 6, 0, 6), e4.add(h2, 11, 0, 11), e4.add(h2, 13, 13, 13), e4; + const e4 = new a2(4095), t4 = Array.apply(null, Array(256)).map((e5, t5) => t5), i4 = /* @__PURE__ */ __name((e5, i5) => t4.slice(e5, i5), "i"), s4 = i4(32, 127), r3 = i4(0, 24); + r3.push(25), r3.push.apply(r3, i4(28, 32)); + const n3 = i4(0, 14); + let o3; + for (o3 in e4.setDefault(1, 0), e4.addMany(s4, 0, 2, 0), n3) e4.addMany([24, 26, 153, 154], o3, 3, 0), e4.addMany(i4(128, 144), o3, 3, 0), e4.addMany(i4(144, 152), o3, 3, 0), e4.add(156, o3, 0, 0), e4.add(27, o3, 11, 1), e4.add(157, o3, 4, 8), e4.addMany([152, 158, 159], o3, 0, 7), e4.add(155, o3, 11, 3), e4.add(144, o3, 11, 9); + return e4.addMany(r3, 0, 3, 0), e4.addMany(r3, 1, 3, 1), e4.add(127, 1, 0, 1), e4.addMany(r3, 8, 0, 8), e4.addMany(r3, 3, 3, 3), e4.add(127, 3, 0, 3), e4.addMany(r3, 4, 3, 4), e4.add(127, 4, 0, 4), e4.addMany(r3, 6, 3, 6), e4.addMany(r3, 5, 3, 5), e4.add(127, 5, 0, 5), e4.addMany(r3, 2, 3, 2), e4.add(127, 2, 0, 2), e4.add(93, 1, 4, 8), e4.addMany(s4, 8, 5, 8), e4.add(127, 8, 5, 8), e4.addMany([156, 27, 24, 26, 7], 8, 6, 0), e4.addMany(i4(28, 32), 8, 0, 8), e4.addMany([88, 94, 95], 1, 0, 7), e4.addMany(s4, 7, 0, 7), e4.addMany(r3, 7, 0, 7), e4.add(156, 7, 0, 0), e4.add(127, 7, 0, 7), e4.add(91, 1, 11, 3), e4.addMany(i4(64, 127), 3, 7, 0), e4.addMany(i4(48, 60), 3, 8, 4), e4.addMany([60, 61, 62, 63], 3, 9, 4), e4.addMany(i4(48, 60), 4, 8, 4), e4.addMany(i4(64, 127), 4, 7, 0), e4.addMany([60, 61, 62, 63], 4, 0, 6), e4.addMany(i4(32, 64), 6, 0, 6), e4.add(127, 6, 0, 6), e4.addMany(i4(64, 127), 6, 0, 0), e4.addMany(i4(32, 48), 3, 9, 5), e4.addMany(i4(32, 48), 5, 9, 5), e4.addMany(i4(48, 64), 5, 0, 6), e4.addMany(i4(64, 127), 5, 7, 0), e4.addMany(i4(32, 48), 4, 9, 5), e4.addMany(i4(32, 48), 1, 9, 2), e4.addMany(i4(32, 48), 2, 9, 2), e4.addMany(i4(48, 127), 2, 10, 0), e4.addMany(i4(48, 80), 1, 10, 0), e4.addMany(i4(81, 88), 1, 10, 0), e4.addMany([89, 90, 92], 1, 10, 0), e4.addMany(i4(96, 127), 1, 10, 0), e4.add(80, 1, 11, 9), e4.addMany(r3, 9, 0, 9), e4.add(127, 9, 0, 9), e4.addMany(i4(28, 32), 9, 0, 9), e4.addMany(i4(32, 48), 9, 9, 12), e4.addMany(i4(48, 60), 9, 8, 10), e4.addMany([60, 61, 62, 63], 9, 9, 10), e4.addMany(r3, 11, 0, 11), e4.addMany(i4(32, 128), 11, 0, 11), e4.addMany(i4(28, 32), 11, 0, 11), e4.addMany(r3, 10, 0, 10), e4.add(127, 10, 0, 10), e4.addMany(i4(28, 32), 10, 0, 10), e4.addMany(i4(48, 60), 10, 8, 10), e4.addMany([60, 61, 62, 63], 10, 0, 11), e4.addMany(i4(32, 48), 10, 9, 12), e4.addMany(r3, 12, 0, 12), e4.add(127, 12, 0, 12), e4.addMany(i4(28, 32), 12, 0, 12), e4.addMany(i4(32, 48), 12, 9, 12), e4.addMany(i4(48, 64), 12, 0, 11), e4.addMany(i4(64, 127), 12, 12, 13), e4.addMany(i4(64, 127), 10, 12, 13), e4.addMany(i4(64, 127), 9, 12, 13), e4.addMany(r3, 13, 13, 13), e4.addMany(s4, 13, 13, 13), e4.add(127, 13, 0, 13), e4.addMany([27, 156, 24, 26], 13, 14, 0), e4.add(h2, 0, 2, 0), e4.add(h2, 8, 5, 8), e4.add(h2, 6, 0, 6), e4.add(h2, 11, 0, 11), e4.add(h2, 13, 13, 13), e4; }(); - class c extends s2.Disposable { + class c2 extends s3.Disposable { static { __name(this, "c"); } constructor(e4 = t3.VT500_TRANSITION_TABLE) { - super(), this._transitions = e4, this._parseStack = { state: 0, handlers: [], handlerPos: 0, transition: 0, chunkPos: 0 }, this.initialState = 0, this.currentState = this.initialState, this._params = new r.Params(), this._params.addParam(0), this._collect = 0, this.precedingJoinState = 0, this._printHandlerFb = (e5, t4, i4) => { + super(), this._transitions = e4, this._parseStack = { state: 0, handlers: [], handlerPos: 0, transition: 0, chunkPos: 0 }, this.initialState = 0, this.currentState = this.initialState, this._params = new r2.Params(), this._params.addParam(0), this._collect = 0, this.precedingJoinState = 0, this._printHandlerFb = (e5, t4, i4) => { }, this._executeHandlerFb = (e5) => { }, this._csiHandlerFb = (e5, t4) => { }, this._escHandlerFb = (e5) => { - }, this._errorHandlerFb = (e5) => e5, this._printHandler = this._printHandlerFb, this._executeHandlers = /* @__PURE__ */ Object.create(null), this._csiHandlers = /* @__PURE__ */ Object.create(null), this._escHandlers = /* @__PURE__ */ Object.create(null), this.register((0, s2.toDisposable)(() => { + }, this._errorHandlerFb = (e5) => e5, this._printHandler = this._printHandlerFb, this._executeHandlers = /* @__PURE__ */ Object.create(null), this._csiHandlers = /* @__PURE__ */ Object.create(null), this._escHandlers = /* @__PURE__ */ Object.create(null), this.register((0, s3.toDisposable)(() => { this._csiHandlers = /* @__PURE__ */ Object.create(null), this._executeHandlers = /* @__PURE__ */ Object.create(null), this._escHandlers = /* @__PURE__ */ Object.create(null); - })), this._oscParser = this.register(new n.OscParser()), this._dcsParser = this.register(new o.DcsParser()), this._errorHandler = this._errorHandlerFb, this.registerEscHandler({ final: "\\" }, () => true); + })), this._oscParser = this.register(new n2.OscParser()), this._dcsParser = this.register(new o2.DcsParser()), this._errorHandler = this._errorHandlerFb, this.registerEscHandler({ final: "\\" }, () => true); } _identifier(e4, t4 = [64, 126]) { let i4 = 0; @@ -162305,15 +190615,15 @@ WARNING: This link could potentially be dangerous`)) { if (e4.intermediates) { if (e4.intermediates.length > 2) throw new Error("only two bytes as intermediates are supported"); for (let t5 = 0; t5 < e4.intermediates.length; ++t5) { - const s4 = e4.intermediates.charCodeAt(t5); - if (32 > s4 || s4 > 47) throw new Error("intermediate must be in range 0x20 .. 0x2f"); - i4 <<= 8, i4 |= s4; + const s5 = e4.intermediates.charCodeAt(t5); + if (32 > s5 || s5 > 47) throw new Error("intermediate must be in range 0x20 .. 0x2f"); + i4 <<= 8, i4 |= s5; } } if (1 !== e4.final.length) throw new Error("final must be a single byte"); - const s3 = e4.final.charCodeAt(0); - if (t4[0] > s3 || s3 > t4[1]) throw new Error(`final must be in range ${t4[0]} .. ${t4[1]}`); - return i4 <<= 8, i4 |= s3, i4; + const s4 = e4.final.charCodeAt(0); + if (t4[0] > s4 || s4 > t4[1]) throw new Error(`final must be in range ${t4[0]} .. ${t4[1]}`); + return i4 <<= 8, i4 |= s4, i4; } identToString(e4) { const t4 = []; @@ -162329,10 +190639,10 @@ WARNING: This link could potentially be dangerous`)) { registerEscHandler(e4, t4) { const i4 = this._identifier(e4, [48, 126]); void 0 === this._escHandlers[i4] && (this._escHandlers[i4] = []); - const s3 = this._escHandlers[i4]; - return s3.push(t4), { dispose: /* @__PURE__ */ __name(() => { - const e5 = s3.indexOf(t4); - -1 !== e5 && s3.splice(e5, 1); + const s4 = this._escHandlers[i4]; + return s4.push(t4), { dispose: /* @__PURE__ */ __name(() => { + const e5 = s4.indexOf(t4); + -1 !== e5 && s4.splice(e5, 1); }, "dispose") }; } clearEscHandler(e4) { @@ -162353,10 +190663,10 @@ WARNING: This link could potentially be dangerous`)) { registerCsiHandler(e4, t4) { const i4 = this._identifier(e4); void 0 === this._csiHandlers[i4] && (this._csiHandlers[i4] = []); - const s3 = this._csiHandlers[i4]; - return s3.push(t4), { dispose: /* @__PURE__ */ __name(() => { - const e5 = s3.indexOf(t4); - -1 !== e5 && s3.splice(e5, 1); + const s4 = this._csiHandlers[i4]; + return s4.push(t4), { dispose: /* @__PURE__ */ __name(() => { + const e5 = s4.indexOf(t4); + -1 !== e5 && s4.splice(e5, 1); }, "dispose") }; } clearCsiHandler(e4) { @@ -162392,78 +190702,78 @@ WARNING: This link could potentially be dangerous`)) { reset() { this.currentState = this.initialState, this._oscParser.reset(), this._dcsParser.reset(), this._params.reset(), this._params.addParam(0), this._collect = 0, this.precedingJoinState = 0, 0 !== this._parseStack.state && (this._parseStack.state = 2, this._parseStack.handlers = []); } - _preserveStack(e4, t4, i4, s3, r2) { - this._parseStack.state = e4, this._parseStack.handlers = t4, this._parseStack.handlerPos = i4, this._parseStack.transition = s3, this._parseStack.chunkPos = r2; + _preserveStack(e4, t4, i4, s4, r3) { + this._parseStack.state = e4, this._parseStack.handlers = t4, this._parseStack.handlerPos = i4, this._parseStack.transition = s4, this._parseStack.chunkPos = r3; } parse(e4, t4, i4) { - let s3, r2 = 0, n2 = 0, o2 = 0; - if (this._parseStack.state) if (2 === this._parseStack.state) this._parseStack.state = 0, o2 = this._parseStack.chunkPos + 1; + let s4, r3 = 0, n3 = 0, o3 = 0; + if (this._parseStack.state) if (2 === this._parseStack.state) this._parseStack.state = 0, o3 = this._parseStack.chunkPos + 1; else { if (void 0 === i4 || 1 === this._parseStack.state) throw this._parseStack.state = 1, new Error("improper continuation due to previous async handler, giving up parsing"); const t5 = this._parseStack.handlers; - let n3 = this._parseStack.handlerPos - 1; + let n4 = this._parseStack.handlerPos - 1; switch (this._parseStack.state) { case 3: - if (false === i4 && n3 > -1) { - for (; n3 >= 0 && (s3 = t5[n3](this._params), true !== s3); n3--) if (s3 instanceof Promise) return this._parseStack.handlerPos = n3, s3; + if (false === i4 && n4 > -1) { + for (; n4 >= 0 && (s4 = t5[n4](this._params), true !== s4); n4--) if (s4 instanceof Promise) return this._parseStack.handlerPos = n4, s4; } this._parseStack.handlers = []; break; case 4: - if (false === i4 && n3 > -1) { - for (; n3 >= 0 && (s3 = t5[n3](), true !== s3); n3--) if (s3 instanceof Promise) return this._parseStack.handlerPos = n3, s3; + if (false === i4 && n4 > -1) { + for (; n4 >= 0 && (s4 = t5[n4](), true !== s4); n4--) if (s4 instanceof Promise) return this._parseStack.handlerPos = n4, s4; } this._parseStack.handlers = []; break; case 6: - if (r2 = e4[this._parseStack.chunkPos], s3 = this._dcsParser.unhook(24 !== r2 && 26 !== r2, i4), s3) return s3; - 27 === r2 && (this._parseStack.transition |= 1), this._params.reset(), this._params.addParam(0), this._collect = 0; + if (r3 = e4[this._parseStack.chunkPos], s4 = this._dcsParser.unhook(24 !== r3 && 26 !== r3, i4), s4) return s4; + 27 === r3 && (this._parseStack.transition |= 1), this._params.reset(), this._params.addParam(0), this._collect = 0; break; case 5: - if (r2 = e4[this._parseStack.chunkPos], s3 = this._oscParser.end(24 !== r2 && 26 !== r2, i4), s3) return s3; - 27 === r2 && (this._parseStack.transition |= 1), this._params.reset(), this._params.addParam(0), this._collect = 0; + if (r3 = e4[this._parseStack.chunkPos], s4 = this._oscParser.end(24 !== r3 && 26 !== r3, i4), s4) return s4; + 27 === r3 && (this._parseStack.transition |= 1), this._params.reset(), this._params.addParam(0), this._collect = 0; } - this._parseStack.state = 0, o2 = this._parseStack.chunkPos + 1, this.precedingJoinState = 0, this.currentState = 15 & this._parseStack.transition; + this._parseStack.state = 0, o3 = this._parseStack.chunkPos + 1, this.precedingJoinState = 0, this.currentState = 15 & this._parseStack.transition; } - for (let i5 = o2; i5 < t4; ++i5) { - switch (r2 = e4[i5], n2 = this._transitions.table[this.currentState << 8 | (r2 < 160 ? r2 : h2)], n2 >> 4) { + for (let i5 = o3; i5 < t4; ++i5) { + switch (r3 = e4[i5], n3 = this._transitions.table[this.currentState << 8 | (r3 < 160 ? r3 : h2)], n3 >> 4) { case 2: - for (let s4 = i5 + 1; ; ++s4) { - if (s4 >= t4 || (r2 = e4[s4]) < 32 || r2 > 126 && r2 < h2) { - this._printHandler(e4, i5, s4), i5 = s4 - 1; + for (let s5 = i5 + 1; ; ++s5) { + if (s5 >= t4 || (r3 = e4[s5]) < 32 || r3 > 126 && r3 < h2) { + this._printHandler(e4, i5, s5), i5 = s5 - 1; break; } - if (++s4 >= t4 || (r2 = e4[s4]) < 32 || r2 > 126 && r2 < h2) { - this._printHandler(e4, i5, s4), i5 = s4 - 1; + if (++s5 >= t4 || (r3 = e4[s5]) < 32 || r3 > 126 && r3 < h2) { + this._printHandler(e4, i5, s5), i5 = s5 - 1; break; } - if (++s4 >= t4 || (r2 = e4[s4]) < 32 || r2 > 126 && r2 < h2) { - this._printHandler(e4, i5, s4), i5 = s4 - 1; + if (++s5 >= t4 || (r3 = e4[s5]) < 32 || r3 > 126 && r3 < h2) { + this._printHandler(e4, i5, s5), i5 = s5 - 1; break; } - if (++s4 >= t4 || (r2 = e4[s4]) < 32 || r2 > 126 && r2 < h2) { - this._printHandler(e4, i5, s4), i5 = s4 - 1; + if (++s5 >= t4 || (r3 = e4[s5]) < 32 || r3 > 126 && r3 < h2) { + this._printHandler(e4, i5, s5), i5 = s5 - 1; break; } } break; case 3: - this._executeHandlers[r2] ? this._executeHandlers[r2]() : this._executeHandlerFb(r2), this.precedingJoinState = 0; + this._executeHandlers[r3] ? this._executeHandlers[r3]() : this._executeHandlerFb(r3), this.precedingJoinState = 0; break; case 0: break; case 1: - if (this._errorHandler({ position: i5, code: r2, currentState: this.currentState, collect: this._collect, params: this._params, abort: false }).abort) return; + if (this._errorHandler({ position: i5, code: r3, currentState: this.currentState, collect: this._collect, params: this._params, abort: false }).abort) return; break; case 7: - const o3 = this._csiHandlers[this._collect << 8 | r2]; - let a2 = o3 ? o3.length - 1 : -1; - for (; a2 >= 0 && (s3 = o3[a2](this._params), true !== s3); a2--) if (s3 instanceof Promise) return this._preserveStack(3, o3, a2, n2, i5), s3; - a2 < 0 && this._csiHandlerFb(this._collect << 8 | r2, this._params), this.precedingJoinState = 0; + const o4 = this._csiHandlers[this._collect << 8 | r3]; + let a3 = o4 ? o4.length - 1 : -1; + for (; a3 >= 0 && (s4 = o4[a3](this._params), true !== s4); a3--) if (s4 instanceof Promise) return this._preserveStack(3, o4, a3, n3, i5), s4; + a3 < 0 && this._csiHandlerFb(this._collect << 8 | r3, this._params), this.precedingJoinState = 0; break; case 8: do { - switch (r2) { + switch (r3) { case 59: this._params.addParam(0); break; @@ -162471,60 +190781,60 @@ WARNING: This link could potentially be dangerous`)) { this._params.addSubParam(-1); break; default: - this._params.addDigit(r2 - 48); + this._params.addDigit(r3 - 48); } - } while (++i5 < t4 && (r2 = e4[i5]) > 47 && r2 < 60); + } while (++i5 < t4 && (r3 = e4[i5]) > 47 && r3 < 60); i5--; break; case 9: - this._collect <<= 8, this._collect |= r2; + this._collect <<= 8, this._collect |= r3; break; case 10: - const c2 = this._escHandlers[this._collect << 8 | r2]; - let l = c2 ? c2.length - 1 : -1; - for (; l >= 0 && (s3 = c2[l](), true !== s3); l--) if (s3 instanceof Promise) return this._preserveStack(4, c2, l, n2, i5), s3; - l < 0 && this._escHandlerFb(this._collect << 8 | r2), this.precedingJoinState = 0; + const c3 = this._escHandlers[this._collect << 8 | r3]; + let l2 = c3 ? c3.length - 1 : -1; + for (; l2 >= 0 && (s4 = c3[l2](), true !== s4); l2--) if (s4 instanceof Promise) return this._preserveStack(4, c3, l2, n3, i5), s4; + l2 < 0 && this._escHandlerFb(this._collect << 8 | r3), this.precedingJoinState = 0; break; case 11: this._params.reset(), this._params.addParam(0), this._collect = 0; break; case 12: - this._dcsParser.hook(this._collect << 8 | r2, this._params); + this._dcsParser.hook(this._collect << 8 | r3, this._params); break; case 13: - for (let s4 = i5 + 1; ; ++s4) if (s4 >= t4 || 24 === (r2 = e4[s4]) || 26 === r2 || 27 === r2 || r2 > 127 && r2 < h2) { - this._dcsParser.put(e4, i5, s4), i5 = s4 - 1; + for (let s5 = i5 + 1; ; ++s5) if (s5 >= t4 || 24 === (r3 = e4[s5]) || 26 === r3 || 27 === r3 || r3 > 127 && r3 < h2) { + this._dcsParser.put(e4, i5, s5), i5 = s5 - 1; break; } break; case 14: - if (s3 = this._dcsParser.unhook(24 !== r2 && 26 !== r2), s3) return this._preserveStack(6, [], 0, n2, i5), s3; - 27 === r2 && (n2 |= 1), this._params.reset(), this._params.addParam(0), this._collect = 0, this.precedingJoinState = 0; + if (s4 = this._dcsParser.unhook(24 !== r3 && 26 !== r3), s4) return this._preserveStack(6, [], 0, n3, i5), s4; + 27 === r3 && (n3 |= 1), this._params.reset(), this._params.addParam(0), this._collect = 0, this.precedingJoinState = 0; break; case 4: this._oscParser.start(); break; case 5: - for (let s4 = i5 + 1; ; s4++) if (s4 >= t4 || (r2 = e4[s4]) < 32 || r2 > 127 && r2 < h2) { - this._oscParser.put(e4, i5, s4), i5 = s4 - 1; + for (let s5 = i5 + 1; ; s5++) if (s5 >= t4 || (r3 = e4[s5]) < 32 || r3 > 127 && r3 < h2) { + this._oscParser.put(e4, i5, s5), i5 = s5 - 1; break; } break; case 6: - if (s3 = this._oscParser.end(24 !== r2 && 26 !== r2), s3) return this._preserveStack(5, [], 0, n2, i5), s3; - 27 === r2 && (n2 |= 1), this._params.reset(), this._params.addParam(0), this._collect = 0, this.precedingJoinState = 0; + if (s4 = this._oscParser.end(24 !== r3 && 26 !== r3), s4) return this._preserveStack(5, [], 0, n3, i5), s4; + 27 === r3 && (n3 |= 1), this._params.reset(), this._params.addParam(0), this._collect = 0, this.precedingJoinState = 0; } - this.currentState = 15 & n2; + this.currentState = 15 & n3; } } } - t3.EscapeSequenceParser = c; + t3.EscapeSequenceParser = c2; }, 6242: (e3, t3, i3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.OscHandler = t3.OscParser = void 0; - const s2 = i3(5770), r = i3(482), n = []; + const s3 = i3(5770), r2 = i3(482), n2 = []; t3.OscParser = class { constructor() { - this._state = 0, this._active = n, this._id = -1, this._handlers = /* @__PURE__ */ Object.create(null), this._handlerFb = () => { + this._state = 0, this._active = n2, this._id = -1, this._handlers = /* @__PURE__ */ Object.create(null), this._handlerFb = () => { }, this._stack = { paused: false, loopPosition: 0, fallThrough: false }; } registerHandler(e4, t4) { @@ -162543,19 +190853,19 @@ WARNING: This link could potentially be dangerous`)) { } dispose() { this._handlers = /* @__PURE__ */ Object.create(null), this._handlerFb = () => { - }, this._active = n; + }, this._active = n2; } reset() { if (2 === this._state) for (let e4 = this._stack.paused ? this._stack.loopPosition - 1 : this._active.length - 1; e4 >= 0; --e4) this._active[e4].end(false); - this._stack.paused = false, this._active = n, this._id = -1, this._state = 0; + this._stack.paused = false, this._active = n2, this._id = -1, this._state = 0; } _start() { - if (this._active = this._handlers[this._id] || n, this._active.length) for (let e4 = this._active.length - 1; e4 >= 0; e4--) this._active[e4].start(); + if (this._active = this._handlers[this._id] || n2, this._active.length) for (let e4 = this._active.length - 1; e4 >= 0; e4--) this._active[e4].start(); else this._handlerFb(this._id, "START"); } _put(e4, t4, i4) { - if (this._active.length) for (let s3 = this._active.length - 1; s3 >= 0; s3--) this._active[s3].put(e4, t4, i4); - else this._handlerFb(this._id, "PUT", (0, r.utf32ToString)(e4, t4, i4)); + if (this._active.length) for (let s4 = this._active.length - 1; s4 >= 0; s4--) this._active[s4].put(e4, t4, i4); + else this._handlerFb(this._id, "PUT", (0, r2.utf32ToString)(e4, t4, i4)); } start() { this.reset(), this._state = 1; @@ -162577,14 +190887,14 @@ WARNING: This link could potentially be dangerous`)) { end(e4, t4 = true) { if (0 !== this._state) { if (3 !== this._state) if (1 === this._state && this._start(), this._active.length) { - let i4 = false, s3 = this._active.length - 1, r2 = false; - if (this._stack.paused && (s3 = this._stack.loopPosition - 1, i4 = t4, r2 = this._stack.fallThrough, this._stack.paused = false), !r2 && false === i4) { - for (; s3 >= 0 && (i4 = this._active[s3].end(e4), true !== i4); s3--) if (i4 instanceof Promise) return this._stack.paused = true, this._stack.loopPosition = s3, this._stack.fallThrough = false, i4; - s3--; + let i4 = false, s4 = this._active.length - 1, r3 = false; + if (this._stack.paused && (s4 = this._stack.loopPosition - 1, i4 = t4, r3 = this._stack.fallThrough, this._stack.paused = false), !r3 && false === i4) { + for (; s4 >= 0 && (i4 = this._active[s4].end(e4), true !== i4); s4--) if (i4 instanceof Promise) return this._stack.paused = true, this._stack.loopPosition = s4, this._stack.fallThrough = false, i4; + s4--; } - for (; s3 >= 0; s3--) if (i4 = this._active[s3].end(false), i4 instanceof Promise) return this._stack.paused = true, this._stack.loopPosition = s3, this._stack.fallThrough = true, i4; + for (; s4 >= 0; s4--) if (i4 = this._active[s4].end(false), i4 instanceof Promise) return this._stack.paused = true, this._stack.loopPosition = s4, this._stack.fallThrough = true, i4; } else this._handlerFb(this._id, "END", e4); - this._active = n, this._id = -1, this._state = 0; + this._active = n2, this._id = -1, this._state = 0; } } }, t3.OscHandler = class { @@ -162595,7 +190905,7 @@ WARNING: This link could potentially be dangerous`)) { this._data = "", this._hitLimit = false; } put(e4, t4, i4) { - this._hitLimit || (this._data += (0, r.utf32ToString)(e4, t4, i4), this._data.length > s2.PAYLOAD_LIMIT && (this._data = "", this._hitLimit = true)); + this._hitLimit || (this._data += (0, r2.utf32ToString)(e4, t4, i4), this._data.length > s3.PAYLOAD_LIMIT && (this._data = "", this._hitLimit = true)); } end(e4) { let t4 = false; @@ -162607,17 +190917,17 @@ WARNING: This link could potentially be dangerous`)) { }, 8742: (e3, t3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.Params = void 0; const i3 = 2147483647; - class s2 { + class s3 { static { __name(this, "s"); } static fromArray(e4) { - const t4 = new s2(); + const t4 = new s3(); if (!e4.length) return t4; for (let i4 = Array.isArray(e4[0]) ? 1 : 0; i4 < e4.length; ++i4) { - const s3 = e4[i4]; - if (Array.isArray(s3)) for (let e5 = 0; e5 < s3.length; ++e5) t4.addSubParam(s3[e5]); - else t4.addParam(s3); + const s4 = e4[i4]; + if (Array.isArray(s4)) for (let e5 = 0; e5 < s4.length; ++e5) t4.addSubParam(s4[e5]); + else t4.addParam(s4); } return t4; } @@ -162626,15 +190936,15 @@ WARNING: This link could potentially be dangerous`)) { this.params = new Int32Array(e4), this.length = 0, this._subParams = new Int32Array(t4), this._subParamsLength = 0, this._subParamsIdx = new Uint16Array(e4), this._rejectDigits = false, this._rejectSubDigits = false, this._digitIsSub = false; } clone() { - const e4 = new s2(this.maxLength, this.maxSubParamsLength); + const e4 = new s3(this.maxLength, this.maxSubParamsLength); return e4.params.set(this.params), e4.length = this.length, e4._subParams.set(this._subParams), e4._subParamsLength = this._subParamsLength, e4._subParamsIdx.set(this._subParamsIdx), e4._rejectDigits = this._rejectDigits, e4._rejectSubDigits = this._rejectSubDigits, e4._digitIsSub = this._digitIsSub, e4; } toArray() { const e4 = []; for (let t4 = 0; t4 < this.length; ++t4) { e4.push(this.params[t4]); - const i4 = this._subParamsIdx[t4] >> 8, s3 = 255 & this._subParamsIdx[t4]; - s3 - i4 > 0 && e4.push(Array.prototype.slice.call(this._subParams, i4, s3)); + const i4 = this._subParamsIdx[t4] >> 8, s4 = 255 & this._subParamsIdx[t4]; + s4 - i4 > 0 && e4.push(Array.prototype.slice.call(this._subParams, i4, s4)); } return e4; } @@ -162665,19 +190975,19 @@ WARNING: This link could potentially be dangerous`)) { getSubParamsAll() { const e4 = {}; for (let t4 = 0; t4 < this.length; ++t4) { - const i4 = this._subParamsIdx[t4] >> 8, s3 = 255 & this._subParamsIdx[t4]; - s3 - i4 > 0 && (e4[t4] = this._subParams.slice(i4, s3)); + const i4 = this._subParamsIdx[t4] >> 8, s4 = 255 & this._subParamsIdx[t4]; + s4 - i4 > 0 && (e4[t4] = this._subParams.slice(i4, s4)); } return e4; } addDigit(e4) { let t4; if (this._rejectDigits || !(t4 = this._digitIsSub ? this._subParamsLength : this.length) || this._digitIsSub && this._rejectSubDigits) return; - const s3 = this._digitIsSub ? this._subParams : this.params, r = s3[t4 - 1]; - s3[t4 - 1] = ~r ? Math.min(10 * r + e4, i3) : e4; + const s4 = this._digitIsSub ? this._subParams : this.params, r2 = s4[t4 - 1]; + s4[t4 - 1] = ~r2 ? Math.min(10 * r2 + e4, i3) : e4; } } - t3.Params = s2; + t3.Params = s3; }, 5741: (e3, t3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.AddonManager = void 0, t3.AddonManager = class { constructor() { @@ -162703,7 +191013,7 @@ WARNING: This link could potentially be dangerous`)) { }; }, 8771: (e3, t3, i3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.BufferApiView = void 0; - const s2 = i3(3785), r = i3(511); + const s3 = i3(3785), r2 = i3(511); t3.BufferApiView = class { constructor(e4, t4) { this._buffer = e4, this.type = t4; @@ -162728,15 +191038,15 @@ WARNING: This link could potentially be dangerous`)) { } getLine(e4) { const t4 = this._buffer.lines.get(e4); - if (t4) return new s2.BufferLineApiView(t4); + if (t4) return new s3.BufferLineApiView(t4); } getNullCell() { - return new r.CellData(); + return new r2.CellData(); } }; }, 3785: (e3, t3, i3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.BufferLineApiView = void 0; - const s2 = i3(511); + const s3 = i3(511); t3.BufferLineApiView = class { constructor(e4) { this._line = e4; @@ -162748,7 +191058,7 @@ WARNING: This link could potentially be dangerous`)) { return this._line.length; } getCell(e4, t4) { - if (!(e4 < 0 || e4 >= this._line.length)) return t4 ? (this._line.loadCell(e4, t4), t4) : this._line.loadCell(e4, new s2.CellData()); + if (!(e4 < 0 || e4 >= this._line.length)) return t4 ? (this._line.loadCell(e4, t4), t4) : this._line.loadCell(e4, new s3.CellData()); } translateToString(e4, t4, i4) { return this._line.translateToString(e4, t4, i4); @@ -162756,13 +191066,13 @@ WARNING: This link could potentially be dangerous`)) { }; }, 8285: (e3, t3, i3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.BufferNamespaceApi = void 0; - const s2 = i3(8771), r = i3(8460), n = i3(844); - class o extends n.Disposable { + const s3 = i3(8771), r2 = i3(8460), n2 = i3(844); + class o2 extends n2.Disposable { static { __name(this, "o"); } constructor(e4) { - super(), this._core = e4, this._onBufferChange = this.register(new r.EventEmitter()), this.onBufferChange = this._onBufferChange.event, this._normal = new s2.BufferApiView(this._core.buffers.normal, "normal"), this._alternate = new s2.BufferApiView(this._core.buffers.alt, "alternate"), this._core.buffers.onBufferActivate(() => this._onBufferChange.fire(this.active)); + super(), this._core = e4, this._onBufferChange = this.register(new r2.EventEmitter()), this.onBufferChange = this._onBufferChange.event, this._normal = new s3.BufferApiView(this._core.buffers.normal, "normal"), this._alternate = new s3.BufferApiView(this._core.buffers.alt, "alternate"), this._core.buffers.onBufferActivate(() => this._onBufferChange.fire(this.active)); } get active() { if (this._core.buffers.active === this._core.buffers.normal) return this.normal; @@ -162776,7 +191086,7 @@ WARNING: This link could potentially be dangerous`)) { return this._alternate.init(this._core.buffers.alt); } } - t3.BufferNamespaceApi = o; + t3.BufferNamespaceApi = o2; }, 7975: (e3, t3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.ParserApi = void 0, t3.ParserApi = class { constructor(e4) { @@ -162826,25 +191136,25 @@ WARNING: This link could potentially be dangerous`)) { } }; }, 744: function(e3, t3, i3) { - var s2 = this && this.__decorate || function(e4, t4, i4, s3) { - var r2, n2 = arguments.length, o2 = n2 < 3 ? t4 : null === s3 ? s3 = Object.getOwnPropertyDescriptor(t4, i4) : s3; - if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o2 = Reflect.decorate(e4, t4, i4, s3); - else for (var a2 = e4.length - 1; a2 >= 0; a2--) (r2 = e4[a2]) && (o2 = (n2 < 3 ? r2(o2) : n2 > 3 ? r2(t4, i4, o2) : r2(t4, i4)) || o2); - return n2 > 3 && o2 && Object.defineProperty(t4, i4, o2), o2; - }, r = this && this.__param || function(e4, t4) { - return function(i4, s3) { - t4(i4, s3, e4); + var s3 = this && this.__decorate || function(e4, t4, i4, s4) { + var r3, n3 = arguments.length, o3 = n3 < 3 ? t4 : null === s4 ? s4 = Object.getOwnPropertyDescriptor(t4, i4) : s4; + if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o3 = Reflect.decorate(e4, t4, i4, s4); + else for (var a3 = e4.length - 1; a3 >= 0; a3--) (r3 = e4[a3]) && (o3 = (n3 < 3 ? r3(o3) : n3 > 3 ? r3(t4, i4, o3) : r3(t4, i4)) || o3); + return n3 > 3 && o3 && Object.defineProperty(t4, i4, o3), o3; + }, r2 = this && this.__param || function(e4, t4) { + return function(i4, s4) { + t4(i4, s4, e4); }; }; Object.defineProperty(t3, "__esModule", { value: true }), t3.BufferService = t3.MINIMUM_ROWS = t3.MINIMUM_COLS = void 0; - const n = i3(8460), o = i3(844), a = i3(5295), h2 = i3(2585); + const n2 = i3(8460), o2 = i3(844), a2 = i3(5295), h2 = i3(2585); t3.MINIMUM_COLS = 2, t3.MINIMUM_ROWS = 1; - let c = t3.BufferService = class extends o.Disposable { + let c2 = t3.BufferService = class extends o2.Disposable { get buffer() { return this.buffers.active; } constructor(e4) { - super(), this.isUserScrolling = false, this._onResize = this.register(new n.EventEmitter()), this.onResize = this._onResize.event, this._onScroll = this.register(new n.EventEmitter()), this.onScroll = this._onScroll.event, this.cols = Math.max(e4.rawOptions.cols || 0, t3.MINIMUM_COLS), this.rows = Math.max(e4.rawOptions.rows || 0, t3.MINIMUM_ROWS), this.buffers = this.register(new a.BufferSet(e4, this)); + super(), this.isUserScrolling = false, this._onResize = this.register(new n2.EventEmitter()), this.onResize = this._onResize.event, this._onScroll = this.register(new n2.EventEmitter()), this.onScroll = this._onScroll.event, this.cols = Math.max(e4.rawOptions.cols || 0, t3.MINIMUM_COLS), this.rows = Math.max(e4.rawOptions.rows || 0, t3.MINIMUM_ROWS), this.buffers = this.register(new a2.BufferSet(e4, this)); } resize(e4, t4) { this.cols = e4, this.rows = t4, this.buffers.resize(e4, t4), this._onResize.fire({ cols: e4, rows: t4 }); @@ -162854,29 +191164,29 @@ WARNING: This link could potentially be dangerous`)) { } scroll(e4, t4 = false) { const i4 = this.buffer; - let s3; - s3 = this._cachedBlankLine, s3 && s3.length === this.cols && s3.getFg(0) === e4.fg && s3.getBg(0) === e4.bg || (s3 = i4.getBlankLine(e4, t4), this._cachedBlankLine = s3), s3.isWrapped = t4; - const r2 = i4.ybase + i4.scrollTop, n2 = i4.ybase + i4.scrollBottom; + let s4; + s4 = this._cachedBlankLine, s4 && s4.length === this.cols && s4.getFg(0) === e4.fg && s4.getBg(0) === e4.bg || (s4 = i4.getBlankLine(e4, t4), this._cachedBlankLine = s4), s4.isWrapped = t4; + const r3 = i4.ybase + i4.scrollTop, n3 = i4.ybase + i4.scrollBottom; if (0 === i4.scrollTop) { const e5 = i4.lines.isFull; - n2 === i4.lines.length - 1 ? e5 ? i4.lines.recycle().copyFrom(s3) : i4.lines.push(s3.clone()) : i4.lines.splice(n2 + 1, 0, s3.clone()), e5 ? this.isUserScrolling && (i4.ydisp = Math.max(i4.ydisp - 1, 0)) : (i4.ybase++, this.isUserScrolling || i4.ydisp++); + n3 === i4.lines.length - 1 ? e5 ? i4.lines.recycle().copyFrom(s4) : i4.lines.push(s4.clone()) : i4.lines.splice(n3 + 1, 0, s4.clone()), e5 ? this.isUserScrolling && (i4.ydisp = Math.max(i4.ydisp - 1, 0)) : (i4.ybase++, this.isUserScrolling || i4.ydisp++); } else { - const e5 = n2 - r2 + 1; - i4.lines.shiftElements(r2 + 1, e5 - 1, -1), i4.lines.set(n2, s3.clone()); + const e5 = n3 - r3 + 1; + i4.lines.shiftElements(r3 + 1, e5 - 1, -1), i4.lines.set(n3, s4.clone()); } this.isUserScrolling || (i4.ydisp = i4.ybase), this._onScroll.fire(i4.ydisp); } scrollLines(e4, t4, i4) { - const s3 = this.buffer; + const s4 = this.buffer; if (e4 < 0) { - if (0 === s3.ydisp) return; + if (0 === s4.ydisp) return; this.isUserScrolling = true; - } else e4 + s3.ydisp >= s3.ybase && (this.isUserScrolling = false); - const r2 = s3.ydisp; - s3.ydisp = Math.max(Math.min(s3.ydisp + e4, s3.ybase), 0), r2 !== s3.ydisp && (t4 || this._onScroll.fire(s3.ydisp)); + } else e4 + s4.ydisp >= s4.ybase && (this.isUserScrolling = false); + const r3 = s4.ydisp; + s4.ydisp = Math.max(Math.min(s4.ydisp + e4, s4.ybase), 0), r3 !== s4.ydisp && (t4 || this._onScroll.fire(s4.ydisp)); } }; - t3.BufferService = c = s2([r(0, h2.IOptionsService)], c); + t3.BufferService = c2 = s3([r2(0, h2.IOptionsService)], c2); }, 7994: (e3, t3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.CharsetService = void 0, t3.CharsetService = class { constructor() { @@ -162893,38 +191203,38 @@ WARNING: This link could potentially be dangerous`)) { } }; }, 1753: function(e3, t3, i3) { - var s2 = this && this.__decorate || function(e4, t4, i4, s3) { - var r2, n2 = arguments.length, o2 = n2 < 3 ? t4 : null === s3 ? s3 = Object.getOwnPropertyDescriptor(t4, i4) : s3; - if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o2 = Reflect.decorate(e4, t4, i4, s3); - else for (var a2 = e4.length - 1; a2 >= 0; a2--) (r2 = e4[a2]) && (o2 = (n2 < 3 ? r2(o2) : n2 > 3 ? r2(t4, i4, o2) : r2(t4, i4)) || o2); - return n2 > 3 && o2 && Object.defineProperty(t4, i4, o2), o2; - }, r = this && this.__param || function(e4, t4) { - return function(i4, s3) { - t4(i4, s3, e4); + var s3 = this && this.__decorate || function(e4, t4, i4, s4) { + var r3, n3 = arguments.length, o3 = n3 < 3 ? t4 : null === s4 ? s4 = Object.getOwnPropertyDescriptor(t4, i4) : s4; + if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o3 = Reflect.decorate(e4, t4, i4, s4); + else for (var a3 = e4.length - 1; a3 >= 0; a3--) (r3 = e4[a3]) && (o3 = (n3 < 3 ? r3(o3) : n3 > 3 ? r3(t4, i4, o3) : r3(t4, i4)) || o3); + return n3 > 3 && o3 && Object.defineProperty(t4, i4, o3), o3; + }, r2 = this && this.__param || function(e4, t4) { + return function(i4, s4) { + t4(i4, s4, e4); }; }; Object.defineProperty(t3, "__esModule", { value: true }), t3.CoreMouseService = void 0; - const n = i3(2585), o = i3(8460), a = i3(844), h2 = { NONE: { events: 0, restrict: /* @__PURE__ */ __name(() => false, "restrict") }, X10: { events: 1, restrict: /* @__PURE__ */ __name((e4) => 4 !== e4.button && 1 === e4.action && (e4.ctrl = false, e4.alt = false, e4.shift = false, true), "restrict") }, VT200: { events: 19, restrict: /* @__PURE__ */ __name((e4) => 32 !== e4.action, "restrict") }, DRAG: { events: 23, restrict: /* @__PURE__ */ __name((e4) => 32 !== e4.action || 3 !== e4.button, "restrict") }, ANY: { events: 31, restrict: /* @__PURE__ */ __name((e4) => true, "restrict") } }; - function c(e4, t4) { + const n2 = i3(2585), o2 = i3(8460), a2 = i3(844), h2 = { NONE: { events: 0, restrict: /* @__PURE__ */ __name(() => false, "restrict") }, X10: { events: 1, restrict: /* @__PURE__ */ __name((e4) => 4 !== e4.button && 1 === e4.action && (e4.ctrl = false, e4.alt = false, e4.shift = false, true), "restrict") }, VT200: { events: 19, restrict: /* @__PURE__ */ __name((e4) => 32 !== e4.action, "restrict") }, DRAG: { events: 23, restrict: /* @__PURE__ */ __name((e4) => 32 !== e4.action || 3 !== e4.button, "restrict") }, ANY: { events: 31, restrict: /* @__PURE__ */ __name((e4) => true, "restrict") } }; + function c2(e4, t4) { let i4 = (e4.ctrl ? 16 : 0) | (e4.shift ? 4 : 0) | (e4.alt ? 8 : 0); return 4 === e4.button ? (i4 |= 64, i4 |= e4.action) : (i4 |= 3 & e4.button, 4 & e4.button && (i4 |= 64), 8 & e4.button && (i4 |= 128), 32 === e4.action ? i4 |= 32 : 0 !== e4.action || t4 || (i4 |= 3)), i4; } - __name(c, "c"); - const l = String.fromCharCode, d = { DEFAULT: /* @__PURE__ */ __name((e4) => { - const t4 = [c(e4, false) + 32, e4.col + 32, e4.row + 32]; - return t4[0] > 255 || t4[1] > 255 || t4[2] > 255 ? "" : `\x1B[M${l(t4[0])}${l(t4[1])}${l(t4[2])}`; + __name(c2, "c"); + const l2 = String.fromCharCode, d2 = { DEFAULT: /* @__PURE__ */ __name((e4) => { + const t4 = [c2(e4, false) + 32, e4.col + 32, e4.row + 32]; + return t4[0] > 255 || t4[1] > 255 || t4[2] > 255 ? "" : `\x1B[M${l2(t4[0])}${l2(t4[1])}${l2(t4[2])}`; }, "DEFAULT"), SGR: /* @__PURE__ */ __name((e4) => { const t4 = 0 === e4.action && 4 !== e4.button ? "m" : "M"; - return `\x1B[<${c(e4, true)};${e4.col};${e4.row}${t4}`; + return `\x1B[<${c2(e4, true)};${e4.col};${e4.row}${t4}`; }, "SGR"), SGR_PIXELS: /* @__PURE__ */ __name((e4) => { const t4 = 0 === e4.action && 4 !== e4.button ? "m" : "M"; - return `\x1B[<${c(e4, true)};${e4.x};${e4.y}${t4}`; + return `\x1B[<${c2(e4, true)};${e4.x};${e4.y}${t4}`; }, "SGR_PIXELS") }; - let _2 = t3.CoreMouseService = class extends a.Disposable { + let _2 = t3.CoreMouseService = class extends a2.Disposable { constructor(e4, t4) { - super(), this._bufferService = e4, this._coreService = t4, this._protocols = {}, this._encodings = {}, this._activeProtocol = "", this._activeEncoding = "", this._lastEvent = null, this._onProtocolChange = this.register(new o.EventEmitter()), this.onProtocolChange = this._onProtocolChange.event; + super(), this._bufferService = e4, this._coreService = t4, this._protocols = {}, this._encodings = {}, this._activeProtocol = "", this._activeEncoding = "", this._lastEvent = null, this._onProtocolChange = this.register(new o2.EventEmitter()), this.onProtocolChange = this._onProtocolChange.event; for (const e5 of Object.keys(h2)) this.addProtocol(e5, h2[e5]); - for (const e5 of Object.keys(d)) this.addEncoding(e5, d[e5]); + for (const e5 of Object.keys(d2)) this.addEncoding(e5, d2[e5]); this.reset(); } addProtocol(e4, t4) { @@ -162977,26 +191287,26 @@ WARNING: This link could potentially be dangerous`)) { return e4.button === t4.button && e4.action === t4.action && e4.ctrl === t4.ctrl && e4.alt === t4.alt && e4.shift === t4.shift; } }; - t3.CoreMouseService = _2 = s2([r(0, n.IBufferService), r(1, n.ICoreService)], _2); + t3.CoreMouseService = _2 = s3([r2(0, n2.IBufferService), r2(1, n2.ICoreService)], _2); }, 6975: function(e3, t3, i3) { - var s2 = this && this.__decorate || function(e4, t4, i4, s3) { - var r2, n2 = arguments.length, o2 = n2 < 3 ? t4 : null === s3 ? s3 = Object.getOwnPropertyDescriptor(t4, i4) : s3; - if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o2 = Reflect.decorate(e4, t4, i4, s3); - else for (var a2 = e4.length - 1; a2 >= 0; a2--) (r2 = e4[a2]) && (o2 = (n2 < 3 ? r2(o2) : n2 > 3 ? r2(t4, i4, o2) : r2(t4, i4)) || o2); - return n2 > 3 && o2 && Object.defineProperty(t4, i4, o2), o2; - }, r = this && this.__param || function(e4, t4) { - return function(i4, s3) { - t4(i4, s3, e4); + var s3 = this && this.__decorate || function(e4, t4, i4, s4) { + var r3, n3 = arguments.length, o3 = n3 < 3 ? t4 : null === s4 ? s4 = Object.getOwnPropertyDescriptor(t4, i4) : s4; + if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o3 = Reflect.decorate(e4, t4, i4, s4); + else for (var a3 = e4.length - 1; a3 >= 0; a3--) (r3 = e4[a3]) && (o3 = (n3 < 3 ? r3(o3) : n3 > 3 ? r3(t4, i4, o3) : r3(t4, i4)) || o3); + return n3 > 3 && o3 && Object.defineProperty(t4, i4, o3), o3; + }, r2 = this && this.__param || function(e4, t4) { + return function(i4, s4) { + t4(i4, s4, e4); }; }; Object.defineProperty(t3, "__esModule", { value: true }), t3.CoreService = void 0; - const n = i3(1439), o = i3(8460), a = i3(844), h2 = i3(2585), c = Object.freeze({ insertMode: false }), l = Object.freeze({ applicationCursorKeys: false, applicationKeypad: false, bracketedPasteMode: false, origin: false, reverseWraparound: false, sendFocus: false, wraparound: true }); - let d = t3.CoreService = class extends a.Disposable { + const n2 = i3(1439), o2 = i3(8460), a2 = i3(844), h2 = i3(2585), c2 = Object.freeze({ insertMode: false }), l2 = Object.freeze({ applicationCursorKeys: false, applicationKeypad: false, bracketedPasteMode: false, origin: false, reverseWraparound: false, sendFocus: false, wraparound: true }); + let d2 = t3.CoreService = class extends a2.Disposable { constructor(e4, t4, i4) { - super(), this._bufferService = e4, this._logService = t4, this._optionsService = i4, this.isCursorInitialized = false, this.isCursorHidden = false, this._onData = this.register(new o.EventEmitter()), this.onData = this._onData.event, this._onUserInput = this.register(new o.EventEmitter()), this.onUserInput = this._onUserInput.event, this._onBinary = this.register(new o.EventEmitter()), this.onBinary = this._onBinary.event, this._onRequestScrollToBottom = this.register(new o.EventEmitter()), this.onRequestScrollToBottom = this._onRequestScrollToBottom.event, this.modes = (0, n.clone)(c), this.decPrivateModes = (0, n.clone)(l); + super(), this._bufferService = e4, this._logService = t4, this._optionsService = i4, this.isCursorInitialized = false, this.isCursorHidden = false, this._onData = this.register(new o2.EventEmitter()), this.onData = this._onData.event, this._onUserInput = this.register(new o2.EventEmitter()), this.onUserInput = this._onUserInput.event, this._onBinary = this.register(new o2.EventEmitter()), this.onBinary = this._onBinary.event, this._onRequestScrollToBottom = this.register(new o2.EventEmitter()), this.onRequestScrollToBottom = this._onRequestScrollToBottom.event, this.modes = (0, n2.clone)(c2), this.decPrivateModes = (0, n2.clone)(l2); } reset() { - this.modes = (0, n.clone)(c), this.decPrivateModes = (0, n.clone)(l); + this.modes = (0, n2.clone)(c2), this.decPrivateModes = (0, n2.clone)(l2); } triggerDataEvent(e4, t4 = false) { if (this._optionsService.rawOptions.disableStdin) return; @@ -163007,12 +191317,12 @@ WARNING: This link could potentially be dangerous`)) { this._optionsService.rawOptions.disableStdin || (this._logService.debug(`sending binary "${e4}"`, () => e4.split("").map((e5) => e5.charCodeAt(0))), this._onBinary.fire(e4)); } }; - t3.CoreService = d = s2([r(0, h2.IBufferService), r(1, h2.ILogService), r(2, h2.IOptionsService)], d); + t3.CoreService = d2 = s3([r2(0, h2.IBufferService), r2(1, h2.ILogService), r2(2, h2.IOptionsService)], d2); }, 9074: (e3, t3, i3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.DecorationService = void 0; - const s2 = i3(8055), r = i3(8460), n = i3(844), o = i3(6106); - let a = 0, h2 = 0; - class c extends n.Disposable { + const s3 = i3(8055), r2 = i3(8460), n2 = i3(844), o2 = i3(6106); + let a2 = 0, h2 = 0; + class c2 extends n2.Disposable { static { __name(this, "c"); } @@ -163020,11 +191330,11 @@ WARNING: This link could potentially be dangerous`)) { return this._decorations.values(); } constructor() { - super(), this._decorations = new o.SortedList((e4) => e4?.marker.line), this._onDecorationRegistered = this.register(new r.EventEmitter()), this.onDecorationRegistered = this._onDecorationRegistered.event, this._onDecorationRemoved = this.register(new r.EventEmitter()), this.onDecorationRemoved = this._onDecorationRemoved.event, this.register((0, n.toDisposable)(() => this.reset())); + super(), this._decorations = new o2.SortedList((e4) => e4?.marker.line), this._onDecorationRegistered = this.register(new r2.EventEmitter()), this.onDecorationRegistered = this._onDecorationRegistered.event, this._onDecorationRemoved = this.register(new r2.EventEmitter()), this.onDecorationRemoved = this._onDecorationRemoved.event, this.register((0, n2.toDisposable)(() => this.reset())); } registerDecoration(e4) { if (e4.marker.isDisposed) return; - const t4 = new l(e4); + const t4 = new l2(e4); if (t4) { const e5 = t4.marker.onDispose(() => t4.dispose()); t4.onDispose(() => { @@ -163038,17 +191348,17 @@ WARNING: This link could potentially be dangerous`)) { this._decorations.clear(); } *getDecorationsAtCell(e4, t4, i4) { - let s3 = 0, r2 = 0; - for (const n2 of this._decorations.getKeyIterator(t4)) s3 = n2.options.x ?? 0, r2 = s3 + (n2.options.width ?? 1), e4 >= s3 && e4 < r2 && (!i4 || (n2.options.layer ?? "bottom") === i4) && (yield n2); + let s4 = 0, r3 = 0; + for (const n3 of this._decorations.getKeyIterator(t4)) s4 = n3.options.x ?? 0, r3 = s4 + (n3.options.width ?? 1), e4 >= s4 && e4 < r3 && (!i4 || (n3.options.layer ?? "bottom") === i4) && (yield n3); } - forEachDecorationAtCell(e4, t4, i4, s3) { + forEachDecorationAtCell(e4, t4, i4, s4) { this._decorations.forEachByKey(t4, (t5) => { - a = t5.options.x ?? 0, h2 = a + (t5.options.width ?? 1), e4 >= a && e4 < h2 && (!i4 || (t5.options.layer ?? "bottom") === i4) && s3(t5); + a2 = t5.options.x ?? 0, h2 = a2 + (t5.options.width ?? 1), e4 >= a2 && e4 < h2 && (!i4 || (t5.options.layer ?? "bottom") === i4) && s4(t5); }); } } - t3.DecorationService = c; - class l extends n.Disposable { + t3.DecorationService = c2; + class l2 extends n2.Disposable { static { __name(this, "l"); } @@ -163056,13 +191366,13 @@ WARNING: This link could potentially be dangerous`)) { return this._isDisposed; } get backgroundColorRGB() { - return null === this._cachedBg && (this.options.backgroundColor ? this._cachedBg = s2.css.toColor(this.options.backgroundColor) : this._cachedBg = void 0), this._cachedBg; + return null === this._cachedBg && (this.options.backgroundColor ? this._cachedBg = s3.css.toColor(this.options.backgroundColor) : this._cachedBg = void 0), this._cachedBg; } get foregroundColorRGB() { - return null === this._cachedFg && (this.options.foregroundColor ? this._cachedFg = s2.css.toColor(this.options.foregroundColor) : this._cachedFg = void 0), this._cachedFg; + return null === this._cachedFg && (this.options.foregroundColor ? this._cachedFg = s3.css.toColor(this.options.foregroundColor) : this._cachedFg = void 0), this._cachedFg; } constructor(e4) { - super(), this.options = e4, this.onRenderEmitter = this.register(new r.EventEmitter()), this.onRender = this.onRenderEmitter.event, this._onDispose = this.register(new r.EventEmitter()), this.onDispose = this._onDispose.event, this._cachedBg = null, this._cachedFg = null, this.marker = e4.marker, this.options.overviewRulerOptions && !this.options.overviewRulerOptions.position && (this.options.overviewRulerOptions.position = "full"); + super(), this.options = e4, this.onRenderEmitter = this.register(new r2.EventEmitter()), this.onRender = this.onRenderEmitter.event, this._onDispose = this.register(new r2.EventEmitter()), this.onDispose = this._onDispose.event, this._cachedBg = null, this._cachedFg = null, this.marker = e4.marker, this.options.overviewRulerOptions && !this.options.overviewRulerOptions.position && (this.options.overviewRulerOptions.position = "full"); } dispose() { this._onDispose.fire(), super.dispose(); @@ -163070,8 +191380,8 @@ WARNING: This link could potentially be dangerous`)) { } }, 4348: (e3, t3, i3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.InstantiationService = t3.ServiceCollection = void 0; - const s2 = i3(2585), r = i3(8343); - class n { + const s3 = i3(2585), r2 = i3(8343); + class n2 { static { __name(this, "n"); } @@ -163093,9 +191403,9 @@ WARNING: This link could potentially be dangerous`)) { return this._entries.get(e4); } } - t3.ServiceCollection = n, t3.InstantiationService = class { + t3.ServiceCollection = n2, t3.InstantiationService = class { constructor() { - this._services = new n(), this._services.set(s2.IInstantiationService, this); + this._services = new n2(), this._services.set(s3.IInstantiationService, this); } setService(e4, t4) { this._services.set(e4, t4); @@ -163104,39 +191414,39 @@ WARNING: This link could potentially be dangerous`)) { return this._services.get(e4); } createInstance(e4, ...t4) { - const i4 = (0, r.getServiceDependencies)(e4).sort((e5, t5) => e5.index - t5.index), s3 = []; + const i4 = (0, r2.getServiceDependencies)(e4).sort((e5, t5) => e5.index - t5.index), s4 = []; for (const t5 of i4) { const i5 = this._services.get(t5.id); if (!i5) throw new Error(`[createInstance] ${e4.name} depends on UNKNOWN service ${t5.id}.`); - s3.push(i5); + s4.push(i5); } - const n2 = i4.length > 0 ? i4[0].index : t4.length; - if (t4.length !== n2) throw new Error(`[createInstance] First service dependency of ${e4.name} at position ${n2 + 1} conflicts with ${t4.length} static arguments`); - return new e4(...[...t4, ...s3]); + const n3 = i4.length > 0 ? i4[0].index : t4.length; + if (t4.length !== n3) throw new Error(`[createInstance] First service dependency of ${e4.name} at position ${n3 + 1} conflicts with ${t4.length} static arguments`); + return new e4(...[...t4, ...s4]); } }; }, 7866: function(e3, t3, i3) { - var s2 = this && this.__decorate || function(e4, t4, i4, s3) { - var r2, n2 = arguments.length, o2 = n2 < 3 ? t4 : null === s3 ? s3 = Object.getOwnPropertyDescriptor(t4, i4) : s3; - if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o2 = Reflect.decorate(e4, t4, i4, s3); - else for (var a2 = e4.length - 1; a2 >= 0; a2--) (r2 = e4[a2]) && (o2 = (n2 < 3 ? r2(o2) : n2 > 3 ? r2(t4, i4, o2) : r2(t4, i4)) || o2); - return n2 > 3 && o2 && Object.defineProperty(t4, i4, o2), o2; - }, r = this && this.__param || function(e4, t4) { - return function(i4, s3) { - t4(i4, s3, e4); + var s3 = this && this.__decorate || function(e4, t4, i4, s4) { + var r3, n3 = arguments.length, o3 = n3 < 3 ? t4 : null === s4 ? s4 = Object.getOwnPropertyDescriptor(t4, i4) : s4; + if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o3 = Reflect.decorate(e4, t4, i4, s4); + else for (var a3 = e4.length - 1; a3 >= 0; a3--) (r3 = e4[a3]) && (o3 = (n3 < 3 ? r3(o3) : n3 > 3 ? r3(t4, i4, o3) : r3(t4, i4)) || o3); + return n3 > 3 && o3 && Object.defineProperty(t4, i4, o3), o3; + }, r2 = this && this.__param || function(e4, t4) { + return function(i4, s4) { + t4(i4, s4, e4); }; }; Object.defineProperty(t3, "__esModule", { value: true }), t3.traceCall = t3.setTraceLogger = t3.LogService = void 0; - const n = i3(844), o = i3(2585), a = { trace: o.LogLevelEnum.TRACE, debug: o.LogLevelEnum.DEBUG, info: o.LogLevelEnum.INFO, warn: o.LogLevelEnum.WARN, error: o.LogLevelEnum.ERROR, off: o.LogLevelEnum.OFF }; - let h2, c = t3.LogService = class extends n.Disposable { + const n2 = i3(844), o2 = i3(2585), a2 = { trace: o2.LogLevelEnum.TRACE, debug: o2.LogLevelEnum.DEBUG, info: o2.LogLevelEnum.INFO, warn: o2.LogLevelEnum.WARN, error: o2.LogLevelEnum.ERROR, off: o2.LogLevelEnum.OFF }; + let h2, c2 = t3.LogService = class extends n2.Disposable { get logLevel() { return this._logLevel; } constructor(e4) { - super(), this._optionsService = e4, this._logLevel = o.LogLevelEnum.OFF, this._updateLogLevel(), this.register(this._optionsService.onSpecificOptionChange("logLevel", () => this._updateLogLevel())), h2 = this; + super(), this._optionsService = e4, this._logLevel = o2.LogLevelEnum.OFF, this._updateLogLevel(), this.register(this._optionsService.onSpecificOptionChange("logLevel", () => this._updateLogLevel())), h2 = this; } _updateLogLevel() { - this._logLevel = a[this._optionsService.rawOptions.logLevel]; + this._logLevel = a2[this._optionsService.rawOptions.logLevel]; } _evalLazyOptionalParams(e4) { for (let t4 = 0; t4 < e4.length; t4++) "function" == typeof e4[t4] && (e4[t4] = e4[t4]()); @@ -163145,52 +191455,52 @@ WARNING: This link could potentially be dangerous`)) { this._evalLazyOptionalParams(i4), e4.call(console, (this._optionsService.options.logger ? "" : "xterm.js: ") + t4, ...i4); } trace(e4, ...t4) { - this._logLevel <= o.LogLevelEnum.TRACE && this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger) ?? console.log, e4, t4); + this._logLevel <= o2.LogLevelEnum.TRACE && this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger) ?? console.log, e4, t4); } debug(e4, ...t4) { - this._logLevel <= o.LogLevelEnum.DEBUG && this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger) ?? console.log, e4, t4); + this._logLevel <= o2.LogLevelEnum.DEBUG && this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger) ?? console.log, e4, t4); } info(e4, ...t4) { - this._logLevel <= o.LogLevelEnum.INFO && this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger) ?? console.info, e4, t4); + this._logLevel <= o2.LogLevelEnum.INFO && this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger) ?? console.info, e4, t4); } warn(e4, ...t4) { - this._logLevel <= o.LogLevelEnum.WARN && this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger) ?? console.warn, e4, t4); + this._logLevel <= o2.LogLevelEnum.WARN && this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger) ?? console.warn, e4, t4); } error(e4, ...t4) { - this._logLevel <= o.LogLevelEnum.ERROR && this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger) ?? console.error, e4, t4); + this._logLevel <= o2.LogLevelEnum.ERROR && this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger) ?? console.error, e4, t4); } }; - t3.LogService = c = s2([r(0, o.IOptionsService)], c), t3.setTraceLogger = function(e4) { + t3.LogService = c2 = s3([r2(0, o2.IOptionsService)], c2), t3.setTraceLogger = function(e4) { h2 = e4; }, t3.traceCall = function(e4, t4, i4) { if ("function" != typeof i4.value) throw new Error("not supported"); - const s3 = i4.value; + const s4 = i4.value; i4.value = function(...e5) { - if (h2.logLevel !== o.LogLevelEnum.TRACE) return s3.apply(this, e5); - h2.trace(`GlyphRenderer#${s3.name}(${e5.map((e6) => JSON.stringify(e6)).join(", ")})`); - const t5 = s3.apply(this, e5); - return h2.trace(`GlyphRenderer#${s3.name} return`, t5), t5; + if (h2.logLevel !== o2.LogLevelEnum.TRACE) return s4.apply(this, e5); + h2.trace(`GlyphRenderer#${s4.name}(${e5.map((e6) => JSON.stringify(e6)).join(", ")})`); + const t5 = s4.apply(this, e5); + return h2.trace(`GlyphRenderer#${s4.name} return`, t5), t5; }; }; }, 7302: (e3, t3, i3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.OptionsService = t3.DEFAULT_OPTIONS = void 0; - const s2 = i3(8460), r = i3(844), n = i3(6114); - t3.DEFAULT_OPTIONS = { cols: 80, rows: 24, cursorBlink: false, cursorStyle: "block", cursorWidth: 1, cursorInactiveStyle: "outline", customGlyphs: true, drawBoldTextInBrightColors: true, documentOverride: null, fastScrollModifier: "alt", fastScrollSensitivity: 5, fontFamily: "courier-new, courier, monospace", fontSize: 15, fontWeight: "normal", fontWeightBold: "bold", ignoreBracketedPasteMode: false, lineHeight: 1, letterSpacing: 0, linkHandler: null, logLevel: "info", logger: null, scrollback: 1e3, scrollOnUserInput: true, scrollSensitivity: 1, screenReaderMode: false, smoothScrollDuration: 0, macOptionIsMeta: false, macOptionClickForcesSelection: false, minimumContrastRatio: 1, disableStdin: false, allowProposedApi: false, allowTransparency: false, tabStopWidth: 8, theme: {}, rescaleOverlappingGlyphs: false, rightClickSelectsWord: n.isMac, windowOptions: {}, windowsMode: false, windowsPty: {}, wordSeparator: " ()[]{}',\"`", altClickMovesCursor: true, convertEol: false, termName: "xterm", cancelEvents: false, overviewRulerWidth: 0 }; - const o = ["normal", "bold", "100", "200", "300", "400", "500", "600", "700", "800", "900"]; - class a extends r.Disposable { + const s3 = i3(8460), r2 = i3(844), n2 = i3(6114); + t3.DEFAULT_OPTIONS = { cols: 80, rows: 24, cursorBlink: false, cursorStyle: "block", cursorWidth: 1, cursorInactiveStyle: "outline", customGlyphs: true, drawBoldTextInBrightColors: true, documentOverride: null, fastScrollModifier: "alt", fastScrollSensitivity: 5, fontFamily: "courier-new, courier, monospace", fontSize: 15, fontWeight: "normal", fontWeightBold: "bold", ignoreBracketedPasteMode: false, lineHeight: 1, letterSpacing: 0, linkHandler: null, logLevel: "info", logger: null, scrollback: 1e3, scrollOnUserInput: true, scrollSensitivity: 1, screenReaderMode: false, smoothScrollDuration: 0, macOptionIsMeta: false, macOptionClickForcesSelection: false, minimumContrastRatio: 1, disableStdin: false, allowProposedApi: false, allowTransparency: false, tabStopWidth: 8, theme: {}, rescaleOverlappingGlyphs: false, rightClickSelectsWord: n2.isMac, windowOptions: {}, windowsMode: false, windowsPty: {}, wordSeparator: " ()[]{}',\"`", altClickMovesCursor: true, convertEol: false, termName: "xterm", cancelEvents: false, overviewRulerWidth: 0 }; + const o2 = ["normal", "bold", "100", "200", "300", "400", "500", "600", "700", "800", "900"]; + class a2 extends r2.Disposable { static { __name(this, "a"); } constructor(e4) { - super(), this._onOptionChange = this.register(new s2.EventEmitter()), this.onOptionChange = this._onOptionChange.event; + super(), this._onOptionChange = this.register(new s3.EventEmitter()), this.onOptionChange = this._onOptionChange.event; const i4 = { ...t3.DEFAULT_OPTIONS }; for (const t4 in e4) if (t4 in i4) try { - const s3 = e4[t4]; - i4[t4] = this._sanitizeAndValidateOption(t4, s3); + const s4 = e4[t4]; + i4[t4] = this._sanitizeAndValidateOption(t4, s4); } catch (e5) { console.error(e5); } - this.rawOptions = i4, this.options = { ...i4 }, this._setupOptions(), this.register((0, r.toDisposable)(() => { + this.rawOptions = i4, this.options = { ...i4 }, this._setupOptions(), this.register((0, r2.toDisposable)(() => { this.rawOptions.linkHandler = null, this.rawOptions.documentOverride = null; })); } @@ -163213,8 +191523,8 @@ WARNING: This link could potentially be dangerous`)) { i5 = this._sanitizeAndValidateOption(e5, i5), this.rawOptions[e5] !== i5 && (this.rawOptions[e5] = i5, this._onOptionChange.fire(e5)); }, "i"); for (const t4 in this.rawOptions) { - const s3 = { get: e4.bind(this, t4), set: i4.bind(this, t4) }; - Object.defineProperty(this.options, t4, s3); + const s4 = { get: e4.bind(this, t4), set: i4.bind(this, t4) }; + Object.defineProperty(this.options, t4, s4); } } _sanitizeAndValidateOption(e4, i4) { @@ -163230,7 +191540,7 @@ WARNING: This link could potentially be dangerous`)) { case "fontWeight": case "fontWeightBold": if ("number" == typeof i4 && 1 <= i4 && i4 <= 1e3) break; - i4 = o.includes(i4) ? i4 : t3.DEFAULT_OPTIONS[e4]; + i4 = o2.includes(i4) ? i4 : t3.DEFAULT_OPTIONS[e4]; break; case "cursorWidth": i4 = Math.floor(i4); @@ -163258,34 +191568,34 @@ WARNING: This link could potentially be dangerous`)) { return i4; } } - t3.OptionsService = a; + t3.OptionsService = a2; }, 2660: function(e3, t3, i3) { - var s2 = this && this.__decorate || function(e4, t4, i4, s3) { - var r2, n2 = arguments.length, o2 = n2 < 3 ? t4 : null === s3 ? s3 = Object.getOwnPropertyDescriptor(t4, i4) : s3; - if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o2 = Reflect.decorate(e4, t4, i4, s3); - else for (var a = e4.length - 1; a >= 0; a--) (r2 = e4[a]) && (o2 = (n2 < 3 ? r2(o2) : n2 > 3 ? r2(t4, i4, o2) : r2(t4, i4)) || o2); - return n2 > 3 && o2 && Object.defineProperty(t4, i4, o2), o2; - }, r = this && this.__param || function(e4, t4) { - return function(i4, s3) { - t4(i4, s3, e4); + var s3 = this && this.__decorate || function(e4, t4, i4, s4) { + var r3, n3 = arguments.length, o3 = n3 < 3 ? t4 : null === s4 ? s4 = Object.getOwnPropertyDescriptor(t4, i4) : s4; + if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o3 = Reflect.decorate(e4, t4, i4, s4); + else for (var a2 = e4.length - 1; a2 >= 0; a2--) (r3 = e4[a2]) && (o3 = (n3 < 3 ? r3(o3) : n3 > 3 ? r3(t4, i4, o3) : r3(t4, i4)) || o3); + return n3 > 3 && o3 && Object.defineProperty(t4, i4, o3), o3; + }, r2 = this && this.__param || function(e4, t4) { + return function(i4, s4) { + t4(i4, s4, e4); }; }; Object.defineProperty(t3, "__esModule", { value: true }), t3.OscLinkService = void 0; - const n = i3(2585); - let o = t3.OscLinkService = class { + const n2 = i3(2585); + let o2 = t3.OscLinkService = class { constructor(e4) { this._bufferService = e4, this._nextId = 1, this._entriesWithId = /* @__PURE__ */ new Map(), this._dataByLinkId = /* @__PURE__ */ new Map(); } registerLink(e4) { const t4 = this._bufferService.buffer; if (void 0 === e4.id) { - const i5 = t4.addMarker(t4.ybase + t4.y), s4 = { data: e4, id: this._nextId++, lines: [i5] }; - return i5.onDispose(() => this._removeMarkerFromLink(s4, i5)), this._dataByLinkId.set(s4.id, s4), s4.id; + const i5 = t4.addMarker(t4.ybase + t4.y), s5 = { data: e4, id: this._nextId++, lines: [i5] }; + return i5.onDispose(() => this._removeMarkerFromLink(s5, i5)), this._dataByLinkId.set(s5.id, s5), s5.id; } - const i4 = e4, s3 = this._getEntryIdKey(i4), r2 = this._entriesWithId.get(s3); - if (r2) return this.addLineToLink(r2.id, t4.ybase + t4.y), r2.id; - const n2 = t4.addMarker(t4.ybase + t4.y), o2 = { id: this._nextId++, key: this._getEntryIdKey(i4), data: i4, lines: [n2] }; - return n2.onDispose(() => this._removeMarkerFromLink(o2, n2)), this._entriesWithId.set(o2.key, o2), this._dataByLinkId.set(o2.id, o2), o2.id; + const i4 = e4, s4 = this._getEntryIdKey(i4), r3 = this._entriesWithId.get(s4); + if (r3) return this.addLineToLink(r3.id, t4.ybase + t4.y), r3.id; + const n3 = t4.addMarker(t4.ybase + t4.y), o3 = { id: this._nextId++, key: this._getEntryIdKey(i4), data: i4, lines: [n3] }; + return n3.onDispose(() => this._removeMarkerFromLink(o3, n3)), this._entriesWithId.set(o3.key, o3), this._dataByLinkId.set(o3.id, o3), o3.id; } addLineToLink(e4, t4) { const i4 = this._dataByLinkId.get(e4); @@ -163305,33 +191615,33 @@ WARNING: This link could potentially be dangerous`)) { -1 !== i4 && (e4.lines.splice(i4, 1), 0 === e4.lines.length && (void 0 !== e4.data.id && this._entriesWithId.delete(e4.key), this._dataByLinkId.delete(e4.id))); } }; - t3.OscLinkService = o = s2([r(0, n.IBufferService)], o); + t3.OscLinkService = o2 = s3([r2(0, n2.IBufferService)], o2); }, 8343: (e3, t3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.createDecorator = t3.getServiceDependencies = t3.serviceRegistry = void 0; - const i3 = "di$target", s2 = "di$dependencies"; + const i3 = "di$target", s3 = "di$dependencies"; t3.serviceRegistry = /* @__PURE__ */ new Map(), t3.getServiceDependencies = function(e4) { - return e4[s2] || []; + return e4[s3] || []; }, t3.createDecorator = function(e4) { if (t3.serviceRegistry.has(e4)) return t3.serviceRegistry.get(e4); - const r = /* @__PURE__ */ __name(function(e5, t4, n) { + const r2 = /* @__PURE__ */ __name(function(e5, t4, n2) { if (3 !== arguments.length) throw new Error("@IServiceName-decorator can only be used to decorate a parameter"); - !function(e6, t5, r2) { - t5[i3] === t5 ? t5[s2].push({ id: e6, index: r2 }) : (t5[s2] = [{ id: e6, index: r2 }], t5[i3] = t5); - }(r, e5, n); + !function(e6, t5, r3) { + t5[i3] === t5 ? t5[s3].push({ id: e6, index: r3 }) : (t5[s3] = [{ id: e6, index: r3 }], t5[i3] = t5); + }(r2, e5, n2); }, "r"); - return r.toString = () => e4, t3.serviceRegistry.set(e4, r), r; + return r2.toString = () => e4, t3.serviceRegistry.set(e4, r2), r2; }; }, 2585: (e3, t3, i3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.IDecorationService = t3.IUnicodeService = t3.IOscLinkService = t3.IOptionsService = t3.ILogService = t3.LogLevelEnum = t3.IInstantiationService = t3.ICharsetService = t3.ICoreService = t3.ICoreMouseService = t3.IBufferService = void 0; - const s2 = i3(8343); - var r; - t3.IBufferService = (0, s2.createDecorator)("BufferService"), t3.ICoreMouseService = (0, s2.createDecorator)("CoreMouseService"), t3.ICoreService = (0, s2.createDecorator)("CoreService"), t3.ICharsetService = (0, s2.createDecorator)("CharsetService"), t3.IInstantiationService = (0, s2.createDecorator)("InstantiationService"), function(e4) { + const s3 = i3(8343); + var r2; + t3.IBufferService = (0, s3.createDecorator)("BufferService"), t3.ICoreMouseService = (0, s3.createDecorator)("CoreMouseService"), t3.ICoreService = (0, s3.createDecorator)("CoreService"), t3.ICharsetService = (0, s3.createDecorator)("CharsetService"), t3.IInstantiationService = (0, s3.createDecorator)("InstantiationService"), function(e4) { e4[e4.TRACE = 0] = "TRACE", e4[e4.DEBUG = 1] = "DEBUG", e4[e4.INFO = 2] = "INFO", e4[e4.WARN = 3] = "WARN", e4[e4.ERROR = 4] = "ERROR", e4[e4.OFF = 5] = "OFF"; - }(r || (t3.LogLevelEnum = r = {})), t3.ILogService = (0, s2.createDecorator)("LogService"), t3.IOptionsService = (0, s2.createDecorator)("OptionsService"), t3.IOscLinkService = (0, s2.createDecorator)("OscLinkService"), t3.IUnicodeService = (0, s2.createDecorator)("UnicodeService"), t3.IDecorationService = (0, s2.createDecorator)("DecorationService"); + }(r2 || (t3.LogLevelEnum = r2 = {})), t3.ILogService = (0, s3.createDecorator)("LogService"), t3.IOptionsService = (0, s3.createDecorator)("OptionsService"), t3.IOscLinkService = (0, s3.createDecorator)("OscLinkService"), t3.IUnicodeService = (0, s3.createDecorator)("UnicodeService"), t3.IDecorationService = (0, s3.createDecorator)("DecorationService"); }, 1480: (e3, t3, i3) => { Object.defineProperty(t3, "__esModule", { value: true }), t3.UnicodeService = void 0; - const s2 = i3(8460), r = i3(225); - class n { + const s3 = i3(8460), r2 = i3(225); + class n2 { static { __name(this, "n"); } @@ -163348,8 +191658,8 @@ WARNING: This link could potentially be dangerous`)) { return (16777215 & e4) << 3 | (3 & t4) << 1 | (i4 ? 1 : 0); } constructor() { - this._providers = /* @__PURE__ */ Object.create(null), this._active = "", this._onChange = new s2.EventEmitter(), this.onChange = this._onChange.event; - const e4 = new r.UnicodeV6(); + this._providers = /* @__PURE__ */ Object.create(null), this._active = "", this._onChange = new s3.EventEmitter(), this.onChange = this._onChange.event; + const e4 = new r2.UnicodeV6(); this.register(e4), this._active = e4.version, this._activeProvider = e4; } dispose() { @@ -163373,17 +191683,17 @@ WARNING: This link could potentially be dangerous`)) { } getStringCellWidth(e4) { let t4 = 0, i4 = 0; - const s3 = e4.length; - for (let r2 = 0; r2 < s3; ++r2) { - let o = e4.charCodeAt(r2); - if (55296 <= o && o <= 56319) { - if (++r2 >= s3) return t4 + this.wcwidth(o); - const i5 = e4.charCodeAt(r2); - 56320 <= i5 && i5 <= 57343 ? o = 1024 * (o - 55296) + i5 - 56320 + 65536 : t4 += this.wcwidth(i5); + const s4 = e4.length; + for (let r3 = 0; r3 < s4; ++r3) { + let o2 = e4.charCodeAt(r3); + if (55296 <= o2 && o2 <= 56319) { + if (++r3 >= s4) return t4 + this.wcwidth(o2); + const i5 = e4.charCodeAt(r3); + 56320 <= i5 && i5 <= 57343 ? o2 = 1024 * (o2 - 55296) + i5 - 56320 + 65536 : t4 += this.wcwidth(i5); } - const a = this.charProperties(o, i4); - let h2 = n.extractWidth(a); - n.extractShouldJoin(a) && (h2 -= n.extractWidth(i4)), t4 += h2, i4 = a; + const a2 = this.charProperties(o2, i4); + let h2 = n2.extractWidth(a2); + n2.extractShouldJoin(a2) && (h2 -= n2.extractWidth(i4)), t4 += h2, i4 = a2; } return t4; } @@ -163391,36 +191701,36 @@ WARNING: This link could potentially be dangerous`)) { return this._activeProvider.charProperties(e4, t4); } } - t3.UnicodeService = n; + t3.UnicodeService = n2; } }, t2 = {}; - function i2(s2) { - var r = t2[s2]; - if (void 0 !== r) return r.exports; - var n = t2[s2] = { exports: {} }; - return e2[s2].call(n.exports, n, n.exports, i2), n.exports; + function i2(s3) { + var r2 = t2[s3]; + if (void 0 !== r2) return r2.exports; + var n2 = t2[s3] = { exports: {} }; + return e2[s3].call(n2.exports, n2, n2.exports, i2), n2.exports; } __name(i2, "i"); - var s = {}; + var s2 = {}; return (() => { - var e3 = s; + var e3 = s2; Object.defineProperty(e3, "__esModule", { value: true }), e3.Terminal = void 0; - const t3 = i2(9042), r = i2(3236), n = i2(844), o = i2(5741), a = i2(8285), h2 = i2(7975), c = i2(7090), l = ["cols", "rows"]; - class d extends n.Disposable { + const t3 = i2(9042), r2 = i2(3236), n2 = i2(844), o2 = i2(5741), a2 = i2(8285), h2 = i2(7975), c2 = i2(7090), l2 = ["cols", "rows"]; + class d2 extends n2.Disposable { static { __name(this, "d"); } constructor(e4) { - super(), this._core = this.register(new r.Terminal(e4)), this._addonManager = this.register(new o.AddonManager()), this._publicOptions = { ...this._core.options }; + super(), this._core = this.register(new r2.Terminal(e4)), this._addonManager = this.register(new o2.AddonManager()), this._publicOptions = { ...this._core.options }; const t4 = /* @__PURE__ */ __name((e5) => this._core.options[e5], "t"), i3 = /* @__PURE__ */ __name((e5, t5) => { this._checkReadonlyOptions(e5), this._core.options[e5] = t5; }, "i"); for (const e5 in this._core.options) { - const s2 = { get: t4.bind(this, e5), set: i3.bind(this, e5) }; - Object.defineProperty(this._publicOptions, e5, s2); + const s3 = { get: t4.bind(this, e5), set: i3.bind(this, e5) }; + Object.defineProperty(this._publicOptions, e5, s3); } } _checkReadonlyOptions(e4) { - if (l.includes(e4)) throw new Error(`Option "${e4}" can only be set in the constructor`); + if (l2.includes(e4)) throw new Error(`Option "${e4}" can only be set in the constructor`); } _checkProposedApi() { if (!this._core.optionsService.rawOptions.allowProposedApi) throw new Error("You must set the allowProposedApi option to true to use proposed API"); @@ -163468,7 +191778,7 @@ WARNING: This link could potentially be dangerous`)) { return this._parser || (this._parser = new h2.ParserApi(this._core)), this._parser; } get unicode() { - return this._checkProposedApi(), new c.UnicodeApi(this._core); + return this._checkProposedApi(), new c2.UnicodeApi(this._core); } get textarea() { return this._core.textarea; @@ -163480,7 +191790,7 @@ WARNING: This link could potentially be dangerous`)) { return this._core.cols; } get buffer() { - return this._buffer || (this._buffer = this.register(new a.BufferNamespaceApi(this._core))), this._buffer; + return this._buffer || (this._buffer = this.register(new a2.BufferNamespaceApi(this._core))), this._buffer; } get markers() { return this._checkProposedApi(), this._core.markers; @@ -163618,8 +191928,8 @@ WARNING: This link could potentially be dangerous`)) { for (const t4 of e4) if (t4 && (t4 === 1 / 0 || isNaN(t4) || t4 % 1 != 0 || t4 < 0)) throw new Error("This API only accepts positive integers"); } } - e3.Terminal = d; - })(), s; + e3.Terminal = d2; + })(), s2; })()); })(xterm$2, xterm$2.exports); var xtermExports = xterm$2.exports; @@ -163633,10 +191943,8 @@ function useTerminal(element) { ); terminal.loadAddon(fitAddon); terminal.attachCustomKeyEventHandler((event) => { - if (event.type === "keydown" && (event.ctrlKey || event.metaKey)) { - if (event.key === "c" || event.key === "v") { - return false; - } + if (event.type === "keydown" && (event.ctrlKey || event.metaKey) && (event.key === "c" && terminal.hasSelection() || event.key === "v")) { + return false; } return true; }); @@ -163648,42 +191956,55 @@ function useTerminal(element) { }); return { terminal, - useAutoSize(root24, autoRows = true, autoCols = true, onResize2) { + useAutoSize({ + root: root27, + autoRows = true, + autoCols = true, + minCols = Number.NEGATIVE_INFINITY, + minRows = Number.NEGATIVE_INFINITY, + onResize: onResize2 + }) { const ensureValidRows = /* @__PURE__ */ __name((rows) => { if (rows == null || isNaN(rows)) { - return root24.value?.clientHeight / 20; + return root27.value?.clientHeight / 20; } return rows; }, "ensureValidRows"); const ensureValidCols = /* @__PURE__ */ __name((cols) => { if (cols == null || isNaN(cols)) { - return root24.value?.clientWidth / 8; + return root27.value?.clientWidth / 8; } return cols; }, "ensureValidCols"); - const resize = /* @__PURE__ */ __name(() => { + const resize2 = /* @__PURE__ */ __name(() => { const dims = fitAddon.proposeDimensions(); terminal.resize( - autoCols ? ensureValidCols(dims?.cols) : terminal.cols, - autoRows ? ensureValidRows(dims?.rows) : terminal.rows + Math.max( + autoCols ? ensureValidCols(dims?.cols) : terminal.cols, + minCols + ), + Math.max( + autoRows ? ensureValidRows(dims?.rows) : terminal.rows, + minRows + ) ); onResize2?.(); }, "resize"); - const resizeObserver = new ResizeObserver(lodashExports.debounce(resize, 25)); + const resizeObserver = new ResizeObserver(lodashExports.debounce(resize2, 25)); onMounted(async () => { - resizeObserver.observe(root24.value); - resize(); + resizeObserver.observe(root27.value); + resize2(); }); onUnmounted(() => { resizeObserver.disconnect(); }); - return { resize }; + return { resize: resize2 }; } }; } __name(useTerminal, "useTerminal"); -const _withScopeId$d = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-250ab9af"), n = n(), popScopeId(), n), "_withScopeId$d"); -const _hoisted_1$v = { class: "p-terminal rounded-none h-full w-full p-2" }; +const _withScopeId$d = /* @__PURE__ */ __name((n2) => (pushScopeId("data-v-250ab9af"), n2 = n2(), popScopeId(), n2), "_withScopeId$d"); +const _hoisted_1$t = { class: "p-terminal rounded-none h-full w-full p-2" }; const _sfc_main$t = /* @__PURE__ */ defineComponent({ __name: "BaseTerminal", emits: ["created"], @@ -163698,7 +192019,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({ ref_key: "rootEl", ref: rootEl }, [ - createBaseVNode("div", _hoisted_1$v, [ + createBaseVNode("div", _hoisted_1$t, [ createBaseVNode("div", { class: "h-full terminal-host", ref_key: "terminalEl", @@ -163713,13 +192034,18 @@ const BaseTerminal = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__scopeId", "da const _sfc_main$s = /* @__PURE__ */ defineComponent({ __name: "CommandTerminal", setup(__props) { - const terminalCreated = /* @__PURE__ */ __name(({ terminal, useAutoSize }, root24) => { + const terminalCreated = /* @__PURE__ */ __name(({ terminal, useAutoSize }, root27) => { const terminalApi = electronAPI().Terminal; let offData; let offOutput; - useAutoSize(root24, true, true, () => { - if (!terminal.element?.offsetParent) return; - terminalApi.resize(terminal.cols, terminal.rows); + useAutoSize({ + root: root27, + autoRows: true, + autoCols: true, + onResize: /* @__PURE__ */ __name(() => { + if (!terminal.element?.offsetParent) return; + terminalApi.resize(terminal.cols, terminal.rows); + }, "onResize") }); onMounted(async () => { offData = terminal.onData(async (message3) => { @@ -163746,7 +192072,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({ }; } }); -const CommandTerminal = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__scopeId", "data-v-6187144a"]]); +const CommandTerminal = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__scopeId", "data-v-90a7f075"]]); const useExecutionStore = /* @__PURE__ */ defineStore("execution", () => { const clientId = ref(null); const activePromptId = ref(null); @@ -163759,7 +192085,7 @@ const useExecutionStore = /* @__PURE__ */ defineStore("execution", () => { const canvasState = workflow.changeTracker?.activeState ?? null; if (!canvasState) return null; return canvasState.nodes.find( - (n) => String(n.id) === executingNodeId.value + (n2) => String(n2.id) === executingNodeId.value ) ?? null; }); const _executingNodeProgress = ref(null); @@ -163823,8 +192149,8 @@ const useExecutionStore = /* @__PURE__ */ defineStore("execution", () => { __name(handleExecutionStart, "handleExecutionStart"); function handleExecutionCached(e2) { if (!activePrompt.value) return; - for (const n of e2.detail.nodes) { - activePrompt.value.nodes[n] = true; + for (const n2 of e2.detail.nodes) { + activePrompt.value.nodes[n2] = true; } } __name(handleExecutionCached, "handleExecutionCached"); @@ -163867,8 +192193,8 @@ const useExecutionStore = /* @__PURE__ */ defineStore("execution", () => { queuedPrompts.value[id3] ??= { nodes: {} }; const queuedPrompt = queuedPrompts.value[id3]; queuedPrompt.nodes = { - ...nodes.reduce((p2, n) => { - p2[n] = false; + ...nodes.reduce((p2, n2) => { + p2[n2] = false; return p2; }, {}), ...queuedPrompt.nodes @@ -163898,9 +192224,9 @@ const useExecutionStore = /* @__PURE__ */ defineStore("execution", () => { _executingNodeProgress }; }); -const _withScopeId$c = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-b27b58f4"), n = n(), popScopeId(), n), "_withScopeId$c"); -const _hoisted_1$u = { class: "bg-black h-full w-full" }; -const _hoisted_2$m = { +const _withScopeId$c = /* @__PURE__ */ __name((n2) => (pushScopeId("data-v-03daf1c8"), n2 = n2(), popScopeId(), n2), "_withScopeId$c"); +const _hoisted_1$s = { class: "bg-black h-full w-full" }; +const _hoisted_2$k = { key: 0, class: "p-4 text-center" }; @@ -163909,8 +192235,8 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({ setup(__props) { const errorMessage = ref(""); const loading2 = ref(true); - const terminalCreated = /* @__PURE__ */ __name(({ terminal, useAutoSize }, root24) => { - useAutoSize(root24, true, false); + const terminalCreated = /* @__PURE__ */ __name(({ terminal, useAutoSize }, root27) => { + useAutoSize({ root: root27, autoRows: true, autoCols: false, minCols: 80 }); const update = /* @__PURE__ */ __name((entries, size2) => { if (size2) { terminal.resize(size2.cols, terminal.rows); @@ -163951,8 +192277,8 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({ }); }, "terminalCreated"); return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1$u, [ - errorMessage.value ? (openBlock(), createElementBlock("p", _hoisted_2$m, toDisplayString$1(errorMessage.value), 1)) : loading2.value ? (openBlock(), createBlock(unref(script$Y), { + return openBlock(), createElementBlock("div", _hoisted_1$s, [ + errorMessage.value ? (openBlock(), createElementBlock("p", _hoisted_2$k, toDisplayString$1(errorMessage.value), 1)) : loading2.value ? (openBlock(), createBlock(unref(script$$), { key: 1, class: "relative inset-0 flex justify-center items-center h-full z-10" })) : createCommentVNode("", true), @@ -163963,7 +192289,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({ }; } }); -const LogsTerminal = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-b27b58f4"]]); +const LogsTerminal = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-03daf1c8"]]); const useLogsTerminalTab = /* @__PURE__ */ __name(() => { const { t: t2 } = useI18n(); return { @@ -164054,7 +192380,7 @@ const useExtensionService = /* @__PURE__ */ __name(() => { settingStore.get("Comfy.Extension.Disabled") ); const extensions = await api.getExtensions(); - await __vitePreload(() => import("./index-Bordpmzt.js"), true ? __vite__mapDeps([25,26]) : void 0, import.meta.url); + await __vitePreload(() => import("./index-je62U6DH.js"), true ? __vite__mapDeps([25,26]) : void 0, import.meta.url); extensionStore.captureCoreExtensions(); await Promise.all( extensions.filter((extension) => !extension.includes("extensions/core")).map(async (ext) => { @@ -164300,7 +192626,7 @@ function toggleSwitch(name2, items2, e2) { elements = items2.map((item3, i2) => { if (typeof item3 === "string") item3 = { text: item3 }; if (!item3.value) item3.value = item3.text; - const toggle4 = $el( + const toggle5 = $el( "label", { textContent: item3.text, @@ -164319,7 +192645,7 @@ function toggleSwitch(name2, items2, e2) { if (item3.selected) { updateSelected(i2); } - return toggle4; + return toggle5; }); const container = $el("div.comfy-toggle-switch", elements); if (selectedIndex == null) { @@ -164654,197 +192980,205 @@ class ComfyUI { } } }); - this.menuContainer = $el("div.comfy-menu", { parent: containerElement }, [ - $el( - "div.drag-handle.comfy-menu-header", - { - style: { - overflow: "hidden", - position: "relative", - width: "100%", - cursor: "default" - } - }, - [ - $el("span.drag-handle"), - $el("span.comfy-menu-queue-size", { $: /* @__PURE__ */ __name((q) => this.queueSize = q, "$") }), - $el("div.comfy-menu-actions", [ - $el("button.comfy-settings-btn", { - textContent: "⚙️", - onclick: /* @__PURE__ */ __name(() => { - useDialogService().showSettingsDialog(); - }, "onclick") + this.menuContainer = $el( + "div.comfy-menu.no-drag", + { parent: containerElement }, + [ + $el( + "div.drag-handle.comfy-menu-header", + { + style: { + overflow: "hidden", + position: "relative", + width: "100%", + cursor: "default" + } + }, + [ + $el("span.drag-handle"), + $el("span.comfy-menu-queue-size", { + $: /* @__PURE__ */ __name((q2) => this.queueSize = q2, "$") }), - $el("button.comfy-close-menu-btn", { - textContent: "×", - onclick: /* @__PURE__ */ __name(() => { - useWorkspaceStore().focusMode = true; - }, "onclick") - }) - ]) - ] - ), - $el("button.comfy-queue-btn", { - id: "queue-button", - textContent: "Queue Prompt", - onclick: /* @__PURE__ */ __name(() => app$1.queuePrompt(0, this.batchCount), "onclick") - }), - $el("div", {}, [ - $el("label", { innerHTML: "Extra options" }, [ - $el("input", { - type: "checkbox", - onchange: /* @__PURE__ */ __name((i2) => { - document.getElementById("extraOptions").style.display = i2.srcElement.checked ? "block" : "none"; - this.batchCount = i2.srcElement.checked ? Number.parseInt( - document.getElementById( - "batchCountInputRange" - ).value - ) : 1; - document.getElementById("autoQueueCheckbox").checked = false; - this.autoQueueEnabled = false; - }, "onchange") - }) - ]) - ]), - $el( - "div", - { id: "extraOptions", style: { width: "100%", display: "none" } }, - [ - $el("div", [ - $el("label", { innerHTML: "Batch count" }), - $el("input", { - id: "batchCountInputNumber", - type: "number", - value: this.batchCount, - min: "1", - style: { width: "35%", marginLeft: "0.4em" }, - oninput: /* @__PURE__ */ __name((i2) => { - this.batchCount = i2.target.value; - document.getElementById( - "batchCountInputRange" - ).value = this.batchCount.toString(); - }, "oninput") - }), - $el("input", { - id: "batchCountInputRange", - type: "range", - min: "1", - max: "100", - value: this.batchCount, - oninput: /* @__PURE__ */ __name((i2) => { - this.batchCount = i2.srcElement.value; - document.getElementById( - "batchCountInputNumber" - ).value = i2.srcElement.value; - }, "oninput") - }) - ]), - $el("div", [ - $el("label", { - for: "autoQueueCheckbox", - innerHTML: "Auto Queue" - }), - $el("input", { - id: "autoQueueCheckbox", - type: "checkbox", - checked: false, - title: "Automatically queue prompt when the queue size hits 0", - onchange: /* @__PURE__ */ __name((e2) => { - this.autoQueueEnabled = e2.target.checked; - autoQueueModeEl.style.display = this.autoQueueEnabled ? "" : "none"; - }, "onchange") - }), - autoQueueModeEl - ]) - ] - ), - $el("div.comfy-menu-btns", [ - $el("button", { - id: "queue-front-button", - textContent: "Queue Front", - onclick: /* @__PURE__ */ __name(() => app$1.queuePrompt(-1, this.batchCount), "onclick") + $el("div.comfy-menu-actions", [ + $el("button.comfy-settings-btn", { + textContent: "⚙️", + onclick: /* @__PURE__ */ __name(() => { + useDialogService().showSettingsDialog(); + }, "onclick") + }), + $el("button.comfy-close-menu-btn", { + textContent: "×", + onclick: /* @__PURE__ */ __name(() => { + useWorkspaceStore().focusMode = true; + }, "onclick") + }) + ]) + ] + ), + $el("button.comfy-queue-btn", { + id: "queue-button", + textContent: "Queue Prompt", + onclick: /* @__PURE__ */ __name(() => app$1.queuePrompt(0, this.batchCount), "onclick") }), + $el("div", {}, [ + $el("label", { innerHTML: "Extra options" }, [ + $el("input", { + type: "checkbox", + onchange: /* @__PURE__ */ __name((i2) => { + document.getElementById("extraOptions").style.display = i2.srcElement.checked ? "block" : "none"; + this.batchCount = i2.srcElement.checked ? Number.parseInt( + document.getElementById( + "batchCountInputRange" + ).value + ) : 1; + document.getElementById( + "autoQueueCheckbox" + ).checked = false; + this.autoQueueEnabled = false; + }, "onchange") + }) + ]) + ]), + $el( + "div", + { id: "extraOptions", style: { width: "100%", display: "none" } }, + [ + $el("div", [ + $el("label", { innerHTML: "Batch count" }), + $el("input", { + id: "batchCountInputNumber", + type: "number", + value: this.batchCount, + min: "1", + style: { width: "35%", marginLeft: "0.4em" }, + oninput: /* @__PURE__ */ __name((i2) => { + this.batchCount = i2.target.value; + document.getElementById( + "batchCountInputRange" + ).value = this.batchCount.toString(); + }, "oninput") + }), + $el("input", { + id: "batchCountInputRange", + type: "range", + min: "1", + max: "100", + value: this.batchCount, + oninput: /* @__PURE__ */ __name((i2) => { + this.batchCount = i2.srcElement.value; + document.getElementById( + "batchCountInputNumber" + ).value = i2.srcElement.value; + }, "oninput") + }) + ]), + $el("div", [ + $el("label", { + for: "autoQueueCheckbox", + innerHTML: "Auto Queue" + }), + $el("input", { + id: "autoQueueCheckbox", + type: "checkbox", + checked: false, + title: "Automatically queue prompt when the queue size hits 0", + onchange: /* @__PURE__ */ __name((e2) => { + this.autoQueueEnabled = e2.target.checked; + autoQueueModeEl.style.display = this.autoQueueEnabled ? "" : "none"; + }, "onchange") + }), + autoQueueModeEl + ]) + ] + ), + $el("div.comfy-menu-btns", [ + $el("button", { + id: "queue-front-button", + textContent: "Queue Front", + onclick: /* @__PURE__ */ __name(() => app$1.queuePrompt(-1, this.batchCount), "onclick") + }), + $el("button", { + $: /* @__PURE__ */ __name((b2) => this.queue.button = b2, "$"), + id: "comfy-view-queue-button", + textContent: "View Queue", + onclick: /* @__PURE__ */ __name(() => { + this.history.hide(); + this.queue.toggle(); + }, "onclick") + }), + $el("button", { + $: /* @__PURE__ */ __name((b2) => this.history.button = b2, "$"), + id: "comfy-view-history-button", + textContent: "View History", + onclick: /* @__PURE__ */ __name(() => { + this.queue.hide(); + this.history.toggle(); + }, "onclick") + }) + ]), + this.queue.element, + this.history.element, $el("button", { - $: /* @__PURE__ */ __name((b) => this.queue.button = b, "$"), - id: "comfy-view-queue-button", - textContent: "View Queue", + id: "comfy-save-button", + textContent: "Save", onclick: /* @__PURE__ */ __name(() => { - this.history.hide(); - this.queue.toggle(); + useCommandStore().execute("Comfy.ExportWorkflow"); }, "onclick") }), $el("button", { - $: /* @__PURE__ */ __name((b) => this.history.button = b, "$"), - id: "comfy-view-history-button", - textContent: "View History", + id: "comfy-dev-save-api-button", + textContent: "Save (API Format)", + style: { width: "100%", display: "none" }, onclick: /* @__PURE__ */ __name(() => { - this.queue.hide(); - this.history.toggle(); + useCommandStore().execute("Comfy.ExportWorkflowAPI"); + }, "onclick") + }), + $el("button", { + id: "comfy-load-button", + textContent: "Load", + onclick: /* @__PURE__ */ __name(() => fileInput2.click(), "onclick") + }), + $el("button", { + id: "comfy-refresh-button", + textContent: "Refresh", + onclick: /* @__PURE__ */ __name(() => app$1.refreshComboInNodes(), "onclick") + }), + $el("button", { + id: "comfy-clipspace-button", + textContent: "Clipspace", + onclick: /* @__PURE__ */ __name(() => app$1.openClipspace(), "onclick") + }), + $el("button", { + id: "comfy-clear-button", + textContent: "Clear", + onclick: /* @__PURE__ */ __name(() => { + if (!useSettingStore().get("Comfy.ConfirmClear") || confirm("Clear workflow?")) { + app$1.clean(); + app$1.graph.clear(); + app$1.resetView(); + api.dispatchCustomEvent("graphCleared"); + } + }, "onclick") + }), + $el("button", { + id: "comfy-load-default-button", + textContent: "Load Default", + onclick: /* @__PURE__ */ __name(async () => { + if (!useSettingStore().get("Comfy.ConfirmClear") || confirm("Load default workflow?")) { + app$1.resetView(); + await app$1.loadGraphData(); + } + }, "onclick") + }), + $el("button", { + id: "comfy-reset-view-button", + textContent: "Reset View", + onclick: /* @__PURE__ */ __name(async () => { + app$1.resetView(); }, "onclick") }) - ]), - this.queue.element, - this.history.element, - $el("button", { - id: "comfy-save-button", - textContent: "Save", - onclick: /* @__PURE__ */ __name(() => { - useCommandStore().execute("Comfy.ExportWorkflow"); - }, "onclick") - }), - $el("button", { - id: "comfy-dev-save-api-button", - textContent: "Save (API Format)", - style: { width: "100%", display: "none" }, - onclick: /* @__PURE__ */ __name(() => { - useCommandStore().execute("Comfy.ExportWorkflowAPI"); - }, "onclick") - }), - $el("button", { - id: "comfy-load-button", - textContent: "Load", - onclick: /* @__PURE__ */ __name(() => fileInput2.click(), "onclick") - }), - $el("button", { - id: "comfy-refresh-button", - textContent: "Refresh", - onclick: /* @__PURE__ */ __name(() => app$1.refreshComboInNodes(), "onclick") - }), - $el("button", { - id: "comfy-clipspace-button", - textContent: "Clipspace", - onclick: /* @__PURE__ */ __name(() => app$1.openClipspace(), "onclick") - }), - $el("button", { - id: "comfy-clear-button", - textContent: "Clear", - onclick: /* @__PURE__ */ __name(() => { - if (!useSettingStore().get("Comfy.ConfirmClear") || confirm("Clear workflow?")) { - app$1.clean(); - app$1.graph.clear(); - app$1.resetView(); - api.dispatchCustomEvent("graphCleared"); - } - }, "onclick") - }), - $el("button", { - id: "comfy-load-default-button", - textContent: "Load Default", - onclick: /* @__PURE__ */ __name(async () => { - if (!useSettingStore().get("Comfy.ConfirmClear") || confirm("Load default workflow?")) { - app$1.resetView(); - await app$1.loadGraphData(); - } - }, "onclick") - }), - $el("button", { - id: "comfy-reset-view-button", - textContent: "Reset View", - onclick: /* @__PURE__ */ __name(async () => { - app$1.resetView(); - }, "onclick") - }) - ]); + ] + ); this.menuContainer.style.display = "none"; this.restoreMenuPosition = dragElement(this.menuContainer, this.settings); this.setStatus({ exec_info: { queue_remaining: "X" } }); @@ -164868,27 +193202,27 @@ window.comfyAPI.ui.$el = $el; window.comfyAPI.ui.ComfyUI = ComfyUI; function calculateImageGrid(imgs, dw, dh) { let best = 0; - let w = imgs[0].naturalWidth; + let w2 = imgs[0].naturalWidth; let h2 = imgs[0].naturalHeight; const numImages = imgs.length; let cellWidth, cellHeight, cols, rows, shiftX; - for (let c = 1; c <= numImages; c++) { - const r = Math.ceil(numImages / c); - const cW = dw / c; - const cH = dh / r; - const scaleX = cW / w; + for (let c2 = 1; c2 <= numImages; c2++) { + const r2 = Math.ceil(numImages / c2); + const cW = dw / c2; + const cH = dh / r2; + const scaleX = cW / w2; const scaleY = cH / h2; const scale = Math.min(scaleX, scaleY, 1); - const imageW = w * scale; + const imageW = w2 * scale; const imageH = h2 * scale; const area = imageW * imageH * numImages; if (area > best) { best = area; cellWidth = imageW; cellHeight = imageH; - cols = c; - rows = r; - shiftX = c * ((cW - imageW) / 2); + cols = c2; + rows = r2; + shiftX = c2 * ((cW - imageW) / 2); } } return { cellWidth, cellHeight, cols, rows, shiftX }; @@ -164899,7 +193233,7 @@ function createImageHost(node3) { let currentImgs; let first2 = true; function updateSize() { - let w = null; + let w2 = null; let h2 = null; if (currentImgs) { let elH = el.clientHeight; @@ -164913,14 +193247,14 @@ function createImageHost(node3) { el.style.setProperty("--comfy-widget-min-height", null); } const nw = node3.size[0]; - ({ cellWidth: w, cellHeight: h2 } = calculateImageGrid( + ({ cellWidth: w2, cellHeight: h2 } = calculateImageGrid( currentImgs, nw - 20, elH )); - w += "px"; + w2 += "px"; h2 += "px"; - el.style.setProperty("--comfy-img-preview-width", w); + el.style.setProperty("--comfy-img-preview-width", w2); el.style.setProperty("--comfy-img-preview-height", h2); } } @@ -165038,13 +193372,13 @@ const useLitegraphService = /* @__PURE__ */ __name(() => { } } } - for (const o in nodeData["output"]) { - let output = nodeData["output"][o]; + for (const o2 in nodeData["output"]) { + let output = nodeData["output"][o2]; if (output instanceof Array) output = "COMBO"; - const outputName = nodeData["output_name"][o] || output; - const outputIsList = nodeData["output_is_list"][o]; + const outputName = nodeData["output_name"][o2] || output; + const outputIsList = nodeData["output_is_list"][o2]; const shapeOptions = outputIsList ? { shape: LiteGraph.GRID_SHAPE } : {}; - const nameKey = `nodeDefs.${normalizeI18nKey(nodeData.name)}.outputs.${o}.name`; + const nameKey = `nodeDefs.${normalizeI18nKey(nodeData.name)}.outputs.${o2}.name`; const typeKey = `dataTypes.${normalizeI18nKey(output)}`; const outputOptions = { ...shapeOptions, @@ -165056,14 +193390,14 @@ const useLitegraphService = /* @__PURE__ */ __name(() => { }; this.addOutput(outputName, output, outputOptions); } - const s = this.computeSize(); - s[0] = Math.max(config2.minWidth, s[0] * 1.5); - s[1] = Math.max(config2.minHeight, s[1]); - this.size = s; + const s2 = this.computeSize(); + s2[0] = Math.max(config2.minWidth, s2[0] * 1.5); + s2[1] = Math.max(config2.minHeight, s2[1]); + this.size = s2; this.serialize_widgets = true; extensionService.invokeExtensionsAsync("nodeCreated", this); } - configure(data24) { + configure(data25) { const merge2 = /* @__PURE__ */ __name((current, incoming) => { const result = { ...incoming }; if (current.widget === void 0 && incoming.widget !== void 0) { @@ -165078,12 +193412,12 @@ const useLitegraphService = /* @__PURE__ */ __name(() => { return result; }, "merge"); for (const field of ["inputs", "outputs"]) { - const slots = data24[field] ?? []; - data24[field] = slots.map( + const slots = data25[field] ?? []; + data25[field] = slots.map( (slot, i2) => merge2(this[field][i2] ?? {}, slot) ); } - super.configure(data24); + super.configure(data25); } }; node3.prototype.comfyClass = nodeData.name; @@ -165117,8 +193451,8 @@ const useLitegraphService = /* @__PURE__ */ __name(() => { ]); }, "writeImage"); try { - const data24 = await fetch(url); - const blob = await data24.blob(); + const data25 = await fetch(url); + const blob = await data25.blob(); try { await writeImage(blob); } catch (error2) { @@ -165186,17 +193520,17 @@ const useLitegraphService = /* @__PURE__ */ __name(() => { { content: "Save Image", callback: /* @__PURE__ */ __name(() => { - const a = document.createElement("a"); + const a2 = document.createElement("a"); const url = new URL(img.src); url.searchParams.delete("preview"); - a.href = url.toString(); - a.setAttribute( + a2.href = url.toString(); + a2.setAttribute( "download", new URLSearchParams(url.search).get("filename") ); - document.body.append(a); - a.click(); - requestAnimationFrame(() => a.remove()); + document.body.append(a2); + a2.click(); + requestAnimationFrame(() => a2.remove()); }, "callback") } ); @@ -165248,12 +193582,12 @@ const useLitegraphService = /* @__PURE__ */ __name(() => { if (node22.imageOffset != null) { return node22.imageOffset; } else if (node22.widgets?.length) { - const w = node22.widgets[node22.widgets.length - 1]; - shiftY = w.last_y; - if (w.computeSize) { - shiftY += w.computeSize()[1] + 4; - } else if (w.computedHeight) { - shiftY += w.computedHeight; + const w2 = node22.widgets[node22.widgets.length - 1]; + shiftY = w2.last_y; + if (w2.computeSize) { + shiftY += w2.computeSize()[1] + 4; + } else if (w2.computedHeight) { + shiftY += w2.computedHeight; } else { shiftY += LiteGraph.NODE_WIDGET_HEIGHT + 4; } @@ -165304,10 +193638,10 @@ const useLitegraphService = /* @__PURE__ */ __name(() => { if (imgURLs.length > 0) { Promise.all( imgURLs.flat().map((src) => { - return new Promise((r) => { + return new Promise((r2) => { const img = new Image(); - img.onload = () => r(img); - img.onerror = () => r(null); + img.onload = () => r2(img); + img.onerror = () => r2(null); img.src = src; }); }) @@ -165332,7 +193666,7 @@ const useLitegraphService = /* @__PURE__ */ __name(() => { }, "is_all_same_aspect_ratio"); if (!this.imgs?.length) return; const widgetIdx = this.widgets?.findIndex( - (w2) => w2.name === ANIM_PREVIEW_WIDGET + (w22) => w22.name === ANIM_PREVIEW_WIDGET ); if (this.animatedImages) { if (widgetIdx > -1) { @@ -165472,16 +193806,16 @@ const useLitegraphService = /* @__PURE__ */ __name(() => { } return; } - let w = this.imgs[imageIndex].naturalWidth; + let w2 = this.imgs[imageIndex].naturalWidth; let h2 = this.imgs[imageIndex].naturalHeight; - const scaleX = dw / w; + const scaleX = dw / w2; const scaleY = dh / h2; const scale = Math.min(scaleX, scaleY, 1); - w *= scale; + w2 *= scale; h2 *= scale; - const x2 = (dw - w) / 2; + const x2 = (dw - w2) / 2; const y2 = (dh - h2) / 2 + shiftY; - ctx.drawImage(this.imgs[imageIndex], x2, y2, w, h2); + ctx.drawImage(this.imgs[imageIndex], x2, y2, w2, h2); const drawButton = /* @__PURE__ */ __name((x22, y22, sz, text2) => { const hovered = LiteGraph.isInsideRectangle( mouse[0], @@ -165491,20 +193825,20 @@ const useLitegraphService = /* @__PURE__ */ __name(() => { sz, sz ); - let fill = "#333"; + let fill2 = "#333"; let textFill = "#fff"; let isClicking = false; if (hovered) { canvas.canvas.style.cursor = "pointer"; if (canvas.pointer_is_down) { - fill = "#1e90ff"; + fill2 = "#1e90ff"; isClicking = true; } else { - fill = "#eee"; + fill2 = "#eee"; textFill = "#000"; } } - ctx.fillStyle = fill; + ctx.fillStyle = fill2; ctx.beginPath(); ctx.roundRect(x22, y22, sz, sz, [4]); ctx.fill(); @@ -165584,8 +193918,8 @@ const useLitegraphService = /* @__PURE__ */ __name(() => { __name(addNodeOnGraph, "addNodeOnGraph"); function getCanvasCenter() { const dpi = Math.max(window.devicePixelRatio ?? 1, 1); - const [x2, y2, w, h2] = app$1.canvas.ds.visible_area; - return [x2 + w / dpi / 2, y2 + h2 / dpi / 2]; + const [x2, y2, w2, h2] = app$1.canvas.ds.visible_area; + return [x2 + w2 / dpi / 2, y2 + h2 / dpi / 2]; } __name(getCanvasCenter, "getCanvasCenter"); function goToNode(nodeId) { @@ -165753,13 +194087,13 @@ window.comfyAPI.defaultGraph.defaultGraph = defaultGraph; window.comfyAPI.defaultGraph.defaultGraphJSON = defaultGraphJSON; window.comfyAPI.defaultGraph.blankGraph = blankGraph; const parts = { - d: /* @__PURE__ */ __name((d) => d.getDate(), "d"), - M: /* @__PURE__ */ __name((d) => d.getMonth() + 1, "M"), - h: /* @__PURE__ */ __name((d) => d.getHours(), "h"), - m: /* @__PURE__ */ __name((d) => d.getMinutes(), "m"), - s: /* @__PURE__ */ __name((d) => d.getSeconds(), "s") + d: /* @__PURE__ */ __name((d2) => d2.getDate(), "d"), + M: /* @__PURE__ */ __name((d2) => d2.getMonth() + 1, "M"), + h: /* @__PURE__ */ __name((d2) => d2.getHours(), "h"), + m: /* @__PURE__ */ __name((d2) => d2.getMinutes(), "m"), + s: /* @__PURE__ */ __name((d2) => d2.getSeconds(), "s") }; -const format$1 = Object.keys(parts).map((k) => k + k + "?").join("|") + "|yyy?y?"; +const format$1 = Object.keys(parts).map((k2) => k2 + k2 + "?").join("|") + "|yyy?y?"; function formatDate(text2, date) { return text2.replace(new RegExp(format$1, "g"), (text22) => { if (text22 === "yy") return (date.getFullYear() + "").substring(2); @@ -165795,10 +194129,10 @@ function applyTextReplacements(app2, value4) { return match2; } let nodes = app2.graph.nodes.filter( - (n) => n.properties?.["Node name for S&R"] === split2[0] + (n2) => n2.properties?.["Node name for S&R"] === split2[0] ); if (!nodes.length) { - nodes = app2.graph.nodes.filter((n) => n.title === split2[0]); + nodes = app2.graph.nodes.filter((n2) => n2.title === split2[0]); } if (!nodes.length) { console.warn("Unable to find node", split2[0]); @@ -165808,7 +194142,7 @@ function applyTextReplacements(app2, value4) { console.warn("Multiple nodes matched", split2[0], "using first match"); } const node3 = nodes[0]; - const widget2 = node3.widgets?.find((w) => w.name === split2[1]); + const widget2 = node3.widgets?.find((w2) => w2.name === split2[1]); if (!widget2) { console.warn("Unable to find widget", split2[1], "on node", split2[0], node3); return match2; @@ -165841,15 +194175,15 @@ async function addStylesheet(urlOrFile, relativeTo) { __name(addStylesheet, "addStylesheet"); function downloadBlob(filename, blob) { const url = URL.createObjectURL(blob); - const a = $el("a", { + const a2 = $el("a", { href: url, download: filename, style: { display: "none" }, parent: document.body }); - a.click(); + a2.click(); setTimeout(function() { - a.remove(); + a2.remove(); window.URL.revokeObjectURL(url); }, 0); } @@ -166021,7 +194355,7 @@ class Pipe { throw new Error(`filter not found: ${filterName}`); } list() { - return this.filters.map((f) => f.filterName); + return this.filters.map((f2) => f2.filterName); } after(filterName, ...params) { const index2 = this.indexOf(filterName); @@ -166637,11 +194971,11 @@ const diffFilter$2 = /* @__PURE__ */ __name(function arraysDiffFilter(context) { }, "arraysDiffFilter"); diffFilter$2.filterName = "arrays"; const compare = { - numerically(a, b) { - return a - b; + numerically(a2, b2) { + return a2 - b2; }, numericallyBy(name2) { - return (a, b) => a[name2] - b[name2]; + return (a2, b2) => a2[name2] - b2[name2]; } }; const patchFilter$1 = /* @__PURE__ */ __name(function nestedPatchFilter2(context) { @@ -166916,14 +195250,14 @@ const patchFilter = /* @__PURE__ */ __name(function textsPatchFilter(context) { patchFilter.filterName = "texts"; const textDeltaReverse = /* @__PURE__ */ __name(function(delta2) { let i2; - let l; + let l2; let line; let lineTmp; let header3 = null; const headerRegex = /^@@ +-(\d+),(\d+) +\+(\d+),(\d+) +@@$/; let lineHeader; const lines = delta2.split("\n"); - for (i2 = 0, l = lines.length; i2 < l; i2++) { + for (i2 = 0, l2 = lines.length; i2 < l2; i2++) { line = lines[i2]; const lineStart = line.slice(0, 1); if (lineStart === "@") { @@ -167037,15 +195371,15 @@ function clone$1(value4) { __name(clone$1, "clone$1"); var loglevel$1 = { exports: {} }; var loglevel = loglevel$1.exports; -(function(module) { - (function(root24, definition) { +(function(module2) { + (function(root27, definition) { "use strict"; if (false) { (void 0)(definition); - } else if (module.exports) { - module.exports = definition(); + } else if (module2.exports) { + module2.exports = definition(); } else { - root24.log = definition(); + root27.log = definition(); } })(commonjsGlobal, function() { "use strict"; @@ -167551,12 +195885,12 @@ class ChangeTracker { const nodeOutputs = changeTracker.nodeOutputs; const output = nodeOutputs[detail.node]; if (detail.merge && output) { - for (const k in detail.output ?? {}) { - const v2 = output[k]; + for (const k2 in detail.output ?? {}) { + const v2 = output[k2]; if (v2 instanceof Array) { - output[k] = v2.concat(detail.output[k]); + output[k2] = v2.concat(detail.output[k2]); } else { - output[k] = detail.output[k]; + output[k2] = detail.output[k2]; } } } else { @@ -167581,20 +195915,20 @@ class ChangeTracker { } return false; } - static graphEqual(a, b) { - if (a === b) return true; - if (typeof a == "object" && a && typeof b == "object" && b) { - if (!_.isEqualWith(a.nodes, b.nodes, (arrA, arrB) => { + static graphEqual(a2, b2) { + if (a2 === b2) return true; + if (typeof a2 == "object" && a2 && typeof b2 == "object" && b2) { + if (!_.isEqualWith(a2.nodes, b2.nodes, (arrA, arrB) => { if (Array.isArray(arrA) && Array.isArray(arrB)) { return _.isEqual(new Set(arrA), new Set(arrB)); } })) { return false; } - if (!_.isEqual(_.omit(a.extra ?? {}, ["ds"]), _.omit(b.extra ?? {}, ["ds"]))) + if (!_.isEqual(_.omit(a2.extra ?? {}, ["ds"]), _.omit(b2.extra ?? {}, ["ds"]))) return false; for (const key of ["links", "reroutes", "groups"]) { - if (!_.isEqual(a[key], b[key])) { + if (!_.isEqual(a2[key], b2[key])) { return false; } } @@ -167602,21 +195936,21 @@ class ChangeTracker { } return false; } - static graphDiff(a, b) { + static graphDiff(a2, b2) { function sortGraphNodes(graph) { return { links: graph.links, groups: graph.groups, - nodes: graph.nodes.sort((a2, b2) => { - if (typeof a2.id === "number" && typeof b2.id === "number") { - return a2.id - b2.id; + nodes: graph.nodes.sort((a22, b22) => { + if (typeof a22.id === "number" && typeof b22.id === "number") { + return a22.id - b22.id; } return 0; }) }; } __name(sortGraphNodes, "sortGraphNodes"); - return diff(sortGraphNodes(a), sortGraphNodes(b)); + return diff(sortGraphNodes(a2), sortGraphNodes(b2)); } } window.comfyAPI = window.comfyAPI || {}; @@ -167939,6 +196273,16 @@ const useWorkflowStore = /* @__PURE__ */ defineStore("workflow", () => { openWorkflowPaths.value.splice(to, 0, movedTab); }, "reorderWorkflows"); const isOpen = /* @__PURE__ */ __name((workflow) => openWorkflowPathSet.value.has(workflow.path), "isOpen"); + const openWorkflowsInBackground = /* @__PURE__ */ __name((paths) => { + const { left = [], right = [] } = paths; + if (!left.length && !right.length) return; + const isValidPath = /* @__PURE__ */ __name((path) => typeof path === "string" && path in workflowLookup.value, "isValidPath"); + openWorkflowPaths.value = _.union( + left, + openWorkflowPaths.value, + right + ).filter(isValidPath); + }, "openWorkflowsInBackground"); const openWorkflow = /* @__PURE__ */ __name(async (workflow) => { if (isActive2(workflow)) return workflow; if (!openWorkflowPaths.value.includes(workflow.path)) { @@ -168076,6 +196420,7 @@ const useWorkflowStore = /* @__PURE__ */ defineStore("workflow", () => { openWorkflows, openedWorkflowIndexShift, openWorkflow, + openWorkflowsInBackground, isOpen, isBusy, closeWorkflow, @@ -168236,9 +196581,6 @@ const useWorkflowService = /* @__PURE__ */ __name(() => { ); }, "openWorkflow"); const closeWorkflow = /* @__PURE__ */ __name(async (workflow, options4 = { warnIfUnsaved: true }) => { - if (!workflow.isLoaded) { - return true; - } if (workflow.isModified && options4.warnIfUnsaved) { const confirmed = await dialogService.confirm({ title: t("sideToolbar.workflowTab.dirtyCloseTitle"), @@ -168326,9 +196668,9 @@ const useWorkflowService = /* @__PURE__ */ __name(() => { }, "afterLoadNewGraph"); const insertWorkflow = /* @__PURE__ */ __name(async (workflow) => { const loadedWorkflow = await workflow.load(); - const data24 = loadedWorkflow.initialState; + const data25 = loadedWorkflow.initialState; const old = localStorage.getItem("litegrapheditor_clipboard"); - const graph = new LGraph(data24); + const graph = new LGraph(data25); const canvasElement = document.createElement("canvas"); const canvas = new LGraphCanvas(canvasElement, graph, { skip_events: true, @@ -168384,9 +196726,9 @@ function _findInMetadata(metadata, ...keys2) { if (key in metadata) { return metadata[key]; } - for (const k in metadata) { - if (k.endsWith(key)) { - return metadata[k]; + for (const k2 in metadata) { + if (k2.endsWith(key)) { + return metadata[k2]; } } } @@ -168753,7 +197095,7 @@ const BasicOptions = { // Whether to sort the result list, by score shouldSort: true, // Default sort function: sort by ascending score, ascending index - sortFn: /* @__PURE__ */ __name((a, b) => a.score === b.score ? a.idx < b.idx ? -1 : 1 : a.score < b.score ? -1 : 1, "sortFn") + sortFn: /* @__PURE__ */ __name((a2, b2) => a2.score === b2.score ? a2.idx < b2.idx ? -1 : 1 : a2.score < b2.score ? -1 : 1, "sortFn") }; const FuzzyOptions = { // Approximately where in the text is the pattern expected to be found? @@ -168794,7 +197136,7 @@ var Config = { const SPACE = /[^ ]+/g; function norm(weight = 1, mantissa = 3) { const cache2 = /* @__PURE__ */ new Map(); - const m = Math.pow(10, mantissa); + const m2 = Math.pow(10, mantissa); return { get(value4) { const numTokens = value4.match(SPACE).length; @@ -168802,9 +197144,9 @@ function norm(weight = 1, mantissa = 3) { return cache2.get(numTokens); } const norm2 = 1 / Math.pow(numTokens, 0.5 * weight); - const n = parseFloat(Math.round(norm2 * m) / m); - cache2.set(numTokens, n); - return n; + const n2 = parseFloat(Math.round(norm2 * m2) / m2); + cache2.set(numTokens, n2); + return n2; }, clear() { cache2.clear(); @@ -168880,15 +197222,15 @@ class FuseIndex { if (!isDefined(doc2) || isBlank(doc2)) { return; } - let record = { + let record2 = { v: doc2, i: docIndex, n: this.norm.get(doc2) }; - this.records.push(record); + this.records.push(record2); } _addObject(doc2, docIndex) { - let record = { i: docIndex, $: {} }; + let record2 = { i: docIndex, $: {} }; this.keys.forEach((key, keyIndex) => { let value4 = key.getFn ? key.getFn(doc2) : this.getFn(doc2, key.path); if (!isDefined(value4)) { @@ -168910,24 +197252,24 @@ class FuseIndex { }; subRecords.push(subRecord); } else if (isArray(value5)) { - value5.forEach((item3, k) => { + value5.forEach((item3, k2) => { stack2.push({ - nestedArrIndex: k, + nestedArrIndex: k2, value: item3 }); }); } else ; } - record.$[keyIndex] = subRecords; + record2.$[keyIndex] = subRecords; } else if (isString(value4) && !isBlank(value4)) { let subRecord = { v: value4, n: this.norm.get(value4) }; - record.$[keyIndex] = subRecord; + record2.$[keyIndex] = subRecord; } }); - this.records.push(record); + this.records.push(record2); } toJSON() { return { @@ -168944,8 +197286,8 @@ function createIndex(keys2, docs, { getFn = Config.getFn, fieldNormWeight = Conf return myIndex; } __name(createIndex, "createIndex"); -function parseIndex(data24, { getFn = Config.getFn, fieldNormWeight = Config.fieldNormWeight } = {}) { - const { keys: keys2, records } = data24; +function parseIndex(data25, { getFn = Config.getFn, fieldNormWeight = Config.fieldNormWeight } = {}) { + const { keys: keys2, records } = data25; const myIndex = new FuseIndex({ getFn, fieldNormWeight }); myIndex.setKeys(keys2); myIndex.setIndexRecords(records); @@ -169059,17 +197401,17 @@ function search(text2, pattern, patternAlphabet, { let finish = findAllMatches ? textLen : Math.min(expectedLocation + binMid, textLen) + patternLen; let bitArr = Array(finish + 2); bitArr[finish + 1] = (1 << i2) - 1; - for (let j = finish; j >= start2; j -= 1) { - let currentLocation = j - 1; + for (let j2 = finish; j2 >= start2; j2 -= 1) { + let currentLocation = j2 - 1; let charMatch = patternAlphabet[text2.charAt(currentLocation)]; if (computeMatches) { matchMask[currentLocation] = +!!charMatch; } - bitArr[j] = (bitArr[j + 1] << 1 | 1) & charMatch; + bitArr[j2] = (bitArr[j2 + 1] << 1 | 1) & charMatch; if (i2) { - bitArr[j] |= (lastBitArr[j + 1] | lastBitArr[j]) << 1 | 1 | lastBitArr[j + 1]; + bitArr[j2] |= (lastBitArr[j2 + 1] | lastBitArr[j2]) << 1 | 1 | lastBitArr[j2 + 1]; } - if (bitArr[j] & mask3) { + if (bitArr[j2] & mask3) { finalScore = computeScore$1(pattern, { errors: i2, currentLocation, @@ -169570,8 +197912,8 @@ class ExtendedSearch { const searchers2 = query[i2]; allIndices.length = 0; numMatches = 0; - for (let j = 0, pLen = searchers2.length; j < pLen; j += 1) { - const searcher = searchers2[j]; + for (let j2 = 0, pLen = searchers2.length; j2 < pLen; j2 += 1) { + const searcher = searchers2[j2]; const { isMatch, indices, score } = searcher.search(text2); if (isMatch) { numMatches += 1; @@ -169695,9 +198037,9 @@ function computeScore(results, { ignoreFieldNorm = Config.ignoreFieldNorm }) { }); } __name(computeScore, "computeScore"); -function transformMatches(result, data24) { +function transformMatches(result, data25) { const matches2 = result.matches; - data24.matches = []; + data25.matches = []; if (!isDefined(matches2)) { return; } @@ -169716,12 +198058,12 @@ function transformMatches(result, data24) { if (match2.idx > -1) { obj.refIndex = match2.idx; } - data24.matches.push(obj); + data25.matches.push(obj); }); } __name(transformMatches, "transformMatches"); -function transformScore(result, data24) { - data24.score = result.score; +function transformScore(result, data25) { + data25.score = result.score; } __name(transformScore, "transformScore"); function format(results, docs, { @@ -169733,16 +198075,16 @@ function format(results, docs, { if (includeScore) transformers.push(transformScore); return results.map((result) => { const { idx } = result; - const data24 = { + const data25 = { item: docs[idx], refIndex: idx }; if (transformers.length) { transformers.forEach((transformer) => { - transformer(result, data24); + transformer(result, data25); }); } - return data24; + return data25; }); } __name(format, "format"); @@ -169965,12 +198307,12 @@ class FuseSearch { keys; data; advancedScoring; - constructor(data24, options4, createIndex2 = true, advancedScoring = false) { - this.data = data24; + constructor(data25, options4, createIndex2 = true, advancedScoring = false) { + this.data = data25; this.keys = options4.keys ?? []; this.advancedScoring = advancedScoring; - const index2 = createIndex2 && options4?.keys ? Fuse.createIndex(options4.keys, data24) : void 0; - this.fuse = new Fuse(data24, options4, index2); + const index2 = createIndex2 && options4?.keys ? Fuse.createIndex(options4.keys, data25) : void 0; + this.fuse = new Fuse(data25, options4, index2); } search(query, options4) { const fuseResult = !query ? this.data.map((x2) => ({ item: x2, score: 0 })) : this.fuse.search(query, options4); @@ -169980,7 +198322,7 @@ class FuseSearch { const aux = fuseResult.map((x2) => ({ item: x2.item, scores: this.calcAuxScores(query.toLocaleLowerCase(), x2.item, x2.score) - })).sort((a, b) => this.compareAux(a.scores, b.scores)); + })).sort((a2, b2) => this.compareAux(a2.scores, b2.scores)); return aux.map((x2) => x2.item); } calcAuxScores(query, entry, score) { @@ -170035,13 +198377,13 @@ class FuseSearch { const lengthPenalty = 0.2 * (1 - Math.min(item3.length, query.length) / Math.max(item3.length, query.length)); return [main, aux1, aux2, score + lengthPenalty]; } - compareAux(a, b) { - for (let i2 = 0; i2 < Math.min(a.length, b.length); i2++) { - if (a[i2] !== b[i2]) { - return a[i2] - b[i2]; + compareAux(a2, b2) { + for (let i2 = 0; i2 < Math.min(a2.length, b2.length); i2++) { + if (a2[i2] !== b2[i2]) { + return a2[i2] - b2[i2]; } } - return a.length - b.length; + return a2.length - b2.length; } } class NodeFilter { @@ -170084,9 +198426,9 @@ class NodeSearchService { } nodeFuseSearch; nodeFilters; - constructor(data24) { + constructor(data25) { this.nodeFuseSearch = new FuseSearch( - data24, + data25, { keys: ["name", "display_name"], includeScore: true, @@ -170112,7 +198454,7 @@ class NodeSearchService { /* longInvokeSequence */ "input", (node3) => node3.inputs.all.map((input) => input.type), - data24, + data25, filterSearchOptions ); const outputTypeFilter = new NodeFilter( @@ -170125,7 +198467,7 @@ class NodeSearchService { /* longInvokeSequence */ "output", (node3) => node3.outputs.all.map((output) => output.type), - data24, + data25, filterSearchOptions ); const nodeCategoryFilter = new NodeFilter( @@ -170138,7 +198480,7 @@ class NodeSearchService { /* longInvokeSequence */ "category", (node3) => [node3.category], - data24, + data25, filterSearchOptions ); const nodeSourceFilter = new NodeFilter( @@ -170151,7 +198493,7 @@ class NodeSearchService { /* longInvokeSequence */ "source", (node3) => [node3.nodeSource.displayText], - data24, + data25, filterSearchOptions ); this.nodeFilters = [ @@ -170190,9 +198532,9 @@ class ComfyInputsSpec { this.optional = ComfyInputsSpec.transformInputSpecRecord(obj.optional ?? {}); this.hidden = obj.hidden; } - static transformInputSpecRecord(record) { + static transformInputSpecRecord(record2) { const result = {}; - for (const [key, value4] of Object.entries(record)) { + for (const [key, value4] of Object.entries(record2)) { result[key] = ComfyInputsSpec.transformSingleInputSpec(key, value4); } return result; @@ -170524,44 +198866,44 @@ const useNodeFrequencyStore = /* @__PURE__ */ defineStore("nodeFrequency", () => getNodeFrequencyByName }; }); -function rgbToHsl({ r, g: g2, b }) { - r /= 255; +function rgbToHsl({ r: r2, g: g2, b: b2 }) { + r2 /= 255; g2 /= 255; - b /= 255; - const max = Math.max(r, g2, b), min = Math.min(r, g2, b); - let h2 = 0, s = 0; - const l = (max + min) / 2; + b2 /= 255; + const max = Math.max(r2, g2, b2), min = Math.min(r2, g2, b2); + let h2 = 0, s2 = 0; + const l2 = (max + min) / 2; if (max !== min) { - const d = max - min; - s = l > 0.5 ? d / (2 - max - min) : d / (max + min); + const d2 = max - min; + s2 = l2 > 0.5 ? d2 / (2 - max - min) : d2 / (max + min); switch (max) { - case r: - h2 = (g2 - b) / d + (g2 < b ? 6 : 0); + case r2: + h2 = (g2 - b2) / d2 + (g2 < b2 ? 6 : 0); break; case g2: - h2 = (b - r) / d + 2; + h2 = (b2 - r2) / d2 + 2; break; - case b: - h2 = (r - g2) / d + 4; + case b2: + h2 = (r2 - g2) / d2 + 4; break; } h2 /= 6; } - return { h: h2, s, l }; + return { h: h2, s: s2, l: l2 }; } __name(rgbToHsl, "rgbToHsl"); function hexToRgb(hex) { - let r = 0, g2 = 0, b = 0; + let r2 = 0, g2 = 0, b2 = 0; if (hex.length == 4) { - r = parseInt(hex[1] + hex[1], 16); + r2 = parseInt(hex[1] + hex[1], 16); g2 = parseInt(hex[2] + hex[2], 16); - b = parseInt(hex[3] + hex[3], 16); + b2 = parseInt(hex[3] + hex[3], 16); } else if (hex.length == 7) { - r = parseInt(hex.slice(1, 3), 16); + r2 = parseInt(hex.slice(1, 3), 16); g2 = parseInt(hex.slice(3, 5), 16); - b = parseInt(hex.slice(5, 7), 16); + b2 = parseInt(hex.slice(5, 7), 16); } - return { r, g: g2, b }; + return { r: r2, g: g2, b: b2 }; } __name(hexToRgb, "hexToRgb"); const identifyColorFormat = /* @__PURE__ */ __name((color2) => { @@ -170596,23 +198938,23 @@ function parseToHSLA(color2, format2) { case "rgba": { match2 = color2.match(/\d+(\.\d+)?/g); if (!match2 || match2.length < 3) return null; - const [r, g2, b] = match2.map(Number); - const hsl = rgbToHsl({ r, g: g2, b }); - const a = format2 === "rgba" && match2[3] ? parseFloat(match2[3]) : 1; + const [r2, g2, b2] = match2.map(Number); + const hsl = rgbToHsl({ r: r2, g: g2, b: b2 }); + const a2 = format2 === "rgba" && match2[3] ? parseFloat(match2[3]) : 1; return { h: Math.round(hsl.h * 360), s: +(hsl.s * 100).toFixed(1), l: +(hsl.l * 100).toFixed(1), - a + a: a2 }; } case "hsl": case "hsla": { match2 = color2.match(/\d+(\.\d+)?/g); if (!match2 || match2.length < 3) return null; - const [h2, s, l] = match2.map(Number); - const a = format2 === "hsla" && match2[3] ? parseFloat(match2[3]) : 1; - return { h: h2, s, l, a }; + const [h2, s2, l2] = match2.map(Number); + const a2 = format2 === "hsla" && match2[3] ? parseFloat(match2[3]) : 1; + return { h: h2, s: s2, l: l2, a: a2 }; } default: return null; @@ -170681,13 +199023,13 @@ function serialise(nodes, graph) { return JSON.stringify(serialisable); } __name(serialise, "serialise"); -function deserialiseAndCreate(data24, canvas) { - if (!data24) return; +function deserialiseAndCreate(data25, canvas) { + if (!data25) return; const { graph, graph_mouse } = canvas; canvas.emitBeforeChange(); try { graph.beforeChange(); - const deserialised = JSON.parse(data24); + const deserialised = JSON.parse(data25); const topLeft = [Infinity, Infinity]; for (const { pos: pos2 } of deserialised.nodes) { if (topLeft[0] > pos2[0]) topLeft[0] = pos2[0]; @@ -170747,11 +199089,11 @@ function getFromFlacBuffer(buffer2) { } __name(getFromFlacBuffer, "getFromFlacBuffer"); function getFromFlacFile(file) { - return new Promise((r) => { + return new Promise((r2) => { const reader = new FileReader(); reader.onload = function(event) { const arrayBuffer = event.target.result; - r(getFromFlacBuffer(arrayBuffer)); + r2(getFromFlacBuffer(arrayBuffer)); }; reader.readAsArrayBuffer(file); }); @@ -170823,10 +199165,10 @@ function getFromPngBuffer(buffer2) { } __name(getFromPngBuffer, "getFromPngBuffer"); function getFromPngFile(file) { - return new Promise((r) => { + return new Promise((r2) => { const reader = new FileReader(); reader.onload = (event) => { - r(getFromPngBuffer(event.target.result)); + r2(getFromPngBuffer(event.target.result)); }; reader.readAsArrayBuffer(file); }); @@ -170897,14 +199239,14 @@ function splitValues(input) { } __name(splitValues, "splitValues"); function getWebpMetadata(file) { - return new Promise((r) => { + return new Promise((r2) => { const reader = new FileReader(); reader.onload = (event) => { const webp = new Uint8Array(event.target.result); const dataView = new DataView(webp.buffer); if (dataView.getUint32(0) !== 1380533830 || dataView.getUint32(8) !== 1464156752) { console.error("Not a valid WEBP file"); - r({}); + r2({}); return; } let offset = 12; @@ -170918,11 +199260,11 @@ function getWebpMetadata(file) { if (String.fromCharCode(...webp.slice(offset + 8, offset + 8 + 6)) == "Exif\0\0") { offset += 6; } - let data24 = parseExifData( + let data25 = parseExifData( webp.slice(offset + 8, offset + 8 + chunk_length) ); - for (var key in data24) { - const value4 = data24[key]; + for (var key in data25) { + const value4 = data25[key]; if (typeof value4 === "string") { const index2 = value4.indexOf(":"); txt_chunks[value4.slice(0, index2)] = value4.slice(index2 + 1); @@ -170932,14 +199274,14 @@ function getWebpMetadata(file) { } offset += 8 + chunk_length; } - r(txt_chunks); + r2(txt_chunks); }; reader.readAsArrayBuffer(file); }); } __name(getWebpMetadata, "getWebpMetadata"); function getLatentMetadata(file) { - return new Promise((r) => { + return new Promise((r2) => { const reader = new FileReader(); reader.onload = (event) => { const safetensorsData = new Uint8Array(event.target.result); @@ -170951,7 +199293,7 @@ function getLatentMetadata(file) { safetensorsData.slice(offset, offset + header_size) ) ); - r(header3.__metadata__); + r2(header3.__metadata__); }; var slice2 = file.slice(0, 1024 * 1024 * 4); reader.readAsArrayBuffer(slice2); @@ -170964,12 +199306,12 @@ async function importA1111(graph, parameters) { const embeddings = await api.getEmbeddings(); const opts = parameters.substr(p2).split("\n")[1].match( new RegExp('\\s*([^:]+:\\s*([^"\\{].*?|".*?"|\\{.*?\\}))\\s*(,|$)', "g") - ).reduce((p3, n) => { - const s = n.split(":"); - if (s[1].endsWith(",")) { - s[1] = s[1].substr(0, s[1].length - 1); + ).reduce((p3, n2) => { + const s2 = n2.split(":"); + if (s2[1].endsWith(",")) { + s2[1] = s2[1].substr(0, s2[1].length - 1); } - p3[s[0].trim().toLowerCase()] = s[1].trim(); + p3[s2[0].trim().toLowerCase()] = s2[1].trim(); return p3; }, {}); const p22 = parameters.lastIndexOf("\nNegative prompt:", p2); @@ -170989,40 +199331,40 @@ async function importA1111(graph, parameters) { let hrSteps = null; const ceil64 = /* @__PURE__ */ __name((v2) => Math.ceil(v2 / 64) * 64, "ceil64"); const getWidget = /* @__PURE__ */ __name((node3, name2) => { - return node3.widgets.find((w) => w.name === name2); + return node3.widgets.find((w2) => w2.name === name2); }, "getWidget"); const setWidgetValue2 = /* @__PURE__ */ __name((node3, name2, value4, isOptionPrefix) => { - const w = getWidget(node3, name2); + const w2 = getWidget(node3, name2); if (isOptionPrefix) { - const o = w.options.values.find((w2) => w2.startsWith(value4)); - if (o) { - w.value = o; + const o2 = w2.options.values.find((w22) => w22.startsWith(value4)); + if (o2) { + w2.value = o2; } else { console.warn(`Unknown value '${value4}' for widget '${name2}'`, node3); - w.value = value4; + w2.value = value4; } } else { - w.value = value4; + w2.value = value4; } }, "setWidgetValue"); const createLoraNodes = /* @__PURE__ */ __name((clipNode, text2, prevClip, prevModel) => { const loras = []; - text2 = text2.replace(/<lora:([^:]+:[^>]+)>/g, function(m, c) { - const s = c.split(":"); - const weight = parseFloat(s[1]); + text2 = text2.replace(/<lora:([^:]+:[^>]+)>/g, function(m2, c2) { + const s2 = c2.split(":"); + const weight = parseFloat(s2[1]); if (isNaN(weight)) { - console.warn("Invalid LORA", m); + console.warn("Invalid LORA", m2); } else { - loras.push({ name: s[0], weight }); + loras.push({ name: s2[0], weight }); } return ""; }); - for (const l of loras) { + for (const l2 of loras) { const loraNode = LiteGraph.createNode("LoraLoader"); graph.add(loraNode); - setWidgetValue2(loraNode, "lora_name", l.name, true); - setWidgetValue2(loraNode, "strength_model", l.weight); - setWidgetValue2(loraNode, "strength_clip", l.weight); + setWidgetValue2(loraNode, "lora_name", l2.name, true); + setWidgetValue2(loraNode, "strength_model", l2.weight); + setWidgetValue2(loraNode, "strength_clip", l2.weight); prevModel.node.connect(prevModel.index, loraNode, 0); prevClip.node.connect(prevClip.index, loraNode, 1); prevModel = { node: loraNode, index: 0 }; @@ -171091,33 +199433,33 @@ async function importA1111(graph, parameters) { } else { setWidgetValue2(samplerNode, "scheduler", "normal"); } - const w = getWidget(samplerNode, "sampler_name"); - const o = w.options.values.find( - (w2) => w2 === name2 || w2 === "sample_" + name2 + const w2 = getWidget(samplerNode, "sampler_name"); + const o2 = w2.options.values.find( + (w22) => w22 === name2 || w22 === "sample_" + name2 ); - if (o) { - setWidgetValue2(samplerNode, "sampler_name", o); + if (o2) { + setWidgetValue2(samplerNode, "sampler_name", o2); } }, size(v2) { const wxh = v2.split("x"); - const w = ceil64(+wxh[0]); + const w2 = ceil64(+wxh[0]); const h2 = ceil64(+wxh[1]); const hrUp = popOpt("hires upscale"); const hrSz = popOpt("hires resize"); hrSteps = popOpt("hires steps"); let hrMethod = popOpt("hires upscaler"); - setWidgetValue2(imageNode, "width", w); + setWidgetValue2(imageNode, "width", w2); setWidgetValue2(imageNode, "height", h2); if (hrUp || hrSz) { let uw, uh; if (hrUp) { - uw = w * hrUp; + uw = w2 * hrUp; uh = h2 * hrUp; } else { - const s = hrSz.split("x"); - uw = +s[0]; - uh = +s[1]; + const s2 = hrSz.split("x"); + uw = +s2[0]; + uh = +s2[1]; } let upscaleNode; let latentNode; @@ -171203,15 +199545,15 @@ async function importA1111(graph, parameters) { +(popOpt("denoising strength") || "1") ); } - let n = createLoraNodes( + let n2 = createLoraNodes( positiveNode, positive, { node: clipSkipNode, index: 0 }, { node: ckptNode, index: 0 } ); - positive = n.text; - n = createLoraNodes(negativeNode, negative, n.prevClip, n.prevModel); - negative = n.text; + positive = n2.text; + n2 = createLoraNodes(negativeNode, negative, n2.prevClip, n2.prevModel); + negative = n2.text; setWidgetValue2(positiveNode, "text", replaceEmbeddings(positive)); setWidgetValue2(negativeNode, "text", replaceEmbeddings(negative)); graph.arrange(); @@ -171260,13 +199602,13 @@ class ComfyButtonGroup { indexOrButton = this.buttons.indexOf(indexOrButton); } if (indexOrButton > -1) { - const r = this.buttons.splice(indexOrButton, 1); + const r2 = this.buttons.splice(indexOrButton, 1); this.update(); - return r; + return r2; } } update() { - this.element.replaceChildren(...this.buttons.map((b) => b["element"] ?? b)); + this.element.replaceChildren(...this.buttons.map((b2) => b2["element"] ?? b2)); } } window.comfyAPI = window.comfyAPI || {}; @@ -171280,9 +199622,9 @@ function applyClasses(element, classList, ...requiredClasses) { } else if (classList instanceof Array) { str = classList.join(" "); } else { - str = Object.entries(classList).reduce((p2, c) => { - if (c[1]) { - p2 += (p2.length ? " " : "") + c[0]; + str = Object.entries(classList).reduce((p2, c2) => { + if (c2[1]) { + p2 += (p2.length ? " " : "") + c2[0]; } return p2; }, ""); @@ -171514,8 +199856,8 @@ class ComfyPopup extends EventTarget { classList, () => applyClasses(this.element, this.classList, "comfyui-popup", horizontal2) ); - this.open = prop(this, "open", false, (v2, o) => { - if (v2 === o) return; + this.open = prop(this, "open", false, (v2, o2) => { + if (v2 === o2) return; if (v2) { this.#show(); } else { @@ -171638,7 +199980,7 @@ class ComfySplitButton { } update() { this.popup.element.replaceChildren( - ...this.items.map((b) => "element" in b ? b.element : b) + ...this.items.map((b2) => "element" in b2 ? b2.element : b2) ); } } @@ -171915,7 +200257,7 @@ class DraggableList extends EventTarget { this.items = []; this.unsetDraggableItem(); this.unsetItemState(); - this.offDrag.forEach((f) => f()); + this.offDrag.forEach((f2) => f2()); this.offDrag = []; } unsetDraggableItem() { @@ -171932,7 +200274,7 @@ class DraggableList extends EventTarget { }); } dispose() { - this.off.forEach((f) => f()); + this.off.forEach((f2) => f2()); } } window.comfyAPI = window.comfyAPI || {}; @@ -171973,8 +200315,8 @@ function sanitizeNodeName(string) { "`": "", "=": "" }; - return String(string).replace(/[&<>"'`=]/g, /* @__PURE__ */ __name(function fromEntityMap(s) { - return entityMap[s]; + return String(string).replace(/[&<>"'`=]/g, /* @__PURE__ */ __name(function fromEntityMap(s2) { + return entityMap[s2]; }, "fromEntityMap")); } __name(sanitizeNodeName, "sanitizeNodeName"); @@ -172247,9 +200589,9 @@ class ComfyApp { document.addEventListener("drop", async (event) => { event.preventDefault(); event.stopPropagation(); - const n = this.dragOverNode; + const n2 = this.dragOverNode; this.dragOverNode = null; - if (n && n.onDragDrop && await n.onDragDrop(event)) { + if (n2 && n2.onDragDrop && await n2.onDragDrop(event)) { return; } if (event.dataTransfer.files.length && event.dataTransfer.files[0].type !== "image/bmp") { @@ -172298,8 +200640,8 @@ class ComfyApp { #addPasteHandler() { document.addEventListener("paste", async (e2) => { if (this.shiftDown) return; - let data24 = e2.clipboardData || window.clipboardData; - const items2 = data24.items; + let data25 = e2.clipboardData || window.clipboardData; + const items2 = data25.items; for (const item3 of items2) { if (item3.type.startsWith("image/")) { var imageNode = null; @@ -172317,16 +200659,16 @@ class ComfyApp { return; } } - data24 = data24.getData("text/plain"); + data25 = data25.getData("text/plain"); let workflow = null; try { - data24 = data24.slice(data24.indexOf("{")); - workflow = JSON.parse(data24); + data25 = data25.slice(data25.indexOf("{")); + workflow = JSON.parse(data25); } catch (err) { try { - data24 = data24.slice(data24.indexOf("workflow\n")); - data24 = data24.slice(data24.indexOf("{")); - workflow = JSON.parse(data24); + data25 = data25.slice(data25.indexOf("workflow\n")); + data25 = data25.slice(data25.indexOf("{")); + workflow = JSON.parse(data25); } catch (error2) { workflow = null; } @@ -172416,7 +200758,7 @@ class ComfyApp { const keyCombo = KeyComboImpl.fromEvent(e2); const keybindingStore = useKeybindingStore(); const keybinding = keybindingStore.getKeybinding(keyCombo); - if (keybinding && keybinding.targetSelector === "#graph-canvas") { + if (keybinding && keybinding.targetElementId === "graph-canvas") { useCommandStore().execute(keybinding.commandId); block_default = true; } @@ -172617,12 +200959,12 @@ class ComfyApp { api.addEventListener("executed", ({ detail }) => { const output = this.nodeOutputs[detail.display_node || detail.node]; if (detail.merge && output) { - for (const k in detail.output ?? {}) { - const v2 = output[k]; + for (const k2 in detail.output ?? {}) { + const v2 = output[k2]; if (v2 instanceof Array) { - output[k] = v2.concat(detail.output[k]); + output[k2] = v2.concat(detail.output[k2]); } else { - output[k] = detail.output[k]; + output[k2] = detail.output[k2]; } } } else { @@ -172673,11 +201015,11 @@ class ComfyApp { for (const node3 of app2.graph.nodes) { node3.onGraphConfigured?.(); } - const r = onConfigure?.apply(this, arguments); + const r2 = onConfigure?.apply(this, arguments); for (const node3 of app2.graph.nodes) { node3.onAfterGraphConfigured?.(); } - return r; + return r2; }; } /** @@ -172845,8 +201187,8 @@ class ComfyApp { if (!template?.data) { continue; } - const data24 = JSON.parse(template.data); - if (!data24.reroutes) { + const data25 = JSON.parse(template.data); + if (!data25.reroutes) { deserialiseAndCreate(template.data, app$1.canvas); } else { localStorage.setItem("litegrapheditor_clipboard", template.data); @@ -172906,26 +201248,26 @@ class ComfyApp { missingNodeTypes // TODO: missingModels ); - for (let n of graphData.nodes) { - if (n.type == "T2IAdapterLoader") n.type = "ControlNetLoader"; - if (n.type == "ConditioningAverage ") n.type = "ConditioningAverage"; - if (n.type == "SDV_img2vid_Conditioning") - n.type = "SVD_img2vid_Conditioning"; - if (!(n.type in LiteGraph.registered_node_types)) { - missingNodeTypes.push(n.type); - n.type = sanitizeNodeName(n.type); + for (let n2 of graphData.nodes) { + if (n2.type == "T2IAdapterLoader") n2.type = "ControlNetLoader"; + if (n2.type == "ConditioningAverage ") n2.type = "ConditioningAverage"; + if (n2.type == "SDV_img2vid_Conditioning") + n2.type = "SVD_img2vid_Conditioning"; + if (!(n2.type in LiteGraph.registered_node_types)) { + missingNodeTypes.push(n2.type); + n2.type = sanitizeNodeName(n2.type); } } if (graphData.models && useSettingStore().get("Comfy.Workflow.ShowMissingModelsWarning")) { - for (const m of graphData.models) { + for (const m2 of graphData.models) { const models_available = await useModelStore().getLoadedModelFolder( - m.directory + m2.directory ); if (models_available === null) { - m.directory_invalid = true; - missingModels.push(m); - } else if (!(m.name in models_available.models)) { - missingModels.push(m); + m2.directory_invalid = true; + missingModels.push(m2); + } else if (!(m2.name in models_available.models)) { + missingModels.push(m2); } } } @@ -173047,7 +201389,7 @@ class ComfyApp { * @returns The workflow and node links */ async graphToPrompt(graph = this.graph, clean = true) { - for (const outerNode of this.graph.computeExecutionOrder(false)) { + for (const outerNode of graph.computeExecutionOrder(false)) { if (outerNode.widgets) { for (const widget2 of outerNode.widgets) { widget2.beforeQueued?.(); @@ -173151,10 +201493,10 @@ class ComfyApp { } } if (clean) { - for (const o in output) { - for (const i2 in output[o].inputs) { - if (Array.isArray(output[o].inputs[i2]) && output[o].inputs[i2].length === 2 && !output[output[o].inputs[i2][0]]) { - delete output[o].inputs[i2]; + for (const o2 in output) { + for (const i2 in output[o2].inputs) { + if (Array.isArray(output[o2].inputs[i2]) && output[o2].inputs[i2].length === 2 && !output[output[o2].inputs[i2][0]]) { + delete output[o2].inputs[i2]; } } } @@ -173221,8 +201563,8 @@ class ComfyApp { } break; } - for (const n of p2.workflow.nodes) { - const node3 = this.graph.getNodeById(n.id); + for (const n2 of p2.workflow.nodes) { + const node3 = this.graph.getNodeById(n2.id); if (node3.widgets) { for (const widget2 of node3.widgets) { if (widget2.afterQueued) { @@ -173253,11 +201595,11 @@ class ComfyApp { * @param {File} file */ async handleFile(file) { - const removeExt = /* @__PURE__ */ __name((f) => { - if (!f) return f; - const p2 = f.lastIndexOf("."); - if (p2 === -1) return f; - return f.substring(0, p2); + const removeExt = /* @__PURE__ */ __name((f2) => { + if (!f2) return f2; + const p2 = f2.lastIndexOf("."); + if (p2 === -1) return f2; + return f2.substring(0, p2); }, "removeExt"); const fileName = removeExt(file.name); if (file.type === "image/png") { @@ -173338,14 +201680,14 @@ class ComfyApp { this.showErrorOnFileLoad(file); } } - isApiJson(data24) { - return Object.values(data24).every((v2) => v2.class_type); + isApiJson(data25) { + return Object.values(data25).every((v2) => v2.class_type); } loadApiJson(apiData, fileName) { useWorkflowService().beforeLoadNewGraph(); const missingNodeTypes = Object.values(apiData).filter( // @ts-expect-error - (n) => !LiteGraph.registered_node_types[n.class_type] + (n2) => !LiteGraph.registered_node_types[n2.class_type] ); if (missingNodeTypes.length) { this.#showMissingNodesError( @@ -173357,24 +201699,24 @@ class ComfyApp { const ids = Object.keys(apiData); app$1.graph.clear(); for (const id3 of ids) { - const data24 = apiData[id3]; - const node3 = LiteGraph.createNode(data24.class_type); + const data25 = apiData[id3]; + const node3 = LiteGraph.createNode(data25.class_type); node3.id = isNaN(+id3) ? id3 : +id3; - node3.title = data24._meta?.title ?? node3.title; + node3.title = data25._meta?.title ?? node3.title; app$1.graph.add(node3); } for (const id3 of ids) { - const data24 = apiData[id3]; + const data25 = apiData[id3]; const node3 = app$1.graph.getNodeById(id3); - for (const input in data24.inputs ?? {}) { - const value4 = data24.inputs[input]; + for (const input in data25.inputs ?? {}) { + const value4 = data25.inputs[input]; if (value4 instanceof Array) { const [fromId, fromSlot] = value4; const fromNode = app$1.graph.getNodeById(fromId); let toSlot = node3.inputs?.findIndex((inp) => inp.name === input); if (toSlot == null || toSlot === -1) { try { - const widget2 = node3.widgets?.find((w) => w.name === input); + const widget2 = node3.widgets?.find((w2) => w2.name === input); if (widget2 && node3.convertWidgetToInput?.(widget2)) { toSlot = node3.inputs?.length - 1; } @@ -173385,7 +201727,7 @@ class ComfyApp { fromNode.connect(fromSlot, node3, toSlot); } } else { - const widget2 = node3.widgets?.find((w) => w.name === input); + const widget2 = node3.widgets?.find((w2) => w2.name === input); if (widget2) { widget2.value = value4; widget2.callback?.(value4); @@ -173395,17 +201737,17 @@ class ComfyApp { } app$1.graph.arrange(); for (const id3 of ids) { - const data24 = apiData[id3]; + const data25 = apiData[id3]; const node3 = app$1.graph.getNodeById(id3); - for (const input in data24.inputs ?? {}) { - const value4 = data24.inputs[input]; + for (const input in data25.inputs ?? {}) { + const value4 = data25.inputs[input]; if (value4 instanceof Array) { const [fromId, fromSlot] = value4; const fromNode = app$1.graph.getNodeById(fromId); let toSlot = node3.inputs?.findIndex((inp) => inp.name === input); if (toSlot == null || toSlot === -1) { try { - const widget2 = node3.widgets?.find((w) => w.name === input); + const widget2 = node3.widgets?.find((w2) => w2.name === input); if (widget2 && node3.convertWidgetToInput?.(widget2)) { toSlot = node3.inputs?.length - 1; } @@ -173416,7 +201758,7 @@ class ComfyApp { fromNode.connect(fromSlot, node3, toSlot); } } else { - const widget2 = node3.widgets?.find((w) => w.name === input); + const widget2 = node3.widgets?.find((w2) => w2.name === input); if (widget2) { widget2.value = value4; widget2.callback?.(value4); @@ -173531,8 +201873,8 @@ const useColorPaletteService = /* @__PURE__ */ __name(() => { const settingStore = useSettingStore(); const nodeDefStore = useNodeDefStore(); const { wrapWithErrorHandling, wrapWithErrorHandlingAsync } = useErrorHandling(); - const validateColorPalette = /* @__PURE__ */ __name((data24) => { - const result = paletteSchema.safeParse(data24); + const validateColorPalette = /* @__PURE__ */ __name((data25) => { + const result = paletteSchema.safeParse(data25); if (result.success) return result.data; const error2 = fromZodError(result.error); throw new Error(`Invalid color palette against zod schema: @@ -173927,7 +202269,7 @@ const useQueueStore = /* @__PURE__ */ defineStore("queue", () => { "status" in task ? task.status : void 0, "outputs" in task ? task.outputs : void 0 ) - ).sort((a, b) => b.queueIndex - a.queueIndex), "toClassAll"); + ).sort((a2, b2) => b2.queueIndex - a2.queueIndex), "toClassAll"); runningTasks.value = toClassAll(queue2.Running); pendingTasks.value = toClassAll(queue2.Pending); const allIndex = new Set( @@ -173941,7 +202283,7 @@ const useQueueStore = /* @__PURE__ */ defineStore("queue", () => { const existingHistoryItems = historyTasks.value.filter( (item3) => allIndex.has(item3.queueIndex) ); - historyTasks.value = [...newHistoryItems, ...existingHistoryItems].slice(0, maxHistoryItems.value).sort((a, b) => b.queueIndex - a.queueIndex); + historyTasks.value = [...newHistoryItems, ...existingHistoryItems].slice(0, maxHistoryItems.value).sort((a2, b2) => b2.queueIndex - a2.queueIndex); } finally { isLoading.value = false; } @@ -173991,11 +202333,11 @@ const useQueueSettingsStore = /* @__PURE__ */ defineStore("queueSettingsStore", batchCount: 1 }), "state") }); -var theme$9 = /* @__PURE__ */ __name(function theme30(_ref) { +var theme$8 = /* @__PURE__ */ __name(function theme33(_ref) { var dt2 = _ref.dt; return "\n.p-contextmenu {\n background: ".concat(dt2("contextmenu.background"), ";\n color: ").concat(dt2("contextmenu.color"), ";\n border: 1px solid ").concat(dt2("contextmenu.border.color"), ";\n border-radius: ").concat(dt2("contextmenu.border.radius"), ";\n box-shadow: ").concat(dt2("contextmenu.shadow"), ";\n min-width: 12.5rem;\n}\n\n.p-contextmenu-root-list,\n.p-contextmenu-submenu {\n margin: 0;\n padding: ").concat(dt2("contextmenu.list.padding"), ";\n list-style: none;\n outline: 0 none;\n display: flex;\n flex-direction: column;\n gap: ").concat(dt2("contextmenu.list.gap"), ";\n}\n\n.p-contextmenu-submenu {\n position: absolute;\n display: flex;\n flex-direction: column;\n min-width: 100%;\n z-index: 1;\n background: ").concat(dt2("contextmenu.background"), ";\n color: ").concat(dt2("contextmenu.color"), ";\n border: 1px solid ").concat(dt2("contextmenu.border.color"), ";\n border-radius: ").concat(dt2("contextmenu.border.radius"), ";\n box-shadow: ").concat(dt2("contextmenu.shadow"), ";\n}\n\n.p-contextmenu-item {\n position: relative;\n}\n\n.p-contextmenu-item-content {\n transition: background ").concat(dt2("contextmenu.transition.duration"), ", color ").concat(dt2("contextmenu.transition.duration"), ";\n border-radius: ").concat(dt2("contextmenu.item.border.radius"), ";\n color: ").concat(dt2("contextmenu.item.color"), ";\n}\n\n.p-contextmenu-item-link {\n cursor: pointer;\n display: flex;\n align-items: center;\n text-decoration: none;\n overflow: hidden;\n position: relative;\n color: inherit;\n padding: ").concat(dt2("contextmenu.item.padding"), ";\n gap: ").concat(dt2("contextmenu.item.gap"), ";\n user-select: none;\n}\n\n.p-contextmenu-item-label {\n line-height: 1;\n}\n\n.p-contextmenu-item-icon {\n color: ").concat(dt2("contextmenu.item.icon.color"), ";\n}\n\n.p-contextmenu-submenu-icon {\n color: ").concat(dt2("contextmenu.submenu.icon.color"), ";\n margin-left: auto;\n font-size: ").concat(dt2("contextmenu.submenu.icon.size"), ";\n width: ").concat(dt2("contextmenu.submenu.icon.size"), ";\n height: ").concat(dt2("contextmenu.submenu.icon.size"), ";\n}\n\n.p-contextmenu-item.p-focus > .p-contextmenu-item-content {\n color: ").concat(dt2("contextmenu.item.focus.color"), ";\n background: ").concat(dt2("contextmenu.item.focus.background"), ";\n}\n\n.p-contextmenu-item.p-focus > .p-contextmenu-item-content .p-contextmenu-item-icon {\n color: ").concat(dt2("contextmenu.item.icon.focus.color"), ";\n}\n\n.p-contextmenu-item.p-focus > .p-contextmenu-item-content .p-contextmenu-submenu-icon {\n color: ").concat(dt2("contextmenu.submenu.icon.focus.color"), ";\n}\n\n.p-contextmenu-item:not(.p-disabled) > .p-contextmenu-item-content:hover {\n color: ").concat(dt2("contextmenu.item.focus.color"), ";\n background: ").concat(dt2("contextmenu.item.focus.background"), ";\n}\n\n.p-contextmenu-item:not(.p-disabled) > .p-contextmenu-item-content:hover .p-contextmenu-item-icon {\n color: ").concat(dt2("contextmenu.item.icon.focus.color"), ";\n}\n\n.p-contextmenu-item:not(.p-disabled) > .p-contextmenu-item-content:hover .p-contextmenu-submenu-icon {\n color: ").concat(dt2("contextmenu.submenu.icon.focus.color"), ";\n}\n\n.p-contextmenu-item-active > .p-contextmenu-item-content {\n color: ").concat(dt2("contextmenu.item.active.color"), ";\n background: ").concat(dt2("contextmenu.item.active.background"), ";\n}\n\n.p-contextmenu-item-active > .p-contextmenu-item-content .p-contextmenu-item-icon {\n color: ").concat(dt2("contextmenu.item.icon.active.color"), ";\n}\n\n.p-contextmenu-item-active > .p-contextmenu-item-content .p-contextmenu-submenu-icon {\n color: ").concat(dt2("contextmenu.submenu.icon.active.color"), ";\n}\n\n.p-contextmenu-separator {\n border-top: 1px solid ").concat(dt2("contextmenu.separator.border.color"), ";\n}\n\n.p-contextmenu-enter-from,\n.p-contextmenu-leave-active {\n opacity: 0;\n}\n\n.p-contextmenu-enter-active {\n transition: opacity 250ms;\n}\n"); }, "theme"); -var classes$9 = { +var classes$8 = { root: "p-contextmenu p-component", rootList: "p-contextmenu-root-list", item: /* @__PURE__ */ __name(function item2(_ref2) { @@ -174016,32 +202358,32 @@ var classes$9 = { }; var ContextMenuStyle = BaseStyle.extend({ name: "contextmenu", - theme: theme$9, - classes: classes$9 + theme: theme$8, + classes: classes$8 }); -var script$f = { +var script$d = { name: "AngleRightIcon", - "extends": script$X + "extends": script$_ }; -var _hoisted_1$t = /* @__PURE__ */ createBaseVNode("path", { +var _hoisted_1$r = /* @__PURE__ */ createBaseVNode("path", { d: "M5.25 11.1728C5.14929 11.1694 5.05033 11.1455 4.9592 11.1025C4.86806 11.0595 4.78666 10.9984 4.72 10.9228C4.57955 10.7822 4.50066 10.5916 4.50066 10.3928C4.50066 10.1941 4.57955 10.0035 4.72 9.86283L7.72 6.86283L4.72 3.86283C4.66067 3.71882 4.64765 3.55991 4.68275 3.40816C4.71785 3.25642 4.79932 3.11936 4.91585 3.01602C5.03238 2.91268 5.17819 2.84819 5.33305 2.83149C5.4879 2.81479 5.64411 2.84671 5.78 2.92283L9.28 6.42283C9.42045 6.56346 9.49934 6.75408 9.49934 6.95283C9.49934 7.15158 9.42045 7.34221 9.28 7.48283L5.78 10.9228C5.71333 10.9984 5.63193 11.0595 5.5408 11.1025C5.44966 11.1455 5.35071 11.1694 5.25 11.1728Z", fill: "currentColor" }, null, -1); -var _hoisted_2$l = [_hoisted_1$t]; -function render$e(_ctx, _cache, $props, $setup, $data, $options) { +var _hoisted_2$j = [_hoisted_1$r]; +function render$c(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" - }, _ctx.pti()), _hoisted_2$l, 16); + }, _ctx.pti()), _hoisted_2$j, 16); } -__name(render$e, "render$e"); -script$f.render = render$e; +__name(render$c, "render$c"); +script$d.render = render$c; var script$2$2 = { name: "BaseContextMenu", - "extends": script$_, + "extends": script$11, props: { model: { type: Array, @@ -174077,17 +202419,17 @@ var script$2$2 = { } }, style: ContextMenuStyle, - provide: /* @__PURE__ */ __name(function provide32() { + provide: /* @__PURE__ */ __name(function provide35() { return { $pcContextMenu: this, $parentInstance: this }; }, "provide") }; -var script$1$9 = { +var script$1$8 = { name: "ContextMenuSub", hostName: "ContextMenu", - "extends": script$_, + "extends": script$11, emits: ["item-click", "item-mouseenter", "item-mousemove"], props: { items: { @@ -174135,7 +202477,7 @@ var script$1$9 = { return this.getItemId(processedItem); }, "getItemKey"), getItemProp: /* @__PURE__ */ __name(function getItemProp(processedItem, name2, params) { - return processedItem && processedItem.item ? resolve$1(processedItem.item[name2], params) : void 0; + return processedItem && processedItem.item ? resolve$2(processedItem.item[name2], params) : void 0; }, "getItemProp"), getItemLabel: /* @__PURE__ */ __name(function getItemLabel(processedItem) { return this.getItemProp(processedItem, "label"); @@ -174143,7 +202485,7 @@ var script$1$9 = { getItemLabelId: /* @__PURE__ */ __name(function getItemLabelId(processedItem) { return "".concat(this.menuId, "_").concat(processedItem.key, "_label"); }, "getItemLabelId"), - getPTOptions: /* @__PURE__ */ __name(function getPTOptions5(key, processedItem, index2) { + getPTOptions: /* @__PURE__ */ __name(function getPTOptions6(key, processedItem, index2) { return this.ptm(key, { context: { item: processedItem.item, @@ -174230,14 +202572,14 @@ var script$1$9 = { }, "getMenuItemProps") }, components: { - AngleRightIcon: script$f + AngleRightIcon: script$d }, directives: { ripple: Ripple } }; -var _hoisted_1$s = ["tabindex"]; -var _hoisted_2$k = ["id", "aria-label", "aria-disabled", "aria-expanded", "aria-haspopup", "aria-level", "aria-setsize", "aria-posinset", "data-p-active", "data-p-focused", "data-p-disabled"]; +var _hoisted_1$q = ["tabindex"]; +var _hoisted_2$i = ["id", "aria-label", "aria-disabled", "aria-expanded", "aria-haspopup", "aria-level", "aria-setsize", "aria-posinset", "data-p-active", "data-p-focused", "data-p-disabled"]; var _hoisted_3$a = ["onClick", "onMouseenter", "onMousemove"]; var _hoisted_4$7 = ["href", "target"]; var _hoisted_5$6 = ["id"]; @@ -174350,7 +202692,7 @@ function render$1$2(_ctx, _cache, $props, $setup, $data, $options) { }), "aria-labelledby": $options.getItemLabelId(processedItem), ref_for: true - }, _ctx.ptm("submenu")), null, 16, ["id", "class", "menuId", "focusedItemId", "items", "templates", "activeItemPath", "level", "visible", "pt", "unstyled", "aria-labelledby"])) : createCommentVNode("", true)], 16, _hoisted_2$k)) : createCommentVNode("", true), $options.isItemVisible(processedItem) && $options.getItemProp(processedItem, "separator") ? (openBlock(), createElementBlock("li", mergeProps({ + }, _ctx.ptm("submenu")), null, 16, ["id", "class", "menuId", "focusedItemId", "items", "templates", "activeItemPath", "level", "visible", "pt", "unstyled", "aria-labelledby"])) : createCommentVNode("", true)], 16, _hoisted_2$i)) : createCommentVNode("", true), $options.isItemVisible(processedItem) && $options.getItemProp(processedItem, "separator") ? (openBlock(), createElementBlock("li", mergeProps({ key: 1, id: $options.getItemId(processedItem), style: $options.getItemProp(processedItem, "style"), @@ -174358,14 +202700,14 @@ function render$1$2(_ctx, _cache, $props, $setup, $data, $options) { role: "separator", ref_for: true }, _ctx.ptm("separator")), null, 16, _hoisted_6$5)) : createCommentVNode("", true)], 64); - }), 128))], 16, _hoisted_1$s)) : createCommentVNode("", true)]; + }), 128))], 16, _hoisted_1$q)) : createCommentVNode("", true)]; }), _: 1 }, 16, ["onEnter"]); } __name(render$1$2, "render$1$2"); -script$1$9.render = render$1$2; -var script$e = { +script$1$8.render = render$1$2; +var script$c = { name: "ContextMenu", "extends": script$2$2, inheritAttrs: false, @@ -174378,7 +202720,7 @@ var script$e = { pageY: null, container: null, list: null, - data: /* @__PURE__ */ __name(function data15() { + data: /* @__PURE__ */ __name(function data17() { return { id: this.$attrs.id, focused: false, @@ -174393,7 +202735,7 @@ var script$e = { }; }, "data"), watch: { - "$attrs.id": /* @__PURE__ */ __name(function $attrsId7(newValue2) { + "$attrs.id": /* @__PURE__ */ __name(function $attrsId8(newValue2) { this.id = newValue2 || UniqueComponentId(); }, "$attrsId"), activeItemPath: /* @__PURE__ */ __name(function activeItemPath(newPath) { @@ -174406,7 +202748,7 @@ var script$e = { } }, "activeItemPath") }, - mounted: /* @__PURE__ */ __name(function mounted15() { + mounted: /* @__PURE__ */ __name(function mounted17() { this.id = this.id || UniqueComponentId(); if (this.global) { this.bindDocumentContextMenuListener(); @@ -174424,7 +202766,7 @@ var script$e = { }, "beforeUnmount"), methods: { getItemProp: /* @__PURE__ */ __name(function getItemProp2(item3, name2) { - return item3 ? resolve$1(item3[name2]) : void 0; + return item3 ? resolve$2(item3[name2]) : void 0; }, "getItemProp"), getItemLabel: /* @__PURE__ */ __name(function getItemLabel2(item3) { return this.getItemProp(item3, "label"); @@ -174447,7 +202789,7 @@ var script$e = { isProccessedItemGroup: /* @__PURE__ */ __name(function isProccessedItemGroup(processedItem) { return processedItem && isNotEmpty(processedItem.items); }, "isProccessedItemGroup"), - toggle: /* @__PURE__ */ __name(function toggle(event) { + toggle: /* @__PURE__ */ __name(function toggle2(event) { this.visible ? this.hide() : this.show(event); }, "toggle"), show: /* @__PURE__ */ __name(function show3(event) { @@ -174475,7 +202817,7 @@ var script$e = { parentKey: "" }; }, "hide"), - onFocus: /* @__PURE__ */ __name(function onFocus5(event) { + onFocus: /* @__PURE__ */ __name(function onFocus6(event) { this.focused = true; this.focusedItemInfo = this.focusedItemInfo.index !== -1 ? this.focusedItemInfo : { index: -1, @@ -174484,7 +202826,7 @@ var script$e = { }; this.$emit("focus", event); }, "onFocus"), - onBlur: /* @__PURE__ */ __name(function onBlur5(event) { + onBlur: /* @__PURE__ */ __name(function onBlur6(event) { this.focused = false; this.focusedItemInfo = { index: -1, @@ -174494,7 +202836,7 @@ var script$e = { this.searchValue = ""; this.$emit("blur", event); }, "onBlur"), - onKeyDown: /* @__PURE__ */ __name(function onKeyDown6(event) { + onKeyDown: /* @__PURE__ */ __name(function onKeyDown7(event) { var metaKey = event.metaKey || event.ctrlKey; switch (event.code) { case "ArrowDown": @@ -174617,8 +202959,8 @@ var script$e = { var parentItem = this.activeItemPath.find(function(p2) { return p2.key === processedItem.parentKey; }); - var root24 = isEmpty$1(processedItem.parent); - if (!root24) { + var root27 = isEmpty$1(processedItem.parent); + if (!root27) { this.focusedItemInfo = { index: -1, parentKey: parentItem ? parentItem.parentKey : "" @@ -174935,11 +203277,11 @@ var script$e = { }, "focusedItemIdx") }, components: { - ContextMenuSub: script$1$9, - Portal: script$Q + ContextMenuSub: script$1$8, + Portal: script$T } }; -function render$d(_ctx, _cache, $props, $setup, $data, $options) { +function render$b(_ctx, _cache, $props, $setup, $data, $options) { var _component_ContextMenuSub = resolveComponent("ContextMenuSub"); var _component_Portal = resolveComponent("Portal"); return openBlock(), createBlock(_component_Portal, { @@ -174992,14 +203334,14 @@ function render$d(_ctx, _cache, $props, $setup, $data, $options) { _: 1 }, 8, ["appendTo"]); } -__name(render$d, "render$d"); -script$e.render = render$d; -var theme$8 = /* @__PURE__ */ __name(function theme31(_ref) { +__name(render$b, "render$b"); +script$c.render = render$b; +var theme$7 = /* @__PURE__ */ __name(function theme34(_ref) { var dt2 = _ref.dt; return "\n.p-tree {\n background: ".concat(dt2("tree.background"), ";\n color: ").concat(dt2("tree.color"), ";\n padding: ").concat(dt2("tree.padding"), ";\n}\n\n.p-tree-root-children,\n.p-tree-node-children {\n display: flex;\n list-style-type: none;\n flex-direction: column;\n margin: 0;\n gap: ").concat(dt2("tree.gap"), ";\n}\n\n.p-tree-root-children {\n padding: ").concat(dt2("tree.gap"), " 0 0 0;\n}\n\n.p-tree-node-children {\n padding: ").concat(dt2("tree.gap"), " 0 0 ").concat(dt2("tree.indent"), ";\n}\n\n.p-tree-node {\n padding: 0;\n outline: 0 none;\n}\n\n.p-tree-node-content {\n border-radius: ").concat(dt2("tree.node.border.radius"), ";\n padding: ").concat(dt2("tree.node.padding"), ";\n display: flex;\n align-items: center;\n outline-color: transparent;\n color: ").concat(dt2("tree.node.color"), ";\n gap: ").concat(dt2("tree.node.gap"), ";\n transition: background ").concat(dt2("tree.transition.duration"), ", color ").concat(dt2("tree.transition.duration"), ", outline-color ").concat(dt2("tree.transition.duration"), ", box-shadow ").concat(dt2("tree.transition.duration"), ";\n}\n\n.p-tree-node:focus-visible > .p-tree-node-content {\n box-shadow: ").concat(dt2("tree.node.focus.ring.shadow"), ";\n outline: ").concat(dt2("tree.node.focus.ring.width"), " ").concat(dt2("tree.node.focus.ring.style"), " ").concat(dt2("tree.node.focus.ring.color"), ";\n outline-offset: ").concat(dt2("tree.node.focus.ring.offset"), ";\n}\n\n.p-tree-node-content.p-tree-node-selectable:not(.p-tree-node-selected):hover {\n background: ").concat(dt2("tree.node.hover.background"), ";\n color: ").concat(dt2("tree.node.hover.color"), ";\n}\n\n.p-tree-node-content.p-tree-node-selectable:not(.p-tree-node-selected):hover .p-tree-node-icon {\n color: ").concat(dt2("tree.node.icon.hover.color"), ";\n}\n\n.p-tree-node-content.p-tree-node-selected {\n background: ").concat(dt2("tree.node.selected.background"), ";\n color: ").concat(dt2("tree.node.selected.color"), ";\n}\n\n.p-tree-node-content.p-tree-node-selected .p-tree-node-toggle-button {\n color: inherit;\n}\n\n.p-tree-node-toggle-button {\n cursor: pointer;\n user-select: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n position: relative;\n flex-shrink: 0;\n width: ").concat(dt2("tree.node.toggle.button.size"), ";\n height: ").concat(dt2("tree.node.toggle.button.size"), ";\n color: ").concat(dt2("tree.node.toggle.button.color"), ";\n border: 0 none;\n background: transparent;\n border-radius: ").concat(dt2("tree.node.toggle.button.border.radius"), ";\n transition: background ").concat(dt2("tree.transition.duration"), ", color ").concat(dt2("tree.transition.duration"), ", border-color ").concat(dt2("tree.transition.duration"), ", outline-color ").concat(dt2("tree.transition.duration"), ", box-shadow ").concat(dt2("tree.transition.duration"), ";\n outline-color: transparent;\n padding: 0;\n}\n\n.p-tree-node-toggle-button:enabled:hover {\n background: ").concat(dt2("tree.node.toggle.button.hover.background"), ";\n color: ").concat(dt2("tree.node.toggle.button.hover.color"), ";\n}\n\n.p-tree-node-content.p-tree-node-selected .p-tree-node-toggle-button:hover {\n background: ").concat(dt2("tree.node.toggle.button.selected.hover.background"), ";\n color: ").concat(dt2("tree.node.toggle.button.selected.hover.color"), ";\n}\n\n.p-tree-root {\n overflow: auto;\n}\n\n.p-tree-node-selectable {\n cursor: pointer;\n user-select: none;\n}\n\n.p-tree-node-leaf > .p-tree-node-content .p-tree-node-toggle-button {\n visibility: hidden;\n}\n\n.p-tree-node-icon {\n color: ").concat(dt2("tree.node.icon.color"), ";\n transition: color ").concat(dt2("tree.transition.duration"), ";\n}\n\n.p-tree-node-content.p-tree-node-selected .p-tree-node-icon {\n color: ").concat(dt2("tree.node.icon.selected.color"), ";\n}\n\n.p-tree-filter-input {\n width: 100%;\n}\n\n.p-tree-loading {\n position: relative;\n height: 100%;\n}\n\n.p-tree-loading-icon {\n font-size: ").concat(dt2("tree.loading.icon.size"), ";\n width: ").concat(dt2("tree.loading.icon.size"), ";\n height: ").concat(dt2("tree.loading.icon.size"), ";\n}\n\n.p-tree .p-tree-mask {\n position: absolute;\n z-index: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.p-tree-flex-scrollable {\n display: flex;\n flex: 1;\n height: 100%;\n flex-direction: column;\n}\n\n.p-tree-flex-scrollable .p-tree-root {\n flex: 1;\n}\n"); }, "theme"); -var classes$8 = { - root: /* @__PURE__ */ __name(function root19(_ref2) { +var classes$7 = { + root: /* @__PURE__ */ __name(function root23(_ref2) { var props = _ref2.props; return ["p-tree p-component", { "p-tree-selectable": props.selectionMode != null, @@ -175035,278 +203377,12 @@ var classes$8 = { }; var TreeStyle = BaseStyle.extend({ name: "tree", - theme: theme$8, - classes: classes$8 -}); -var script$d = { - name: "MinusIcon", - "extends": script$X -}; -var _hoisted_1$r = /* @__PURE__ */ createBaseVNode("path", { - d: "M13.2222 7.77778H0.777778C0.571498 7.77778 0.373667 7.69584 0.227806 7.54998C0.0819442 7.40412 0 7.20629 0 7.00001C0 6.79373 0.0819442 6.5959 0.227806 6.45003C0.373667 6.30417 0.571498 6.22223 0.777778 6.22223H13.2222C13.4285 6.22223 13.6263 6.30417 13.7722 6.45003C13.9181 6.5959 14 6.79373 14 7.00001C14 7.20629 13.9181 7.40412 13.7722 7.54998C13.6263 7.69584 13.4285 7.77778 13.2222 7.77778Z", - fill: "currentColor" -}, null, -1); -var _hoisted_2$j = [_hoisted_1$r]; -function render$c(_ctx, _cache, $props, $setup, $data, $options) { - return openBlock(), createElementBlock("svg", mergeProps({ - width: "14", - height: "14", - viewBox: "0 0 14 14", - fill: "none", - xmlns: "http://www.w3.org/2000/svg" - }, _ctx.pti()), _hoisted_2$j, 16); -} -__name(render$c, "render$c"); -script$d.render = render$c; -var theme$7 = /* @__PURE__ */ __name(function theme32(_ref) { - var dt2 = _ref.dt; - return "\n.p-checkbox {\n position: relative;\n display: inline-flex;\n user-select: none;\n vertical-align: bottom;\n width: ".concat(dt2("checkbox.width"), ";\n height: ").concat(dt2("checkbox.height"), ";\n}\n\n.p-checkbox-input {\n cursor: pointer;\n appearance: none;\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n padding: 0;\n margin: 0;\n opacity: 0;\n z-index: 1;\n outline: 0 none;\n border: 1px solid transparent;\n border-radius: ").concat(dt2("checkbox.border.radius"), ";\n}\n\n.p-checkbox-box {\n display: flex;\n justify-content: center;\n align-items: center;\n border-radius: ").concat(dt2("checkbox.border.radius"), ";\n border: 1px solid ").concat(dt2("checkbox.border.color"), ";\n background: ").concat(dt2("checkbox.background"), ";\n width: ").concat(dt2("checkbox.width"), ";\n height: ").concat(dt2("checkbox.height"), ";\n transition: background ").concat(dt2("checkbox.transition.duration"), ", color ").concat(dt2("checkbox.transition.duration"), ", border-color ").concat(dt2("checkbox.transition.duration"), ", box-shadow ").concat(dt2("checkbox.transition.duration"), ", outline-color ").concat(dt2("checkbox.transition.duration"), ";\n outline-color: transparent;\n box-shadow: ").concat(dt2("checkbox.shadow"), ";\n}\n\n.p-checkbox-icon {\n transition-duration: ").concat(dt2("checkbox.transition.duration"), ";\n color: ").concat(dt2("checkbox.icon.color"), ";\n font-size: ").concat(dt2("checkbox.icon.size"), ";\n width: ").concat(dt2("checkbox.icon.size"), ";\n height: ").concat(dt2("checkbox.icon.size"), ";\n}\n\n.p-checkbox:not(.p-disabled):has(.p-checkbox-input:hover) .p-checkbox-box {\n border-color: ").concat(dt2("checkbox.hover.border.color"), ";\n}\n\n.p-checkbox-checked .p-checkbox-box {\n border-color: ").concat(dt2("checkbox.checked.border.color"), ";\n background: ").concat(dt2("checkbox.checked.background"), ";\n}\n\n.p-checkbox-checked .p-checkbox-icon {\n color: ").concat(dt2("checkbox.icon.checked.color"), ";\n}\n\n.p-checkbox-checked:not(.p-disabled):has(.p-checkbox-input:hover) .p-checkbox-box {\n background: ").concat(dt2("checkbox.checked.hover.background"), ";\n border-color: ").concat(dt2("checkbox.checked.hover.border.color"), ";\n}\n\n.p-checkbox-checked:not(.p-disabled):has(.p-checkbox-input:hover) .p-checkbox-icon {\n color: ").concat(dt2("checkbox.icon.checked.hover.color"), ";\n}\n\n.p-checkbox:not(.p-disabled):has(.p-checkbox-input:focus-visible) .p-checkbox-box {\n border-color: ").concat(dt2("checkbox.focus.border.color"), ";\n box-shadow: ").concat(dt2("checkbox.focus.ring.shadow"), ";\n outline: ").concat(dt2("checkbox.focus.ring.width"), " ").concat(dt2("checkbox.focus.ring.style"), " ").concat(dt2("checkbox.focus.ring.color"), ";\n outline-offset: ").concat(dt2("checkbox.focus.ring.offset"), ";\n}\n\n.p-checkbox-checked:not(.p-disabled):has(.p-checkbox-input:focus-visible) .p-checkbox-box {\n border-color: ").concat(dt2("checkbox.checked.focus.border.color"), ";\n}\n\n.p-checkbox.p-invalid > .p-checkbox-box {\n border-color: ").concat(dt2("checkbox.invalid.border.color"), ";\n}\n\n.p-checkbox.p-variant-filled .p-checkbox-box {\n background: ").concat(dt2("checkbox.filled.background"), ";\n}\n\n.p-checkbox-checked.p-variant-filled .p-checkbox-box {\n background: ").concat(dt2("checkbox.checked.background"), ";\n}\n\n.p-checkbox-checked.p-variant-filled:not(.p-disabled):has(.p-checkbox-input:hover) .p-checkbox-box {\n background: ").concat(dt2("checkbox.checked.hover.background"), ";\n}\n\n.p-checkbox.p-disabled {\n opacity: 1;\n}\n\n.p-checkbox.p-disabled .p-checkbox-box {\n background: ").concat(dt2("checkbox.disabled.background"), ";\n border-color: ").concat(dt2("checkbox.checked.disabled.border.color"), ";\n}\n\n.p-checkbox.p-disabled .p-checkbox-box .p-checkbox-icon {\n color: ").concat(dt2("checkbox.icon.disabled.color"), ";\n}\n"); -}, "theme"); -var classes$7 = { - root: /* @__PURE__ */ __name(function root20(_ref2) { - var instance = _ref2.instance, props = _ref2.props; - return ["p-checkbox p-component", { - "p-checkbox-checked": instance.checked, - "p-disabled": props.disabled, - "p-invalid": props.invalid, - "p-variant-filled": props.variant ? props.variant === "filled" : instance.$primevue.config.inputStyle === "filled" || instance.$primevue.config.inputVariant === "filled" - }]; - }, "root"), - box: "p-checkbox-box", - input: "p-checkbox-input", - icon: "p-checkbox-icon" -}; -var CheckboxStyle = BaseStyle.extend({ - name: "checkbox", theme: theme$7, classes: classes$7 }); -var script$1$8 = { - name: "BaseCheckbox", - "extends": script$_, - props: { - value: null, - modelValue: null, - binary: Boolean, - name: { - type: String, - "default": null - }, - indeterminate: { - type: Boolean, - "default": false - }, - trueValue: { - type: null, - "default": true - }, - falseValue: { - type: null, - "default": false - }, - variant: { - type: String, - "default": null - }, - invalid: { - type: Boolean, - "default": false - }, - disabled: { - type: Boolean, - "default": false - }, - readonly: { - type: Boolean, - "default": false - }, - required: { - type: Boolean, - "default": false - }, - tabindex: { - type: Number, - "default": null - }, - inputId: { - type: String, - "default": null - }, - inputClass: { - type: [String, Object], - "default": null - }, - inputStyle: { - type: Object, - "default": null - }, - ariaLabelledby: { - type: String, - "default": null - }, - ariaLabel: { - type: String, - "default": null - } - }, - style: CheckboxStyle, - provide: /* @__PURE__ */ __name(function provide33() { - return { - $pcCheckbox: this, - $parentInstance: this - }; - }, "provide") -}; -function _toConsumableArray$5(r) { - return _arrayWithoutHoles$5(r) || _iterableToArray$5(r) || _unsupportedIterableToArray$7(r) || _nonIterableSpread$5(); -} -__name(_toConsumableArray$5, "_toConsumableArray$5"); -function _nonIterableSpread$5() { - throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} -__name(_nonIterableSpread$5, "_nonIterableSpread$5"); -function _unsupportedIterableToArray$7(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray$7(r, a); - var t2 = {}.toString.call(r).slice(8, -1); - return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$7(r, a) : void 0; - } -} -__name(_unsupportedIterableToArray$7, "_unsupportedIterableToArray$7"); -function _iterableToArray$5(r) { - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); -} -__name(_iterableToArray$5, "_iterableToArray$5"); -function _arrayWithoutHoles$5(r) { - if (Array.isArray(r)) return _arrayLikeToArray$7(r); -} -__name(_arrayWithoutHoles$5, "_arrayWithoutHoles$5"); -function _arrayLikeToArray$7(r, a) { - (null == a || a > r.length) && (a = r.length); - for (var e2 = 0, n = Array(a); e2 < a; e2++) n[e2] = r[e2]; - return n; -} -__name(_arrayLikeToArray$7, "_arrayLikeToArray$7"); -var script$c = { - name: "Checkbox", - "extends": script$1$8, - inheritAttrs: false, - emits: ["update:modelValue", "change", "focus", "blur", "update:indeterminate"], - data: /* @__PURE__ */ __name(function data16() { - return { - d_indeterminate: this.indeterminate - }; - }, "data"), - watch: { - indeterminate: /* @__PURE__ */ __name(function indeterminate2(newValue2) { - this.d_indeterminate = newValue2; - }, "indeterminate") - }, - methods: { - getPTOptions: /* @__PURE__ */ __name(function getPTOptions6(key) { - var _ptm = key === "root" ? this.ptmi : this.ptm; - return _ptm(key, { - context: { - checked: this.checked, - indeterminate: this.d_indeterminate, - disabled: this.disabled - } - }); - }, "getPTOptions"), - onChange: /* @__PURE__ */ __name(function onChange3(event) { - var _this = this; - if (!this.disabled && !this.readonly) { - var newModelValue; - if (this.binary) { - newModelValue = this.d_indeterminate ? this.trueValue : this.checked ? this.falseValue : this.trueValue; - } else { - if (this.checked || this.d_indeterminate) newModelValue = this.modelValue.filter(function(val) { - return !equals(val, _this.value); - }); - else newModelValue = this.modelValue ? [].concat(_toConsumableArray$5(this.modelValue), [this.value]) : [this.value]; - } - if (this.d_indeterminate) { - this.d_indeterminate = false; - this.$emit("update:indeterminate", this.d_indeterminate); - } - this.$emit("update:modelValue", newModelValue); - this.$emit("change", event); - } - }, "onChange"), - onFocus: /* @__PURE__ */ __name(function onFocus6(event) { - this.$emit("focus", event); - }, "onFocus"), - onBlur: /* @__PURE__ */ __name(function onBlur6(event) { - this.$emit("blur", event); - }, "onBlur") - }, - computed: { - checked: /* @__PURE__ */ __name(function checked2() { - return this.d_indeterminate ? false : this.binary ? this.modelValue === this.trueValue : contains(this.value, this.modelValue); - }, "checked") - }, - components: { - CheckIcon: script$K, - MinusIcon: script$d - } -}; -var _hoisted_1$q = ["data-p-checked", "data-p-indeterminate", "data-p-disabled"]; -var _hoisted_2$i = ["id", "value", "name", "checked", "tabindex", "disabled", "readonly", "required", "aria-labelledby", "aria-label", "aria-invalid", "aria-checked"]; -function render$b(_ctx, _cache, $props, $setup, $data, $options) { - var _component_CheckIcon = resolveComponent("CheckIcon"); - var _component_MinusIcon = resolveComponent("MinusIcon"); - return openBlock(), createElementBlock("div", mergeProps({ - "class": _ctx.cx("root") - }, $options.getPTOptions("root"), { - "data-p-checked": $options.checked, - "data-p-indeterminate": $data.d_indeterminate || void 0, - "data-p-disabled": _ctx.disabled - }), [createBaseVNode("input", mergeProps({ - id: _ctx.inputId, - type: "checkbox", - "class": [_ctx.cx("input"), _ctx.inputClass], - style: _ctx.inputStyle, - value: _ctx.value, - name: _ctx.name, - checked: $options.checked, - tabindex: _ctx.tabindex, - disabled: _ctx.disabled, - readonly: _ctx.readonly, - required: _ctx.required, - "aria-labelledby": _ctx.ariaLabelledby, - "aria-label": _ctx.ariaLabel, - "aria-invalid": _ctx.invalid || void 0, - "aria-checked": $data.d_indeterminate ? "mixed" : void 0, - onFocus: _cache[0] || (_cache[0] = function() { - return $options.onFocus && $options.onFocus.apply($options, arguments); - }), - onBlur: _cache[1] || (_cache[1] = function() { - return $options.onBlur && $options.onBlur.apply($options, arguments); - }), - onChange: _cache[2] || (_cache[2] = function() { - return $options.onChange && $options.onChange.apply($options, arguments); - }) - }, $options.getPTOptions("input")), null, 16, _hoisted_2$i), createBaseVNode("div", mergeProps({ - "class": _ctx.cx("box") - }, $options.getPTOptions("box")), [renderSlot(_ctx.$slots, "icon", { - checked: $options.checked, - indeterminate: $data.d_indeterminate, - "class": normalizeClass(_ctx.cx("icon")) - }, function() { - return [$options.checked ? (openBlock(), createBlock(_component_CheckIcon, mergeProps({ - key: 0, - "class": _ctx.cx("icon") - }, $options.getPTOptions("icon")), null, 16, ["class"])) : $data.d_indeterminate ? (openBlock(), createBlock(_component_MinusIcon, mergeProps({ - key: 1, - "class": _ctx.cx("icon") - }, $options.getPTOptions("icon")), null, 16, ["class"])) : createCommentVNode("", true)]; - })], 16)], 16, _hoisted_1$q); -} -__name(render$b, "render$b"); -script$c.render = render$b; var script$2$1 = { name: "BaseTree", - "extends": script$_, + "extends": script$11, props: { value: { type: null, @@ -175382,79 +203458,79 @@ var script$2$1 = { } }, style: TreeStyle, - provide: /* @__PURE__ */ __name(function provide34() { + provide: /* @__PURE__ */ __name(function provide36() { return { $pcTree: this, $parentInstance: this }; }, "provide") }; -function _typeof$1$1(o) { +function _typeof$1$1(o2) { "@babel/helpers - typeof"; - return _typeof$1$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { - return typeof o2; - } : function(o2) { - return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; - }, _typeof$1$1(o); + return _typeof$1$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { + return typeof o3; + } : function(o3) { + return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; + }, _typeof$1$1(o2); } __name(_typeof$1$1, "_typeof$1$1"); -function _createForOfIteratorHelper$1$1(r, e2) { - var t2 = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; +function _createForOfIteratorHelper$1$1(r2, e2) { + var t2 = "undefined" != typeof Symbol && r2[Symbol.iterator] || r2["@@iterator"]; if (!t2) { - if (Array.isArray(r) || (t2 = _unsupportedIterableToArray$1$1(r)) || e2) { - t2 && (r = t2); - var _n = 0, F = /* @__PURE__ */ __name(function F2() { + if (Array.isArray(r2) || (t2 = _unsupportedIterableToArray$1$1(r2)) || e2) { + t2 && (r2 = t2); + var _n = 0, F2 = /* @__PURE__ */ __name(function F3() { }, "F"); - return { s: F, n: /* @__PURE__ */ __name(function n() { - return _n >= r.length ? { done: true } : { done: false, value: r[_n++] }; - }, "n"), e: /* @__PURE__ */ __name(function e3(r2) { - throw r2; - }, "e"), f: F }; + return { s: F2, n: /* @__PURE__ */ __name(function n2() { + return _n >= r2.length ? { done: true } : { done: false, value: r2[_n++] }; + }, "n"), e: /* @__PURE__ */ __name(function e3(r3) { + throw r3; + }, "e"), f: F2 }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - var o, a = true, u = false; - return { s: /* @__PURE__ */ __name(function s() { - t2 = t2.call(r); - }, "s"), n: /* @__PURE__ */ __name(function n() { - var r2 = t2.next(); - return a = r2.done, r2; - }, "n"), e: /* @__PURE__ */ __name(function e3(r2) { - u = true, o = r2; - }, "e"), f: /* @__PURE__ */ __name(function f() { + var o2, a2 = true, u2 = false; + return { s: /* @__PURE__ */ __name(function s2() { + t2 = t2.call(r2); + }, "s"), n: /* @__PURE__ */ __name(function n2() { + var r3 = t2.next(); + return a2 = r3.done, r3; + }, "n"), e: /* @__PURE__ */ __name(function e3(r3) { + u2 = true, o2 = r3; + }, "e"), f: /* @__PURE__ */ __name(function f2() { try { - a || null == t2["return"] || t2["return"](); + a2 || null == t2["return"] || t2["return"](); } finally { - if (u) throw o; + if (u2) throw o2; } }, "f") }; } __name(_createForOfIteratorHelper$1$1, "_createForOfIteratorHelper$1$1"); -function ownKeys$1$1(e2, r) { +function ownKeys$1$1(e2, r2) { var t2 = Object.keys(e2); if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e2); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e2, r2).enumerable; - })), t2.push.apply(t2, o); + var o2 = Object.getOwnPropertySymbols(e2); + r2 && (o2 = o2.filter(function(r3) { + return Object.getOwnPropertyDescriptor(e2, r3).enumerable; + })), t2.push.apply(t2, o2); } return t2; } __name(ownKeys$1$1, "ownKeys$1$1"); function _objectSpread$1$1(e2) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$1$1(Object(t2), true).forEach(function(r2) { - _defineProperty$1$1(e2, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$1$1(Object(t2)).forEach(function(r2) { - Object.defineProperty(e2, r2, Object.getOwnPropertyDescriptor(t2, r2)); + for (var r2 = 1; r2 < arguments.length; r2++) { + var t2 = null != arguments[r2] ? arguments[r2] : {}; + r2 % 2 ? ownKeys$1$1(Object(t2), true).forEach(function(r3) { + _defineProperty$1$1(e2, r3, t2[r3]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$1$1(Object(t2)).forEach(function(r3) { + Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3)); }); } return e2; } __name(_objectSpread$1$1, "_objectSpread$1$1"); -function _defineProperty$1$1(e2, r, t2) { - return (r = _toPropertyKey$1$1(r)) in e2 ? Object.defineProperty(e2, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r] = t2, e2; +function _defineProperty$1$1(e2, r2, t2) { + return (r2 = _toPropertyKey$1$1(r2)) in e2 ? Object.defineProperty(e2, r2, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r2] = t2, e2; } __name(_defineProperty$1$1, "_defineProperty$1$1"); function _toPropertyKey$1$1(t2) { @@ -175462,51 +203538,51 @@ function _toPropertyKey$1$1(t2) { return "symbol" == _typeof$1$1(i2) ? i2 : i2 + ""; } __name(_toPropertyKey$1$1, "_toPropertyKey$1$1"); -function _toPrimitive$1$1(t2, r) { +function _toPrimitive$1$1(t2, r2) { if ("object" != _typeof$1$1(t2) || !t2) return t2; var e2 = t2[Symbol.toPrimitive]; if (void 0 !== e2) { - var i2 = e2.call(t2, r || "default"); + var i2 = e2.call(t2, r2 || "default"); if ("object" != _typeof$1$1(i2)) return i2; throw new TypeError("@@toPrimitive must return a primitive value."); } - return ("string" === r ? String : Number)(t2); + return ("string" === r2 ? String : Number)(t2); } __name(_toPrimitive$1$1, "_toPrimitive$1$1"); -function _toConsumableArray$1$1(r) { - return _arrayWithoutHoles$1$1(r) || _iterableToArray$1$1(r) || _unsupportedIterableToArray$1$1(r) || _nonIterableSpread$1$1(); +function _toConsumableArray$1$1(r2) { + return _arrayWithoutHoles$1$1(r2) || _iterableToArray$1$1(r2) || _unsupportedIterableToArray$1$1(r2) || _nonIterableSpread$1$1(); } __name(_toConsumableArray$1$1, "_toConsumableArray$1$1"); function _nonIterableSpread$1$1() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } __name(_nonIterableSpread$1$1, "_nonIterableSpread$1$1"); -function _unsupportedIterableToArray$1$1(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray$1$1(r, a); - var t2 = {}.toString.call(r).slice(8, -1); - return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$1$1(r, a) : void 0; +function _unsupportedIterableToArray$1$1(r2, a2) { + if (r2) { + if ("string" == typeof r2) return _arrayLikeToArray$1$1(r2, a2); + var t2 = {}.toString.call(r2).slice(8, -1); + return "Object" === t2 && r2.constructor && (t2 = r2.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r2) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$1$1(r2, a2) : void 0; } } __name(_unsupportedIterableToArray$1$1, "_unsupportedIterableToArray$1$1"); -function _iterableToArray$1$1(r) { - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); +function _iterableToArray$1$1(r2) { + if ("undefined" != typeof Symbol && null != r2[Symbol.iterator] || null != r2["@@iterator"]) return Array.from(r2); } __name(_iterableToArray$1$1, "_iterableToArray$1$1"); -function _arrayWithoutHoles$1$1(r) { - if (Array.isArray(r)) return _arrayLikeToArray$1$1(r); +function _arrayWithoutHoles$1$1(r2) { + if (Array.isArray(r2)) return _arrayLikeToArray$1$1(r2); } __name(_arrayWithoutHoles$1$1, "_arrayWithoutHoles$1$1"); -function _arrayLikeToArray$1$1(r, a) { - (null == a || a > r.length) && (a = r.length); - for (var e2 = 0, n = Array(a); e2 < a; e2++) n[e2] = r[e2]; - return n; +function _arrayLikeToArray$1$1(r2, a2) { + (null == a2 || a2 > r2.length) && (a2 = r2.length); + for (var e2 = 0, n2 = Array(a2); e2 < a2; e2++) n2[e2] = r2[e2]; + return n2; } __name(_arrayLikeToArray$1$1, "_arrayLikeToArray$1$1"); var script$1$7 = { name: "TreeNode", hostName: "Tree", - "extends": script$_, + "extends": script$11, emits: ["node-toggle", "node-click", "checkbox-change"], props: { node: { @@ -175541,11 +203617,11 @@ var script$1$7 = { }, nodeTouched: false, toggleClicked: false, - mounted: /* @__PURE__ */ __name(function mounted16() { + mounted: /* @__PURE__ */ __name(function mounted18() { this.setAllNodesTabIndexes(); }, "mounted"), methods: { - toggle: /* @__PURE__ */ __name(function toggle2() { + toggle: /* @__PURE__ */ __name(function toggle3() { this.$emit("node-toggle", this.node); this.toggleClicked = true; }, "toggle"), @@ -175590,7 +203666,7 @@ var script$1$7 = { onTouchEnd: /* @__PURE__ */ __name(function onTouchEnd2() { this.nodeTouched = true; }, "onTouchEnd"), - onKeyDown: /* @__PURE__ */ __name(function onKeyDown7(event) { + onKeyDown: /* @__PURE__ */ __name(function onKeyDown8(event) { if (!this.isSameNode(event)) return; switch (event.code) { case "Tab": @@ -175855,12 +203931,12 @@ var script$1$7 = { }, "ariaSelected") }, components: { - Checkbox: script$c, - ChevronDownIcon: script$p, - ChevronRightIcon: script$u, - CheckIcon: script$K, - MinusIcon: script$d, - SpinnerIcon: script$T + Checkbox: script$I, + ChevronDownIcon: script$n, + ChevronRightIcon: script$s, + CheckIcon: script$J, + MinusIcon: script$N, + SpinnerIcon: script$W }, directives: { ripple: Ripple @@ -175991,102 +204067,102 @@ function render$1$1(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$1$1, "render$1$1"); script$1$7.render = render$1$1; -function _typeof$4(o) { +function _typeof$4(o2) { "@babel/helpers - typeof"; - return _typeof$4 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { - return typeof o2; - } : function(o2) { - return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; - }, _typeof$4(o); + return _typeof$4 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { + return typeof o3; + } : function(o3) { + return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; + }, _typeof$4(o2); } __name(_typeof$4, "_typeof$4"); -function _createForOfIteratorHelper$3(r, e2) { - var t2 = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; +function _createForOfIteratorHelper$3(r2, e2) { + var t2 = "undefined" != typeof Symbol && r2[Symbol.iterator] || r2["@@iterator"]; if (!t2) { - if (Array.isArray(r) || (t2 = _unsupportedIterableToArray$6(r)) || e2) { - t2 && (r = t2); - var _n = 0, F = /* @__PURE__ */ __name(function F2() { + if (Array.isArray(r2) || (t2 = _unsupportedIterableToArray$6(r2)) || e2) { + t2 && (r2 = t2); + var _n = 0, F2 = /* @__PURE__ */ __name(function F3() { }, "F"); - return { s: F, n: /* @__PURE__ */ __name(function n() { - return _n >= r.length ? { done: true } : { done: false, value: r[_n++] }; - }, "n"), e: /* @__PURE__ */ __name(function e3(r2) { - throw r2; - }, "e"), f: F }; + return { s: F2, n: /* @__PURE__ */ __name(function n2() { + return _n >= r2.length ? { done: true } : { done: false, value: r2[_n++] }; + }, "n"), e: /* @__PURE__ */ __name(function e3(r3) { + throw r3; + }, "e"), f: F2 }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - var o, a = true, u = false; - return { s: /* @__PURE__ */ __name(function s() { - t2 = t2.call(r); - }, "s"), n: /* @__PURE__ */ __name(function n() { - var r2 = t2.next(); - return a = r2.done, r2; - }, "n"), e: /* @__PURE__ */ __name(function e3(r2) { - u = true, o = r2; - }, "e"), f: /* @__PURE__ */ __name(function f() { + var o2, a2 = true, u2 = false; + return { s: /* @__PURE__ */ __name(function s2() { + t2 = t2.call(r2); + }, "s"), n: /* @__PURE__ */ __name(function n2() { + var r3 = t2.next(); + return a2 = r3.done, r3; + }, "n"), e: /* @__PURE__ */ __name(function e3(r3) { + u2 = true, o2 = r3; + }, "e"), f: /* @__PURE__ */ __name(function f2() { try { - a || null == t2["return"] || t2["return"](); + a2 || null == t2["return"] || t2["return"](); } finally { - if (u) throw o; + if (u2) throw o2; } }, "f") }; } __name(_createForOfIteratorHelper$3, "_createForOfIteratorHelper$3"); -function _toConsumableArray$4(r) { - return _arrayWithoutHoles$4(r) || _iterableToArray$4(r) || _unsupportedIterableToArray$6(r) || _nonIterableSpread$4(); +function _toConsumableArray$4(r2) { + return _arrayWithoutHoles$4(r2) || _iterableToArray$4(r2) || _unsupportedIterableToArray$6(r2) || _nonIterableSpread$4(); } __name(_toConsumableArray$4, "_toConsumableArray$4"); function _nonIterableSpread$4() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } __name(_nonIterableSpread$4, "_nonIterableSpread$4"); -function _unsupportedIterableToArray$6(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray$6(r, a); - var t2 = {}.toString.call(r).slice(8, -1); - return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$6(r, a) : void 0; +function _unsupportedIterableToArray$6(r2, a2) { + if (r2) { + if ("string" == typeof r2) return _arrayLikeToArray$6(r2, a2); + var t2 = {}.toString.call(r2).slice(8, -1); + return "Object" === t2 && r2.constructor && (t2 = r2.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r2) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$6(r2, a2) : void 0; } } __name(_unsupportedIterableToArray$6, "_unsupportedIterableToArray$6"); -function _iterableToArray$4(r) { - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); +function _iterableToArray$4(r2) { + if ("undefined" != typeof Symbol && null != r2[Symbol.iterator] || null != r2["@@iterator"]) return Array.from(r2); } __name(_iterableToArray$4, "_iterableToArray$4"); -function _arrayWithoutHoles$4(r) { - if (Array.isArray(r)) return _arrayLikeToArray$6(r); +function _arrayWithoutHoles$4(r2) { + if (Array.isArray(r2)) return _arrayLikeToArray$6(r2); } __name(_arrayWithoutHoles$4, "_arrayWithoutHoles$4"); -function _arrayLikeToArray$6(r, a) { - (null == a || a > r.length) && (a = r.length); - for (var e2 = 0, n = Array(a); e2 < a; e2++) n[e2] = r[e2]; - return n; +function _arrayLikeToArray$6(r2, a2) { + (null == a2 || a2 > r2.length) && (a2 = r2.length); + for (var e2 = 0, n2 = Array(a2); e2 < a2; e2++) n2[e2] = r2[e2]; + return n2; } __name(_arrayLikeToArray$6, "_arrayLikeToArray$6"); -function ownKeys$6(e2, r) { +function ownKeys$6(e2, r2) { var t2 = Object.keys(e2); if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e2); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e2, r2).enumerable; - })), t2.push.apply(t2, o); + var o2 = Object.getOwnPropertySymbols(e2); + r2 && (o2 = o2.filter(function(r3) { + return Object.getOwnPropertyDescriptor(e2, r3).enumerable; + })), t2.push.apply(t2, o2); } return t2; } __name(ownKeys$6, "ownKeys$6"); function _objectSpread$6(e2) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$6(Object(t2), true).forEach(function(r2) { - _defineProperty$4(e2, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$6(Object(t2)).forEach(function(r2) { - Object.defineProperty(e2, r2, Object.getOwnPropertyDescriptor(t2, r2)); + for (var r2 = 1; r2 < arguments.length; r2++) { + var t2 = null != arguments[r2] ? arguments[r2] : {}; + r2 % 2 ? ownKeys$6(Object(t2), true).forEach(function(r3) { + _defineProperty$4(e2, r3, t2[r3]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$6(Object(t2)).forEach(function(r3) { + Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3)); }); } return e2; } __name(_objectSpread$6, "_objectSpread$6"); -function _defineProperty$4(e2, r, t2) { - return (r = _toPropertyKey$3(r)) in e2 ? Object.defineProperty(e2, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r] = t2, e2; +function _defineProperty$4(e2, r2, t2) { + return (r2 = _toPropertyKey$3(r2)) in e2 ? Object.defineProperty(e2, r2, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r2] = t2, e2; } __name(_defineProperty$4, "_defineProperty$4"); function _toPropertyKey$3(t2) { @@ -176094,15 +204170,15 @@ function _toPropertyKey$3(t2) { return "symbol" == _typeof$4(i2) ? i2 : i2 + ""; } __name(_toPropertyKey$3, "_toPropertyKey$3"); -function _toPrimitive$3(t2, r) { +function _toPrimitive$3(t2, r2) { if ("object" != _typeof$4(t2) || !t2) return t2; var e2 = t2[Symbol.toPrimitive]; if (void 0 !== e2) { - var i2 = e2.call(t2, r || "default"); + var i2 = e2.call(t2, r2 || "default"); if ("object" != _typeof$4(i2)) return i2; throw new TypeError("@@toPrimitive must return a primitive value."); } - return ("string" === r ? String : Number)(t2); + return ("string" === r2 ? String : Number)(t2); } __name(_toPrimitive$3, "_toPrimitive$3"); var script$b = { @@ -176110,7 +204186,7 @@ var script$b = { "extends": script$2$1, inheritAttrs: false, emits: ["node-expand", "node-collapse", "update:expandedKeys", "update:selectionKeys", "node-select", "node-unselect", "filter"], - data: /* @__PURE__ */ __name(function data17() { + data: /* @__PURE__ */ __name(function data18() { return { d_expandedKeys: this.expandedKeys || {}, filterValue: null @@ -176309,11 +204385,11 @@ var script$b = { }, components: { TreeNode: script$1$7, - InputText: script$G, - InputIcon: script$H, - IconField: script$I, - SearchIcon: script$J, - SpinnerIcon: script$T + InputText: script$O, + InputIcon: script$E, + IconField: script$F, + SearchIcon: script$G, + SpinnerIcon: script$W } }; var _hoisted_1$p = ["aria-labelledby", "aria-label"]; @@ -176405,7 +204481,7 @@ function render$a(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$a, "render$a"); script$b.render = render$a; -const _withScopeId$b = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-d670c40f"), n = n(), popScopeId(), n), "_withScopeId$b"); +const _withScopeId$b = /* @__PURE__ */ __name((n2) => (pushScopeId("data-v-d670c40f"), n2 = n2(), popScopeId(), n2), "_withScopeId$b"); const _hoisted_1$o = { class: "editable-text" }; const _hoisted_2$g = { key: 0 }; const _sfc_main$q = /* @__PURE__ */ defineComponent({ @@ -176448,7 +204524,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({ }; return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1$o, [ - !props.isEditing ? (openBlock(), createElementBlock("span", _hoisted_2$g, toDisplayString$1(_ctx.modelValue), 1)) : withDirectives((openBlock(), createBlock(unref(script$G), { + !props.isEditing ? (openBlock(), createElementBlock("span", _hoisted_2$g, toDisplayString$1(_ctx.modelValue), 1)) : withDirectives((openBlock(), createBlock(unref(script$O), { key: 1, type: "text", size: "small", @@ -176473,43 +204549,43 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({ } }); const EditableText = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__scopeId", "data-v-d670c40f"]]); -function _arrayWithHoles(r) { - if (Array.isArray(r)) return r; +function _arrayWithHoles(r2) { + if (Array.isArray(r2)) return r2; } __name(_arrayWithHoles, "_arrayWithHoles"); -function _iterableToArrayLimit(r, l) { - var t2 = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; +function _iterableToArrayLimit(r2, l2) { + var t2 = null == r2 ? null : "undefined" != typeof Symbol && r2[Symbol.iterator] || r2["@@iterator"]; if (null != t2) { - var e2, n, i2, u, a = [], f = true, o = false; + var e2, n2, i2, u2, a2 = [], f2 = true, o2 = false; try { - if (i2 = (t2 = t2.call(r)).next, 0 === l) { + if (i2 = (t2 = t2.call(r2)).next, 0 === l2) { if (Object(t2) !== t2) return; - f = false; - } else for (; !(f = (e2 = i2.call(t2)).done) && (a.push(e2.value), a.length !== l); f = true) ; - } catch (r2) { - o = true, n = r2; + f2 = false; + } else for (; !(f2 = (e2 = i2.call(t2)).done) && (a2.push(e2.value), a2.length !== l2); f2 = true) ; + } catch (r3) { + o2 = true, n2 = r3; } finally { try { - if (!f && null != t2["return"] && (u = t2["return"](), Object(u) !== u)) return; + if (!f2 && null != t2["return"] && (u2 = t2["return"](), Object(u2) !== u2)) return; } finally { - if (o) throw n; + if (o2) throw n2; } } - return a; + return a2; } } __name(_iterableToArrayLimit, "_iterableToArrayLimit"); -function _arrayLikeToArray$5(r, a) { - (null == a || a > r.length) && (a = r.length); - for (var e2 = 0, n = Array(a); e2 < a; e2++) n[e2] = r[e2]; - return n; +function _arrayLikeToArray$5(r2, a2) { + (null == a2 || a2 > r2.length) && (a2 = r2.length); + for (var e2 = 0, n2 = Array(a2); e2 < a2; e2++) n2[e2] = r2[e2]; + return n2; } __name(_arrayLikeToArray$5, "_arrayLikeToArray$5"); -function _unsupportedIterableToArray$5(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray$5(r, a); - var t2 = {}.toString.call(r).slice(8, -1); - return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$5(r, a) : void 0; +function _unsupportedIterableToArray$5(r2, a2) { + if (r2) { + if ("string" == typeof r2) return _arrayLikeToArray$5(r2, a2); + var t2 = {}.toString.call(r2).slice(8, -1); + return "Object" === t2 && r2.constructor && (t2 = r2.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r2) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$5(r2, a2) : void 0; } } __name(_unsupportedIterableToArray$5, "_unsupportedIterableToArray$5"); @@ -176517,8 +204593,8 @@ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } __name(_nonIterableRest, "_nonIterableRest"); -function _slicedToArray(r, e2) { - return _arrayWithHoles(r) || _iterableToArrayLimit(r, e2) || _unsupportedIterableToArray$5(r, e2) || _nonIterableRest(); +function _slicedToArray(r2, e2) { + return _arrayWithHoles(r2) || _iterableToArrayLimit(r2, e2) || _unsupportedIterableToArray$5(r2, e2) || _nonIterableRest(); } __name(_slicedToArray, "_slicedToArray"); var dist = {}; @@ -176539,10 +204615,10 @@ var bindAll$1 = {}; "use strict"; var __assign = commonjsGlobal && commonjsGlobal.__assign || function() { __assign = Object.assign || function(t2) { - for (var s, i2 = 1, n = arguments.length; i2 < n; i2++) { - s = arguments[i2]; - for (var p2 in s) if (Object.prototype.hasOwnProperty.call(s, p2)) - t2[p2] = s[p2]; + for (var s2, i2 = 1, n2 = arguments.length; i2 < n2; i2++) { + s2 = arguments[i2]; + for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2)) + t2[p2] = s2[p2]; } return t2; }; @@ -176614,24 +204690,24 @@ function getElementFromPointWithoutHoneypot(client) { return top; } __name(getElementFromPointWithoutHoneypot, "getElementFromPointWithoutHoneypot"); -function _typeof$3(o) { +function _typeof$3(o2) { "@babel/helpers - typeof"; - return _typeof$3 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { - return typeof o2; - } : function(o2) { - return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; - }, _typeof$3(o); + return _typeof$3 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { + return typeof o3; + } : function(o3) { + return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; + }, _typeof$3(o2); } __name(_typeof$3, "_typeof$3"); -function toPrimitive(t2, r) { +function toPrimitive(t2, r2) { if ("object" != _typeof$3(t2) || !t2) return t2; var e2 = t2[Symbol.toPrimitive]; if (void 0 !== e2) { - var i2 = e2.call(t2, r || "default"); + var i2 = e2.call(t2, r2 || "default"); if ("object" != _typeof$3(i2)) return i2; throw new TypeError("@@toPrimitive must return a primitive value."); } - return ("string" === r ? String : Number)(t2); + return ("string" === r2 ? String : Number)(t2); } __name(toPrimitive, "toPrimitive"); function toPropertyKey(t2) { @@ -176639,34 +204715,34 @@ function toPropertyKey(t2) { return "symbol" == _typeof$3(i2) ? i2 : i2 + ""; } __name(toPropertyKey, "toPropertyKey"); -function _defineProperty$3(e2, r, t2) { - return (r = toPropertyKey(r)) in e2 ? Object.defineProperty(e2, r, { +function _defineProperty$3(e2, r2, t2) { + return (r2 = toPropertyKey(r2)) in e2 ? Object.defineProperty(e2, r2, { value: t2, enumerable: true, configurable: true, writable: true - }) : e2[r] = t2, e2; + }) : e2[r2] = t2, e2; } __name(_defineProperty$3, "_defineProperty$3"); var maxZIndex = 2147483647; -function ownKeys$5(e2, r) { +function ownKeys$5(e2, r2) { var t2 = Object.keys(e2); if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e2); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e2, r2).enumerable; - })), t2.push.apply(t2, o); + var o2 = Object.getOwnPropertySymbols(e2); + r2 && (o2 = o2.filter(function(r3) { + return Object.getOwnPropertyDescriptor(e2, r3).enumerable; + })), t2.push.apply(t2, o2); } return t2; } __name(ownKeys$5, "ownKeys$5"); function _objectSpread$5(e2) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$5(Object(t2), true).forEach(function(r2) { - _defineProperty$3(e2, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$5(Object(t2)).forEach(function(r2) { - Object.defineProperty(e2, r2, Object.getOwnPropertyDescriptor(t2, r2)); + for (var r2 = 1; r2 < arguments.length; r2++) { + var t2 = null != arguments[r2] ? arguments[r2] : {}; + r2 % 2 ? ownKeys$5(Object(t2), true).forEach(function(r3) { + _defineProperty$3(e2, r3, t2[r3]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$5(Object(t2)).forEach(function(r3) { + Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3)); }); } return e2; @@ -176895,20 +204971,20 @@ function makeHoneyPotFix() { }; } __name(makeHoneyPotFix, "makeHoneyPotFix"); -function _arrayWithoutHoles$3(r) { - if (Array.isArray(r)) return _arrayLikeToArray$5(r); +function _arrayWithoutHoles$3(r2) { + if (Array.isArray(r2)) return _arrayLikeToArray$5(r2); } __name(_arrayWithoutHoles$3, "_arrayWithoutHoles$3"); -function _iterableToArray$3(r) { - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); +function _iterableToArray$3(r2) { + if ("undefined" != typeof Symbol && null != r2[Symbol.iterator] || null != r2["@@iterator"]) return Array.from(r2); } __name(_iterableToArray$3, "_iterableToArray$3"); function _nonIterableSpread$3() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } __name(_nonIterableSpread$3, "_nonIterableSpread$3"); -function _toConsumableArray$3(r) { - return _arrayWithoutHoles$3(r) || _iterableToArray$3(r) || _unsupportedIterableToArray$5(r) || _nonIterableSpread$3(); +function _toConsumableArray$3(r2) { + return _arrayWithoutHoles$3(r2) || _iterableToArray$3(r2) || _unsupportedIterableToArray$5(r2) || _nonIterableSpread$3(); } __name(_toConsumableArray$3, "_toConsumableArray$3"); function once(fn) { @@ -177151,17 +205227,17 @@ var dragStart = /* @__PURE__ */ function() { }; } __name(schedule, "schedule"); - function flush() { + function flush2() { if (scheduled) { cancelAnimationFrame(scheduled.frameId); scheduled.fn(); scheduled = null; } } - __name(flush, "flush"); + __name(flush2, "flush"); return { schedule, - flush + flush: flush2 }; }(); function makeDispatch(_ref) { @@ -177537,73 +205613,73 @@ function addAttribute(element, _ref) { }; } __name(addAttribute, "addAttribute"); -function ownKeys$4(e2, r) { +function ownKeys$4(e2, r2) { var t2 = Object.keys(e2); if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e2); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e2, r2).enumerable; - })), t2.push.apply(t2, o); + var o2 = Object.getOwnPropertySymbols(e2); + r2 && (o2 = o2.filter(function(r22) { + return Object.getOwnPropertyDescriptor(e2, r22).enumerable; + })), t2.push.apply(t2, o2); } return t2; } __name(ownKeys$4, "ownKeys$4"); function _objectSpread$4(e2) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$4(Object(t2), true).forEach(function(r2) { - _defineProperty$3(e2, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$4(Object(t2)).forEach(function(r2) { - Object.defineProperty(e2, r2, Object.getOwnPropertyDescriptor(t2, r2)); + for (var r2 = 1; r2 < arguments.length; r2++) { + var t2 = null != arguments[r2] ? arguments[r2] : {}; + r2 % 2 ? ownKeys$4(Object(t2), true).forEach(function(r22) { + _defineProperty$3(e2, r22, t2[r22]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$4(Object(t2)).forEach(function(r22) { + Object.defineProperty(e2, r22, Object.getOwnPropertyDescriptor(t2, r22)); }); } return e2; } __name(_objectSpread$4, "_objectSpread$4"); -function _createForOfIteratorHelper$2(r, e2) { - var t2 = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; +function _createForOfIteratorHelper$2(r2, e2) { + var t2 = "undefined" != typeof Symbol && r2[Symbol.iterator] || r2["@@iterator"]; if (!t2) { - if (Array.isArray(r) || (t2 = _unsupportedIterableToArray$4(r)) || e2 && r && "number" == typeof r.length) { - t2 && (r = t2); - var _n = 0, F = /* @__PURE__ */ __name(function F2() { + if (Array.isArray(r2) || (t2 = _unsupportedIterableToArray$4(r2)) || e2 && r2 && "number" == typeof r2.length) { + t2 && (r2 = t2); + var _n = 0, F2 = /* @__PURE__ */ __name(function F22() { }, "F2"); - return { s: F, n: /* @__PURE__ */ __name(function n() { - return _n >= r.length ? { done: true } : { done: false, value: r[_n++] }; - }, "n"), e: /* @__PURE__ */ __name(function e22(r2) { - throw r2; - }, "e2"), f: F }; + return { s: F2, n: /* @__PURE__ */ __name(function n2() { + return _n >= r2.length ? { done: true } : { done: false, value: r2[_n++] }; + }, "n"), e: /* @__PURE__ */ __name(function e22(r22) { + throw r22; + }, "e2"), f: F2 }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - var o, a = true, u = false; - return { s: /* @__PURE__ */ __name(function s() { - t2 = t2.call(r); - }, "s"), n: /* @__PURE__ */ __name(function n() { - var r2 = t2.next(); - return a = r2.done, r2; - }, "n"), e: /* @__PURE__ */ __name(function e22(r2) { - u = true, o = r2; - }, "e2"), f: /* @__PURE__ */ __name(function f() { + var o2, a2 = true, u2 = false; + return { s: /* @__PURE__ */ __name(function s2() { + t2 = t2.call(r2); + }, "s"), n: /* @__PURE__ */ __name(function n2() { + var r22 = t2.next(); + return a2 = r22.done, r22; + }, "n"), e: /* @__PURE__ */ __name(function e22(r22) { + u2 = true, o2 = r22; + }, "e2"), f: /* @__PURE__ */ __name(function f2() { try { - a || null == t2.return || t2.return(); + a2 || null == t2.return || t2.return(); } finally { - if (u) throw o; + if (u2) throw o2; } }, "f") }; } __name(_createForOfIteratorHelper$2, "_createForOfIteratorHelper$2"); -function _unsupportedIterableToArray$4(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray$4(r, a); - var t2 = {}.toString.call(r).slice(8, -1); - return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$4(r, a) : void 0; +function _unsupportedIterableToArray$4(r2, a2) { + if (r2) { + if ("string" == typeof r2) return _arrayLikeToArray$4(r2, a2); + var t2 = {}.toString.call(r2).slice(8, -1); + return "Object" === t2 && r2.constructor && (t2 = r2.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r2) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$4(r2, a2) : void 0; } } __name(_unsupportedIterableToArray$4, "_unsupportedIterableToArray$4"); -function _arrayLikeToArray$4(r, a) { - (null == a || a > r.length) && (a = r.length); - for (var e2 = 0, n = Array(a); e2 < a; e2++) n[e2] = r[e2]; - return n; +function _arrayLikeToArray$4(r2, a2) { + (null == a2 || a2 > r2.length) && (a2 = r2.length); + for (var e2 = 0, n2 = Array(a2); e2 < a2; e2++) n2[e2] = r2[e2]; + return n2; } __name(_arrayLikeToArray$4, "_arrayLikeToArray$4"); function copyReverse(array) { @@ -177679,10 +205755,10 @@ function makeDropTarget(_ref) { result }); } - var data24 = (_args$getData = (_args$getData2 = args.getData) === null || _args$getData2 === void 0 ? void 0 : _args$getData2.call(args, feedback)) !== null && _args$getData !== void 0 ? _args$getData : {}; + var data25 = (_args$getData = (_args$getData2 = args.getData) === null || _args$getData2 === void 0 ? void 0 : _args$getData2.call(args, feedback)) !== null && _args$getData !== void 0 ? _args$getData : {}; var dropEffect = (_args$getDropEffect = (_args$getDropEffect2 = args.getDropEffect) === null || _args$getDropEffect2 === void 0 ? void 0 : _args$getDropEffect2.call(args, feedback)) !== null && _args$getDropEffect !== void 0 ? _args$getDropEffect : defaultDropEffect; - var record = { - data: data24, + var record2 = { + data: data25, element: args.element, dropEffect, // we are collecting _actual_ drop targets, so these are @@ -177694,7 +205770,7 @@ function makeDropTarget(_ref) { target: args.element.parentElement, input, // Using bubble ordering. Same ordering as `event.getPath()` - result: [].concat(_toConsumableArray$3(result), [record]) + result: [].concat(_toConsumableArray$3(result), [record2]) }); } __name(getActualDropTargets, "getActualDropTargets"); @@ -177704,10 +205780,10 @@ function makeDropTarget(_ref) { try { for (_iterator.s(); !(_step = _iterator.n()).done; ) { var _entry$eventName; - var record = _step.value; - var entry = registry.get(record.element); + var record2 = _step.value; + var entry = registry.get(record2.element); var args = _objectSpread$4(_objectSpread$4({}, payload), {}, { - self: record + self: record2 }); entry === null || entry === void 0 || (_entry$eventName = entry[eventName]) === null || _entry$eventName === void 0 || _entry$eventName.call( entry, @@ -177731,20 +205807,20 @@ function makeDropTarget(_ref) { onDrop: notifyCurrent, onDropTargetChange: /* @__PURE__ */ __name(function onDropTargetChange(_ref4) { var payload = _ref4.payload; - var isCurrent = new Set(payload.location.current.dropTargets.map(function(record2) { - return record2.element; + var isCurrent = new Set(payload.location.current.dropTargets.map(function(record22) { + return record22.element; })); var visited = /* @__PURE__ */ new Set(); var _iterator2 = _createForOfIteratorHelper$2(payload.location.previous.dropTargets), _step2; try { for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) { var _entry$onDropTargetCh; - var record = _step2.value; - visited.add(record.element); - var entry = registry.get(record.element); - var isOver = isCurrent.has(record.element); + var record2 = _step2.value; + visited.add(record2.element); + var entry = registry.get(record2.element); + var isOver = isCurrent.has(record2.element); var args = _objectSpread$4(_objectSpread$4({}, payload), {}, { - self: record + self: record2 }); entry === null || entry === void 0 || (_entry$onDropTargetCh = entry.onDropTargetChange) === null || _entry$onDropTargetCh === void 0 || _entry$onDropTargetCh.call(entry, args); if (!isOver) { @@ -177839,70 +205915,70 @@ function makeDropTarget(_ref) { }; } __name(makeDropTarget, "makeDropTarget"); -function _createForOfIteratorHelper$1(r, e2) { - var t2 = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; +function _createForOfIteratorHelper$1(r2, e2) { + var t2 = "undefined" != typeof Symbol && r2[Symbol.iterator] || r2["@@iterator"]; if (!t2) { - if (Array.isArray(r) || (t2 = _unsupportedIterableToArray$3(r)) || e2 && r && "number" == typeof r.length) { - t2 && (r = t2); - var _n = 0, F = /* @__PURE__ */ __name(function F2() { + if (Array.isArray(r2) || (t2 = _unsupportedIterableToArray$3(r2)) || e2 && r2 && "number" == typeof r2.length) { + t2 && (r2 = t2); + var _n = 0, F2 = /* @__PURE__ */ __name(function F3() { }, "F"); - return { s: F, n: /* @__PURE__ */ __name(function n() { - return _n >= r.length ? { done: true } : { done: false, value: r[_n++] }; - }, "n"), e: /* @__PURE__ */ __name(function e3(r2) { - throw r2; - }, "e"), f: F }; + return { s: F2, n: /* @__PURE__ */ __name(function n2() { + return _n >= r2.length ? { done: true } : { done: false, value: r2[_n++] }; + }, "n"), e: /* @__PURE__ */ __name(function e3(r3) { + throw r3; + }, "e"), f: F2 }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - var o, a = true, u = false; - return { s: /* @__PURE__ */ __name(function s() { - t2 = t2.call(r); - }, "s"), n: /* @__PURE__ */ __name(function n() { - var r2 = t2.next(); - return a = r2.done, r2; - }, "n"), e: /* @__PURE__ */ __name(function e3(r2) { - u = true, o = r2; - }, "e"), f: /* @__PURE__ */ __name(function f() { + var o2, a2 = true, u2 = false; + return { s: /* @__PURE__ */ __name(function s2() { + t2 = t2.call(r2); + }, "s"), n: /* @__PURE__ */ __name(function n2() { + var r3 = t2.next(); + return a2 = r3.done, r3; + }, "n"), e: /* @__PURE__ */ __name(function e3(r3) { + u2 = true, o2 = r3; + }, "e"), f: /* @__PURE__ */ __name(function f2() { try { - a || null == t2.return || t2.return(); + a2 || null == t2.return || t2.return(); } finally { - if (u) throw o; + if (u2) throw o2; } }, "f") }; } __name(_createForOfIteratorHelper$1, "_createForOfIteratorHelper$1"); -function _unsupportedIterableToArray$3(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray$3(r, a); - var t2 = {}.toString.call(r).slice(8, -1); - return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$3(r, a) : void 0; +function _unsupportedIterableToArray$3(r2, a2) { + if (r2) { + if ("string" == typeof r2) return _arrayLikeToArray$3(r2, a2); + var t2 = {}.toString.call(r2).slice(8, -1); + return "Object" === t2 && r2.constructor && (t2 = r2.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r2) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$3(r2, a2) : void 0; } } __name(_unsupportedIterableToArray$3, "_unsupportedIterableToArray$3"); -function _arrayLikeToArray$3(r, a) { - (null == a || a > r.length) && (a = r.length); - for (var e2 = 0, n = Array(a); e2 < a; e2++) n[e2] = r[e2]; - return n; +function _arrayLikeToArray$3(r2, a2) { + (null == a2 || a2 > r2.length) && (a2 = r2.length); + for (var e2 = 0, n2 = Array(a2); e2 < a2; e2++) n2[e2] = r2[e2]; + return n2; } __name(_arrayLikeToArray$3, "_arrayLikeToArray$3"); -function ownKeys$3(e2, r) { +function ownKeys$3(e2, r2) { var t2 = Object.keys(e2); if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e2); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e2, r2).enumerable; - })), t2.push.apply(t2, o); + var o2 = Object.getOwnPropertySymbols(e2); + r2 && (o2 = o2.filter(function(r3) { + return Object.getOwnPropertyDescriptor(e2, r3).enumerable; + })), t2.push.apply(t2, o2); } return t2; } __name(ownKeys$3, "ownKeys$3"); function _objectSpread$3(e2) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$3(Object(t2), true).forEach(function(r2) { - _defineProperty$3(e2, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$3(Object(t2)).forEach(function(r2) { - Object.defineProperty(e2, r2, Object.getOwnPropertyDescriptor(t2, r2)); + for (var r2 = 1; r2 < arguments.length; r2++) { + var t2 = null != arguments[r2] ? arguments[r2] : {}; + r2 % 2 ? ownKeys$3(Object(t2), true).forEach(function(r3) { + _defineProperty$3(e2, r3, t2[r3]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$3(Object(t2)).forEach(function(r3) { + Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3)); }); } return e2; @@ -178090,8 +206166,8 @@ var adapter = makeAdapter({ var nativeData = (_entry$getInitialData = (_entry$getInitialData2 = entry.getInitialDataForExternal) === null || _entry$getInitialData2 === void 0 ? void 0 : _entry$getInitialData2.call(entry, feedback)) !== null && _entry$getInitialData !== void 0 ? _entry$getInitialData : null; if (nativeData) { for (var _i = 0, _Object$entries = Object.entries(nativeData); _i < _Object$entries.length; _i++) { - var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), key = _Object$entries$_i[0], data24 = _Object$entries$_i[1]; - event.dataTransfer.setData(key, data24 !== null && data24 !== void 0 ? data24 : ""); + var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), key = _Object$entries$_i[0], data25 = _Object$entries$_i[1]; + event.dataTransfer.setData(key, data25 !== null && data25 !== void 0 ? data25 : ""); } } if (isAndroid() && !event.dataTransfer.types.includes(textMediaType) && !event.dataTransfer.types.includes(URLMediaType)) { @@ -178198,7 +206274,7 @@ function usePragmaticDraggable(draggableElement, options4) { }); } __name(usePragmaticDraggable, "usePragmaticDraggable"); -const _withScopeId$a = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-a6457774"), n = n(), popScopeId(), n), "_withScopeId$a"); +const _withScopeId$a = /* @__PURE__ */ __name((n2) => (pushScopeId("data-v-a6457774"), n2 = n2(), popScopeId(), n2), "_withScopeId$a"); const _hoisted_1$n = { class: "node-content" }; const _hoisted_2$f = { class: "node-label" }; const _hoisted_3$9 = { class: "node-actions" }; @@ -178299,7 +206375,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({ node: props.node }, void 0, true) ]), - showNodeBadgeText.value ? (openBlock(), createBlock(unref(script$S), { + showNodeBadgeText.value ? (openBlock(), createBlock(unref(script$V), { key: 0, value: nodeBadgeText.value, severity: "secondary", @@ -178471,7 +206547,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({ ]), _: 3 }, 8, ["class", "expandedKeys", "selectionKeys", "value", "pt"]), - createVNode(unref(script$e), { + createVNode(unref(script$c), { ref_key: "menu", ref: menu2, model: menuItems.value @@ -178481,7 +206557,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({ } }); const TreeExplorer = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-31d518da"]]); -var theme$6 = /* @__PURE__ */ __name(function theme33(_ref) { +var theme$6 = /* @__PURE__ */ __name(function theme35(_ref) { var dt2 = _ref.dt; return "\n.p-toolbar {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-wrap: wrap;\n padding: ".concat(dt2("toolbar.padding"), ";\n background: ").concat(dt2("toolbar.background"), ";\n border: 1px solid ").concat(dt2("toolbar.border.color"), ";\n color: ").concat(dt2("toolbar.color"), ";\n border-radius: ").concat(dt2("toolbar.border.radius"), ";\n gap: ").concat(dt2("toolbar.gap"), ";\n}\n\n.p-toolbar-start,\n.p-toolbar-center,\n.p-toolbar-end {\n display: flex;\n align-items: center;\n}\n"); }, "theme"); @@ -178498,7 +206574,7 @@ var ToolbarStyle = BaseStyle.extend({ }); var script$1$6 = { name: "BaseToolbar", - "extends": script$_, + "extends": script$11, props: { ariaLabelledby: { type: String, @@ -178506,7 +206582,7 @@ var script$1$6 = { } }, style: ToolbarStyle, - provide: /* @__PURE__ */ __name(function provide35() { + provide: /* @__PURE__ */ __name(function provide37() { return { $pcToolbar: this, $parentInstance: this @@ -178534,9 +206610,9 @@ function render$9(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$9, "render$9"); script$a.render = render$9; -const _withScopeId$9 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-9159c070"), n = n(), popScopeId(), n), "_withScopeId$9"); +const _withScopeId$9 = /* @__PURE__ */ __name((n2) => (pushScopeId("data-v-5e759e25"), n2 = n2(), popScopeId(), n2), "_withScopeId$9"); const _hoisted_1$l = { class: "comfy-vue-side-bar-header" }; -const _hoisted_2$e = { class: "text-sm" }; +const _hoisted_2$e = ["title"]; const _sfc_main$n = /* @__PURE__ */ defineComponent({ __name: "SidebarTabTemplate", props: { @@ -178550,9 +206626,12 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({ class: normalizeClass(["comfy-vue-side-bar-container flex flex-col h-full", props.class]) }, [ createBaseVNode("div", _hoisted_1$l, [ - createVNode(unref(script$a), { class: "flex-shrink-0 border-x-0 border-t-0 rounded-none px-2 py-1 min-h-8" }, { + createVNode(unref(script$a), { class: "border-x-0 border-t-0 rounded-none px-2 py-1 min-h-8" }, { start: withCtx(() => [ - createBaseVNode("span", _hoisted_2$e, toDisplayString$1(props.title.toUpperCase()), 1) + createBaseVNode("span", { + class: "text-xs 2xl:text-sm truncate", + title: props.title + }, toDisplayString$1(props.title.toUpperCase()), 9, _hoisted_2$e) ]), end: withCtx(() => [ renderSlot(_ctx.$slots, "tool-buttons", {}, void 0, true) @@ -178561,7 +206640,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({ }), renderSlot(_ctx.$slots, "header", {}, void 0, true) ]), - createVNode(unref(script$N), { class: "comfy-vue-side-bar-body flex-grow h-0" }, { + createVNode(unref(script$Q), { class: "comfy-vue-side-bar-body flex-grow h-0" }, { default: withCtx(() => [ renderSlot(_ctx.$slots, "body", {}, void 0, true) ]), @@ -178571,7 +206650,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({ }; } }); -const SidebarTabTemplate = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__scopeId", "data-v-9159c070"]]); +const SidebarTabTemplate = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__scopeId", "data-v-5e759e25"]]); const _hoisted_1$k = { class: "flex flex-col" }; const _hoisted_2$d = { key: 0 }; const _hoisted_3$8 = { @@ -178609,7 +206688,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({ return openBlock(), createElementBlock("div", _hoisted_1$k, [ createBaseVNode("div", null, toDisplayString$1(getDownloadLabel(_ctx.download.savePath)), 1), ["cancelled", "error"].includes(_ctx.download.status) ? (openBlock(), createElementBlock("div", _hoisted_2$d, [ - createVNode(unref(script$y), { + createVNode(unref(script$w), { class: "h-6 text-sm font-light bg-red-700 mt-2", removable: "", onRemove: handleRemoveDownload @@ -178621,12 +206700,12 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({ }) ])) : createCommentVNode("", true), ["in_progress", "paused", "completed"].includes(_ctx.download.status) ? (openBlock(), createElementBlock("div", _hoisted_3$8, [ - createVNode(unref(script$D), { + createVNode(unref(script$B), { class: "flex-1", value: Number((_ctx.download.progress * 100).toFixed(1)), "show-value": _ctx.download.progress > 0.1 }, null, 8, ["value", "show-value"]), - _ctx.download.status === "in_progress" ? withDirectives((openBlock(), createBlock(unref(script$R), { + _ctx.download.status === "in_progress" ? withDirectives((openBlock(), createBlock(unref(script$U), { key: 0, class: "file-action-button w-[22px] h-[22px]", size: "small", @@ -178641,7 +206720,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({ { top: true } ] ]) : createCommentVNode("", true), - _ctx.download.status === "paused" ? withDirectives((openBlock(), createBlock(unref(script$R), { + _ctx.download.status === "paused" ? withDirectives((openBlock(), createBlock(unref(script$U), { key: 1, class: "file-action-button w-[22px] h-[22px]", size: "small", @@ -178656,7 +206735,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({ { top: true } ] ]) : createCommentVNode("", true), - ["in_progress", "paused"].includes(_ctx.download.status) ? withDirectives((openBlock(), createBlock(unref(script$R), { + ["in_progress", "paused"].includes(_ctx.download.status) ? withDirectives((openBlock(), createBlock(unref(script$U), { key: 2, class: "file-action-button w-[22px] h-[22px] p-red", size: "small", @@ -178700,7 +206779,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({ }; } }); -const _withScopeId$8 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-32e6c4d9"), n = n(), popScopeId(), n), "_withScopeId$8"); +const _withScopeId$8 = /* @__PURE__ */ __name((n2) => (pushScopeId("data-v-32e6c4d9"), n2 = n2(), popScopeId(), n2), "_withScopeId$8"); const _hoisted_1$i = { class: "model_preview" }; const _hoisted_2$b = { class: "model_preview_title" }; const _hoisted_3$7 = { class: "model_preview_top_container" }; @@ -178782,7 +206861,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({ } }); const ModelPreview = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__scopeId", "data-v-32e6c4d9"]]); -const _withScopeId$7 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-b45ea43e"), n = n(), popScopeId(), n), "_withScopeId$7"); +const _withScopeId$7 = /* @__PURE__ */ __name((n2) => (pushScopeId("data-v-b45ea43e"), n2 = n2(), popScopeId(), n2), "_withScopeId$7"); const _hoisted_1$h = { key: 0, class: "model-lib-model-icon-container" @@ -179008,7 +207087,7 @@ const useModelToNodeStore = /* @__PURE__ */ defineStore("modelToNode", () => { registerDefaults }; }); -const _withScopeId$6 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-0bb2ac55"), n = n(), popScopeId(), n), "_withScopeId$6"); +const _withScopeId$6 = /* @__PURE__ */ __name((n2) => (pushScopeId("data-v-0bb2ac55"), n2 = n2(), popScopeId(), n2), "_withScopeId$6"); const _hoisted_1$g = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ createBaseVNode("div", { id: "model-library-model-preview-container" }, null, -1)); const _sfc_main$i = /* @__PURE__ */ defineComponent({ __name: "ModelLibrarySidebarTab", @@ -179032,10 +207111,10 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({ return model.searchable.includes(search2); }); nextTick(() => { - expandNode(root24.value); + expandNode(root27.value); }); }, "handleSearch"); - const root24 = computed(() => { + const root27 = computed(() => { const allNodes = searchQuery.value ? filteredModels.value : [...modelStore.modelFolders, ...modelStore.models]; return buildTree$1( allNodes, @@ -179088,7 +207167,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({ }, "handleClick") }; }, "fillNodeInfo"); - return fillNodeInfo(root24.value); + return fillNodeInfo(root27.value); }); watch( toRef$1(expandedKeys2, "value"), @@ -179117,7 +207196,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({ class: "bg-[var(--p-tree-background)]" }, { "tool-buttons": withCtx(() => [ - withDirectives(createVNode(unref(script$R), { + withDirectives(createVNode(unref(script$U), { icon: "pi pi-refresh", onClick: unref(modelStore).loadModelFolders, severity: "secondary", @@ -179130,7 +207209,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({ { bottom: true } ] ]), - withDirectives(createVNode(unref(script$R), { + withDirectives(createVNode(unref(script$U), { icon: "pi pi-cloud-download", onClick: unref(modelStore).loadModels, severity: "secondary", @@ -179195,7 +207274,7 @@ const useModelLibrarySidebarTab = /* @__PURE__ */ __name(() => { }, "iconBadge") }; }, "useModelLibrarySidebarTab"); -var theme$5 = /* @__PURE__ */ __name(function theme34(_ref) { +var theme$5 = /* @__PURE__ */ __name(function theme36(_ref) { var dt2 = _ref.dt; return "\n.p-popover {\n margin-top: ".concat(dt2("popover.gutter"), ";\n background: ").concat(dt2("popover.background"), ";\n color: ").concat(dt2("popover.color"), ";\n border: 1px solid ").concat(dt2("popover.border.color"), ";\n border-radius: ").concat(dt2("popover.border.radius"), ";\n box-shadow: ").concat(dt2("popover.shadow"), ";\n}\n\n.p-popover-content {\n padding: ").concat(dt2("popover.content.padding"), ";\n}\n\n.p-popover-flipped {\n margin-top: calc(").concat(dt2("popover.gutter"), " * -1);\n margin-bottom: ").concat(dt2("popover.gutter"), ";\n}\n\n.p-popover-enter-from {\n opacity: 0;\n transform: scaleY(0.8);\n}\n\n.p-popover-leave-to {\n opacity: 0;\n}\n\n.p-popover-enter-active {\n transition: transform 0.12s cubic-bezier(0, 0, 0.2, 1), opacity 0.12s cubic-bezier(0, 0, 0.2, 1);\n}\n\n.p-popover-leave-active {\n transition: opacity 0.1s linear;\n}\n\n.p-popover:after,\n.p-popover:before {\n bottom: 100%;\n left: calc(").concat(dt2("popover.arrow.offset"), " + ").concat(dt2("popover.arrow.left"), ');\n content: " ";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n}\n\n.p-popover:after {\n border-width: calc(').concat(dt2("popover.gutter"), " - 2px);\n margin-left: calc(-1 * (").concat(dt2("popover.gutter"), " - 2px));\n border-style: solid;\n border-color: transparent;\n border-bottom-color: ").concat(dt2("popover.background"), ";\n}\n\n.p-popover:before {\n border-width: ").concat(dt2("popover.gutter"), ";\n margin-left: calc(-1 * ").concat(dt2("popover.gutter"), ");\n border-style: solid;\n border-color: transparent;\n border-bottom-color: ").concat(dt2("popover.border.color"), ";\n}\n\n.p-popover-flipped:after,\n.p-popover-flipped:before {\n bottom: auto;\n top: 100%;\n}\n\n.p-popover.p-popover-flipped:after {\n border-bottom-color: transparent;\n border-top-color: ").concat(dt2("popover.background"), ";\n}\n\n.p-popover.p-popover-flipped:before {\n border-bottom-color: transparent;\n border-top-color: ").concat(dt2("popover.border.color"), ";\n}\n"); }, "theme"); @@ -179210,7 +207289,7 @@ var PopoverStyle = BaseStyle.extend({ }); var script$1$5 = { name: "BasePopover", - "extends": script$_, + "extends": script$11, props: { dismissable: { type: Boolean, @@ -179238,7 +207317,7 @@ var script$1$5 = { } }, style: PopoverStyle, - provide: /* @__PURE__ */ __name(function provide36() { + provide: /* @__PURE__ */ __name(function provide38() { return { $pcPopover: this, $parentInstance: this @@ -179250,7 +207329,7 @@ var script$9 = { "extends": script$1$5, inheritAttrs: false, emits: ["show", "hide"], - data: /* @__PURE__ */ __name(function data18() { + data: /* @__PURE__ */ __name(function data19() { return { visible: false }; @@ -179297,13 +207376,13 @@ var script$9 = { } this.container = null; }, "beforeUnmount"), - mounted: /* @__PURE__ */ __name(function mounted17() { + mounted: /* @__PURE__ */ __name(function mounted19() { if (this.breakpoints) { this.createStyle(); } }, "mounted"), methods: { - toggle: /* @__PURE__ */ __name(function toggle3(event, target) { + toggle: /* @__PURE__ */ __name(function toggle4(event, target) { if (this.visible) this.hide(); else this.show(event, target); }, "toggle"), @@ -179396,7 +207475,7 @@ var script$9 = { focusTarget.focus(); } }, "focus"), - onKeyDown: /* @__PURE__ */ __name(function onKeyDown8(event) { + onKeyDown: /* @__PURE__ */ __name(function onKeyDown9(event) { if (event.code === "Escape" && this.closeOnEscape) { this.visible = false; } @@ -179508,7 +207587,7 @@ var script$9 = { ripple: Ripple }, components: { - Portal: script$Q + Portal: script$T } }; var _hoisted_1$f = ["aria-modal"]; @@ -179563,12 +207642,12 @@ function render$8(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$8, "render$8"); script$9.render = render$8; -var theme$4 = /* @__PURE__ */ __name(function theme35(_ref) { +var theme$4 = /* @__PURE__ */ __name(function theme37(_ref) { var dt2 = _ref.dt; return "\n.p-togglebutton {\n display: inline-flex;\n cursor: pointer;\n user-select: none;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n position: relative;\n color: ".concat(dt2("togglebutton.color"), ";\n background: ").concat(dt2("togglebutton.background"), ";\n border: 1px solid ").concat(dt2("togglebutton.border.color"), ";\n padding: ").concat(dt2("togglebutton.padding"), ";\n font-size: 1rem;\n font-family: inherit;\n font-feature-settings: inherit;\n transition: background ").concat(dt2("togglebutton.transition.duration"), ", color ").concat(dt2("togglebutton.transition.duration"), ", border-color ").concat(dt2("togglebutton.transition.duration"), ",\n outline-color ").concat(dt2("togglebutton.transition.duration"), ", box-shadow ").concat(dt2("togglebutton.transition.duration"), ";\n border-radius: ").concat(dt2("togglebutton.border.radius"), ";\n outline-color: transparent;\n font-weight: ").concat(dt2("togglebutton.font.weight"), ";\n}\n\n.p-togglebutton-content {\n position: relative;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: ").concat(dt2("togglebutton.gap"), ';\n}\n\n.p-togglebutton-label,\n.p-togglebutton-icon {\n position: relative;\n transition: none;\n}\n\n.p-togglebutton::before {\n content: "";\n background: transparent;\n transition: background ').concat(dt2("togglebutton.transition.duration"), ", color ").concat(dt2("togglebutton.transition.duration"), ", border-color ").concat(dt2("togglebutton.transition.duration"), ",\n outline-color ").concat(dt2("togglebutton.transition.duration"), ", box-shadow ").concat(dt2("togglebutton.transition.duration"), ";\n position: absolute;\n left: ").concat(dt2("togglebutton.content.left"), ";\n top: ").concat(dt2("togglebutton.content.top"), ";\n width: calc(100% - calc(2 * ").concat(dt2("togglebutton.content.left"), "));\n height: calc(100% - calc(2 * ").concat(dt2("togglebutton.content.top"), "));\n border-radius: ").concat(dt2("togglebutton.border.radius"), ";\n}\n\n.p-togglebutton.p-togglebutton-checked::before {\n background: ").concat(dt2("togglebutton.content.checked.background"), ";\n box-shadow: ").concat(dt2("togglebutton.content.checked.shadow"), ";\n}\n\n.p-togglebutton:not(:disabled):not(.p-togglebutton-checked):hover {\n background: ").concat(dt2("togglebutton.hover.background"), ";\n color: ").concat(dt2("togglebutton.hover.color"), ";\n}\n\n.p-togglebutton.p-togglebutton-checked {\n background: ").concat(dt2("togglebutton.checked.background"), ";\n border-color: ").concat(dt2("togglebutton.checked.border.color"), ";\n color: ").concat(dt2("togglebutton.checked.color"), ";\n}\n\n.p-togglebutton:focus-visible {\n box-shadow: ").concat(dt2("togglebutton.focus.ring.shadow"), ";\n outline: ").concat(dt2("togglebutton.focus.ring.width"), " ").concat(dt2("togglebutton.focus.ring.style"), " ").concat(dt2("togglebutton.focus.ring.color"), ";\n outline-offset: ").concat(dt2("togglebutton.focus.ring.offset"), ";\n}\n\n.p-togglebutton.p-invalid {\n border-color: ").concat(dt2("togglebutton.invalid.border.color"), ";\n}\n\n.p-togglebutton:disabled {\n opacity: 1;\n cursor: default;\n background: ").concat(dt2("togglebutton.disabled.background"), ";\n border-color: ").concat(dt2("togglebutton.disabled.border.color"), ";\n color: ").concat(dt2("togglebutton.disabled.color"), ";\n}\n\n.p-togglebutton-icon {\n color: ").concat(dt2("togglebutton.icon.color"), ";\n}\n\n.p-togglebutton:not(:disabled):not(.p-togglebutton-checked):hover .p-togglebutton-icon {\n color: ").concat(dt2("togglebutton.icon.hover.color"), ";\n}\n\n.p-togglebutton.p-togglebutton-checked .p-togglebutton-icon {\n color: ").concat(dt2("togglebutton.icon.checked.color"), ";\n}\n\n.p-togglebutton:disabled .p-togglebutton-icon {\n color: ").concat(dt2("togglebutton.icon.disabled.color"), ";\n}\n"); }, "theme"); var classes$4 = { - root: /* @__PURE__ */ __name(function root21(_ref2) { + root: /* @__PURE__ */ __name(function root24(_ref2) { var instance = _ref2.instance, props = _ref2.props; return ["p-togglebutton p-component", { "p-togglebutton-checked": instance.active, @@ -179586,7 +207665,7 @@ var ToggleButtonStyle = BaseStyle.extend({ }); var script$1$4 = { name: "BaseToggleButton", - "extends": script$_, + "extends": script$11, props: { modelValue: Boolean, onIcon: String, @@ -179629,7 +207708,7 @@ var script$1$4 = { } }, style: ToggleButtonStyle, - provide: /* @__PURE__ */ __name(function provide37() { + provide: /* @__PURE__ */ __name(function provide39() { return { $pcToggleButton: this, $parentInstance: this @@ -179706,12 +207785,12 @@ function render$7(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$7, "render$7"); script$8.render = render$7; -var theme$3 = /* @__PURE__ */ __name(function theme36(_ref) { +var theme$3 = /* @__PURE__ */ __name(function theme38(_ref) { var dt2 = _ref.dt; return "\n.p-selectbutton {\n display: inline-flex;\n user-select: none;\n vertical-align: bottom;\n outline-color: transparent;\n border-radius: ".concat(dt2("selectbutton.border.radius"), ";\n}\n\n.p-selectbutton .p-togglebutton {\n border-radius: 0;\n border-width: 1px 1px 1px 0;\n}\n\n.p-selectbutton .p-togglebutton:focus-visible {\n position: relative;\n z-index: 1;\n}\n\n.p-selectbutton .p-togglebutton:first-child {\n border-left-width: 1px;\n border-top-left-radius: ").concat(dt2("selectbutton.border.radius"), ";\n border-bottom-left-radius: ").concat(dt2("selectbutton.border.radius"), ";\n}\n\n.p-selectbutton .p-togglebutton:last-child {\n border-top-right-radius: ").concat(dt2("selectbutton.border.radius"), ";\n border-bottom-right-radius: ").concat(dt2("selectbutton.border.radius"), ";\n}\n\n.p-selectbutton.p-invalid {\n outline: 1px solid ").concat(dt2("selectbutton.invalid.border.color"), ";\n outline-offset: 0;\n}\n"); }, "theme"); var classes$3 = { - root: /* @__PURE__ */ __name(function root22(_ref2) { + root: /* @__PURE__ */ __name(function root25(_ref2) { var props = _ref2.props; return ["p-selectbutton p-component", { "p-invalid": props.invalid @@ -179725,7 +207804,7 @@ var SelectButtonStyle = BaseStyle.extend({ }); var script$1$3 = { name: "BaseSelectButton", - "extends": script$_, + "extends": script$11, props: { modelValue: null, options: Array, @@ -179749,73 +207828,73 @@ var script$1$3 = { } }, style: SelectButtonStyle, - provide: /* @__PURE__ */ __name(function provide38() { + provide: /* @__PURE__ */ __name(function provide40() { return { $pcSelectButton: this, $parentInstance: this }; }, "provide") }; -function _createForOfIteratorHelper(r, e2) { - var t2 = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; +function _createForOfIteratorHelper(r2, e2) { + var t2 = "undefined" != typeof Symbol && r2[Symbol.iterator] || r2["@@iterator"]; if (!t2) { - if (Array.isArray(r) || (t2 = _unsupportedIterableToArray$2(r)) || e2) { - t2 && (r = t2); - var _n = 0, F = /* @__PURE__ */ __name(function F2() { + if (Array.isArray(r2) || (t2 = _unsupportedIterableToArray$2(r2)) || e2) { + t2 && (r2 = t2); + var _n = 0, F2 = /* @__PURE__ */ __name(function F3() { }, "F"); - return { s: F, n: /* @__PURE__ */ __name(function n() { - return _n >= r.length ? { done: true } : { done: false, value: r[_n++] }; - }, "n"), e: /* @__PURE__ */ __name(function e3(r2) { - throw r2; - }, "e"), f: F }; + return { s: F2, n: /* @__PURE__ */ __name(function n2() { + return _n >= r2.length ? { done: true } : { done: false, value: r2[_n++] }; + }, "n"), e: /* @__PURE__ */ __name(function e3(r3) { + throw r3; + }, "e"), f: F2 }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - var o, a = true, u = false; - return { s: /* @__PURE__ */ __name(function s() { - t2 = t2.call(r); - }, "s"), n: /* @__PURE__ */ __name(function n() { - var r2 = t2.next(); - return a = r2.done, r2; - }, "n"), e: /* @__PURE__ */ __name(function e3(r2) { - u = true, o = r2; - }, "e"), f: /* @__PURE__ */ __name(function f() { + var o2, a2 = true, u2 = false; + return { s: /* @__PURE__ */ __name(function s2() { + t2 = t2.call(r2); + }, "s"), n: /* @__PURE__ */ __name(function n2() { + var r3 = t2.next(); + return a2 = r3.done, r3; + }, "n"), e: /* @__PURE__ */ __name(function e3(r3) { + u2 = true, o2 = r3; + }, "e"), f: /* @__PURE__ */ __name(function f2() { try { - a || null == t2["return"] || t2["return"](); + a2 || null == t2["return"] || t2["return"](); } finally { - if (u) throw o; + if (u2) throw o2; } }, "f") }; } __name(_createForOfIteratorHelper, "_createForOfIteratorHelper"); -function _toConsumableArray$2(r) { - return _arrayWithoutHoles$2(r) || _iterableToArray$2(r) || _unsupportedIterableToArray$2(r) || _nonIterableSpread$2(); +function _toConsumableArray$2(r2) { + return _arrayWithoutHoles$2(r2) || _iterableToArray$2(r2) || _unsupportedIterableToArray$2(r2) || _nonIterableSpread$2(); } __name(_toConsumableArray$2, "_toConsumableArray$2"); function _nonIterableSpread$2() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } __name(_nonIterableSpread$2, "_nonIterableSpread$2"); -function _unsupportedIterableToArray$2(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray$2(r, a); - var t2 = {}.toString.call(r).slice(8, -1); - return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$2(r, a) : void 0; +function _unsupportedIterableToArray$2(r2, a2) { + if (r2) { + if ("string" == typeof r2) return _arrayLikeToArray$2(r2, a2); + var t2 = {}.toString.call(r2).slice(8, -1); + return "Object" === t2 && r2.constructor && (t2 = r2.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r2) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$2(r2, a2) : void 0; } } __name(_unsupportedIterableToArray$2, "_unsupportedIterableToArray$2"); -function _iterableToArray$2(r) { - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); +function _iterableToArray$2(r2) { + if ("undefined" != typeof Symbol && null != r2[Symbol.iterator] || null != r2["@@iterator"]) return Array.from(r2); } __name(_iterableToArray$2, "_iterableToArray$2"); -function _arrayWithoutHoles$2(r) { - if (Array.isArray(r)) return _arrayLikeToArray$2(r); +function _arrayWithoutHoles$2(r2) { + if (Array.isArray(r2)) return _arrayLikeToArray$2(r2); } __name(_arrayWithoutHoles$2, "_arrayWithoutHoles$2"); -function _arrayLikeToArray$2(r, a) { - (null == a || a > r.length) && (a = r.length); - for (var e2 = 0, n = Array(a); e2 < a; e2++) n[e2] = r[e2]; - return n; +function _arrayLikeToArray$2(r2, a2) { + (null == a2 || a2 > r2.length) && (a2 = r2.length); + for (var e2 = 0, n2 = Array(a2); e2 < a2; e2++) n2[e2] = r2[e2]; + return n2; } __name(_arrayLikeToArray$2, "_arrayLikeToArray$2"); var script$7 = { @@ -179948,7 +208027,7 @@ function render$6(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$6, "render$6"); script$7.render = render$6; -const _withScopeId$5 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-c4279e6b"), n = n(), popScopeId(), n), "_withScopeId$5"); +const _withScopeId$5 = /* @__PURE__ */ __name((n2) => (pushScopeId("data-v-c4279e6b"), n2 = n2(), popScopeId(), n2), "_withScopeId$5"); const _hoisted_1$c = { class: "_content" }; const _hoisted_2$a = { class: "_footer" }; const _sfc_main$h = /* @__PURE__ */ defineComponent({ @@ -179989,7 +208068,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({ optionLabel: "name", onChange: updateSelectedFilterValue }, null, 8, ["modelValue", "options"]), - createVNode(unref(script$o), { + createVNode(unref(script$m), { class: "filter-value-select", modelValue: selectedFilterValue.value, "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => selectedFilterValue.value = $event), @@ -179999,7 +208078,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({ }, null, 8, ["modelValue", "options"]) ]), createBaseVNode("div", _hoisted_2$a, [ - createVNode(unref(script$R), { + createVNode(unref(script$U), { type: "button", label: _ctx.$t("g.add"), onClick: submit @@ -180010,7 +208089,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({ } }); const NodeSearchFilter = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-c4279e6b"]]); -const _withScopeId$4 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-d9792337"), n = n(), popScopeId(), n), "_withScopeId$4"); +const _withScopeId$4 = /* @__PURE__ */ __name((n2) => (pushScopeId("data-v-d9792337"), n2 = n2(), popScopeId(), n2), "_withScopeId$4"); const _hoisted_1$b = { class: "_sb_node_preview" }; const _hoisted_2$9 = { class: "_sb_table" }; const _hoisted_3$6 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ createBaseVNode("div", { class: "_sb_dot headdot" }, null, -1)); @@ -180176,14 +208255,14 @@ const useNodeBookmarkStore = /* @__PURE__ */ defineStore("nodeBookmark", () => { const deleteBookmark = /* @__PURE__ */ __name((nodePath) => { settingStore.set( BOOKMARK_SETTING_ID, - bookmarks.value.filter((b) => b !== nodePath) + bookmarks.value.filter((b2) => b2 !== nodePath) ); }, "deleteBookmark"); const addNewBookmarkFolder = /* @__PURE__ */ __name((parent) => { const parentPath = parent ? parent.nodePath : ""; let newFolderPath = parentPath + "New Folder/"; let suffix2 = 1; - while (bookmarks.value.some((b) => b.startsWith(newFolderPath))) { + while (bookmarks.value.some((b2) => b2.startsWith(newFolderPath))) { newFolderPath = parentPath + `New Folder ${suffix2}/`; suffix2++; } @@ -180201,13 +208280,13 @@ const useNodeBookmarkStore = /* @__PURE__ */ defineStore("nodeBookmark", () => { if (newNodePath === folderNode.nodePath) { return; } - if (bookmarks.value.some((b) => b.startsWith(newNodePath))) { + if (bookmarks.value.some((b2) => b2.startsWith(newNodePath))) { throw new Error(`Folder name "${newNodePath}" already exists`); } settingStore.set( BOOKMARK_SETTING_ID, bookmarks.value.map( - (b) => b.startsWith(folderNode.nodePath) ? b.replace(folderNode.nodePath, newNodePath) : b + (b2) => b2.startsWith(folderNode.nodePath) ? b2.replace(folderNode.nodePath, newNodePath) : b2 ) ); renameBookmarkCustomization(folderNode.nodePath, newNodePath); @@ -180219,7 +208298,7 @@ const useNodeBookmarkStore = /* @__PURE__ */ defineStore("nodeBookmark", () => { settingStore.set( BOOKMARK_SETTING_ID, bookmarks.value.filter( - (b) => b !== folderNode.nodePath && !b.startsWith(folderNode.nodePath) + (b2) => b2 !== folderNode.nodePath && !b2.startsWith(folderNode.nodePath) ) ); deleteBookmarkCustomization(folderNode.nodePath); @@ -180346,19 +208425,19 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({ }, [ createVNode(TreeExplorerTreeNode, { node: _ctx.node }, { "before-label": withCtx(() => [ - nodeDef.value.experimental ? (openBlock(), createBlock(unref(script$x), { + nodeDef.value.experimental ? (openBlock(), createBlock(unref(script$v), { key: 0, value: _ctx.$t("g.experimental"), severity: "primary" }, null, 8, ["value"])) : createCommentVNode("", true), - nodeDef.value.deprecated ? (openBlock(), createBlock(unref(script$x), { + nodeDef.value.deprecated ? (openBlock(), createBlock(unref(script$v), { key: 1, value: _ctx.$t("g.deprecated"), severity: "danger" }, null, 8, ["value"])) : createCommentVNode("", true) ]), actions: withCtx(() => [ - createVNode(unref(script$R), { + createVNode(unref(script$U), { class: "bookmark-button", size: "small", icon: isBookmarked.value ? "pi pi-bookmark-fill" : "pi pi-bookmark", @@ -180389,7 +208468,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({ } }); const NodeTreeLeaf = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-da9a8962"]]); -const _withScopeId$3 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-4b8adc78"), n = n(), popScopeId(), n), "_withScopeId$3"); +const _withScopeId$3 = /* @__PURE__ */ __name((n2) => (pushScopeId("data-v-05364174"), n2 = n2(), popScopeId(), n2), "_withScopeId$3"); const _hoisted_1$a = { class: "p-fluid" }; const _hoisted_2$8 = { class: "field icon-field" }; const _hoisted_3$5 = { for: "icon" }; @@ -180481,19 +208560,19 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({ ); return (_ctx, _cache) => { const _directive_tooltip = resolveDirective("tooltip"); - return openBlock(), createBlock(unref(script$P), { + return openBlock(), createBlock(unref(script$S), { visible: visible.value, "onUpdate:visible": _cache[3] || (_cache[3] = ($event) => visible.value = $event), header: _ctx.$t("g.customizeFolder") }, { footer: withCtx(() => [ - createVNode(unref(script$R), { + createVNode(unref(script$U), { label: _ctx.$t("g.reset"), icon: "pi pi-refresh", onClick: resetCustomization, class: "p-button-text" }, null, 8, ["label"]), - createVNode(unref(script$R), { + createVNode(unref(script$U), { label: _ctx.$t("g.confirm"), icon: "pi pi-check", onClick: confirmCustomization, @@ -180520,7 +208599,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({ _: 1 }, 8, ["modelValue"]) ]), - createVNode(unref(script$O)), + createVNode(unref(script$R)), createBaseVNode("div", _hoisted_4$4, [ createBaseVNode("label", _hoisted_5$3, toDisplayString$1(_ctx.$t("g.color")), 1), createBaseVNode("div", _hoisted_6$2, [ @@ -180529,7 +208608,8 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => selectedColor.value = $event), options: colorOptions, optionLabel: "name", - dataKey: "value" + dataKey: "value", + "allow-empty": false }, { option: withCtx((slotProps) => [ slotProps.option.value !== "custom" ? (openBlock(), createElementBlock("div", { @@ -180546,7 +208626,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({ ]), _: 1 }, 8, ["modelValue"]), - selectedColor.value.value === "custom" ? (openBlock(), createBlock(unref(script$j), { + selectedColor.value.value === "custom" ? (openBlock(), createBlock(unref(script$h), { key: 0, modelValue: customColor.value, "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => customColor.value = $event) @@ -180560,7 +208640,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({ }; } }); -const FolderCustomizationDialog = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-4b8adc78"]]); +const FolderCustomizationDialog = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-05364174"]]); const _sfc_main$d = /* @__PURE__ */ defineComponent({ __name: "NodeTreeFolder", props: { @@ -180679,11 +208759,11 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({ () => { const fillNodeInfo = /* @__PURE__ */ __name((node3) => { const children = node3.children?.map(fillNodeInfo); - const sortedChildren = children?.sort((a, b) => { - if (a.leaf === b.leaf) { - return a.label.localeCompare(b.label); + const sortedChildren = children?.sort((a2, b2) => { + if (a2.leaf === b2.leaf) { + return a2.label.localeCompare(b2.label); } - return a.leaf ? 1 : -1; + return a2.leaf ? 1 : -1; }); return { key: node3.key, @@ -180700,8 +208780,8 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({ children: sortedChildren, draggable: node3.leaf, droppable: !node3.leaf, - handleDrop: /* @__PURE__ */ __name((node22, data24) => { - const nodeDefToAdd = data24.data.data; + handleDrop: /* @__PURE__ */ __name((node22, data25) => { + const nodeDefToAdd = data25.data.data; if (nodeBookmarkStore.isBookmarked(nodeDefToAdd)) { nodeBookmarkStore.toggleBookmark(nodeDefToAdd); } @@ -180803,9 +208883,9 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({ const searchFilter = ref(null); const alphabeticalSort = ref(false); const searchQuery = ref(""); - const root24 = computed(() => { - const root25 = filteredRoot.value || nodeDefStore.nodeTree; - return alphabeticalSort.value ? sortedTree(root25, { groupLeaf: true }) : root25; + const root27 = computed(() => { + const root28 = filteredRoot.value || nodeDefStore.nodeTree; + return alphabeticalSort.value ? sortedTree(root28, { groupLeaf: true }) : root28; }); const renderedRoot = computed(() => { const fillNodeInfo = /* @__PURE__ */ __name((node3) => { @@ -180831,7 +208911,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({ }, "handleClick") }; }, "fillNodeInfo"); - return fillNodeInfo(root24.value); + return fillNodeInfo(root27.value); }); const filteredNodeDefs = ref([]); const filteredRoot = computed(() => { @@ -180847,10 +208927,10 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({ expandedKeys2.value = {}; return; } - const f = filters.value.map((f2) => f2.filter); + const f2 = filters.value.map((f22) => f22.filter); filteredNodeDefs.value = nodeDefStore.nodeSearchService.searchNode( query, - f, + f2, { limit: 64 }, @@ -180873,7 +208953,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({ handleSearch(searchQuery.value); }, "onAddFilter"); const onRemoveFilter = /* @__PURE__ */ __name((filterAndValue) => { - const index2 = filters.value.findIndex((f) => f === filterAndValue); + const index2 = filters.value.findIndex((f2) => f2 === filterAndValue); if (index2 !== -1) { filters.value.splice(index2, 1); } @@ -180887,7 +208967,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({ class: "bg-[var(--p-tree-background)]" }, { "tool-buttons": withCtx(() => [ - withDirectives(createVNode(unref(script$R), { + withDirectives(createVNode(unref(script$U), { class: "new-folder-button", icon: "pi pi-folder-plus", text: "", @@ -180901,7 +208981,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({ { bottom: true } ] ]), - withDirectives(createVNode(unref(script$R), { + withDirectives(createVNode(unref(script$U), { class: "sort-button", icon: alphabeticalSort.value ? "pi pi-sort-alpha-down" : "pi pi-sort-alt", text: "", @@ -180945,7 +209025,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({ ref: nodeBookmarkTreeExplorerRef, "filtered-node-defs": filteredNodeDefs.value }, null, 8, ["filtered-node-defs"]), - withDirectives(createVNode(unref(script$O), { + withDirectives(createVNode(unref(script$R), { type: "dashed", class: "m-2" }, null, 512), [ @@ -180981,7 +209061,7 @@ const useNodeLibrarySidebarTab = /* @__PURE__ */ __name(() => { type: "vue" }; }, "useNodeLibrarySidebarTab"); -var theme$2 = /* @__PURE__ */ __name(function theme37(_ref) { +var theme$2 = /* @__PURE__ */ __name(function theme39(_ref) { var dt2 = _ref.dt; return "\n.p-confirmpopup {\n position: absolute;\n margin-top: ".concat(dt2("confirmpopup.gutter"), ";\n top: 0;\n left: 0;\n background: ").concat(dt2("confirmpopup.background"), ";\n color: ").concat(dt2("confirmpopup.color"), ";\n border: 1px solid ").concat(dt2("confirmpopup.border.color"), ";\n border-radius: ").concat(dt2("confirmpopup.border.radius"), ";\n box-shadow: ").concat(dt2("confirmpopup.shadow"), ";\n}\n\n.p-confirmpopup-content {\n display: flex;\n align-items: center;\n padding: ").concat(dt2("confirmpopup.content.padding"), ";\n gap: ").concat(dt2("confirmpopup.content.gap"), ";\n}\n\n.p-confirmpopup-icon {\n font-size: ").concat(dt2("confirmpopup.icon.size"), ";\n width: ").concat(dt2("confirmpopup.icon.size"), ";\n height: ").concat(dt2("confirmpopup.icon.size"), ";\n color: ").concat(dt2("confirmpopup.icon.color"), ";\n}\n\n.p-confirmpopup-footer {\n display: flex;\n justify-content: flex-end;\n gap: ").concat(dt2("confirmpopup.footer.gap"), ";\n padding: ").concat(dt2("confirmpopup.footer.padding"), ";\n}\n\n.p-confirmpopup-footer button {\n width: auto;\n}\n\n.p-confirmpopup-footer button:last-child {\n margin: 0;\n}\n\n.p-confirmpopup-flipped {\n margin-top: calc(").concat(dt2("confirmpopup.gutter"), " * -1);\n margin-bottom: ").concat(dt2("confirmpopup.gutter"), ";\n}\n\n.p-confirmpopup-enter-from {\n opacity: 0;\n transform: scaleY(0.8);\n}\n\n.p-confirmpopup-leave-to {\n opacity: 0;\n}\n\n.p-confirmpopup-enter-active {\n transition: transform 0.12s cubic-bezier(0, 0, 0.2, 1), opacity 0.12s cubic-bezier(0, 0, 0.2, 1);\n}\n\n.p-confirmpopup-leave-active {\n transition: opacity 0.1s linear;\n}\n\n.p-confirmpopup:after,\n.p-confirmpopup:before {\n bottom: 100%;\n left: calc(").concat(dt2("confirmpopup.arrow.offset"), " + ").concat(dt2("confirmpopup.arrow.left"), ');\n content: " ";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n}\n\n.p-confirmpopup:after {\n border-width: calc(').concat(dt2("confirmpopup.gutter"), " - 2px);\n margin-left: calc(-1 * (").concat(dt2("confirmpopup.gutter"), " - 2px));\n border-style: solid;\n border-color: transparent;\n border-bottom-color: ").concat(dt2("confirmpopup.background"), ";\n}\n\n.p-confirmpopup:before {\n border-width: ").concat(dt2("confirmpopup.gutter"), ";\n margin-left: calc(-1 * ").concat(dt2("confirmpopup.gutter"), ");\n border-style: solid;\n border-color: transparent;\n border-bottom-color: ").concat(dt2("confirmpopup.border.color"), ";\n}\n\n.p-confirmpopup-flipped:after,\n.p-confirmpopup-flipped:before {\n bottom: auto;\n top: 100%;\n}\n\n.p-confirmpopup-flipped:after {\n border-bottom-color: transparent;\n border-top-color: ").concat(dt2("confirmpopup.background"), ";\n}\n\n.p-confirmpopup-flipped:before {\n border-bottom-color: transparent;\n border-top-color: ").concat(dt2("confirmpopup.border.color"), ";\n}\n"); }, "theme"); @@ -181001,12 +209081,12 @@ var ConfirmPopupStyle = BaseStyle.extend({ }); var script$1$2 = { name: "BaseConfirmPopup", - "extends": script$_, + "extends": script$11, props: { group: String }, style: ConfirmPopupStyle, - provide: /* @__PURE__ */ __name(function provide39() { + provide: /* @__PURE__ */ __name(function provide41() { return { $pcConfirmPopup: this, $parentInstance: this @@ -181017,7 +209097,7 @@ var script$6 = { name: "ConfirmPopup", "extends": script$1$2, inheritAttrs: false, - data: /* @__PURE__ */ __name(function data19() { + data: /* @__PURE__ */ __name(function data20() { return { visible: false, confirmation: null, @@ -181033,7 +209113,7 @@ var script$6 = { container: null, confirmListener: null, closeListener: null, - mounted: /* @__PURE__ */ __name(function mounted18() { + mounted: /* @__PURE__ */ __name(function mounted20() { var _this = this; this.confirmListener = function(options4) { if (!options4) { @@ -181254,8 +209334,8 @@ var script$6 = { }, "rejectIcon") }, components: { - Button: script$R, - Portal: script$Q + Button: script$U, + Portal: script$T }, directives: { focustrap: FocusTrap @@ -181463,13 +209543,13 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({ } }); const VirtualGrid = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-ad33a347"]]); -var theme$1 = /* @__PURE__ */ __name(function theme38(_ref) { +var theme$1 = /* @__PURE__ */ __name(function theme40(_ref) { var dt2 = _ref.dt; return "\n.p-galleria {\n overflow: hidden;\n border-style: solid;\n border-width: ".concat(dt2("galleria.border.width"), ";\n border-color: ").concat(dt2("galleria.border.color"), ";\n border-radius: ").concat(dt2("galleria.border.radius"), ";\n}\n\n.p-galleria-content {\n display: flex;\n flex-direction: column;\n}\n\n.p-galleria-items-container {\n display: flex;\n flex-direction: column;\n position: relative;\n}\n\n.p-galleria-items {\n position: relative;\n display: flex;\n height: 100%;\n}\n\n.p-galleria-nav-button {\n position: absolute;\n top: 50%;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n overflow: hidden;\n background: ").concat(dt2("galleria.nav.button.background"), ";\n color: ").concat(dt2("galleria.nav.button.color"), ";\n width: ").concat(dt2("galleria.nav.button.size"), ";\n height: ").concat(dt2("galleria.nav.button.size"), ";\n transition: background ").concat(dt2("galleria.transition.duration"), ", color ").concat(dt2("galleria.transition.duration"), ", outline-color ").concat(dt2("galleria.transition.duration"), ", box-shadow ").concat(dt2("galleria.transition.duration"), ";\n margin: calc(-1 * calc(").concat(dt2("galleria.nav.button.size"), ") / 2) ").concat(dt2("galleria.nav.button.gutter"), " 0 ").concat(dt2("galleria.nav.button.gutter"), ";\n padding: 0;\n user-select: none;\n border: 0 none;\n cursor: pointer;\n outline-color: transparent;\n}\n\n.p-galleria-nav-button:not(.p-disabled):hover {\n background: ").concat(dt2("galleria.nav.button.hover.background"), ";\n color: ").concat(dt2("galleria.nav.button.hover.color"), ";\n}\n\n.p-galleria-nav-button:not(.p-disabled):focus-visible {\n box-shadow: ").concat(dt2("galleria.nav.button.focus.ring.shadow"), ";\n outline: ").concat(dt2("galleria.nav.button.focus.ring.width"), " ").concat(dt2("galleria.nav.button.focus.ring.style"), " ").concat(dt2("galleria.nav.button.focus.ring.color"), ";\n outline-offset: ").concat(dt2("galleria.nav.button.focus.ring.offset"), ";\n}\n\n.p-galleria-next-icon,\n.p-galleria-prev-icon {\n font-size: ").concat(dt2("galleria.nav.icon.size"), ";\n width: ").concat(dt2("galleria.nav.icon.size"), ";\n height: ").concat(dt2("galleria.nav.icon.size"), ";\n}\n\n.p-galleria-prev-button {\n border-radius: ").concat(dt2("galleria.nav.button.prev.border.radius"), ";\n left: 0;\n}\n\n.p-galleria-next-button {\n border-radius: ").concat(dt2("galleria.nav.button.next.border.radius"), ";\n right: 0;\n}\n\n.p-galleria-item {\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n width: 100%;\n}\n\n.p-galleria-hover-navigators .p-galleria-nav-button {\n pointer-events: none;\n opacity: 0;\n transition: opacity ").concat(dt2("galleria.transition.duration"), " ease-in-out;\n}\n\n.p-galleria-hover-navigators .p-galleria-items-container:hover .p-galleria-nav-button {\n pointer-events: all;\n opacity: 1;\n}\n\n.p-galleria-hover-navigators .p-galleria-items-container:hover .p-galleria-nav-button.p-disabled {\n pointer-events: none;\n}\n\n.p-galleria-caption {\n position: absolute;\n bottom: 0;\n left: 0;\n width: 100%;\n background: ").concat(dt2("galleria.caption.background"), ";\n color: ").concat(dt2("galleria.caption.color"), ";\n padding: ").concat(dt2("galleria.caption.padding"), ";\n}\n\n.p-galleria-thumbnails {\n display: flex;\n flex-direction: column;\n overflow: auto;\n flex-shrink: 0;\n}\n\n.p-galleria-thumbnail-nav-button {\n align-self: center;\n flex: 0 0 auto;\n display: flex;\n justify-content: center;\n align-items: center;\n overflow: hidden;\n position: relative;\n margin: 0 ").concat(dt2("galleria.thumbnail.nav.button.gutter"), ";\n padding: 0;\n border: none;\n user-select: none;\n cursor: pointer;\n background: transparent;\n color: ").concat(dt2("galleria.thumbnail.nav.button.color"), ";\n width: ").concat(dt2("galleria.thumbnail.nav.button.size"), ";\n height: ").concat(dt2("galleria.thumbnail.nav.button.size"), ";\n transition: background ").concat(dt2("galleria.transition.duration"), ", color ").concat(dt2("galleria.transition.duration"), ", outline-color ").concat(dt2("galleria.transition.duration"), ";\n outline-color: transparent;\n border-radius: ").concat(dt2("galleria.thumbnail.nav.button.border.radius"), ";\n}\n\n.p-galleria-thumbnail-nav-button:hover {\n background: ").concat(dt2("galleria.thumbnail.nav.button.hover.background"), ";\n color: ").concat(dt2("galleria.thumbnail.nav.button.hover.color"), ";\n}\n\n.p-galleria-thumbnail-nav-button:focus-visible {\n box-shadow: ").concat(dt2("galleria.thumbnail.nav.button.focus.ring.shadow"), ";\n outline: ").concat(dt2("galleria.thumbnail.nav.button.focus.ring.width"), " ").concat(dt2("galleria.thumbnail.nav.button.focus.ring.style"), " ").concat(dt2("galleria.thumbnail.nav.button.focus.ring.color"), ";\n outline-offset: ").concat(dt2("galleria.thumbnail.nav.button.focus.ring.offset"), ";\n}\n\n.p-galleria-thumbnail-nav-button .p-galleria-thumbnail-next-icon,\n.p-galleria-thumbnail-nav-button .p-galleria-thumbnail-prev-icon {\n font-size: ").concat(dt2("galleria.thumbnail.nav.button.icon.size"), ";\n width: ").concat(dt2("galleria.thumbnail.nav.button.icon.size"), ";\n height: ").concat(dt2("galleria.thumbnail.nav.button.icon.size"), ";\n}\n\n.p-galleria-thumbnails-content {\n display: flex;\n flex-direction: row;\n background: ").concat(dt2("galleria.thumbnails.content.background"), ";\n padding: ").concat(dt2("galleria.thumbnails.content.padding"), ";\n}\n\n.p-galleria-thumbnails-viewport {\n overflow: hidden;\n width: 100%;\n}\n\n.p-galleria-thumbnail-items {\n display: flex;\n}\n\n.p-galleria-thumbnail-item {\n overflow: auto;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n opacity: 0.5;\n}\n\n.p-galleria-thumbnail {\n outline-color: transparent;\n}\n\n.p-galleria-thumbnail-item:hover {\n opacity: 1;\n transition: opacity 0.3s;\n}\n\n.p-galleria-thumbnail-item-current {\n opacity: 1;\n}\n\n.p-galleria-thumbnails-left .p-galleria-content,\n.p-galleria-thumbnails-right .p-galleria-content {\n flex-direction: row;\n}\n\n.p-galleria-thumbnails-left .p-galleria-items-container,\n.p-galleria-thumbnails-right .p-galleria-items-container {\n flex-direction: row;\n}\n\n.p-galleria-thumbnails-left .p-galleria-items-container,\n.p-galleria-thumbnails-top .p-galleria-items-container {\n order: 2;\n}\n\n.p-galleria-thumbnails-left .p-galleria-thumbnails,\n.p-galleria-thumbnails-top .p-galleria-thumbnails {\n order: 1;\n}\n\n.p-galleria-thumbnails-left .p-galleria-thumbnails-content,\n.p-galleria-thumbnails-right .p-galleria-thumbnails-content {\n flex-direction: column;\n flex-grow: 1;\n}\n\n.p-galleria-thumbnails-left .p-galleria-thumbnail-items,\n.p-galleria-thumbnails-right .p-galleria-thumbnail-items {\n flex-direction: column;\n height: 100%;\n}\n\n.p-galleria-indicator-list {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: ").concat(dt2("galleria.indicator.list.padding"), ";\n gap: ").concat(dt2("galleria.indicator.list.gap"), ";\n margin: 0;\n list-style: none;\n}\n\n.p-galleria-indicator-button {\n display: inline-flex;\n align-items: center;\n background: ").concat(dt2("galleria.indicator.button.background"), ";\n width: ").concat(dt2("galleria.indicator.button.width"), ";\n height: ").concat(dt2("galleria.indicator.button.height"), ";\n transition: background ").concat(dt2("galleria.transition.duration"), ", color ").concat(dt2("galleria.transition.duration"), ", outline-color ").concat(dt2("galleria.transition.duration"), ", box-shadow ").concat(dt2("galleria.transition.duration"), ";\n outline-color: transparent;\n border-radius: ").concat(dt2("galleria.indicator.button.border.radius"), ";\n margin: 0;\n padding: 0;\n border: none;\n user-select: none;\n cursor: pointer;\n}\n\n.p-galleria-indicator-button:hover {\n background: ").concat(dt2("galleria.indicator.button.hover.background"), ";\n}\n\n.p-galleria-indicator-button:focus-visible {\n box-shadow: ").concat(dt2("galleria.indicator.button.focus.ring.shadow"), ";\n outline: ").concat(dt2("galleria.indicator.button.focus.ring.width"), " ").concat(dt2("galleria.indicator.button.focus.ring.style"), " ").concat(dt2("galleria.indicator.button.focus.ring.color"), ";\n outline-offset: ").concat(dt2("galleria.indicator.button.focus.ring.offset"), ";\n}\n\n.p-galleria-indicator-active .p-galleria-indicator-button {\n background: ").concat(dt2("galleria.indicator.button.active.background"), ";\n}\n\n.p-galleria-indicators-left .p-galleria-items-container,\n.p-galleria-indicators-right .p-galleria-items-container {\n flex-direction: row;\n align-items: center;\n}\n\n.p-galleria-indicators-left .p-galleria-items,\n.p-galleria-indicators-top .p-galleria-items {\n order: 2;\n}\n\n.p-galleria-indicators-left .p-galleria-indicator-list,\n.p-galleria-indicators-top .p-galleria-indicator-list {\n order: 1;\n}\n\n.p-galleria-indicators-left .p-galleria-indicator-list,\n.p-galleria-indicators-right .p-galleria-indicator-list {\n flex-direction: column;\n}\n\n.p-galleria-inset-indicators .p-galleria-indicator-list {\n position: absolute;\n display: flex;\n z-index: 1;\n background: ").concat(dt2("galleria.inset.indicator.list.background"), ";\n}\n\n.p-galleria-inset-indicators .p-galleria-indicator-button {\n background: ").concat(dt2("galleria.inset.indicator.button.background"), ";\n}\n\n.p-galleria-inset-indicators .p-galleria-indicator-button:hover {\n background: ").concat(dt2("galleria.inset.indicator.button.hover.background"), ";\n}\n\n.p-galleria-inset-indicators .p-galleria-indicator-active .p-galleria-indicator-button {\n background: ").concat(dt2("galleria.inset.indicator.button.active.background"), ";\n}\n\n.p-galleria-inset-indicators.p-galleria-indicators-top .p-galleria-indicator-list {\n top: 0;\n left: 0;\n width: 100%;\n align-items: flex-start;\n}\n\n.p-galleria-inset-indicators.p-galleria-indicators-right .p-galleria-indicator-list {\n right: 0;\n top: 0;\n height: 100%;\n align-items: flex-end;\n}\n\n.p-galleria-inset-indicators.p-galleria-indicators-bottom .p-galleria-indicator-list {\n bottom: 0;\n left: 0;\n width: 100%;\n align-items: flex-end;\n}\n\n.p-galleria-inset-indicators.p-galleria-indicators-left .p-galleria-indicator-list {\n left: 0;\n top: 0;\n height: 100%;\n align-items: flex-start;\n}\n\n.p-galleria-mask {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.p-galleria-close-button {\n position: absolute;\n top: 0;\n right: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n overflow: hidden;\n margin: ").concat(dt2("galleria.close.button.gutter"), ";\n background: ").concat(dt2("galleria.close.button.background"), ";\n color: ").concat(dt2("galleria.close.button.color"), ";\n width: ").concat(dt2("galleria.close.button.size"), ";\n height: ").concat(dt2("galleria.close.button.size"), ";\n padding: 0;\n border: none;\n user-select: none;\n cursor: pointer;\n border-radius: ").concat(dt2("galleria.close.button.border.radius"), ";\n outline-color: transparent;\n transition: background ").concat(dt2("galleria.transition.duration"), ", color ").concat(dt2("galleria.transition.duration"), ", outline-color ").concat(dt2("galleria.transition.duration"), ";\n}\n\n.p-galleria-close-icon {\n font-size: ").concat(dt2("galleria.close.button.icon.size"), ";\n width: ").concat(dt2("galleria.close.button.icon.size"), ";\n height: ").concat(dt2("galleria.close.button.icon.size"), ";\n}\n\n.p-galleria-close-button:hover {\n background: ").concat(dt2("galleria.close.button.hover.background"), ";\n color: ").concat(dt2("galleria.close.button.hover.color"), ";\n}\n\n.p-galleria-close-button:focus-visible {\n box-shadow: ").concat(dt2("galleria.close.button.focus.ring.shadow"), ";\n outline: ").concat(dt2("galleria.close.button.focus.ring.width"), " ").concat(dt2("galleria.close.button.focus.ring.style"), " ").concat(dt2("galleria.close.button.focus.ring.color"), ";\n outline-offset: ").concat(dt2("galleria.close.button.focus.ring.offset"), ";\n}\n\n.p-galleria-mask .p-galleria-nav-button {\n position: fixed;\n top: 50%;\n}\n\n.p-galleria-enter-active {\n transition: all 150ms cubic-bezier(0, 0, 0.2, 1);\n}\n\n.p-galleria-leave-active {\n transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);\n}\n\n.p-galleria-enter-from,\n.p-galleria-leave-to {\n opacity: 0;\n transform: scale(0.7);\n}\n\n.p-galleria-enter-active .p-galleria-nav-button {\n opacity: 0;\n}\n\n.p-items-hidden .p-galleria-thumbnail-item {\n visibility: hidden;\n}\n\n.p-items-hidden .p-galleria-thumbnail-item.p-galleria-thumbnail-item-active {\n visibility: visible;\n}\n"); }, "theme"); var classes$1 = { mask: "p-galleria-mask p-overlay-mask p-overlay-mask-enter", - root: /* @__PURE__ */ __name(function root23(_ref2) { + root: /* @__PURE__ */ __name(function root26(_ref2) { var instance = _ref2.instance; var thumbnailsPosClass = instance.$attrs.showThumbnails && instance.getPositionClass("p-galleria-thumbnails", instance.$attrs.thumbnailsPosition); var indicatorPosClass = instance.$attrs.showIndicators && instance.getPositionClass("p-galleria-indicators", instance.$attrs.indicatorsPosition); @@ -181546,7 +209626,7 @@ var GalleriaStyle = BaseStyle.extend({ }); var script$4 = { name: "BaseGalleria", - "extends": script$_, + "extends": script$11, props: { id: { type: String, @@ -181666,47 +209746,47 @@ var script$4 = { } }, style: GalleriaStyle, - provide: /* @__PURE__ */ __name(function provide40() { + provide: /* @__PURE__ */ __name(function provide42() { return { $pcGalleria: this, $parentInstance: this }; }, "provide") }; -function _toConsumableArray$1(r) { - return _arrayWithoutHoles$1(r) || _iterableToArray$1(r) || _unsupportedIterableToArray$1(r) || _nonIterableSpread$1(); +function _toConsumableArray$1(r2) { + return _arrayWithoutHoles$1(r2) || _iterableToArray$1(r2) || _unsupportedIterableToArray$1(r2) || _nonIterableSpread$1(); } __name(_toConsumableArray$1, "_toConsumableArray$1"); function _nonIterableSpread$1() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } __name(_nonIterableSpread$1, "_nonIterableSpread$1"); -function _unsupportedIterableToArray$1(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray$1(r, a); - var t2 = {}.toString.call(r).slice(8, -1); - return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$1(r, a) : void 0; +function _unsupportedIterableToArray$1(r2, a2) { + if (r2) { + if ("string" == typeof r2) return _arrayLikeToArray$1(r2, a2); + var t2 = {}.toString.call(r2).slice(8, -1); + return "Object" === t2 && r2.constructor && (t2 = r2.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r2) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$1(r2, a2) : void 0; } } __name(_unsupportedIterableToArray$1, "_unsupportedIterableToArray$1"); -function _iterableToArray$1(r) { - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); +function _iterableToArray$1(r2) { + if ("undefined" != typeof Symbol && null != r2[Symbol.iterator] || null != r2["@@iterator"]) return Array.from(r2); } __name(_iterableToArray$1, "_iterableToArray$1"); -function _arrayWithoutHoles$1(r) { - if (Array.isArray(r)) return _arrayLikeToArray$1(r); +function _arrayWithoutHoles$1(r2) { + if (Array.isArray(r2)) return _arrayLikeToArray$1(r2); } __name(_arrayWithoutHoles$1, "_arrayWithoutHoles$1"); -function _arrayLikeToArray$1(r, a) { - (null == a || a > r.length) && (a = r.length); - for (var e2 = 0, n = Array(a); e2 < a; e2++) n[e2] = r[e2]; - return n; +function _arrayLikeToArray$1(r2, a2) { + (null == a2 || a2 > r2.length) && (a2 = r2.length); + for (var e2 = 0, n2 = Array(a2); e2 < a2; e2++) n2[e2] = r2[e2]; + return n2; } __name(_arrayLikeToArray$1, "_arrayLikeToArray$1"); var script$3 = { name: "GalleriaItem", hostName: "Galleria", - "extends": script$_, + "extends": script$11, emits: ["start-slideshow", "stop-slideshow", "update:activeIndex"], props: { circular: { @@ -181750,7 +209830,7 @@ var script$3 = { "default": null } }, - mounted: /* @__PURE__ */ __name(function mounted19() { + mounted: /* @__PURE__ */ __name(function mounted21() { if (this.autoPlay) { this.$emit("start-slideshow"); } @@ -181904,8 +209984,8 @@ var script$3 = { }, "ariaSlideLabel") }, components: { - ChevronLeftIcon: script$v, - ChevronRightIcon: script$u + ChevronLeftIcon: script$t, + ChevronRightIcon: script$s }, directives: { ripple: Ripple @@ -182000,40 +210080,40 @@ function render$3(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$3, "render$3"); script$3.render = render$3; -function _toConsumableArray(r) { - return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); +function _toConsumableArray(r2) { + return _arrayWithoutHoles(r2) || _iterableToArray(r2) || _unsupportedIterableToArray(r2) || _nonIterableSpread(); } __name(_toConsumableArray, "_toConsumableArray"); function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } __name(_nonIterableSpread, "_nonIterableSpread"); -function _unsupportedIterableToArray(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray(r, a); - var t2 = {}.toString.call(r).slice(8, -1); - return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray(r, a) : void 0; +function _unsupportedIterableToArray(r2, a2) { + if (r2) { + if ("string" == typeof r2) return _arrayLikeToArray(r2, a2); + var t2 = {}.toString.call(r2).slice(8, -1); + return "Object" === t2 && r2.constructor && (t2 = r2.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r2) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray(r2, a2) : void 0; } } __name(_unsupportedIterableToArray, "_unsupportedIterableToArray"); -function _iterableToArray(r) { - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); +function _iterableToArray(r2) { + if ("undefined" != typeof Symbol && null != r2[Symbol.iterator] || null != r2["@@iterator"]) return Array.from(r2); } __name(_iterableToArray, "_iterableToArray"); -function _arrayWithoutHoles(r) { - if (Array.isArray(r)) return _arrayLikeToArray(r); +function _arrayWithoutHoles(r2) { + if (Array.isArray(r2)) return _arrayLikeToArray(r2); } __name(_arrayWithoutHoles, "_arrayWithoutHoles"); -function _arrayLikeToArray(r, a) { - (null == a || a > r.length) && (a = r.length); - for (var e2 = 0, n = Array(a); e2 < a; e2++) n[e2] = r[e2]; - return n; +function _arrayLikeToArray(r2, a2) { + (null == a2 || a2 > r2.length) && (a2 = r2.length); + for (var e2 = 0, n2 = Array(a2); e2 < a2; e2++) n2[e2] = r2[e2]; + return n2; } __name(_arrayLikeToArray, "_arrayLikeToArray"); var script$2 = { name: "GalleriaThumbnails", hostName: "Galleria", - "extends": script$_, + "extends": script$11, emits: ["stop-slideshow", "update:activeIndex"], props: { containerId: { @@ -182092,7 +210172,7 @@ var script$2 = { startPos: null, thumbnailsStyle: null, sortedResponsiveOptions: null, - data: /* @__PURE__ */ __name(function data20() { + data: /* @__PURE__ */ __name(function data21() { return { d_numVisible: this.numVisible, d_oldNumVisible: this.numVisible, @@ -182112,14 +210192,14 @@ var script$2 = { this.d_oldActiveItemIndex = oldValue2; }, "activeIndex") }, - mounted: /* @__PURE__ */ __name(function mounted20() { + mounted: /* @__PURE__ */ __name(function mounted22() { this.createStyle(); this.calculatePosition(); if (this.responsiveOptions) { this.bindDocumentListeners(); } }, "mounted"), - updated: /* @__PURE__ */ __name(function updated10() { + updated: /* @__PURE__ */ __name(function updated11() { var totalShiftedItems = this.totalShiftedItems; if (this.d_oldNumVisible !== this.d_numVisible || this.d_oldActiveItemIndex !== this.d_activeIndex) { if (this.d_activeIndex <= this.getMedianItemIndex()) { @@ -182350,9 +210430,9 @@ var script$2 = { if (this.responsiveOptions && !this.isUnstyled) { this.sortedResponsiveOptions = _toConsumableArray(this.responsiveOptions); var comparer = localeComparator(); - this.sortedResponsiveOptions.sort(function(data1, data24) { + this.sortedResponsiveOptions.sort(function(data1, data25) { var value1 = data1.breakpoint; - var value22 = data24.breakpoint; + var value22 = data25.breakpoint; return sort(value1, value22, -1, comparer); }); for (var i2 = 0; i2 < this.sortedResponsiveOptions.length; i2++) { @@ -182422,49 +210502,49 @@ var script$2 = { }, "ariaNextButtonLabel") }, components: { - ChevronLeftIcon: script$v, - ChevronRightIcon: script$u, - ChevronUpIcon: script$h, - ChevronDownIcon: script$p + ChevronLeftIcon: script$t, + ChevronRightIcon: script$s, + ChevronUpIcon: script$f, + ChevronDownIcon: script$n }, directives: { ripple: Ripple } }; -function _typeof$2(o) { +function _typeof$2(o2) { "@babel/helpers - typeof"; - return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { - return typeof o2; - } : function(o2) { - return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; - }, _typeof$2(o); + return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { + return typeof o3; + } : function(o3) { + return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; + }, _typeof$2(o2); } __name(_typeof$2, "_typeof$2"); -function ownKeys$2(e2, r) { +function ownKeys$2(e2, r2) { var t2 = Object.keys(e2); if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e2); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e2, r2).enumerable; - })), t2.push.apply(t2, o); + var o2 = Object.getOwnPropertySymbols(e2); + r2 && (o2 = o2.filter(function(r3) { + return Object.getOwnPropertyDescriptor(e2, r3).enumerable; + })), t2.push.apply(t2, o2); } return t2; } __name(ownKeys$2, "ownKeys$2"); function _objectSpread$2(e2) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$2(Object(t2), true).forEach(function(r2) { - _defineProperty$2(e2, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$2(Object(t2)).forEach(function(r2) { - Object.defineProperty(e2, r2, Object.getOwnPropertyDescriptor(t2, r2)); + for (var r2 = 1; r2 < arguments.length; r2++) { + var t2 = null != arguments[r2] ? arguments[r2] : {}; + r2 % 2 ? ownKeys$2(Object(t2), true).forEach(function(r3) { + _defineProperty$2(e2, r3, t2[r3]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$2(Object(t2)).forEach(function(r3) { + Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3)); }); } return e2; } __name(_objectSpread$2, "_objectSpread$2"); -function _defineProperty$2(e2, r, t2) { - return (r = _toPropertyKey$2(r)) in e2 ? Object.defineProperty(e2, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r] = t2, e2; +function _defineProperty$2(e2, r2, t2) { + return (r2 = _toPropertyKey$2(r2)) in e2 ? Object.defineProperty(e2, r2, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r2] = t2, e2; } __name(_defineProperty$2, "_defineProperty$2"); function _toPropertyKey$2(t2) { @@ -182472,15 +210552,15 @@ function _toPropertyKey$2(t2) { return "symbol" == _typeof$2(i2) ? i2 : i2 + ""; } __name(_toPropertyKey$2, "_toPropertyKey$2"); -function _toPrimitive$2(t2, r) { +function _toPrimitive$2(t2, r2) { if ("object" != _typeof$2(t2) || !t2) return t2; var e2 = t2[Symbol.toPrimitive]; if (void 0 !== e2) { - var i2 = e2.call(t2, r || "default"); + var i2 = e2.call(t2, r2 || "default"); if ("object" != _typeof$2(i2)) return i2; throw new TypeError("@@toPrimitive must return a primitive value."); } - return ("string" === r ? String : Number)(t2); + return ("string" === r2 ? String : Number)(t2); } __name(_toPrimitive$2, "_toPrimitive$2"); var _hoisted_1$2$1 = ["disabled", "aria-label"]; @@ -182577,40 +210657,40 @@ function render$2(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$2, "render$2"); script$2.render = render$2; -function _typeof$1(o) { +function _typeof$1(o2) { "@babel/helpers - typeof"; - return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { - return typeof o2; - } : function(o2) { - return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; - }, _typeof$1(o); + return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { + return typeof o3; + } : function(o3) { + return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; + }, _typeof$1(o2); } __name(_typeof$1, "_typeof$1"); -function ownKeys$1(e2, r) { +function ownKeys$1(e2, r2) { var t2 = Object.keys(e2); if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e2); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e2, r2).enumerable; - })), t2.push.apply(t2, o); + var o2 = Object.getOwnPropertySymbols(e2); + r2 && (o2 = o2.filter(function(r3) { + return Object.getOwnPropertyDescriptor(e2, r3).enumerable; + })), t2.push.apply(t2, o2); } return t2; } __name(ownKeys$1, "ownKeys$1"); function _objectSpread$1(e2) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$1(Object(t2), true).forEach(function(r2) { - _defineProperty$1(e2, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$1(Object(t2)).forEach(function(r2) { - Object.defineProperty(e2, r2, Object.getOwnPropertyDescriptor(t2, r2)); + for (var r2 = 1; r2 < arguments.length; r2++) { + var t2 = null != arguments[r2] ? arguments[r2] : {}; + r2 % 2 ? ownKeys$1(Object(t2), true).forEach(function(r3) { + _defineProperty$1(e2, r3, t2[r3]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$1(Object(t2)).forEach(function(r3) { + Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3)); }); } return e2; } __name(_objectSpread$1, "_objectSpread$1"); -function _defineProperty$1(e2, r, t2) { - return (r = _toPropertyKey$1(r)) in e2 ? Object.defineProperty(e2, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r] = t2, e2; +function _defineProperty$1(e2, r2, t2) { + return (r2 = _toPropertyKey$1(r2)) in e2 ? Object.defineProperty(e2, r2, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r2] = t2, e2; } __name(_defineProperty$1, "_defineProperty$1"); function _toPropertyKey$1(t2) { @@ -182618,25 +210698,25 @@ function _toPropertyKey$1(t2) { return "symbol" == _typeof$1(i2) ? i2 : i2 + ""; } __name(_toPropertyKey$1, "_toPropertyKey$1"); -function _toPrimitive$1(t2, r) { +function _toPrimitive$1(t2, r2) { if ("object" != _typeof$1(t2) || !t2) return t2; var e2 = t2[Symbol.toPrimitive]; if (void 0 !== e2) { - var i2 = e2.call(t2, r || "default"); + var i2 = e2.call(t2, r2 || "default"); if ("object" != _typeof$1(i2)) return i2; throw new TypeError("@@toPrimitive must return a primitive value."); } - return ("string" === r ? String : Number)(t2); + return ("string" === r2 ? String : Number)(t2); } __name(_toPrimitive$1, "_toPrimitive$1"); var script$1$1 = { name: "GalleriaContent", hostName: "Galleria", - "extends": script$_, + "extends": script$11, inheritAttrs: false, interval: null, emits: ["activeitem-change", "mask-hide"], - data: /* @__PURE__ */ __name(function data21() { + data: /* @__PURE__ */ __name(function data22() { return { id: this.$attrs.id || UniqueComponentId(), activeIndex: this.$attrs.activeIndex, @@ -182645,7 +210725,7 @@ var script$1$1 = { }; }, "data"), watch: { - "$attrs.id": /* @__PURE__ */ __name(function $attrsId8(newValue2) { + "$attrs.id": /* @__PURE__ */ __name(function $attrsId9(newValue2) { this.id = newValue2 || UniqueComponentId(); }, "$attrsId"), "$attrs.value": /* @__PURE__ */ __name(function $attrsValue(newVal) { @@ -182663,10 +210743,10 @@ var script$1$1 = { newVal ? this.startSlideShow() : this.stopSlideShow(); }, "$attrsAutoPlay") }, - mounted: /* @__PURE__ */ __name(function mounted21() { + mounted: /* @__PURE__ */ __name(function mounted23() { this.id = this.id || UniqueComponentId(); }, "mounted"), - updated: /* @__PURE__ */ __name(function updated11() { + updated: /* @__PURE__ */ __name(function updated12() { this.$emit("activeitem-change", this.activeIndex); }, "updated"), beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount12() { @@ -182719,46 +210799,46 @@ var script$1$1 = { components: { GalleriaItem: script$3, GalleriaThumbnails: script$2, - TimesIcon: script$W + TimesIcon: script$Z }, directives: { ripple: Ripple } }; -function _typeof(o) { +function _typeof(o2) { "@babel/helpers - typeof"; - return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { - return typeof o2; - } : function(o2) { - return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; - }, _typeof(o); + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { + return typeof o3; + } : function(o3) { + return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; + }, _typeof(o2); } __name(_typeof, "_typeof"); -function ownKeys(e2, r) { +function ownKeys(e2, r2) { var t2 = Object.keys(e2); if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e2); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e2, r2).enumerable; - })), t2.push.apply(t2, o); + var o2 = Object.getOwnPropertySymbols(e2); + r2 && (o2 = o2.filter(function(r3) { + return Object.getOwnPropertyDescriptor(e2, r3).enumerable; + })), t2.push.apply(t2, o2); } return t2; } __name(ownKeys, "ownKeys"); function _objectSpread(e2) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys(Object(t2), true).forEach(function(r2) { - _defineProperty(e2, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys(Object(t2)).forEach(function(r2) { - Object.defineProperty(e2, r2, Object.getOwnPropertyDescriptor(t2, r2)); + for (var r2 = 1; r2 < arguments.length; r2++) { + var t2 = null != arguments[r2] ? arguments[r2] : {}; + r2 % 2 ? ownKeys(Object(t2), true).forEach(function(r3) { + _defineProperty(e2, r3, t2[r3]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys(Object(t2)).forEach(function(r3) { + Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3)); }); } return e2; } __name(_objectSpread, "_objectSpread"); -function _defineProperty(e2, r, t2) { - return (r = _toPropertyKey(r)) in e2 ? Object.defineProperty(e2, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r] = t2, e2; +function _defineProperty(e2, r2, t2) { + return (r2 = _toPropertyKey(r2)) in e2 ? Object.defineProperty(e2, r2, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r2] = t2, e2; } __name(_defineProperty, "_defineProperty"); function _toPropertyKey(t2) { @@ -182766,15 +210846,15 @@ function _toPropertyKey(t2) { return "symbol" == _typeof(i2) ? i2 : i2 + ""; } __name(_toPropertyKey, "_toPropertyKey"); -function _toPrimitive(t2, r) { +function _toPrimitive(t2, r2) { if ("object" != _typeof(t2) || !t2) return t2; var e2 = t2[Symbol.toPrimitive]; if (void 0 !== e2) { - var i2 = e2.call(t2, r || "default"); + var i2 = e2.call(t2, r2 || "default"); if ("object" != _typeof(i2)) return i2; throw new TypeError("@@toPrimitive must return a primitive value."); } - return ("string" === r ? String : Number)(t2); + return ("string" === r2 ? String : Number)(t2); } __name(_toPrimitive, "_toPrimitive"); var _hoisted_1$1$1 = ["id", "aria-label", "aria-roledescription"]; @@ -182868,12 +210948,12 @@ var script$5 = { emits: ["update:activeIndex", "update:visible"], container: null, mask: null, - data: /* @__PURE__ */ __name(function data22() { + data: /* @__PURE__ */ __name(function data23() { return { containerVisible: this.visible }; }, "data"), - updated: /* @__PURE__ */ __name(function updated12() { + updated: /* @__PURE__ */ __name(function updated13() { if (this.fullScreen && this.visible) { this.containerVisible = this.visible; } @@ -182928,7 +211008,7 @@ var script$5 = { }, components: { GalleriaContent: script$1$1, - Portal: script$Q + Portal: script$T }, directives: { focustrap: FocusTrap @@ -182982,9 +211062,9 @@ function render$4(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$4, "render$4"); script$5.render = render$4; -const _withScopeId$2 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-ffe66146"), n = n(), popScopeId(), n), "_withScopeId$2"); -const _hoisted_1$6 = ["src", "data-test"]; -const _hoisted_2$6 = ["src"]; +const _withScopeId$2 = /* @__PURE__ */ __name((n2) => (pushScopeId("data-v-a748ccd8"), n2 = n2(), popScopeId(), n2), "_withScopeId$2"); +const _hoisted_1$6 = ["src", "data-test", "alt"]; +const _hoisted_2$6 = ["src", "alt"]; const _hoisted_3$3 = { key: 1, class: "broken-image-placeholder" @@ -182995,7 +211075,8 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({ props: { src: {}, class: {}, - contain: { type: Boolean, default: false } + contain: { type: Boolean, default: false }, + alt: { default: "Image content" } }, setup(__props) { const props = __props; @@ -183025,12 +211106,14 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({ onError: handleImageError, "data-test": _ctx.src, class: "comfy-image-blur", - style: normalizeStyle({ "background-image": `url(${_ctx.src})` }) + style: normalizeStyle({ "background-image": `url(${_ctx.src})` }), + alt: _ctx.alt }, null, 44, _hoisted_1$6)) : createCommentVNode("", true), createBaseVNode("img", { src: _ctx.src, onError: handleImageError, - class: normalizeClass(["comfy-image-main", [...classArray.value]]) + class: normalizeClass(["comfy-image-main", [...classArray.value]]), + alt: _ctx.alt }, null, 42, _hoisted_2$6) ], 2)) : createCommentVNode("", true), imageBroken.value ? (openBlock(), createElementBlock("div", _hoisted_3$3, [ @@ -183041,7 +211124,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({ }; } }); -const ComfyImage = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-ffe66146"]]); +const ComfyImage = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-a748ccd8"]]); const _hoisted_1$5 = { controls: "", width: "100%", @@ -183168,8 +211251,9 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({ key: item3.url, src: item3.url, contain: false, + alt: item3.filename, class: "galleria-image" - }, null, 8, ["src"])) : item3.isVideo ? (openBlock(), createBlock(_sfc_main$8, { + }, null, 8, ["src", "alt"])) : item3.isVideo ? (openBlock(), createBlock(_sfc_main$8, { key: 1, result: item3 }, null, 8, ["result"])) : createCommentVNode("", true) @@ -183179,7 +211263,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({ }; } }); -const _withScopeId$1 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-61515e14"), n = n(), popScopeId(), n), "_withScopeId$1"); +const _withScopeId$1 = /* @__PURE__ */ __name((n2) => (pushScopeId("data-v-2403edc6"), n2 = n2(), popScopeId(), n2), "_withScopeId$1"); const _hoisted_1$4 = { key: 2, class: "task-result-preview" @@ -183220,8 +211304,9 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({ key: 0, src: _ctx.result.url, class: "task-output-image", - contain: imageFit.value === "contain" - }, null, 8, ["src", "contain"])) : _ctx.result.isVideo ? (openBlock(), createBlock(_sfc_main$8, { + contain: imageFit.value === "contain", + alt: _ctx.result.filename + }, null, 8, ["src", "contain", "alt"])) : _ctx.result.isVideo ? (openBlock(), createBlock(_sfc_main$8, { key: 1, result: _ctx.result }, null, 8, ["result"])) : (openBlock(), createElementBlock("div", _hoisted_1$4, [ @@ -183229,7 +211314,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({ createBaseVNode("span", null, toDisplayString$1(_ctx.result.mediaType), 1) ])), _ctx.result.supportsPreview ? (openBlock(), createElementBlock("div", _hoisted_3$2, [ - createVNode(unref(script$R), { + createVNode(unref(script$U), { icon: "pi pi-eye", severity: "secondary", onClick: _cache[0] || (_cache[0] = ($event) => emit2("preview", _ctx.result)), @@ -183240,8 +211325,8 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({ }; } }); -const ResultItem = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-61515e14"]]); -const _withScopeId = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-b676a511"), n = n(), popScopeId(), n), "_withScopeId"); +const ResultItem = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-2403edc6"]]); +const _withScopeId = /* @__PURE__ */ __name((n2) => (pushScopeId("data-v-b676a511"), n2 = n2(), popScopeId(), n2), "_withScopeId"); const _hoisted_1$3 = { class: "task-result-preview" }; const _hoisted_2$3 = { key: 0, @@ -183283,7 +211368,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({ const flatOutputs = props.task.flatOutputs; const coverResult = flatOutputs.length ? props.task.previewOutput || flatOutputs[0] : null; const node3 = flatOutputs.length && props.task.workflow ? props.task.workflow.nodes.find( - (n) => n.id == coverResult.nodeId + (n2) => n2.id == coverResult.nodeId ) ?? null : null; const progressPreviewBlobUrl = ref(""); const emit2 = __emit; @@ -183376,12 +211461,12 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({ ]), createBaseVNode("div", _hoisted_7, [ createBaseVNode("div", _hoisted_8, [ - _ctx.isFlatTask && _ctx.task.isHistory ? (openBlock(), createBlock(unref(script$x), { + _ctx.isFlatTask && _ctx.task.isHistory ? (openBlock(), createBlock(unref(script$v), { key: 0, class: "node-name-tag" }, { default: withCtx(() => [ - createVNode(unref(script$R), { + createVNode(unref(script$U), { class: "task-node-link", label: `${unref(node3)?.type} (#${unref(node3)?.id})`, link: "", @@ -183391,7 +211476,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({ ]), _: 1 })) : createCommentVNode("", true), - createVNode(unref(script$x), { + createVNode(unref(script$v), { severity: taskTagSeverity(_ctx.task.displayStatus) }, { default: withCtx(() => [ @@ -183405,7 +211490,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({ }, 8, ["severity"]) ]), createBaseVNode("div", _hoisted_12, [ - _ctx.task.isHistory && unref(flatOutputs).length > 1 ? (openBlock(), createBlock(unref(script$R), { + _ctx.task.isHistory && unref(flatOutputs).length > 1 ? (openBlock(), createBlock(unref(script$U), { key: 0, outlined: "", onClick: handleOutputLengthClick @@ -183486,9 +211571,6 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({ }, "accept") }); }, "confirmRemoveAll"); - const onStatus = /* @__PURE__ */ __name(async () => { - await queueStore.update(); - }, "onStatus"); const menu2 = ref(null); const menuTargetTask = ref(null); const menuTargetNode = ref(null); @@ -183546,13 +211628,6 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({ const newIndex = galleryActiveIndex.value + lengthChange; galleryActiveIndex.value = Math.max(0, newIndex); }); - onMounted(() => { - api.addEventListener("status", onStatus); - queueStore.update(); - }); - onUnmounted(() => { - api.removeEventListener("status", onStatus); - }); return (_ctx, _cache) => { const _directive_tooltip = resolveDirective("tooltip"); return openBlock(), createElementBlock(Fragment$1, null, [ @@ -183560,7 +211635,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({ title: _ctx.$t("sideToolbar.queue") }, { "tool-buttons": withCtx(() => [ - withDirectives(createVNode(unref(script$R), { + withDirectives(createVNode(unref(script$U), { icon: imageFit.value === "cover" ? "pi pi-arrow-down-left-and-arrow-up-right-to-center" : "pi pi-arrow-up-right-and-arrow-down-left-from-center", text: "", severity: "secondary", @@ -183574,7 +211649,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({ { bottom: true } ] ]), - isInFolderView.value ? withDirectives((openBlock(), createBlock(unref(script$R), { + isInFolderView.value ? withDirectives((openBlock(), createBlock(unref(script$U), { key: 0, icon: "pi pi-arrow-left", text: "", @@ -183589,7 +211664,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({ { bottom: true } ] ]) : (openBlock(), createElementBlock(Fragment$1, { key: 1 }, [ - withDirectives(createVNode(unref(script$R), { + withDirectives(createVNode(unref(script$U), { icon: isExpanded.value ? "pi pi-images" : "pi pi-image", text: "", severity: "secondary", @@ -183598,7 +211673,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({ }, null, 8, ["icon"]), [ [_directive_tooltip, _ctx.$t("sideToolbar.queueTab.showFlatList")] ]), - unref(queueStore).hasPendingTasks ? withDirectives((openBlock(), createBlock(unref(script$R), { + unref(queueStore).hasPendingTasks ? withDirectives((openBlock(), createBlock(unref(script$U), { key: 0, icon: "pi pi-stop", severity: "danger", @@ -183612,7 +211687,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({ { bottom: true } ] ]) : createCommentVNode("", true), - createVNode(unref(script$R), { + createVNode(unref(script$U), { icon: "pi pi-trash", text: "", severity: "primary", @@ -183643,7 +211718,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({ ]), _: 1 }, 8, ["items"])) : unref(queueStore).isLoading ? (openBlock(), createElementBlock("div", _hoisted_1$2, [ - createVNode(unref(script$Y), { style: { "width": "50px", "left": "50%", "transform": "translateX(-50%)" } }) + createVNode(unref(script$$), { style: { "width": "50px", "left": "50%", "transform": "translateX(-50%)" } }) ])) : (openBlock(), createElementBlock("div", _hoisted_2$2, [ createVNode(NoResultsPlaceholder, { icon: "pi pi-info-circle", @@ -183655,7 +211730,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({ _: 1 }, 8, ["title"]), createVNode(unref(script$6)), - createVNode(unref(script$e), { + createVNode(unref(script$c), { ref_key: "menu", ref: menu2, model: menuItems.value @@ -183685,7 +211760,7 @@ const useQueueSidebarTab = /* @__PURE__ */ __name(() => { type: "vue" }; }, "useQueueSidebarTab"); -var theme = /* @__PURE__ */ __name(function theme39(_ref) { +var theme = /* @__PURE__ */ __name(function theme41(_ref) { var dt2 = _ref.dt; return "\n.p-confirmdialog .p-dialog-content {\n display: flex;\n align-items: center;\n gap: ".concat(dt2("confirmdialog.content.gap"), ";\n}\n\n.p-confirmdialog-icon {\n color: ").concat(dt2("confirmdialog.icon.color"), ";\n font-size: ").concat(dt2("confirmdialog.icon.size"), ";\n width: ").concat(dt2("confirmdialog.icon.size"), ";\n height: ").concat(dt2("confirmdialog.icon.size"), ";\n}\n"); }, "theme"); @@ -183703,7 +211778,7 @@ var ConfirmDialogStyle = BaseStyle.extend({ }); var script$1 = { name: "BaseConfirmDialog", - "extends": script$_, + "extends": script$11, props: { group: String, breakpoints: { @@ -183716,7 +211791,7 @@ var script$1 = { } }, style: ConfirmDialogStyle, - provide: /* @__PURE__ */ __name(function provide41() { + provide: /* @__PURE__ */ __name(function provide43() { return { $pcConfirmDialog: this, $parentInstance: this @@ -183728,13 +211803,13 @@ var script = { "extends": script$1, confirmListener: null, closeListener: null, - data: /* @__PURE__ */ __name(function data23() { + data: /* @__PURE__ */ __name(function data24() { return { visible: false, confirmation: null }; }, "data"), - mounted: /* @__PURE__ */ __name(function mounted22() { + mounted: /* @__PURE__ */ __name(function mounted24() { var _this = this; this.confirmListener = function(options4) { if (!options4) { @@ -183827,8 +211902,8 @@ var script = { }, "closeOnEscape") }, components: { - Dialog: script$P, - Button: script$R + Dialog: script$S, + Button: script$U } }; function render(_ctx, _cache, $props, $setup, $data, $options) { @@ -183968,7 +212043,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({ class: normalizeClass(["flex items-center", props.class]) }, [ _ctx.position === "left" ? (openBlock(), createElementBlock("span", _hoisted_1$1, toDisplayString$1(_ctx.text), 1)) : createCommentVNode("", true), - createVNode(unref(script$O), { + createVNode(unref(script$R), { align: _ctx.align, type: _ctx.type, layout: _ctx.layout, @@ -183993,7 +212068,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({ return (_ctx, _cache) => { return openBlock(), createBlock(TreeExplorerTreeNode, { node: _ctx.node }, { actions: withCtx(({ node: node3 }) => [ - createVNode(unref(script$R), { + createVNode(unref(script$U), { icon: isBookmarked.value ? "pi pi-bookmark-fill" : "pi pi-bookmark", text: "", severity: "secondary", @@ -184141,7 +212216,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({ class: "workflows-sidebar-tab bg-[var(--p-tree-background)]" }, { "tool-buttons": withCtx(() => [ - withDirectives(createVNode(unref(script$R), { + withDirectives(createVNode(unref(script$U), { class: "browse-templates-button", icon: "pi pi-th-large", text: "", @@ -184154,7 +212229,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({ { bottom: true } ] ]), - withDirectives(createVNode(unref(script$R), { + withDirectives(createVNode(unref(script$U), { class: "open-workflow-button", icon: "pi pi-folder-open", text: "", @@ -184167,7 +212242,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({ { bottom: true } ] ]), - withDirectives(createVNode(unref(script$R), { + withDirectives(createVNode(unref(script$U), { class: "new-blank-workflow-button", icon: "pi pi-plus", onClick: _cache[2] || (_cache[2] = () => unref(commandStore).execute("Comfy.NewBlankWorkflow")), @@ -184212,7 +212287,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({ node22.data.isModified || !node22.data.isPersisted ? (openBlock(), createElementBlock("span", _hoisted_3, "*")) : createCommentVNode("", true) ]), actions: withCtx(({ node: node22 }) => [ - createVNode(unref(script$R), { + createVNode(unref(script$U), { class: "close-workflow-button", icon: "pi pi-times", text: "", @@ -184450,12 +212525,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ const _component_router_view = resolveComponent("router-view"); return openBlock(), createElementBlock(Fragment$1, null, [ createVNode(_component_router_view), - isLoading.value ? (openBlock(), createBlock(unref(script$Y), { + isLoading.value ? (openBlock(), createBlock(unref(script$$), { key: 0, class: "absolute inset-0 flex justify-center items-center h-screen" })) : createCommentVNode("", true), - createVNode(_sfc_main$Z), - createVNode(unref(script$Z), { + createVNode(_sfc_main$_), + createVNode(unref(script$10), { "full-screen": "", blocked: isLoading.value }, null, 8, ["blocked"]) @@ -184470,6 +212545,17 @@ const ComfyUIPreset = definePreset(index$2, { }); const app = createApp(_sfc_main); const pinia = createPinia(); +init$3({ + app, + dsn: "https://e2d0c0bd392ffdce48e856c2a055f437@o4507954455314432.ingest.us.sentry.io/4508621568475136", + enabled: true, + release: "1.7.14", + integrations: [], + autoSessionTracking: false, + defaultIntegrations: false, + normalizeDepth: 8, + tracesSampleRate: 0 +}); app.directive("tooltip", Tooltip); app.use(router).use(PrimeVue, { theme: { @@ -184487,217 +212573,225 @@ app.use(router).use(PrimeVue, { } }).use(ConfirmationService).use(ToastService).use(pinia).use(i18n).mount("#vue-app"); export { - defineStore as $, - getVNodeProp as A, + script$y as $, + getHeight as A, BaseStyle as B, - isArray$5 as C, - mergeProps as D, - renderList as E, - Fragment$1 as F, - resolveDynamicComponent as G, - createBaseVNode as H, - createCommentVNode as I, - renderSlot as J, - useSidebarTabStore as K, - useBottomPanelStore as L, - withCtx as M, - createVNode as N, - getAttribute as O, - findSingle as P, - focus$1 as Q, - equals as R, - Ripple as S, - normalizeClass as T, - getOffset as U, - script$v as V, - script$u as W, - toDisplayString$1 as X, - script$A as Y, - markRaw as Z, + getOuterWidth as C, + getOuterHeight as D, + getVNodeProp as E, + isArray$a as F, + mergeProps as G, + Fragment$1 as H, + renderList as I, + createBlock as J, + resolveDynamicComponent as K, + createCommentVNode as L, + renderSlot as M, + useSidebarTabStore as N, + useBottomPanelStore as O, + withCtx as P, + getAttribute as Q, + findSingle as R, + focus$1 as S, + equals as T, + Ripple as U, + normalizeClass as V, + getOffset as W, + script$t as X, + script$s as Y, + toDisplayString$1 as Z, _export_sfc as _, useSettingStore as a, useKeybindingStore as a$, - shallowRef as a0, - useI18n as a1, - useCommandStore as a2, - LiteGraph as a3, - useColorPaletteStore as a4, - watch as a5, - useNodeDefStore as a6, - BadgePosition as a7, - LGraphBadge as a8, - _ as a9, - script$y as aA, - resolveComponent as aB, - Transition as aC, - createSlots as aD, - createTextVNode as aE, - useNodeFrequencyStore as aF, - useNodeBookmarkStore as aG, - highlightQuery as aH, - script$x as aI, - formatNumberWithSuffix as aJ, - NodeSourceType as aK, - pushScopeId as aL, - popScopeId as aM, + markRaw as a0, + defineStore as a1, + shallowRef as a2, + useI18n as a3, + useCommandStore as a4, + LiteGraph as a5, + useColorPaletteStore as a6, + watch as a7, + useNodeDefStore as a8, + BadgePosition as a9, + script$n as aA, + script$W as aB, + script$w as aC, + resolveComponent as aD, + Transition as aE, + createSlots as aF, + createTextVNode as aG, + useNodeFrequencyStore as aH, + useNodeBookmarkStore as aI, + highlightQuery as aJ, + script$v as aK, + formatNumberWithSuffix as aL, + NodeSourceType as aM, NodePreview as aN, NodeSearchFilter as aO, - script$P as aP, + script$S as aP, SearchFilterChip as aQ, useLitegraphService as aR, storeToRefs as aS, isRef as aT, toRaw as aU, LinkReleaseTriggerAction as aV, - script$S as aW, + script$V as aW, useUserStore as aX, useDialogStore as aY, SettingDialogHeader as aZ, SettingDialogContent as a_, - NodeBadgeMode as aa, - ref as ab, - useEventListener as ac, - nextTick as ad, - st as ae, - normalizeI18nKey as af, - LGraphGroup as ag, - LGraphNode as ah, - EditableText as ai, - isNotEmpty as aj, - UniqueComponentId as ak, - ZIndex as al, - resolveFieldData as am, - OverlayEventBus as an, - isEmpty$1 as ao, - addStyle as ap, - relativePosition as aq, - absolutePosition as ar, - ConnectedOverlayScrollHandler as as, - isTouchDevice as at, - findLastIndex as au, - script$G as av, - script$F as aw, - script$Q as ax, - script$p as ay, + LGraphBadge as aa, + _ as ab, + NodeBadgeMode as ac, + ref as ad, + useEventListener as ae, + nextTick as af, + st as ag, + normalizeI18nKey as ah, + LGraphGroup as ai, + LGraphNode as aj, + EditableText as ak, + isNotEmpty as al, + UniqueComponentId as am, + ZIndex as an, + resolveFieldData as ao, + OverlayEventBus as ap, + isEmpty$1 as aq, + addStyle as ar, + relativePosition as as, + absolutePosition as at, + ConnectedOverlayScrollHandler as au, + isTouchDevice as av, + findLastIndex as aw, + script$O as ax, + script$D as ay, script$T as az, useWorkflowStore as b, - BaseTerminal as b$, + i18n as b$, Teleport as b0, - LinkMarkerShape as b1, - useModelToNodeStore as b2, - CanvasPointer as b3, - IS_CONTROL_WIDGET as b4, - updateControlWidgetLabel as b5, - useColorPaletteService as b6, - setStorageValue as b7, - api as b8, - usePragmaticDroppable as b9, - useQueuePendingTaskCountStore as bA, - useLocalStorage as bB, - useDraggable as bC, - watchDebounced as bD, - inject as bE, - useElementBounding as bF, - lodashExports as bG, - useEventBus as bH, - script$n as bI, - guardReactiveProps as bJ, - useMenuItemStore as bK, - usePragmaticDraggable as bL, - withModifiers as bM, - script$7 as bN, - script$e as bO, - provide as bP, - script$O as bQ, - useDialogService as bR, - LGraphEventMode as bS, - useQueueStore as bT, - i18n as bU, - useModelStore as bV, - useRouter as bW, - withKeys as bX, - script$o as bY, - script$q as bZ, - ProgressStatus as b_, - LGraph$1 as ba, - LLink as bb, - DragAndScale as bc, - LGraphCanvas as bd, - ContextMenu as be, - ChangeTracker as bf, - useWorkflowService as bg, - ComfyNodeDefImpl as bh, - ComfyModelDef as bi, - script$r as bj, - script$K as bk, - script$s as bl, - script$z as bm, - script$W as bn, - normalizeProps as bo, - ToastEventBus as bp, - setAttribute as bq, - TransitionGroup as br, - useToast as bs, - useToastStore as bt, - resolve$1 as bu, - nestedPosition as bv, - script$f as bw, - isPrintableCharacter as bx, - useQueueSettingsStore as by, - script$l as bz, + usePragmaticDraggable as b1, + usePragmaticDroppable as b2, + withModifiers as b3, + useWorkflowService as b4, + useWorkflowBookmarkStore as b5, + script$7 as b6, + script$Q as b7, + script$c as b8, + LinkMarkerShape as b9, + useToastStore as bA, + resolve$2 as bB, + nestedPosition as bC, + script$d as bD, + isPrintableCharacter as bE, + useQueueSettingsStore as bF, + script$j as bG, + useQueuePendingTaskCountStore as bH, + useLocalStorage as bI, + useDraggable as bJ, + watchDebounced as bK, + inject as bL, + useElementBounding as bM, + script$L as bN, + lodashExports as bO, + useEventBus as bP, + script$l as bQ, + guardReactiveProps as bR, + useMenuItemStore as bS, + isElectron as bT, + provide as bU, + electronAPI as bV, + useDialogService as bW, + LGraphEventMode as bX, + useQueueStore as bY, + DEFAULT_DARK_COLOR_PALETTE as bZ, + DEFAULT_LIGHT_COLOR_PALETTE as b_, + useModelToNodeStore as ba, + getStorageValue as bb, + CanvasPointer as bc, + IS_CONTROL_WIDGET as bd, + updateControlWidgetLabel as be, + useColorPaletteService as bf, + setStorageValue as bg, + api as bh, + LGraph$1 as bi, + LLink as bj, + DragAndScale as bk, + LGraphCanvas as bl, + ContextMenu as bm, + ChangeTracker as bn, + ComfyNodeDefImpl as bo, + ComfyModelDef as bp, + script$p as bq, + script$J as br, + script$q as bs, + script$x as bt, + script$Z as bu, + normalizeProps as bv, + ToastEventBus as bw, + setAttribute as bx, + TransitionGroup as by, + useToast as bz, computed as c, - electronAPI as c0, - findIndexInList as c1, - find$1 as c2, - useModel as c3, - script$k as c4, - script$H as c5, - script$I as c6, - MigrationItems as c7, - script$c as c8, - script$d as c9, - FocusTrap as cA, - getIndex as cB, - isClickable as cC, - clearSelection as cD, - localeComparator as cE, - sort as cF, - FilterService as cG, - exportCSV as cH, - getHiddenElementOuterWidth as cI, - getHiddenElementOuterHeight as cJ, - reorderArray as cK, - getWindowScrollTop as cL, - removeClass as cM, - addClass as cN, - useCopyToClipboard as cO, - FormItem as cP, - ComfyDialog as ca, - $el as cb, - ComfyApp as cc, - useExtensionService as cd, - processDynamicPrompt as ce, - isElectron as cf, - t as cg, - DraggableList as ch, - applyTextReplacements as ci, - ComfyWidgets as cj, - addValueControlWidgets as ck, - serialise as cl, - deserialiseAndCreate as cm, - FilterMatchMode as cn, - SearchBox as co, - _sfc_main$K as cp, - KeyComboImpl as cq, - KeybindingImpl as cr, - useExtensionStore as cs, - script$X as ct, - getFirstFocusableElement as cu, - invokeElementMethod as cv, - getNextElementSibling as cw, - getPreviousElementSibling as cx, - _default as cy, - FilterOperator as cz, + useErrorHandling as c0, + useModelStore as c1, + useRouter as c2, + withKeys as c3, + script$R as c4, + script$m as c5, + script$o as c6, + ProgressStatus as c7, + BaseTerminal as c8, + findIndexInList as c9, + script$_ as cA, + getFirstFocusableElement as cB, + invokeElementMethod as cC, + getNextElementSibling as cD, + getPreviousElementSibling as cE, + _default as cF, + FilterOperator as cG, + script$M as cH, + FocusTrap as cI, + getIndex as cJ, + isClickable as cK, + clearSelection as cL, + localeComparator as cM, + sort as cN, + FilterService as cO, + exportCSV as cP, + getHiddenElementOuterWidth as cQ, + getHiddenElementOuterHeight as cR, + reorderArray as cS, + getWindowScrollTop as cT, + removeClass as cU, + addClass as cV, + useCopyToClipboard as cW, + FormItem as cX, + find$1 as ca, + useModel as cb, + script$i as cc, + script$E as cd, + script$F as ce, + MigrationItems as cf, + script$I as cg, + script$B as ch, + ComfyDialog as ci, + $el as cj, + ComfyApp as ck, + useExtensionService as cl, + processDynamicPrompt as cm, + t as cn, + DraggableList as co, + applyTextReplacements as cp, + ComfyWidgets as cq, + addValueControlWidgets as cr, + serialise as cs, + deserialiseAndCreate as ct, + FilterMatchMode as cu, + SearchBox as cv, + _sfc_main$K as cw, + KeyComboImpl as cx, + KeybindingImpl as cy, + useExtensionStore as cz, defineComponent as d, useTitle as e, createElementBlock as f, @@ -184705,21 +212799,21 @@ export { app$1 as h, withDirectives as i, unref as j, - createBlock as k, - script$R as l, - onMounted as m, + createVNode as k, + script$U as l, + createBaseVNode as m, normalizeStyle as n, openBlock as o, - onBeforeUnmount as p, - script$_ as q, + pushScopeId as p, + popScopeId as q, resolveDirective as r, showNativeMenu as s, - getWidth as t, + onMounted as t, useExecutionStore as u, vShow as v, watchEffect as w, - getHeight as x, - getOuterWidth as y, - getOuterHeight as z + onBeforeUnmount as x, + script$11 as y, + getWidth as z }; -//# sourceMappingURL=index-DjNHn37O.js.map +//# sourceMappingURL=index-QvfM__ze.js.map diff --git a/web/assets/index-jXPKy3pP.js b/web/assets/index-jXPKy3pP.js deleted file mode 100644 index 1efdf332..00000000 --- a/web/assets/index-jXPKy3pP.js +++ /dev/null @@ -1,173 +0,0 @@ -var __defProp = Object.defineProperty; -var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { B as BaseStyle, q as script$2, ak as UniqueComponentId, c9 as script$4, l as script$5, S as Ripple, aB as resolveComponent, o as openBlock, f as createElementBlock, D as mergeProps, H as createBaseVNode, J as renderSlot, T as normalizeClass, X as toDisplayString, I as createCommentVNode, k as createBlock, M as withCtx, G as resolveDynamicComponent, N as createVNode, aC as Transition, i as withDirectives, v as vShow } from "./index-DjNHn37O.js"; -import { s as script$3 } from "./index-5HFeZax4.js"; -var theme = /* @__PURE__ */ __name(function theme2(_ref) { - var dt = _ref.dt; - return "\n.p-panel {\n border: 1px solid ".concat(dt("panel.border.color"), ";\n border-radius: ").concat(dt("panel.border.radius"), ";\n background: ").concat(dt("panel.background"), ";\n color: ").concat(dt("panel.color"), ";\n}\n\n.p-panel-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: ").concat(dt("panel.header.padding"), ";\n background: ").concat(dt("panel.header.background"), ";\n color: ").concat(dt("panel.header.color"), ";\n border-style: solid;\n border-width: ").concat(dt("panel.header.border.width"), ";\n border-color: ").concat(dt("panel.header.border.color"), ";\n border-radius: ").concat(dt("panel.header.border.radius"), ";\n}\n\n.p-panel-toggleable .p-panel-header {\n padding: ").concat(dt("panel.toggleable.header.padding"), ";\n}\n\n.p-panel-title {\n line-height: 1;\n font-weight: ").concat(dt("panel.title.font.weight"), ";\n}\n\n.p-panel-content {\n padding: ").concat(dt("panel.content.padding"), ";\n}\n\n.p-panel-footer {\n padding: ").concat(dt("panel.footer.padding"), ";\n}\n"); -}, "theme"); -var classes = { - root: /* @__PURE__ */ __name(function root(_ref2) { - var props = _ref2.props; - return ["p-panel p-component", { - "p-panel-toggleable": props.toggleable - }]; - }, "root"), - header: "p-panel-header", - title: "p-panel-title", - headerActions: "p-panel-header-actions", - pcToggleButton: "p-panel-toggle-button", - contentContainer: "p-panel-content-container", - content: "p-panel-content", - footer: "p-panel-footer" -}; -var PanelStyle = BaseStyle.extend({ - name: "panel", - theme, - classes -}); -var script$1 = { - name: "BasePanel", - "extends": script$2, - props: { - header: String, - toggleable: Boolean, - collapsed: Boolean, - toggleButtonProps: { - type: Object, - "default": /* @__PURE__ */ __name(function _default() { - return { - severity: "secondary", - text: true, - rounded: true - }; - }, "_default") - } - }, - style: PanelStyle, - provide: /* @__PURE__ */ __name(function provide() { - return { - $pcPanel: this, - $parentInstance: this - }; - }, "provide") -}; -var script = { - name: "Panel", - "extends": script$1, - inheritAttrs: false, - emits: ["update:collapsed", "toggle"], - data: /* @__PURE__ */ __name(function data() { - return { - id: this.$attrs.id, - d_collapsed: this.collapsed - }; - }, "data"), - watch: { - "$attrs.id": /* @__PURE__ */ __name(function $attrsId(newValue) { - this.id = newValue || UniqueComponentId(); - }, "$attrsId"), - collapsed: /* @__PURE__ */ __name(function collapsed(newValue) { - this.d_collapsed = newValue; - }, "collapsed") - }, - mounted: /* @__PURE__ */ __name(function mounted() { - this.id = this.id || UniqueComponentId(); - }, "mounted"), - methods: { - toggle: /* @__PURE__ */ __name(function toggle(event) { - this.d_collapsed = !this.d_collapsed; - this.$emit("update:collapsed", this.d_collapsed); - this.$emit("toggle", { - originalEvent: event, - value: this.d_collapsed - }); - }, "toggle"), - onKeyDown: /* @__PURE__ */ __name(function onKeyDown(event) { - if (event.code === "Enter" || event.code === "NumpadEnter" || event.code === "Space") { - this.toggle(event); - event.preventDefault(); - } - }, "onKeyDown") - }, - computed: { - buttonAriaLabel: /* @__PURE__ */ __name(function buttonAriaLabel() { - return this.toggleButtonProps && this.toggleButtonProps.ariaLabel ? this.toggleButtonProps.ariaLabel : this.header; - }, "buttonAriaLabel") - }, - components: { - PlusIcon: script$3, - MinusIcon: script$4, - Button: script$5 - }, - directives: { - ripple: Ripple - } -}; -var _hoisted_1 = ["id"]; -var _hoisted_2 = ["id", "aria-labelledby"]; -function render(_ctx, _cache, $props, $setup, $data, $options) { - var _component_Button = resolveComponent("Button"); - return openBlock(), createElementBlock("div", mergeProps({ - "class": _ctx.cx("root") - }, _ctx.ptmi("root")), [createBaseVNode("div", mergeProps({ - "class": _ctx.cx("header") - }, _ctx.ptm("header")), [renderSlot(_ctx.$slots, "header", { - id: $data.id + "_header", - "class": normalizeClass(_ctx.cx("title")) - }, function() { - return [_ctx.header ? (openBlock(), createElementBlock("span", mergeProps({ - key: 0, - id: $data.id + "_header", - "class": _ctx.cx("title") - }, _ctx.ptm("title")), toDisplayString(_ctx.header), 17, _hoisted_1)) : createCommentVNode("", true)]; - }), createBaseVNode("div", mergeProps({ - "class": _ctx.cx("headerActions") - }, _ctx.ptm("headerActions")), [renderSlot(_ctx.$slots, "icons"), _ctx.toggleable ? (openBlock(), createBlock(_component_Button, mergeProps({ - key: 0, - id: $data.id + "_header", - "class": _ctx.cx("pcToggleButton"), - "aria-label": $options.buttonAriaLabel, - "aria-controls": $data.id + "_content", - "aria-expanded": !$data.d_collapsed, - unstyled: _ctx.unstyled, - onClick: $options.toggle, - onKeydown: $options.onKeyDown - }, _ctx.toggleButtonProps, { - pt: _ctx.ptm("pcToggleButton") - }), { - icon: withCtx(function(slotProps) { - return [renderSlot(_ctx.$slots, _ctx.$slots.toggleicon ? "toggleicon" : "togglericon", { - collapsed: $data.d_collapsed - }, function() { - return [(openBlock(), createBlock(resolveDynamicComponent($data.d_collapsed ? "PlusIcon" : "MinusIcon"), mergeProps({ - "class": slotProps["class"] - }, _ctx.ptm("pcToggleButton")["icon"]), null, 16, ["class"]))]; - })]; - }), - _: 3 - }, 16, ["id", "class", "aria-label", "aria-controls", "aria-expanded", "unstyled", "onClick", "onKeydown", "pt"])) : createCommentVNode("", true)], 16)], 16), createVNode(Transition, mergeProps({ - name: "p-toggleable-content" - }, _ctx.ptm("transition")), { - "default": withCtx(function() { - return [withDirectives(createBaseVNode("div", mergeProps({ - id: $data.id + "_content", - "class": _ctx.cx("contentContainer"), - role: "region", - "aria-labelledby": $data.id + "_header" - }, _ctx.ptm("contentContainer")), [createBaseVNode("div", mergeProps({ - "class": _ctx.cx("content") - }, _ctx.ptm("content")), [renderSlot(_ctx.$slots, "default")], 16), _ctx.$slots.footer ? (openBlock(), createElementBlock("div", mergeProps({ - key: 0, - "class": _ctx.cx("footer") - }, _ctx.ptm("footer")), [renderSlot(_ctx.$slots, "footer")], 16)) : createCommentVNode("", true)], 16, _hoisted_2), [[vShow, !$data.d_collapsed]])]; - }), - _: 3 - }, 16)], 16); -} -__name(render, "render"); -script.render = render; -export { - script as s -}; -//# sourceMappingURL=index-jXPKy3pP.js.map diff --git a/web/assets/index-Bordpmzt.js b/web/assets/index-je62U6DH.js similarity index 99% rename from web/assets/index-Bordpmzt.js rename to web/assets/index-je62U6DH.js index 85a75572..6acbfcc2 100644 --- a/web/assets/index-Bordpmzt.js +++ b/web/assets/index-je62U6DH.js @@ -1,6 +1,6 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { ca as ComfyDialog, cb as $el, cc as ComfyApp, h as app, a3 as LiteGraph, bd as LGraphCanvas, cd as useExtensionService, ce as processDynamicPrompt, cf as isElectron, c0 as electronAPI, bR as useDialogService, cg as t, ch as DraggableList, bt as useToastStore, ah as LGraphNode, ci as applyTextReplacements, cj as ComfyWidgets, ck as addValueControlWidgets, a6 as useNodeDefStore, cl as serialise, cm as deserialiseAndCreate, b8 as api, a as useSettingStore, ag as LGraphGroup, ad as nextTick } from "./index-DjNHn37O.js"; +import { ci as ComfyDialog, cj as $el, ck as ComfyApp, h as app, a5 as LiteGraph, bl as LGraphCanvas, cl as useExtensionService, cm as processDynamicPrompt, bT as isElectron, bV as electronAPI, bW as useDialogService, cn as t, co as DraggableList, bA as useToastStore, aj as LGraphNode, cp as applyTextReplacements, cq as ComfyWidgets, cr as addValueControlWidgets, a8 as useNodeDefStore, cs as serialise, ct as deserialiseAndCreate, bh as api, a as useSettingStore, ai as LGraphGroup, af as nextTick, bO as lodashExports, bg as setStorageValue, bb as getStorageValue } from "./index-QvfM__ze.js"; class ClipspaceDialog extends ComfyDialog { static { __name(this, "ClipspaceDialog"); @@ -441,10 +441,24 @@ app.registerExtension({ { id: "Comfy-Desktop.SendStatistics", category: ["Comfy-Desktop", "General", "Send Statistics"], - name: "Send anonymous crash reports", + name: "Send anonymous usage metrics", type: "boolean", defaultValue: true, onChange: onChangeRestartApp + }, + { + id: "Comfy-Desktop.WindowStyle", + category: ["Comfy-Desktop", "General", "Window Style"], + name: "Window Style", + tooltip: "Choose custom option to hide the system title bar", + type: "combo", + experimental: true, + defaultValue: "default", + options: ["default", "custom"], + onChange: /* @__PURE__ */ __name((newValue, oldValue) => { + electronAPI$1.Config.setWindowStyle(newValue); + onChangeRestartApp(newValue, oldValue); + }, "onChange") } ], commands: [ @@ -2968,10 +2982,10 @@ function manageGroupNodes(type) { new ManageGroupDialog(app).show(type); } __name(manageGroupNodes, "manageGroupNodes"); -const id$2 = "Comfy.GroupNode"; +const id$1 = "Comfy.GroupNode"; let globalDefs; const ext = { - name: id$2, + name: id$1, commands: [ { id: "Comfy.GroupNode.ConvertSelectedNodesToGroupNode", @@ -3234,39 +3248,6 @@ app.registerExtension({ }; } }); -const id$1 = "Comfy.InvertMenuScrolling"; -app.registerExtension({ - name: id$1, - init() { - const ctxMenu = LiteGraph.ContextMenu; - const replace = /* @__PURE__ */ __name(() => { - LiteGraph.ContextMenu = function(values, options) { - options = options || {}; - if (options.scroll_speed) { - options.scroll_speed *= -1; - } else { - options.scroll_speed = -0.1; - } - return ctxMenu.call(this, values, options); - }; - LiteGraph.ContextMenu.prototype = ctxMenu.prototype; - }, "replace"); - app.ui.settings.addSetting({ - id: id$1, - category: ["LiteGraph", "Menu", "InvertMenuScrolling"], - name: "Invert Context Menu Scrolling", - type: "boolean", - defaultValue: false, - onChange(value) { - if (value) { - replace(); - } else { - LiteGraph.ContextMenu = ctxMenu; - } - } - }); - } -}); /** * @license * Copyright 2010-2024 Three.js Authors @@ -36361,6 +36342,229 @@ function interceptControlUp(event) { } } __name(interceptControlUp, "interceptControlUp"); +class ViewHelper extends Object3D { + static { + __name(this, "ViewHelper"); + } + constructor(camera, domElement) { + super(); + this.isViewHelper = true; + this.animating = false; + this.center = new Vector3(); + const color1 = new Color("#ff4466"); + const color2 = new Color("#88ff44"); + const color3 = new Color("#4488ff"); + const color4 = new Color("#000000"); + const options = {}; + const interactiveObjects = []; + const raycaster = new Raycaster(); + const mouse = new Vector2(); + const dummy = new Object3D(); + const orthoCamera = new OrthographicCamera(-2, 2, 2, -2, 0, 4); + orthoCamera.position.set(0, 0, 2); + const geometry = new CylinderGeometry(0.04, 0.04, 0.8, 5).rotateZ(-Math.PI / 2).translate(0.4, 0, 0); + const xAxis = new Mesh(geometry, getAxisMaterial(color1)); + const yAxis = new Mesh(geometry, getAxisMaterial(color2)); + const zAxis = new Mesh(geometry, getAxisMaterial(color3)); + yAxis.rotation.z = Math.PI / 2; + zAxis.rotation.y = -Math.PI / 2; + this.add(xAxis); + this.add(zAxis); + this.add(yAxis); + const spriteMaterial1 = getSpriteMaterial(color1); + const spriteMaterial2 = getSpriteMaterial(color2); + const spriteMaterial3 = getSpriteMaterial(color3); + const spriteMaterial4 = getSpriteMaterial(color4); + const posXAxisHelper = new Sprite(spriteMaterial1); + const posYAxisHelper = new Sprite(spriteMaterial2); + const posZAxisHelper = new Sprite(spriteMaterial3); + const negXAxisHelper = new Sprite(spriteMaterial4); + const negYAxisHelper = new Sprite(spriteMaterial4); + const negZAxisHelper = new Sprite(spriteMaterial4); + posXAxisHelper.position.x = 1; + posYAxisHelper.position.y = 1; + posZAxisHelper.position.z = 1; + negXAxisHelper.position.x = -1; + negYAxisHelper.position.y = -1; + negZAxisHelper.position.z = -1; + negXAxisHelper.material.opacity = 0.2; + negYAxisHelper.material.opacity = 0.2; + negZAxisHelper.material.opacity = 0.2; + posXAxisHelper.userData.type = "posX"; + posYAxisHelper.userData.type = "posY"; + posZAxisHelper.userData.type = "posZ"; + negXAxisHelper.userData.type = "negX"; + negYAxisHelper.userData.type = "negY"; + negZAxisHelper.userData.type = "negZ"; + this.add(posXAxisHelper); + this.add(posYAxisHelper); + this.add(posZAxisHelper); + this.add(negXAxisHelper); + this.add(negYAxisHelper); + this.add(negZAxisHelper); + interactiveObjects.push(posXAxisHelper); + interactiveObjects.push(posYAxisHelper); + interactiveObjects.push(posZAxisHelper); + interactiveObjects.push(negXAxisHelper); + interactiveObjects.push(negYAxisHelper); + interactiveObjects.push(negZAxisHelper); + const point = new Vector3(); + const dim = 128; + const turnRate = 2 * Math.PI; + this.render = function(renderer) { + this.quaternion.copy(camera.quaternion).invert(); + this.updateMatrixWorld(); + point.set(0, 0, 1); + point.applyQuaternion(camera.quaternion); + const x = domElement.offsetWidth - dim; + renderer.clearDepth(); + renderer.getViewport(viewport); + renderer.setViewport(x, 0, dim, dim); + renderer.render(this, orthoCamera); + renderer.setViewport(viewport.x, viewport.y, viewport.z, viewport.w); + }; + const targetPosition = new Vector3(); + const targetQuaternion = new Quaternion(); + const q1 = new Quaternion(); + const q2 = new Quaternion(); + const viewport = new Vector4(); + let radius = 0; + this.handleClick = function(event) { + if (this.animating === true) return false; + const rect = domElement.getBoundingClientRect(); + const offsetX = rect.left + (domElement.offsetWidth - dim); + const offsetY = rect.top + (domElement.offsetHeight - dim); + mouse.x = (event.clientX - offsetX) / (rect.right - offsetX) * 2 - 1; + mouse.y = -((event.clientY - offsetY) / (rect.bottom - offsetY)) * 2 + 1; + raycaster.setFromCamera(mouse, orthoCamera); + const intersects2 = raycaster.intersectObjects(interactiveObjects); + if (intersects2.length > 0) { + const intersection = intersects2[0]; + const object = intersection.object; + prepareAnimationData(object, this.center); + this.animating = true; + return true; + } else { + return false; + } + }; + this.setLabels = function(labelX, labelY, labelZ) { + options.labelX = labelX; + options.labelY = labelY; + options.labelZ = labelZ; + updateLabels(); + }; + this.setLabelStyle = function(font, color, radius2) { + options.font = font; + options.color = color; + options.radius = radius2; + updateLabels(); + }; + this.update = function(delta) { + const step = delta * turnRate; + q1.rotateTowards(q2, step); + camera.position.set(0, 0, 1).applyQuaternion(q1).multiplyScalar(radius).add(this.center); + camera.quaternion.rotateTowards(targetQuaternion, step); + if (q1.angleTo(q2) === 0) { + this.animating = false; + } + }; + this.dispose = function() { + geometry.dispose(); + xAxis.material.dispose(); + yAxis.material.dispose(); + zAxis.material.dispose(); + posXAxisHelper.material.map.dispose(); + posYAxisHelper.material.map.dispose(); + posZAxisHelper.material.map.dispose(); + negXAxisHelper.material.map.dispose(); + negYAxisHelper.material.map.dispose(); + negZAxisHelper.material.map.dispose(); + posXAxisHelper.material.dispose(); + posYAxisHelper.material.dispose(); + posZAxisHelper.material.dispose(); + negXAxisHelper.material.dispose(); + negYAxisHelper.material.dispose(); + negZAxisHelper.material.dispose(); + }; + function prepareAnimationData(object, focusPoint) { + switch (object.userData.type) { + case "posX": + targetPosition.set(1, 0, 0); + targetQuaternion.setFromEuler(new Euler(0, Math.PI * 0.5, 0)); + break; + case "posY": + targetPosition.set(0, 1, 0); + targetQuaternion.setFromEuler(new Euler(-Math.PI * 0.5, 0, 0)); + break; + case "posZ": + targetPosition.set(0, 0, 1); + targetQuaternion.setFromEuler(new Euler()); + break; + case "negX": + targetPosition.set(-1, 0, 0); + targetQuaternion.setFromEuler(new Euler(0, -Math.PI * 0.5, 0)); + break; + case "negY": + targetPosition.set(0, -1, 0); + targetQuaternion.setFromEuler(new Euler(Math.PI * 0.5, 0, 0)); + break; + case "negZ": + targetPosition.set(0, 0, -1); + targetQuaternion.setFromEuler(new Euler(0, Math.PI, 0)); + break; + default: + console.error("ViewHelper: Invalid axis."); + } + radius = camera.position.distanceTo(focusPoint); + targetPosition.multiplyScalar(radius).add(focusPoint); + dummy.position.copy(focusPoint); + dummy.lookAt(camera.position); + q1.copy(dummy.quaternion); + dummy.lookAt(targetPosition); + q2.copy(dummy.quaternion); + } + __name(prepareAnimationData, "prepareAnimationData"); + function getAxisMaterial(color) { + return new MeshBasicMaterial({ color, toneMapped: false }); + } + __name(getAxisMaterial, "getAxisMaterial"); + function getSpriteMaterial(color, text) { + const { font = "24px Arial", color: labelColor = "#000000", radius: radius2 = 14 } = options; + const canvas = document.createElement("canvas"); + canvas.width = 64; + canvas.height = 64; + const context = canvas.getContext("2d"); + context.beginPath(); + context.arc(32, 32, radius2, 0, 2 * Math.PI); + context.closePath(); + context.fillStyle = color.getStyle(); + context.fill(); + if (text) { + context.font = font; + context.textAlign = "center"; + context.fillStyle = labelColor; + context.fillText(text, 32, 41); + } + const texture = new CanvasTexture(canvas); + texture.colorSpace = SRGBColorSpace; + return new SpriteMaterial({ map: texture, toneMapped: false }); + } + __name(getSpriteMaterial, "getSpriteMaterial"); + function updateLabels() { + posXAxisHelper.material.map.dispose(); + posYAxisHelper.material.map.dispose(); + posZAxisHelper.material.map.dispose(); + posXAxisHelper.material.dispose(); + posYAxisHelper.material.dispose(); + posZAxisHelper.material.dispose(); + posXAxisHelper.material = getSpriteMaterial(color1, options.labelX); + posYAxisHelper.material = getSpriteMaterial(color2, options.labelY); + posZAxisHelper.material = getSpriteMaterial(color3, options.labelZ); + } + __name(updateLabels, "updateLabels"); + } +} /*! fflate - fast JavaScript compression/decompression <https://101arrowz.github.io/fflate> @@ -45833,7 +46037,6 @@ class Load3d { stlLoader; currentModel = null; originalModel = null; - node; animationFrameId = null; gridHelper; lights = []; @@ -45846,6 +46049,10 @@ class Load3d { materialMode = "original"; currentUpDirection = "original"; originalRotation = null; + viewHelper; + viewHelperContainer; + cameraSwitcherContainer; + gridSwitcherContainer; constructor(container) { this.scene = new Scene(); this.perspectiveCamera = new PerspectiveCamera(75, 1, 0.1, 1e3); @@ -45866,6 +46073,7 @@ class Load3d { this.renderer = new WebGLRenderer({ alpha: true, antialias: true }); this.renderer.setSize(300, 300); this.renderer.setClearColor(2631720); + this.renderer.autoClear = false; const rendererDomElement = this.renderer.domElement; container.appendChild(rendererDomElement); this.controls = new OrbitControls( @@ -45901,10 +46109,113 @@ class Load3d { side: DoubleSide }); this.standardMaterial = this.createSTLMaterial(); - this.animate(); + this.createViewHelper(container); + this.createGridSwitcher(container); + this.createCameraSwitcher(container); this.handleResize(); this.startAnimation(); } + createViewHelper(container) { + this.viewHelperContainer = document.createElement("div"); + this.viewHelperContainer.style.position = "absolute"; + this.viewHelperContainer.style.bottom = "0"; + this.viewHelperContainer.style.left = "0"; + this.viewHelperContainer.style.width = "128px"; + this.viewHelperContainer.style.height = "128px"; + this.viewHelperContainer.addEventListener("pointerup", (event) => { + event.stopPropagation(); + this.viewHelper.handleClick(event); + }); + this.viewHelperContainer.addEventListener("pointerdown", (event) => { + event.stopPropagation(); + }); + container.appendChild(this.viewHelperContainer); + this.viewHelper = new ViewHelper( + this.activeCamera, + this.viewHelperContainer + ); + this.viewHelper.center = this.controls.target; + } + createGridSwitcher(container) { + this.gridSwitcherContainer = document.createElement("div"); + this.gridSwitcherContainer.style.position = "absolute"; + this.gridSwitcherContainer.style.top = "28px"; + this.gridSwitcherContainer.style.left = "3px"; + this.gridSwitcherContainer.style.width = "20px"; + this.gridSwitcherContainer.style.height = "20px"; + this.gridSwitcherContainer.style.cursor = "pointer"; + this.gridSwitcherContainer.style.alignItems = "center"; + this.gridSwitcherContainer.style.justifyContent = "center"; + this.gridSwitcherContainer.style.transition = "background-color 0.2s"; + const gridIcon = document.createElement("div"); + gridIcon.innerHTML = ` + <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2"> + <path d="M3 3h18v18H3z"/> + <path d="M3 9h18"/> + <path d="M3 15h18"/> + <path d="M9 3v18"/> + <path d="M15 3v18"/> + </svg> + `; + const updateButtonState = /* @__PURE__ */ __name(() => { + if (this.gridHelper.visible) { + this.gridSwitcherContainer.style.backgroundColor = "rgba(255, 255, 255, 0.2)"; + } else { + this.gridSwitcherContainer.style.backgroundColor = "transparent"; + } + }, "updateButtonState"); + updateButtonState(); + this.gridSwitcherContainer.addEventListener("mouseenter", () => { + if (!this.gridHelper.visible) { + this.gridSwitcherContainer.style.backgroundColor = "rgba(0, 0, 0, 0.5)"; + } + }); + this.gridSwitcherContainer.addEventListener("mouseleave", () => { + if (!this.gridHelper.visible) { + this.gridSwitcherContainer.style.backgroundColor = "transparent"; + } + }); + this.gridSwitcherContainer.title = "Toggle Grid"; + this.gridSwitcherContainer.addEventListener("click", (event) => { + event.stopPropagation(); + this.toggleGrid(!this.gridHelper.visible); + updateButtonState(); + }); + this.gridSwitcherContainer.appendChild(gridIcon); + container.appendChild(this.gridSwitcherContainer); + } + createCameraSwitcher(container) { + this.cameraSwitcherContainer = document.createElement("div"); + this.cameraSwitcherContainer.style.position = "absolute"; + this.cameraSwitcherContainer.style.top = "3px"; + this.cameraSwitcherContainer.style.left = "3px"; + this.cameraSwitcherContainer.style.width = "20px"; + this.cameraSwitcherContainer.style.height = "20px"; + this.cameraSwitcherContainer.style.cursor = "pointer"; + this.cameraSwitcherContainer.style.alignItems = "center"; + this.cameraSwitcherContainer.style.justifyContent = "center"; + const cameraIcon = document.createElement("div"); + cameraIcon.innerHTML = ` + <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2"> + <path d="M18 4H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2Z"/> + <path d="m12 12 4-2.4"/> + <circle cx="12" cy="12" r="3"/> + </svg> + `; + this.cameraSwitcherContainer.addEventListener("mouseenter", () => { + this.cameraSwitcherContainer.style.backgroundColor = "rgba(0, 0, 0, 0.5)"; + }); + this.cameraSwitcherContainer.addEventListener("mouseleave", () => { + this.cameraSwitcherContainer.style.backgroundColor = "rgba(0, 0, 0, 0.3)"; + }); + this.cameraSwitcherContainer.title = "Switch Camera (Perspective/Orthographic)"; + this.cameraSwitcherContainer.addEventListener("click", (event) => { + event.stopPropagation(); + this.toggleCamera(); + }); + this.cameraSwitcherContainer.appendChild(cameraIcon); + container.appendChild(this.cameraSwitcherContainer); + } setFOV(fov2) { if (this.activeCamera === this.perspectiveCamera) { this.perspectiveCamera.fov = fov2; @@ -46097,6 +46408,12 @@ class Load3d { this.controls.object = this.activeCamera; this.controls.target.copy(target); this.controls.update(); + this.viewHelper.dispose(); + this.viewHelper = new ViewHelper( + this.activeCamera, + this.viewHelperContainer + ); + this.viewHelper.center = this.controls.target; this.handleResize(); } getCurrentCameraType() { @@ -46127,8 +46444,14 @@ class Load3d { startAnimation() { const animate = /* @__PURE__ */ __name(() => { this.animationFrameId = requestAnimationFrame(animate); + const delta = this.clock.getDelta(); + if (this.viewHelper.animating) { + this.viewHelper.update(delta); + } + this.renderer.clear(); this.controls.update(); this.renderer.render(this.scene, this.activeCamera); + this.viewHelper.render(this.renderer); }, "animate"); animate(); } @@ -46193,6 +46516,7 @@ class Load3d { cancelAnimationFrame(this.animationFrameId); } this.controls.dispose(); + this.viewHelper.dispose(); this.renderer.dispose(); this.renderer.domElement.remove(); this.scene.clear(); @@ -46372,9 +46696,11 @@ class Load3d { this.orthographicCamera.bottom = -frustumSize / 2; this.orthographicCamera.updateProjectionMatrix(); } + this.renderer.clear(); this.renderer.render(this.scene, this.activeCamera); const sceneData = this.renderer.domElement.toDataURL("image/png"); this.renderer.setClearColor(0, 0); + this.renderer.clear(); this.renderer.render(this.scene, this.activeCamera); const maskData = this.renderer.domElement.toDataURL("image/png"); this.renderer.setClearColor(originalClearColor, originalClearAlpha); @@ -46395,38 +46721,6 @@ class Load3d { side: DoubleSide }); } - setViewPosition(position) { - if (!this.currentModel) { - return; - } - const box = new Box3(); - let center = new Vector3(); - let size = new Vector3(); - if (this.currentModel) { - box.setFromObject(this.currentModel); - box.getCenter(center); - box.getSize(size); - } - const maxDim = Math.max(size.x, size.y, size.z); - const distance = maxDim * 2; - switch (position) { - case "front": - this.activeCamera.position.set(0, 0, distance); - break; - case "top": - this.activeCamera.position.set(0, distance, 0); - break; - case "right": - this.activeCamera.position.set(distance, 0, 0); - break; - case "isometric": - this.activeCamera.position.set(distance, distance, distance); - break; - } - this.activeCamera.lookAt(center); - this.controls.target.copy(center); - this.controls.update(); - } setBackgroundColor(color) { this.renderer.setClearColor(new Color(color)); this.renderer.render(this.scene, this.activeCamera); @@ -46536,15 +46830,23 @@ class Load3dAnimation extends Load3d { } }); } - animate = /* @__PURE__ */ __name(() => { - requestAnimationFrame(this.animate); - if (this.currentAnimation && this.isAnimationPlaying) { + startAnimation() { + const animate = /* @__PURE__ */ __name(() => { + this.animationFrameId = requestAnimationFrame(animate); const delta = this.clock.getDelta(); - this.currentAnimation.update(delta); - } - this.controls.update(); - this.renderer.render(this.scene, this.activeCamera); - }, "animate"); + if (this.currentAnimation && this.isAnimationPlaying) { + this.currentAnimation.update(delta); + } + this.controls.update(); + this.renderer.clear(); + this.renderer.render(this.scene, this.activeCamera); + if (this.viewHelper.animating) { + this.viewHelper.update(delta); + } + this.viewHelper.render(this.renderer); + }, "animate"); + animate(); + } } function splitFilePath$1(path) { const folder_separator = path.lastIndexOf("/"); @@ -46577,7 +46879,7 @@ const load3dCanvasCSSCLASS = `display: flex; width: 100% !important; height: 100% !important;`; const containerToLoad3D = /* @__PURE__ */ new Map(); -function configureLoad3D(load3d, loadFolder, modelWidget, showGrid, cameraType, view, material, bgColor, lightIntensity, upDirection, fov2, cameraState, postModelUpdateFunc) { +function configureLoad3D(load3d, loadFolder, modelWidget, material, bgColor, lightIntensity, upDirection, fov2, cameraState, postModelUpdateFunc) { const createModelUpdateHandler = /* @__PURE__ */ __name(() => { let isFirstLoad = true; return async (value) => { @@ -46611,17 +46913,6 @@ function configureLoad3D(load3d, loadFolder, modelWidget, showGrid, cameraType, onModelWidgetUpdate(modelWidget.value); } modelWidget.callback = onModelWidgetUpdate; - load3d.toggleGrid(showGrid.value); - showGrid.callback = (value) => { - load3d.toggleGrid(value); - }; - load3d.toggleCamera(cameraType.value); - cameraType.callback = (value) => { - load3d.toggleCamera(value); - }; - view.callback = (value) => { - load3d.setViewPosition(value); - }; material.callback = (value) => { load3d.setMaterialMode(value); }; @@ -46741,11 +47032,6 @@ app.registerExtension({ const modelWidget = node.widgets.find( (w2) => w2.name === "model_file" ); - const showGrid = node.widgets.find((w2) => w2.name === "show_grid"); - const cameraType = node.widgets.find( - (w2) => w2.name === "camera_type" - ); - const view = node.widgets.find((w2) => w2.name === "view"); const material = node.widgets.find((w2) => w2.name === "material"); const bgColor = node.widgets.find((w2) => w2.name === "bg_color"); const lightIntensity = node.widgets.find( @@ -46769,9 +47055,6 @@ app.registerExtension({ load3d, "input", modelWidget, - showGrid, - cameraType, - view, material, bgColor, lightIntensity, @@ -46939,11 +47222,6 @@ app.registerExtension({ const modelWidget = node.widgets.find( (w2) => w2.name === "model_file" ); - const showGrid = node.widgets.find((w2) => w2.name === "show_grid"); - const cameraType = node.widgets.find( - (w2) => w2.name === "camera_type" - ); - const view = node.widgets.find((w2) => w2.name === "view"); const material = node.widgets.find((w2) => w2.name === "material"); const bgColor = node.widgets.find((w2) => w2.name === "bg_color"); const lightIntensity = node.widgets.find( @@ -46976,9 +47254,6 @@ app.registerExtension({ load3d, "input", modelWidget, - showGrid, - cameraType, - view, material, bgColor, lightIntensity, @@ -47001,6 +47276,7 @@ app.registerExtension({ const h = node.widgets.find((w2) => w2.name === "height"); sceneWidget.serializeValue = async () => { node.properties["Camera Info"] = JSON.stringify(load3d.getCameraState()); + load3d.toggleAnimation(false); const { scene: imageData, mask: maskData } = await load3d.captureScene( w.value, h.value @@ -47081,11 +47357,6 @@ app.registerExtension({ const modelWidget = node.widgets.find( (w) => w.name === "model_file" ); - const showGrid = node.widgets.find((w) => w.name === "show_grid"); - const cameraType = node.widgets.find( - (w) => w.name === "camera_type" - ); - const view = node.widgets.find((w) => w.name === "view"); const material = node.widgets.find((w) => w.name === "material"); const bgColor = node.widgets.find((w) => w.name === "bg_color"); const lightIntensity = node.widgets.find( @@ -47109,9 +47380,6 @@ app.registerExtension({ load3d, "output", modelWidget, - showGrid, - cameraType, - view, material, bgColor, lightIntensity, @@ -48299,15 +48567,15 @@ var styles = ` } #maskEditor_toolPanel { height: 100%; - width: var(--sidebar-width); + width: 4rem; z-index: 8888; background: var(--comfy-menu-bg); display: flex; flex-direction: column; } .maskEditor_toolPanelContainer { - width: var(--sidebar-width); - height: var(--sidebar-width); + width: 4rem; + height: 4rem; display: flex; justify-content: center; align-items: center; @@ -48368,7 +48636,7 @@ var styles = ` margin-bottom: 5px; } #maskEditor_pointerZone { - width: calc(100% - var(--sidebar-width) - 220px); + width: calc(100% - 4rem - 220px); height: 100%; } #maskEditor_uiContainer { @@ -48740,8 +49008,8 @@ var styles = ` } .maskEditor_toolPanelZoomIndicator { - width: var(--sidebar-width); - height: var(--sidebar-width); + width: 4rem; + height: 4rem; display: flex; flex-direction: column; justify-content: center; @@ -48800,6 +49068,31 @@ var ColorComparisonMethod = /* @__PURE__ */ ((ColorComparisonMethod2) => { ColorComparisonMethod2["LAB"] = "lab"; return ColorComparisonMethod2; })(ColorComparisonMethod || {}); +const saveBrushToCache = lodashExports.debounce(function(key, brush) { + try { + const brushString = JSON.stringify(brush); + setStorageValue(key, brushString); + } catch (error) { + console.error("Failed to save brush to cache:", error); + } +}, 300); +function loadBrushFromCache(key) { + try { + const brushString = getStorageValue(key); + if (brushString) { + const brush = JSON.parse(brushString); + console.log("Loaded brush from cache:", brush); + return brush; + } else { + console.log("No brush found in cache."); + return null; + } + } catch (error) { + console.error("Failed to load brush from cache:", error); + return null; + } +} +__name(loadBrushFromCache, "loadBrushFromCache"); class MaskEditorDialog extends ComfyDialog { static { __name(this, "MaskEditorDialog"); @@ -49065,7 +49358,7 @@ class MaskEditorDialog extends ComfyDialog { }).then((response) => { if (!response.ok) { console.log("Failed to upload mask:", response); - this.uploadMask(filepath, formData, 2); + this.uploadMask(filepath, formData, retries - 1); } }).catch((error) => { console.error("Error:", error); @@ -49664,13 +49957,18 @@ class BrushTool { this.brushAdjustmentSpeed = app.extensionManager.setting.get( "Comfy.MaskEditor.BrushAdjustmentSpeed" ); - this.brushSettings = { - size: 10, - opacity: 100, - hardness: 1, - type: "arc" - /* Arc */ - }; + const cachedBrushSettings = loadBrushFromCache("maskeditor_brush_settings"); + if (cachedBrushSettings) { + this.brushSettings = cachedBrushSettings; + } else { + this.brushSettings = { + type: "arc", + size: 10, + opacity: 0.7, + hardness: 1, + smoothingPrecision: 10 + }; + } this.maskBlendMode = "black"; } createListeners() { @@ -49732,6 +50030,10 @@ class BrushTool { "brushType", async () => this.brushSettings.type ); + this.messageBroker.createPullTopic( + "brushSmoothingPrecision", + async () => this.brushSettings.smoothingPrecision + ); this.messageBroker.createPullTopic( "maskBlendMode", async () => this.maskBlendMode @@ -49840,7 +50142,7 @@ class BrushTool { dy = points[i + 1].y - points[i].y; totalLength += Math.sqrt(dx * dx + dy * dy); } - const distanceBetweenPoints = this.brushSettings.size / this.smoothingPrecision * 6; + const distanceBetweenPoints = this.brushSettings.size / this.brushSettings.smoothingPrecision * 6; const stepNr = Math.ceil(totalLength / distanceBetweenPoints); let interpolatedPoints = points; if (stepNr > 0) { @@ -49871,7 +50173,7 @@ class BrushTool { const brush_size = await this.messageBroker.pull("brushSize"); const distance = Math.sqrt((p2.x - p1.x) ** 2 + (p2.y - p1.y) ** 2); const steps = Math.ceil( - distance / (brush_size / this.smoothingPrecision * 4) + distance / (brush_size / this.brushSettings.smoothingPrecision * 4) ); const interpolatedOpacity = 1 / (1 + Math.exp(-6 * (this.brushSettings.opacity - 0.5))) - 1 / (1 + Math.exp(3)); this.init_shape(compositionOp); @@ -50123,18 +50425,23 @@ class BrushTool { } setBrushSize(size) { this.brushSettings.size = size; + saveBrushToCache("maskeditor_brush_settings", this.brushSettings); } setBrushOpacity(opacity) { this.brushSettings.opacity = opacity; + saveBrushToCache("maskeditor_brush_settings", this.brushSettings); } setBrushHardness(hardness) { this.brushSettings.hardness = hardness; + saveBrushToCache("maskeditor_brush_settings", this.brushSettings); } setBrushType(type) { this.brushSettings.type = type; + saveBrushToCache("maskeditor_brush_settings", this.brushSettings); } setBrushSmoothingPrecision(precision) { - this.smoothingPrecision = precision; + this.brushSettings.smoothingPrecision = precision; + saveBrushToCache("maskeditor_brush_settings", this.brushSettings); } } class UIManager { @@ -50340,7 +50647,6 @@ class UIManager { const circle_shape = document.createElement("div"); circle_shape.id = "maskEditor_sidePanelBrushShapeCircle"; circle_shape.classList.add(shapeColor); - circle_shape.style.background = "var(--p-button-text-primary-color)"; circle_shape.addEventListener("click", () => { this.messageBroker.publish( "setBrushShape", @@ -50354,7 +50660,6 @@ class UIManager { const square_shape = document.createElement("div"); square_shape.id = "maskEditor_sidePanelBrushShapeSquare"; square_shape.classList.add(shapeColor); - square_shape.style.background = ""; square_shape.addEventListener("click", () => { this.messageBroker.publish( "setBrushShape", @@ -50365,6 +50670,13 @@ class UIManager { square_shape.style.background = "var(--p-button-text-primary-color)"; circle_shape.style.background = ""; }); + if ((await this.messageBroker.pull("brushSettings")).type === "arc") { + circle_shape.style.background = "var(--p-button-text-primary-color)"; + square_shape.style.background = ""; + } else { + circle_shape.style.background = ""; + square_shape.style.background = "var(--p-button-text-primary-color)"; + } brush_shape_container.appendChild(circle_shape); brush_shape_container.appendChild(square_shape); brush_shape_outer_container.appendChild(brush_shape_title); @@ -50374,7 +50686,7 @@ class UIManager { 1, 100, 1, - 10, + (await this.messageBroker.pull("brushSettings")).size, (event, value) => { this.messageBroker.publish("setBrushSize", parseInt(value)); this.updateBrushPreview(); @@ -50386,7 +50698,7 @@ class UIManager { 0, 1, 0.01, - 0.7, + (await this.messageBroker.pull("brushSettings")).opacity, (event, value) => { this.messageBroker.publish("setBrushOpacity", parseFloat(value)); this.updateBrushPreview(); @@ -50398,7 +50710,7 @@ class UIManager { 0, 1, 0.01, - 1, + (await this.messageBroker.pull("brushSettings")).hardness, (event, value) => { this.messageBroker.publish("setBrushHardness", parseFloat(value)); this.updateBrushPreview(); @@ -50410,7 +50722,7 @@ class UIManager { 1, 100, 1, - 10, + (await this.messageBroker.pull("brushSettings")).smoothingPrecision, (event, value) => { this.messageBroker.publish( "setBrushSmoothingPrecision", @@ -50418,7 +50730,30 @@ class UIManager { ); } ); + const resetBrushSettingsButton = document.createElement("button"); + resetBrushSettingsButton.id = "resetBrushSettingsButton"; + resetBrushSettingsButton.innerText = "Reset to Default"; + resetBrushSettingsButton.addEventListener("click", () => { + this.messageBroker.publish( + "setBrushShape", + "arc" + /* Arc */ + ); + this.messageBroker.publish("setBrushSize", 10); + this.messageBroker.publish("setBrushOpacity", 0.7); + this.messageBroker.publish("setBrushHardness", 1); + this.messageBroker.publish("setBrushSmoothingPrecision", 10); + circle_shape.style.background = "var(--p-button-text-primary-color)"; + square_shape.style.background = ""; + thicknesSliderObj.slider.value = "10"; + opacitySliderObj.slider.value = "0.7"; + hardnessSliderObj.slider.value = "1"; + brushSmoothingPrecisionSliderObj.slider.value = "10"; + this.setBrushBorderRadius(); + this.updateBrushPreview(); + }); brush_settings_container.appendChild(brush_settings_title); + brush_settings_container.appendChild(resetBrushSettingsButton); brush_settings_container.appendChild(brush_shape_outer_container); brush_settings_container.appendChild(thicknesSliderObj.container); brush_settings_container.appendChild(opacitySliderObj.container); @@ -53211,4 +53546,4 @@ app.registerExtension({ }); } }); -//# sourceMappingURL=index-Bordpmzt.js.map +//# sourceMappingURL=index-je62U6DH.js.map diff --git a/web/assets/keybindingService-Bx7YdkXn.js b/web/assets/keybindingService-Cak1En5n.js similarity index 89% rename from web/assets/keybindingService-Bx7YdkXn.js rename to web/assets/keybindingService-Cak1En5n.js index 37b5d01c..89d8cdd9 100644 --- a/web/assets/keybindingService-Bx7YdkXn.js +++ b/web/assets/keybindingService-Cak1En5n.js @@ -1,6 +1,6 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { a$ as useKeybindingStore, a2 as useCommandStore, a as useSettingStore, cq as KeyComboImpl, cr as KeybindingImpl } from "./index-DjNHn37O.js"; +import { a$ as useKeybindingStore, a4 as useCommandStore, a as useSettingStore, cx as KeyComboImpl, cy as KeybindingImpl } from "./index-QvfM__ze.js"; const CORE_KEYBINDINGS = [ { combo: { @@ -96,7 +96,7 @@ const CORE_KEYBINDINGS = [ alt: true }, commandId: "Comfy.Canvas.ZoomIn", - targetSelector: "#graph-canvas" + targetElementId: "graph-canvas" }, { combo: { @@ -105,7 +105,7 @@ const CORE_KEYBINDINGS = [ shift: true }, commandId: "Comfy.Canvas.ZoomIn", - targetSelector: "#graph-canvas" + targetElementId: "graph-canvas" }, // For number pad '+' { @@ -114,7 +114,7 @@ const CORE_KEYBINDINGS = [ alt: true }, commandId: "Comfy.Canvas.ZoomIn", - targetSelector: "#graph-canvas" + targetElementId: "graph-canvas" }, { combo: { @@ -122,21 +122,21 @@ const CORE_KEYBINDINGS = [ alt: true }, commandId: "Comfy.Canvas.ZoomOut", - targetSelector: "#graph-canvas" + targetElementId: "graph-canvas" }, { combo: { key: "." }, commandId: "Comfy.Canvas.FitView", - targetSelector: "#graph-canvas" + targetElementId: "graph-canvas" }, { combo: { key: "p" }, commandId: "Comfy.Canvas.ToggleSelected.Pin", - targetSelector: "#graph-canvas" + targetElementId: "graph-canvas" }, { combo: { @@ -144,7 +144,7 @@ const CORE_KEYBINDINGS = [ alt: true }, commandId: "Comfy.Canvas.ToggleSelectedNodes.Collapse", - targetSelector: "#graph-canvas" + targetElementId: "graph-canvas" }, { combo: { @@ -152,7 +152,7 @@ const CORE_KEYBINDINGS = [ ctrl: true }, commandId: "Comfy.Canvas.ToggleSelectedNodes.Bypass", - targetSelector: "#graph-canvas" + targetElementId: "graph-canvas" }, { combo: { @@ -160,7 +160,7 @@ const CORE_KEYBINDINGS = [ ctrl: true }, commandId: "Comfy.Canvas.ToggleSelectedNodes.Mute", - targetSelector: "#graph-canvas" + targetElementId: "graph-canvas" }, { combo: { @@ -190,7 +190,7 @@ const useKeybindingService = /* @__PURE__ */ __name(() => { return; } const keybinding = keybindingStore.getKeybinding(keyCombo); - if (keybinding && keybinding.targetSelector !== "#graph-canvas") { + if (keybinding && keybinding.targetElementId !== "graph-canvas") { event.preventDefault(); await commandStore.execute(keybinding.commandId); return; @@ -247,4 +247,4 @@ const useKeybindingService = /* @__PURE__ */ __name(() => { export { useKeybindingService as u }; -//# sourceMappingURL=keybindingService-Bx7YdkXn.js.map +//# sourceMappingURL=keybindingService-Cak1En5n.js.map diff --git a/web/assets/serverConfigStore-CvyKFVuP.js b/web/assets/serverConfigStore-DCme3xlV.js similarity index 95% rename from web/assets/serverConfigStore-CvyKFVuP.js rename to web/assets/serverConfigStore-DCme3xlV.js index 65cc6b7f..10f8b277 100644 --- a/web/assets/serverConfigStore-CvyKFVuP.js +++ b/web/assets/serverConfigStore-DCme3xlV.js @@ -1,6 +1,6 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { $ as defineStore, ab as ref, c as computed } from "./index-DjNHn37O.js"; +import { a1 as defineStore, ad as ref, c as computed } from "./index-QvfM__ze.js"; const useServerConfigStore = defineStore("serverConfig", () => { const serverConfigById = ref({}); const serverConfigs = computed(() => { @@ -87,4 +87,4 @@ const useServerConfigStore = defineStore("serverConfig", () => { export { useServerConfigStore as u }; -//# sourceMappingURL=serverConfigStore-CvyKFVuP.js.map +//# sourceMappingURL=serverConfigStore-DCme3xlV.js.map diff --git a/web/index.html b/web/index.html index a79b584c..59fabeaa 100644 --- a/web/index.html +++ b/web/index.html @@ -6,8 +6,8 @@ <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> <link rel="stylesheet" type="text/css" href="user.css" /> <link rel="stylesheet" type="text/css" href="materialdesignicons.min.css" /> - <script type="module" crossorigin src="./assets/index-DjNHn37O.js"></script> - <link rel="stylesheet" crossorigin href="./assets/index-t-sFBuUC.css"> + <script type="module" crossorigin src="./assets/index-QvfM__ze.js"></script> + <link rel="stylesheet" crossorigin href="./assets/index-Cf-n7v0V.css"> </head> <body class="litegraph grid"> <div id="vue-app"></div> From ebf038d4faa1232ce90ca45ee124942bf7f1a6d0 Mon Sep 17 00:00:00 2001 From: Sergii Dymchenko <kit1980@gmail.com> Date: Sun, 19 Jan 2025 01:54:32 -0800 Subject: [PATCH 47/47] Use `torch.special.expm1` (#6388) * Use `torch.special.expm1` This function provides greater precision than `exp(x) - 1` for small values of `x`. Found with TorchFix https://github.com/pytorch-labs/torchfix/ * Use non-alias --- comfy/k_diffusion/sampling.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/k_diffusion/sampling.py b/comfy/k_diffusion/sampling.py index 13ae272f..87a522b7 100644 --- a/comfy/k_diffusion/sampling.py +++ b/comfy/k_diffusion/sampling.py @@ -40,7 +40,7 @@ def get_sigmas_polyexponential(n, sigma_min, sigma_max, rho=1., device='cpu'): def get_sigmas_vp(n, beta_d=19.9, beta_min=0.1, eps_s=1e-3, device='cpu'): """Constructs a continuous VP noise schedule.""" t = torch.linspace(1, eps_s, n, device=device) - sigmas = torch.sqrt(torch.exp(beta_d * t ** 2 / 2 + beta_min * t) - 1) + sigmas = torch.sqrt(torch.special.expm1(beta_d * t ** 2 / 2 + beta_min * t)) return append_zero(sigmas)