import{f as D,e as p,n as m,g as c,z as H,F as $,t as y,T as N,M as T,N as z,k as A,A as h,o as f,J as I,O as F,R as P,r as B,p as R}from"../modules/vue-DkYzewYG.js";import{C as E,x as V,y as K,_ as j}from"../index-Dgc7rSMr.js";const q=["title"],J={class:"flex gap-0.2 items-center min-w-16 font-mono mr1"},O={"text-primary":""},U={op50:"","text-sm":""},X={key:1,op50:"","flex-auto":"",pl1:""},G={relative:"","flex-auto":"",h5:"","font-mono":"",flex:"~"},Q=["min","max"],W=D({__name:"ClicksSlider",props:{clicksContext:{},readonly:{type:Boolean},active:{type:Boolean,default:!0}},setup(u){const d=u,t=h(()=>d.clicksContext.total),x=h(()=>V(0,d.clicksContext.clicksStart,t.value)),v=h(()=>t.value-x.value+1),n=h({get(){return d.clicksContext.current>t.value?-1:d.clicksContext.current},set(k){d.clicksContext.current=k}}),C=h(()=>K(x.value,t.value+1));function b(){d.readonly||(n.value<0||n.value>t.value)&&(n.value=0)}return(k,r)=>(f(),p("div",{class:m(["flex gap-1 items-center select-none",v.value&&d.clicksContext.isMounted?"":"op50"]),title:`Clicks in this slide: ${v.value}`},[c("div",J,[r[4]||(r[4]=c("div",{class:"i-carbon:cursor-1 text-sm op50"},null,-1)),n.value>=0&&n.value!==H(E)&&u.active?(f(),p($,{key:0},[r[2]||(r[2]=c("div",{"flex-auto":""},null,-1)),c("span",O,y(n.value),1),r[3]||(r[3]=c("span",{op25:"","text-sm":""},"/",-1)),c("span",U,y(t.value),1)],64)):(f(),p("div",X,y(t.value),1))]),c("div",G,[(f(!0),p($,null,N(C.value,l=>(f(),p("div",{key:l,border:"y main","of-hidden":"",relative:"",class:m([l===0?"rounded-l border-l":"",l===t.value?"rounded-r border-r":""]),style:A({width:v.value>0?`${1/v.value*100}%`:"100%"})},[c("div",{absolute:"","inset-0":"",class:m(l<=n.value&&u.active?"bg-primary op15":"")},null,2),c("div",{class:m([+l==+n.value&&u.active?"text-primary font-bold op100 border-primary":"op30 border-main",l===0?"rounded-l":"",l===t.value?"rounded-r":"border-r-2"]),"w-full":"","h-full":"","text-xs":"",flex:"","items-center":"","justify-center":"","z-1":""},y(l),3)],6))),128)),T(c("input",{"onUpdate:modelValue":r[0]||(r[0]=l=>n.value=l),class:m(["range",u.readonly?"pointer-events-none":""]),type:"range",min:x.value,max:t.value,step:1,absolute:"","inset-0":"","z-label":"",op0:"",style:A({"--thumb-width":`${1/(v.value+1)*100}%`}),onMousedown:b,onFocus:r[1]||(r[1]=l=>l.currentTarget?.blur())},null,46,Q),[[z,n.value]])])],10,q))}}),le=j(W,[["__scopeId","data-v-d1ec9b7d"]]),Y=["innerHTML"],Z=["textContent"],ee=["textContent"],M="slidev-note-fade",g="slidev-note-click-mark",se=D({__name:"NoteDisplay",props:{class:{},noteHtml:{},note:{},highlight:{type:Boolean,default:!0},placeholder:{},clicksContext:{},autoScroll:{type:Boolean}},emits:["markerDblclick","markerClick"],setup(u,{emit:d}){const t=u,x=d,v=h(()=>t.clicksContext!=null&&t.noteHtml?.includes(g)),n=B(null);function C(){if(!n.value||!v.value)return;const k=Array.from(n.value.querySelectorAll(`.${g}`)),r=new Map,l=new Map;let L=0;for(const a of k){const s=Number(a.dataset.clicks);r.set(a,s);let o=a,e=a.parentElement;for(;e&&o!==n.value;)l.has(e)||l.set(e,[[null,L]]),l.get(e).push([o,s]),o=e,e=e.parentElement;L=s}const S=new Map;for(const[a,s]of l){let o=!1,e=0;for(const i of Array.from(a.childNodes)){let w=!1;for(;i===s[e+1]?.[0];)w=!0,e++;if(w)continue;let _=i;if(i.nodeType===3){if(!i.textContent?.trim())continue;_=document.createElement("span"),_.textContent=i.textContent,a.insertBefore(_,i),i.remove()}o||=e===0,S.set(_,s[e][1])}o||(s[0][1]=-1)}return a=>{const s=t.highlight;for(const[o,e]of l)o.classList.toggle(M,s&&!e.some(([i,w])=>w===a));for(const[o,e]of S)o.classList.toggle(M,s&&e!==a);for(const[o,e]of r)o.classList.remove(M),o.classList.toggle(`${g}-past`,s&&e<a),o.classList.toggle(`${g}-active`,s&&e===a),o.classList.toggle(`${g}-next`,s&&e===a+1),o.classList.toggle(`${g}-future`,s&&e>a+1),o.ondblclick=i=>{s&&(x("markerDblclick",i,e),!i.defaultPrevented&&(t.clicksContext.current=e,i.stopPropagation(),i.stopImmediatePropagation()))},o.onclick=i=>{s&&x("markerClick",i,e)},s&&t.autoScroll&&e===a&&o.scrollIntoView({block:"center",behavior:"smooth"})}}const b=B();return I(()=>[t.noteHtml,t.highlight],()=>{R(()=>{b.value=C()})},{immediate:!0}),F(()=>{C()}),P(()=>{const k=t.clicksContext?.current??E;b.value?.(k)}),(k,r)=>u.noteHtml?(f(),p("div",{key:0,ref_key:"noteDisplay",ref:n,class:m(["prose dark:prose-invert overflow-auto outline-none slidev-note",[t.class,v.value?"slidev-note-with-clicks":""]]),innerHTML:u.noteHtml},null,10,Y)):u.note?(f(),p("div",{key:1,class:m(["prose dark:prose-invert overflow-auto outline-none slidev-note",t.class])},[c("p",{textContent:y(u.note)},null,8,Z)],2)):(f(),p("div",{key:2,class:m(["prose dark:prose-invert overflow-auto outline-none opacity-50 italic select-none slidev-note",t.class])},[c("p",{textContent:y(t.placeholder||"No notes.")},null,8,ee)],2))}});export{le as C,se as _};
