(()=>{"use strict";var e={n:o=>{var r=o&&o.__esModule?()=>o.default:()=>o;return e.d(r,{a:r}),r},d:(o,r)=>{for(var n in r)e.o(r,n)&&!e.o(o,n)&&Object.defineProperty(o,n,{enumerable:!0,get:r[n]})},o:(e,o)=>Object.prototype.hasOwnProperty.call(e,o)};const o=window.wp.blocks,r=window.wp.i18n,n=JSON.parse('{"UU":"mine-cloudvod/course-single","DD":"Single Course"}'),l=window.wp.components,d=window.wp.blockEditor,i=window.wp.data,t=window.wp.serverSideRender;var s=e.n(t);const c=window.wp.element,a=window.ReactJSXRuntime,u={edit:(0,l.withNotices)((({attributes:e,setAttributes:o})=>{const{cid:t}=e,u=(0,d.useBlockProps)(),p=(0,i.useSelect)((e=>e("core").getEntityRecords("postType","mcv_course",{per_page:-1,orderby:"id",order:"desc",_fields:["id","title"]})||[]),[]),w=(0,c.useMemo)((()=>p.map((e=>({value:e.id,label:e.title.rendered})))),[p]),[v,m]=(0,c.useState)(null),_=null!==v?v:w;return(0,a.jsxs)("div",{...u,children:[(0,a.jsx)(d.InspectorControls,{children:(0,a.jsx)(l.PanelBody,{title:`${n.DD} ${(0,r.__)("Settings","mine-cloudvod")}`,children:(0,a.jsx)(l.ComboboxControl,{label:(0,r.__)("Courses","mine-cloudvod"),value:t,onChange:e=>o({cid:e}),options:_,onInputChange:e=>{m(e?w.filter((o=>o.label.toLowerCase().startsWith(e.toLowerCase()))):null)}})})}),(0,a.jsx)(s(),{block:n.UU,attributes:e,LoadingResponsePlaceholder:()=>(0,a.jsx)("div",{className:"mine-cloudvod__placeholder is-loading",children:(0,a.jsx)("p",{children:(0,r.__)("Loading preview…","mine-cloudvod")})}),ErrorResponsePlaceholder:({error:e})=>(0,a.jsx)("div",{className:"mine-cloudvod__placeholder",children:(0,a.jsx)("p",{children:e||(0,r.__)("Error loading preview","mine-cloudvod")})})})]})})),save:function(){return null}};(0,o.registerBlockType)(n.UU,u)})();