@xwadex/fesd 0.0.20 → 0.0.22

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.
@@ -2,18 +2,18 @@ var U = (r, e, t) => {
2
2
  if (!e.has(r))
3
3
  throw TypeError("Cannot " + t);
4
4
  };
5
- var V = (r, e, t) => {
5
+ var D = (r, e, t) => {
6
6
  if (e.has(r))
7
7
  throw TypeError("Cannot add the same private member more than once");
8
8
  e instanceof WeakSet ? e.add(r) : e.set(r, t);
9
9
  };
10
- var _ = (r, e, t) => (U(r, e, "access private method"), t);
11
- import { n as z, o as C } from "./image-preview-bundle.js";
12
- import { x as ue, B as de, z as fe, G as pe, F as me, J as ye, K as he, E as ve, L as ge, O as be, P as xe, Q as Se, X as ke, Y as Ae, w as Ee, U as we, W as qe, u as Ce, t as Le, V as Oe, q as Te, r as Fe, p as Ge, S as $e, y as Ie, H as Ne, N as Ve } from "./image-preview-bundle.js";
13
- import { o as H, z as P } from "./vendor-bundle.js";
14
- import b from "jquery";
10
+ var V = (r, e, t) => (U(r, e, "access private method"), t);
11
+ import { n as z, o as q } from "./image-preview-bundle.js";
12
+ import { x as ue, B as de, z as fe, G as pe, F as me, J as ye, K as he, E as ve, L as ge, O as be, P as ke, Q as xe, X as Se, Y as Ae, w as Ee, U as we, W as Ce, u as qe, t as Le, V as Oe, q as Te, r as Fe, p as Ge, S as $e, y as Ie, H as Ne, N as De } from "./image-preview-bundle.js";
13
+ import { o as H, z as Q } from "./vendor-bundle.js";
14
+ import h from "jquery";
15
15
  import w from "validator";
16
- import D from "flatpickr";
16
+ import _ from "flatpickr";
17
17
  function se() {
18
18
  if (!document.body.classList.contains("error") || document.querySelector(".back-home") == null)
19
19
  return;
@@ -23,57 +23,57 @@ function se() {
23
23
  e--, o.textContent = e, e === 0 && (clearInterval(r), window.location.href = t);
24
24
  }, 1e3);
25
25
  }
