var m=(e,r)=>()=>(r||(r={exports:{}},e(r.exports,r)),r.exports);var T=m(n=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0});n.kFieldCount=n.kResponseCountField=n.kRequestCountField=n.isTaskQueue=n.markMovable=n.isMovable=n.isTransferable=n.kQueueOptions=n.kValue=n.kTransferable=n.commonState=void 0;n.commonState={isWorkerThread:!1,workerData:void 0};var k=Symbol("Piscina.kMovable");n.kTransferable=Symbol.for("Piscina.transferable");n.kValue=Symbol.for("Piscina.valueOf");n.kQueueOptions=Symbol.for("Piscina.queueOptions");function M(e){return e!=null&&typeof e=="object"&&n.kTransferable in e&&n.kValue in e}n.isTransferable=M;function U(e){return M(e)&&e[k]===!0}n.isMovable=U;function Q(e){Object.defineProperty(e,k,{enumerable:!1,configurable:!0,writable:!0,value:!0})}n.markMovable=Q;function V(e){return typeof e=="object"&&e!==null&&"size"in e&&typeof e.shift=="function"&&typeof e.remove=="function"&&typeof e.push=="function"}n.isTaskQueue=V;n.kRequestCountField=0;n.kResponseCountField=1;n.kFieldCount=2});var D=m((K,S)=>{var C=require("fs"),u=require("path"),q=require("os"),P=typeof __webpack_require__=="function"?__non_webpack_require__:require,W=process.config&&process.config.variables||{},H=!!process.env.PREBUILDS_ONLY,R=process.versions.modules,v=z()?"electron":"node",_=q.arch(),h=q.platform(),O=process.env.LIBC||($(h)?"musl":"glibc"),b=process.env.ARM_VERSION||(_==="arm64"?"8":W.arm_version)||"",j=(process.versions.uv||"").split(".")[0];S.exports=f;function f(e){return P(f.path(e))}f.path=function(e){e=u.resolve(e||".");try{var r=P(u.join(e,"package.json")).name.toUpperCase().replace(/-/g,"_");process.env[r+"_PREBUILD"]&&(e=process.env[r+"_PREBUILD"])}catch(c){}if(!H){var t=E(u.join(e,"build/Release"),x);if(t)return t;var i=E(u.join(e,"build/Debug"),x);if(i)return i}var s=p(e);if(s)return s;var o=p(u.dirname(process.execPath));if(o)return o;var l=["platform="+h,"arch="+_,"runtime="+v,"abi="+R,"uv="+j,b?"armv="+b:"","libc="+O,"node="+process.versions.node,process.versions&&process.versions.electron?"electron="+process.versions.electron:"",typeof __webpack_require__=="function"?"webpack=true":""].filter(Boolean).join(" ");throw new Error("No native build was found for "+l+`
    loaded from: `+e+`
`);function p(c){var a=u.join(c,"prebuilds",h+"-"+_),d=g(a).map(L),B=d.filter(I(v,R)),y=B.sort(A(v))[0];if(y)return u.join(a,y.file)}};function g(e){try{return C.readdirSync(e)}catch(r){return[]}}function E(e,r){var t=g(e).filter(r);return t[0]&&u.join(e,t[0])}function x(e){return/\.node$/.test(e)}function L(e){var r=e.split("."),t=r.pop(),i={file:e,specificity:0};if(t==="node"){for(var s=0;s<r.length;s++){var o=r[s];if(o==="node"||o==="electron"||o==="node-webkit")i.runtime=o;else if(o==="napi")i.napi=!0;else if(o.slice(0,3)==="abi")i.abi=o.slice(3);else if(o.slice(0,2)==="uv")i.uv=o.slice(2);else if(o.slice(0,4)==="armv")i.armv=o.slice(4);else if(o==="glibc"||o==="musl")i.libc=o;else continue;i.specificity++}return i}}function I(e,r){return function(t){return!(t==null||t.runtime!==e&&!Y(t)||t.abi!==r&&!t.napi||t.uv&&t.uv!==j||t.armv&&t.armv!==b||t.libc&&t.libc!==O)}}function Y(e){return e.runtime==="node"&&e.napi}function A(e){return function(r,t){return r.runtime!==t.runtime?r.runtime===e?-1:1:r.abi!==t.abi?r.abi?-1:1:r.specificity!==t.specificity?r.specificity>t.specificity?-1:1:0}}function z(){return process.versions&&process.versions.electron||process.env.ELECTRON_RUN_AS_NODE?!0:typeof window!="undefined"&&window.process&&window.process.type==="renderer"}function $(e){return e==="linux"&&C.existsSync("/etc/alpine-release")}f.parseTags=L;f.matchTags=I;f.compareTags=A});var N=m((X,F)=>{"use strict";var{nice:w}=D()(__dirname);w.nice=w;F.exports=w});"use strict";var __createBinding=exports&&exports.__createBinding||(Object.create?function(e,r,t,i){i===void 0&&(i=t),Object.defineProperty(e,i,{enumerable:!0,get:function(){return r[t]}})}:function(e,r,t,i){i===void 0&&(i=t),e[i]=r[t]}),__setModuleDefault=exports&&exports.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}:function(e,r){e.default=r}),__importStar=exports&&exports.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var t in e)t!=="default"&&Object.prototype.hasOwnProperty.call(e,t)&&__createBinding(r,e,t);return __setModuleDefault(r,e),r};Object.defineProperty(exports,"__esModule",{value:!0});var worker_threads_1=require("worker_threads"),url_1=require("url"),common_1=T();common_1.commonState.isWorkerThread=!0;common_1.commonState.workerData=worker_threads_1.workerData;var handlerCache=new Map,useAtomics=!0,importESMCached;function getImportESM(){return importESMCached===void 0&&(importESMCached=eval("(specifier) => import(specifier)")),importESMCached}async function getHandler(e){let r=handlerCache.get(e);if(r!==void 0)return r;try{r=await Promise.resolve().then(()=>__importStar(require(e))),typeof r!="function"&&(r=await r.default)}catch(t){}if(typeof r!="function"&&(r=await getImportESM()(url_1.pathToFileURL(e).href),typeof r!="function"&&(r=await r.default)),typeof r!="function")return null;if(handlerCache.size>1e3){let[[t]]=handlerCache;handlerCache.delete(t)}return handlerCache.set(e,r),r}worker_threads_1.parentPort.on("message",e=>{useAtomics=e.useAtomics;let{port:r,sharedBuffer:t,filename:i,niceIncrement:s}=e;(async function(){try{s!==0&&process.platform==="linux"&&(await Promise.resolve().then(()=>__importStar(N()))).default(s)}catch(l){}i!==null&&await getHandler(i);let o={ready:!0};worker_threads_1.parentPort.postMessage(o),r.on("message",onMessage.bind(null,r,t)),atomicsWaitLoop(r,t)})().catch(throwInNextTick)});var currentTasks=0,lastSeenRequestCount=0;function atomicsWaitLoop(e,r){if(!!useAtomics)for(;currentTasks===0;){Atomics.wait(r,common_1.kRequestCountField,lastSeenRequestCount),lastSeenRequestCount=Atomics.load(r,common_1.kRequestCountField);let t;for(;(t=worker_threads_1.receiveMessageOnPort(e))!==void 0;)onMessage(e,r,t.message)}}function onMessage(e,r,t){currentTasks++;let{taskId:i,task:s,filename:o}=t;(async function(){let l,p=[];try{let c=await getHandler(o);if(c===null)throw new Error(`No handler function exported from ${o}`);let a=await c(s);common_1.isMovable(a)&&(p.concat(a[common_1.kTransferable]),a=a[common_1.kValue]),l={taskId:i,result:a,error:null},process.stdout.writableLength>0&&await new Promise(d=>process.stdout.write("",d)),process.stderr.writableLength>0&&await new Promise(d=>process.stderr.write("",d))}catch(c){l={taskId:i,result:null,error:c}}currentTasks--,e.postMessage(l,p),Atomics.add(r,common_1.kResponseCountField,1),atomicsWaitLoop(e,r)})().catch(throwInNextTick)}function throwInNextTick(e){process.nextTick(()=>{throw e})}
