@selvajs/compute 1.5.3 → 2.0.0-beta.1

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.
Files changed (66) hide show
  1. package/dist/chunk-3FH7FKLG.cjs +2 -0
  2. package/dist/chunk-3FH7FKLG.cjs.map +1 -0
  3. package/dist/chunk-DELOBV2Q.js +2 -0
  4. package/dist/chunk-DELOBV2Q.js.map +1 -0
  5. package/dist/chunk-GTTKNF4G.js +4 -0
  6. package/dist/chunk-GTTKNF4G.js.map +1 -0
  7. package/dist/chunk-JFLD2UCY.cjs +2 -0
  8. package/dist/chunk-JFLD2UCY.cjs.map +1 -0
  9. package/dist/chunk-MA6YB3YZ.cjs +4 -0
  10. package/dist/chunk-MA6YB3YZ.cjs.map +1 -0
  11. package/dist/chunk-MKW2KTPT.js +2 -0
  12. package/dist/chunk-MKW2KTPT.js.map +1 -0
  13. package/dist/core.cjs +1 -1
  14. package/dist/core.cjs.map +1 -1
  15. package/dist/core.d.cts +10 -15
  16. package/dist/core.d.ts +10 -15
  17. package/dist/core.js +1 -1
  18. package/dist/grasshopper.cjs +1 -1
  19. package/dist/grasshopper.cjs.map +1 -1
  20. package/dist/grasshopper.d.cts +77 -101
  21. package/dist/grasshopper.d.ts +77 -101
  22. package/dist/grasshopper.js +1 -1
  23. package/dist/handle-files-DsrxHKHP.d.cts +262 -0
  24. package/dist/handle-files-DsrxHKHP.d.ts +262 -0
  25. package/dist/index.cjs +1 -1
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.d.cts +4 -4
  28. package/dist/index.d.ts +4 -4
  29. package/dist/index.js +1 -1
  30. package/dist/{types-Dfeei0dD.d.cts → types-CJ092lxB.d.cts} +116 -73
  31. package/dist/types-D1SkNje_.d.cts +87 -0
  32. package/dist/types-D1SkNje_.d.ts +87 -0
  33. package/dist/{types-Dfeei0dD.d.ts → types-XCUrJGby.d.ts} +116 -73
  34. package/dist/visualization-GU7JIB4V.cjs +2 -0
  35. package/dist/visualization-GU7JIB4V.cjs.map +1 -0
  36. package/dist/visualization-WIUVT2FZ.js +2 -0
  37. package/dist/visualization.cjs +1 -1
  38. package/dist/visualization.cjs.map +1 -1
  39. package/dist/visualization.d.cts +16 -21
  40. package/dist/visualization.d.ts +16 -21
  41. package/dist/visualization.js +1 -1
  42. package/package.json +18 -7
  43. package/dist/chunk-GZYSQSLH.cjs +0 -2
  44. package/dist/chunk-GZYSQSLH.cjs.map +0 -1
  45. package/dist/chunk-JZYEMZZ5.js +0 -2
  46. package/dist/chunk-JZYEMZZ5.js.map +0 -1
  47. package/dist/chunk-OEDLGVIQ.js +0 -2
  48. package/dist/chunk-OEDLGVIQ.js.map +0 -1
  49. package/dist/chunk-OW6HV6QP.js +0 -2
  50. package/dist/chunk-OW6HV6QP.js.map +0 -1
  51. package/dist/chunk-RBNF6MNH.cjs +0 -3
  52. package/dist/chunk-RBNF6MNH.cjs.map +0 -1
  53. package/dist/chunk-SVEXPGHW.cjs +0 -2
  54. package/dist/chunk-SVEXPGHW.cjs.map +0 -1
  55. package/dist/chunk-XBIEAJBK.js +0 -3
  56. package/dist/chunk-XBIEAJBK.js.map +0 -1
  57. package/dist/chunk-ZRQRYG6F.cjs +0 -2
  58. package/dist/chunk-ZRQRYG6F.cjs.map +0 -1
  59. package/dist/errors-CEy4nM1J.d.cts +0 -149
  60. package/dist/errors-CEy4nM1J.d.ts +0 -149
  61. package/dist/types-COCuQEMk.d.cts +0 -93
  62. package/dist/types-COCuQEMk.d.ts +0 -93
  63. package/dist/visualization-ENMBHWIN.js +0 -2
  64. package/dist/visualization-TBPFFBFU.cjs +0 -2
  65. package/dist/visualization-TBPFFBFU.cjs.map +0 -1
  66. /package/dist/{visualization-ENMBHWIN.js.map → visualization-WIUVT2FZ.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  import * as THREE from 'three';
2
2
  import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
3
- import { f as GrasshopperComputeResponse } from './types-Dfeei0dD.cjs';
4
- import { M as MeshExtractionOptions, a as MeshBatch } from './types-COCuQEMk.cjs';
3
+ import { f as GrasshopperComputeResponse, M as MeshExtractionOptions, m as MeshBatchParsingOptions, n as MeshBatch } from './types-CJ092lxB.cjs';
4
+ import './types-D1SkNje_.cjs';
5
5
 
6
6
  type CameraConfig = {
7
7
  position?: THREE.Vector3;
@@ -176,6 +176,15 @@ declare const SCALE_FACTORS: Record<string, number>;
176
176
  */
177
177
  declare function getThreeMeshesFromComputeResponse(data: GrasshopperComputeResponse, options?: MeshExtractionOptions): Promise<THREE.Mesh[]>;
178
178
 
179
+ /**
180
+ * Internal-only telemetry threaded from an outer entry point (e.g. the JSON
181
+ * `parseMeshBatch` measuring its own `JSON.parse` cost) into the shared build
182
+ * step. Never part of any public options surface — callers don't supply timings.
183
+ */
184
+ interface ParseTelemetry {
185
+ parseTime?: number;
186
+ perfStart?: number;
187
+ }
179
188
  /**
180
189
  * Parses a MeshBatch object and creates Three.js meshes.
181
190
  *
@@ -187,20 +196,12 @@ declare function getThreeMeshesFromComputeResponse(data: GrasshopperComputeRespo
187
196
  * @param options - Rendering options
188
197
  * @returns Promise resolving to array of Three.js mesh objects
189
198
  */
190
- declare function parseMeshBatchObject(batch: MeshBatch, options?: {
191
- /** Merge meshes with same material into single geometry*/
192
- mergeByMaterial?: boolean;
193
- /** Apply coordinate system transformations */
194
- applyTransforms?: boolean;
199
+ declare function parseMeshBatchObject(batch: MeshBatch, options?: MeshBatchParsingOptions & {
195
200
  /** Scale factor to apply to meshes (e.g., for unit conversion) */
196
201
  scaleFactor?: number;
197
- /** Enable performance monitoring */
198
- debug?: boolean;
199
- /** Parse time (optional, for debugging) */
200
- parseTime?: number;
201
- /** Performance start time (optional, for debugging) */
202
- perfStart?: number;
203
- }): Promise<THREE.Mesh[]>;
202
+ },
203
+ /** @internal Timings threaded from an outer entry point; not a caller option. */
204
+ telemetry?: ParseTelemetry): Promise<THREE.Mesh[]>;
204
205
  /**
205
206
  * Parses a raw binary mesh batch blob (SLVA wire format) and creates Three.js meshes.
206
207
  *
@@ -213,15 +214,9 @@ declare function parseMeshBatchObject(batch: MeshBatch, options?: {
213
214
  * @param options - Rendering options.
214
215
  * @returns Promise resolving to array of Three.js mesh objects.
215
216
  */
216
- declare function parseMeshBatchBlob(blob: ArrayBuffer | Uint8Array, options?: {
217
- /** Merge meshes with same material into single geometry */
218
- mergeByMaterial?: boolean;
219
- /** Apply coordinate system transformations */
220
- applyTransforms?: boolean;
217
+ declare function parseMeshBatchBlob(blob: ArrayBuffer | Uint8Array, options?: MeshBatchParsingOptions & {
221
218
  /** Scale factor to apply to meshes (e.g., for unit conversion) */
222
219
  scaleFactor?: number;
223
- /** Enable performance monitoring */
224
- debug?: boolean;
225
220
  }): Promise<THREE.Mesh[]>;
226
221
 
227
222
  export { type CameraConfig, type ControlsConfig, type EnvironmentConfig, type EventConfig, type FloorConfig, type LightingConfig, threeMaterials as Materials, MeshBatch, MeshExtractionOptions, type RenderConfig, SCALE_FACTORS, type ThreeInitializerOptions, getThreeMeshesFromComputeResponse, initThree, parseMeshBatchBlob, parseMeshBatchObject, updateScene };
@@ -1,7 +1,7 @@
1
1
  import * as THREE from 'three';
2
2
  import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
3
- import { f as GrasshopperComputeResponse } from './types-Dfeei0dD.js';
4
- import { M as MeshExtractionOptions, a as MeshBatch } from './types-COCuQEMk.js';
3
+ import { f as GrasshopperComputeResponse, M as MeshExtractionOptions, m as MeshBatchParsingOptions, n as MeshBatch } from './types-XCUrJGby.js';
4
+ import './types-D1SkNje_.js';
5
5
 
6
6
  type CameraConfig = {
7
7
  position?: THREE.Vector3;
@@ -176,6 +176,15 @@ declare const SCALE_FACTORS: Record<string, number>;
176
176
  */
177
177
  declare function getThreeMeshesFromComputeResponse(data: GrasshopperComputeResponse, options?: MeshExtractionOptions): Promise<THREE.Mesh[]>;
178
178
 
179
+ /**
180
+ * Internal-only telemetry threaded from an outer entry point (e.g. the JSON
181
+ * `parseMeshBatch` measuring its own `JSON.parse` cost) into the shared build
182
+ * step. Never part of any public options surface — callers don't supply timings.
183
+ */
184
+ interface ParseTelemetry {
185
+ parseTime?: number;
186
+ perfStart?: number;
187
+ }
179
188
  /**
180
189
  * Parses a MeshBatch object and creates Three.js meshes.
181
190
  *
@@ -187,20 +196,12 @@ declare function getThreeMeshesFromComputeResponse(data: GrasshopperComputeRespo
187
196
  * @param options - Rendering options
188
197
  * @returns Promise resolving to array of Three.js mesh objects
189
198
  */
190
- declare function parseMeshBatchObject(batch: MeshBatch, options?: {
191
- /** Merge meshes with same material into single geometry*/
192
- mergeByMaterial?: boolean;
193
- /** Apply coordinate system transformations */
194
- applyTransforms?: boolean;
199
+ declare function parseMeshBatchObject(batch: MeshBatch, options?: MeshBatchParsingOptions & {
195
200
  /** Scale factor to apply to meshes (e.g., for unit conversion) */
196
201
  scaleFactor?: number;
197
- /** Enable performance monitoring */
198
- debug?: boolean;
199
- /** Parse time (optional, for debugging) */
200
- parseTime?: number;
201
- /** Performance start time (optional, for debugging) */
202
- perfStart?: number;
203
- }): Promise<THREE.Mesh[]>;
202
+ },
203
+ /** @internal Timings threaded from an outer entry point; not a caller option. */
204
+ telemetry?: ParseTelemetry): Promise<THREE.Mesh[]>;
204
205
  /**
205
206
  * Parses a raw binary mesh batch blob (SLVA wire format) and creates Three.js meshes.
206
207
  *
@@ -213,15 +214,9 @@ declare function parseMeshBatchObject(batch: MeshBatch, options?: {
213
214
  * @param options - Rendering options.
214
215
  * @returns Promise resolving to array of Three.js mesh objects.
215
216
  */
216
- declare function parseMeshBatchBlob(blob: ArrayBuffer | Uint8Array, options?: {
217
- /** Merge meshes with same material into single geometry */
218
- mergeByMaterial?: boolean;
219
- /** Apply coordinate system transformations */
220
- applyTransforms?: boolean;
217
+ declare function parseMeshBatchBlob(blob: ArrayBuffer | Uint8Array, options?: MeshBatchParsingOptions & {
221
218
  /** Scale factor to apply to meshes (e.g., for unit conversion) */
222
219
  scaleFactor?: number;
223
- /** Enable performance monitoring */
224
- debug?: boolean;
225
220
  }): Promise<THREE.Mesh[]>;
226
221
 
227
222
  export { type CameraConfig, type ControlsConfig, type EnvironmentConfig, type EventConfig, type FloorConfig, type LightingConfig, threeMaterials as Materials, MeshBatch, MeshExtractionOptions, type RenderConfig, SCALE_FACTORS, type ThreeInitializerOptions, getThreeMeshesFromComputeResponse, initThree, parseMeshBatchBlob, parseMeshBatchObject, updateScene };
@@ -1,2 +1,2 @@
1
- import{a as e,b as o,f as t,l as r,m as i,n,o as s}from"./chunk-OEDLGVIQ.js";import"./chunk-OW6HV6QP.js";import"./chunk-XBIEAJBK.js";export{t as Materials,n as SCALE_FACTORS,s as getThreeMeshesFromComputeResponse,e as initThree,i as parseMeshBatchBlob,r as parseMeshBatchObject,o as updateScene};
1
+ import{a as e,b as o,f as t,l as r,m as i,n,o as s}from"./chunk-MKW2KTPT.js";import"./chunk-GTTKNF4G.js";export{t as Materials,n as SCALE_FACTORS,s as getThreeMeshesFromComputeResponse,e as initThree,i as parseMeshBatchBlob,r as parseMeshBatchObject,o as updateScene};
2
2
  //# sourceMappingURL=visualization.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@selvajs/compute",
3
- "version": "1.5.3",
3
+ "version": "2.0.0-beta.1",
4
4
  "description": "TypeScript library for Rhino Compute Server - Grasshopper and RhinoCommon",
5
5
  "author": "VektorNode",
6
6
  "license": "MIT",
@@ -65,9 +65,13 @@
65
65
  "provenance": false
66
66
  },
67
67
  "sideEffects": false,
68
+ "lint-staged": {
69
+ "*.{ts,js,mjs,svelte,json,md}": "prettier --write",
70
+ "*.{ts,js,mjs,svelte}": "eslint --fix"
71
+ },
68
72
  "dependencies": {
69
73
  "fflate": "^0.8.2",
70
- "rhino3dm": "8.9.0"
74
+ "rhino3dm": "8.17.0"
71
75
  },
72
76
  "peerDependencies": {
73
77
  "three": ">=0.179.0"
@@ -81,17 +85,20 @@
81
85
  "@changesets/cli": "^2.30.0",
82
86
  "@eslint/js": "^9.39.3",
83
87
  "@types/node": "^25.3.3",
84
- "@types/three": "^0.182.0",
88
+ "@types/three": "^0.184.1",
89
+ "@vitest/coverage-v8": "^3.2.4",
85
90
  "esbuild-plugin-file-path-extensions": "^2.1.4",
86
- "eslint": "^9.39.3",
91
+ "eslint": "^10.4.1",
87
92
  "eslint-config-prettier": "^10.1.8",
88
93
  "eslint-plugin-svelte": "^3.15.0",
89
94
  "globals": "^17.4.0",
95
+ "husky": "^9.1.7",
96
+ "lint-staged": "^17.0.7",
90
97
  "prettier": "^3.8.1",
91
- "prettier-plugin-svelte": "^3.5.1",
92
- "prettier-plugin-tailwindcss": "^0.7.2",
98
+ "prettier-plugin-svelte": "^4.1.0",
99
+ "prettier-plugin-tailwindcss": "^0.8.0",
93
100
  "svelte": "^5.53.7",
94
- "three": "^0.182.0",
101
+ "three": "^0.184.0",
95
102
  "tsup": "^8.5.1",
96
103
  "typedoc": "^0.28.17",
97
104
  "typedoc-plugin-extras": "^4.0.1",
@@ -113,6 +120,10 @@
113
120
  "format:check": "prettier --check .",
114
121
  "test": "vitest",
115
122
  "test:watch": "vitest watch",
123
+ "contract:snapshot": "node scripts/fetch-server-contract.mjs",
124
+ "contract:check": "node scripts/fetch-server-contract.mjs --check",
125
+ "test:seams": "vitest run tests/contract",
126
+ "test:seams:live": "RUN_LIVE_CONTRACT=1 vitest run tests/contract/server-contract.live.test.ts",
116
127
  "type-check": "tsc --noEmit",
117
128
  "build-docs": "typedoc",
118
129
  "release": "changeset publish"
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkZRQRYG6Fcjs = require('./chunk-ZRQRYG6F.cjs');var _chunkRBNF6MNHcjs = require('./chunk-RBNF6MNH.cjs');function L(r){let e=new WeakSet,t=n=>{if(n==null)return JSON.stringify(n);if(typeof n=="number")return Number.isFinite(n)?String(n):JSON.stringify(null);if(typeof n=="string"||typeof n=="boolean")return JSON.stringify(n);if(typeof n=="bigint")return JSON.stringify(n.toString());if(n instanceof Uint8Array){let s=n.length>64?Array.from(n.slice(0,32)).concat(Array.from(n.slice(-32))):Array.from(n);return JSON.stringify({__u8:!0,len:n.length,sample:s})}return Array.isArray(n)?`[${n.map(t).join(",")}]`:typeof n=="object"?e.has(n)?JSON.stringify("[Circular]"):(e.add(n),`{${Object.keys(n).sort().map(a=>`${JSON.stringify(a)}:${t(n[a])}`).join(",")}}`):JSON.stringify(null)};return t(r)}function J(r){let e=2166136261;for(let t=0;t<r.length;t++)e^=r.charCodeAt(t),e=e+((e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24))>>>0;return e.toString(16).padStart(8,"0")}function R(r,e){let t=typeof r=="string"?r:L({__u8:!0,len:r.length});return J(`${t}|${L(e)}`)}var b=class{constructor(e,t,n={}){_chunkRBNF6MNHcjs.b.call(void 0, this,"executor");_chunkRBNF6MNHcjs.b.call(void 0, this,"baseConfig");_chunkRBNF6MNHcjs.b.call(void 0, this,"mode");_chunkRBNF6MNHcjs.b.call(void 0, this,"maxConcurrent");_chunkRBNF6MNHcjs.b.call(void 0, this,"timeoutMs");_chunkRBNF6MNHcjs.b.call(void 0, this,"retry");_chunkRBNF6MNHcjs.b.call(void 0, this,"cacheEnabled");_chunkRBNF6MNHcjs.b.call(void 0, this,"cacheMax");_chunkRBNF6MNHcjs.b.call(void 0, this,"cacheTtl");_chunkRBNF6MNHcjs.b.call(void 0, this,"cache",new Map);_chunkRBNF6MNHcjs.b.call(void 0, this,"onStart");_chunkRBNF6MNHcjs.b.call(void 0, this,"onSettle");_chunkRBNF6MNHcjs.b.call(void 0, this,"onSuperseded");_chunkRBNF6MNHcjs.b.call(void 0, this,"subscribers",new Set);_chunkRBNF6MNHcjs.b.call(void 0, this,"inFlight",new Set);_chunkRBNF6MNHcjs.b.call(void 0, this,"pendingForLatestWins",null);_chunkRBNF6MNHcjs.b.call(void 0, this,"fifoQueue",[]);_chunkRBNF6MNHcjs.b.call(void 0, this,"_lastResult",null);_chunkRBNF6MNHcjs.b.call(void 0, this,"_lastError",null);_chunkRBNF6MNHcjs.b.call(void 0, this,"_lastDurationMs",null);_chunkRBNF6MNHcjs.b.call(void 0, this,"disposed",!1);this.executor=e,this.baseConfig=t,this.mode=_nullishCoalesce(n.mode, () => ("latest-wins")),this.maxConcurrent=Math.max(1,_nullishCoalesce(n.maxConcurrent, () => ((this.mode==="parallel"?4:1)))),this.timeoutMs=n.timeoutMs,this.retry=n.retry;let s=n.cache;this.cacheEnabled=s!==void 0&&s!==!1;let o=typeof s=="object"?s:{};this.cacheMax=_nullishCoalesce(o.maxEntries, () => (50)),this.cacheTtl=_nullishCoalesce(o.ttlMs, () => (0)),this.onStart=n.onStart,this.onSettle=n.onSettle,this.onSuperseded=n.onSuperseded}get isSolving(){return this.inFlight.size>0}get hasPending(){return this.pendingForLatestWins!==null||this.fifoQueue.length>0}get inFlightCount(){return this.inFlight.size}get queueDepth(){return this.fifoQueue.length+(this.pendingForLatestWins?1:0)}get lastResult(){return this._lastResult}get lastError(){return this._lastError}get lastDurationMs(){return this._lastDurationMs}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}notify(){for(let e of this.subscribers)try{e()}catch(t){_chunkRBNF6MNHcjs.e.call(void 0, ).error("[SolveScheduler] subscriber threw:",t)}}solve(e,t,n){if(this.disposed)return Promise.reject(new (0, _chunkRBNF6MNHcjs.d)("SolveScheduler has been disposed and cannot be used",_chunkRBNF6MNHcjs.c.INVALID_STATE));let s=R(e,t),o={key:s,enqueuedAt:Date.now(),startedAt:null};if(this.cacheEnabled){let a=this.readCache(s);if(a){let u={status:"success",response:a,durationMs:0,fromCache:!0};return this._lastResult=a,this._lastError=null,this._lastDurationMs=0,this.runHook(this.onStart,o),this.runHook(this.onSettle,o,u),this.notify(),Promise.resolve(a)}}return new Promise((a,u)=>{let i={definition:e,dataTree:t,ctx:o,resolve:a,reject:u,externalSignal:_optionalChain([n, 'optionalAccess', _2 => _2.signal])};if(_optionalChain([i, 'access', _3 => _3.externalSignal, 'optionalAccess', _4 => _4.aborted])){let c=this.makeAbortError(o);i.settled={error:c},u(c);return}this.enqueue(i)})}enqueue(e){switch(this.mode){case"latest-wins":{this.pendingForLatestWins&&(this.supersede(this.pendingForLatestWins),this.pendingForLatestWins=null);for(let t of this.inFlight)this.supersede(t),t.controller.abort();this.inFlight.size===0?this.execute(e):this.pendingForLatestWins=e;break}case"queue":case"parallel":{this.inFlight.size<this.maxConcurrent?this.execute(e):this.fifoQueue.push(e);break}}this.notify()}async execute(e){let t=new AbortController,n={...e,controller:t};this.inFlight.add(n),e.ctx.startedAt=Date.now();let s=()=>t.abort();_optionalChain([e, 'access', _5 => _5.externalSignal, 'optionalAccess', _6 => _6.addEventListener, 'call', _7 => _7("abort",s,{once:!0})]),this.runHook(this.onStart,e.ctx),this.notify();let o=performance.now();try{let a={...this.baseConfig,signal:t.signal,...this.timeoutMs!==void 0&&{timeoutMs:this.timeoutMs},...this.retry!==void 0&&{retry:this.retry}},u=await this.executor(e.definition,e.dataTree,a),i=performance.now()-o;if(this.cacheEnabled&&this.writeCache(e.ctx.key,u),e.settled)return;e.settled={ok:!0},this._lastResult=u,this._lastError=null,this._lastDurationMs=i,e.resolve(u),this.runHook(this.onSettle,e.ctx,{status:"success",response:u,durationMs:i,fromCache:!1})}catch(a){let u=performance.now()-o,i=this.normalizeExecutionError(a,n),c=!!n.settled;this._lastError=i,this._lastDurationMs=u,c||(n.settled={error:i},e.reject(i),this.runHook(this.onSettle,e.ctx,{status:"error",error:i,durationMs:u}))}finally{_optionalChain([e, 'access', _8 => _8.externalSignal, 'optionalAccess', _9 => _9.removeEventListener, 'call', _10 => _10("abort",s)]),this.inFlight.delete(n),this.drainNext(),this.notify()}}drainNext(){if(!this.disposed){if(this.mode==="latest-wins"){if(this.pendingForLatestWins&&this.inFlight.size===0){let e=this.pendingForLatestWins;this.pendingForLatestWins=null,this.execute(e)}return}for(;this.fifoQueue.length>0&&this.inFlight.size<this.maxConcurrent;){let e=this.fifoQueue.shift();this.execute(e)}}}supersede(e){if(e.settled)return;let t=new (0, _chunkRBNF6MNHcjs.d)("Superseded by newer solve",_chunkRBNF6MNHcjs.c.SUPERSEDED,{context:{key:e.ctx.key,enqueuedAt:e.ctx.enqueuedAt}});e.settled={error:t},e.reject(t),this.runHook(this.onSuperseded,e.ctx)}makeAbortError(e){return new (0, _chunkRBNF6MNHcjs.d)("Request aborted by caller",_chunkRBNF6MNHcjs.c.ABORTED,{context:{key:e.key,enqueuedAt:e.enqueuedAt}})}isAbortLikeError(e){if(e instanceof Error){if(e.name==="AbortError")return!0;if(typeof DOMException<"u"&&e instanceof DOMException)return e.name==="AbortError"}return!1}normalizeExecutionError(e,t){return t.settled&&"error"in t.settled?t.settled.error:e instanceof _chunkRBNF6MNHcjs.d?e:this.isAbortLikeError(e)?this.makeAbortError(t.ctx):new (0, _chunkRBNF6MNHcjs.d)(e instanceof Error?e.message:String(e),_chunkRBNF6MNHcjs.c.UNKNOWN_ERROR,{originalError:e instanceof Error?e:new Error(String(e))})}cancelAll(){for(this.pendingForLatestWins&&(this.rejectAsAborted(this.pendingForLatestWins),this.pendingForLatestWins=null);this.fifoQueue.length>0;){let e=this.fifoQueue.shift();this.rejectAsAborted(e)}for(let e of this.inFlight){if(!e.settled){let t=this.makeAbortError(e.ctx);e.settled={error:t},e.reject(t),this.runHook(this.onSettle,e.ctx,{status:"error",error:t,durationMs:e.ctx.startedAt?performance.now()-e.ctx.startedAt:0})}e.controller.abort()}this.notify()}rejectAsAborted(e){if(e.settled)return;let t=this.makeAbortError(e.ctx);e.settled={error:t},e.reject(t)}readCache(e){if(!this.cacheEnabled)return null;let t=this.cache.get(e);return t?this.cacheTtl>0&&Date.now()-t.insertedAt>this.cacheTtl?(this.cache.delete(e),null):(this.cache.delete(e),this.cache.set(e,t),t.response):null}writeCache(e,t){if(this.cacheEnabled)for(this.cache.set(e,{response:t,insertedAt:Date.now()});this.cache.size>this.cacheMax;){let n=this.cache.keys().next().value;if(n===void 0)break;this.cache.delete(n)}}clearCache(){this.cache.clear()}dispose(){this.disposed||(this.disposed=!0,this.cancelAll(),this.subscribers.clear(),this.cache.clear())}runHook(e,...t){if(e)try{e(...t)}catch(n){_chunkRBNF6MNHcjs.e.call(void 0, ).error("[SolveScheduler] hook threw:",n)}}};var x=class r{constructor(e){_chunkRBNF6MNHcjs.b.call(void 0, this,"config");_chunkRBNF6MNHcjs.b.call(void 0, this,"serverStats");_chunkRBNF6MNHcjs.b.call(void 0, this,"disposed",!1);this.config=this.normalizeComputeConfig(e),this.serverStats=new (0, _chunkRBNF6MNHcjs.i)(this.config.serverUrl,this.config.apiKey)}static async create(e){let t=new r(e);if(!await t.serverStats.isServerOnline())throw new (0, _chunkRBNF6MNHcjs.d)("Rhino Compute server is not online",_chunkRBNF6MNHcjs.c.NETWORK_ERROR,{context:{serverUrl:t.config.serverUrl}});return t}getConfig(){return this.ensureNotDisposed(),{...this.config}}async getIO(e){return this.ensureNotDisposed(),E(e,this.config)}async getRawIO(e){return this.ensureNotDisposed(),I(e,this.config)}async solve(e,t,n){this.ensureNotDisposed();try{if(typeof e=="string"&&!_optionalChain([e, 'optionalAccess', _11 => _11.trim, 'call', _12 => _12()]))throw new (0, _chunkRBNF6MNHcjs.d)("Definition URL/content is required",_chunkRBNF6MNHcjs.c.INVALID_INPUT,{context:{receivedUrl:e}});if(e instanceof Uint8Array&&e.length===0)throw new (0, _chunkRBNF6MNHcjs.d)("Definition content is empty",_chunkRBNF6MNHcjs.c.INVALID_INPUT);let s={...this.config,..._optionalChain([n, 'optionalAccess', _13 => _13.signal])!==void 0&&{signal:n.signal},..._optionalChain([n, 'optionalAccess', _14 => _14.timeoutMs])!==void 0&&{timeoutMs:n.timeoutMs},..._optionalChain([n, 'optionalAccess', _15 => _15.retry])!==void 0&&{retry:n.retry}},o=await C(t,e,s);if(_optionalChain([o, 'optionalAccess', _16 => _16.errors])&&o.errors.length>0)throw new (0, _chunkRBNF6MNHcjs.d)(o.errors.join("; ")||"Computation failed",_chunkRBNF6MNHcjs.c.COMPUTATION_ERROR,{context:{definition:typeof e=="string"&&e.length<200?e:"...content...",inputs:t,errors:o.errors,warnings:o.warnings}});return o}catch(s){throw this.config.debug&&_chunkRBNF6MNHcjs.e.call(void 0, ).error("Compute failed:",s),s instanceof _chunkRBNF6MNHcjs.d?s:new (0, _chunkRBNF6MNHcjs.d)(s instanceof Error?s.message:String(s),_chunkRBNF6MNHcjs.c.COMPUTATION_ERROR,{context:{definition:typeof e=="string"&&e.length<200?e:"...content...",inputs:t},originalError:s instanceof Error?s:new Error(String(s))})}}createScheduler(e){this.ensureNotDisposed();let t=(n,s,o)=>C(s,n,o);return new b(t,this.config,e)}async dispose(){this.disposed||(this.disposed=!0,await this.serverStats.dispose())}ensureNotDisposed(){if(this.disposed)throw new (0, _chunkRBNF6MNHcjs.d)("GrasshopperClient has been disposed and cannot be used",_chunkRBNF6MNHcjs.c.INVALID_STATE)}normalizeComputeConfig(e){if(!_optionalChain([e, 'access', _17 => _17.serverUrl, 'optionalAccess', _18 => _18.trim, 'call', _19 => _19()]))throw new (0, _chunkRBNF6MNHcjs.d)("serverUrl is required",_chunkRBNF6MNHcjs.c.INVALID_CONFIG,{context:{receivedServerUrl:e.serverUrl}});try{new URL(e.serverUrl)}catch (e2){throw new (0, _chunkRBNF6MNHcjs.d)("serverUrl must be a valid URL",_chunkRBNF6MNHcjs.c.INVALID_CONFIG,{context:{receivedServerUrl:e.serverUrl}})}if(e.serverUrl===""||e.serverUrl==="https://compute.rhino3d.com/")throw new (0, _chunkRBNF6MNHcjs.d)("serverUrl must be set to your Compute server URL. The default public endpoint is not allowed.",_chunkRBNF6MNHcjs.c.INVALID_CONFIG,{context:{receivedServerUrl:e.serverUrl}});return{...e,serverUrl:e.serverUrl.replace(/\/+$/,""),apiKey:e.apiKey,authToken:e.authToken,debug:_nullishCoalesce(e.debug, () => (!1)),suppressBrowserWarning:_nullishCoalesce(e.suppressBrowserWarning, () => (e.suppressClientSideWarning))}}};var H=async(r,e=null)=>{try{return await K(r,e)}catch(t){throw new (0, _chunkRBNF6MNHcjs.d)("Failed to extract files from compute response",_chunkRBNF6MNHcjs.c.INVALID_STATE,{context:{originalError:t instanceof Error?t.message:String(t)},originalError:t instanceof Error?t:void 0})}},w= exports.e =async(r,e,t=null)=>{if(typeof document>"u"||typeof Blob>"u")throw new (0, _chunkRBNF6MNHcjs.d)("File download functionality is only available in browser environments. This function requires the DOM API (document, Blob).",_chunkRBNF6MNHcjs.c.BROWSER_ONLY,{context:{environment:typeof window<"u"?"browser (SSR)":"Node.js",documentAvailable:typeof document<"u",blobAvailable:typeof Blob<"u"}});try{let n=await K(r,t);await le(n,e)}catch(n){throw n instanceof _chunkRBNF6MNHcjs.d?n:new (0, _chunkRBNF6MNHcjs.d)("Failed to download files from compute response",_chunkRBNF6MNHcjs.c.INVALID_STATE,{context:{originalError:n instanceof Error?n.message:String(n)},originalError:n instanceof Error?n:void 0})}},K=async(r,e)=>{let t=[];if(r.forEach(n=>{let s=`${n.fileName}${n.fileType}`;if(n.subFolder&&n.subFolder.trim()!==""&&(s=`${n.subFolder}/${s}`),n.isBase64Encoded===!0&&n.data){let o=_chunkZRQRYG6Fcjs.c.call(void 0, n.data);t.push({fileName:`${n.fileName}${n.fileType}`,content:new Uint8Array(o.buffer),path:s})}else n.isBase64Encoded===!1&&n.data&&t.push({fileName:`${n.fileName}${n.fileType}`,content:n.data,path:s})}),e){let n=Array.isArray(e)?e:[e],s=await Promise.all(n.map(async o=>{try{let a=await fetch(o.filePath);if(!a.ok)return _chunkRBNF6MNHcjs.e.call(void 0, ).warn(`Failed to fetch additional file from URL: ${o.filePath}`),null;let i=await(await a.blob()).arrayBuffer();return{fileName:o.fileName,content:new Uint8Array(i),path:o.fileName}}catch(a){return _chunkRBNF6MNHcjs.e.call(void 0, ).error(`Error fetching additional file from URL: ${o.filePath}`,a),null}}));t.push(...s.filter(o=>o!==null))}return t};async function le(r,e){let{zipSync:t,strToU8:n}=await Promise.resolve().then(() => _interopRequireWildcard(require("fflate"))),s={};r.forEach(u=>{s[u.path]=typeof u.content=="string"?n(u.content):u.content});let o=t(s,{level:6}),a=new Blob([o],{type:"application/zip"});pe(a,`${e}.zip`)}function pe(r,e){if(typeof document>"u")throw new (0, _chunkRBNF6MNHcjs.d)("saveFile requires a browser environment with DOM API access.",_chunkRBNF6MNHcjs.c.BROWSER_ONLY,{context:{function:"saveFile",requiredAPI:"document"}});let t=document.createElement("a");t.href=URL.createObjectURL(r),t.download=e,t.click(),URL.revokeObjectURL(t.href)}var A=new Map;function Y(r,e){A.set(r,e)}Y("Rhino.Geometry.Point3d",(r,e)=>{let t=e;return!t||typeof t.X!="number"?null:new r.Point([t.X,t.Y,t.Z])});Y("Rhino.Geometry.Line",(r,e)=>{let t=e;return!t||!t.From||!t.To?null:new r.Line([t.From.X,t.From.Y,t.From.Z],[t.To.X,t.To.Y,t.To.Z])});function ce(r){if(A.has(r))return A.get(r);for(let[e,t]of A)if(r.startsWith(e))return t}function fe(r){return!r||typeof r!="object"?null:_nullishCoalesce(_nullishCoalesce(r.data, () => (r.value)), () => (null))}function Q(r,e,t){let n=ce(e);if(n)try{return n(t,r)}catch(s){_chunkRBNF6MNHcjs.e.call(void 0, ).warn(`Failed to decode Rhino type ${e}:`,s)}try{let s=fe(r);if(s)return t.CommonObject.decode(s)}catch(s){return _chunkRBNF6MNHcjs.e.call(void 0, ).warn(`Failed to decode ${e} with CommonObject:`,s),{__decodeError:!0,type:e,raw:r}}return r}var T={STRING:"System.String",INT:"System.Int32",DOUBLE:"System.Double",BOOL:"System.Boolean"},me="Rhino.Geometry.",de=["WebDisplay"],he="FileData";function X(r){return de.some(e=>r.includes(e))}function Z(r){if(typeof r!="string")return r;let e=r.trim();if(!(e.startsWith("{")||e.startsWith("[")||e.startsWith('"')))return r;try{let n=JSON.parse(e);if(typeof n=="string")try{return JSON.parse(n)}catch (e3){return n}return n}catch (e4){return r}}function ye(r,e,t){switch(e){case T.STRING:return typeof r!="string"?r:r.replace(/^"(.*)"$/,"$1");case T.INT:return Number.parseInt(r,10);case T.DOUBLE:return Number.parseFloat(r);case T.BOOL:return String(r).toLowerCase()==="true";default:return t&&e.startsWith(me)?Q(r,e,t):r}}function ee(r,e,t,n){if(typeof r!="string")return r;let s=t?Z(r):r;return ye(s,e,n)}function ge(r){if(!r||typeof r!="object")return!1;let e=r;return typeof e.fileName=="string"&&typeof e.fileType=="string"&&"data"in e&&typeof e.isBase64Encoded=="boolean"&&typeof e.subFolder=="string"}function F(r,e){for(let t of Object.values(r))if(Array.isArray(t))for(let n of t)e(n)}function re(r,e=!1,t={}){let{parseValues:n=!0,rhino:s,stringOnly:o=!1}=t,a={};for(let u of r.values)F(u.InnerTree,i=>{if(X(i.type)||o&&i.type!==T.STRING)return;let c=e?i.id:u.ParamName;if(!c)return;let d=ee(i.data,i.type,n,s);a[c]===void 0?a[c]=d:Array.isArray(a[c])?a[c].push(d):a[c]=[a[c],d]});return{values:a}}function te(r){let e=[];for(let t of r.values)F(t.InnerTree,n=>{if(!n.type.includes(he))return;let s=Z(n.data);ge(s)&&e.push(s)});return e}function O(r,e,t={}){let{parseValues:n=!0,rhino:s,stringOnly:o=!1}=t,a;if("byName"in e?a=r.values.find(i=>i.ParamName===e.byName):a=r.values.find(i=>{let c=!1;return F(i.InnerTree,d=>{d.id===e.byId&&(c=!0)}),c}),!a)return;let u=[];if(F(a.InnerTree,i=>{if("byId"in e&&i.id!==e.byId||X(i.type)||o&&i.type!==T.STRING)return;let c=ee(i.data,i.type,n,s);u.push(c)}),u.length!==0)return u.length===1?u[0]:u}var D=class{constructor(e,t=!1){this.response=e;this.debug=t}getValues(e=!1,t={}){return re(this.response,e,t)}getValue(e,t){return O(this.response,e,t)}getValueByParamName(e,t){return O(this.response,{byName:e},t)}getValueByParamId(e,t){return O(this.response,{byId:e},t)}async extractMeshesFromResponse(e){let t={debug:this.debug,...e},n;try{({getThreeMeshesFromComputeResponse:n}=await Promise.resolve().then(() => _interopRequireWildcard(require("./visualization-TBPFFBFU.cjs"))))}catch(s){throw new (0, _chunkRBNF6MNHcjs.d)("Failed to load three.js visualization module. Ensure three.js is installed as a peer dependency.",_chunkRBNF6MNHcjs.c.INVALID_STATE,{context:{originalError:s instanceof Error?s.message:String(s)}})}return n(this.response,t)}getFileData(){return te(this.response)}getAndDownloadFiles(e,t){let n=this.getFileData();w(n,e,t)}};function N(r,e){e||typeof window<"u"&&_chunkRBNF6MNHcjs.e.call(void 0, ).warn(`Warning: ${r} is running on the client side. For better performance and security, consider running this on the server side.`)}async function C(r,e,t){t.debug&&N("solveGrasshopperDefinition",_nullishCoalesce(t.suppressBrowserWarning, () => (t.suppressClientSideWarning)));let n=M(e,r);be(n,t);let s=await _chunkRBNF6MNHcjs.h.call(void 0, "grasshopper",n,t);if("pointer"in s){let{pointer:o,...a}=s;return a}return s}function M(r,e){let t={algo:null,pointer:null,values:e};return r instanceof Uint8Array?t.algo=_chunkZRQRYG6Fcjs.d.call(void 0, r):/^https?:\/\//i.test(r)?t.pointer=r:_chunkZRQRYG6Fcjs.b.call(void 0, r)?t.algo=r:t.algo=_chunkZRQRYG6Fcjs.a.call(void 0, r),t}function be(r,e){e.cachesolve!=null&&(r.cachesolve=e.cachesolve),e.modelunits!=null&&(r.modelunits=e.modelunits),e.angletolerance!=null&&(r.angletolerance=e.angletolerance),e.absolutetolerance!=null&&(r.absolutetolerance=e.absolutetolerance),e.dataversion!=null&&(r.dataversion=e.dataversion)}function ne(r){if(typeof r.default!="object"||r.default===null)return;if(!("innerTree"in r.default)){_chunkRBNF6MNHcjs.e.call(void 0, ).warn("Unexpected structure in input.default:",r.default),r.default=null;return}let e=r.default.innerTree;if(Object.keys(e).length===0){r.default=void 0;return}if(r.treeAccess||r.atMost&&r.atMost>1){let n={};for(let[s,o]of Object.entries(e))n[s]=o.map(a=>{if(typeof a.data=="string"){if(a.type==="System.Double"||a.type==="System.Int32"){let u=Number(a.data);return Number.isNaN(u)?a.data:u}if(a.type==="System.Boolean")return a.data.toLowerCase()==="true";if(a.type.startsWith("Rhino.Geometry")||a.type==="System.String")try{return JSON.parse(a.data)}catch (e5){return a.data}}return a.data});r.default=n;return}let t=[];for(let n of Object.values(e))Array.isArray(n)&&n.forEach(s=>{s&&typeof s=="object"&&"data"in s&&t.push(s.data)});t.length===0?r.default=void 0:t.length===1?r.default=t[0]:r.default=t}function P(r,e){let{transform:t,setUndefinedOnEmpty:n=!0}=e;if(!(r.default===void 0||r.default===null))if(Array.isArray(r.default)){let s=r.default.map(t).filter(o=>o!==null);r.default=s.length>0?s:void 0}else{let s=t(r.default);s!==null?r.default=s:n&&(r.default=void 0)}}function Te(){return r=>{if(typeof r=="number")return r;if(typeof r=="string"){let e=Number(r.trim());return Number.isNaN(e)?null:e}return null}}function Se(){return r=>{if(typeof r=="boolean")return r;if(typeof r=="string"){let e=r.toLowerCase();if(e==="true")return!0;if(e==="false")return!1;throw new Error(`Invalid boolean string: "${r}"`)}return null}}function xe(){return r=>typeof r=="string"?r.startsWith('"')&&r.endsWith('"')||r.startsWith('"')?r.slice(1,-1):r:null}function Ce(){return r=>{if(typeof r=="string"){let e=r.trim();return e.startsWith('"')&&e.endsWith('"')&&(e=e.slice(1,-1).trim()),e}return null}}function Ie(r){P(r,{transform:Ce(),setUndefinedOnEmpty:!1})}function De(r="unknown"){return e=>{if(typeof e=="object"&&e!==null)return e;if(typeof e=="string"&&e.trim()!=="")try{let t=JSON.parse(e);return typeof t=="object"&&t!==null?t:(_chunkRBNF6MNHcjs.e.call(void 0, ).warn(`Parsed value for input ${r} is not an object`),null)}catch(t){return _chunkRBNF6MNHcjs.e.call(void 0, ).warn(`Failed to parse object value "${e}" for input ${r}`,t),null}return null}}function se(r,e,t){let n=Number(r.toFixed(e));return Math.abs(r-n)<t?n:r}function Pe(r,e=1e-8){if(!Number.isFinite(r)||r===0)return .1;let t=Math.abs(r);if(t>=1){let h=String(r).split(".")[1];if(h&&h.length>0){let y=Math.min(h.length,12),g=Math.pow(10,-y),U=Number(g.toFixed(y));return Math.abs(U-g)<e?U:g}return 1}let n=String(r),s=n.toLowerCase().match(/e(-?\d+)/);if(s){let S=Number(s[1]);if(S<0||n.toLowerCase().includes("e-")){let h=Math.abs(S),y=Math.pow(10,-h),g=Number(y.toFixed(h));return Math.abs(g-y)<e?g:y}return .1}let o=12,u=t.toFixed(o).replace(/0+$/,""),i=Math.min((u.split(".")[1]||"").length,o);if(i===0)return .1;let c=Math.pow(10,-i),d=Number(c.toFixed(i));return Math.abs(d-c)<e?d:c}function oe(r,e=1e-8){let t=r.paramType==="Integer";if(P(r,{transform:Te()}),t){Array.isArray(r.default)?r.default=r.default.map(o=>typeof o=="number"?Math.round(o):o):typeof r.default=="number"&&(r.default=Math.round(r.default)),r.stepSize=1;return}let n=Array.isArray(r.default)?r.default[0]:r.default,s;if(typeof n=="number"&&Number.isFinite(n)&&n!==0?s=n:typeof r.minimum=="number"&&Number.isFinite(r.minimum)&&r.minimum!==0?s=r.minimum:typeof r.maximum=="number"&&Number.isFinite(r.maximum)&&r.maximum!==0&&(s=r.maximum),s!==void 0?r.stepSize=Pe(s,e):r.stepSize=.1,typeof r.stepSize=="number"){let o=0,a=String(r.stepSize),u=a.toLowerCase().match(/e(-?\d+)/);if(u?o=Math.abs(Number(u[1])):o=_nullishCoalesce(_optionalChain([a, 'access', _20 => _20.split, 'call', _21 => _21("."), 'access', _22 => _22[1], 'optionalAccess', _23 => _23.length]), () => (0)),o===0&&typeof n=="number"&&n!==0&&Math.abs(n)<1){let i=Math.ceil(-Math.log10(Math.abs(n)));Number.isFinite(i)&&i>0&&(o=i)}o=Math.min(Math.max(o,0),12),Array.isArray(r.default)?r.default=r.default.map(i=>typeof i=="number"?se(i,o,e):i):typeof r.default=="number"&&(r.default=se(r.default,o,e))}}function ve(r){try{P(r,{transform:Se(),setUndefinedOnEmpty:!1})}catch(e){throw e instanceof Error?new (0, _chunkRBNF6MNHcjs.d)(e.message):e}}function Re(r){P(r,{transform:xe(),setUndefinedOnEmpty:!1})}function ae(r){P(r,{transform:De(r.nickname||"unnamed"),setUndefinedOnEmpty:!0})}function Ee(r){if(!r.values||typeof r.values!="object"||Object.keys(r.values).length===0)throw _chunkRBNF6MNHcjs.d.missingValues(r.nickname||"unnamed","ValueList");if(r.default!==void 0&&r.default!==null){let e=String(r.default).toLowerCase();Object.keys(r.values).some(n=>n.toLowerCase()===e)||_chunkRBNF6MNHcjs.e.call(void 0, ).warn(`ValueList input "${r.nickname||"unnamed"}" default value "${r.default}" is not in available values`)}}var k={Number:oe,Integer:oe,Boolean:ve,Text:Re,ValueList:Ee,Geometry:ae,File:ae,Color:Ie};var we=new Map(Object.keys(k).map(r=>[r.toLowerCase(),r]));function Ae(r){return _nullishCoalesce(we.get(_optionalChain([r, 'optionalAccess', _24 => _24.toLowerCase, 'call', _25 => _25()])), () => (r))}function Fe(r,e){let t=(_nullishCoalesce(r.atMost, () => (1)))>1;switch(r.paramType){case"Number":case"Integer":return{...e,paramType:r.paramType,minimum:r.minimum,maximum:r.maximum,atLeast:r.atLeast,atMost:r.atMost,default:t?[0]:0};case"Boolean":return{...e,paramType:"Boolean",default:t?[!1]:!1};case"Text":return{...e,paramType:"Text",default:t?[""]:""};case"ValueList":return{...e,paramType:"ValueList",values:_nullishCoalesce(r.values, () => ({})),default:t?[r.default]:r.default};case"File":return{...e,paramType:"File",default:t?[null]:null};case"Color":return{...e,paramType:"Color",default:t?["0, 0, 0"]:"0, 0, 0"};default:return{...e,paramType:"Geometry",default:t?[null]:null}}}function ie(r){return B(r).input}function B(r){let e={description:r.description,name:r.name,nickname:r.nickname,treeAccess:r.treeAccess,groupName:_nullishCoalesce(r.groupName, () => ("")),id:r.id};r.paramType=Ae(r.paramType);try{ne(r);let t=k[r.paramType];if(!t)throw _chunkRBNF6MNHcjs.d.unknownParamType(r.paramType,r.name);switch(t(r),r.paramType){case"Number":case"Integer":return{input:{...e,paramType:r.paramType,minimum:r.minimum,maximum:r.maximum,atLeast:r.atLeast,atMost:r.atMost,stepSize:r.stepSize,default:r.default}};case"Boolean":return{input:{...e,paramType:"Boolean",default:r.default}};case"Text":return{input:{...e,paramType:"Text",default:r.default}};case"ValueList":return{input:{...e,paramType:"ValueList",values:r.values,default:r.default}};case"Geometry":return{input:{...e,paramType:r.paramType,default:r.default}};case"File":return{input:{...e,paramType:r.paramType,acceptedFormats:r.acceptedFormats,default:r.default}};case"Color":return{input:{...e,paramType:"Color",default:r.default}};default:throw _chunkRBNF6MNHcjs.d.unknownParamType(r.paramType,r.name)}}catch(t){if(t instanceof _chunkRBNF6MNHcjs.d)return _chunkRBNF6MNHcjs.e.call(void 0, ).error(`Validation error for input ${r.name||"unknown"}:`,t.message),{input:Fe(r,e),error:{inputName:r.name||"unknown",paramType:r.paramType,message:t.message,code:t.code}};throw new (0, _chunkRBNF6MNHcjs.d)(t instanceof Error?t.message:String(t),"VALIDATION_ERROR",{context:{paramName:r.name,paramType:r.paramType},originalError:t instanceof Error?t:new Error(String(t))})}}function ue(r){return V(r).inputs}function V(r){let e=[],t=[];for(let n of r){let{input:s,error:o}=B(n);e.push(s),o&&t.push(o)}return{inputs:e,parseErrors:t}}async function I(r,e){let t=M(r,[]),n={};if(t.algo&&(n.algo=t.algo),t.pointer&&(n.pointer=t.pointer),!n.algo&&!n.pointer)throw new (0, _chunkRBNF6MNHcjs.d)("Definition must resolve to either a URL pointer or base64 algo",_chunkRBNF6MNHcjs.c.INVALID_INPUT,{context:{definition:r}});let s=await _chunkRBNF6MNHcjs.h.call(void 0, "io",n,e);if(!s||typeof s!="object")throw new (0, _chunkRBNF6MNHcjs.d)("Invalid IO response structure",_chunkRBNF6MNHcjs.c.INVALID_INPUT,{context:{response:s,definition:r}});let o=_chunkRBNF6MNHcjs.k.call(void 0, s,{deep:!0});return{inputs:o.inputs,outputs:o.outputs}}async function E(r,e){N("fetchParsedDefinitionIO",_nullishCoalesce(e.suppressBrowserWarning, () => (e.suppressClientSideWarning)));let{inputs:t,outputs:n}=await I(r,e),{inputs:s,parseErrors:o}=V(t);return o.length>0?{inputs:s,outputs:n,parseErrors:o}:{inputs:s,outputs:n}}var G=class r{constructor(e){_chunkRBNF6MNHcjs.b.call(void 0, this,"innerTree");_chunkRBNF6MNHcjs.b.call(void 0, this,"paramName");this.paramName=e,this.innerTree={}}append(e,t){let n=r.formatPathString(e);this.innerTree[n]||(this.innerTree[n]=[]);let s=t.map(o=>({data:r.serializeValue(o)}));return this.innerTree[n].push(...s),this}appendSingle(e,t){return this.append(e,[t])}fromDataTreeDefault(e){this.innerTree={};for(let[t,n]of Object.entries(e)){if(!Array.isArray(n))continue;let s=r.parsePathString(t);this.append(s,n)}return this}appendFlat(e){let t=Array.isArray(e)?e:[e];return this.append([0],t)}flatten(){let e=[];for(let t of Object.values(this.innerTree))if(Array.isArray(t))for(let n of t)e.push(r.deserializeValue(n.data));return e}getPaths(){return Object.keys(this.innerTree)}getPath(e){let t=r.formatPathString(e),n=this.innerTree[t];if(n)return n.map(s=>r.deserializeValue(s.data))}toComputeFormat(){return{ParamName:this.paramName,InnerTree:this.innerTree}}getInnerTree(){return this.innerTree}getParamName(){return this.paramName}static fromInputParams(e){return e.filter(t=>r.hasValidValue(t.default)).map(t=>{let n=new r(t.nickname||"unnamed"),s=t.default;if(t.treeAccess&&r.isDataTreeStructure(s))n.fromDataTreeDefault(s),r.isNumericInput(t)&&n.applyNumericConstraints(t.minimum,t.maximum,t.nickname||"unnamed");else{let o=Array.isArray(s)?s:[s],a=r.processValues(o,t);n.appendFlat(a)}return n.toComputeFormat()})}static fromInputParam(e){return r.hasValidValue(e.default)?r.fromInputParams([e])[0]:void 0}static replaceTreeValue(e,t,n){let s=e.length>0&&e[0]instanceof r,o=r.buildFromValue(t,n);if(s){let c=e,d=c.findIndex(S=>S.getParamName()===t);return d!==-1?c[d]=o:c.push(o),c}let a=e,u=o.toComputeFormat(),i=a.findIndex(c=>c.ParamName===t);return i!==-1?a[i]=u:a.push(u),a}static buildFromValue(e,t){let n=new r(e);return typeof t=="object"&&t!==null&&!Array.isArray(t)&&r.isDataTreeStructure(t)?n.fromDataTreeDefault(t):n.appendFlat(t),n}static getTreeValue(e,t){let s=e.length>0&&e[0]instanceof r?r.readFromBuilders(e,t):r.readFromDataTrees(e,t);return s===null||s.length===0?null:s.length===1?s[0]:s}static readFromBuilders(e,t){let n=e.find(s=>s.getParamName()===t);return n?n.flatten():null}static readFromDataTrees(e,t){let n=e.find(a=>a.ParamName===t);if(!_optionalChain([n, 'optionalAccess', _26 => _26.InnerTree]))return null;let s=Object.keys(n.InnerTree)[0];if(!s)return null;let o=n.InnerTree[s];return Array.isArray(o)?o.map(a=>_optionalChain([a, 'optionalAccess', _27 => _27.data])!==void 0?r.deserializeValue(a.data):null).filter(a=>a!==null):_optionalChain([o, 'optionalAccess', _28 => _28.data])!==void 0?[r.deserializeValue(o.data)]:o!==void 0?[o]:null}static parsePathString(e){let t=e.match(/^\{([\d;]*)\}$/);return t?t[1]===""?[]:t[1].split(";").map(Number):(_chunkRBNF6MNHcjs.e.call(void 0, ).warn(`Invalid TreeBuilder path format: ${e}, using [0]`),[0])}static formatPathString(e){return`{${e.join(";")}}`}applyNumericConstraints(e,t,n){for(let s of Object.values(this.innerTree))if(Array.isArray(s))for(let o of s){let a=r.deserializeValue(o.data);if(typeof a=="number"){let u=r.clampValue(a,e,t,n);o.data=r.serializeValue(u)}}}static serializeValue(e){return typeof e=="boolean"||typeof e=="number"||typeof e=="string"?e:typeof e=="object"&&e!==null?JSON.stringify(e):String(e)}static deserializeValue(e){if(typeof e=="boolean"||typeof e=="number"||typeof e!="string")return e;if(e.startsWith("{")||e.startsWith("["))try{return JSON.parse(e)}catch (e6){return e}return isNaN(Number(e))?e==="true"?!0:e==="false"?!1:e:Number(e)}static hasValidValue(e){return e==null?!1:typeof e=="string"?!0:!(Array.isArray(e)&&e.length===0||typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0)}static isDataTreeStructure(e){return typeof e!="object"||e===null||Array.isArray(e)?!1:Object.entries(e).every(([t,n])=>typeof t=="string"&&/^\{[\d;]+\}$/.test(t)&&Array.isArray(n))}static isNumericInput(e){return e.paramType==="Number"||e.paramType==="Integer"}static processValues(e,t){return e.map(n=>r.isNumericInput(t)&&typeof n=="number"?r.clampValue(n,t.minimum,t.maximum,t.nickname||"unnamed"):n).filter(n=>n!=null)}static clampValue(e,t,n,s){let o=e;return t!=null&&o<t&&(_chunkRBNF6MNHcjs.e.call(void 0, ).warn(`${s}: ${e} below min ${t}, clamping`),o=t),n!=null&&o>n&&(_chunkRBNF6MNHcjs.e.call(void 0, ).warn(`${s}: ${e} above max ${n}, clamping`),o=n),o}};exports.a = R; exports.b = b; exports.c = x; exports.d = H; exports.e = w; exports.f = D; exports.g = C; exports.h = ie; exports.i = ue; exports.j = I; exports.k = E; exports.l = G;
2
- //# sourceMappingURL=chunk-GZYSQSLH.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/home/runner/work/selva-compute/selva-compute/dist/chunk-GZYSQSLH.cjs","../src/features/grasshopper/scheduler/stable-hash.ts"],"names":["stableStringify","value","seen","stringify","v","sample","k"],"mappings":"AAAA,2/BAA6D,wDAAmF,SCShIA,CAAAA,CAAgBC,CAAAA,CAAwB,CACvD,IAAMC,CAAAA,CAAO,IAAI,OAAA,CAEXC,CAAAA,CAAaC,CAAAA,EAAuB,CACzC,EAAA,CAAIA,CAAAA,EAAM,IAAA,CAAyB,OAAO,IAAA,CAAK,SAAA,CAAUA,CAAC,CAAA,CAC1D,EAAA,CAAI,OAAOA,CAAAA,EAAM,QAAA,CAChB,OAAO,MAAA,CAAO,QAAA,CAASA,CAAC,CAAA,CAAI,MAAA,CAAOA,CAAC,CAAA,CAAI,IAAA,CAAK,SAAA,CAAU,IAAI,CAAA,CAE5D,EAAA,CAAI,OAAOA,CAAAA,EAAM,QAAA,EAAY,OAAOA,CAAAA,EAAM,SAAA,CAAW,OAAO,IAAA,CAAK,SAAA,CAAUA,CAAC,CAAA,CAC5E,EAAA,CAAI,OAAOA,CAAAA,EAAM,QAAA,CAAU,OAAO,IAAA,CAAK,SAAA,CAAUA,CAAAA,CAAE,QAAA,CAAS,CAAC,CAAA,CAC7D,EAAA,CAAIA,EAAAA,WAAa,UAAA,CAAY,CAE5B,IAAMC,CAAAA,CACLD,CAAAA,CAAE,MAAA,CAAS,EAAA,CAAK,KAAA,CAAM,IAAA,CAAKA,CAAAA,CAAE,KAAA,CAAM,CAAA,CAAG,EAAE,CAAC,CAAA,CAAE,MAAA,CAAO,KAAA,CAAM,IAAA,CAAKA,CAAAA,CAAE,KAAA,CAAM,CAAA,EAAG,CAAC,CAAC,CAAA,CAAI,KAAA,CAAM,IAAA,CAAKA,CAAC,CAAA,CAC3F,OAAO,IAAA,CAAK,SAAA,CAAU,CAAE,IAAA,CAAM,CAAA,CAAA,CAAM,GAAA,CAAKA,CAAAA,CAAE,MAAA,CAAQ,MAAA,CAAAC,CAAO,CAAC,CAC5D,CACA,OAAI,KAAA,CAAM,OAAA,CAAQD,CAAC,CAAA,CACX,CAAA,CAAA,EAAIA,CAAAA,CAAE,GAAA,CAAID,CAAS,CAAA,CAAE,IAAA,CAAK,GAAG,CAAC,CAAA,CAAA,CAAA,CAElC,OAAOC,CAAAA,EAAM,QAAA,CACZF,CAAAA,CAAK,GAAA,CAAIE,CAAW,CAAA,CAAU,IAAA,CAAK,SAAA,CAAU,YAAY,CAAA,CAAA,CAC7DF,CAAAA,CAAK,GAAA,CAAIE,CAAW,CAAA,CAGb,CAAA,CAAA,EAFM,MAAA,CAAO,IAAA,CAAKA,CAAW,CAAA,CAAE,IAAA,CAAK,CAAA,CACxB,GAAA,CAAKE,CAAAA,EAAM,CAAA,EAAA","file":"/home/runner/work/selva-compute/selva-compute/dist/chunk-GZYSQSLH.cjs","sourcesContent":[null,"/**\n * Stable hashing for solve deduplication and caching.\n * @internal\n */\n\n/**\n * Deterministic stringify with sorted keys. {a:1,b:2} and {b:2,a:1} produce\n * the same string. Safely handles circular references and non-finite numbers.\n */\nexport function stableStringify(value: unknown): string {\n\tconst seen = new WeakSet<object>();\n\n\tconst stringify = (v: unknown): string => {\n\t\tif (v === null || v === undefined) return JSON.stringify(v);\n\t\tif (typeof v === 'number') {\n\t\t\treturn Number.isFinite(v) ? String(v) : JSON.stringify(null);\n\t\t}\n\t\tif (typeof v === 'string' || typeof v === 'boolean') return JSON.stringify(v);\n\t\tif (typeof v === 'bigint') return JSON.stringify(v.toString());\n\t\tif (v instanceof Uint8Array) {\n\t\t\t// Use length + sample instead of full buffer to avoid stringifying large data\n\t\t\tconst sample =\n\t\t\t\tv.length > 64 ? Array.from(v.slice(0, 32)).concat(Array.from(v.slice(-32))) : Array.from(v);\n\t\t\treturn JSON.stringify({ __u8: true, len: v.length, sample });\n\t\t}\n\t\tif (Array.isArray(v)) {\n\t\t\treturn `[${v.map(stringify).join(',')}]`;\n\t\t}\n\t\tif (typeof v === 'object') {\n\t\t\tif (seen.has(v as object)) return JSON.stringify('[Circular]');\n\t\t\tseen.add(v as object);\n\t\t\tconst keys = Object.keys(v as object).sort();\n\t\t\tconst parts = keys.map((k) => `${JSON.stringify(k)}:${stringify((v as any)[k])}`);\n\t\t\treturn `{${parts.join(',')}}`;\n\t\t}\n\t\t// Fallback for functions, symbols, etc.\n\t\treturn JSON.stringify(null);\n\t};\n\n\treturn stringify(value);\n}\n\n/**\n * 32-bit FNV-1a— fast, no dependencies. Returns unsigned hex string.\n */\nexport function fnv1a(input: string): string {\n\tlet hash = 0x811c9dc5;\n\tfor (let i = 0; i < input.length; i++) {\n\t\thash ^= input.charCodeAt(i);\n\t\thash = (hash + ((hash << 1) + (hash << 4) + (hash << 7) + (hash << 8) + (hash << 24))) >>> 0;\n\t}\n\treturn hash.toString(16).padStart(8, '0');\n}\n\n/**\n * Hash definition and data tree into a stable cache key.\n * For Uint8Array, uses length + samples to keep hashing fast.\n */\nexport function hashSolveInput(definition: string | Uint8Array, dataTree: unknown): string {\n\tconst defKey =\n\t\ttypeof definition === 'string'\n\t\t\t? definition\n\t\t\t: stableStringify({ __u8: true, len: definition.length });\n\treturn fnv1a(`${defKey}|${stableStringify(dataTree)}`);\n}\n"]}
@@ -1,2 +0,0 @@
1
- import{a as $,b as z,c as q,d as _}from"./chunk-OW6HV6QP.js";import{b as p,c as f,d as l,e as m,h as v,i as j,k as W}from"./chunk-XBIEAJBK.js";function L(r){let e=new WeakSet,t=n=>{if(n==null)return JSON.stringify(n);if(typeof n=="number")return Number.isFinite(n)?String(n):JSON.stringify(null);if(typeof n=="string"||typeof n=="boolean")return JSON.stringify(n);if(typeof n=="bigint")return JSON.stringify(n.toString());if(n instanceof Uint8Array){let s=n.length>64?Array.from(n.slice(0,32)).concat(Array.from(n.slice(-32))):Array.from(n);return JSON.stringify({__u8:!0,len:n.length,sample:s})}return Array.isArray(n)?`[${n.map(t).join(",")}]`:typeof n=="object"?e.has(n)?JSON.stringify("[Circular]"):(e.add(n),`{${Object.keys(n).sort().map(a=>`${JSON.stringify(a)}:${t(n[a])}`).join(",")}}`):JSON.stringify(null)};return t(r)}function J(r){let e=2166136261;for(let t=0;t<r.length;t++)e^=r.charCodeAt(t),e=e+((e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24))>>>0;return e.toString(16).padStart(8,"0")}function R(r,e){let t=typeof r=="string"?r:L({__u8:!0,len:r.length});return J(`${t}|${L(e)}`)}var b=class{constructor(e,t,n={}){p(this,"executor");p(this,"baseConfig");p(this,"mode");p(this,"maxConcurrent");p(this,"timeoutMs");p(this,"retry");p(this,"cacheEnabled");p(this,"cacheMax");p(this,"cacheTtl");p(this,"cache",new Map);p(this,"onStart");p(this,"onSettle");p(this,"onSuperseded");p(this,"subscribers",new Set);p(this,"inFlight",new Set);p(this,"pendingForLatestWins",null);p(this,"fifoQueue",[]);p(this,"_lastResult",null);p(this,"_lastError",null);p(this,"_lastDurationMs",null);p(this,"disposed",!1);this.executor=e,this.baseConfig=t,this.mode=n.mode??"latest-wins",this.maxConcurrent=Math.max(1,n.maxConcurrent??(this.mode==="parallel"?4:1)),this.timeoutMs=n.timeoutMs,this.retry=n.retry;let s=n.cache;this.cacheEnabled=s!==void 0&&s!==!1;let o=typeof s=="object"?s:{};this.cacheMax=o.maxEntries??50,this.cacheTtl=o.ttlMs??0,this.onStart=n.onStart,this.onSettle=n.onSettle,this.onSuperseded=n.onSuperseded}get isSolving(){return this.inFlight.size>0}get hasPending(){return this.pendingForLatestWins!==null||this.fifoQueue.length>0}get inFlightCount(){return this.inFlight.size}get queueDepth(){return this.fifoQueue.length+(this.pendingForLatestWins?1:0)}get lastResult(){return this._lastResult}get lastError(){return this._lastError}get lastDurationMs(){return this._lastDurationMs}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}notify(){for(let e of this.subscribers)try{e()}catch(t){m().error("[SolveScheduler] subscriber threw:",t)}}solve(e,t,n){if(this.disposed)return Promise.reject(new l("SolveScheduler has been disposed and cannot be used",f.INVALID_STATE));let s=R(e,t),o={key:s,enqueuedAt:Date.now(),startedAt:null};if(this.cacheEnabled){let a=this.readCache(s);if(a){let u={status:"success",response:a,durationMs:0,fromCache:!0};return this._lastResult=a,this._lastError=null,this._lastDurationMs=0,this.runHook(this.onStart,o),this.runHook(this.onSettle,o,u),this.notify(),Promise.resolve(a)}}return new Promise((a,u)=>{let i={definition:e,dataTree:t,ctx:o,resolve:a,reject:u,externalSignal:n?.signal};if(i.externalSignal?.aborted){let c=this.makeAbortError(o);i.settled={error:c},u(c);return}this.enqueue(i)})}enqueue(e){switch(this.mode){case"latest-wins":{this.pendingForLatestWins&&(this.supersede(this.pendingForLatestWins),this.pendingForLatestWins=null);for(let t of this.inFlight)this.supersede(t),t.controller.abort();this.inFlight.size===0?this.execute(e):this.pendingForLatestWins=e;break}case"queue":case"parallel":{this.inFlight.size<this.maxConcurrent?this.execute(e):this.fifoQueue.push(e);break}}this.notify()}async execute(e){let t=new AbortController,n={...e,controller:t};this.inFlight.add(n),e.ctx.startedAt=Date.now();let s=()=>t.abort();e.externalSignal?.addEventListener("abort",s,{once:!0}),this.runHook(this.onStart,e.ctx),this.notify();let o=performance.now();try{let a={...this.baseConfig,signal:t.signal,...this.timeoutMs!==void 0&&{timeoutMs:this.timeoutMs},...this.retry!==void 0&&{retry:this.retry}},u=await this.executor(e.definition,e.dataTree,a),i=performance.now()-o;if(this.cacheEnabled&&this.writeCache(e.ctx.key,u),e.settled)return;e.settled={ok:!0},this._lastResult=u,this._lastError=null,this._lastDurationMs=i,e.resolve(u),this.runHook(this.onSettle,e.ctx,{status:"success",response:u,durationMs:i,fromCache:!1})}catch(a){let u=performance.now()-o,i=this.normalizeExecutionError(a,n),c=!!n.settled;this._lastError=i,this._lastDurationMs=u,c||(n.settled={error:i},e.reject(i),this.runHook(this.onSettle,e.ctx,{status:"error",error:i,durationMs:u}))}finally{e.externalSignal?.removeEventListener("abort",s),this.inFlight.delete(n),this.drainNext(),this.notify()}}drainNext(){if(!this.disposed){if(this.mode==="latest-wins"){if(this.pendingForLatestWins&&this.inFlight.size===0){let e=this.pendingForLatestWins;this.pendingForLatestWins=null,this.execute(e)}return}for(;this.fifoQueue.length>0&&this.inFlight.size<this.maxConcurrent;){let e=this.fifoQueue.shift();this.execute(e)}}}supersede(e){if(e.settled)return;let t=new l("Superseded by newer solve",f.SUPERSEDED,{context:{key:e.ctx.key,enqueuedAt:e.ctx.enqueuedAt}});e.settled={error:t},e.reject(t),this.runHook(this.onSuperseded,e.ctx)}makeAbortError(e){return new l("Request aborted by caller",f.ABORTED,{context:{key:e.key,enqueuedAt:e.enqueuedAt}})}isAbortLikeError(e){if(e instanceof Error){if(e.name==="AbortError")return!0;if(typeof DOMException<"u"&&e instanceof DOMException)return e.name==="AbortError"}return!1}normalizeExecutionError(e,t){return t.settled&&"error"in t.settled?t.settled.error:e instanceof l?e:this.isAbortLikeError(e)?this.makeAbortError(t.ctx):new l(e instanceof Error?e.message:String(e),f.UNKNOWN_ERROR,{originalError:e instanceof Error?e:new Error(String(e))})}cancelAll(){for(this.pendingForLatestWins&&(this.rejectAsAborted(this.pendingForLatestWins),this.pendingForLatestWins=null);this.fifoQueue.length>0;){let e=this.fifoQueue.shift();this.rejectAsAborted(e)}for(let e of this.inFlight){if(!e.settled){let t=this.makeAbortError(e.ctx);e.settled={error:t},e.reject(t),this.runHook(this.onSettle,e.ctx,{status:"error",error:t,durationMs:e.ctx.startedAt?performance.now()-e.ctx.startedAt:0})}e.controller.abort()}this.notify()}rejectAsAborted(e){if(e.settled)return;let t=this.makeAbortError(e.ctx);e.settled={error:t},e.reject(t)}readCache(e){if(!this.cacheEnabled)return null;let t=this.cache.get(e);return t?this.cacheTtl>0&&Date.now()-t.insertedAt>this.cacheTtl?(this.cache.delete(e),null):(this.cache.delete(e),this.cache.set(e,t),t.response):null}writeCache(e,t){if(this.cacheEnabled)for(this.cache.set(e,{response:t,insertedAt:Date.now()});this.cache.size>this.cacheMax;){let n=this.cache.keys().next().value;if(n===void 0)break;this.cache.delete(n)}}clearCache(){this.cache.clear()}dispose(){this.disposed||(this.disposed=!0,this.cancelAll(),this.subscribers.clear(),this.cache.clear())}runHook(e,...t){if(e)try{e(...t)}catch(n){m().error("[SolveScheduler] hook threw:",n)}}};var x=class r{constructor(e){p(this,"config");p(this,"serverStats");p(this,"disposed",!1);this.config=this.normalizeComputeConfig(e),this.serverStats=new j(this.config.serverUrl,this.config.apiKey)}static async create(e){let t=new r(e);if(!await t.serverStats.isServerOnline())throw new l("Rhino Compute server is not online",f.NETWORK_ERROR,{context:{serverUrl:t.config.serverUrl}});return t}getConfig(){return this.ensureNotDisposed(),{...this.config}}async getIO(e){return this.ensureNotDisposed(),E(e,this.config)}async getRawIO(e){return this.ensureNotDisposed(),I(e,this.config)}async solve(e,t,n){this.ensureNotDisposed();try{if(typeof e=="string"&&!e?.trim())throw new l("Definition URL/content is required",f.INVALID_INPUT,{context:{receivedUrl:e}});if(e instanceof Uint8Array&&e.length===0)throw new l("Definition content is empty",f.INVALID_INPUT);let s={...this.config,...n?.signal!==void 0&&{signal:n.signal},...n?.timeoutMs!==void 0&&{timeoutMs:n.timeoutMs},...n?.retry!==void 0&&{retry:n.retry}},o=await C(t,e,s);if(o?.errors&&o.errors.length>0)throw new l(o.errors.join("; ")||"Computation failed",f.COMPUTATION_ERROR,{context:{definition:typeof e=="string"&&e.length<200?e:"...content...",inputs:t,errors:o.errors,warnings:o.warnings}});return o}catch(s){throw this.config.debug&&m().error("Compute failed:",s),s instanceof l?s:new l(s instanceof Error?s.message:String(s),f.COMPUTATION_ERROR,{context:{definition:typeof e=="string"&&e.length<200?e:"...content...",inputs:t},originalError:s instanceof Error?s:new Error(String(s))})}}createScheduler(e){this.ensureNotDisposed();let t=(n,s,o)=>C(s,n,o);return new b(t,this.config,e)}async dispose(){this.disposed||(this.disposed=!0,await this.serverStats.dispose())}ensureNotDisposed(){if(this.disposed)throw new l("GrasshopperClient has been disposed and cannot be used",f.INVALID_STATE)}normalizeComputeConfig(e){if(!e.serverUrl?.trim())throw new l("serverUrl is required",f.INVALID_CONFIG,{context:{receivedServerUrl:e.serverUrl}});try{new URL(e.serverUrl)}catch{throw new l("serverUrl must be a valid URL",f.INVALID_CONFIG,{context:{receivedServerUrl:e.serverUrl}})}if(e.serverUrl===""||e.serverUrl==="https://compute.rhino3d.com/")throw new l("serverUrl must be set to your Compute server URL. The default public endpoint is not allowed.",f.INVALID_CONFIG,{context:{receivedServerUrl:e.serverUrl}});return{...e,serverUrl:e.serverUrl.replace(/\/+$/,""),apiKey:e.apiKey,authToken:e.authToken,debug:e.debug??!1,suppressBrowserWarning:e.suppressBrowserWarning??e.suppressClientSideWarning}}};var H=async(r,e=null)=>{try{return await K(r,e)}catch(t){throw new l("Failed to extract files from compute response",f.INVALID_STATE,{context:{originalError:t instanceof Error?t.message:String(t)},originalError:t instanceof Error?t:void 0})}},w=async(r,e,t=null)=>{if(typeof document>"u"||typeof Blob>"u")throw new l("File download functionality is only available in browser environments. This function requires the DOM API (document, Blob).",f.BROWSER_ONLY,{context:{environment:typeof window<"u"?"browser (SSR)":"Node.js",documentAvailable:typeof document<"u",blobAvailable:typeof Blob<"u"}});try{let n=await K(r,t);await le(n,e)}catch(n){throw n instanceof l?n:new l("Failed to download files from compute response",f.INVALID_STATE,{context:{originalError:n instanceof Error?n.message:String(n)},originalError:n instanceof Error?n:void 0})}},K=async(r,e)=>{let t=[];if(r.forEach(n=>{let s=`${n.fileName}${n.fileType}`;if(n.subFolder&&n.subFolder.trim()!==""&&(s=`${n.subFolder}/${s}`),n.isBase64Encoded===!0&&n.data){let o=q(n.data);t.push({fileName:`${n.fileName}${n.fileType}`,content:new Uint8Array(o.buffer),path:s})}else n.isBase64Encoded===!1&&n.data&&t.push({fileName:`${n.fileName}${n.fileType}`,content:n.data,path:s})}),e){let n=Array.isArray(e)?e:[e],s=await Promise.all(n.map(async o=>{try{let a=await fetch(o.filePath);if(!a.ok)return m().warn(`Failed to fetch additional file from URL: ${o.filePath}`),null;let i=await(await a.blob()).arrayBuffer();return{fileName:o.fileName,content:new Uint8Array(i),path:o.fileName}}catch(a){return m().error(`Error fetching additional file from URL: ${o.filePath}`,a),null}}));t.push(...s.filter(o=>o!==null))}return t};async function le(r,e){let{zipSync:t,strToU8:n}=await import("fflate"),s={};r.forEach(u=>{s[u.path]=typeof u.content=="string"?n(u.content):u.content});let o=t(s,{level:6}),a=new Blob([o],{type:"application/zip"});pe(a,`${e}.zip`)}function pe(r,e){if(typeof document>"u")throw new l("saveFile requires a browser environment with DOM API access.",f.BROWSER_ONLY,{context:{function:"saveFile",requiredAPI:"document"}});let t=document.createElement("a");t.href=URL.createObjectURL(r),t.download=e,t.click(),URL.revokeObjectURL(t.href)}var A=new Map;function Y(r,e){A.set(r,e)}Y("Rhino.Geometry.Point3d",(r,e)=>{let t=e;return!t||typeof t.X!="number"?null:new r.Point([t.X,t.Y,t.Z])});Y("Rhino.Geometry.Line",(r,e)=>{let t=e;return!t||!t.From||!t.To?null:new r.Line([t.From.X,t.From.Y,t.From.Z],[t.To.X,t.To.Y,t.To.Z])});function ce(r){if(A.has(r))return A.get(r);for(let[e,t]of A)if(r.startsWith(e))return t}function fe(r){return!r||typeof r!="object"?null:r.data??r.value??null}function Q(r,e,t){let n=ce(e);if(n)try{return n(t,r)}catch(s){m().warn(`Failed to decode Rhino type ${e}:`,s)}try{let s=fe(r);if(s)return t.CommonObject.decode(s)}catch(s){return m().warn(`Failed to decode ${e} with CommonObject:`,s),{__decodeError:!0,type:e,raw:r}}return r}var T={STRING:"System.String",INT:"System.Int32",DOUBLE:"System.Double",BOOL:"System.Boolean"},me="Rhino.Geometry.",de=["WebDisplay"],he="FileData";function X(r){return de.some(e=>r.includes(e))}function Z(r){if(typeof r!="string")return r;let e=r.trim();if(!(e.startsWith("{")||e.startsWith("[")||e.startsWith('"')))return r;try{let n=JSON.parse(e);if(typeof n=="string")try{return JSON.parse(n)}catch{return n}return n}catch{return r}}function ye(r,e,t){switch(e){case T.STRING:return typeof r!="string"?r:r.replace(/^"(.*)"$/,"$1");case T.INT:return Number.parseInt(r,10);case T.DOUBLE:return Number.parseFloat(r);case T.BOOL:return String(r).toLowerCase()==="true";default:return t&&e.startsWith(me)?Q(r,e,t):r}}function ee(r,e,t,n){if(typeof r!="string")return r;let s=t?Z(r):r;return ye(s,e,n)}function ge(r){if(!r||typeof r!="object")return!1;let e=r;return typeof e.fileName=="string"&&typeof e.fileType=="string"&&"data"in e&&typeof e.isBase64Encoded=="boolean"&&typeof e.subFolder=="string"}function F(r,e){for(let t of Object.values(r))if(Array.isArray(t))for(let n of t)e(n)}function re(r,e=!1,t={}){let{parseValues:n=!0,rhino:s,stringOnly:o=!1}=t,a={};for(let u of r.values)F(u.InnerTree,i=>{if(X(i.type)||o&&i.type!==T.STRING)return;let c=e?i.id:u.ParamName;if(!c)return;let d=ee(i.data,i.type,n,s);a[c]===void 0?a[c]=d:Array.isArray(a[c])?a[c].push(d):a[c]=[a[c],d]});return{values:a}}function te(r){let e=[];for(let t of r.values)F(t.InnerTree,n=>{if(!n.type.includes(he))return;let s=Z(n.data);ge(s)&&e.push(s)});return e}function O(r,e,t={}){let{parseValues:n=!0,rhino:s,stringOnly:o=!1}=t,a;if("byName"in e?a=r.values.find(i=>i.ParamName===e.byName):a=r.values.find(i=>{let c=!1;return F(i.InnerTree,d=>{d.id===e.byId&&(c=!0)}),c}),!a)return;let u=[];if(F(a.InnerTree,i=>{if("byId"in e&&i.id!==e.byId||X(i.type)||o&&i.type!==T.STRING)return;let c=ee(i.data,i.type,n,s);u.push(c)}),u.length!==0)return u.length===1?u[0]:u}var D=class{constructor(e,t=!1){this.response=e;this.debug=t}getValues(e=!1,t={}){return re(this.response,e,t)}getValue(e,t){return O(this.response,e,t)}getValueByParamName(e,t){return O(this.response,{byName:e},t)}getValueByParamId(e,t){return O(this.response,{byId:e},t)}async extractMeshesFromResponse(e){let t={debug:this.debug,...e},n;try{({getThreeMeshesFromComputeResponse:n}=await import("./visualization-ENMBHWIN.js"))}catch(s){throw new l("Failed to load three.js visualization module. Ensure three.js is installed as a peer dependency.",f.INVALID_STATE,{context:{originalError:s instanceof Error?s.message:String(s)}})}return n(this.response,t)}getFileData(){return te(this.response)}getAndDownloadFiles(e,t){let n=this.getFileData();w(n,e,t)}};function N(r,e){e||typeof window<"u"&&m().warn(`Warning: ${r} is running on the client side. For better performance and security, consider running this on the server side.`)}async function C(r,e,t){t.debug&&N("solveGrasshopperDefinition",t.suppressBrowserWarning??t.suppressClientSideWarning);let n=M(e,r);be(n,t);let s=await v("grasshopper",n,t);if("pointer"in s){let{pointer:o,...a}=s;return a}return s}function M(r,e){let t={algo:null,pointer:null,values:e};return r instanceof Uint8Array?t.algo=_(r):/^https?:\/\//i.test(r)?t.pointer=r:z(r)?t.algo=r:t.algo=$(r),t}function be(r,e){e.cachesolve!=null&&(r.cachesolve=e.cachesolve),e.modelunits!=null&&(r.modelunits=e.modelunits),e.angletolerance!=null&&(r.angletolerance=e.angletolerance),e.absolutetolerance!=null&&(r.absolutetolerance=e.absolutetolerance),e.dataversion!=null&&(r.dataversion=e.dataversion)}function ne(r){if(typeof r.default!="object"||r.default===null)return;if(!("innerTree"in r.default)){m().warn("Unexpected structure in input.default:",r.default),r.default=null;return}let e=r.default.innerTree;if(Object.keys(e).length===0){r.default=void 0;return}if(r.treeAccess||r.atMost&&r.atMost>1){let n={};for(let[s,o]of Object.entries(e))n[s]=o.map(a=>{if(typeof a.data=="string"){if(a.type==="System.Double"||a.type==="System.Int32"){let u=Number(a.data);return Number.isNaN(u)?a.data:u}if(a.type==="System.Boolean")return a.data.toLowerCase()==="true";if(a.type.startsWith("Rhino.Geometry")||a.type==="System.String")try{return JSON.parse(a.data)}catch{return a.data}}return a.data});r.default=n;return}let t=[];for(let n of Object.values(e))Array.isArray(n)&&n.forEach(s=>{s&&typeof s=="object"&&"data"in s&&t.push(s.data)});t.length===0?r.default=void 0:t.length===1?r.default=t[0]:r.default=t}function P(r,e){let{transform:t,setUndefinedOnEmpty:n=!0}=e;if(!(r.default===void 0||r.default===null))if(Array.isArray(r.default)){let s=r.default.map(t).filter(o=>o!==null);r.default=s.length>0?s:void 0}else{let s=t(r.default);s!==null?r.default=s:n&&(r.default=void 0)}}function Te(){return r=>{if(typeof r=="number")return r;if(typeof r=="string"){let e=Number(r.trim());return Number.isNaN(e)?null:e}return null}}function Se(){return r=>{if(typeof r=="boolean")return r;if(typeof r=="string"){let e=r.toLowerCase();if(e==="true")return!0;if(e==="false")return!1;throw new Error(`Invalid boolean string: "${r}"`)}return null}}function xe(){return r=>typeof r=="string"?r.startsWith('"')&&r.endsWith('"')||r.startsWith('"')?r.slice(1,-1):r:null}function Ce(){return r=>{if(typeof r=="string"){let e=r.trim();return e.startsWith('"')&&e.endsWith('"')&&(e=e.slice(1,-1).trim()),e}return null}}function Ie(r){P(r,{transform:Ce(),setUndefinedOnEmpty:!1})}function De(r="unknown"){return e=>{if(typeof e=="object"&&e!==null)return e;if(typeof e=="string"&&e.trim()!=="")try{let t=JSON.parse(e);return typeof t=="object"&&t!==null?t:(m().warn(`Parsed value for input ${r} is not an object`),null)}catch(t){return m().warn(`Failed to parse object value "${e}" for input ${r}`,t),null}return null}}function se(r,e,t){let n=Number(r.toFixed(e));return Math.abs(r-n)<t?n:r}function Pe(r,e=1e-8){if(!Number.isFinite(r)||r===0)return .1;let t=Math.abs(r);if(t>=1){let h=String(r).split(".")[1];if(h&&h.length>0){let y=Math.min(h.length,12),g=Math.pow(10,-y),U=Number(g.toFixed(y));return Math.abs(U-g)<e?U:g}return 1}let n=String(r),s=n.toLowerCase().match(/e(-?\d+)/);if(s){let S=Number(s[1]);if(S<0||n.toLowerCase().includes("e-")){let h=Math.abs(S),y=Math.pow(10,-h),g=Number(y.toFixed(h));return Math.abs(g-y)<e?g:y}return .1}let o=12,u=t.toFixed(o).replace(/0+$/,""),i=Math.min((u.split(".")[1]||"").length,o);if(i===0)return .1;let c=Math.pow(10,-i),d=Number(c.toFixed(i));return Math.abs(d-c)<e?d:c}function oe(r,e=1e-8){let t=r.paramType==="Integer";if(P(r,{transform:Te()}),t){Array.isArray(r.default)?r.default=r.default.map(o=>typeof o=="number"?Math.round(o):o):typeof r.default=="number"&&(r.default=Math.round(r.default)),r.stepSize=1;return}let n=Array.isArray(r.default)?r.default[0]:r.default,s;if(typeof n=="number"&&Number.isFinite(n)&&n!==0?s=n:typeof r.minimum=="number"&&Number.isFinite(r.minimum)&&r.minimum!==0?s=r.minimum:typeof r.maximum=="number"&&Number.isFinite(r.maximum)&&r.maximum!==0&&(s=r.maximum),s!==void 0?r.stepSize=Pe(s,e):r.stepSize=.1,typeof r.stepSize=="number"){let o=0,a=String(r.stepSize),u=a.toLowerCase().match(/e(-?\d+)/);if(u?o=Math.abs(Number(u[1])):o=a.split(".")[1]?.length??0,o===0&&typeof n=="number"&&n!==0&&Math.abs(n)<1){let i=Math.ceil(-Math.log10(Math.abs(n)));Number.isFinite(i)&&i>0&&(o=i)}o=Math.min(Math.max(o,0),12),Array.isArray(r.default)?r.default=r.default.map(i=>typeof i=="number"?se(i,o,e):i):typeof r.default=="number"&&(r.default=se(r.default,o,e))}}function ve(r){try{P(r,{transform:Se(),setUndefinedOnEmpty:!1})}catch(e){throw e instanceof Error?new l(e.message):e}}function Re(r){P(r,{transform:xe(),setUndefinedOnEmpty:!1})}function ae(r){P(r,{transform:De(r.nickname||"unnamed"),setUndefinedOnEmpty:!0})}function Ee(r){if(!r.values||typeof r.values!="object"||Object.keys(r.values).length===0)throw l.missingValues(r.nickname||"unnamed","ValueList");if(r.default!==void 0&&r.default!==null){let e=String(r.default).toLowerCase();Object.keys(r.values).some(n=>n.toLowerCase()===e)||m().warn(`ValueList input "${r.nickname||"unnamed"}" default value "${r.default}" is not in available values`)}}var k={Number:oe,Integer:oe,Boolean:ve,Text:Re,ValueList:Ee,Geometry:ae,File:ae,Color:Ie};var we=new Map(Object.keys(k).map(r=>[r.toLowerCase(),r]));function Ae(r){return we.get(r?.toLowerCase())??r}function Fe(r,e){let t=(r.atMost??1)>1;switch(r.paramType){case"Number":case"Integer":return{...e,paramType:r.paramType,minimum:r.minimum,maximum:r.maximum,atLeast:r.atLeast,atMost:r.atMost,default:t?[0]:0};case"Boolean":return{...e,paramType:"Boolean",default:t?[!1]:!1};case"Text":return{...e,paramType:"Text",default:t?[""]:""};case"ValueList":return{...e,paramType:"ValueList",values:r.values??{},default:t?[r.default]:r.default};case"File":return{...e,paramType:"File",default:t?[null]:null};case"Color":return{...e,paramType:"Color",default:t?["0, 0, 0"]:"0, 0, 0"};default:return{...e,paramType:"Geometry",default:t?[null]:null}}}function ie(r){return B(r).input}function B(r){let e={description:r.description,name:r.name,nickname:r.nickname,treeAccess:r.treeAccess,groupName:r.groupName??"",id:r.id};r.paramType=Ae(r.paramType);try{ne(r);let t=k[r.paramType];if(!t)throw l.unknownParamType(r.paramType,r.name);switch(t(r),r.paramType){case"Number":case"Integer":return{input:{...e,paramType:r.paramType,minimum:r.minimum,maximum:r.maximum,atLeast:r.atLeast,atMost:r.atMost,stepSize:r.stepSize,default:r.default}};case"Boolean":return{input:{...e,paramType:"Boolean",default:r.default}};case"Text":return{input:{...e,paramType:"Text",default:r.default}};case"ValueList":return{input:{...e,paramType:"ValueList",values:r.values,default:r.default}};case"Geometry":return{input:{...e,paramType:r.paramType,default:r.default}};case"File":return{input:{...e,paramType:r.paramType,acceptedFormats:r.acceptedFormats,default:r.default}};case"Color":return{input:{...e,paramType:"Color",default:r.default}};default:throw l.unknownParamType(r.paramType,r.name)}}catch(t){if(t instanceof l)return m().error(`Validation error for input ${r.name||"unknown"}:`,t.message),{input:Fe(r,e),error:{inputName:r.name||"unknown",paramType:r.paramType,message:t.message,code:t.code}};throw new l(t instanceof Error?t.message:String(t),"VALIDATION_ERROR",{context:{paramName:r.name,paramType:r.paramType},originalError:t instanceof Error?t:new Error(String(t))})}}function ue(r){return V(r).inputs}function V(r){let e=[],t=[];for(let n of r){let{input:s,error:o}=B(n);e.push(s),o&&t.push(o)}return{inputs:e,parseErrors:t}}async function I(r,e){let t=M(r,[]),n={};if(t.algo&&(n.algo=t.algo),t.pointer&&(n.pointer=t.pointer),!n.algo&&!n.pointer)throw new l("Definition must resolve to either a URL pointer or base64 algo",f.INVALID_INPUT,{context:{definition:r}});let s=await v("io",n,e);if(!s||typeof s!="object")throw new l("Invalid IO response structure",f.INVALID_INPUT,{context:{response:s,definition:r}});let o=W(s,{deep:!0});return{inputs:o.inputs,outputs:o.outputs}}async function E(r,e){N("fetchParsedDefinitionIO",e.suppressBrowserWarning??e.suppressClientSideWarning);let{inputs:t,outputs:n}=await I(r,e),{inputs:s,parseErrors:o}=V(t);return o.length>0?{inputs:s,outputs:n,parseErrors:o}:{inputs:s,outputs:n}}var G=class r{constructor(e){p(this,"innerTree");p(this,"paramName");this.paramName=e,this.innerTree={}}append(e,t){let n=r.formatPathString(e);this.innerTree[n]||(this.innerTree[n]=[]);let s=t.map(o=>({data:r.serializeValue(o)}));return this.innerTree[n].push(...s),this}appendSingle(e,t){return this.append(e,[t])}fromDataTreeDefault(e){this.innerTree={};for(let[t,n]of Object.entries(e)){if(!Array.isArray(n))continue;let s=r.parsePathString(t);this.append(s,n)}return this}appendFlat(e){let t=Array.isArray(e)?e:[e];return this.append([0],t)}flatten(){let e=[];for(let t of Object.values(this.innerTree))if(Array.isArray(t))for(let n of t)e.push(r.deserializeValue(n.data));return e}getPaths(){return Object.keys(this.innerTree)}getPath(e){let t=r.formatPathString(e),n=this.innerTree[t];if(n)return n.map(s=>r.deserializeValue(s.data))}toComputeFormat(){return{ParamName:this.paramName,InnerTree:this.innerTree}}getInnerTree(){return this.innerTree}getParamName(){return this.paramName}static fromInputParams(e){return e.filter(t=>r.hasValidValue(t.default)).map(t=>{let n=new r(t.nickname||"unnamed"),s=t.default;if(t.treeAccess&&r.isDataTreeStructure(s))n.fromDataTreeDefault(s),r.isNumericInput(t)&&n.applyNumericConstraints(t.minimum,t.maximum,t.nickname||"unnamed");else{let o=Array.isArray(s)?s:[s],a=r.processValues(o,t);n.appendFlat(a)}return n.toComputeFormat()})}static fromInputParam(e){return r.hasValidValue(e.default)?r.fromInputParams([e])[0]:void 0}static replaceTreeValue(e,t,n){let s=e.length>0&&e[0]instanceof r,o=r.buildFromValue(t,n);if(s){let c=e,d=c.findIndex(S=>S.getParamName()===t);return d!==-1?c[d]=o:c.push(o),c}let a=e,u=o.toComputeFormat(),i=a.findIndex(c=>c.ParamName===t);return i!==-1?a[i]=u:a.push(u),a}static buildFromValue(e,t){let n=new r(e);return typeof t=="object"&&t!==null&&!Array.isArray(t)&&r.isDataTreeStructure(t)?n.fromDataTreeDefault(t):n.appendFlat(t),n}static getTreeValue(e,t){let s=e.length>0&&e[0]instanceof r?r.readFromBuilders(e,t):r.readFromDataTrees(e,t);return s===null||s.length===0?null:s.length===1?s[0]:s}static readFromBuilders(e,t){let n=e.find(s=>s.getParamName()===t);return n?n.flatten():null}static readFromDataTrees(e,t){let n=e.find(a=>a.ParamName===t);if(!n?.InnerTree)return null;let s=Object.keys(n.InnerTree)[0];if(!s)return null;let o=n.InnerTree[s];return Array.isArray(o)?o.map(a=>a?.data!==void 0?r.deserializeValue(a.data):null).filter(a=>a!==null):o?.data!==void 0?[r.deserializeValue(o.data)]:o!==void 0?[o]:null}static parsePathString(e){let t=e.match(/^\{([\d;]*)\}$/);return t?t[1]===""?[]:t[1].split(";").map(Number):(m().warn(`Invalid TreeBuilder path format: ${e}, using [0]`),[0])}static formatPathString(e){return`{${e.join(";")}}`}applyNumericConstraints(e,t,n){for(let s of Object.values(this.innerTree))if(Array.isArray(s))for(let o of s){let a=r.deserializeValue(o.data);if(typeof a=="number"){let u=r.clampValue(a,e,t,n);o.data=r.serializeValue(u)}}}static serializeValue(e){return typeof e=="boolean"||typeof e=="number"||typeof e=="string"?e:typeof e=="object"&&e!==null?JSON.stringify(e):String(e)}static deserializeValue(e){if(typeof e=="boolean"||typeof e=="number"||typeof e!="string")return e;if(e.startsWith("{")||e.startsWith("["))try{return JSON.parse(e)}catch{return e}return isNaN(Number(e))?e==="true"?!0:e==="false"?!1:e:Number(e)}static hasValidValue(e){return e==null?!1:typeof e=="string"?!0:!(Array.isArray(e)&&e.length===0||typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0)}static isDataTreeStructure(e){return typeof e!="object"||e===null||Array.isArray(e)?!1:Object.entries(e).every(([t,n])=>typeof t=="string"&&/^\{[\d;]+\}$/.test(t)&&Array.isArray(n))}static isNumericInput(e){return e.paramType==="Number"||e.paramType==="Integer"}static processValues(e,t){return e.map(n=>r.isNumericInput(t)&&typeof n=="number"?r.clampValue(n,t.minimum,t.maximum,t.nickname||"unnamed"):n).filter(n=>n!=null)}static clampValue(e,t,n,s){let o=e;return t!=null&&o<t&&(m().warn(`${s}: ${e} below min ${t}, clamping`),o=t),n!=null&&o>n&&(m().warn(`${s}: ${e} above max ${n}, clamping`),o=n),o}};export{R as a,b,x as c,H as d,w as e,D as f,C as g,ie as h,ue as i,I as j,E as k,G as l};
2
- //# sourceMappingURL=chunk-JZYEMZZ5.js.map