import{P as S,h as o,i as v}from"./index-CXwCk-SR.js";function i(n){return typeof n!="string"||n.length===0?null:n}const y=S("layer-selection",()=>{const n=o(null),t=o(null),u=o(null),r=o(null);function c(e,s,l){const a=`${e}|${s}`;r.value!==a&&(r.value=a,n.value=i(l.service),t.value=i(l.instance),u.value=i(l.endpoint))}function f(e,s={}){if(e===n.value)return;const l=n.value;n.value=e,l!==null&&!s.keepNarrower&&(t.value=null,u.value=null)}function p(e){e!==t.value&&(t.value=e)}function d(e){e!==u.value&&(u.value=e)}const h=v(()=>{const e=[];return n.value&&e.push(`service=${encodeURIComponent(n.value)}`),t.value&&e.push(`instance=${encodeURIComponent(t.value)}`),u.value&&e.push(`endpoint=${encodeURIComponent(u.value)}`),e.length>0?`?${e.join("&")}`:""});return{service:n,instance:t,endpoint:u,hydratedKey:r,hydrateFromQuery:c,setService:f,setInstance:p,setEndpoint:d,shareQuery:h}});function m(){const n=y(),t=v(()=>n.service);function u(r,c={}){n.setService(r,c)}return{selectedId:t,setSelected:u}}export{m as a,y as u};
