@nextcloud/vue 8.6.2 → 8.7.1

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 (137) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/Components/NcActionButton.cjs +6 -6
  3. package/dist/Components/NcActionButton.cjs.map +1 -1
  4. package/dist/Components/NcActionButton.mjs +3 -3
  5. package/dist/Components/NcActionButton.mjs.map +1 -1
  6. package/dist/Components/NcActionInput.cjs +1 -1
  7. package/dist/Components/NcActionInput.mjs +1 -1
  8. package/dist/Components/NcBreadcrumb.cjs +1 -1
  9. package/dist/Components/NcBreadcrumb.mjs +1 -1
  10. package/dist/Components/NcBreadcrumbs.cjs +1 -1
  11. package/dist/Components/NcBreadcrumbs.mjs +1 -1
  12. package/dist/Components/NcDashboardWidget.cjs +1 -1
  13. package/dist/Components/NcDashboardWidget.mjs +1 -1
  14. package/dist/Components/NcDashboardWidgetItem.cjs +1 -1
  15. package/dist/Components/NcDashboardWidgetItem.mjs +1 -1
  16. package/dist/Components/NcDateTimePicker.cjs +3 -3
  17. package/dist/Components/NcDateTimePicker.cjs.map +1 -1
  18. package/dist/Components/NcDateTimePicker.mjs +8 -8
  19. package/dist/Components/NcDateTimePicker.mjs.map +1 -1
  20. package/dist/Components/NcDateTimePickerNative.cjs +1 -1
  21. package/dist/Components/NcDateTimePickerNative.mjs +1 -1
  22. package/dist/Components/NcListItem.cjs +1 -1
  23. package/dist/Components/NcListItem.mjs +1 -1
  24. package/dist/Components/NcModal.cjs +7 -7
  25. package/dist/Components/NcModal.cjs.map +1 -1
  26. package/dist/Components/NcModal.mjs +6 -6
  27. package/dist/Components/NcModal.mjs.map +1 -1
  28. package/dist/Components/NcRichContenteditable.cjs +1 -1
  29. package/dist/Components/NcRichContenteditable.mjs +1 -1
  30. package/dist/Components/NcRichText.cjs +11 -11
  31. package/dist/Components/NcRichText.cjs.map +1 -1
  32. package/dist/Components/NcRichText.mjs +22 -21
  33. package/dist/Components/NcRichText.mjs.map +1 -1
  34. package/dist/Components/NcSelect.cjs +1 -1
  35. package/dist/Components/NcSelect.mjs +1 -1
  36. package/dist/Components/NcSelectTags.cjs +1 -1
  37. package/dist/Components/NcSelectTags.mjs +1 -1
  38. package/dist/Components/NcSettingsSelectGroup.cjs +1 -1
  39. package/dist/Components/NcSettingsSelectGroup.mjs +1 -1
  40. package/dist/Components/NcTimezonePicker.cjs +1 -1
  41. package/dist/Components/NcTimezonePicker.mjs +1 -1
  42. package/dist/Functions/reference.cjs +16 -0
  43. package/dist/Functions/reference.cjs.map +1 -0
  44. package/dist/Functions/reference.mjs +17 -0
  45. package/dist/Functions/reference.mjs.map +1 -0
  46. package/dist/Functions/registerReference.cjs +71 -0
  47. package/dist/Functions/registerReference.cjs.map +1 -0
  48. package/dist/Functions/registerReference.mjs +71 -0
  49. package/dist/Functions/registerReference.mjs.map +1 -0
  50. package/dist/assets/{NcActionButton-1Z9lN7ar.css → NcActionButton-rOZFVQA8.css} +17 -17
  51. package/dist/assets/{NcBreadcrumb-M3hqCbqS.css → NcBreadcrumb-HspaFygg.css} +16 -16
  52. package/dist/assets/{NcDashboardWidgetItem-S7fELANA.css → NcDashboardWidgetItem-OL--xR_P.css} +15 -13
  53. package/dist/assets/{NcDateTimePicker-rixdCL1X.css → NcDateTimePicker-TArRbMs-.css} +17 -17
  54. package/dist/assets/{NcListItem-5XAhBDJv.css → NcListItem-L8LeGwpe.css} +43 -43
  55. package/dist/assets/{NcModal-UZh031V1.css → NcModal-sIK5sUoC.css} +63 -63
  56. package/dist/assets/{NcRichContenteditable-WQVknpPy.css → NcRichContenteditable-CuR1YKTU.css} +34 -32
  57. package/dist/assets/NcRichText-Pw6kTpnR.css +215 -0
  58. package/dist/assets/referencePickerModal-A0PlFUEI.css +316 -0
  59. package/dist/chunks/{NcActionInput-BN9rIyI8.mjs → NcActionInput-XHMzOL_h.mjs} +1 -1
  60. package/dist/chunks/{NcActionInput-BN9rIyI8.mjs.map → NcActionInput-XHMzOL_h.mjs.map} +1 -1
  61. package/dist/chunks/{NcActionInput-qeRQBGlt.cjs → NcActionInput-f1Oq2O71.cjs} +1 -1
  62. package/dist/chunks/{NcActionInput-qeRQBGlt.cjs.map → NcActionInput-f1Oq2O71.cjs.map} +1 -1
  63. package/dist/chunks/{NcBreadcrumb-EGgIr-sA.cjs → NcBreadcrumb-DEWk7wO9.cjs} +27 -20
  64. package/dist/chunks/NcBreadcrumb-DEWk7wO9.cjs.map +1 -0
  65. package/dist/chunks/{NcBreadcrumb-on01ofev.mjs → NcBreadcrumb-w1UX2NR-.mjs} +13 -6
  66. package/dist/chunks/NcBreadcrumb-w1UX2NR-.mjs.map +1 -0
  67. package/dist/chunks/{NcBreadcrumbs-hQmUGh48.cjs → NcBreadcrumbs-VuaG3ex5.cjs} +1 -1
  68. package/dist/chunks/{NcBreadcrumbs-hQmUGh48.cjs.map → NcBreadcrumbs-VuaG3ex5.cjs.map} +1 -1
  69. package/dist/chunks/{NcBreadcrumbs-2l-mWYHl.mjs → NcBreadcrumbs-tRR9CjKD.mjs} +1 -1
  70. package/dist/chunks/{NcBreadcrumbs-2l-mWYHl.mjs.map → NcBreadcrumbs-tRR9CjKD.mjs.map} +1 -1
  71. package/dist/chunks/{NcDashboardWidget-ogqyHahY.mjs → NcDashboardWidget-9LDutUO0.mjs} +1 -1
  72. package/dist/chunks/{NcDashboardWidget-ogqyHahY.mjs.map → NcDashboardWidget-9LDutUO0.mjs.map} +1 -1
  73. package/dist/chunks/{NcDashboardWidget-QciRRvL4.cjs → NcDashboardWidget-oPZKAkd-.cjs} +1 -1
  74. package/dist/chunks/{NcDashboardWidget-QciRRvL4.cjs.map → NcDashboardWidget-oPZKAkd-.cjs.map} +1 -1
  75. package/dist/chunks/{NcDashboardWidgetItem-mIPkPR7r.cjs → NcDashboardWidgetItem-1r760Ikh.cjs} +3 -3
  76. package/dist/chunks/NcDashboardWidgetItem-1r760Ikh.cjs.map +1 -0
  77. package/dist/chunks/{NcDashboardWidgetItem-wuUHTeLl.mjs → NcDashboardWidgetItem-Qd8gSF2h.mjs} +5 -5
  78. package/dist/chunks/NcDashboardWidgetItem-Qd8gSF2h.mjs.map +1 -0
  79. package/dist/chunks/{NcListItem-RDF4Yv0n.cjs → NcListItem--_PCqetA.cjs} +2 -2
  80. package/dist/chunks/{NcListItem-_PBHug1k.mjs.map → NcListItem--_PCqetA.cjs.map} +1 -1
  81. package/dist/chunks/{NcListItem-_PBHug1k.mjs → NcListItem-AMcc69jK.mjs} +2 -2
  82. package/dist/chunks/{NcListItem-RDF4Yv0n.cjs.map → NcListItem-AMcc69jK.mjs.map} +1 -1
  83. package/dist/chunks/{NcRichContenteditable-xcoJkj3I.cjs → NcRichContenteditable-cUZMZlgG.cjs} +77 -54
  84. package/dist/chunks/NcRichContenteditable-cUZMZlgG.cjs.map +1 -0
  85. package/dist/chunks/{NcRichContenteditable-glkLWE43.mjs → NcRichContenteditable-d4EOAT2a.mjs} +86 -64
  86. package/dist/chunks/NcRichContenteditable-d4EOAT2a.mjs.map +1 -0
  87. package/dist/chunks/NcRichText-S34HoIhH.cjs +313 -0
  88. package/dist/chunks/NcRichText-S34HoIhH.cjs.map +1 -0
  89. package/dist/chunks/NcRichText-yfYdNWFh.mjs +328 -0
  90. package/dist/chunks/NcRichText-yfYdNWFh.mjs.map +1 -0
  91. package/dist/chunks/{NcSelect-SlL-Y8Qz.cjs → NcSelect-U9LJcdIo.cjs} +54 -44
  92. package/dist/chunks/NcSelect-U9LJcdIo.cjs.map +1 -0
  93. package/dist/chunks/{NcSelect-2ClmJ8jJ.mjs → NcSelect-b2H-YQsK.mjs} +39 -29
  94. package/dist/chunks/NcSelect-b2H-YQsK.mjs.map +1 -0
  95. package/dist/chunks/{NcSelectTags-TC2UmbfI.mjs → NcSelectTags-MlILya2b.mjs} +1 -1
  96. package/dist/chunks/{NcSelectTags-TC2UmbfI.mjs.map → NcSelectTags-MlILya2b.mjs.map} +1 -1
  97. package/dist/chunks/{NcSelectTags-FKigJPco.cjs → NcSelectTags-rO88Pk-1.cjs} +1 -1
  98. package/dist/chunks/{NcSelectTags-FKigJPco.cjs.map → NcSelectTags-rO88Pk-1.cjs.map} +1 -1
  99. package/dist/chunks/{NcSettingsSelectGroup-fOU9O4VD.cjs → NcSettingsSelectGroup-rfeDPLCg.cjs} +1 -1
  100. package/dist/chunks/{NcSettingsSelectGroup-fOU9O4VD.cjs.map → NcSettingsSelectGroup-rfeDPLCg.cjs.map} +1 -1
  101. package/dist/chunks/{NcSettingsSelectGroup-Bcai5uHx.mjs → NcSettingsSelectGroup-xhnDBg8a.mjs} +1 -1
  102. package/dist/chunks/{NcSettingsSelectGroup-Bcai5uHx.mjs.map → NcSettingsSelectGroup-xhnDBg8a.mjs.map} +1 -1
  103. package/dist/chunks/{NcTimezonePicker-Dv6pIP9O.cjs → NcTimezonePicker-KG0dvgUv.cjs} +1 -1
  104. package/dist/chunks/{NcTimezonePicker-Dv6pIP9O.cjs.map → NcTimezonePicker-KG0dvgUv.cjs.map} +1 -1
  105. package/dist/chunks/{NcTimezonePicker-DDce-mch.mjs → NcTimezonePicker-jJeiI-Ff.mjs} +1 -1
  106. package/dist/chunks/{NcTimezonePicker-DDce-mch.mjs.map → NcTimezonePicker-jJeiI-Ff.mjs.map} +1 -1
  107. package/dist/chunks/{ScopeComponent-hYwaRplQ.mjs → ScopeComponent-ZQvTL_tO.mjs} +1 -1
  108. package/dist/chunks/{ScopeComponent-hYwaRplQ.mjs.map → ScopeComponent-ZQvTL_tO.mjs.map} +1 -1
  109. package/dist/chunks/{ScopeComponent-qBzpvxit.cjs → ScopeComponent-v4OJPQb8.cjs} +1 -1
  110. package/dist/chunks/{ScopeComponent-qBzpvxit.cjs.map → ScopeComponent-v4OJPQb8.cjs.map} +1 -1
  111. package/dist/chunks/referencePickerModal-cPBjsn4r.cjs +2393 -0
  112. package/dist/chunks/referencePickerModal-cPBjsn4r.cjs.map +1 -0
  113. package/dist/chunks/referencePickerModal-gDBkGfNV.mjs +2414 -0
  114. package/dist/chunks/referencePickerModal-gDBkGfNV.mjs.map +1 -0
  115. package/dist/index.cjs +189 -170
  116. package/dist/index.cjs.map +1 -1
  117. package/dist/index.mjs +178 -159
  118. package/dist/index.mjs.map +1 -1
  119. package/dist/vendor.LICENSE.txt +4 -0
  120. package/package.json +2 -2
  121. package/dist/assets/referencePickerModal-yucfxaTX.css +0 -509
  122. package/dist/chunks/NcBreadcrumb-EGgIr-sA.cjs.map +0 -1
  123. package/dist/chunks/NcBreadcrumb-on01ofev.mjs.map +0 -1
  124. package/dist/chunks/NcDashboardWidgetItem-mIPkPR7r.cjs.map +0 -1
  125. package/dist/chunks/NcDashboardWidgetItem-wuUHTeLl.mjs.map +0 -1
  126. package/dist/chunks/NcRichContenteditable-glkLWE43.mjs.map +0 -1
  127. package/dist/chunks/NcRichContenteditable-xcoJkj3I.cjs.map +0 -1
  128. package/dist/chunks/NcRichText-TdyEC_z7.cjs +0 -337
  129. package/dist/chunks/NcRichText-TdyEC_z7.cjs.map +0 -1
  130. package/dist/chunks/NcRichText-lyvuLvpr.mjs +0 -353
  131. package/dist/chunks/NcRichText-lyvuLvpr.mjs.map +0 -1
  132. package/dist/chunks/NcSelect-2ClmJ8jJ.mjs.map +0 -1
  133. package/dist/chunks/NcSelect-SlL-Y8Qz.cjs.map +0 -1
  134. package/dist/chunks/referencePickerModal-cy4_Q5bu.cjs +0 -880
  135. package/dist/chunks/referencePickerModal-cy4_Q5bu.cjs.map +0 -1
  136. package/dist/chunks/referencePickerModal-wDsYQHxX.mjs +0 -897
  137. package/dist/chunks/referencePickerModal-wDsYQHxX.mjs.map +0 -1
