import{d as g,Y as I,w as N,N as x,O as E,o as n,e as l,y as T,f as A,h as v,a0 as w,q as _,i as f,t as S,j as b,r as p,k as C,x as Y,aX as j,_ as H,P as y,bk as M,b_ as U,E as q,aV as G}from"./index-D92x6h1h.js";import{S as K}from"./sliders-horizontal-Am8f4Xsv.js";const D=Symbol("settingsPopoverContext"),X=["aria-label","aria-expanded"],F={key:0,class:"settings-popover__panel",role:"menu"},J={key:0,class:"settings-popover__divider"},Q=["disabled"],W=g({__name:"SettingsPopover",props:{ariaLabel:{default:b("View options")},tooltipText:{default:b("View options")},defaultsActive:{type:Boolean,default:!1}},emits:["reset"],setup(o,{expose:i,emit:a}){const c=a,s=p(!1),r=p(null),h=I(),V=C(()=>!!h.default&&(h.default()?.length??0)>0),m=p([]),d=p(new Set);function $(t,e){m.value.push({id:t,isDefault:e})}function O(t){const e=m.value.findIndex(u=>u.id===t);e>=0&&m.value.splice(e,1)}function P(t){const e=new Set(d.value);e.has(t)?e.delete(t):e.add(t),d.value=e}function B(){s.value=!s.value}N(s,(t,e)=>{!t&&e&&(d.value=new Set)}),j(D,{openSections:d,popoverOpen:s,registerSection:$,unregisterSection:O,toggleSection:P});function R(){c("reset"),s.value=!1}const L=[".p-multiselect-overlay",".p-select-overlay",".p-datepicker-panel",".p-tooltip"];function z(t){for(const e of t)if(e instanceof Element){for(const u of L)if(e.matches(u))return!0}return!1}function k(t){if(!r.value)return;const e=t.composedPath();e.includes(r.value)||z(e)||(s.value=!1)}return x(()=>document.addEventListener("click",k)),E(()=>document.removeEventListener("click",k)),i({close:()=>{s.value=!1}}),(t,e)=>{const u=Y("tooltip");return n(),l("div",{ref_key:"root",ref:r,class:"settings-popover"},[T((n(),l("button",{type:"button",class:"settings-popover__btn","aria-label":o.ariaLabel,"aria-haspopup":"menu","aria-expanded":s.value,onClick:B},[A(v(K),{size:16,"stroke-width":2})],8,X)),[[u,o.tooltipText,void 0,{bottom:!0}]]),s.value?(n(),l("div",F,[w(t.$slots,"default",{},void 0,!0),V.value?(n(),l("hr",J)):_("",!0),f("button",{type:"button",class:"settings-popover__reset",disabled:o.defaultsActive,onClick:R},S(v(b)("Reset to defaults")),9,Q)])):_("",!0)],512)}}}),le=H(W,[["__scopeId","data-v-8ee4cb17"]]),Z={class:"collapsible-section"},ee=["aria-expanded","aria-controls"],te={class:"collapsible-section__chevron","aria-hidden":"true"},oe={class:"collapsible-section__title"},se=["id"],ce=g({__name:"CollapsibleSection",props:{id:{},title:{},isDefault:{type:Boolean},summary:{}},setup(o){const i=o,a=G(D,null),c=C(()=>a?.openSections.value.has(i.id)??!0);x(()=>{a&&a.registerSection(i.id,()=>i.isDefault)}),E(()=>{a&&a.unregisterSection(i.id)});function s(){a&&a.toggleSection(i.id)}return(r,h)=>(n(),l("div",Z,[f("button",{type:"button",class:"collapsible-section__header","aria-expanded":c.value,"aria-controls":`collapsible-${o.id}`,onClick:s},[f("span",te,[c.value?(n(),y(v(M),{key:0,size:14,"stroke-width":2})):(n(),y(v(U),{key:1,size:14,"stroke-width":2}))]),f("span",oe,S(o.title),1),o.summary?(n(),l("span",{key:0,class:q(["collapsible-section__chip",{"collapsible-section__chip--accent":!o.isDefault}])},S(o.summary),3)):_("",!0)],8,ee),c.value?(n(),l("div",{key:0,id:`collapsible-${o.id}`,class:"collapsible-section__body"},[w(r.$slots,"default")],8,se)):_("",!0)]))}});export{le as S,ce as _};
