var M=Object.create;var E=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var N=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty;var W=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var K=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of x(t))!j.call(e,i)&&i!==n&&E(e,i,{get:()=>t[i],enumerable:!(r=F(t,i))||r.enumerable});return e};var k=(e,t,n)=>(n=e!=null?M(N(e)):{},K(t||!e||!e.__esModule?E(n,"default",{value:e,enumerable:!0}):n,e));var C=W((Z,v)=>{"use strict";var a=typeof Reflect=="object"?Reflect:null,h=a&&typeof a.apply=="function"?a.apply:function(t,n,r){return Function.prototype.apply.call(t,n,r)},l;a&&typeof a.ownKeys=="function"?l=a.ownKeys:Object.getOwnPropertySymbols?l=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:l=function(t){return Object.getOwnPropertyNames(t)};function H(e){console&&console.warn&&console.warn(e)}var _=Number.isNaN||function(t){return t!==t};function s(){s.init.call(this)}v.exports=s;v.exports.once=B;s.EventEmitter=s;s.prototype._events=void 0;s.prototype._eventsCount=0;s.prototype._maxListeners=void 0;var O=10;function p(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return O},set:function(e){if(typeof e!="number"||e<0||_(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");O=e}});s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};s.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||_(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function m(e){return e._maxListeners===void 0?s.defaultMaxListeners:e._maxListeners}s.prototype.getMaxListeners=function(){return m(this)};s.prototype.emit=function(t){for(var n=[],r=1;r0&&(o=n[0]),o instanceof Error)throw o;var u=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw u.context=o,u}var c=f[t];if(c===void 0)return!1;if(typeof c=="function")h(c,this,n);else for(var d=c.length,P=I(c,d),r=0;r0&&o.length>i&&!o.warned){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=o.length,H(u)}return e}s.prototype.addListener=function(t,n){return D(this,t,n,!1)};s.prototype.on=s.prototype.addListener;s.prototype.prependListener=function(t,n){return D(this,t,n,!0)};function U(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function y(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=U.bind(r);return i.listener=n,r.wrapFn=i,i}s.prototype.once=function(t,n){return p(n),this.on(t,y(this,t,n)),this};s.prototype.prependOnceListener=function(t,n){return p(n),this.prependListener(t,y(this,t,n)),this};s.prototype.removeListener=function(t,n){var r,i,f,o,u;if(p(n),i=this._events,i===void 0)return this;if(r=i[t],r===void 0)return this;if(r===n||r.listener===n)--this._eventsCount===0?this._events=Object.create(null):(delete i[t],i.removeListener&&this.emit("removeListener",t,r.listener||n));else if(typeof r!="function"){for(f=-1,o=r.length-1;o>=0;o--)if(r[o]===n||r[o].listener===n){u=r[o].listener,f=o;break}if(f<0)return this;f===0?r.shift():T(r,f),r.length===1&&(i[t]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",t,u||n)}return this};s.prototype.off=s.prototype.removeListener;s.prototype.removeAllListeners=function(t){var n,r,i;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[t]),this;if(arguments.length===0){var f=Object.keys(r),o;for(i=0;i=0;i--)this.removeListener(t,n[i]);return this};function A(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i=="function"?n?[i.listener||i]:[i]:n?S(i):I(i,i.length)}s.prototype.listeners=function(t){return A(this,t,!0)};s.prototype.rawListeners=function(t){return A(this,t,!1)};s.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):g.call(e,t)};s.prototype.listenerCount=g;function g(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?l(this._events):[]};function I(e,t){for(var n=new Array(t),r=0;r(r[r.PAUSE=0]="PAUSE",r[r.PROVIDE_FILE=1]="PROVIDE_FILE",r[r.RESUME=2]="RESUME",r))(L||{});var w=new b.default,G=(e,t)=>(Object.assign(e,t),typeof WorkerGlobalScope<"u"&&self.postMessage({event:"FILE_UPDATED",lufiFile:e}),e),ne=(e,t)=>{G(e,{uploadStatus:2}),self.postMessage({event:"OPERATION_FAILED",error:t})},re=()=>{w.once("SOCKET_OPENED",()=>{self.postMessage({event:"SOCKET_OPENED"})}),w.once("OPERATION_FAILED",e=>{self.postMessage({event:"OPERATION_FAILED",error:e})})},ie=e=>typeof e=="object"&&e!==null&&"action"in e&&Object.values(L).includes(e.action);export{w as events,re as init,ie as isWorkerActionMessage,ne as sendFileError,G as updateFile};