@copilotkitnext/sqlite-runner 0.0.0-max-changeset-20260109200053 → 0.0.0-max-umd-20260122170341

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,9 +1,91 @@
1
1
  # @copilotkitnext/sqlite-runner
2
2
 
3
- ## 0.0.0-max-changeset-20260109200053
3
+ ## 0.0.0-max-umd-20260122170341
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - 6da0e74: Update versioning strategy
8
- - Updated dependencies [6da0e74]
9
- - @copilotkitnext/runtime@0.0.0-max-changeset-20260109200053
7
+ - 7f437ba: Add UMD export
8
+ - Updated dependencies [7f437ba]
9
+ - @copilotkitnext/runtime@0.0.0-max-umd-20260122170341
10
+
11
+ ## 1.51.3-next.2
12
+
13
+ ### Patch Changes
14
+
15
+ - @copilotkitnext/runtime@1.51.3-next.2
16
+
17
+ ## 1.51.3-next.1
18
+
19
+ ### Patch Changes
20
+
21
+ - @copilotkitnext/runtime@1.51.3-next.1
22
+
23
+ ## 1.51.3-next.0
24
+
25
+ ### Patch Changes
26
+
27
+ - @copilotkitnext/runtime@1.51.3-next.0
28
+
29
+ ## 1.51.2
30
+
31
+ ### Patch Changes
32
+
33
+ - e59d23f: Use deps instead of peerdeps
34
+ - Updated dependencies [e59d23f]
35
+ - @copilotkitnext/runtime@1.51.2
36
+
37
+ ## 1.51.2-next.1
38
+
39
+ ### Patch Changes
40
+
41
+ - e59d23f: Use deps instead of peerdeps
42
+ - Updated dependencies [e59d23f]
43
+ - @copilotkitnext/runtime@1.51.2-next.1
44
+
45
+ ## 1.51.2-next.0
46
+
47
+ ### Patch Changes
48
+
49
+ - @copilotkitnext/runtime@1.51.2-next.0
50
+
51
+ ## 1.51.1
52
+
53
+ ### Patch Changes
54
+
55
+ - @copilotkitnext/runtime@1.51.1
56
+
57
+ ## 1.51.0
58
+
59
+ ### Patch Changes
60
+
61
+ - 2839a15: Update versioning strategy
62
+ - Updated dependencies [2793a11]
63
+ - Updated dependencies [73f196f]
64
+ - Updated dependencies [2839a15]
65
+ - @copilotkitnext/runtime@1.51.0
66
+
67
+ ## 1.51.0-next.4
68
+
69
+ ### Patch Changes
70
+
71
+ - Updated dependencies [2793a11]
72
+ - @copilotkitnext/runtime@1.51.0-next.4
73
+
74
+ ## 1.51.0-next.3
75
+
76
+ ### Patch Changes
77
+
78
+ - Updated dependencies [73f196f]
79
+ - @copilotkitnext/runtime@1.51.0-next.3
80
+
81
+ ## 1.51.0-next.2
82
+
83
+ ### Patch Changes
84
+
85
+ - @copilotkitnext/runtime@1.51.0-next.2
86
+
87
+ ## 1.51.0-next.1
88
+
89
+ ### Patch Changes
90
+
91
+ - @copilotkitnext/runtime@1.51.0-next.1
@@ -0,0 +1,12 @@
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("fs"),require("path")):"function"==typeof define&&define.amd?define(["exports","fs","path"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).CopilotKitNextSQLiteRunner={},e.require$$0,e.require$$1)}(this,function(e,t,r){"use strict";var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)};function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function i(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function a(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function s(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}function u(e){return"function"==typeof e}function c(e){var t=e(function(e){Error.call(e),e.stack=(new Error).stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}"function"==typeof SuppressedError&&SuppressedError;var l=c(function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map(function(e,t){return t+1+") "+e.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}});function d(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var p=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,r,n,o;if(!this.closed){this.closed=!0;var c=this._parentage;if(c)if(this._parentage=null,Array.isArray(c))try{for(var d=i(c),p=d.next();!p.done;p=d.next()){p.value.remove(this)}}catch(t){e={error:t}}finally{try{p&&!p.done&&(t=d.return)&&t.call(d)}finally{if(e)throw e.error}}else c.remove(this);var f=this.initialTeardown;if(u(f))try{f()}catch(e){o=e instanceof l?e.errors:[e]}var h=this._finalizers;if(h){this._finalizers=null;try{for(var m=i(h),g=m.next();!g.done;g=m.next()){var v=g.value;try{y(v)}catch(e){o=null!=o?o:[],e instanceof l?o=s(s([],a(o)),a(e.errors)):o.push(e)}}}catch(e){r={error:e}}finally{try{g&&!g.done&&(n=m.return)&&n.call(m)}finally{if(r)throw r.error}}}if(o)throw new l(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)y(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&d(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&d(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),f=p.EMPTY;function h(e){return e instanceof p||e&&"closed"in e&&u(e.remove)&&u(e.add)&&u(e.unsubscribe)}function y(e){u(e)?e():e.unsubscribe()}var m={Promise:void 0},g=function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setTimeout.apply(void 0,s([e,t],a(r)))};function v(){}function _(e){e()}var b=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,h(t)&&t.add(r)):r.destination=O,r}return o(t,e),t.create=function(e,t,r){return new E(e,t,r)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(p),w=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){T(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){T(e)}else T(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){T(e)}},e}(),E=function(e){function t(t,r,n){var o,i=e.call(this)||this;return o=u(t)||!t?{next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:t,i.destination=new w(o),i}return o(t,e),t}(b);function T(e){var t;t=e,g(function(){throw t})}var O={closed:!0,next:v,error:function(e){throw e},complete:v},A="function"==typeof Symbol&&Symbol.observable||"@@observable";function S(e){return e}var x=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var n,o=this,i=(n=e)&&n instanceof b||function(e){return e&&u(e.next)&&u(e.error)&&u(e.complete)}(n)&&h(n)?e:new E(e,t,r);return _(function(){var e=o,t=e.operator,r=e.source;i.add(t?t.call(i,r):r?o._subscribe(i):o._trySubscribe(i))}),i},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=I(t))(function(t,n){var o=new E({next:function(t){try{e(t)}catch(e){n(e),o.unsubscribe()}},error:n,complete:t});r.subscribe(o)})},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[A]=function(){return this},e.prototype.pipe=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return(0===(e=t).length?S:1===e.length?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)})(this)},e.prototype.toPromise=function(e){var t=this;return new(e=I(e))(function(e,r){var n;t.subscribe(function(e){return n=e},function(e){return r(e)},function(){return e(n)})})},e.create=function(t){return new e(t)},e}();function I(e){var t;return null!==(t=null!=e?e:m.Promise)&&void 0!==t?t:Promise}var N,R,k=c(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),j=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return o(t,e),t.prototype.lift=function(e){var t=new P(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new k},t.prototype.next=function(e){var t=this;_(function(){var r,n;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var o=i(t.currentObservers),a=o.next();!a.done;a=o.next()){a.value.next(e)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}})},t.prototype.error=function(e){var t=this;_(function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var r=t.observers;r.length;)r.shift().error(e)}})},t.prototype.complete=function(){var e=this;_(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,r=this,n=r.hasError,o=r.isStopped,i=r.observers;return n||o?f:(this.currentObservers=null,i.push(e),new p(function(){t.currentObservers=null,d(i,e)}))},t.prototype._checkFinalizedStatuses=function(e){var t=this,r=t.hasError,n=t.thrownError,o=t.isStopped;r?e.error(n):o&&e.complete()},t.prototype.asObservable=function(){var e=new x;return e.source=this,e},t.create=function(e,t){return new P(e,t)},t}(x),P=function(e){function t(t,r){var n=e.call(this)||this;return n.destination=t,n.source=r,n}return o(t,e),t.prototype.next=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===r||r.call(t,e)},t.prototype.error=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===r||r.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,r;return null!==(r=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==r?r:f},t}(j),C={now:function(){return(C.delegate||Date).now()},delegate:void 0},L=function(e){function t(t,r,n){void 0===t&&(t=1/0),void 0===r&&(r=1/0),void 0===n&&(n=C);var o=e.call(this)||this;return o._bufferSize=t,o._windowTime=r,o._timestampProvider=n,o._buffer=[],o._infiniteTimeWindow=!0,o._infiniteTimeWindow=r===1/0,o._bufferSize=Math.max(1,t),o._windowTime=Math.max(1,r),o}return o(t,e),t.prototype.next=function(t){var r=this,n=r.isStopped,o=r._buffer,i=r._infiniteTimeWindow,a=r._timestampProvider,s=r._windowTime;n||(o.push(t),!i&&o.push(a.now()+s)),this._trimBuffer(),e.prototype.next.call(this,t)},t.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var t=this._innerSubscribe(e),r=this._infiniteTimeWindow,n=this._buffer.slice(),o=0;o<n.length&&!e.closed;o+=r?1:2)e.next(n[o]);return this._checkFinalizedStatuses(e),t},t.prototype._trimBuffer=function(){var e=this,t=e._bufferSize,r=e._timestampProvider,n=e._buffer,o=e._infiniteTimeWindow,i=(o?1:2)*t;if(t<1/0&&i<n.length&&n.splice(0,n.length-i),!o){for(var a=r.now(),s=0,u=1;u<n.length&&n[u]<=a;u+=2)s=u;s&&n.splice(0,s+1)}},t}(j);!function(e){e.assertEqual=e=>{},e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const r of e)t[r]=r;return t},e.getValidEnumValues=t=>{const r=e.objectKeys(t).filter(e=>"number"!=typeof t[t[e]]),n={};for(const e of r)n[e]=t[e];return e.objectValues(n)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},e.find=(e,t)=>{for(const r of e)if(t(r))return r},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(N||(N={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(R||(R={}));const M=N.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),D=e=>{switch(typeof e){case"undefined":return M.undefined;case"string":return M.string;case"number":return Number.isNaN(e)?M.nan:M.number;case"boolean":return M.boolean;case"function":return M.function;case"bigint":return M.bigint;case"symbol":return M.symbol;case"object":return Array.isArray(e)?M.array:null===e?M.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?M.promise:"undefined"!=typeof Map&&e instanceof Map?M.map:"undefined"!=typeof Set&&e instanceof Set?M.set:"undefined"!=typeof Date&&e instanceof Date?M.date:M.object;default:return M.unknown}},U=N.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class F extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},r={_errors:[]},n=e=>{for(const o of e.issues)if("invalid_union"===o.code)o.unionErrors.map(n);else if("invalid_return_type"===o.code)n(o.returnTypeError);else if("invalid_arguments"===o.code)n(o.argumentsError);else if(0===o.path.length)r._errors.push(t(o));else{let e=r,n=0;for(;n<o.path.length;){const r=o.path[n];n===o.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(o))):e[r]=e[r]||{_errors:[]},e=e[r],n++}}};return n(this),r}static assert(e){if(!(e instanceof F))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,N.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},r=[];for(const n of this.issues)if(n.path.length>0){const r=n.path[0];t[r]=t[r]||[],t[r].push(e(n))}else r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}F.create=e=>new F(e);const $=(e,t)=>{let r;switch(e.code){case U.invalid_type:r=e.received===M.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case U.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,N.jsonStringifyReplacer)}`;break;case U.unrecognized_keys:r=`Unrecognized key(s) in object: ${N.joinValues(e.keys,", ")}`;break;case U.invalid_union:r="Invalid input";break;case U.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${N.joinValues(e.options)}`;break;case U.invalid_enum_value:r=`Invalid enum value. Expected ${N.joinValues(e.options)}, received '${e.received}'`;break;case U.invalid_arguments:r="Invalid function arguments";break;case U.invalid_return_type:r="Invalid function return type";break;case U.invalid_date:r="Invalid date";break;case U.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:N.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case U.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case U.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case U.custom:r="Invalid input";break;case U.invalid_intersection_types:r="Intersection results could not be merged";break;case U.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case U.not_finite:r="Number must be finite";break;default:r=t.defaultError,N.assertNever(e)}return{message:r}};let Z=$;function B(e,t){const r=Z,n=(e=>{const{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...o.path||[]],a={...o,path:i};if(void 0!==o.message)return{...o,path:i,message:o.message};let s="";const u=n.filter(e=>!!e).slice().reverse();for(const e of u)s=e(a,{data:t,defaultError:s}).message;return{...o,path:i,message:s}})({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===$?void 0:$].filter(e=>!!e)});e.common.issues.push(n)}class V{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const n of t){if("aborted"===n.status)return G;"dirty"===n.status&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const e of t){const t=await e.key,n=await e.value;r.push({key:t,value:n})}return V.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const n of t){const{key:t,value:o}=n;if("aborted"===t.status)return G;if("aborted"===o.status)return G;"dirty"===t.status&&e.dirty(),"dirty"===o.status&&e.dirty(),"__proto__"===t.value||void 0===o.value&&!n.alwaysSet||(r[t.value]=o.value)}return{status:e.value,value:r}}}const G=Object.freeze({status:"aborted"}),z=e=>({status:"dirty",value:e}),H=e=>({status:"valid",value:e}),W=e=>"aborted"===e.status,q=e=>"dirty"===e.status,J=e=>"valid"===e.status,K=e=>"undefined"!=typeof Promise&&e instanceof Promise;var X;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:e?.message}(X||(X={}));class Y{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Q=(e,t)=>{if(J(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new F(e.common.issues);return this._error=t,this._error}}};function ee(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:o};return{errorMap:(t,o)=>{const{message:i}=e;return"invalid_enum_value"===t.code?{message:i??o.defaultError}:void 0===o.data?{message:i??n??o.defaultError}:"invalid_type"!==t.code?{message:o.defaultError}:{message:i??r??o.defaultError}},description:o}}class te{get description(){return this._def.description}_getType(e){return D(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:D(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new V,ctx:{common:e.parent.common,data:e.data,parsedType:D(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(K(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){const r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:D(e)},n=this._parseSync({data:e,path:r.path,parent:r});return Q(r,n)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:D(e)};if(!this["~standard"].async)try{const r=this._parseSync({data:e,path:[],parent:t});return J(r)?{value:r.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>J(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:D(e)},n=this._parse({data:e,path:r.path,parent:r}),o=await(K(n)?n:Promise.resolve(n));return Q(r,o)}refine(e,t){const r=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,n)=>{const o=e(t),i=()=>n.addIssue({code:U.custom,...r(t)});return"undefined"!=typeof Promise&&o instanceof Promise?o.then(e=>!!e||(i(),!1)):!!o||(i(),!1)})}refinement(e,t){return this._refinement((r,n)=>!!e(r)||(n.addIssue("function"==typeof t?t(r,n):t),!1))}_refinement(e){return new rt({schema:this,typeName:dt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return nt.create(this,this._def)}nullable(){return ot.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ue.create(this)}promise(){return tt.create(this,this._def)}or(e){return Ze.create([this,e],this._def)}and(e){return ze.create(this,e,this._def)}transform(e){return new rt({...ee(this._def),schema:this,typeName:dt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new it({...ee(this._def),innerType:this,defaultValue:t,typeName:dt.ZodDefault})}brand(){return new ut({typeName:dt.ZodBranded,type:this,...ee(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new at({...ee(this._def),innerType:this,catchValue:t,typeName:dt.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ct.create(this,e)}readonly(){return lt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const re=/^c[^\s-]{8,}$/i,ne=/^[0-9a-z]+$/,oe=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ie=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,ae=/^[a-z0-9_-]{21}$/i,se=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ue=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,ce=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let le;const de=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,pe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,fe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,he=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ye=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,me=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ge="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",ve=new RegExp(`^${ge}$`);function _e(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function be(e){return new RegExp(`^${_e(e)}$`)}function we(e){let t=`${ge}T${_e(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function Ee(e,t){return!("v4"!==t&&t||!de.test(e))||!("v6"!==t&&t||!fe.test(e))}function Te(e,t){if(!se.test(e))return!1;try{const[r]=e.split(".");if(!r)return!1;const n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return"object"==typeof o&&null!==o&&((!("typ"in o)||"JWT"===o?.typ)&&(!!o.alg&&(!t||o.alg===t)))}catch{return!1}}function Oe(e,t){return!("v4"!==t&&t||!pe.test(e))||!("v6"!==t&&t||!he.test(e))}class Ae extends te{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==M.string){const t=this._getOrReturnCtx(e);return B(t,{code:U.invalid_type,expected:M.string,received:t.parsedType}),G}const t=new V;let r;for(const n of this._def.checks)if("min"===n.kind)e.data.length<n.value&&(r=this._getOrReturnCtx(e,r),B(r,{code:U.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("max"===n.kind)e.data.length>n.value&&(r=this._getOrReturnCtx(e,r),B(r,{code:U.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("length"===n.kind){const o=e.data.length>n.value,i=e.data.length<n.value;(o||i)&&(r=this._getOrReturnCtx(e,r),o?B(r,{code:U.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):i&&B(r,{code:U.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),t.dirty())}else if("email"===n.kind)ce.test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"email",code:U.invalid_string,message:n.message}),t.dirty());else if("emoji"===n.kind)le||(le=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),le.test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"emoji",code:U.invalid_string,message:n.message}),t.dirty());else if("uuid"===n.kind)ie.test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"uuid",code:U.invalid_string,message:n.message}),t.dirty());else if("nanoid"===n.kind)ae.test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"nanoid",code:U.invalid_string,message:n.message}),t.dirty());else if("cuid"===n.kind)re.test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"cuid",code:U.invalid_string,message:n.message}),t.dirty());else if("cuid2"===n.kind)ne.test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"cuid2",code:U.invalid_string,message:n.message}),t.dirty());else if("ulid"===n.kind)oe.test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"ulid",code:U.invalid_string,message:n.message}),t.dirty());else if("url"===n.kind)try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),B(r,{validation:"url",code:U.invalid_string,message:n.message}),t.dirty()}else if("regex"===n.kind){n.regex.lastIndex=0;n.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"regex",code:U.invalid_string,message:n.message}),t.dirty())}else if("trim"===n.kind)e.data=e.data.trim();else if("includes"===n.kind)e.data.includes(n.value,n.position)||(r=this._getOrReturnCtx(e,r),B(r,{code:U.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),t.dirty());else if("toLowerCase"===n.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===n.kind)e.data=e.data.toUpperCase();else if("startsWith"===n.kind)e.data.startsWith(n.value)||(r=this._getOrReturnCtx(e,r),B(r,{code:U.invalid_string,validation:{startsWith:n.value},message:n.message}),t.dirty());else if("endsWith"===n.kind)e.data.endsWith(n.value)||(r=this._getOrReturnCtx(e,r),B(r,{code:U.invalid_string,validation:{endsWith:n.value},message:n.message}),t.dirty());else if("datetime"===n.kind){we(n).test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{code:U.invalid_string,validation:"datetime",message:n.message}),t.dirty())}else if("date"===n.kind){ve.test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{code:U.invalid_string,validation:"date",message:n.message}),t.dirty())}else if("time"===n.kind){be(n).test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{code:U.invalid_string,validation:"time",message:n.message}),t.dirty())}else"duration"===n.kind?ue.test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"duration",code:U.invalid_string,message:n.message}),t.dirty()):"ip"===n.kind?Ee(e.data,n.version)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"ip",code:U.invalid_string,message:n.message}),t.dirty()):"jwt"===n.kind?Te(e.data,n.alg)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"jwt",code:U.invalid_string,message:n.message}),t.dirty()):"cidr"===n.kind?Oe(e.data,n.version)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"cidr",code:U.invalid_string,message:n.message}),t.dirty()):"base64"===n.kind?ye.test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"base64",code:U.invalid_string,message:n.message}),t.dirty()):"base64url"===n.kind?me.test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"base64url",code:U.invalid_string,message:n.message}),t.dirty()):N.assertNever(n);return{status:t.value,value:e.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:U.invalid_string,...X.errToObj(r)})}_addCheck(e){return new Ae({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...X.errToObj(e)})}url(e){return this._addCheck({kind:"url",...X.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...X.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...X.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...X.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...X.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...X.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...X.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...X.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...X.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...X.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...X.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...X.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...X.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,...X.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...X.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...X.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...X.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...X.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...X.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...X.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...X.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...X.errToObj(t)})}nonempty(e){return this.min(1,X.errToObj(e))}trim(){return new Ae({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ae({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ae({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function Se(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n;return Number.parseInt(e.toFixed(o).replace(".",""))%Number.parseInt(t.toFixed(o).replace(".",""))/10**o}Ae.create=e=>new Ae({checks:[],typeName:dt.ZodString,coerce:e?.coerce??!1,...ee(e)});class xe extends te{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==M.number){const t=this._getOrReturnCtx(e);return B(t,{code:U.invalid_type,expected:M.number,received:t.parsedType}),G}let t;const r=new V;for(const n of this._def.checks)if("int"===n.kind)N.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),B(t,{code:U.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty());else if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),B(t,{code:U.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),B(t,{code:U.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty())}else"multipleOf"===n.kind?0!==Se(e.data,n.value)&&(t=this._getOrReturnCtx(e,t),B(t,{code:U.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),B(t,{code:U.not_finite,message:n.message}),r.dirty()):N.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,X.toString(t))}gt(e,t){return this.setLimit("min",e,!1,X.toString(t))}lte(e,t){return this.setLimit("max",e,!0,X.toString(t))}lt(e,t){return this.setLimit("max",e,!1,X.toString(t))}setLimit(e,t,r,n){return new xe({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:X.toString(n)}]})}_addCheck(e){return new xe({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:X.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:X.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:X.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:X.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:X.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:X.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:X.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:X.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:X.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&N.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}xe.create=e=>new xe({checks:[],typeName:dt.ZodNumber,coerce:e?.coerce||!1,...ee(e)});class Ie extends te{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==M.bigint)return this._getInvalidInput(e);let t;const r=new V;for(const n of this._def.checks)if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),B(t,{code:U.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),B(t,{code:U.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty())}else"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),B(t,{code:U.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):N.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return B(t,{code:U.invalid_type,expected:M.bigint,received:t.parsedType}),G}gte(e,t){return this.setLimit("min",e,!0,X.toString(t))}gt(e,t){return this.setLimit("min",e,!1,X.toString(t))}lte(e,t){return this.setLimit("max",e,!0,X.toString(t))}lt(e,t){return this.setLimit("max",e,!1,X.toString(t))}setLimit(e,t,r,n){return new Ie({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:X.toString(n)}]})}_addCheck(e){return new Ie({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:X.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:X.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:X.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:X.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:X.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}Ie.create=e=>new Ie({checks:[],typeName:dt.ZodBigInt,coerce:e?.coerce??!1,...ee(e)});class Ne extends te{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==M.boolean){const t=this._getOrReturnCtx(e);return B(t,{code:U.invalid_type,expected:M.boolean,received:t.parsedType}),G}return H(e.data)}}Ne.create=e=>new Ne({typeName:dt.ZodBoolean,coerce:e?.coerce||!1,...ee(e)});class Re extends te{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==M.date){const t=this._getOrReturnCtx(e);return B(t,{code:U.invalid_type,expected:M.date,received:t.parsedType}),G}if(Number.isNaN(e.data.getTime())){return B(this._getOrReturnCtx(e),{code:U.invalid_date}),G}const t=new V;let r;for(const n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),B(r,{code:U.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(r=this._getOrReturnCtx(e,r),B(r,{code:U.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):N.assertNever(n);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Re({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:X.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:X.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}Re.create=e=>new Re({checks:[],coerce:e?.coerce||!1,typeName:dt.ZodDate,...ee(e)});class ke extends te{_parse(e){if(this._getType(e)!==M.symbol){const t=this._getOrReturnCtx(e);return B(t,{code:U.invalid_type,expected:M.symbol,received:t.parsedType}),G}return H(e.data)}}ke.create=e=>new ke({typeName:dt.ZodSymbol,...ee(e)});class je extends te{_parse(e){if(this._getType(e)!==M.undefined){const t=this._getOrReturnCtx(e);return B(t,{code:U.invalid_type,expected:M.undefined,received:t.parsedType}),G}return H(e.data)}}je.create=e=>new je({typeName:dt.ZodUndefined,...ee(e)});class Pe extends te{_parse(e){if(this._getType(e)!==M.null){const t=this._getOrReturnCtx(e);return B(t,{code:U.invalid_type,expected:M.null,received:t.parsedType}),G}return H(e.data)}}Pe.create=e=>new Pe({typeName:dt.ZodNull,...ee(e)});class Ce extends te{constructor(){super(...arguments),this._any=!0}_parse(e){return H(e.data)}}Ce.create=e=>new Ce({typeName:dt.ZodAny,...ee(e)});class Le extends te{constructor(){super(...arguments),this._unknown=!0}_parse(e){return H(e.data)}}Le.create=e=>new Le({typeName:dt.ZodUnknown,...ee(e)});class Me extends te{_parse(e){const t=this._getOrReturnCtx(e);return B(t,{code:U.invalid_type,expected:M.never,received:t.parsedType}),G}}Me.create=e=>new Me({typeName:dt.ZodNever,...ee(e)});class De extends te{_parse(e){if(this._getType(e)!==M.undefined){const t=this._getOrReturnCtx(e);return B(t,{code:U.invalid_type,expected:M.void,received:t.parsedType}),G}return H(e.data)}}De.create=e=>new De({typeName:dt.ZodVoid,...ee(e)});class Ue extends te{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==M.array)return B(t,{code:U.invalid_type,expected:M.array,received:t.parsedType}),G;if(null!==n.exactLength){const e=t.data.length>n.exactLength.value,o=t.data.length<n.exactLength.value;(e||o)&&(B(t,{code:e?U.too_big:U.too_small,minimum:o?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(B(t,{code:U.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(B(t,{code:U.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((e,r)=>n.type._parseAsync(new Y(t,e,t.path,r)))).then(e=>V.mergeArray(r,e));const o=[...t.data].map((e,r)=>n.type._parseSync(new Y(t,e,t.path,r)));return V.mergeArray(r,o)}get element(){return this._def.type}min(e,t){return new Ue({...this._def,minLength:{value:e,message:X.toString(t)}})}max(e,t){return new Ue({...this._def,maxLength:{value:e,message:X.toString(t)}})}length(e,t){return new Ue({...this._def,exactLength:{value:e,message:X.toString(t)}})}nonempty(e){return this.min(1,e)}}function Fe(e){if(e instanceof $e){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=nt.create(Fe(n))}return new $e({...e._def,shape:()=>t})}return e instanceof Ue?new Ue({...e._def,type:Fe(e.element)}):e instanceof nt?nt.create(Fe(e.unwrap())):e instanceof ot?ot.create(Fe(e.unwrap())):e instanceof He?He.create(e.items.map(e=>Fe(e))):e}Ue.create=(e,t)=>new Ue({type:e,minLength:null,maxLength:null,exactLength:null,typeName:dt.ZodArray,...ee(t)});class $e extends te{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=N.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==M.object){const t=this._getOrReturnCtx(e);return B(t,{code:U.invalid_type,expected:M.object,received:t.parsedType}),G}const{status:t,ctx:r}=this._processInputParams(e),{shape:n,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof Me&&"strip"===this._def.unknownKeys))for(const e in r.data)o.includes(e)||i.push(e);const a=[];for(const e of o){const t=n[e],o=r.data[e];a.push({key:{status:"valid",value:e},value:t._parse(new Y(r,o,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof Me){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of i)a.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)i.length>0&&(B(r,{code:U.unrecognized_keys,keys:i}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of i){const n=r.data[t];a.push({key:{status:"valid",value:t},value:e._parse(new Y(r,n,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of a){const r=await t.key,n=await t.value;e.push({key:r,value:n,alwaysSet:t.alwaysSet})}return e}).then(e=>V.mergeObjectSync(t,e)):V.mergeObjectSync(t,a)}get shape(){return this._def.shape()}strict(e){return X.errToObj,new $e({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{const n=this._def.errorMap?.(t,r).message??r.defaultError;return"unrecognized_keys"===t.code?{message:X.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new $e({...this._def,unknownKeys:"strip"})}passthrough(){return new $e({...this._def,unknownKeys:"passthrough"})}extend(e){return new $e({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new $e({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:dt.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new $e({...this._def,catchall:e})}pick(e){const t={};for(const r of N.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new $e({...this._def,shape:()=>t})}omit(e){const t={};for(const r of N.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new $e({...this._def,shape:()=>t})}deepPartial(){return Fe(this)}partial(e){const t={};for(const r of N.objectKeys(this.shape)){const n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()}return new $e({...this._def,shape:()=>t})}required(e){const t={};for(const r of N.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof nt;)e=e._def.innerType;t[r]=e}return new $e({...this._def,shape:()=>t})}keyof(){return Ye(N.objectKeys(this.shape))}}$e.create=(e,t)=>new $e({shape:()=>e,unknownKeys:"strip",catchall:Me.create(),typeName:dt.ZodObject,...ee(t)}),$e.strictCreate=(e,t)=>new $e({shape:()=>e,unknownKeys:"strict",catchall:Me.create(),typeName:dt.ZodObject,...ee(t)}),$e.lazycreate=(e,t)=>new $e({shape:e,unknownKeys:"strip",catchall:Me.create(),typeName:dt.ZodObject,...ee(t)});class Ze extends te{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map(async e=>{const r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}})).then(function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;const r=e.map(e=>new F(e.ctx.common.issues));return B(t,{code:U.invalid_union,unionErrors:r}),G});{let e;const n=[];for(const o of r){const r={...t,common:{...t.common,issues:[]},parent:null},i=o._parseSync({data:t.data,path:t.path,parent:r});if("valid"===i.status)return i;"dirty"!==i.status||e||(e={result:i,ctx:r}),r.common.issues.length&&n.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const o=n.map(e=>new F(e));return B(t,{code:U.invalid_union,unionErrors:o}),G}}get options(){return this._def.options}}Ze.create=(e,t)=>new Ze({options:e,typeName:dt.ZodUnion,...ee(t)});const Be=e=>e instanceof Ke?Be(e.schema):e instanceof rt?Be(e.innerType()):e instanceof Xe?[e.value]:e instanceof Qe?e.options:e instanceof et?N.objectValues(e.enum):e instanceof it?Be(e._def.innerType):e instanceof je?[void 0]:e instanceof Pe?[null]:e instanceof nt?[void 0,...Be(e.unwrap())]:e instanceof ot?[null,...Be(e.unwrap())]:e instanceof ut||e instanceof lt?Be(e.unwrap()):e instanceof at?Be(e._def.innerType):[];class Ve extends te{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==M.object)return B(t,{code:U.invalid_type,expected:M.object,received:t.parsedType}),G;const r=this.discriminator,n=t.data[r],o=this.optionsMap.get(n);return o?t.common.async?o._parseAsync({data:t.data,path:t.path,parent:t}):o._parseSync({data:t.data,path:t.path,parent:t}):(B(t,{code:U.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),G)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const n=new Map;for(const r of t){const t=Be(r.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of t){if(n.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);n.set(o,r)}}return new Ve({typeName:dt.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...ee(r)})}}function Ge(e,t){const r=D(e),n=D(t);if(e===t)return{valid:!0,data:e};if(r===M.object&&n===M.object){const r=N.objectKeys(t),n=N.objectKeys(e).filter(e=>-1!==r.indexOf(e)),o={...e,...t};for(const r of n){const n=Ge(e[r],t[r]);if(!n.valid)return{valid:!1};o[r]=n.data}return{valid:!0,data:o}}if(r===M.array&&n===M.array){if(e.length!==t.length)return{valid:!1};const r=[];for(let n=0;n<e.length;n++){const o=Ge(e[n],t[n]);if(!o.valid)return{valid:!1};r.push(o.data)}return{valid:!0,data:r}}return r===M.date&&n===M.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}class ze extends te{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=(e,n)=>{if(W(e)||W(n))return G;const o=Ge(e.value,n.value);return o.valid?((q(e)||q(n))&&t.dirty(),{status:t.value,value:o.data}):(B(r,{code:U.invalid_intersection_types}),G)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([e,t])=>n(e,t)):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}ze.create=(e,t,r)=>new ze({left:e,right:t,typeName:dt.ZodIntersection,...ee(r)});class He extends te{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==M.array)return B(r,{code:U.invalid_type,expected:M.array,received:r.parsedType}),G;if(r.data.length<this._def.items.length)return B(r,{code:U.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),G;!this._def.rest&&r.data.length>this._def.items.length&&(B(r,{code:U.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...r.data].map((e,t)=>{const n=this._def.items[t]||this._def.rest;return n?n._parse(new Y(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(n).then(e=>V.mergeArray(t,e)):V.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new He({...this._def,rest:e})}}He.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new He({items:e,typeName:dt.ZodTuple,rest:null,...ee(t)})};class We extends te{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==M.object)return B(r,{code:U.invalid_type,expected:M.object,received:r.parsedType}),G;const n=[],o=this._def.keyType,i=this._def.valueType;for(const e in r.data)n.push({key:o._parse(new Y(r,e,r.path,e)),value:i._parse(new Y(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?V.mergeObjectAsync(t,n):V.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return new We(t instanceof te?{keyType:e,valueType:t,typeName:dt.ZodRecord,...ee(r)}:{keyType:Ae.create(),valueType:e,typeName:dt.ZodRecord,...ee(t)})}}class qe extends te{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==M.map)return B(r,{code:U.invalid_type,expected:M.map,received:r.parsedType}),G;const n=this._def.keyType,o=this._def.valueType,i=[...r.data.entries()].map(([e,t],i)=>({key:n._parse(new Y(r,e,r.path,[i,"key"])),value:o._parse(new Y(r,t,r.path,[i,"value"]))}));if(r.common.async){const e=new Map;return Promise.resolve().then(async()=>{for(const r of i){const n=await r.key,o=await r.value;if("aborted"===n.status||"aborted"===o.status)return G;"dirty"!==n.status&&"dirty"!==o.status||t.dirty(),e.set(n.value,o.value)}return{status:t.value,value:e}})}{const e=new Map;for(const r of i){const n=r.key,o=r.value;if("aborted"===n.status||"aborted"===o.status)return G;"dirty"!==n.status&&"dirty"!==o.status||t.dirty(),e.set(n.value,o.value)}return{status:t.value,value:e}}}}qe.create=(e,t,r)=>new qe({valueType:t,keyType:e,typeName:dt.ZodMap,...ee(r)});class Je extends te{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==M.set)return B(r,{code:U.invalid_type,expected:M.set,received:r.parsedType}),G;const n=this._def;null!==n.minSize&&r.data.size<n.minSize.value&&(B(r,{code:U.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&r.data.size>n.maxSize.value&&(B(r,{code:U.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const o=this._def.valueType;function i(e){const r=new Set;for(const n of e){if("aborted"===n.status)return G;"dirty"===n.status&&t.dirty(),r.add(n.value)}return{status:t.value,value:r}}const a=[...r.data.values()].map((e,t)=>o._parse(new Y(r,e,r.path,t)));return r.common.async?Promise.all(a).then(e=>i(e)):i(a)}min(e,t){return new Je({...this._def,minSize:{value:e,message:X.toString(t)}})}max(e,t){return new Je({...this._def,maxSize:{value:e,message:X.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Je.create=(e,t)=>new Je({valueType:e,minSize:null,maxSize:null,typeName:dt.ZodSet,...ee(t)});class Ke extends te{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Ke.create=(e,t)=>new Ke({getter:e,typeName:dt.ZodLazy,...ee(t)});class Xe extends te{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return B(t,{received:t.data,code:U.invalid_literal,expected:this._def.value}),G}return{status:"valid",value:e.data}}get value(){return this._def.value}}function Ye(e,t){return new Qe({values:e,typeName:dt.ZodEnum,...ee(t)})}Xe.create=(e,t)=>new Xe({value:e,typeName:dt.ZodLiteral,...ee(t)});class Qe extends te{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),r=this._def.values;return B(t,{expected:N.joinValues(r),received:t.parsedType,code:U.invalid_type}),G}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return B(t,{received:t.data,code:U.invalid_enum_value,options:r}),G}return H(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Qe.create(e,{...this._def,...t})}exclude(e,t=this._def){return Qe.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}Qe.create=Ye;class et extends te{_parse(e){const t=N.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==M.string&&r.parsedType!==M.number){const e=N.objectValues(t);return B(r,{expected:N.joinValues(e),received:r.parsedType,code:U.invalid_type}),G}if(this._cache||(this._cache=new Set(N.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=N.objectValues(t);return B(r,{received:r.data,code:U.invalid_enum_value,options:e}),G}return H(e.data)}get enum(){return this._def.values}}et.create=(e,t)=>new et({values:e,typeName:dt.ZodNativeEnum,...ee(t)});class tt extends te{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==M.promise&&!1===t.common.async)return B(t,{code:U.invalid_type,expected:M.promise,received:t.parsedType}),G;const r=t.parsedType===M.promise?t.data:Promise.resolve(t.data);return H(r.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}tt.create=(e,t)=>new tt({type:e,typeName:dt.ZodPromise,...ee(t)});class rt extends te{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===dt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,o={addIssue:e=>{B(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),"preprocess"===n.type){const e=n.transform(r.data,o);if(r.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return G;const n=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===n.status?G:"dirty"===n.status||"dirty"===t.value?z(n.value):n});{if("aborted"===t.value)return G;const n=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===n.status?G:"dirty"===n.status||"dirty"===t.value?z(n.value):n}}if("refinement"===n.type){const e=e=>{const t=n.refinement(e,o);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===r.common.async){const n=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===n.status?G:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(r=>"aborted"===r.status?G:("dirty"===r.status&&t.dirty(),e(r.value).then(()=>({status:t.value,value:r.value}))))}if("transform"===n.type){if(!1===r.common.async){const e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!J(e))return G;const i=n.transform(e.value,o);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>J(e)?Promise.resolve(n.transform(e.value,o)).then(e=>({status:t.value,value:e})):G)}N.assertNever(n)}}rt.create=(e,t,r)=>new rt({schema:e,typeName:dt.ZodEffects,effect:t,...ee(r)}),rt.createWithPreprocess=(e,t,r)=>new rt({schema:t,effect:{type:"preprocess",transform:e},typeName:dt.ZodEffects,...ee(r)});class nt extends te{_parse(e){return this._getType(e)===M.undefined?H(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}nt.create=(e,t)=>new nt({innerType:e,typeName:dt.ZodOptional,...ee(t)});class ot extends te{_parse(e){return this._getType(e)===M.null?H(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ot.create=(e,t)=>new ot({innerType:e,typeName:dt.ZodNullable,...ee(t)});class it extends te{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===M.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}it.create=(e,t)=>new it({innerType:e,typeName:dt.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...ee(t)});class at extends te{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return K(n)?n.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new F(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new F(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}at.create=(e,t)=>new at({innerType:e,typeName:dt.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...ee(t)});class st extends te{_parse(e){if(this._getType(e)!==M.nan){const t=this._getOrReturnCtx(e);return B(t,{code:U.invalid_type,expected:M.nan,received:t.parsedType}),G}return{status:"valid",value:e.data}}}st.create=e=>new st({typeName:dt.ZodNaN,...ee(e)});class ut extends te{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class ct extends te{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?G:"dirty"===e.status?(t.dirty(),z(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})()}{const e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?G:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new ct({in:e,out:t,typeName:dt.ZodPipeline})}}class lt extends te{_parse(e){const t=this._def.innerType._parse(e),r=e=>(J(e)&&(e.value=Object.freeze(e.value)),e);return K(t)?t.then(e=>r(e)):r(t)}unwrap(){return this._def.innerType}}var dt;lt.create=(e,t)=>new lt({innerType:e,typeName:dt.ZodReadonly,...ee(t)}),function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(dt||(dt={}));const pt=Ae.create,ft=xe.create,ht=Ne.create,yt=Ce.create;Me.create;const mt=Ue.create,gt=$e.create,vt=Ze.create,_t=Ve.create;ze.create,He.create;const bt=We.create,wt=Xe.create,Et=Qe.create,Tt=et.create;tt.create,nt.create,ot.create;var Ot=gt({name:pt(),arguments:pt()}),At=gt({id:pt(),type:wt("function"),function:Ot}),St=gt({id:pt(),role:pt(),content:pt().optional(),name:pt().optional()}),xt=gt({type:wt("text"),text:pt()}),It=gt({type:wt("binary"),mimeType:pt(),id:pt().optional(),url:pt().optional(),data:pt().optional(),filename:pt().optional()}),Nt=(e,t)=>{e.id||e.url||e.data||t.addIssue({code:U.custom,message:"BinaryInputContent requires at least one of id, url, or data.",path:["id"]})};It.superRefine((e,t)=>{Nt(e,t)});var Rt=_t("type",[xt,It]).superRefine((e,t)=>{"binary"===e.type&&Nt(e,t)}),kt=_t("role",[St.extend({role:wt("developer"),content:pt()}),St.extend({role:wt("system"),content:pt()}),St.extend({role:wt("assistant"),content:pt().optional(),toolCalls:mt(At).optional()}),St.extend({role:wt("user"),content:vt([pt(),mt(Rt)])}),gt({id:pt(),content:pt(),role:wt("tool"),toolCallId:pt(),error:pt().optional()}),gt({id:pt(),role:wt("activity"),activityType:pt(),content:bt(yt())})]);vt([wt("developer"),wt("system"),wt("assistant"),wt("user"),wt("tool"),wt("activity")]);var jt=gt({description:pt(),value:pt()}),Pt=gt({name:pt(),description:pt(),parameters:yt()}),Ct=gt({threadId:pt(),runId:pt(),parentRunId:pt().optional(),state:yt(),messages:mt(kt),tools:mt(Pt),context:mt(jt),forwardedProps:yt()}),Lt=yt(),Mt=vt([wt("developer"),wt("system"),wt("assistant"),wt("user")]),Dt=(e=>(e.TEXT_MESSAGE_START="TEXT_MESSAGE_START",e.TEXT_MESSAGE_CONTENT="TEXT_MESSAGE_CONTENT",e.TEXT_MESSAGE_END="TEXT_MESSAGE_END",e.TEXT_MESSAGE_CHUNK="TEXT_MESSAGE_CHUNK",e.THINKING_TEXT_MESSAGE_START="THINKING_TEXT_MESSAGE_START",e.THINKING_TEXT_MESSAGE_CONTENT="THINKING_TEXT_MESSAGE_CONTENT",e.THINKING_TEXT_MESSAGE_END="THINKING_TEXT_MESSAGE_END",e.TOOL_CALL_START="TOOL_CALL_START",e.TOOL_CALL_ARGS="TOOL_CALL_ARGS",e.TOOL_CALL_END="TOOL_CALL_END",e.TOOL_CALL_CHUNK="TOOL_CALL_CHUNK",e.TOOL_CALL_RESULT="TOOL_CALL_RESULT",e.THINKING_START="THINKING_START",e.THINKING_END="THINKING_END",e.STATE_SNAPSHOT="STATE_SNAPSHOT",e.STATE_DELTA="STATE_DELTA",e.MESSAGES_SNAPSHOT="MESSAGES_SNAPSHOT",e.ACTIVITY_SNAPSHOT="ACTIVITY_SNAPSHOT",e.ACTIVITY_DELTA="ACTIVITY_DELTA",e.RAW="RAW",e.CUSTOM="CUSTOM",e.RUN_STARTED="RUN_STARTED",e.RUN_FINISHED="RUN_FINISHED",e.RUN_ERROR="RUN_ERROR",e.STEP_STARTED="STEP_STARTED",e.STEP_FINISHED="STEP_FINISHED",e))(Dt||{}),Ut=gt({type:Tt(Dt),timestamp:ft().optional(),rawEvent:yt().optional()}),Ft=Ut.extend({type:wt("TEXT_MESSAGE_START"),messageId:pt(),role:Mt.default("assistant")}),$t=Ut.extend({type:wt("TEXT_MESSAGE_CONTENT"),messageId:pt(),delta:pt().refine(e=>e.length>0,"Delta must not be an empty string")}),Zt=Ut.extend({type:wt("TEXT_MESSAGE_END"),messageId:pt()}),Bt=Ut.extend({type:wt("TEXT_MESSAGE_CHUNK"),messageId:pt().optional(),role:Mt.optional(),delta:pt().optional()}),Vt=Ut.extend({type:wt("THINKING_TEXT_MESSAGE_START")}),Gt=$t.omit({messageId:!0,type:!0}).extend({type:wt("THINKING_TEXT_MESSAGE_CONTENT")}),zt=Ut.extend({type:wt("THINKING_TEXT_MESSAGE_END")}),Ht=Ut.extend({type:wt("TOOL_CALL_START"),toolCallId:pt(),toolCallName:pt(),parentMessageId:pt().optional()}),Wt=Ut.extend({type:wt("TOOL_CALL_ARGS"),toolCallId:pt(),delta:pt()}),qt=Ut.extend({type:wt("TOOL_CALL_END"),toolCallId:pt()}),Jt=Ut.extend({messageId:pt(),type:wt("TOOL_CALL_RESULT"),toolCallId:pt(),content:pt(),role:wt("tool").optional()}),Kt=Ut.extend({type:wt("TOOL_CALL_CHUNK"),toolCallId:pt().optional(),toolCallName:pt().optional(),parentMessageId:pt().optional(),delta:pt().optional()});_t("type",[Ft,$t,Zt,Bt,Ut.extend({type:wt("THINKING_START"),title:pt().optional()}),Ut.extend({type:wt("THINKING_END")}),Vt,Gt,zt,Ht,Wt,qt,Kt,Jt,Ut.extend({type:wt("STATE_SNAPSHOT"),snapshot:Lt}),Ut.extend({type:wt("STATE_DELTA"),delta:mt(yt())}),Ut.extend({type:wt("MESSAGES_SNAPSHOT"),messages:mt(kt)}),Ut.extend({type:wt("ACTIVITY_SNAPSHOT"),messageId:pt(),activityType:pt(),content:bt(yt()),replace:ht().optional().default(!0)}),Ut.extend({type:wt("ACTIVITY_DELTA"),messageId:pt(),activityType:pt(),patch:mt(yt())}),Ut.extend({type:wt("RAW"),event:yt(),source:pt().optional()}),Ut.extend({type:wt("CUSTOM"),name:pt(),value:yt()}),Ut.extend({type:wt("RUN_STARTED"),threadId:pt(),runId:pt(),parentRunId:pt().optional(),input:Ct.optional()}),Ut.extend({type:wt("RUN_FINISHED"),threadId:pt(),runId:pt(),result:yt().optional()}),Ut.extend({type:wt("RUN_ERROR"),message:pt(),code:pt().optional()}),Ut.extend({type:wt("STEP_STARTED"),stepName:pt()}),Ut.extend({type:wt("STEP_FINISHED"),stepName:pt()})]);const Xt=[];for(let e=0;e<256;++e)Xt.push((e+256).toString(16).slice(1));let Yt;const Qt=new Uint8Array(16);var er={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function tr(e,t,r){if(er.randomUUID&&!e)return er.randomUUID();const n=(e=e||{}).random??e.rng?.()??function(){if(!Yt){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Yt=crypto.getRandomValues.bind(crypto)}return Yt(Qt)}();if(n.length<16)throw new Error("Random bytes length must be >= 16");return n[6]=15&n[6]|64,n[8]=63&n[8]|128,function(e,t=0){return(Xt[e[t+0]]+Xt[e[t+1]]+Xt[e[t+2]]+Xt[e[t+3]]+"-"+Xt[e[t+4]]+Xt[e[t+5]]+"-"+Xt[e[t+6]]+Xt[e[t+7]]+"-"+Xt[e[t+8]]+Xt[e[t+9]]+"-"+Xt[e[t+10]]+Xt[e[t+11]]+Xt[e[t+12]]+Xt[e[t+13]]+Xt[e[t+14]]+Xt[e[t+15]]).toLowerCase()}(n)}
2
+ /*!
3
+ * https://github.com/Starcounter-Jack/JSON-Patch
4
+ * (c) 2017-2022 Joachim Wester
5
+ * MIT licensed
6
+ */var rr=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},e(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),nr=Object.prototype.hasOwnProperty;function or(e,t){return nr.call(e,t)}function ir(e){if(Array.isArray(e)){for(var t=new Array(e.length),r=0;r<t.length;r++)t[r]=""+r;return t}if(Object.keys)return Object.keys(e);var n=[];for(var o in e)or(e,o)&&n.push(o);return n}function ar(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function sr(e){for(var t,r=0,n=e.length;r<n;){if(!((t=e.charCodeAt(r))>=48&&t<=57))return!1;r++}return!0}function ur(e){return-1===e.indexOf("/")&&-1===e.indexOf("~")?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function cr(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function lr(e){if(void 0===e)return!0;if(e)if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(lr(e[t]))return!0}else if("object"==typeof e)for(var n=ir(e),o=n.length,i=0;i<o;i++)if(lr(e[n[i]]))return!0;return!1}function dr(e,t){var r=[e];for(var n in t){var o="object"==typeof t[n]?JSON.stringify(t[n],null,2):t[n];void 0!==o&&r.push(n+": "+o)}return r.join("\n")}var pr=function(e){function t(t,r,n,o,i){var a=this.constructor,s=e.call(this,dr(t,{name:r,index:n,operation:o,tree:i}))||this;return s.name=r,s.index=n,s.operation=o,s.tree=i,Object.setPrototypeOf(s,a.prototype),s.message=dr(t,{name:r,index:n,operation:o,tree:i}),s}return rr(t,e),t}(Error),fr=pr,hr=ar,yr={add:function(e,t,r){return e[t]=this.value,{newDocument:r}},remove:function(e,t,r){var n=e[t];return delete e[t],{newDocument:r,removed:n}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:function(e,t,r){var n=gr(r,this.path);n&&(n=ar(n));var o=vr(r,{op:"remove",path:this.from}).removed;return vr(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=gr(r,this.from);return vr(r,{op:"add",path:this.path,value:ar(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:Er(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},mr={add:function(e,t,r){return sr(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:r,index:t}},remove:function(e,t,r){return{newDocument:r,removed:e.splice(t,1)[0]}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:yr.move,copy:yr.copy,test:yr.test,_get:yr._get};function gr(e,t){if(""==t)return e;var r={op:"_get",path:t};return vr(e,r),r.value}function vr(e,t,r,n,o,i){if(void 0===r&&(r=!1),void 0===n&&(n=!0),void 0===o&&(o=!0),void 0===i&&(i=0),r&&("function"==typeof r?r(t,0,e,t.path):br(t,0)),""===t.path){var a={newDocument:e};if("add"===t.op)return a.newDocument=t.value,a;if("replace"===t.op)return a.newDocument=t.value,a.removed=e,a;if("move"===t.op||"copy"===t.op)return a.newDocument=gr(e,t.from),"move"===t.op&&(a.removed=e),a;if("test"===t.op){if(a.test=Er(e,t.value),!1===a.test)throw new fr("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a.newDocument=e,a}if("remove"===t.op)return a.removed=e,a.newDocument=null,a;if("_get"===t.op)return t.value=e,a;if(r)throw new fr("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,t,e);return a}n||(e=ar(e));var s=(t.path||"").split("/"),u=e,c=1,l=s.length,d=void 0,p=void 0,f=void 0;for(f="function"==typeof r?r:br;;){if((p=s[c])&&-1!=p.indexOf("~")&&(p=cr(p)),o&&("__proto__"==p||"prototype"==p&&c>0&&"constructor"==s[c-1]))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&void 0===d&&(void 0===u[p]?d=s.slice(0,c).join("/"):c==l-1&&(d=t.path),void 0!==d&&f(t,0,e,d)),c++,Array.isArray(u)){if("-"===p)p=u.length;else{if(r&&!sr(p))throw new fr("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",i,t,e);sr(p)&&(p=~~p)}if(c>=l){if(r&&"add"===t.op&&p>u.length)throw new fr("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,t,e);if(!1===(a=mr[t.op].call(t,u,p,e)).test)throw new fr("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}}else if(c>=l){if(!1===(a=yr[t.op].call(t,u,p,e)).test)throw new fr("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}if(u=u[p],r&&c<l&&(!u||"object"!=typeof u))throw new fr("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,t,e)}}function _r(e,t,r,n,o){if(void 0===n&&(n=!0),void 0===o&&(o=!0),r&&!Array.isArray(t))throw new fr("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=ar(e));for(var i=new Array(t.length),a=0,s=t.length;a<s;a++)i[a]=vr(e,t[a],r,!0,o,a),e=i[a].newDocument;return i.newDocument=e,i}function br(e,t,r,n){if("object"!=typeof e||null===e||Array.isArray(e))throw new fr("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(!yr[e.op])throw new fr("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r);if("string"!=typeof e.path)throw new fr("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(0!==e.path.indexOf("/")&&e.path.length>0)throw new fr('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",t,e,r);if(("move"===e.op||"copy"===e.op)&&"string"!=typeof e.from)throw new fr("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,r);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&void 0===e.value)throw new fr("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,r);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&lr(e.value))throw new fr("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,r);if(r)if("add"==e.op){var o=e.path.split("/").length,i=n.split("/").length;if(o!==i+1&&o!==i)throw new fr("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,r)}else if("replace"===e.op||"remove"===e.op||"_get"===e.op){if(e.path!==n)throw new fr("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,r)}else if("move"===e.op||"copy"===e.op){var a=wr([{op:"_get",path:e.from,value:void 0}],r);if(a&&"OPERATION_PATH_UNRESOLVABLE"===a.name)throw new fr("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}function wr(e,t,r){try{if(!Array.isArray(e))throw new fr("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)_r(ar(t),ar(e),r||!0);else{r=r||br;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(e){if(e instanceof fr)return e;throw e}}function Er(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){var r,n,o,i=Array.isArray(e),a=Array.isArray(t);if(i&&a){if((n=e.length)!=t.length)return!1;for(r=n;0!==r--;)if(!Er(e[r],t[r]))return!1;return!0}if(i!=a)return!1;var s=Object.keys(e);if((n=s.length)!==Object.keys(t).length)return!1;for(r=n;0!==r--;)if(!t.hasOwnProperty(s[r]))return!1;for(r=n;0!==r--;)if(!Er(e[o=s[r]],t[o]))return!1;return!0}return e!=e&&t!=t}var Tr=Object.freeze({__proto__:null,JsonPatchError:fr,_areEquals:Er,applyOperation:vr,applyPatch:_r,applyReducer:function(e,t,r){var n=vr(e,t);if(!1===n.test)throw new fr("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument},deepClone:hr,getValueByPointer:gr,validate:wr,validator:br}),Or=new WeakMap,Ar=function(e){this.observers=new Map,this.obj=e},Sr=function(e,t){this.callback=e,this.observer=t};
7
+ /*!
8
+ * https://github.com/Starcounter-Jack/JSON-Patch
9
+ * (c) 2017-2021 Joachim Wester
10
+ * MIT license
11
+ */function xr(e,t){void 0===t&&(t=!1);var r=Or.get(e.object);Ir(r.value,e.object,e.patches,"",t),e.patches.length&&_r(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function Ir(e,t,r,n,o){if(t!==e){"function"==typeof t.toJSON&&(t=t.toJSON());for(var i=ir(t),a=ir(e),s=!1,u=a.length-1;u>=0;u--){var c=e[d=a[u]];if(!or(t,d)||void 0===t[d]&&void 0!==c&&!1===Array.isArray(t))Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+ur(d),value:ar(c)}),r.push({op:"remove",path:n+"/"+ur(d)}),s=!0):(o&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}));else{var l=t[d];"object"==typeof c&&null!=c&&"object"==typeof l&&null!=l&&Array.isArray(c)===Array.isArray(l)?Ir(c,l,r,n+"/"+ur(d),o):c!==l&&(o&&r.push({op:"test",path:n+"/"+ur(d),value:ar(c)}),r.push({op:"replace",path:n+"/"+ur(d),value:ar(l)}))}}if(s||i.length!=a.length)for(u=0;u<i.length;u++){var d;or(e,d=i[u])||void 0===t[d]||r.push({op:"add",path:n+"/"+ur(d),value:ar(t[d])})}}}var Nr=Object.freeze({__proto__:null,compare:function(e,t,r){void 0===r&&(r=!1);var n=[];return Ir(e,t,n,"",r),n},generate:xr,observe:function(e,t){var r,n=function(e){return Or.get(e)}(e);if(n){var o=function(e,t){return e.observers.get(t)}(n,t);r=o&&o.observer}else n=new Ar(e),Or.set(e,n);if(r)return r;if(r={},n.value=ar(e),t){r.callback=t,r.next=null;var i=function(){xr(r)},a=function(){clearTimeout(r.next),r.next=setTimeout(i)};"undefined"!=typeof window&&(window.addEventListener("mouseup",a),window.addEventListener("keyup",a),window.addEventListener("mousedown",a),window.addEventListener("keydown",a),window.addEventListener("change",a))}return r.patches=[],r.object=e,r.unobserve=function(){xr(r),clearTimeout(r.next),function(e,t){e.observers.delete(t.callback)}(n,r),"undefined"!=typeof window&&(window.removeEventListener("mouseup",a),window.removeEventListener("keyup",a),window.removeEventListener("mousedown",a),window.removeEventListener("keydown",a),window.removeEventListener("change",a))},n.observers.set(t,new Sr(t,r)),r},unobserve:function(e,t){t.unobserve()}});Object.assign({},Tr,Nr,{JsonPatchError:pr,deepClone:ar,escapePathComponent:ur,unescapePathComponent:cr});var Rr=Et(["TextMessageStart","TextMessageContent","TextMessageEnd","ActionExecutionStart","ActionExecutionArgs","ActionExecutionEnd","ActionExecutionResult","AgentStateMessage","MetaEvent","RunStarted","RunFinished","RunError","NodeStarted","NodeFinished"]),kr=Et(["LangGraphInterruptEvent","PredictState","Exit"]);function jr(e){let t=[],r=new Map,n=new Map;for(let o of e)if(o.type===Dt.TEXT_MESSAGE_START){let e=o,t=e.messageId;r.has(t)||r.set(t,{contents:[],otherEvents:[]}),r.get(t).start=e}else if(o.type===Dt.TEXT_MESSAGE_CONTENT){let e=o,t=e.messageId;r.has(t)||r.set(t,{contents:[],otherEvents:[]}),r.get(t).contents.push(e)}else if(o.type===Dt.TEXT_MESSAGE_END){let e=o,n=e.messageId;r.has(n)||r.set(n,{contents:[],otherEvents:[]});let i=r.get(n);i.end=e,Pr(n,i,t),r.delete(n)}else if(o.type===Dt.TOOL_CALL_START){let e=o,t=e.toolCallId;n.has(t)||n.set(t,{args:[],otherEvents:[]}),n.get(t).start=e}else if(o.type===Dt.TOOL_CALL_ARGS){let e=o,t=e.toolCallId;n.has(t)||n.set(t,{args:[],otherEvents:[]}),n.get(t).args.push(e)}else if(o.type===Dt.TOOL_CALL_END){let e=o,r=e.toolCallId;n.has(r)||n.set(r,{args:[],otherEvents:[]});let i=n.get(r);i.end=e,Cr(r,i,t),n.delete(r)}else{let e=!1;for(let[t,n]of r)if(n.start&&!n.end){n.otherEvents.push(o),e=!0;break}if(!e)for(let[t,r]of n)if(r.start&&!r.end){r.otherEvents.push(o),e=!0;break}e||t.push(o)}for(let[e,n]of r)Pr(e,n,t);for(let[e,r]of n)Cr(e,r,t);return t}function Pr(e,t,r){if(t.start&&r.push(t.start),t.contents.length>0){let n=t.contents.map(e=>e.delta).join(""),o={type:Dt.TEXT_MESSAGE_CONTENT,messageId:e,delta:n};r.push(o)}t.end&&r.push(t.end);for(let e of t.otherEvents)r.push(e)}function Cr(e,t,r){if(t.start&&r.push(t.start),t.args.length>0){let n=t.args.map(e=>e.delta).join(""),o={type:Dt.TOOL_CALL_ARGS,toolCallId:e,delta:n};r.push(o)}t.end&&r.push(t.end);for(let e of t.otherEvents)r.push(e)}_t("type",[gt({type:wt(Rr.enum.TextMessageStart),messageId:pt(),parentMessageId:pt().optional(),role:pt().optional()}),gt({type:wt(Rr.enum.TextMessageContent),messageId:pt(),content:pt()}),gt({type:wt(Rr.enum.TextMessageEnd),messageId:pt()}),gt({type:wt(Rr.enum.ActionExecutionStart),actionExecutionId:pt(),actionName:pt(),parentMessageId:pt().optional()}),gt({type:wt(Rr.enum.ActionExecutionArgs),actionExecutionId:pt(),args:pt()}),gt({type:wt(Rr.enum.ActionExecutionEnd),actionExecutionId:pt()}),gt({type:wt(Rr.enum.ActionExecutionResult),actionName:pt(),actionExecutionId:pt(),result:pt()}),gt({type:wt(Rr.enum.AgentStateMessage),threadId:pt(),agentName:pt(),nodeName:pt(),runId:pt(),active:ht(),role:pt(),state:pt(),running:ht()}),gt({type:wt(Rr.enum.MetaEvent),name:kr,value:yt()}),gt({type:wt(Rr.enum.RunError),message:pt(),code:pt().optional()})]),gt({id:pt(),role:pt(),content:pt(),parentMessageId:pt().optional()}),gt({id:pt(),name:pt(),arguments:yt(),parentMessageId:pt().optional()}),gt({id:pt(),result:yt(),actionExecutionId:pt(),actionName:pt()});var Lr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Mr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Dr,Ur,Fr={},$r={};function Zr(){return Dr||(Dr=1,e=$r,Object.defineProperty(e,"__esModule",{value:!0}),e.Allow=e.ALL=e.COLLECTION=e.ATOM=e.SPECIAL=e.INF=e._INFINITY=e.INFINITY=e.NAN=e.BOOL=e.NULL=e.OBJ=e.ARR=e.NUM=e.STR=void 0,e.STR=1,e.NUM=2,e.ARR=4,e.OBJ=8,e.NULL=16,e.BOOL=32,e.NAN=64,e.INFINITY=128,e._INFINITY=256,e.INF=e.INFINITY|e._INFINITY,e.SPECIAL=e.NULL|e.BOOL|e.INF|e.NAN,e.ATOM=e.STR|e.NUM|e.SPECIAL,e.COLLECTION=e.ARR|e.OBJ,e.ALL=e.ATOM|e.COLLECTION,e.Allow={STR:e.STR,NUM:e.NUM,ARR:e.ARR,OBJ:e.OBJ,NULL:e.NULL,BOOL:e.BOOL,NAN:e.NAN,INFINITY:e.INFINITY,_INFINITY:e._INFINITY,INF:e.INF,SPECIAL:e.SPECIAL,ATOM:e.ATOM,COLLECTION:e.COLLECTION,ALL:e.ALL},e.default=e.Allow),$r;var e}function Br(){return tr()}Ur||(Ur=1,function(e){var t=Fr&&Fr.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=Fr&&Fr.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),e.Allow=e.MalformedJSON=e.PartialJSON=e.parseJSON=e.parse=void 0;const n=Zr();Object.defineProperty(e,"Allow",{enumerable:!0,get:function(){return n.Allow}}),r(Zr(),e);class o extends Error{}e.PartialJSON=o;class i extends Error{}function a(e,t=n.Allow.ALL){if("string"!=typeof e)throw new TypeError("expecting str, got "+typeof e);if(!e.trim())throw new Error(`${e} is empty`);return s(e.trim(),t)}e.MalformedJSON=i,e.parseJSON=a;const s=(e,t)=>{const r=e.length;let a=0;const s=e=>{throw new o(`${e} at position ${a}`)},u=e=>{throw new i(`${e} at position ${a}`)},c=()=>(h(),a>=r&&s("Unexpected end of input"),'"'===e[a]?l():"{"===e[a]?d():"["===e[a]?p():"null"===e.substring(a,a+4)||n.Allow.NULL&t&&r-a<4&&"null".startsWith(e.substring(a))?(a+=4,null):"true"===e.substring(a,a+4)||n.Allow.BOOL&t&&r-a<4&&"true".startsWith(e.substring(a))?(a+=4,!0):"false"===e.substring(a,a+5)||n.Allow.BOOL&t&&r-a<5&&"false".startsWith(e.substring(a))?(a+=5,!1):"Infinity"===e.substring(a,a+8)||n.Allow.INFINITY&t&&r-a<8&&"Infinity".startsWith(e.substring(a))?(a+=8,1/0):"-Infinity"===e.substring(a,a+9)||n.Allow._INFINITY&t&&1<r-a&&r-a<9&&"-Infinity".startsWith(e.substring(a))?(a+=9,-1/0):"NaN"===e.substring(a,a+3)||n.Allow.NAN&t&&r-a<3&&"NaN".startsWith(e.substring(a))?(a+=3,NaN):f()),l=()=>{const o=a;let i=!1;for(a++;a<r&&('"'!==e[a]||i&&"\\"===e[a-1]);)i="\\"===e[a]&&!i,a++;if('"'==e.charAt(a))try{return JSON.parse(e.substring(o,++a-Number(i)))}catch(e){u(String(e))}else if(n.Allow.STR&t)try{return JSON.parse(e.substring(o,a-Number(i))+'"')}catch(t){return JSON.parse(e.substring(o,e.lastIndexOf("\\"))+'"')}s("Unterminated string literal")},d=()=>{a++,h();const o={};try{for(;"}"!==e[a];){if(h(),a>=r&&n.Allow.OBJ&t)return o;const i=l();h(),a++;try{const e=c();o[i]=e}catch(e){if(n.Allow.OBJ&t)return o;throw e}h(),","===e[a]&&a++}}catch(e){if(n.Allow.OBJ&t)return o;s("Expected '}' at end of object")}return a++,o},p=()=>{a++;const r=[];try{for(;"]"!==e[a];)r.push(c()),h(),","===e[a]&&a++}catch(e){if(n.Allow.ARR&t)return r;s("Expected ']' at end of array")}return a++,r},f=()=>{if(0===a){"-"===e&&u("Not sure what '-' is");try{return JSON.parse(e)}catch(r){if(n.Allow.NUM&t)try{return JSON.parse(e.substring(0,e.lastIndexOf("e")))}catch(e){}u(String(r))}}const o=a;for("-"===e[a]&&a++;e[a]&&-1===",]}".indexOf(e[a]);)a++;a!=r||n.Allow.NUM&t||s("Unterminated number literal");try{return JSON.parse(e.substring(o,a))}catch(t){"-"===e.substring(o,a)&&s("Not sure what '-' is");try{return JSON.parse(e.substring(o,e.lastIndexOf("e")))}catch(e){u(String(e))}}},h=()=>{for(;a<r&&" \n\r\t".includes(e[a]);)a++};return c()},u=a;e.parse=u}(Fr));var Vr="Run stopped by user";function Gr(e,t={}){const{stopRequested:r=!1,interruptionMessage:n}=t,o=n??Vr,i=n&&n!==Vr?n:"Run ended without emitting a terminal event",a=[],s=new Set,u=new Map;for(const t of e)switch(t.type){case Dt.TEXT_MESSAGE_START:{const e=t.messageId;"string"==typeof e&&s.add(e);break}case Dt.TEXT_MESSAGE_END:{const e=t.messageId;"string"==typeof e&&s.delete(e);break}case Dt.TOOL_CALL_START:{const e=t.toolCallId;"string"==typeof e&&u.set(e,{hasEnd:!1,hasResult:!1});break}case Dt.TOOL_CALL_END:{const e=t.toolCallId,r=e?u.get(e):void 0;r&&(r.hasEnd=!0);break}case Dt.TOOL_CALL_RESULT:{const e=t.toolCallId,r=e?u.get(e):void 0;r&&(r.hasResult=!0);break}}const c=e.some(e=>e.type===Dt.RUN_FINISHED),l=e.some(e=>e.type===Dt.RUN_ERROR),d=!(c||l);for(const t of s){const r={type:Dt.TEXT_MESSAGE_END,messageId:t};e.push(r),a.push(r)}for(const[t,n]of u){if(!n.hasEnd){const r={type:Dt.TOOL_CALL_END,toolCallId:t};e.push(r),a.push(r)}if(d&&!n.hasResult){const n={type:Dt.TOOL_CALL_RESULT,toolCallId:t,messageId:`${t??Br()}-result`,role:"tool",content:JSON.stringify(r?{status:"stopped",reason:"stop_requested",message:o}:{status:"error",reason:"missing_terminal_event",message:i})};e.push(n),a.push(n)}}if(d)if(r){const t={type:Dt.RUN_FINISHED};e.push(t),a.push(t)}else{const t={type:Dt.RUN_ERROR,message:i,code:"INCOMPLETE_STREAM"};e.push(t),a.push(t)}return a}var zr=(e=>(e.SERVICE_NOT_CONFIGURED="service_not_configured",e.INVALID_AUDIO_FORMAT="invalid_audio_format",e.AUDIO_TOO_LONG="audio_too_long",e.AUDIO_TOO_SHORT="audio_too_short",e.RATE_LIMITED="rate_limited",e.AUTH_FAILED="auth_failed",e.PROVIDER_ERROR="provider_error",e.NETWORK_ERROR="network_error",e.INVALID_REQUEST="invalid_request",e))(zr||{}),Hr=class{},Wr=class{constructor(e){this.threadId=e}subject=null;isRunning=!1;currentRunId=null;historicRuns=[];agent=null;runSubject=null;stopRequested=!1;currentEvents=null},qr=Symbol.for("@copilotkitnext/runtime/in-memory-store");!function(){const e=globalThis;e[qr]||(e[qr]={stores:new Map,historicRunsBackup:new Map});const t=e[qr];if(0===t.stores.size&&t.historicRunsBackup.size>0)for(const[e,r]of t.historicRunsBackup){const n=new Wr(e);n.historicRuns=r,t.stores.set(e,n)}t.stores}(),zr.SERVICE_NOT_CONFIGURED,zr.INVALID_AUDIO_FORMAT,zr.AUDIO_TOO_LONG,zr.AUDIO_TOO_SHORT,zr.RATE_LIMITED,zr.AUTH_FAILED,zr.PROVIDER_ERROR,zr.NETWORK_ERROR,zr.INVALID_REQUEST,new Set(".\\+*[^]$()");var Jr={exports:{}};function Kr(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Xr,Yr,Qr,en={};function tn(){return Xr||(Xr=1,en.getBooleanOption=(e,t)=>{let r=!1;if(t in e&&"boolean"!=typeof(r=e[t]))throw new TypeError(`Expected the "${t}" option to be a boolean`);return r},en.cppdb=Symbol(),en.inspect=Symbol.for("nodejs.util.inspect.custom")),en}function rn(){if(Qr)return Yr;Qr=1;const e={value:"SqliteError",writable:!0,enumerable:!1,configurable:!0};function t(r,n){if(new.target!==t)return new t(r,n);if("string"!=typeof n)throw new TypeError("Expected second argument to be a string");Error.call(this,r),e.value=""+r,Object.defineProperty(this,"message",e),Error.captureStackTrace(this,t),this.code=n}return Object.setPrototypeOf(t,Error),Object.setPrototypeOf(t.prototype,Error.prototype),Object.defineProperty(t.prototype,"name",e),Yr=t}var nn,on,an,sn={exports:{}};function un(){return an||(an=1,function(e,n){var o=t,i=r,a=function(){if(on)return nn;on=1;var e=r.sep||"/";return nn=function(t){if("string"!=typeof t||t.length<=7||"file://"!=t.substring(0,7))throw new TypeError("must pass in a file:// URI to convert to a file path");var r=decodeURI(t.substring(7)),n=r.indexOf("/"),o=r.substring(0,n),i=r.substring(n+1);return"localhost"==o&&(o=""),o&&(o=e+e+o),i=i.replace(/^(.+)\|/,"$1:"),"\\"==e&&(i=i.replace(/\//g,"\\")),/^.+\:/.test(i)||(i=e+i),o+i},nn}(),s=i.join,u=i.dirname,c=o.accessSync&&function(e){try{o.accessSync(e)}catch(e){return!1}return!0}||o.existsSync||i.existsSync,l={arrow:process.env.NODE_BINDINGS_ARROW||" → ",compiled:process.env.NODE_BINDINGS_COMPILED_DIR||"compiled",platform:process.platform,arch:process.arch,nodePreGyp:"node-v"+process.versions.modules+"-"+process.platform+"-"+process.arch,version:process.versions.node,bindings:"bindings.node",try:[["module_root","build","bindings"],["module_root","build","Debug","bindings"],["module_root","build","Release","bindings"],["module_root","out","Debug","bindings"],["module_root","Debug","bindings"],["module_root","out","Release","bindings"],["module_root","Release","bindings"],["module_root","build","default","bindings"],["module_root","compiled","version","platform","arch","bindings"],["module_root","addon-build","release","install-root","bindings"],["module_root","addon-build","debug","install-root","bindings"],["module_root","addon-build","default","install-root","bindings"],["module_root","lib","binding","nodePreGyp","bindings"]]};e.exports=n=function(e){"string"==typeof e?e={bindings:e}:e||(e={}),Object.keys(l).map(function(t){t in e||(e[t]=l[t])}),e.module_root||(e.module_root=n.getRoot(n.getFileName())),".node"!=i.extname(e.bindings)&&(e.bindings+=".node");for(var t,r,o,a="function"==typeof __webpack_require__?__non_webpack_require__:Kr,u=[],c=0,d=e.try.length;c<d;c++){t=s.apply(null,e.try[c].map(function(t){return e[t]||t})),u.push(t);try{return r=e.path?a.resolve(t):a(t),e.path||(r.path=t),r}catch(e){if("MODULE_NOT_FOUND"!==e.code&&"QUALIFIED_PATH_RESOLUTION_FAILED"!==e.code&&!/not find/i.test(e.message))throw e}}throw(o=new Error("Could not locate the bindings file. Tried:\n"+u.map(function(t){return e.arrow+t}).join("\n"))).tries=u,o},n.getFileName=function(e){var t,r=Error.prepareStackTrace,n=Error.stackTraceLimit,o={};Error.stackTraceLimit=10,Error.prepareStackTrace=function(r,n){for(var o=0,i=n.length;o<i;o++)if((t=n[o].getFileName())!==__filename){if(!e)return;if(t!==e)return}},Error.captureStackTrace(o),Error.prepareStackTrace=r,Error.stackTraceLimit=n;return 0===t.indexOf("file://")&&(t=a(t)),t},n.getRoot=function(e){for(var t,r=u(e);;){if("."===r&&(r=process.cwd()),c(s(r,"package.json"))||c(s(r,"node_modules")))return r;if(t===r)throw new Error('Could not find module root given file: "'+e+'". Do you have a `package.json` file? ');t=r,r=s(r,"..")}}}(sn,sn.exports)),sn.exports}var cn,ln,dn,pn,fn,hn={};function yn(){if(cn)return hn;cn=1;const{cppdb:e}=tn();return hn.prepare=function(t){return this[e].prepare(t,this,!1)},hn.exec=function(t){return this[e].exec(t),this},hn.close=function(){return this[e].close(),this},hn.loadExtension=function(...t){return this[e].loadExtension(...t),this},hn.defaultSafeIntegers=function(...t){return this[e].defaultSafeIntegers(...t),this},hn.unsafeMode=function(...t){return this[e].unsafeMode(...t),this},hn.getters={name:{get:function(){return this[e].name},enumerable:!0},open:{get:function(){return this[e].open},enumerable:!0},inTransaction:{get:function(){return this[e].inTransaction},enumerable:!0},readonly:{get:function(){return this[e].readonly},enumerable:!0},memory:{get:function(){return this[e].memory},enumerable:!0}},hn}var mn,gn,vn,_n,bn,wn,En,Tn,On,An,Sn,xn,In,Nn,Rn,kn,jn,Pn,Cn,Ln,Mn,Dn,Un,Fn,$n,Zn,Bn,Vn,Gn,zn,Hn,Wn,qn,Jn,Kn,Xn,Yn,Qn,eo,to,ro,no,oo,io,ao,so,uo,co,lo,po,fo,ho,yo,mo,go,vo,_o,bo,wo,Eo,To,Oo,Ao,So,xo,Io,No,Ro,ko,jo,Po,Co,Lo,Mo,Do,Uo,Fo,$o,Zo,Bo,Vo,Go,zo,Ho,Wo,qo,Jo,Ko,Xo,Yo,Qo={},ei={};function ti(){return gn?mn:(gn=1,mn=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(var n in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var o=Object.getOwnPropertySymbols(e);if(1!==o.length||o[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(e,t);if(42!==i.value||!0!==i.enumerable)return!1}return!0})}function ri(){if(_n)return vn;_n=1;var e=ti();return vn=function(){return e()&&!!Symbol.toStringTag}}function ni(){return wn?bn:(wn=1,bn=Object)}function oi(){return Tn?En:(Tn=1,En=Error)}function ii(){return An?On:(An=1,On=EvalError)}function ai(){return xn?Sn:(xn=1,Sn=RangeError)}function si(){return Nn?In:(Nn=1,In=ReferenceError)}function ui(){return kn?Rn:(kn=1,Rn=SyntaxError)}function ci(){return Pn?jn:(Pn=1,jn=TypeError)}function li(){return Ln?Cn:(Ln=1,Cn=URIError)}function di(){return Dn?Mn:(Dn=1,Mn=Math.abs)}function pi(){return Fn?Un:(Fn=1,Un=Math.floor)}function fi(){return Zn?$n:(Zn=1,$n=Math.max)}function hi(){return Vn?Bn:(Vn=1,Bn=Math.min)}function yi(){return zn?Gn:(zn=1,Gn=Math.pow)}function mi(){return Wn?Hn:(Wn=1,Hn=Math.round)}function gi(){return Jn?qn:(Jn=1,qn=Number.isNaN||function(e){return e!=e})}function vi(){if(Xn)return Kn;Xn=1;var e=gi();return Kn=function(t){return e(t)||0===t?t:t<0?-1:1}}function _i(){return Qn?Yn:(Qn=1,Yn=Object.getOwnPropertyDescriptor)}function bi(){if(to)return eo;to=1;var e=_i();if(e)try{e([],"length")}catch(t){e=null}return eo=e}function wi(){if(no)return ro;no=1;var e=Object.defineProperty||!1;if(e)try{e({},"a",{value:1})}catch(t){e=!1}return ro=e}function Ei(){if(io)return oo;io=1;var e="undefined"!=typeof Symbol&&Symbol,t=ti();return oo=function(){return"function"==typeof e&&("function"==typeof Symbol&&("symbol"==typeof e("foo")&&("symbol"==typeof Symbol("bar")&&t())))}}function Ti(){return so?ao:(so=1,ao="undefined"!=typeof Reflect&&Reflect.getPrototypeOf||null)}function Oi(){return co?uo:(co=1,uo=ni().getPrototypeOf||null)}function Ai(){if(po)return lo;po=1;var e=Object.prototype.toString,t=Math.max,r=function(e,t){for(var r=[],n=0;n<e.length;n+=1)r[n]=e[n];for(var o=0;o<t.length;o+=1)r[o+e.length]=t[o];return r};return lo=function(n){var o=this;if("function"!=typeof o||"[object Function]"!==e.apply(o))throw new TypeError("Function.prototype.bind called on incompatible "+o);for(var i,a=function(e,t){for(var r=[],n=t,o=0;n<e.length;n+=1,o+=1)r[o]=e[n];return r}(arguments,1),s=t(0,o.length-a.length),u=[],c=0;c<s;c++)u[c]="$"+c;if(i=Function("binder","return function ("+function(e,t){for(var r="",n=0;n<e.length;n+=1)r+=e[n],n+1<e.length&&(r+=t);return r}(u,",")+"){ return binder.apply(this,arguments); }")(function(){if(this instanceof i){var e=o.apply(this,r(a,arguments));return Object(e)===e?e:this}return o.apply(n,r(a,arguments))}),o.prototype){var l=function(){};l.prototype=o.prototype,i.prototype=new l,l.prototype=null}return i},lo}function Si(){if(ho)return fo;ho=1;var e=Ai();return fo=Function.prototype.bind||e}function xi(){return mo?yo:(mo=1,yo=Function.prototype.call)}function Ii(){return vo?go:(vo=1,go=Function.prototype.apply)}function Ni(){if(Eo)return wo;Eo=1;var e=Si(),t=Ii(),r=xi(),n=bo?_o:(bo=1,_o="undefined"!=typeof Reflect&&Reflect&&Reflect.apply);return wo=n||e.call(r,t)}function Ri(){if(Oo)return To;Oo=1;var e=Si(),t=ci(),r=xi(),n=Ni();return To=function(o){if(o.length<1||"function"!=typeof o[0])throw new t("a function is required");return n(e,r,o)}}function ki(){if(So)return Ao;So=1;var e,t=Ri(),r=bi();try{e=[].__proto__===Array.prototype}catch(e){if(!e||"object"!=typeof e||!("code"in e)||"ERR_PROTO_ACCESS"!==e.code)throw e}var n=!!e&&r&&r(Object.prototype,"__proto__"),o=Object,i=o.getPrototypeOf;return Ao=n&&"function"==typeof n.get?t([n.get]):"function"==typeof i&&function(e){return i(null==e?e:o(e))}}function ji(){if(Io)return xo;Io=1;var e=Ti(),t=Oi(),r=ki();return xo=e?function(t){return e(t)}:t?function(e){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new TypeError("getProto: not an object");return t(e)}:r?function(e){return r(e)}:null}function Pi(){if(Ro)return No;Ro=1;var e=Function.prototype.call,t=Object.prototype.hasOwnProperty,r=Si();return No=r.call(e,t)}function Ci(){if(jo)return ko;var e;jo=1;var t=ni(),r=oi(),n=ii(),o=ai(),i=si(),a=ui(),s=ci(),u=li(),c=di(),l=pi(),d=fi(),p=hi(),f=yi(),h=mi(),y=vi(),m=Function,g=function(e){try{return m('"use strict"; return ('+e+").constructor;")()}catch(e){}},v=bi(),_=wi(),b=function(){throw new s},w=v?function(){try{return b}catch(e){try{return v(arguments,"callee").get}catch(e){return b}}}():b,E=Ei()(),T=ji(),O=Oi(),A=Ti(),S=Ii(),x=xi(),I={},N="undefined"!=typeof Uint8Array&&T?T(Uint8Array):e,R={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?e:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?e:ArrayBuffer,"%ArrayIteratorPrototype%":E&&T?T([][Symbol.iterator]()):e,"%AsyncFromSyncIteratorPrototype%":e,"%AsyncFunction%":I,"%AsyncGenerator%":I,"%AsyncGeneratorFunction%":I,"%AsyncIteratorPrototype%":I,"%Atomics%":"undefined"==typeof Atomics?e:Atomics,"%BigInt%":"undefined"==typeof BigInt?e:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?e:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?e:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?e:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":r,"%eval%":eval,"%EvalError%":n,"%Float16Array%":"undefined"==typeof Float16Array?e:Float16Array,"%Float32Array%":"undefined"==typeof Float32Array?e:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?e:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?e:FinalizationRegistry,"%Function%":m,"%GeneratorFunction%":I,"%Int8Array%":"undefined"==typeof Int8Array?e:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?e:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?e:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":E&&T?T(T([][Symbol.iterator]())):e,"%JSON%":"object"==typeof JSON?JSON:e,"%Map%":"undefined"==typeof Map?e:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&E&&T?T((new Map)[Symbol.iterator]()):e,"%Math%":Math,"%Number%":Number,"%Object%":t,"%Object.getOwnPropertyDescriptor%":v,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?e:Promise,"%Proxy%":"undefined"==typeof Proxy?e:Proxy,"%RangeError%":o,"%ReferenceError%":i,"%Reflect%":"undefined"==typeof Reflect?e:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?e:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&E&&T?T((new Set)[Symbol.iterator]()):e,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?e:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":E&&T?T(""[Symbol.iterator]()):e,"%Symbol%":E?Symbol:e,"%SyntaxError%":a,"%ThrowTypeError%":w,"%TypedArray%":N,"%TypeError%":s,"%Uint8Array%":"undefined"==typeof Uint8Array?e:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?e:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?e:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?e:Uint32Array,"%URIError%":u,"%WeakMap%":"undefined"==typeof WeakMap?e:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?e:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?e:WeakSet,"%Function.prototype.call%":x,"%Function.prototype.apply%":S,"%Object.defineProperty%":_,"%Object.getPrototypeOf%":O,"%Math.abs%":c,"%Math.floor%":l,"%Math.max%":d,"%Math.min%":p,"%Math.pow%":f,"%Math.round%":h,"%Math.sign%":y,"%Reflect.getPrototypeOf%":A};if(T)try{null.error}catch(e){var k=T(T(e));R["%Error.prototype%"]=k}var j=function e(t){var r;if("%AsyncFunction%"===t)r=g("async function () {}");else if("%GeneratorFunction%"===t)r=g("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=g("async function* () {}");else if("%AsyncGenerator%"===t){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===t){var o=e("%AsyncGenerator%");o&&T&&(r=T(o.prototype))}return R[t]=r,r},P={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},C=Si(),L=Pi(),M=C.call(x,Array.prototype.concat),D=C.call(S,Array.prototype.splice),U=C.call(x,String.prototype.replace),F=C.call(x,String.prototype.slice),$=C.call(x,RegExp.prototype.exec),Z=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,B=/\\(\\)?/g,V=function(e,t){var r,n=e;if(L(P,n)&&(n="%"+(r=P[n])[0]+"%"),L(R,n)){var o=R[n];if(o===I&&(o=j(n)),void 0===o&&!t)throw new s("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:o}}throw new a("intrinsic "+e+" does not exist!")};return ko=function(e,t){if("string"!=typeof e||0===e.length)throw new s("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new s('"allowMissing" argument must be a boolean');if(null===$(/^%?[^%]*%?$/,e))throw new a("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function(e){var t=F(e,0,1),r=F(e,-1);if("%"===t&&"%"!==r)throw new a("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new a("invalid intrinsic syntax, expected opening `%`");var n=[];return U(e,Z,function(e,t,r,o){n[n.length]=r?U(o,B,"$1"):t||e}),n}(e),n=r.length>0?r[0]:"",o=V("%"+n+"%",t),i=o.name,u=o.value,c=!1,l=o.alias;l&&(n=l[0],D(r,M([0,1],l)));for(var d=1,p=!0;d<r.length;d+=1){var f=r[d],h=F(f,0,1),y=F(f,-1);if(('"'===h||"'"===h||"`"===h||'"'===y||"'"===y||"`"===y)&&h!==y)throw new a("property names with quotes must have matching quotes");if("constructor"!==f&&p||(c=!0),L(R,i="%"+(n+="."+f)+"%"))u=R[i];else if(null!=u){if(!(f in u)){if(!t)throw new s("base intrinsic for "+e+" exists, but the property is not available.");return}if(v&&d+1>=r.length){var m=v(u,f);u=(p=!!m)&&"get"in m&&!("originalValue"in m.get)?m.get:u[f]}else p=L(u,f),u=u[f];p&&!c&&(R[i]=u)}}return u},ko}function Li(){if(Co)return Po;Co=1;var e=Ci(),t=Ri(),r=t([e("%String.prototype.indexOf%")]);return Po=function(n,o){var i=e(n,!!o);return"function"==typeof i&&r(n,".prototype.")>-1?t([i]):i}}function Mi(){if(Mo)return Lo;Mo=1;var e=ri()(),t=Li()("Object.prototype.toString"),r=function(r){return!(e&&r&&"object"==typeof r&&Symbol.toStringTag in r)&&"[object Arguments]"===t(r)},n=function(e){return!!r(e)||null!==e&&"object"==typeof e&&"length"in e&&"number"==typeof e.length&&e.length>=0&&"[object Array]"!==t(e)&&"callee"in e&&"[object Function]"===t(e.callee)},o=function(){return r(arguments)}();return r.isLegacyArguments=n,Lo=o?r:n}function Di(){if(Uo)return Do;Uo=1;var e,t=Li(),r=ri()(),n=Pi(),o=bi();if(r){var i=t("RegExp.prototype.exec"),a={},s=function(){throw a},u={toString:s,valueOf:s};"symbol"==typeof Symbol.toPrimitive&&(u[Symbol.toPrimitive]=s),e=function(e){if(!e||"object"!=typeof e)return!1;var t=o(e,"lastIndex");if(!(t&&n(t,"value")))return!1;try{i(e,u)}catch(e){return e===a}}}else{var c=t("Object.prototype.toString");e=function(e){return!(!e||"object"!=typeof e&&"function"!=typeof e)&&"[object RegExp]"===c(e)}}return Do=e}function Ui(){if($o)return Fo;$o=1;var e=Li(),t=Di(),r=e("RegExp.prototype.exec"),n=ci();return Fo=function(e){if(!t(e))throw new n("`regex` must be a RegExp");return function(t){return null!==r(e,t)}}}function Fi(){if(Bo)return Zo;Bo=1;const e=function*(){}.constructor;return Zo=()=>e}function $i(){if(Go)return Vo;Go=1;var e=Li(),t=Ui()(/^\s*(?:function)?\*/),r=ri()(),n=ji(),o=e("Object.prototype.toString"),i=e("Function.prototype.toString"),a=Fi();return Vo=function(e){if("function"!=typeof e)return!1;if(t(i(e)))return!0;if(!r)return"[object GeneratorFunction]"===o(e);if(!n)return!1;var s=a();return s&&n(e)===s.prototype}}function Zi(){if(Ho)return zo;Ho=1;var e,t,r=Function.prototype.toString,n="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof n&&"function"==typeof Object.defineProperty)try{e=Object.defineProperty({},"length",{get:function(){throw t}}),t={},n(function(){throw 42},null,e)}catch(e){e!==t&&(n=null)}else n=null;var o=/^\s*class\b/,i=function(e){try{var t=r.call(e);return o.test(t)}catch(e){return!1}},a=function(e){try{return!i(e)&&(r.call(e),!0)}catch(e){return!1}},s=Object.prototype.toString,u="function"==typeof Symbol&&!!Symbol.toStringTag,c=!(0 in[,]),l=function(){return!1};if("object"==typeof document){var d=document.all;s.call(d)===s.call(document.all)&&(l=function(e){if((c||!e)&&(void 0===e||"object"==typeof e))try{var t=s.call(e);return("[object HTMLAllCollection]"===t||"[object HTML document.all class]"===t||"[object HTMLCollection]"===t||"[object Object]"===t)&&null==e("")}catch(e){}return!1})}return zo=n?function(r){if(l(r))return!0;if(!r)return!1;if("function"!=typeof r&&"object"!=typeof r)return!1;try{n(r,null,e)}catch(e){if(e!==t)return!1}return!i(r)&&a(r)}:function(e){if(l(e))return!0;if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;if(u)return a(e);if(i(e))return!1;var t=s.call(e);return!("[object Function]"!==t&&"[object GeneratorFunction]"!==t&&!/^\[object HTML/.test(t))&&a(e)}}function Bi(){if(qo)return Wo;qo=1;var e=Zi(),t=Object.prototype.toString,r=Object.prototype.hasOwnProperty;return Wo=function(n,o,i){if(!e(o))throw new TypeError("iterator must be a function");var a,s;arguments.length>=3&&(a=i),s=n,"[object Array]"===t.call(s)?function(e,t,n){for(var o=0,i=e.length;o<i;o++)r.call(e,o)&&(null==n?t(e[o],o,e):t.call(n,e[o],o,e))}(n,o,a):"string"==typeof n?function(e,t,r){for(var n=0,o=e.length;n<o;n++)null==r?t(e.charAt(n),n,e):t.call(r,e.charAt(n),n,e)}(n,o,a):function(e,t,n){for(var o in e)r.call(e,o)&&(null==n?t(e[o],o,e):t.call(n,e[o],o,e))}(n,o,a)},Wo}function Vi(){return Ko?Jo:(Ko=1,Jo=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"])}function Gi(){if(Yo)return Xo;Yo=1;var e=Vi(),t="undefined"==typeof globalThis?Lr:globalThis;return Xo=function(){for(var r=[],n=0;n<e.length;n++)"function"==typeof t[e[n]]&&(r[r.length]=e[n]);return r}}var zi,Hi,Wi,qi,Ji,Ki,Xi,Yi,Qi,ea,ta,ra,na,oa,ia,aa,sa={exports:{}};function ua(){if(Hi)return zi;Hi=1;var e=wi(),t=ui(),r=ci(),n=bi();return zi=function(o,i,a){if(!o||"object"!=typeof o&&"function"!=typeof o)throw new r("`obj` must be an object or a function`");if("string"!=typeof i&&"symbol"!=typeof i)throw new r("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new r("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new r("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new r("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new r("`loose`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,u=arguments.length>4?arguments[4]:null,c=arguments.length>5?arguments[5]:null,l=arguments.length>6&&arguments[6],d=!!n&&n(o,i);if(e)e(o,i,{configurable:null===c&&d?d.configurable:!c,enumerable:null===s&&d?d.enumerable:!s,value:a,writable:null===u&&d?d.writable:!u});else{if(!l&&(s||u||c))throw new t("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");o[i]=a}},zi}function ca(){if(qi)return Wi;qi=1;var e=wi(),t=function(){return!!e};return t.hasArrayLengthDefineBug=function(){if(!e)return null;try{return 1!==e([],"length",{value:1}).length}catch(e){return!0}},Wi=t}function la(){if(Ki)return Ji;Ki=1;var e=Ci(),t=ua(),r=ca()(),n=bi(),o=ci(),i=e("%Math.floor%");return Ji=function(e,a){if("function"!=typeof e)throw new o("`fn` is not a function");if("number"!=typeof a||a<0||a>4294967295||i(a)!==a)throw new o("`length` must be a positive 32-bit integer");var s=arguments.length>2&&!!arguments[2],u=!0,c=!0;if("length"in e&&n){var l=n(e,"length");l&&!l.configurable&&(u=!1),l&&!l.writable&&(c=!1)}return(u||c||!s)&&(r?t(e,"length",a,!0,!0):t(e,"length",a)),e},Ji}function da(){if(Yi)return Xi;Yi=1;var e=Si(),t=Ii(),r=Ni();return Xi=function(){return r(e,t,arguments)},Xi}function pa(){return Qi||(Qi=1,function(e){var t=la(),r=wi(),n=Ri(),o=da();e.exports=function(e){var r=n(arguments),o=e.length-(arguments.length-1);return t(r,1+(o>0?o:0),!0)},r?r(e.exports,"apply",{value:o}):e.exports.apply=o}(sa)),sa.exports}function fa(){if(ta)return ea;ta=1;var e=Bi(),t=Gi(),r=pa(),n=Li(),o=bi(),i=ji(),a=n("Object.prototype.toString"),s=ri()(),u="undefined"==typeof globalThis?Lr:globalThis,c=t(),l=n("String.prototype.slice"),d=n("Array.prototype.indexOf",!0)||function(e,t){for(var r=0;r<e.length;r+=1)if(e[r]===t)return r;return-1},p={__proto__:null};e(c,s&&o&&i?function(e){var t=new u[e];if(Symbol.toStringTag in t&&i){var n=i(t),a=o(n,Symbol.toStringTag);if(!a&&n){var s=i(n);a=o(s,Symbol.toStringTag)}p["$"+e]=r(a.get)}}:function(e){var t=new u[e],n=t.slice||t.set;n&&(p["$"+e]=r(n))});return ea=function(t){if(!t||"object"!=typeof t)return!1;if(!s){var r=l(a(t),8,-1);return d(c,r)>-1?r:"Object"===r&&function(t){var r=!1;return e(p,function(e,n){if(!r)try{e(t),r=l(n,1)}catch(e){}}),r}(t)}return o?function(t){var r=!1;return e(p,function(e,n){if(!r)try{"$"+e(t)===n&&(r=l(n,1))}catch(e){}}),r}(t):null}}function ha(){if(na)return ra;na=1;var e=fa();return ra=function(t){return!!e(t)}}var ya,ma,ga,va,_a,ba,wa,Ea,Ta,Oa,Aa,Sa,xa,Ia,Na,Ra,ka,ja={exports:{}};function Pa(){return ma||(ma=1,function(e){var t=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),r={},n=0;n<t.length;n++)r[t[n]]=Object.getOwnPropertyDescriptor(e,t[n]);return r},r=/%[sdj%]/g;e.format=function(e){if(!m(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(a(arguments[n]));return t.join(" ")}n=1;for(var o=arguments,i=o.length,s=String(e).replace(r,function(e){if("%%"===e)return"%";if(n>=i)return e;switch(e){case"%s":return String(o[n++]);case"%d":return Number(o[n++]);case"%j":try{return JSON.stringify(o[n++])}catch(e){return"[Circular]"}default:return e}}),u=o[n];n<i;u=o[++n])h(u)||!_(u)?s+=" "+u:s+=" "+a(u);return s},e.deprecate=function(t,r){if("undefined"!=typeof process&&!0===process.noDeprecation)return t;if("undefined"==typeof process)return function(){return e.deprecate(t,r).apply(this,arguments)};var n=!1;return function(){if(!n){if(process.throwDeprecation)throw new Error(r);process.traceDeprecation?console.trace(r):console.error(r),n=!0}return t.apply(this,arguments)}};var n={},o=/^$/;if(process.env.NODE_DEBUG){var i=process.env.NODE_DEBUG;i=i.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),o=new RegExp("^"+i+"$","i")}function a(t,r){var n={seen:[],stylize:u};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),f(r)?n.showHidden=r:r&&e._extend(n,r),g(n.showHidden)&&(n.showHidden=!1),g(n.depth)&&(n.depth=2),g(n.colors)&&(n.colors=!1),g(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=s),c(n,t,n.depth)}function s(e,t){var r=a.styles[t];return r?"["+a.colors[r][0]+"m"+e+"["+a.colors[r][1]+"m":e}function u(e,t){return e}function c(t,r,n){if(t.customInspect&&r&&E(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var o=r.inspect(n,t);return m(o)||(o=c(t,o,n)),o}var i=function(e,t){if(g(t))return e.stylize("undefined","undefined");if(m(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(y(t))return e.stylize(""+t,"number");if(f(t))return e.stylize(""+t,"boolean");if(h(t))return e.stylize("null","null")}(t,r);if(i)return i;var a=Object.keys(r),s=function(e){var t={};return e.forEach(function(e,r){t[e]=!0}),t}(a);if(t.showHidden&&(a=Object.getOwnPropertyNames(r)),w(r)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return l(r);if(0===a.length){if(E(r)){var u=r.name?": "+r.name:"";return t.stylize("[Function"+u+"]","special")}if(v(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(b(r))return t.stylize(Date.prototype.toString.call(r),"date");if(w(r))return l(r)}var _,T="",O=!1,A=["{","}"];(p(r)&&(O=!0,A=["[","]"]),E(r))&&(T=" [Function"+(r.name?": "+r.name:"")+"]");return v(r)&&(T=" "+RegExp.prototype.toString.call(r)),b(r)&&(T=" "+Date.prototype.toUTCString.call(r)),w(r)&&(T=" "+l(r)),0!==a.length||O&&0!=r.length?n<0?v(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special"):(t.seen.push(r),_=O?function(e,t,r,n,o){for(var i=[],a=0,s=t.length;a<s;++a)S(t,String(a))?i.push(d(e,t,r,n,String(a),!0)):i.push("");return o.forEach(function(o){o.match(/^\d+$/)||i.push(d(e,t,r,n,o,!0))}),i}(t,r,n,s,a):a.map(function(e){return d(t,r,n,s,e,O)}),t.seen.pop(),function(e,t,r){var n=e.reduce(function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(n>60)return r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1];return r[0]+t+" "+e.join(", ")+" "+r[1]}(_,T,A)):A[0]+T+A[1]}function l(e){return"["+Error.prototype.toString.call(e)+"]"}function d(e,t,r,n,o,i){var a,s,u;if((u=Object.getOwnPropertyDescriptor(t,o)||{value:t[o]}).get?s=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(s=e.stylize("[Setter]","special")),S(n,o)||(a="["+o+"]"),s||(e.seen.indexOf(u.value)<0?(s=h(r)?c(e,u.value,null):c(e,u.value,r-1)).indexOf("\n")>-1&&(s=i?s.split("\n").map(function(e){return" "+e}).join("\n").slice(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n")):s=e.stylize("[Circular]","special")),g(a)){if(i&&o.match(/^\d+$/))return s;(a=JSON.stringify(""+o)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.slice(1,-1),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function p(e){return Array.isArray(e)}function f(e){return"boolean"==typeof e}function h(e){return null===e}function y(e){return"number"==typeof e}function m(e){return"string"==typeof e}function g(e){return void 0===e}function v(e){return _(e)&&"[object RegExp]"===T(e)}function _(e){return"object"==typeof e&&null!==e}function b(e){return _(e)&&"[object Date]"===T(e)}function w(e){return _(e)&&("[object Error]"===T(e)||e instanceof Error)}function E(e){return"function"==typeof e}function T(e){return Object.prototype.toString.call(e)}function O(e){return e<10?"0"+e.toString(10):e.toString(10)}e.debuglog=function(t){if(t=t.toUpperCase(),!n[t])if(o.test(t)){var r=process.pid;n[t]=function(){var n=e.format.apply(e,arguments);console.error("%s %d: %s",t,r,n)}}else n[t]=function(){};return n[t]},e.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},e.types=(oa||(oa=1,function(e){var t=Mi(),r=$i(),n=fa(),o=ha();function i(e){return e.call.bind(e)}var a="undefined"!=typeof BigInt,s="undefined"!=typeof Symbol,u=i(Object.prototype.toString),c=i(Number.prototype.valueOf),l=i(String.prototype.valueOf),d=i(Boolean.prototype.valueOf);if(a)var p=i(BigInt.prototype.valueOf);if(s)var f=i(Symbol.prototype.valueOf);function h(e,t){if("object"!=typeof e)return!1;try{return t(e),!0}catch(e){return!1}}function y(e){return"[object Map]"===u(e)}function m(e){return"[object Set]"===u(e)}function g(e){return"[object WeakMap]"===u(e)}function v(e){return"[object WeakSet]"===u(e)}function _(e){return"[object ArrayBuffer]"===u(e)}function b(e){return"undefined"!=typeof ArrayBuffer&&(_.working?_(e):e instanceof ArrayBuffer)}function w(e){return"[object DataView]"===u(e)}function E(e){return"undefined"!=typeof DataView&&(w.working?w(e):e instanceof DataView)}e.isArgumentsObject=t,e.isGeneratorFunction=r,e.isTypedArray=o,e.isPromise=function(e){return"undefined"!=typeof Promise&&e instanceof Promise||null!==e&&"object"==typeof e&&"function"==typeof e.then&&"function"==typeof e.catch},e.isArrayBufferView=function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):o(e)||E(e)},e.isUint8Array=function(e){return"Uint8Array"===n(e)},e.isUint8ClampedArray=function(e){return"Uint8ClampedArray"===n(e)},e.isUint16Array=function(e){return"Uint16Array"===n(e)},e.isUint32Array=function(e){return"Uint32Array"===n(e)},e.isInt8Array=function(e){return"Int8Array"===n(e)},e.isInt16Array=function(e){return"Int16Array"===n(e)},e.isInt32Array=function(e){return"Int32Array"===n(e)},e.isFloat32Array=function(e){return"Float32Array"===n(e)},e.isFloat64Array=function(e){return"Float64Array"===n(e)},e.isBigInt64Array=function(e){return"BigInt64Array"===n(e)},e.isBigUint64Array=function(e){return"BigUint64Array"===n(e)},y.working="undefined"!=typeof Map&&y(new Map),e.isMap=function(e){return"undefined"!=typeof Map&&(y.working?y(e):e instanceof Map)},m.working="undefined"!=typeof Set&&m(new Set),e.isSet=function(e){return"undefined"!=typeof Set&&(m.working?m(e):e instanceof Set)},g.working="undefined"!=typeof WeakMap&&g(new WeakMap),e.isWeakMap=function(e){return"undefined"!=typeof WeakMap&&(g.working?g(e):e instanceof WeakMap)},v.working="undefined"!=typeof WeakSet&&v(new WeakSet),e.isWeakSet=function(e){return v(e)},_.working="undefined"!=typeof ArrayBuffer&&_(new ArrayBuffer),e.isArrayBuffer=b,w.working="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView&&w(new DataView(new ArrayBuffer(1),0,1)),e.isDataView=E;var T="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:void 0;function O(e){return"[object SharedArrayBuffer]"===u(e)}function A(e){return void 0!==T&&(void 0===O.working&&(O.working=O(new T)),O.working?O(e):e instanceof T)}function S(e){return h(e,c)}function x(e){return h(e,l)}function I(e){return h(e,d)}function N(e){return a&&h(e,p)}function R(e){return s&&h(e,f)}e.isSharedArrayBuffer=A,e.isAsyncFunction=function(e){return"[object AsyncFunction]"===u(e)},e.isMapIterator=function(e){return"[object Map Iterator]"===u(e)},e.isSetIterator=function(e){return"[object Set Iterator]"===u(e)},e.isGeneratorObject=function(e){return"[object Generator]"===u(e)},e.isWebAssemblyCompiledModule=function(e){return"[object WebAssembly.Module]"===u(e)},e.isNumberObject=S,e.isStringObject=x,e.isBooleanObject=I,e.isBigIntObject=N,e.isSymbolObject=R,e.isBoxedPrimitive=function(e){return S(e)||x(e)||I(e)||N(e)||R(e)},e.isAnyArrayBuffer=function(e){return"undefined"!=typeof Uint8Array&&(b(e)||A(e))},["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(t){Object.defineProperty(e,t,{enumerable:!1,value:function(){throw new Error(t+" is not supported in userland")}})})}(ei)),ei),e.isArray=p,e.isBoolean=f,e.isNull=h,e.isNullOrUndefined=function(e){return null==e},e.isNumber=y,e.isString=m,e.isSymbol=function(e){return"symbol"==typeof e},e.isUndefined=g,e.isRegExp=v,e.types.isRegExp=v,e.isObject=_,e.isDate=b,e.types.isDate=b,e.isError=w,e.types.isNativeError=w,e.isFunction=E,e.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},e.isBuffer=aa?ia:(aa=1,ia=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8});var A=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function S(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.log=function(){var t,r;console.log("%s - %s",(t=new Date,r=[O(t.getHours()),O(t.getMinutes()),O(t.getSeconds())].join(":"),[t.getDate(),A[t.getMonth()],r].join(" ")),e.format.apply(e,arguments))},e.inherits=(ya||(ya=1,"function"==typeof Object.create?ja.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:ja.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}),ja.exports),e._extend=function(e,t){if(!t||!_(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e};var x="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function I(e,t){if(!e){var r=new Error("Promise was rejected with a falsy value");r.reason=e,e=r}return t(e)}e.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(x&&e[x]){var r;if("function"!=typeof(r=e[x]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(r,x,{value:r,enumerable:!1,writable:!1,configurable:!0}),r}function r(){for(var t,r,n=new Promise(function(e,n){t=e,r=n}),o=[],i=0;i<arguments.length;i++)o.push(arguments[i]);o.push(function(e,n){e?r(e):t(n)});try{e.apply(this,o)}catch(e){r(e)}return n}return Object.setPrototypeOf(r,Object.getPrototypeOf(e)),x&&Object.defineProperty(r,x,{value:r,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(r,t(e))},e.promisify.custom=x,e.callbackify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');function r(){for(var t=[],r=0;r<arguments.length;r++)t.push(arguments[r]);var n=t.pop();if("function"!=typeof n)throw new TypeError("The last argument must be of type Function");var o=this,i=function(){return n.apply(o,arguments)};e.apply(this,t).then(function(e){process.nextTick(i.bind(null,null,e))},function(e){process.nextTick(I.bind(null,e,i))})}return Object.setPrototypeOf(r,Object.getPrototypeOf(e)),Object.defineProperties(r,t(e)),r}}(Qo)),Qo}function Ca(){if(Sa)return Aa;Sa=1;const{cppdb:e}=tn();function t(e,t,n){if(!i.call(e,"rows"))throw new TypeError(`Virtual table module "${n}" ${t} a table definition without a "rows" property`);if(!i.call(e,"columns"))throw new TypeError(`Virtual table module "${n}" ${t} a table definition without a "columns" property`);const o=e.rows;if("function"!=typeof o||Object.getPrototypeOf(o)!==s)throw new TypeError(`Virtual table module "${n}" ${t} a table definition with an invalid "rows" property (should be a generator function)`);let a,c=e.columns;if(!Array.isArray(c)||!(c=[...c]).every(e=>"string"==typeof e))throw new TypeError(`Virtual table module "${n}" ${t} a table definition with an invalid "columns" property (should be an array of strings)`);if(c.length!==new Set(c).size)throw new TypeError(`Virtual table module "${n}" ${t} a table definition with duplicate column names`);if(!c.length)throw new RangeError(`Virtual table module "${n}" ${t} a table definition with zero columns`);if(i.call(e,"parameters")){if(a=e.parameters,!Array.isArray(a)||!(a=[...a]).every(e=>"string"==typeof e))throw new TypeError(`Virtual table module "${n}" ${t} a table definition with an invalid "parameters" property (should be an array of strings)`)}else a=function({length:e}){if(!Number.isInteger(e)||e<0)throw new TypeError("Expected function.length to be a positive integer");const t=[];for(let r=0;r<e;++r)t.push(`$${r+1}`);return t}(o);if(a.length!==new Set(a).size)throw new TypeError(`Virtual table module "${n}" ${t} a table definition with duplicate parameter names`);if(a.length>32)throw new RangeError(`Virtual table module "${n}" ${t} a table definition with more than the maximum number of 32 parameters`);for(const e of a)if(c.includes(e))throw new TypeError(`Virtual table module "${n}" ${t} a table definition with column "${e}" which was ambiguously defined as both a column and parameter`);let l=2;if(i.call(e,"safeIntegers")){const r=e.safeIntegers;if("boolean"!=typeof r)throw new TypeError(`Virtual table module "${n}" ${t} a table definition with an invalid "safeIntegers" property (should be a boolean)`);l=+r}let d=!1;if(i.call(e,"directOnly")&&(d=e.directOnly,"boolean"!=typeof d))throw new TypeError(`Virtual table module "${n}" ${t} a table definition with an invalid "directOnly" property (should be a boolean)`);return[`CREATE TABLE x(${[...a.map(u).map(e=>`${e} HIDDEN`),...c.map(u)].join(", ")});`,r(o,new Map(c.map((e,t)=>[e,a.length+t])),n),a,l,d]}function r(e,t,r){return function*(...i){const a=i.map(e=>Buffer.isBuffer(e)?Buffer.from(e):e);for(let e=0;e<t.size;++e)a.push(null);for(const s of e(...i))if(Array.isArray(s))n(s,a,t.size,r),yield a;else{if("object"!=typeof s||null===s)throw new TypeError(`Virtual table module "${r}" yielded something that isn't a valid row object`);o(s,a,t,r),yield a}}}function n(e,t,r,n){if(e.length!==r)throw new TypeError(`Virtual table module "${n}" yielded a row with an incorrect number of columns`);const o=t.length-r;for(let n=0;n<r;++n)t[n+o]=e[n]}function o(e,t,r,n){let o=0;for(const i of Object.keys(e)){const a=r.get(i);if(void 0===a)throw new TypeError(`Virtual table module "${n}" yielded a row with an undeclared column "${i}"`);t[a]=e[i],o+=1}if(o!==r.size)throw new TypeError(`Virtual table module "${n}" yielded a row with missing columns`)}Aa=function(r,n){if("string"!=typeof r)throw new TypeError("Expected first argument to be a string");if(!r)throw new TypeError("Virtual table module name cannot be an empty string");let o=!1;if("object"==typeof n&&null!==n)o=!0,n=c(t(n,"used",r));else{if("function"!=typeof n)throw new TypeError("Expected second argument to be a function or a table definition object");n=function(e){return function(r,n,o,...i){const s={module:r,database:n,table:o},u=a.call(e,s,i);if("object"!=typeof u||null===u)throw new TypeError(`Virtual table module "${r}" did not return a table definition object`);return t(u,"returned",r)}}(n)}return this[e].table(n,r,o),this};const{hasOwnProperty:i}=Object.prototype,{apply:a}=Function.prototype,s=Object.getPrototypeOf(function*(){}),u=e=>`"${e.replace(/"/g,'""')}"`,c=e=>()=>e;return Aa}function La(){if(Ra)return Na;Ra=1;const e=t,n=r,o=tn(),i=rn();let a;function s(t,r){if(null==new.target)return new s(t,r);let c;if(Buffer.isBuffer(t)&&(c=t,t=":memory:"),null==t&&(t=""),null==r&&(r={}),"string"!=typeof t)throw new TypeError("Expected first argument to be a string");if("object"!=typeof r)throw new TypeError("Expected second argument to be an options object");if("readOnly"in r)throw new TypeError('Misspelled option "readOnly" should be "readonly"');if("memory"in r)throw new TypeError('Option "memory" was removed in v7.0.0 (use ":memory:" filename instead)');const l=t.trim(),d=""===l||":memory:"===l,p=o.getBooleanOption(r,"readonly"),f=o.getBooleanOption(r,"fileMustExist"),h="timeout"in r?r.timeout:5e3,y="verbose"in r?r.verbose:null,m="nativeBinding"in r?r.nativeBinding:null;if(p&&d&&!c)throw new TypeError("In-memory/temporary databases cannot be readonly");if(!Number.isInteger(h)||h<0)throw new TypeError('Expected the "timeout" option to be a positive integer');if(h>2147483647)throw new RangeError('Option "timeout" cannot be greater than 2147483647');if(null!=y&&"function"!=typeof y)throw new TypeError('Expected the "verbose" option to be a function');if(null!=m&&"string"!=typeof m&&"object"!=typeof m)throw new TypeError('Expected the "nativeBinding" option to be a string or addon object');let g;if(null==m)g=a||(a=un()("better_sqlite3.node"));else if("string"==typeof m){g=("function"==typeof __non_webpack_require__?__non_webpack_require__:Kr)(n.resolve(m).replace(/(\.node)?$/,".node"))}else g=m;if(g.isInitialized||(g.setErrorConstructor(i),g.isInitialized=!0),!d&&!l.startsWith("file:")&&!e.existsSync(n.dirname(l)))throw new TypeError("Cannot open database because the directory does not exist");Object.defineProperties(this,{[o.cppdb]:{value:new g.Database(l,t,d,p,f,h,y||null,c||null)},...u.getters})}const u=yn();return s.prototype.prepare=u.prepare,s.prototype.transaction=function(){if(dn)return ln;dn=1;const{cppdb:e}=tn(),t=new WeakMap;ln=function(t){if("function"!=typeof t)throw new TypeError("Expected first argument to be a function");const o=this[e],i=r(o,this),{apply:a}=Function.prototype,s={default:{value:n(a,t,o,i.default)},deferred:{value:n(a,t,o,i.deferred)},immediate:{value:n(a,t,o,i.immediate)},exclusive:{value:n(a,t,o,i.exclusive)},database:{value:this,enumerable:!0}};return Object.defineProperties(s.default.value,s),Object.defineProperties(s.deferred.value,s),Object.defineProperties(s.immediate.value,s),Object.defineProperties(s.exclusive.value,s),s.default.value};const r=(e,r)=>{let n=t.get(e);if(!n){const o={commit:e.prepare("COMMIT",r,!1),rollback:e.prepare("ROLLBACK",r,!1),savepoint:e.prepare("SAVEPOINT `\t_bs3.\t`",r,!1),release:e.prepare("RELEASE `\t_bs3.\t`",r,!1),rollbackTo:e.prepare("ROLLBACK TO `\t_bs3.\t`",r,!1)};t.set(e,n={default:Object.assign({begin:e.prepare("BEGIN",r,!1)},o),deferred:Object.assign({begin:e.prepare("BEGIN DEFERRED",r,!1)},o),immediate:Object.assign({begin:e.prepare("BEGIN IMMEDIATE",r,!1)},o),exclusive:Object.assign({begin:e.prepare("BEGIN EXCLUSIVE",r,!1)},o)})}return n},n=(e,t,r,{begin:n,commit:o,rollback:i,savepoint:a,release:s,rollbackTo:u})=>function(){let c,l,d;r.inTransaction?(c=a,l=s,d=u):(c=n,l=o,d=i),c.run();try{const r=e.call(t,this,arguments);if(r&&"function"==typeof r.then)throw new TypeError("Transaction function cannot return a promise");return l.run(),r}catch(e){throw r.inTransaction&&(d.run(),d!==i&&l.run()),e}};return ln}(),s.prototype.pragma=function(){if(fn)return pn;fn=1;const{getBooleanOption:e,cppdb:t}=tn();return pn=function(r,n){if(null==n&&(n={}),"string"!=typeof r)throw new TypeError("Expected first argument to be a string");if("object"!=typeof n)throw new TypeError("Expected second argument to be an options object");const o=e(n,"simple"),i=this[t].prepare(`PRAGMA ${r}`,this,!0);return o?i.pluck().get():i.all()},pn}(),s.prototype.backup=function(){if(va)return ga;va=1;const e=t,n=r,{promisify:o}=Pa(),{cppdb:i}=tn(),a=o(e.access);ga=async function(e,t){if(null==t&&(t={}),"string"!=typeof e)throw new TypeError("Expected first argument to be a string");if("object"!=typeof t)throw new TypeError("Expected second argument to be an options object");e=e.trim();const r="attached"in t?t.attached:"main",o="progress"in t?t.progress:null;if(!e)throw new TypeError("Backup filename cannot be an empty string");if(":memory:"===e)throw new TypeError('Invalid backup filename ":memory:"');if("string"!=typeof r)throw new TypeError('Expected the "attached" option to be a string');if(!r)throw new TypeError('The "attached" option cannot be an empty string');if(null!=o&&"function"!=typeof o)throw new TypeError('Expected the "progress" option to be a function');await a(n.dirname(e)).catch(()=>{throw new TypeError("Cannot save backup because the directory does not exist")});const u=await a(e).then(()=>!1,()=>!0);return s(this[i].backup(this,r,e,u),o||null)};const s=(e,t)=>{let r=0,n=!0;return new Promise((o,i)=>{setImmediate(function a(){try{const i=e.transfer(r);if(!i.remainingPages)return e.close(),void o(i);if(n&&(n=!1,r=100),t){const e=t(i);if(void 0!==e){if("number"!=typeof e||e!=e)throw new TypeError("Expected progress callback to return a number or undefined");r=Math.max(0,Math.min(2147483647,Math.round(e)))}}setImmediate(a)}catch(t){e.close(),i(t)}})})};return ga}(),s.prototype.serialize=function(){if(ba)return _a;ba=1;const{cppdb:e}=tn();return _a=function(t){if(null==t&&(t={}),"object"!=typeof t)throw new TypeError("Expected first argument to be an options object");const r="attached"in t?t.attached:"main";if("string"!=typeof r)throw new TypeError('Expected the "attached" option to be a string');if(!r)throw new TypeError('The "attached" option cannot be an empty string');return this[e].serialize(r)},_a}(),s.prototype.function=function(){if(Ea)return wa;Ea=1;const{getBooleanOption:e,cppdb:t}=tn();return wa=function(r,n,o){if(null==n&&(n={}),"function"==typeof n&&(o=n,n={}),"string"!=typeof r)throw new TypeError("Expected first argument to be a string");if("function"!=typeof o)throw new TypeError("Expected last argument to be a function");if("object"!=typeof n)throw new TypeError("Expected second argument to be an options object");if(!r)throw new TypeError("User-defined function name cannot be an empty string");const i="safeIntegers"in n?+e(n,"safeIntegers"):2,a=e(n,"deterministic"),s=e(n,"directOnly");let u=-1;if(!e(n,"varargs")){if(u=o.length,!Number.isInteger(u)||u<0)throw new TypeError("Expected function.length to be a positive integer");if(u>100)throw new RangeError("User-defined functions cannot have more than 100 arguments")}return this[t].function(o,r,u,i,a,s),this},wa}(),s.prototype.aggregate=function(){if(Oa)return Ta;Oa=1;const{getBooleanOption:e,cppdb:t}=tn();Ta=function(o,i){if("string"!=typeof o)throw new TypeError("Expected first argument to be a string");if("object"!=typeof i||null===i)throw new TypeError("Expected second argument to be an options object");if(!o)throw new TypeError("User-defined function name cannot be an empty string");const a="start"in i?i.start:null,s=r(i,"step",!0),u=r(i,"inverse",!1),c=r(i,"result",!1),l="safeIntegers"in i?+e(i,"safeIntegers"):2,d=e(i,"deterministic"),p=e(i,"directOnly");let f=-1;if(!e(i,"varargs")&&(f=Math.max(n(s),u?n(u):0),f>0&&(f-=1),f>100))throw new RangeError("User-defined functions cannot have more than 100 arguments");return this[t].aggregate(a,s,u,c,o,f,l,d,p),this};const r=(e,t,r)=>{const n=t in e?e[t]:null;if("function"==typeof n)return n;if(null!=n)throw new TypeError(`Expected the "${t}" option to be a function`);if(r)throw new TypeError(`Missing required option "${t}"`);return null},n=({length:e})=>{if(Number.isInteger(e)&&e>=0)return e;throw new TypeError("Expected function.length to be a positive integer")};return Ta}(),s.prototype.table=Ca(),s.prototype.loadExtension=u.loadExtension,s.prototype.exec=u.exec,s.prototype.close=u.close,s.prototype.defaultSafeIntegers=u.defaultSafeIntegers,s.prototype.unsafeMode=u.unsafeMode,s.prototype[o.inspect]=function(){if(Ia)return xa;Ia=1;const e=function(){};return xa=function(t,r){return Object.assign(new e,this)}}(),Na=s}var Ma=Mr((ka||(ka=1,Jr.exports=La(),Jr.exports.SqliteError=rn()),Jr.exports));const Da=new Map;e.SqliteAgentRunner=class extends Hr{db;constructor(e={}){super();const t=e.dbPath??":memory:";if(!Ma)throw new Error("better-sqlite3 is required for SqliteAgentRunner but was not found.\nPlease install it in your project:\n npm install better-sqlite3\n or\n pnpm add better-sqlite3\n or\n yarn add better-sqlite3\n\nIf you don't need persistence, use InMemoryAgentRunner instead.");this.db=new Ma(t),this.initializeSchema()}initializeSchema(){this.db.exec("\n CREATE TABLE IF NOT EXISTS agent_runs (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n thread_id TEXT NOT NULL,\n run_id TEXT NOT NULL UNIQUE,\n parent_run_id TEXT,\n events TEXT NOT NULL,\n input TEXT NOT NULL,\n created_at INTEGER NOT NULL,\n version INTEGER NOT NULL\n )\n "),this.db.exec("\n CREATE TABLE IF NOT EXISTS run_state (\n thread_id TEXT PRIMARY KEY,\n is_running INTEGER DEFAULT 0,\n current_run_id TEXT,\n updated_at INTEGER NOT NULL\n )\n "),this.db.exec("\n CREATE INDEX IF NOT EXISTS idx_thread_id ON agent_runs(thread_id);\n CREATE INDEX IF NOT EXISTS idx_parent_run_id ON agent_runs(parent_run_id);\n "),this.db.exec("\n CREATE TABLE IF NOT EXISTS schema_version (\n version INTEGER PRIMARY KEY,\n applied_at INTEGER NOT NULL\n )\n ");const e=this.db.prepare("SELECT version FROM schema_version ORDER BY version DESC LIMIT 1").get();(!e||e.version<1)&&this.db.prepare("INSERT OR REPLACE INTO schema_version (version, applied_at) VALUES (?, ?)").run(1,Date.now())}storeRun(e,t,r,n,o){const i=jr(r);this.db.prepare("\n INSERT INTO agent_runs (thread_id, run_id, parent_run_id, events, input, created_at, version)\n VALUES (?, ?, ?, ?, ?, ?, ?)\n ").run(e,t,o??null,JSON.stringify(i),JSON.stringify(n),Date.now(),1)}getHistoricRuns(e){return this.db.prepare("\n WITH RECURSIVE run_chain AS (\n -- Base case: find the root runs (those without parent)\n SELECT * FROM agent_runs \n WHERE thread_id = ? AND parent_run_id IS NULL\n \n UNION ALL\n \n -- Recursive case: find children of current level\n SELECT ar.* FROM agent_runs ar\n INNER JOIN run_chain rc ON ar.parent_run_id = rc.run_id\n WHERE ar.thread_id = ?\n )\n SELECT * FROM run_chain\n ORDER BY created_at ASC\n ").all(e,e).map(e=>({id:e.id,thread_id:e.thread_id,run_id:e.run_id,parent_run_id:e.parent_run_id,events:JSON.parse(e.events),input:JSON.parse(e.input),created_at:e.created_at,version:e.version}))}getLatestRunId(e){const t=this.db.prepare("\n SELECT run_id FROM agent_runs \n WHERE thread_id = ? \n ORDER BY created_at DESC \n LIMIT 1\n ").get(e);return t?.run_id??null}setRunState(e,t,r){this.db.prepare("\n INSERT OR REPLACE INTO run_state (thread_id, is_running, current_run_id, updated_at)\n VALUES (?, ?, ?, ?)\n ").run(e,t?1:0,r??null,Date.now())}getRunState(e){const t=this.db.prepare("\n SELECT is_running, current_run_id FROM run_state WHERE thread_id = ?\n ").get(e);return{isRunning:1===t?.is_running,currentRunId:t?.current_run_id??null}}run(e){if(this.getRunState(e.threadId).isRunning)throw new Error("Thread already running");this.setRunState(e.threadId,!0,e.input.runId);const t=new Set,r=[],n=this.getHistoricRuns(e.threadId),o=new Set;for(const e of n)for(const t of e.events)if("messageId"in t&&"string"==typeof t.messageId&&o.add(t.messageId),t.type===Dt.RUN_STARTED){const e=t,r=e.input?.messages??[];for(const e of r)o.add(e.id)}const i=new L(1/0),a=Da.get(e.threadId),s=a?.subject,u=new L(1/0);Da.set(e.threadId,{subject:i,agent:e.agent,runSubject:u,currentEvents:r,stopRequested:!1});return s&&s.subscribe({next:e=>i.next(e),error:e=>i.error(e),complete:()=>{}}),(async()=>{const n=this.getLatestRunId(e.threadId);try{await e.agent.runAgent(e.input,{onEvent:({event:t})=>{let n=t;if(t.type===Dt.RUN_STARTED){const r=t;if(!r.input){const t=e.input.messages?e.input.messages.filter(e=>!o.has(e.id)):void 0,i={...e.input,...void 0!==t?{messages:t}:{}};n={...r,input:i}}}u.next(n),i.next(n),r.push(n)},onNewMessage:({message:e})=>{t.has(e.id)||t.add(e.id)},onRunStartedEvent:()=>{if(e.input.messages)for(const r of e.input.messages)t.has(r.id)||t.add(r.id)}});const a=Da.get(e.threadId),s=Gr(r,{stopRequested:a?.stopRequested??!1});for(const e of s)u.next(e),i.next(e);this.storeRun(e.threadId,e.input.runId,r,e.input,n),this.setRunState(e.threadId,!1),a&&(a.agent=void 0,a.runSubject=void 0,a.currentEvents=void 0,a.stopRequested=!1),u.complete(),i.complete(),Da.delete(e.threadId)}catch{const t=Da.get(e.threadId),o=Gr(r,{stopRequested:t?.stopRequested??!1});for(const e of o)u.next(e),i.next(e);r.length>0&&this.storeRun(e.threadId,e.input.runId,r,e.input,n),this.setRunState(e.threadId,!1),t&&(t.agent=void 0,t.runSubject=void 0,t.currentEvents=void 0,t.stopRequested=!1),u.complete(),i.complete(),Da.delete(e.threadId)}})(),u.asObservable()}connect(e){const t=new L(1/0),r=this.getHistoricRuns(e.threadId),n=[];for(const e of r)n.push(...e.events);const o=jr(n),i=new Set;for(const e of o)t.next(e),"messageId"in e&&"string"==typeof e.messageId&&i.add(e.messageId);const a=Da.get(e.threadId),s=this.getRunState(e.threadId);return a&&(s.isRunning||a.stopRequested)?a.subject.subscribe({next:e=>{"messageId"in e&&"string"==typeof e.messageId&&i.has(e.messageId)||t.next(e)},complete:()=>t.complete(),error:e=>t.error(e)}):t.complete(),t.asObservable()}isRunning(e){const t=this.getRunState(e.threadId);return Promise.resolve(t.isRunning)}stop(e){if(!this.getRunState(e.threadId).isRunning)return Promise.resolve(!1);const t=Da.get(e.threadId),r=t?.agent;if(!t||!r)return Promise.resolve(!1);if(t.stopRequested)return Promise.resolve(!1);t.stopRequested=!0,this.setRunState(e.threadId,!1);try{return r.abortRun(),Promise.resolve(!0)}catch(r){return console.error("Failed to abort sqlite agent run",r),t.stopRequested=!1,this.setRunState(e.threadId,!0),Promise.resolve(!1)}}close(){this.db&&this.db.close()}}});
12
+ //# sourceMappingURL=index.umd.js.map