(()=>{var e={942(e,t){var a;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e="",t=0;t<arguments.length;t++){var a=arguments[t];a&&(e=l(e,r(a)))}return e}function r(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return o.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var a in e)n.call(e,a)&&e[a]&&(t=l(t,a));return t}function l(e,t){return t?e?e+" "+t:e+t:e}e.exports?(o.default=o,e.exports=o):void 0===(a=function(){return o}.apply(t,[]))||(e.exports=a)}()}},t={};function a(n){var o=t[n];if(void 0!==o)return o.exports;var r=t[n]={exports:{}};return e[n](r,r.exports,a),r.exports}a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";const e=window.wp.blocks,t=window.wp.serverSideRender;var n=a.n(t),o=a(942),r=a.n(o);const l=window.wp.compose,s=window.wp.blockEditor,i=window.wp.components,c=window.wp.element,p=window.wp.hooks,u=window.ReactJSXRuntime,d=JSON.parse('{"UU":"automatic-youtube-gallery/block"}');function b(e){var t="string";return"number"==e?t="number":"checkbox"==e&&(t="boolean"),t}(0,e.registerBlockType)(d.UU,{attributes:function(){var e={is_admin:{type:"boolean",default:!1},uid:{type:"string",default:""}};for(var t in ayg_block.options){var a=ayg_block.options[t].fields;for(var n in a)e[a[n].name]={type:b(a[n].type),default:a[n].value}}return e}(),edit:function({attributes:e,setAttributes:t,className:a,clientId:o}){e.uid=o;const[d,b]=(0,c.useState)(!1),[y,m]=(0,c.useState)(e),g=(0,c.useCallback)(()=>(0,u.jsx)(n(),{block:"automatic-youtube-gallery/block",attributes:Object.assign({},y,{is_admin:!0})}),[y]),h=(0,l.debounce)(()=>{b(!1),m({...e})},1e3),x=e=>a=>{t({[e]:a})};(0,c.useEffect)(()=>{b(!0),h()},[e]);const f=(0,c.useRef)();(0,c.useEffect)(()=>{f.current?(0,p.applyFilters)("ayg_block_init",e):f.current=!0});const v=r()(a,{"is-loading":d}),_=(0,s.useBlockProps)({className:v});return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(s.InspectorControls,{children:Object.keys(ayg_block.options).map((a,n)=>(t=>{let a=!0;switch(t){case"gallery":"video"!=e.type&&"livestream"!=e.type||(a=!1);break;case"search":"video"!=e.type&&"livestream"!=e.type||(a=!1),"slider"!=e.theme&&"slider-popup"!=e.theme&&"slider-inline"!=e.theme&&"playlister"!=e.theme||(a=!1)}return(0,p.applyFilters)("ayg_block_toggle_panels",a,t,e)})(a)&&(0,u.jsx)(i.PanelBody,{title:ayg_block.options[a].label,initialOpen:0==n,className:"automatic-youtube-gallery-block-panel",children:Object.keys(ayg_block.options[a].fields).map((n,o)=>((a,n)=>{if(!(t=>{let a=!0;switch(t){case"playlist":case"username":case"search":case"video":case"videos":t!=e.type&&(a=!1);break;case"channel":"channel"!=e.type&&"livestream"!=e.type&&(a=!1);break;case"order":case"limit":"search"!=e.type&&(a=!1);break;case"cache":case"player_title":case"player_description":case"loop":"livestream"==e.type&&(a=!1);break;case"autoadvance":"video"!=e.type&&"livestream"!=e.type||(a=!1)}return(0,p.applyFilters)("ayg_block_toggle_controls",a,t,e)})(a.name))return"";const o=a.placeholder?a.placeholder:"",r=a.description?a.description:"";switch(a.type){case"number":return(0,u.jsx)(i.PanelRow,{children:(0,u.jsx)(i.RangeControl,{label:a.label,help:r,placeholder:o,value:e[a.name],min:a.min,max:a.max,onChange:x(a.name),__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0})},n);case"textarea":return(0,u.jsx)(i.PanelRow,{children:(0,u.jsx)(i.TextareaControl,{label:a.label,help:r,placeholder:o,value:e[a.name],onChange:x(a.name),__nextHasNoMarginBottom:!0})},n);case"select":case"radio":let c=[];for(let e in a.options)c.push({label:a.options[e],value:e});return(0,u.jsx)(i.PanelRow,{children:(0,u.jsx)(i.SelectControl,{label:a.label,help:r,options:c,value:e[a.name],onChange:x(a.name),__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0})},n);case"checkbox":return(0,u.jsx)(i.PanelRow,{children:(0,u.jsx)(i.ToggleControl,{label:a.label,help:r,checked:e[a.name],onChange:(l=a.name,e=>{t({[l]:e})}),__nextHasNoMarginBottom:!0})},n);case"color":return(0,u.jsx)(i.PanelRow,{children:(0,u.jsx)(s.PanelColorSettings,{title:a.label,colorSettings:[{label:ayg_block.i18n.selected_color,value:e[a.name],onChange:x(a.name)}]})},n);default:return(0,u.jsx)(i.PanelRow,{children:(0,u.jsx)(i.TextControl,{label:a.label,help:r,placeholder:o,value:e[a.name],onChange:x(a.name),__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0})},n)}var l})(ayg_block.options[a].fields[n],"automatic-youtube-gallery-block-control-"+o))},"automatic-youtube-gallery-block-panel-"+n))}),(0,u.jsx)("div",{..._,children:(0,u.jsx)(i.Disabled,{children:(0,u.jsx)(g,{})})})]})}})})()})();