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