function mockNetwork(e){if(!global.__minium__[`${e}_network_mocked`]){Object.defineProperty(global.__minium__,`${e}_network_mocked`,{value:!0,writable:!1});class s{constructor(e,s,c){this.success=e,this.fail=s,this.callback=c,this.chunkCallback=[],this.headersReceivedCallback=[],this.progressUpdateCallback=[],this.fd=setTimeout((()=>{this.headersReceivedCallback.forEach((e=>{this.success&&e({header:this.success.header})})),this.chunkCallback.forEach((e=>{this.success&&e(this.success.data)})),this.progressUpdateCallback.forEach((e=>{this.success&&e({progress:100,totalBytesWritten:100,totalBytesExpectedToWrite:100})})),c(this.success||this.fail)}))}abort(){clearTimeout(this.fd)}offChunkReceived(e){var s=this.chunkCallback.indexOf(e);-1!==s&&this.chunkCallback.splice(s,1)}offHeadersReceived(e){var s=this.headersReceivedCallback.indexOf(e);-1!==s&&this.headersReceivedCallback.splice(s,1)}onChunkReceived(e){this.chunkCallback.push(e)}onHeadersReceived(e){this.headersReceivedCallback.push(e)}onProgressUpdate(e){this.progressUpdateCallback.push(e)}}global.__minium__[`${e}Task`]=s;const c=new global.__minium__.MockRule(`${e}_network_mock_rule`);global.__minium__.setMock(e,(function(e){const i=c.search(e);return i?(console.log("@@@@rule match",i),e.__miniumMocked=!0,i.success?new s(i.success,void 0,(s=>{e.success&&e.success(s),e.complete&&e.complete(s)})):i.fail?new s(void 0,i.fail,(s=>{e.fail&&e.fail(s),e.complete&&e.complete(s)})):void 0):this.origin(e)}))}}
