import{r as v,j as r}from"./sikshya-admin-sikshya-react-E_TY_un4.js";import{A as E}from"./sikshya-admin-ApiErrorPanel-2sA2VptM.js";import{E as p}from"./sikshya-admin-EmbeddableShell-B-jr8i1j.js";import{d as g,a as l}from"./sikshya-admin.js";import{r as y}from"./sikshya-admin-editors-9dUHfMxz.js";import{ad as u}from"./sikshya-admin-sikshya-vendor-BVAk_Gwu.js";import"./sikshya-admin-TopRightToast-D3K3yjHl.js";import"./sikshya-admin-buttons-Bym2otdv.js";import"./sikshya-admin-HorizontalEditorTabs-ogi6XBus.js";import"./sikshya-admin-WPMediaPickerField-BKf3vJE8.js";import"./sikshya-admin-DateTimePickerField-BPjPg-oO.js";import"./sikshya-admin-sikshya-datepicker-2wS9MLBN.js";import"./sikshya-admin-QuillField-DWLKMNYK.js";import"./sikshya-admin-sikshya-editor-BMfQXWSC.js";import"./sikshya-admin-GatedFeatureWorkspace-mZXMq0_r.js";import"./sikshya-admin-FeaturePreviewSkeleton-dX7zKbyj.js";import"./sikshya-admin-PlanUpgradeOverlay-XI07NKbe.js";import"./sikshya-admin-licensing-CjKVE_yW.js";import"./sikshya-admin-sikshya-dnd-DbBu59F0.js";import"./sikshya-admin-useAddons-vZnXRCUM.js";import"./sikshya-admin-Modal-DYW1MqVy.js";const x={sik_course:{view:"courses",sidebarKey:"courses"},sik_lesson:{view:"content-library",tab:"lessons",sidebarKey:"content-library"},sik_quiz:{view:"content-library",tab:"quizzes",sidebarKey:"content-library"},sik_assignment:{view:"content-library",tab:"assignments",sidebarKey:"content-library"},sik_question:{view:"content-library",tab:"questions",sidebarKey:"content-library"},sik_chapter:{view:"content-library",tab:"chapters",sidebarKey:"content-library"},sikshya_certificate:{view:"certificates-hub",tab:"templates",sidebarKey:"certificates-hub"}},K={sik_course:"Course",sik_lesson:"Lesson",sik_quiz:"Quiz",sik_assignment:"Assignment",sik_question:"Question",sik_chapter:"Chapter",sikshya_certificate:"Certificate"};function D(n){const{config:t,shellTitle:c}=n,{navigateHref:_}=g(),a=t.query||{},e=(a.post_type||"").trim(),i=Number(a.post_id||a.id||0)||0,d=i<=0,o=x[e]||{view:"dashboard",sidebarKey:"dashboard"},h=o.sidebarKey,s=K[e]||"Content",b=l(t,o.view,o.tab?{tab:o.tab}:{}),f=e==="sikshya_certificate",m=w=>{_(l(t,"edit-content",{post_type:e,post_id:String(w)}))},k=v.useMemo(()=>e?d?`New ${s}`:`Edit ${s} #${i}`:"Missing content type",[e,s,d,i]);return e?f?r.jsx("div",{className:"sikshya-cert-builder-viewport",children:y(e,{config:t,postType:e,postId:i,backHref:b,entityLabel:s,onSavedNewId:m})}):r.jsx(p,{embedded:n.embedded,config:t,title:c,subtitle:k,sidebarActivePage:h,children:r.jsx("div",{className:"w-full min-w-0",children:y(e,{config:t,postType:e,postId:i,backHref:b,entityLabel:s,onSavedNewId:m})})}):r.jsx(p,{embedded:n.embedded,config:t,title:c,subtitle:u("Missing content type","sikshya"),sidebarActivePage:"dashboard",children:r.jsx(E,{error:new Error("No post_type in the URL. Open this screen from a list link."),title:u("Cannot load editor","sikshya")})})}export{D as ContentPostEditorPage};
