@cling-se/widget 0.14.4 → 0.14.5

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 (134) hide show
  1. package/.eslintrc.cjs +4 -4
  2. package/README.md +40 -40
  3. package/dist/AddClientCallout-BMc-v9rJ.js +46 -0
  4. package/dist/AnswerModal-Cu0Ke5pl.js +3874 -0
  5. package/dist/AttachmentItem-Co8pVvtv.js +78 -0
  6. package/dist/BaseDatePicker-P5iq-XAp.js +3183 -0
  7. package/dist/BaseUpload-BDWnWTxr.js +1977 -0
  8. package/dist/BlockMedia-B_UiePCr.js +76 -0
  9. package/dist/CCallout-Bbp9ya9n.js +59 -0
  10. package/dist/CCurrencyDropdown-Cw39vJWw.js +246 -0
  11. package/dist/CDropdownItem-BjYnhZJr.js +538 -0
  12. package/dist/CField.vue_vue_type_style_index_0_lang-l0sNRNKZ.js +1 -0
  13. package/dist/CFormField-CeJ58aN2.js +241 -0
  14. package/dist/CPhoneFormat-BZnmeEeW.js +62 -0
  15. package/dist/CPriceInput-B07d19qq.js +112 -0
  16. package/dist/CTabs.vue_vue_type_style_index_0_scoped_e02a6440_lang-l0sNRNKZ.js +1 -0
  17. package/dist/ClientAutocomplete-9iM1pR9l.js +78 -0
  18. package/dist/ClientModal-fw8f6UvL.js +625 -0
  19. package/dist/ColorPicker-uu6vKe8o.js +2879 -0
  20. package/dist/CompanyModal-5t4yhKL4.js +141 -0
  21. package/dist/ContentWrapper-DwcOQ21l.js +183 -0
  22. package/dist/CoverBlockSettings-cCCXzAZ0.js +275 -0
  23. package/dist/DocAnswer-9lbgqHRX.js +36 -0
  24. package/dist/DocDetails-CoLL_tHs.js +246 -0
  25. package/dist/DocForm-DUjcuHJe.js +7273 -0
  26. package/dist/DocFormSend-LawcXcM2.js +143 -0
  27. package/dist/DocLinks-pJT9HpjR.js +38 -0
  28. package/dist/DocModalBase-xUoskL63.js +28 -0
  29. package/dist/DocPrint-ClEJBiAg.js +240 -0
  30. package/dist/DocReceipt-x_YsXPnG.js +210 -0
  31. package/dist/DocSendReminder-Dbz8CkAz.js +137 -0
  32. package/dist/DocTextEditor-AqBE7jZj.js +17181 -0
  33. package/dist/DocTimeline-hq2asPzr.js +481 -0
  34. package/dist/DocumentClient-TmtHqfiw.js +136 -0
  35. package/dist/DocumentLayout-CRAp8mfk.js +4909 -0
  36. package/dist/DocumentLogotype-emSjQ21f.js +87 -0
  37. package/dist/DocumentVoided-BOjiWBK6.js +25 -0
  38. package/dist/EmbedInput-B3LFGEee.js +113 -0
  39. package/dist/EmbedSettings-BYPJTGQf.js +72 -0
  40. package/dist/ErrorCallout-CwgYHBkg.js +28 -0
  41. package/dist/FilePreviewModal-81sSrDGg.js +81 -0
  42. package/dist/Flag-DGFvUTQZ.js +114 -0
  43. package/dist/HeaderSettings-BGpkzcbj.js +392 -0
  44. package/dist/ImageSelectModal-Cimviyuy.js +84 -0
  45. package/dist/ImageUploadWrapper-qJDHCf8T.js +1604 -0
  46. package/dist/Index-18w_qMQH.js +25 -0
  47. package/dist/Index-9_R8_myc.js +77 -0
  48. package/dist/Index-BKoXW7GK.js +84 -0
  49. package/dist/Index-BL3-tRGt.js +642 -0
  50. package/dist/Index-BNfAA-ZJ.js +154 -0
  51. package/dist/Index-BOxSvAug.js +144 -0
  52. package/dist/Index-BQgW1jlH.js +45 -0
  53. package/dist/Index-BXAqgXVi.js +150 -0
  54. package/dist/Index-BgK_WC0d.js +140 -0
  55. package/dist/Index-BkUzlQaQ.js +107 -0
  56. package/dist/Index-BpyYa9LR.js +171 -0
  57. package/dist/Index-ByzGXUoc.js +292 -0
  58. package/dist/Index-C1lsSfnX.js +52 -0
  59. package/dist/Index-C9sq_RDg.js +223 -0
  60. package/dist/Index-CDEh3GAi.js +26 -0
  61. package/dist/Index-CEG-Hiv6.js +69 -0
  62. package/dist/Index-CMUg61_b.js +33 -0
  63. package/dist/Index-CObGPoQv.js +62 -0
  64. package/dist/Index-CPNUsaOS.js +57 -0
  65. package/dist/Index-CegW1Rim.js +98 -0
  66. package/dist/Index-CoSt-Bws.js +31 -0
  67. package/dist/Index-CpDgldnz.js +70 -0
  68. package/dist/Index-CqImx-rG.js +55 -0
  69. package/dist/Index-CrOD4_xj.js +58 -0
  70. package/dist/Index-DBCNVVm5.js +24 -0
  71. package/dist/Index-DGG1S8uJ.js +559 -0
  72. package/dist/Index-DRWS2z82.js +2402 -0
  73. package/dist/Index-DXRgZZNj.js +61 -0
  74. package/dist/Index-DY5gAUnE.js +754 -0
  75. package/dist/Index-Dr7mVlBb.js +49 -0
  76. package/dist/Index-Dx944wv-.js +21 -0
  77. package/dist/Index-Eq3JlTKK.js +46 -0
  78. package/dist/Index-Sr3emNkE.js +25 -0
  79. package/dist/Index-VshOfaom.js +32 -0
  80. package/dist/InputToggleRow-CQsaayf-.js +57 -0
  81. package/dist/ManualPopover-CFXm5cQy.js +58 -0
  82. package/dist/MediaWrapper-Cn0Yr4ce.js +23 -0
  83. package/dist/NotBindingText-CNiszGqn.js +32 -0
  84. package/dist/PackageGroup-BVys9ouj.js +699 -0
  85. package/dist/PdfTerms-Bbns-jMY.js +36 -0
  86. package/dist/PdfViewer-B1zzZU4Y.js +374 -0
  87. package/dist/PlainHtml-CARRbTxi.js +20 -0
  88. package/dist/PriceHeader-CqeC9Lhb.js +339 -0
  89. package/dist/SearchApi-bB9FLxUq.js +161 -0
  90. package/dist/Setup-p3Du_uf8.js +50 -0
  91. package/dist/SmartList-P5ZfTWBb.js +83 -0
  92. package/dist/TermsSettings-CQ8TGwBV.js +102 -0
  93. package/dist/ThemeColorRow-DMWVlFRU.js +67 -0
  94. package/dist/ToggleBinding-BPaYWgqP.js +38 -0
  95. package/dist/UploadModal-9O4HTVZm.js +95 -0
  96. package/dist/VideoPlayerInput-5KybfY7N.js +93 -0
  97. package/dist/VideoPlayerSettings-xSW8tcTZ.js +61 -0
  98. package/dist/VideoSelectModal-BbaNAxGH.js +100 -0
  99. package/dist/anime.es-BrPTThYb.js +858 -0
  100. package/dist/answerDocumentMixin-S-Bmv15G.js +51 -0
  101. package/dist/color-TdtKxwVa.js +19 -0
  102. package/dist/debounce-B_0g8OVh.js +84 -0
  103. package/dist/dom-CJxkno7i.js +91 -0
  104. package/dist/favicon.ico +0 -0
  105. package/dist/focusDrawerMixin-DhsqWZUo.js +22 -0
  106. package/dist/formComponentsInstall-UG7a9vjZ.js +2499 -0
  107. package/dist/formDrawerState-BMQrWaBt.js +20 -0
  108. package/dist/formValidationMixin-DUu0omWT.js +49 -0
  109. package/dist/i18nMessages-Chz_lxGG.js +17 -0
  110. package/dist/index-B3R_uKML.js +347 -0
  111. package/dist/index-B4aiQXsr.js +166 -0
  112. package/dist/index-C50JSDKO.js +3916 -0
  113. package/dist/index-CJ9AvuZH.js +102 -0
  114. package/dist/index-Czyda2Ej.js +492 -0
  115. package/dist/index-myOYAnwV.js +81 -0
  116. package/dist/index.es.js +35 -0
  117. package/dist/index.umd.js +3148 -0
  118. package/dist/main-B9t0ybqW.js +56739 -0
  119. package/dist/mapFormMixin-ETYhBLl2.js +72 -0
  120. package/dist/omit-DtTfKAed.js +31 -0
  121. package/dist/publicSenderState-DD1lN9CR.js +21 -0
  122. package/dist/splitpanes-BHUVsCZF.js +382 -0
  123. package/dist/style.css +4 -0
  124. package/dist/throttle-qziKkJJX.js +18 -0
  125. package/dist/tinycolor-CMC8Xp7x.js +633 -0
  126. package/dist/tippy.esm-DjbYjfS2.js +1799 -0
  127. package/dist/utils-C5Rg0fQC.js +108 -0
  128. package/dist/vuedraggable.umd-CE3WmaEQ.js +3161 -0
  129. package/dist/vuex.esm-DKGl8mcw.js +467 -0
  130. package/package.json +1 -1
  131. package/tsconfig.json +26 -26
  132. package/tsconfig.node.json +10 -10
  133. package/tsconfig.paths.json +17 -17
  134. package/vite.config.ts +61 -61
