(()=>{"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}!function(){if(function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("test",null,t)}catch(e){}return e}()){var t=EventTarget.prototype.addEventListener;EventTarget.prototype.addEventListener=function(o,n,a){"touchstart"!==o&&"touchmove"!==o||("object"===e(a)?a.passive=!0:a={passive:!0}),t.call(this,o,n,a)}}}(),document.addEventListener("DOMContentLoaded",(function(){!function(e){function t(){e(".noahs_page_builder_codemirror, .noahs_page_builder_codemirror_js").each((function(){var t=this,o=e(t).hasClass("noahs_page_builder_codemirror_js")?"javascript":"css",n=e(t).closest("form").find('input[name="wid"]').val(),a=CodeMirror.fromTextArea(t,{mode:o,lineNumbers:!0,theme:"material-darker",extraKeys:{"Ctrl-Space":"autocomplete"}});n&&a.on("change",(function(o){var a=o.getValue();e(t).val(a),modificarEstilo(e(t),n),modificarJson(e(t),n)}))}))}new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){1===e.nodeType&&e.classList.contains("noahs_page_builder-modal")&&setTimeout((function(){t()}),50)}))}))})).observe(document.body,{childList:!0,subtree:!0}),e(window).on("load",(function(){setTimeout((function(){t()}),50)}))}(jQuery,Drupal,drupalSettings),function(e,t,o,n){var a=(null==o||null===(n=o.noahs_page_builder)||void 0===n?void 0:n.pallete_color)||[];function r(t){e(document).on("touchstart",".form-control-color",(function(e){e.passive=!0})),document.querySelectorAll(".form-control-color").forEach((function(o){o.dataset.colorFieldSpectrum||(o.dataset.colorFieldSpectrum=!0,e(o).spectrum({type:"component",preferredFormat:"hex",showInput:!0,showInitial:!0,showAlpha:!0,hideAfterPaletteSelect:!0,showPalette:!0,showSelectionPalette:!0,palette:a,appendTo:o.parentElement,allowEmpty:!0,localStorageKey:"spectrum.default",move:function(n){e(o).closest("#noahs_page_builder_edit_widget_form").length&&(modificarEstilo(o,t),modificarJson(o,t)),e(o).closest("#noahs_page_builder_sttings_page_form").length&&modifyPageStyles(),e(o).closest("#noahs_settings_form").length&&modifyNoahsSettingstyles(o)}}))})),document.querySelectorAll(".form-control-color-alpha").forEach((function(o){o.dataset.colorFieldSpectrum||(o.dataset.colorFieldSpectrum=!0,e(o).spectrum({type:"component",preferredFormat:"hex",showInput:!0,showInitial:!0,showAlpha:!0,showPalette:!0,showSelectionPalette:!0,palette:a,appendTo:o.parentElement,localStorageKey:"spectrum.overlay",move:function(e){modificarEstilo(o,t)}}))}))}new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){1===e.nodeType&&e.classList.contains("noahs_page_builder-modal")&&setTimeout((function(){r(document.querySelector('input[name="wid"]').value)}),50)}))}))})).observe(document.body,{childList:!0,subtree:!0}),e(document).ready((function(){r()}))}(jQuery,Drupal,drupalSettings),function(e){function t(){e('[data-select-2="1"]').select2({width:"resolve",theme:"classic"}),e("[data-select-2-sortable]").each((function(){var t=e(this),o=t.data("select-value");if(Array.isArray(o)){var n=t.find("option");n.sort((function(t,n){var a=o.indexOf(e(t).val()),r=o.indexOf(e(n).val());return(-1===a?1/0:a)-(-1===r?1/0:r)})),t.empty().append(n)}var a=t.select2({width:"100%"});a.next().find("ul").sortable({containment:"parent",stop:function(t,o){console.log("caca"),o.item.parent().children("[title]").each((function(){var t=e(this).attr("title");e("option:contains('"+t+"')",a).filter((function(){if(e(this).text()===t){var o=e(this);o.detach(),a.append(o)}}))})),a.change()}})}))}t(),new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){1===e.nodeType&&e.classList.contains("noahs_page_builder-modal")&&setTimeout((function(){t()}),50)}))}))})).observe(document.body,{childList:!0,subtree:!0})}(jQuery,Drupal,drupalSettings)}))})();