amis-rpc-design/dist/json.worker.js

2 lines
355 KiB
JavaScript
Raw Permalink Normal View History

2023-10-07 19:42:30 +08:00
/*! For license information please see json.worker.js.LICENSE.txt */
(()=>{"use strict";var e={};e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}();const t=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout((()=>{if(e.stack){if(o.isErrorNoTelemetry(e))throw new o(e.message+"\n\n"+e.stack);throw new Error(e.message+"\n\n"+e.stack)}throw e}),0)}}emit(e){this.listeners.forEach((t=>{t(e)}))}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function n(e){var n;(n=e)instanceof s||n instanceof Error&&n.name===i&&n.message===i||t.onUnexpectedError(e)}function r(e){if(e instanceof Error){const{name:t,message:n}=e;return{$isError:!0,name:t,message:n,stack:e.stacktrace||e.stack,noTelemetry:o.isErrorNoTelemetry(e)}}return e}const i="Canceled";class s extends Error{constructor(){super(i),this.name=this.message}}class o extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof o)return e;const t=new o;return t.message=e.message,t.stack=e.stack,t}static isErrorNoTelemetry(e){return"CodeExpectedError"===e.name}}class a extends Error{constructor(e){super(e||"An unexpected bug occurred."),Object.setPrototypeOf(this,a.prototype)}}function l(e){const t=this;let n,r=!1;return function(){return r||(r=!0,n=e.apply(t,arguments)),n}}var u;!function(e){function t(e){return e&&"object"==typeof e&&"function"==typeof e[Symbol.iterator]}e.is=t;const n=Object.freeze([]);function*r(e){yield e}e.empty=function(){return n},e.single=r,e.wrap=function(e){return t(e)?e:r(e)},e.from=function(e){return e||n},e.isEmpty=function(e){return!e||!0===e[Symbol.iterator]().next().done},e.first=function(e){return e[Symbol.iterator]().next().value},e.some=function(e,t){for(const n of e)if(t(n))return!0;return!1},e.find=function(e,t){for(const n of e)if(t(n))return n},e.filter=function*(e,t){for(const n of e)t(n)&&(yield n)},e.map=function*(e,t){let n=0;for(const r of e)yield t(r,n++)},e.concat=function*(...e){for(const t of e)for(const e of t)yield e},e.reduce=function(e,t,n){let r=n;for(const n of e)r=t(r,n);return r},e.slice=function*(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]},e.consume=function(t,n=Number.POSITIVE_INFINITY){const r=[];if(0===n)return[r,t];const i=t[Symbol.iterator]();for(let t=0;t<n;t++){const t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator]:()=>i}]}}(u||(u={}));let c=null;function h(e){return null==c||c.trackDisposable(e),e}function d(e){null==c||c.markAsDisposed(e)}function f(e,t){null==c||c.setParent(e,t)}function g(e){if(u.is(e)){const t=[];for(const n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(1===t.length)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function m(e){const t=h({dispose:l((()=>{d(t),e()}))});return t}class p{constructor(){this._toDispose=new Set,this._isDisposed=!1,h(this)}dispose(){this._isDisposed||(d(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(0!==this._toDispose.size)try{g(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return f(e,this),this._isDisposed?p.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}}p.DISABLE_DISPOSED_WARNING=!1;class v{constructor(){this._store=new p,h(this),f(this._store,this)}dispose(){d(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}}v.None=Object.freeze({dispose(){}}),Symbol.iterator;class b{constructor(e){this.element=e,this.next=b.Undefined,this.prev=b.Undefined}}b.Undefined=new b(void 0);class y{constructor(){t