import{a8 as m,a9 as b}from"./app-k0jcl5PQ.js";import{g as w}from"./DHXW5qmJ.chunk.js";import"./CRGucDdi.chunk.js";import"./Cq8Wr_gd.chunk.js";import"./DjpUaGGv.chunk.js";var _=(function(){function n(){this.fetchObserver=null}return n.prototype.start=function(e){this.eventCallback=e,this.observeFetch()},n.prototype.stop=function(){var e;(e=this.fetchObserver)===null||e===void 0||e.call(this),this.fetchObserver=null,this.eventCallback=void 0},n.prototype.notifyEvent=function(e){var t;(t=this.eventCallback)===null||t===void 0||t.call(this,e)},n.prototype.observeFetch=function(){var e=this,t=w();if(t){var h=t.fetch;h&&(t.fetch=function(f,o){return m(e,void 0,void 0,function(){var i,r,c,s,u,v,s,l;return b(this,function(a){switch(a.label){case 0:i=Date.now(),r={timestamp:i,type:"fetch",method:(o==null?void 0:o.method)||"GET",url:f.toString(),requestHeaders:o==null?void 0:o.headers},a.label=1;case 1:return a.trys.push([1,3,,4]),[4,h(f,o)];case 2:return c=a.sent(),s=Date.now(),r.status=c.status,r.duration=s-i,u={},c.headers.forEach(function(d,p){u[p]=d}),r.responseHeaders=u,this.notifyEvent(r),[2,c];case 3:throw v=a.sent(),s=Date.now(),r.duration=s-i,l=v,r.error={name:l.name||"UnknownError",message:l.message||"An unknown error occurred"},this.notifyEvent(r),v;case 4:return[2]}})})},this.fetchObserver=function(){t.fetch=h})}},n})();export{_ as NetworkObservers};
//# sourceMappingURL=adAn19_H.chunk.js.map
