(()=>{"use strict";var e={n:t=>{var l=t&&t.__esModule?()=>t.default:()=>t;return e.d(l,{a:l}),l},d:(t,l)=>{for(var r in l)e.o(l,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:l[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.element,l=window.wp.blocks,r=window.wp.components,s=window.wp.blockEditor,o=window.wp.i18n,n=window.wp.serverSideRender;var i=e.n(n);const c=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"llms/course-continue","title":"Course Progress with Continue Button","category":"llms-blocks","description":"Display a progress bar with continue button for a specific course. Renders only for enrolled students.","textdomain":"lifterlms","attributes":{"course_id":{"type":"integer"},"llms_visibility":{"type":"string"},"llms_visibility_in":{"type":"string"},"llms_visibility_posts":{"type":"string"}},"supports":{"align":["wide","full"]},"editorScript":"file:./index.js"}'),a=window.wp.primitives,u=window.wp.data,p=["course","lesson","llms_quiz"],d=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"name";const l=null==e?void 0:e.replace("llms_",""),r=l.charAt(0).toUpperCase()+l.slice(1);return"name"===t?l:r},m=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"course";const{posts:t,currentPostType:l}=(0,u.useSelect)((t=>{var l;return{posts:t("core").getEntityRecords("postType",e),currentPostType:null===(l=t("core/editor"))||void 0===l?void 0:l.getCurrentPostType()}}),[]),r=(d(e),[]);return p.includes(l)||r.push({label:(0,o.__)("Select course","lifterlms"),value:0}),null!=t&&t.length&&t.forEach((e=>{r.push({label:e.title.rendered+" (ID: "+e.id+")",value:e.id})})),p.includes(l)&&r.unshift({label:(0,o.sprintf)(
// Translators: %s = Post type name.
(0,o.__)("Inherit from current %s","lifterlms"),d(l)),value:0}),null!=r&&r.length||r.push({label:(0,o.__)("Loading","lifterlms"),value:0}),r},w=e=>{var l,s;let{attributes:n,setAttributes:i,postType:c="course",attribute:a="course_id"}=e;const u=m(c),p=d(c),w=d(c,"title"),b=(0,o.sprintf)(
// Translators: %s = Post type name.
(0,o.__)("Select the %s to associate with this block.","lifterlms"),p);return(0,t.createElement)(r.PanelRow,null,(0,t.createElement)(r.SelectControl,{label:w,help:b,value:null!==(l=null==n?void 0:n[a])&&void 0!==l?l:null==u||null===(s=u[0])||void 0===s?void 0:s.value,options:u,onChange:e=>{i({[a]:parseInt(e,10)})}}))};(0,l.registerBlockType)(c,{icon:()=>(0,t.createElement)(a.SVG,{className:"llms-block-icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},(0,t.createElement)(a.Path,{d:"M448 160H320V128H448v32zM48 64C21.5 64 0 85.5 0 112v64c0 26.5 21.5 48 48 48H464c26.5 0 48-21.5 48-48V112c0-26.5-21.5-48-48-48H48zM448 352v32H192V352H448zM48 288c-26.5 0-48 21.5-48 48v64c0 26.5 21.5 48 48 48H464c26.5 0 48-21.5 48-48V336c0-26.5-21.5-48-48-48H48z"})),edit:e=>{const{attributes:l}=e,n=(0,s.useBlockProps)(),a=m(),u=(0,t.useMemo)((()=>{let e=(0,o.__)("No progress data found for this course. This block will not be displayed.","lifterlms");return!l.course_id&&a.length>0&&(e=(0,o.__)("No course selected. Please choose a Course from the block sidebar panel.","lifterlms")),(0,t.createElement)(i(),{block:c.name,attributes:l,LoadingResponsePlaceholder:()=>(0,t.createElement)(r.Spinner,null),ErrorResponsePlaceholder:()=>(0,t.createElement)("p",{className:"llms-block-error"},(0,o.__)("Error loading content. Please check block settings are valid. This block will not be displayed.","lifterlms")),EmptyResponsePlaceholder:()=>(0,t.createElement)("p",{className:"llms-block-empty"},e)})}),[l]);return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(s.InspectorControls,null,(0,t.createElement)(r.PanelBody,{title:(0,o.__)("Course Continue Settings","lifterlms")},(0,t.createElement)(w,e))),(0,t.createElement)("div",n,(0,t.createElement)(r.Disabled,null,u)))}})})();