(()=>{"use strict";const e=window.React,t=window.wp.blockEditor,o=window.wp.blocks,l=window.wp.element,r=window.wp.data,n=window.wp.components,i=window.wp.i18n,c=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"html5-player/parent","title":"HTML5 Video Player Form","icon":"format-video","category":"media","keywords":["HTML5 Video Player","Media Player"],"supports":{"inserter":false,"reusable":false,"html":false},"editorScript":"file:./index.js","viewScript":"file:./view.js"}');(0,o.registerBlockType)(c,{edit:({clientId:o,isSelected:c})=>{const a=(0,t.useBlockProps)(),s=(0,r.useSelect)((e=>e("core/block-editor").getBlock(o).innerBlocks)),[p,d]=(0,l.useState)(h5vpBlock?.isPipe);(0,l.useEffect)((()=>{c&&wp.data.dispatch("core/edit-post").openGeneralSidebar("edit-post/block")}),[c]),(0,r.dispatch)("core/block-editor").setTemplateValidity(!0);const m=e=>{const t=wp.blocks.createBlock(`html5-player/${e}`);return(0,r.dispatch)("core/block-editor").insertBlock(t,0,o)};return s?.length?(0,e.createElement)("div",null,(0,e.createElement)("div",{...a},(0,e.createElement)(t.InnerBlocks,{templateLock:!1,allowedBlocks:["html5-player/video","html5-player/vimeo","html5-player/youtube"],renderAppender:()=>0===s.length&&(0,e.createElement)(t.InnerBlocks.ButtonBlockAppender,null)}))):(0,e.createElement)("div",null,(0,e.createElement)("div",{...a},(0,e.createElement)(n.Placeholder,{icon:(0,e.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"html5-block-icon"},(0,e.createElement)("polygon",{points:"23 7 16 12 23 17 23 7"}),(0,e.createElement)("rect",{x:"1",y:"5",width:"15",height:"14",rx:"2",ry:"2"})),instructions:(0,i.__)("Choose a video type to get started.","h5vp"),label:(0,i.__)("Choose a Video Type","h5vp")},(0,e.createElement)(n.Button,{isPrimary:!0,onClick:()=>{m("video")}},(0,i.__)("Video","h5vp")),(0,e.createElement)(n.Button,{disabled:!p,isPrimary:!0,onClick:()=>{m("youtube")}},(0,i.__)("Youtube","h5vp")),(0,e.createElement)(n.Button,{disabled:!p,isPrimary:!0,onClick:()=>{m("vimeo")}},(0,i.__)("Vimeo","h5vp")),!p&&(0,e.createElement)("p",{style:{marginTop:"8px",fontSize:"15px",color:"#d52525"}},(0,i.__)("Youtube and Vimeo is available on pro version!","h5vp"))),(0,e.createElement)(t.InnerBlocks,{templateLock:!1,allowedBlocks:["html5-player/video","html5-player/vimeo","html5-player/youtube"],renderAppender:()=>!1})))},save:()=>{const o=t.useBlockProps.save();return(0,e.createElement)("div",{...o},(0,e.createElement)(t.InnerBlocks.Content,null))}})})();