@xwadex/fesd 0.0.34 → 0.0.36

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