In this section
- Standalone geodesy · stars / library/standalone.mjs lines 1240–1939
Standalone
A JavaScript module in the library folder of Stars that maps Renewable Energy Planning Database (REPD) master and heavy emitters UK, using SHA-256, and uses data from the GridAtlas repository.
Set aside from the main view: A comment at the top of the file says a tool wrote it. (noise-generated, proposed by noise.py). All set-aside files, with reasons. Nothing was deleted.
Evidence
- line 2 comment: // Generated by the modular star 2026-12-05T23:26:43.596Z. Each export is one family's earliest-seen copy, unchanged; the comment links its source.
geodesystars / library/standalone.mjs · lines 1240–1939 of 12585 (continued from section 1562) · Entry point · pattern segmentConductors (shared by 2 files)
- What it does
- It maps REPD master, heavy emitters UK, notice and substations. Defines 1111 functions or classes, including f1586_invariant, f8767_representativePoint, f8768_voltagesKv, f8772_voltageOf, f8773_ratingsOf. Side effects: changes the web page (DOM); reads or writes files; makes network requests; uses storage (browser storage, DuckDB or Parquet).
- Why it exists in the grid workflow
- Domain terms in the code: substations, 750kV, 400kV, 275kV, 132kV, 66kV.
- Inputs & outputs
- In: data source: gridatlas data; JSON file repd_master.json; JSON file heavy_emitters_uk.json; JSON file notice.json; form fields (user input). Out: canvas drawing. Coordinate systems named: OSGB36 / EPSG:27700 (British National Grid), WGS84 / EPSG:4326. Voltage levels named: 750kV, 400kV, 275kV, 132kV, 66kV, 33kV, 1.5kV, 1500V.
- Downstream impact
- Used directly by 4 files: Code (stars, https://ventusltd.github.io/stars/code.html); Proof (stars); Modular Star Workflow (stars); Testcode — Code Record Page (globalgrid2050, https://globalgrid2050.com/testcode/202609141754/code-record/). Reached from 383 other entry points, including Code Generator — Index Page (code-generator, https://ventusltd.github.io/code-generator/); Generate (code-generator, https://ventusltd.github.io/code-generator/); 404 (galaxies-wafers, https://ventusltd.github.io/galaxies-wafers/404.html).
- What it achieves
- It snaps coordinate (`snapCoordinate`), paints cursor (`paintCursor`) and sets plan (`setPlan`). Compiled library of self-contained JavaScript functions that appear in two or more places across Ventusltd code. Its code works with 33 kV, 132 kV and 275 kV. It responds to abort events.
- Why it matters
- Loaded by the Code page at https://ventusltd.github.io/stars/code.html and 1 other page. Run by Proof and Modular Star Workflow.
- Application
- stars · library · JavaScript module
- VEDIC
- MEASURE (GG2050-VEDIC-000001): GridAtlas / Geodesy · Mathematics / Spherical geometry. coordinate_pair, coordinate_pair → distance_km
- VEDIC
- REPRESENT (GG2050-VEDIC-000002): GridAtlas / Geodesy · Computer science / Geometry processing. geojson_geometry → coordinate_pair_or_null
- VEDIC
- VOLTAGE (GG2050-VEDIC-000003): GridAtlas / Geodesy · Computer science / Data normalisation. voltage_properties → kilovolt_list
- Uses
- GlobalGrid2050 — Renewable Energy Planning Database (REPD) Grid Atlas v8 Page (estate URL), Declared Connections (estate URL)
- Used by
- named by URL in Code (estate URL), run by Proof (script call), run by Modular Star Workflow (workflow run), named by URL in Testcode — Code Record Page (estate URL)
- Produces
- f1586_invariant, f8767_representativePoint, f8768_voltagesKv, f8772_voltageOf, f8773_ratingsOf, f8775_parametersOf, f5168_escapeHTML, f8321_suppliedArrivalFields, f8850__anonymous_, f8786_crossing, f8788_legality, f8789_startNodes
- Defines here
- f8480_escapeHtml, f8481_caveatHtml, f8510_emptyCollection, f8575_interactiveLayerIds, f9057_countMatches, f9058_capacityAppears, f9088_invariant, f9091_invariant, f9165_displayOfficialDate, f9302_displayDate, f8464_voltagesKv, push, f8519__anonymous_, f8521_fromOwnUi, f8541_gbRow, f8542__anonymous_, f8545_ledgerStamp, f8556__anonymous_, f9097_invariant, f8470_continueVerifiedArrival, f8469_createArrivalGate, f8498_resetCardGeometry, f8362_probe, f8363_probe, f8364_probe, f8365_detail, f8366_probe, f8388_bucketOf, f1679_invariant, f8332_mapReadyKey
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- stars@030ebc202d35959fecd162327892f671d1d9a0cc library/standalone.mjs:1240-1939 · blob fc3d8c8b93e14d4a56b8a26da47071d60bc5bc4d · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom, filesystem, network, storage · domain stage: unknown · users: none · canonical: unknown
: type === 'MultiPolygon' ? coordinates[0]?.[0] : null;
if (!Array.isArray(ring) || !ring.length) return null;
let x = 0; let y = 0;
for (const p of ring) { x += p[0]; y += p[1]; }
return [x / ring.length, y / ring.length];
};
// Family #8480 · element #8480 · 173 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609050354-sld-sandbox-v9-8.js#L3424-L3427
export const f8480_escapeHtml = function escapeHtml(value) {
return String(value).replace(/[&<>"']/g, c => (
{ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
};
// Family #8481 · element #8481 · 173 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609050354-sld-sandbox-v9-8.js#L3432-L3443
export const f8481_caveatHtml = function caveatHtml() {
return `<div class="neon-caveat">`
+ `<b>Beta analytics, not an actual grid connection.</b> Straight-line distance to mapped `
+ `geometry — not a cable route, not a connection length, and no route has been `
+ `walked. A real connection depends on factors that must be studied: network impedance `
+ `and fault level, thermal headroom, existing committed connections and queue position, `
+ `right of way, wayleaves and easements, crossings, terrain, land control and consent. `
+ `None of those can be inferred from a distance. A mapped substation does not confirm `
+ `capacity, voltage suitability or acceptance by any network party, and absence from a `
+ `mapped layer is not absence on the ground.`
+ `</div>`;
};
// Family #8510 · element #8510 · 173 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609050354-sld-sandbox-v9-8.js#L4036-L4038
export const f8510_emptyCollection = function emptyCollection() {
return { type: 'FeatureCollection', features: [] };
};
// Family #8575 · element #8575 · 173 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609050354-sld-sandbox-v9-8.js#L5502-L5516
export const f8575_interactiveLayerIds = function interactiveLayerIds(map) {
// Whatever the engine has made visible and interactive. Reading the style
// rather than hard-coding ids keeps this working as layers come and go.
try {
return map.getStyle().layers
.filter(layer => /^l-/.test(layer.id) && layer.type !== 'background')
.map(layer => layer.id)
.filter(id => {
try { return map.getLayoutProperty(id, 'visibility') !== 'none'; }
catch (_) { return false; }
});
} catch (_) {
return [];
}
};
// Family #9057 · element #9057 · 152 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/pipeline/scripts/core/news-relevance-v9-2.js#L15-L17
export const f9057_countMatches = function countMatches(tokens, text) {
return tokens.filter((token) => text.includes(token)).length;
};
// Family #9058 · element #9058 · 152 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/pipeline/scripts/core/news-relevance-v9-2.js#L19-L28
export const f9058_capacityAppears = function capacityAppears(item, headline) {
const capacity = Number(item.capacity_mw || 0);
if (!capacity) return false;
const candidates = new Set([
String(capacity),
String(Math.round(capacity)),
capacity.toLocaleString("en-GB", { maximumFractionDigits: 2 }),
]);
return [...candidates].some((candidate) => candidate && headline.includes(candidate.toLowerCase()));
};
// Family #9088 · element #9088 · 152 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/pipeline/scripts/data/canonical-projects-v9-2.js#L5-L7
export const f9088_invariant = function invariant(condition, message) {
if (!condition) throw new Error(`V9.2 canonical projects: ${message}`);
};
// Family #9091 · element #9091 · 152 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/pipeline/scripts/data/canonical-projects-v9-3.js#L5-L7
export const f9091_invariant = function invariant(condition, message) {
if (!condition) throw new Error(`V9.3 canonical projects: ${message}`);
};
// Family #9165 · element #9165 · 152 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/pipeline/scripts/plugins/canonical-project-table.js#L47-L51
export const f9165_displayOfficialDate = function displayOfficialDate(value, missingValueLabel) {
if (!value) return missingValueLabel;
const [year, month, day] = value.split("-");
return `${day}/${month}/${year}`;
};
// Family #9302 · element #9302 · 152 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/pipeline/scripts/plugins/projects-v9-1.js#L27-L31
export const f9302_displayDate = function displayDate(value) {
if (!value) return "not supplied by REPD";
const [year, month, day] = value.split("-");
return `${day}/${month}/${year}`;
};
// Family #8464 · element #8464 · 172 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609050354-sld-sandbox-v9-8.js#L3175-L3190
export const f8464_voltagesKv = function voltagesKv(properties) {
const out = [];
const push = (raw, divisor) => {
for (const token of String(raw ?? '').split(/[;,|:\s]+/)) {
if (!token) continue;
const value = Number(token);
if (!Number.isFinite(value) || value <= 0) continue;
out.push(value / divisor);
}
};
// OSM `voltage` is volts. Always, at every magnitude.
push(properties?.voltage, 1000);
// An explicit `kv` is already kilovolts.
if (!out.length) push(properties?.kv, 1);
return out;
};
// Family #8519 · element #8519 · 172 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609050354-sld-sandbox-v9-8.js#L4273-L4276
export const f8519__anonymous_ = (input) => {
const label = (input.closest('label') || input.parentElement)?.textContent || '';
return label.replace(/\s+/g, ' ').trim().toLowerCase().startsWith('subs ');
};
// Family #8521 · element #8521 · 172 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609050354-sld-sandbox-v9-8.js#L4292-L4297
export const f8521_fromOwnUi = function fromOwnUi(event) {
const target = event?.originalEvent?.target;
if (!target || typeof target.closest !== 'function') return false;
return Boolean(target.closest('.maplibregl-popup')
|| target.closest('#gridatlas-sld-panel'));
};
// Family #8541 · element #8541 · 172 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609050354-sld-sandbox-v9-8.js#L4862-L4865
export const f8541_gbRow = function gbRow(label, value, unit) {
return `<div class="gb-row"><span class="gb-k">${label}</span>`
+ `<span class="gb-v">${value}<em>${unit || ''}</em></span></div>`;
};
// Family #8542 · element #8542 · 172 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609050354-sld-sandbox-v9-8.js#L4880-L4891
export const f8542__anonymous_ = row => {
const days = Number(row.days_included);
const calendarDays = Number(row.calendar_days);
const status = days === calendarDays ? 'FULL_DATE_COVERAGE' : 'PARTIAL_DATE_COVERAGE';
const coverage = 100 * days / calendarDays;
const share = 100 * Number(row.days_with_a_negative_settlement_period) / days;
return days === Number(row.days)
&& calendarDays >= days
&& row.calendar_date_coverage === status
&& Math.abs(Number(row.calendar_date_coverage_pct) - coverage) < 0.011
&& Math.abs(Number(row.negative_period_day_share_pct) - share) < 0.011;
};
// Family #8545 · element #8545 · 172 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609050354-sld-sandbox-v9-8.js#L5048-L5052
export const f8545_ledgerStamp = function ledgerStamp(generation) {
return generation.slice(0, 4) + '-' + generation.slice(4, 6) + '-'
+ generation.slice(6, 8) + ' ' + generation.slice(8, 10) + ':'
+ generation.slice(10, 12) + ' UTC';
};
// Family #8556 · element #8556 · 172 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609050354-sld-sandbox-v9-8.js#L5245-L5248
export const f8556__anonymous_ = entry => ({
type: 'Feature', properties: { kind: 'site' },
geometry: { type: 'Point', coordinates: entry.at }
});
// Family #9097 · element #9097 · 152 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/pipeline/scripts/data/canonical-projects-v9-5-1.js#L5-L7
export const f9097_invariant = function invariant(condition, message) {
if (!condition) throw new Error(`V9.5.1 canonical projects: ${message}`);
};
// Family #8470 · element #8470 · 134 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609050354-sld-sandbox-v9-8.js#L3262-L3267
export const f8470_continueVerifiedArrival = async function continueVerifiedArrival(gate, epoch, verification, apply) {
const result = await verification;
if (!gate.isCurrent(epoch)) return false;
await apply(result);
return gate.isCurrent(epoch);
};
// Family #8469 · element #8469 · 130 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609050354-sld-sandbox-v9-8.js#L3235-L3261
export const f8469_createArrivalGate = function createArrivalGate() {
let epoch = 0;
let activeKey = null;
const invalidations = [];
return Object.freeze({
begin(key = null) {
const candidate = key == null ? null : String(key);
/* The search owner and the measurement owner claim the same URL
independently as their scripts boot. A keyed claim is idempotent,
so whichever starts first gives both halves one cancellation
epoch rather than making the second half stale immediately. */
if (candidate && candidate === activeKey) return epoch;
epoch += 1;
activeKey = candidate;
return epoch;
},
invalidate(reason) {
epoch += 1;
activeKey = null;
invalidations.push({ epoch, reason: String(reason || 'unspecified') });
return epoch;
},
isCurrent(candidate) { return candidate === epoch; },
snapshot() { return Object.freeze({ epoch, activeKey,
invalidations: [...invalidations] }); }
});
};
// Family #8498 · element #8498 · 133 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609050354-sld-sandbox-v9-8.js#L3829-L3843
export const f8498_resetCardGeometry = function resetCardGeometry(content) {
const popup = content?.closest?.('.maplibregl-popup');
if (!popup) return;
popup.classList.remove('gridatlas-free');
popup.classList.remove('gridatlas-min');
popup.style.removeProperty('--gx');
popup.style.removeProperty('--gy');
content.style.removeProperty('max-height');
content.style.removeProperty('display');
// The bar's own control has to agree with the class it toggles, or a card
// restored by this reset still shows a plus that no longer minimises
// anything. The control is .min and it carries an HTML entity, not text.
const toggle = content.querySelector('.gridatlas-card-bar .min');
if (toggle) toggle.innerHTML = '−';
};
// Family #8362 · element #8362 · 167 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609050354-sld-sandbox-v9-8.js#L249-L255
export const f8362_probe = (w) => {
const links = w.__GRIDATLAS_NEON_LINKS__;
if (!links) return 'absent';
if (typeof links.measure?.distanceKm !== 'function') return 'loaded, cannot measure';
if (!links.substations_loaded) return 'loaded, no substations yet';
return 'ready';
};
// Family #8363 · element #8363 · 167 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609050354-sld-sandbox-v9-8.js#L266-L272
export const f8363_probe = (w) => {
const network = w.__GRIDATLAS_NETWORK__;
if (!network) return 'absent';
if (network.failed) return 'failed to load';
if (!network.loaded) return 'loading';
return 'ready';
};
// Family #8364 · element #8364 · 165 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609050354-sld-sandbox-v9-8.js#L296-L304
export const f8364_probe = (w) => {
if (!w.__GRIDATLAS_MODULES__?.networkTopology) return 'absent';
const loader = w.__GRIDATLAS_TOPOLOGY__;
if (!loader) return 'module present, no loader in this composition';
if (loader.state === 'ready') return 'ready';
if (loader.state === 'loading') return 'loading';
if (loader.state === 'failed') return 'failed to load';
return 'idle, loads on first use';
};
// Family #8365 · element #8365 · 165 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609050354-sld-sandbox-v9-8.js#L305-L307
export const f8365_detail = (w) => ({ sites: w.__GRIDATLAS_TOPOLOGY__?.sites || null,
bytes: w.__GRIDATLAS_TOPOLOGY__?.bytes || null,
schema: w.__GRIDATLAS_TOPOLOGY__?.schema || null });
// Family #8366 · element #8366 · 162 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609050354-sld-sandbox-v9-8.js#L328-L336
export const f8366_probe = (w) => {
const loader = w.__GRIDATLAS_GB_CONDITIONS__;
if (!loader) return 'absent';
if (loader.state === 'ready') return 'ready';
if (loader.state === 'loading') return 'loading';
if (loader.state === 'failed') return 'failed to load';
if (loader.state === 'withheld') return 'withheld: ' + String(loader.reason || 'schema not supported');
return 'idle, loads on first use';
};
// Family #8388 · element #8388 · 143 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609050354-sld-sandbox-v9-8.js#L1433-L1435
export const f8388_bucketOf = function bucketOf(tech) {
return String(tech == null ? '' : tech).trim();
};
// Family #1679 · element #1679 · 260 places in 3 repositories · https://github.com/Ventusltd/ventus-grid-engine/blob/ad566356a44e006682e956483d569f31ddbb9630/sources/deeplink-extracts/emitter/atlas-pointer-deep-link.mjs#L101-L103
export const f1679_invariant = function invariant(condition, message) {
if (!condition) throw new Error(`Atlas receiver contract: ${message}`);
};
// Family #8332 · element #8332 · 77 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609041945-streaming-parquet-bridge-v9-5.js#L81-L86
export const f8332_mapReadyKey = function mapReadyKey(pathname) {
const marker = '/data/';
const index = pathname.toLowerCase().lastIndexOf(marker);
if (index < 0) return '';
return `data/${decodeURIComponent(pathname.slice(index + marker.length)).toLowerCase()}`;
};
// Family #144670 · element #144670 · 39 places in 3 repositories · https://github.com/Ventusltd/graphics-engines-open-source/blob/79e0bd8ee33844835e553fc84d552b6aa1521152/web/versions/202609262227-site-world/world/bng.mjs#L45-L54
export const f144670_invert3 = function invert3(m) {
const [[a, b, c], [d, e, f], [g, h, i]] = m;
const A = e * i - f * h, B = -(d * i - f * g), C = d * h - e * g;
const det = a * A + b * B + c * C;
return [
[A / det, -(b * i - c * h) / det, (b * f - c * e) / det],
[B / det, (a * i - c * g) / det, -(a * f - c * d) / det],
[C / det, -(a * h - b * g) / det, (a * e - b * d) / det],
];
};
// Family #144671 · element #144671 · 39 places in 3 repositories · https://github.com/Ventusltd/graphics-engines-open-source/blob/79e0bd8ee33844835e553fc84d552b6aa1521152/web/versions/202609262227-site-world/world/bng.mjs#L57-L61
export const f144671_apply = (m, v) => [
m[0][0] * v[0] + m[0][1] * v[1] + m[0][2] * v[2],
m[1][0] * v[0] + m[1][1] * v[1] + m[1][2] * v[2],
m[2][0] * v[0] + m[2][1] * v[1] + m[2][2] * v[2],
];
// Family #144672 · element #144672 · 39 places in 3 repositories · https://github.com/Ventusltd/graphics-engines-open-source/blob/79e0bd8ee33844835e553fc84d552b6aa1521152/web/versions/202609262227-site-world/world/bng.mjs#L63-L67
export const f144672_toCartesian = function toCartesian(lat, lon, h, a, e2) {
const s = Math.sin(lat), c = Math.cos(lat);
const nu = a / Math.sqrt(1 - e2 * s * s);
return [(nu + h) * c * Math.cos(lon), (nu + h) * c * Math.sin(lon), (nu * (1 - e2) + h) * s];
};
// Family #144673 · element #144673 · 39 places in 3 repositories · https://github.com/Ventusltd/graphics-engines-open-source/blob/79e0bd8ee33844835e553fc84d552b6aa1521152/web/versions/202609262227-site-world/world/bng.mjs#L70-L83
export const f144673_fromCartesian = function fromCartesian(x, y, z, a, e2) {
const p = Math.hypot(x, y);
let lat = Math.atan2(z, p * (1 - e2));
for (let k = 0; k < 12; k++) {
const nu = a / Math.sqrt(1 - e2 * Math.sin(lat) ** 2);
const next = Math.atan2(z + e2 * nu * Math.sin(lat), p);
const done = Math.abs(next - lat) < 1e-12;
lat = next;
if (done) break;
}
const nu = a / Math.sqrt(1 - e2 * Math.sin(lat) ** 2);
const h = Math.abs(Math.cos(lat)) > 1e-9 ? p / Math.cos(lat) - nu : Math.abs(z) - nu * (1 - e2);
return { lat, lon: Math.atan2(y, x), h };
};
// Family #1682 · element #1682 · 165 places in 3 repositories · https://github.com/Ventusltd/ventus-grid-engine/blob/ad566356a44e006682e956483d569f31ddbb9630/sources/deeplink-extracts/emitter/atlas-pointer-deep-link.mjs#L147-L155
export const f1682_finiteInRange = function finiteInRange(value, limit) {
// Number(null) and Number("") are both 0, which is finite and in range. Without
// this guard a project with a missing longitude is emitted at longitude 0 - the
// Greenwich meridian - instead of having its coordinates dropped. Caught by
// selfTest case "drops both coordinates when only one is present".
if (value === null || value === undefined || value === "") return null;
const n = Number(value);
return Number.isFinite(n) && Math.abs(n) <= limit ? n : null;
};
// Family #58975 · element #58975 · 29 places in 3 repositories · https://github.com/Ventusltd/gridatlas/blob/f944f8dcbc09cd09c0895f0126682ec241cd576f/atlas/cartridges/202609051503-substation-intelligence-v9-63.js#L6973-L6978
export const f58975_stopTracks = function stopTracks(stream) {
if (!stream || typeof stream.getTracks !== 'function') return;
for (const track of stream.getTracks()) {
try { track.stop(); } catch (_) { /* already stopped */ }
}
};
// Family #58981 · element #58981 · 29 places in 3 repositories · https://github.com/Ventusltd/gridatlas/blob/f944f8dcbc09cd09c0895f0126682ec241cd576f/atlas/cartridges/202609051503-substation-intelligence-v9-63.js#L7114-L7121
export const f58981_join = function join(parts) {
let length = 0;
for (const part of parts) length += part.length;
const out = new Uint8Array(length);
let at = 0;
for (const part of parts) { out.set(part, at); at += part.length; }
return out;
};
// Family #58982 · element #58982 · 29 places in 3 repositories · https://github.com/Ventusltd/gridatlas/blob/f944f8dcbc09cd09c0895f0126682ec241cd576f/atlas/cartridges/202609051503-substation-intelligence-v9-63.js#L7127-L7131
export const f58982_pdfString = function pdfString(text) {
return String(text == null ? '' : text)
.replace(/[\\()]/g, '\\$&')
.replace(/[^\x20-\x7e]/g, '');
};
// Family #58990 · element #58990 · 29 places in 3 repositories · https://github.com/Ventusltd/gridatlas/blob/f944f8dcbc09cd09c0895f0126682ec241cd576f/atlas/cartridges/202609051503-substation-intelligence-v9-63.js#L7346-L7349
export const f58990__anonymous_ = node => {
const rect = node.getBoundingClientRect();
return rect.width > 0 && rect.height > 0;
};
// Family #58991 · element #58991 · 29 places in 3 repositories · https://github.com/Ventusltd/gridatlas/blob/f944f8dcbc09cd09c0895f0126682ec241cd576f/atlas/cartridges/202609051503-substation-intelligence-v9-63.js#L7350-L7354
export const f58991__anonymous_ = node => {
const label = node.closest('label') || node.parentElement;
const text = ((label && label.textContent) || node.name || node.id || '').trim();
return { control: text.replace(/\s+/g, ' ').slice(0, 80), checked: !!node.checked };
};
// Family #4598 · element #4598 · 30 places in 3 repositories · https://github.com/Ventusltd/cosmic/blob/7af39006cb27f561acfbb154401207722bea2dc3/tools/explore/theme/pilot-lightning.js#L209-L214
export const f4598_numberInRange = function numberInRange(value, minimum, maximum) {
if (value === null || value === undefined || value === "") return null;
const number = Number(value);
return Number.isFinite(number) && number >= minimum && number <= maximum
? number : null;
};
// Family #144717 · element #144717 · 26 places in 3 repositories · https://github.com/Ventusltd/graphics-engines-open-source/blob/79e0bd8ee33844835e553fc84d552b6aa1521152/web/versions/202609262227-site-world/world/cable-route.mjs#L94-L100
export const f144717_at = function at(seg, u) {
if (seg.type === 'line') {
return { x: seg.a[0] + (seg.b[0] - seg.a[0]) * u, y: seg.a[1] + (seg.b[1] - seg.a[1]) * u, h: Math.atan2(seg.dir[1], seg.dir[0]) };
}
const ang = seg.a0 + seg.theta * u;
return { x: seg.centre[0] + seg.r * Math.cos(ang), y: seg.centre[1] + seg.r * Math.sin(ang), h: seg.h0 + seg.theta * u };
};
// Family #144718 · element #144718 · 26 places in 3 repositories · https://github.com/Ventusltd/graphics-engines-open-source/blob/79e0bd8ee33844835e553fc84d552b6aa1521152/web/versions/202609262227-site-world/world/cable-route.mjs#L103-L109
export const f144718_coreOffsets = function coreOffsets(formation, spacing) {
if (formation === 'trefoil') {
const rc = spacing / Math.sqrt(3); // circumradius of the touching triangle
return [[0, rc], [-spacing / 2, -rc / 2], [spacing / 2, -rc / 2]];
}
return [[spacing, 0], [0, 0], [-spacing, 0]];
};
// Family #144724 · element #144724 · 26 places in 3 repositories · https://github.com/Ventusltd/graphics-engines-open-source/blob/79e0bd8ee33844835e553fc84d552b6aa1521152/web/versions/202609262227-site-world/world/cable-route.mjs#L196-L198
export const f144724__anonymous_ = (g) => (g.type === 'arc'
? { type: 'arc', centre: g.centre, radius: g.r, turn: g.theta, s0: g.s0, s1: g.s1, index: g.index }
: { type: 'line', from: g.a, to: g.b, s0: g.s0, s1: g.s1 });
// Family #145102 · element #145102 · 24 places in 3 repositories · https://github.com/Ventusltd/graphics-engines-open-source/blob/79e0bd8ee33844835e553fc84d552b6aa1521152/web/versions/202609262227-site-world/world/lines.mjs#L25-L29
export const f145102_splitBatches = batches => {
const occluders = [], lines = [];
for (const b of batches) (b.occluder ? occluders : lines).push(b);
return { occluders, lines };
};
// Family #145103 · element #145103 · 24 places in 3 repositories · https://github.com/Ventusltd/graphics-engines-open-source/blob/79e0bd8ee33844835e553fc84d552b6aa1521152/web/versions/202609262227-site-world/world/lines.mjs#L36-L56
export const f145103_occluderMesh = function occluderMesh(heightAt, x, y, { cell = 8, radius = 400, sink = 0.5, key = 'occluder', version } = {}) {
if (!(cell > 0) || !(radius > 0)) throw Error('occluderMesh needs a positive cell and radius');
const cx = Math.round(x / cell) * cell, cy = Math.round(y / cell) * cell;
const n = Math.ceil(radius / cell), side = 2 * n + 1;
const h = new Float64Array(side * side);
for (let j = 0; j < side; j++) for (let i = 0; i < side; i++) {
const v = heightAt(cx + (i - n) * cell, cy + (j - n) * cell);
h[j * side + i] = Number.isFinite(v) ? v - sink : NaN;
}
const out = new Float32Array((side - 1) * (side - 1) * 18);
let k = 0;
const put = (i, j) => { out[k++] = (i - n) * cell; out[k++] = (j - n) * cell; out[k++] = h[j * side + i]; };
for (let j = 0; j < side - 1; j++) for (let i = 0; i < side - 1; i++) {
const a = h[j * side + i], b = h[j * side + i + 1], c = h[(j + 1) * side + i], d = h[(j + 1) * side + i + 1];
if (!Number.isFinite(a + b + c + d)) continue;
put(i, j); put(i + 1, j); put(i + 1, j + 1);
put(i, j); put(i + 1, j + 1); put(i, j + 1);
}
return { key, version: version ?? `${cx},${cy},${cell},${radius},${sink}`, occluder: true,
triangles: out.subarray(0, k), origin: [cx, cy, 0] };
};
// Family #23013 · element #23013 · 20 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/backups/202611140229-pipelinenews-before-repd-2026q3/files/cartridges/provisional-identity.mjs#L50-L52
export const f23013_resolveProject = function resolveProject(records, identity) {
return records.find(row=>[row.repd_ref,row.gg_project_id,...row.aliases].includes(identity)) ?? null;
};
// Family #12124 · element #12124 · 61 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051419/teleprinter/png-pixels.mjs#L8-L12
export const f12124__anonymous_ = (_, index) => {
let value = index;
for (let bit = 0; bit < 8; bit++) value = value & 1 ? 0xedb88320 ^ (value >>> 1) : value >>> 1;
return value >>> 0;
};
// Family #12127 · element #12127 · 61 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051419/teleprinter/png-pixels.mjs#L42-L45
export const f12127_paeth = function paeth(a, b, c) {
const p = a + b - c, pa = Math.abs(p - a), pb = Math.abs(p - b), pc = Math.abs(p - c);
return pa <= pb && pa <= pc ? a : pb <= pc ? b : c;
};
// Family #12147 · element #12147 · 61 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051419/teleprinter/screen-pdf.mjs#L4-L9
export const f12147_join = parts => {
const out = new Uint8Array(parts.reduce((n, p) => n + p.length, 0));
let at = 0;
for (const p of parts) { out.set(p, at); at += p.length; }
return out;
};
// Family #12558 · element #12558 · 59 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051441/teleprinter/runtime-source.js#L45-L57
export const f12558_jsReferences = function jsReferences(text) {
const imports = [];
const patterns = [
/\b(?:import|export)\s+(?:[^;\n]*?\s+from\s*)?["']([^"'\n]+)["']/g,
/\bimport\s*\(\s*["']([^"'\n]+)["']\s*\)/g,
/\bnew\s+(?:Worker|SharedWorker)\s*\(\s*["']([^"'\n]+)["']/g,
];
for (const pattern of patterns) for (const match of text.matchAll(pattern)) imports.push(match[1]);
// Asset URL constructors are not a license to crawl dormant data sets.
for (const match of text.matchAll(/\bnew\s+URL\s*\(\s*["']([^"'\n]+)["']/g)) if (/\.(?:m?js|wasm|css)(?:[?#]|$)/i.test(match[1])) imports.push(match[1]);
const dynamic = [...text.matchAll(/\bimport\s*\(\s*([^\s])/g)].some(match => !['"', "'"].includes(match[1]));
return { imports: [...new Set(imports)], dynamic };
};
// Family #12559 · element #12559 · 59 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051441/teleprinter/runtime-source.js#L58-L63
export const f12559_cssReferences = function cssReferences(text) {
const references = [];
for (const match of text.matchAll(/@import\s+(?:url\(\s*)?["']([^"']+)["']/gi)) references.push(match[1]);
for (const match of text.matchAll(/url\(\s*(?:["']([^"']+)["']|([^\s)]+))\s*\)/gi)) references.push(match[1] ?? match[2]);
return [...new Set(references)];
};
// Family #12553 · element #12553 · 58 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051457/teleprinter/runtime-source.js#L19-L35
export const f12553_readMapState = function readMapState() {
const map = globalThis.window?.__GRIDATLAS_V9_MAP__;
if (!map) return { available: false, reason: 'No public __GRIDATLAS_V9_MAP__ instance.' };
try {
const center = map.getCenter?.();
const style = map.getStyle?.();
const sources = style?.sources ?? {};
let renderedFeatures;
try {
if (typeof map.queryRenderedFeatures === 'function') {
const features = map.queryRenderedFeatures();
renderedFeatures = { available: true, count: features.length, provenance: 'Public queryRenderedFeatures snapshot: derived currently rendered features, possibly clipped/duplicated across tiles; NOT original worker tile bytes or the full source dataset.', features: features.map(feature => ({ type: feature.type, id: feature.id, source: feature.source, sourceLayer: feature.sourceLayer, layerId … [line shortened here: 486 characters; full line on GitHub]
} else renderedFeatures = { available: false, reason: 'Public queryRenderedFeatures is unavailable.' };
} catch (error) { renderedFeatures = { available: false, reason: String(error.message || error) }; }
return { available: true, center: center ? { lng: center.lng, lat: center.lat } : null, zoom: map.getZoom?.(), bearing: map.getBearing?.(), pitch: map.getPitch?.(), layers: style?.layers ?? [], sources, glyphs: style?.glyphs, sprite: style?.sprite, renderedFeatures };
} catch (error) { return { available: false, reason: String(error.message || error) }; }
};
// Family #12979 · element #12979 · 56 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051517/teleprinter/runtime-source.js#L86-L130
export const f12979_readDiagnosticHTTP = function readDiagnosticHTTP(url, { signal, account }) {
return new Promise((resolve, reject) => {
if (typeof globalThis.XMLHttpRequest !== 'function') {
reject(new Error('Direct diagnostic HTTP transport is unavailable (XMLHttpRequest missing); application fetch was not used as a fallback.'));
return;
}
const request = new globalThis.XMLHttpRequest();
let settled = false, accounted = 0;
const finish = (error, value) => {
if (settled) return;
settled = true;
signal?.removeEventListener('abort', abort);
request.onload = request.onerror = request.ontimeout = request.onabort = request.onprogress = null;
error ? reject(error) : resolve(value);
};
const abort = () => { finish(new Error('Direct diagnostic HTTP capture aborted or timed out.')); request.abort(); };
const charge = size => { account(size - accounted); accounted = size; };
request.open('GET', url, true);
request.responseType = 'arraybuffer';
request.timeout = 30000;
// XHR sends same-origin credentials normally; false excludes cross-origin credentials.
request.withCredentials = false;
request.onprogress = event => {
try { charge(event.loaded); }
catch (error) { finish(error); request.abort(); }
};
request.onload = () => {
try {
if (!request.status) throw new Error('Direct diagnostic HTTP response is unavailable (status 0).');
if (!(request.response instanceof ArrayBuffer)) throw new Error('Direct diagnostic HTTP response did not provide complete binary bytes.');
const bytes = new Uint8Array(request.response);
charge(bytes.length);
finish(null, { status: request.status, ok: request.status >= 200 && request.status < 300,
url: request.responseURL || url, diagnosticBytes: bytes,
headers: { get: name => request.getResponseHeader(name) } });
} catch (error) { finish(error); }
};
request.onerror = () => finish(new Error('Direct diagnostic HTTP network/CORS failure; no response body is accessible.'));
request.ontimeout = () => finish(new Error('Direct diagnostic HTTP 30-second timeout.'));
request.onabort = () => finish(new Error('Direct diagnostic HTTP request aborted.'));
signal?.addEventListener('abort', abort, { once: true });
if (signal?.aborted) abort();
else { try { request.send(); } catch (error) { finish(error); } }
});
};
// Family #15289 · element #15289 · 44 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051844/teleprinter/capture-geometry.mjs#L2-L7
export const f15289_captureGeometry = function captureGeometry(width, height, ratio) {
if (![width, height, ratio].every(value => Number.isFinite(value) && value > 0)) throw new Error('Invalid app print dimensions.');
const pixelWidth = Math.floor(width * ratio), pixelHeight = Math.floor(height * ratio);
if (!pixelWidth || !pixelHeight || pixelWidth * pixelHeight > 40000000) throw new Error('This app view is too large to print at full resolution.');
return { width, height, ratio, pixelWidth, pixelHeight };
};
// Family #15290 · element #15290 · 44 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051844/teleprinter/capture-geometry.mjs#L9-L12
export const f15290_assertStableGeometry = function assertStableGeometry(before, after, frame) {
if (before.width !== after.width || before.height !== after.height || before.ratio !== after.ratio) throw new Error('The app view resized during printing. Please try again.');
if (frame.width !== before.pixelWidth || frame.height !== before.pixelHeight) throw new Error('The app renderer returned unexpected print dimensions.');
};
// Family #15671 · element #15671 · 42 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051845/teleprinter/clone-visible-ui.js#L2-L29
export const f15671_cloneVisiblePrinterUi = function cloneVisiblePrinterUi(liveDocument, clonedDocument) {
const source = liveDocument.querySelector('#codex-teleprinter');
const target = clonedDocument.querySelector('#codex-teleprinter');
if (!source?.shadowRoot || !target) return;
const wrapper = clonedDocument.createElement('div');
wrapper.id = target.id;
wrapper.style.display = 'contents';
const view = liveDocument.defaultView;
function copy(node) {
if (node.nodeType !== 1) return node.cloneNode(true);
if (node.tagName === 'STYLE' || node.tagName === 'SCRIPT' || (node.tagName === 'DIALOG' && !node.open)) return null;
const result = node.cloneNode(false);
const style = view.getComputedStyle(node);
for (const property of style) result.style.setProperty(property, style.getPropertyValue(property));
for (const child of node.childNodes) {
// A closed details element displays only its summary; reconstruct that explicitly.
if (node.tagName === 'DETAILS' && !node.open && !(child.nodeType === 1 && child.tagName === 'SUMMARY')) continue;
const cloned = copy(child);
if (cloned) result.appendChild(cloned);
}
return result;
}
for (const child of source.shadowRoot.childNodes) {
const cloned = copy(child);
if (cloned) wrapper.appendChild(cloned);
}
target.replaceWith(wrapper);
};
// Family #16046 · element #16046 · 40 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051847/teleprinter/layer-quick-controls.js#L3-L7
export const f16046_toggleLayerGroup = function toggleLayerGroup(boxes) {
if (!boxes.length) return;
const turnOn = boxes.some(box => !box.checked);
for (const box of boxes) if (box.checked !== turnOn) box.click();
};
// Family #24441 · element #24441 · 38 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609060320/atlas/cartridges/202609060320-substation-intelligence.js#L69-L71
export const f24441_validOutline = function validOutline(points) {
return Array.isArray(points) && points.length >= 3 && points.length <= 4096 && points.every(point => Array.isArray(point) && point.length === 2 && point.every(Number.isFinite) && Math.abs(point[0]) <= 180 && Math.abs(point[1]) <= 85.051129);
};
// Family #25423 · element #25423 · 32 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609060325/atlas/cartridges/202609060325-substation-intelligence.js#L121-L134
export const f25423_createHistory = function createHistory(limit=80) {
let states=[[]],position=0;
const copy=points=>points.map(point=>point.slice());
return Object.freeze({
commit(points) {
if (JSON.stringify(states[position])===JSON.stringify(points)) return;
states=states.slice(0,position+1);states.push(copy(points));
if(states.length>limit)states.shift();position=states.length-1;
},
undo() {if(position===0)return null;return copy(states[--position]);},
redo() {if(position===states.length-1)return null;return copy(states[++position]);},
get canUndo(){return position>0;},get canRedo(){return position<states.length-1;}
});
};
// Family #29066 · element #29066 · 18 places in 3 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609060418/atlas/cartridges/202609060418-substation-intelligence.js#L5353-L5358
export const f29066_wrapPdfText = function wrapPdfText(value,maxChars){
const text=String(value??'').replace(/\u00a9/g,'(c)').replace(/[\u00b7\u2013\u2014]/g,'-').replace(/[^\x20-\x7e]/g,' ').replace(/\s+/g,' ').trim();
const lines=[];let line='';
for(const word of text.split(' ')){let rest=word;while(rest.length>maxChars){if(line){lines.push(line);line='';}lines.push(rest.slice(0,maxChars));rest=rest.slice(maxChars);}if(!rest)continue;if(line.length+rest.length+1>maxChars){lines.push(line);line=rest;}else line+=(line?' ':'')+rest;}
if(line)lines.push(line);return lines;
};
// Family #1198 · element #1198 · 3 places in 3 repositories · https://github.com/Ventusltd/globalgrid2050-hompage/blob/e0c3de9b47685b649e9e73cd377e3cadd2b143ac/assets/dashboard.js#L8-L14
export const f1198__anonymous_ = c => ({
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": '''
}[c]);
// Family #1199 · element #1199 · 3 places in 3 repositories · https://github.com/Ventusltd/globalgrid2050-hompage/blob/e0c3de9b47685b649e9e73cd377e3cadd2b143ac/assets/dashboard.js#L7-L15
export const f1199_esc = function esc(s) {
return String(s).replace(/[&<>"']/g, c => ({
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": '''
}[c]));
};
// Family #1200 · element #1200 · 3 places in 3 repositories · https://github.com/Ventusltd/globalgrid2050-hompage/blob/e0c3de9b47685b649e9e73cd377e3cadd2b143ac/assets/dashboard.js#L17-L19
export const f1200_normalise = function normalise(s) {
return String(s || '').toLowerCase().trim();
};
// Family #80316 · element #80316 · 3 places in 3 repositories · https://github.com/Ventusltd/ventus-grid-engine/blob/ad566356a44e006682e956483d569f31ddbb9630/engine/network-topology.js#L73-L91
export const f80316_physicalUnits = function physicalUnits(records) {
const pairs = new Map();
for (const record of records) {
const near = String(record.from_node);
const far = String(record.to_node);
const forward = near < far;
const key = forward ? near + ' ' + far : far + ' ' + near;
if (!pairs.has(key)) pairs.set(key, { forward: 0, reverse: 0 });
const seen = pairs.get(key);
if (forward) seen.forward += 1; else seen.reverse += 1;
}
let units = 0;
for (const seen of pairs.values()) {
units += (seen.forward && seen.reverse)
? Math.max(seen.forward, seen.reverse)
: seen.forward + seen.reverse;
}
return units;
};
// Family #31875 · element #31875 · 405 places in 2 repositories · https://github.com/Ventusltd/globalgrid2050/blob/32ae2ded87b626ab573efa6887547f2128c55304/uk_renewables_pipeline/202609051156/tests/browser_smoke_v9_3.mjs#L78-L82
export const f31875__anonymous_ = (row) => ({
repd: row.querySelector(".repd-ref")?.textContent,
globalgrid: row.querySelector(".globalgrid-ref")?.textContent,
updated: row.querySelector(".repd-updated")?.textContent,
});
// Family #31825 · element #31825 · 548 places in 2 repositories · https://github.com/Ventusltd/globalgrid2050/blob/32ae2ded87b626ab573efa6887547f2128c55304/uk_renewables_pipeline/202609051156/tests/browser_map_reachability_v9_7.mjs#L131-L133
export const f31825__anonymous_ = (route) => route.fulfill({
status: 200, contentType: "application/javascript", body: "",
});
// Family #136684 · element #136684 · 643 places in 2 repositories · https://github.com/Ventusltd/faraday/blob/e439b450f37a8c124fa4a0cb38159ae0dc337062/bench/fire.js#L11-L13
export const f136684_r = (x, d) => { const up = Number(x.toFixed(d)), t = Math.abs(x).toFixed(d + 25), tail = t.slice(t.indexOf('.') + 1 + d);
if (!/^50*$/.test(tail)) return up;
const k = Math.pow(10, d), n = Math.round(Math.abs(up) * k); return n % 2 === 0 ? up : Number((up - Math.sign(x) / k).toFixed(d)); };
// Family #136690 · element #136690 · 643 places in 2 repositories · https://github.com/Ventusltd/faraday/blob/e439b450f37a8c124fa4a0cb38159ae0dc337062/bench/fire.js#L52-L57
export const f136690_parse = function parse(text) {
const m = String(text).trim().match(/^fire\s+([a-z0-9-]+)\s*(\{[\s\S]*\})?\s*$/i);
if (!m) throw new Error('a command looks like: fire cable-withstand {"metal":"al","size_mm2":185,"seconds":1,"fault_ka":16}');
let inputs = {}; if (m[2]) { try { inputs = JSON.parse(m[2]); } catch (e) { throw new Error('the part in { } is not valid: ' + e.message); } }
return { name: m[1].toLowerCase(), inputs };
};
// Family #136692 · element #136692 · 643 places in 2 repositories · https://github.com/Ventusltd/faraday/blob/e439b450f37a8c124fa4a0cb38159ae0dc337062/bench/fire_site.js#L12-L14
export const f136692_standardSite = () => ({ intake_cable_km: 0.6, export_limit_kw: 500.0, generator_kw: 500.0, pv_kw: 1000.0, pv_on: 4,
subs: [{ n: 1, kva: 1600, load_kw: 900, km: 0.15 }, { n: 2, kva: 1000, load_kw: 550, km: 0.25 }, { n: 3, kva: 1000, load_kw: 500, km: 0.35 },
{ n: 4, kva: 1000, load_kw: 350, km: 0.45 }, { n: 5, kva: 800, load_kw: 300, km: 0.30, tenant: true }] });