import{At as S$1,I as Fd,Rn as cw,W as Ie,Y as J,fa as zr,l as Be}from"./chunk-jkw018wQ.js";import{B as fe}from"./chunk-C7jJGTJv.js";var C=new S$1(`COOKIE_OPTIONS`);var p=new S$1(`COOKIE_WRITER`);function l(e){return e==null}function s(e){return!l(e)}function b(e){return typeof e==`string`}function j(e,r){return r?{path:s(r.path)?r.path:e.path,domain:s(r.domain)?r.domain:e.domain,expires:s(r.expires)?r.expires:e.expires,secure:s(r.secure)?r.secure:e.secure,sameSite:s(r.sameSite)?r.sameSite:e.sameSite,httpOnly:s(r.httpOnly)?r.httpOnly:e.httpOnly,storeUnencoded:s(r.storeUnencoded)?r.storeUnencoded:e.storeUnencoded}:e}function O(e){let r={},t=``,i,o,c,n,d;if(e!==t)for(t=e,i=t.split(`;`),r={},c=0;c<i.length;c++)o=i[c],n=o.indexOf(`=`),n>0&&(d=S(o.substring(0,n).trim()),l(r[d])&&(r[d]=S(o.substring(n+1).trim())));return r}function M(e,r,t){let i=t?.expires,o;l(r)?(i=`Thu, 01 Jan 1970 00:00:00 GMT`,o=``):o=r,b(i)&&(i=new Date(i));let c=t?.storeUnencoded?r:encodeURIComponent(o),n=encodeURIComponent(e)+`=`+c;n+=t?.path?`;path=`+t.path:``,n+=t?.domain?`;domain=`+t.domain:``,n+=i?`;expires=`+i.toUTCString():``,n+=t?.sameSite?`; SameSite=`+t.sameSite:``,n+=t?.secure?`;secure`:``,n+=t?.httpOnly?`; HttpOnly`:``;let d=n.length+1;return d>4096&&console.log(`Cookie '`+e+`' possibly not set or overflowed because it was too large (`+d+` > 4096 bytes)!`),n}function S(e){try{return decodeURIComponent(e)}catch(r){return e}}var g=(()=>{class e{constructor(t={},i){this.injector=i,this.defaultOptions={path:this.injector.get(fe,`/`),domain:void 0,expires:void 0,secure:!1,httpOnly:!1},this.options=j(this.defaultOptions,t)}}return e.ɵfac=function(t){return new(t||e)(Be(C),Be(Ie))},e.ɵprov=J({token:e,factory:e.ɵfac}),e})();var I=(()=>{class e{constructor(t,i,o){this.document=t,this.optionsProvider=i,this.cookieWriterService=o,this.options=this.optionsProvider.options}hasKey(t){return s(this.get(t))}get(t){return this.getAll()?.[t]}getObject(t){let i=this.get(t);if(!l(i))return i===``?{}:JSON.parse(i)}getAll(){return O(this.cookieWriterService.readAllAsString())}put(t,i,o){let c=j(this.options,o);this.cookieWriterService.write(t,i,c)}putObject(t,i,o){this.put(t,JSON.stringify(i),o)}remove(t,i){this.put(t,void 0,i)}removeAll(t){let i=this.getAll();Object.keys(i).forEach(o=>this.remove(o,t))}}return e.ɵfac=function(t){return new(t||e)(Be(zr),Be(g),Be(p))},e.ɵprov=J({token:e,factory:e.ɵfac}),e})();var A=(()=>{class e{constructor(t){this.document=t}readAllAsString(){return this.document.cookie||``}write(t,i,o){this.document.cookie=M(t,i,o)}}return e.ɵfac=function(t){return new(t||e)(Be(zr))},e.ɵprov=J({token:e,factory:e.ɵfac}),e})();function x(e,r,t){return new I(e,r,t)}var _=(()=>{class e{static withOptions(t={}){return{ngModule:e,providers:[{provide:C,useValue:t},{provide:p,useClass:A},{provide:I,useFactory:x,deps:[zr,g,p]}]}}static forRoot(t={}){return this.withOptions(t)}static forChild(t={}){return this.withOptions(t)}}return e.ɵfac=function(t){return new(t||e)},e.ɵmod=cw({type:e}),e.ɵinj=Fd({providers:[g]}),e})();export{_ as n,I as t};