1 | import{toConsumableArray as e,typeof as n,createForOfIteratorHelper as t}from"./_virtual/_rollupPluginBabelHelpers.js";var r,o=new Map,a=new Map,c=[],i=3600,u=6e4,f=!1,l="";function s(){var e,n=t(c);try{for(n.s();!(e=n.n()).done;){(0,e.value)()}}catch(e){n.e(e)}finally{n.f()}}function v(){return(new Date).getTime()/1e3}function h(){r=setInterval((function(){o.size>0&&a.forEach((function(e,n){o.has(n)&&e<v()&&(o.delete(n),a.delete(n),s())}))}),u||6e4)}function d(e){l=e,s()}function g(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;n||(n="".concat(l,"._").concat(l)),m(n)||(o.set(n,e),a.set(n,v()+i)),s()}function p(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;return e&&o.has(e)?o.get(e):o.get("".concat(l,"._").concat(l))}function y(e){u=e,s()}function b(e){i=e,s()}function m(e){if(o.has(e)&&a.has(e)){var t=o.get(e);if(Array.isArray(t))return t.length>0;if("object"===n(t))return Object.keys(t).length>0}return!1}function I(e){e&&(o.delete(e),a.delete(e)),s()}function _(e){(f=e)?h():clearInterval(r),s()}function j(){return o}function w(n){return c=[].concat(e(c),[n]),f&&h(),function(){c=c.filter((function(e){return e!==n})),clearInterval(r)}}export{g as add,I as clear,p as get,j as getSnapshot,m as has,d as setKey,y as setPeriodTime,_ as setPeriodically,b as setTTL,w as subscribe};
|