n8n-editor-ui 1.70.0 → 1.71.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/dist/assets/{AnnotationTagsDropdown.ee.vue_vue_type_script_setup_true_lang-BntMIzDT.js → AnnotationTagsDropdown.ee.vue_vue_type_script_setup_true_lang-YmjXnGZU.js} +1 -1
  2. package/dist/assets/{AuthView-Dxh8QCaY.js → AuthView-II3Wa5OB.js} +1 -1
  3. package/dist/assets/{CanvasChat-DKeWqqZz.css → CanvasChat-BuYT3e9G.css} +56 -62
  4. package/dist/assets/{CanvasChat-rOzwS7Vn.js → CanvasChat-ycxVbREq.js} +211 -156
  5. package/dist/assets/{CanvasControls-Bmo04dJ7.js → CanvasControls-xKyFrMYs.js} +1 -1
  6. package/dist/assets/{ChangePasswordView-BtxMhBmp.js → ChangePasswordView-V6_lM1cg.js} +5 -5
  7. package/dist/assets/CollectionParameter-B_tZRaC-.js +4 -0
  8. package/dist/assets/{ExecutionsTime.vue_vue_type_script_setup_true_lang-u1_TBZpo.js → ConcurrentExecutionsHeader-D0gwFXQC.js} +100 -13
  9. package/dist/assets/{ExecutionsTime-DVxRt-Pz.css → ConcurrentExecutionsHeader-D99WmQjD.css} +13 -1
  10. package/dist/assets/{CredentialsView-B4KE87Vi.js → CredentialsView-CFXV7rF5.js} +5 -5
  11. package/dist/assets/{ErrorView-BIcv6TEp.js → ErrorView-DnkoQwKM.js} +1 -1
  12. package/dist/assets/{ExecutionsView-C8106X7e.js → ExecutionsView-Bxv-oyjW.js} +44 -25
  13. package/dist/assets/{ExecutionsView-COFUjHqa.css → ExecutionsView-DNwpODRj.css} +29 -29
  14. package/dist/assets/{FileSaver.min-BP27OS5o.js → FileSaver.min-BbGWF0W0.js} +1 -1
  15. package/dist/assets/{FixedCollectionParameter-jU2z1mVN.js → FixedCollectionParameter-B8gqkYrn.js} +1 -1
  16. package/dist/assets/{ForgotMyPasswordView-BPRVyjqF.js → ForgotMyPasswordView-DJno5OYu.js} +2 -2
  17. package/dist/assets/{MainHeader-C5fjzcBU.js → MainHeader-B12_uYMD.js} +8 -8
  18. package/dist/assets/{MainSidebar-DDwUpW3R.js → MainSidebar-KWMUAI1a.js} +4 -4
  19. package/dist/assets/{NodeCreation-fYCCIvH0.js → NodeCreation-D0ZfyMv8.js} +4 -4
  20. package/dist/assets/{NodeCreator-CIH8NrPP.js → NodeCreator-DMv1F4DA.js} +11 -11
  21. package/dist/assets/{NodeViewSwitcher-o9O7uIC5.js → NodeViewSwitcher-BAmNQYuK.js} +126 -98
  22. package/dist/assets/{NodeViewSwitcher-KdRgfKxB.css → NodeViewSwitcher-CVfdiWEq.css} +42 -42
  23. package/dist/assets/{ProjectCardBadge-rog20byy.js → ProjectCardBadge-CsopiL8Q.js} +1 -1
  24. package/dist/assets/{ProjectHeader-Ch7-0YgF.js → ProjectHeader-ByJin2Vs.js} +2 -2
  25. package/dist/assets/{ProjectSettings-GsW7L_Gg.js → ProjectSettings-BaqLhSok.js} +3 -3
  26. package/dist/assets/{PushConnectionTracker.vue_vue_type_script_setup_true_lang-DVCg4pLb.js → PushConnectionTracker.vue_vue_type_script_setup_true_lang-BREVdOi8.js} +1 -1
  27. package/dist/assets/{ResourcesListLayout-Btn9Hay8.js → ResourcesListLayout-CrPAVdQx.js} +1 -1
  28. package/dist/assets/{RunDataJson-BHIY5dHu.js → RunDataJson-0Gdn6kSj.js} +12 -12
  29. package/dist/assets/{RunDataJsonActions-h2GG7hQH.js → RunDataJsonActions-BhDX_Txs.js} +3 -3
  30. package/dist/assets/{RunDataSearch-C-CgDL9m.js → RunDataSearch-CfZ3sk7A.js} +1 -1
  31. package/dist/assets/{RunDataTable-DX2WMhyi.js → RunDataTable-1ZOHR24l.js} +2 -2
  32. package/dist/assets/{SamlOnboarding-DAv7qRQH.js → SamlOnboarding-B0gz6dmT.js} +2 -2
  33. package/dist/assets/{SettingsApiView-BpT9mKIy.js → SettingsApiView-D7TfC68f.js} +1 -1
  34. package/dist/assets/{SettingsCommunityNodesView-C_eGce72.js → SettingsCommunityNodesView-Cn2QS6YJ.js} +3 -3
  35. package/dist/assets/{SettingsExternalSecrets-CGbkGSxM.js → SettingsExternalSecrets-BMwHXUbh.js} +1 -1
  36. package/dist/assets/{SettingsLdapView-w-4uJ-WO.js → SettingsLdapView-Om4h-SOK.js} +1 -1
  37. package/dist/assets/{SettingsLogStreamingView-dIzDyxR0.js → SettingsLogStreamingView-1qxOcSwE.js} +1 -1
  38. package/dist/assets/{SettingsPersonalView-Cqkzewwp.js → SettingsPersonalView-Cbcb-dUn.js} +1 -1
  39. package/dist/assets/{SettingsSourceControl-DvdzOGOW.js → SettingsSourceControl-CU-rij4H.js} +1 -1
  40. package/dist/assets/{SettingsSso-CEyzwTf6.js → SettingsSso-CqzdZX3v.js} +1 -1
  41. package/dist/assets/{SettingsUsageAndPlan-BfvgFmrE.js → SettingsUsageAndPlan-C2e9GLsv.js} +1 -1
  42. package/dist/assets/{SettingsUsersView-B74JDNzE.js → SettingsUsersView-xZokdz1r.js} +1 -1
  43. package/dist/assets/{SettingsView-BXjB3fL0.js → SettingsView-BH_iYABe.js} +5 -4
  44. package/dist/assets/{SetupView-CUYm-G9-.js → SetupView-CzbIaZVJ.js} +2 -2
  45. package/dist/assets/{SetupWorkflowCredentialsButton-ebC2FUi4.js → SetupWorkflowCredentialsButton-C0OcQQFJ.js} +1 -1
  46. package/dist/assets/{SetupWorkflowFromTemplateView-D9qMRkDl.js → SetupWorkflowFromTemplateView-CsQJwMO0.js} +3 -3
  47. package/dist/assets/{SigninView-DJyuz9c2.js → SigninView-CsucBbVi.js} +19 -19
  48. package/dist/assets/{SignoutView-C6UBxu60.js → SignoutView-CyLWedvn.js} +1 -1
  49. package/dist/assets/{SignupView-D2FWuaiH.js → SignupView-cLJ1k6Ti.js} +2 -2
  50. package/dist/assets/{TemplateDetails-B2Tjk70m.js → TemplateDetails-BD_iO2dV.js} +1 -1
  51. package/dist/assets/{TemplateList-HMZjVMyp.js → TemplateList-ftUTzbNT.js} +1 -1
  52. package/dist/assets/{TemplatesCollectionView-BIJyxp-d.js → TemplatesCollectionView-BN4T_Z3V.js} +5 -5
  53. package/dist/assets/{TemplatesSearchView-DZ_z-833.js → TemplatesSearchView-Bmug-QXp.js} +3 -3
  54. package/dist/assets/{TemplatesView-9gF5kWu6.js → TemplatesView-df4IkFNm.js} +1 -1
  55. package/dist/assets/{TemplatesWorkflowView-BuUff8HB.js → TemplatesWorkflowView-DRuQcO2d.js} +5 -5
  56. package/dist/assets/{TestDefinitionEditView-CQZkRDBJ.js → TestDefinitionEditView-CJG_M-B4.js} +2 -2
  57. package/dist/assets/{TestDefinitionListView-CjZFxgTi.js → TestDefinitionListView-cEfmYGle.js} +2 -2
  58. package/dist/assets/{VariablesView-FC5wqShX.js → VariablesView-BqyMbnya.js} +2 -2
  59. package/dist/assets/VirtualSchema-Be-DGXEU.css +173 -0
  60. package/dist/assets/VirtualSchema-DiQQitJX.js +1863 -0
  61. package/dist/assets/{WorkerView-C-nSya6I.js → WorkerView-CSrcIA14.js} +4 -4
  62. package/dist/assets/{WorkflowActivator-CHX1pfvG.js → WorkflowActivator-CAKSe6ab.js} +2 -2
  63. package/dist/assets/{WorkflowExecutionsInfoAccordion-BXyNsJxl.js → WorkflowExecutionsInfoAccordion-DnWD_9ew.js} +1 -1
  64. package/dist/assets/{WorkflowExecutionsLandingPage-F1VtQsvR.js → WorkflowExecutionsLandingPage-B-SW6qSF.js} +2 -2
  65. package/dist/assets/{WorkflowExecutionsPreview-D0LX3heg.js → WorkflowExecutionsPreview-DgzqD7xu.js} +5 -5
  66. package/dist/assets/{WorkflowExecutionsView-CfNb8qea.js → WorkflowExecutionsView-C4qhWmn5.js} +16 -7
  67. package/dist/assets/{WorkflowExecutionsView-CepgQyRt.css → WorkflowExecutionsView-C6EMZ-AQ.css} +2 -2
  68. package/dist/assets/{WorkflowHistory-BbJWHQnH.js → WorkflowHistory-Btu_t8nw.js} +3 -3
  69. package/dist/assets/{WorkflowOnboardingView-DjX_Iu8m.js → WorkflowOnboardingView-Dqiba8dR.js} +1 -1
  70. package/dist/assets/{WorkflowPreview-CHIMaYHv.js → WorkflowPreview-BghVkp3I.js} +1 -1
  71. package/dist/assets/{WorkflowsView-TVYSIx1a.js → WorkflowsView-CGSmdVr2.js} +7 -7
  72. package/dist/assets/{index-CmLVLa2S.js → index-BLjFvDIb.js} +1471 -1234
  73. package/dist/assets/{index-CnXoucRo.css → index-D50gpyk6.css} +18 -10
  74. package/dist/assets/{pushConnection.store-CyaZOmSq.js → pushConnection.store-B_O3Ndxc.js} +1 -1
  75. package/dist/assets/{templateActions-BJQmBPkz.js → templateActions-CBKQAFvV.js} +1 -1
  76. package/dist/assets/{testDefinition.store.ee-C_33eEVx.js → testDefinition.store.ee-2tviSVei.js} +1 -1
  77. package/dist/assets/{useBugReporting-B6XywIQp.js → useBugReporting-C2zyZy6T.js} +1 -1
  78. package/dist/assets/{useExecutionDebugging-3jTK_axu.js → useExecutionDebugging-Nq-02Km0.js} +3 -3
  79. package/dist/assets/{useExecutionHelpers-B2Hv6YkQ.js → useExecutionHelpers-BhXcAom9.js} +1 -1
  80. package/dist/assets/{useGlobalEntityCreation-Bs_R5VRy.js → useGlobalEntityCreation-BNV5jiBY.js} +2 -2
  81. package/dist/assets/{useNodeViewVersionSwitcher-cbmuQpXh.js → useNodeViewVersionSwitcher-k_nkRZI7.js} +1 -1
  82. package/dist/assets/{usePushConnection-D2ReX4YT.js → usePushConnection-Bn4oBeSx.js} +2 -2
  83. package/dist/assets/{useRunWorkflow-DH7ZzA8t.css → useRunWorkflow-B_S0x25z.css} +44 -43
  84. package/dist/assets/{useRunWorkflow-D5J5xO1e.js → useRunWorkflow-DVQNNBeJ.js} +47 -39
  85. package/dist/assets/{useWorkflowActivate-Ck0ToSti.js → useWorkflowActivate-CkngxVfp.js} +1 -1
  86. package/dist/index.html +2 -2
  87. package/package.json +1 -1
  88. package/dist/assets/CollectionParameter-B6D9F9ZW.js +0 -4
  89. package/dist/static/quickstart_thumbnail.png +0 -0
