Time slots app prototype
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

4 lines
18 KiB

var ar=Object.create;var R=Object.defineProperty;var cr=Object.getOwnPropertyDescriptor;var fr=Object.getOwnPropertyNames;var lr=Object.getPrototypeOf,dr=Object.prototype.hasOwnProperty;var d=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var pr=(r,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of fr(t))!dr.call(r,n)&&n!==e&&R(r,n,{get:()=>t[n],enumerable:!(o=cr(t,n))||o.enumerable});return r};var hr=(r,t,e)=>(e=r!=null?ar(lr(r)):{},pr(t||!r||!r.__esModule?R(e,"default",{value:r,enumerable:!0}):e,r));var W=d((exports,module)=>{var requireFoolWebpack=eval(`typeof require !== 'undefined' ? require : function (module) { throw new Error('Module " + module + " not found.') }`);module.exports=requireFoolWebpack});var g=d((Mr,h)=>{var N=W(),S=function(r){return typeof r<"u"&&r.versions!=null&&r.versions.node!=null};h.exports.isNode=S;h.exports.platform=typeof process<"u"&&S(process)?"node":"browser";var L=kr("worker_threads");h.exports.isMainThread=h.exports.platform==="node"?(!L||L.isMainThread)&&!process.connected:typeof Window<"u";h.exports.cpus=h.exports.platform==="browser"?self.navigator.hardwareConcurrency:N("os").cpus().length;function kr(r){try{return N(r)}catch{return null}}});var b=d((jr,D)=>{"use strict";function f(r,t){var e=this;if(!(this instanceof f))throw new SyntaxError("Constructor must be called with the new operator");if(typeof r!="function")throw new SyntaxError("Function parameter handler(resolve, reject) missing");var o=[],n=[];this.resolved=!1,this.rejected=!1,this.pending=!0;var u=function(s,a){o.push(s),n.push(a)};this.then=function(s,a){return new f(function(w,x){var sr=s?F(s,w,x):w,ur=a?F(a,w,x):x;u(sr,ur)},e)};var c=function(s){return e.resolved=!0,e.rejected=!1,e.pending=!1,o.forEach(function(a){a(s)}),u=function(a,w){a(s)},c=i=function(){},e},i=function(s){return e.resolved=!1,e.rejected=!0,e.pending=!1,n.forEach(function(a){a(s)}),u=function(a,w){w(s)},c=i=function(){},e};this.cancel=function(){return t?t.cancel():i(new y),e},this.timeout=function(s){if(t)t.timeout(s);else{var a=setTimeout(function(){i(new v("Promise timed out after "+s+" ms"))},s);e.always(function(){clearTimeout(a)})}return e},r(function(s){c(s)},function(s){i(s)})}function F(r,t,e){return function(o){try{var n=r(o);n&&typeof n.then=="function"&&typeof n.catch=="function"?n.then(t,e):t(n)}catch(u){e(u)}}}f.prototype.catch=function(r){return this.then(null,r)};f.prototype.always=function(r){return this.then(r,r)};f.all=function(r){return new f(function(t,e){var o=r.length,n=[];o?r.forEach(function(u,c){u.then(function(i){n[c]=i,o--,o==0&&t(n)},function(i){o=0,e(i)})}):t(n)})};f.defer=function(){var r={};return r.promise=new f(function(t,e){r.resolve=t,r.reject=e}),r};function y(r){this.message=r||"promise cancelled",this.stack=new Error().stack}y.prototype=new Error;y.prototype.constructor=Error;y.prototype.name="CancellationError";f.CancellationError=y;function v(r){this.message=r||"timeout exceeded",this.stack=new Error().stack}v.prototype=new Error;v.prototype.constructor=Error;v.prototype.name="TimeoutError";f.TimeoutError=v;D.exports=f});var H=d((Ar,U)=>{U.exports=`!function(){var __webpack_exports__={};!function(){var exports=__webpack_exports__,__webpack_unused_export__;function _typeof(r){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r})(r)}var requireFoolWebpack=eval("typeof require !== 'undefined' ? require : function (module) { throw new Error('Module \\" + module + \\" not found.') }"),TERMINATE_METHOD_ID="__workerpool-terminate__",worker={exit:function(){}},WorkerThreads,parentPort;if("undefined"!=typeof self&&"function"==typeof postMessage&&"function"==typeof addEventListener)worker.on=function(r,e){addEventListener(r,function(r){e(r.data)})},worker.send=function(r){postMessage(r)};else{if("undefined"==typeof process)throw new Error("Script must be executed as a worker");try{WorkerThreads=requireFoolWebpack("worker_threa
`;a+=" exitCode: `"+i+"`\n",a+=" signalCode: `"+s+"`\n",a+=" workerpool.script: `"+e.script+"`\n",a+=" spawnArgs: `"+c.spawnargs+"`\n",a+=" spawnfile: `"+c.spawnfile+"`\n",a+=" stdout: `"+c.stdout+"`\n",a+=" stderr: `"+c.stderr+"`\n",n(new Error(a))}),this.processing=Object.create(null),this.terminating=!1,this.terminated=!1,this.terminationHandler=null,this.lastId=0}m.prototype.methods=function(){return this.exec("methods")};m.prototype.exec=function(r,t,e,o){e||(e=_.defer());var n=++this.lastId;this.processing[n]={id:n,resolver:e,options:o};var u={id:n,method:r,params:t};this.terminated?e.reject(new Error("Worker is terminated")):this.worker.ready?this.worker.send(u):this.requestQueue.push(u);var c=this;return e.promise.catch(function(i){if(i instanceof _.CancellationError||i instanceof _.TimeoutError)return delete c.processing[n],c.terminateAndNotify(!0).then(function(){throw i},function(s){throw s});throw i})};m.prototype.busy=function(){return Object.keys(this.processing).length>0};m.prototype.terminate=function(r,t){var e=this;if(r){for(var o in this.processing)this.processing[o]!==void 0&&this.processing[o].resolver.reject(new Error("Worker terminated"));this.processing=Object.create(null)}if(typeof t=="function"&&(this.terminationHandler=t),this.busy())this.terminating=!0;else{var n=function(c){if(e.terminated=!0,e.worker!=null&&e.worker.removeAllListeners&&e.worker.removeAllListeners("message"),e.worker=null,e.terminating=!1,e.terminationHandler)e.terminationHandler(c,e);else if(c)throw c};if(this.worker)if(typeof this.worker.kill=="function"){if(this.worker.killed){n(new Error("worker already killed!"));return}if(this.worker.isChildProcess){var u=setTimeout(function(){e.worker.kill()},wr);this.worker.once("exit",function(){clearTimeout(u),e.worker.killed=!0,n()}),this.worker.ready?this.worker.send(C):this.worker.requestQueue.push(C)}else this.worker.kill(),this.worker.killed=!0,n();return}else if(typeof this.worker.terminate=="function")this.worker.terminate(),this.worker.killed=!0;else throw new Error("Failed to terminate worker");n()}};m.prototype.terminateAndNotify=function(r,t){var e=_.defer();return t&&(e.promise.timeout=t),this.terminate(r,function(o,n){o?e.reject(o):e.resolve(n)}),e.promise};k.exports=m;k.exports._tryRequireWorkerThreads=q;k.exports._setupProcessWorker=P;k.exports._setupBrowserWorker=T;k.exports._setupWorkerThreadWorker=O;k.exports.ensureWorkerThreads=$});var K=d((Rr,J)=>{"use strict";var X=65535;J.exports=M;function M(){this.ports=Object.create(null),this.length=0}M.prototype.nextAvailableStartingAt=function(r){for(;this.ports[r]===!0;)r++;if(r>=X)throw new Error("WorkerPool debug port limit reached: "+r+">= "+X);return this.ports[r]=!0,this.length++,r};M.prototype.releasePort=function(r){delete this.ports[r],this.length--}});var tr=d((Lr,er)=>{var j=b(),V=G(),gr=g(),br=K(),Y=new br;function l(r,t){typeof r=="string"?this.script=r||null:(this.script=null,t=r),this.workers=[],this.tasks=[],t=t||{},this.forkArgs=t.forkArgs||[],this.forkOpts=t.forkOpts||{},this.debugPortStart=t.debugPortStart||43210,this.nodeWorker=t.nodeWorker,this.workerType=t.workerType||t.nodeWorker||"auto",this.maxQueueSize=t.maxQueueSize||1/0,t&&"maxWorkers"in t?(_r(t.maxWorkers),this.maxWorkers=t.maxWorkers):this.maxWorkers=Math.max((gr.cpus||4)-1,1),t&&"minWorkers"in t&&(t.minWorkers==="max"?this.minWorkers=this.maxWorkers:(xr(t.minWorkers),this.minWorkers=t.minWorkers,this.maxWorkers=Math.max(this.minWorkers,this.maxWorkers)),this._ensureMinWorkers()),this._boundNext=this._next.bind(this),this.workerType==="thread"&&V.ensureWorkerThreads()}l.prototype.exec=function(r,t,e){if(t&&!Array.isArray(t))throw new TypeError('Array expected as argument "params"');if(typeof r=="string"){var o=j.defer();if(this.tasks.length>=this.maxQueueSize)throw new Error("Max queue size of "+this.maxQueueSize+" reached");var n=this.tasks,u={method:r,params:t,resolver:o,timeout:null,options:e};n.push(u);var c=o.promise.timeout;return o.promise.timeout=function(s){return n.indexOf(u)!==-1?(u.timeout=s,o.promise):c.call
`+n),e.js=n,e}Tr.worker({compile_imba:Or,compile_imba1:Pr});