@selvajs/compute 4.0.0-beta.8 → 4.0.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.
- package/dist/{core-Bb-B_3XN.js → core-BQtRL5GE.js} +3 -3
- package/dist/{core-Bb-B_3XN.js.map → core-BQtRL5GE.js.map} +1 -1
- package/dist/core-DdSvCuFX.cjs +3 -0
- package/dist/{core-Bx_1_H10.cjs.map → core-DdSvCuFX.cjs.map} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +1 -1
- package/dist/grasshopper.cjs +1 -1
- package/dist/grasshopper.cjs.map +1 -1
- package/dist/grasshopper.d.cts +52 -2
- package/dist/grasshopper.d.ts +52 -2
- package/dist/grasshopper.js +1 -1
- package/dist/grasshopper.js.map +1 -1
- package/dist/{index-cUZsorKK.d.ts → index-C7Olveh2.d.cts} +21 -2
- package/dist/{index-cUZsorKK.d.cts → index-C7Olveh2.d.ts} +21 -2
- package/package.json +6 -6
- package/dist/core-Bx_1_H10.cjs +0 -3
package/dist/grasshopper.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { E as RetryPolicy, T as ComputeConfig, a as extractFilesFromComputeResponse, c as ProcessedFile, f as DefinitionRef, k as ComputeError, m as isDefinitionRef, o as FileBaseInfo, p as SolveDefinition, r as downloadFileData, s as FileData } from "./index-C7Olveh2.cjs";
|
|
2
2
|
//#region src/grasshopper/server/compute-server-stats.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* ComputeServerStats provides methods to query Rhino Compute server statistics.
|
|
@@ -1387,6 +1387,56 @@ interface SchemaEndpointResult<TSchema = unknown> {
|
|
|
1387
1387
|
*/
|
|
1388
1388
|
declare function readSchemaResults<TSchema = unknown>(raw: unknown): SchemaEndpointResult<TSchema>[];
|
|
1389
1389
|
//#endregion
|
|
1390
|
+
//#region src/grasshopper/io/normalize-ui-schema.d.ts
|
|
1391
|
+
/**
|
|
1392
|
+
* Canonicalize a `/grasshopper/schema` body's key CASING.
|
|
1393
|
+
*
|
|
1394
|
+
* ## Why this exists
|
|
1395
|
+
*
|
|
1396
|
+
* Compute serializes the plugin's `UISchema` POCO, whose camelCase wire names
|
|
1397
|
+
* live in Newtonsoft `[JsonProperty]` attributes. `Selva.gha` ILRepack-merges
|
|
1398
|
+
* Newtonsoft into itself, so those attributes have type
|
|
1399
|
+
* `Selva!Newtonsoft.Json.JsonPropertyAttribute`. When the serializer that runs is
|
|
1400
|
+
* compute's OWN Newtonsoft assembly, it does not recognize that type as its own
|
|
1401
|
+
* attribute, reads no attributes at all, and falls back to raw CLR member names —
|
|
1402
|
+
* emitting `Inputs`/`Layout`/`SchemaVersion`.
|
|
1403
|
+
*
|
|
1404
|
+
* Nothing throws on the wire. Every consumer reads `schema.inputs` as
|
|
1405
|
+
* `undefined`, so the definition renders with no inputs, and `schemaVersion`
|
|
1406
|
+
* reads `undefined` — which also silently disables the newer-plugin version gate.
|
|
1407
|
+
*
|
|
1408
|
+
* This is the schema-body counterpart to {@link normalizeInputSchema}, which
|
|
1409
|
+
* solves the same split for the `/io` endpoint's param records.
|
|
1410
|
+
*
|
|
1411
|
+
* ## Why a casing rule, and not a key allowlist
|
|
1412
|
+
*
|
|
1413
|
+
* The wire names are the CLR names run through Newtonsoft's camelCase strategy,
|
|
1414
|
+
* so reproducing that strategy covers every key. An allowlist would have to
|
|
1415
|
+
* enumerate every structural key in `UISchema` and drift out of date each time
|
|
1416
|
+
* the schema gains a field, failing silently and in exactly this way again.
|
|
1417
|
+
*
|
|
1418
|
+
* ## What it does NOT touch
|
|
1419
|
+
*
|
|
1420
|
+
* `options`, `defaultOptions` and `values` hold USER-AUTHORED keys — dropdown
|
|
1421
|
+
* labels like `"Standart Beschichtung"`, `"Use 10 Elements instead"`, `"True"`.
|
|
1422
|
+
* Those maps are copied verbatim; only the key naming them is canonicalized.
|
|
1423
|
+
* Rewriting their contents is the exact regression that motivated deleting the
|
|
1424
|
+
* old global `camelcaseKeys` pass (see `read-field.ts`), which mangled
|
|
1425
|
+
* `"Option A"` into `"optionA"` and silently changed what a definition solved
|
|
1426
|
+
* with.
|
|
1427
|
+
*
|
|
1428
|
+
* Values are never inspected — only object keys are rewritten.
|
|
1429
|
+
*/
|
|
1430
|
+
/**
|
|
1431
|
+
* Returns a schema whose structural keys are camelCase, regardless of which
|
|
1432
|
+
* Newtonsoft serialized it. A body that is already camelCase passes through
|
|
1433
|
+
* unchanged in shape (it is still rebuilt, so the result is always a fresh
|
|
1434
|
+
* object the caller may mutate).
|
|
1435
|
+
*
|
|
1436
|
+
* Safe to call on any parsed JSON value; non-objects are returned as-is.
|
|
1437
|
+
*/
|
|
1438
|
+
declare function normalizeUISchemaCasing<T>(raw: T): T;
|
|
1439
|
+
//#endregion
|
|
1390
1440
|
//#region src/grasshopper/io/input/input-processors.d.ts
|
|
1391
1441
|
/**
|
|
1392
1442
|
* Parse one raw Grasshopper input schema into a typed {@link InputParam}.
|
|
@@ -1668,5 +1718,5 @@ declare class TreeBuilder {
|
|
|
1668
1718
|
private static clampValue;
|
|
1669
1719
|
}
|
|
1670
1720
|
//#endregion
|
|
1671
|
-
export { type BooleanInputType, type CacheOptions, ComputeServerStats, type DataItem, type DataTree, type DataTreeDefault, type DataTreePath, type DataTreeValue, type DefaultValue, type DefinitionRef, type FileBaseInfo, type FileData, type FileInputType, type GeometryInputType, type GetValuesOptions, type GetValuesResult, GrasshopperClient, type GrasshopperComputeConfig, type GrasshopperComputeResponse, type GrasshopperParsedIO, type GrasshopperParsedIORaw, type GrasshopperRequestSchema, GrasshopperResponseProcessor, type InnerTreeData, type InputParam, type InputParamSchema, type NumericInputType, type OutputParamSchema, type OutputType, type ParsedContext, type ProcessedFile, type RhinoModelUnit, type SchedulerMode, type SchemaEndpointResult, type SolveContext, type SolveDefinition, type SolveOptions, type SolveResult, SolveScheduler, type SolveSchedulerOptions, type TextInputType, TreeBuilder, type ValueListInputType, downloadFileData, extractFilesFromComputeResponse, fetchDefinitionIO, fetchParsedDefinitionIO, hashDefinition, hashSolveInput, isDefinitionRef, processInput, readSchemaResults, solveGrasshopperDefinition, stableStringify };
|
|
1721
|
+
export { type BooleanInputType, type CacheOptions, ComputeServerStats, type DataItem, type DataTree, type DataTreeDefault, type DataTreePath, type DataTreeValue, type DefaultValue, type DefinitionRef, type FileBaseInfo, type FileData, type FileInputType, type GeometryInputType, type GetValuesOptions, type GetValuesResult, GrasshopperClient, type GrasshopperComputeConfig, type GrasshopperComputeResponse, type GrasshopperParsedIO, type GrasshopperParsedIORaw, type GrasshopperRequestSchema, GrasshopperResponseProcessor, type InnerTreeData, type InputParam, type InputParamSchema, type NumericInputType, type OutputParamSchema, type OutputType, type ParsedContext, type ProcessedFile, type RhinoModelUnit, type SchedulerMode, type SchemaEndpointResult, type SolveContext, type SolveDefinition, type SolveOptions, type SolveResult, SolveScheduler, type SolveSchedulerOptions, type TextInputType, TreeBuilder, type ValueListInputType, downloadFileData, extractFilesFromComputeResponse, fetchDefinitionIO, fetchParsedDefinitionIO, hashDefinition, hashSolveInput, isDefinitionRef, normalizeUISchemaCasing, processInput, readSchemaResults, solveGrasshopperDefinition, stableStringify };
|
|
1672
1722
|
//# sourceMappingURL=grasshopper.d.cts.map
|
package/dist/grasshopper.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { E as RetryPolicy, T as ComputeConfig, a as extractFilesFromComputeResponse, c as ProcessedFile, f as DefinitionRef, k as ComputeError, m as isDefinitionRef, o as FileBaseInfo, p as SolveDefinition, r as downloadFileData, s as FileData } from "./index-C7Olveh2.js";
|
|
2
2
|
//#region src/grasshopper/server/compute-server-stats.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* ComputeServerStats provides methods to query Rhino Compute server statistics.
|
|
@@ -1387,6 +1387,56 @@ interface SchemaEndpointResult<TSchema = unknown> {
|
|
|
1387
1387
|
*/
|
|
1388
1388
|
declare function readSchemaResults<TSchema = unknown>(raw: unknown): SchemaEndpointResult<TSchema>[];
|
|
1389
1389
|
//#endregion
|
|
1390
|
+
//#region src/grasshopper/io/normalize-ui-schema.d.ts
|
|
1391
|
+
/**
|
|
1392
|
+
* Canonicalize a `/grasshopper/schema` body's key CASING.
|
|
1393
|
+
*
|
|
1394
|
+
* ## Why this exists
|
|
1395
|
+
*
|
|
1396
|
+
* Compute serializes the plugin's `UISchema` POCO, whose camelCase wire names
|
|
1397
|
+
* live in Newtonsoft `[JsonProperty]` attributes. `Selva.gha` ILRepack-merges
|
|
1398
|
+
* Newtonsoft into itself, so those attributes have type
|
|
1399
|
+
* `Selva!Newtonsoft.Json.JsonPropertyAttribute`. When the serializer that runs is
|
|
1400
|
+
* compute's OWN Newtonsoft assembly, it does not recognize that type as its own
|
|
1401
|
+
* attribute, reads no attributes at all, and falls back to raw CLR member names —
|
|
1402
|
+
* emitting `Inputs`/`Layout`/`SchemaVersion`.
|
|
1403
|
+
*
|
|
1404
|
+
* Nothing throws on the wire. Every consumer reads `schema.inputs` as
|
|
1405
|
+
* `undefined`, so the definition renders with no inputs, and `schemaVersion`
|
|
1406
|
+
* reads `undefined` — which also silently disables the newer-plugin version gate.
|
|
1407
|
+
*
|
|
1408
|
+
* This is the schema-body counterpart to {@link normalizeInputSchema}, which
|
|
1409
|
+
* solves the same split for the `/io` endpoint's param records.
|
|
1410
|
+
*
|
|
1411
|
+
* ## Why a casing rule, and not a key allowlist
|
|
1412
|
+
*
|
|
1413
|
+
* The wire names are the CLR names run through Newtonsoft's camelCase strategy,
|
|
1414
|
+
* so reproducing that strategy covers every key. An allowlist would have to
|
|
1415
|
+
* enumerate every structural key in `UISchema` and drift out of date each time
|
|
1416
|
+
* the schema gains a field, failing silently and in exactly this way again.
|
|
1417
|
+
*
|
|
1418
|
+
* ## What it does NOT touch
|
|
1419
|
+
*
|
|
1420
|
+
* `options`, `defaultOptions` and `values` hold USER-AUTHORED keys — dropdown
|
|
1421
|
+
* labels like `"Standart Beschichtung"`, `"Use 10 Elements instead"`, `"True"`.
|
|
1422
|
+
* Those maps are copied verbatim; only the key naming them is canonicalized.
|
|
1423
|
+
* Rewriting their contents is the exact regression that motivated deleting the
|
|
1424
|
+
* old global `camelcaseKeys` pass (see `read-field.ts`), which mangled
|
|
1425
|
+
* `"Option A"` into `"optionA"` and silently changed what a definition solved
|
|
1426
|
+
* with.
|
|
1427
|
+
*
|
|
1428
|
+
* Values are never inspected — only object keys are rewritten.
|
|
1429
|
+
*/
|
|
1430
|
+
/**
|
|
1431
|
+
* Returns a schema whose structural keys are camelCase, regardless of which
|
|
1432
|
+
* Newtonsoft serialized it. A body that is already camelCase passes through
|
|
1433
|
+
* unchanged in shape (it is still rebuilt, so the result is always a fresh
|
|
1434
|
+
* object the caller may mutate).
|
|
1435
|
+
*
|
|
1436
|
+
* Safe to call on any parsed JSON value; non-objects are returned as-is.
|
|
1437
|
+
*/
|
|
1438
|
+
declare function normalizeUISchemaCasing<T>(raw: T): T;
|
|
1439
|
+
//#endregion
|
|
1390
1440
|
//#region src/grasshopper/io/input/input-processors.d.ts
|
|
1391
1441
|
/**
|
|
1392
1442
|
* Parse one raw Grasshopper input schema into a typed {@link InputParam}.
|
|
@@ -1668,5 +1718,5 @@ declare class TreeBuilder {
|
|
|
1668
1718
|
private static clampValue;
|
|
1669
1719
|
}
|
|
1670
1720
|
//#endregion
|
|
1671
|
-
export { type BooleanInputType, type CacheOptions, ComputeServerStats, type DataItem, type DataTree, type DataTreeDefault, type DataTreePath, type DataTreeValue, type DefaultValue, type DefinitionRef, type FileBaseInfo, type FileData, type FileInputType, type GeometryInputType, type GetValuesOptions, type GetValuesResult, GrasshopperClient, type GrasshopperComputeConfig, type GrasshopperComputeResponse, type GrasshopperParsedIO, type GrasshopperParsedIORaw, type GrasshopperRequestSchema, GrasshopperResponseProcessor, type InnerTreeData, type InputParam, type InputParamSchema, type NumericInputType, type OutputParamSchema, type OutputType, type ParsedContext, type ProcessedFile, type RhinoModelUnit, type SchedulerMode, type SchemaEndpointResult, type SolveContext, type SolveDefinition, type SolveOptions, type SolveResult, SolveScheduler, type SolveSchedulerOptions, type TextInputType, TreeBuilder, type ValueListInputType, downloadFileData, extractFilesFromComputeResponse, fetchDefinitionIO, fetchParsedDefinitionIO, hashDefinition, hashSolveInput, isDefinitionRef, processInput, readSchemaResults, solveGrasshopperDefinition, stableStringify };
|
|
1721
|
+
export { type BooleanInputType, type CacheOptions, ComputeServerStats, type DataItem, type DataTree, type DataTreeDefault, type DataTreePath, type DataTreeValue, type DefaultValue, type DefinitionRef, type FileBaseInfo, type FileData, type FileInputType, type GeometryInputType, type GetValuesOptions, type GetValuesResult, GrasshopperClient, type GrasshopperComputeConfig, type GrasshopperComputeResponse, type GrasshopperParsedIO, type GrasshopperParsedIORaw, type GrasshopperRequestSchema, GrasshopperResponseProcessor, type InnerTreeData, type InputParam, type InputParamSchema, type NumericInputType, type OutputParamSchema, type OutputType, type ParsedContext, type ProcessedFile, type RhinoModelUnit, type SchedulerMode, type SchemaEndpointResult, type SolveContext, type SolveDefinition, type SolveOptions, type SolveResult, SolveScheduler, type SolveSchedulerOptions, type TextInputType, TreeBuilder, type ValueListInputType, downloadFileData, extractFilesFromComputeResponse, fetchDefinitionIO, fetchParsedDefinitionIO, hashDefinition, hashSolveInput, isDefinitionRef, normalizeUISchemaCasing, processInput, readSchemaResults, solveGrasshopperDefinition, stableStringify };
|
|
1672
1722
|
//# sourceMappingURL=grasshopper.d.ts.map
|
package/dist/grasshopper.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e,b as t,c as n,d as r,f as i,g as a,h as o,l as s,m as c,o as l,r as u,s as d,t as f,v as p,x as m}from"./core-Bb-B_3XN.js";var h=class e{serverUrl;apiKey;disposed=!1;activeMonitors=new Set;activeTimeouts=new Set;static DEFAULT_TIMEOUT_MS=5e3;static LIFECYCLE_TIMEOUT_MS=6e4;static MIN_MONITOR_INTERVAL_MS=100;constructor(e,t){this.serverUrl=c(e),this.apiKey=t}buildHeaders(){let e={"Content-Type":`application/json`};return this.apiKey&&(e.RhinoComputeKey=this.apiKey),e}fetchWithTimeout(t,n={},r=e.DEFAULT_TIMEOUT_MS){let i=new Headers(this.buildHeaders());n.headers&&new Headers(n.headers).forEach((e,t)=>{i.set(t,e)});let a={};i.forEach((e,t)=>{a[t]=e});let o={...n,headers:a};return r>0&&!o.signal&&(o.signal=AbortSignal.timeout(r)),fetch(t,o)}async isServerOnline(e=5e3){this.ensureNotDisposed();let t=`${this.serverUrl}/`;try{return(await this.fetchWithTimeout(t,{method:`GET`},e)).ok}catch(e){return p().debug(`[ComputeServerStats] Fetch error:`,e),!1}}async getActiveChildren(t={}){this.ensureNotDisposed();let{initialize:n=!0}=t,r=n?`${this.serverUrl}/activechildren`:`${this.serverUrl}/activechildren?initialize=false`,i=n?e.LIFECYCLE_TIMEOUT_MS:e.DEFAULT_TIMEOUT_MS;try{let e=await this.fetchWithTimeout(r,{},i);if(!e.ok)return p().warn(`[ComputeServerStats] Failed to fetch active children:`,e.status),null;let t=(await e.text()).trim();return/^\d+$/.test(t)?parseInt(t,10):(p().warn(`[ComputeServerStats] Invalid active children response:`,t),null)}catch(e){return p().warn(`[ComputeServerStats] Error fetching active children:`,e),null}}async getVersion(){this.ensureNotDisposed();try{let e=await this.fetchWithTimeout(`${this.serverUrl}/version`);if(!e.ok)return p().warn(`[ComputeServerStats] Failed to fetch version:`,e.status),null;let t=await e.text();try{let e=JSON.parse(t);return{rhino:e.rhino??``,compute:e.compute??``,git_sha:e.git_sha??null}}catch{return{rhino:t,compute:``,git_sha:null}}}catch(e){return p().warn(`[ComputeServerStats] Error fetching version:`,e),null}}async getInstalledPlugins(e=`gh`){this.ensureNotDisposed();try{let t=await this.fetchWithTimeout(`${this.serverUrl}/plugins/${e}/installed`);if(!t.ok)return p().warn(`[ComputeServerStats] Failed to fetch ${e} plugins:`,t.status),null;let n=await t.text();try{let e=JSON.parse(n);return e&&typeof e==`object`?e:null}catch{return null}}catch(t){return p().warn(`[ComputeServerStats] Error fetching ${e} plugins:`,t),null}}async getServerStats(){if(this.ensureNotDisposed(),!await this.isServerOnline())return{isOnline:!1};let[e,t]=await Promise.all([this.getVersion(),this.getActiveChildren({initialize:!1})]);return{isOnline:!0,...e&&{version:e},...t!==null&&{activeChildren:t}}}async purgeCache(){this.ensureNotDisposed();try{let e=await this.fetchWithTimeout(`${this.serverUrl}/cache/purge`,{method:`POST`});if(!e.ok)return p().warn(`[ComputeServerStats] Failed to purge cache:`,e.status),null;let t=await e.text();try{let e=JSON.parse(t);return typeof e.purged==`number`?e.purged:null}catch{return null}}catch(e){return p().warn(`[ComputeServerStats] Error purging cache:`,e),null}}async purgeAllChildren(){this.ensureNotDisposed();let e=await this.getActiveChildren({initialize:!1});if(e===null)return p().warn(`[ComputeServerStats] purgeAllChildren: could not read child count`),null;if(e===0)return{totalPurged:0,calls:0,children:0,confident:!0};let t=e*2,n=0;for(let e=0;e<t;e++){let e=await this.purgeCache();e!==null&&(n+=e)}return{totalPurged:n,calls:t,children:e,confident:e===1}}async getServerTime(){this.ensureNotDisposed();try{let e=await this.fetchWithTimeout(`${this.serverUrl}/servertime`);if(!e.ok)return p().warn(`[ComputeServerStats] Failed to fetch server time:`,e.status),null;let t=(await e.text()).trim().replace(/^"|"$/g,``),n=new Date(t);return isNaN(n.getTime())?null:n}catch(e){return p().warn(`[ComputeServerStats] Error fetching server time:`,e),null}}async getIdleSpan(){this.ensureNotDisposed();try{let e=await this.fetchWithTimeout(`${this.serverUrl}/idlespan`);if(!e.ok)return p().warn(`[ComputeServerStats] Failed to fetch idle span:`,e.status),null;let t=parseFloat((await e.text()).trim());return isNaN(t)?null:t}catch(e){return p().warn(`[ComputeServerStats] Error fetching idle span:`,e),null}}async launchChildren(){return this.postJson(`/launch-children`)}async launchChild(e){let t=e===void 0?`/launch-child`:`/launch-child?port=${e}`;return this.postJson(t)}async shutdownChildren(e){let t=e===void 0?`/shutdown-children`:`/shutdown-children?port=${e}`;return this.postJson(t)}async recycleChildren(e){let t=e===void 0?`/recycle-children`:`/recycle-children?port=${e}`;return this.postJson(t)}async postJson(t){this.ensureNotDisposed();try{let n=await this.fetchWithTimeout(`${this.serverUrl}${t}`,{method:`POST`},e.LIFECYCLE_TIMEOUT_MS);if(!n.ok)return p().warn(`[ComputeServerStats] POST ${t} failed:`,n.status),null;let r=await n.text();try{return JSON.parse(r)}catch{return null}}catch(e){return p().warn(`[ComputeServerStats] Error on POST ${t}:`,e),null}}monitor(t,n=5e3){if(this.ensureNotDisposed(),!Number.isFinite(n)||n<e.MIN_MONITOR_INTERVAL_MS)throw RangeError(`monitor() intervalMs must be a finite number >= ${e.MIN_MONITOR_INTERVAL_MS}ms, got ${n}. Sub-${e.MIN_MONITOR_INTERVAL_MS}ms polling would hot-loop the server.`);let r=!0,i=null;p().info(`🔄 Starting server stats monitoring every ${n}ms`);let a=async()=>{if(i!==null&&(this.activeTimeouts.delete(i),i=null),!(!r||this.disposed)){try{let e=await this.getServerStats();if(!r||this.disposed)return;try{t(e)}catch(e){p().error(`[ComputeServerStats] Monitor callback threw:`,e)}}catch(e){!r||this.disposed?p().debug(`[ComputeServerStats] Monitor poll cancelled during shutdown:`,e):p().error(`[ComputeServerStats] Failed to fetch stats during monitor:`,e)}r&&!this.disposed&&(i=setTimeout(()=>void a(),n),this.activeTimeouts.add(i))}},o=()=>{r=!1,i!==null&&(clearTimeout(i),this.activeTimeouts.delete(i),i=null),this.activeMonitors.delete(o)};return this.activeMonitors.add(o),a(),o}async dispose(){if(!this.disposed){this.disposed=!0;for(let e of this.activeMonitors)e();this.activeMonitors.clear();for(let e of this.activeTimeouts)clearTimeout(e);this.activeTimeouts.clear()}}ensureNotDisposed(){if(this.disposed)throw new t(`ComputeServerStats has been disposed and cannot be used`,m.INVALID_STATE,{context:{disposed:this.disposed}})}};const g=new Set;function ee(){if(typeof window>`u`||globalThis.process?.versions?.node!=null)return!1;let e=globalThis.navigator,t=typeof e?.userAgent==`string`?e.userAgent:``;return!/jsdom/i.test(t)}function _(e,t){t||ee()&&!g.has(e)&&(g.add(e),p().warn(`Warning: ${e} is running on the client side. For better performance and security, consider running this on the server side.`))}const te={definition_not_cached:m.DEFINITION_NOT_CACHED};function v(e){return{...e,serverErrorCodes:{...te,...e.serverErrorCodes}}}function ne(e){return e instanceof t?e.code===m.DEFINITION_NOT_CACHED||e.message.includes(`Unable to load grasshopper definition`):!1}function re(e,t){if(!t)return;let n=a(e,`values`);if(!Array.isArray(n)||n.length===0)return;let r=[];for(let e of n){let t=a(e,`innerTree`);(!t||Object.keys(t).length===0)&&r.push(a(e,`paramName`)??`<unnamed>`)}if(r.length===0)return;let i=r.length===n.length?`all`:`${r.length}/${n.length}`;p().warn(`Solve returned empty output(s) (${i}): ${r.join(`, `)}. These parameters produced no data — check the definition's inputs and the branch feeding each.`)}async function y(e,t,n){_(`solveGrasshopperDefinition`,n.suppressBrowserWarning);let{response:r}=await x(S(await b(t),e),n);return r}async function ie(e,t,n){return _(`solveGrasshopperDefinitionWithCacheKey`,n.suppressBrowserWarning),x(S(await b(t),e),n)}async function ae(e,t,n,r){_(`solveByCacheKey`,r.suppressBrowserWarning);let i={algo:null,pointer:t,values:e};try{return{...await x(i,r),missed:!1}}catch(t){if(!ne(t))throw t;return{...await x(S(await b(n),e),r),missed:!0}}}async function b(n){if(!e(n))return n;try{return await n.load()}catch(e){throw new t(`Failed to load definition bytes for ref '${n.key}'`,m.INVALID_INPUT,{context:{definitionKey:n.key},originalError:e instanceof Error?e:Error(String(e))})}}async function x(e,t){oe(e,t);let r=await l(`grasshopper`,e,v(t)),{pointer:i,algo:a,...o}=r,s=o,c=d(r);if(c!==void 0){let e=typeof a==`string`?a.length:0;n(s,Math.max(0,c-e))}return re(s,t.debug),{response:s,cacheKey:typeof i==`string`?i:null}}function S(e,t){let n={algo:null,pointer:null,values:t};return e instanceof Uint8Array?n.algo=s(e):/^https?:\/\//i.test(e)?n.pointer=e:n.algo=r(e)??i(e),n}function oe(e,t){t.cachesolve!=null&&(e.cachesolve=t.cachesolve),t.cacheerroredsolves!=null&&(e.cacheerroredsolves=t.cacheerroredsolves),t.modelunits!=null&&(e.modelunits=t.modelunits),t.angletolerance!=null&&(e.angletolerance=t.angletolerance),t.absolutetolerance!=null&&(e.absolutetolerance=t.absolutetolerance),t.dataversion!=null&&(e.dataversion=t.dataversion)}function se(e){let t=new WeakSet,n=e=>{if(e===void 0)return`undefined`;if(e===null)return`null`;if(typeof e==`number`)return Number.isFinite(e)?String(e):`null`;if(typeof e==`string`||typeof e==`boolean`)return JSON.stringify(e);if(typeof e==`bigint`)return`${e}n`;if(e instanceof Uint8Array)return`{"__u8":${e.length},"hash":"${w(e)}"}`;if(Array.isArray(e)){if(t.has(e))return`"[Circular]"`;t.add(e);let r=[];for(let t=0;t<e.length;t++)r.push(n(e[t]));return t.delete(e),`[${r.join(`,`)}]`}if(typeof e==`object`){if(t.has(e))return`"[Circular]"`;t.add(e);let r;return r=typeof e.toJSON==`function`?n(e.toJSON()):e instanceof Map?`{"__map":[${[...e.entries()].map(([e,t])=>`[${n(e)},${n(t)}]`).sort().join(`,`)}]}`:e instanceof Set?`{"__set":[${[...e.values()].map(n).sort().join(`,`)}]}`:`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${n(e[t])}`).join(`,`)}}`,t.delete(e),r}return`null`};return n(e)}function ce(e,t){let n=2166136261;for(let r=0;r<e;r++)n^=t(r),n=n+((n<<1)+(n<<4)+(n<<7)+(n<<8)+(n<<24))>>>0;return n.toString(16).padStart(8,`0`)}function C(e){return ce(e.length,t=>e.charCodeAt(t))}function w(e){return ce(e.length,t=>e[t])}function le(e,t){return T(E(e),t)}function T(e,t){let n=se(t);return`${e}|t:${n.length}:${C(n)}`}function E(t){return e(t)?`r:${t.key}`:typeof t==`string`?`s:${t.length}:${C(t)}`:`u8:${t.length}:${w(t)}`}function ue(e){return typeof e!=`string`||!/^https?:\/\//i.test(e)}function de(e){try{return JSON.stringify(e)?.length??0}catch{return 0}}var D=class{executor;baseConfig;mode;maxConcurrent;maxQueueDepth;queueWaitMs;timeoutMs;retry;cacheEnabled;cacheMaxBytes;cacheTtl;cacheErroredSolves;cache=new Map;cacheBytes=0;cacheHits=0;cacheMisses=0;cacheEvictions=0;cacheKeyExecutor;reuseServerDefinitionCache;serverCacheKeys=new Map;onStart;onSettle;onSuperseded;subscribers=new Set;inFlight=new Set;pendingForLatestWins=null;fifoQueue=[];_lastResult=null;_lastError=null;_lastDurationMs=null;solveSeq=0;lastStateSeq=0;disposed=!1;constructor(e,t,n={},r){this.executor=e,this.cacheKeyExecutor=r,this.baseConfig=t,this.mode=n.mode??`latest-wins`,this.maxConcurrent=Math.max(1,n.maxConcurrent??(this.mode===`parallel`?4:1)),this.maxQueueDepth=n.maxQueueDepth!==void 0&&n.maxQueueDepth>0?Math.floor(n.maxQueueDepth):void 0,this.queueWaitMs=n.queueWaitMs!==void 0&&n.queueWaitMs>0?n.queueWaitMs:void 0,this.timeoutMs=n.timeoutMs,this.retry=n.retry;let i=n.cache,a=typeof i==`object`?i:null;this.cacheMaxBytes=Math.max(0,a?.maxBytes??0),this.cacheEnabled=this.cacheMaxBytes>0,this.cacheTtl=a?.ttlMs??0,this.cacheErroredSolves=a?.cacheErroredSolves??!0,this.reuseServerDefinitionCache=!!r&&(n.reuseServerDefinitionCache??!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}get lastResult(){return this._lastResult}get lastError(){return this._lastError}get lastDurationMs(){return this._lastDurationMs}setMaxConcurrent(e){let t=Math.max(1,Math.floor(e));if(t===this.maxConcurrent)return;let n=t>this.maxConcurrent;this.maxConcurrent=t,n&&this.drainNext()}getMaxConcurrent(){return this.maxConcurrent}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}notify(){for(let e of this.subscribers)try{e()}catch(e){p().error(`[SolveScheduler] subscriber threw:`,e)}}solve(e,n,r){if(this.disposed)return Promise.reject(new t(`SolveScheduler has been disposed and cannot be used`,m.INVALID_STATE));let i=E(e),a=T(i,n),o=++this.solveSeq,s={key:a,enqueuedAt:Date.now(),startedAt:null};if(r?.signal?.aborted)return Promise.reject(this.makeAbortError(s));if(this.cacheEnabled){let e=this.readCache(a);if(e){this.mode===`latest-wins`&&this.supersedeCurrent();let t={status:`success`,response:e,durationMs:0,fromCache:!0};return this.writeLastState(o,{result:e,durationMs:0}),this.runHook(this.onStart,s),this.runHook(this.onSettle,s,t),this.notify(),Promise.resolve(e)}}return new Promise((t,a)=>{let c={definition:e,dataTree:n,definitionHash:i,ctx:s,seq:o,resolve:t,reject:a,externalSignal:r?.signal};c.externalSignal&&(c.queuedAbortHandler=()=>this.abortQueuedItem(c),c.externalSignal.addEventListener(`abort`,c.queuedAbortHandler,{once:!0})),this.enqueue(c)})}writeLastState(e,t){return e<this.lastStateSeq?!1:(this.lastStateSeq=e,`result`in t?(this._lastResult=t.result,this._lastError=null):this._lastError=t.error,this._lastDurationMs=t.durationMs,!0)}supersedeCurrent(){this.pendingForLatestWins&&=(this.supersede(this.pendingForLatestWins),null);for(let e of this.inFlight)this.supersede(e),e.controller.abort()}abortQueuedItem(e){this.pendingForLatestWins===e&&(this.pendingForLatestWins=null);let t=this.fifoQueue.indexOf(e);t>=0&&this.fifoQueue.splice(t,1),this.rejectAsAborted(e),this.notify()}shedAsQueueFull(e){let n=new t(`Solve queue is full; request rejected (backpressure)`,m.QUEUE_FULL,{statusCode:503,context:{key:e.ctx.key,queueDepth:this.fifoQueue.length,maxQueueDepth:this.maxQueueDepth}});this.settleError(e,n)&&this.runHook(this.onSettle,e.ctx,{status:`error`,error:n,durationMs:0}),this.notify()}armQueueWaitTimer(e){if(this.queueWaitMs===void 0)return;let n=this.queueWaitMs;e.queueWaitTimer=setTimeout(()=>{if(e.settled)return;let r=this.fifoQueue.indexOf(e);r>=0&&this.fifoQueue.splice(r,1);let i=new t(`Solve waited longer than ${n}ms in queue; rejected (backpressure)`,m.QUEUE_TIMEOUT,{statusCode:503,context:{key:e.ctx.key,waitedMs:Date.now()-e.ctx.enqueuedAt,queueWaitMs:n}});this.settleError(e,i)&&this.runHook(this.onSettle,e.ctx,{status:`error`,error:i,durationMs:0}),this.notify()},n)}clearQueueWaitTimer(e){e.queueWaitTimer!==void 0&&(clearTimeout(e.queueWaitTimer),e.queueWaitTimer=void 0)}enqueue(e){switch(this.mode){case`latest-wins`:this.supersedeCurrent(),this.inFlight.size===0?this.execute(e):this.pendingForLatestWins=e;break;case`queue`:case`parallel`:this.inFlight.size<this.maxConcurrent?this.execute(e):this.maxQueueDepth!==void 0&&this.fifoQueue.length>=this.maxQueueDepth?this.shedAsQueueFull(e):(this.armQueueWaitTimer(e),this.fifoQueue.push(e))}this.notify()}async execute(e){let t=new AbortController,n=e;n.controller=t,this.inFlight.add(n),e.ctx.startedAt=Date.now(),this.clearQueueWaitTimer(e),this.removeQueuedAbortHandler(e);let r=()=>t.abort();e.externalSignal?.addEventListener(`abort`,r,{once:!0}),this.runHook(this.onStart,e.ctx),this.notify();let i=performance.now();try{let n={...this.baseConfig,signal:t.signal,...this.timeoutMs!==void 0&&{timeoutMs:this.timeoutMs},...this.retry!==void 0&&{retry:this.retry}},{response:r,definitionReuploaded:a}=await this.runExecutor(e.definition,e.dataTree,e.definitionHash,n),o=performance.now()-i;if(this.cacheEnabled&&this.writeCache(e.ctx.key,r),!this.settleSuccess(e,r))return;this.writeLastState(e.seq,{result:r,durationMs:o}),this.runHook(this.onSettle,e.ctx,{status:`success`,response:r,durationMs:o,fromCache:!1,definitionReuploaded:a})}catch(t){let r=performance.now()-i,a=this.normalizeExecutionError(t,n);this.writeLastState(e.seq,{error:a,durationMs:r}),this.settleError(e,a)&&this.runHook(this.onSettle,e.ctx,{status:`error`,error:a,durationMs:r})}finally{e.externalSignal?.removeEventListener(`abort`,r),this.inFlight.delete(n),this.drainNext(),this.notify()}}async runExecutor(e,t,n,r){if(!this.cacheKeyExecutor||!this.reuseServerDefinitionCache||!ue(e))return{response:await this.executor(e,t,r)};let i=n,a=this.serverCacheKeys.get(i)??null,o=await this.cacheKeyExecutor(e,t,a,r);if(o.cacheKey)for(this.serverCacheKeys.delete(i),this.serverCacheKeys.set(i,o.cacheKey);this.serverCacheKeys.size>100;){let e=this.serverCacheKeys.keys().next().value;if(e===void 0)break;this.serverCacheKeys.delete(e)}else this.serverCacheKeys.delete(i);return{response:o.response,definitionReuploaded:o.missed}}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){let n=new t(`Superseded by newer solve`,m.SUPERSEDED,{context:{key:e.ctx.key,enqueuedAt:e.ctx.enqueuedAt}});this.settleError(e,n)&&this.runHook(this.onSuperseded,e.ctx)}makeAbortError(e){return new t(`Request aborted by caller`,m.ABORTED,{context:{key:e.key,enqueuedAt:e.enqueuedAt}})}settleError(e,t){return!e.settled&&(e.settled={error:t},this.clearQueueWaitTimer(e),this.removeQueuedAbortHandler(e),e.reject(t),!0)}settleSuccess(e,t){return!e.settled&&(e.settled={ok:!0},this.clearQueueWaitTimer(e),this.removeQueuedAbortHandler(e),e.resolve(t),!0)}removeQueuedAbortHandler(e){e.queuedAbortHandler&&e.externalSignal&&e.externalSignal.removeEventListener(`abort`,e.queuedAbortHandler),e.queuedAbortHandler=void 0}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,n){return n.settled&&`error`in n.settled?n.settled.error:e instanceof t?e:this.isAbortLikeError(e)?this.makeAbortError(n.ctx):new t(e instanceof Error?e.message:String(e),m.UNKNOWN_ERROR,{originalError:e instanceof Error?e:Error(String(e))})}cancelAll(){for(this.pendingForLatestWins&&=(this.rejectAsAborted(this.pendingForLatestWins),null);this.fifoQueue.length>0;){let e=this.fifoQueue.shift();this.rejectAsAborted(e)}for(let e of this.inFlight){let t=this.makeAbortError(e.ctx);this.settleError(e,t)&&this.runHook(this.onSettle,e.ctx,{status:`error`,error:t,durationMs:e.ctx.startedAt?Date.now()-e.ctx.startedAt:0}),e.controller.abort()}this.notify()}rejectAsAborted(e){let t=this.makeAbortError(e.ctx);this.settleError(e,t)&&this.runHook(this.onSettle,e.ctx,{status:`error`,error:t,durationMs:0})}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.dropCacheEntry(e),this.cacheMisses+=1,null):(this.cache.delete(e),this.cache.set(e,t),this.cacheHits+=1,t.response):(this.cacheMisses+=1,null)}writeCache(e,t){if(!this.cacheEnabled||!this.cacheErroredSolves&&t.errors&&t.errors.length>0)return;let n=d(t)??de(t);if(!(n>this.cacheMaxBytes))for(this.dropCacheEntry(e),this.cache.set(e,{response:t,insertedAt:Date.now(),sizeBytes:n}),this.cacheBytes+=n;this.cacheBytes>this.cacheMaxBytes&&this.cache.size>0;){let e=this.cache.keys().next().value;if(e===void 0)break;this.dropCacheEntry(e),this.cacheEvictions+=1}}dropCacheEntry(e){let t=this.cache.get(e);t&&(this.cache.delete(e),this.cacheBytes-=t.sizeBytes)}clearCache(){this.cache.clear(),this.cacheBytes=0}cacheStats(){return{entries:this.cache.size,bytes:this.cacheBytes,hits:this.cacheHits,misses:this.cacheMisses,evictions:this.cacheEvictions}}dispose(){this.disposed||(this.disposed=!0,this.cancelAll(),this.subscribers.clear(),this.clearCache())}runHook(e,...t){if(e)try{e(...t)}catch(e){p().error(`[SolveScheduler] hook threw:`,e)}}};function O(t){return e(t)?`ref:${t.key}`:typeof t==`string`&&t.length<200?t:`...content...`}function k(e){return Array.isArray(e)?e.map(e=>{let t=0,n=0,r=a(e,`innerTree`);if(r&&typeof r==`object`){for(let e of Object.values(r))if(Array.isArray(e)){t+=e.length;for(let t of e){let e=t?.data;typeof e==`string`&&(n+=e.length)}}}return{param:a(e,`paramName`)??`<unnamed>`,items:t,bytes:n}}):[]}var fe=class n{config;serverStats;disposed=!1;constructor(e){this.config=this.normalizeComputeConfig(e),this.serverStats=new h(this.config.serverUrl,this.config.apiKey)}static async create(e){let r=new n(e),i=Math.max(1,(e.retry?.attempts??2)+1),a=e.retry?.baseDelayMs??250,o=e.retry?.maxDelayMs??1e3;for(let e=0;e<i;e++){if(await r.serverStats.isServerOnline())return r;if(e<i-1){let t=Math.min(a*2**e,o);await new Promise(e=>setTimeout(e,t))}}throw await r.dispose(),new t(`Rhino Compute server is not online`,m.NETWORK_ERROR,{context:{serverUrl:r.config.serverUrl,attempts:i}})}getConfig(){return this.ensureNotDisposed(),{...this.config}}async getIO(e){return this.ensureNotDisposed(),Ke(e,this.config)}async getRawIO(e){return this.ensureNotDisposed(),$(e,this.config)}async solve(n,r,i){this.ensureNotDisposed();try{if(typeof n==`string`&&!n?.trim())throw new t(`Definition URL/content is required`,m.INVALID_INPUT,{context:{receivedUrl:n}});if(n instanceof Uint8Array&&n.length===0)throw new t(`Definition content is empty`,m.INVALID_INPUT);if(e(n)&&!n.key.trim())throw new t(`DefinitionRef key is empty`,m.INVALID_INPUT);let a=await y(r,n,{...this.config,...i?.signal!==void 0&&{signal:i.signal},...i?.timeoutMs!==void 0&&{timeoutMs:i.timeoutMs},...i?.retry!==void 0&&{retry:i.retry}});if(a?.errors&&a.errors.length>0)throw new t(a.errors.join(`; `)||`Computation failed`,m.COMPUTATION_ERROR,{context:{definition:O(n),inputSummary:k(r),errors:a.errors,warnings:a.warnings,values:a.values}});return a}catch(e){throw this.config.debug&&p().error(`Compute failed:`,e),e instanceof t?e:new t(e instanceof Error?e.message:String(e),m.COMPUTATION_ERROR,{context:{definition:O(n),inputSummary:k(r)},originalError:e instanceof Error?e:Error(String(e))})}}createScheduler(e){return this.ensureNotDisposed(),new D((e,t,n)=>y(t,e,n),this.config,e,(e,t,n,r)=>n===null?ie(t,e,r).then(e=>({...e,missed:!1})):ae(t,n,e,r))}async dispose(){this.disposed||(this.disposed=!0,await this.serverStats.dispose())}ensureNotDisposed(){if(this.disposed)throw new t(`GrasshopperClient has been disposed and cannot be used`,m.INVALID_STATE)}normalizeComputeConfig(e){return{...e,serverUrl:c(e.serverUrl),apiKey:e.apiKey,authToken:e.authToken,debug:e.debug??!1,suppressBrowserWarning:e.suppressBrowserWarning}}};const A=new Map;function j(e,t){A.set(e,t)}j(`Rhino.Geometry.Point3d`,(e,t)=>{let n=t;return!n||typeof n.X!=`number`?null:new e.Point([n.X,n.Y,n.Z])}),j(`Rhino.Geometry.Line`,(e,t)=>{let n=t;return!n||!n.From||!n.To?null:new e.Line([n.From.X,n.From.Y,n.From.Z],[n.To.X,n.To.Y,n.To.Z])});function pe(e){if(A.has(e))return A.get(e);for(let[t,n]of A)if(e.startsWith(t))return n}function me(e){return!!(e&&typeof e==`object`&&typeof e.data==`string`)}function M(e,t){return{__decodeError:!0,type:e,raw:t}}function he(e,t,n){let r=pe(t),i=!1;if(r)try{let t=r(n,e);if(t!=null)return t}catch(e){p().warn(`Failed to decode Rhino type ${t}:`,e),i=!0}try{if(me(e))return n.CommonObject.decode(e)}catch(n){return p().warn(`Failed to decode ${t} with CommonObject:`,n),M(t,e)}return i?M(t,e):e}function ge(e){let t=new WeakSet,n=e=>{if(!e||typeof e!=`object`||t.has(e))return;t.add(e);let r=e.delete;if(typeof r==`function`){let t=e.isDeleted;(typeof t!=`function`||!t.call(e))&&r.call(e);return}if(Array.isArray(e)){for(let t of e)n(t);return}let i=Object.getPrototypeOf(e);if(i===Object.prototype||i===null)for(let t of Object.values(e))n(t)};n(e)}const N={STRING:`System.String`,INT:`System.Int32`,DOUBLE:`System.Double`,BOOL:`System.Boolean`},_e=[`WebDisplay`];function P(e){return _e.some(t=>e.includes(t))}function ve(e){if(typeof e!=`string`)return e;let t=e.trim();if(!(t.startsWith(`{`)||t.startsWith(`[`)||t.startsWith(`"`)))return e;try{let e=JSON.parse(t);if(typeof e==`string`)try{return JSON.parse(e)}catch{return e}return e}catch{return e}}function ye(e,t,n){switch(t){case N.STRING:return typeof e==`string`?e.replace(/^"(.*)"$/,`$1`):e;case N.INT:return Number.parseInt(e,10);case N.DOUBLE:return Number.parseFloat(e);case N.BOOL:return String(e).toLowerCase()===`true`;default:return n&&t.startsWith(`Rhino.Geometry.`)?he(e,t,n):e}}const F=new WeakMap;function I(e){if(F.has(e))return F.get(e);let t=ve(e.data);return F.set(e,t),t}function L(e,t,n,r){return typeof e.data==`string`?ye(n?I(e):e.data,t,r):e.data}function be(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.fileName==`string`&&typeof t.fileType==`string`&&`data`in t&&typeof t.isBase64Encoded==`boolean`&&typeof t.subFolder==`string`}function R(e){let t=a(e,`values`);return Array.isArray(t)?t:[]}function z(e){return typeof e.type==`string`?e.type:``}function B(e,t){if(!(!e||typeof e!=`object`)){for(let n of Object.values(e))if(Array.isArray(n))for(let e of n)e&&typeof e==`object`&&t(e)}}function xe(e,t=!1,n={}){let{parseValues:r=!0,rhino:i,stringOnly:o=!1}=n,s={},c=new Set;for(let n of R(e)){let e=a(n,`paramName`);B(a(n,`innerTree`),n=>{let a=z(n);if(P(a)||o&&a!==N.STRING)return;let l=t?n.id:e;if(!l)return;let u=L(n,a,r,i);l in s?c.has(l)?s[l].push(u):(s[l]=[s[l],u],c.add(l)):s[l]=u})}return{values:s,dispose:()=>ge(s)}}function Se(e){let t=[];for(let n of R(e))B(a(n,`innerTree`),e=>{if(!z(e).includes(`FileData`))return;let n=I(e);be(n)&&t.push(n)});return t}function Ce(e,t,n={}){let{parseValues:r=!0,rhino:i,stringOnly:o=!1}=n;for(let n of R(e)){let e=a(n,`innerTree`),s=!1;if(`byName`in t){if(a(n,`paramName`)!==t.byName)continue;s=!0}let c=[];if(B(e,e=>{if(`byId`in t){if(e.id!==t.byId)return;s=!0}let n=z(e);P(n)||o&&n!==N.STRING||c.push(L(e,n,r,i))}),s)return c.length===0?void 0:c.length===1?c[0]:c}}var we=class{response;debug;constructor(e,t=!1){this.response=e,this.debug=t}getValues(e=!1,t={}){return xe(this.response,e,t)}getValue(e,t){return Ce(this.response,e,t)}getFileData(){return Se(this.response)}async getAndDownloadFiles(e,t){let n=this.getFileData();await f(n,e,t)}};const V=/^\{(-?\d+(?:;-?\d+)*)?\}$/;function H(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=Object.entries(e);return t.length>0&&t.every(([e,t])=>V.test(e)&&Array.isArray(t))}function U(e,t,n){let r=Number(e.toFixed(t));return Math.abs(e-r)<n?r:e}function Te(e,t){if(!Number.isFinite(e)||e===0)return .1;let n=Math.abs(e);if(n>=1){let n=String(e).split(`.`)[1];if(n&&n.length>0){let e=Math.min(n.length,12),r=10**-e,i=Number(r.toFixed(e));return Math.abs(i-r)<t?i:r}return 1}let r=String(e),i=r.toLowerCase().match(/e(-?\d+)/);if(i){let e=Number(i[1]);if(e<0||r.toLowerCase().includes(`e-`)){let n=Math.abs(e),r=10**-n,i=Number(r.toFixed(n));return Math.abs(i-r)<t?i:r}return .1}let a=n.toFixed(12).replace(/0+$/,``),o=Math.min((a.split(`.`)[1]||``).length,12);if(o===0)return .1;let s=10**-o,c=Number(s.toFixed(o));return Math.abs(c-s)<t?c:s}function W(e){return typeof e.stepSize==`number`&&Number.isFinite(e.stepSize)&&e.stepSize>0?e.stepSize:void 0}function G(e,t,n){if(e==null)return e;if(Array.isArray(e)){let n=e.map(t).filter(e=>e!==null);return n.length>0?n:void 0}let r=t(e);return r===null?n?void 0:e:r}const K=e=>{if(typeof e==`number`)return Number.isFinite(e)?e:null;if(typeof e==`string`){let t=e.trim();if(t===``||/^[+-]?0[xbo]/i.test(t))return null;let n=Number(t);return Number.isFinite(n)?n:null}return null},q=e=>{if(typeof e==`boolean`)return e;if(typeof e==`string`){let t=e.trim().toLowerCase();if(t===`true`)return!0;if(t===`false`)return!1}return null},Ee=e=>typeof e==`string`?e.length>=2&&e.startsWith(`"`)&&e.endsWith(`"`)?e.slice(1,-1):e.startsWith(`"`)?e.slice(1):e:null,De=e=>{if(typeof e==`string`){let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)&&(t=t.slice(1,-1).trim()),t}return null};function J(e){return t=>{if(typeof t==`object`&&t)return t;if(typeof t==`string`&&t.trim()!==``)try{let n=JSON.parse(t);return typeof n==`object`&&n?n:(p().warn(`Parsed value for input ${e} is not an object`),null)}catch(n){return p().warn(`Failed to parse object value "${t}" for input ${e}`,n),null}return null}}function Oe(e,n=1e-8){let r=e.paramType===`Integer`,i=W(e);if(H(e.default))return{default:e.default,stepSize:i??(r?1:.1)};if(typeof e.default==`string`&&e.default.trim()!==``&&K(e.default)===null)throw new t(`Invalid numeric default "${e.default}" for input "${e.name||`unknown`}"`,m.VALIDATION_ERROR,{context:{inputName:e.name,default:e.default}});let a=G(e.default,K,!0);if(r)return Array.isArray(a)?a=a.map(e=>typeof e==`number`?Math.round(e):e):typeof a==`number`&&(a=Math.round(a)),{default:a,stepSize:i??1};let o=Array.isArray(a)?a[0]:a,s;typeof o==`number`&&Number.isFinite(o)&&o!==0?s=o:typeof e.minimum==`number`&&Number.isFinite(e.minimum)&&e.minimum!==0?s=e.minimum:typeof e.maximum==`number`&&Number.isFinite(e.maximum)&&e.maximum!==0&&(s=e.maximum);let c=i??(s===void 0?.1:Te(s,n)),l=0,u=String(c),d=u.toLowerCase().match(/e(-?\d+)/);if(l=d?Math.abs(Number(d[1])):u.split(`.`)[1]?.length??0,l===0&&typeof o==`number`&&o!==0&&Math.abs(o)<1){let e=Math.ceil(-Math.log10(Math.abs(o)));Number.isFinite(e)&&e>0&&(l=e)}return l=Math.min(Math.max(l,0),12),Array.isArray(a)?a=a.map(e=>typeof e==`number`?U(e,l,n):e):typeof a==`number`&&(a=U(a,l,n)),{default:a,stepSize:c}}const ke={types:[`Number`,`Integer`],parse(e,t){let{default:n,stepSize:r}=Oe(e);return{...t,paramType:e.paramType,minimum:e.minimum,maximum:e.maximum,atLeast:e.atLeast,atMost:e.atMost,stepSize:r,default:n}},fallback(e,t){let n=(e.atMost??1)>1,r=typeof e.minimum==`number`&&Number.isFinite(e.minimum)&&e.minimum>0?e.minimum:0;return{...t,paramType:e.paramType,minimum:e.minimum,maximum:e.maximum,atLeast:e.atLeast,atMost:e.atMost,stepSize:W(e)??(e.paramType===`Integer`?1:.1),default:n?[r]:r}}},Ae={types:[`Boolean`],parse(e,n){if(H(e.default))return{...n,paramType:`Boolean`,default:e.default};let r=G(e.default,q,!1);if(r!=null&&typeof r!=`boolean`&&!Array.isArray(r))throw new t(`Invalid boolean default "${String(r)}" for input "${e.name||`unknown`}"`,m.VALIDATION_ERROR,{context:{inputName:e.name,default:e.default}});return{...n,paramType:`Boolean`,default:r}},fallback(e,t){let n=(e.atMost??1)>1;return{...t,paramType:`Boolean`,default:n?[!1]:!1}}},je={types:[`Text`],parse(e,t){let n=G(e.default,Ee,!1);return{...t,paramType:`Text`,default:n}},fallback(e,t){let n=(e.atMost??1)>1;return{...t,paramType:`Text`,default:n?[``]:``}}},Me={types:[`ValueList`],parse(e,n){if(!e.values||typeof e.values!=`object`||Object.keys(e.values).length===0)throw t.missingValues(e.nickname||`unnamed`,`ValueList`);let r=e.default;if(e.default!==void 0&&e.default!==null){if(typeof e.default==`object`)throw new t(`ValueList input "${e.nickname||`unnamed`}" default is not a string-able value`,m.VALIDATION_ERROR,{context:{inputName:e.name,default:e.default}});let n=String(e.default).toLowerCase(),i=Object.keys(e.values).find(e=>e.toLowerCase()===n);i===void 0?p().warn(`ValueList input "${e.nickname||`unnamed`}" default value "${e.default}" is not in available values`):r=i}return{...n,paramType:`ValueList`,values:e.values,default:r}},fallback(e,t){return{...t,paramType:`ValueList`,values:e.values&&typeof e.values==`object`?e.values:{},default:void 0}}},Y={types:[`Geometry`],parse(e,t){let n=G(e.default,J(e.nickname||`unnamed`),!0);return{...t,paramType:`Geometry`,default:n}},fallback(e,t){let n=(e.atMost??1)>1;return{...t,paramType:`Geometry`,default:n?[null]:null}}},X=new Map([ke,Ae,je,Me,Y,{types:[`File`],parse(e,t){let n=G(e.default,J(e.nickname||`unnamed`),!0);return{...t,paramType:`File`,acceptedFormats:e.acceptedFormats,default:n}},fallback(e,t){let n=(e.atMost??1)>1;return{...t,paramType:`File`,default:n?[null]:null}}},{types:[`Color`],parse(e,t){let n=G(e.default,De,!1);return{...t,paramType:`Color`,default:n}},fallback(e,t){let n=(e.atMost??1)>1;return{...t,paramType:`Color`,default:n?[`0, 0, 0`]:`0, 0, 0`}}}].flatMap(e=>e.types.map(t=>[t,e]))),Ne=Y;function Z(e){return a(e,`data`)}function Pe(e){return a(e,`type`)}const Fe=new Set([`System.Double`,`System.Single`,`System.Decimal`,`System.Int32`,`System.Int64`]),Ie=new Set([`System.Int32`,`System.Int64`]);function Le(e){if(typeof e.default!=`object`||e.default===null||Array.isArray(e.default))return{schema:e};if(!o(e.default,`innerTree`)){let t=`Input "${e.name??`unknown`}" default had an unrecognized shape (no innerTree key); the default was dropped.`;return p().warn(`Unexpected structure in input.default:`,e.default),{schema:{...e,default:null},warning:{code:`MALFORMED_DEFAULT`,message:t}}}let t=a(e.default,`innerTree`)??{};if(Object.keys(t).length===0)return{schema:{...e,default:void 0}};if(e.treeAccess||e.atMost&&e.atMost>1){let n={},r=[];for(let[i,a]of Object.entries(t)){if(!Array.isArray(a)){let t=`Input "${e.name??`unknown`}" default had a non-array innerTree branch ("${i}"); the default was dropped.`;return p().warn(`Unexpected structure in input.default innerTree:`,e.default),{schema:{...e,default:null},warning:{code:`MALFORMED_DEFAULT`,message:t}}}let t=[];for(let e of a){let n=Z(e),i=Pe(e);if(i&&Fe.has(i)){if(typeof n==`string`&&n.trim()===``)continue;let e=K(n);if(e===null){r.push(`"${String(n)}" (${i})`);continue}t.push(Ie.has(i)?Math.round(e):e);continue}if(i===`System.Boolean`){let e=q(n);if(e===null){r.push(`"${String(n)}" (${i})`);continue}t.push(e);continue}if(typeof n==`string`&&i?.startsWith(`Rhino.Geometry`)){try{t.push(JSON.parse(n))}catch{t.push(n)}continue}t.push(n)}n[i]=t}let i;if(r.length>0){let t=`Input "${e.name??`unknown`}" default contained ${r.length} tree value(s) that could not be parsed and were dropped: ${r.join(`, `)}.`;p().warn(t),i={code:`MALFORMED_DEFAULT`,message:t}}return{schema:{...e,default:n},...i&&{warning:i}}}let n=[];for(let e of Object.values(t))Array.isArray(e)&&e.forEach(e=>{e&&typeof e==`object`&&o(e,`data`)&&n.push(Z(e))});return n.length===0?{schema:{...e,default:void 0}}:n.length===1?{schema:{...e,default:n[0]}}:{schema:{...e,default:n}}}const Re=new Map([...X.keys()].map(e=>[e.toLowerCase(),e]));function ze(e){return Re.get(e?.toLowerCase())??e}function Be(e){return Q(e).input}function Q(e){let n={description:e.description,name:e.name,nickname:e.nickname,treeAccess:e.treeAccess,groupName:e.groupName??void 0,id:e.id},r=ze(e.paramType),i={...e,paramType:r},a;try{let{schema:t,warning:n}=Le(i);i=t,a=n&&{inputName:e.name||`unknown`,paramType:e.paramType,message:n.message,code:n.code}}catch(t){i={...i,default:null},a={inputName:e.name||`unknown`,paramType:e.paramType,message:`Input "${e.name??`unknown`}" default could not be normalized and was dropped: ${t instanceof Error?t.message:String(t)}`,code:`MALFORMED_DEFAULT`}}let o=X.get(r);try{if(!o)throw t.unknownParamType(r,e.name);return{input:o.parse(i,n),error:a,...a&&{errors:[a]}}}catch(s){if(s instanceof t){p().error(`Validation error for input ${e.name||`unknown`}:`,s.message);let t={inputName:e.name||`unknown`,paramType:e.paramType,message:s.message,code:s.code};return{input:(o??Ne).fallback(i,n),error:t,errors:a?[a,t]:[t]}}throw new t(s instanceof Error?s.message:String(s),`VALIDATION_ERROR`,{context:{paramName:e.name,paramType:r},originalError:s instanceof Error?s:Error(String(s))})}}function Ve(e){let t=[],n=[];for(let r of e){let{input:e,errors:i}=Q(r);t.push(e),i&&n.push(...i)}return{inputs:t,parseErrors:n}}function He(e){let t=a(e,`stepSize`);return{id:a(e,`id`)??``,name:a(e,`name`)??``,nickname:a(e,`nickname`)??null,description:a(e,`description`)??``,paramType:a(e,`paramType`)??``,treeAccess:a(e,`treeAccess`)??!1,minimum:a(e,`minimum`)??null,maximum:a(e,`maximum`)??null,atLeast:a(e,`atLeast`)??1,atMost:a(e,`atMost`)??1,stepSize:typeof t==`number`&&Number.isFinite(t)?t:void 0,default:a(e,`default`),values:a(e,`values`),acceptedFormats:a(e,`acceptedFormats`),groupName:a(e,`groupName`)??null}}function Ue(e){return{name:a(e,`name`)??``,nickname:a(e,`nickname`)??null,paramType:a(e,`paramType`)??``,id:a(e,`id`)??``}}async function $(e,n){let r=S(e,[]),i={};if(r.algo&&(i.algo=r.algo),r.pointer&&(i.pointer=r.pointer),!i.algo&&!i.pointer)throw new t(`Definition must resolve to either a URL pointer or base64 algo`,m.INVALID_INPUT,{context:{definition:e}});let o=await l(`io`,i,v(n));if(!o||typeof o!=`object`)throw new t(`Invalid IO response structure`,m.INVALID_INPUT,{context:{response:o,definition:e}});let s=We(a(o,`warnings`)),c=We(a(o,`errors`)),u=a(o,`inputs`),d=a(o,`outputs`);return{inputs:Array.isArray(u)?u.map(He):[],outputs:Array.isArray(d)?d.map(Ue):[],...s&&{loadWarnings:s},...c&&{loadErrors:c}}}function We(e){if(!Array.isArray(e))return;let t=e.map(Ge).filter(e=>e!==void 0);return t.length>0?t:void 0}function Ge(e){if(e==null)return;let t;if(typeof e==`string`)t=e;else if(typeof e==`object`){let n=a(e,`message`);if(typeof n==`string`&&n.trim().length>0)t=n;else try{t=JSON.stringify(e)??String(e)}catch{t=String(e)}}else t=String(e);return t.trim().length>0?t:void 0}async function Ke(e,t){_(`fetchParsedDefinitionIO`,t.suppressBrowserWarning);let{inputs:n,outputs:r,loadWarnings:i,loadErrors:a}=await $(e,t),{inputs:o,parseErrors:s}=Ve(n);return{inputs:o,outputs:r,...s.length>0&&{parseErrors:s},...i&&{loadWarnings:i},...a&&{loadErrors:a}}}function qe(e){return(Array.isArray(e)?e:[e]).map(e=>({schemas:a(e,`schemas`),error:a(e,`error`)}))}var Je=class e{innerTree;paramName;constructor(e){this.paramName=e,this.innerTree={}}append(t,n){let r=e.formatPathString(t);this.innerTree[r]||(this.innerTree[r]=[]);let i=n.map(t=>({data:e.serializeValue(t)}));return this.innerTree[r].push(...i),this}appendSingle(e,t){return this.append(e,[t])}fromDataTreeDefault(t){this.innerTree={};for(let[n,r]of Object.entries(t)){if(!Array.isArray(r))continue;let t=e.parsePathString(n);this.append(t,r)}return this}appendFlat(e){let t=Array.isArray(e)?e:[e];return this.append([0],t)}flatten(){let t=[];for(let n of Object.values(this.innerTree))if(Array.isArray(n))for(let r of n)t.push(e.deserializeValue(r.data));return t}getPaths(){return Object.keys(this.innerTree)}getPath(t){let n=e.formatPathString(t),r=this.innerTree[n];if(r)return r.map(t=>e.deserializeValue(t.data))}toComputeFormat(){return{ParamName:this.paramName,InnerTree:this.innerTree}}getInnerTree(){return this.innerTree}getParamName(){return this.paramName}static fromInputParams(t){return t.filter(t=>e.hasValidValue(t.default)).map(t=>{let n=new e(t.nickname||`unnamed`),r=t.default;if(t.treeAccess&&H(r))n.fromDataTreeDefault(r),e.isNumericInput(t)&&n.applyNumericConstraints(t.minimum,t.maximum,t.nickname||`unnamed`);else{let i=Array.isArray(r)?r:[r],a=e.processValues(i,t);n.appendFlat(a)}return n.toComputeFormat()})}static fromInputParam(t){if(e.hasValidValue(t.default))return e.fromInputParams([t])[0]}static replaceTreeValue(t,n,r){let i=t.length>0&&t[0]instanceof e,a=e.buildFromValue(n,r);if(i){let e=t.slice(),r=e.findIndex(e=>e.getParamName()===n);return r===-1?e.push(a):e[r]=a,e}let o=t.slice(),s=a.toComputeFormat(),c=o.findIndex(e=>e.ParamName===n);return c===-1?o.push(s):o[c]=s,o}static buildFromValue(t,n){let r=new e(t);return H(n)?r.fromDataTreeDefault(n):r.appendFlat(n),r}static getTreeValue(t,n){let r=t.length>0&&t[0]instanceof e?e.readFromBuilders(t,n):e.readFromDataTrees(t,n);return r===null||r.length===0?null:r.length===1?r[0]:r}static readFromBuilders(e,t){let n=e.find(e=>e.getParamName()===t);return n?n.flatten():null}static readFromDataTrees(t,n){let r=t.find(e=>e.ParamName===n);if(!r?.InnerTree)return null;let i=Object.keys(r.InnerTree)[0];if(!i)return null;let a=r.InnerTree[i];return Array.isArray(a)?a.map(t=>t?.data===void 0?null:e.deserializeValue(t.data)):a?.data===void 0?a===void 0?null:[a]:[e.deserializeValue(a.data)]}static parsePathString(e){let t=e.match(V);if(!t)throw Error(`Invalid Grasshopper tree path: "${e}". Expected "{}", "{0}", or "{0;1;2}" (negative indices allowed, no empty segments).`);return t[1]?t[1].split(`;`).map(Number):[]}static formatPathString(e){return`{${e.join(`;`)}}`}applyNumericConstraints(t,n,r){for(let i of Object.values(this.innerTree))if(Array.isArray(i))for(let a of i){let i=e.deserializeValue(a.data);if(typeof i==`number`){let o=e.clampValue(i,t,n,r);a.data=e.serializeValue(o)}}}static serializeValue(e){return typeof e==`boolean`||typeof e==`number`||typeof e==`string`?e:typeof e==`object`&&e?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}let t=Number(e);return Number.isFinite(t)&&String(t)===e?t:e===`true`||e!==`false`&&e}static hasValidValue(e){return e==null?!1:typeof e==`string`||!(Array.isArray(e)&&e.length===0||typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0)}static isNumericInput(e){return e.paramType===`Number`||e.paramType===`Integer`}static processValues(t,n){return t.map(t=>e.isNumericInput(n)&&typeof t==`number`?e.clampValue(t,n.minimum,n.maximum,n.nickname||`unnamed`):t).filter(e=>e!=null)}static clampValue(e,t,n,r){let i=e;return t!=null&&i<t&&(p().warn(`${r}: ${e} below min ${t}, clamping`),i=t),n!=null&&i>n&&(p().warn(`${r}: ${e} above max ${n}, clamping`),i=n),i}};export{h as ComputeServerStats,fe as GrasshopperClient,we as GrasshopperResponseProcessor,D as SolveScheduler,Je as TreeBuilder,f as downloadFileData,u as extractFilesFromComputeResponse,$ as fetchDefinitionIO,Ke as fetchParsedDefinitionIO,E as hashDefinition,le as hashSolveInput,e as isDefinitionRef,Be as processInput,qe as readSchemaResults,y as solveGrasshopperDefinition,se as stableStringify};
|
|
1
|
+
import{S as e,_ as t,c as n,f as r,g as i,h as a,l as o,o as s,p as c,r as l,s as u,t as d,u as ee,x as f,y as p}from"./core-BQtRL5GE.js";var m=class t{serverUrl;apiKey;disposed=!1;activeMonitors=new Set;activeTimeouts=new Set;static DEFAULT_TIMEOUT_MS=5e3;static LIFECYCLE_TIMEOUT_MS=6e4;static MIN_MONITOR_INTERVAL_MS=100;constructor(e,t){this.serverUrl=a(e),this.apiKey=t}buildHeaders(){let e={"Content-Type":`application/json`};return this.apiKey&&(e.RhinoComputeKey=this.apiKey),e}fetchWithTimeout(e,n={},r=t.DEFAULT_TIMEOUT_MS){let i=new Headers(this.buildHeaders());n.headers&&new Headers(n.headers).forEach((e,t)=>{i.set(t,e)});let a={};i.forEach((e,t)=>{a[t]=e});let o={...n,headers:a};return r>0&&!o.signal&&(o.signal=AbortSignal.timeout(r)),fetch(e,o)}async isServerOnline(e=5e3){this.ensureNotDisposed();let t=`${this.serverUrl}/`;try{return(await this.fetchWithTimeout(t,{method:`GET`},e)).ok}catch(e){return p().debug(`[ComputeServerStats] Fetch error:`,e),!1}}async getActiveChildren(e={}){this.ensureNotDisposed();let{initialize:n=!0}=e,r=n?`${this.serverUrl}/activechildren`:`${this.serverUrl}/activechildren?initialize=false`,i=n?t.LIFECYCLE_TIMEOUT_MS:t.DEFAULT_TIMEOUT_MS;try{let e=await this.fetchWithTimeout(r,{},i);if(!e.ok)return p().warn(`[ComputeServerStats] Failed to fetch active children:`,e.status),null;let t=(await e.text()).trim();return/^\d+$/.test(t)?parseInt(t,10):(p().warn(`[ComputeServerStats] Invalid active children response:`,t),null)}catch(e){return p().warn(`[ComputeServerStats] Error fetching active children:`,e),null}}async getVersion(){this.ensureNotDisposed();try{let e=await this.fetchWithTimeout(`${this.serverUrl}/version`);if(!e.ok)return p().warn(`[ComputeServerStats] Failed to fetch version:`,e.status),null;let t=await e.text();try{let e=JSON.parse(t);return{rhino:e.rhino??``,compute:e.compute??``,git_sha:e.git_sha??null}}catch{return{rhino:t,compute:``,git_sha:null}}}catch(e){return p().warn(`[ComputeServerStats] Error fetching version:`,e),null}}async getInstalledPlugins(e=`gh`){this.ensureNotDisposed();try{let t=await this.fetchWithTimeout(`${this.serverUrl}/plugins/${e}/installed`);if(!t.ok)return p().warn(`[ComputeServerStats] Failed to fetch ${e} plugins:`,t.status),null;let n=await t.text();try{let e=JSON.parse(n);return e&&typeof e==`object`?e:null}catch{return null}}catch(t){return p().warn(`[ComputeServerStats] Error fetching ${e} plugins:`,t),null}}async getServerStats(){if(this.ensureNotDisposed(),!await this.isServerOnline())return{isOnline:!1};let[e,t]=await Promise.all([this.getVersion(),this.getActiveChildren({initialize:!1})]);return{isOnline:!0,...e&&{version:e},...t!==null&&{activeChildren:t}}}async purgeCache(){this.ensureNotDisposed();try{let e=await this.fetchWithTimeout(`${this.serverUrl}/cache/purge`,{method:`POST`});if(!e.ok)return p().warn(`[ComputeServerStats] Failed to purge cache:`,e.status),null;let t=await e.text();try{let e=JSON.parse(t);return typeof e.purged==`number`?e.purged:null}catch{return null}}catch(e){return p().warn(`[ComputeServerStats] Error purging cache:`,e),null}}async purgeAllChildren(){this.ensureNotDisposed();let e=await this.getActiveChildren({initialize:!1});if(e===null)return p().warn(`[ComputeServerStats] purgeAllChildren: could not read child count`),null;if(e===0)return{totalPurged:0,calls:0,children:0,confident:!0};let t=e*2,n=0;for(let e=0;e<t;e++){let e=await this.purgeCache();e!==null&&(n+=e)}return{totalPurged:n,calls:t,children:e,confident:e===1}}async getServerTime(){this.ensureNotDisposed();try{let e=await this.fetchWithTimeout(`${this.serverUrl}/servertime`);if(!e.ok)return p().warn(`[ComputeServerStats] Failed to fetch server time:`,e.status),null;let t=(await e.text()).trim().replace(/^"|"$/g,``),n=new Date(t);return isNaN(n.getTime())?null:n}catch(e){return p().warn(`[ComputeServerStats] Error fetching server time:`,e),null}}async getIdleSpan(){this.ensureNotDisposed();try{let e=await this.fetchWithTimeout(`${this.serverUrl}/idlespan`);if(!e.ok)return p().warn(`[ComputeServerStats] Failed to fetch idle span:`,e.status),null;let t=parseFloat((await e.text()).trim());return isNaN(t)?null:t}catch(e){return p().warn(`[ComputeServerStats] Error fetching idle span:`,e),null}}async launchChildren(){return this.postJson(`/launch-children`)}async launchChild(e){let t=e===void 0?`/launch-child`:`/launch-child?port=${e}`;return this.postJson(t)}async shutdownChildren(e){let t=e===void 0?`/shutdown-children`:`/shutdown-children?port=${e}`;return this.postJson(t)}async recycleChildren(e){let t=e===void 0?`/recycle-children`:`/recycle-children?port=${e}`;return this.postJson(t)}async postJson(e){this.ensureNotDisposed();try{let n=await this.fetchWithTimeout(`${this.serverUrl}${e}`,{method:`POST`},t.LIFECYCLE_TIMEOUT_MS);if(!n.ok)return p().warn(`[ComputeServerStats] POST ${e} failed:`,n.status),null;let r=await n.text();try{return JSON.parse(r)}catch{return null}}catch(t){return p().warn(`[ComputeServerStats] Error on POST ${e}:`,t),null}}monitor(e,n=5e3){if(this.ensureNotDisposed(),!Number.isFinite(n)||n<t.MIN_MONITOR_INTERVAL_MS)throw RangeError(`monitor() intervalMs must be a finite number >= ${t.MIN_MONITOR_INTERVAL_MS}ms, got ${n}. Sub-${t.MIN_MONITOR_INTERVAL_MS}ms polling would hot-loop the server.`);let r=!0,i=null;p().info(`🔄 Starting server stats monitoring every ${n}ms`);let a=async()=>{if(i!==null&&(this.activeTimeouts.delete(i),i=null),!(!r||this.disposed)){try{let t=await this.getServerStats();if(!r||this.disposed)return;try{e(t)}catch(e){p().error(`[ComputeServerStats] Monitor callback threw:`,e)}}catch(e){!r||this.disposed?p().debug(`[ComputeServerStats] Monitor poll cancelled during shutdown:`,e):p().error(`[ComputeServerStats] Failed to fetch stats during monitor:`,e)}r&&!this.disposed&&(i=setTimeout(()=>void a(),n),this.activeTimeouts.add(i))}},o=()=>{r=!1,i!==null&&(clearTimeout(i),this.activeTimeouts.delete(i),i=null),this.activeMonitors.delete(o)};return this.activeMonitors.add(o),a(),o}async dispose(){if(!this.disposed){this.disposed=!0;for(let e of this.activeMonitors)e();this.activeMonitors.clear();for(let e of this.activeTimeouts)clearTimeout(e);this.activeTimeouts.clear()}}ensureNotDisposed(){if(this.disposed)throw new f(`ComputeServerStats has been disposed and cannot be used`,e.INVALID_STATE,{context:{disposed:this.disposed}})}};const h=new Set;function te(){if(typeof window>`u`||globalThis.process?.versions?.node!=null)return!1;let e=globalThis.navigator,t=typeof e?.userAgent==`string`?e.userAgent:``;return!/jsdom/i.test(t)}function g(e,t){t||te()&&!h.has(e)&&(h.add(e),p().warn(`Warning: ${e} is running on the client side. For better performance and security, consider running this on the server side.`))}const ne={definition_not_cached:e.DEFINITION_NOT_CACHED};function _(e){return{...e,serverErrorCodes:{...ne,...e.serverErrorCodes}}}function re(t){return t instanceof f?t.code===e.DEFINITION_NOT_CACHED||t.message.includes(`Unable to load grasshopper definition`):!1}function ie(e,n){if(!n)return;let r=t(e,`values`);if(!Array.isArray(r)||r.length===0)return;let i=[];for(let e of r){let n=t(e,`innerTree`);(!n||Object.keys(n).length===0)&&i.push(t(e,`paramName`)??`<unnamed>`)}if(i.length===0)return;let a=i.length===r.length?`all`:`${i.length}/${r.length}`;p().warn(`Solve returned empty output(s) (${a}): ${i.join(`, `)}. These parameters produced no data — check the definition's inputs and the branch feeding each.`)}async function v(e,t,n){g(`solveGrasshopperDefinition`,n.suppressBrowserWarning);let{response:r}=await b(x(await y(t),e),n);return r}async function ae(e,t,n){return g(`solveGrasshopperDefinitionWithCacheKey`,n.suppressBrowserWarning),b(x(await y(t),e),n)}async function oe(e,t,n,r){g(`solveByCacheKey`,r.suppressBrowserWarning);let i={algo:null,pointer:t,values:e};try{return{...await b(i,r),missed:!1}}catch(t){if(!re(t))throw t;return{...await b(x(await y(n),e),r),missed:!0}}}async function y(t){if(!s(t))return t;try{return await t.load()}catch(n){throw new f(`Failed to load definition bytes for ref '${t.key}'`,e.INVALID_INPUT,{context:{definitionKey:t.key},originalError:n instanceof Error?n:Error(String(n))})}}async function b(e,t){se(e,t);let r=await u(`grasshopper`,e,_(t)),{pointer:i,algo:a,...s}=r,c=s,l=n(r);if(l!==void 0){let e=typeof a==`string`?a.length:0;o(c,Math.max(0,l-e))}return ie(c,t.debug),{response:c,cacheKey:typeof i==`string`?i:null}}function x(e,t){let n={algo:null,pointer:null,values:t};return e instanceof Uint8Array?n.algo=ee(e):/^https?:\/\//i.test(e)?n.pointer=e:n.algo=r(e)??c(e),n}function se(e,t){t.cachesolve!=null&&(e.cachesolve=t.cachesolve),t.cacheerroredsolves!=null&&(e.cacheerroredsolves=t.cacheerroredsolves),t.modelunits!=null&&(e.modelunits=t.modelunits),t.angletolerance!=null&&(e.angletolerance=t.angletolerance),t.absolutetolerance!=null&&(e.absolutetolerance=t.absolutetolerance),t.dataversion!=null&&(e.dataversion=t.dataversion)}function S(e){let t=new WeakSet,n=e=>{if(e===void 0)return`undefined`;if(e===null)return`null`;if(typeof e==`number`)return Number.isFinite(e)?String(e):`null`;if(typeof e==`string`||typeof e==`boolean`)return JSON.stringify(e);if(typeof e==`bigint`)return`${e}n`;if(e instanceof Uint8Array)return`{"__u8":${e.length},"hash":"${C(e)}"}`;if(Array.isArray(e)){if(t.has(e))return`"[Circular]"`;t.add(e);let r=[];for(let t=0;t<e.length;t++)r.push(n(e[t]));return t.delete(e),`[${r.join(`,`)}]`}if(typeof e==`object`){if(t.has(e))return`"[Circular]"`;t.add(e);let r;return r=typeof e.toJSON==`function`?n(e.toJSON()):e instanceof Map?`{"__map":[${[...e.entries()].map(([e,t])=>`[${n(e)},${n(t)}]`).sort().join(`,`)}]}`:e instanceof Set?`{"__set":[${[...e.values()].map(n).sort().join(`,`)}]}`:`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${n(e[t])}`).join(`,`)}}`,t.delete(e),r}return`null`};return n(e)}function ce(e,t){let n=2166136261;for(let r=0;r<e;r++)n^=t(r),n=n+((n<<1)+(n<<4)+(n<<7)+(n<<8)+(n<<24))>>>0;return n.toString(16).padStart(8,`0`)}function le(e){return ce(e.length,t=>e.charCodeAt(t))}function C(e){return ce(e.length,t=>e[t])}function ue(e,t){return w(T(e),t)}function w(e,t){let n=S(t);return`${e}|t:${n.length}:${le(n)}`}function T(e){return s(e)?`r:${e.key}`:typeof e==`string`?`s:${e.length}:${le(e)}`:`u8:${e.length}:${C(e)}`}function de(e){return typeof e!=`string`||!/^https?:\/\//i.test(e)}function fe(e){try{return JSON.stringify(e)?.length??0}catch{return 0}}var E=class{executor;baseConfig;mode;maxConcurrent;maxQueueDepth;queueWaitMs;timeoutMs;retry;cacheEnabled;cacheMaxBytes;cacheTtl;cacheErroredSolves;cache=new Map;cacheBytes=0;cacheHits=0;cacheMisses=0;cacheEvictions=0;cacheKeyExecutor;reuseServerDefinitionCache;serverCacheKeys=new Map;onStart;onSettle;onSuperseded;subscribers=new Set;inFlight=new Set;pendingForLatestWins=null;fifoQueue=[];_lastResult=null;_lastError=null;_lastDurationMs=null;solveSeq=0;lastStateSeq=0;disposed=!1;constructor(e,t,n={},r){this.executor=e,this.cacheKeyExecutor=r,this.baseConfig=t,this.mode=n.mode??`latest-wins`,this.maxConcurrent=Math.max(1,n.maxConcurrent??(this.mode===`parallel`?4:1)),this.maxQueueDepth=n.maxQueueDepth!==void 0&&n.maxQueueDepth>0?Math.floor(n.maxQueueDepth):void 0,this.queueWaitMs=n.queueWaitMs!==void 0&&n.queueWaitMs>0?n.queueWaitMs:void 0,this.timeoutMs=n.timeoutMs,this.retry=n.retry;let i=n.cache,a=typeof i==`object`?i:null;this.cacheMaxBytes=Math.max(0,a?.maxBytes??0),this.cacheEnabled=this.cacheMaxBytes>0,this.cacheTtl=a?.ttlMs??0,this.cacheErroredSolves=a?.cacheErroredSolves??!0,this.reuseServerDefinitionCache=!!r&&(n.reuseServerDefinitionCache??!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}get lastResult(){return this._lastResult}get lastError(){return this._lastError}get lastDurationMs(){return this._lastDurationMs}setMaxConcurrent(e){let t=Math.max(1,Math.floor(e));if(t===this.maxConcurrent)return;let n=t>this.maxConcurrent;this.maxConcurrent=t,n&&this.drainNext()}getMaxConcurrent(){return this.maxConcurrent}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}notify(){for(let e of this.subscribers)try{e()}catch(e){p().error(`[SolveScheduler] subscriber threw:`,e)}}solve(t,n,r){if(this.disposed)return Promise.reject(new f(`SolveScheduler has been disposed and cannot be used`,e.INVALID_STATE));let i=T(t),a=w(i,n),o=++this.solveSeq,s={key:a,enqueuedAt:Date.now(),startedAt:null};if(r?.signal?.aborted)return Promise.reject(this.makeAbortError(s));if(this.cacheEnabled){let e=this.readCache(a);if(e){this.mode===`latest-wins`&&this.supersedeCurrent();let t={status:`success`,response:e,durationMs:0,fromCache:!0};return this.writeLastState(o,{result:e,durationMs:0}),this.runHook(this.onStart,s),this.runHook(this.onSettle,s,t),this.notify(),Promise.resolve(e)}}return new Promise((e,a)=>{let c={definition:t,dataTree:n,definitionHash:i,ctx:s,seq:o,resolve:e,reject:a,externalSignal:r?.signal};c.externalSignal&&(c.queuedAbortHandler=()=>this.abortQueuedItem(c),c.externalSignal.addEventListener(`abort`,c.queuedAbortHandler,{once:!0})),this.enqueue(c)})}writeLastState(e,t){return e<this.lastStateSeq?!1:(this.lastStateSeq=e,`result`in t?(this._lastResult=t.result,this._lastError=null):this._lastError=t.error,this._lastDurationMs=t.durationMs,!0)}supersedeCurrent(){this.pendingForLatestWins&&=(this.supersede(this.pendingForLatestWins),null);for(let e of this.inFlight)this.supersede(e),e.controller.abort()}abortQueuedItem(e){this.pendingForLatestWins===e&&(this.pendingForLatestWins=null);let t=this.fifoQueue.indexOf(e);t>=0&&this.fifoQueue.splice(t,1),this.rejectAsAborted(e),this.notify()}shedAsQueueFull(t){let n=new f(`Solve queue is full; request rejected (backpressure)`,e.QUEUE_FULL,{statusCode:503,context:{key:t.ctx.key,queueDepth:this.fifoQueue.length,maxQueueDepth:this.maxQueueDepth}});this.settleError(t,n)&&this.runHook(this.onSettle,t.ctx,{status:`error`,error:n,durationMs:0}),this.notify()}armQueueWaitTimer(t){if(this.queueWaitMs===void 0)return;let n=this.queueWaitMs;t.queueWaitTimer=setTimeout(()=>{if(t.settled)return;let r=this.fifoQueue.indexOf(t);r>=0&&this.fifoQueue.splice(r,1);let i=new f(`Solve waited longer than ${n}ms in queue; rejected (backpressure)`,e.QUEUE_TIMEOUT,{statusCode:503,context:{key:t.ctx.key,waitedMs:Date.now()-t.ctx.enqueuedAt,queueWaitMs:n}});this.settleError(t,i)&&this.runHook(this.onSettle,t.ctx,{status:`error`,error:i,durationMs:0}),this.notify()},n)}clearQueueWaitTimer(e){e.queueWaitTimer!==void 0&&(clearTimeout(e.queueWaitTimer),e.queueWaitTimer=void 0)}enqueue(e){switch(this.mode){case`latest-wins`:this.supersedeCurrent(),this.inFlight.size===0?this.execute(e):this.pendingForLatestWins=e;break;case`queue`:case`parallel`:this.inFlight.size<this.maxConcurrent?this.execute(e):this.maxQueueDepth!==void 0&&this.fifoQueue.length>=this.maxQueueDepth?this.shedAsQueueFull(e):(this.armQueueWaitTimer(e),this.fifoQueue.push(e))}this.notify()}async execute(e){let t=new AbortController,n=e;n.controller=t,this.inFlight.add(n),e.ctx.startedAt=Date.now(),this.clearQueueWaitTimer(e),this.removeQueuedAbortHandler(e);let r=()=>t.abort();e.externalSignal?.addEventListener(`abort`,r,{once:!0}),this.runHook(this.onStart,e.ctx),this.notify();let i=performance.now();try{let n={...this.baseConfig,signal:t.signal,...this.timeoutMs!==void 0&&{timeoutMs:this.timeoutMs},...this.retry!==void 0&&{retry:this.retry}},{response:r,definitionReuploaded:a}=await this.runExecutor(e.definition,e.dataTree,e.definitionHash,n),o=performance.now()-i;if(this.cacheEnabled&&this.writeCache(e.ctx.key,r),!this.settleSuccess(e,r))return;this.writeLastState(e.seq,{result:r,durationMs:o}),this.runHook(this.onSettle,e.ctx,{status:`success`,response:r,durationMs:o,fromCache:!1,definitionReuploaded:a})}catch(t){let r=performance.now()-i,a=this.normalizeExecutionError(t,n);this.writeLastState(e.seq,{error:a,durationMs:r}),this.settleError(e,a)&&this.runHook(this.onSettle,e.ctx,{status:`error`,error:a,durationMs:r})}finally{e.externalSignal?.removeEventListener(`abort`,r),this.inFlight.delete(n),this.drainNext(),this.notify()}}async runExecutor(e,t,n,r){if(!this.cacheKeyExecutor||!this.reuseServerDefinitionCache||!de(e))return{response:await this.executor(e,t,r)};let i=n,a=this.serverCacheKeys.get(i)??null,o=await this.cacheKeyExecutor(e,t,a,r);if(o.cacheKey)for(this.serverCacheKeys.delete(i),this.serverCacheKeys.set(i,o.cacheKey);this.serverCacheKeys.size>100;){let e=this.serverCacheKeys.keys().next().value;if(e===void 0)break;this.serverCacheKeys.delete(e)}else this.serverCacheKeys.delete(i);return{response:o.response,definitionReuploaded:o.missed}}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(t){let n=new f(`Superseded by newer solve`,e.SUPERSEDED,{context:{key:t.ctx.key,enqueuedAt:t.ctx.enqueuedAt}});this.settleError(t,n)&&this.runHook(this.onSuperseded,t.ctx)}makeAbortError(t){return new f(`Request aborted by caller`,e.ABORTED,{context:{key:t.key,enqueuedAt:t.enqueuedAt}})}settleError(e,t){return!e.settled&&(e.settled={error:t},this.clearQueueWaitTimer(e),this.removeQueuedAbortHandler(e),e.reject(t),!0)}settleSuccess(e,t){return!e.settled&&(e.settled={ok:!0},this.clearQueueWaitTimer(e),this.removeQueuedAbortHandler(e),e.resolve(t),!0)}removeQueuedAbortHandler(e){e.queuedAbortHandler&&e.externalSignal&&e.externalSignal.removeEventListener(`abort`,e.queuedAbortHandler),e.queuedAbortHandler=void 0}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(t,n){return n.settled&&`error`in n.settled?n.settled.error:t instanceof f?t:this.isAbortLikeError(t)?this.makeAbortError(n.ctx):new f(t instanceof Error?t.message:String(t),e.UNKNOWN_ERROR,{originalError:t instanceof Error?t:Error(String(t))})}cancelAll(){for(this.pendingForLatestWins&&=(this.rejectAsAborted(this.pendingForLatestWins),null);this.fifoQueue.length>0;){let e=this.fifoQueue.shift();this.rejectAsAborted(e)}for(let e of this.inFlight){let t=this.makeAbortError(e.ctx);this.settleError(e,t)&&this.runHook(this.onSettle,e.ctx,{status:`error`,error:t,durationMs:e.ctx.startedAt?Date.now()-e.ctx.startedAt:0}),e.controller.abort()}this.notify()}rejectAsAborted(e){let t=this.makeAbortError(e.ctx);this.settleError(e,t)&&this.runHook(this.onSettle,e.ctx,{status:`error`,error:t,durationMs:0})}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.dropCacheEntry(e),this.cacheMisses+=1,null):(this.cache.delete(e),this.cache.set(e,t),this.cacheHits+=1,t.response):(this.cacheMisses+=1,null)}writeCache(e,t){if(!this.cacheEnabled||!this.cacheErroredSolves&&t.errors&&t.errors.length>0)return;let r=n(t)??fe(t);if(!(r>this.cacheMaxBytes))for(this.dropCacheEntry(e),this.cache.set(e,{response:t,insertedAt:Date.now(),sizeBytes:r}),this.cacheBytes+=r;this.cacheBytes>this.cacheMaxBytes&&this.cache.size>0;){let e=this.cache.keys().next().value;if(e===void 0)break;this.dropCacheEntry(e),this.cacheEvictions+=1}}dropCacheEntry(e){let t=this.cache.get(e);t&&(this.cache.delete(e),this.cacheBytes-=t.sizeBytes)}clearCache(){this.cache.clear(),this.cacheBytes=0}cacheStats(){return{entries:this.cache.size,bytes:this.cacheBytes,hits:this.cacheHits,misses:this.cacheMisses,evictions:this.cacheEvictions}}dispose(){this.disposed||(this.disposed=!0,this.cancelAll(),this.subscribers.clear(),this.clearCache())}runHook(e,...t){if(e)try{e(...t)}catch(e){p().error(`[SolveScheduler] hook threw:`,e)}}};function D(e){return s(e)?`ref:${e.key}`:typeof e==`string`&&e.length<200?e:`...content...`}function O(e){return Array.isArray(e)?e.map(e=>{let n=0,r=0,i=t(e,`innerTree`);if(i&&typeof i==`object`){for(let e of Object.values(i))if(Array.isArray(e)){n+=e.length;for(let t of e){let e=t?.data;typeof e==`string`&&(r+=e.length)}}}return{param:t(e,`paramName`)??`<unnamed>`,items:n,bytes:r}}):[]}var pe=class t{config;serverStats;disposed=!1;constructor(e){this.config=this.normalizeComputeConfig(e),this.serverStats=new m(this.config.serverUrl,this.config.apiKey)}static async create(n){let r=new t(n),i=Math.max(1,(n.retry?.attempts??2)+1),a=n.retry?.baseDelayMs??250,o=n.retry?.maxDelayMs??1e3;for(let e=0;e<i;e++){if(await r.serverStats.isServerOnline())return r;if(e<i-1){let t=Math.min(a*2**e,o);await new Promise(e=>setTimeout(e,t))}}throw await r.dispose(),new f(`Rhino Compute server is not online`,e.NETWORK_ERROR,{context:{serverUrl:r.config.serverUrl,attempts:i}})}getConfig(){return this.ensureNotDisposed(),{...this.config}}async getIO(e){return this.ensureNotDisposed(),qe(e,this.config)}async getRawIO(e){return this.ensureNotDisposed(),Q(e,this.config)}async solve(t,n,r){this.ensureNotDisposed();try{if(typeof t==`string`&&!t?.trim())throw new f(`Definition URL/content is required`,e.INVALID_INPUT,{context:{receivedUrl:t}});if(t instanceof Uint8Array&&t.length===0)throw new f(`Definition content is empty`,e.INVALID_INPUT);if(s(t)&&!t.key.trim())throw new f(`DefinitionRef key is empty`,e.INVALID_INPUT);let i=await v(n,t,{...this.config,...r?.signal!==void 0&&{signal:r.signal},...r?.timeoutMs!==void 0&&{timeoutMs:r.timeoutMs},...r?.retry!==void 0&&{retry:r.retry}});if(i?.errors&&i.errors.length>0)throw new f(i.errors.join(`; `)||`Computation failed`,e.COMPUTATION_ERROR,{context:{definition:D(t),inputSummary:O(n),errors:i.errors,warnings:i.warnings,values:i.values}});return i}catch(r){throw this.config.debug&&p().error(`Compute failed:`,r),r instanceof f?r:new f(r instanceof Error?r.message:String(r),e.COMPUTATION_ERROR,{context:{definition:D(t),inputSummary:O(n)},originalError:r instanceof Error?r:Error(String(r))})}}createScheduler(e){return this.ensureNotDisposed(),new E((e,t,n)=>v(t,e,n),this.config,e,(e,t,n,r)=>n===null?ae(t,e,r).then(e=>({...e,missed:!1})):oe(t,n,e,r))}async dispose(){this.disposed||(this.disposed=!0,await this.serverStats.dispose())}ensureNotDisposed(){if(this.disposed)throw new f(`GrasshopperClient has been disposed and cannot be used`,e.INVALID_STATE)}normalizeComputeConfig(e){return{...e,serverUrl:a(e.serverUrl),apiKey:e.apiKey,authToken:e.authToken,debug:e.debug??!1,suppressBrowserWarning:e.suppressBrowserWarning}}};const k=new Map;function A(e,t){k.set(e,t)}A(`Rhino.Geometry.Point3d`,(e,t)=>{let n=t;return!n||typeof n.X!=`number`?null:new e.Point([n.X,n.Y,n.Z])}),A(`Rhino.Geometry.Line`,(e,t)=>{let n=t;return!n||!n.From||!n.To?null:new e.Line([n.From.X,n.From.Y,n.From.Z],[n.To.X,n.To.Y,n.To.Z])});function me(e){if(k.has(e))return k.get(e);for(let[t,n]of k)if(e.startsWith(t))return n}function he(e){return!!(e&&typeof e==`object`&&typeof e.data==`string`)}function j(e,t){return{__decodeError:!0,type:e,raw:t}}function ge(e,t,n){let r=me(t),i=!1;if(r)try{let t=r(n,e);if(t!=null)return t}catch(e){p().warn(`Failed to decode Rhino type ${t}:`,e),i=!0}try{if(he(e))return n.CommonObject.decode(e)}catch(n){return p().warn(`Failed to decode ${t} with CommonObject:`,n),j(t,e)}return i?j(t,e):e}function _e(e){let t=new WeakSet,n=e=>{if(!e||typeof e!=`object`||t.has(e))return;t.add(e);let r=e.delete;if(typeof r==`function`){let t=e.isDeleted;(typeof t!=`function`||!t.call(e))&&r.call(e);return}if(Array.isArray(e)){for(let t of e)n(t);return}let i=Object.getPrototypeOf(e);if(i===Object.prototype||i===null)for(let t of Object.values(e))n(t)};n(e)}const M={STRING:`System.String`,INT:`System.Int32`,DOUBLE:`System.Double`,BOOL:`System.Boolean`},ve=[`WebDisplay`];function N(e){return ve.some(t=>e.includes(t))}function ye(e){if(typeof e!=`string`)return e;let t=e.trim();if(!(t.startsWith(`{`)||t.startsWith(`[`)||t.startsWith(`"`)))return e;try{let e=JSON.parse(t);if(typeof e==`string`)try{return JSON.parse(e)}catch{return e}return e}catch{return e}}function be(e,t,n){switch(t){case M.STRING:return typeof e==`string`?e.replace(/^"(.*)"$/,`$1`):e;case M.INT:return Number.parseInt(e,10);case M.DOUBLE:return Number.parseFloat(e);case M.BOOL:return String(e).toLowerCase()===`true`;default:return n&&t.startsWith(`Rhino.Geometry.`)?ge(e,t,n):e}}const P=new WeakMap;function F(e){if(P.has(e))return P.get(e);let t=ye(e.data);return P.set(e,t),t}function I(e,t,n,r){return typeof e.data==`string`?be(n?F(e):e.data,t,r):e.data}function xe(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.fileName==`string`&&typeof t.fileType==`string`&&`data`in t&&typeof t.isBase64Encoded==`boolean`&&typeof t.subFolder==`string`}function L(e){let n=t(e,`values`);return Array.isArray(n)?n:[]}function R(e){return typeof e.type==`string`?e.type:``}function z(e,t){if(!(!e||typeof e!=`object`)){for(let n of Object.values(e))if(Array.isArray(n))for(let e of n)e&&typeof e==`object`&&t(e)}}function Se(e,n=!1,r={}){let{parseValues:i=!0,rhino:a,stringOnly:o=!1}=r,s={},c=new Set;for(let r of L(e)){let e=t(r,`paramName`);z(t(r,`innerTree`),t=>{let r=R(t);if(N(r)||o&&r!==M.STRING)return;let l=n?t.id:e;if(!l)return;let u=I(t,r,i,a);l in s?c.has(l)?s[l].push(u):(s[l]=[s[l],u],c.add(l)):s[l]=u})}return{values:s,dispose:()=>_e(s)}}function Ce(e){let n=[];for(let r of L(e))z(t(r,`innerTree`),e=>{if(!R(e).includes(`FileData`))return;let t=F(e);xe(t)&&n.push(t)});return n}function we(e,n,r={}){let{parseValues:i=!0,rhino:a,stringOnly:o=!1}=r;for(let r of L(e)){let e=t(r,`innerTree`),s=!1;if(`byName`in n){if(t(r,`paramName`)!==n.byName)continue;s=!0}let c=[];if(z(e,e=>{if(`byId`in n){if(e.id!==n.byId)return;s=!0}let t=R(e);N(t)||o&&t!==M.STRING||c.push(I(e,t,i,a))}),s)return c.length===0?void 0:c.length===1?c[0]:c}}var Te=class{response;debug;constructor(e,t=!1){this.response=e,this.debug=t}getValues(e=!1,t={}){return Se(this.response,e,t)}getValue(e,t){return we(this.response,e,t)}getFileData(){return Ce(this.response)}async getAndDownloadFiles(e,t){let n=this.getFileData();await d(n,e,t)}};const B=/^\{(-?\d+(?:;-?\d+)*)?\}$/;function V(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=Object.entries(e);return t.length>0&&t.every(([e,t])=>B.test(e)&&Array.isArray(t))}function H(e,t,n){let r=Number(e.toFixed(t));return Math.abs(e-r)<n?r:e}function Ee(e,t){if(!Number.isFinite(e)||e===0)return .1;let n=Math.abs(e);if(n>=1){let n=String(e).split(`.`)[1];if(n&&n.length>0){let e=Math.min(n.length,12),r=10**-e,i=Number(r.toFixed(e));return Math.abs(i-r)<t?i:r}return 1}let r=String(e),i=r.toLowerCase().match(/e(-?\d+)/);if(i){let e=Number(i[1]);if(e<0||r.toLowerCase().includes(`e-`)){let n=Math.abs(e),r=10**-n,i=Number(r.toFixed(n));return Math.abs(i-r)<t?i:r}return .1}let a=n.toFixed(12).replace(/0+$/,``),o=Math.min((a.split(`.`)[1]||``).length,12);if(o===0)return .1;let s=10**-o,c=Number(s.toFixed(o));return Math.abs(c-s)<t?c:s}function U(e){return typeof e.stepSize==`number`&&Number.isFinite(e.stepSize)&&e.stepSize>0?e.stepSize:void 0}function W(e,t,n){if(e==null)return e;if(Array.isArray(e)){let n=e.map(t).filter(e=>e!==null);return n.length>0?n:void 0}let r=t(e);return r===null?n?void 0:e:r}const G=e=>{if(typeof e==`number`)return Number.isFinite(e)?e:null;if(typeof e==`string`){let t=e.trim();if(t===``||/^[+-]?0[xbo]/i.test(t))return null;let n=Number(t);return Number.isFinite(n)?n:null}return null},K=e=>{if(typeof e==`boolean`)return e;if(typeof e==`string`){let t=e.trim().toLowerCase();if(t===`true`)return!0;if(t===`false`)return!1}return null},De=e=>typeof e==`string`?e.length>=2&&e.startsWith(`"`)&&e.endsWith(`"`)?e.slice(1,-1):e.startsWith(`"`)?e.slice(1):e:null,Oe=e=>{if(typeof e==`string`){let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)&&(t=t.slice(1,-1).trim()),t}return null};function q(e){return t=>{if(typeof t==`object`&&t)return t;if(typeof t==`string`&&t.trim()!==``)try{let n=JSON.parse(t);return typeof n==`object`&&n?n:(p().warn(`Parsed value for input ${e} is not an object`),null)}catch(n){return p().warn(`Failed to parse object value "${t}" for input ${e}`,n),null}return null}}function ke(t,n=1e-8){let r=t.paramType===`Integer`,i=U(t);if(V(t.default))return{default:t.default,stepSize:i??(r?1:.1)};if(typeof t.default==`string`&&t.default.trim()!==``&&G(t.default)===null)throw new f(`Invalid numeric default "${t.default}" for input "${t.name||`unknown`}"`,e.VALIDATION_ERROR,{context:{inputName:t.name,default:t.default}});let a=W(t.default,G,!0);if(r)return Array.isArray(a)?a=a.map(e=>typeof e==`number`?Math.round(e):e):typeof a==`number`&&(a=Math.round(a)),{default:a,stepSize:i??1};let o=Array.isArray(a)?a[0]:a,s;typeof o==`number`&&Number.isFinite(o)&&o!==0?s=o:typeof t.minimum==`number`&&Number.isFinite(t.minimum)&&t.minimum!==0?s=t.minimum:typeof t.maximum==`number`&&Number.isFinite(t.maximum)&&t.maximum!==0&&(s=t.maximum);let c=i??(s===void 0?.1:Ee(s,n)),l=0,u=String(c),d=u.toLowerCase().match(/e(-?\d+)/);if(l=d?Math.abs(Number(d[1])):u.split(`.`)[1]?.length??0,l===0&&typeof o==`number`&&o!==0&&Math.abs(o)<1){let e=Math.ceil(-Math.log10(Math.abs(o)));Number.isFinite(e)&&e>0&&(l=e)}return l=Math.min(Math.max(l,0),12),Array.isArray(a)?a=a.map(e=>typeof e==`number`?H(e,l,n):e):typeof a==`number`&&(a=H(a,l,n)),{default:a,stepSize:c}}const Ae={types:[`Number`,`Integer`],parse(e,t){let{default:n,stepSize:r}=ke(e);return{...t,paramType:e.paramType,minimum:e.minimum,maximum:e.maximum,atLeast:e.atLeast,atMost:e.atMost,stepSize:r,default:n}},fallback(e,t){let n=(e.atMost??1)>1,r=typeof e.minimum==`number`&&Number.isFinite(e.minimum)&&e.minimum>0?e.minimum:0;return{...t,paramType:e.paramType,minimum:e.minimum,maximum:e.maximum,atLeast:e.atLeast,atMost:e.atMost,stepSize:U(e)??(e.paramType===`Integer`?1:.1),default:n?[r]:r}}},je={types:[`Boolean`],parse(t,n){if(V(t.default))return{...n,paramType:`Boolean`,default:t.default};let r=W(t.default,K,!1);if(r!=null&&typeof r!=`boolean`&&!Array.isArray(r))throw new f(`Invalid boolean default "${String(r)}" for input "${t.name||`unknown`}"`,e.VALIDATION_ERROR,{context:{inputName:t.name,default:t.default}});return{...n,paramType:`Boolean`,default:r}},fallback(e,t){let n=(e.atMost??1)>1;return{...t,paramType:`Boolean`,default:n?[!1]:!1}}},Me={types:[`Text`],parse(e,t){let n=W(e.default,De,!1);return{...t,paramType:`Text`,default:n}},fallback(e,t){let n=(e.atMost??1)>1;return{...t,paramType:`Text`,default:n?[``]:``}}},Ne={types:[`ValueList`],parse(t,n){if(!t.values||typeof t.values!=`object`||Object.keys(t.values).length===0)throw f.missingValues(t.nickname||`unnamed`,`ValueList`);let r=t.default;if(t.default!==void 0&&t.default!==null){if(typeof t.default==`object`)throw new f(`ValueList input "${t.nickname||`unnamed`}" default is not a string-able value`,e.VALIDATION_ERROR,{context:{inputName:t.name,default:t.default}});let n=String(t.default).toLowerCase(),i=Object.keys(t.values).find(e=>e.toLowerCase()===n);i===void 0?p().warn(`ValueList input "${t.nickname||`unnamed`}" default value "${t.default}" is not in available values`):r=i}return{...n,paramType:`ValueList`,values:t.values,default:r}},fallback(e,t){return{...t,paramType:`ValueList`,values:e.values&&typeof e.values==`object`?e.values:{},default:void 0}}},J={types:[`Geometry`],parse(e,t){let n=W(e.default,q(e.nickname||`unnamed`),!0);return{...t,paramType:`Geometry`,default:n}},fallback(e,t){let n=(e.atMost??1)>1;return{...t,paramType:`Geometry`,default:n?[null]:null}}},Y=new Map([Ae,je,Me,Ne,J,{types:[`File`],parse(e,t){let n=W(e.default,q(e.nickname||`unnamed`),!0);return{...t,paramType:`File`,acceptedFormats:e.acceptedFormats,default:n}},fallback(e,t){let n=(e.atMost??1)>1;return{...t,paramType:`File`,default:n?[null]:null}}},{types:[`Color`],parse(e,t){let n=W(e.default,Oe,!1);return{...t,paramType:`Color`,default:n}},fallback(e,t){let n=(e.atMost??1)>1;return{...t,paramType:`Color`,default:n?[`0, 0, 0`]:`0, 0, 0`}}}].flatMap(e=>e.types.map(t=>[t,e]))),Pe=J;function X(e){return t(e,`data`)}function Fe(e){return t(e,`type`)}const Ie=new Set([`System.Double`,`System.Single`,`System.Decimal`,`System.Int32`,`System.Int64`]),Le=new Set([`System.Int32`,`System.Int64`]);function Re(e){if(typeof e.default!=`object`||e.default===null||Array.isArray(e.default))return{schema:e};if(!i(e.default,`innerTree`)){let t=`Input "${e.name??`unknown`}" default had an unrecognized shape (no innerTree key); the default was dropped.`;return p().warn(`Unexpected structure in input.default:`,e.default),{schema:{...e,default:null},warning:{code:`MALFORMED_DEFAULT`,message:t}}}let n=t(e.default,`innerTree`)??{};if(Object.keys(n).length===0)return{schema:{...e,default:void 0}};if(e.treeAccess||e.atMost&&e.atMost>1){let t={},r=[];for(let[i,a]of Object.entries(n)){if(!Array.isArray(a)){let t=`Input "${e.name??`unknown`}" default had a non-array innerTree branch ("${i}"); the default was dropped.`;return p().warn(`Unexpected structure in input.default innerTree:`,e.default),{schema:{...e,default:null},warning:{code:`MALFORMED_DEFAULT`,message:t}}}let n=[];for(let e of a){let t=X(e),i=Fe(e);if(i&&Ie.has(i)){if(typeof t==`string`&&t.trim()===``)continue;let e=G(t);if(e===null){r.push(`"${String(t)}" (${i})`);continue}n.push(Le.has(i)?Math.round(e):e);continue}if(i===`System.Boolean`){let e=K(t);if(e===null){r.push(`"${String(t)}" (${i})`);continue}n.push(e);continue}if(typeof t==`string`&&i?.startsWith(`Rhino.Geometry`)){try{n.push(JSON.parse(t))}catch{n.push(t)}continue}n.push(t)}t[i]=n}let i;if(r.length>0){let t=`Input "${e.name??`unknown`}" default contained ${r.length} tree value(s) that could not be parsed and were dropped: ${r.join(`, `)}.`;p().warn(t),i={code:`MALFORMED_DEFAULT`,message:t}}return{schema:{...e,default:t},...i&&{warning:i}}}let r=[];for(let e of Object.values(n))Array.isArray(e)&&e.forEach(e=>{e&&typeof e==`object`&&i(e,`data`)&&r.push(X(e))});return r.length===0?{schema:{...e,default:void 0}}:r.length===1?{schema:{...e,default:r[0]}}:{schema:{...e,default:r}}}const ze=new Map([...Y.keys()].map(e=>[e.toLowerCase(),e]));function Be(e){return ze.get(e?.toLowerCase())??e}function Ve(e){return Z(e).input}function Z(e){let t={description:e.description,name:e.name,nickname:e.nickname,treeAccess:e.treeAccess,groupName:e.groupName??void 0,id:e.id},n=Be(e.paramType),r={...e,paramType:n},i;try{let{schema:t,warning:n}=Re(r);r=t,i=n&&{inputName:e.name||`unknown`,paramType:e.paramType,message:n.message,code:n.code}}catch(t){r={...r,default:null},i={inputName:e.name||`unknown`,paramType:e.paramType,message:`Input "${e.name??`unknown`}" default could not be normalized and was dropped: ${t instanceof Error?t.message:String(t)}`,code:`MALFORMED_DEFAULT`}}let a=Y.get(n);try{if(!a)throw f.unknownParamType(n,e.name);return{input:a.parse(r,t),error:i,...i&&{errors:[i]}}}catch(o){if(o instanceof f){p().error(`Validation error for input ${e.name||`unknown`}:`,o.message);let n={inputName:e.name||`unknown`,paramType:e.paramType,message:o.message,code:o.code};return{input:(a??Pe).fallback(r,t),error:n,errors:i?[i,n]:[n]}}throw new f(o instanceof Error?o.message:String(o),`VALIDATION_ERROR`,{context:{paramName:e.name,paramType:n},originalError:o instanceof Error?o:Error(String(o))})}}function He(e){let t=[],n=[];for(let r of e){let{input:e,errors:i}=Z(r);t.push(e),i&&n.push(...i)}return{inputs:t,parseErrors:n}}function Ue(e){let n=t(e,`stepSize`);return{id:t(e,`id`)??``,name:t(e,`name`)??``,nickname:t(e,`nickname`)??null,description:t(e,`description`)??``,paramType:t(e,`paramType`)??``,treeAccess:t(e,`treeAccess`)??!1,minimum:t(e,`minimum`)??null,maximum:t(e,`maximum`)??null,atLeast:t(e,`atLeast`)??1,atMost:t(e,`atMost`)??1,stepSize:typeof n==`number`&&Number.isFinite(n)?n:void 0,default:t(e,`default`),values:t(e,`values`),acceptedFormats:t(e,`acceptedFormats`),groupName:t(e,`groupName`)??null}}function We(e){return{name:t(e,`name`)??``,nickname:t(e,`nickname`)??null,paramType:t(e,`paramType`)??``,id:t(e,`id`)??``}}async function Q(n,r){let i=x(n,[]),a={};if(i.algo&&(a.algo=i.algo),i.pointer&&(a.pointer=i.pointer),!a.algo&&!a.pointer)throw new f(`Definition must resolve to either a URL pointer or base64 algo`,e.INVALID_INPUT,{context:{definition:n}});let o=await u(`io`,a,_(r));if(!o||typeof o!=`object`)throw new f(`Invalid IO response structure`,e.INVALID_INPUT,{context:{response:o,definition:n}});let s=Ge(t(o,`warnings`)),c=Ge(t(o,`errors`)),l=t(o,`inputs`),d=t(o,`outputs`);return{inputs:Array.isArray(l)?l.map(Ue):[],outputs:Array.isArray(d)?d.map(We):[],...s&&{loadWarnings:s},...c&&{loadErrors:c}}}function Ge(e){if(!Array.isArray(e))return;let t=e.map(Ke).filter(e=>e!==void 0);return t.length>0?t:void 0}function Ke(e){if(e==null)return;let n;if(typeof e==`string`)n=e;else if(typeof e==`object`){let r=t(e,`message`);if(typeof r==`string`&&r.trim().length>0)n=r;else try{n=JSON.stringify(e)??String(e)}catch{n=String(e)}}else n=String(e);return n.trim().length>0?n:void 0}async function qe(e,t){g(`fetchParsedDefinitionIO`,t.suppressBrowserWarning);let{inputs:n,outputs:r,loadWarnings:i,loadErrors:a}=await Q(e,t),{inputs:o,parseErrors:s}=He(n);return{inputs:o,outputs:r,...s.length>0&&{parseErrors:s},...i&&{loadWarnings:i},...a&&{loadErrors:a}}}function Je(e){return(Array.isArray(e)?e:[e]).map(e=>({schemas:t(e,`schemas`),error:t(e,`error`)}))}const Ye=new Set([`options`,`defaultOptions`,`values`]),Xe=e=>e>=`A`&&e<=`Z`;function Ze(e){if(e.length===0||!Xe(e[0]))return e;let t=0;for(;t<e.length&&Xe(e[t]);)t++;return t>1&&t<e.length&&t--,e.slice(0,t).toLowerCase()+e.slice(t)}function Qe(e){return $(e)}function $(e){if(Array.isArray(e))return e.map($);if(typeof e!=`object`||!e)return e;let t={};for(let[n,r]of Object.entries(e)){let e=Ze(n);t[e]=Ye.has(e)?r:$(r)}return t}var $e=class e{innerTree;paramName;constructor(e){this.paramName=e,this.innerTree={}}append(t,n){let r=e.formatPathString(t);this.innerTree[r]||(this.innerTree[r]=[]);let i=n.map(t=>({data:e.serializeValue(t)}));return this.innerTree[r].push(...i),this}appendSingle(e,t){return this.append(e,[t])}fromDataTreeDefault(t){this.innerTree={};for(let[n,r]of Object.entries(t)){if(!Array.isArray(r))continue;let t=e.parsePathString(n);this.append(t,r)}return this}appendFlat(e){let t=Array.isArray(e)?e:[e];return this.append([0],t)}flatten(){let t=[];for(let n of Object.values(this.innerTree))if(Array.isArray(n))for(let r of n)t.push(e.deserializeValue(r.data));return t}getPaths(){return Object.keys(this.innerTree)}getPath(t){let n=e.formatPathString(t),r=this.innerTree[n];if(r)return r.map(t=>e.deserializeValue(t.data))}toComputeFormat(){return{ParamName:this.paramName,InnerTree:this.innerTree}}getInnerTree(){return this.innerTree}getParamName(){return this.paramName}static fromInputParams(t){return t.filter(t=>e.hasValidValue(t.default)).map(t=>{let n=new e(t.nickname||`unnamed`),r=t.default;if(t.treeAccess&&V(r))n.fromDataTreeDefault(r),e.isNumericInput(t)&&n.applyNumericConstraints(t.minimum,t.maximum,t.nickname||`unnamed`);else{let i=Array.isArray(r)?r:[r],a=e.processValues(i,t);n.appendFlat(a)}return n.toComputeFormat()})}static fromInputParam(t){if(e.hasValidValue(t.default))return e.fromInputParams([t])[0]}static replaceTreeValue(t,n,r){let i=t.length>0&&t[0]instanceof e,a=e.buildFromValue(n,r);if(i){let e=t.slice(),r=e.findIndex(e=>e.getParamName()===n);return r===-1?e.push(a):e[r]=a,e}let o=t.slice(),s=a.toComputeFormat(),c=o.findIndex(e=>e.ParamName===n);return c===-1?o.push(s):o[c]=s,o}static buildFromValue(t,n){let r=new e(t);return V(n)?r.fromDataTreeDefault(n):r.appendFlat(n),r}static getTreeValue(t,n){let r=t.length>0&&t[0]instanceof e?e.readFromBuilders(t,n):e.readFromDataTrees(t,n);return r===null||r.length===0?null:r.length===1?r[0]:r}static readFromBuilders(e,t){let n=e.find(e=>e.getParamName()===t);return n?n.flatten():null}static readFromDataTrees(t,n){let r=t.find(e=>e.ParamName===n);if(!r?.InnerTree)return null;let i=Object.keys(r.InnerTree)[0];if(!i)return null;let a=r.InnerTree[i];return Array.isArray(a)?a.map(t=>t?.data===void 0?null:e.deserializeValue(t.data)):a?.data===void 0?a===void 0?null:[a]:[e.deserializeValue(a.data)]}static parsePathString(e){let t=e.match(B);if(!t)throw Error(`Invalid Grasshopper tree path: "${e}". Expected "{}", "{0}", or "{0;1;2}" (negative indices allowed, no empty segments).`);return t[1]?t[1].split(`;`).map(Number):[]}static formatPathString(e){return`{${e.join(`;`)}}`}applyNumericConstraints(t,n,r){for(let i of Object.values(this.innerTree))if(Array.isArray(i))for(let a of i){let i=e.deserializeValue(a.data);if(typeof i==`number`){let o=e.clampValue(i,t,n,r);a.data=e.serializeValue(o)}}}static serializeValue(e){return typeof e==`boolean`||typeof e==`number`||typeof e==`string`?e:typeof e==`object`&&e?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}let t=Number(e);return Number.isFinite(t)&&String(t)===e?t:e===`true`||e!==`false`&&e}static hasValidValue(e){return e==null?!1:typeof e==`string`||!(Array.isArray(e)&&e.length===0||typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0)}static isNumericInput(e){return e.paramType===`Number`||e.paramType===`Integer`}static processValues(t,n){return t.map(t=>e.isNumericInput(n)&&typeof t==`number`?e.clampValue(t,n.minimum,n.maximum,n.nickname||`unnamed`):t).filter(e=>e!=null)}static clampValue(e,t,n,r){let i=e;return t!=null&&i<t&&(p().warn(`${r}: ${e} below min ${t}, clamping`),i=t),n!=null&&i>n&&(p().warn(`${r}: ${e} above max ${n}, clamping`),i=n),i}};export{m as ComputeServerStats,pe as GrasshopperClient,Te as GrasshopperResponseProcessor,E as SolveScheduler,$e as TreeBuilder,d as downloadFileData,l as extractFilesFromComputeResponse,Q as fetchDefinitionIO,qe as fetchParsedDefinitionIO,T as hashDefinition,ue as hashSolveInput,s as isDefinitionRef,Qe as normalizeUISchemaCasing,Ve as processInput,Je as readSchemaResults,v as solveGrasshopperDefinition,S as stableStringify};
|
|
2
2
|
//# sourceMappingURL=grasshopper.js.map
|