26
- function Q(r, e = r) {
26
+ function W(r, e = r) {
27
27
  if (r.complete) {
28
- const o = new H().getColor(r), i = o[0] * 0.299 + o[1] * 0.587 + o[2] * 0.114;
29
- G(i, e), e.classList.add("detected");
28
+ const o = new H().getColor(r), s = o[0] * 0.299 + o[1] * 0.587 + o[2] * 0.114;
29
+ G(s, e), e.classList.add("detected");
30
30
  }
31
31
  }
32
32
  function G(r, e) {
33
33
  const t = e.getAttribute("addClassEl");
34
34
  r >= 192 ? t && t !== "" ? t.split(",").forEach((o) => {
35
- var i;
36
- e.closest(o) || console.error(`closest "${o}" not found`), (i = e.closest(o)) == null || i.classList.add("is-light");
35
+ var s;
36
+ e.closest(o) || console.error(`closest "${o}" not found`), (s = e.closest(o)) == null || s.classList.add("is-light");
37
37
  }) : e.classList.add("is-light") : t && t !== "" ? t.split(",").forEach((o) => {
38
- var i;
39
- e.closest(o) || console.error(`closest "${o}" not found`), (i = e.closest(o)) == null || i.classList.add("is-dark");
38
+ var s;
39
+ e.closest(o) || console.error(`closest "${o}" not found`), (s = e.closest(o)) == null || s.classList.add("is-dark");
40
40
  }) : e.classList.add("is-dark");
41
41
  }
42
- function W(r, e, t) {
43
- const o = document.createElement("canvas"), i = o.getContext("2d");
42
+ function R(r, e, t) {
43
+ const o = document.createElement("canvas"), s = o.getContext("2d");
44
44
  if (o.width = 50, o.height = 50, r !== "" && e === "")
45
- i.fillStyle = r;
45
+ s.fillStyle = r;
46
46
  else if (r !== "" && e !== "") {
47
- const f = i.createLinearGradient(0, 0, o.width, o.height);
48
- f.addColorStop(0, r), f.addColorStop(1, e), i.fillStyle = f;
47
+ const p = s.createLinearGradient(0, 0, o.width, o.height);
48
+ p.addColorStop(0, r), p.addColorStop(1, e), s.fillStyle = p;
49
49
  }
50
- i.fillRect(0, 0, o.width, o.height);
51
- const p = new Image();
52
- return p.src = o.toDataURL(), p.crossOrigin = "Anonymous", p.addEventListener("load", function() {
53
- Q(this, t);
54
- }), p;
50
+ s.fillRect(0, 0, o.width, o.height);
51
+ const d = new Image();
52
+ return d.src = o.toDataURL(), d.crossOrigin = "Anonymous", d.addEventListener("load", function() {
53
+ W(this, t);
54
+ }), d;
55
55
  }
56
56
  function ie() {
57
57
  [...document.querySelectorAll(".detect-shade:not(.detected)")].forEach((e) => {
58
58
  if (e.tagName === "IMG")
59
59
  return;
60
- const t = ["#FFF", "#FFFFFF", "#fff", "#ffffff"], o = ["#000", "#000000"], i = getComputedStyle(e).getPropertyValue("--start-color"), p = getComputedStyle(e).getPropertyValue("--end-color");
61
- if (i === "" && p === "") {
60
+ const t = ["#FFF", "#FFFFFF", "#fff", "#ffffff"], o = ["#000", "#000000"], s = getComputedStyle(e).getPropertyValue("--start-color"), d = getComputedStyle(e).getPropertyValue("--end-color");
61
+ if (s === "" && d === "") {
62
62
  console.error(e, "=> No color set!");
63
63
  return;
64
- } else if (t.indexOf(i) > 0) {
64
+ } else if (t.indexOf(s) > 0) {
65
65
  console.warn(e, "=> TypeError!! ( #FFF ) "), G(255, e);
66
66
  return;
67
- } else if (o.indexOf(i) > 0) {
67
+ } else if (o.indexOf(s) > 0) {
68
68
  console.warn(e, "=> TypeError!! ( #000 ) "), G(0, e);
69
69
  return;
70
70
  }
71
- W(i, p, e);
71
+ R(s, d, e);
72
72
  });
73
73
  }
74
74
  const O = {
75
75
  CG_A: function(r) {
76
- b("html,body").delay(100).animate(
76
+ h("html,body").delay(100).animate(
77
77
  { opacity: "0" },
78
78
  {
79
79
  queue: !0,
@@ -86,7 +86,7 @@ const O = {
86
86
  );
87
87
  },
88
88
  CG_B: function(r) {
89
- b("main").append("<div id='CG_Abg'><div class='CG_Abg1'></div><div class='CG_Abg2'></div></div>"), b("body").delay(1200).animate(
89
+ h("main").append("<div id='CG_Abg'><div class='CG_Abg1'></div><div class='CG_Abg2'></div></div>"), h("body").delay(1200).animate(
90
90
  { opacity: "0" },
91
91
  {
92
92
  queue: !0,
@@ -101,7 +101,7 @@ const O = {
101
101
  );
102
102
  },
103
103
  CG_C: function(r) {
104
- b("main").append("<div id='CG_Bbg'></div>"), b("body").delay(1200).animate(
104
+ h("main").append("<div id='CG_Bbg'></div>"), h("body").delay(1200).animate(
105
105
  { opacity: "0" },
106
106
  {
107
107
  queue: !0,
@@ -116,7 +116,7 @@ const O = {
116
116
  );
117
117
  },
118
118
  CG_D: function(r) {
119
- b("main").append("<div id='CG_Cbg'><div class='CG_Cbg1'></div><div class='CG_Cbg2'></div></div>"), b("body").delay(1200).animate(
119
+ h("main").append("<div id='CG_Cbg'><div class='CG_Cbg1'></div><div class='CG_Cbg2'></div></div>"), h("body").delay(1200).animate(
120
120
  { opacity: "0" },
121
121
  {
122
122
  queue: !0,
@@ -130,7 +130,7 @@ const O = {
130
130
  }
131
131
  );
132
132
  }
133
- }, R = (r) => {
133
+ }, K = (r) => {
134
134
  switch (1) {
135
135
  case 1:
136
136
  O.CG_A(r);
@@ -145,38 +145,54 @@ const O = {
145
145
  O.CG_D(r);
146
146
  break;
147
147
  }
148
- }, K = (r) => {
148
+ }, j = (r, e) => {
149
149
  r.preventDefault();
150
- const e = b(r.currentTarget), t = e.attr("target"), o = e.attr("href");
151
- let i;
152
- e.hasClass("href-link") ? i = e.closest("[data-href]").attr("data-href") : i = o;
150
+ const t = h(r.currentTarget), o = t.attr("target"), s = t.attr("href");
151
+ let d;
152
+ if (e) {
153
+ if (t.is("[data-nolink]")) {
154
+ r.stopPropagation(), r.preventDefault();
155
+ return;
156
+ }
157
+ t.hasClass("click-block") ? d = t.closest("[data-href]").attr("data-href") : d = s;
158
+ } else {
159
+ if (t.is("[data-nolink]")) {
160
+ r.stopPropagation(), r.preventDefault();
161
+ return;
162
+ }
163
+ t.hasClass("href-link") ? d = t.closest("[data-href]").attr("data-href") : d = s;
164
+ }
153
165
  let f = window.location.pathname.replace("http://", "").split("/");
154
- f = a(f);
155
- const d = i.replace("http://", "");
156
- let n = d.split("/");
157
- n = a(n);
158
- function a(s) {
159
- const c = s.pop();
160
- return c.indexOf("#") > -1 || c.indexOf("html") > 0 ? s.push(c) : (c == "" || s.push(c), s.push("index.html")), s;
166
+ f = i(f);
167
+ const c = d.replace("http://", "");
168
+ let a = c.split("/");
169
+ a = i(a);
170
+ function i(u) {
171
+ const l = u.pop();
172
+ return l.indexOf("#") > -1 || l.indexOf("html") > 0 ? u.push(l) : (l == "" || u.push(l), u.push("index.html")), u;
161
173
  }
162
- t == "_blank" || r.ctrlKey || r.metaKey ? window.open(i) : d.indexOf("jpg") > -1 || d.indexOf("javascript") > -1 || R(i);
174
+ o == "_blank" || r.ctrlKey || r.metaKey ? window.open(d) : c.indexOf("jpg") > -1 || c.indexOf("javascript") > -1 || K(d);
163
175
  }, X = (r) => {
164
- const t = b(r.currentTarget).closest("[data-href]");
176
+ const t = h(r.currentTarget).closest("[data-href]");
165
177
  t.hasClass("isHover") || t.addClass("isHover");
166
178
  }, Y = (r) => {
167
- const t = b(r.currentTarget).closest("[data-href]");
179
+ const t = h(r.currentTarget).closest("[data-href]");
168
180
  t.hasClass("isHover") && t.removeClass("isHover");
169
- }, ae = () => {
170
- b.easing.jswing = b.easing.swing, b.extend(b.easing, {
181
+ }, ae = (r = !0) => {
182
+ h.easing.jswing = h.easing.swing, h.extend(h.easing, {
171
183
  def: "easeOutQuad",
172
- easeOutQuad: function(r, e, t, o, i) {
173
- return -o * (e /= i) * (e - 2) + t;
184
+ easeOutQuad: function(e, t, o, s, d) {
185
+ return -s * (t /= d) * (t - 2) + o;
174
186
  },
175
- easeInOutCirc: function(r, e, t, o, i) {
176
- return (e /= i / 2) < 1 ? -o / 2 * (Math.sqrt(1 - e * e) - 1) + t : o / 2 * (Math.sqrt(1 - (e -= 2) * e) + 1) + t;
187
+ easeInOutCirc: function(e, t, o, s, d) {
188
+ return (t /= d / 2) < 1 ? -s / 2 * (Math.sqrt(1 - t * t) - 1) + o : s / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + o;
177
189
  }
178
- }), b("body").on("click", "a:not(.nocg), .href-link", (r) => K(r)), b("body").on("mouseenter", "[data-href] a", (r) => X(r)), b("body").on("mouseleave", "[data-href] a", (r) => Y(r));
179
- }, q = {
190
+ }), r ? (h("body").on("click", "a:not(.nocg), .click-block, [data-nolink]", (e) => j(e, r)), h("body").on("click", "a:not(.nocg)", function(e) {
191
+ e.stopPropagation();
192
+ })) : (h("body").on("click", "a:not(.nocg), .href-link, [data-nolink]", (e) => j(e, r)), h("body").on("click", "a:not(.nocg)", function(e) {
193
+ e.stopPropagation();
194
+ })), h("body").on("mouseenter", "[data-href] a", (e) => X(e)), h("body").on("mouseleave", "[data-href] a", (e) => Y(e));
195
+ }, C = {
180
196
  "zh-TW": {
181
197
  format: "格式錯誤",
182
198
  input: "尚未填寫",
@@ -208,13 +224,13 @@ const O = {
208
224
  select: ""
209
225
  }
210
226
  };
211
- var T, j;
227
+ var T, P;
212
228
  class le {
213
229
  constructor(e, t) {
214
230
  /**
215
231
  * 綁事件
216
232
  */
217
- V(this, T);
233
+ D(this, T);
218
234
  this.element = document.querySelector(e), this.allField = this.element.querySelectorAll(`${e} [form-field]`), this.allInput = this.element.querySelectorAll(`${e} input`), this.allTextarea = this.element.querySelectorAll(`${e} textarea`), this.allCheckbox = this.element.querySelectorAll(`${e} input[type="checkbox"]`), this.allRadio = this.element.querySelectorAll(`${e} input[type="radio"]`), this.allFileUpload = this.element.querySelectorAll(`${e} fake-file-upload`), this.allDropdown = this.element.querySelectorAll(`${e} dropdown-el`), this.submitEvent = new Event("submit");
219
235
  const o = {
220
236
  locale: "zh-TW",
@@ -222,7 +238,7 @@ class le {
222
238
  {
223
239
  el: ".datepicker-input",
224
240
  options: {
225
- locale: P.Mandarin
241
+ locale: Q.Mandarin
226
242
  }
227
243
  }
228
244
  ],
@@ -244,18 +260,18 @@ class le {
244
260
  underField: !1,
245
261
  detailOutput: !1
246
262
  }
247
- }, i = (p, f) => {
248
- const d = { ...p };
249
- for (let n of Object.keys(f))
250
- typeof f[n] == "object" && n in p ? d[n] = Array.isArray(d[n]) ? [...f[n]] : i(p[n], f[n]) : d[n] = f[n];
251
- return d;
263
+ }, s = (d, p) => {
264
+ const f = { ...d };
265
+ for (let c of Object.keys(p))
266
+ typeof p[c] == "object" && c in d ? f[c] = Array.isArray(f[c]) ? [...p[c]] : s(d[c], p[c]) : f[c] = p[c];
267
+ return f;
252
268
  };
253
- this.options = t ? i(o, t) : o, this.init();
269
+ this.options = t ? s(o, t) : o, this.init();
254
270
  }
255
271
  init() {
256
272
  var t;
257
273
  const e = this;
258
- e.element.value = e.getValue(), e.detailOutputEl = e.options.errorText.detailOutput ? document.querySelector(e.options.errorText.detailOutput) : null, _(t = e, T, j).call(t);
274
+ e.element.value = e.getValue(), e.detailOutputEl = e.options.errorText.detailOutput ? document.querySelector(e.options.errorText.detailOutput) : null, V(t = e, T, P).call(t);
259
275
  }
260
276
  /**
261
277
  * 取得表單所有的值
@@ -265,47 +281,47 @@ class le {
265
281
  const e = this;
266
282
  let t = {};
267
283
  return [...e.allField].forEach((o) => {
268
- const i = o.getAttribute("form-field");
284
+ const s = o.getAttribute("form-field");
269
285
  switch (o.getAttribute("field-type")) {
270
286
  case "isRadio":
271
- const f = o.querySelector("input:checked"), d = f.querySelector('input[type="text"]');
272
- t[i] = {
273
- id: parseInt(f.closest(".option-item").querySelector(".text").getAttribute("data-id")),
274
- value: d ? d.value : f.closest(".option-item").querySelector(".text").textContent
287
+ const p = o.querySelector("input:checked"), f = p.querySelector('input[type="text"]');
288
+ t[s] = {
289
+ id: parseInt(p.closest(".option-item").querySelector(".text").getAttribute("data-id")),
290
+ value: f ? f.value : p.closest(".option-item").querySelector(".text").textContent
275
291
  };
276
292
  break;
277
293
  case "isCheckBox":
278
- const n = o.querySelectorAll("input:checked");
279
- t[i] = [...n].map((c) => {
280
- const u = c.querySelector('input[type="text"]');
294
+ const c = o.querySelectorAll("input:checked");
295
+ t[s] = [...c].map((u) => {
296
+ const l = u.querySelector('input[type="text"]');
281
297
  return {
282
- id: parseInt(c.closest(".option-item").querySelector(".text").getAttribute("data-id")),
283
- value: u ? u.value : c.closest(".option-item").querySelector(".text").textContent
298
+ id: parseInt(u.closest(".option-item").querySelector(".text").getAttribute("data-id")),
299
+ value: l ? l.value : u.closest(".option-item").querySelector(".text").textContent
284
300
  };
285
301
  });
286
302
  break;
287
303
  case "isSelect":
288
304
  switch (o.hasAttribute("multiple") ? "multiple" : "single") {
289
305
  case "single":
290
- t[i] = {
306
+ t[s] = {
291
307
  value: o.s.value.id ? o.s.value.id : "",
292
308
  display: o.s.value.el ? o.s.value.el.textContent : ""
293
309
  };
294
310
  break;
295
311
  case "multiple":
296
- t[i] = {
297
- value: o.s.value.map((c) => c.id),
298
- display: o.s.value.map((c) => c.el.textContent)
312
+ t[s] = {
313
+ value: o.s.value.map((u) => u.id),
314
+ display: o.s.value.map((u) => u.el.textContent)
299
315
  };
300
316
  break;
301
317
  }
302
318
  break;
303
319
  case "isFile":
304
- const s = o.closest(".file-wrap").querySelector(".fake-file-upload input");
305
- t[i] = s ? s.files : void 0;
320
+ const i = o.closest(".file-wrap").querySelector(".fake-file-upload input");
321
+ t[s] = i ? i.files : void 0;
306
322
  break;
307
323
  default:
308
- t[i] = o.value;
324
+ t[s] = o.value;
309
325
  break;
310
326
  }
311
327
  }), t;
@@ -316,111 +332,111 @@ class le {
316
332
  * @returns
317
333
  */
318
334
  verify(e) {
319
- var d;
320
- const t = this, { options: o } = t, i = t.element.value, p = e || i;
321
- function f(n) {
322
- var s, c, u, l;
335
+ var f;
336
+ const t = this, { options: o } = t, s = t.element.value, d = e || s;
337
+ function p(c) {
338
+ var i, u, l, n;
323
339
  const a = '<div class="validation-icon"></div>';
324
- for (const v in n) {
325
- const S = t.element.querySelector(`[form-field="${v}"]`), L = S.getAttribute("data-verify"), m = S.closest(".form-group");
340
+ for (const g in c) {
341
+ const x = t.element.querySelector(`[form-field="${g}"]`), L = x.getAttribute("data-verify"), m = x.closest(".form-group");
326
342
  switch (L) {
327
343
  case "select":
328
- const E = S.querySelector(".select-wrapper"), y = E.querySelector(".dropdown-icon");
329
- (s = E.querySelector(".validation-icon")) == null || s.remove(), E.insertBefore(C(a), y);
344
+ const E = x.querySelector(".select-wrapper"), y = E.querySelector(".dropdown-icon");
345
+ (i = E.querySelector(".validation-icon")) == null || i.remove(), E.insertBefore(q(a), y);
330
346
  break;
331
347
  case "radio":
332
348
  case "checkbox":
333
- (c = m.querySelector(".validation-icon")) == null || c.remove(), m.append(C(a));
349
+ (u = m.querySelector(".validation-icon")) == null || u.remove(), m.append(q(a));
334
350
  break;
335
351
  case "file":
336
- const h = S.closest(".file-wrap").querySelector(".fake-file-upload"), x = S.closest(".file-wrap").querySelector(".upload-icon");
337
- (u = h.querySelector(".validation-icon")) == null || u.remove(), x ? h.insertBefore(C(a), x) : h.append(C(a));
352
+ const v = x.closest(".file-wrap").querySelector(".fake-file-upload"), k = x.closest(".file-wrap").querySelector(".upload-icon");
353
+ (l = v.querySelector(".validation-icon")) == null || l.remove(), k ? v.insertBefore(q(a), k) : v.append(q(a));
338
354
  break;
339
355
  case "date":
340
356
  case "textarea":
341
357
  default:
342
- (l = S.closest(".input-wrap").querySelector(".validation-icon")) == null || l.remove(), S.closest(".input-wrap").append(C(a));
358
+ (n = x.closest(".input-wrap").querySelector(".validation-icon")) == null || n.remove(), x.closest(".input-wrap").append(q(a));
343
359
  break;
344
360
  }
345
361
  }
346
362
  }
347
- if (f(p), e) {
348
- const n = Object.keys(p)[0];
349
- t.element.querySelectorAll(`.error-text[name="${n}"]`).forEach((a) => a.remove());
363
+ if (p(d), e) {
364
+ const c = Object.keys(d)[0];
365
+ t.element.querySelectorAll(`.error-text[name="${c}"]`).forEach((a) => a.remove());
350
366
  } else
351
- t.element.querySelectorAll(".error-text").forEach((n) => n.remove());
352
- for (const n in p) {
353
- let m = function(h, x, k) {
354
- const g = t.element.querySelector(`[form-field="${n}"]`), $ = [...t.element.querySelectorAll("[form-field]")].indexOf(g), A = (F) => `<p class="error-text" name="${n}" index="${$}">${c} - ${q[o.locale][F]}</p>`;
355
- switch (x) {
367
+ t.element.querySelectorAll(".error-text").forEach((c) => c.remove());
368
+ for (const c in d) {
369
+ let m = function(v, k, S) {
370
+ const b = t.element.querySelector(`[form-field="${c}"]`), $ = [...t.element.querySelectorAll("[form-field]")].indexOf(b), A = (F) => `<p class="error-text" name="${c}" index="${$}">${u} - ${C[o.locale][F]}</p>`;
371
+ switch (k) {
356
372
  case "underField":
357
373
  if (!o.errorText.underField)
358
374
  return;
359
- k.append(C(A(h)));
375
+ S.append(q(A(v)));
360
376
  break;
361
377
  case "detail":
362
- if (!k)
378
+ if (!S)
363
379
  return;
364
- k.append(C(A(h)));
380
+ S.append(q(A(v)));
365
381
  break;
366
382
  }
367
383
  }, E = function() {
368
- const h = t.detailOutputEl.querySelectorAll(".error-text");
369
- [...h].length > 0 ? t.element.classList.add("something-wrong") : t.element.classList.remove("something-wrong");
370
- const x = [...h].sort((k, g) => k.getAttribute("index") - g.getAttribute("index"));
371
- t.detailOutputEl && (t.detailOutputEl.textContent = ""), x.forEach((k) => {
372
- var g;
373
- return (g = t.detailOutputEl) == null ? void 0 : g.appendChild(k);
384
+ const v = t.detailOutputEl.querySelectorAll(".error-text");
385
+ [...v].length > 0 ? t.element.classList.add("something-wrong") : t.element.classList.remove("something-wrong");
386
+ const k = [...v].sort((S, b) => S.getAttribute("index") - b.getAttribute("index"));
387
+ t.detailOutputEl && (t.detailOutputEl.textContent = ""), k.forEach((S) => {
388
+ var b;
389
+ return (b = t.detailOutputEl) == null ? void 0 : b.appendChild(S);
374
390
  });
375
391
  };
376
- const a = t.element.querySelector(`[form-field="${n}"]`), s = a.closest(".form-group"), c = (d = s.querySelector(".subject")) == null ? void 0 : d.textContent, u = a.getAttribute("data-verify"), l = () => typeof i[n] == "object" && !Array.isArray(i[n]) ? u === "file" ? i[n] : i[n].value : i[n], v = () => u === "file" ? l() === void 0 ? !0 : l() && l().length === 0 : Array.isArray(l()) && l().length === 0 || !Array.isArray(l()) && w.isEmpty(l()), S = () => u === "file" ? l() === void 0 ? !1 : l() && l().length > 0 : Array.isArray(l()) && l().length > 0 || !Array.isArray(l()) && !w.isEmpty(l()), L = s.classList.contains("required");
392
+ const a = t.element.querySelector(`[form-field="${c}"]`), i = a.closest(".form-group"), u = (f = i.querySelector(".subject")) == null ? void 0 : f.textContent, l = a.getAttribute("data-verify"), n = () => typeof s[c] == "object" && !Array.isArray(s[c]) ? l === "file" ? s[c] : s[c].value : s[c], g = () => l === "file" ? n() === void 0 ? !0 : n() && n().length === 0 : Array.isArray(n()) && n().length === 0 || !Array.isArray(n()) && w.isEmpty(n()), x = () => l === "file" ? n() === void 0 ? !1 : n() && n().length > 0 : Array.isArray(n()) && n().length > 0 || !Array.isArray(n()) && !w.isEmpty(n()), L = i.classList.contains("required");
377
393
  let y;
378
- if (L && v())
379
- switch (a.classList.remove("success"), a.classList.add("error"), s.classList.add("error"), u) {
394
+ if (L && g())
395
+ switch (a.classList.remove("success"), a.classList.add("error"), i.classList.add("error"), l) {
380
396
  case "select":
381
- y = a.querySelector(".validation-icon"), y.setAttribute("error-text", q[o.locale].select), m("select", "underField", s.parentNode), m("select", "detail", t.detailOutputEl);
397
+ y = a.querySelector(".validation-icon"), y.setAttribute("error-text", C[o.locale].select), m("select", "underField", i.parentNode), m("select", "detail", t.detailOutputEl);
382
398
  break;
383
399
  case "radio":
384
400
  case "checkbox":
385
- y = s.querySelector(".validation-icon"), y.setAttribute("error-text", q[o.locale].select), m("select", "underField", s.parentNode), m("select", "detail", t.detailOutputEl);
401
+ y = i.querySelector(".validation-icon"), y.setAttribute("error-text", C[o.locale].select), m("select", "underField", i.parentNode), m("select", "detail", t.detailOutputEl);
386
402
  break;
387
403
  case "file":
388
- y = a.closest(".file-wrap").querySelector(".validation-icon"), y.setAttribute("error-text", q[o.locale].file), m("file", "underField", s.parentNode), m("file", "detail", t.detailOutputEl);
404
+ y = a.closest(".file-wrap").querySelector(".validation-icon"), y.setAttribute("error-text", C[o.locale].file), m("file", "underField", i.parentNode), m("file", "detail", t.detailOutputEl);
389
405
  break;
390
406
  default:
391
- y = a.closest(".input-wrap").querySelector(".validation-icon"), y.setAttribute("error-text", q[o.locale].input), m("input", "underField", s.parentNode), m("input", "detail", t.detailOutputEl);
407
+ y = a.closest(".input-wrap").querySelector(".validation-icon"), y.setAttribute("error-text", C[o.locale].input), m("input", "underField", i.parentNode), m("input", "detail", t.detailOutputEl);
392
408
  break;
393
409
  }
394
- if (S()) {
395
- let h = function(x, k) {
396
- const g = x.closest(".form-group");
397
- x.classList.toggle("error", !k), x.classList.toggle("success", k);
398
- const A = x.getAttribute("data-verify") === "phone" ? g.querySelector("*:not(input)[form-field]") : g.querySelector("*:not(dropdown-el)[form-field]"), F = !!A, I = x.classList.contains("success"), B = x.classList.contains("error"), M = A == null ? void 0 : A.classList.contains("success"), N = A == null ? void 0 : A.classList.contains("error");
399
- F ? M && !N && I ? (g.classList.remove("error"), g.classList.add("success")) : (N || B) && (g.classList.remove("success"), g.classList.add("error")) : I ? (g.classList.remove("error"), g.classList.add("success")) : (g.classList.add("error"), g.classList.remove("success"));
410
+ if (x()) {
411
+ let v = function(k, S) {
412
+ const b = k.closest(".form-group");
413
+ k.classList.toggle("error", !S), k.classList.toggle("success", S);
414
+ const A = k.getAttribute("data-verify") === "phone" ? b.querySelector("*:not(input)[form-field]") : b.querySelector("*:not(dropdown-el)[form-field]"), F = !!A, I = k.classList.contains("success"), B = k.classList.contains("error"), M = A == null ? void 0 : A.classList.contains("success"), N = A == null ? void 0 : A.classList.contains("error");
415
+ F ? M && !N && I ? (b.classList.remove("error"), b.classList.add("success")) : (N || B) && (b.classList.remove("success"), b.classList.add("error")) : I ? (b.classList.remove("error"), b.classList.add("success")) : (b.classList.add("error"), b.classList.remove("success"));
400
416
  };
401
- switch (u) {
417
+ switch (l) {
402
418
  case "phone":
403
- const x = s.querySelector("dropdown-el");
404
- w.isMobilePhone(l()) ? (h(a, !0), x && x.classList.contains("success") && (s.classList.remove("error"), s.classList.add("success"))) : (h(a, !1), y = a.closest(".input-wrap").querySelector(".validation-icon"), y.setAttribute("error-text", q[o.locale].format), m("format", "underField", s.parentNode), m("format", "detail", t.detailOutputEl));
419
+ const k = i.querySelector("dropdown-el");
420
+ w.isMobilePhone(n()) ? (v(a, !0), k && k.classList.contains("success") && (i.classList.remove("error"), i.classList.add("success"))) : (v(a, !1), y = a.closest(".input-wrap").querySelector(".validation-icon"), y.setAttribute("error-text", C[o.locale].format), m("format", "underField", i.parentNode), m("format", "detail", t.detailOutputEl));
405
421
  break;
406
422
  case "password":
407
- w.isStrongPassword(l(), {
423
+ w.isStrongPassword(n(), {
408
424
  minLength: 8,
409
425
  minLowercase: 1,
410
426
  minUppercase: 0,
411
427
  minNumbers: 1,
412
428
  minSymbols: 0
413
- }) ? h(a, !0) : (h(a, !1), y = a.closest(".input-wrap").querySelector(".validation-icon"), y.setAttribute("error-text", q[o.locale].format), m("format", "underField", s.parentNode), m("format", "detail", t.detailOutputEl));
429
+ }) ? v(a, !0) : (v(a, !1), y = a.closest(".input-wrap").querySelector(".validation-icon"), y.setAttribute("error-text", C[o.locale].format), m("format", "underField", i.parentNode), m("format", "detail", t.detailOutputEl));
414
430
  break;
415
431
  case "email":
416
- w.isEmail(l()) ? h(a, !0) : (h(a, !1), y = a.closest(".input-wrap").querySelector(".validation-icon"), y.setAttribute("error-text", q[o.locale].format), m("format", "underField", s.parentNode), m("format", "detail", t.detailOutputEl));
432
+ w.isEmail(n()) ? v(a, !0) : (v(a, !1), y = a.closest(".input-wrap").querySelector(".validation-icon"), y.setAttribute("error-text", C[o.locale].format), m("format", "underField", i.parentNode), m("format", "detail", t.detailOutputEl));
417
433
  break;
418
434
  case "verifyCode":
419
- w.isNumeric(l(), { no_symbols: !0 }) && w.isLength(l(), { min: 4, max: 4 }) ? h(a, !0) : (h(a, !1), y = a.closest(".input-wrap").querySelector(".validation-icon"), y.setAttribute("error-text", q[o.locale].format), m("format", "underField", s.parentNode), m("format", "detail", t.detailOutputEl));
435
+ w.isNumeric(n(), { no_symbols: !0 }) && w.isLength(n(), { min: 4, max: 4 }) ? v(a, !0) : (v(a, !1), y = a.closest(".input-wrap").querySelector(".validation-icon"), y.setAttribute("error-text", C[o.locale].format), m("format", "underField", i.parentNode), m("format", "detail", t.detailOutputEl));
420
436
  break;
421
437
  case "select":
422
438
  default:
423
- h(a, !0);
439
+ v(a, !0);
424
440
  break;
425
441
  }
426
442
  }
@@ -438,96 +454,96 @@ class le {
438
454
  * 清除表單所有欄位
439
455
  */
440
456
  clear() {
441
- const e = this, { allInput: t, allTextarea: o, allCheckbox: i, allFileUpload: p, allDropdown: f } = e;
442
- [...e.allField].forEach((d) => {
457
+ const e = this, { allInput: t, allTextarea: o, allCheckbox: s, allFileUpload: d, allDropdown: p } = e;
458
+ [...e.allField].forEach((f) => {
443
459
  var a;
444
- const n = d.closest(".form-group");
445
- n.classList.remove("success"), n.classList.remove("error"), d.classList.remove("success"), d.classList.remove("error"), (a = d.closest(".form-grid").querySelector(".error-text")) == null || a.remove(), e.detailOutputEl && (e.detailOutputEl.textContent = "");
446
- }), [...t].forEach((d) => {
447
- d.value = "";
448
- }), [...o].forEach((d) => {
449
- d.value = "";
450
- }), [...i].forEach((d) => {
451
- d.checked = !1;
452
- }), [...p].forEach((d) => {
453
- let n = d.getAttribute("data-default");
454
- const a = n.querySelector(".file-name");
455
- a.classList.remove("is-upload"), a.textContent = n;
456
- }), [...f].forEach((d) => {
457
- d.setAttribute("d4-value", ""), d.hasAttribute("control-elements") && [...d.getAttribute("control-elements").split(",")].forEach((a) => {
460
+ const c = f.closest(".form-group");
461
+ c.classList.remove("success"), c.classList.remove("error"), f.classList.remove("success"), f.classList.remove("error"), (a = f.closest(".form-grid").querySelector(".error-text")) == null || a.remove(), e.detailOutputEl && (e.detailOutputEl.textContent = "");
462
+ }), [...t].forEach((f) => {
463
+ f.value = "";
464
+ }), [...o].forEach((f) => {
465
+ f.value = "";
466
+ }), [...s].forEach((f) => {
467
+ f.checked = !1;
468
+ }), [...d].forEach((f) => {
469
+ let c = f.getAttribute("data-default");
470
+ const a = c.querySelector(".file-name");
471
+ a.classList.remove("is-upload"), a.textContent = c;
472
+ }), [...p].forEach((f) => {
473
+ f.setAttribute("d4-value", ""), f.hasAttribute("control-elements") && [...f.getAttribute("control-elements").split(",")].forEach((a) => {
458
474
  document.querySelector(a).classList.remove("disabled");
459
475
  });
460
476
  }), e.element.value = e.getValue();
461
477
  }
462
478
  }
463
- T = new WeakSet(), j = function() {
464
- const e = this, { datepicker: t, timepicker: o, clearEl: i, submitEl: p } = e.options;
465
- function f() {
466
- t.forEach((s) => {
467
- D(s.el, s.options);
468
- }), o.forEach((s) => {
469
- D(s.el, s.options);
479
+ T = new WeakSet(), P = function() {
480
+ const e = this, { datepicker: t, timepicker: o, clearEl: s, submitEl: d } = e.options;
481
+ function p() {
482
+ t.forEach((i) => {
483
+ _(i.el, i.options);
484
+ }), o.forEach((i) => {
485
+ _(i.el, i.options);
470
486
  });
471
487
  }
472
- function d() {
473
- const s = document.querySelector(i), c = document.querySelector(p);
474
- s == null || s.addEventListener("click", function() {
488
+ function f() {
489
+ const i = document.querySelector(s), u = document.querySelector(d);
490
+ i == null || i.addEventListener("click", function() {
475
491
  e.clear();
476
- }), c == null || c.addEventListener("click", function() {
492
+ }), u == null || u.addEventListener("click", function() {
477
493
  e.submit();
478
494
  });
479
495
  }
480
- function n(s) {
496
+ function c(i) {
481
497
  var y;
482
- const c = s.closest(".form-group");
483
- if (s.files.length <= 0)
498
+ const u = i.closest(".form-group");
499
+ if (i.files.length <= 0)
484
500
  return;
485
- const u = s.closest(".file-wrap").querySelector(".fake-file-upload");
486
- u.getAttribute("data-default");
487
- const l = u.querySelector(".file-name"), v = Number(s.getAttribute("data-limit")), S = s.files[0], L = S.size / 1024 / 1024, m = S.name, E = s.cloneNode(!0);
488
- L > v ? (c.classList.add("error"), c.classList.remove("success"), E.value = "") : (c.classList.remove("error"), c.classList.add("success")), l.textContent = m, E.removeAttribute("form-field field-type data-limit"), (y = u.querySelector('input[type="file"]')) == null || y.remove(), u.append(E);
501
+ const l = i.closest(".file-wrap").querySelector(".fake-file-upload");
502
+ l.getAttribute("data-default");
503
+ const n = l.querySelector(".file-name"), g = Number(i.getAttribute("data-limit")), x = i.files[0], L = x.size / 1024 / 1024, m = x.name, E = i.cloneNode(!0);
504
+ L > g ? (u.classList.add("error"), u.classList.remove("success"), E.value = "") : (u.classList.remove("error"), u.classList.add("success")), n.textContent = m, E.removeAttribute("form-field field-type data-limit"), (y = l.querySelector('input[type="file"]')) == null || y.remove(), l.append(E);
489
505
  }
490
506
  function a() {
491
- function s(c) {
492
- const { target: u } = c;
493
- let l, v;
494
- u.matches('[type="radio"], [type="checkbox"]') && (e.element.value = e.getValue(), l = u.closest(".form-check").getAttribute("form-field"), v = {
495
- [l]: e.element.value[l]
496
- }, e.options.verify && e.verify(v)), u.matches('[type="file"]') && (n(u), e.element.value = e.getValue(), l = u.getAttribute("form-field"), v = {
497
- [l]: e.element.value[l]
498
- }, e.options.verify && e.verify(v));
507
+ function i(u) {
508
+ const { target: l } = u;
509
+ let n, g;
510
+ l.matches('[type="radio"], [type="checkbox"]') && (e.element.value = e.getValue(), n = l.closest(".form-check").getAttribute("form-field"), g = {
511
+ [n]: e.element.value[n]
512
+ }, e.options.verify && e.verify(g)), l.matches('[type="file"]') && (c(l), e.element.value = e.getValue(), n = l.getAttribute("form-field"), g = {
513
+ [n]: e.element.value[n]
514
+ }, e.options.verify && e.verify(g));
499
515
  }
500
516
  e.element.addEventListener(
501
517
  "input",
502
- z(function(c) {
503
- const { target: u } = c;
504
- if (u.matches('[type="text"],[type="number"],[type="email"],[type="password"], textarea')) {
505
- if (e.element.value = e.getValue(), !u.closest(".form-group").classList.contains("required") && u.hasAttribute("data-verify")) {
506
- w.isEmpty(u.value) && (u.classList.remove("error"), u.classList.remove("success"), u.closest(".form-group").classList.remove("error"));
518
+ z(function(u) {
519
+ const { target: l } = u;
520
+ if (l.matches('[type="text"],[type="number"],[type="email"],[type="password"], textarea')) {
521
+ if (e.element.value = e.getValue(), !l.closest(".form-group").classList.contains("required") && l.hasAttribute("data-verify")) {
522
+ w.isEmpty(l.value) && (l.classList.remove("error"), l.classList.remove("success"), l.closest(".form-group").classList.remove("error"));
507
523
  return;
508
524
  }
509
- const l = u.getAttribute("form-field"), v = {
510
- [l]: e.element.value[l]
525
+ const n = l.getAttribute("form-field"), g = {
526
+ [n]: e.element.value[n]
511
527
  };
512
- e.options.verify && e.verify(v);
528
+ e.options.verify && e.verify(g);
513
529
  }
514
530
  })
515
- ), e.allCheckbox.forEach((c) => {
516
- c.addEventListener("change", s);
517
- }), e.allRadio.forEach((c) => {
518
- c.addEventListener("change", s);
519
- }), e.allDropdown.forEach((c) => {
520
- c.on("change", function() {
521
- const u = this.getAttribute("form-field");
531
+ ), e.allCheckbox.forEach((u) => {
532
+ u.addEventListener("change", i);
533
+ }), e.allRadio.forEach((u) => {
534
+ u.addEventListener("change", i);
535
+ }), e.allDropdown.forEach((u) => {
536
+ u.on("change", function() {
537
+ const l = this.getAttribute("form-field");
522
538
  e.element.value = e.getValue();
523
- const l = e.element.value[u], v = typeof l == "object" && !Array.isArray(l) ? l.value : l, S = {
524
- [u]: l
539
+ const n = e.element.value[l], g = typeof n == "object" && !Array.isArray(n) ? n.value : n, x = {
540
+ [l]: n
525
541
  };
526
- (Array.isArray(v) && v.length > 0 || !Array.isArray(v) && !w.isEmpty(v)) && e.options.verify && e.verify(S);
542
+ (Array.isArray(g) && g.length > 0 || !Array.isArray(g) && !w.isEmpty(g)) && e.options.verify && e.verify(x);
527
543
  });
528
544
  });
529
545
  }
530
- f(), d(), a();
546
+ p(), f(), a();
531
547
  };
532
548
  export {
533
549
  le as CustomForm,
@@ -539,25 +555,25 @@ export {
539
555
  me as clickToggleClass,
540
556
  G as colorPick,
541
557
  ye as countDown,
542
- W as createColorCube,
558
+ R as createColorCube,
543
559
  z as debounce,
544
560
  he as delay,
545
561
  ve as detectMacOSVersion,
546
- Q as detectShade,
562
+ W as detectShade,
547
563
  se as errorPage,
548
- q as errorText,
564
+ C as errorText,
549
565
  ge as fixMobile100vh,
550
566
  be as formatFloat,
551
- xe as getSlideDataIndex,
552
- Se as getSlidesCount,
553
- ke as getTransformX,
567
+ ke as getSlideDataIndex,
568
+ xe as getSlidesCount,
569
+ Se as getTransformX,
554
570
  Ae as getTransformY,
555
- C as htmlStringToDOM,
571
+ q as htmlStringToDOM,
556
572
  Ee as imagePreview,
557
573
  ie as init,
558
574
  we as isVideo,
559
- qe as letterGrow,
560
- Ce as loaded,
575
+ Ce as letterGrow,
576
+ qe as loaded,
561
577
  Le as loading,
562
578
  Oe as numberGrow,
563
579
  Te as scrollLock,
@@ -566,6 +582,6 @@ export {
566
582
  $e as slideImgDetect,
567
583
  Ie as tabChange,
568
584
  Ne as throttle,
569
- Ve as wordAnimation
585
+ De as wordAnimation
570
586
  };
571
587
  //# sourceMappingURL=tools-bundle.js.map