/*
 * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
 * This devtool is neither made for production nor for readable output files.
 * It uses "eval()" calls to create a separate source file in the browser devtools.
 * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
 * or disable the default devtool with "devtool: false".
 * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
 */
/******/ (() => { // webpackBootstrap
/******/ 	var __webpack_modules__ = ({

/***/ "./dev/admin/adminify-framework/main.js":
/*!**********************************************!*\
  !*** ./dev/admin/adminify-framework/main.js ***!
  \**********************************************/
/***/ (() => {

eval("function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\n/**\n *\n * -----------------------------------------------------------\n *\n * Adminify Framework\n * A Simple and Lightweight WordPress Option Framework\n *\n * -----------------------------------------------------------\n *\n */\n(function ($, window, document, undefined) {\n  \"use strict\";\n\n  //\n  // Constants\n  //\n  var ADMINIFY = ADMINIFY || {};\n  ADMINIFY.funcs = {};\n  ADMINIFY.vars = {\n    onloaded: false,\n    $body: $(\"body\"),\n    $window: $(window),\n    $document: $(document),\n    $form_warning: null,\n    is_confirm: false,\n    form_modified: false,\n    code_themes: [],\n    is_rtl: $(\"body\").hasClass(\"rtl\")\n  };\n\n  //\n  // Helper Functions\n  //\n  ADMINIFY.helper = {\n    //\n    // Generate UID\n    //\n    uid: function uid(prefix) {\n      return (prefix || \"\") + Math.random().toString(36).substr(2, 9);\n    },\n    // Quote regular expression characters\n    //\n    preg_quote: function preg_quote(str) {\n      return (str + \"\").replace(/(\\[|\\])/g, \"\\\\$1\");\n    },\n    //\n    // Reneme input names\n    //\n    name_nested_replace: function name_nested_replace($selector, field_id) {\n      var checks = [];\n      var regex = new RegExp(ADMINIFY.helper.preg_quote(field_id + \"[\\\\d+]\"), \"g\");\n      $selector.find(\":radio\").each(function () {\n        if (this.checked || this.orginal_checked) {\n          this.orginal_checked = true;\n        }\n      });\n      $selector.each(function (index) {\n        $(this).find(\":input\").each(function () {\n          this.name = this.name.replace(regex, field_id + \"[\" + index + \"]\");\n          if (this.orginal_checked) {\n            this.checked = true;\n          }\n        });\n      });\n    },\n    //\n    // Debounce\n    //\n    debounce: function debounce(callback, threshold, immediate) {\n      var timeout;\n      return function () {\n        var context = this,\n          args = arguments;\n        var later = function later() {\n          timeout = null;\n          if (!immediate) {\n            callback.apply(context, args);\n          }\n        };\n        var callNow = immediate && !timeout;\n        clearTimeout(timeout);\n        timeout = setTimeout(later, threshold);\n        if (callNow) {\n          callback.apply(context, args);\n        }\n      };\n    }\n  };\n\n  //\n  // Custom clone for textarea and select clone() bug\n  //\n  $.fn.adminify_clone = function () {\n    var base = $.fn.clone.apply(this, arguments),\n      clone = this.find(\"select\").add(this.filter(\"select\")),\n      cloned = base.find(\"select\").add(base.filter(\"select\"));\n    for (var i = 0; i < clone.length; ++i) {\n      for (var j = 0; j < clone[i].options.length; ++j) {\n        if (clone[i].options[j].selected === true) {\n          cloned[i].options[j].selected = true;\n        }\n      }\n    }\n    this.find(\":radio\").each(function () {\n      this.orginal_checked = this.checked;\n    });\n    return base;\n  };\n\n  //\n  // Expand All Options\n  //\n  $.fn.adminify_expand_all = function () {\n    return this.each(function () {\n      $(this).on(\"click\", function (e) {\n        e.preventDefault();\n        $(\".adminify-wrapper\").toggleClass(\"adminify-show-all\");\n        $(\".adminify-section\").adminify_reload_script();\n        $(this).find(\".fa\").toggleClass(\"fa-indent\").toggleClass(\"fa-outdent\");\n      });\n    });\n  };\n\n  //\n  // Options Navigation\n  //\n  $.fn.adminify_nav_options = function () {\n    return this.each(function () {\n      var $nav = $(this),\n        $window = $(window),\n        $wpwrap = $(\"#wpwrap\"),\n        $links = $nav.find(\"a\"),\n        $last;\n      $window.on(\"hashchange adminify.hashchange\", function () {\n        var hash = window.location.hash.replace(\"#tab=\", \"\");\n        var slug = hash ? hash : $links.first().attr(\"href\").replace(\"#tab=\", \"\");\n        var $link = $('[data-tab-id=\"' + slug + '\"]');\n        if ($link.length) {\n          $link.closest(\".adminify-tab-item\").addClass(\"adminify-tab-expanded\").siblings().removeClass(\"adminify-tab-expanded\");\n          if ($link.next().is(\"ul\")) {\n            $link = $link.next().find(\"li\").first().find(\"a\");\n            slug = $link.data(\"tab-id\");\n          }\n          $links.removeClass(\"adminify-active\");\n          $link.addClass(\"adminify-active\");\n          if ($last) {\n            $last.addClass(\"hidden\");\n          }\n          var $section = $('[data-section-id=\"' + slug + '\"]');\n          $section.removeClass(\"hidden\");\n          $section.adminify_reload_script();\n          $(\".adminify-section-id\").val($section.index() + 1);\n          $last = $section;\n          if ($wpwrap.hasClass(\"wp-responsive-open\")) {\n            $(\"html, body\").animate({\n              scrollTop: $section.offset().top - 50\n            }, 200);\n            $wpwrap.removeClass(\"wp-responsive-open\");\n          }\n        }\n      }).trigger(\"adminify.hashchange\");\n    });\n  };\n\n  //\n  // Metabox Tabs\n  //\n  $.fn.adminify_nav_metabox = function () {\n    return this.each(function () {\n      var $nav = $(this),\n        $links = $nav.find(\"a\"),\n        $sections = $nav.parent().find(\".adminify-section\"),\n        $last;\n      $links.each(function (index) {\n        $(this).on(\"click\", function (e) {\n          e.preventDefault();\n          var $link = $(this);\n          $links.removeClass(\"adminify-active\");\n          $link.addClass(\"adminify-active\");\n          if ($last !== undefined) {\n            $last.addClass(\"hidden\");\n          }\n          var $section = $sections.eq(index);\n          $section.removeClass(\"hidden\");\n          $section.adminify_reload_script();\n          $last = $section;\n        });\n      });\n      $links.first().trigger(\"click\");\n    });\n  };\n\n  //\n  // Metabox Page Templates Listener\n  //\n  $.fn.adminify_page_templates = function () {\n    if (this.length) {\n      $(document).on(\"change\", \".editor-page-attributes__template select, #page_template\", function () {\n        var maybe_value = $(this).val() || \"default\";\n        $(\".adminify-page-templates\").removeClass(\"adminify-metabox-show\").addClass(\"adminify-metabox-hide\");\n        $(\".adminify-page-\" + maybe_value.toLowerCase().replace(/[^a-zA-Z0-9]+/g, \"-\")).removeClass(\"adminify-metabox-hide\").addClass(\"adminify-metabox-show\");\n      });\n    }\n  };\n\n  //\n  // Metabox Post Formats Listener\n  //\n  $.fn.adminify_post_formats = function () {\n    if (this.length) {\n      $(document).on(\"change\", '.editor-post-format select, #formatdiv input[name=\"post_format\"]', function () {\n        var maybe_value = $(this).val() || \"default\";\n\n        // Fallback for classic editor version\n        maybe_value = maybe_value === \"0\" ? \"default\" : maybe_value;\n        $(\".adminify-post-formats\").removeClass(\"adminify-metabox-show\").addClass(\"adminify-metabox-hide\");\n        $(\".adminify-post-format-\" + maybe_value).removeClass(\"adminify-metabox-hide\").addClass(\"adminify-metabox-show\");\n      });\n    }\n  };\n\n  //\n  // Search\n  //\n  $.fn.adminify_search = function () {\n    return this.each(function () {\n      var $this = $(this),\n        $input = $this.find(\"input\");\n      $input.on(\"change keyup\", function () {\n        var value = $(this).val(),\n          $wrapper = $(\".adminify-wrapper\"),\n          $section = $wrapper.find(\".adminify-section\"),\n          $fields = $section.find(\"> .adminify-field:not(.adminify-depend-on)\"),\n          $titles = $fields.find(\"> .adminify-title, .adminify-search-tags\");\n        if (value.length > 3) {\n          $fields.addClass(\"adminify-metabox-hide\");\n          $wrapper.addClass(\"adminify-search-all\");\n          $titles.each(function () {\n            var $title = $(this);\n            if ($title.text().match(new RegExp(\".*?\" + value + \".*?\", \"i\"))) {\n              var $field = $title.closest(\".adminify-field\");\n              $field.removeClass(\"adminify-metabox-hide\");\n              $field.parent().adminify_reload_script();\n            }\n          });\n        } else {\n          $fields.removeClass(\"adminify-metabox-hide\");\n          $wrapper.removeClass(\"adminify-search-all\");\n        }\n      });\n    });\n  };\n\n  //\n  // Sticky Header\n  //\n  $.fn.adminify_sticky = function () {\n    return this.each(function () {\n      var $this = $(this),\n        $window = $(window),\n        $inner = $this.find(\".adminify-header-inner\"),\n        padding = parseInt($inner.css(\"padding-left\")) + parseInt($inner.css(\"padding-right\")),\n        offset = 32,\n        scrollTop = 0,\n        lastTop = 0,\n        ticking = false,\n        stickyUpdate = function stickyUpdate() {\n          var offsetTop = $this.offset().top,\n            stickyTop = Math.max(offset, offsetTop - scrollTop),\n            winWidth = $window.innerWidth();\n          if (stickyTop <= offset && winWidth > 782) {\n            $inner.css({\n              width: $this.outerWidth() - padding\n            });\n            $this.css({\n              height: $this.outerHeight()\n            }).addClass(\"adminify-sticky\");\n          } else {\n            $inner.removeAttr(\"style\");\n            $this.removeAttr(\"style\").removeClass(\"adminify-sticky\");\n          }\n        },\n        requestTick = function requestTick() {\n          if (!ticking) {\n            requestAnimationFrame(function () {\n              stickyUpdate();\n              ticking = false;\n            });\n          }\n          ticking = true;\n        },\n        onSticky = function onSticky() {\n          scrollTop = $window.scrollTop();\n          requestTick();\n        };\n      $window.on(\"scroll resize\", onSticky);\n      onSticky();\n    });\n  };\n\n  //\n  // Dependency System\n  //\n  $.fn.adminify_dependency = function () {\n    return this.each(function () {\n      var $this = $(this),\n        $fields = $this.children(\"[data-controller]\");\n      if ($fields.length) {\n        var normal_ruleset = $.adminify_deps.createRuleset(),\n          global_ruleset = $.adminify_deps.createRuleset(),\n          normal_depends = [],\n          global_depends = [];\n        $fields.each(function () {\n          var $field = $(this),\n            controllers = $field.data(\"controller\").split(\"|\"),\n            conditions = $field.data(\"condition\").split(\"|\"),\n            values = $field.data(\"value\").toString().split(\"|\"),\n            is_global = $field.data(\"depend-global\") ? true : false,\n            ruleset = is_global ? global_ruleset : normal_ruleset;\n          $.each(controllers, function (index, depend_id) {\n            var value = values[index] || \"\",\n              condition = conditions[index] || conditions[0];\n            ruleset = ruleset.createRule('[data-depend-id=\"' + depend_id + '\"]', condition, value);\n            ruleset.include($field);\n            if (is_global) {\n              global_depends.push(depend_id);\n            } else {\n              normal_depends.push(depend_id);\n            }\n          });\n        });\n        if (normal_depends.length) {\n          $.adminify_deps.enable($this, normal_ruleset, normal_depends);\n        }\n        if (global_depends.length) {\n          $.adminify_deps.enable(ADMINIFY.vars.$body, global_ruleset, global_depends);\n        }\n      }\n    });\n  };\n\n  //\n  // Field: accordion\n  //\n  $.fn.adminify_field_accordion = function () {\n    return this.each(function () {\n      var $titles = $(this).find(\".adminify-accordion-title\");\n      $titles.on(\"click\", function () {\n        var $title = $(this),\n          $icon = $title.find(\".adminify-accordion-icon\"),\n          $content = $title.next();\n        if ($icon.hasClass(\"fa-angle-right\")) {\n          $icon.removeClass(\"fa-angle-right\").addClass(\"fa-angle-down\");\n        } else {\n          $icon.removeClass(\"fa-angle-down\").addClass(\"fa-angle-right\");\n        }\n        if (!$content.data(\"opened\")) {\n          $content.adminify_reload_script();\n          $content.data(\"opened\", true);\n        }\n        $content.toggleClass(\"adminify-accordion-open\");\n      });\n    });\n  };\n\n  //\n  // Field: backup\n  //\n  $.fn.adminify_field_backup = function () {\n    return this.each(function () {\n      if (window.wp.customize === undefined) {\n        return;\n      }\n      var base = this,\n        $this = $(this),\n        $body = $(\"body\"),\n        $import = $this.find(\".adminify-import\"),\n        $reset = $this.find(\".adminify-reset\");\n      base.notificationOverlay = function () {\n        if (wp.customize.notifications && wp.customize.OverlayNotification) {\n          // clear if there is any saved data.\n          if (!wp.customize.state(\"saved\").get()) {\n            wp.customize.state(\"changesetStatus\").set(\"trash\");\n            wp.customize.each(function (setting) {\n              setting._dirty = false;\n            });\n            wp.customize.state(\"saved\").set(true);\n          }\n\n          // then show a notification overlay\n          wp.customize.notifications.add(new wp.customize.OverlayNotification(\"adminify_field_backup_notification\", {\n            type: \"default\",\n            message: \"&nbsp;\",\n            loading: true\n          }));\n        }\n      };\n      $reset.on(\"click\", function (e) {\n        e.preventDefault();\n        if (ADMINIFY.vars.is_confirm) {\n          base.notificationOverlay();\n          window.wp.ajax.post(\"adminify-reset\", {\n            unique: $reset.data(\"unique\"),\n            nonce: $reset.data(\"nonce\")\n          }).done(function (response) {\n            window.location.reload(true);\n          }).fail(function (response) {\n            alert(response.error);\n            wp.customize.notifications.remove(\"adminify_field_backup_notification\");\n          });\n        }\n      });\n      $import.on(\"click\", function (e) {\n        e.preventDefault();\n        if (ADMINIFY.vars.is_confirm) {\n          base.notificationOverlay();\n          window.wp.ajax.post(\"adminify-import\", {\n            unique: $import.data(\"unique\"),\n            nonce: $import.data(\"nonce\"),\n            data: $this.find(\".adminify-import-data\").val()\n          }).done(function (response) {\n            window.location.reload(true);\n          }).fail(function (response) {\n            alert(response.error);\n            wp.customize.notifications.remove(\"adminify_field_backup_notification\");\n          });\n        }\n      });\n    });\n  };\n\n  //\n  // Field: background\n  //\n  $.fn.adminify_field_background = function () {\n    return this.each(function () {\n      $(this).find(\".adminify--background-image\").adminify_reload_script();\n    });\n  };\n\n  //\n  // Field: code_editor\n  //\n  $.fn.adminify_field_code_editor = function () {\n    return this.each(function () {\n      if (typeof CodeMirror !== \"function\") {\n        return;\n      }\n      var $this = $(this),\n        $textarea = $this.find(\"textarea\"),\n        $inited = $this.find(\".CodeMirror\"),\n        data_editor = $textarea.data(\"editor\");\n      if ($inited.length) {\n        $inited.remove();\n      }\n      var interval = setInterval(function () {\n        if ($this.is(\":visible\")) {\n          var code_editor = CodeMirror.fromTextArea($textarea[0], data_editor);\n\n          // load code-mirror theme css.\n          if (data_editor.theme !== \"default\" && ADMINIFY.vars.code_themes.indexOf(data_editor.theme) === -1) {\n            var $cssLink = $(\"<link>\");\n            $(\"#adminify-codemirror-css\").after($cssLink);\n            $cssLink.attr({\n              rel: \"stylesheet\",\n              id: \"adminify-codemirror-\" + data_editor.theme + \"-css\",\n              href: data_editor.cdnURL + \"/theme/\" + data_editor.theme + \".min.css\",\n              type: \"text/css\",\n              media: \"all\"\n            });\n            ADMINIFY.vars.code_themes.push(data_editor.theme);\n          }\n          CodeMirror.modeURL = data_editor.cdnURL + \"/mode/%N/%N.min.js\";\n          CodeMirror.autoLoadMode(code_editor, data_editor.mode);\n          code_editor.on(\"change\", function (editor, event) {\n            $textarea.val(code_editor.getValue()).trigger(\"change\");\n          });\n          clearInterval(interval);\n        }\n      });\n    });\n  };\n\n  //\n  // Field: date\n  //\n  $.fn.adminify_field_date = function () {\n    return this.each(function () {\n      var $this = $(this),\n        $inputs = $this.find(\"input\"),\n        settings = $this.find(\".adminify-date-settings\").data(\"settings\"),\n        wrapper = '<div class=\"adminify-datepicker-wrapper\"></div>';\n      var defaults = {\n        showAnim: \"\",\n        beforeShow: function beforeShow(input, inst) {\n          $(inst.dpDiv).addClass(\"adminify-datepicker-wrapper\");\n        },\n        onClose: function onClose(input, inst) {\n          $(inst.dpDiv).removeClass(\"adminify-datepicker-wrapper\");\n        }\n      };\n      settings = $.extend({}, settings, defaults);\n      if ($inputs.length === 2) {\n        settings = $.extend({}, settings, {\n          onSelect: function onSelect(selectedDate) {\n            var $this = $(this),\n              $from = $inputs.first(),\n              option = $inputs.first().attr(\"id\") === $(this).attr(\"id\") ? \"minDate\" : \"maxDate\",\n              date = $.datepicker.parseDate(settings.dateFormat, selectedDate);\n            $inputs.not(this).datepicker(\"option\", option, date);\n          }\n        });\n      }\n      $inputs.each(function () {\n        var $input = $(this);\n        if ($input.hasClass(\"hasDatepicker\")) {\n          $input.removeAttr(\"id\").removeClass(\"hasDatepicker\");\n        }\n        $input.datepicker(settings);\n      });\n    });\n  };\n\n  //\n  // Field: datetime\n  //\n  $.fn.adminify_field_datetime = function () {\n    return this.each(function () {\n      var $this = $(this),\n        $inputs = $this.find(\"input\"),\n        settings = $this.find(\".adminify-datetime-settings\").data(\"settings\");\n      settings = $.extend({}, settings, {\n        onReady: function onReady(selectedDates, dateStr, instance) {\n          $(instance.calendarContainer).addClass(\"adminify-flatpickr\");\n        }\n      });\n      if ($inputs.length === 2) {\n        settings = $.extend({}, settings, {\n          onChange: function onChange(selectedDates, dateStr, instance) {\n            if ($(instance.element).data(\"type\") === \"from\") {\n              $inputs.last().get(0)._flatpickr.set(\"minDate\", selectedDates[0]);\n            } else {\n              $inputs.first().get(0)._flatpickr.set(\"maxDate\", selectedDates[0]);\n            }\n          }\n        });\n      }\n      $inputs.each(function () {\n        $(this).flatpickr(settings);\n      });\n    });\n  };\n\n  //\n  // Field: fieldset\n  //\n  $.fn.adminify_field_fieldset = function () {\n    return this.each(function () {\n      $(this).find(\".adminify-fieldset-content\").adminify_reload_script();\n    });\n  };\n\n  //\n  // Field: gallery\n  //\n  $.fn.adminify_field_gallery = function () {\n    return this.each(function () {\n      var $this = $(this),\n        $edit = $this.find(\".adminify-edit-gallery\"),\n        $clear = $this.find(\".adminify-clear-gallery\"),\n        $list = $this.find(\"ul\"),\n        $input = $this.find(\"input\"),\n        $img = $this.find(\"img\"),\n        wp_media_frame;\n      $this.on(\"click\", \".adminify-button, .adminify-edit-gallery\", function (e) {\n        var $el = $(this),\n          ids = $input.val(),\n          what = $el.hasClass(\"adminify-edit-gallery\") ? \"edit\" : \"add\",\n          state = what === \"add\" && !ids.length ? \"gallery\" : \"gallery-edit\";\n        e.preventDefault();\n        if (typeof window.wp === \"undefined\" || !window.wp.media || !window.wp.media.gallery) {\n          return;\n        }\n\n        // Open media with state\n        if (state === \"gallery\") {\n          wp_media_frame = window.wp.media({\n            library: {\n              type: \"image\"\n            },\n            frame: \"post\",\n            state: \"gallery\",\n            multiple: true\n          });\n          wp_media_frame.open();\n        } else {\n          wp_media_frame = window.wp.media.gallery.edit('[gallery ids=\"' + ids + '\"]');\n          if (what === \"add\") {\n            wp_media_frame.setState(\"gallery-library\");\n          }\n        }\n\n        // Media Update\n        wp_media_frame.on(\"update\", function (selection) {\n          $list.empty();\n          var selectedIds = selection.models.map(function (attachment) {\n            var item = attachment.toJSON();\n            var thumb = item.sizes && item.sizes.thumbnail && item.sizes.thumbnail.url ? item.sizes.thumbnail.url : item.url;\n            $list.append('<li><img src=\"' + thumb + '\"></li>');\n            return item.id;\n          });\n          $input.val(selectedIds.join(\",\")).trigger(\"change\");\n          $clear.removeClass(\"hidden\");\n          $edit.removeClass(\"hidden\");\n        });\n      });\n      $clear.on(\"click\", function (e) {\n        e.preventDefault();\n        $list.empty();\n        $input.val(\"\").trigger(\"change\");\n        $clear.addClass(\"hidden\");\n        $edit.addClass(\"hidden\");\n      });\n    });\n  };\n\n  //\n  // Field: group\n  //\n  $.fn.adminify_field_group = function () {\n    return this.each(function () {\n      var $this = $(this),\n        $fieldset = $this.children(\".adminify-fieldset\"),\n        $group = $fieldset.length ? $fieldset : $this,\n        $wrapper = $group.children(\".adminify-cloneable-wrapper\"),\n        $hidden = $group.children(\".adminify-cloneable-hidden\"),\n        $max = $group.children(\".adminify-cloneable-max\"),\n        $min = $group.children(\".adminify-cloneable-min\"),\n        title_by = $wrapper.data(\"title-by\"),\n        title_prefix = $wrapper.data(\"title-by-prefix\"),\n        field_id = $wrapper.data(\"field-id\"),\n        is_number = Boolean(Number($wrapper.data(\"title-number\"))),\n        max = parseInt($wrapper.data(\"max\")),\n        min = parseInt($wrapper.data(\"min\"));\n\n      // clear accordion arrows if multi-instance\n      if ($wrapper.hasClass(\"ui-accordion\")) {\n        $wrapper.find(\".ui-accordion-header-icon\").remove();\n      }\n      var update_title_numbers = function update_title_numbers($selector) {\n        $selector.find(\".adminify-cloneable-title-number\").each(function (index) {\n          $(this).html($(this).closest(\".adminify-cloneable-item\").index() + 1 + \".\");\n        });\n      };\n      $wrapper.accordion({\n        header: \"> .adminify-cloneable-item > .adminify-cloneable-title\",\n        collapsible: true,\n        active: false,\n        animate: false,\n        heightStyle: \"content\",\n        icons: {\n          header: \"adminify-cloneable-header-icon fas fa-angle-right\",\n          activeHeader: \"adminify-cloneable-header-icon fas fa-angle-down\"\n        },\n        activate: function activate(event, ui) {\n          var $panel = ui.newPanel;\n          var $header = ui.newHeader;\n          if ($panel.length && !$panel.data(\"opened\")) {\n            var $title = $header.find(\".adminify-cloneable-value\");\n            var inputs = [];\n            $.each(title_by, function (key, title_key) {\n              inputs.push($panel.find('[data-depend-id=\"' + title_key + '\"]'));\n            });\n            $.each(inputs, function (key, $input) {\n              $input.on(\"change keyup adminify.keyup\", function () {\n                var titles = [];\n                $.each(inputs, function (key, $input) {\n                  var input_value = $input.val();\n                  if (input_value) {\n                    titles.push(input_value);\n                  }\n                });\n                if (titles.length) {\n                  $title.text(titles.join(title_prefix));\n                }\n              }).trigger(\"adminify.keyup\");\n            });\n            $panel.adminify_reload_script();\n            $panel.data(\"opened\", true);\n            $panel.data(\"retry\", false);\n          } else if ($panel.data(\"retry\")) {\n            $panel.adminify_reload_script_retry();\n            $panel.data(\"retry\", false);\n          }\n        }\n      });\n      $wrapper.sortable({\n        axis: \"y\",\n        handle: \".adminify-cloneable-title,.adminify-cloneable-sort\",\n        helper: \"original\",\n        cursor: \"move\",\n        placeholder: \"widget-placeholder\",\n        start: function start(event, ui) {\n          $wrapper.accordion({\n            active: false\n          });\n          $wrapper.sortable(\"refreshPositions\");\n          ui.item.children(\".adminify-cloneable-content\").data(\"retry\", true);\n        },\n        update: function update(event, ui) {\n          ADMINIFY.helper.name_nested_replace($wrapper.children(\".adminify-cloneable-item\"), field_id);\n          $wrapper.adminify_customizer_refresh();\n          if (is_number) {\n            update_title_numbers($wrapper);\n          }\n        }\n      });\n      $group.children(\".adminify-cloneable-add\").on(\"click\", function (e) {\n        e.preventDefault();\n        var count = $wrapper.children(\".adminify-cloneable-item\").length;\n        $min.hide();\n        if (max && count + 1 > max) {\n          $max.show();\n          return;\n        }\n        var $cloned_item = $hidden.adminify_clone(true);\n        $cloned_item.removeClass(\"adminify-cloneable-hidden\");\n        $cloned_item.find(':input[name!=\"_pseudo\"]').each(function () {\n          this.name = this.name.replace(\"___\", \"\").replace(field_id + \"[0]\", field_id + \"[\" + count + \"]\");\n        });\n        $wrapper.append($cloned_item);\n        $wrapper.accordion(\"refresh\");\n        $wrapper.accordion({\n          active: count\n        });\n        $wrapper.adminify_customizer_refresh();\n        $wrapper.adminify_customizer_listen({\n          closest: true\n        });\n        if (is_number) {\n          update_title_numbers($wrapper);\n        }\n      });\n      var event_clone = function event_clone(e) {\n        e.preventDefault();\n        var count = $wrapper.children(\".adminify-cloneable-item\").length;\n        $min.hide();\n        if (max && count + 1 > max) {\n          $max.show();\n          return;\n        }\n        var $this = $(this),\n          $parent = $this.parent().parent(),\n          $cloned_helper = $parent.children(\".adminify-cloneable-helper\").adminify_clone(true),\n          $cloned_title = $parent.children(\".adminify-cloneable-title\").adminify_clone(),\n          $cloned_content = $parent.children(\".adminify-cloneable-content\").adminify_clone(),\n          $cloned_item = $('<div class=\"adminify-cloneable-item\" />');\n        $cloned_item.append($cloned_helper);\n        $cloned_item.append($cloned_title);\n        $cloned_item.append($cloned_content);\n        $wrapper.children().eq($parent.index()).after($cloned_item);\n        ADMINIFY.helper.name_nested_replace($wrapper.children(\".adminify-cloneable-item\"), field_id);\n        $wrapper.accordion(\"refresh\");\n        $wrapper.adminify_customizer_refresh();\n        $wrapper.adminify_customizer_listen({\n          closest: true\n        });\n        if (is_number) {\n          update_title_numbers($wrapper);\n        }\n      };\n      $wrapper.children(\".adminify-cloneable-item\").children(\".adminify-cloneable-helper\").on(\"click\", \".adminify-cloneable-clone\", event_clone);\n      $group.children(\".adminify-cloneable-hidden\").children(\".adminify-cloneable-helper\").on(\"click\", \".adminify-cloneable-clone\", event_clone);\n      var event_remove = function event_remove(e) {\n        e.preventDefault();\n        var count = $wrapper.children(\".adminify-cloneable-item\").length;\n        $max.hide();\n        $min.hide();\n        if (min && count - 1 < min) {\n          $min.show();\n          return;\n        }\n        $(this).closest(\".adminify-cloneable-item\").remove();\n        ADMINIFY.helper.name_nested_replace($wrapper.children(\".adminify-cloneable-item\"), field_id);\n        $wrapper.adminify_customizer_refresh();\n        if (is_number) {\n          update_title_numbers($wrapper);\n        }\n      };\n      $wrapper.children(\".adminify-cloneable-item\").children(\".adminify-cloneable-helper\").on(\"click\", \".adminify-cloneable-remove\", event_remove);\n      $group.children(\".adminify-cloneable-hidden\").children(\".adminify-cloneable-helper\").on(\"click\", \".adminify-cloneable-remove\", event_remove);\n    });\n  };\n\n  //\n  // Field: icon\n  //\n  $.fn.adminify_field_icon = function () {\n    return this.each(function () {\n      var $this = $(this);\n      $this.on(\"click\", \".adminify-icon-add\", function (e) {\n        e.preventDefault();\n        var $button = $(this);\n        var $modal = $(\"#adminify-modal-icon\");\n        $modal.removeClass(\"hidden\");\n        ADMINIFY.vars.$icon_target = $this;\n        if (!ADMINIFY.vars.icon_modal_loaded) {\n          $modal.find(\".adminify-modal-loading\").show();\n          window.wp.ajax.post(\"adminify-get-icons\", {\n            nonce: $button.data(\"nonce\")\n          }).done(function (response) {\n            $modal.find(\".adminify-modal-loading\").hide();\n            ADMINIFY.vars.icon_modal_loaded = true;\n            var $load = $modal.find(\".adminify-modal-load\").html(response.content);\n            $load.on(\"click\", \"i\", function (e) {\n              e.preventDefault();\n              var icon = $(this).attr(\"title\");\n              ADMINIFY.vars.$icon_target.find(\".adminify-icon-preview i\").removeAttr(\"class\").addClass(icon);\n              ADMINIFY.vars.$icon_target.find(\".adminify-icon-preview\").removeClass(\"hidden\");\n              ADMINIFY.vars.$icon_target.find(\".adminify-icon-remove\").removeClass(\"hidden\");\n              ADMINIFY.vars.$icon_target.find(\"input\").val(icon).trigger(\"change\");\n              $modal.addClass(\"hidden\");\n            });\n            $modal.on(\"change keyup\", \".adminify-icon-search\", function () {\n              var value = $(this).val(),\n                $icons = $load.find(\"i\");\n              $icons.each(function () {\n                var $elem = $(this);\n                if ($elem.attr(\"title\").search(new RegExp(value, \"i\")) < 0) {\n                  $elem.hide();\n                } else {\n                  $elem.show();\n                }\n              });\n            });\n            $modal.on(\"click\", \".adminify-modal-close, .adminify-modal-overlay\", function () {\n              $modal.addClass(\"hidden\");\n            });\n          }).fail(function (response) {\n            $modal.find(\".adminify-modal-loading\").hide();\n            $modal.find(\".adminify-modal-load\").html(response.error);\n            $modal.on(\"click\", function () {\n              $modal.addClass(\"hidden\");\n            });\n          });\n        }\n      });\n      $this.on(\"click\", \".adminify-icon-remove\", function (e) {\n        e.preventDefault();\n        $this.find(\".adminify-icon-preview\").addClass(\"hidden\");\n        $this.find(\"input\").val(\"\").trigger(\"change\");\n        $(this).addClass(\"hidden\");\n      });\n    });\n  };\n\n  //\n  // Field: map\n  //\n  $.fn.adminify_field_map = function () {\n    return this.each(function () {\n      if (typeof L === \"undefined\") {\n        return;\n      }\n      var $this = $(this),\n        $map = $this.find(\".adminify--map-osm\"),\n        $search_input = $this.find(\".adminify--map-search input\"),\n        $latitude = $this.find(\".adminify--latitude\"),\n        $longitude = $this.find(\".adminify--longitude\"),\n        $zoom = $this.find(\".adminify--zoom\"),\n        map_data = $map.data(\"map\");\n      var mapInit = L.map($map.get(0), map_data);\n      L.tileLayer(\"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png\", {\n        attribution: '&copy; <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors'\n      }).addTo(mapInit);\n      var mapMarker = L.marker(map_data.center, {\n        draggable: true\n      }).addTo(mapInit);\n      var update_latlng = function update_latlng(data) {\n        $latitude.val(data.lat);\n        $longitude.val(data.lng);\n        $zoom.val(mapInit.getZoom());\n      };\n      mapInit.on(\"click\", function (data) {\n        mapMarker.setLatLng(data.latlng);\n        update_latlng(data.latlng);\n      });\n      mapInit.on(\"zoom\", function () {\n        update_latlng(mapMarker.getLatLng());\n      });\n      mapMarker.on(\"drag\", function () {\n        update_latlng(mapMarker.getLatLng());\n      });\n      if (!$search_input.length) {\n        $search_input = $('[data-depend-id=\"' + $this.find(\".adminify--address-field\").data(\"address-field\") + '\"]');\n      }\n      var cache = {};\n      $search_input.autocomplete({\n        source: function source(request, response) {\n          var term = request.term;\n          if (term in cache) {\n            response(cache[term]);\n            return;\n          }\n          $.get(\"https://nominatim.openstreetmap.org/search\", {\n            format: \"json\",\n            q: term\n          }, function (results) {\n            var data;\n            if (results.length) {\n              data = results.map(function (item) {\n                return {\n                  value: item.display_name,\n                  label: item.display_name,\n                  lat: item.lat,\n                  lon: item.lon\n                };\n              }, \"json\");\n            } else {\n              data = [{\n                value: \"no-data\",\n                label: \"No Results.\"\n              }];\n            }\n            cache[term] = data;\n            response(data);\n          });\n        },\n        select: function select(event, ui) {\n          if (ui.item.value === \"no-data\") {\n            return false;\n          }\n          var latLng = L.latLng(ui.item.lat, ui.item.lon);\n          mapInit.panTo(latLng);\n          mapMarker.setLatLng(latLng);\n          update_latlng(latLng);\n        },\n        create: function create(event, ui) {\n          $(this).autocomplete(\"widget\").addClass(\"adminify-map-ui-autocomplate\");\n        }\n      });\n      var input_update_latlng = function input_update_latlng() {\n        var latLng = L.latLng($latitude.val(), $longitude.val());\n        mapInit.panTo(latLng);\n        mapMarker.setLatLng(latLng);\n      };\n      $latitude.on(\"change\", input_update_latlng);\n      $longitude.on(\"change\", input_update_latlng);\n    });\n  };\n  function removeTags(str) {\n    if (str === null || str === \"\") return false;else str = str.toString();\n    return str.replace(/(<([^>]+)>)/gi, \"\");\n  }\n\n  //\n  // Field: link\n  //\n  $.fn.adminify_field_link = function () {\n    return this.each(function () {\n      var $this = $(this),\n        $link = $this.find(\".adminify--link\"),\n        $add = $this.find(\".adminify--add\"),\n        $edit = $this.find(\".adminify--edit\"),\n        $remove = $this.find(\".adminify--remove\"),\n        $result = $this.find(\".adminify--result\"),\n        uniqid = ADMINIFY.helper.uid(\"adminify-wplink-textarea-\");\n      $add.on(\"click\", function (e) {\n        e.preventDefault();\n        window.wpLink.open(uniqid);\n      });\n      $edit.on(\"click\", function (e) {\n        e.preventDefault();\n        $add.trigger(\"click\");\n        $(\"#wp-link-url\").val(removeTags($this.find(\".adminify--url\").val()));\n        $(\"#wp-link-text\").val(removeTags($this.find(\".adminify--text\").val()));\n        $(\"#wp-link-target\").prop(\"checked\", $this.find(\".adminify--target\").val() === \"_blank\");\n      });\n      $remove.on(\"click\", function (e) {\n        e.preventDefault();\n        $this.find(\".adminify--url\").val(\"\").trigger(\"change\");\n        $this.find(\".adminify--text\").val(\"\");\n        $this.find(\".adminify--target\").val(\"\");\n        $add.removeClass(\"hidden\");\n        $edit.addClass(\"hidden\");\n        $remove.addClass(\"hidden\");\n        $result.parent().addClass(\"hidden\");\n      });\n      $link.attr(\"id\", uniqid).on(\"change\", function () {\n        var atts = window.wpLink.getAttrs(),\n          href = removeTags(atts.href),\n          text = removeTags($(\"#wp-link-text\").val()),\n          target = atts.target ? atts.target : \"\";\n        $this.find(\".adminify--url\").val(href).trigger(\"change\");\n        $this.find(\".adminify--text\").val(text);\n        $this.find(\".adminify--target\").val(target);\n        $result.html('{url:\"' + href + '\", text:\"' + text + '\", target:\"' + target + '\"}');\n        $add.addClass(\"hidden\");\n        $edit.removeClass(\"hidden\");\n        $remove.removeClass(\"hidden\");\n        $result.parent().removeClass(\"hidden\");\n      });\n    });\n  };\n\n  //\n  // Field: media\n  //\n  $.fn.adminify_field_media = function () {\n    return this.each(function () {\n      var $this = $(this),\n        $upload_button = $this.find(\".adminify--button\"),\n        $remove_button = $this.find(\".adminify--remove\"),\n        $library = $upload_button.data(\"library\") && $upload_button.data(\"library\").split(\",\") || \"\",\n        $auto_attributes = $this.hasClass(\"adminify-assign-field-background\") ? $this.closest(\".adminify-field-background\").find(\".adminify--auto-attributes\") : false,\n        wp_media_frame;\n      $upload_button.on(\"click\", function (e) {\n        e.preventDefault();\n        if (typeof window.wp === \"undefined\" || !window.wp.media || !window.wp.media.gallery) {\n          return;\n        }\n        if (wp_media_frame) {\n          wp_media_frame.open();\n          return;\n        }\n        wp_media_frame = window.wp.media({\n          library: {\n            type: $library\n          }\n        });\n        wp_media_frame.on(\"select\", function () {\n          var thumbnail;\n          var attributes = wp_media_frame.state().get(\"selection\").first().attributes;\n          var preview_size = $upload_button.data(\"preview-size\") || \"thumbnail\";\n          if ($library.length && $library.indexOf(attributes.subtype) === -1 && $library.indexOf(attributes.type) === -1) {\n            return;\n          }\n          $this.find(\".adminify--id\").val(attributes.id);\n          $this.find(\".adminify--width\").val(attributes.width);\n          $this.find(\".adminify--height\").val(attributes.height);\n          $this.find(\".adminify--alt\").val(attributes.alt);\n          $this.find(\".adminify--title\").val(attributes.title);\n          $this.find(\".adminify--description\").val(attributes.description);\n          if (typeof attributes.sizes !== \"undefined\" && typeof attributes.sizes.thumbnail !== \"undefined\" && preview_size === \"thumbnail\") {\n            thumbnail = attributes.sizes.thumbnail.url;\n          } else if (typeof attributes.sizes !== \"undefined\" && typeof attributes.sizes.full !== \"undefined\") {\n            thumbnail = attributes.sizes.full.url;\n          } else if (attributes.type === \"image\") {\n            thumbnail = attributes.url;\n          } else {\n            thumbnail = attributes.icon;\n          }\n          if ($auto_attributes) {\n            $auto_attributes.removeClass(\"adminify--attributes-hidden\");\n          }\n          $remove_button.removeClass(\"hidden\");\n          $this.find(\".adminify--preview\").removeClass(\"hidden\");\n          $this.find(\".adminify--src\").attr(\"src\", thumbnail);\n          $this.find(\".adminify--thumbnail\").val(thumbnail);\n          $this.find(\".adminify--url\").val(attributes.url).trigger(\"change\");\n        });\n        wp_media_frame.open();\n      });\n      $remove_button.on(\"click\", function (e) {\n        e.preventDefault();\n        if ($auto_attributes) {\n          $auto_attributes.addClass(\"adminify--attributes-hidden\");\n        }\n        $remove_button.addClass(\"hidden\");\n        $this.find(\"input\").val(\"\");\n        $this.find(\".adminify--preview\").addClass(\"hidden\");\n        $this.find(\".adminify--url\").trigger(\"change\");\n      });\n    });\n  };\n\n  //\n  // Field: repeater\n  //\n  $.fn.adminify_field_repeater = function () {\n    return this.each(function () {\n      var $this = $(this),\n        $fieldset = $this.children(\".adminify-fieldset\"),\n        $repeater = $fieldset.length ? $fieldset : $this,\n        $wrapper = $repeater.children(\".adminify-repeater-wrapper\"),\n        $hidden = $repeater.children(\".adminify-repeater-hidden\"),\n        $max = $repeater.children(\".adminify-repeater-max\"),\n        $min = $repeater.children(\".adminify-repeater-min\"),\n        field_id = $wrapper.data(\"field-id\"),\n        max = parseInt($wrapper.data(\"max\")),\n        min = parseInt($wrapper.data(\"min\"));\n      $wrapper.children(\".adminify-repeater-item\").children(\".adminify-repeater-content\").adminify_reload_script();\n      $wrapper.sortable({\n        axis: \"y\",\n        handle: \".adminify-repeater-sort\",\n        helper: \"original\",\n        cursor: \"move\",\n        placeholder: \"widget-placeholder\",\n        update: function update(event, ui) {\n          ADMINIFY.helper.name_nested_replace($wrapper.children(\".adminify-repeater-item\"), field_id);\n          $wrapper.adminify_customizer_refresh();\n          ui.item.adminify_reload_script_retry();\n        }\n      });\n      $repeater.children(\".adminify-repeater-add\").on(\"click\", function (e) {\n        e.preventDefault();\n        var count = $wrapper.children(\".adminify-repeater-item\").length;\n        $min.hide();\n        if (max && count + 1 > max) {\n          $max.show();\n          return;\n        }\n        var $cloned_item = $hidden.adminify_clone(true);\n        $cloned_item.removeClass(\"adminify-repeater-hidden\");\n        $cloned_item.find(':input[name!=\"_pseudo\"]').each(function () {\n          this.name = this.name.replace(\"___\", \"\").replace(field_id + \"[0]\", field_id + \"[\" + count + \"]\");\n        });\n        $wrapper.append($cloned_item);\n        $cloned_item.children(\".adminify-repeater-content\").adminify_reload_script();\n        $wrapper.adminify_customizer_refresh();\n        $wrapper.adminify_customizer_listen({\n          closest: true\n        });\n      });\n      var event_clone = function event_clone(e) {\n        e.preventDefault();\n        var count = $wrapper.children(\".adminify-repeater-item\").length;\n        $min.hide();\n        if (max && count + 1 > max) {\n          $max.show();\n          return;\n        }\n        var $this = $(this),\n          $parent = $this.parent().parent().parent(),\n          $cloned_content = $parent.children(\".adminify-repeater-content\").adminify_clone(),\n          $cloned_helper = $parent.children(\".adminify-repeater-helper\").adminify_clone(true),\n          $cloned_item = $('<div class=\"adminify-repeater-item\" />');\n        $cloned_item.append($cloned_content);\n        $cloned_item.append($cloned_helper);\n        $wrapper.children().eq($parent.index()).after($cloned_item);\n        $cloned_item.children(\".adminify-repeater-content\").adminify_reload_script();\n        ADMINIFY.helper.name_nested_replace($wrapper.children(\".adminify-repeater-item\"), field_id);\n        $wrapper.adminify_customizer_refresh();\n        $wrapper.adminify_customizer_listen({\n          closest: true\n        });\n      };\n      $wrapper.children(\".adminify-repeater-item\").children(\".adminify-repeater-helper\").on(\"click\", \".adminify-repeater-clone\", event_clone);\n      $repeater.children(\".adminify-repeater-hidden\").children(\".adminify-repeater-helper\").on(\"click\", \".adminify-repeater-clone\", event_clone);\n      var event_remove = function event_remove(e) {\n        e.preventDefault();\n        var count = $wrapper.children(\".adminify-repeater-item\").length;\n        $max.hide();\n        $min.hide();\n        if (min && count - 1 < min) {\n          $min.show();\n          return;\n        }\n        $(this).closest(\".adminify-repeater-item\").remove();\n        ADMINIFY.helper.name_nested_replace($wrapper.children(\".adminify-repeater-item\"), field_id);\n        $wrapper.adminify_customizer_refresh();\n      };\n      $wrapper.children(\".adminify-repeater-item\").children(\".adminify-repeater-helper\").on(\"click\", \".adminify-repeater-remove\", event_remove);\n      $repeater.children(\".adminify-repeater-hidden\").children(\".adminify-repeater-helper\").on(\"click\", \".adminify-repeater-remove\", event_remove);\n    });\n  };\n\n  //\n  // Field: slider\n  //\n  $.fn.adminify_field_slider = function () {\n    return this.each(function () {\n      var $this = $(this),\n        $input = $this.find(\"input\"),\n        $slider = $this.find(\".adminify-slider-ui\"),\n        data = $input.data(),\n        value = $input.val() || 0;\n      if ($slider.hasClass(\"ui-slider\")) {\n        $slider.empty();\n      }\n      $slider.slider({\n        range: \"min\",\n        value: value,\n        min: data.min || 0,\n        max: data.max || 100,\n        step: data.step || 1,\n        slide: function slide(e, o) {\n          $input.val(o.value).trigger(\"change\");\n        }\n      });\n      $input.on(\"keyup\", function () {\n        $slider.slider(\"value\", $input.val());\n      });\n    });\n  };\n\n  //\n  // Field: sortable\n  //\n  $.fn.adminify_field_sortable = function () {\n    return this.each(function () {\n      var $sortable = $(this).find(\".adminify-sortable\");\n      $sortable.sortable({\n        axis: \"y\",\n        helper: \"original\",\n        cursor: \"move\",\n        placeholder: \"widget-placeholder\",\n        update: function update(event, ui) {\n          $sortable.adminify_customizer_refresh();\n        }\n      });\n      $sortable.find(\".adminify-sortable-content\").adminify_reload_script();\n    });\n  };\n\n  //\n  // Field: sorter\n  //\n  $.fn.adminify_field_sorter = function () {\n    return this.each(function () {\n      var $this = $(this),\n        $enabled = $this.find(\".adminify-enabled\"),\n        $has_disabled = $this.find(\".adminify-disabled\"),\n        $disabled = $has_disabled.length ? $has_disabled : false;\n      $enabled.sortable({\n        connectWith: $disabled,\n        placeholder: \"ui-sortable-placeholder\",\n        update: function update(event, ui) {\n          var $el = ui.item.find(\"input\");\n          if (ui.item.parent().hasClass(\"adminify-enabled\")) {\n            $el.attr(\"name\", $el.attr(\"name\").replace(\"disabled\", \"enabled\"));\n          } else {\n            $el.attr(\"name\", $el.attr(\"name\").replace(\"enabled\", \"disabled\"));\n          }\n          $this.adminify_customizer_refresh();\n        }\n      });\n      if ($disabled) {\n        $disabled.sortable({\n          connectWith: $enabled,\n          placeholder: \"ui-sortable-placeholder\",\n          update: function update(event, ui) {\n            $this.adminify_customizer_refresh();\n          }\n        });\n      }\n    });\n  };\n\n  //\n  // Field: spinner\n  //\n  $.fn.adminify_field_spinner = function () {\n    return this.each(function () {\n      var $this = $(this),\n        $input = $this.find(\"input\"),\n        $inited = $this.find(\".ui-button\"),\n        data = $input.data();\n      if ($inited.length) {\n        $inited.remove();\n      }\n      $input.spinner({\n        min: data.min || 0,\n        max: data.max || 100,\n        step: data.step || 1,\n        create: function create(event, ui) {\n          if (data.unit) {\n            $input.after('<span class=\"ui-button adminify--unit\">' + data.unit + \"</span>\");\n          }\n        },\n        spin: function spin(event, ui) {\n          $input.val(ui.value).trigger(\"change\");\n        }\n      });\n    });\n  };\n\n  //\n  // Field: switcher\n  //\n  $.fn.adminify_field_switcher = function () {\n    return this.each(function () {\n      var $switcher = $(this).find(\".adminify--switcher\");\n      $switcher.on(\"click\", function () {\n        var value = 0;\n        var $input = $switcher.find(\"input\");\n        if ($switcher.hasClass(\"adminify--active\")) {\n          $switcher.removeClass(\"adminify--active\");\n        } else {\n          value = 1;\n          $switcher.addClass(\"adminify--active\");\n        }\n        $input.val(value).trigger(\"change\");\n      });\n    });\n  };\n\n  //\n  // Field: tabbed\n  //\n  $.fn.adminify_field_tabbed = function () {\n    return this.each(function () {\n      var $this = $(this),\n        $links = $this.find(\".adminify-tabbed-nav a\"),\n        $contents = $this.find(\".adminify-tabbed-content\");\n      $contents.eq(0).adminify_reload_script();\n      $links.on(\"click\", function (e) {\n        e.preventDefault();\n        var $link = $(this),\n          index = $link.index(),\n          $content = $contents.eq(index);\n        $link.addClass(\"adminify-tabbed-active\").siblings().removeClass(\"adminify-tabbed-active\");\n        $content.adminify_reload_script();\n        $content.removeClass(\"hidden\").siblings().addClass(\"hidden\");\n      });\n    });\n  };\n\n  //\n  // Field: typography\n  //\n  $.fn.adminify_field_typography = function () {\n    return this.each(function () {\n      var base = this;\n      var $this = $(this);\n      var loaded_fonts = [];\n      var webfonts = adminify_typography_json.webfonts;\n      var googlestyles = adminify_typography_json.googlestyles;\n      var defaultstyles = adminify_typography_json.defaultstyles;\n\n      //\n      //\n      // Sanitize google font subset\n      base.sanitize_subset = function (subset) {\n        subset = subset.replace(\"-ext\", \" Extended\");\n        subset = subset.charAt(0).toUpperCase() + subset.slice(1);\n        return subset;\n      };\n\n      //\n      //\n      // Sanitize google font styles (weight and style)\n      base.sanitize_style = function (style) {\n        return googlestyles[style] ? googlestyles[style] : style;\n      };\n\n      //\n      //\n      // Load google font\n      base.load_google_font = function (font_family, weight, style) {\n        if (font_family && (typeof WebFont === \"undefined\" ? \"undefined\" : _typeof(WebFont)) === \"object\") {\n          weight = weight ? weight.replace(\"normal\", \"\") : \"\";\n          style = style ? style.replace(\"normal\", \"\") : \"\";\n          if (weight || style) {\n            font_family = font_family + \":\" + weight + style;\n          }\n          if (loaded_fonts.indexOf(font_family) === -1) {\n            WebFont.load({\n              google: {\n                families: [font_family]\n              }\n            });\n          }\n          loaded_fonts.push(font_family);\n        }\n      };\n\n      //\n      //\n      // Append select options\n      base.append_select_options = function ($select, options, condition, type, is_multi) {\n        $select.find(\"option\").not(\":first\").remove();\n        var opts = \"\";\n        $.each(options, function (key, value) {\n          var selected;\n          var name = value;\n\n          // is_multi\n          if (is_multi) {\n            selected = condition && condition.indexOf(value) !== -1 ? \" selected\" : \"\";\n          } else {\n            selected = condition && condition === value ? \" selected\" : \"\";\n          }\n          if (type === \"subset\") {\n            name = base.sanitize_subset(value);\n          } else if (type === \"style\") {\n            name = base.sanitize_style(value);\n          }\n          opts += '<option value=\"' + value + '\"' + selected + \">\" + name + \"</option>\";\n        });\n        $select.append(opts).trigger(\"adminify.change\").trigger(\"chosen:updated\");\n      };\n      base.init = function () {\n        //\n        //\n        // Constants\n        var selected_styles = [];\n        var $typography = $this.find(\".adminify--typography\");\n        var $type = $this.find(\".adminify--type\");\n        var $styles = $this.find(\".adminify--block-font-style\");\n        var unit = $typography.data(\"unit\");\n        var line_height_unit = $typography.data(\"line-height-unit\");\n        var exclude_fonts = $typography.data(\"exclude\") ? $typography.data(\"exclude\").split(\",\") : [];\n\n        //\n        //\n        // Chosen init\n        if ($this.find(\".adminify--chosen\").length) {\n          var $chosen_selects = $this.find(\"select\");\n          $chosen_selects.each(function () {\n            var $chosen_select = $(this),\n              $chosen_inited = $chosen_select.parent().find(\".chosen-container\");\n            if ($chosen_inited.length) {\n              $chosen_inited.remove();\n            }\n            $chosen_select.chosen({\n              allow_single_deselect: true,\n              disable_search_threshold: 15,\n              width: \"100%\"\n            });\n          });\n        }\n\n        //\n        //\n        // Font family select\n        var $font_family_select = $this.find(\".adminify--font-family\");\n        var first_font_family = $font_family_select.val();\n\n        // Clear default font family select options\n        $font_family_select.find(\"option\").not(\":first-child\").remove();\n        var opts = \"\";\n        $.each(webfonts, function (type, group) {\n          // Check for exclude fonts\n          if (exclude_fonts && exclude_fonts.indexOf(type) !== -1) {\n            return;\n          }\n          opts += '<optgroup label=\"' + group.label + '\">';\n          $.each(group.fonts, function (key, value) {\n            // use key if value is object\n            value = _typeof(value) === \"object\" ? key : value;\n            var selected = value === first_font_family ? \" selected\" : \"\";\n            opts += '<option value=\"' + value + '\" data-type=\"' + type + '\"' + selected + \">\" + value + \"</option>\";\n          });\n          opts += \"</optgroup>\";\n        });\n\n        // Append google font select options\n        $font_family_select.append(opts).trigger(\"chosen:updated\");\n\n        //\n        //\n        // Font style select\n        var $font_style_block = $this.find(\".adminify--block-font-style\");\n        if ($font_style_block.length) {\n          var $font_style_select = $this.find(\".adminify--font-style-select\");\n          var first_style_value = $font_style_select.val() ? $font_style_select.val().replace(/normal/g, \"\") : \"\";\n\n          //\n          // Font Style on on change listener\n          $font_style_select.on(\"change adminify.change\", function (event) {\n            var style_value = $font_style_select.val();\n\n            // set a default value\n            if (!style_value && selected_styles && selected_styles.indexOf(\"normal\") === -1) {\n              style_value = selected_styles[0];\n            }\n\n            // set font weight, for eg. replacing 800italic to 800\n            var font_normal = style_value && style_value !== \"italic\" && style_value === \"normal\" ? \"normal\" : \"\";\n            var font_weight = style_value && style_value !== \"italic\" && style_value !== \"normal\" ? style_value.replace(\"italic\", \"\") : font_normal;\n            var font_style = style_value && style_value.substr(-6) === \"italic\" ? \"italic\" : \"\";\n            $this.find(\".adminify--font-weight\").val(font_weight);\n            $this.find(\".adminify--font-style\").val(font_style);\n          });\n\n          //\n          //\n          // Extra font style select\n          var $extra_font_style_block = $this.find(\".adminify--block-extra-styles\");\n          if ($extra_font_style_block.length) {\n            var $extra_font_style_select = $this.find(\".adminify--extra-styles\");\n            var first_extra_style_value = $extra_font_style_select.val();\n          }\n        }\n\n        //\n        //\n        // Subsets select\n        var $subset_block = $this.find(\".adminify--block-subset\");\n        if ($subset_block.length) {\n          var $subset_select = $this.find(\".adminify--subset\");\n          var first_subset_select_value = $subset_select.val();\n          var subset_multi_select = $subset_select.data(\"multiple\") || false;\n        }\n\n        //\n        //\n        // Backup font family\n        var $backup_font_family_block = $this.find(\".adminify--block-backup-font-family\");\n\n        //\n        //\n        // Font Family on Change Listener\n        $font_family_select.on(\"change adminify.change\", function (event) {\n          // Hide subsets on change\n          if ($subset_block.length) {\n            $subset_block.addClass(\"hidden\");\n          }\n\n          // Hide extra font style on change\n          if ($extra_font_style_block.length) {\n            $extra_font_style_block.addClass(\"hidden\");\n          }\n\n          // Hide backup font family on change\n          if ($backup_font_family_block.length) {\n            $backup_font_family_block.addClass(\"hidden\");\n          }\n          var $selected = $font_family_select.find(\":selected\");\n          var value = $selected.val();\n          var type = $selected.data(\"type\");\n          if (type && value) {\n            // Show backup fonts if font type google or custom\n            if ((type === \"google\" || type === \"custom\") && $backup_font_family_block.length) {\n              $backup_font_family_block.removeClass(\"hidden\");\n            }\n\n            // Appending font style select options\n            if ($font_style_block.length) {\n              // set styles for multi and normal style selectors\n              var styles = defaultstyles;\n\n              // Custom or gogle font styles\n              if (type === \"google\" && webfonts[type].fonts[value][0]) {\n                styles = webfonts[type].fonts[value][0];\n              } else if (type === \"custom\" && webfonts[type].fonts[value]) {\n                styles = webfonts[type].fonts[value];\n              }\n              selected_styles = styles;\n\n              // Set selected style value for avoid load errors\n              var set_auto_style = styles.indexOf(\"normal\") !== -1 ? \"normal\" : styles[0];\n              var set_style_value = first_style_value && styles.indexOf(first_style_value) !== -1 ? first_style_value : set_auto_style;\n\n              // Append style select options\n              base.append_select_options($font_style_select, styles, set_style_value, \"style\");\n\n              // Clear first value\n              first_style_value = false;\n\n              // Show style select after appended\n              $font_style_block.removeClass(\"hidden\");\n\n              // Appending extra font style select options\n              if (type === \"google\" && $extra_font_style_block.length && styles.length > 1) {\n                // Append extra-style select options\n                base.append_select_options($extra_font_style_select, styles, first_extra_style_value, \"style\", true);\n\n                // Clear first value\n                first_extra_style_value = false;\n\n                // Show style select after appended\n                $extra_font_style_block.removeClass(\"hidden\");\n              }\n            }\n\n            // Appending google fonts subsets select options\n            if (type === \"google\" && $subset_block.length && webfonts[type].fonts[value][1]) {\n              var subsets = webfonts[type].fonts[value][1];\n              var set_auto_subset = subsets.length < 2 && subsets[0] !== \"latin\" ? subsets[0] : \"\";\n              var set_subset_value = first_subset_select_value && subsets.indexOf(first_subset_select_value) !== -1 ? first_subset_select_value : set_auto_subset;\n\n              // check for multiple subset select\n              set_subset_value = subset_multi_select && first_subset_select_value ? first_subset_select_value : set_subset_value;\n              base.append_select_options($subset_select, subsets, set_subset_value, \"subset\", subset_multi_select);\n              first_subset_select_value = false;\n              $subset_block.removeClass(\"hidden\");\n            }\n          } else {\n            // Clear Styles\n            $styles.find(\":input\").val(\"\");\n\n            // Clear subsets options if type and value empty\n            if ($subset_block.length) {\n              $subset_select.find(\"option\").not(\":first-child\").remove();\n              $subset_select.trigger(\"chosen:updated\");\n            }\n\n            // Clear font styles options if type and value empty\n            if ($font_style_block.length) {\n              $font_style_select.find(\"option\").not(\":first-child\").remove();\n              $font_style_select.trigger(\"chosen:updated\");\n            }\n          }\n\n          // Update font type input value\n          $type.val(type);\n        }).trigger(\"adminify.change\");\n\n        //\n        //\n        // Preview\n        var $preview_block = $this.find(\".adminify--block-preview\");\n        if ($preview_block.length) {\n          var $preview = $this.find(\".adminify--preview\");\n\n          // Set preview styles on change\n          $this.on(\"change\", ADMINIFY.helper.debounce(function (event) {\n            $preview_block.removeClass(\"hidden\");\n            var font_family = $font_family_select.val(),\n              font_weight = $this.find(\".adminify--font-weight\").val(),\n              font_style = $this.find(\".adminify--font-style\").val(),\n              font_size = $this.find(\".adminify--font-size\").val(),\n              font_variant = $this.find(\".adminify--font-variant\").val(),\n              line_height = $this.find(\".adminify--line-height\").val(),\n              text_align = $this.find(\".adminify--text-align\").val(),\n              text_transform = $this.find(\".adminify--text-transform\").val(),\n              text_decoration = $this.find(\".adminify--text-decoration\").val(),\n              text_color = $this.find(\".adminify--color\").val(),\n              word_spacing = $this.find(\".adminify--word-spacing\").val(),\n              letter_spacing = $this.find(\".adminify--letter-spacing\").val(),\n              custom_style = $this.find(\".adminify--custom-style\").val(),\n              type = $this.find(\".adminify--type\").val();\n            if (type === \"google\") {\n              base.load_google_font(font_family, font_weight, font_style);\n            }\n            var properties = {};\n            if (font_family) {\n              properties.fontFamily = font_family;\n            }\n            if (font_weight) {\n              properties.fontWeight = font_weight;\n            }\n            if (font_style) {\n              properties.fontStyle = font_style;\n            }\n            if (font_variant) {\n              properties.fontVariant = font_variant;\n            }\n            if (font_size) {\n              properties.fontSize = font_size + unit;\n            }\n            if (line_height) {\n              properties.lineHeight = line_height + line_height_unit;\n            }\n            if (letter_spacing) {\n              properties.letterSpacing = letter_spacing + unit;\n            }\n            if (word_spacing) {\n              properties.wordSpacing = word_spacing + unit;\n            }\n            if (text_align) {\n              properties.textAlign = text_align;\n            }\n            if (text_transform) {\n              properties.textTransform = text_transform;\n            }\n            if (text_decoration) {\n              properties.textDecoration = text_decoration;\n            }\n            if (text_color) {\n              properties.color = text_color;\n            }\n            $preview.removeAttr(\"style\");\n\n            // Customs style attribute\n            if (custom_style) {\n              $preview.attr(\"style\", custom_style);\n            }\n            $preview.css(properties);\n          }, 100));\n\n          // Preview black and white backgrounds trigger\n          $preview_block.on(\"click\", function () {\n            $preview.toggleClass(\"adminify--black-background\");\n            var $toggle = $preview_block.find(\".adminify--toggle\");\n            if ($toggle.hasClass(\"fa-toggle-off\")) {\n              $toggle.removeClass(\"fa-toggle-off\").addClass(\"fa-toggle-on\");\n            } else {\n              $toggle.removeClass(\"fa-toggle-on\").addClass(\"fa-toggle-off\");\n            }\n          });\n          if (!$preview_block.hasClass(\"hidden\")) {\n            $this.trigger(\"change\");\n          }\n        }\n      };\n      base.init();\n    });\n  };\n\n  //\n  // Field: upload\n  //\n  $.fn.adminify_field_upload = function () {\n    return this.each(function () {\n      var $this = $(this),\n        $input = $this.find(\"input\"),\n        $upload_button = $this.find(\".adminify--button\"),\n        $remove_button = $this.find(\".adminify--remove\"),\n        $preview_wrap = $this.find(\".adminify--preview\"),\n        $preview_src = $this.find(\".adminify--src\"),\n        $library = $upload_button.data(\"library\") && $upload_button.data(\"library\").split(\",\") || \"\",\n        wp_media_frame;\n      $upload_button.on(\"click\", function (e) {\n        e.preventDefault();\n        if (typeof window.wp === \"undefined\" || !window.wp.media || !window.wp.media.gallery) {\n          return;\n        }\n        if (wp_media_frame) {\n          wp_media_frame.open();\n          return;\n        }\n        wp_media_frame = window.wp.media({\n          library: {\n            type: $library\n          }\n        });\n        wp_media_frame.on(\"select\", function () {\n          var src;\n          var attributes = wp_media_frame.state().get(\"selection\").first().attributes;\n          if ($library.length && $library.indexOf(attributes.subtype) === -1 && $library.indexOf(attributes.type) === -1) {\n            return;\n          }\n          $input.val(attributes.url).trigger(\"change\");\n        });\n        wp_media_frame.open();\n      });\n      $remove_button.on(\"click\", function (e) {\n        e.preventDefault();\n        $input.val(\"\").trigger(\"change\");\n      });\n      $input.on(\"change\", function (e) {\n        var $value = $input.val();\n        if ($value) {\n          $remove_button.removeClass(\"hidden\");\n        } else {\n          $remove_button.addClass(\"hidden\");\n        }\n        if ($preview_wrap.length) {\n          if ($.inArray($value.split(\".\").pop().toLowerCase(), [\"jpg\", \"jpeg\", \"gif\", \"png\", \"svg\", \"webp\"]) !== -1) {\n            $preview_wrap.removeClass(\"hidden\");\n            $preview_src.attr(\"src\", $value);\n          } else {\n            $preview_wrap.addClass(\"hidden\");\n          }\n        }\n      });\n    });\n  };\n\n  //\n  // Field: wp_editor\n  //\n  $.fn.adminify_field_wp_editor = function () {\n    return this.each(function () {\n      if (typeof window.wp.editor === \"undefined\" || typeof window.tinyMCEPreInit === \"undefined\" || typeof window.tinyMCEPreInit.mceInit.adminify_wp_editor === \"undefined\") {\n        return;\n      }\n      var $this = $(this),\n        $editor = $this.find(\".adminify-wp-editor\"),\n        $textarea = $this.find(\"textarea\");\n\n      // If there is wp-editor remove it for avoid dupliated wp-editor conflicts.\n      var $has_wp_editor = $this.find(\".wp-editor-wrap\").length || $this.find(\".mce-container\").length;\n      if ($has_wp_editor) {\n        $editor.empty();\n        $editor.append($textarea);\n        $textarea.css(\"display\", \"\");\n      }\n\n      // Generate a unique id\n      var uid = ADMINIFY.helper.uid(\"adminify-editor-\");\n      $textarea.attr(\"id\", uid);\n\n      // Get default editor settings\n      var default_editor_settings = {\n        tinymce: window.tinyMCEPreInit.mceInit.adminify_wp_editor,\n        quicktags: window.tinyMCEPreInit.qtInit.adminify_wp_editor\n      };\n\n      // Get default editor settings\n      var field_editor_settings = $editor.data(\"editor-settings\");\n\n      // Callback for old wp editor\n      var wpEditor = wp.oldEditor ? wp.oldEditor : wp.editor;\n      if (wpEditor && wpEditor.hasOwnProperty(\"autop\")) {\n        wp.editor.autop = wpEditor.autop;\n        wp.editor.removep = wpEditor.removep;\n        wp.editor.initialize = wpEditor.initialize;\n      }\n\n      // Add on change event handle\n      var editor_on_change = function editor_on_change(editor) {\n        editor.on(\"change keyup\", function () {\n          var value = field_editor_settings.wpautop ? editor.getContent() : wp.editor.removep(editor.getContent());\n          $textarea.val(value).trigger(\"change\");\n        });\n      };\n\n      // Extend editor selector and on change event handler\n      default_editor_settings.tinymce = $.extend({}, default_editor_settings.tinymce, {\n        selector: \"#\" + uid,\n        setup: editor_on_change\n      });\n\n      // Override editor tinymce settings\n      if (field_editor_settings.tinymce === false) {\n        default_editor_settings.tinymce = false;\n        $editor.addClass(\"adminify-no-tinymce\");\n      }\n\n      // Override editor quicktags settings\n      if (field_editor_settings.quicktags === false) {\n        default_editor_settings.quicktags = false;\n        $editor.addClass(\"adminify-no-quicktags\");\n      }\n\n      // Wait until :visible\n      var interval = setInterval(function () {\n        if ($this.is(\":visible\")) {\n          window.wp.editor.initialize(uid, default_editor_settings);\n          clearInterval(interval);\n        }\n      });\n\n      // Add Media buttons\n      if (field_editor_settings.media_buttons && window.adminify_media_buttons) {\n        var $editor_buttons = $editor.find(\".wp-media-buttons\");\n        if ($editor_buttons.length) {\n          $editor_buttons.find(\".adminify-shortcode-button\").data(\"editor-id\", uid);\n        } else {\n          var $media_buttons = $(window.adminify_media_buttons);\n          $media_buttons.find(\".adminify-shortcode-button\").data(\"editor-id\", uid);\n          $editor.prepend($media_buttons);\n        }\n      }\n    });\n  };\n\n  //\n  // Confirm\n  //\n  $.fn.adminify_confirm = function () {\n    return this.each(function () {\n      $(this).on(\"click\", function (e) {\n        var confirm_text = $(this).data(\"confirm\") || window.adminify_vars.i18n.confirm;\n        var confirm_answer = confirm(confirm_text);\n        if (confirm_answer) {\n          ADMINIFY.vars.is_confirm = true;\n          ADMINIFY.vars.form_modified = false;\n        } else {\n          e.preventDefault();\n          return false;\n        }\n      });\n    });\n  };\n  $.fn.serializeObject = function () {\n    var obj = {};\n    $.each(this.serializeArray(), function (i, o) {\n      var n = o.name,\n        v = o.value;\n      obj[n] = obj[n] === undefined ? v : $.isArray(obj[n]) ? obj[n].concat(v) : [obj[n], v];\n    });\n    return obj;\n  };\n\n  //\n  // Options Save\n  //\n  $.fn.adminify_save = function () {\n    return this.each(function () {\n      var $this = $(this),\n        $buttons = $(\".adminify-save\"),\n        $panel = $(\".adminify-options\"),\n        flooding = false,\n        timeout;\n      $this.on(\"click\", function (e) {\n        if (!flooding) {\n          var $text = $this.data(\"save\"),\n            $value = $this.val();\n          $buttons.attr(\"value\", $text);\n          if ($this.hasClass(\"adminify-save-ajax\")) {\n            // e.preventDefault();\n\n            $panel.addClass(\"adminify-saving\");\n            $buttons.prop(\"disabled\", true);\n            window.wp.ajax.post(\"adminify_\" + $panel.data(\"unique\") + \"_ajax_save\", {\n              data: $(\"#adminify-form\").serializeJSONADMINIFY()\n            }).done(function (response) {\n              // clear errors\n              $(\".adminify-error\").remove();\n              if (Object.keys(response.errors).length) {\n                var error_icon = '<i class=\"adminify-label-error adminify-error\">!</i>';\n                $.each(response.errors, function (key, error_message) {\n                  var $field = $('[data-depend-id=\"' + key + '\"]'),\n                    $link = $('a[href=\"#tab=' + $field.closest(\".adminify-section\").data(\"section-id\") + '\"]'),\n                    $tab = $link.closest(\".adminify-tab-item\");\n                  $field.closest(\".adminify-fieldset\").append('<p class=\"adminify-error adminify-error-text\">' + error_message + \"</p>\");\n                  if (!$link.find(\".adminify-error\").length) {\n                    $link.append(error_icon);\n                  }\n                  if (!$tab.find(\".adminify-arrow .adminify-error\").length) {\n                    $tab.find(\".adminify-arrow\").append(error_icon);\n                  }\n                });\n              }\n              $panel.removeClass(\"adminify-saving\");\n              $buttons.prop(\"disabled\", false).attr(\"value\", $value);\n              flooding = false;\n              ADMINIFY.vars.form_modified = false;\n              ADMINIFY.vars.$form_warning.hide();\n              clearTimeout(timeout);\n              var $result_success = $(\".adminify-form-success\");\n              $result_success.empty().append(response.notice).fadeIn(\"fast\", function () {\n                timeout = setTimeout(function () {\n                  $result_success.fadeOut(\"fast\");\n                }, 1000);\n              });\n            }).fail(function (response) {\n              alert(response.error);\n            });\n          } else {\n            ADMINIFY.vars.form_modified = false;\n          }\n        }\n        flooding = true;\n      });\n    });\n    // return this.each(function () {\n    //     var $this = $(this),\n    //         $buttons = $(\".adminify-save\"),\n    //         $panel = $(\".adminify-options\"),\n    //         flooding = false,\n    //         timeout;\n\n    //     $this.on(\"click\", function (e) {\n    //         if (!flooding) {\n    //             var $text = $this.data(\"save\"),\n    //                 $value = $this.val();\n\n    //             $buttons.attr(\"value\", $text);\n\n    //             if ($this.hasClass(\"adminify-save-ajax\")) {\n    //                 e.preventDefault();\n\n    //                 $panel.addClass(\"adminify-saving\");\n    //                 $buttons.prop(\"disabled\", true);\n\n    //                 window.wp.ajax\n    //                     .post(\"adminify_\" + $panel.data(\"unique\") + \"_ajax_save\", {\n    //                         data: $(\"#adminify-form\").serializeJSONADMINIFY(),\n    //                     })\n    //                     .done(function (response) {\n    //                         console.log(\"Done Response\", response);\n    //                         // clear errors\n    //                         $(\".adminify-error\").remove();\n\n    //                         if (Object.keys(response.errors).length) {\n    //                             var error_icon =\n    //                                 '<i class=\"adminify-label-error adminify-error\">!</i>';\n\n    //                             $.each(response.errors, function (key, error_message) {\n    //                                 var $field = $('[data-depend-id=\"' + key + '\"]'),\n    //                                     $link = $(\n    //                                         'a[href=\"#tab=' +\n    //                                             $field\n    //                                                 .closest(\".adminify-section\")\n    //                                                 .data(\"section-id\") +\n    //                                             '\"]'\n    //                                     ),\n    //                                     $tab = $link.closest(\".adminify-tab-item\");\n\n    //                                 $field\n    //                                     .closest(\".adminify-fieldset\")\n    //                                     .append(\n    //                                         '<p class=\"adminify-error adminify-error-text\">' +\n    //                                             error_message +\n    //                                             \"</p>\"\n    //                                     );\n\n    //                                 if (!$link.find(\".adminify-error\").length) {\n    //                                     $link.append(error_icon);\n    //                                 }\n\n    //                                 if (!$tab.find(\".adminify-arrow .adminify-error\").length) {\n    //                                     $tab.find(\".adminify-arrow\").append(error_icon);\n    //                                 }\n    //                             });\n    //                         }\n\n    //                         $panel.removeClass(\"adminify-saving\");\n    //                         $buttons.prop(\"disabled\", false).attr(\"value\", $value);\n    //                         flooding = false;\n\n    //                         ADMINIFY.vars.form_modified = false;\n    //                         ADMINIFY.vars.$form_warning.hide();\n\n    //                         clearTimeout(timeout);\n\n    //                         var $result_success = $(\".adminify-form-success\");\n    //                         $result_success\n    //                             .empty()\n    //                             .append(response.notice)\n    //                             .fadeIn(\"fast\", function () {\n    //                                 timeout = setTimeout(function () {\n    //                                     $result_success.fadeOut(\"fast\");\n    //                                 }, 1000);\n    //                             });\n    //                     })\n    //                     .fail(function (response) {\n    //                         console.log(\"Fail Response\", response);\n    //                         alert(response.error);\n    //                     });\n    //             } else {\n    //                 ADMINIFY.vars.form_modified = false;\n    //             }\n    //         }\n\n    //         flooding = true;\n    //     });\n    // });\n  };\n\n  //\n  // Option Framework\n  //\n  $.fn.adminify_options = function () {\n    return this.each(function () {\n      var $this = $(this),\n        $content = $this.find(\".adminify-content\"),\n        $form_success = $this.find(\".adminify-form-success\"),\n        $form_warning = $this.find(\".adminify-form-warning\"),\n        $save_button = $this.find(\".adminify-header .adminify-save\");\n      ADMINIFY.vars.$form_warning = $form_warning;\n\n      // Shows a message white leaving theme options without saving\n      if ($form_warning.length) {\n        window.onbeforeunload = function () {\n          return ADMINIFY.vars.form_modified ? true : undefined;\n        };\n        $content.on(\"change keypress\", \":input\", function () {\n          if (!ADMINIFY.vars.form_modified) {\n            $form_success.hide();\n            $form_warning.fadeIn(\"fast\");\n            ADMINIFY.vars.form_modified = true;\n          }\n        });\n      }\n      if ($form_success.hasClass(\"adminify-form-show\")) {\n        setTimeout(function () {\n          $form_success.fadeOut(\"fast\");\n        }, 1000);\n      }\n      $(document).keydown(function (event) {\n        if ((event.ctrlKey || event.metaKey) && event.which === 83) {\n          $save_button.trigger(\"click\");\n          event.preventDefault();\n          return false;\n        }\n      });\n    });\n  };\n\n  //\n  // Taxonomy Framework\n  //\n  $.fn.adminify_taxonomy = function () {\n    return this.each(function () {\n      var $this = $(this),\n        $form = $this.parents(\"form\");\n      if ($form.attr(\"id\") === \"addtag\") {\n        var $submit = $form.find(\"#submit\"),\n          $cloned = $this.find(\".adminify-field\").adminify_clone();\n        $submit.on(\"click\", function () {\n          if (!$form.find(\".form-required\").hasClass(\"form-invalid\")) {\n            $this.data(\"inited\", false);\n            $this.empty();\n            $this.html($cloned);\n            $cloned = $cloned.adminify_clone();\n            $this.adminify_reload_script();\n          }\n        });\n      }\n    });\n  };\n\n  //\n  // Shortcode Framework\n  //\n  $.fn.adminify_shortcode = function () {\n    var base = this;\n    base.shortcode_parse = function (serialize, key) {\n      var shortcode = \"\";\n      $.each(serialize, function (shortcode_key, shortcode_values) {\n        key = key ? key : shortcode_key;\n        shortcode += \"[\" + key;\n        $.each(shortcode_values, function (shortcode_tag, shortcode_value) {\n          if (shortcode_tag === \"content\") {\n            shortcode += \"]\";\n            shortcode += shortcode_value;\n            shortcode += \"[/\" + key + \"\";\n          } else {\n            shortcode += base.shortcode_tags(shortcode_tag, shortcode_value);\n          }\n        });\n        shortcode += \"]\";\n      });\n      return shortcode;\n    };\n    base.shortcode_tags = function (shortcode_tag, shortcode_value) {\n      var shortcode = \"\";\n      if (shortcode_value !== \"\") {\n        if (_typeof(shortcode_value) === \"object\" && !$.isArray(shortcode_value)) {\n          $.each(shortcode_value, function (sub_shortcode_tag, sub_shortcode_value) {\n            // sanitize spesific key/value\n            switch (sub_shortcode_tag) {\n              case \"background-image\":\n                sub_shortcode_value = sub_shortcode_value.url ? sub_shortcode_value.url : \"\";\n                break;\n            }\n            if (sub_shortcode_value !== \"\") {\n              shortcode += \" \" + sub_shortcode_tag + '=\"' + sub_shortcode_value.toString() + '\"';\n            }\n          });\n        } else {\n          shortcode += \" \" + shortcode_tag + '=\"' + shortcode_value.toString() + '\"';\n        }\n      }\n      return shortcode;\n    };\n    base.insertAtChars = function (_this, currentValue) {\n      var obj = typeof _this[0].name !== \"undefined\" ? _this[0] : _this;\n      if (obj.value.length && typeof obj.selectionStart !== \"undefined\") {\n        obj.focus();\n        return obj.value.substring(0, obj.selectionStart) + currentValue + obj.value.substring(obj.selectionEnd, obj.value.length);\n      } else {\n        obj.focus();\n        return currentValue;\n      }\n    };\n    base.send_to_editor = function (html, editor_id) {\n      var tinymce_editor;\n      if (typeof tinymce !== \"undefined\") {\n        tinymce_editor = tinymce.get(editor_id);\n      }\n      if (tinymce_editor && !tinymce_editor.isHidden()) {\n        tinymce_editor.execCommand(\"mceInsertContent\", false, html);\n      } else {\n        var $editor = $(\"#\" + editor_id);\n        $editor.val(base.insertAtChars($editor, html)).trigger(\"change\");\n      }\n    };\n    return this.each(function () {\n      var $modal = $(this),\n        $load = $modal.find(\".adminify-modal-load\"),\n        $content = $modal.find(\".adminify-modal-content\"),\n        $insert = $modal.find(\".adminify-modal-insert\"),\n        $loading = $modal.find(\".adminify-modal-loading\"),\n        $select = $modal.find(\"select\"),\n        modal_id = $modal.data(\"modal-id\"),\n        nonce = $modal.data(\"nonce\"),\n        editor_id,\n        target_id,\n        gutenberg_id,\n        sc_key,\n        sc_name,\n        sc_view,\n        sc_group,\n        $cloned,\n        $button;\n      $(document).on(\"click\", '.adminify-shortcode-button[data-modal-id=\"' + modal_id + '\"]', function (e) {\n        e.preventDefault();\n        $button = $(this);\n        editor_id = $button.data(\"editor-id\") || false;\n        target_id = $button.data(\"target-id\") || false;\n        gutenberg_id = $button.data(\"gutenberg-id\") || false;\n        $modal.removeClass(\"hidden\");\n\n        // single usage trigger first shortcode\n        if ($modal.hasClass(\"adminify-shortcode-single\") && sc_name === undefined) {\n          $select.trigger(\"change\");\n        }\n      });\n      $select.on(\"change\", function () {\n        var $option = $(this);\n        var $selected = $option.find(\":selected\");\n        sc_key = $option.val();\n        sc_name = $selected.data(\"shortcode\");\n        sc_view = $selected.data(\"view\") || \"normal\";\n        sc_group = $selected.data(\"group\") || sc_name;\n        $load.empty();\n        if (sc_key) {\n          $loading.show();\n          window.wp.ajax.post(\"adminify-get-shortcode-\" + modal_id, {\n            shortcode_key: sc_key,\n            nonce: nonce\n          }).done(function (response) {\n            $loading.hide();\n            var $appended = $(response.content).appendTo($load);\n            $insert.parent().removeClass(\"hidden\");\n            $cloned = $appended.find(\".adminify--repeat-shortcode\").adminify_clone();\n            $appended.adminify_reload_script();\n            $appended.find(\".adminify-fields\").adminify_reload_script();\n          });\n        } else {\n          $insert.parent().addClass(\"hidden\");\n        }\n      });\n      $insert.on(\"click\", function (e) {\n        e.preventDefault();\n        if ($insert.prop(\"disabled\") || $insert.attr(\"disabled\")) {\n          return;\n        }\n        var shortcode = \"\";\n        var serialize = $modal.find(\".adminify-field:not(.adminify-depend-on)\").find(\":input:not(.ignore)\").serializeObjectADMINIFY();\n        switch (sc_view) {\n          case \"contents\":\n            var contentsObj = sc_name ? serialize[sc_name] : serialize;\n            $.each(contentsObj, function (sc_key, sc_value) {\n              var sc_tag = sc_name ? sc_name : sc_key;\n              shortcode += \"[\" + sc_tag + \"]\" + sc_value + \"[/\" + sc_tag + \"]\";\n            });\n            break;\n          case \"group\":\n            shortcode += \"[\" + sc_name;\n            $.each(serialize[sc_name], function (sc_key, sc_value) {\n              shortcode += base.shortcode_tags(sc_key, sc_value);\n            });\n            shortcode += \"]\";\n            shortcode += base.shortcode_parse(serialize[sc_group], sc_group);\n            shortcode += \"[/\" + sc_name + \"]\";\n            break;\n          case \"repeater\":\n            shortcode += base.shortcode_parse(serialize[sc_group], sc_group);\n            break;\n          default:\n            shortcode += base.shortcode_parse(serialize);\n            break;\n        }\n        shortcode = shortcode === \"\" ? \"[\" + sc_name + \"]\" : shortcode;\n        if (gutenberg_id) {\n          var content = window.adminify_gutenberg_props.attributes.hasOwnProperty(\"shortcode\") ? window.adminify_gutenberg_props.attributes.shortcode : \"\";\n          window.adminify_gutenberg_props.setAttributes({\n            shortcode: content + shortcode\n          });\n        } else if (editor_id) {\n          base.send_to_editor(shortcode, editor_id);\n        } else {\n          var $textarea = target_id ? $(target_id) : $button.parent().find(\"textarea\");\n          $textarea.val(base.insertAtChars($textarea, shortcode)).trigger(\"change\");\n        }\n        $modal.addClass(\"hidden\");\n      });\n      $modal.on(\"click\", \".adminify--repeat-button\", function (e) {\n        e.preventDefault();\n        var $repeatable = $modal.find(\".adminify--repeatable\");\n        var $new_clone = $cloned.adminify_clone();\n        var $remove_btn = $new_clone.find(\".adminify-repeat-remove\");\n        var $appended = $new_clone.appendTo($repeatable);\n        $new_clone.find(\".adminify-fields\").adminify_reload_script();\n        ADMINIFY.helper.name_nested_replace($modal.find(\".adminify--repeat-shortcode\"), sc_group);\n        $remove_btn.on(\"click\", function () {\n          $new_clone.remove();\n          ADMINIFY.helper.name_nested_replace($modal.find(\".adminify--repeat-shortcode\"), sc_group);\n        });\n      });\n      $modal.on(\"click\", \".adminify-modal-close, .adminify-modal-overlay\", function () {\n        $modal.addClass(\"hidden\");\n      });\n    });\n  };\n\n  //\n  // WP Color Picker\n  //\n  if (typeof Color === \"function\") {\n    Color.prototype.toString = function () {\n      if (this._alpha < 1) {\n        return this.toCSS(\"rgba\", this._alpha).replace(/\\s+/g, \"\");\n      }\n      var hex = parseInt(this._color, 10).toString(16);\n      if (this.error) {\n        return \"\";\n      }\n      if (hex.length < 6) {\n        for (var i = 6 - hex.length - 1; i >= 0; i--) {\n          hex = \"0\" + hex;\n        }\n      }\n      return \"#\" + hex;\n    };\n  }\n  ADMINIFY.funcs.parse_color = function (color) {\n    var value = color.replace(/\\s+/g, \"\"),\n      trans = value.indexOf(\"rgba\") !== -1 ? parseFloat(value.replace(/^.*,(.+)\\)/, \"$1\") * 100) : 100,\n      rgba = trans < 100 ? true : false;\n    return {\n      value: value,\n      transparent: trans,\n      rgba: rgba\n    };\n  };\n  $.fn.adminify_color = function () {\n    return this.each(function () {\n      var $input = $(this),\n        picker_color = ADMINIFY.funcs.parse_color($input.val()),\n        palette_color = window.adminify_vars.color_palette.length ? window.adminify_vars.color_palette : true,\n        $container;\n\n      // Destroy and Reinit\n      if ($input.hasClass(\"wp-color-picker\")) {\n        $input.closest(\".wp-picker-container\").after($input).remove();\n      }\n      $input.wpColorPicker({\n        palettes: palette_color,\n        change: function change(event, ui) {\n          var ui_color_value = ui.color.toString();\n          $container.removeClass(\"adminify--transparent-active\");\n          $container.find(\".adminify--transparent-offset\").css(\"background-color\", ui_color_value);\n          $input.val(ui_color_value).trigger(\"change\");\n        },\n        create: function create() {\n          $container = $input.closest(\".wp-picker-container\");\n          var a8cIris = $input.data(\"a8cIris\"),\n            $transparent_wrap = $('<div class=\"adminify--transparent-wrap\">' + '<div class=\"adminify--transparent-slider\"></div>' + '<div class=\"adminify--transparent-offset\"></div>' + '<div class=\"adminify--transparent-text\"></div>' + '<div class=\"adminify--transparent-button\">transparent <i class=\"fas fa-toggle-off\"></i></div>' + \"</div>\").appendTo($container.find(\".wp-picker-holder\")),\n            $transparent_slider = $transparent_wrap.find(\".adminify--transparent-slider\"),\n            $transparent_text = $transparent_wrap.find(\".adminify--transparent-text\"),\n            $transparent_offset = $transparent_wrap.find(\".adminify--transparent-offset\"),\n            $transparent_button = $transparent_wrap.find(\".adminify--transparent-button\");\n          if ($input.val() === \"transparent\") {\n            $container.addClass(\"adminify--transparent-active\");\n          }\n          $transparent_button.on(\"click\", function () {\n            if ($input.val() !== \"transparent\") {\n              $input.val(\"transparent\").trigger(\"change\").removeClass(\"iris-error\");\n              $container.addClass(\"adminify--transparent-active\");\n            } else {\n              $input.val(a8cIris._color.toString()).trigger(\"change\");\n              $container.removeClass(\"adminify--transparent-active\");\n            }\n          });\n          $transparent_slider.slider({\n            value: picker_color.transparent,\n            step: 1,\n            min: 0,\n            max: 100,\n            slide: function slide(event, ui) {\n              var slide_value = parseFloat(ui.value / 100);\n              a8cIris._color._alpha = slide_value;\n              $input.wpColorPicker(\"color\", a8cIris._color.toString());\n              $transparent_text.text(slide_value === 1 || slide_value === 0 ? \"\" : slide_value);\n            },\n            create: function create() {\n              var slide_value = parseFloat(picker_color.transparent / 100),\n                text_value = slide_value < 1 ? slide_value : \"\";\n              $transparent_text.text(text_value);\n              $transparent_offset.css(\"background-color\", picker_color.value);\n              $container.on(\"click\", \".wp-picker-clear\", function () {\n                a8cIris._color._alpha = 1;\n                $transparent_text.text(\"\");\n                $transparent_slider.slider(\"option\", \"value\", 100);\n                $container.removeClass(\"adminify--transparent-active\");\n                $input.trigger(\"change\");\n              });\n              $container.on(\"click\", \".wp-picker-default\", function () {\n                var default_color = ADMINIFY.funcs.parse_color($input.data(\"default-color\")),\n                  default_value = parseFloat(default_color.transparent / 100),\n                  default_text = default_value < 1 ? default_value : \"\";\n                a8cIris._color._alpha = default_value;\n                $transparent_text.text(default_text);\n                $transparent_slider.slider(\"option\", \"value\", default_color.transparent);\n                if (default_color.value === \"transparent\") {\n                  $input.removeClass(\"iris-error\");\n                  $container.addClass(\"adminify--transparent-active\");\n                }\n              });\n            }\n          });\n        }\n      });\n    });\n  };\n\n  //\n  // ChosenJS\n  //\n  $.fn.adminify_chosen = function () {\n    return this.each(function () {\n      var $this = $(this),\n        $inited = $this.parent().find(\".chosen-container\"),\n        is_sortable = $this.hasClass(\"adminify-chosen-sortable\") || false,\n        is_ajax = $this.hasClass(\"adminify-chosen-ajax\") || false,\n        is_multiple = $this.attr(\"multiple\") || false,\n        set_width = is_multiple ? \"100%\" : \"auto\",\n        set_options = $.extend({\n          allow_single_deselect: true,\n          disable_search_threshold: 10,\n          width: set_width,\n          no_results_text: window.adminify_vars.i18n.no_results_text\n        }, $this.data(\"chosen-settings\"));\n      if ($inited.length) {\n        $inited.remove();\n      }\n\n      // Chosen ajax\n      if (is_ajax) {\n        var set_ajax_options = $.extend({\n          data: {\n            type: \"post\",\n            nonce: \"\"\n          },\n          allow_single_deselect: true,\n          disable_search_threshold: -1,\n          width: \"100%\",\n          min_length: 3,\n          type_delay: 500,\n          typing_text: window.adminify_vars.i18n.typing_text,\n          searching_text: window.adminify_vars.i18n.searching_text,\n          no_results_text: window.adminify_vars.i18n.no_results_text\n        }, $this.data(\"chosen-settings\"));\n        $this.ADMINIFYAjaxChosen(set_ajax_options);\n      } else {\n        $this.chosen(set_options);\n      }\n\n      // Chosen keep options order\n      if (is_multiple) {\n        var $hidden_select = $this.parent().find(\".adminify-hide-select\");\n        var $hidden_value = $hidden_select.val() || [];\n        $this.on(\"change\", function (obj, result) {\n          if (result && result.selected) {\n            $hidden_select.append('<option value=\"' + result.selected + '\" selected=\"selected\">' + result.selected + \"</option>\");\n          } else if (result && result.deselected) {\n            $hidden_select.find('option[value=\"' + result.deselected + '\"]').remove();\n          }\n\n          // Force customize refresh\n          if (window.wp.customize !== undefined && $hidden_select.children().length === 0 && $hidden_select.data(\"customize-setting-link\")) {\n            window.wp.customize.control($hidden_select.data(\"customize-setting-link\")).setting.set(\"\");\n          }\n          $hidden_select.trigger(\"change\");\n        });\n\n        // Chosen order abstract\n        $this.ADMINIFYChosenOrder($hidden_value, true);\n      }\n\n      // Chosen sortable\n      if (is_sortable) {\n        var $chosen_container = $this.parent().find(\".chosen-container\");\n        var $chosen_choices = $chosen_container.find(\".chosen-choices\");\n        $chosen_choices.bind(\"mousedown\", function (event) {\n          if ($(event.target).is(\"span\")) {\n            event.stopPropagation();\n          }\n        });\n        $chosen_choices.sortable({\n          items: \"li:not(.search-field)\",\n          helper: \"orginal\",\n          cursor: \"move\",\n          placeholder: \"search-choice-placeholder\",\n          start: function start(e, ui) {\n            ui.placeholder.width(ui.item.innerWidth());\n            ui.placeholder.height(ui.item.innerHeight());\n          },\n          update: function update(e, ui) {\n            var select_options = \"\";\n            var chosen_object = $this.data(\"chosen\");\n            var $prev_select = $this.parent().find(\".adminify-hide-select\");\n            $chosen_choices.find(\".search-choice-close\").each(function () {\n              var option_array_index = $(this).data(\"option-array-index\");\n              $.each(chosen_object.results_data, function (index, data) {\n                if (data.array_index === option_array_index) {\n                  select_options += '<option value=\"' + data.value + '\" selected>' + data.value + \"</option>\";\n                }\n              });\n            });\n            $prev_select.children().remove();\n            $prev_select.append(select_options);\n            $prev_select.trigger(\"change\");\n          }\n        });\n      }\n    });\n  };\n\n  //\n  // Helper Checkbox Checker\n  //\n  $.fn.adminify_checkbox = function () {\n    return this.each(function () {\n      var $this = $(this),\n        $input = $this.find(\".adminify--input\"),\n        $checkbox = $this.find(\".adminify--checkbox\");\n      $checkbox.on(\"click\", function () {\n        $input.val(Number($checkbox.prop(\"checked\"))).trigger(\"change\");\n      });\n    });\n  };\n\n  //\n  // Siblings\n  //\n  $.fn.adminify_siblings = function () {\n    return this.each(function () {\n      var $this = $(this),\n        $siblings = $this.find(\".adminify--sibling\"),\n        multiple = $this.data(\"multiple\") || false;\n      $siblings.on(\"click\", function () {\n        var $sibling = $(this);\n        if (multiple) {\n          if ($sibling.hasClass(\"adminify--active\")) {\n            $sibling.removeClass(\"adminify--active\");\n            $sibling.find(\"input\").prop(\"checked\", false).trigger(\"change\");\n          } else {\n            $sibling.addClass(\"adminify--active\");\n            $sibling.find(\"input\").prop(\"checked\", true).trigger(\"change\");\n          }\n        } else {\n          $this.find(\"input\").prop(\"checked\", false);\n          $sibling.find(\"input\").prop(\"checked\", true).trigger(\"change\");\n          $sibling.addClass(\"adminify--active\").siblings().removeClass(\"adminify--active\");\n        }\n      });\n    });\n  };\n\n  //\n  // Help Tooltip\n  //\n  $.fn.adminify_help = function () {\n    return this.each(function () {\n      var $this = $(this),\n        $tooltip,\n        offset_left;\n      $this.on({\n        mouseenter: function mouseenter() {\n          $tooltip = $('<div class=\"adminify-tooltip\"></div>').html($this.find(\".adminify-help-text\").html()).appendTo(\"body\");\n          offset_left = ADMINIFY.vars.is_rtl ? $this.offset().left + 24 : $this.offset().left - $tooltip.outerWidth();\n          $tooltip.css({\n            top: $this.offset().top - ($tooltip.outerHeight() / 2 - 14),\n            left: offset_left\n          });\n        },\n        mouseleave: function mouseleave() {\n          if ($tooltip !== undefined) {\n            $tooltip.remove();\n          }\n        }\n      });\n    });\n  };\n\n  //\n  // Customize Refresh\n  //\n  $.fn.adminify_customizer_refresh = function () {\n    return this.each(function () {\n      var $this = $(this),\n        $complex = $this.closest(\".adminify-customize-complex\");\n      if ($complex.length) {\n        var unique_id = $complex.data(\"unique-id\");\n        if (unique_id === undefined) {\n          return;\n        }\n        var $input = $complex.find(\":input\"),\n          option_id = $complex.data(\"option-id\"),\n          obj = $input.serializeObjectADMINIFY(),\n          data = !$.isEmptyObject(obj) && obj[unique_id] && obj[unique_id][option_id] ? obj[unique_id][option_id] : \"\",\n          control = window.wp.customize.control(unique_id + \"[\" + option_id + \"]\");\n\n        // clear the value to force refresh.\n        control.setting._value = null;\n        control.setting.set(data);\n      } else {\n        $this.find(\":input\").first().trigger(\"change\");\n      }\n      $(document).trigger(\"adminify-customizer-refresh\", $this);\n    });\n  };\n\n  //\n  // Customize Listen Form Elements\n  //\n  $.fn.adminify_customizer_listen = function (options) {\n    var settings = $.extend({\n      closest: false\n    }, options);\n    return this.each(function () {\n      if (window.wp.customize === undefined) {\n        return;\n      }\n      var $this = settings.closest ? $(this).closest(\".adminify-customize-complex\") : $(this),\n        $input = $this.find(\":input\"),\n        unique_id = $this.data(\"unique-id\"),\n        option_id = $this.data(\"option-id\");\n      if (unique_id === undefined) {\n        return;\n      }\n      $input.on(\"change keyup adminify.change\", function () {\n        var obj = $this.find(\":input\").serializeObjectADMINIFY();\n        var val = !$.isEmptyObject(obj) && obj[unique_id] && obj[unique_id][option_id] ? obj[unique_id][option_id] : \"\";\n        window.wp.customize.control(unique_id + \"[\" + option_id + \"]\").setting.set(val);\n      });\n    });\n  };\n\n  //\n  // Customizer Listener for Reload JS\n  //\n  $(document).on(\"expanded\", \".control-section\", function () {\n    var $this = $(this);\n    if ($this.hasClass(\"open\") && !$this.data(\"inited\")) {\n      var $fields = $this.find(\".adminify-customize-field\");\n      var $complex = $this.find(\".adminify-customize-complex\");\n      if ($fields.length) {\n        $this.adminify_dependency();\n        $fields.adminify_reload_script({\n          dependency: false\n        });\n        $complex.adminify_customizer_listen();\n      }\n      $this.data(\"inited\", true);\n    }\n  });\n\n  //\n  // Window on resize\n  //\n  ADMINIFY.vars.$window.on(\"resize adminify.resize\", ADMINIFY.helper.debounce(function (event) {\n    var window_width = navigator.userAgent.indexOf(\"AppleWebKit/\") > -1 ? ADMINIFY.vars.$window.width() : window.innerWidth;\n    if (window_width <= 782 && !ADMINIFY.vars.onloaded) {\n      $(\".adminify-section\").adminify_reload_script();\n      ADMINIFY.vars.onloaded = true;\n    }\n  }, 200)).trigger(\"adminify.resize\");\n\n  //\n  // Widgets Framework\n  //\n  $.fn.adminify_widgets = function () {\n    return this.each(function () {\n      $(document).on(\"widget-added widget-updated\", function (event, $widget) {\n        var $fields = $widget.find(\".adminify-fields\");\n        if ($fields.length) {\n          $fields.adminify_reload_script();\n        }\n      });\n      $(document).on(\"click\", \".widget-top\", function (event) {\n        var $fields = $(this).parent().find(\".adminify-fields\");\n        if ($fields.length) {\n          $fields.adminify_reload_script();\n        }\n      });\n      $(\".widgets-sortables, .control-section-sidebar\").on(\"sortstop\", function (event, ui) {\n        ui.item.find(\".adminify-fields\").adminify_reload_script_retry();\n      });\n    });\n  };\n\n  //\n  // Nav Menu Options Framework\n  //\n  $.fn.adminify_nav_menu = function () {\n    return this.each(function () {\n      var $navmenu = $(this);\n      $navmenu.on(\"click\", \"a.item-edit\", function () {\n        $(this).closest(\"li.menu-item\").find(\".adminify-fields\").adminify_reload_script();\n      });\n      $navmenu.on(\"sortstop\", function (event, ui) {\n        ui.item.find(\".adminify-fields\").adminify_reload_script_retry();\n      });\n    });\n  };\n\n  //\n  // Retry Plugins\n  //\n  $.fn.adminify_reload_script_retry = function () {\n    return this.each(function () {\n      var $this = $(this);\n      if ($this.data(\"inited\")) {\n        $this.children(\".adminify-field-wp_editor\").adminify_field_wp_editor();\n      }\n    });\n  };\n\n  //\n  // Reload Plugins\n  //\n  $.fn.adminify_reload_script = function (options) {\n    var settings = $.extend({\n      dependency: true\n    }, options);\n    return this.each(function () {\n      var $this = $(this);\n\n      // Avoid for conflicts\n      if (!$this.data(\"inited\")) {\n        // Field plugins\n        $this.children(\".adminify-field-accordion\").adminify_field_accordion();\n        $this.children(\".adminify-field-backup\").adminify_field_backup();\n        $this.children(\".adminify-field-background\").adminify_field_background();\n        $this.children(\".adminify-field-code_editor\").adminify_field_code_editor();\n        $this.children(\".adminify-field-date\").adminify_field_date();\n        $this.children(\".adminify-field-datetime\").adminify_field_datetime();\n        $this.children(\".adminify-field-fieldset\").adminify_field_fieldset();\n        $this.children(\".adminify-field-gallery\").adminify_field_gallery();\n        $this.children(\".adminify-field-group\").adminify_field_group();\n        $this.children(\".adminify-field-icon\").adminify_field_icon();\n        $this.children(\".adminify-field-link\").adminify_field_link();\n        $this.children(\".adminify-field-media\").adminify_field_media();\n        $this.children(\".adminify-field-map\").adminify_field_map();\n        $this.children(\".adminify-field-repeater\").adminify_field_repeater();\n        $this.children(\".adminify-field-slider\").adminify_field_slider();\n        $this.children(\".adminify-field-sortable\").adminify_field_sortable();\n        $this.children(\".adminify-field-sorter\").adminify_field_sorter();\n        $this.children(\".adminify-field-spinner\").adminify_field_spinner();\n        $this.children(\".adminify-field-switcher\").adminify_field_switcher();\n        $this.children(\".adminify-field-tabbed\").adminify_field_tabbed();\n        $this.children(\".adminify-field-typography\").adminify_field_typography();\n        $this.children(\".adminify-field-upload\").adminify_field_upload();\n        $this.children(\".adminify-field-wp_editor\").adminify_field_wp_editor();\n\n        // Field colors\n        $this.children(\".adminify-field-border\").find(\".adminify-color\").adminify_color();\n        $this.children(\".adminify-field-background\").find(\".adminify-color\").adminify_color();\n        $this.children(\".adminify-field-color\").find(\".adminify-color\").adminify_color();\n        $this.children(\".adminify-field-color_group\").find(\".adminify-color\").adminify_color();\n        $this.children(\".adminify-field-link_color\").find(\".adminify-color\").adminify_color();\n        $this.children(\".adminify-field-typography\").find(\".adminify-color\").adminify_color();\n\n        // Field chosenjs\n        $this.children(\".adminify-field-select\").find(\".adminify-chosen\").adminify_chosen();\n\n        // Field Checkbox\n        $this.children(\".adminify-field-checkbox\").find(\".adminify-checkbox\").adminify_checkbox();\n\n        // Field Siblings\n        $this.children(\".adminify-field-button_set\").find(\".adminify-siblings\").adminify_siblings();\n        $this.children(\".adminify-field-image_select\").find(\".adminify-siblings\").adminify_siblings();\n        $this.children(\".adminify-field-palette\").find(\".adminify-siblings\").adminify_siblings();\n\n        // Help Tooptip\n        $this.children(\".adminify-field\").find(\".adminify-help\").adminify_help();\n        if (settings.dependency) {\n          $this.adminify_dependency();\n        }\n        $this.data(\"inited\", true);\n        $(document).trigger(\"adminify-reload-script\", $this);\n      }\n    });\n  };\n\n  //\n  // Document ready and run scripts\n  //\n  $(document).ready(function () {\n    $(\".adminify-save\").adminify_save();\n    $(\".adminify-options\").adminify_options();\n    $(\".adminify-sticky-header\").adminify_sticky();\n    $(\".adminify-nav-options\").adminify_nav_options();\n    $(\".adminify-nav-metabox\").adminify_nav_metabox();\n    $(\".adminify-taxonomy\").adminify_taxonomy();\n    $(\".adminify-page-templates\").adminify_page_templates();\n    $(\".adminify-post-formats\").adminify_post_formats();\n    $(\".adminify-shortcode\").adminify_shortcode();\n    $(\".adminify-search\").adminify_search();\n    $(\".adminify-confirm\").adminify_confirm();\n    $(\".adminify-expand-all\").adminify_expand_all();\n    $(\".adminify-onload\").adminify_reload_script();\n    $(\"#widgets-editor\").adminify_widgets();\n    $(\"#widgets-right\").adminify_widgets();\n    $(\"#menu-to-edit\").adminify_nav_menu();\n  });\n})(jQuery, window, document);\n\n//# sourceURL=webpack://adminify/./dev/admin/adminify-framework/main.js?");

/***/ })

/******/ 	});
/************************************************************************/
/******/ 	
/******/ 	// startup
/******/ 	// Load entry module and return exports
/******/ 	// This entry module can't be inlined because the eval devtool is used.
/******/ 	var __webpack_exports__ = {};
/******/ 	__webpack_modules__["./dev/admin/adminify-framework/main.js"]();
/******/ 	
/******/ })()
;