!function(){"use strict";var e=window.wp.escapeHtml;const t=wp.element.createElement,o={};o.spwpspIcon=t("img",{src:(0,e.escapeAttribute)(sp_wps_load_script.path+"/Admin/GutenbergBlock/assets/wps-block.svg")});var s=o,r=window.wp.i18n,c=window.wp.element;const a=c.createElement;var l=t=>{let{attributes:{shortcode:o},shortCodeList:s,shortcodeUpdate:l}=t;return(0,c.createElement)(c.Fragment,null,a("div",{className:"sp-wpsp-gutenberg-shortcode editor-styles-wrapper"},a("select",{className:"sp-wpsp-shortcode-selector",onChange:e=>l(e),value:(0,e.escapeAttribute)(o)},a("option",{value:(0,e.escapeAttribute)("0")},(0,e.escapeHTML)((0,r.__)("-- Select a shortcode --","woo-category-slider"))),s.map((t=>{var o=t.title.length>35?t.title.substring(0,30)+".... #("+t.id+")":t.title+" #("+t.id+")";return a("option",{value:(0,e.escapeAttribute)(t.id.toString()),key:(0,e.escapeAttribute)(t.id.toString())},(0,e.escapeHTML)(o))})))))},p=window.wp.blocks,n=window.wp.components,i=window.wp.blockEditor;const d=wp.serverSideRender,u=c.createElement;(0,p.registerBlockType)("woo-product-slider-pro/shortcode",{title:(0,e.escapeHTML)((0,r.__)("Woo Product Slider","woo-product-slider")),description:(0,e.escapeHTML)((0,r.__)("Use Woo Product Slider to insert a shortcode in your page.","woo-product-slider")),icon:s.spwpspIcon,category:"common",supports:{html:!0},edit:t=>{const{attributes:o,setAttributes:s}=t;var a=sp_wps_load_script.shortCodeList;let p=e=>{let t=!1,o=setInterval((function(){let s=jQuery("#sp-woo-product-slider-"+e).parents().parents().attr("id");document.getElementById(s)&&(jQuery("#wpspro-preloader-"+e).css({opacity:0,display:"none"}),jQuery("#wpspro-preloader-"+e).animate({opacity:1},600),jQuery.getScript(sp_wps_load_script.loadScript),t=!0,s=""),t&&clearInterval(o),0==e&&clearInterval(o)}),10)},m=t=>{var o;o=t,s({shortcode:(0,e.escapeAttribute)(o.target.value)});let r=(0,e.escapeAttribute)(t.target.value);p(r)};if(document.addEventListener("readystatechange",(t=>{if("complete"===t.target.readyState){let t=(0,e.escapeAttribute)(o.shortcode);p(t)}})),jQuery(".wps-slider-section:not(.wps-slider-section-loaded)").length>0){let t=(0,e.escapeAttribute)(o.shortcode);p(t)}return o.preview?u("div",{className:"sp_wpsp_shortcode_block_preview_image"},u("img",{src:(0,e.escapeAttribute)(sp_wps_load_script.path+"Admin/GutenbergBlock/assets/wps-block-preview.svg")})):0===a.length?(0,c.createElement)(c.Fragment,null,u("div",{className:"components-placeholder components-placeholder is-large"},u("div",{className:"components-placeholder__label"},u("img",{className:"block-editor-block-icon",src:(0,e.escapeAttribute)(sp_wps_load_script.path+"/Admin/GutenbergBlock/assets/wps-block.svg")}),(0,e.escapeHTML)((0,r.__)("Woo Product Slider","woo-product-slider"))),u("div",{className:"components-placeholder__instructions"},(0,e.escapeHTML)((0,r.__)("No shortcode found. ","woo-product-slider")),u("a",{href:(0,e.escapeAttribute)(sp_wps_load_script.url)},(0,e.escapeHTML)((0,r.__)("Create a shortcode now!","woo-product-slider")))))):o.shortcode&&0!=o.shortcode?(0,c.createElement)(c.Fragment,null,(0,c.createElement)(i.InspectorControls,null,(0,c.createElement)(n.PanelBody,{title:"Select a shortcode"},(0,c.createElement)(n.PanelRow,null,(0,c.createElement)(l,{attributes:o,shortCodeList:a,shortcodeUpdate:m})))),(0,c.createElement)(d,{block:"woo-product-slider-pro/shortcode",attributes:o})):(0,c.createElement)(c.Fragment,null,(0,c.createElement)(i.InspectorControls,null,(0,c.createElement)(n.PanelBody,{title:"Select a shortcode"},(0,c.createElement)(n.PanelRow,null,(0,c.createElement)(l,{attributes:o,shortCodeList:a,shortcodeUpdate:m})))),u("div",{className:"components-placeholder components-placeholder is-large"},u("div",{className:"components-placeholder__label"},u("img",{className:"block-editor-block-icon",src:(0,e.escapeAttribute)(sp_wps_load_script.path+"/Admin/GutenbergBlock/assets/wps-block.svg")}),(0,e.escapeHTML)((0,r.__)("Woo Product Slider","woo-product-slider"))),u("div",{className:"components-placeholder__instructions"},(0,e.escapeHTML)((0,r.__)("Select a shortcode","woo-product-slider"))),(0,c.createElement)(l,{attributes:o,shortCodeList:a,shortcodeUpdate:m})))},save:()=>null})}();