import{a as c}from"./chunk-7ZFHDZI4.js";import{a as A}from"./chunk-5JDCLYZA.js";import{Ia as S,a as j,db as k,lb as f,mb as w,r as m}from"./chunk-FWZCAEAJ.js";import{a as u}from"./chunk-CWTPBX7D.js";function s(n,...D){let[b,o,l,p,h]=O(D);if(b){let t=null;return l instanceof f?t=l:t=c(s,l).get(f),b.pipe(A(t)).subscribe(e=>{let y=()=>{n.update(i=>{if(!d(i))return o?.(i,e)||e;if(!d(e)){let r=o?o(i,e):e;return d(r)?u(u({},i),r):r}return u(u({},i),o?.(i,e)||e)})};p?k(y):y()})}if(h){let t=l instanceof S?c(s,l):void 0;return w(()=>n.set(h()),{allowSignalWrites:!0,injector:t})}return{with(...t){if(!this.subscription)this.subscription=new j;else if(this.subscription.closed)return console.info("[ngxtension connect] ConnectedSignal has been closed."),this;return this.subscription.add(s(n,...t,l,p)),this},subscription:null}}function O(n){return n.length>3?[n[0],n[1],n[2],n[3],null]:n.length===3?typeof n[2]=="boolean"?[n[0],null,n[1],n[2],null]:[n[0],n[1],n[2],!1,null]:n.length===2?typeof n[1]=="boolean"?[null,null,n[0],n[1],null]:typeof n[1]=="function"?[n[0],n[1],null,!1,null]:[n[0],null,n[1],!1,null]:m(n[0])?[n[0],null,null,!1,null]:typeof n[0]=="function"?[null,null,null,!1,n[0]]:[null,null,n[0],!1,null]}function d(n){return typeof n=="object"&&n!==void 0&&n!==null&&!Array.isArray(n)}export{s as a};
