!function (u, p) { "use strict"; u.Package.name = "KenFiles", u.Package.version = "3.2.0"; var c = p(window), a = p("body"), d = p(document), e = "nk-menu", s = "nk-header", r = "nk-header-menu", l = u.Break; function f(t, n) { return Object.keys(n).forEach(function (e) { t[e] = n[e]; }), t; } u.ClassNavMenu = function () { u.BreakClass("." + r, l.lg, { timeOut: 0 }), c.on("resize", function () { u.BreakClass("." + r, l.lg); }); }, u.Prettify = function () { window.prettyPrint && prettyPrint(); }, u.Copied = function () { var e = ".clipboard-init", i = ".clipboard-text", o = "clipboard-success", s = "clipboard-error"; function t(e, t) { var e = p(e), n = e.parent(), a = { text: "Copy", done: "Copied", fail: "Failed" }, e = { text: e.data("clip-text"), done: e.data("clip-success"), fail: e.data("clip-error") }, e = (a.text = e.text || a.text, a.done = e.done || a.done, a.fail = e.fail || a.fail, "success" === t ? a.done : a.fail); n.addClass("success" === t ? o : s).find(i).html(e), setTimeout(function () { n.removeClass(o + " " + s).find(i).html(a.text).blur(), n.find("input").blur(); }, 2e3); } ClipboardJS.isSupported() ? new ClipboardJS(e).on("success", function (e) { t(e.trigger, "success"), e.clearSelection(); }).on("error", function (e) { t(e.trigger, "error"); }) : p(e).css("display", "none"); }, u.CurrentLink = function () { var e = window.location.href, n = (n = e.substring(0, -1 == e.indexOf("#") ? e.length : e.indexOf("#"))).substring(0, -1 == n.indexOf("?") ? n.length : n.indexOf("?")); p(".nk-menu-link, .menu-link, .nav-link").each(function () { var e = p(this), t = e.attr("href"); n.match(t) ? (e.closest("li").addClass("active current-page").parents().closest("li").addClass("active current-page"), e.closest("li").children(".nk-menu-sub").css("display", "block"), e.parents().closest("li").children(".nk-menu-sub").css("display", "block")) : e.closest("li").removeClass("active current-page").parents().closest("li:not(.current-page)").removeClass("active"); }); }, u.CurrentAdminLink = function () { let a = !1; var e = "#admin_side_menu ul li a.nk-fmg-menu-item"; let t = window.location.href; if (console.log(t), p(e).each(function () { var e = p(this); e.attr("href") == t && (a = !0, i(e)); }), !a) { let n = t.substring(0, -1 == t.indexOf("#") ? t.length : t.indexOf("#")); n = n.substring(0, -1 == n.indexOf("?") ? n.length : n.indexOf("?")), p(e).each(function () { var e = p(this), t = e.attr("href"); n.match(t) && (a = !0, i(e)); }); } function i(e) { e.addClass("active"), e.closest("ul").closest("li").addClass("active").children(".collapsed").removeClass("collapsed"), e.closest("div").addClass("show"); } a || p("#admin_side_menu_home").addClass("active"); }, u.PassSwitch = function () { u.Passcode(".passcode-switch"); }, u.TGL.screen = function (e) { p(e).exists() && p(e).each(function () { var e = p(this).data("toggle-screen"); e && p(this).addClass("toggle-screen-" + e); }); }, u.TGL.content = function (e, t) { var e = p(e || ".toggle"), n = p("[data-content]"), s = !1, a = { active: "active", content: "content-active", break: !0 }, r = t ? f(a, t) : a; u.TGL.screen(n), e.on("click", function (e) { s = this, u.Toggle.trigger(p(this).data("target"), r), e.preventDefault(); }), d.on("mouseup", function (e) { var t, n, a, i, o; s && (t = p(s), n = p(s).data("target"), n = p(`[data-content="${n}"]`), a = p(".datepicker-dropdown"), i = p(".ui-timepicker-container"), o = p(".modal"), t.is(e.target) || 0 !== t.has(e.target).length || n.is(e.target) || 0 !== n.has(e.target).length || 0 !== p(e.target).closest(".select2-container").length || a.is(e.target) || 0 !== a.has(e.target).length || i.is(e.target) || 0 !== i.has(e.target).length || o.is(e.target) || 0 !== o.has(e.target).length || (u.Toggle.removed(t.data("target"), r), s = !1)); }), c.on("resize", function () { n.each(function () { var e = p(this).data("content"), t = p(this).data("toggle-screen"), t = l[t]; u.Win.width > t && u.Toggle.removed(e, r); }); }); }, u.TGL.expand = function (e, t) { var e = e || ".expand", n = { toggle: !0 }, a = t ? f(n, t) : n; p(e).on("click", function (e) { u.Toggle.trigger(p(this).data("target"), a), e.preventDefault(); }); }, u.TGL.ddmenu = function (e, t) { var e = e || ".nk-menu-toggle", n = { active: "active", self: "nk-menu-toggle", child: "nk-menu-sub" }, a = t ? f(n, t) : n; p(e).on("click", function (e) { u.Win.width < l.lg && u.Toggle.dropMenu(p(this), a), e.preventDefault(); }); }, u.TGL.showmenu = function (e, t) { var n = p(e || ".nk-nav-toggle"), a = p("[data-content]"), i = a.hasClass(r) ? l.lg : l.xl, e = { active: "toggle-active", content: s + "-active", body: "nav-shown", overlay: "nk-header-overlay", break: i, close: { profile: !0, menu: !1 } }, o = t ? f(e, t) : e; n.on("click", function (e) { u.Toggle.trigger(p(this).data("target"), o), e.preventDefault(); }), d.on("mouseup", function (e) { !n.is(e.target) && 0 === n.has(e.target).length && !a.is(e.target) && 0 === a.has(e.target).length && u.Win.width < i && u.Toggle.removed(n.data("target"), o); }), c.on("resize", function () { (u.Win.width < l.xl || u.Win.width < i) && !u.State.isMobile && u.Toggle.removed(n.data("target"), o); }); }, u.Ani.formSearch = function (e, t) { var n = { active: "active", timeout: 400, target: "[data-search]" }, a = t ? f(n, t) : n, i = p(e), o = p(a.target); i.exists() && (i.on("click", function (e) { e.preventDefault(); var e = p(this).data("target"), t = p("[data-search=" + e + "]"), e = p("[data-target=" + e + "]"); t.hasClass(a.active) ? (e.add(t).removeClass(a.active), setTimeout(function () { t.find("input").val(""); }, a.timeout)) : (e.add(t).addClass(a.active), t.find("input").focus()); }), d.on({ keyup: function (e) { "Escape" === e.key && i.add(o).removeClass(a.active); }, mouseup: function (e) { o.find("input").val() || o.is(e.target) || 0 !== o.has(e.target).length || i.is(e.target) || 0 !== i.has(e.target).length || i.add(o).removeClass(a.active); } })); }, u.Ani.formElm = function (e, t) { var n = { focus: "focused" }, a = t ? f(n, t) : n; p(e).exists() && p(e).each(function () { var e = p(this); e.val() && e.parent().addClass(a.focus), e.on({ focus: function () { e.parent().addClass(a.focus); }, blur: function () { e.val() || e.parent().removeClass(a.focus); } }); }); }, u.Validate = function (e, t) { p(e).exists() && (p(e).each(function () { var e = { errorElement: "span" }, e = t ? f(e, t) : e; p(this).validate(e); }), u.Validate.OnChange(".js-select2"), u.Validate.OnChange(".date-picker"), u.Validate.OnChange(".js-tagify")); }, u.Validate.OnChange = function (e) { p(e).on("change", function () { p(this).valid(); }); }, u.Validate.init = function () { u.Validate(".form-validate", { errorElement: "span", errorClass: "invalid", errorPlacement: function (e, t) { t.parents().hasClass("input-group") ? e.appendTo(t.parent().parent()) : e.appendTo(t.parent()); } }); }, u.Wizard = function () { var e = p(".nk-wizard"); e.exists() && e.each(function () { var e = p(this).attr("id"), a = p("#" + e).show(); a.steps({ headerTag: ".nk-wizard-head", bodyTag: ".nk-wizard-content", labels: { finish: "Submit", next: "Next", previous: "Prev", loading: "Loading ..." }, titleTemplate: '0#index# #title#', onStepChanging: function (e, t, n) { return n < t || (t < n && (a.find(".body:eq(" + n + ") label.error").remove(), a.find(".body:eq(" + n + ") .error").removeClass("error")), a.validate().settings.ignore = ":disabled,:hidden", a.valid()); }, onFinishing: function (e, t) { return a.validate().settings.ignore = ":disabled", a.valid(); }, onFinished: function (e, t) { window.location.href = "#"; } }).validate({ errorElement: "span", errorClass: "invalid", errorPlacement: function (e, t) { e.appendTo(t.parent()); } }); }); }, u.BS.ddfix = function (e, t) { var n = t || "a:not(.clickable), button:not(.clickable), a:not(.clickable) *, button:not(.clickable) *"; p(e || ".dropdown-menu").on("click", function (e) { p(e.target).is(n) || e.stopPropagation(); }), u.State.isRTL && p(".dropdown-menu").each(function () { var e = p(this); e.hasClass("dropdown-menu-end") && !e.hasClass("dropdown-menu-center") ? e.prev('[data-bs-toggle="dropdown"]').dropdown({ popperConfig: { placement: "bottom-start" } }) : e.hasClass("dropdown-menu-end") || e.hasClass("dropdown-menu-center") || e.prev('[data-bs-toggle="dropdown"]').dropdown({ popperConfig: { placement: "bottom-end" } }); }); }, u.BS.tabfix = function (e) { p(e || '[data-bs-toggle="modal"]').on("click", function () { var e = p(this), t = e.data("target"), n = e.attr("href"), e = e.data("tab-target"), t = t ? a.find(t) : a.find(n); e && "#" !== e && t ? t.find('[href="' + e + '"]').tab("show") : t && (n = t.find(".nk-nav.nav-tabs"), e = p(n[0]).find('[data-toggle="tab"]'), p(e[0]).tab("show")); }); }, u.ModeSwitch2 = function () { var e = p("#swDarkMode"); a.hasClass("dark-mode") ? (e.hasClass("checked") || e.addClass("checked"), console.log("is Dark")) : (e.hasClass("checked") && e.removeClass("checked"), console.log("is Light")), p("#isDarkMode").on("click", function () { a.toggleClass("dark-mode"); var e = a.hasClass("dark-mode") ? "dark" : "light"; Cookies.set("style-mode", e, { expires: 7, sameSite: "Strict", secure: !1 }); }); }, u.ModeSwitch = function () { var e = p(".dark-switch"); a.hasClass("dark-mode") ? e.addClass("active") : e.removeClass("active"), e.on("click", function (e) { e.preventDefault(), p(this).toggleClass("active"), a.toggleClass("dark-mode"); e = p(this).hasClass("active") ? "dark" : "light"; Cookies.set("style-mode", e, { expires: 7, sameSite: "Strict", secure: !1 }); }); }, u.Knob = function (e, t) { var n, a; p(e).exists() && "function" == typeof p.fn.knob && (n = { min: 0 }, a = t ? f(n, t) : n, p(e).each(function () { p(this).knob(a); })); }, u.Knob.init = function () { var e = { readOnly: !0, lineCap: "round" }, t = { angleOffset: -90, angleArc: 180, readOnly: !0, lineCap: "round" }; u.Knob(".knob", e), u.Knob(".knob-half", t); }, u.Range = function (e, l) { p(e).exists() && "undefined" != typeof noUiSlider && p(e).each(function () { var e = p(this), t = e.attr("id"), n = e.data("start"), n = (n = /\s/g.test(n) ? n.split(" ") : n) || 0, a = e.data("connect"), a = void 0 === (a = /\s/g.test(a) ? a.split(" ") : a) ? "lower" : a, i = e.data("min") || 0, o = e.data("max") || 100, s = e.data("min-distance") || null, r = e.data("max-distance") || null, c = e.data("step") || 1, d = e.data("orientation") || "horizontal", e = e.data("tooltip") || !1, t = (console.log(e), document.getElementById(t)), n = { start: n, connect: a, direction: u.State.isRTL ? "rtl" : "ltr", range: { min: i, max: o }, margin: s, limit: r, step: c, orientation: d, tooltips: e }, a = l ? f(n, l) : n; noUiSlider.create(t, a); }); }, u.Range.init = function () { u.Range(".form-control-slider"), u.Range(".form-range-slider"); }, u.Select2.init = function () { u.Select2(".js-select2", { width: "resolve" }); }, u.Slick = function (e, t) { p(e).exists() && "function" == typeof p.fn.slick && p(e).each(function () { var e = { prevArrow: '
', nextArrow: '
', rtl: u.State.isRTL }, e = t ? f(e, t) : e; p(this).slick(e); }); }, u.Slider.init = function () { u.Slick(".slider-init"); }, u.Lightbox = function (e, t, n) { p(e).exists() && p(e).each(function () { var e = {}, e = "video" == t || "iframe" == t ? { type: "iframe", removalDelay: 160, preloader: !0, fixedContentPos: !1, callbacks: { beforeOpen: function () { this.st.image.markup = this.st.image.markup.replace("mfp-figure", "mfp-figure mfp-with-anim"), this.st.mainClass = this.st.el.attr("data-effect"); } } } : "content" == t ? { type: "inline", preloader: !0, removalDelay: 400, mainClass: "mfp-fade content-popup" } : { type: "image", mainClass: "mfp-fade image-popup" }, e = n ? f(e, n) : e; p(this).magnificPopup(e); }); }, u.Control = function (e) { document.querySelectorAll(e).forEach(function (e, t, n) { e.checked && e.parentNode.classList.add("checked"), e.addEventListener("change", function () { "checkbox" == e.type && (e.checked ? e.parentNode.classList.add("checked") : e.parentNode.classList.remove("checked")), "radio" == e.type && (document.querySelectorAll('input[name="' + e.name + '"]').forEach(function (e, t, n) { e.parentNode.classList.remove("checked"); }), e.checked) && e.parentNode.classList.add("checked"); }); }); }, u.NumberSpinner = function (e, t) { var a = document.querySelectorAll("[data-number='plus']"), i = document.querySelectorAll("[data-number='minus']"); a.forEach(function (e, t, n) { a[t].parentNode; a[t].addEventListener("click", function () { var s = a[t].parentNode.children; s.forEach(function (e, t, n) { var a, i, o; s[t].classList.contains("number-spinner") && (a = "" == !s[t].value ? parseInt(s[t].value) : 0, i = "" == !s[t].step ? parseInt(s[t].step) : 1, o = "" == !s[t].max ? parseInt(s[t].max) : 1 / 0, s[t].value = a + i < o + 1 ? a + i : a); }); }); }), i.forEach(function (e, t, n) { i[t].parentNode; i[t].addEventListener("click", function () { var s = i[t].parentNode.children; s.forEach(function (e, t, n) { var a, i, o; s[t].classList.contains("number-spinner") && (a = "" == !s[t].value ? parseInt(s[t].value) : 0, i = "" == !s[t].step ? parseInt(s[t].step) : 1, o = "" == !s[t].min ? parseInt(s[t].min) : 0, s[t].value = o - 1 < a - i ? a - i : a); }); }); }); }, u.Stepper = function (e, a) { e = document.querySelectorAll(e); 0 < e.length && e.forEach(function (e, t) { var n = { selectors: { nav: "stepper-nav", progress: "stepper-progress", content: "stepper-steps", prev: "step-prev", next: "step-next", submit: "step-submit" }, classes: { nav_current: "current", nav_done: "done", step_active: "active", step_done: "done", active_step: "active" }, current_step: 1 }, n = a ? f(n, a) : n; u.Custom.Stepper(e, n), u.Validate.OnChange(".js-select2"), u.Validate.OnChange(".date-picker"), u.Validate.OnChange(".js-tagify"); }); }, u.Stepper.init = function () { u.Stepper(".stepper-init"); }, u.Tagify = function (e, t) { p(e).exists() && "function" == typeof p.fn.tagify && (t = t ? f(void 0, t) : void 0, p(e).tagify(t)); }, u.Tagify.init = function () { u.Tagify(".js-tagify"); }, u.OtherInit = function () { u.PassSwitch(), u.CurrentLink(), u.CurrentAdminLink(), u.LinkOff(".is-disable"), u.ClassNavMenu(), u.SetHW("[data-height]", "height"), u.SetHW("[data-width]", "width"), u.NumberSpinner(), u.Lightbox(".popup-video", "video"), u.Lightbox(".popup-iframe", "iframe"), u.Lightbox(".popup-image", "image"), u.Lightbox(".popup-content", "content"), u.Control(".custom-control-input"); }, u.Ani.init = function () { u.Ani.formElm(".form-control-outlined"), u.Ani.formSearch(".toggle-search"); }, u.BS.init = function () { u.BS.menutip("a.nk-menu-link"), u.BS.tooltip(".nk-tooltip"), u.BS.tooltip(".btn-tooltip", { placement: "top" }), u.BS.tooltip('[data-toggle="tooltip"]'), u.BS.tooltip('[data-bs-toggle="tooltip"]'), u.BS.tooltip(".tipinfo,.nk-menu-tooltip", { placement: "right" }), u.BS.popover('[data-toggle="popover"]'), u.BS.popover('[data-bs-toggle="popover"]'), u.BS.progress("[data-progress]"), u.BS.fileinput(".form-file-input"), u.BS.modalfix(), u.BS.ddfix(), u.BS.tabfix(); }, u.Picker.init = function () { u.Picker.date(".date-picker", { format: p(this).data("format") }), u.Picker.dob(".date-picker-alt"), u.Picker.time(".time-picker"), u.Picker.date(".date-picker-range", { todayHighlight: !1, autoclose: !1 }), u.Picker.date(".date-picker-ym", { format: "mm/yy", startView: 2, autoclose: !0, maxViewMode: 2, minViewMode: 1 }); }, u.Addons.Init = function () { u.Knob.init(), u.Range.init(), u.Select2.init(), u.Slider.init(), u.Tagify.init(); }, u.TGL.init = function () { u.TGL.content(".toggle"), u.TGL.expand(".toggle-expand"), u.TGL.expand(".toggle-opt", { toggle: !1 }), u.TGL.showmenu(".nk-nav-toggle"), u.TGL.ddmenu("." + e + "-toggle", { self: e + "-toggle", child: e + "-sub" }); }, u.BS.modalOnInit = function () { p(".modal").on("shown.bs.modal", function () { u.Select2.init(), u.Validate.init(); }); }, u.init = function () { u.coms.docReady.push(u.OtherInit), u.coms.docReady.push(u.Prettify), u.coms.docReady.push(u.ColorBG), u.coms.docReady.push(u.ColorTXT), u.coms.docReady.push(u.Copied), u.coms.docReady.push(u.Ani.init), u.coms.docReady.push(u.TGL.init), u.coms.docReady.push(u.BS.init), u.coms.docReady.push(u.Validate.init), u.coms.docReady.push(u.Picker.init), u.coms.docReady.push(u.Addons.Init), u.coms.docReady.push(u.Wizard), u.coms.docReady.push(u.Stepper.init), u.coms.docReady.push(u.ModeSwitch), u.coms.docReady.push(u.ModeSwitch2); }, u.init(); }(NioApp, jQuery);