import{ak as K,z as b,d as N,b as m,T as s,n as w,o,al as Q,Q as z,f as u,ah as I,i as C,am as W,g as t,ad as T,r as M,K as L,Y,L as J,P as X,an as Z,e as i,B as ee,w as y,k as V,a9 as E,t as te,F as se}from"../modules/vue-B5Z8nqrj.js";import{a as oe,u as ne,e as le,h as re,j as ie,k as ae,l as ce,m as ue,s as de,d as ve,n as me,_ as fe}from"../index-Dvzj8oI6.js";import{b as pe,c as xe,a as P,S as _e}from"./SlideWrapper-C3uJZr2r.js";import{r as ke,u as ge,a as ye,_ as be,o as we,b as Ce,S as Se,G as he,c as $e,d as Te}from"./shortcuts-WrMfzOUH.js";import{_ as Me,C as ze}from"./NoteDisplay.vue_vue_type_style_index_0_lang-CnNPARlR.js";import{_ as Ne}from"./DrawingControls.vue_vue_type_style_index_0_lang-DRaCWWfk.js";import{_ as R}from"./IconButton.vue_vue_type_script_setup_true_lang-BC4Pfblr.js";import"../modules/shiki-CcvRnmUC.js";import"./context-BnSEiytE.js";import"../modules/unplugin-icons-CKCvuFEe.js";function Fe(){const{counter:x,isActive:n,reset:r,pause:l,resume:a}=K(1e3,{controls:!0});return{timer:b(()=>{const d=x.value,S=Math.floor(d%60).toString().padStart(2,"0");return`${Math.floor(d/60).toString().padStart(2,"0")}:${S}`}),isTimerActive:n,resetTimer:r,toggleTimer:()=>n.value?l():a()}}const je=N({__name:"NoteStatic",props:{no:{},class:{},clicksContext:{}},setup(x){const n=x,{info:r}=pe(n.no);return(l,a)=>(o(),m(Me,{class:w(n.class),note:s(r)?.note,"note-html":s(r)?.noteHTML,"clicks-context":l.clicksContext},null,8,["class","note","note-html","clicks-context"]))}}),Be={"h-full":"","w-full":""},De={key:0,"w-full":"","h-full":"",flex:"~ col gap-4 items-center justify-center"},Le=N({__name:"ScreenCaptureMirror",setup(x){const n=Q("video"),r=z(null),l=z(!1);async function a(){r.value=await navigator.mediaDevices.getDisplayMedia({video:{cursor:"always"},audio:!1,selfBrowserSurface:"include",preferCurrentTab:!1}),n.value.srcObject=r.value,n.value.play(),l.value=!0,r.value.addEventListener("inactive",()=>{n.value.srcObject=null,l.value=!1}),r.value.addEventListener("ended",()=>{n.value.srcObject=null,l.value=!1})}return(_,d)=>(o(),u("div",Be,[I(t("video",{ref_key:"video",ref:n,class:"w-full h-full object-contain"},null,512),[[W,l.value]]),l.value?C("v-if",!0):(o(),u("div",De,[d[0]||(d[0]=t("div",{op50:""},[T(" Use screen capturing to mirror your main screen back to presenter view."),t("br"),T(" Click the button below and "),t("b",null,"select your other monitor or window"),T(". ")],-1)),t("button",{class:"slidev-form-button",onClick:a}," Start Screen Mirroring ")]))]))}}),Ve={class:"bg-main h-full slidev-presenter","pt-2px":""},Ee={flex:"~ gap-4 items-center",border:"b main",p1:""},Pe={class:"relative grid-section next flex flex-col p-2 lg:p-4"},Re={key:1,class:"h-full flex justify-center items-center"},Ie={key:0,class:"grid-section note of-auto"},We={key:1,class:"grid-section note grid grid-rows-[1fr_min-content] overflow-hidden"},Ae={class:"grid-section bottom flex"},Oe={class:"group flex items-center justify-center pl-4 select-none"},Ge={class:"w-22px cursor-pointer"},He={class:"group-not-hover:hidden flex flex-col items-center"},Ue={key:0,class:"i-carbon:pause text-lg"},qe={key:1,class:"i-carbon:play"},Ke={class:"text-2xl px-3 my-auto tabular-nums"},Qe={class:"progress-bar"},Ye=N({__name:"presenter",setup(x){const n=E(),r=M();ke(),ge(r),ye();const{clicksContext:l,currentSlideNo:a,currentSlideRoute:_,hasNext:d,nextRoute:S,slides:F,getPrimaryClicks:A,total:O}=oe(),{isDrawing:G}=xe();ne({title:`Presenter - ${de}`}),M(!1);const{timer:H,isTimerActive:U,resetTimer:j,toggleTimer:B}=Fe(),q=b(()=>F.value.map(f=>{const e=M(0);return{context:le(e,f?.meta.slide?.frontmatter.clicksStart??0,f?.meta.clicks),clicks:e}})),c=b(()=>l.value.currentc.value&&q.value[c.value[0].no-1]);L(c,()=>{g.value&&c.value&&(g.value.clicks.value=c.value[1])},{immediate:!0});const k=Y("slidev-presenter-main-slide-mode","slides"),D=z();return J(()=>{const f=r.value.querySelector("#slide-content"),e=X(Z()),v=E();L(()=>{if(!v.value||G.value||!me.value||!f)return;const p=f.getBoundingClientRect(),h=(e.x-p.left)/p.width*100,$=(e.y-p.top)/p.height*100;if(!(h<0||h>100||$<0||$>100))return{x:h,y:$}},p=>{ve.cursor=p})}),(f,e)=>(o(),u(se,null,[t("div",Ve,[t("div",{class:w(["grid-container",`layout${s(re)}`])},[t("div",{ref_key:"main",ref:r,class:"relative grid-section main flex flex-col"},[t("div",Ee,[e[5]||(e[5]=t("span",{op50:"",px2:""},"Current",-1)),e[6]||(e[6]=t("div",{"flex-auto":""},null,-1)),i(be,{modelValue:s(k),"onUpdate:modelValue":e[0]||(e[0]=v=>ee(k)?k.value=v:null),options:[{label:"Slides",value:"slides"},{label:"Screen Mirror",value:"mirror"}]},null,8,["modelValue"])]),s(k)==="mirror"?(o(),m(Le,{key:0})):C("v-if",!0),C(" We use v-show here to still infer the clicks context "),I(i(P,{key:"main",class:"p-2 lg:p-4 flex-auto","is-main":"",onContextmenu:s(we)},{default:y(()=>[i(Se,{"render-context":"presenter"})]),_:1},8,["onContextmenu"]),[[W,s(k)==="slides"]]),(o(),m(ze,{key:s(_)?.no,"clicks-context":s(A)(s(_)),class:"w-full pb2 px4 flex-none"},null,8,["clicks-context"]))],512),t("div",Pe,[c.value&&g.value?(o(),m(P,{key:"next"},{default:y(()=>[(o(),m(_e,{key:c.value[0].no,"clicks-context":g.value.context,route:c.value[0],"render-context":"previewNext"},null,8,["clicks-context","route"]))]),_:1})):(o(),u("div",Re,e[7]||(e[7]=[t("div",{class:"text-gray-500"}," End of the presentation ",-1)]))),e[8]||(e[8]=t("div",{class:"absolute left-0 top-0 bg-main border-b border-r border-main px2 py1 op50 text-sm"}," Next ",-1))]),D.value&&s(ie)?(o(),u("div",Ie,[i(s(D))])):(o(),u("div",We,[(o(),m(je,{key:`static-${s(a)}`,no:s(a),class:"w-full max-w-full h-full overflow-auto p-2 lg:p-4",style:V({fontSize:`${s(ae)}em`}),"clicks-context":s(l)},null,8,["no","style","clicks-context"])),e[12]||(e[12]=t("div",{"border-t":"","border-main":""},null,-1)),t("div",{class:w(["py-1 px-2 text-sm transition",s(n)?"":"op25"])},[i(R,{title:"Increase font size",onClick:s(ce)},{default:y(()=>e[9]||(e[9]=[t("div",{class:"i-carbon:zoom-in"},null,-1)])),_:1,__:[9]},8,["onClick"]),i(R,{title:"Decrease font size",onClick:s(ue)},{default:y(()=>e[10]||(e[10]=[t("div",{class:"i-carbon:zoom-out"},null,-1)])),_:1,__:[10]},8,["onClick"]),C("v-if",!0)],2)])),t("div",Ae,[i(Ce,{persist:!0,class:w(["transition",s(n)?"":"op25"])},null,8,["class"]),e[15]||(e[15]=t("div",{"flex-auto":""},null,-1)),t("div",Oe,[t("div",Ge,[e[14]||(e[14]=t("div",{class:"i-carbon:time group-hover:hidden text-xl"},null,-1)),t("div",He,[t("div",{class:"relative op-80 hover:op-100",onClick:e[3]||(e[3]=(...v)=>s(B)&&s(B)(...v))},[s(U)?(o(),u("div",Ue)):(o(),u("div",qe))]),t("div",{class:"op-80 hover:op-100",onClick:e[4]||(e[4]=(...v)=>s(j)&&s(j)(...v))},e[13]||(e[13]=[t("div",{class:"i-carbon:renew"},null,-1)]))])]),t("div",Ke,te(s(H)),1)])]),(o(),m(Ne,{key:2}))],2),t("div",Qe,[t("div",{class:"progress h-3px bg-primary transition-all",style:V({width:`${(s(a)-1)/(s(O)-1)*100+1}%`})},null,4)])]),i(he),i($e),i(Te)],64))}}),it=fe(Ye,[["__scopeId","data-v-1415c4a0"]]);export{it as default};