@@ -0,0 +1,1863 @@
1
+ import { d as defineComponent, d0 as useCssVars, c as openBlock, h as createElementBlock, j as createBaseVNode, i as createVNode, n as normalizeClass, l as unref, fo as FontAwesomeIcon, f as createCommentVNode, jJ as TextWithHighlights, _ as _export_sfc, q as computed, I as withModifiers, dx as _sfc_main$3, k as createTextVNode, t as toDisplayString, e as createBlock, g as useI18n, cC as pushScopeId, cA as popScopeId, y as nextTick, dk as withScopeId, aq as h, cn as markRaw, cO as shallowReactive, m as resolveComponent, cI as resolveDirective, ay as withDirectives, s as renderSlot, w as withCtx, F as Fragment, A as renderList, aY as resolveDynamicComponent, aX as mergeProps, cV as toHandlers, B as normalizeStyle, aV as normalizeProps, aW as guardReactiveProps, bd as NodeConnectionType, at as useNDVStore, bk as useNodeTypesStore, T as useWorkflowsStore, jP as useFlattenSchema, bl as useNodeHelpers, r as ref, H as watch, eo as N8nText, jI as MappingPill, ed as Draggable, ht as useDataSchema, eI as executionDataToJson, aP as useExternalHooks, ak as useTelemetry } from "./index-BLjFvDIb.js";
2
+ const _hoisted_1$4 = { class: "toggle-container" };
3
+ const _hoisted_2$3 = ["data-name", "data-path", "data-depth", "data-nest-level", "data-value", "data-node-type"];
4
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
5
+ __name: "VirtualSchemaItem",
6
+ props: {
7
+ title: {},
8
+ path: {},
9
+ level: {},
10
+ depth: {},
11
+ expression: {},
12
+ value: {},
13
+ id: {},
14
+ icon: {},
15
+ collapsable: { type: Boolean },
16
+ nodeType: {},
17
+ highlight: { type: Boolean },
18
+ draggable: { type: Boolean },
19
+ collapsed: { type: Boolean },
20
+ search: {}
21
+ },
22
+ emits: ["click"],
23
+ setup(__props, { emit: __emit }) {
24
+ useCssVars((_ctx) => ({
25
+ "386322a6": _ctx.level
26
+ }));
27
+ const props2 = __props;
28
+ const emit = __emit;
29
+ return (_ctx, _cache) => {
30
+ return openBlock(), createElementBlock("div", {
31
+ class: normalizeClass(["schema-item", { draggable: _ctx.draggable }]),
32
+ "data-test-id": "run-data-schema-item"
33
+ }, [
34
+ createBaseVNode("div", _hoisted_1$4, [
35
+ _ctx.collapsable ? (openBlock(), createElementBlock("div", {
36
+ key: 0,
37
+ class: "toggle",
38
+ onClick: _cache[0] || (_cache[0] = ($event) => emit("click"))
39
+ }, [
40
+ createVNode(unref(FontAwesomeIcon), {
41
+ icon: "angle-down",
42
+ class: normalizeClass({ "collapse-icon": true, collapsed: _ctx.collapsed })
43
+ }, null, 8, ["class"])
44
+ ])) : createCommentVNode("", true)
45
+ ]),
46
+ _ctx.title ? (openBlock(), createElementBlock("div", {
47
+ key: 0,
48
+ "data-name": _ctx.title,
49
+ "data-path": _ctx.path,
50
+ "data-depth": _ctx.depth,
51
+ "data-nest-level": _ctx.level,
52
+ "data-value": _ctx.expression,
53
+ "data-node-type": _ctx.nodeType,
54
+ "data-target": "mappable",
55
+ class: normalizeClass(["pill", { "pill--highlight": _ctx.highlight }]),
56
+ "data-test-id": "run-data-schema-node-name"
57
+ }, [
58
+ createVNode(unref(FontAwesomeIcon), {
59
+ class: "type-icon",
60
+ icon: _ctx.icon,
61
+ size: "sm"
62
+ }, null, 8, ["icon"]),
63
+ createVNode(TextWithHighlights, {
64
+ class: "title",
65
+ content: _ctx.title,
66
+ search: props2.search
67
+ }, null, 8, ["content", "search"])
68
+ ], 10, _hoisted_2$3)) : createCommentVNode("", true),
69
+ createVNode(TextWithHighlights, {
70
+ "data-test-id": "run-data-schema-item-value",
71
+ class: "text",
72
+ content: _ctx.value,
73
+ search: props2.search
74
+ }, null, 8, ["content", "search"])
75
+ ], 2);
76
+ };
77
+ }
78
+ });
79
+ const VirtualSchemaItem = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-01d2c8ae"]]);
80
+ const _hoisted_1$3 = {
81
+ class: "schema-header",
82
+ "data-test-id": "run-data-schema-header"
83
+ };
84
+ const _hoisted_2$2 = { class: "title" };
85
+ const _hoisted_3 = {
86
+ key: 0,
87
+ class: "info"
88
+ };
89
+ const _hoisted_4 = {
90
+ key: 1,
91
+ class: "item-count",
92
+ "data-test-id": "run-data-schema-node-item-count"
93
+ };
94
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
95
+ __name: "VirtualSchemaHeader",
96
+ props: {
97
+ title: {},
98
+ info: {},
99
+ collapsable: { type: Boolean },
100
+ collapsed: { type: Boolean },
101
+ nodeType: {},
102
+ itemCount: {}
103
+ },
104
+ emits: ["click:toggle"],
105
+ setup(__props, { emit: __emit }) {
106
+ const props2 = __props;
107
+ const i18n = useI18n();
108
+ const isTrigger = computed(() => props2.nodeType.group.includes("trigger"));
109
+ const emit = __emit;
110
+ return (_ctx, _cache) => {
111
+ return openBlock(), createElementBlock("div", _hoisted_1$3, [
112
+ createBaseVNode("div", {
113
+ class: "toggle",
114
+ onClickCapture: _cache[0] || (_cache[0] = withModifiers(($event) => emit("click:toggle"), ["stop"]))
115
+ }, [
116
+ createVNode(unref(FontAwesomeIcon), {
117
+ icon: "angle-down",
118
+ class: normalizeClass({ "collapse-icon": true, collapsed: _ctx.collapsed })
119
+ }, null, 8, ["class"])
120
+ ], 32),
121
+ createVNode(_sfc_main$3, {
122
+ class: normalizeClass(["icon", { ["icon-trigger"]: isTrigger.value }]),
123
+ "node-type": _ctx.nodeType,
124
+ size: 12
125
+ }, null, 8, ["class", "node-type"]),
126
+ createBaseVNode("div", _hoisted_2$2, [
127
+ createTextVNode(toDisplayString(_ctx.title) + " ", 1),
128
+ _ctx.info ? (openBlock(), createElementBlock("span", _hoisted_3, toDisplayString(_ctx.info), 1)) : createCommentVNode("", true)
129
+ ]),
130
+ isTrigger.value ? (openBlock(), createBlock(unref(FontAwesomeIcon), {
131
+ key: 0,
132
+ class: "trigger-icon",
133
+ icon: "bolt",
134
+ size: "xs"
135
+ })) : createCommentVNode("", true),
136
+ _ctx.itemCount ? (openBlock(), createElementBlock("div", _hoisted_4, toDisplayString(unref(i18n).baseText("ndv.output.items", { interpolate: { count: _ctx.itemCount } })), 1)) : createCommentVNode("", true)
137
+ ]);
138
+ };
139
+ }
140
+ });
141
+ const VirtualSchemaHeader = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-1977e9a6"]]);
142
+ function getInternetExplorerVersion() {
143
+ var ua = window.navigator.userAgent;
144
+ var msie = ua.indexOf("MSIE ");
145
+ if (msie > 0) {
146
+ return parseInt(ua.substring(msie + 5, ua.indexOf(".", msie)), 10);
147
+ }
148
+ var trident = ua.indexOf("Trident/");
149
+ if (trident > 0) {
150
+ var rv = ua.indexOf("rv:");
151
+ return parseInt(ua.substring(rv + 3, ua.indexOf(".", rv)), 10);
152
+ }
153
+ var edge = ua.indexOf("Edge/");
154
+ if (edge > 0) {
155
+ return parseInt(ua.substring(edge + 5, ua.indexOf(".", edge)), 10);
156
+ }
157
+ return -1;
158
+ }
159
+ let isIE;
160
+ function initCompat() {
161
+ if (!initCompat.init) {
162
+ initCompat.init = true;
163
+ isIE = getInternetExplorerVersion() !== -1;
164
+ }
165
+ }
166
+ var script$3 = {
167
+ name: "ResizeObserver",
168
+ props: {
169
+ emitOnMount: {
170
+ type: Boolean,
171
+ default: false
172
+ },
173
+ ignoreWidth: {
174
+ type: Boolean,
175
+ default: false
176
+ },
177
+ ignoreHeight: {
178
+ type: Boolean,
179
+ default: false
180
+ }
181
+ },
182
+ emits: [
183
+ "notify"
184
+ ],
185
+ mounted() {
186
+ initCompat();
187
+ nextTick(() => {
188
+ this._w = this.$el.offsetWidth;
189
+ this._h = this.$el.offsetHeight;
190
+ if (this.emitOnMount) {
191
+ this.emitSize();
192
+ }
193
+ });
194
+ const object = document.createElement("object");
195
+ this._resizeObject = object;
196
+ object.setAttribute("aria-hidden", "true");
197
+ object.setAttribute("tabindex", -1);
198
+ object.onload = this.addResizeHandlers;
199
+ object.type = "text/html";
200
+ if (isIE) {
201
+ this.$el.appendChild(object);
202
+ }
203
+ object.data = "about:blank";
204
+ if (!isIE) {
205
+ this.$el.appendChild(object);
206
+ }
207
+ },
208
+ beforeUnmount() {
209
+ this.removeResizeHandlers();
210
+ },
211
+ methods: {
212
+ compareAndNotify() {
213
+ if (!this.ignoreWidth && this._w !== this.$el.offsetWidth || !this.ignoreHeight && this._h !== this.$el.offsetHeight) {
214
+ this._w = this.$el.offsetWidth;
215
+ this._h = this.$el.offsetHeight;
216
+ this.emitSize();
217
+ }
218
+ },
219
+ emitSize() {
220
+ this.$emit("notify", {
221
+ width: this._w,
222
+ height: this._h
223
+ });
224
+ },
225
+ addResizeHandlers() {
226
+ this._resizeObject.contentDocument.defaultView.addEventListener("resize", this.compareAndNotify);
227
+ this.compareAndNotify();
228
+ },
229
+ removeResizeHandlers() {
230
+ if (this._resizeObject && this._resizeObject.onload) {
231
+ if (!isIE && this._resizeObject.contentDocument) {
232
+ this._resizeObject.contentDocument.defaultView.removeEventListener("resize", this.compareAndNotify);
233
+ }
234
+ this.$el.removeChild(this._resizeObject);
235
+ this._resizeObject.onload = null;
236
+ this._resizeObject = null;
237
+ }
238
+ }
239
+ }
240
+ };
241
+ const _withId = /* @__PURE__ */ withScopeId();
242
+ pushScopeId("data-v-b329ee4c");
243
+ const _hoisted_1$2 = {
244
+ class: "resize-observer",
245
+ tabindex: "-1"
246
+ };
247
+ popScopeId();
248
+ const render$2 = /* @__PURE__ */ _withId((_ctx, _cache, $props, $setup, $data, $options) => {
249
+ return openBlock(), createBlock("div", _hoisted_1$2);
250
+ });
251
+ script$3.render = render$2;
252
+ script$3.__scopeId = "data-v-b329ee4c";
253
+ script$3.__file = "src/components/ResizeObserver.vue";
254
+ function _typeof$1(obj) {
255
+ "@babel/helpers - typeof";
256
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
257
+ _typeof$1 = function(obj2) {
258
+ return typeof obj2;
259
+ };
260
+ } else {
261
+ _typeof$1 = function(obj2) {
262
+ return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
263
+ };
264
+ }
265
+ return _typeof$1(obj);
266
+ }
267
+ function _classCallCheck(instance, Constructor) {
268
+ if (!(instance instanceof Constructor)) {
269
+ throw new TypeError("Cannot call a class as a function");
270
+ }
271
+ }
272
+ function _defineProperties(target, props2) {
273
+ for (var i = 0; i < props2.length; i++) {
274
+ var descriptor = props2[i];
275
+ descriptor.enumerable = descriptor.enumerable || false;
276
+ descriptor.configurable = true;
277
+ if ("value" in descriptor) descriptor.writable = true;
278
+ Object.defineProperty(target, descriptor.key, descriptor);
279
+ }
280
+ }
281
+ function _createClass(Constructor, protoProps, staticProps) {
282
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
283
+ return Constructor;
284
+ }
285
+ function _toConsumableArray(arr) {
286
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
287
+ }
288
+ function _arrayWithoutHoles(arr) {
289
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
290
+ }
291
+ function _iterableToArray(iter) {
292
+ if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
293
+ }
294
+ function _unsupportedIterableToArray(o, minLen) {
295
+ if (!o) return;
296
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
297
+ var n = Object.prototype.toString.call(o).slice(8, -1);
298
+ if (n === "Object" && o.constructor) n = o.constructor.name;
299
+ if (n === "Map" || n === "Set") return Array.from(o);
300
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
301
+ }
302
+ function _arrayLikeToArray(arr, len) {
303
+ if (len == null || len > arr.length) len = arr.length;
304
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
305
+ return arr2;
306
+ }
307
+ function _nonIterableSpread() {
308
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
309
+ }
310
+ function processOptions(value) {
311
+ var options;
312
+ if (typeof value === "function") {
313
+ options = {
314
+ callback: value
315
+ };
316
+ } else {
317
+ options = value;
318
+ }
319
+ return options;
320
+ }
321
+ function throttle(callback, delay) {
322
+ var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
323
+ var timeout;
324
+ var lastState;
325
+ var currentArgs;
326
+ var throttled = function throttled2(state) {
327
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
328
+ args[_key - 1] = arguments[_key];
329
+ }
330
+ currentArgs = args;
331
+ if (timeout && state === lastState) return;
332
+ var leading = options.leading;
333
+ if (typeof leading === "function") {
334
+ leading = leading(state, lastState);
335
+ }
336
+ if ((!timeout || state !== lastState) && leading) {
337
+ callback.apply(void 0, [state].concat(_toConsumableArray(currentArgs)));
338
+ }
339
+ lastState = state;
340
+ clearTimeout(timeout);
341
+ timeout = setTimeout(function() {
342
+ callback.apply(void 0, [state].concat(_toConsumableArray(currentArgs)));
343
+ timeout = 0;
344
+ }, delay);
345
+ };
346
+ throttled._clear = function() {
347
+ clearTimeout(timeout);
348
+ timeout = null;
349
+ };
350
+ return throttled;
351
+ }
352
+ function deepEqual(val1, val2) {
353
+ if (val1 === val2) return true;
354
+ if (_typeof$1(val1) === "object") {
355
+ for (var key in val1) {
356
+ if (!deepEqual(val1[key], val2[key])) {
357
+ return false;
358
+ }
359
+ }
360
+ return true;
361
+ }
362
+ return false;
363
+ }
364
+ var VisibilityState = /* @__PURE__ */ function() {
365
+ function VisibilityState2(el, options, vnode) {
366
+ _classCallCheck(this, VisibilityState2);
367
+ this.el = el;
368
+ this.observer = null;
369
+ this.frozen = false;
370
+ this.createObserver(options, vnode);
371
+ }
372
+ _createClass(VisibilityState2, [{
373
+ key: "createObserver",
374
+ value: function createObserver(options, vnode) {
375
+ var _this = this;
376
+ if (this.observer) {
377
+ this.destroyObserver();
378
+ }
379
+ if (this.frozen) return;
380
+ this.options = processOptions(options);
381
+ this.callback = function(result, entry) {
382
+ _this.options.callback(result, entry);
383
+ if (result && _this.options.once) {
384
+ _this.frozen = true;
385
+ _this.destroyObserver();
386
+ }
387
+ };
388
+ if (this.callback && this.options.throttle) {
389
+ var _ref = this.options.throttleOptions || {}, _leading = _ref.leading;
390
+ this.callback = throttle(this.callback, this.options.throttle, {
391
+ leading: function leading(state) {
392
+ return _leading === "both" || _leading === "visible" && state || _leading === "hidden" && !state;
393
+ }
394
+ });
395
+ }
396
+ this.oldResult = void 0;
397
+ this.observer = new IntersectionObserver(function(entries) {
398
+ var entry = entries[0];
399
+ if (entries.length > 1) {
400
+ var intersectingEntry = entries.find(function(e) {
401
+ return e.isIntersecting;
402
+ });
403
+ if (intersectingEntry) {
404
+ entry = intersectingEntry;
405
+ }
406
+ }
407
+ if (_this.callback) {
408
+ var result = entry.isIntersecting && entry.intersectionRatio >= _this.threshold;
409
+ if (result === _this.oldResult) return;
410
+ _this.oldResult = result;
411
+ _this.callback(result, entry);
412
+ }
413
+ }, this.options.intersection);
414
+ nextTick(function() {
415
+ if (_this.observer) {
416
+ _this.observer.observe(_this.el);
417
+ }
418
+ });
419
+ }
420
+ }, {
421
+ key: "destroyObserver",
422
+ value: function destroyObserver() {
423
+ if (this.observer) {
424
+ this.observer.disconnect();
425
+ this.observer = null;
426
+ }
427
+ if (this.callback && this.callback._clear) {
428
+ this.callback._clear();
429
+ this.callback = null;
430
+ }
431
+ }
432
+ }, {
433
+ key: "threshold",
434
+ get: function get() {
435
+ return this.options.intersection && typeof this.options.intersection.threshold === "number" ? this.options.intersection.threshold : 0;
436
+ }
437
+ }]);
438
+ return VisibilityState2;
439
+ }();
440
+ function beforeMount(el, _ref2, vnode) {
441
+ var value = _ref2.value;
442
+ if (!value) return;
443
+ if (typeof IntersectionObserver === "undefined") {
444
+ console.warn("[vue-observe-visibility] IntersectionObserver API is not available in your browser. Please install this polyfill: https://github.com/w3c/IntersectionObserver/tree/master/polyfill");
445
+ } else {
446
+ var state = new VisibilityState(el, value, vnode);
447
+ el._vue_visibilityState = state;
448
+ }
449
+ }
450
+ function updated(el, _ref3, vnode) {
451
+ var value = _ref3.value, oldValue = _ref3.oldValue;
452
+ if (deepEqual(value, oldValue)) return;
453
+ var state = el._vue_visibilityState;
454
+ if (!value) {
455
+ unmounted(el);
456
+ return;
457
+ }
458
+ if (state) {
459
+ state.createObserver(value, vnode);
460
+ } else {
461
+ beforeMount(el, {
462
+ value
463
+ }, vnode);
464
+ }
465
+ }
466
+ function unmounted(el) {
467
+ var state = el._vue_visibilityState;
468
+ if (state) {
469
+ state.destroyObserver();
470
+ delete el._vue_visibilityState;
471
+ }
472
+ }
473
+ var ObserveVisibility = {
474
+ beforeMount,
475
+ updated,
476
+ unmounted
477
+ };
478
+ function mitt(n) {
479
+ return { all: n = n || /* @__PURE__ */ new Map(), on: function(t, e) {
480
+ var i = n.get(t);
481
+ i && i.push(e) || n.set(t, [e]);
482
+ }, off: function(t, e) {
483
+ var i = n.get(t);
484
+ i && i.splice(i.indexOf(e) >>> 0, 1);
485
+ }, emit: function(t, e) {
486
+ (n.get(t) || []).slice().map(function(n2) {
487
+ n2(e);
488
+ }), (n.get("*") || []).slice().map(function(n2) {
489
+ n2(t, e);
490
+ });
491
+ } };
492
+ }
493
+ var config = {
494
+ itemsLimit: 1e3
495
+ };
496
+ var regex = /(auto|scroll)/;
497
+ function parents(node, ps) {
498
+ if (node.parentNode === null) {
499
+ return ps;
500
+ }
501
+ return parents(node.parentNode, ps.concat([node]));
502
+ }
503
+ var style = function style2(node, prop) {
504
+ return getComputedStyle(node, null).getPropertyValue(prop);
505
+ };
506
+ var overflow = function overflow2(node) {
507
+ return style(node, "overflow") + style(node, "overflow-y") + style(node, "overflow-x");
508
+ };
509
+ var scroll = function scroll2(node) {
510
+ return regex.test(overflow(node));
511
+ };
512
+ function getScrollParent(node) {
513
+ if (!(node instanceof HTMLElement || node instanceof SVGElement)) {
514
+ return;
515
+ }
516
+ var ps = parents(node.parentNode, []);
517
+ for (var i = 0; i < ps.length; i += 1) {
518
+ if (scroll(ps[i])) {
519
+ return ps[i];
520
+ }
521
+ }
522
+ return document.scrollingElement || document.documentElement;
523
+ }
524
+ function _typeof(obj) {
525
+ "@babel/helpers - typeof";
526
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
527
+ return typeof obj2;
528
+ } : function(obj2) {
529
+ return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
530
+ }, _typeof(obj);
531
+ }
532
+ var props = {
533
+ items: {
534
+ type: Array,
535
+ required: true
536
+ },
537
+ keyField: {
538
+ type: String,
539
+ default: "id"
540
+ },
541
+ direction: {
542
+ type: String,
543
+ default: "vertical",
544
+ validator: function validator(value) {
545
+ return ["vertical", "horizontal"].includes(value);
546
+ }
547
+ },
548
+ listTag: {
549
+ type: String,
550
+ default: "div"
551
+ },
552
+ itemTag: {
553
+ type: String,
554
+ default: "div"
555
+ }
556
+ };
557
+ function simpleArray() {
558
+ return this.items.length && _typeof(this.items[0]) !== "object";
559
+ }
560
+ var supportsPassive = false;
561
+ if (typeof window !== "undefined") {
562
+ supportsPassive = false;
563
+ try {
564
+ var opts = Object.defineProperty({}, "passive", {
565
+ get: function get() {
566
+ supportsPassive = true;
567
+ }
568
+ });
569
+ window.addEventListener("test", null, opts);
570
+ } catch (e) {
571
+ }
572
+ }
573
+ let uid = 0;
574
+ var script$2 = {
575
+ name: "RecycleScroller",
576
+ components: {
577
+ ResizeObserver: script$3
578
+ },
579
+ directives: {
580
+ ObserveVisibility
581
+ },
582
+ props: {
583
+ ...props,
584
+ itemSize: {
585
+ type: Number,
586
+ default: null
587
+ },
588
+ gridItems: {
589
+ type: Number,
590
+ default: void 0
591
+ },
592
+ itemSecondarySize: {
593
+ type: Number,
594
+ default: void 0
595
+ },
596
+ minItemSize: {
597
+ type: [Number, String],
598
+ default: null
599
+ },
600
+ sizeField: {
601
+ type: String,
602
+ default: "size"
603
+ },
604
+ typeField: {
605
+ type: String,
606
+ default: "type"
607
+ },
608
+ buffer: {
609
+ type: Number,
610
+ default: 200
611
+ },
612
+ pageMode: {
613
+ type: Boolean,
614
+ default: false
615
+ },
616
+ prerender: {
617
+ type: Number,
618
+ default: 0
619
+ },
620
+ emitUpdate: {
621
+ type: Boolean,
622
+ default: false
623
+ },
624
+ updateInterval: {
625
+ type: Number,
626
+ default: 0
627
+ },
628
+ skipHover: {
629
+ type: Boolean,
630
+ default: false
631
+ },
632
+ listTag: {
633
+ type: String,
634
+ default: "div"
635
+ },
636
+ itemTag: {
637
+ type: String,
638
+ default: "div"
639
+ },
640
+ listClass: {
641
+ type: [String, Object, Array],
642
+ default: ""
643
+ },
644
+ itemClass: {
645
+ type: [String, Object, Array],
646
+ default: ""
647
+ }
648
+ },
649
+ emits: [
650
+ "resize",
651
+ "visible",
652
+ "hidden",
653
+ "update",
654
+ "scroll-start",
655
+ "scroll-end"
656
+ ],
657
+ data() {
658
+ return {
659
+ pool: [],
660
+ totalSize: 0,
661
+ ready: false,
662
+ hoverKey: null
663
+ };
664
+ },
665
+ computed: {
666
+ sizes() {
667
+ if (this.itemSize === null) {
668
+ const sizes = {
669
+ "-1": { accumulator: 0 }
670
+ };
671
+ const items = this.items;
672
+ const field = this.sizeField;
673
+ const minItemSize = this.minItemSize;
674
+ let computedMinSize = 1e4;
675
+ let accumulator = 0;
676
+ let current;
677
+ for (let i = 0, l = items.length; i < l; i++) {
678
+ current = items[i][field] || minItemSize;
679
+ if (current < computedMinSize) {
680
+ computedMinSize = current;
681
+ }
682
+ accumulator += current;
683
+ sizes[i] = { accumulator, size: current };
684
+ }
685
+ this.$_computedMinItemSize = computedMinSize;
686
+ return sizes;
687
+ }
688
+ return [];
689
+ },
690
+ simpleArray,
691
+ itemIndexByKey() {
692
+ const { keyField, items } = this;
693
+ const result = {};
694
+ for (let i = 0, l = items.length; i < l; i++) {
695
+ result[items[i][keyField]] = i;
696
+ }
697
+ return result;
698
+ }
699
+ },
700
+ watch: {
701
+ items() {
702
+ this.updateVisibleItems(true);
703
+ },
704
+ pageMode() {
705
+ this.applyPageMode();
706
+ this.updateVisibleItems(false);
707
+ },
708
+ sizes: {
709
+ handler() {
710
+ this.updateVisibleItems(false);
711
+ },
712
+ deep: true
713
+ },
714
+ gridItems() {
715
+ this.updateVisibleItems(true);
716
+ },
717
+ itemSecondarySize() {
718
+ this.updateVisibleItems(true);
719
+ }
720
+ },
721
+ created() {
722
+ this.$_startIndex = 0;
723
+ this.$_endIndex = 0;
724
+ this.$_views = /* @__PURE__ */ new Map();
725
+ this.$_unusedViews = /* @__PURE__ */ new Map();
726
+ this.$_scrollDirty = false;
727
+ this.$_lastUpdateScrollPosition = 0;
728
+ if (this.prerender) {
729
+ this.$_prerender = true;
730
+ this.updateVisibleItems(false);
731
+ }
732
+ if (this.gridItems && !this.itemSize) {
733
+ console.error("[vue-recycle-scroller] You must provide an itemSize when using gridItems");
734
+ }
735
+ },
736
+ mounted() {
737
+ this.applyPageMode();
738
+ this.$nextTick(() => {
739
+ this.$_prerender = false;
740
+ this.updateVisibleItems(true);
741
+ this.ready = true;
742
+ });
743
+ },
744
+ activated() {
745
+ const lastPosition = this.$_lastUpdateScrollPosition;
746
+ if (typeof lastPosition === "number") {
747
+ this.$nextTick(() => {
748
+ this.scrollToPosition(lastPosition);
749
+ });
750
+ }
751
+ },
752
+ beforeUnmount() {
753
+ this.removeListeners();
754
+ },
755
+ methods: {
756
+ addView(pool, index, item, key, type) {
757
+ const nr = markRaw({
758
+ id: uid++,
759
+ index,
760
+ used: true,
761
+ key,
762
+ type
763
+ });
764
+ const view = shallowReactive({
765
+ item,
766
+ position: 0,
767
+ nr
768
+ });
769
+ pool.push(view);
770
+ return view;
771
+ },
772
+ unuseView(view, fake = false) {
773
+ const unusedViews = this.$_unusedViews;
774
+ const type = view.nr.type;
775
+ let unusedPool = unusedViews.get(type);
776
+ if (!unusedPool) {
777
+ unusedPool = [];
778
+ unusedViews.set(type, unusedPool);
779
+ }
780
+ unusedPool.push(view);
781
+ if (!fake) {
782
+ view.nr.used = false;
783
+ view.position = -9999;
784
+ }
785
+ },
786
+ handleResize() {
787
+ this.$emit("resize");
788
+ if (this.ready) this.updateVisibleItems(false);
789
+ },
790
+ handleScroll(event) {
791
+ if (!this.$_scrollDirty) {
792
+ this.$_scrollDirty = true;
793
+ if (this.$_updateTimeout) return;
794
+ const requestUpdate = () => requestAnimationFrame(() => {
795
+ this.$_scrollDirty = false;
796
+ const { continuous } = this.updateVisibleItems(false, true);
797
+ if (!continuous) {
798
+ clearTimeout(this.$_refreshTimout);
799
+ this.$_refreshTimout = setTimeout(this.handleScroll, this.updateInterval + 100);
800
+ }
801
+ });
802
+ requestUpdate();
803
+ if (this.updateInterval) {
804
+ this.$_updateTimeout = setTimeout(() => {
805
+ this.$_updateTimeout = 0;
806
+ if (this.$_scrollDirty) requestUpdate();
807
+ }, this.updateInterval);
808
+ }
809
+ }
810
+ },
811
+ handleVisibilityChange(isVisible, entry) {
812
+ if (this.ready) {
813
+ if (isVisible || entry.boundingClientRect.width !== 0 || entry.boundingClientRect.height !== 0) {
814
+ this.$emit("visible");
815
+ requestAnimationFrame(() => {
816
+ this.updateVisibleItems(false);
817
+ });
818
+ } else {
819
+ this.$emit("hidden");
820
+ }
821
+ }
822
+ },
823
+ updateVisibleItems(checkItem, checkPositionDiff = false) {
824
+ const itemSize = this.itemSize;
825
+ const gridItems = this.gridItems || 1;
826
+ const itemSecondarySize = this.itemSecondarySize || itemSize;
827
+ const minItemSize = this.$_computedMinItemSize;
828
+ const typeField = this.typeField;
829
+ const keyField = this.simpleArray ? null : this.keyField;
830
+ const items = this.items;
831
+ const count = items.length;
832
+ const sizes = this.sizes;
833
+ const views = this.$_views;
834
+ const unusedViews = this.$_unusedViews;
835
+ const pool = this.pool;
836
+ const itemIndexByKey = this.itemIndexByKey;
837
+ let startIndex, endIndex;
838
+ let totalSize;
839
+ let visibleStartIndex, visibleEndIndex;
840
+ if (!count) {
841
+ startIndex = endIndex = visibleStartIndex = visibleEndIndex = totalSize = 0;
842
+ } else if (this.$_prerender) {
843
+ startIndex = visibleStartIndex = 0;
844
+ endIndex = visibleEndIndex = Math.min(this.prerender, items.length);
845
+ totalSize = null;
846
+ } else {
847
+ const scroll3 = this.getScroll();
848
+ if (checkPositionDiff) {
849
+ let positionDiff = scroll3.start - this.$_lastUpdateScrollPosition;
850
+ if (positionDiff < 0) positionDiff = -positionDiff;
851
+ if (itemSize === null && positionDiff < minItemSize || positionDiff < itemSize) {
852
+ return {
853
+ continuous: true
854
+ };
855
+ }
856
+ }
857
+ this.$_lastUpdateScrollPosition = scroll3.start;
858
+ const buffer = this.buffer;
859
+ scroll3.start -= buffer;
860
+ scroll3.end += buffer;
861
+ let beforeSize = 0;
862
+ if (this.$refs.before) {
863
+ beforeSize = this.$refs.before.scrollHeight;
864
+ scroll3.start -= beforeSize;
865
+ }
866
+ if (this.$refs.after) {
867
+ const afterSize = this.$refs.after.scrollHeight;
868
+ scroll3.end += afterSize;
869
+ }
870
+ if (itemSize === null) {
871
+ let h2;
872
+ let a = 0;
873
+ let b = count - 1;
874
+ let i = ~~(count / 2);
875
+ let oldI;
876
+ do {
877
+ oldI = i;
878
+ h2 = sizes[i].accumulator;
879
+ if (h2 < scroll3.start) {
880
+ a = i;
881
+ } else if (i < count - 1 && sizes[i + 1].accumulator > scroll3.start) {
882
+ b = i;
883
+ }
884
+ i = ~~((a + b) / 2);
885
+ } while (i !== oldI);
886
+ i < 0 && (i = 0);
887
+ startIndex = i;
888
+ totalSize = sizes[count - 1].accumulator;
889
+ for (endIndex = i; endIndex < count && sizes[endIndex].accumulator < scroll3.end; endIndex++) ;
890
+ if (endIndex === -1) {
891
+ endIndex = items.length - 1;
892
+ } else {
893
+ endIndex++;
894
+ endIndex > count && (endIndex = count);
895
+ }
896
+ for (visibleStartIndex = startIndex; visibleStartIndex < count && beforeSize + sizes[visibleStartIndex].accumulator < scroll3.start; visibleStartIndex++) ;
897
+ for (visibleEndIndex = visibleStartIndex; visibleEndIndex < count && beforeSize + sizes[visibleEndIndex].accumulator < scroll3.end; visibleEndIndex++) ;
898
+ } else {
899
+ startIndex = ~~(scroll3.start / itemSize * gridItems);
900
+ const remainer = startIndex % gridItems;
901
+ startIndex -= remainer;
902
+ endIndex = Math.ceil(scroll3.end / itemSize * gridItems);
903
+ visibleStartIndex = Math.max(0, Math.floor((scroll3.start - beforeSize) / itemSize * gridItems));
904
+ visibleEndIndex = Math.floor((scroll3.end - beforeSize) / itemSize * gridItems);
905
+ startIndex < 0 && (startIndex = 0);
906
+ endIndex > count && (endIndex = count);
907
+ visibleStartIndex < 0 && (visibleStartIndex = 0);
908
+ visibleEndIndex > count && (visibleEndIndex = count);
909
+ totalSize = Math.ceil(count / gridItems) * itemSize;
910
+ }
911
+ }
912
+ if (endIndex - startIndex > config.itemsLimit) {
913
+ this.itemsLimitError();
914
+ }
915
+ this.totalSize = totalSize;
916
+ let view;
917
+ const continuous = startIndex <= this.$_endIndex && endIndex >= this.$_startIndex;
918
+ if (continuous) {
919
+ for (let i = 0, l = pool.length; i < l; i++) {
920
+ view = pool[i];
921
+ if (view.nr.used) {
922
+ if (checkItem) {
923
+ view.nr.index = itemIndexByKey[view.item[keyField]];
924
+ }
925
+ if (view.nr.index == null || view.nr.index < startIndex || view.nr.index >= endIndex) {
926
+ this.unuseView(view);
927
+ }
928
+ }
929
+ }
930
+ }
931
+ const unusedIndex = continuous ? null : /* @__PURE__ */ new Map();
932
+ let item, type;
933
+ let v;
934
+ for (let i = startIndex; i < endIndex; i++) {
935
+ item = items[i];
936
+ const key = keyField ? item[keyField] : item;
937
+ if (key == null) {
938
+ throw new Error(`Key is ${key} on item (keyField is '${keyField}')`);
939
+ }
940
+ view = views.get(key);
941
+ if (!itemSize && !sizes[i].size) {
942
+ if (view) this.unuseView(view);
943
+ continue;
944
+ }
945
+ type = item[typeField];
946
+ let unusedPool = unusedViews.get(type);
947
+ let newlyUsedView = false;
948
+ if (!view) {
949
+ if (continuous) {
950
+ if (unusedPool && unusedPool.length) {
951
+ view = unusedPool.pop();
952
+ } else {
953
+ view = this.addView(pool, i, item, key, type);
954
+ }
955
+ } else {
956
+ v = unusedIndex.get(type) || 0;
957
+ if (!unusedPool || v >= unusedPool.length) {
958
+ view = this.addView(pool, i, item, key, type);
959
+ this.unuseView(view, true);
960
+ unusedPool = unusedViews.get(type);
961
+ }
962
+ view = unusedPool[v];
963
+ unusedIndex.set(type, v + 1);
964
+ }
965
+ views.delete(view.nr.key);
966
+ view.nr.used = true;
967
+ view.nr.index = i;
968
+ view.nr.key = key;
969
+ view.nr.type = type;
970
+ views.set(key, view);
971
+ newlyUsedView = true;
972
+ } else {
973
+ if (!view.nr.used) {
974
+ view.nr.used = true;
975
+ newlyUsedView = true;
976
+ if (unusedPool) {
977
+ const index = unusedPool.indexOf(view);
978
+ if (index !== -1) unusedPool.splice(index, 1);
979
+ }
980
+ }
981
+ }
982
+ view.item = item;
983
+ if (newlyUsedView) {
984
+ if (i === items.length - 1) this.$emit("scroll-end");
985
+ if (i === 0) this.$emit("scroll-start");
986
+ }
987
+ if (itemSize === null) {
988
+ view.position = sizes[i - 1].accumulator;
989
+ view.offset = 0;
990
+ } else {
991
+ view.position = Math.floor(i / gridItems) * itemSize;
992
+ view.offset = i % gridItems * itemSecondarySize;
993
+ }
994
+ }
995
+ this.$_startIndex = startIndex;
996
+ this.$_endIndex = endIndex;
997
+ if (this.emitUpdate) this.$emit("update", startIndex, endIndex, visibleStartIndex, visibleEndIndex);
998
+ clearTimeout(this.$_sortTimer);
999
+ this.$_sortTimer = setTimeout(this.sortViews, this.updateInterval + 300);
1000
+ return {
1001
+ continuous
1002
+ };
1003
+ },
1004
+ getListenerTarget() {
1005
+ let target = getScrollParent(this.$el);
1006
+ if (window.document && (target === window.document.documentElement || target === window.document.body)) {
1007
+ target = window;
1008
+ }
1009
+ return target;
1010
+ },
1011
+ getScroll() {
1012
+ const { $el: el, direction } = this;
1013
+ const isVertical = direction === "vertical";
1014
+ let scrollState;
1015
+ if (this.pageMode) {
1016
+ const bounds = el.getBoundingClientRect();
1017
+ const boundsSize = isVertical ? bounds.height : bounds.width;
1018
+ let start = -(isVertical ? bounds.top : bounds.left);
1019
+ let size = isVertical ? window.innerHeight : window.innerWidth;
1020
+ if (start < 0) {
1021
+ size += start;
1022
+ start = 0;
1023
+ }
1024
+ if (start + size > boundsSize) {
1025
+ size = boundsSize - start;
1026
+ }
1027
+ scrollState = {
1028
+ start,
1029
+ end: start + size
1030
+ };
1031
+ } else if (isVertical) {
1032
+ scrollState = {
1033
+ start: el.scrollTop,
1034
+ end: el.scrollTop + el.clientHeight
1035
+ };
1036
+ } else {
1037
+ scrollState = {
1038
+ start: el.scrollLeft,
1039
+ end: el.scrollLeft + el.clientWidth
1040
+ };
1041
+ }
1042
+ return scrollState;
1043
+ },
1044
+ applyPageMode() {
1045
+ if (this.pageMode) {
1046
+ this.addListeners();
1047
+ } else {
1048
+ this.removeListeners();
1049
+ }
1050
+ },
1051
+ addListeners() {
1052
+ this.listenerTarget = this.getListenerTarget();
1053
+ this.listenerTarget.addEventListener("scroll", this.handleScroll, supportsPassive ? {
1054
+ passive: true
1055
+ } : false);
1056
+ this.listenerTarget.addEventListener("resize", this.handleResize);
1057
+ },
1058
+ removeListeners() {
1059
+ if (!this.listenerTarget) {
1060
+ return;
1061
+ }
1062
+ this.listenerTarget.removeEventListener("scroll", this.handleScroll);
1063
+ this.listenerTarget.removeEventListener("resize", this.handleResize);
1064
+ this.listenerTarget = null;
1065
+ },
1066
+ scrollToItem(index) {
1067
+ let scroll3;
1068
+ const gridItems = this.gridItems || 1;
1069
+ if (this.itemSize === null) {
1070
+ scroll3 = index > 0 ? this.sizes[index - 1].accumulator : 0;
1071
+ } else {
1072
+ scroll3 = Math.floor(index / gridItems) * this.itemSize;
1073
+ }
1074
+ this.scrollToPosition(scroll3);
1075
+ },
1076
+ scrollToPosition(position) {
1077
+ const direction = this.direction === "vertical" ? { scroll: "scrollTop", start: "top" } : { scroll: "scrollLeft", start: "left" };
1078
+ let viewport;
1079
+ let scrollDirection;
1080
+ let scrollDistance;
1081
+ if (this.pageMode) {
1082
+ const viewportEl = getScrollParent(this.$el);
1083
+ const scrollTop = viewportEl.tagName === "HTML" ? 0 : viewportEl[direction.scroll];
1084
+ const bounds = viewportEl.getBoundingClientRect();
1085
+ const scroller = this.$el.getBoundingClientRect();
1086
+ const scrollerPosition = scroller[direction.start] - bounds[direction.start];
1087
+ viewport = viewportEl;
1088
+ scrollDirection = direction.scroll;
1089
+ scrollDistance = position + scrollTop + scrollerPosition;
1090
+ } else {
1091
+ viewport = this.$el;
1092
+ scrollDirection = direction.scroll;
1093
+ scrollDistance = position;
1094
+ }
1095
+ viewport[scrollDirection] = scrollDistance;
1096
+ },
1097
+ itemsLimitError() {
1098
+ setTimeout(() => {
1099
+ console.log("It seems the scroller element isn't scrolling, so it tries to render all the items at once.", "Scroller:", this.$el);
1100
+ console.log("Make sure the scroller has a fixed height (or width) and 'overflow-y' (or 'overflow-x') set to 'auto' so it can scroll correctly and only render the items visible in the scroll viewport.");
1101
+ });
1102
+ throw new Error("Rendered items limit reached");
1103
+ },
1104
+ sortViews() {
1105
+ this.pool.sort((viewA, viewB) => viewA.nr.index - viewB.nr.index);
1106
+ }
1107
+ }
1108
+ };
1109
+ const _hoisted_1$1 = {
1110
+ key: 0,
1111
+ ref: "before",
1112
+ class: "vue-recycle-scroller__slot"
1113
+ };
1114
+ const _hoisted_2$1 = {
1115
+ key: 1,
1116
+ ref: "after",
1117
+ class: "vue-recycle-scroller__slot"
1118
+ };
1119
+ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
1120
+ const _component_ResizeObserver = resolveComponent("ResizeObserver");
1121
+ const _directive_observe_visibility = resolveDirective("observe-visibility");
1122
+ return withDirectives((openBlock(), createElementBlock(
1123
+ "div",
1124
+ {
1125
+ class: normalizeClass(["vue-recycle-scroller", {
1126
+ ready: $data.ready,
1127
+ "page-mode": $props.pageMode,
1128
+ [`direction-${_ctx.direction}`]: true
1129
+ }]),
1130
+ onScrollPassive: _cache[0] || (_cache[0] = (...args) => $options.handleScroll && $options.handleScroll(...args))
1131
+ },
1132
+ [
1133
+ _ctx.$slots.before ? (openBlock(), createElementBlock(
1134
+ "div",
1135
+ _hoisted_1$1,
1136
+ [
1137
+ renderSlot(_ctx.$slots, "before")
1138
+ ],
1139
+ 512
1140
+ /* NEED_PATCH */
1141
+ )) : createCommentVNode("v-if", true),
1142
+ (openBlock(), createBlock(resolveDynamicComponent($props.listTag), {
1143
+ ref: "wrapper",
1144
+ style: normalizeStyle({ [_ctx.direction === "vertical" ? "minHeight" : "minWidth"]: $data.totalSize + "px" }),
1145
+ class: normalizeClass(["vue-recycle-scroller__item-wrapper", $props.listClass])
1146
+ }, {
1147
+ default: withCtx(() => [
1148
+ (openBlock(true), createElementBlock(
1149
+ Fragment,
1150
+ null,
1151
+ renderList($data.pool, (view) => {
1152
+ return openBlock(), createBlock(resolveDynamicComponent($props.itemTag), mergeProps({
1153
+ key: view.nr.id,
1154
+ style: $data.ready ? {
1155
+ transform: `translate${_ctx.direction === "vertical" ? "Y" : "X"}(${view.position}px) translate${_ctx.direction === "vertical" ? "X" : "Y"}(${view.offset}px)`,
1156
+ width: $props.gridItems ? `${_ctx.direction === "vertical" ? $props.itemSecondarySize || $props.itemSize : $props.itemSize}px` : void 0,
1157
+ height: $props.gridItems ? `${_ctx.direction === "horizontal" ? $props.itemSecondarySize || $props.itemSize : $props.itemSize}px` : void 0
1158
+ } : null,
1159
+ class: ["vue-recycle-scroller__item-view", [
1160
+ $props.itemClass,
1161
+ {
1162
+ hover: !$props.skipHover && $data.hoverKey === view.nr.key
1163
+ }
1164
+ ]]
1165
+ }, toHandlers($props.skipHover ? {} : {
1166
+ mouseenter: () => {
1167
+ $data.hoverKey = view.nr.key;
1168
+ },
1169
+ mouseleave: () => {
1170
+ $data.hoverKey = null;
1171
+ }
1172
+ })), {
1173
+ default: withCtx(() => [
1174
+ renderSlot(_ctx.$slots, "default", {
1175
+ item: view.item,
1176
+ index: view.nr.index,
1177
+ active: view.nr.used
1178
+ })
1179
+ ]),
1180
+ _: 2
1181
+ /* DYNAMIC */
1182
+ }, 1040, ["style", "class"]);
1183
+ }),
1184
+ 128
1185
+ /* KEYED_FRAGMENT */
1186
+ )),
1187
+ renderSlot(_ctx.$slots, "empty")
1188
+ ]),
1189
+ _: 3
1190
+ /* FORWARDED */
1191
+ }, 8, ["style", "class"])),
1192
+ _ctx.$slots.after ? (openBlock(), createElementBlock(
1193
+ "div",
1194
+ _hoisted_2$1,
1195
+ [
1196
+ renderSlot(_ctx.$slots, "after")
1197
+ ],
1198
+ 512
1199
+ /* NEED_PATCH */
1200
+ )) : createCommentVNode("v-if", true),
1201
+ createVNode(_component_ResizeObserver, { onNotify: $options.handleResize }, null, 8, ["onNotify"])
1202
+ ],
1203
+ 34
1204
+ /* CLASS, HYDRATE_EVENTS */
1205
+ )), [
1206
+ [_directive_observe_visibility, $options.handleVisibilityChange]
1207
+ ]);
1208
+ }
1209
+ script$2.render = render$1;
1210
+ script$2.__file = "src/components/RecycleScroller.vue";
1211
+ var script$1 = {
1212
+ name: "DynamicScroller",
1213
+ components: {
1214
+ RecycleScroller: script$2
1215
+ },
1216
+ provide() {
1217
+ if (typeof ResizeObserver !== "undefined") {
1218
+ this.$_resizeObserver = new ResizeObserver((entries) => {
1219
+ requestAnimationFrame(() => {
1220
+ if (!Array.isArray(entries)) {
1221
+ return;
1222
+ }
1223
+ for (const entry of entries) {
1224
+ if (entry.target && entry.target.$_vs_onResize) {
1225
+ let width, height;
1226
+ if (entry.borderBoxSize) {
1227
+ const resizeObserverSize = entry.borderBoxSize[0];
1228
+ width = resizeObserverSize.inlineSize;
1229
+ height = resizeObserverSize.blockSize;
1230
+ } else {
1231
+ width = entry.contentRect.width;
1232
+ height = entry.contentRect.height;
1233
+ }
1234
+ entry.target.$_vs_onResize(entry.target.$_vs_id, width, height);
1235
+ }
1236
+ }
1237
+ });
1238
+ });
1239
+ }
1240
+ return {
1241
+ vscrollData: this.vscrollData,
1242
+ vscrollParent: this,
1243
+ vscrollResizeObserver: this.$_resizeObserver
1244
+ };
1245
+ },
1246
+ inheritAttrs: false,
1247
+ props: {
1248
+ ...props,
1249
+ minItemSize: {
1250
+ type: [Number, String],
1251
+ required: true
1252
+ }
1253
+ },
1254
+ emits: [
1255
+ "resize",
1256
+ "visible"
1257
+ ],
1258
+ data() {
1259
+ return {
1260
+ vscrollData: {
1261
+ active: true,
1262
+ sizes: {},
1263
+ keyField: this.keyField,
1264
+ simpleArray: false
1265
+ }
1266
+ };
1267
+ },
1268
+ computed: {
1269
+ simpleArray,
1270
+ itemsWithSize() {
1271
+ const result = [];
1272
+ const { items, keyField, simpleArray: simpleArray2 } = this;
1273
+ const sizes = this.vscrollData.sizes;
1274
+ const l = items.length;
1275
+ for (let i = 0; i < l; i++) {
1276
+ const item = items[i];
1277
+ const id = simpleArray2 ? i : item[keyField];
1278
+ let size = sizes[id];
1279
+ if (typeof size === "undefined" && !this.$_undefinedMap[id]) {
1280
+ size = 0;
1281
+ }
1282
+ result.push({
1283
+ item,
1284
+ id,
1285
+ size
1286
+ });
1287
+ }
1288
+ return result;
1289
+ }
1290
+ },
1291
+ watch: {
1292
+ items() {
1293
+ this.forceUpdate();
1294
+ },
1295
+ simpleArray: {
1296
+ handler(value) {
1297
+ this.vscrollData.simpleArray = value;
1298
+ },
1299
+ immediate: true
1300
+ },
1301
+ direction(value) {
1302
+ this.forceUpdate(true);
1303
+ },
1304
+ itemsWithSize(next, prev) {
1305
+ const scrollTop = this.$el.scrollTop;
1306
+ let prevActiveTop = 0;
1307
+ let activeTop = 0;
1308
+ const length = Math.min(next.length, prev.length);
1309
+ for (let i = 0; i < length; i++) {
1310
+ if (prevActiveTop >= scrollTop) {
1311
+ break;
1312
+ }
1313
+ prevActiveTop += prev[i].size || this.minItemSize;
1314
+ activeTop += next[i].size || this.minItemSize;
1315
+ }
1316
+ const offset = activeTop - prevActiveTop;
1317
+ if (offset === 0) {
1318
+ return;
1319
+ }
1320
+ this.$el.scrollTop += offset;
1321
+ }
1322
+ },
1323
+ beforeCreate() {
1324
+ this.$_updates = [];
1325
+ this.$_undefinedSizes = 0;
1326
+ this.$_undefinedMap = {};
1327
+ this.$_events = mitt();
1328
+ },
1329
+ activated() {
1330
+ this.vscrollData.active = true;
1331
+ },
1332
+ deactivated() {
1333
+ this.vscrollData.active = false;
1334
+ },
1335
+ unmounted() {
1336
+ this.$_events.all.clear();
1337
+ },
1338
+ methods: {
1339
+ onScrollerResize() {
1340
+ const scroller = this.$refs.scroller;
1341
+ if (scroller) {
1342
+ this.forceUpdate();
1343
+ }
1344
+ this.$emit("resize");
1345
+ },
1346
+ onScrollerVisible() {
1347
+ this.$_events.emit("vscroll:update", { force: false });
1348
+ this.$emit("visible");
1349
+ },
1350
+ forceUpdate(clear = false) {
1351
+ if (clear || this.simpleArray) {
1352
+ this.vscrollData.sizes = {};
1353
+ }
1354
+ this.$_events.emit("vscroll:update", { force: true });
1355
+ },
1356
+ scrollToItem(index) {
1357
+ const scroller = this.$refs.scroller;
1358
+ if (scroller) scroller.scrollToItem(index);
1359
+ },
1360
+ getItemSize(item, index = void 0) {
1361
+ const id = this.simpleArray ? index != null ? index : this.items.indexOf(item) : item[this.keyField];
1362
+ return this.vscrollData.sizes[id] || 0;
1363
+ },
1364
+ scrollToBottom() {
1365
+ if (this.$_scrollingToBottom) return;
1366
+ this.$_scrollingToBottom = true;
1367
+ const el = this.$el;
1368
+ this.$nextTick(() => {
1369
+ el.scrollTop = el.scrollHeight + 5e3;
1370
+ const cb = () => {
1371
+ el.scrollTop = el.scrollHeight + 5e3;
1372
+ requestAnimationFrame(() => {
1373
+ el.scrollTop = el.scrollHeight + 5e3;
1374
+ if (this.$_undefinedSizes === 0) {
1375
+ this.$_scrollingToBottom = false;
1376
+ } else {
1377
+ requestAnimationFrame(cb);
1378
+ }
1379
+ });
1380
+ };
1381
+ requestAnimationFrame(cb);
1382
+ });
1383
+ }
1384
+ }
1385
+ };
1386
+ function render(_ctx, _cache, $props, $setup, $data, $options) {
1387
+ const _component_RecycleScroller = resolveComponent("RecycleScroller");
1388
+ return openBlock(), createBlock(_component_RecycleScroller, mergeProps({
1389
+ ref: "scroller",
1390
+ items: $options.itemsWithSize,
1391
+ "min-item-size": $props.minItemSize,
1392
+ direction: _ctx.direction,
1393
+ "key-field": "id",
1394
+ "list-tag": _ctx.listTag,
1395
+ "item-tag": _ctx.itemTag
1396
+ }, _ctx.$attrs, {
1397
+ onResize: $options.onScrollerResize,
1398
+ onVisible: $options.onScrollerVisible
1399
+ }), {
1400
+ default: withCtx(({ item: itemWithSize, index, active }) => [
1401
+ renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({
1402
+ item: itemWithSize.item,
1403
+ index,
1404
+ active,
1405
+ itemWithSize
1406
+ })))
1407
+ ]),
1408
+ before: withCtx(() => [
1409
+ renderSlot(_ctx.$slots, "before")
1410
+ ]),
1411
+ after: withCtx(() => [
1412
+ renderSlot(_ctx.$slots, "after")
1413
+ ]),
1414
+ empty: withCtx(() => [
1415
+ renderSlot(_ctx.$slots, "empty")
1416
+ ]),
1417
+ _: 3
1418
+ /* FORWARDED */
1419
+ }, 16, ["items", "min-item-size", "direction", "list-tag", "item-tag", "onResize", "onVisible"]);
1420
+ }
1421
+ script$1.render = render;
1422
+ script$1.__file = "src/components/DynamicScroller.vue";
1423
+ var script = {
1424
+ name: "DynamicScrollerItem",
1425
+ inject: [
1426
+ "vscrollData",
1427
+ "vscrollParent",
1428
+ "vscrollResizeObserver"
1429
+ ],
1430
+ props: {
1431
+ // eslint-disable-next-line vue/require-prop-types
1432
+ item: {
1433
+ required: true
1434
+ },
1435
+ watchData: {
1436
+ type: Boolean,
1437
+ default: false
1438
+ },
1439
+ /**
1440
+ * Indicates if the view is actively used to display an item.
1441
+ */
1442
+ active: {
1443
+ type: Boolean,
1444
+ required: true
1445
+ },
1446
+ index: {
1447
+ type: Number,
1448
+ default: void 0
1449
+ },
1450
+ sizeDependencies: {
1451
+ type: [Array, Object],
1452
+ default: null
1453
+ },
1454
+ emitResize: {
1455
+ type: Boolean,
1456
+ default: false
1457
+ },
1458
+ tag: {
1459
+ type: String,
1460
+ default: "div"
1461
+ }
1462
+ },
1463
+ emits: [
1464
+ "resize"
1465
+ ],
1466
+ computed: {
1467
+ id() {
1468
+ if (this.vscrollData.simpleArray) return this.index;
1469
+ if (this.vscrollData.keyField in this.item) return this.item[this.vscrollData.keyField];
1470
+ throw new Error(`keyField '${this.vscrollData.keyField}' not found in your item. You should set a valid keyField prop on your Scroller`);
1471
+ },
1472
+ size() {
1473
+ return this.vscrollData.sizes[this.id] || 0;
1474
+ },
1475
+ finalActive() {
1476
+ return this.active && this.vscrollData.active;
1477
+ }
1478
+ },
1479
+ watch: {
1480
+ watchData: "updateWatchData",
1481
+ id(value, oldValue) {
1482
+ this.$el.$_vs_id = this.id;
1483
+ if (!this.size) {
1484
+ this.onDataUpdate();
1485
+ }
1486
+ if (this.$_sizeObserved) {
1487
+ const oldSize = this.vscrollData.sizes[oldValue];
1488
+ const size = this.vscrollData.sizes[value];
1489
+ if (oldSize != null && oldSize !== size) {
1490
+ this.applySize(oldSize);
1491
+ }
1492
+ }
1493
+ },
1494
+ finalActive(value) {
1495
+ if (!this.size) {
1496
+ if (value) {
1497
+ if (!this.vscrollParent.$_undefinedMap[this.id]) {
1498
+ this.vscrollParent.$_undefinedSizes++;
1499
+ this.vscrollParent.$_undefinedMap[this.id] = true;
1500
+ }
1501
+ } else {
1502
+ if (this.vscrollParent.$_undefinedMap[this.id]) {
1503
+ this.vscrollParent.$_undefinedSizes--;
1504
+ this.vscrollParent.$_undefinedMap[this.id] = false;
1505
+ }
1506
+ }
1507
+ }
1508
+ if (this.vscrollResizeObserver) {
1509
+ if (value) {
1510
+ this.observeSize();
1511
+ } else {
1512
+ this.unobserveSize();
1513
+ }
1514
+ } else if (value && this.$_pendingVScrollUpdate === this.id) {
1515
+ this.updateSize();
1516
+ }
1517
+ }
1518
+ },
1519
+ created() {
1520
+ if (this.$isServer) return;
1521
+ this.$_forceNextVScrollUpdate = null;
1522
+ this.updateWatchData();
1523
+ if (!this.vscrollResizeObserver) {
1524
+ for (const k in this.sizeDependencies) {
1525
+ this.$watch(() => this.sizeDependencies[k], this.onDataUpdate);
1526
+ }
1527
+ this.vscrollParent.$_events.on("vscroll:update", this.onVscrollUpdate);
1528
+ }
1529
+ },
1530
+ mounted() {
1531
+ if (this.finalActive) {
1532
+ this.updateSize();
1533
+ this.observeSize();
1534
+ }
1535
+ },
1536
+ beforeUnmount() {
1537
+ this.vscrollParent.$_events.off("vscroll:update", this.onVscrollUpdate);
1538
+ this.unobserveSize();
1539
+ },
1540
+ methods: {
1541
+ updateSize() {
1542
+ if (this.finalActive) {
1543
+ if (this.$_pendingSizeUpdate !== this.id) {
1544
+ this.$_pendingSizeUpdate = this.id;
1545
+ this.$_forceNextVScrollUpdate = null;
1546
+ this.$_pendingVScrollUpdate = null;
1547
+ this.computeSize(this.id);
1548
+ }
1549
+ } else {
1550
+ this.$_forceNextVScrollUpdate = this.id;
1551
+ }
1552
+ },
1553
+ updateWatchData() {
1554
+ if (this.watchData && !this.vscrollResizeObserver) {
1555
+ this.$_watchData = this.$watch("item", () => {
1556
+ this.onDataUpdate();
1557
+ }, {
1558
+ deep: true
1559
+ });
1560
+ } else if (this.$_watchData) {
1561
+ this.$_watchData();
1562
+ this.$_watchData = null;
1563
+ }
1564
+ },
1565
+ onVscrollUpdate({ force }) {
1566
+ if (!this.finalActive && force) {
1567
+ this.$_pendingVScrollUpdate = this.id;
1568
+ }
1569
+ if (this.$_forceNextVScrollUpdate === this.id || force || !this.size) {
1570
+ this.updateSize();
1571
+ }
1572
+ },
1573
+ onDataUpdate() {
1574
+ this.updateSize();
1575
+ },
1576
+ computeSize(id) {
1577
+ this.$nextTick(() => {
1578
+ if (this.id === id) {
1579
+ const width = this.$el.offsetWidth;
1580
+ const height = this.$el.offsetHeight;
1581
+ this.applyWidthHeight(width, height);
1582
+ }
1583
+ this.$_pendingSizeUpdate = null;
1584
+ });
1585
+ },
1586
+ applyWidthHeight(width, height) {
1587
+ const size = ~~(this.vscrollParent.direction === "vertical" ? height : width);
1588
+ if (size && this.size !== size) {
1589
+ this.applySize(size);
1590
+ }
1591
+ },
1592
+ applySize(size) {
1593
+ if (this.vscrollParent.$_undefinedMap[this.id]) {
1594
+ this.vscrollParent.$_undefinedSizes--;
1595
+ this.vscrollParent.$_undefinedMap[this.id] = void 0;
1596
+ }
1597
+ this.vscrollData.sizes[this.id] = size;
1598
+ if (this.emitResize) this.$emit("resize", this.id);
1599
+ },
1600
+ observeSize() {
1601
+ if (!this.vscrollResizeObserver) return;
1602
+ if (this.$_sizeObserved) return;
1603
+ this.vscrollResizeObserver.observe(this.$el);
1604
+ this.$el.$_vs_id = this.id;
1605
+ this.$el.$_vs_onResize = this.onResize;
1606
+ this.$_sizeObserved = true;
1607
+ },
1608
+ unobserveSize() {
1609
+ if (!this.vscrollResizeObserver) return;
1610
+ if (!this.$_sizeObserved) return;
1611
+ this.vscrollResizeObserver.unobserve(this.$el);
1612
+ this.$el.$_vs_onResize = void 0;
1613
+ this.$_sizeObserved = false;
1614
+ },
1615
+ onResize(id, width, height) {
1616
+ if (this.id === id) {
1617
+ this.applyWidthHeight(width, height);
1618
+ }
1619
+ }
1620
+ },
1621
+ render() {
1622
+ return h(this.tag, this.$slots.default());
1623
+ }
1624
+ };
1625
+ script.__file = "src/components/DynamicScrollerItem.vue";
1626
+ const _hoisted_1 = { class: "run-data-schema full-height" };
1627
+ const _hoisted_2 = {
1628
+ key: 0,
1629
+ class: "no-results"
1630
+ };
1631
+ const _sfc_main = /* @__PURE__ */ defineComponent({
1632
+ __name: "VirtualSchema",
1633
+ props: {
1634
+ nodes: { default: () => [] },
1635
+ node: { default: null },
1636
+ data: { default: () => [] },
1637
+ mappingEnabled: { type: Boolean, default: false },
1638
+ runIndex: { default: 0 },
1639
+ outputIndex: { default: 0 },
1640
+ totalRuns: { default: 1 },
1641
+ paneType: {},
1642
+ connectionType: { default: NodeConnectionType.Main },
1643
+ search: { default: "" }
1644
+ },
1645
+ emits: ["clear:search"],
1646
+ setup(__props, { emit: __emit }) {
1647
+ const props2 = __props;
1648
+ const telemetry = useTelemetry();
1649
+ const i18n = useI18n();
1650
+ const ndvStore = useNDVStore();
1651
+ const nodeTypesStore = useNodeTypesStore();
1652
+ const workflowsStore = useWorkflowsStore();
1653
+ const { getSchemaForExecutionData, filterSchema } = useDataSchema();
1654
+ const { closedNodes, flattenSchema, flattenMultipleSchemas, toggleLeaf, toggleNode } = useFlattenSchema();
1655
+ const { getNodeInputData } = useNodeHelpers();
1656
+ const emit = __emit;
1657
+ const scroller = ref();
1658
+ const toggleNodeAndScrollTop = (id) => {
1659
+ var _a;
1660
+ toggleNode(id);
1661
+ (_a = scroller.value) == null ? void 0 : _a.scrollToItem(0);
1662
+ };
1663
+ watch(
1664
+ () => props2.search,
1665
+ (newSearch) => {
1666
+ if (!newSearch) return;
1667
+ closedNodes.value.clear();
1668
+ }
1669
+ );
1670
+ const getNodeSchema = (fullNode, connectedNode) => {
1671
+ const pinData = workflowsStore.pinDataByNodeName(connectedNode.name);
1672
+ const connectedOutputIndexes = connectedNode.indicies.length > 0 ? connectedNode.indicies : [0];
1673
+ const data = pinData ?? connectedOutputIndexes.map(
1674
+ (outputIndex) => executionDataToJson(
1675
+ getNodeInputData(
1676
+ fullNode,
1677
+ props2.runIndex,
1678
+ outputIndex,
1679
+ props2.paneType,
1680
+ props2.connectionType
1681
+ )
1682
+ )
1683
+ ).flat();
1684
+ return {
1685
+ schema: getSchemaForExecutionData(data),
1686
+ connectedOutputIndexes,
1687
+ itemsCount: data.length
1688
+ };
1689
+ };
1690
+ const nodeSchema = computed(
1691
+ () => filterSchema(getSchemaForExecutionData(props2.data), props2.search)
1692
+ );
1693
+ const nodesSchemas = computed(() => {
1694
+ return props2.nodes.reduce((acc, node) => {
1695
+ const fullNode = workflowsStore.getNodeByName(node.name);
1696
+ if (!fullNode) return acc;
1697
+ const nodeType = nodeTypesStore.getNodeType(fullNode.type, fullNode.typeVersion);
1698
+ if (!nodeType) return acc;
1699
+ const { schema, connectedOutputIndexes, itemsCount } = getNodeSchema(fullNode, node);
1700
+ const filteredSchema = filterSchema(schema, props2.search);
1701
+ if (!filteredSchema) return acc;
1702
+ acc.push({
1703
+ node: fullNode,
1704
+ connectedOutputIndexes,
1705
+ depth: node.depth,
1706
+ itemsCount,
1707
+ nodeType,
1708
+ schema: filteredSchema
1709
+ });
1710
+ return acc;
1711
+ }, []);
1712
+ });
1713
+ const nodeAdditionalInfo = (node) => {
1714
+ const returnData = [];
1715
+ if (node.disabled) {
1716
+ returnData.push(i18n.baseText("node.disabled"));
1717
+ }
1718
+ const connections = ndvStore.ndvNodeInputNumber[node.name];
1719
+ if (connections) {
1720
+ if (connections.length === 1) {
1721
+ returnData.push(`Input ${connections}`);
1722
+ } else {
1723
+ returnData.push(`Inputs ${connections.join(", ")}`);
1724
+ }
1725
+ }
1726
+ return returnData.length ? `(${returnData.join(" | ")})` : "";
1727
+ };
1728
+ const flattenedNodes = computed(
1729
+ () => flattenMultipleSchemas(nodesSchemas.value, nodeAdditionalInfo)
1730
+ );
1731
+ const flattenNodeSchema = computed(
1732
+ () => nodeSchema.value ? flattenSchema({ schema: nodeSchema.value, depth: 0, level: -1 }) : []
1733
+ );
1734
+ const isDebugging = computed(() => !props2.nodes.length);
1735
+ const items = computed(() => {
1736
+ if (isDebugging.value || props2.paneType === "output") {
1737
+ return flattenNodeSchema.value;
1738
+ }
1739
+ return flattenedNodes.value;
1740
+ });
1741
+ const noSearchResults = computed(() => {
1742
+ return Boolean(props2.search.trim()) && !Boolean(items.value.length);
1743
+ });
1744
+ const onDragStart = () => {
1745
+ ndvStore.resetMappingTelemetry();
1746
+ };
1747
+ const onDragEnd = (el) => {
1748
+ setTimeout(() => {
1749
+ const mappingTelemetry = ndvStore.mappingTelemetry;
1750
+ const telemetryPayload = {
1751
+ src_node_type: el.dataset.nodeType,
1752
+ src_field_name: el.dataset.name ?? "",
1753
+ src_nodes_back: el.dataset.depth,
1754
+ src_run_index: props2.runIndex,
1755
+ src_runs_total: props2.totalRuns,
1756
+ src_field_nest_level: el.dataset.level ?? 0,
1757
+ src_view: "schema",
1758
+ src_element: el,
1759
+ success: false,
1760
+ ...mappingTelemetry
1761
+ };
1762
+ void useExternalHooks().run("runDataJson.onDragEnd", telemetryPayload);
1763
+ telemetry.track("User dragged data for mapping", telemetryPayload, { withPostHog: true });
1764
+ }, 250);
1765
+ };
1766
+ return (_ctx, _cache) => {
1767
+ const _component_i18n_t = resolveComponent("i18n-t");
1768
+ return openBlock(), createElementBlock("div", _hoisted_1, [
1769
+ noSearchResults.value ? (openBlock(), createElementBlock("div", _hoisted_2, [
1770
+ createVNode(unref(N8nText), {
1771
+ tag: "h3",
1772
+ size: "large"
1773
+ }, {
1774
+ default: withCtx(() => [
1775
+ createTextVNode(toDisplayString(unref(i18n).baseText("ndv.search.noNodeMatch.title")), 1)
1776
+ ]),
1777
+ _: 1
1778
+ }),
1779
+ createVNode(unref(N8nText), null, {
1780
+ default: withCtx(() => [
1781
+ createVNode(_component_i18n_t, {
1782
+ keypath: "ndv.search.noMatch.description",
1783
+ tag: "span"
1784
+ }, {
1785
+ link: withCtx(() => [
1786
+ createBaseVNode("a", {
1787
+ href: "#",
1788
+ onClick: _cache[0] || (_cache[0] = ($event) => emit("clear:search"))
1789
+ }, toDisplayString(unref(i18n).baseText("ndv.search.noMatch.description.link")), 1)
1790
+ ]),
1791
+ _: 1
1792
+ })
1793
+ ]),
1794
+ _: 1
1795
+ }),
1796
+ _ctx.paneType === "output" ? (openBlock(), createBlock(unref(N8nText), { key: 0 }, {
1797
+ default: withCtx(() => [
1798
+ createTextVNode(toDisplayString(unref(i18n).baseText("ndv.search.noMatchSchema.description")), 1)
1799
+ ]),
1800
+ _: 1
1801
+ })) : createCommentVNode("", true)
1802
+ ])) : createCommentVNode("", true),
1803
+ items.value.length ? (openBlock(), createBlock(Draggable, {
1804
+ key: 1,
1805
+ class: "full-height",
1806
+ type: "mapping",
1807
+ "target-data-key": "mappable",
1808
+ disabled: !_ctx.mappingEnabled,
1809
+ onDragstart: onDragStart,
1810
+ onDragend: onDragEnd
1811
+ }, {
1812
+ preview: withCtx(({ canDrop, el }) => [
1813
+ el ? (openBlock(), createBlock(MappingPill, {
1814
+ key: 0,
1815
+ html: el.outerHTML,
1816
+ "can-drop": canDrop
1817
+ }, null, 8, ["html", "can-drop"])) : createCommentVNode("", true)
1818
+ ]),
1819
+ default: withCtx(() => [
1820
+ createVNode(unref(script$1), {
1821
+ ref_key: "scroller",
1822
+ ref: scroller,
1823
+ items: items.value,
1824
+ "min-item-size": 38,
1825
+ class: "full-height scroller"
1826
+ }, {
1827
+ default: withCtx(({ item, index, active }) => [
1828
+ item.type === "header" ? (openBlock(), createBlock(VirtualSchemaHeader, mergeProps({ key: 0 }, item, {
1829
+ collapsed: unref(closedNodes).has(item.id),
1830
+ "onClick:toggle": ($event) => unref(toggleLeaf)(item.id),
1831
+ onClick: ($event) => toggleNodeAndScrollTop(item.id)
1832
+ }), null, 16, ["collapsed", "onClick:toggle", "onClick"])) : (openBlock(), createBlock(unref(script), {
1833
+ key: 1,
1834
+ item,
1835
+ active,
1836
+ "size-dependencies": [item.value],
1837
+ "data-index": index
1838
+ }, {
1839
+ default: withCtx(() => [
1840
+ createVNode(VirtualSchemaItem, mergeProps(item, {
1841
+ search: _ctx.search,
1842
+ draggable: _ctx.mappingEnabled,
1843
+ collapsed: unref(closedNodes).has(item.id),
1844
+ highlight: unref(ndvStore).highlightDraggables,
1845
+ onClick: ($event) => unref(toggleLeaf)(item.id)
1846
+ }), null, 16, ["search", "draggable", "collapsed", "highlight", "onClick"])
1847
+ ]),
1848
+ _: 2
1849
+ }, 1032, ["item", "active", "size-dependencies", "data-index"]))
1850
+ ]),
1851
+ _: 1
1852
+ }, 8, ["items"])
1853
+ ]),
1854
+ _: 1
1855
+ }, 8, ["disabled"])) : createCommentVNode("", true)
1856
+ ]);
1857
+ };
1858
+ }
1859
+ });
1860
+ const VirtualSchema = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-b6673c4a"]]);
1861
+ export {
1862
+ VirtualSchema as default
1863
+ };