(()=>{"use strict";var t={n:n=>{var e=n&&n.__esModule?()=>n.default:()=>n;return t.d(e,{a:e}),e},d:(n,e)=>{for(var o in e)t.o(e,o)&&!t.o(n,o)&&Object.defineProperty(n,o,{enumerable:!0,get:e[o]})},o:(t,n)=>Object.prototype.hasOwnProperty.call(t,n)};const n=window.jQuery;var e=t.n(n);const o=window.wp.compose;var i=window,r=i.ajaxurl,a=i.VPAdminVariables,s=e()("body");function c(t){return JSON.stringify(t.serializeArray())}function l(t){t.data("vpfInitialState",c(t))}function u(t){var n=t.data("vpfInitialState");void 0!==n&&t.find(".vpf-settings-submit").prop("disabled",c(t)===n)}window.VPAdminSettingsForms={getInitialState:function(t){return function(t){var n=t.data("vpfInitialState");if(void 0===n)return[];try{return JSON.parse(n)}catch(t){return[]}}(t)},setInitialState:function(t,n){t.data("vpfInitialState",JSON.stringify(n)),u(t)},refresh:function(t){u(t)},persist:function(t){l(t),u(t)}},e()(".vpf-settings-form").each(function(){var t=e()(this);l(t),u(t)}),s.on("input change",".vpf-settings-form :input",function(){u(e()(this).closest(".vpf-settings-form"))}),s.on("vpf_settings_form_updated",".vpf-settings-form",function(){u(e()(this))}),s.on("vpf_settings_form_persisted",".vpf-settings-form",function(){var t=e()(this);l(t),u(t)}),s.on("focus",'[name="vp_list_shortcode"], [name="vp_filter_shortcode"], [name="vp_sort_shortcode"]',function(){this.select()}),s.on("click",".vp-onclick-selection",function(){window.getSelection().selectAllChildren(this)}),s.on("copy cut",".vp-onclick-selection",function(t){var n=window.getSelection().toString().replace(/[\n\r]+/g,"");t.originalEvent.clipboardData.setData("text/plain",n),t.originalEvent.preventDefault()});var f=e()("#vp_format_video"),p=e()("#post-format-video"),d=null;function v(t){null!==d&&d===t||(d=t,f[t?"show":"hide"]())}f.length&&p.length&&(v(p.is(":checked")),s.on("change","[name=post_format]",function(){v(p.is(":checked"))}));var h,m,g,_,y=null,w=function(t){y=e().ajax({url:r,method:"POST",dataType:"json",data:{action:"vp_find_oembed",q:t.val(),nonce:a.nonce},complete:function(n){var e=n.responseJSON;e&&void 0!==e.html&&t.next(".vp-oembed-preview").html(e.html)}})};w=(0,o.debounce)(300,(h=w,m=[],g=null,(_=function(){for(var t=arguments.length,n=new Array(t),e=0;e<t;e++)n[e]=arguments[e];m=n,g||(g=requestAnimationFrame(function(){g=null,h.apply(void 0,m)}))}).cancel=function(){g&&(cancelAnimationFrame(g),g=null)},_)),s.on("change input",'.vp-input[name="_vp_format_video_url"]',function(){null!==y&&y.abort();var t=e()(this);t.next(".vp-oembed-preview").html(""),w(t)}),s.on("change","input[name='vp_general[register_portfolio_post_type]']",function(){e()(this).is(":checked")||confirm("Are you sure you want to turn off the Portfolio custom post type and related taxonomies? Make sure you don't use this post type on your site, otherwise you might see errors on the frontend.")||e()(this).prop("checked",!0)})})();