import{f as w,r as m,L as N,e as k,d as p,w as c,g as t,M as _,N as $,F as V,o as y,D as a}from"../modules/vue-DkYzewYG.js";import{u as C,j as T,s as H}from"../index-Dgc7rSMr.js";import{u as z}from"./useSlideInfo-BPaAfowv.js";import{_ as B}from"./IconButton.vue_vue_type_script_setup_true_lang-Bk4_sWNY.js";import{_ as D}from"./Modal.vue_vue_type_script_setup_true_lang-CZdOOjRt.js";import"../modules/shiki-COU8xzp7.js";const E={class:"flex my-1"},j={class:"h-full"},F={class:"slidev-glass-effect fixed bottom-5 right-5 rounded-full border border-main"},q=w({__name:"notes-edit",setup(I){C({title:`Notes Edit - ${H}`});const{slides:i}=T(),l=m(!1),n=m(v(i.value));function v(o){const e=[];for(const s of o)s.meta.slide.note?.trim()&&(e.push(`--- #${s.no}`),e.push(""),e.push(s.meta.slide.note),e.push(""));return e.join(`
`)}function h(o,e){const s=o.split(/^(---\s*#\d+\s*)$/gm);s.forEach((x,b)=>{const r=x.match(/^---\s*#(\d+)\s*$/);if(r){const d=Number.parseInt(r[1]),u=s[b+1].trim(),f=e.find(g=>g.no===d);f&&(f.meta.slide.note=u,z(d).update({note:u}))}})}return N(n,o=>{h(o,i.value)},{debounce:300}),(o,e)=>(y(),k(V,null,[p(D,{modelValue:l.value,"onUpdate:modelValue":e[1]||(e[1]=s=>l.value=s),class:"px-6 py-4 flex flex-col gap-2"},{default:c(()=>[e[4]||(e[4]=t("div",{class:"flex gap-2 text-xl"},[t("div",{class:"i-carbon:information my-auto"}),a(" Help ")],-1)),e[5]||(e[5]=t("div",{class:"prose dark:prose-invert"},[t("p",null,"This is the batch notes editor. You can edit the notes for all the slides at once here."),t("p",null,[a("The note for each slide are separated by "),t("code",null,"--- #[no]"),a(" lines, you might want to keep them while editing.")])],-1)),t("div",E,[t("button",{class:"slidev-form-button",onClick:e[0]||(e[0]=s=>l.value=!1)}," Close ")])]),_:1},8,["modelValue"]),t("div",j,[t("div",F,[p(B,{title:"Help",class:"rounded-full",onClick:e[2]||(e[2]=s=>l.value=!0)},{default:c(()=>[...e[6]||(e[6]=[t("div",{class:"i-carbon:help text-2xl"},null,-1)])]),_:1})]),_(t("textarea",{"onUpdate:modelValue":e[3]||(e[3]=s=>n.value=s),class:"prose dark:prose-invert resize-none p5 outline-none bg-transparent block h-full w-full! max-w-full! max-h-full! min-h-full! min-w-full!"},null,512),[[$,n.value]])])],64))}});export{q as default};