@@ -0,0 +1,2499 @@
1
+ import { m } from "./mapFormMixin-ETYhBLl2.js";
2
+ import { I as L, a as H, r as l } from "./index-C50JSDKO.js";
3
+ import { az as v, h as q, n as o, b as c, aA as j, t as K, aB as B, aC as W, q as I, aD as P, f as T, aE as R, J as y } from "./main-B9t0ybqW.js";
4
+ import { B as M } from "./BaseDatePicker-P5iq-XAp.js";
5
+ import { E as X } from "./ErrorCallout-CwgYHBkg.js";
6
+ import { s as U, F as Q } from "./Flag-DGFvUTQZ.js";
7
+ import { b as Y, m as g } from "./vuex.esm-DKGl8mcw.js";
8
+ import G from "./AddClientCallout-BMc-v9rJ.js";
9
+ import J from "./ClientModal-fw8f6UvL.js";
10
+ import { c as Z, r as ee, g as te, C as h, a as f, b as p } from "./CDropdownItem-BjYnhZJr.js";
11
+ import "./CTabs.vue_vue_type_style_index_0_scoped_e02a6440_lang-l0sNRNKZ.js";
12
+ import { C as _ } from "./CCallout-Bbp9ya9n.js";
13
+ import { a as ie, C as se } from "./CFormField-CeJ58aN2.js";
14
+ import { S as ne } from "./SmartList-P5ZfTWBb.js";
15
+ function z(t, e) {
16
+ const i = new Date(t.getTime());
17
+ return i.setDate(
18
+ t.getDate() + (7 + e - t.getDay() - 1) % 7 + 1
19
+ ), i.setHours(8, 0, 0, 0), i;
20
+ }
21
+ function E(t) {
22
+ const e = new Date(t.getTime());
23
+ return e.setDate(e.getDate() + 1), e.setHours(10, 0, 0, 0), e;
24
+ }
25
+ let b = E(/* @__PURE__ */ new Date()), C = z(/* @__PURE__ */ new Date(), 1);
26
+ const ae = {
27
+ name: "DocumentSendLater",
28
+ i18nOptions: {
29
+ namespaces: "documentSendLater",
30
+ messages: {
31
+ en: {
32
+ title: "Schedule Delivery",
33
+ tomorrowMorning: "Tomorrow morning",
34
+ mondayMorning: "Monday morning",
35
+ custom: {
36
+ title: "Set time & date",
37
+ invalid: "Time & date can't be in the past"
38
+ }
39
+ },
40
+ sv: {
41
+ title: "Skicka med schemaläggning",
42
+ tomorrowMorning: "Imorgon förmiddag",
43
+ mondayMorning: "Måndag morgon",
44
+ custom: {
45
+ title: "Välj datum & tid",
46
+ invalid: "Välj en tid & datum längre fram i tiden."
47
+ }
48
+ }
49
+ }
50
+ },
51
+ components: {
52
+ BaseDatePicker: M
53
+ },
54
+ props: {
55
+ _document: {
56
+ type: Object,
57
+ default: () => ({})
58
+ },
59
+ setFormValue: {
60
+ type: Function,
61
+ required: !0
62
+ },
63
+ removeFormValue: {
64
+ type: Function,
65
+ required: !0
66
+ },
67
+ onSaveDocument: {
68
+ type: Function,
69
+ required: !0
70
+ }
71
+ },
72
+ data() {
73
+ return {
74
+ sendAt: v(/* @__PURE__ */ new Date(), 5).toISOString(),
75
+ showCustom: !1,
76
+ backupSentFlag: !1
77
+ // needed since doc/project flags not instant on double clicks
78
+ };
79
+ },
80
+ validations: {
81
+ sendAt: {
82
+ minValue: (t) => t > v(/* @__PURE__ */ new Date(), 2).toISOString()
83
+ // two minutes as safety
84
+ }
85
+ },
86
+ computed: {
87
+ ...Y("forms", {
88
+ formData: (t) => t.document2.data
89
+ }),
90
+ ...g({
91
+ deliveryTypes: "forms/deliveryTypes",
92
+ isPostingDocument: "documents2/isPosting",
93
+ feature: "application/feature"
94
+ }),
95
+ tomorrowMorning() {
96
+ return b.toISOString();
97
+ },
98
+ mondayMorning() {
99
+ return C.toISOString();
100
+ },
101
+ reminderDeliveryTypes() {
102
+ const t = ["email"];
103
+ return this.feature("sms") && t.push("sms"), this.deliveryTypes ? [
104
+ ...this.deliveryTypes.sms && this.feature("sms") ? ["sms"] : [],
105
+ ...this.deliveryTypes.email ? ["email"] : []
106
+ ] : t;
107
+ }
108
+ },
109
+ created() {
110
+ b = E(/* @__PURE__ */ new Date()), C = z(/* @__PURE__ */ new Date(), 1);
111
+ },
112
+ methods: {
113
+ setTime(t) {
114
+ const e = t.split(":"), i = new Date(this.sendAt).setHours(e[0], e[1]);
115
+ i && (this.sendAt = new Date(i).toISOString());
116
+ },
117
+ setDate(t) {
118
+ const e = new Date(this.sendAt), i = new Date(t).setHours(e.getHours(), e.getMinutes());
119
+ this.sendAt = new Date(i).toISOString();
120
+ },
121
+ async onSendAt(t) {
122
+ try {
123
+ if (this.$v.$invalid || this.isPostingDocument || this.backupSentFlag)
124
+ return;
125
+ this.backupSentFlag = !0;
126
+ const e = {
127
+ type: "first",
128
+ status: "new",
129
+ sendDays: 0,
130
+ sendAt: t,
131
+ deliveryTypes: this.reminderDeliveryTypes,
132
+ tries: 0
133
+ }, i = this.formData.reminders.findIndex(
134
+ (n) => n.type === "first"
135
+ ), s = i >= 0 ? `data.reminders[${i}]` : "data.reminders";
136
+ this.setFormValue({ key: s, value: e }), await this.onSaveDocument({ doSend: !0 }), this.backupSentFlag = !1;
137
+ } catch (e) {
138
+ q(e);
139
+ } finally {
140
+ this.backupSentFlag = !1;
141
+ }
142
+ }
143
+ }
144
+ };
145
+ var re = function() {
146
+ var e = this, i = e._self._c;
147
+ return i("div", { staticClass: "overflow-hidden rounded-xl bg-white" }, [i("div", { staticClass: "px-6 pb-3 pt-8" }, [i("div", { staticClass: "text-md text-center font-semibold" }, [e._v(" " + e._s(e.$t("title")) + " ")]), i("div", { staticClass: "pt-8" }, e._l([
148
+ [e.tomorrowMorning, "tomorrowMorning"],
149
+ [e.mondayMorning, "mondayMorning"]
150
+ ], function(s, n) {
151
+ return i("div", { key: n, staticClass: "mb-4 flex cursor-pointer select-none items-center justify-between rounded-md border border-gray-200 bg-gray-50 p-4 text-sm hover:border-gray-300 hover:bg-gray-100 active:border-gray-400 active:bg-gray-200", on: { click: () => e.onSendAt(s[0]) } }, [i("div", { staticClass: "font-medium" }, [e._v(e._s(e.$t(s[1])))]), i("div", { staticClass: "text-gray-500" }, [e._v(" " + e._s(e.$formatDate(s[0], "p, d MMM")) + " ")])]);
152
+ }), 0)]), i("div", { staticClass: "border-t border-gray-200 bg-gray-100 px-8 py-6", class: e.showCustom ? "" : "cursor-pointer hover:bg-gray-200", on: { click: function(s) {
153
+ e.showCustom = !0;
154
+ } } }, [i("div", { staticClass: "flex items-center text-sm" }, [i("CIcon", { staticClass: "text-primary-500 mr-2", attrs: { type: "calendar", size: "18" } }), i("div", { staticClass: "font-medium", domProps: { textContent: e._s(e.$t("custom.title")) } })], 1), i("Animation", [i("div", { directives: [{ name: "show", rawName: "v-show", value: e.showCustom, expression: "showCustom" }], staticClass: "mt-4" }, [i("div", { staticClass: "grid grid-cols-2 gap-4" }, [i("BaseDatePicker", { attrs: { value: e.sendAt }, on: { input: e.setDate } }), i("CInput", { attrs: { value: e.$formatDate(e.sendAt, "HH:mm"), type: "time" }, on: { input: e.setTime } })], 1), e.$v.$invalid ? i("div", { staticClass: "error-wrapper" }, [i("CIcon", { staticClass: "text-primary-500 mr-2", attrs: { type: "calendar" } }), e._v(" " + e._s(e.$t("custom.invalid")) + " ")], 1) : e._e(), i("CButton", { staticStyle: { "margin-top": "calc(1.5 * var(--rem))" }, attrs: { loading: e.isPostingDocument, type: "secondary", wide: "" }, on: { click: function(s) {
155
+ return e.onSendAt(e.sendAt);
156
+ } } }, [e._v(" " + e._s(e.$t("_common:send")) + " " + e._s(e.$formatDate(e.sendAt, "d MMM - p")) + " ")])], 1)])], 1)]);
157
+ }, oe = [], le = /* @__PURE__ */ o(
158
+ ae,
159
+ re,
160
+ oe,
161
+ !1,
162
+ null,
163
+ "dcfae061"
164
+ );
165
+ const de = le.exports, ce = {
166
+ sv: {
167
+ title: "Skicka dokument",
168
+ nameLabel: "Dokumentnamn",
169
+ namePlaceholder: "Namn",
170
+ sendAs: "Skicka som",
171
+ validityPeriod: "Giltighetstid",
172
+ manualDelivery: "Manuell leverans",
173
+ manualDeliveryTooltip: "Skicka ut dokument till din mottagare själv. Du kan dela en länk eller en PDF.",
174
+ scheduledTooltip: "Schemalägg utskick",
175
+ clientsAreMissingContactInfo: "En eller flera mottagare saknar e-post eller mobiltelefon-nr. Dokumentet kommer inte att kunna skickas till dem.",
176
+ missingDeliveryMethod: "Välj en eller fler leveransmetoder",
177
+ sendButton: "Skicka dokument",
178
+ signMethod: {
179
+ title: "Signeringsmetod",
180
+ tooltip: "Hur ska din mottagare signera?",
181
+ button: {
182
+ title: "Standard - knapptryck",
183
+ content: "Bevisnivå: IP-adress, tidpunkt och enhet."
184
+ },
185
+ bankId: {
186
+ title: "BankId",
187
+ content: "Samma säkerhetsgrad som bankerna har."
188
+ },
189
+ signature: {
190
+ title: "Standard",
191
+ content: "Bevisnivå: IP-adress, tidpunkt och enhet."
192
+ },
193
+ inPerson: {
194
+ title: "Fysisk underskrift",
195
+ content: "Signatur på utskrivet dokument"
196
+ }
197
+ }
198
+ },
199
+ en: {
200
+ title: "Send document",
201
+ nameLabel: "Document name",
202
+ namePlaceholder: "Name",
203
+ sendAs: "Send as",
204
+ validityPeriod: "Expiration",
205
+ manualDelivery: "Manual delivery",
206
+ manualDeliveryTooltip: "Share the document with your recipient yourself. You can share a link or a PDF.",
207
+ scheduledTooltip: "Schedule delivery",
208
+ clientsAreMissingContactInfo: "Note that one or more recipients are missing an email or cellphone number. The document will not be sent to them.",
209
+ missingDeliveryMethod: "Please select one or more delivery methods",
210
+ sendButton: "Send document",
211
+ signMethod: {
212
+ title: "Signing method",
213
+ tooltip: "How do you want your client to sign?",
214
+ button: {
215
+ title: "Standard - button",
216
+ content: "Level of proof: IP address, timestamp and device."
217
+ },
218
+ bankId: {
219
+ title: "BankID",
220
+ content: "Same level of proof as the banks use."
221
+ },
222
+ signature: {
223
+ title: "Signature",
224
+ content: "Level of proof: IP address, timestamp and device."
225
+ },
226
+ inPerson: {
227
+ title: "In person",
228
+ content: "Signature on print document"
229
+ }
230
+ }
231
+ }
232
+ }, ue = {
233
+ sv: {
234
+ addFirstButton: "Lägg till mottagare",
235
+ addButton: "Lägg till mottagare",
236
+ signOrder: {
237
+ label: "Signeringsordning",
238
+ tooltip: "Signeringsordning låter dig bestämma i vilken ordning dina mottagare tar emot och signerar dokumentet."
239
+ }
240
+ },
241
+ en: {
242
+ addFirstButton: "Add recipient",
243
+ addButton: "Add recipient",
244
+ signOrder: {
245
+ label: "Signing order",
246
+ tooltip: "Signing order lets you decide the order in which your recipients receive and sign your documents."
247
+ }
248
+ }
249
+ }, me = {
250
+ name: "ClientSendListItem",
251
+ props: {
252
+ client: {
253
+ type: Object,
254
+ default: () => ({})
255
+ },
256
+ isOrder: {
257
+ type: Boolean,
258
+ default: !1
259
+ },
260
+ isSender: {
261
+ type: Boolean,
262
+ default: !1
263
+ },
264
+ compact: {
265
+ type: Boolean,
266
+ default: !1
267
+ },
268
+ allowEditClients: {
269
+ type: Boolean,
270
+ default: !0
271
+ },
272
+ rightButton: {
273
+ // TODO temporary in order to disable sender sign for widget context
274
+ type: Boolean,
275
+ default: !0
276
+ }
277
+ },
278
+ data() {
279
+ return {
280
+ isHover: !1,
281
+ isDropdownOpen: !1
282
+ };
283
+ },
284
+ methods: {
285
+ onClick() {
286
+ var t;
287
+ if (this.rightButton && this.isSender)
288
+ return (t = this.$refs.dropdown) == null ? void 0 : t.toggle();
289
+ this.allowEditClients && this.$emit("open");
290
+ }
291
+ }
292
+ };
293
+ var pe = function() {
294
+ var s;
295
+ var e = this, i = e._self._c;
296
+ return i("div", { staticClass: "rc-card flex items-center", class: {
297
+ "is-hover": e.isHover,
298
+ "has-controls": e.isOrder
299
+ }, staticStyle: { "padding-left": "8px" }, on: { click: e.onClick, "&mouseover": function(n) {
300
+ e.isHover = !0;
301
+ }, "&mouseleave": function(n) {
302
+ e.isHover = !1;
303
+ } } }, [e.compact ? i("div", { staticStyle: { "font-size": "14px" } }, [i("div", [e._v(e._s(e.client.name || e.client.companyName))]), e.client.name && e.client.companyName ? i("div", { staticStyle: { "font-size": "12px", "font-weight": "500" } }, [e._v(" " + e._s(e.client.companyName) + " ")]) : e._e(), e.client.documentRole ? i("div", { staticClass: "text-gray-700", staticStyle: { "font-size": "13px", "margin-top": "4px" } }, [e._v(" " + e._s(e.$t(`_common:documentRole.${e.client.documentRole}.description`)) + " ")]) : e._e(), e.isOrder ? i("div", { staticClass: "compact-order" }, [i("CIcon", { staticClass: "compact-order-button", attrs: { size: "16", type: "chevron-up" }, on: { click: function(n) {
304
+ return n.preventDefault(), n.stopPropagation(), e.$emit("move", -1);
305
+ } } }), i("div", { staticClass: "rc-order", staticStyle: { width: "20px", height: "20px" } }, [e._v(" " + e._s(e.client.signOrder) + " ")]), i("CIcon", { staticClass: "compact-order-button", attrs: { size: "16", type: "chevron-down" }, on: { click: function(n) {
306
+ return n.preventDefault(), n.stopPropagation(), e.$emit("move", 1);
307
+ } } })], 1) : e._e()]) : [i("div", { staticStyle: { width: "34px", flex: "0 0 34px", display: "inline-flex", "justify-content": "center" } }, [e.isOrder ? i("div", { staticStyle: { position: "relative", display: "inline-block" } }, [i("CButton", { staticClass: "rc-order__button up", attrs: { type: "none", pattern: "primary", circle: "", raised: "", size: "small", icon: "minus" }, on: { click: function(n) {
308
+ return n.preventDefault(), n.stopPropagation(), e.$emit("move", -1);
309
+ } } }), i("CButton", { staticClass: "rc-order__button down", attrs: { type: "none", pattern: "primary", circle: "", raised: "", size: "small", icon: "plus" }, on: { click: function(n) {
310
+ return n.preventDefault(), n.stopPropagation(), e.$emit("move", 1);
311
+ } } }), i("div", { staticClass: "rc-order" }, [e._v(" " + e._s(e.client.signOrder) + " ")])], 1) : i("CIcon", { staticClass: "text-primary-500", staticStyle: { "margin-right": "8px", flex: "0 0 18px" }, attrs: { type: e.isSender ? "send" : ["signee", "approver"].includes(e.client.documentRole) ? "pen-tool" : "eye", size: "18" } })], 1), i("div", { staticClass: "rc-data truncate-text" }, [e.client.name || e.client.companyName ? i("div", { staticStyle: { "font-weight": "500" } }, [e._v(" " + e._s(e.client.name || e.client.companyName) + " ")]) : e.isSender ? i("div", { staticClass: "text-gray-500" }, [e._v(" " + e._s(e.$t("_common:empty", { thing: e.$t("_common:reference") })) + " ")]) : i("div", { staticClass: "text-gray-500" }, [e._v(" " + e._s(e.$t("_common:missing", { thing: e.$t("_common:name") })) + " ")]), i("div", { staticClass: "text-gray-700", staticStyle: { "font-size": "12px" } }, [e.isSender ? [e.isSender ? i("span", [e._v(" " + e._s(e.$t("_common:documentRole.sender.description")) + " ")]) : e._e(), e.client.documentRole === "signee" ? i("span", [e._v(" " + e._s(e.$t(`_common:documentRole.${e.client.documentRole}.description`)) + " ")]) : e._e()] : [((s = e.client.answerMethod) == null ? void 0 : s.accept) === "inPerson" ? i("span", { staticClass: "text-red-500" }, [e._v(" " + e._s(e.$t("_common:signMethod.title")) + ": "), i("span", [e._v(" " + e._s(e.$t("_common:signMethod.inPerson")) + " ")])]) : e._e(), e.client.documentRole ? i("span", [e._v(" " + e._s(e.$t(`_common:documentRole.${e.client.documentRole}.description`)) + " ")]) : e._e(), e.client.email ? i("span", [e._v(e._s(e.client.email))]) : e._e(), e.client.cellphone ? i("span", [e._v(e._s(e.client.cellphone))]) : e._e()]], 2)])], e.rightButton ? i("transition", { attrs: { name: "fade-100" } }, [e.isHover || e.isDropdownOpen ? [e.isSender ? i("CDropdown", { ref: "dropdown", staticStyle: { position: "absolute", right: "calc(0.5 * var(--rem))" }, attrs: { position: "is-bottom-left", "menu-styling": {
312
+ minWidth: "220px"
313
+ }, "append-to-body": "" }, on: { "active-change": function(n) {
314
+ e.isDropdownOpen = n;
315
+ } }, nativeOn: { click: function(n) {
316
+ n.stopPropagation();
317
+ } } }, [i("CButton", { attrs: { slot: "trigger", circle: "", size: "small", type: "none", pattern: "secondary", raised: "", icon: "more-horizontal" }, slot: "trigger" }), e._t("dropdownOptions")], 2) : e.allowEditClients ? i("CButton", { staticStyle: { position: "absolute", right: "calc(0.5 * var(--rem))" }, attrs: { circle: "", size: "small", icon: "x", type: "none", pattern: "secondary", raised: "" }, on: { click: function(n) {
318
+ return n.stopPropagation(), e.$emit("remove");
319
+ } } }) : e._e()] : e._e()], 2) : e._e()], 2);
320
+ }, he = [], fe = /* @__PURE__ */ o(
321
+ me,
322
+ pe,
323
+ he,
324
+ !1,
325
+ null,
326
+ "47fa5bc0"
327
+ );
328
+ const N = fe.exports, ge = {
329
+ name: "SenderBlockItem",
330
+ i18nOptions: {
331
+ namespaces: "senderBlockItem",
332
+ messages: {
333
+ en: {
334
+ toggle: {
335
+ label: "Sign the document",
336
+ description: "Toggle to add your own signature to the document."
337
+ }
338
+ },
339
+ sv: {
340
+ toggle: {
341
+ label: "Signera dokumentet",
342
+ description: "Aktivera för att lägga till din signatur på dokumentet."
343
+ }
344
+ }
345
+ }
346
+ },
347
+ components: {
348
+ RecipientBlockItem: N
349
+ },
350
+ mixins: [
351
+ m(["senderClient"], {
352
+ useEmit: !1,
353
+ setFnName: "setFormValue"
354
+ })
355
+ ],
356
+ inject: {
357
+ allowSenderSign: {
358
+ default: !0
359
+ }
360
+ },
361
+ props: {
362
+ setFormValue: {
363
+ type: Function,
364
+ required: !0
365
+ },
366
+ defaultAddSenderClient: {
367
+ type: Boolean,
368
+ default: !1
369
+ }
370
+ },
371
+ data() {
372
+ return {
373
+ senderClientData: null
374
+ };
375
+ },
376
+ computed: {
377
+ ...g({
378
+ feature: "application/feature"
379
+ })
380
+ },
381
+ created() {
382
+ this.generateSenderClient(), this._document.id || this._document.isDirty("senderClient") ? this.toggleSenderSign(!!this.senderClient) : this.defaultAddSenderClient && this.toggleSenderSign(!0);
383
+ },
384
+ methods: {
385
+ get: c,
386
+ generateSenderClient() {
387
+ const { company: t, user: e } = this._document.sender || {}, i = c(
388
+ this._document,
389
+ "data.defaultAnswerMethod"
390
+ );
391
+ this.senderClientData = {
392
+ ...j(),
393
+ documentRole: "recipient",
394
+ ...i && { answerMethod: i },
395
+ ...this.senderClient,
396
+ // latest sender values in the document
397
+ type: "company",
398
+ companyName: t.name,
399
+ name: e.name,
400
+ email: e.email,
401
+ cellphone: e.cellphone
402
+ };
403
+ },
404
+ toggleSenderSign(t) {
405
+ this.senderClientData.documentRole = t ? "signee" : "recipient", this.senderClient = t ? this.senderClientData : null, this._document.setDirty("senderClient");
406
+ },
407
+ setSenderMethod(t) {
408
+ const e = {
409
+ ...this.senderClient,
410
+ answerMethod: {
411
+ accept: t,
412
+ deny: "button"
413
+ }
414
+ };
415
+ this.senderClient = e, this.senderClientData = { ...e };
416
+ }
417
+ }
418
+ };
419
+ var ve = function() {
420
+ var e = this, i = e._self._c;
421
+ return e.senderClientData ? i("RecipientBlockItem", { staticClass: "first-of-group last-of-group", staticStyle: { display: "inline-flex", width: "auto", "padding-right": "2em", "min-width": "220px" }, attrs: { client: e.senderClientData, "right-button": e.allowSenderSign, "is-sender": !0 } }, [i("template", { slot: "dropdownOptions" }, [i("CDropdownItem", { attrs: { value: !!e.senderClient, "close-on-click": !1, toggle: "" }, on: { input: e.toggleSenderSign } }, [e._v(" " + e._s(e.$t("toggle.label")) + " ")]), e.senderClient ? [i("CDropdownItem", { attrs: { separator: "" } }), i("div", { staticClass: "text-gray-400", staticStyle: { "font-size": "13px", padding: "calc(0.5 * var(--rem)) 0 calc(0.25 * var(--rem))", "font-weight": "500" } }, [e._v(" " + e._s(e.$t("_common:signMethod.title")) + " ")]), e._l([
422
+ "login",
423
+ "signature",
424
+ ...e.feature("bankId") ? ["bankId"] : []
425
+ ], function(s) {
426
+ return i("CDropdownItem", { key: s, attrs: { "icon-right": e.get(e.senderClient, "answerMethod.accept") === s ? "check" : "" }, on: { click: function(n) {
427
+ return e.setSenderMethod(s);
428
+ } } }, [e._v(" " + e._s(e.$t(`_common:signMethod.${s}`)) + " ")]);
429
+ })] : i("div", { staticClass: "bg-gray-100 text-gray-700", staticStyle: { padding: "calc(0.5 * var(--rem))", margin: "calc(0.5 * var(--rem))", "font-size": "13px", "border-radius": "4px", "line-height": "1.25", "font-weight": "500" } }, [e._v(" " + e._s(e.$t("toggle.description")) + " ")])], 2)], 2) : e._e();
430
+ }, ye = [], _e = /* @__PURE__ */ o(
431
+ ge,
432
+ ve,
433
+ ye,
434
+ !1,
435
+ null,
436
+ "dad49914"
437
+ );
438
+ const be = _e.exports, Ce = {
439
+ name: "RecipientBlock",
440
+ i18nOptions: {
441
+ namespaces: "recipientBlock",
442
+ messages: ue
443
+ },
444
+ components: {
445
+ AddClientCallout: G,
446
+ RecipientBlockItem: N,
447
+ SenderBlockItem: be
448
+ },
449
+ mixins: [
450
+ m(["clients"], {
451
+ useEmit: !1,
452
+ setFnName: "setFormValue"
453
+ })
454
+ ],
455
+ props: {
456
+ compact: {
457
+ type: Boolean,
458
+ default: !1
459
+ },
460
+ setFormValue: {
461
+ type: Function,
462
+ required: !0
463
+ },
464
+ removeFormValue: {
465
+ type: Function,
466
+ required: !0
467
+ },
468
+ defaultAddSenderClient: {
469
+ type: Boolean,
470
+ default: !1
471
+ },
472
+ allowEditClients: {
473
+ type: Boolean,
474
+ default: !0
475
+ },
476
+ isPublicForm: {
477
+ type: Boolean,
478
+ default: !1
479
+ }
480
+ },
481
+ computed: {
482
+ sortedClients() {
483
+ return [...this.clients].map((t, e) => ({ ...t, index: e })).sort((t, e) => t.signOrder - e.signOrder);
484
+ },
485
+ maxSignOrder() {
486
+ if (!this.useSignOrder || this.sortedClients.length === 0)
487
+ return 0;
488
+ const { signOrder: t } = this.sortedClients[this.sortedClients.length - 1];
489
+ return t;
490
+ },
491
+ useSignOrder() {
492
+ return c(this._document, "useSignOrder", !1);
493
+ }
494
+ },
495
+ methods: {
496
+ onMoveRecipient({ index: t, direction: e }) {
497
+ this.clients = K(this.clients).set(
498
+ {
499
+ ...this.clients[t],
500
+ signOrder: Math.max(this.clients[t].signOrder + e, 0)
501
+ },
502
+ t
503
+ );
504
+ },
505
+ toggleSignOrder(t) {
506
+ let e = [];
507
+ if (t) {
508
+ const i = !this.clients.every(
509
+ ({ signOrder: s }) => !s
510
+ );
511
+ this.clients = this.clients.map((s, n) => ({
512
+ ...s,
513
+ signOrder: i ? s.signOrder : n + 1
514
+ }));
515
+ } else
516
+ e = c(this._document, "template.reminders", []), e.length || (e = B.default);
517
+ this.setFormValue({ key: "data.reminders", value: e }), this.setFormValue({ key: "useSignOrder", value: t });
518
+ },
519
+ removeClient(t) {
520
+ this.removeFormValue(`clients[${t}]`);
521
+ },
522
+ openClientModal(t = 0) {
523
+ var i;
524
+ const e = c(this, `clients[${t}].signOrder`);
525
+ this.$modal.show(J, {
526
+ documentClientIndex: t,
527
+ ...this.useSignOrder && {
528
+ signOrder: W(e) === "number" ? e : this.maxSignOrder + 1
529
+ },
530
+ signOptions: (i = this._document) == null ? void 0 : i.signOptions,
531
+ setFormValue: this.setFormValue,
532
+ removeFormValue: this.removeFormValue,
533
+ isPublicForm: this.isPublicForm
534
+ });
535
+ },
536
+ setClient(t) {
537
+ this.setFormValue({ key: `clients[${this.clients.length}]`, value: t });
538
+ }
539
+ }
540
+ };
541
+ var we = function() {
542
+ var e = this, i = e._self._c;
543
+ return i("div", [e.compact ? e._e() : [i("div", { staticClass: "pb-0.5 text-xs font-medium text-gray-900" }, [e._v(" " + e._s(e.$t("_common:from").capitalize()) + ": ")]), i("SenderBlockItem", { attrs: { _document: e._document, _value: { senderClient: "senderClient" }, "set-form-value": e.setFormValue, "default-add-sender-client": e.defaultAddSenderClient } })], i("div", { staticClass: "block-title flex pb-0.5 pt-2 text-xs text-gray-500", class: { "block-title__line": !e.compact } }, [e.compact ? e._e() : i("div", { staticClass: "font-medium text-gray-900" }, [e._v(" " + e._s(e.$t("_common:to").capitalize()) + ": ")]), e.clients && e.clients.length ? i("div", { staticClass: "ml-auto inline-flex items-center justify-end" }, [i("CIcon", { directives: [{ name: "tooltip", rawName: "v-tooltip", value: e.$t("signOrder.tooltip"), expression: "$t('signOrder.tooltip')" }], staticClass: "mr-1", attrs: { type: "info", size: "14" } }), i("div", { staticClass: "mr-2 font-medium" }, [e._v(" " + e._s(e.$t("signOrder.label")) + " ")]), i("CSwitch", { staticClass: "!mr-0", attrs: { value: e.useSignOrder, size: "tiny", type: "success" }, on: { input: e.toggleSignOrder } })], 1) : e._e()]), e.clients && e.clients.length ? [e.useSignOrder ? i("transition-group", { staticClass: "list-move", attrs: { name: "list-move" } }, [e._l(e.sortedClients, function(s, n) {
544
+ return [n > 0 && s.signOrder !== e.sortedClients[n - 1].signOrder ? i("div", { key: n, staticClass: "h-2 pl-6" }, [i("div", { staticClass: "bg-primary-500 h-full w-0.5 rounded-sm" })]) : e._e(), i("div", { key: s._uniqueId, staticClass: "mb-0.5 mt-px" }, [i("RecipientBlockItem", { class: {
545
+ "first-of-group": n === 0 || n > 0 && s.signOrder !== e.sortedClients[n - 1].signOrder,
546
+ "last-of-group": n === e.sortedClients.length - 1 || e.sortedClients[n + 1] && s.signOrder !== e.sortedClients[n + 1].signOrder
547
+ }, attrs: { client: s, "is-order": e.useSignOrder, compact: e.compact, "allow-edit-clients": e.allowEditClients }, on: { move: function(a) {
548
+ return e.onMoveRecipient({ index: s.index, direction: a });
549
+ }, open: function(a) {
550
+ return e.openClientModal(s.index);
551
+ }, remove: function(a) {
552
+ return e.removeClient(s.index);
553
+ } } })], 1)];
554
+ })], 2) : e._l(e.clients, function(s, n) {
555
+ return i("RecipientBlockItem", { key: s._uniqueId, staticClass: "mb-0.5 mt-px", class: {
556
+ "first-of-group": n === 0,
557
+ "last-of-group": n === e.clients.length - 1
558
+ }, attrs: { "is-order": e.useSignOrder, compact: e.compact, "allow-edit-clients": e.allowEditClients, client: s }, on: { open: function(a) {
559
+ return e.openClientModal(n);
560
+ }, remove: function(a) {
561
+ return e.removeClient(n);
562
+ } } });
563
+ }), !e.compact && e.allowEditClients ? i("CButton", { staticClass: "is-thinner !text-sm", attrs: { type: "secondary", pattern: "tertiary", "icon-left": "plus", size: "normal" }, on: { click: function(s) {
564
+ return e.openClientModal(e.clients.length);
565
+ } } }, [e._v(" " + e._s(e.$t("addButton")) + " ")]) : e._e()] : (e.$view === "widget" || e.viewSettings.isPublicForm) && e.allowEditClients ? i("CButton", { staticClass: "!px-4 font-medium", attrs: { type: "secondary", raised: "", size: "small", taller: "", "icon-left": "person" }, on: { click: function(s) {
566
+ return e.openClientModal(e.clients.length);
567
+ } } }, [e._v(" " + e._s(e.$t("addFirstButton")) + " ")]) : !e.compact && e.allowEditClients ? i("AddClientCallout", { attrs: { compact: !0 }, on: { add: function(s) {
568
+ return e.openClientModal(e.clients.length);
569
+ }, setClient: e.setClient } }) : e._e()], 2);
570
+ }, xe = [], Se = /* @__PURE__ */ o(
571
+ Ce,
572
+ we,
573
+ xe,
574
+ !1,
575
+ null,
576
+ "51e072f2"
577
+ );
578
+ const $e = Se.exports, ke = {
579
+ name: "DocumentSendReminderItem",
580
+ props: {
581
+ label: {
582
+ type: String,
583
+ required: !0
584
+ },
585
+ value: {
586
+ type: [Number, String],
587
+ default: 0
588
+ },
589
+ done: {
590
+ type: Boolean,
591
+ default: !1
592
+ }
593
+ }
594
+ };
595
+ var De = function() {
596
+ var e = this, i = e._self._c;
597
+ return i("div", { staticClass: "mb-4 flex min-h-[2.5em] select-none items-center rounded-md bg-gray-100 px-4 py-2 text-sm font-medium" }, [i("div", { staticClass: "mr-6 flex-auto select-none text-gray-700" }, [e._v(" " + e._s(e.label) + " ")]), i("div", { staticClass: "flex flex-nowrap items-center justify-center text-sm" }, [e.done ? i("span", { staticClass: "text-green-500" }, [i("CIcon", { attrs: { type: "check", size: "18" } }), e._v(" " + e._s(e.$t("sent")) + " ")], 1) : [i("CButton", { staticClass: "!h-6 !w-6 bg-white", attrs: { icon: "minus", size: "small", circle: "", raised: "" }, on: { click: function(s) {
598
+ e.$emit("input", Math.max(e.value - 1, 0));
599
+ } } }), i("div", { staticClass: "min-w-[8ch] py-4 text-center text-sm font-medium text-gray-800" }, [e.value ? [e._v(" " + e._s(e.$tc("day", { count: Number(e.value) })) + " ")] : i("span", { staticClass: "text-xs text-gray-500" }, [e._v(" " + e._s(e.$t("disabled").capitalize()) + " ")])], 2), i("CButton", { staticClass: "!h-6 !w-6 bg-white", attrs: { icon: "plus", size: "small", circle: "", raised: "" }, on: { click: function(s) {
600
+ return e.$emit("input", e.value + 1);
601
+ } } })]], 2)]);
602
+ }, Ve = [], Fe = /* @__PURE__ */ o(
603
+ ke,
604
+ De,
605
+ Ve,
606
+ !1,
607
+ null,
608
+ null
609
+ );
610
+ const Ae = Fe.exports, Oe = {
611
+ name: "DocumentSendReminders",
612
+ i18nOptions: {
613
+ namespaces: "documentSendReminders",
614
+ messages: {
615
+ en: {
616
+ description: "Edit when smart reminders should be sent to client",
617
+ notViewed: "Not viewed after",
618
+ notAnswered: "No reply after",
619
+ expires: "When expiration date is within"
620
+ },
621
+ sv: {
622
+ description: "Ställ in när smarta påminnelser ska skickas ut till mottagaren",
623
+ notViewed: "Inte öppnat efter",
624
+ notAnswered: "Inte svarat efter",
625
+ expires: "När giltighetstiden är inom"
626
+ }
627
+ }
628
+ },
629
+ components: {
630
+ DocumentSendReminderItem: Ae
631
+ },
632
+ mixins: [m()],
633
+ props: {
634
+ setFormValue: {
635
+ type: Function,
636
+ required: !0
637
+ },
638
+ removeFormValue: {
639
+ type: Function,
640
+ required: !0
641
+ }
642
+ },
643
+ computed: {
644
+ reminders() {
645
+ const t = {
646
+ first: null,
647
+ notViewed: null,
648
+ notAnswered: null,
649
+ expires: null
650
+ };
651
+ return this._document.reminders.forEach((e, i) => {
652
+ e.type === "first" ? t.first = { ...e, index: i } : e.type === "viewed" ? t.notViewed = { ...e, index: i } : e.type === "expires" ? t.expires = { ...e, index: i } : t.notAnswered = { ...e, index: i };
653
+ }), t;
654
+ }
655
+ },
656
+ methods: {
657
+ getDefaultReminders() {
658
+ if (!this._document.template)
659
+ return [];
660
+ const t = this._document.template.getDefaultData({
661
+ path: "properties.data.properties.reminders"
662
+ });
663
+ return t && Array.isArray(t) ? t : [];
664
+ },
665
+ setReminder(t, e) {
666
+ let i = "sendDays";
667
+ if (typeof e == "string" && (i = "sendAt"), !e) {
668
+ this.removeFormValue(`data.reminders[${t.index}]`);
669
+ return;
670
+ }
671
+ if (typeof t == "string") {
672
+ let s = this.getDefaultReminders().find(
673
+ (n) => n.type === t
674
+ );
675
+ if (s || (s = B.default.find((n) => n.type === t)), !s)
676
+ throw new Error("Could not find default reminder");
677
+ s[i] = e, this.setFormValue({ key: "data.reminders", value: s });
678
+ return;
679
+ }
680
+ this.setFormValue({
681
+ key: `data.reminders[${t.index}].${i}`,
682
+ value: e
683
+ });
684
+ }
685
+ }
686
+ };
687
+ var Be = function() {
688
+ var e = this, i = e._self._c;
689
+ return i("div", { staticStyle: { "background-color": "white", "border-radius": "calc(0.5 * var(--rem))", padding: "calc(2 * var(--rem))", "font-size": "16px" } }, [i("div", { staticStyle: { "font-size": "1.25em", "font-weight": "700", "margin-bottom": "0.25em", "text-align": "center" } }, [e._v(" " + e._s(e.$t("_common:reminder_plural").capitalize()) + " ")]), i("div", { staticClass: "text-center text-gray-600", staticStyle: { "max-width": "calc(20 * var(--rem))", margin: "0 auto calc(2 * var(--rem)) auto" } }, [e._v(" " + e._s(e.$t("description")) + " ")]), e._l([
690
+ { type: "notViewed", fallbackKey: "viewed" },
691
+ { type: "notAnswered", fallbackKey: "reminder" },
692
+ { type: "expires", fallbackKey: "expires" }
693
+ ], function(s, n) {
694
+ return i("DocumentSendReminderItem", { key: n, attrs: { label: e.$t(s.type), value: e.reminders[s.type] ? e.reminders[s.type].sendDays : 0, done: e.reminders[s.type] && e.reminders[s.type].status === "successful" }, on: { input: function(a) {
695
+ return e.setReminder(e.reminders[s.type] || s.fallbackKey, a);
696
+ } } });
697
+ }), i("div", { staticClass: "flex w-full items-center justify-center", staticStyle: { "margin-top": "calc(2.5 * var(--rem))" } }, [i("CButton", { attrs: { type: "secondary", expanded: "" }, on: { click: function(s) {
698
+ return e.$emit("close");
699
+ } } }, [e._v(" " + e._s(e.$t("_common:save")) + " ")])], 1)], 2);
700
+ }, Ie = [], Pe = /* @__PURE__ */ o(
701
+ Oe,
702
+ Be,
703
+ Ie,
704
+ !1,
705
+ null,
706
+ null
707
+ );
708
+ const Te = Pe.exports, Re = {
709
+ name: "SendForm",
710
+ i18nOptions: {
711
+ namespaces: "sendForm",
712
+ messages: ce
713
+ },
714
+ components: {
715
+ Simplebar: U,
716
+ BaseDatePicker: M,
717
+ RecipientBlock: $e,
718
+ ErrorCallout: X,
719
+ IsPremiumPreStep: L,
720
+ IsPremium: H
721
+ },
722
+ mixins: [
723
+ m(
724
+ ["expiresAt", "clients", "defaultAnswerMethod", "reminders", "name"],
725
+ {
726
+ useEmit: !1,
727
+ setFnName: "setFormValue"
728
+ }
729
+ )
730
+ ],
731
+ props: {
732
+ showName: {
733
+ type: Boolean,
734
+ default: !0
735
+ },
736
+ showSave: {
737
+ type: Boolean,
738
+ default: !0
739
+ },
740
+ showSchedule: {
741
+ type: Boolean,
742
+ default: !0
743
+ },
744
+ allowManualDelivery: {
745
+ type: Boolean,
746
+ default: !0
747
+ },
748
+ allowEditClients: {
749
+ type: Boolean,
750
+ default: !0
751
+ },
752
+ setFormValue: {
753
+ type: Function,
754
+ required: !0
755
+ },
756
+ removeFormValue: {
757
+ type: Function,
758
+ required: !0
759
+ },
760
+ useScroll: {
761
+ type: Boolean,
762
+ default: !1
763
+ },
764
+ onSaveDocument: {
765
+ type: Function,
766
+ required: !0
767
+ }
768
+ },
769
+ data() {
770
+ return {
771
+ localIsPosting: !1,
772
+ clientHoverIndex: null
773
+ };
774
+ },
775
+ computed: {
776
+ ...g({
777
+ deliveryTypes: "forms/deliveryTypes",
778
+ isPostingDocument: "documents2/isPosting",
779
+ documentSenderSign: "settings/documentSenderSign",
780
+ // todo: could be moved to load form action
781
+ getCompanySetting: "settings/getCompanySetting",
782
+ feature: "application/feature"
783
+ }),
784
+ isPosting() {
785
+ return this.isPostingDocument || this.localIsPosting;
786
+ },
787
+ isPublicForm() {
788
+ return !!(this.viewSettings && this.viewSettings.isPublicForm);
789
+ },
790
+ useSignOrder() {
791
+ var t;
792
+ return ((t = this._document) == null ? void 0 : t.useSignOrder) || !1;
793
+ },
794
+ noOfReminders() {
795
+ return Object.values(this.reminders || []).reduce(
796
+ (t, e) => e && (e.sendDays || e.sendAt) && e.type !== "first" ? t + 1 : t,
797
+ 0
798
+ );
799
+ },
800
+ smsActivated() {
801
+ return this.deliveryTypes.sms;
802
+ },
803
+ emailActivated() {
804
+ return this.deliveryTypes.email;
805
+ },
806
+ isManualDelivery() {
807
+ return !this.smsActivated && !this.emailActivated;
808
+ },
809
+ sendTypesText() {
810
+ return this.emailActivated || this.smsActivated ? [
811
+ ...this.emailActivated ? [this.$t("_common:email").capitalize()] : [],
812
+ ...this.smsActivated ? [this.$t("_common:sms")] : []
813
+ ].join(" & ") : this._document.isDirty("isManualDelivery") && this.clients.length ? this.$t("manualDelivery") : " ";
814
+ },
815
+ clientsAreMissingContactInfo() {
816
+ return this.isManualDelivery ? !1 : this.clients.some((t) => !(t.email || t.cellphone));
817
+ },
818
+ signMethods() {
819
+ var t, e;
820
+ return ((e = (t = this._document.signOptions) == null ? void 0 : t.filter((i) => i !== "inPerson")) == null ? void 0 : e.map((i) => ({
821
+ value: i,
822
+ title: this.$t(`signMethod.${i}.title`),
823
+ content: this.$t(`signMethod.${i}.content`)
824
+ }))) || [];
825
+ }
826
+ },
827
+ created() {
828
+ var t;
829
+ if (!this.expiresAt && !this._document.isDirty("expiresAt")) {
830
+ const e = this.getCompanySetting("defaultExpireDays");
831
+ if (e && Number.isInteger(e) && e > 0) {
832
+ const i = /* @__PURE__ */ new Date();
833
+ i.setDate(i.getDate() + e), this.setField({
834
+ field: "expiresAt",
835
+ value: i.toISOString(),
836
+ options: { ignoreChanges: !0 }
837
+ });
838
+ }
839
+ }
840
+ if (((t = this.defaultAnswerMethod) == null ? void 0 : t.accept) === "button") {
841
+ const [e] = this._document.signOptions || ["signature"];
842
+ this.setAnswerMethod(e, { ignoreChanges: !0 });
843
+ }
844
+ },
845
+ validations() {
846
+ const t = {
847
+ clients: {
848
+ required: (e) => e && e.length
849
+ }
850
+ };
851
+ return !this.allowManualDelivery && this.clients.length && (t.isManualDelivery = {
852
+ checked: (e) => !e
853
+ }), t;
854
+ },
855
+ methods: {
856
+ async doSaveDocument({ doSend: t }) {
857
+ try {
858
+ this.localIsPosting = !0, await this.onSaveDocument({ doSend: t });
859
+ } finally {
860
+ this.localIsPosting = !1;
861
+ }
862
+ },
863
+ async doSendDocument() {
864
+ var t;
865
+ this.$v.$touch(), !this.$v.$invalid && (["denied", "expired", "voided"].includes((t = this._document) == null ? void 0 : t.status) && this.resetDeniedDocument(), await this.doSaveDocument({ doSend: !0 }));
866
+ },
867
+ setDeliveryMethod(t, e) {
868
+ const i = this.deliveryTypes;
869
+ i[t] = e;
870
+ const s = Object.keys(i).filter((n) => i[n]);
871
+ (this.clients || []).forEach((n, a) => {
872
+ this.setFormValue({
873
+ key: `clients[${a}].deliveryTypes`,
874
+ value: s
875
+ });
876
+ });
877
+ },
878
+ setAnswerMethod(t, e = {}) {
879
+ this.setField({
880
+ field: "defaultAnswerMethod",
881
+ value: { ...this.defaultAnswerMethod, accept: t },
882
+ options: e
883
+ }), (this.clients || []).forEach((i, s) => {
884
+ var n;
885
+ ((n = i.answerMethod) == null ? void 0 : n.accept) !== "inPerson" && this.setField({
886
+ key: `clients[${s}].answerMethod.accept`,
887
+ value: t,
888
+ options: e
889
+ });
890
+ });
891
+ },
892
+ openReminders() {
893
+ this.useSignOrder || this.$modal.show(
894
+ Te,
895
+ {
896
+ _document: this._document,
897
+ setFormValue: this.setFormValue,
898
+ removeFormValue: this.removeFormValue
899
+ },
900
+ {
901
+ adaptive: !0,
902
+ height: "auto",
903
+ width: "90%",
904
+ maxWidth: 360
905
+ }
906
+ );
907
+ },
908
+ openSendLater() {
909
+ this.$v.$touch(), !this.$v.$invalid && this.$modal.show(
910
+ de,
911
+ {
912
+ _document: this._document,
913
+ setFormValue: this.setFormValue,
914
+ removeFormValue: this.removeFormValue,
915
+ onSaveDocument: this.doSaveDocument
916
+ },
917
+ {
918
+ adaptive: !0,
919
+ height: "auto",
920
+ width: "90%",
921
+ maxWidth: 360
922
+ }
923
+ );
924
+ },
925
+ resetDeniedDocument() {
926
+ (this.clients || []).forEach((t, e) => {
927
+ this.setFormValue({ key: `clients[${e}].answer`, value: null });
928
+ }), this.setFormValue({ key: "data.rejectReasons", value: [] }), this.setFormValue({ key: "status", value: "sent" });
929
+ },
930
+ shouldShowUpgradeModal({ canUseBankId: t, canUseSms: e }) {
931
+ var i;
932
+ return !!(this.smsActivated && !e || ((i = this.defaultAnswerMethod) == null ? void 0 : i.accept) === "bankId" && !t);
933
+ }
934
+ }
935
+ };
936
+ var Me = function() {
937
+ var e = this, i = e._self._c;
938
+ return i("IsPremium", { scopedSlots: e._u([{ key: "default", fn: function({ canUseBankId: s, canUseSms: n }) {
939
+ var a;
940
+ return [i("div", { staticClass: "@container flex h-full flex-col" }, [i(e.useScroll ? "Simplebar" : "div", { tag: "component", staticClass: "main-container" }, [i("div", { staticClass: "@md:px-8 @md:pb-8 @xl:px-16 @xl:pb-16 relative px-4 pb-4 pt-6" }, [i("div", { staticClass: "pb-4 text-lg font-bold" }, [e._v(" " + e._s(e.$t("title")) + " ")]), e.showName ? i("div", { staticClass: "mb-6" }, [i("div", { staticClass: "pb-0.5 text-xs font-medium text-gray-900" }, [e._v(" " + e._s(e.$t("nameLabel")) + " ")]), i("CInput", { attrs: { placeholder: e.$t("namePlaceholder"), filled: "" }, model: { value: e.name, callback: function(r) {
941
+ e.name = r;
942
+ }, expression: "name" } })], 1) : e._e(), i("div", { staticClass: "mb-6" }, [i("RecipientBlock", { attrs: { _value: {
943
+ clients: "clients"
944
+ }, _document: e._document, "set-form-value": e.setFormValue, "remove-form-value": e.removeFormValue, "default-add-sender-client": e.documentSenderSign, "allow-edit-clients": e.allowEditClients, "is-public-form": e.isPublicForm } })], 1), e._t("default"), e.defaultAnswerMethod && e.signMethods.length > 1 ? i("div", { staticClass: "mb-8" }, [i("div", { staticClass: "block-title pb-0.5 text-xs font-medium text-gray-900" }, [e._v(" " + e._s(e.$t("signMethod.title")) + " "), i("CIcon", { directives: [{ name: "tooltip", rawName: "v-tooltip", value: e.$t("signMethod.tooltip"), expression: "$t('signMethod.tooltip')" }], staticClass: "ml-px text-gray-500", attrs: { type: "info", size: "14" } })], 1), i("div", { staticClass: "cb-card-group" }, e._l(e.signMethods, function(r) {
945
+ return i("div", { key: r.value, staticClass: "cb-card flex border-2 border-transparent hover:border-gray-300/30 hover:bg-gray-200", class: {
946
+ checked: e.defaultAnswerMethod.accept === r.value
947
+ }, on: { click: function(d) {
948
+ e.defaultAnswerMethod.accept !== r.value && e.setAnswerMethod(r.value);
949
+ } } }, [i("CRadio", { staticClass: "sign-radio pointer-events-none mr-3", attrs: { value: e.defaultAnswerMethod.accept, "native-value": r.value, type: "secondary", size: "small" } }), i("div", { staticClass: "flex-grow" }, [i("div", { staticClass: "cb-card-title flex items-center justify-between" }, [e._v(" " + e._s(r.title) + " "), r.value === "bankId" && !s ? i("div", { staticClass: "bg-primary-500 ml-2 rounded-full px-1.5 py-1 text-[10px] font-semibold leading-none text-white" }, [e._v(" Pro ")]) : e._e()]), i("div", { directives: [{ name: "show", rawName: "v-show", value: e.defaultAnswerMethod.accept === r.value, expression: "defaultAnswerMethod.accept === signMethod.value" }], staticClass: "cb-card-body" }, [e._v(" " + e._s(r.content) + " ")])])], 1);
950
+ }), 0)]) : e._e(), i("div", { staticClass: "grid items-center gap-2", staticStyle: { "grid-template-columns": "repeat(auto-fit, minmax(200px, 1fr))" } }, [i("div", [i("BaseDatePicker", { staticClass: "psuedo-input relative", attrs: { "custom-el": !0, direction: "end", tabindex: "0" }, model: { value: e.expiresAt, callback: function(r) {
951
+ e.expiresAt = r;
952
+ }, expression: "expiresAt" } }, [i("div", { staticClass: "psuedo-input-label" }, [e._v(e._s(e.$t("validityPeriod")))]), i("div", [e._v(" " + e._s(e.expiresAt ? e.$formatDate(e.expiresAt) : e.$t("_common:disabled").capitalize()) + " ")]), e.expiresAt ? i("CButton", { staticClass: "absolute right-3 top-3 z-10", attrs: { icon: "x", size: "small", type: "none", pattern: "secondary" }, on: { click: function(r) {
953
+ r.preventDefault(), r.stopPropagation(), e.expiresAt = void 0, e._document.setDirty("expiresAt");
954
+ } } }) : e._e()], 1)], 1), i("CDropdown", { staticStyle: { flex: "1 0 200px" }, attrs: { disabled: !e.clients.length, "mobile-label": e.$t("sendAs"), expanded: "" } }, [i("div", { staticClass: "psuedo-input", attrs: { slot: "trigger", tabindex: "0" }, slot: "trigger" }, [i("div", { staticClass: "psuedo-input-label" }, [e._v(e._s(e.$t("sendAs")))]), i("div", { domProps: { innerHTML: e._s(e.sendTypesText) } })]), i("CDropdownItem", { attrs: { value: e.emailActivated, "close-on-click": !1, toggle: "" }, on: { click: function(r) {
955
+ return e.setDeliveryMethod("email", !e.emailActivated);
956
+ } } }, [e._v(" " + e._s(e.$t("_common:email").capitalize()) + " ")]), e.feature("sms") ? i("CDropdownItem", { attrs: { value: e.smsActivated, "close-on-click": !1, toggle: "" }, on: { click: function(r) {
957
+ return e.setDeliveryMethod("sms", !e.smsActivated);
958
+ } } }, [e._v(" " + e._s(e.$t("_common:sms")) + " "), n ? e._e() : i("div", { staticClass: "bg-primary-500 ml-2 rounded-full px-1.5 py-1 text-[10px] font-semibold leading-none text-white" }, [e._v(" Pro ")])]) : e._e(), e.allowManualDelivery ? i("CDropdownItem", { attrs: { value: "", tooltip: {
959
+ content: e.$t("manualDeliveryTooltip")
960
+ } }, domProps: { textContent: e._s(e.$t("manualDelivery")) }, on: { click: () => {
961
+ e.setDeliveryMethod("sms", !1), e.setDeliveryMethod("email", !1), e._document.setDirty("isManualDelivery");
962
+ } } }) : e._e()], 1), !e.useSignOrder && !e.isManualDelivery ? i("div", { staticClass: "psuedo-input relative", attrs: { tabindex: "0" }, on: { click: e.openReminders } }, [i("div", { staticClass: "psuedo-input-label" }, [e._v(" " + e._s(e.$t("_common:reminder_plural").capitalize()) + " ")]), i("div", [e._v(" " + e._s(e.noOfReminders ? `${e.noOfReminders} ${e.$i18n.lang === "sv" ? e.$t("_common:unitType.unit") : ""}` : e.$t("_common:disabled").capitalize()) + " ")]), e.noOfReminders ? i("CButton", { staticClass: "absolute right-3 top-3", attrs: { icon: "x", size: "small", type: "none", pattern: "secondary" }, on: { click: function(r) {
963
+ r.preventDefault(), r.stopPropagation(), e.reminders = [];
964
+ } } }) : e._e()], 1) : e._e()], 1), e.clientsAreMissingContactInfo || (a = e.$v.isManualDelivery) != null && a.$invalid ? i("ErrorCallout", { attrs: { message: e.clientsAreMissingContactInfo ? e.$t("clientsAreMissingContactInfo") : e.$t("missingDeliveryMethod"), size: "small" } }) : e._e(), e._t("content")], 2)]), i("div", { staticClass: "@md:px-8 @xl:px-16 px-4 pb-4" }, [e._t("send", function() {
965
+ return [i("IsPremiumPreStep", { attrs: { feature: "bankIdAndSms" }, scopedSlots: e._u([{ key: "default", fn: function({ onClick: r }) {
966
+ return [i("div", { staticClass: "flex" }, [e.showSave ? i("CButton", { directives: [{ name: "tooltip", rawName: "v-tooltip", value: e.$t("_common:save", {
967
+ thing: e.$t("_common:document").toLowerCase()
968
+ }), expression: `
969
+ $t('_common:save', {
970
+ thing: $t('_common:document').toLowerCase()
971
+ })
972
+ ` }], staticClass: "mr-2 w-12", attrs: { loading: e.isPosting, type: "none", icon: "save", pattern: "secondary" }, on: { click: function(d) {
973
+ return e.doSaveDocument({ doSend: !1 });
974
+ } } }) : e._e(), e.showSchedule && !e.useSignOrder && !e.isManualDelivery ? i("CButton", { staticClass: "@md:w-auto mr-2 w-12", staticStyle: { padding: "14px 16px", "border-radius": "8px", height: "initial", "font-size": "14px", "font-weight": "600" }, attrs: { disabled: e.isPosting || !e.clients.length, type: "none", pattern: "secondary" }, on: { click: e.openSendLater } }, [i("span", { staticClass: "@md:!block !hidden", domProps: { textContent: e._s(e.$t("scheduledTooltip")) } }), i("CIcon", { staticClass: "@md:!hidden", attrs: { type: "calendar", size: "16" } })], 1) : e._e(), i("div", { directives: [{ name: "tooltip", rawName: "v-tooltip", value: e.$v.$invalid ? {
975
+ content: e.clients.length ? e.$t("missingDeliveryMethod") : e.$t(
976
+ "components:account.documentForm.clients.errorMessage"
977
+ )
978
+ } : {}, expression: `
979
+ $v.$invalid
980
+ ? {
981
+ content: !clients.length
982
+ ? $t(
983
+ 'components:account.documentForm.clients.errorMessage'
984
+ )
985
+ : $t('missingDeliveryMethod')
986
+ }
987
+ : {}
988
+ ` }], staticClass: "flex-auto" }, [i("CButton", { staticStyle: { padding: "14px 16px", "border-radius": "8px", height: "100%", "font-size": "14px", "font-weight": "600", "box-shadow": "0 2px 4px -1px rgba(0, 0, 0, 0.1)" }, attrs: { disabled: e.$v.$invalid, loading: e.isPosting, type: "secondary", wide: "" }, on: { click: function(d) {
989
+ e.shouldShowUpgradeModal({ canUseBankId: s, canUseSms: n }) ? r({
990
+ data: {
991
+ bankIdBlocked: !s,
992
+ smsBlocked: !n
993
+ }
994
+ }) : e.doSendDocument();
995
+ } } }, [e._v(" " + e._s(e.$t("sendButton")) + " ")])], 1)], 1)];
996
+ } }], null, !0) })];
997
+ }), e._t("footer")], 2)], 1)];
998
+ } }], null, !0) });
999
+ }, ze = [], Ee = /* @__PURE__ */ o(
1000
+ Re,
1001
+ Me,
1002
+ ze,
1003
+ !1,
1004
+ null,
1005
+ "7ec7fd0b"
1006
+ );
1007
+ const ii = Ee.exports, Ne = {
1008
+ name: "CAutocomplete",
1009
+ components: {
1010
+ CInput: I
1011
+ },
1012
+ mixins: [P],
1013
+ inheritAttrs: !1,
1014
+ props: {
1015
+ value: {
1016
+ type: [Number, String],
1017
+ default: null
1018
+ },
1019
+ data: {
1020
+ type: Array,
1021
+ default: () => []
1022
+ },
1023
+ field: {
1024
+ type: String,
1025
+ default: "value"
1026
+ },
1027
+ keepFirst: Boolean,
1028
+ clearOnSelect: Boolean,
1029
+ openOnFocus: Boolean,
1030
+ customFormatter: {
1031
+ type: Function,
1032
+ default: () => {
1033
+ }
1034
+ },
1035
+ checkInfiniteScroll: Boolean,
1036
+ keepOpen: Boolean,
1037
+ clearable: Boolean,
1038
+ maxHeight: {
1039
+ type: [String, Number],
1040
+ default: null
1041
+ },
1042
+ dropdownPosition: {
1043
+ type: String,
1044
+ default: "auto"
1045
+ },
1046
+ iconRight: {
1047
+ type: String,
1048
+ default: null
1049
+ },
1050
+ iconRightClickable: Boolean,
1051
+ appendToBody: Boolean
1052
+ },
1053
+ data() {
1054
+ return {
1055
+ selected: null,
1056
+ hovered: null,
1057
+ isActive: !1,
1058
+ newValue: this.value,
1059
+ newAutocomplete: this.autocomplete || "off",
1060
+ isListInViewportVertically: !0,
1061
+ hasFocus: !1,
1062
+ style: {},
1063
+ _isAutocomplete: !0,
1064
+ _elementRef: "input",
1065
+ _bodyEl: void 0
1066
+ // Used to append to body
1067
+ };
1068
+ },
1069
+ computed: {
1070
+ /**
1071
+ * White-listed items to not close when clicked.
1072
+ * Add input, dropdown and all children.
1073
+ */
1074
+ whiteList() {
1075
+ const t = [];
1076
+ if (t.push(this.$refs.input.$el.querySelector("input")), t.push(this.$refs.dropdown), this.$refs.dropdown !== void 0) {
1077
+ const e = this.$refs.dropdown.querySelectorAll("*");
1078
+ for (const i of e)
1079
+ t.push(i);
1080
+ }
1081
+ if (this.$parent.$data._isTaginput) {
1082
+ t.push(this.$parent.$el);
1083
+ const e = this.$parent.$el.querySelectorAll("*");
1084
+ for (const i of e)
1085
+ t.push(i);
1086
+ }
1087
+ return t;
1088
+ },
1089
+ /**
1090
+ * Check if exists default slot
1091
+ */
1092
+ hasDefaultSlot() {
1093
+ return !!this.$scopedSlots.default;
1094
+ },
1095
+ /**
1096
+ * Check if exists "empty" slot
1097
+ */
1098
+ hasEmptySlot() {
1099
+ return !!this.$slots.empty;
1100
+ },
1101
+ /**
1102
+ * Check if exists "header" slot
1103
+ */
1104
+ hasHeaderSlot() {
1105
+ return !!this.$slots.header;
1106
+ },
1107
+ /**
1108
+ * Check if exists "footer" slot
1109
+ */
1110
+ hasFooterSlot() {
1111
+ return !!this.$slots.footer;
1112
+ },
1113
+ /**
1114
+ * Apply dropdownPosition property
1115
+ */
1116
+ isOpenedTop() {
1117
+ return this.dropdownPosition === "top" || this.dropdownPosition === "auto" && !this.isListInViewportVertically;
1118
+ },
1119
+ newIconRight() {
1120
+ return this.clearable && this.newValue ? "close-circle" : this.iconRight;
1121
+ },
1122
+ newIconRightClickable() {
1123
+ return this.clearable ? !0 : this.iconRightClickable;
1124
+ },
1125
+ contentStyle() {
1126
+ return {
1127
+ maxHeight: this.maxHeight === void 0 ? null : isNaN(this.maxHeight) ? this.maxHeight : `${this.maxHeight}px`
1128
+ };
1129
+ },
1130
+ isDropdownOpen() {
1131
+ return this.isActive && (this.data.length > 0 || this.hasEmptySlot || this.hasHeaderSlot);
1132
+ }
1133
+ },
1134
+ watch: {
1135
+ /**
1136
+ * When dropdown is toggled, check the visibility to know when
1137
+ * to open upwards.
1138
+ */
1139
+ isActive(t) {
1140
+ this.dropdownPosition === "auto" && (t ? this.calcDropdownInViewportVertical() : setTimeout(() => {
1141
+ this.calcDropdownInViewportVertical();
1142
+ }, 100)), t && this.$nextTick(() => this.setHovered(null));
1143
+ },
1144
+ /**
1145
+ * When updating input's value
1146
+ * 1. Emit changes
1147
+ * 2. If value isn't the same as selected, set null
1148
+ * 3. Close dropdown if value is clear or else open it
1149
+ */
1150
+ newValue(t) {
1151
+ this.$emit("input", t);
1152
+ const e = this.getValue(this.selected);
1153
+ e && e !== t && this.setSelected(null, !1), this.hasFocus && (!this.openOnFocus || t) && (this.isActive = !!t);
1154
+ },
1155
+ /**
1156
+ * When v-model is changed:
1157
+ * 1. Update internal value.
1158
+ * 2. If it's invalid, validate again.
1159
+ */
1160
+ value(t) {
1161
+ this.newValue = t;
1162
+ },
1163
+ /**
1164
+ * Select first option if "keep-first
1165
+ */
1166
+ data(t) {
1167
+ this.keepFirst && this.selectFirstOption(t);
1168
+ }
1169
+ },
1170
+ created() {
1171
+ typeof window < "u" && (document.addEventListener("click", this.clickedOutside), this.dropdownPosition === "auto" && window.addEventListener("resize", this.calcDropdownInViewportVertical));
1172
+ },
1173
+ mounted() {
1174
+ if (this.checkInfiniteScroll && this.$refs.dropdown && this.$refs.dropdown.querySelector(".dropdown-content")) {
1175
+ const t = this.$refs.dropdown.querySelector(".dropdown-content");
1176
+ t.addEventListener(
1177
+ "scroll",
1178
+ () => this.checkIfReachedTheEndOfScroll(t)
1179
+ );
1180
+ }
1181
+ this.appendToBody && (this.$data._bodyEl = Z(this.$refs.dropdown), this.updateAppendToBody());
1182
+ },
1183
+ beforeDestroy() {
1184
+ typeof window < "u" && (document.removeEventListener("click", this.clickedOutside), this.dropdownPosition === "auto" && window.removeEventListener(
1185
+ "resize",
1186
+ this.calcDropdownInViewportVertical
1187
+ )), this.checkInfiniteScroll && this.$refs.dropdown && this.$refs.dropdown.querySelector(".dropdown-content") && this.$refs.dropdown.querySelector(".dropdown-content").removeEventListener("scroll", this.checkIfReachedTheEndOfScroll), this.appendToBody && ee(this.$data._bodyEl);
1188
+ },
1189
+ methods: {
1190
+ /**
1191
+ * Set which option is currently hovered.
1192
+ */
1193
+ setHovered(t) {
1194
+ t !== void 0 && (this.hovered = t);
1195
+ },
1196
+ /**
1197
+ * Set which option is currently selected, update v-model,
1198
+ * update input value and close dropdown.
1199
+ */
1200
+ setSelected(t, e = !0) {
1201
+ t !== void 0 && (this.selected = t, this.$emit("select", this.selected), this.selected !== null && (this.newValue = this.clearOnSelect ? "" : this.getValue(this.selected), this.setHovered(this.clearOnSelect ? null : this.hovered)), e && this.$nextTick(() => {
1202
+ this.isActive = !1;
1203
+ }), this.checkValidity());
1204
+ },
1205
+ /**
1206
+ * Select first option
1207
+ */
1208
+ selectFirstOption(t) {
1209
+ this.$nextTick(() => {
1210
+ t.length ? (this.openOnFocus || this.newValue !== "" && this.hovered !== t[0]) && this.setHovered(t[0]) : this.setHovered(null);
1211
+ });
1212
+ },
1213
+ /**
1214
+ * Enter key listener.
1215
+ * Select the hovered option.
1216
+ */
1217
+ enterPressed(t) {
1218
+ this.isDropdownOpen && (t.preventDefault(), this.hovered !== null && this.setSelected(this.hovered, !this.keepOpen));
1219
+ },
1220
+ /**
1221
+ * Tab key listener.
1222
+ * Select hovered option if it exists, close dropdown, then allow
1223
+ * native handling to move to next tabbable element.
1224
+ */
1225
+ tabPressed() {
1226
+ if (this.hovered === null) {
1227
+ this.isActive = !1;
1228
+ return;
1229
+ }
1230
+ this.setSelected(this.hovered, !this.keepOpen);
1231
+ },
1232
+ /**
1233
+ * Close dropdown if clicked outside.
1234
+ */
1235
+ clickedOutside(t) {
1236
+ var i;
1237
+ const e = ((i = t.path) == null ? void 0 : i[0]) || t.target;
1238
+ this.whiteList.indexOf(e) < 0 && (this.isActive = !1);
1239
+ },
1240
+ /**
1241
+ * Return display text for the input.
1242
+ * If object, get value from path, or else just the value.
1243
+ */
1244
+ getValue(t) {
1245
+ if (t !== null)
1246
+ return typeof this.customFormatter < "u" ? this.customFormatter(t) : typeof t == "object" ? te(t, this.field) : t;
1247
+ },
1248
+ /**
1249
+ * Check if the scroll list inside the dropdown
1250
+ * reached it's end.
1251
+ */
1252
+ checkIfReachedTheEndOfScroll(t) {
1253
+ t.clientHeight !== t.scrollHeight && t.scrollTop + t.clientHeight >= t.scrollHeight && this.$emit("infinite-scroll");
1254
+ },
1255
+ /**
1256
+ * Calculate if the dropdown is vertically visible when activated,
1257
+ * otherwise it is openened upwards.
1258
+ */
1259
+ calcDropdownInViewportVertical() {
1260
+ this.$nextTick(() => {
1261
+ if (this.$refs.dropdown === void 0)
1262
+ return;
1263
+ const t = this.$refs.dropdown.getBoundingClientRect();
1264
+ this.isListInViewportVertically = t.top >= 0 && t.bottom <= (window.innerHeight || document.documentElement.clientHeight), this.appendToBody && this.updateAppendToBody();
1265
+ });
1266
+ },
1267
+ /**
1268
+ * Arrows keys listener.
1269
+ * If dropdown is active, set hovered option, or else just open.
1270
+ */
1271
+ keyArrows(t) {
1272
+ const e = t === "down" ? 1 : -1;
1273
+ if (this.isActive) {
1274
+ let i = this.data.indexOf(this.hovered) + e;
1275
+ i = i > this.data.length - 1 ? this.data.length : i, i = i < 0 ? 0 : i, this.setHovered(this.data[i]);
1276
+ const s = this.$refs.dropdown.querySelector(".dropdown-content"), n = s.querySelectorAll(
1277
+ "a.dropdown-item:not(.is-disabled)"
1278
+ )[i];
1279
+ if (!n)
1280
+ return;
1281
+ const a = s.scrollTop, r = s.scrollTop + s.clientHeight - n.clientHeight;
1282
+ n.offsetTop < a ? s.scrollTop = n.offsetTop : n.offsetTop >= r && (s.scrollTop = n.offsetTop - s.clientHeight + n.clientHeight);
1283
+ } else
1284
+ this.isActive = !0;
1285
+ },
1286
+ /**
1287
+ * Focus listener.
1288
+ * If value is the same as selected, select all text.
1289
+ */
1290
+ focused(t) {
1291
+ this.getValue(this.selected) === this.newValue && this.$el.querySelector("input").select(), this.openOnFocus && (this.isActive = !0, this.keepFirst && this.selectFirstOption(this.data)), this.hasFocus = !0, this.$emit("focus", t);
1292
+ },
1293
+ /**
1294
+ * Blur listener.
1295
+ */
1296
+ onBlur(t) {
1297
+ this.hasFocus = !1, this.$emit("blur", t);
1298
+ },
1299
+ onInput() {
1300
+ const t = this.getValue(this.selected);
1301
+ t && t === this.newValue || (this.$emit("typing", this.newValue), this.checkValidity());
1302
+ },
1303
+ rightIconClick(t) {
1304
+ this.clearable ? this.newValue = "" : this.$emit("icon-right-click", t);
1305
+ },
1306
+ checkValidity() {
1307
+ this.useHtml5Validation && this.$nextTick(() => {
1308
+ this.checkHtml5Validity();
1309
+ });
1310
+ },
1311
+ updateAppendToBody() {
1312
+ const t = this.$refs.dropdown, e = this.$refs.input.$el;
1313
+ if (t && e) {
1314
+ const i = this.$data._bodyEl;
1315
+ i.classList.forEach((r) => i.classList.remove(r)), i.classList.add("autocomplete"), i.classList.add("control"), this.expandend && i.classList.add("is-expandend");
1316
+ const s = e.getBoundingClientRect();
1317
+ let n = s.top + window.scrollY;
1318
+ const a = s.left + window.scrollX;
1319
+ this.isOpenedTop ? n -= t.clientHeight : n += e.clientHeight, this.style = {
1320
+ position: "absolute",
1321
+ top: `${n}px`,
1322
+ left: `${a}px`,
1323
+ width: `${e.clientWidth}px`,
1324
+ maxWidth: `${e.clientWidth}px`,
1325
+ zIndex: "99"
1326
+ };
1327
+ }
1328
+ }
1329
+ }
1330
+ };
1331
+ var Le = function() {
1332
+ var e = this, i = e._self._c;
1333
+ return i("div", { staticClass: "autocomplete control", class: { "is-expanded": e.expanded } }, [i("CInput", e._b({ ref: "input", attrs: { size: e.size, loading: e.loading, rounded: e.rounded, icon: e.icon, "icon-right": e.newIconRight, "icon-right-clickable": e.newIconRightClickable, "icon-pack": e.iconPack, maxlength: e.maxlength, autocomplete: e.newAutocomplete, "use-html5-validation": !1, type: "text" }, on: { input: e.onInput, focus: e.focused, blur: e.onBlur, "icon-right-click": e.rightIconClick, "icon-click": (s) => e.$emit("icon-click", s) }, nativeOn: { keyup: function(s) {
1334
+ if (!s.type.indexOf("key") && e._k(s.keyCode, "esc", 27, s.key, ["Esc", "Escape"]))
1335
+ return null;
1336
+ s.preventDefault(), e.isActive = !1;
1337
+ }, keydown: [function(s) {
1338
+ return !s.type.indexOf("key") && e._k(s.keyCode, "tab", 9, s.key, "Tab") ? null : e.tabPressed.apply(null, arguments);
1339
+ }, function(s) {
1340
+ return !s.type.indexOf("key") && e._k(s.keyCode, "enter", 13, s.key, "Enter") ? null : e.enterPressed.apply(null, arguments);
1341
+ }, function(s) {
1342
+ return !s.type.indexOf("key") && e._k(s.keyCode, "up", 38, s.key, ["Up", "ArrowUp"]) ? null : (s.preventDefault(), e.keyArrows("up"));
1343
+ }, function(s) {
1344
+ return !s.type.indexOf("key") && e._k(s.keyCode, "down", 40, s.key, ["Down", "ArrowDown"]) ? null : (s.preventDefault(), e.keyArrows("down"));
1345
+ }] }, model: { value: e.newValue, callback: function(s) {
1346
+ e.newValue = s;
1347
+ }, expression: "newValue" } }, "CInput", e.$attrs, !1)), i("transition", { attrs: { name: "fade" } }, [i("div", { directives: [{ name: "show", rawName: "v-show", value: e.isDropdownOpen, expression: "isDropdownOpen" }], ref: "dropdown", staticClass: "dropdown-menu", class: { "is-opened-top": e.isOpenedTop && !e.appendToBody }, style: e.style }, [i("div", { directives: [{ name: "show", rawName: "v-show", value: e.isActive, expression: "isActive" }], staticClass: "dropdown-content", style: e.contentStyle }, [e.hasHeaderSlot ? i("div", { staticClass: "dropdown-item" }, [e._t("header")], 2) : e._e(), e._l(e.data, function(s, n) {
1348
+ return i("a", { key: n, staticClass: "dropdown-item", class: { "is-hovered": s === e.hovered }, on: { click: function(a) {
1349
+ return e.setSelected(s, void 0, a);
1350
+ } } }, [e.hasDefaultSlot ? e._t("default", null, { option: s, index: n }) : i("span", [e._v(" " + e._s(e.getValue(s, !0)) + " ")])], 2);
1351
+ }), e.data.length === 0 && e.hasEmptySlot ? i("div", { staticClass: "dropdown-item is-disabled" }, [e._t("empty")], 2) : e._e(), e.hasFooterSlot ? i("div", { staticClass: "dropdown-item" }, [e._t("footer")], 2) : e._e()], 2)])])], 1);
1352
+ }, He = [], qe = /* @__PURE__ */ o(
1353
+ Ne,
1354
+ Le,
1355
+ He,
1356
+ !1,
1357
+ null,
1358
+ null
1359
+ );
1360
+ const je = qe.exports, Ke = {
1361
+ name: "CMessage",
1362
+ props: {
1363
+ type: {
1364
+ type: String,
1365
+ default: "secondary"
1366
+ },
1367
+ badge: {
1368
+ type: String,
1369
+ default: ""
1370
+ },
1371
+ text: {
1372
+ type: String,
1373
+ default: ""
1374
+ }
1375
+ }
1376
+ };
1377
+ var We = function(e, i) {
1378
+ return e("div", { class: [i.data.class, i.data.staticClass], staticStyle: { padding: "0.75em 1em", display: "flex", "align-items": "flex-start", "border-radius": "0.6em", "background-color": "hsl(var(--gray-color-100) / 1)" }, style: { ...i.data.staticStyle } }, [e("div", { class: [`has-background-${i.props.type}`], staticStyle: { display: "inline-block", padding: "0.5em", "border-radius": "0.45em", "font-weight": "700", color: "white", "line-height": "1", "font-size": "12px", "margin-right": "1.25em" } }, [i._v(" " + i._s(i.props.badge || i.parent.$t("components:cling.message.tip")) + " ")]), e("div", { staticStyle: { color: "hsl(0, 0%, 25%)" } }, [i.props.text ? [i._v(" " + i._s(i.props.text) + " ")] : i._e(), i._t("default")], 2)]);
1379
+ }, Xe = [], Ue = /* @__PURE__ */ o(
1380
+ Ke,
1381
+ We,
1382
+ Xe,
1383
+ !0,
1384
+ null,
1385
+ "9be3b227"
1386
+ );
1387
+ const w = Ue.exports, Qe = {
1388
+ name: "CPhoneInput",
1389
+ components: {
1390
+ Flag: Q,
1391
+ CInput: I,
1392
+ CDropdown: h,
1393
+ CDropdownItem: f,
1394
+ CButton: T,
1395
+ CField: ie,
1396
+ SmartList: ne
1397
+ },
1398
+ props: {
1399
+ value: {
1400
+ type: [String, Number],
1401
+ default: ""
1402
+ },
1403
+ region: {
1404
+ type: String,
1405
+ default: ""
1406
+ },
1407
+ // Region to fallback to if prefix is not found in value
1408
+ defaultRegion: {
1409
+ type: String,
1410
+ required: !0
1411
+ },
1412
+ label: {
1413
+ type: String,
1414
+ default: ""
1415
+ },
1416
+ labelPosition: {
1417
+ type: String,
1418
+ default: ""
1419
+ }
1420
+ },
1421
+ data() {
1422
+ return {
1423
+ internalPrefix: null,
1424
+ // Used to remember prefix when value is changed to empty
1425
+ searchQuery: ""
1426
+ };
1427
+ },
1428
+ computed: {
1429
+ defaultPrefix() {
1430
+ return l[this.internalRegion].callingCode;
1431
+ },
1432
+ currentRegion() {
1433
+ return this.getRegionByCallingCode(this.prefix);
1434
+ },
1435
+ internalRegion: {
1436
+ get() {
1437
+ if (this.region)
1438
+ return this.region;
1439
+ if (this.value) {
1440
+ const t = (Object.keys(l) || []).find(
1441
+ (e) => l[e].callingCode && this.value && this.value.startsWith(l[e].callingCode)
1442
+ );
1443
+ if (t)
1444
+ return t;
1445
+ }
1446
+ return this.internalPrefix ? this.getRegionByCallingCode(this.internalPrefix) : this.defaultRegion;
1447
+ },
1448
+ set(t) {
1449
+ this.$emit("update:region", t), this.updateValue({ prefix: l[t].callingCode });
1450
+ }
1451
+ },
1452
+ prefix() {
1453
+ if (!this.value)
1454
+ return this.internalPrefix || this.defaultPrefix;
1455
+ const t = (Object.keys(l) || []).find(
1456
+ (e) => l[e].callingCode && this.value && this.value.startsWith(l[e].callingCode)
1457
+ );
1458
+ return t ? l[t].callingCode : this.defaultPrefix;
1459
+ },
1460
+ phone: {
1461
+ get() {
1462
+ return this.prefix && this.value && this.value.startsWith(this.prefix) ? this.value.substring(this.prefix.length) : this.value;
1463
+ },
1464
+ set(t) {
1465
+ this.updateValue({ phone: t });
1466
+ }
1467
+ },
1468
+ sortedRegions() {
1469
+ return (Object.keys(l) || []).map((t) => ({
1470
+ key: t,
1471
+ title: `${l[t].name} (${t})`,
1472
+ callingCode: l[t].callingCode
1473
+ })).sort((t, e) => t.title.localeCompare(e.title));
1474
+ }
1475
+ },
1476
+ methods: {
1477
+ getRegionByCallingCode(t) {
1478
+ return t ? (Object.keys(l) || []).find(
1479
+ (i) => t === l[i].callingCode
1480
+ ) : null;
1481
+ },
1482
+ updateValue({ prefix: t, phone: e }) {
1483
+ const i = t !== void 0 ? t : this.prefix || "", s = e !== void 0 ? e : this.phone || "", n = `${i}${s}`;
1484
+ n !== i ? (this.$emit("input", n), this.region || this.$emit("update:region", this.internalRegion), this.internalPrefix = null) : (this.internalPrefix = i, this.$emit("input", ""));
1485
+ }
1486
+ }
1487
+ };
1488
+ var Ye = function() {
1489
+ var e = this, i = e._self._c;
1490
+ return i("CField", { staticClass: "has-addons", attrs: { expanded: "" } }, [i("div", { staticClass: "control" }, [i("SmartList", { attrs: { query: e.searchQuery, items: e.sortedRegions }, scopedSlots: e._u([{ key: "default", fn: function({ items: s }) {
1491
+ return [i("CDropdown", { staticClass: "control", staticStyle: { height: "100%" }, attrs: { size: e.$attrs.size, disabled: e.$attrs.disabled, "menu-styling": {
1492
+ maxWidth: "300px"
1493
+ }, scrollable: !0, position: "is-bottom-right", "max-height": "240px" }, model: { value: e.internalRegion, callback: function(n) {
1494
+ e.internalRegion = n;
1495
+ }, expression: "internalRegion" } }, [i("CButton", { staticStyle: { height: "100%" }, attrs: { slot: "trigger", size: e.$attrs.size, type: "none", pattern: "secondary" }, slot: "trigger" }, [i("Flag", { staticStyle: { "margin-right": "0.35em" }, attrs: { region: e.internalRegion } }), e._v(" " + e._s(e.prefix) + " ")], 1), i("CInput", { staticStyle: { "margin-bottom": "0.25em" }, attrs: { slot: "header", placeholder: e.$t("_common:search"), filled: "" }, slot: "header", model: { value: e.searchQuery, callback: function(n) {
1496
+ e.searchQuery = n;
1497
+ }, expression: "searchQuery" } }), e._l(s, function({ key: n, title: a, callingCode: r }) {
1498
+ return i("CDropdownItem", { key: n, staticClass: "truncate-text", attrs: { value: n } }, [i("Flag", { staticStyle: { "margin-right": "0.75em", flex: "0 0 auto" }, attrs: { region: n, title: a } }), i("span", { staticClass: "truncate-text" }, [e._v(" " + e._s(a) + " (" + e._s(r) + ") ")])], 1);
1499
+ })], 2)];
1500
+ } }]) })], 1), i("CField", { staticClass: "control", attrs: { label: e.label, "label-position": e.labelPosition, expanded: "" } }, [i("CInput", e._b({ attrs: { size: e.$attrs.size, placeholder: e.$attrs.placeholder, type: "tel" }, model: { value: e.phone, callback: function(s) {
1501
+ e.phone = s;
1502
+ }, expression: "phone" } }, "CInput", { ...e.$attrs, ...e.$props }, !1))], 1)], 1);
1503
+ }, Ge = [], Je = /* @__PURE__ */ o(
1504
+ Qe,
1505
+ Ye,
1506
+ Ge,
1507
+ !1,
1508
+ null,
1509
+ null
1510
+ );
1511
+ const x = Je.exports, Ze = {
1512
+ name: "CRadio",
1513
+ mixins: [R]
1514
+ };
1515
+ var et = function() {
1516
+ var e = this, i = e._self._c;
1517
+ return i("label", { ref: "label", staticClass: "b-radio radio", class: [`is-${e.size}`, { "is-disabled": e.disabled }], attrs: { disabled: e.disabled }, on: { click: e.focus, keydown: function(s) {
1518
+ return !s.type.indexOf("key") && e._k(s.keyCode, "enter", 13, s.key, "Enter") ? null : (s.preventDefault(), e.$refs.label.click());
1519
+ } } }, [i("input", { directives: [{ name: "model", rawName: "v-model", value: e.computedValue, expression: "computedValue" }], ref: "input", attrs: { disabled: e.disabled, required: e.required, name: e.name, type: "radio" }, domProps: { value: e.nativeValue, checked: e._q(e.computedValue, e.nativeValue) }, on: { click: function(s) {
1520
+ s.stopPropagation();
1521
+ }, change: function(s) {
1522
+ e.computedValue = e.nativeValue;
1523
+ } } }), i("span", { staticClass: "check", class: `is-${e.type}` }), i("span", { staticClass: "control-label" }, [e._t("default")], 2)]);
1524
+ }, tt = [], it = /* @__PURE__ */ o(
1525
+ Ze,
1526
+ et,
1527
+ tt,
1528
+ !1,
1529
+ null,
1530
+ null
1531
+ );
1532
+ const S = it.exports, st = {
1533
+ name: "CRadioButton",
1534
+ components: {
1535
+ CButton: T
1536
+ },
1537
+ mixins: [R],
1538
+ props: {
1539
+ type: {
1540
+ type: String,
1541
+ default: "primary"
1542
+ },
1543
+ expanded: Boolean
1544
+ },
1545
+ data() {
1546
+ return {
1547
+ isFocused: !1
1548
+ };
1549
+ }
1550
+ };
1551
+ var nt = function() {
1552
+ var e = this, i = e._self._c;
1553
+ return i("div", { staticClass: "control", class: { "is-expanded": e.expanded } }, [i("CButton", { ref: "label", staticClass: "c-radio radio button", class: [{ "is-disabled": e.disabled, "is-focused": e.isFocused }], attrs: { tag: "label", type: e.newValue === e.nativeValue ? e.type : null, size: e.size, disabled: e.disabled }, on: { click: e.focus, keydown: function(s) {
1554
+ return !s.type.indexOf("key") && e._k(s.keyCode, "enter", 13, s.key, "Enter") ? null : (s.preventDefault(), e.$refs.$el.label.click());
1555
+ } } }, [e._t("default"), i("input", { directives: [{ name: "model", rawName: "v-model", value: e.computedValue, expression: "computedValue" }], ref: "input", attrs: { disabled: e.disabled, required: e.required, name: e.name, type: "radio" }, domProps: { value: e.nativeValue, checked: e._q(e.computedValue, e.nativeValue) }, on: { click: function(s) {
1556
+ s.stopPropagation();
1557
+ }, focus: function(s) {
1558
+ e.isFocused = !0;
1559
+ }, blur: function(s) {
1560
+ e.isFocused = !1;
1561
+ }, change: function(s) {
1562
+ e.computedValue = e.nativeValue;
1563
+ } } })], 2)], 1);
1564
+ }, at = [], rt = /* @__PURE__ */ o(
1565
+ st,
1566
+ nt,
1567
+ at,
1568
+ !1,
1569
+ null,
1570
+ null
1571
+ );
1572
+ const $ = rt.exports, ot = {
1573
+ name: "CSelect",
1574
+ mixins: [P],
1575
+ inheritAttrs: !1,
1576
+ props: {
1577
+ value: {
1578
+ type: [String, Number, Boolean, Object, Array, Function],
1579
+ default: null
1580
+ },
1581
+ placeholder: {
1582
+ type: String,
1583
+ default: ""
1584
+ },
1585
+ multiple: Boolean,
1586
+ selectClass: {
1587
+ type: [String, Object, Array],
1588
+ default: ""
1589
+ },
1590
+ nativeSize: {
1591
+ type: [String, Number],
1592
+ default: null
1593
+ }
1594
+ },
1595
+ data() {
1596
+ return {
1597
+ selected: this.value,
1598
+ _elementRef: "select"
1599
+ };
1600
+ },
1601
+ computed: {
1602
+ computedValue: {
1603
+ get() {
1604
+ return this.selected;
1605
+ },
1606
+ set(t) {
1607
+ this.selected = t, this.$emit("input", t), !this.isValid && this.checkHtml5Validity();
1608
+ }
1609
+ },
1610
+ spanClasses() {
1611
+ return [
1612
+ this.size,
1613
+ this.statusType,
1614
+ {
1615
+ "is-fullwidth": this.expanded,
1616
+ "is-loading": this.loading,
1617
+ "is-multiple": this.multiple,
1618
+ "is-rounded": this.rounded,
1619
+ "is-empty": this.selected === null
1620
+ }
1621
+ ];
1622
+ }
1623
+ },
1624
+ watch: {
1625
+ /**
1626
+ * When v-model is changed:
1627
+ * 1. Set the selected option.
1628
+ * 2. If it's invalid, validate again.
1629
+ */
1630
+ value(t) {
1631
+ this.selected = t, !this.isValid && this.checkHtml5Validity();
1632
+ }
1633
+ }
1634
+ };
1635
+ var lt = function() {
1636
+ var e = this, i = e._self._c;
1637
+ return i("div", { staticClass: "control", class: { "is-expanded": e.expanded, "has-icons-left": e.icon } }, [i("span", { staticClass: "select", class: e.spanClasses }, [i("select", e._b({ directives: [{ name: "model", rawName: "v-model", value: e.computedValue, expression: "computedValue" }], ref: "select", class: e.selectClass, attrs: { multiple: e.multiple, size: e.nativeSize }, on: { blur: function(s) {
1638
+ e.$emit("blur", s) && e.checkHtml5Validity();
1639
+ }, focus: function(s) {
1640
+ return e.$emit("focus", s);
1641
+ }, change: function(s) {
1642
+ var n = Array.prototype.filter.call(s.target.options, function(a) {
1643
+ return a.selected;
1644
+ }).map(function(a) {
1645
+ var r = "_value" in a ? a._value : a.value;
1646
+ return r;
1647
+ });
1648
+ e.computedValue = s.target.multiple ? n : n[0];
1649
+ } } }, "select", e.$attrs, !1), [e.placeholder && e.computedValue == null ? i("option", { attrs: { disabled: "", hidden: "" }, domProps: { value: null } }, [e._v(" " + e._s(e.placeholder) + " ")]) : e._e(), e._t("default")], 2)])]);
1650
+ }, dt = [], ct = /* @__PURE__ */ o(
1651
+ ot,
1652
+ lt,
1653
+ dt,
1654
+ !1,
1655
+ null,
1656
+ "23e48013"
1657
+ );
1658
+ const k = ct.exports, ut = {
1659
+ name: "CSkeleton",
1660
+ functional: !0,
1661
+ props: {
1662
+ active: {
1663
+ type: Boolean,
1664
+ default: !0
1665
+ },
1666
+ animated: {
1667
+ type: Boolean,
1668
+ default: !1
1669
+ },
1670
+ width: [Number, String],
1671
+ height: [Number, String],
1672
+ circle: Boolean,
1673
+ rounded: {
1674
+ type: Boolean,
1675
+ default: !0
1676
+ },
1677
+ count: {
1678
+ type: Number,
1679
+ default: 1
1680
+ },
1681
+ hidden: {
1682
+ type: [Boolean, String],
1683
+ default: !1
1684
+ },
1685
+ color: {
1686
+ type: String,
1687
+ default: null
1688
+ }
1689
+ },
1690
+ render(t, e) {
1691
+ if (!e.props.active)
1692
+ return;
1693
+ const i = [], s = e.props.width, n = e.props.height;
1694
+ for (let a = 0; a < e.props.count; a++)
1695
+ i.push(
1696
+ t("div", {
1697
+ staticClass: "c-skeleton-item",
1698
+ class: { "is-rounded": e.props.rounded },
1699
+ key: a,
1700
+ style: {
1701
+ height: n === void 0 ? null : isNaN(n) ? n : n + "px",
1702
+ width: s === void 0 ? null : isNaN(s) ? s : s + "px",
1703
+ borderRadius: e.props.circle ? "50%" : null,
1704
+ background: e.props.color ? e.props.color : null
1705
+ }
1706
+ })
1707
+ );
1708
+ return t(
1709
+ "div",
1710
+ {
1711
+ staticStyle: e.data.staticStyle,
1712
+ staticClass: "c-skeleton",
1713
+ class: [
1714
+ e.data.staticClass,
1715
+ {
1716
+ "is-animated": e.props.animated,
1717
+ "is-invisible": e.props.hidden
1718
+ }
1719
+ ]
1720
+ },
1721
+ i
1722
+ );
1723
+ }
1724
+ }, mt = null, pt = null;
1725
+ var ht = /* @__PURE__ */ o(
1726
+ ut,
1727
+ mt,
1728
+ pt,
1729
+ !1,
1730
+ null,
1731
+ null
1732
+ );
1733
+ const D = ht.exports, ft = {
1734
+ name: "CSliderThumb",
1735
+ inheritAttrs: !1,
1736
+ props: {
1737
+ value: {
1738
+ type: Number,
1739
+ default: 0
1740
+ },
1741
+ type: {
1742
+ type: String,
1743
+ default: ""
1744
+ },
1745
+ tooltip: {
1746
+ type: Boolean,
1747
+ default: !0
1748
+ },
1749
+ customFormatter: {
1750
+ type: Function,
1751
+ default: null
1752
+ }
1753
+ },
1754
+ data() {
1755
+ return {
1756
+ isFocused: !1,
1757
+ dragging: !1,
1758
+ startX: 0,
1759
+ startPosition: 0,
1760
+ newPosition: null,
1761
+ oldValue: this.value
1762
+ };
1763
+ },
1764
+ computed: {
1765
+ disabled() {
1766
+ return this.$parent.disabled;
1767
+ },
1768
+ max() {
1769
+ return this.$parent.max;
1770
+ },
1771
+ min() {
1772
+ return this.$parent.min;
1773
+ },
1774
+ step() {
1775
+ return this.$parent.step;
1776
+ },
1777
+ precision() {
1778
+ return this.$parent.precision;
1779
+ },
1780
+ currentPosition() {
1781
+ return `${(this.value - this.min) / (this.max - this.min) * 100}%`;
1782
+ },
1783
+ wrapperStyle() {
1784
+ return { left: this.currentPosition };
1785
+ },
1786
+ tooltipLabel() {
1787
+ return typeof this.customFormatter == "function" ? this.customFormatter(this.value) : this.value.toString();
1788
+ }
1789
+ },
1790
+ methods: {
1791
+ onFocus() {
1792
+ this.isFocused = !0;
1793
+ },
1794
+ onBlur() {
1795
+ this.isFocused = !1;
1796
+ },
1797
+ onButtonDown(t) {
1798
+ this.disabled || (t.preventDefault(), this.onDragStart(t), typeof window < "u" && (document.addEventListener("mousemove", this.onDragging), document.addEventListener("touchmove", this.onDragging), document.addEventListener("mouseup", this.onDragEnd), document.addEventListener("touchend", this.onDragEnd), document.addEventListener("contextmenu", this.onDragEnd)));
1799
+ },
1800
+ onLeftKeyDown() {
1801
+ this.disabled || this.value === this.min || (this.newPosition = parseFloat(this.currentPosition) - this.step / (this.max - this.min) * 100, this.setPosition(this.newPosition), this.$parent.emitValue("change"));
1802
+ },
1803
+ onRightKeyDown() {
1804
+ this.disabled || this.value === this.max || (this.newPosition = parseFloat(this.currentPosition) + this.step / (this.max - this.min) * 100, this.setPosition(this.newPosition), this.$parent.emitValue("change"));
1805
+ },
1806
+ onHomeKeyDown() {
1807
+ this.disabled || this.value === this.min || (this.newPosition = 0, this.setPosition(this.newPosition), this.$parent.emitValue("change"));
1808
+ },
1809
+ onEndKeyDown() {
1810
+ this.disabled || this.value === this.max || (this.newPosition = 100, this.setPosition(this.newPosition), this.$parent.emitValue("change"));
1811
+ },
1812
+ onDragStart(t) {
1813
+ this.dragging = !0, this.$emit("dragstart"), t.type === "touchstart" && (t.clientX = t.touches[0].clientX), this.startX = t.clientX, this.startPosition = parseFloat(this.currentPosition), this.newPosition = this.startPosition;
1814
+ },
1815
+ onDragging(t) {
1816
+ if (this.dragging) {
1817
+ t.type === "touchmove" && (t.clientX = t.touches[0].clientX);
1818
+ const e = (t.clientX - this.startX) / this.$parent.sliderSize() * 100;
1819
+ this.newPosition = this.startPosition + e, this.setPosition(this.newPosition);
1820
+ }
1821
+ },
1822
+ onDragEnd() {
1823
+ this.dragging = !1, this.$emit("dragend"), this.value !== this.oldValue && this.$parent.emitValue("change"), this.setPosition(this.newPosition), typeof window < "u" && (document.removeEventListener("mousemove", this.onDragging), document.removeEventListener("touchmove", this.onDragging), document.removeEventListener("mouseup", this.onDragEnd), document.removeEventListener("touchend", this.onDragEnd), document.removeEventListener("contextmenu", this.onDragEnd));
1824
+ },
1825
+ setPosition(t) {
1826
+ if (t === null || isNaN(t))
1827
+ return;
1828
+ t < 0 ? t = 0 : t > 100 && (t = 100);
1829
+ const e = 100 / ((this.max - this.min) / this.step);
1830
+ let s = Math.round(t / e) * e / 100 * (this.max - this.min) + this.min;
1831
+ s = parseFloat(s.toFixed(this.precision)), this.$emit("input", s), !this.dragging && s !== this.oldValue && (this.oldValue = s);
1832
+ }
1833
+ }
1834
+ };
1835
+ var gt = function() {
1836
+ var e = this, i = e._self._c;
1837
+ return i("div", { staticClass: "c-slider-thumb-wrapper", class: { "is-dragging": e.dragging }, style: e.wrapperStyle }, [i("div", e._b({ staticClass: "c-slider-thumb", attrs: { tabindex: e.disabled ? !1 : 0 }, on: { mousedown: e.onButtonDown, touchstart: e.onButtonDown, focus: e.onFocus, blur: e.onBlur, keydown: [function(s) {
1838
+ return !s.type.indexOf("key") && e._k(s.keyCode, "left", 37, s.key, ["Left", "ArrowLeft"]) || "button" in s && s.button !== 0 ? null : (s.preventDefault(), e.onLeftKeyDown.apply(null, arguments));
1839
+ }, function(s) {
1840
+ return !s.type.indexOf("key") && e._k(s.keyCode, "right", 39, s.key, ["Right", "ArrowRight"]) || "button" in s && s.button !== 2 ? null : (s.preventDefault(), e.onRightKeyDown.apply(null, arguments));
1841
+ }, function(s) {
1842
+ return !s.type.indexOf("key") && e._k(s.keyCode, "down", 40, s.key, ["Down", "ArrowDown"]) ? null : (s.preventDefault(), e.onLeftKeyDown.apply(null, arguments));
1843
+ }, function(s) {
1844
+ return !s.type.indexOf("key") && e._k(s.keyCode, "up", 38, s.key, ["Up", "ArrowUp"]) ? null : (s.preventDefault(), e.onRightKeyDown.apply(null, arguments));
1845
+ }, function(s) {
1846
+ return !s.type.indexOf("key") && e._k(s.keyCode, "home", void 0, s.key, void 0) ? null : (s.preventDefault(), e.onHomeKeyDown.apply(null, arguments));
1847
+ }, function(s) {
1848
+ return !s.type.indexOf("key") && e._k(s.keyCode, "end", void 0, s.key, void 0) ? null : (s.preventDefault(), e.onEndKeyDown.apply(null, arguments));
1849
+ }] } }, "div", e.$attrs, !1))]);
1850
+ }, vt = [], yt = /* @__PURE__ */ o(
1851
+ ft,
1852
+ gt,
1853
+ vt,
1854
+ !1,
1855
+ null,
1856
+ null
1857
+ );
1858
+ const _t = yt.exports, bt = {
1859
+ name: "CSliderTick",
1860
+ props: {
1861
+ value: {
1862
+ type: Number,
1863
+ default: 0
1864
+ }
1865
+ },
1866
+ computed: {
1867
+ position() {
1868
+ const t = (this.value - this.$parent.min) / (this.$parent.max - this.$parent.min) * 100;
1869
+ return t >= 0 && t <= 100 ? t : 0;
1870
+ },
1871
+ hidden() {
1872
+ return this.value === this.$parent.min || this.value === this.$parent.max;
1873
+ }
1874
+ },
1875
+ created() {
1876
+ if (!this.$parent.$data._isSlider)
1877
+ throw this.$destroy(), new Error("You should wrap bSliderTick on a bSlider");
1878
+ },
1879
+ methods: {
1880
+ getTickStyle(t) {
1881
+ return { left: `${t}%` };
1882
+ }
1883
+ }
1884
+ };
1885
+ var Ct = function() {
1886
+ var e = this, i = e._self._c;
1887
+ return i("div", { staticClass: "c-slider-tick", class: { "is-tick-hidden": e.hidden }, style: e.getTickStyle(e.position) }, [e.$slots.default ? i("span", { staticClass: "c-slider-tick-label" }, [e._t("default")], 2) : e._e()]);
1888
+ }, wt = [], xt = /* @__PURE__ */ o(
1889
+ bt,
1890
+ Ct,
1891
+ wt,
1892
+ !1,
1893
+ null,
1894
+ null
1895
+ );
1896
+ const St = xt.exports, $t = {
1897
+ name: "CSlider",
1898
+ components: {
1899
+ CSliderThumb: _t,
1900
+ CSliderTick: St
1901
+ },
1902
+ props: {
1903
+ value: {
1904
+ type: [Number, Array],
1905
+ default: 0
1906
+ },
1907
+ min: {
1908
+ type: Number,
1909
+ default: 0
1910
+ },
1911
+ max: {
1912
+ type: Number,
1913
+ default: 100
1914
+ },
1915
+ step: {
1916
+ type: Number,
1917
+ default: 1
1918
+ },
1919
+ type: {
1920
+ type: String,
1921
+ default: "primary"
1922
+ },
1923
+ size: {
1924
+ type: String,
1925
+ default: ""
1926
+ },
1927
+ ticks: {
1928
+ type: Boolean,
1929
+ default: !1
1930
+ },
1931
+ tooltip: {
1932
+ type: Boolean,
1933
+ default: !0
1934
+ },
1935
+ tooltipType: {
1936
+ type: String,
1937
+ default: ""
1938
+ },
1939
+ rounded: {
1940
+ type: Boolean,
1941
+ default: !1
1942
+ },
1943
+ disabled: {
1944
+ type: Boolean,
1945
+ default: !1
1946
+ },
1947
+ lazy: {
1948
+ type: Boolean,
1949
+ default: !1
1950
+ },
1951
+ customFormatter: {
1952
+ type: Function,
1953
+ default: null
1954
+ },
1955
+ ariaLabel: {
1956
+ type: [String, Array],
1957
+ default: ""
1958
+ },
1959
+ biggerSliderFocus: {
1960
+ type: Boolean,
1961
+ default: !1
1962
+ }
1963
+ },
1964
+ data() {
1965
+ return {
1966
+ value1: null,
1967
+ value2: null,
1968
+ dragging: !1,
1969
+ isRange: !1,
1970
+ _isSlider: !0
1971
+ // Used by Thumb and Tick
1972
+ };
1973
+ },
1974
+ computed: {
1975
+ newTooltipType() {
1976
+ return this.tooltipType ? this.tooltipType : this.type;
1977
+ },
1978
+ tickValues() {
1979
+ if (!this.ticks || this.min > this.max || this.step === 0)
1980
+ return [];
1981
+ const t = [];
1982
+ for (let e = this.min + this.step; e < this.max; e += this.step)
1983
+ t.push(e);
1984
+ return t;
1985
+ },
1986
+ minValue() {
1987
+ return Math.min(this.value1, this.value2);
1988
+ },
1989
+ maxValue() {
1990
+ return Math.max(this.value1, this.value2);
1991
+ },
1992
+ barSize() {
1993
+ return this.isRange ? `${100 * (this.maxValue - this.minValue) / (this.max - this.min)}%` : `${100 * (this.value1 - this.min) / (this.max - this.min)}%`;
1994
+ },
1995
+ barStart() {
1996
+ return this.isRange ? `${100 * (this.minValue - this.min) / (this.max - this.min)}%` : "0%";
1997
+ },
1998
+ precision() {
1999
+ const t = [this.min, this.max, this.step].map((e) => {
2000
+ const i = `${e}`.split(".")[1];
2001
+ return i ? i.length : 0;
2002
+ });
2003
+ return Math.max(...t);
2004
+ },
2005
+ barStyle() {
2006
+ return {
2007
+ width: this.barSize,
2008
+ left: this.barStart
2009
+ };
2010
+ },
2011
+ rootClasses() {
2012
+ return {
2013
+ "is-rounded": this.rounded,
2014
+ "is-dragging": this.dragging,
2015
+ "is-disabled": this.disabled,
2016
+ "slider-focus": this.biggerSliderFocus
2017
+ };
2018
+ }
2019
+ },
2020
+ watch: {
2021
+ /**
2022
+ * When v-model is changed set the new active step.
2023
+ */
2024
+ value(t) {
2025
+ this.setValues(t);
2026
+ },
2027
+ value1() {
2028
+ this.onInternalValueUpdate();
2029
+ },
2030
+ value2() {
2031
+ this.onInternalValueUpdate();
2032
+ },
2033
+ min() {
2034
+ this.setValues(this.value);
2035
+ },
2036
+ max() {
2037
+ this.setValues(this.value);
2038
+ }
2039
+ },
2040
+ created() {
2041
+ this.isThumbReversed = !1, this.isTrackClickDisabled = !1, this.setValues(this.value);
2042
+ },
2043
+ methods: {
2044
+ setValues(t) {
2045
+ if (!(this.min > this.max))
2046
+ if (Array.isArray(t)) {
2047
+ this.isRange = !0;
2048
+ const e = typeof t[0] != "number" || isNaN(t[0]) ? this.min : p(t[0], this.min, this.max), i = typeof t[1] != "number" || isNaN(t[1]) ? this.max : p(t[1], this.min, this.max);
2049
+ this.value1 = this.isThumbReversed ? i : e, this.value2 = this.isThumbReversed ? e : i;
2050
+ } else
2051
+ this.isRange = !1, this.value1 = isNaN(t) ? this.min : p(t, this.min, this.max), this.value2 = null;
2052
+ },
2053
+ onInternalValueUpdate() {
2054
+ this.isRange && (this.isThumbReversed = this.value1 > this.value2), (!this.lazy || !this.dragging) && this.emitValue("input"), this.dragging && this.emitValue("dragging");
2055
+ },
2056
+ sliderSize() {
2057
+ return this.$refs.slider.getBoundingClientRect().width;
2058
+ },
2059
+ onSliderClick(t) {
2060
+ if (this.disabled || this.isTrackClickDisabled)
2061
+ return;
2062
+ const e = this.$refs.slider.getBoundingClientRect().left, i = (t.clientX - e) / this.sliderSize() * 100, s = this.min + i * (this.max - this.min) / 100, n = Math.abs(s - this.value1);
2063
+ if (this.isRange) {
2064
+ const a = Math.abs(s - this.value2);
2065
+ if (n <= a) {
2066
+ if (n < this.step / 2)
2067
+ return;
2068
+ this.$refs.button1.setPosition(i);
2069
+ } else {
2070
+ if (a < this.step / 2)
2071
+ return;
2072
+ this.$refs.button2.setPosition(i);
2073
+ }
2074
+ } else {
2075
+ if (n < this.step / 2)
2076
+ return;
2077
+ this.$refs.button1.setPosition(i);
2078
+ }
2079
+ this.emitValue("change");
2080
+ },
2081
+ onDragStart() {
2082
+ this.dragging = !0, this.$emit("dragstart");
2083
+ },
2084
+ onDragEnd() {
2085
+ this.isTrackClickDisabled = !0, setTimeout(() => {
2086
+ this.isTrackClickDisabled = !1;
2087
+ }, 0), this.dragging = !1, this.$emit("dragend"), this.lazy && this.emitValue("input");
2088
+ },
2089
+ emitValue(t) {
2090
+ this.$emit(
2091
+ t,
2092
+ this.isRange ? [this.minValue, this.maxValue] : this.value1
2093
+ );
2094
+ }
2095
+ }
2096
+ };
2097
+ var kt = function() {
2098
+ var e = this, i = e._self._c;
2099
+ return i("div", { staticClass: "c-slider", class: [`is-${e.size}`, `is-${e.type}`, e.rootClasses], on: { click: e.onSliderClick } }, [i("div", { ref: "slider", staticClass: "c-slider-track" }, [i("div", { staticClass: "c-slider-fill", style: e.barStyle }), e.ticks ? e._l(e.tickValues, function(s, n) {
2100
+ return i("CSliderTick", { key: n, attrs: { value: s } });
2101
+ }) : e._e(), e._t("default"), i("CSliderThumb", { ref: "button1", attrs: { type: `is-${e.newTooltipType}`, tooltip: e.tooltip, "custom-formatter": e.customFormatter, "aria-valuenow": e.value1, "aria-valuemin": e.min, "aria-valuemax": e.max, "aria-label": Array.isArray(e.ariaLabel) ? e.ariaLabel[0] : e.ariaLabel, "aria-disabled": e.disabled, role: "slider", "aria-orientation": "horizontal" }, on: { dragstart: e.onDragStart, dragend: e.onDragEnd }, model: { value: e.value1, callback: function(s) {
2102
+ e.value1 = s;
2103
+ }, expression: "value1" } }), e.isRange ? i("CSliderThumb", { ref: "button2", attrs: { type: e.newTooltipType, tooltip: e.tooltip, "custom-formatter": e.customFormatter, "aria-valuenow": e.value2, "aria-valuemin": e.min, "aria-valuemax": e.max, "aria-label": Array.isArray(e.ariaLabel) ? e.ariaLabel[1] : "", "aria-disabled": e.disabled, role: "slider", "aria-orientation": "horizontal" }, on: { dragstart: e.onDragStart, dragend: e.onDragEnd }, model: { value: e.value2, callback: function(s) {
2104
+ e.value2 = s;
2105
+ }, expression: "value2" } }) : e._e()], 2)]);
2106
+ }, Dt = [], Vt = /* @__PURE__ */ o(
2107
+ $t,
2108
+ kt,
2109
+ Dt,
2110
+ !1,
2111
+ null,
2112
+ null
2113
+ );
2114
+ const V = Vt.exports, Ft = {
2115
+ name: "CSwitch",
2116
+ props: {
2117
+ value: {
2118
+ type: [String, Number, Boolean, Function, Object, Array, Date],
2119
+ default: null
2120
+ },
2121
+ nativeValue: {
2122
+ type: [String, Number, Boolean, Function, Object, Array, Date],
2123
+ default: null
2124
+ },
2125
+ disabled: Boolean,
2126
+ type: {
2127
+ type: String,
2128
+ default: ""
2129
+ },
2130
+ name: {
2131
+ type: String,
2132
+ default: ""
2133
+ },
2134
+ required: Boolean,
2135
+ size: {
2136
+ type: String,
2137
+ default: ""
2138
+ },
2139
+ trueValue: {
2140
+ type: [String, Number, Boolean, Function, Object, Array, Date],
2141
+ default: !0
2142
+ },
2143
+ falseValue: {
2144
+ type: [String, Number, Boolean, Function, Object, Array, Date],
2145
+ default: !1
2146
+ },
2147
+ rounded: {
2148
+ type: Boolean,
2149
+ default: !0
2150
+ }
2151
+ },
2152
+ data() {
2153
+ return {
2154
+ newValue: this.value
2155
+ };
2156
+ },
2157
+ computed: {
2158
+ computedValue: {
2159
+ get() {
2160
+ return this.newValue;
2161
+ },
2162
+ set(t) {
2163
+ this.newValue = t, this.$emit("input", t);
2164
+ }
2165
+ },
2166
+ newClass() {
2167
+ return [
2168
+ `is-${this.size}`,
2169
+ {
2170
+ "is-disabled": this.disabled,
2171
+ "is-rounded": this.rounded
2172
+ }
2173
+ ];
2174
+ }
2175
+ },
2176
+ watch: {
2177
+ /**
2178
+ * When v-model change, set internal value.
2179
+ */
2180
+ value(t) {
2181
+ this.newValue = t;
2182
+ }
2183
+ },
2184
+ methods: {
2185
+ focus() {
2186
+ this.$refs.input.focus();
2187
+ }
2188
+ }
2189
+ };
2190
+ var At = function() {
2191
+ var e = this, i = e._self._c;
2192
+ return i("label", { ref: "label", staticClass: "switch", class: e.newClass, attrs: { disabled: e.disabled }, on: { click: e.focus, keydown: function(s) {
2193
+ return !s.type.indexOf("key") && e._k(s.keyCode, "enter", 13, s.key, "Enter") ? null : (s.preventDefault(), e.$refs.label.click());
2194
+ } } }, [i("input", { directives: [{ name: "model", rawName: "v-model", value: e.computedValue, expression: "computedValue" }], ref: "input", attrs: { disabled: e.disabled, name: e.name, required: e.required, "true-value": e.trueValue, "false-value": e.falseValue, type: "checkbox" }, domProps: { value: e.nativeValue, checked: Array.isArray(e.computedValue) ? e._i(e.computedValue, e.nativeValue) > -1 : e._q(e.computedValue, e.trueValue) }, on: { click: function(s) {
2195
+ s.stopPropagation();
2196
+ }, change: function(s) {
2197
+ var n = e.computedValue, a = s.target, r = a.checked ? e.trueValue : e.falseValue;
2198
+ if (Array.isArray(n)) {
2199
+ var d = e.nativeValue, u = e._i(n, d);
2200
+ a.checked ? u < 0 && (e.computedValue = n.concat([d])) : u > -1 && (e.computedValue = n.slice(0, u).concat(n.slice(u + 1)));
2201
+ } else
2202
+ e.computedValue = r;
2203
+ } } }), i("span", { staticClass: "check", class: [`is-${e.type}`] }), i("span", { staticClass: "control-label" }, [e._t("default")], 2)]);
2204
+ }, Ot = [], Bt = /* @__PURE__ */ o(
2205
+ Ft,
2206
+ At,
2207
+ Ot,
2208
+ !1,
2209
+ null,
2210
+ "4cdd239d"
2211
+ );
2212
+ const F = Bt.exports, It = {
2213
+ name: "CTabItem",
2214
+ props: {
2215
+ label: String,
2216
+ icon: String,
2217
+ iconPack: String,
2218
+ disabled: Boolean,
2219
+ visible: {
2220
+ type: Boolean,
2221
+ default: !0
2222
+ },
2223
+ value: [String, Number]
2224
+ },
2225
+ data() {
2226
+ return {
2227
+ isActive: !1,
2228
+ transitionName: null,
2229
+ _isTabItem: !0
2230
+ // Used internally by Tab
2231
+ };
2232
+ },
2233
+ created() {
2234
+ if (!this.$parent.$data._isTabs)
2235
+ throw this.$destroy(), new Error("You should wrap bTabItem on a bTabs");
2236
+ this.$parent.refreshSlots();
2237
+ },
2238
+ beforeDestroy() {
2239
+ this.$parent.refreshSlots();
2240
+ },
2241
+ methods: {
2242
+ /**
2243
+ * Activate tab, alter animation name based on the index.
2244
+ */
2245
+ activate(t, e) {
2246
+ this.transitionName = e < t ? this.$parent.vertical ? "slide-down" : "slide-next" : this.$parent.vertical ? "slide-up" : "slide-prev", this.isActive = !0;
2247
+ },
2248
+ /**
2249
+ * Deactivate tab, alter animation name based on the index.
2250
+ */
2251
+ deactivate(t, e) {
2252
+ this.transitionName = e < t ? this.$parent.vertical ? "slide-down" : "slide-next" : this.$parent.vertical ? "slide-up" : "slide-prev", this.isActive = !1;
2253
+ }
2254
+ },
2255
+ render(t) {
2256
+ if (this.$parent.destroyOnHide && (!this.isActive || !this.visible))
2257
+ return;
2258
+ const e = t(
2259
+ "div",
2260
+ {
2261
+ directives: [
2262
+ {
2263
+ name: "show",
2264
+ value: this.isActive && this.visible
2265
+ }
2266
+ ],
2267
+ class: "tab-item"
2268
+ },
2269
+ this.$slots.default
2270
+ );
2271
+ return this.$parent.animated ? t(
2272
+ "transition",
2273
+ {
2274
+ props: {
2275
+ name: this.transitionName,
2276
+ mode: "out-in"
2277
+ },
2278
+ on: {
2279
+ "before-enter": () => {
2280
+ this.$parent.isTransitioning = !0;
2281
+ },
2282
+ "after-enter": () => {
2283
+ this.$parent.isTransitioning = !1;
2284
+ }
2285
+ }
2286
+ },
2287
+ [e]
2288
+ ) : e;
2289
+ }
2290
+ }, Pt = null, Tt = null;
2291
+ var Rt = /* @__PURE__ */ o(
2292
+ It,
2293
+ Pt,
2294
+ Tt,
2295
+ !1,
2296
+ null,
2297
+ null
2298
+ );
2299
+ const A = Rt.exports, Mt = {
2300
+ name: "CSlotComponent",
2301
+ props: {
2302
+ component: {
2303
+ type: Object,
2304
+ required: !0
2305
+ },
2306
+ name: {
2307
+ type: String,
2308
+ default: "default"
2309
+ },
2310
+ scoped: {
2311
+ type: Boolean
2312
+ },
2313
+ props: {
2314
+ type: Object
2315
+ },
2316
+ tag: {
2317
+ type: String,
2318
+ default: "div"
2319
+ },
2320
+ event: {
2321
+ type: String,
2322
+ default: "hook:updated"
2323
+ }
2324
+ },
2325
+ methods: {
2326
+ refresh() {
2327
+ this.$forceUpdate();
2328
+ },
2329
+ isVueComponent() {
2330
+ return this.component && this.component._isVue;
2331
+ }
2332
+ },
2333
+ created() {
2334
+ this.isVueComponent() && this.component.$on(this.event, this.refresh);
2335
+ },
2336
+ beforeDestroy() {
2337
+ this.isVueComponent() && this.component.$off(this.event, this.refresh);
2338
+ },
2339
+ render(t) {
2340
+ if (this.isVueComponent())
2341
+ return t(
2342
+ this.tag,
2343
+ {},
2344
+ this.scoped ? this.component.$scopedSlots[this.name](this.props) : this.component.$slots[this.name]
2345
+ );
2346
+ }
2347
+ }, zt = {
2348
+ name: "CTabs",
2349
+ components: {
2350
+ CSlotComponent: Mt
2351
+ },
2352
+ props: {
2353
+ value: {
2354
+ type: [Number, String],
2355
+ default: null
2356
+ },
2357
+ expanded: Boolean,
2358
+ type: {
2359
+ type: String,
2360
+ default: null
2361
+ },
2362
+ size: {
2363
+ type: String,
2364
+ default: null
2365
+ },
2366
+ position: {
2367
+ type: String,
2368
+ validator(t) {
2369
+ return ["left", "right", "center"].indexOf(t) > -1;
2370
+ },
2371
+ default: null
2372
+ },
2373
+ animated: {
2374
+ type: Boolean,
2375
+ default: !0
2376
+ },
2377
+ destroyOnHide: {
2378
+ type: Boolean,
2379
+ default: !1
2380
+ },
2381
+ vertical: Boolean,
2382
+ multiline: Boolean
2383
+ },
2384
+ data() {
2385
+ return {
2386
+ activeTab: 0,
2387
+ defaultSlots: [],
2388
+ contentHeight: 0,
2389
+ isTransitioning: !1,
2390
+ _isTabs: !0
2391
+ // Used internally by TabItem
2392
+ };
2393
+ },
2394
+ computed: {
2395
+ mainClasses() {
2396
+ return {
2397
+ "is-fullwidth": this.expanded,
2398
+ "is-vertical": this.vertical,
2399
+ "is-multiline": this.multiline,
2400
+ [`is-${this.position}`]: this.position && this.vertical
2401
+ };
2402
+ },
2403
+ navClasses() {
2404
+ return [
2405
+ this.type,
2406
+ {
2407
+ [`is-${this.size}`]: !!this.size,
2408
+ [`is-${this.position}`]: this.position && !this.vertical,
2409
+ "is-fullwidth": this.expanded,
2410
+ "is-toggle-rounded is-toggle": this.type === "is-toggle-rounded"
2411
+ }
2412
+ ];
2413
+ },
2414
+ tabItems() {
2415
+ return this.defaultSlots.filter(
2416
+ (t) => t.componentInstance && t.componentInstance.$data && t.componentInstance.$data._isTabItem
2417
+ ).map((t) => t.componentInstance);
2418
+ }
2419
+ },
2420
+ watch: {
2421
+ /**
2422
+ * When v-model is changed set the new active tab.
2423
+ */
2424
+ value(t) {
2425
+ const e = this.getIndexByValue(t, t);
2426
+ this.changeTab(e);
2427
+ },
2428
+ /**
2429
+ * When tab-items are updated, set active one.
2430
+ */
2431
+ tabItems() {
2432
+ if (this.activeTab < this.tabItems.length) {
2433
+ let t = this.activeTab;
2434
+ this.tabItems.map((e, i) => {
2435
+ e.isActive && (t = i, t < this.tabItems.length && (this.tabItems[t].isActive = !1));
2436
+ }), this.tabItems[this.activeTab].isActive = !0;
2437
+ } else
2438
+ this.activeTab > 0 && this.changeTab(this.activeTab - 1);
2439
+ }
2440
+ },
2441
+ mounted() {
2442
+ this.activeTab = this.getIndexByValue(this.value || 0), this.activeTab < this.tabItems.length && (this.tabItems[this.activeTab].isActive = !0), this.refreshSlots();
2443
+ },
2444
+ methods: {
2445
+ /**
2446
+ * Change the active tab and emit change event.
2447
+ */
2448
+ changeTab(t) {
2449
+ this.activeTab === t || this.tabItems[t] === void 0 || (this.activeTab < this.tabItems.length && this.tabItems[this.activeTab].deactivate(this.activeTab, t), this.tabItems[t].activate(this.activeTab, t), this.activeTab = t, this.$emit("change", this.getValueByIndex(t)));
2450
+ },
2451
+ /**
2452
+ * Tab click listener, emit input event and change active tab.
2453
+ */
2454
+ tabClick(t) {
2455
+ this.activeTab !== t && (this.$emit("input", this.getValueByIndex(t)), this.changeTab(t));
2456
+ },
2457
+ refreshSlots() {
2458
+ this.defaultSlots = this.$slots.default || [];
2459
+ },
2460
+ getIndexByValue(t) {
2461
+ const e = this.tabItems.map(
2462
+ (i) => i.$options.propsData ? i.$options.propsData.value : void 0
2463
+ ).indexOf(t);
2464
+ return e >= 0 ? e : t;
2465
+ },
2466
+ getValueByIndex(t) {
2467
+ const { propsData: e } = this.tabItems[t].$options;
2468
+ return e && e.value ? e.value : t;
2469
+ }
2470
+ }
2471
+ };
2472
+ var Et = function() {
2473
+ var e = this, i = e._self._c;
2474
+ return i("div", { staticClass: "c-tabs", class: e.mainClasses }, [i("nav", { staticClass: "tabs", class: e.navClasses }, [i("ul", e._l(e.tabItems, function(s, n) {
2475
+ return i("li", { directives: [{ name: "show", rawName: "v-show", value: s.visible, expression: "tabItem.visible" }], key: n, class: {
2476
+ "is-active": e.activeTab === n,
2477
+ "is-disabled": s.disabled
2478
+ } }, [s.$slots.header ? i("CSlotComponent", { attrs: { component: s, name: "header", tag: "a" }, nativeOn: { click: function(a) {
2479
+ return e.tabClick(n);
2480
+ } } }) : i("a", { on: { click: function(a) {
2481
+ return e.tabClick(n);
2482
+ } } }, [s.icon ? i("CIcon", { attrs: { size: e.size, type: s.icon } }) : e._e(), i("span", [e._v(e._s(s.label))])], 1)], 1);
2483
+ }), 0)]), i("section", { staticClass: "tab-content", class: { "is-transitioning": e.isTransitioning } }, [e._t("default")], 2)]);
2484
+ }, Nt = [], Lt = /* @__PURE__ */ o(
2485
+ zt,
2486
+ Et,
2487
+ Nt,
2488
+ !1,
2489
+ null,
2490
+ "e02a6440"
2491
+ );
2492
+ const O = Lt.exports;
2493
+ function si(t) {
2494
+ t.component(D.name, D), t.component("CAutocomplete", je), t.component(y.name, y), t.component(S.name, S), t.component($.name, $), t.component(h.name, h), t.component(f.name, f), t.component(k.name, k), t.component(_.name, _), t.component(F.name, F), t.component(O.name, O), t.component(A.name, A), t.component("CField", se), t.component(w.name, w), t.component(x.name, x), t.component(V.name, V);
2495
+ }
2496
+ export {
2497
+ ii as S,
2498
+ si as i
2499
+ };