@@ -1,897 +0,0 @@
1
- import '../assets/referencePickerModal-yucfxaTX.css';
2
- import { n as o } from "./_plugin-vue2_normalizer-u6G_3nkj.mjs";
3
- import { r as h, O as E, a as n, P as N, Q as C, R as I, u as O, S as B, G as M, T as V } from "./_l10n-FmsZpnE4.mjs";
4
- import f from "@nextcloud/axios";
5
- import { loadState as P } from "@nextcloud/initial-state";
6
- import { imagePath as W, generateOcsUrl as p } from "@nextcloud/router";
7
- import _ from "../Components/NcEmptyContent.mjs";
8
- import { N as w } from "./index-2phCrsSH.mjs";
9
- import { N as b } from "./NcSelect-2ClmJ8jJ.mjs";
10
- import q from "../Components/NcLoadingIcon.mjs";
11
- import { N as T } from "./NcTextField-NnW31cA4.mjs";
12
- import { D as j } from "./DotsHorizontal-IbmXTXRA.mjs";
13
- import z from "../Components/NcButton.mjs";
14
- import D from "../Components/NcModal.mjs";
15
- import { emit as A } from "@nextcloud/event-bus";
16
- import { A as F } from "./ArrowLeft-uW5eNVkY.mjs";
17
- import { C as Q } from "./Close-QtH6_3PP.mjs";
18
- import U from "vue";
19
- window._vue_richtext_widgets || (window._vue_richtext_widgets = {});
20
- const G = (t) => !!window._vue_richtext_widgets[t], H = (t, e, r = (s) => {
21
- }) => {
22
- if (window._vue_richtext_widgets[t]) {
23
- console.error("Widget for id " + t + " already registered");
24
- return;
25
- }
26
- window._vue_richtext_widgets[t] = {
27
- id: t,
28
- callback: e,
29
- onDestroy: r
30
- };
31
- }, Z = (t, { richObjectType: e, richObject: r, accessible: s, interactive: i }) => {
32
- if (e !== "open-graph") {
33
- if (!window._vue_richtext_widgets[e]) {
34
- console.error("Widget for rich object type " + e + " not registered");
35
- return;
36
- }
37
- window._vue_richtext_widgets[e].callback(t, { richObjectType: e, richObject: r, accessible: s, interactive: i });
38
- }
39
- }, J = (t, e) => {
40
- t !== "open-graph" && window._vue_richtext_widgets[t] && window._vue_richtext_widgets[t].onDestroy(e);
41
- };
42
- window._registerWidget = H;
43
- const K = {
44
- name: "NcReferenceWidget",
45
- props: {
46
- reference: {
47
- type: Object,
48
- required: !0
49
- }
50
- },
51
- data() {
52
- return {
53
- compact: 3
54
- };
55
- },
56
- computed: {
57
- hasCustomWidget() {
58
- return G(this.reference.richObjectType);
59
- },
60
- noAccess() {
61
- return this.reference && !this.reference.accessible;
62
- },
63
- descriptionStyle() {
64
- if (this.compact === 0)
65
- return {
66
- display: "none"
67
- };
68
- const t = this.compact < 4 ? this.compact : 3;
69
- return {
70
- lineClamp: t,
71
- webkitLineClamp: t
72
- };
73
- },
74
- compactLink() {
75
- const t = this.reference.openGraphObject.link;
76
- return t ? t.startsWith("https://") ? t.substring(8) : t.startsWith("http://") ? t.substring(7) : t : "";
77
- }
78
- },
79
- mounted() {
80
- this.renderWidget(), this.observer = new ResizeObserver((t) => {
81
- t[0].contentRect.width < 450 ? this.compact = 0 : t[0].contentRect.width < 550 ? this.compact = 1 : t[0].contentRect.width < 650 ? this.compact = 2 : this.compact = 3;
82
- }), this.observer.observe(this.$el);
83
- },
84
- beforeDestroy() {
85
- this.observer.disconnect(), J(this.reference.richObjectType, this.$el);
86
- },
87
- methods: {
88
- renderWidget() {
89
- this.$refs.customWidget && (this.$refs.customWidget.innerHTML = ""), this?.reference?.richObjectType !== "open-graph" && this.$nextTick(() => {
90
- Z(this.$refs.customWidget, this.reference);
91
- });
92
- }
93
- }
94
- };
95
- var X = function() {
96
- var e = this, r = e._self._c;
97
- return r("div", [e.reference && e.hasCustomWidget ? r("div", { staticClass: "widget-custom" }, [r("div", { ref: "customWidget" })]) : !e.noAccess && e.reference && e.reference.openGraphObject && !e.hasCustomWidget ? r("a", { staticClass: "widget-default", attrs: { href: e.reference.openGraphObject.link, rel: "noopener noreferrer", target: "_blank" } }, [e.reference.openGraphObject.thumb ? r("img", { staticClass: "widget-default--image", attrs: { src: e.reference.openGraphObject.thumb } }) : e._e(), r("div", { staticClass: "widget-default--details" }, [r("p", { staticClass: "widget-default--name" }, [e._v(e._s(e.reference.openGraphObject.name))]), r("p", { staticClass: "widget-default--description", style: e.descriptionStyle }, [e._v(e._s(e.reference.openGraphObject.description))]), r("p", { staticClass: "widget-default--link" }, [e._v(e._s(e.compactLink))])])]) : e._e()]);
98
- }, Y = [], ee = /* @__PURE__ */ o(
99
- K,
100
- X,
101
- Y,
102
- !1,
103
- null,
104
- "b1c5a80f",
105
- null,
106
- null
107
- );
108
- const te = ee.exports;
109
- window._vue_richtext_custom_picker_elements || (window._vue_richtext_custom_picker_elements = {});
110
- class ht {
111
- /**
112
- * @param {HTMLElement} element The HTML element
113
- * @param {object} object The object
114
- */
115
- constructor(e, r) {
116
- this.element = e, this.object = r;
117
- }
118
- }
119
- const d = (t) => !!window._vue_richtext_custom_picker_elements[t], re = (t) => {
120
- const e = window._vue_richtext_custom_picker_elements[t]?.size;
121
- return ["small", "normal", "large", "full"].includes(e) ? e : null;
122
- }, se = (t, e, r = (i) => {
123
- }, s = "large") => {
124
- if (window._vue_richtext_custom_picker_elements[t]) {
125
- console.error("Custom reference picker element for id " + t + " already registered");
126
- return;
127
- }
128
- window._vue_richtext_custom_picker_elements[t] = {
129
- id: t,
130
- callback: e,
131
- onDestroy: r,
132
- size: s
133
- };
134
- }, ie = (t, { providerId: e, accessible: r }) => {
135
- if (!window._vue_richtext_custom_picker_elements[e]) {
136
- console.error("Custom reference picker element for reference provider ID " + e + " not registered");
137
- return;
138
- }
139
- return window._vue_richtext_custom_picker_elements[e].callback(t, { providerId: e, accessible: r });
140
- }, ne = (t, e, r) => {
141
- window._vue_richtext_custom_picker_elements[t] && window._vue_richtext_custom_picker_elements[t].onDestroy(e, r);
142
- };
143
- window._registerCustomPickerElement = se;
144
- const oe = {
145
- name: "NcCustomPickerElement",
146
- props: {
147
- /**
148
- * The reference provider
149
- */
150
- provider: {
151
- type: Object,
152
- required: !0
153
- }
154
- },
155
- emits: [
156
- "cancel",
157
- "submit"
158
- ],
159
- data() {
160
- return {
161
- isRegistered: d(this.provider.id),
162
- renderResult: null
163
- };
164
- },
165
- mounted() {
166
- this.isRegistered && this.renderElement();
167
- },
168
- beforeDestroy() {
169
- this.isRegistered && ne(this.provider.id, this.$el, this.renderResult);
170
- },
171
- methods: {
172
- renderElement() {
173
- this.$refs.domElement && (this.$refs.domElement.innerHTML = "");
174
- const t = ie(this.$refs.domElement, { providerId: this.provider.id, accessible: !1 });
175
- Promise.resolve(t).then((e) => {
176
- this.renderResult = e, this.renderResult.object?._isVue && this.renderResult.object?.$on && (this.renderResult.object.$on("submit", this.onSubmit), this.renderResult.object.$on("cancel", this.onCancel)), this.renderResult.element.addEventListener("submit", (r) => {
177
- this.onSubmit(r.detail);
178
- }), this.renderResult.element.addEventListener("cancel", this.onCancel);
179
- });
180
- },
181
- onSubmit(t) {
182
- this.$emit("submit", t);
183
- },
184
- onCancel() {
185
- this.$emit("cancel");
186
- }
187
- }
188
- };
189
- var ce = function() {
190
- var e = this, r = e._self._c;
191
- return r("div", { ref: "domElement" });
192
- }, le = [], ae = /* @__PURE__ */ o(
193
- oe,
194
- ce,
195
- le,
196
- !1,
197
- null,
198
- "cf695ff9",
199
- null,
200
- null
201
- );
202
- const ue = ae.exports;
203
- h(E);
204
- const S = "any-link", $ = {
205
- id: S,
206
- title: n("Any link"),
207
- icon_url: W("core", "filetypes/link.svg")
208
- };
209
- window._vue_richtext_reference_providers || (window._vue_richtext_reference_providers = P("core", "reference-provider-list", []));
210
- window._vue_richtext_reference_provider_timestamps || (window._vue_richtext_reference_provider_timestamps = P("core", "reference-provider-timestamps", {}));
211
- function de(t) {
212
- return t === S ? $ : R().find((e) => e.id === t);
213
- }
214
- function R() {
215
- return window._vue_richtext_reference_providers.filter((t) => {
216
- const e = !!t.search_providers_ids && t.search_providers_ids.length > 0 || d(t.id);
217
- return e || console.debug("[smart picker]", t.id, "reference provider is discoverable but does not have any related search provider or custom picker component registered"), e;
218
- });
219
- }
220
- function he(t) {
221
- const e = window._vue_richtext_reference_provider_timestamps;
222
- return t.sort((r, s) => r.order === s.order ? 0 : r.order > s.order ? 1 : -1).sort((r, s) => {
223
- const i = e[r.id], c = e[s.id];
224
- return i === c ? 0 : c === void 0 ? -1 : i === void 0 ? 1 : i > c ? -1 : 1;
225
- });
226
- }
227
- function me(t, e = null) {
228
- const r = R(), s = t.replace(/[/\-\\^$*+?.()|[\]{}]/g, "\\$&"), i = new RegExp(s, "i"), m = he(r).filter((l) => l.title.match(i)), a = e ? m.slice(0, e) : m;
229
- return (t === "" || a.length === 0) && a.push($), a;
230
- }
231
- function pe(t) {
232
- const e = Math.floor(Date.now() / 1e3), r = {
233
- timestamp: e
234
- }, s = p("references/provider/{providerId}", { providerId: t });
235
- f.put(s, r).then((i) => {
236
- window._vue_richtext_reference_provider_timestamps[t] = e;
237
- });
238
- }
239
- let k = 0;
240
- function L(t, e) {
241
- return function() {
242
- const r = this, s = arguments;
243
- clearTimeout(k), k = setTimeout(function() {
244
- t.apply(r, s);
245
- }, e || 0);
246
- };
247
- }
248
- function v(t) {
249
- try {
250
- return !!new URL(t);
251
- } catch {
252
- return !1;
253
- }
254
- }
255
- h(C, N);
256
- const fe = {
257
- name: "LinkVariantIcon",
258
- emits: ["click"],
259
- props: {
260
- title: {
261
- type: String
262
- },
263
- fillColor: {
264
- type: String,
265
- default: "currentColor"
266
- },
267
- size: {
268
- type: Number,
269
- default: 24
270
- }
271
- }
272
- };
273
- var _e = function() {
274
- var e = this, r = e._self._c;
275
- return r("span", e._b({ staticClass: "material-design-icon link-variant-icon", attrs: { "aria-hidden": e.title ? null : !0, "aria-label": e.title, role: "img" }, on: { click: function(s) {
276
- return e.$emit("click", s);
277
- } } }, "span", e.$attrs, !1), [r("svg", { staticClass: "material-design-icon__svg", attrs: { fill: e.fillColor, width: e.size, height: e.size, viewBox: "0 0 24 24" } }, [r("path", { attrs: { d: "M10.59,13.41C11,13.8 11,14.44 10.59,14.83C10.2,15.22 9.56,15.22 9.17,14.83C7.22,12.88 7.22,9.71 9.17,7.76V7.76L12.71,4.22C14.66,2.27 17.83,2.27 19.78,4.22C21.73,6.17 21.73,9.34 19.78,11.29L18.29,12.78C18.3,11.96 18.17,11.14 17.89,10.36L18.36,9.88C19.54,8.71 19.54,6.81 18.36,5.64C17.19,4.46 15.29,4.46 14.12,5.64L10.59,9.17C9.41,10.34 9.41,12.24 10.59,13.41M13.41,9.17C13.8,8.78 14.44,8.78 14.83,9.17C16.78,11.12 16.78,14.29 14.83,16.24V16.24L11.29,19.78C9.34,21.73 6.17,21.73 4.22,19.78C2.27,17.83 2.27,14.66 4.22,12.71L5.71,11.22C5.7,12.04 5.83,12.86 6.11,13.65L5.64,14.12C4.46,15.29 4.46,17.19 5.64,18.36C6.81,19.54 8.71,19.54 9.88,18.36L13.41,14.83C14.59,13.66 14.59,11.76 13.41,10.59C13,10.2 13,9.56 13.41,9.17Z" } }, [e.title ? r("title", [e._v(e._s(e.title))]) : e._e()])])]);
278
- }, ve = [], ge = /* @__PURE__ */ o(
279
- fe,
280
- _e,
281
- ve,
282
- !1,
283
- null,
284
- null,
285
- null,
286
- null
287
- );
288
- const g = ge.exports, ke = {
289
- name: "NcProviderList",
290
- components: {
291
- NcSelect: b,
292
- NcHighlight: w,
293
- NcEmptyContent: _,
294
- LinkVariantIcon: g
295
- },
296
- emits: [
297
- "select-provider",
298
- "submit"
299
- ],
300
- data() {
301
- return {
302
- selectedProvider: null,
303
- query: "",
304
- multiselectPlaceholder: n("Select provider"),
305
- providerIconAlt: n("Provider icon")
306
- };
307
- },
308
- computed: {
309
- options() {
310
- const t = [];
311
- return this.query !== "" && v(this.query) && t.push({
312
- id: this.query,
313
- title: this.query,
314
- isLink: !0
315
- }), t.push(...me(this.query)), t;
316
- }
317
- },
318
- methods: {
319
- focus() {
320
- setTimeout(() => {
321
- this.$refs["provider-select"]?.$el?.querySelector("#provider-select-input")?.focus();
322
- }, 300);
323
- },
324
- onProviderSelected(t) {
325
- t !== null && (t.isLink ? this.$emit("submit", t.title) : this.$emit("select-provider", t), this.selectedProvider = null);
326
- },
327
- onSearch(t, e) {
328
- this.query = t;
329
- }
330
- }
331
- };
332
- var ye = function() {
333
- var e = this, r = e._self._c;
334
- return r("div", { staticClass: "provider-list" }, [r("NcSelect", { ref: "provider-select", staticClass: "provider-list--select", attrs: { "input-id": "provider-select-input", label: "title", placeholder: e.multiselectPlaceholder, options: e.options, "append-to-body": !1, "clear-search-on-select": !0, "clear-search-on-blur": () => !1, filterable: !1 }, on: { search: e.onSearch, input: e.onProviderSelected }, scopedSlots: e._u([{ key: "option", fn: function(s) {
335
- return [s.isLink ? r("div", { staticClass: "provider" }, [r("LinkVariantIcon", { staticClass: "link-icon", attrs: { size: 20 } }), r("span", [e._v(e._s(s.title))])], 1) : r("div", { staticClass: "provider" }, [r("img", { staticClass: "provider-icon", attrs: { src: s.icon_url, alt: e.providerIconAlt } }), r("NcHighlight", { staticClass: "option-text", attrs: { search: e.query, text: s.title } })], 1)];
336
- } }]), model: { value: e.selectedProvider, callback: function(s) {
337
- e.selectedProvider = s;
338
- }, expression: "selectedProvider" } }), r("NcEmptyContent", { staticClass: "provider-list--empty-content", scopedSlots: e._u([{ key: "icon", fn: function() {
339
- return [r("LinkVariantIcon")];
340
- }, proxy: !0 }]) })], 1);
341
- }, Ce = [], Pe = /* @__PURE__ */ o(
342
- ke,
343
- ye,
344
- Ce,
345
- !1,
346
- null,
347
- "9d850ea5",
348
- null,
349
- null
350
- );
351
- const we = Pe.exports;
352
- h(I);
353
- const be = {
354
- name: "NcRawLinkInput",
355
- components: {
356
- LinkVariantIcon: g,
357
- NcEmptyContent: _,
358
- NcLoadingIcon: q,
359
- NcReferenceWidget: te,
360
- NcTextField: T
361
- },
362
- props: {
363
- /**
364
- * The reference provider
365
- */
366
- provider: {
367
- type: Object,
368
- required: !0
369
- }
370
- },
371
- emits: [
372
- "submit"
373
- ],
374
- data() {
375
- return {
376
- inputValue: "",
377
- loading: !1,
378
- reference: null,
379
- abortController: null,
380
- inputPlaceholder: n("Enter link")
381
- };
382
- },
383
- computed: {
384
- isLinkValid() {
385
- return v(this.inputValue);
386
- }
387
- },
388
- methods: {
389
- focus() {
390
- this.$refs["url-input"].$el.getElementsByTagName("input")[0]?.focus();
391
- },
392
- onSubmit(t) {
393
- const e = t.target.value;
394
- this.isLinkValid && this.$emit("submit", e);
395
- },
396
- onClear() {
397
- this.inputValue = "", this.reference = null;
398
- },
399
- onInput() {
400
- this.reference = null, this.abortController && this.abortController.abort(), this.isLinkValid && L(() => {
401
- this.updateReference();
402
- }, 500)();
403
- },
404
- updateReference() {
405
- this.loading = !0, this.abortController = new AbortController(), f.get(p("references/resolve", 2) + "?reference=" + encodeURIComponent(this.inputValue), {
406
- signal: this.abortController.signal
407
- }).then((t) => {
408
- this.reference = t.data.ocs.data.references[this.inputValue];
409
- }).catch((t) => {
410
- console.error(t);
411
- }).then(() => {
412
- this.loading = !1;
413
- });
414
- }
415
- }
416
- };
417
- var Se = function() {
418
- var e = this, r = e._self._c;
419
- return r("div", { staticClass: "raw-link" }, [r("div", { staticClass: "input-wrapper" }, [r("NcTextField", { ref: "url-input", attrs: { value: e.inputValue, "show-trailing-button": e.inputValue !== "", label: e.inputPlaceholder }, on: { "update:value": [function(s) {
420
- e.inputValue = s;
421
- }, e.onInput], "trailing-button-click": e.onClear }, nativeOn: { keyup: function(s) {
422
- return !s.type.indexOf("key") && e._k(s.keyCode, "enter", 13, s.key, "Enter") ? null : e.onSubmit.apply(null, arguments);
423
- } } }, [e.loading ? r("NcLoadingIcon", { attrs: { size: 16 } }) : r("LinkVariantIcon", { attrs: { size: 16 } })], 1)], 1), e.reference !== null ? r("NcReferenceWidget", { staticClass: "reference-widget", attrs: { reference: e.reference } }) : r("NcEmptyContent", { staticClass: "raw-link--empty-content", scopedSlots: e._u([{ key: "icon", fn: function() {
424
- return [e.provider.icon_url ? r("img", { staticClass: "provider-icon", attrs: { src: e.provider.icon_url } }) : r("LinkVariantIcon")];
425
- }, proxy: !0 }]) })], 1);
426
- }, $e = [], Re = /* @__PURE__ */ o(
427
- be,
428
- Se,
429
- $e,
430
- !1,
431
- null,
432
- "d0ba247a",
433
- null,
434
- null
435
- );
436
- const Le = Re.exports, xe = {
437
- name: "NcSearchResult",
438
- components: {
439
- NcHighlight: w
440
- },
441
- props: {
442
- /**
443
- * Unified search result entry
444
- */
445
- entry: {
446
- type: Object,
447
- required: !0
448
- },
449
- /**
450
- * The query that led to getting this result
451
- * Used to highlight the entry text
452
- */
453
- query: {
454
- type: String,
455
- required: !0
456
- }
457
- }
458
- };
459
- var Ee = function() {
460
- var e = this, r = e._self._c;
461
- return r("div", { staticClass: "result" }, [e.entry.icon ? r("div", { staticClass: "result--icon-class", class: { [e.entry.icon]: !0, rounded: e.entry.rounded } }) : r("img", { staticClass: "result--image", class: { rounded: e.entry.rounded }, attrs: { src: e.entry.thumbnailUrl } }), r("div", { staticClass: "result--content" }, [r("span", { staticClass: "result--content--name" }, [r("NcHighlight", { attrs: { search: e.query, text: e.entry.title } })], 1), r("span", { staticClass: "result--content--subline" }, [r("NcHighlight", { attrs: { search: e.query, text: e.entry.subline } })], 1)])]);
462
- }, Ne = [], Ie = /* @__PURE__ */ o(
463
- xe,
464
- Ee,
465
- Ne,
466
- !1,
467
- null,
468
- "7a394a58",
469
- null,
470
- null
471
- );
472
- const Oe = Ie.exports;
473
- h(B, C, O);
474
- const y = 5, Be = {
475
- name: "NcSearch",
476
- components: {
477
- LinkVariantIcon: g,
478
- DotsHorizontalIcon: j,
479
- NcEmptyContent: _,
480
- NcSelect: b,
481
- NcSearchResult: Oe
482
- },
483
- props: {
484
- /**
485
- * The selected reference provider
486
- */
487
- provider: {
488
- type: Object,
489
- required: !0
490
- },
491
- showEmptyContent: {
492
- type: Boolean,
493
- default: !0
494
- },
495
- searchPlaceholder: {
496
- type: String,
497
- default: null
498
- }
499
- },
500
- emits: [
501
- "submit"
502
- ],
503
- data() {
504
- return {
505
- searchQuery: "",
506
- selectedResult: null,
507
- resultsBySearchProvider: {},
508
- searching: !1,
509
- searchingMoreOf: null,
510
- abortController: null,
511
- noOptionsText: n("Start typing to search"),
512
- providerIconAlt: n("Provider icon")
513
- };
514
- },
515
- computed: {
516
- mySearchPlaceholder() {
517
- return this.searchPlaceholder || n("Search");
518
- },
519
- searchProviderIds() {
520
- return this.provider.search_providers_ids;
521
- },
522
- options() {
523
- if (this.searchQuery === "")
524
- return [];
525
- const t = [];
526
- return v(this.searchQuery) && t.push(this.rawLinkEntry), t.push(...this.formattedSearchResults), t;
527
- },
528
- rawLinkEntry() {
529
- return {
530
- id: "rawLinkEntry",
531
- resourceUrl: this.searchQuery,
532
- isRawLink: !0
533
- };
534
- },
535
- formattedSearchResults() {
536
- const t = [];
537
- return this.searchProviderIds.forEach((e) => {
538
- if (this.resultsBySearchProvider[e].entries.length > 0) {
539
- (this.searchProviderIds.length > 1 || this.resultsBySearchProvider[e].entries.length > 1) && t.push({
540
- id: "groupTitle-" + e,
541
- name: this.resultsBySearchProvider[e].name,
542
- isCustomGroupTitle: !0,
543
- providerId: e
544
- });
545
- const r = this.resultsBySearchProvider[e].entries.map((s, i) => ({
546
- id: "provider-" + e + "-entry-" + i,
547
- ...s
548
- }));
549
- t.push(...r), this.resultsBySearchProvider[e].isPaginated && t.push({
550
- id: "moreOf-" + e,
551
- name: this.resultsBySearchProvider[e].name,
552
- isMore: !0,
553
- providerId: e,
554
- isLoading: this.searchingMoreOf === e
555
- });
556
- }
557
- }), t;
558
- }
559
- },
560
- mounted() {
561
- this.resetResults();
562
- },
563
- beforeDestroy() {
564
- this.cancelSearchRequests();
565
- },
566
- methods: {
567
- t: n,
568
- resetResults() {
569
- const t = {};
570
- this.searchProviderIds.forEach((e) => {
571
- t[e] = {
572
- entries: []
573
- };
574
- }), this.resultsBySearchProvider = t;
575
- },
576
- focus() {
577
- setTimeout(() => {
578
- this.$refs["search-select"]?.$el?.querySelector("#search-select-input")?.focus();
579
- }, 300);
580
- },
581
- cancelSearchRequests() {
582
- this.abortController && this.abortController.abort();
583
- },
584
- onSearchInput(t, e) {
585
- this.searchQuery = t, L(() => {
586
- this.updateSearch();
587
- }, 500)();
588
- },
589
- onSelectResultSelected(t) {
590
- t !== null && (t.resourceUrl ? (this.cancelSearchRequests(), this.$emit("submit", t.resourceUrl)) : t.isMore && this.searchMoreOf(t.providerId).then(() => {
591
- this.selectedResult = null;
592
- }));
593
- },
594
- searchMoreOf(t) {
595
- return this.searchingMoreOf = t, this.cancelSearchRequests(), this.searchProviders(t);
596
- },
597
- updateSearch() {
598
- if (this.cancelSearchRequests(), this.resetResults(), this.searchQuery === "") {
599
- this.searching = !1;
600
- return;
601
- }
602
- return this.searchProviders();
603
- },
604
- searchProviders(t = null) {
605
- this.abortController = new AbortController(), this.searching = !0;
606
- const e = t === null ? [...this.searchProviderIds].map((r) => this.searchOneProvider(r)) : [this.searchOneProvider(t, this.resultsBySearchProvider[t]?.cursor ?? null)];
607
- return Promise.allSettled(e).then((r) => {
608
- !!r.find((i) => i.status === "rejected" && (i.reason.name === "CanceledError" || i.reason.code === "ERR_CANCELED")) || (this.searching = !1, this.searchingMoreOf = null);
609
- });
610
- },
611
- searchOneProvider(t, e = null) {
612
- const r = e === null ? p("search/providers/{providerId}/search?term={term}&limit={limit}", { providerId: t, term: this.searchQuery, limit: y }) : p("search/providers/{providerId}/search?term={term}&limit={limit}&cursor={cursor}", { providerId: t, term: this.searchQuery, limit: y, cursor: e });
613
- return f.get(r, {
614
- signal: this.abortController.signal
615
- }).then((s) => {
616
- const i = s.data.ocs.data;
617
- this.resultsBySearchProvider[t].name = i.name, this.resultsBySearchProvider[t].cursor = i.cursor, this.resultsBySearchProvider[t].isPaginated = i.isPaginated, this.resultsBySearchProvider[t].entries.push(...i.entries);
618
- });
619
- }
620
- }
621
- };
622
- var Me = function() {
623
- var e = this, r = e._self._c;
624
- return r("div", { staticClass: "smart-picker-search", class: { "with-empty-content": e.showEmptyContent } }, [r("NcSelect", { ref: "search-select", staticClass: "smart-picker-search--select", attrs: { "input-id": "search-select-input", label: "name", placeholder: e.mySearchPlaceholder, options: e.options, "append-to-body": !1, "close-on-select": !1, "clear-search-on-select": !1, "clear-search-on-blur": () => !1, "reset-focus-on-options-change": !1, filterable: !1, autoscroll: !0, "reset-on-options-change": !1, loading: e.searching }, on: { search: e.onSearchInput, input: e.onSelectResultSelected }, scopedSlots: e._u([{ key: "option", fn: function(s) {
625
- return [s.isRawLink ? r("div", { staticClass: "custom-option" }, [r("LinkVariantIcon", { staticClass: "option-simple-icon", attrs: { size: 20 } }), r("span", { staticClass: "option-text" }, [e._v(" " + e._s(e.t("Raw link {options}", { options: s.resourceUrl })) + " ")])], 1) : s.resourceUrl ? r("NcSearchResult", { staticClass: "search-result", attrs: { entry: s, query: e.searchQuery } }) : s.isCustomGroupTitle ? r("span", { staticClass: "custom-option group-name" }, [e.provider.icon_url ? r("img", { staticClass: "provider-icon group-name-icon", attrs: { src: e.provider.icon_url } }) : e._e(), r("span", { staticClass: "option-text" }, [r("strong", [e._v(e._s(s.name))])])]) : s.isMore ? r("span", { class: { "custom-option": !0 } }, [s.isLoading ? r("span", { staticClass: "option-simple-icon icon-loading-small" }) : r("DotsHorizontalIcon", { staticClass: "option-simple-icon", attrs: { size: 20 } }), r("span", { staticClass: "option-text" }, [e._v(" " + e._s(e.t('Load more "{options}"', { options: s.name })) + " ")])], 1) : e._e()];
626
- } }, { key: "no-options", fn: function() {
627
- return [e._v(" " + e._s(e.noOptionsText) + " ")];
628
- }, proxy: !0 }]), model: { value: e.selectedResult, callback: function(s) {
629
- e.selectedResult = s;
630
- }, expression: "selectedResult" } }), e.showEmptyContent ? r("NcEmptyContent", { staticClass: "smart-picker-search--empty-content", scopedSlots: e._u([{ key: "icon", fn: function() {
631
- return [e.provider.icon_url ? r("img", { staticClass: "provider-icon", attrs: { alt: e.providerIconAlt, src: e.provider.icon_url } }) : r("LinkVariantIcon")];
632
- }, proxy: !0 }], null, !1, 2922132592) }) : e._e()], 1);
633
- }, Ve = [], We = /* @__PURE__ */ o(
634
- Be,
635
- Me,
636
- Ve,
637
- !1,
638
- null,
639
- "97d196f0",
640
- null,
641
- null
642
- );
643
- const qe = We.exports, u = {
644
- providerList: 1,
645
- standardLinkInput: 2,
646
- searchInput: 3,
647
- customElement: 4
648
- }, Te = {
649
- name: "NcReferencePicker",
650
- components: {
651
- NcCustomPickerElement: ue,
652
- NcProviderList: we,
653
- NcRawLinkInput: Le,
654
- NcSearch: qe
655
- },
656
- props: {
657
- /**
658
- * Provider to select on creation
659
- * Default: null. Show the provider list
660
- */
661
- initialProvider: {
662
- type: Object,
663
- default: () => null
664
- },
665
- /**
666
- * Optional width in pixels
667
- * Default: 100%
668
- */
669
- width: {
670
- type: Number,
671
- default: null
672
- },
673
- /**
674
- * Focus on the provider list select input on creation
675
- * Default: true
676
- */
677
- focusOnCreate: {
678
- type: Boolean,
679
- default: !0
680
- }
681
- },
682
- emits: [
683
- "cancel",
684
- "cancel-raw-link",
685
- "cancel-search",
686
- "provider-selected",
687
- "submit"
688
- ],
689
- data() {
690
- return {
691
- MODES: u,
692
- selectedProvider: this.initialProvider
693
- };
694
- },
695
- computed: {
696
- mode() {
697
- return this.selectedProvider === null ? u.providerList : d(this.selectedProvider.id) ? u.customElement : this.selectedProvider.search_providers_ids ? u.searchInput : u.standardLinkInput;
698
- },
699
- pickerWrapperStyle() {
700
- return {
701
- width: this.width ? this.width + "px" : void 0
702
- };
703
- }
704
- },
705
- mounted() {
706
- this.focusOnCreate && (this.initialProvider ? setTimeout(() => {
707
- this.$refs["url-input"]?.focus();
708
- }, 300) : this.$nextTick(() => {
709
- this.$refs["provider-list"]?.focus();
710
- }));
711
- },
712
- methods: {
713
- onEscapePressed() {
714
- this.selectedProvider !== null ? this.deselectProvider() : this.cancelProviderSelection();
715
- },
716
- onProviderSelected(t) {
717
- this.selectedProvider = t, this.$emit("provider-selected", t), this.$nextTick(() => {
718
- this.$refs["url-input"]?.focus();
719
- });
720
- },
721
- cancelCustomElement() {
722
- this.deselectProvider();
723
- },
724
- cancelSearch() {
725
- this.$emit("cancel-search", this.selectedProvider?.title), this.deselectProvider();
726
- },
727
- cancelRawLinkInput() {
728
- this.$emit("cancel-raw-link", this.selectedProvider?.title), this.deselectProvider();
729
- },
730
- cancelProviderSelection() {
731
- this.$emit("cancel");
732
- },
733
- submitLink(t) {
734
- this.selectedProvider !== null && pe(this.selectedProvider.id), this.$emit("submit", t), this.deselectProvider();
735
- },
736
- deselectProvider() {
737
- this.selectedProvider = null, this.$emit("provider-selected", null), setTimeout(() => {
738
- this.$refs["provider-list"]?.focus();
739
- }, 300);
740
- }
741
- }
742
- };
743
- var je = function() {
744
- var e = this, r = e._self._c;
745
- return r("div", { staticClass: "reference-picker", style: e.pickerWrapperStyle, attrs: { tabindex: "-1" }, on: { keydown: function(s) {
746
- return !s.type.indexOf("key") && e._k(s.keyCode, "esc", 27, s.key, ["Esc", "Escape"]) ? null : (s.stopPropagation(), s.preventDefault(), e.onEscapePressed.apply(null, arguments));
747
- } } }, [e.mode === e.MODES.providerList ? r("NcProviderList", { ref: "provider-list", on: { "select-provider": e.onProviderSelected, submit: e.submitLink, cancel: e.cancelProviderSelection } }) : e.mode === e.MODES.standardLinkInput ? r("NcRawLinkInput", { ref: "url-input", attrs: { provider: e.selectedProvider }, on: { submit: e.submitLink, cancel: e.cancelRawLinkInput } }) : e.mode === e.MODES.searchInput ? r("NcSearch", { ref: "url-input", attrs: { provider: e.selectedProvider }, on: { cancel: e.cancelSearch, submit: e.submitLink } }) : e.mode === e.MODES.customElement ? r("div", { staticClass: "custom-element-wrapper" }, [r("NcCustomPickerElement", { attrs: { provider: e.selectedProvider }, on: { submit: e.submitLink, cancel: e.cancelCustomElement } })], 1) : e._e()], 1);
748
- }, ze = [], De = /* @__PURE__ */ o(
749
- Te,
750
- je,
751
- ze,
752
- !1,
753
- null,
754
- "aa77d0d3",
755
- null,
756
- null
757
- );
758
- const Ae = De.exports;
759
- h(V, M);
760
- const Fe = {
761
- name: "NcReferencePickerModal",
762
- components: {
763
- NcReferencePicker: Ae,
764
- NcModal: D,
765
- NcButton: z,
766
- ArrowLeftIcon: F,
767
- CloseIcon: Q
768
- },
769
- props: {
770
- /**
771
- * Provider to select on creation
772
- * Show the provider list if no initial one is provided
773
- */
774
- initialProvider: {
775
- type: Object,
776
- default: () => null
777
- },
778
- /**
779
- * Focus on the input item on create
780
- */
781
- focusOnCreate: {
782
- type: Boolean,
783
- default: !0
784
- },
785
- /**
786
- * If true, add the modal content to the Viewer trap elements via the event-bus
787
- */
788
- isInsideViewer: {
789
- type: Boolean,
790
- default: !1
791
- }
792
- },
793
- emits: [
794
- "cancel",
795
- "submit"
796
- ],
797
- data() {
798
- return {
799
- show: !0,
800
- selectedProvider: this.initialProvider,
801
- backButtonTitle: n("Back to provider selection"),
802
- closeButtonTitle: n("Close"),
803
- closeButtonLabel: n("Close Smart Picker")
804
- };
805
- },
806
- computed: {
807
- isProviderSelected() {
808
- return this.selectedProvider !== null;
809
- },
810
- showBackButton() {
811
- return this.initialProvider === null && this.isProviderSelected;
812
- },
813
- modalSize() {
814
- return this.isProviderSelected && d(this.selectedProvider.id) ? re(this.selectedProvider.id) ?? "large" : "normal";
815
- },
816
- showModalName() {
817
- return !this.isProviderSelected || !d(this.selectedProvider.id);
818
- },
819
- modalName() {
820
- return this.isProviderSelected ? this.selectedProvider.title : n("Smart Picker");
821
- }
822
- },
823
- mounted() {
824
- if (this.isInsideViewer) {
825
- const t = this.$refs.modal_content;
826
- A("viewer:trapElements:changed", t);
827
- }
828
- },
829
- methods: {
830
- onCancel() {
831
- this.show = !1, this.$emit("cancel");
832
- },
833
- onSubmit(t) {
834
- this.show = !1, this.$emit("submit", t);
835
- },
836
- onProviderSelect(t) {
837
- this.selectedProvider = t, t === null && this.initialProvider !== null && this.onCancel();
838
- },
839
- onBackClicked() {
840
- this.$refs.referencePicker.deselectProvider();
841
- }
842
- }
843
- };
844
- var Qe = function() {
845
- var e = this, r = e._self._c;
846
- return e.show ? r("NcModal", { staticClass: "reference-picker-modal", attrs: { size: e.modalSize, "can-close": !1 }, on: { close: e.onCancel } }, [r("div", { ref: "modal_content", staticClass: "reference-picker-modal--content" }, [e.showBackButton ? r("NcButton", { staticClass: "back-button", attrs: { "aria-label": e.backButtonTitle, title: e.backButtonTitle }, on: { click: e.onBackClicked }, scopedSlots: e._u([{ key: "icon", fn: function() {
847
- return [r("ArrowLeftIcon")];
848
- }, proxy: !0 }], null, !1, 3001860362) }) : e._e(), r("NcButton", { staticClass: "close-button", attrs: { "aria-label": e.closeButtonLabel, title: e.closeButtonTitle, type: "tertiary" }, on: { click: e.onCancel }, scopedSlots: e._u([{ key: "icon", fn: function() {
849
- return [r("CloseIcon")];
850
- }, proxy: !0 }], null, !1, 2491825086) }), e.showModalName ? r("h2", [e._v(" " + e._s(e.modalName) + " ")]) : e._e(), r("NcReferencePicker", { ref: "referencePicker", attrs: { "initial-provider": e.initialProvider, "focus-on-create": e.focusOnCreate }, on: { "provider-selected": e.onProviderSelect, submit: e.onSubmit, cancel: e.onCancel } })], 1)]) : e._e();
851
- }, Ue = [], Ge = /* @__PURE__ */ o(
852
- Fe,
853
- Qe,
854
- Ue,
855
- !1,
856
- null,
857
- "3f1a4ac7",
858
- null,
859
- null
860
- );
861
- const He = Ge.exports;
862
- async function mt(t = null, e = void 0) {
863
- return await new Promise((r, s) => {
864
- const i = "referencePickerModal", c = document.createElement("div");
865
- c.id = i, document.body.append(c);
866
- const m = t === null ? null : de(t) ?? null, a = U.extend(He), l = new a({
867
- propsData: {
868
- initialProvider: m,
869
- isInsideViewer: e
870
- }
871
- }).$mount(c);
872
- l.$on("cancel", () => {
873
- l.$destroy(), s(new Error("User cancellation"));
874
- }), l.$on("submit", (x) => {
875
- l.$destroy(), r(x);
876
- });
877
- });
878
- }
879
- export {
880
- te as N,
881
- Ae as a,
882
- He as b,
883
- qe as c,
884
- Z as d,
885
- ht as e,
886
- se as f,
887
- ie as g,
888
- d as h,
889
- G as i,
890
- mt as j,
891
- S as k,
892
- de as l,
893
- R as m,
894
- me as n,
895
- H as r,
896
- he as s
897
- };