Files
fxl.codes.Weather/www/main.js
T
2025-08-13 22:54:31 -07:00

2659 lines
118 KiB
JavaScript

/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ "./node_modules/@openmeteo/sdk/aggregation.js":
/*!****************************************************!*\
!*** ./node_modules/@openmeteo/sdk/aggregation.js ***!
\****************************************************/
/***/ ((__unused_webpack_module, exports) => {
// automatically generated by the FlatBuffers compiler, do not modify
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Aggregation = void 0;
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
var Aggregation;
(function (Aggregation) {
Aggregation[Aggregation["none"] = 0] = "none";
Aggregation[Aggregation["minimum"] = 1] = "minimum";
Aggregation[Aggregation["maximum"] = 2] = "maximum";
Aggregation[Aggregation["mean"] = 3] = "mean";
Aggregation[Aggregation["p10"] = 4] = "p10";
Aggregation[Aggregation["p25"] = 5] = "p25";
Aggregation[Aggregation["median"] = 6] = "median";
Aggregation[Aggregation["p75"] = 7] = "p75";
Aggregation[Aggregation["p90"] = 8] = "p90";
Aggregation[Aggregation["dominant"] = 9] = "dominant";
Aggregation[Aggregation["sum"] = 10] = "sum";
Aggregation[Aggregation["spread"] = 11] = "spread";
})(Aggregation || (exports.Aggregation = Aggregation = {}));
/***/ }),
/***/ "./node_modules/@openmeteo/sdk/model.js":
/*!**********************************************!*\
!*** ./node_modules/@openmeteo/sdk/model.js ***!
\**********************************************/
/***/ ((__unused_webpack_module, exports) => {
// automatically generated by the FlatBuffers compiler, do not modify
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Model = void 0;
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
var Model;
(function (Model) {
Model[Model["undefined"] = 0] = "undefined";
Model[Model["best_match"] = 1] = "best_match";
Model[Model["gfs_seamless"] = 2] = "gfs_seamless";
Model[Model["gfs_global"] = 3] = "gfs_global";
Model[Model["gfs_hrrr"] = 4] = "gfs_hrrr";
Model[Model["meteofrance_seamless"] = 5] = "meteofrance_seamless";
Model[Model["meteofrance_arpege_seamless"] = 6] = "meteofrance_arpege_seamless";
Model[Model["meteofrance_arpege_world"] = 7] = "meteofrance_arpege_world";
Model[Model["meteofrance_arpege_europe"] = 8] = "meteofrance_arpege_europe";
Model[Model["meteofrance_arome_seamless"] = 9] = "meteofrance_arome_seamless";
Model[Model["meteofrance_arome_france"] = 10] = "meteofrance_arome_france";
Model[Model["meteofrance_arome_france_hd"] = 11] = "meteofrance_arome_france_hd";
Model[Model["jma_seamless"] = 12] = "jma_seamless";
Model[Model["jma_msm"] = 13] = "jma_msm";
Model[Model["jms_gsm"] = 14] = "jms_gsm";
Model[Model["jma_gsm"] = 15] = "jma_gsm";
Model[Model["gem_seamless"] = 16] = "gem_seamless";
Model[Model["gem_global"] = 17] = "gem_global";
Model[Model["gem_regional"] = 18] = "gem_regional";
Model[Model["gem_hrdps_continental"] = 19] = "gem_hrdps_continental";
Model[Model["icon_seamless"] = 20] = "icon_seamless";
Model[Model["icon_global"] = 21] = "icon_global";
Model[Model["icon_eu"] = 22] = "icon_eu";
Model[Model["icon_d2"] = 23] = "icon_d2";
Model[Model["ecmwf_ifs04"] = 24] = "ecmwf_ifs04";
Model[Model["metno_nordic"] = 25] = "metno_nordic";
Model[Model["era5_seamless"] = 26] = "era5_seamless";
Model[Model["era5"] = 27] = "era5";
Model[Model["cerra"] = 28] = "cerra";
Model[Model["era5_land"] = 29] = "era5_land";
Model[Model["ecmwf_ifs"] = 30] = "ecmwf_ifs";
Model[Model["gwam"] = 31] = "gwam";
Model[Model["ewam"] = 32] = "ewam";
Model[Model["glofas_seamless_v3"] = 33] = "glofas_seamless_v3";
Model[Model["glofas_forecast_v3"] = 34] = "glofas_forecast_v3";
Model[Model["glofas_consolidated_v3"] = 35] = "glofas_consolidated_v3";
Model[Model["glofas_seamless_v4"] = 36] = "glofas_seamless_v4";
Model[Model["glofas_forecast_v4"] = 37] = "glofas_forecast_v4";
Model[Model["glofas_consolidated_v4"] = 38] = "glofas_consolidated_v4";
Model[Model["gfs025"] = 39] = "gfs025";
Model[Model["gfs05"] = 40] = "gfs05";
Model[Model["CMCC_CM2_VHR4"] = 41] = "CMCC_CM2_VHR4";
Model[Model["FGOALS_f3_H_highresSST"] = 42] = "FGOALS_f3_H_highresSST";
Model[Model["FGOALS_f3_H"] = 43] = "FGOALS_f3_H";
Model[Model["HiRAM_SIT_HR"] = 44] = "HiRAM_SIT_HR";
Model[Model["MRI_AGCM3_2_S"] = 45] = "MRI_AGCM3_2_S";
Model[Model["EC_Earth3P_HR"] = 46] = "EC_Earth3P_HR";
Model[Model["MPI_ESM1_2_XR"] = 47] = "MPI_ESM1_2_XR";
Model[Model["NICAM16_8S"] = 48] = "NICAM16_8S";
Model[Model["cams_europe"] = 49] = "cams_europe";
Model[Model["cams_global"] = 50] = "cams_global";
Model[Model["cfsv2"] = 51] = "cfsv2";
Model[Model["era5_ocean"] = 52] = "era5_ocean";
Model[Model["cma_grapes_global"] = 53] = "cma_grapes_global";
Model[Model["bom_access_global"] = 54] = "bom_access_global";
Model[Model["bom_access_global_ensemble"] = 55] = "bom_access_global_ensemble";
Model[Model["arpae_cosmo_seamless"] = 56] = "arpae_cosmo_seamless";
Model[Model["arpae_cosmo_2i"] = 57] = "arpae_cosmo_2i";
Model[Model["arpae_cosmo_2i_ruc"] = 58] = "arpae_cosmo_2i_ruc";
Model[Model["arpae_cosmo_5m"] = 59] = "arpae_cosmo_5m";
Model[Model["ecmwf_ifs025"] = 60] = "ecmwf_ifs025";
Model[Model["ecmwf_aifs025"] = 61] = "ecmwf_aifs025";
Model[Model["gfs013"] = 62] = "gfs013";
Model[Model["gfs_graphcast025"] = 63] = "gfs_graphcast025";
Model[Model["ecmwf_wam025"] = 64] = "ecmwf_wam025";
Model[Model["meteofrance_wave"] = 65] = "meteofrance_wave";
Model[Model["meteofrance_currents"] = 66] = "meteofrance_currents";
Model[Model["ecmwf_wam025_ensemble"] = 67] = "ecmwf_wam025_ensemble";
Model[Model["ncep_gfswave025"] = 68] = "ncep_gfswave025";
Model[Model["ncep_gefswave025"] = 69] = "ncep_gefswave025";
Model[Model["knmi_seamless"] = 70] = "knmi_seamless";
Model[Model["knmi_harmonie_arome_europe"] = 71] = "knmi_harmonie_arome_europe";
Model[Model["knmi_harmonie_arome_netherlands"] = 72] = "knmi_harmonie_arome_netherlands";
Model[Model["dmi_seamless"] = 73] = "dmi_seamless";
Model[Model["dmi_harmonie_arome_europe"] = 74] = "dmi_harmonie_arome_europe";
Model[Model["metno_seamless"] = 75] = "metno_seamless";
Model[Model["era5_ensemble"] = 76] = "era5_ensemble";
Model[Model["ecmwf_ifs_analysis"] = 77] = "ecmwf_ifs_analysis";
Model[Model["ecmwf_ifs_long_window"] = 78] = "ecmwf_ifs_long_window";
Model[Model["ecmwf_ifs_analysis_long_window"] = 79] = "ecmwf_ifs_analysis_long_window";
Model[Model["ukmo_global_deterministic_10km"] = 80] = "ukmo_global_deterministic_10km";
Model[Model["ukmo_uk_deterministic_2km"] = 81] = "ukmo_uk_deterministic_2km";
Model[Model["ukmo_seamless"] = 82] = "ukmo_seamless";
Model[Model["ncep_gfswave016"] = 83] = "ncep_gfswave016";
Model[Model["ncep_nbm_conus"] = 84] = "ncep_nbm_conus";
Model[Model["ukmo_global_ensemble_20km"] = 85] = "ukmo_global_ensemble_20km";
Model[Model["ecmwf_aifs025_single"] = 86] = "ecmwf_aifs025_single";
Model[Model["jma_jaxa_himawari"] = 87] = "jma_jaxa_himawari";
Model[Model["eumetsat_sarah3"] = 88] = "eumetsat_sarah3";
Model[Model["eumetsat_lsa_saf_msg"] = 89] = "eumetsat_lsa_saf_msg";
Model[Model["eumetsat_lsa_saf_iodc"] = 90] = "eumetsat_lsa_saf_iodc";
Model[Model["satellite_radiation_seamless"] = 91] = "satellite_radiation_seamless";
Model[Model["kma_gdps"] = 92] = "kma_gdps";
Model[Model["kma_ldps"] = 93] = "kma_ldps";
Model[Model["kma_seamless"] = 94] = "kma_seamless";
Model[Model["italia_meteo_arpae_icon_2i"] = 95] = "italia_meteo_arpae_icon_2i";
})(Model || (exports.Model = Model = {}));
/***/ }),
/***/ "./node_modules/@openmeteo/sdk/unit.js":
/*!*********************************************!*\
!*** ./node_modules/@openmeteo/sdk/unit.js ***!
\*********************************************/
/***/ ((__unused_webpack_module, exports) => {
// automatically generated by the FlatBuffers compiler, do not modify
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Unit = void 0;
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
var Unit;
(function (Unit) {
Unit[Unit["undefined"] = 0] = "undefined";
Unit[Unit["celsius"] = 1] = "celsius";
Unit[Unit["centimetre"] = 2] = "centimetre";
Unit[Unit["cubic_metre_per_cubic_metre"] = 3] = "cubic_metre_per_cubic_metre";
Unit[Unit["cubic_metre_per_second"] = 4] = "cubic_metre_per_second";
Unit[Unit["degree_direction"] = 5] = "degree_direction";
Unit[Unit["dimensionless_integer"] = 6] = "dimensionless_integer";
Unit[Unit["dimensionless"] = 7] = "dimensionless";
Unit[Unit["european_air_quality_index"] = 8] = "european_air_quality_index";
Unit[Unit["fahrenheit"] = 9] = "fahrenheit";
Unit[Unit["feet"] = 10] = "feet";
Unit[Unit["fraction"] = 11] = "fraction";
Unit[Unit["gdd_celsius"] = 12] = "gdd_celsius";
Unit[Unit["geopotential_metre"] = 13] = "geopotential_metre";
Unit[Unit["grains_per_cubic_metre"] = 14] = "grains_per_cubic_metre";
Unit[Unit["gram_per_kilogram"] = 15] = "gram_per_kilogram";
Unit[Unit["hectopascal"] = 16] = "hectopascal";
Unit[Unit["hours"] = 17] = "hours";
Unit[Unit["inch"] = 18] = "inch";
Unit[Unit["iso8601"] = 19] = "iso8601";
Unit[Unit["joule_per_kilogram"] = 20] = "joule_per_kilogram";
Unit[Unit["kelvin"] = 21] = "kelvin";
Unit[Unit["kilopascal"] = 22] = "kilopascal";
Unit[Unit["kilogram_per_square_metre"] = 23] = "kilogram_per_square_metre";
Unit[Unit["kilometres_per_hour"] = 24] = "kilometres_per_hour";
Unit[Unit["knots"] = 25] = "knots";
Unit[Unit["megajoule_per_square_metre"] = 26] = "megajoule_per_square_metre";
Unit[Unit["metre_per_second_not_unit_converted"] = 27] = "metre_per_second_not_unit_converted";
Unit[Unit["metre_per_second"] = 28] = "metre_per_second";
Unit[Unit["metre"] = 29] = "metre";
Unit[Unit["micrograms_per_cubic_metre"] = 30] = "micrograms_per_cubic_metre";
Unit[Unit["miles_per_hour"] = 31] = "miles_per_hour";
Unit[Unit["millimetre"] = 32] = "millimetre";
Unit[Unit["pascal"] = 33] = "pascal";
Unit[Unit["per_second"] = 34] = "per_second";
Unit[Unit["percentage"] = 35] = "percentage";
Unit[Unit["seconds"] = 36] = "seconds";
Unit[Unit["unix_time"] = 37] = "unix_time";
Unit[Unit["us_air_quality_index"] = 38] = "us_air_quality_index";
Unit[Unit["watt_per_square_metre"] = 39] = "watt_per_square_metre";
Unit[Unit["wmo_code"] = 40] = "wmo_code";
Unit[Unit["parts_per_million"] = 41] = "parts_per_million";
})(Unit || (exports.Unit = Unit = {}));
/***/ }),
/***/ "./node_modules/@openmeteo/sdk/variable-with-values.js":
/*!*************************************************************!*\
!*** ./node_modules/@openmeteo/sdk/variable-with-values.js ***!
\*************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
// automatically generated by the FlatBuffers compiler, do not modify
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.VariableWithValues = void 0;
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
const flatbuffers = __importStar(__webpack_require__(/*! flatbuffers */ "./node_modules/flatbuffers/mjs/flatbuffers.js"));
const aggregation_js_1 = __webpack_require__(/*! ./aggregation.js */ "./node_modules/@openmeteo/sdk/aggregation.js");
const unit_js_1 = __webpack_require__(/*! ./unit.js */ "./node_modules/@openmeteo/sdk/unit.js");
const variable_js_1 = __webpack_require__(/*! ./variable.js */ "./node_modules/@openmeteo/sdk/variable.js");
class VariableWithValues {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsVariableWithValues(bb, obj) {
return (obj || new VariableWithValues()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsVariableWithValues(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new VariableWithValues()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
variable() {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? this.bb.readUint8(this.bb_pos + offset) : variable_js_1.Variable.undefined;
}
unit() {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? this.bb.readUint8(this.bb_pos + offset) : unit_js_1.Unit.undefined;
}
value() {
const offset = this.bb.__offset(this.bb_pos, 8);
return offset ? this.bb.readFloat32(this.bb_pos + offset) : 0.0;
}
values(index) {
const offset = this.bb.__offset(this.bb_pos, 10);
return offset ? this.bb.readFloat32(this.bb.__vector(this.bb_pos + offset) + index * 4) : 0;
}
valuesLength() {
const offset = this.bb.__offset(this.bb_pos, 10);
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
}
valuesArray() {
const offset = this.bb.__offset(this.bb_pos, 10);
return offset ? new Float32Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
}
valuesInt64(index) {
const offset = this.bb.__offset(this.bb_pos, 12);
return offset ? this.bb.readInt64(this.bb.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);
}
valuesInt64Length() {
const offset = this.bb.__offset(this.bb_pos, 12);
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
}
altitude() {
const offset = this.bb.__offset(this.bb_pos, 14);
return offset ? this.bb.readInt16(this.bb_pos + offset) : 0;
}
aggregation() {
const offset = this.bb.__offset(this.bb_pos, 16);
return offset ? this.bb.readUint8(this.bb_pos + offset) : aggregation_js_1.Aggregation.none;
}
pressureLevel() {
const offset = this.bb.__offset(this.bb_pos, 18);
return offset ? this.bb.readInt16(this.bb_pos + offset) : 0;
}
depth() {
const offset = this.bb.__offset(this.bb_pos, 20);
return offset ? this.bb.readInt16(this.bb_pos + offset) : 0;
}
depthTo() {
const offset = this.bb.__offset(this.bb_pos, 22);
return offset ? this.bb.readInt16(this.bb_pos + offset) : 0;
}
ensembleMember() {
const offset = this.bb.__offset(this.bb_pos, 24);
return offset ? this.bb.readInt16(this.bb_pos + offset) : 0;
}
previousDay() {
const offset = this.bb.__offset(this.bb_pos, 26);
return offset ? this.bb.readInt16(this.bb_pos + offset) : 0;
}
}
exports.VariableWithValues = VariableWithValues;
/***/ }),
/***/ "./node_modules/@openmeteo/sdk/variable.js":
/*!*************************************************!*\
!*** ./node_modules/@openmeteo/sdk/variable.js ***!
\*************************************************/
/***/ ((__unused_webpack_module, exports) => {
// automatically generated by the FlatBuffers compiler, do not modify
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Variable = void 0;
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
var Variable;
(function (Variable) {
Variable[Variable["undefined"] = 0] = "undefined";
Variable[Variable["apparent_temperature"] = 1] = "apparent_temperature";
Variable[Variable["cape"] = 2] = "cape";
Variable[Variable["cloud_cover"] = 3] = "cloud_cover";
Variable[Variable["cloud_cover_high"] = 4] = "cloud_cover_high";
Variable[Variable["cloud_cover_low"] = 5] = "cloud_cover_low";
Variable[Variable["cloud_cover_mid"] = 6] = "cloud_cover_mid";
Variable[Variable["daylight_duration"] = 7] = "daylight_duration";
Variable[Variable["dew_point"] = 8] = "dew_point";
Variable[Variable["diffuse_radiation"] = 9] = "diffuse_radiation";
Variable[Variable["diffuse_radiation_instant"] = 10] = "diffuse_radiation_instant";
Variable[Variable["direct_normal_irradiance"] = 11] = "direct_normal_irradiance";
Variable[Variable["direct_normal_irradiance_instant"] = 12] = "direct_normal_irradiance_instant";
Variable[Variable["direct_radiation"] = 13] = "direct_radiation";
Variable[Variable["direct_radiation_instant"] = 14] = "direct_radiation_instant";
Variable[Variable["et0_fao_evapotranspiration"] = 15] = "et0_fao_evapotranspiration";
Variable[Variable["evapotranspiration"] = 16] = "evapotranspiration";
Variable[Variable["freezing_level_height"] = 17] = "freezing_level_height";
Variable[Variable["growing_degree_days"] = 18] = "growing_degree_days";
Variable[Variable["is_day"] = 19] = "is_day";
Variable[Variable["latent_heat_flux"] = 20] = "latent_heat_flux";
Variable[Variable["leaf_wetness_probability"] = 21] = "leaf_wetness_probability";
Variable[Variable["lifted_index"] = 22] = "lifted_index";
Variable[Variable["lightning_potential"] = 23] = "lightning_potential";
Variable[Variable["precipitation"] = 24] = "precipitation";
Variable[Variable["precipitation_hours"] = 25] = "precipitation_hours";
Variable[Variable["precipitation_probability"] = 26] = "precipitation_probability";
Variable[Variable["pressure_msl"] = 27] = "pressure_msl";
Variable[Variable["rain"] = 28] = "rain";
Variable[Variable["relative_humidity"] = 29] = "relative_humidity";
Variable[Variable["runoff"] = 30] = "runoff";
Variable[Variable["sensible_heat_flux"] = 31] = "sensible_heat_flux";
Variable[Variable["shortwave_radiation"] = 32] = "shortwave_radiation";
Variable[Variable["shortwave_radiation_instant"] = 33] = "shortwave_radiation_instant";
Variable[Variable["showers"] = 34] = "showers";
Variable[Variable["snow_depth"] = 35] = "snow_depth";
Variable[Variable["snow_height"] = 36] = "snow_height";
Variable[Variable["snowfall"] = 37] = "snowfall";
Variable[Variable["snowfall_height"] = 38] = "snowfall_height";
Variable[Variable["snowfall_water_equivalent"] = 39] = "snowfall_water_equivalent";
Variable[Variable["sunrise"] = 40] = "sunrise";
Variable[Variable["sunset"] = 41] = "sunset";
Variable[Variable["soil_moisture"] = 42] = "soil_moisture";
Variable[Variable["soil_moisture_index"] = 43] = "soil_moisture_index";
Variable[Variable["soil_temperature"] = 44] = "soil_temperature";
Variable[Variable["surface_pressure"] = 45] = "surface_pressure";
Variable[Variable["surface_temperature"] = 46] = "surface_temperature";
Variable[Variable["temperature"] = 47] = "temperature";
Variable[Variable["terrestrial_radiation"] = 48] = "terrestrial_radiation";
Variable[Variable["terrestrial_radiation_instant"] = 49] = "terrestrial_radiation_instant";
Variable[Variable["total_column_integrated_water_vapour"] = 50] = "total_column_integrated_water_vapour";
Variable[Variable["updraft"] = 51] = "updraft";
Variable[Variable["uv_index"] = 52] = "uv_index";
Variable[Variable["uv_index_clear_sky"] = 53] = "uv_index_clear_sky";
Variable[Variable["vapour_pressure_deficit"] = 54] = "vapour_pressure_deficit";
Variable[Variable["visibility"] = 55] = "visibility";
Variable[Variable["weather_code"] = 56] = "weather_code";
Variable[Variable["wind_direction"] = 57] = "wind_direction";
Variable[Variable["wind_gusts"] = 58] = "wind_gusts";
Variable[Variable["wind_speed"] = 59] = "wind_speed";
Variable[Variable["vertical_velocity"] = 60] = "vertical_velocity";
Variable[Variable["geopotential_height"] = 61] = "geopotential_height";
Variable[Variable["wet_bulb_temperature"] = 62] = "wet_bulb_temperature";
Variable[Variable["river_discharge"] = 63] = "river_discharge";
Variable[Variable["wave_height"] = 64] = "wave_height";
Variable[Variable["wave_period"] = 65] = "wave_period";
Variable[Variable["wave_direction"] = 66] = "wave_direction";
Variable[Variable["wind_wave_height"] = 67] = "wind_wave_height";
Variable[Variable["wind_wave_period"] = 68] = "wind_wave_period";
Variable[Variable["wind_wave_peak_period"] = 69] = "wind_wave_peak_period";
Variable[Variable["wind_wave_direction"] = 70] = "wind_wave_direction";
Variable[Variable["swell_wave_height"] = 71] = "swell_wave_height";
Variable[Variable["swell_wave_period"] = 72] = "swell_wave_period";
Variable[Variable["swell_wave_peak_period"] = 73] = "swell_wave_peak_period";
Variable[Variable["swell_wave_direction"] = 74] = "swell_wave_direction";
Variable[Variable["pm10"] = 75] = "pm10";
Variable[Variable["pm2p5"] = 76] = "pm2p5";
Variable[Variable["dust"] = 77] = "dust";
Variable[Variable["aerosol_optical_depth"] = 78] = "aerosol_optical_depth";
Variable[Variable["carbon_monoxide"] = 79] = "carbon_monoxide";
Variable[Variable["nitrogen_dioxide"] = 80] = "nitrogen_dioxide";
Variable[Variable["ammonia"] = 81] = "ammonia";
Variable[Variable["ozone"] = 82] = "ozone";
Variable[Variable["sulphur_dioxide"] = 83] = "sulphur_dioxide";
Variable[Variable["alder_pollen"] = 84] = "alder_pollen";
Variable[Variable["birch_pollen"] = 85] = "birch_pollen";
Variable[Variable["grass_pollen"] = 86] = "grass_pollen";
Variable[Variable["mugwort_pollen"] = 87] = "mugwort_pollen";
Variable[Variable["olive_pollen"] = 88] = "olive_pollen";
Variable[Variable["ragweed_pollen"] = 89] = "ragweed_pollen";
Variable[Variable["european_aqi"] = 90] = "european_aqi";
Variable[Variable["european_aqi_pm2p5"] = 91] = "european_aqi_pm2p5";
Variable[Variable["european_aqi_pm10"] = 92] = "european_aqi_pm10";
Variable[Variable["european_aqi_nitrogen_dioxide"] = 93] = "european_aqi_nitrogen_dioxide";
Variable[Variable["european_aqi_ozone"] = 94] = "european_aqi_ozone";
Variable[Variable["european_aqi_sulphur_dioxide"] = 95] = "european_aqi_sulphur_dioxide";
Variable[Variable["us_aqi"] = 96] = "us_aqi";
Variable[Variable["us_aqi_pm2p5"] = 97] = "us_aqi_pm2p5";
Variable[Variable["us_aqi_pm10"] = 98] = "us_aqi_pm10";
Variable[Variable["us_aqi_nitrogen_dioxide"] = 99] = "us_aqi_nitrogen_dioxide";
Variable[Variable["us_aqi_ozone"] = 100] = "us_aqi_ozone";
Variable[Variable["us_aqi_sulphur_dioxide"] = 101] = "us_aqi_sulphur_dioxide";
Variable[Variable["us_aqi_carbon_monoxide"] = 102] = "us_aqi_carbon_monoxide";
Variable[Variable["sunshine_duration"] = 103] = "sunshine_duration";
Variable[Variable["convective_inhibition"] = 104] = "convective_inhibition";
Variable[Variable["shortwave_radiation_clear_sky"] = 105] = "shortwave_radiation_clear_sky";
Variable[Variable["global_tilted_irradiance"] = 106] = "global_tilted_irradiance";
Variable[Variable["global_tilted_irradiance_instant"] = 107] = "global_tilted_irradiance_instant";
Variable[Variable["ocean_current_velocity"] = 108] = "ocean_current_velocity";
Variable[Variable["ocean_current_direction"] = 109] = "ocean_current_direction";
Variable[Variable["cloud_base"] = 110] = "cloud_base";
Variable[Variable["cloud_top"] = 111] = "cloud_top";
Variable[Variable["mass_density"] = 112] = "mass_density";
Variable[Variable["boundary_layer_height"] = 113] = "boundary_layer_height";
Variable[Variable["formaldehyde"] = 114] = "formaldehyde";
Variable[Variable["glyoxal"] = 115] = "glyoxal";
Variable[Variable["non_methane_volatile_organic_compounds"] = 116] = "non_methane_volatile_organic_compounds";
Variable[Variable["pm10_wildfires"] = 117] = "pm10_wildfires";
Variable[Variable["peroxyacyl_nitrates"] = 118] = "peroxyacyl_nitrates";
Variable[Variable["secondary_inorganic_aerosol"] = 119] = "secondary_inorganic_aerosol";
Variable[Variable["residential_elementary_carbon"] = 120] = "residential_elementary_carbon";
Variable[Variable["total_elementary_carbon"] = 121] = "total_elementary_carbon";
Variable[Variable["pm2_5_total_organic_matter"] = 122] = "pm2_5_total_organic_matter";
Variable[Variable["sea_salt_aerosol"] = 123] = "sea_salt_aerosol";
Variable[Variable["nitrogen_monoxide"] = 124] = "nitrogen_monoxide";
Variable[Variable["thunderstorm_probability"] = 125] = "thunderstorm_probability";
Variable[Variable["rain_probability"] = 126] = "rain_probability";
Variable[Variable["freezing_rain_probability"] = 127] = "freezing_rain_probability";
Variable[Variable["ice_pellets_probability"] = 128] = "ice_pellets_probability";
Variable[Variable["snowfall_probability"] = 129] = "snowfall_probability";
Variable[Variable["carbon_dioxide"] = 130] = "carbon_dioxide";
Variable[Variable["methane"] = 131] = "methane";
Variable[Variable["sea_level_height_msl"] = 132] = "sea_level_height_msl";
Variable[Variable["sea_surface_temperature"] = 133] = "sea_surface_temperature";
Variable[Variable["invert_barometer_height"] = 134] = "invert_barometer_height";
Variable[Variable["hail"] = 135] = "hail";
Variable[Variable["albedo"] = 136] = "albedo";
Variable[Variable["precipitation_type"] = 137] = "precipitation_type";
Variable[Variable["convective_cloud_base"] = 138] = "convective_cloud_base";
Variable[Variable["convective_cloud_top"] = 139] = "convective_cloud_top";
Variable[Variable["snow_depth_water_equivalent"] = 140] = "snow_depth_water_equivalent";
Variable[Variable["secondary_swell_wave_height"] = 141] = "secondary_swell_wave_height";
Variable[Variable["secondary_swell_wave_period"] = 142] = "secondary_swell_wave_period";
Variable[Variable["secondary_swell_wave_peak_period"] = 143] = "secondary_swell_wave_peak_period";
Variable[Variable["secondary_swell_wave_direction"] = 144] = "secondary_swell_wave_direction";
Variable[Variable["tertiary_swell_wave_height"] = 145] = "tertiary_swell_wave_height";
Variable[Variable["tertiary_swell_wave_period"] = 146] = "tertiary_swell_wave_period";
Variable[Variable["tertiary_swell_wave_peak_period"] = 147] = "tertiary_swell_wave_peak_period";
Variable[Variable["tertiary_swell_wave_direction"] = 148] = "tertiary_swell_wave_direction";
})(Variable || (exports.Variable = Variable = {}));
/***/ }),
/***/ "./node_modules/@openmeteo/sdk/variables-with-time.js":
/*!************************************************************!*\
!*** ./node_modules/@openmeteo/sdk/variables-with-time.js ***!
\************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
// automatically generated by the FlatBuffers compiler, do not modify
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.VariablesWithTime = void 0;
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
const flatbuffers = __importStar(__webpack_require__(/*! flatbuffers */ "./node_modules/flatbuffers/mjs/flatbuffers.js"));
const variable_with_values_js_1 = __webpack_require__(/*! ./variable-with-values.js */ "./node_modules/@openmeteo/sdk/variable-with-values.js");
class VariablesWithTime {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsVariablesWithTime(bb, obj) {
return (obj || new VariablesWithTime()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsVariablesWithTime(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new VariablesWithTime()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
time() {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt('0');
}
timeEnd() {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt('0');
}
interval() {
const offset = this.bb.__offset(this.bb_pos, 8);
return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
}
variables(index, obj) {
const offset = this.bb.__offset(this.bb_pos, 10);
return offset ? (obj || new variable_with_values_js_1.VariableWithValues()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
}
variablesLength() {
const offset = this.bb.__offset(this.bb_pos, 10);
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
}
}
exports.VariablesWithTime = VariablesWithTime;
/***/ }),
/***/ "./node_modules/@openmeteo/sdk/weather-api-response.js":
/*!*************************************************************!*\
!*** ./node_modules/@openmeteo/sdk/weather-api-response.js ***!
\*************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
// automatically generated by the FlatBuffers compiler, do not modify
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.WeatherApiResponse = void 0;
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
const flatbuffers = __importStar(__webpack_require__(/*! flatbuffers */ "./node_modules/flatbuffers/mjs/flatbuffers.js"));
const model_js_1 = __webpack_require__(/*! ./model.js */ "./node_modules/@openmeteo/sdk/model.js");
const variables_with_time_js_1 = __webpack_require__(/*! ./variables-with-time.js */ "./node_modules/@openmeteo/sdk/variables-with-time.js");
class WeatherApiResponse {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsWeatherApiResponse(bb, obj) {
return (obj || new WeatherApiResponse()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsWeatherApiResponse(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new WeatherApiResponse()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
latitude() {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? this.bb.readFloat32(this.bb_pos + offset) : 0.0;
}
longitude() {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? this.bb.readFloat32(this.bb_pos + offset) : 0.0;
}
elevation() {
const offset = this.bb.__offset(this.bb_pos, 8);
return offset ? this.bb.readFloat32(this.bb_pos + offset) : 0.0;
}
generationTimeMilliseconds() {
const offset = this.bb.__offset(this.bb_pos, 10);
return offset ? this.bb.readFloat32(this.bb_pos + offset) : 0.0;
}
locationId() {
const offset = this.bb.__offset(this.bb_pos, 12);
return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt('0');
}
model() {
const offset = this.bb.__offset(this.bb_pos, 14);
return offset ? this.bb.readUint8(this.bb_pos + offset) : model_js_1.Model.undefined;
}
utcOffsetSeconds() {
const offset = this.bb.__offset(this.bb_pos, 16);
return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
}
timezone(optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 18);
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
}
timezoneAbbreviation(optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 20);
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
}
current(obj) {
const offset = this.bb.__offset(this.bb_pos, 22);
return offset ? (obj || new variables_with_time_js_1.VariablesWithTime()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
}
daily(obj) {
const offset = this.bb.__offset(this.bb_pos, 24);
return offset ? (obj || new variables_with_time_js_1.VariablesWithTime()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
}
hourly(obj) {
const offset = this.bb.__offset(this.bb_pos, 26);
return offset ? (obj || new variables_with_time_js_1.VariablesWithTime()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
}
minutely15(obj) {
const offset = this.bb.__offset(this.bb_pos, 28);
return offset ? (obj || new variables_with_time_js_1.VariablesWithTime()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
}
sixHourly(obj) {
const offset = this.bb.__offset(this.bb_pos, 30);
return offset ? (obj || new variables_with_time_js_1.VariablesWithTime()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
}
}
exports.WeatherApiResponse = WeatherApiResponse;
/***/ }),
/***/ "./node_modules/flatbuffers/mjs/builder.js":
/*!*************************************************!*\
!*** ./node_modules/flatbuffers/mjs/builder.js ***!
\*************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ Builder: () => (/* binding */ Builder)
/* harmony export */ });
/* harmony import */ var _byte_buffer_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./byte-buffer.js */ "./node_modules/flatbuffers/mjs/byte-buffer.js");
/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constants.js */ "./node_modules/flatbuffers/mjs/constants.js");
class Builder {
/**
* Create a FlatBufferBuilder.
*/
constructor(opt_initial_size) {
/** Minimum alignment encountered so far. */
this.minalign = 1;
/** The vtable for the current table. */
this.vtable = null;
/** The amount of fields we're actually using. */
this.vtable_in_use = 0;
/** Whether we are currently serializing a table. */
this.isNested = false;
/** Starting offset of the current struct/table. */
this.object_start = 0;
/** List of offsets of all vtables. */
this.vtables = [];
/** For the current vector being built. */
this.vector_num_elems = 0;
/** False omits default values from the serialized data */
this.force_defaults = false;
this.string_maps = null;
this.text_encoder = new TextEncoder();
let initial_size;
if (!opt_initial_size) {
initial_size = 1024;
}
else {
initial_size = opt_initial_size;
}
/**
* @type {ByteBuffer}
* @private
*/
this.bb = _byte_buffer_js__WEBPACK_IMPORTED_MODULE_0__.ByteBuffer.allocate(initial_size);
this.space = initial_size;
}
clear() {
this.bb.clear();
this.space = this.bb.capacity();
this.minalign = 1;
this.vtable = null;
this.vtable_in_use = 0;
this.isNested = false;
this.object_start = 0;
this.vtables = [];
this.vector_num_elems = 0;
this.force_defaults = false;
this.string_maps = null;
}
/**
* In order to save space, fields that are set to their default value
* don't get serialized into the buffer. Forcing defaults provides a
* way to manually disable this optimization.
*
* @param forceDefaults true always serializes default values
*/
forceDefaults(forceDefaults) {
this.force_defaults = forceDefaults;
}
/**
* Get the ByteBuffer representing the FlatBuffer. Only call this after you've
* called finish(). The actual data starts at the ByteBuffer's current position,
* not necessarily at 0.
*/
dataBuffer() {
return this.bb;
}
/**
* Get the bytes representing the FlatBuffer. Only call this after you've
* called finish().
*/
asUint8Array() {
return this.bb.bytes().subarray(this.bb.position(), this.bb.position() + this.offset());
}
/**
* Prepare to write an element of `size` after `additional_bytes` have been
* written, e.g. if you write a string, you need to align such the int length
* field is aligned to 4 bytes, and the string data follows it directly. If all
* you need to do is alignment, `additional_bytes` will be 0.
*
* @param size This is the of the new element to write
* @param additional_bytes The padding size
*/
prep(size, additional_bytes) {
// Track the biggest thing we've ever aligned to.
if (size > this.minalign) {
this.minalign = size;
}
// Find the amount of alignment needed such that `size` is properly
// aligned after `additional_bytes`
const align_size = ((~(this.bb.capacity() - this.space + additional_bytes)) + 1) & (size - 1);
// Reallocate the buffer if needed.
while (this.space < align_size + size + additional_bytes) {
const old_buf_size = this.bb.capacity();
this.bb = Builder.growByteBuffer(this.bb);
this.space += this.bb.capacity() - old_buf_size;
}
this.pad(align_size);
}
pad(byte_size) {
for (let i = 0; i < byte_size; i++) {
this.bb.writeInt8(--this.space, 0);
}
}
writeInt8(value) {
this.bb.writeInt8(this.space -= 1, value);
}
writeInt16(value) {
this.bb.writeInt16(this.space -= 2, value);
}
writeInt32(value) {
this.bb.writeInt32(this.space -= 4, value);
}
writeInt64(value) {
this.bb.writeInt64(this.space -= 8, value);
}
writeFloat32(value) {
this.bb.writeFloat32(this.space -= 4, value);
}
writeFloat64(value) {
this.bb.writeFloat64(this.space -= 8, value);
}
/**
* Add an `int8` to the buffer, properly aligned, and grows the buffer (if necessary).
* @param value The `int8` to add the buffer.
*/
addInt8(value) {
this.prep(1, 0);
this.writeInt8(value);
}
/**
* Add an `int16` to the buffer, properly aligned, and grows the buffer (if necessary).
* @param value The `int16` to add the buffer.
*/
addInt16(value) {
this.prep(2, 0);
this.writeInt16(value);
}
/**
* Add an `int32` to the buffer, properly aligned, and grows the buffer (if necessary).
* @param value The `int32` to add the buffer.
*/
addInt32(value) {
this.prep(4, 0);
this.writeInt32(value);
}
/**
* Add an `int64` to the buffer, properly aligned, and grows the buffer (if necessary).
* @param value The `int64` to add the buffer.
*/
addInt64(value) {
this.prep(8, 0);
this.writeInt64(value);
}
/**
* Add a `float32` to the buffer, properly aligned, and grows the buffer (if necessary).
* @param value The `float32` to add the buffer.
*/
addFloat32(value) {
this.prep(4, 0);
this.writeFloat32(value);
}
/**
* Add a `float64` to the buffer, properly aligned, and grows the buffer (if necessary).
* @param value The `float64` to add the buffer.
*/
addFloat64(value) {
this.prep(8, 0);
this.writeFloat64(value);
}
addFieldInt8(voffset, value, defaultValue) {
if (this.force_defaults || value != defaultValue) {
this.addInt8(value);
this.slot(voffset);
}
}
addFieldInt16(voffset, value, defaultValue) {
if (this.force_defaults || value != defaultValue) {
this.addInt16(value);
this.slot(voffset);
}
}
addFieldInt32(voffset, value, defaultValue) {
if (this.force_defaults || value != defaultValue) {
this.addInt32(value);
this.slot(voffset);
}
}
addFieldInt64(voffset, value, defaultValue) {
if (this.force_defaults || value !== defaultValue) {
this.addInt64(value);
this.slot(voffset);
}
}
addFieldFloat32(voffset, value, defaultValue) {
if (this.force_defaults || value != defaultValue) {
this.addFloat32(value);
this.slot(voffset);
}
}
addFieldFloat64(voffset, value, defaultValue) {
if (this.force_defaults || value != defaultValue) {
this.addFloat64(value);
this.slot(voffset);
}
}
addFieldOffset(voffset, value, defaultValue) {
if (this.force_defaults || value != defaultValue) {
this.addOffset(value);
this.slot(voffset);
}
}
/**
* Structs are stored inline, so nothing additional is being added. `d` is always 0.
*/
addFieldStruct(voffset, value, defaultValue) {
if (value != defaultValue) {
this.nested(value);
this.slot(voffset);
}
}
/**
* Structures are always stored inline, they need to be created right
* where they're used. You'll get this assertion failure if you
* created it elsewhere.
*/
nested(obj) {
if (obj != this.offset()) {
throw new TypeError('FlatBuffers: struct must be serialized inline.');
}
}
/**
* Should not be creating any other object, string or vector
* while an object is being constructed
*/
notNested() {
if (this.isNested) {
throw new TypeError('FlatBuffers: object serialization must not be nested.');
}
}
/**
* Set the current vtable at `voffset` to the current location in the buffer.
*/
slot(voffset) {
if (this.vtable !== null)
this.vtable[voffset] = this.offset();
}
/**
* @returns Offset relative to the end of the buffer.
*/
offset() {
return this.bb.capacity() - this.space;
}
/**
* Doubles the size of the backing ByteBuffer and copies the old data towards
* the end of the new buffer (since we build the buffer backwards).
*
* @param bb The current buffer with the existing data
* @returns A new byte buffer with the old data copied
* to it. The data is located at the end of the buffer.
*
* uint8Array.set() formally takes {Array<number>|ArrayBufferView}, so to pass
* it a uint8Array we need to suppress the type check:
* @suppress {checkTypes}
*/
static growByteBuffer(bb) {
const old_buf_size = bb.capacity();
// Ensure we don't grow beyond what fits in an int.
if (old_buf_size & 0xC0000000) {
throw new Error('FlatBuffers: cannot grow buffer beyond 2 gigabytes.');
}
const new_buf_size = old_buf_size << 1;
const nbb = _byte_buffer_js__WEBPACK_IMPORTED_MODULE_0__.ByteBuffer.allocate(new_buf_size);
nbb.setPosition(new_buf_size - old_buf_size);
nbb.bytes().set(bb.bytes(), new_buf_size - old_buf_size);
return nbb;
}
/**
* Adds on offset, relative to where it will be written.
*
* @param offset The offset to add.
*/
addOffset(offset) {
this.prep(_constants_js__WEBPACK_IMPORTED_MODULE_1__.SIZEOF_INT, 0); // Ensure alignment is already done.
this.writeInt32(this.offset() - offset + _constants_js__WEBPACK_IMPORTED_MODULE_1__.SIZEOF_INT);
}
/**
* Start encoding a new object in the buffer. Users will not usually need to
* call this directly. The FlatBuffers compiler will generate helper methods
* that call this method internally.
*/
startObject(numfields) {
this.notNested();
if (this.vtable == null) {
this.vtable = [];
}
this.vtable_in_use = numfields;
for (let i = 0; i < numfields; i++) {
this.vtable[i] = 0; // This will push additional elements as needed
}
this.isNested = true;
this.object_start = this.offset();
}
/**
* Finish off writing the object that is under construction.
*
* @returns The offset to the object inside `dataBuffer`
*/
endObject() {
if (this.vtable == null || !this.isNested) {
throw new Error('FlatBuffers: endObject called without startObject');
}
this.addInt32(0);
const vtableloc = this.offset();
// Trim trailing zeroes.
let i = this.vtable_in_use - 1;
// eslint-disable-next-line no-empty
for (; i >= 0 && this.vtable[i] == 0; i--) { }
const trimmed_size = i + 1;
// Write out the current vtable.
for (; i >= 0; i--) {
// Offset relative to the start of the table.
this.addInt16(this.vtable[i] != 0 ? vtableloc - this.vtable[i] : 0);
}
const standard_fields = 2; // The fields below:
this.addInt16(vtableloc - this.object_start);
const len = (trimmed_size + standard_fields) * _constants_js__WEBPACK_IMPORTED_MODULE_1__.SIZEOF_SHORT;
this.addInt16(len);
// Search for an existing vtable that matches the current one.
let existing_vtable = 0;
const vt1 = this.space;
outer_loop: for (i = 0; i < this.vtables.length; i++) {
const vt2 = this.bb.capacity() - this.vtables[i];
if (len == this.bb.readInt16(vt2)) {
for (let j = _constants_js__WEBPACK_IMPORTED_MODULE_1__.SIZEOF_SHORT; j < len; j += _constants_js__WEBPACK_IMPORTED_MODULE_1__.SIZEOF_SHORT) {
if (this.bb.readInt16(vt1 + j) != this.bb.readInt16(vt2 + j)) {
continue outer_loop;
}
}
existing_vtable = this.vtables[i];
break;
}
}
if (existing_vtable) {
// Found a match:
// Remove the current vtable.
this.space = this.bb.capacity() - vtableloc;
// Point table to existing vtable.
this.bb.writeInt32(this.space, existing_vtable - vtableloc);
}
else {
// No match:
// Add the location of the current vtable to the list of vtables.
this.vtables.push(this.offset());
// Point table to current vtable.
this.bb.writeInt32(this.bb.capacity() - vtableloc, this.offset() - vtableloc);
}
this.isNested = false;
return vtableloc;
}
/**
* Finalize a buffer, poiting to the given `root_table`.
*/
finish(root_table, opt_file_identifier, opt_size_prefix) {
const size_prefix = opt_size_prefix ? _constants_js__WEBPACK_IMPORTED_MODULE_1__.SIZE_PREFIX_LENGTH : 0;
if (opt_file_identifier) {
const file_identifier = opt_file_identifier;
this.prep(this.minalign, _constants_js__WEBPACK_IMPORTED_MODULE_1__.SIZEOF_INT +
_constants_js__WEBPACK_IMPORTED_MODULE_1__.FILE_IDENTIFIER_LENGTH + size_prefix);
if (file_identifier.length != _constants_js__WEBPACK_IMPORTED_MODULE_1__.FILE_IDENTIFIER_LENGTH) {
throw new TypeError('FlatBuffers: file identifier must be length ' +
_constants_js__WEBPACK_IMPORTED_MODULE_1__.FILE_IDENTIFIER_LENGTH);
}
for (let i = _constants_js__WEBPACK_IMPORTED_MODULE_1__.FILE_IDENTIFIER_LENGTH - 1; i >= 0; i--) {
this.writeInt8(file_identifier.charCodeAt(i));
}
}
this.prep(this.minalign, _constants_js__WEBPACK_IMPORTED_MODULE_1__.SIZEOF_INT + size_prefix);
this.addOffset(root_table);
if (size_prefix) {
this.addInt32(this.bb.capacity() - this.space);
}
this.bb.setPosition(this.space);
}
/**
* Finalize a size prefixed buffer, pointing to the given `root_table`.
*/
finishSizePrefixed(root_table, opt_file_identifier) {
this.finish(root_table, opt_file_identifier, true);
}
/**
* This checks a required field has been set in a given table that has
* just been constructed.
*/
requiredField(table, field) {
const table_start = this.bb.capacity() - table;
const vtable_start = table_start - this.bb.readInt32(table_start);
const ok = field < this.bb.readInt16(vtable_start) &&
this.bb.readInt16(vtable_start + field) != 0;
// If this fails, the caller will show what field needs to be set.
if (!ok) {
throw new TypeError('FlatBuffers: field ' + field + ' must be set');
}
}
/**
* Start a new array/vector of objects. Users usually will not call
* this directly. The FlatBuffers compiler will create a start/end
* method for vector types in generated code.
*
* @param elem_size The size of each element in the array
* @param num_elems The number of elements in the array
* @param alignment The alignment of the array
*/
startVector(elem_size, num_elems, alignment) {
this.notNested();
this.vector_num_elems = num_elems;
this.prep(_constants_js__WEBPACK_IMPORTED_MODULE_1__.SIZEOF_INT, elem_size * num_elems);
this.prep(alignment, elem_size * num_elems); // Just in case alignment > int.
}
/**
* Finish off the creation of an array and all its elements. The array must be
* created with `startVector`.
*
* @returns The offset at which the newly created array
* starts.
*/
endVector() {
this.writeInt32(this.vector_num_elems);
return this.offset();
}
/**
* Encode the string `s` in the buffer using UTF-8. If the string passed has
* already been seen, we return the offset of the already written string
*
* @param s The string to encode
* @return The offset in the buffer where the encoded string starts
*/
createSharedString(s) {
if (!s) {
return 0;
}
if (!this.string_maps) {
this.string_maps = new Map();
}
if (this.string_maps.has(s)) {
return this.string_maps.get(s);
}
const offset = this.createString(s);
this.string_maps.set(s, offset);
return offset;
}
/**
* Encode the string `s` in the buffer using UTF-8. If a Uint8Array is passed
* instead of a string, it is assumed to contain valid UTF-8 encoded data.
*
* @param s The string to encode
* @return The offset in the buffer where the encoded string starts
*/
createString(s) {
if (s === null || s === undefined) {
return 0;
}
let utf8;
if (s instanceof Uint8Array) {
utf8 = s;
}
else {
utf8 = this.text_encoder.encode(s);
}
this.addInt8(0);
this.startVector(1, utf8.length, 1);
this.bb.setPosition(this.space -= utf8.length);
this.bb.bytes().set(utf8, this.space);
return this.endVector();
}
/**
* Create a byte vector.
*
* @param v The bytes to add
* @returns The offset in the buffer where the byte vector starts
*/
createByteVector(v) {
if (v === null || v === undefined) {
return 0;
}
this.startVector(1, v.length, 1);
this.bb.setPosition(this.space -= v.length);
this.bb.bytes().set(v, this.space);
return this.endVector();
}
/**
* A helper function to pack an object
*
* @returns offset of obj
*/
createObjectOffset(obj) {
if (obj === null) {
return 0;
}
if (typeof obj === 'string') {
return this.createString(obj);
}
else {
return obj.pack(this);
}
}
/**
* A helper function to pack a list of object
*
* @returns list of offsets of each non null object
*/
createObjectOffsetList(list) {
const ret = [];
for (let i = 0; i < list.length; ++i) {
const val = list[i];
if (val !== null) {
ret.push(this.createObjectOffset(val));
}
else {
throw new TypeError('FlatBuffers: Argument for createObjectOffsetList cannot contain null.');
}
}
return ret;
}
createStructOffsetList(list, startFunc) {
startFunc(this, list.length);
this.createObjectOffsetList(list.slice().reverse());
return this.endVector();
}
}
/***/ }),
/***/ "./node_modules/flatbuffers/mjs/byte-buffer.js":
/*!*****************************************************!*\
!*** ./node_modules/flatbuffers/mjs/byte-buffer.js ***!
\*****************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ ByteBuffer: () => (/* binding */ ByteBuffer)
/* harmony export */ });
/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants.js */ "./node_modules/flatbuffers/mjs/constants.js");
/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.js */ "./node_modules/flatbuffers/mjs/utils.js");
/* harmony import */ var _encoding_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./encoding.js */ "./node_modules/flatbuffers/mjs/encoding.js");
class ByteBuffer {
/**
* Create a new ByteBuffer with a given array of bytes (`Uint8Array`)
*/
constructor(bytes_) {
this.bytes_ = bytes_;
this.position_ = 0;
this.text_decoder_ = new TextDecoder();
}
/**
* Create and allocate a new ByteBuffer with a given size.
*/
static allocate(byte_size) {
return new ByteBuffer(new Uint8Array(byte_size));
}
clear() {
this.position_ = 0;
}
/**
* Get the underlying `Uint8Array`.
*/
bytes() {
return this.bytes_;
}
/**
* Get the buffer's position.
*/
position() {
return this.position_;
}
/**
* Set the buffer's position.
*/
setPosition(position) {
this.position_ = position;
}
/**
* Get the buffer's capacity.
*/
capacity() {
return this.bytes_.length;
}
readInt8(offset) {
return this.readUint8(offset) << 24 >> 24;
}
readUint8(offset) {
return this.bytes_[offset];
}
readInt16(offset) {
return this.readUint16(offset) << 16 >> 16;
}
readUint16(offset) {
return this.bytes_[offset] | this.bytes_[offset + 1] << 8;
}
readInt32(offset) {
return this.bytes_[offset] | this.bytes_[offset + 1] << 8 | this.bytes_[offset + 2] << 16 | this.bytes_[offset + 3] << 24;
}
readUint32(offset) {
return this.readInt32(offset) >>> 0;
}
readInt64(offset) {
return BigInt.asIntN(64, BigInt(this.readUint32(offset)) + (BigInt(this.readUint32(offset + 4)) << BigInt(32)));
}
readUint64(offset) {
return BigInt.asUintN(64, BigInt(this.readUint32(offset)) + (BigInt(this.readUint32(offset + 4)) << BigInt(32)));
}
readFloat32(offset) {
_utils_js__WEBPACK_IMPORTED_MODULE_1__.int32[0] = this.readInt32(offset);
return _utils_js__WEBPACK_IMPORTED_MODULE_1__.float32[0];
}
readFloat64(offset) {
_utils_js__WEBPACK_IMPORTED_MODULE_1__.int32[_utils_js__WEBPACK_IMPORTED_MODULE_1__.isLittleEndian ? 0 : 1] = this.readInt32(offset);
_utils_js__WEBPACK_IMPORTED_MODULE_1__.int32[_utils_js__WEBPACK_IMPORTED_MODULE_1__.isLittleEndian ? 1 : 0] = this.readInt32(offset + 4);
return _utils_js__WEBPACK_IMPORTED_MODULE_1__.float64[0];
}
writeInt8(offset, value) {
this.bytes_[offset] = value;
}
writeUint8(offset, value) {
this.bytes_[offset] = value;
}
writeInt16(offset, value) {
this.bytes_[offset] = value;
this.bytes_[offset + 1] = value >> 8;
}
writeUint16(offset, value) {
this.bytes_[offset] = value;
this.bytes_[offset + 1] = value >> 8;
}
writeInt32(offset, value) {
this.bytes_[offset] = value;
this.bytes_[offset + 1] = value >> 8;
this.bytes_[offset + 2] = value >> 16;
this.bytes_[offset + 3] = value >> 24;
}
writeUint32(offset, value) {
this.bytes_[offset] = value;
this.bytes_[offset + 1] = value >> 8;
this.bytes_[offset + 2] = value >> 16;
this.bytes_[offset + 3] = value >> 24;
}
writeInt64(offset, value) {
this.writeInt32(offset, Number(BigInt.asIntN(32, value)));
this.writeInt32(offset + 4, Number(BigInt.asIntN(32, value >> BigInt(32))));
}
writeUint64(offset, value) {
this.writeUint32(offset, Number(BigInt.asUintN(32, value)));
this.writeUint32(offset + 4, Number(BigInt.asUintN(32, value >> BigInt(32))));
}
writeFloat32(offset, value) {
_utils_js__WEBPACK_IMPORTED_MODULE_1__.float32[0] = value;
this.writeInt32(offset, _utils_js__WEBPACK_IMPORTED_MODULE_1__.int32[0]);
}
writeFloat64(offset, value) {
_utils_js__WEBPACK_IMPORTED_MODULE_1__.float64[0] = value;
this.writeInt32(offset, _utils_js__WEBPACK_IMPORTED_MODULE_1__.int32[_utils_js__WEBPACK_IMPORTED_MODULE_1__.isLittleEndian ? 0 : 1]);
this.writeInt32(offset + 4, _utils_js__WEBPACK_IMPORTED_MODULE_1__.int32[_utils_js__WEBPACK_IMPORTED_MODULE_1__.isLittleEndian ? 1 : 0]);
}
/**
* Return the file identifier. Behavior is undefined for FlatBuffers whose
* schema does not include a file_identifier (likely points at padding or the
* start of a the root vtable).
*/
getBufferIdentifier() {
if (this.bytes_.length < this.position_ + _constants_js__WEBPACK_IMPORTED_MODULE_0__.SIZEOF_INT +
_constants_js__WEBPACK_IMPORTED_MODULE_0__.FILE_IDENTIFIER_LENGTH) {
throw new Error('FlatBuffers: ByteBuffer is too short to contain an identifier.');
}
let result = "";
for (let i = 0; i < _constants_js__WEBPACK_IMPORTED_MODULE_0__.FILE_IDENTIFIER_LENGTH; i++) {
result += String.fromCharCode(this.readInt8(this.position_ + _constants_js__WEBPACK_IMPORTED_MODULE_0__.SIZEOF_INT + i));
}
return result;
}
/**
* Look up a field in the vtable, return an offset into the object, or 0 if the
* field is not present.
*/
__offset(bb_pos, vtable_offset) {
const vtable = bb_pos - this.readInt32(bb_pos);
return vtable_offset < this.readInt16(vtable) ? this.readInt16(vtable + vtable_offset) : 0;
}
/**
* Initialize any Table-derived type to point to the union at the given offset.
*/
__union(t, offset) {
t.bb_pos = offset + this.readInt32(offset);
t.bb = this;
return t;
}
/**
* Create a JavaScript string from UTF-8 data stored inside the FlatBuffer.
* This allocates a new string and converts to wide chars upon each access.
*
* To avoid the conversion to string, pass Encoding.UTF8_BYTES as the
* "optionalEncoding" argument. This is useful for avoiding conversion when
* the data will just be packaged back up in another FlatBuffer later on.
*
* @param offset
* @param opt_encoding Defaults to UTF16_STRING
*/
__string(offset, opt_encoding) {
offset += this.readInt32(offset);
const length = this.readInt32(offset);
offset += _constants_js__WEBPACK_IMPORTED_MODULE_0__.SIZEOF_INT;
const utf8bytes = this.bytes_.subarray(offset, offset + length);
if (opt_encoding === _encoding_js__WEBPACK_IMPORTED_MODULE_2__.Encoding.UTF8_BYTES)
return utf8bytes;
else
return this.text_decoder_.decode(utf8bytes);
}
/**
* Handle unions that can contain string as its member, if a Table-derived type then initialize it,
* if a string then return a new one
*
* WARNING: strings are immutable in JS so we can't change the string that the user gave us, this
* makes the behaviour of __union_with_string different compared to __union
*/
__union_with_string(o, offset) {
if (typeof o === 'string') {
return this.__string(offset);
}
return this.__union(o, offset);
}
/**
* Retrieve the relative offset stored at "offset"
*/
__indirect(offset) {
return offset + this.readInt32(offset);
}
/**
* Get the start of data of a vector whose offset is stored at "offset" in this object.
*/
__vector(offset) {
return offset + this.readInt32(offset) + _constants_js__WEBPACK_IMPORTED_MODULE_0__.SIZEOF_INT; // data starts after the length
}
/**
* Get the length of a vector whose offset is stored at "offset" in this object.
*/
__vector_len(offset) {
return this.readInt32(offset + this.readInt32(offset));
}
__has_identifier(ident) {
if (ident.length != _constants_js__WEBPACK_IMPORTED_MODULE_0__.FILE_IDENTIFIER_LENGTH) {
throw new Error('FlatBuffers: file identifier must be length ' +
_constants_js__WEBPACK_IMPORTED_MODULE_0__.FILE_IDENTIFIER_LENGTH);
}
for (let i = 0; i < _constants_js__WEBPACK_IMPORTED_MODULE_0__.FILE_IDENTIFIER_LENGTH; i++) {
if (ident.charCodeAt(i) != this.readInt8(this.position() + _constants_js__WEBPACK_IMPORTED_MODULE_0__.SIZEOF_INT + i)) {
return false;
}
}
return true;
}
/**
* A helper function for generating list for obj api
*/
createScalarList(listAccessor, listLength) {
const ret = [];
for (let i = 0; i < listLength; ++i) {
const val = listAccessor(i);
if (val !== null) {
ret.push(val);
}
}
return ret;
}
/**
* A helper function for generating list for obj api
* @param listAccessor function that accepts an index and return data at that index
* @param listLength listLength
* @param res result list
*/
createObjList(listAccessor, listLength) {
const ret = [];
for (let i = 0; i < listLength; ++i) {
const val = listAccessor(i);
if (val !== null) {
ret.push(val.unpack());
}
}
return ret;
}
}
/***/ }),
/***/ "./node_modules/flatbuffers/mjs/constants.js":
/*!***************************************************!*\
!*** ./node_modules/flatbuffers/mjs/constants.js ***!
\***************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ FILE_IDENTIFIER_LENGTH: () => (/* binding */ FILE_IDENTIFIER_LENGTH),
/* harmony export */ SIZEOF_INT: () => (/* binding */ SIZEOF_INT),
/* harmony export */ SIZEOF_SHORT: () => (/* binding */ SIZEOF_SHORT),
/* harmony export */ SIZE_PREFIX_LENGTH: () => (/* binding */ SIZE_PREFIX_LENGTH)
/* harmony export */ });
const SIZEOF_SHORT = 2;
const SIZEOF_INT = 4;
const FILE_IDENTIFIER_LENGTH = 4;
const SIZE_PREFIX_LENGTH = 4;
/***/ }),
/***/ "./node_modules/flatbuffers/mjs/encoding.js":
/*!**************************************************!*\
!*** ./node_modules/flatbuffers/mjs/encoding.js ***!
\**************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ Encoding: () => (/* binding */ Encoding)
/* harmony export */ });
var Encoding;
(function (Encoding) {
Encoding[Encoding["UTF8_BYTES"] = 1] = "UTF8_BYTES";
Encoding[Encoding["UTF16_STRING"] = 2] = "UTF16_STRING";
})(Encoding || (Encoding = {}));
/***/ }),
/***/ "./node_modules/flatbuffers/mjs/flatbuffers.js":
/*!*****************************************************!*\
!*** ./node_modules/flatbuffers/mjs/flatbuffers.js ***!
\*****************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ Builder: () => (/* reexport safe */ _builder_js__WEBPACK_IMPORTED_MODULE_3__.Builder),
/* harmony export */ ByteBuffer: () => (/* reexport safe */ _byte_buffer_js__WEBPACK_IMPORTED_MODULE_4__.ByteBuffer),
/* harmony export */ Encoding: () => (/* reexport safe */ _encoding_js__WEBPACK_IMPORTED_MODULE_2__.Encoding),
/* harmony export */ FILE_IDENTIFIER_LENGTH: () => (/* reexport safe */ _constants_js__WEBPACK_IMPORTED_MODULE_0__.FILE_IDENTIFIER_LENGTH),
/* harmony export */ SIZEOF_INT: () => (/* reexport safe */ _constants_js__WEBPACK_IMPORTED_MODULE_0__.SIZEOF_INT),
/* harmony export */ SIZEOF_SHORT: () => (/* reexport safe */ _constants_js__WEBPACK_IMPORTED_MODULE_0__.SIZEOF_SHORT),
/* harmony export */ SIZE_PREFIX_LENGTH: () => (/* reexport safe */ _constants_js__WEBPACK_IMPORTED_MODULE_0__.SIZE_PREFIX_LENGTH),
/* harmony export */ float32: () => (/* reexport safe */ _utils_js__WEBPACK_IMPORTED_MODULE_1__.float32),
/* harmony export */ float64: () => (/* reexport safe */ _utils_js__WEBPACK_IMPORTED_MODULE_1__.float64),
/* harmony export */ int32: () => (/* reexport safe */ _utils_js__WEBPACK_IMPORTED_MODULE_1__.int32),
/* harmony export */ isLittleEndian: () => (/* reexport safe */ _utils_js__WEBPACK_IMPORTED_MODULE_1__.isLittleEndian)
/* harmony export */ });
/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants.js */ "./node_modules/flatbuffers/mjs/constants.js");
/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.js */ "./node_modules/flatbuffers/mjs/utils.js");
/* harmony import */ var _encoding_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./encoding.js */ "./node_modules/flatbuffers/mjs/encoding.js");
/* harmony import */ var _builder_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./builder.js */ "./node_modules/flatbuffers/mjs/builder.js");
/* harmony import */ var _byte_buffer_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./byte-buffer.js */ "./node_modules/flatbuffers/mjs/byte-buffer.js");
/***/ }),
/***/ "./node_modules/flatbuffers/mjs/utils.js":
/*!***********************************************!*\
!*** ./node_modules/flatbuffers/mjs/utils.js ***!
\***********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ float32: () => (/* binding */ float32),
/* harmony export */ float64: () => (/* binding */ float64),
/* harmony export */ int32: () => (/* binding */ int32),
/* harmony export */ isLittleEndian: () => (/* binding */ isLittleEndian)
/* harmony export */ });
const int32 = new Int32Array(2);
const float32 = new Float32Array(int32.buffer);
const float64 = new Float64Array(int32.buffer);
const isLittleEndian = new Uint16Array(new Uint8Array([1, 0]).buffer)[0] === 1;
/***/ }),
/***/ "./node_modules/openmeteo/lib/index.js":
/*!*********************************************!*\
!*** ./node_modules/openmeteo/lib/index.js ***!
\*********************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.fetchWeatherApi = fetchWeatherApi;
const flatbuffers_1 = __webpack_require__(/*! flatbuffers */ "./node_modules/flatbuffers/mjs/flatbuffers.js");
const weather_api_response_1 = __webpack_require__(/*! @openmeteo/sdk/weather-api-response */ "./node_modules/@openmeteo/sdk/weather-api-response.js");
const sleep = (ms) => new Promise(r => setTimeout(r, ms));
function fetchRetried(url_1) {
return __awaiter(this, arguments, void 0, function* (url, retries = 3, backoffFactor = 0.5, backoffMax = 2, fetchOptions = {}) {
const statusToRetry = [500, 502, 504];
const statusWithJsonError = [400, 429];
let currentTry = 0;
let response = yield fetch(url, fetchOptions);
while (statusToRetry.includes(response.status)) {
currentTry++;
if (currentTry >= retries) {
throw new Error(response.statusText);
}
const sleepMs = Math.min(backoffFactor * Math.pow(2, currentTry), backoffMax) * 1000;
yield sleep(sleepMs);
response = yield fetch(url, fetchOptions);
}
if (statusWithJsonError.includes(response.status)) {
const json = yield response.json();
if ('reason' in json) {
throw new Error(json.reason);
}
throw new Error(response.statusText);
}
return response;
});
}
/**
* Retrieve data from the Open-Meteo weather API
*
* @param {string} url Server and endpoint. E.g. "https://api.open-meteo.com/v1/forecast"
* @param {any} params URL parameter as an object
* @param {number} [retries=3] Number of retries in case of an server error
* @param {number} [backoffFactor=0.2] Exponential backoff factor to increase wait time after each retry
* @param {number} [backoffMax=2] Maximum wait time between retries
* @param {RequestInit} [fetchOptions={}] Additional fetch options such as headers, signal, etc.
* @returns {Promise<WeatherApiResponse[]>}
*/
function fetchWeatherApi(url_1, params_1) {
return __awaiter(this, arguments, void 0, function* (url, params, retries = 3, backoffFactor = 0.2, backoffMax = 2, fetchOptions = {}) {
const urlParams = new URLSearchParams(params);
urlParams.set('format', 'flatbuffers');
const response = yield fetchRetried(`${url}?${urlParams.toString()}`, retries, backoffFactor, backoffMax, fetchOptions);
const fb = new flatbuffers_1.ByteBuffer(new Uint8Array(yield response.arrayBuffer()));
const results = [];
let pos = 0;
while (pos < fb.capacity()) {
fb.setPosition(pos);
const len = fb.readInt32(fb.position());
results.push(weather_api_response_1.WeatherApiResponse.getSizePrefixedRootAsWeatherApiResponse(fb));
pos += len + 4;
}
return results;
});
}
/***/ }),
/***/ "./src/color-schemes.ts":
/*!******************************!*\
!*** ./src/color-schemes.ts ***!
\******************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ Analogous: () => (/* binding */ Analogous),
/* harmony export */ Monochromatic: () => (/* binding */ Monochromatic),
/* harmony export */ Scheme: () => (/* binding */ Scheme),
/* harmony export */ SplitComplementary: () => (/* binding */ SplitComplementary),
/* harmony export */ Square: () => (/* binding */ Square),
/* harmony export */ Tetradic: () => (/* binding */ Tetradic),
/* harmony export */ Triadic: () => (/* binding */ Triadic)
/* harmony export */ });
/* harmony import */ var _hsl__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./hsl */ "./src/hsl.ts");
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var Scheme = /** @class */ (function () {
function Scheme(initial) {
this.primary = _hsl__WEBPACK_IMPORTED_MODULE_0__["default"].fromHex(initial);
}
Scheme.prototype.toString = function () {
var values = this.colors.map(function (color) { return color.toString(16); }).join(",");
return "".concat(this.constructor.name, ": ").concat(values);
};
return Scheme;
}());
var Analogous = /** @class */ (function (_super) {
__extends(Analogous, _super);
function Analogous(initial) {
var _this = _super.call(this, initial) || this;
var left1 = new _hsl__WEBPACK_IMPORTED_MODULE_0__["default"](_this.primary.hue - 30, _this.primary.saturation, _this.primary.lightness);
var left2 = new _hsl__WEBPACK_IMPORTED_MODULE_0__["default"](_this.primary.hue - 15, _this.primary.saturation, _this.primary.lightness);
var right1 = new _hsl__WEBPACK_IMPORTED_MODULE_0__["default"](_this.primary.hue + 15, _this.primary.saturation, _this.primary.lightness);
var right2 = new _hsl__WEBPACK_IMPORTED_MODULE_0__["default"](_this.primary.hue + 30, _this.primary.saturation, _this.primary.lightness);
_this.colors = [
left1.toHex(),
left2.toHex(),
initial,
right1.toHex(),
right2.toHex()
];
return _this;
}
return Analogous;
}(Scheme));
var Monochromatic = /** @class */ (function (_super) {
__extends(Monochromatic, _super);
function Monochromatic(initial) {
var _this = _super.call(this, initial) || this;
var delta = _this.primary.lightness / 6;
_this.colors = [
initial,
new _hsl__WEBPACK_IMPORTED_MODULE_0__["default"](_this.primary.hue, _this.primary.saturation, _this.primary.lightness - delta).toHex(),
new _hsl__WEBPACK_IMPORTED_MODULE_0__["default"](_this.primary.hue, _this.primary.saturation, _this.primary.lightness - delta * 2).toHex(),
new _hsl__WEBPACK_IMPORTED_MODULE_0__["default"](_this.primary.hue, _this.primary.saturation, _this.primary.lightness - delta * 3).toHex(),
new _hsl__WEBPACK_IMPORTED_MODULE_0__["default"](_this.primary.hue, _this.primary.saturation, _this.primary.lightness - delta * 4).toHex()
];
return _this;
}
return Monochromatic;
}(Scheme));
var SplitComplementary = /** @class */ (function (_super) {
__extends(SplitComplementary, _super);
function SplitComplementary(initial) {
var _this = _super.call(this, initial) || this;
var complement = new _hsl__WEBPACK_IMPORTED_MODULE_0__["default"]((_this.primary.hue + 180) % 360, _this.primary.saturation, _this.primary.lightness);
_this.colors = [
initial,
new _hsl__WEBPACK_IMPORTED_MODULE_0__["default"](complement.hue - 30, complement.saturation, complement.lightness).toHex(),
new _hsl__WEBPACK_IMPORTED_MODULE_0__["default"](complement.hue + 30, complement.saturation, complement.lightness).toHex()
];
return _this;
}
return SplitComplementary;
}(Scheme));
var Triadic = /** @class */ (function (_super) {
__extends(Triadic, _super);
function Triadic(initial) {
var _this = _super.call(this, initial) || this;
_this.colors = [
initial,
new _hsl__WEBPACK_IMPORTED_MODULE_0__["default"](_this.primary.hue - 120, _this.primary.saturation, _this.primary.lightness).toHex(),
new _hsl__WEBPACK_IMPORTED_MODULE_0__["default"](_this.primary.hue + 120, _this.primary.saturation, _this.primary.lightness).toHex()
];
return _this;
}
return Triadic;
}(Scheme));
var Tetradic = /** @class */ (function (_super) {
__extends(Tetradic, _super);
function Tetradic(initial) {
var _this = _super.call(this, initial) || this;
var second = new _hsl__WEBPACK_IMPORTED_MODULE_0__["default"](_this.primary.hue + 45, _this.primary.saturation, _this.primary.lightness);
var complement = new _hsl__WEBPACK_IMPORTED_MODULE_0__["default"](_this.primary.hue + 180, _this.primary.saturation, _this.primary.lightness);
var secondComplement = new _hsl__WEBPACK_IMPORTED_MODULE_0__["default"](second.hue + 180, _this.primary.saturation, _this.primary.lightness);
_this.colors = [
initial,
second.toHex(),
complement.toHex(),
secondComplement.toHex()
];
return _this;
}
return Tetradic;
}(Scheme));
var Square = /** @class */ (function (_super) {
__extends(Square, _super);
function Square(initial) {
var _this = _super.call(this, initial) || this;
var second = new _hsl__WEBPACK_IMPORTED_MODULE_0__["default"](_this.primary.hue + 90, _this.primary.saturation, _this.primary.lightness);
var third = new _hsl__WEBPACK_IMPORTED_MODULE_0__["default"](_this.primary.hue + 180, _this.primary.saturation, _this.primary.lightness);
var fourth = new _hsl__WEBPACK_IMPORTED_MODULE_0__["default"](second.hue + 270, _this.primary.saturation, _this.primary.lightness);
_this.colors = [
initial,
second.toHex(),
third.toHex(),
fourth.toHex()
];
return _this;
}
return Square;
}(Scheme));
/***/ }),
/***/ "./src/crack.ts":
/*!**********************!*\
!*** ./src/crack.ts ***!
\**********************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _sand_painter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./sand-painter */ "./src/sand-painter.ts");
var Crack = /** @class */ (function () {
function Crack(state, x, y, angle) {
this.x = 0;
this.y = 0;
this.angle = 0;
this.state = state;
this.painter = new _sand_painter__WEBPACK_IMPORTED_MODULE_0__["default"](this);
this.start(x, y, angle);
}
Crack.prototype.start = function (x, y, angle) {
var random = crypto.getRandomValues(new Uint8Array(2));
this.x = x + .61 * Math.cos(angle * Math.PI / 180);
this.y = y + .61 * Math.sin(angle * Math.PI / 180);
var flip = (random[0] / 256) > 0.5;
this.angle = angle + (90 + Math.floor((random[1] / 256) * 4.1 - 2)) * (flip ? -1 : 1);
};
Crack.prototype.draw = function () {
var random = crypto.getRandomValues(new Uint8Array(2));
this.x += .42 * Math.cos(this.angle * Math.PI / 180);
this.y += .42 * Math.sin(this.angle * Math.PI / 180);
var fuzzX = this.x + (random[0] / 256 * .66 - .33);
var fuzzY = this.y + (random[1] / 256 * .66 - .33);
var context = this.state.canvas.getContext("2d");
context.fillStyle = "#000";
context.fillRect(fuzzX, fuzzY, 1, 1);
this.painter.render();
var x = Math.floor(this.x);
var y = Math.floor(this.y);
if (this.state.isWithinBoundary(x, y)) {
var angle = this.state.grid[x][y];
if (angle > 10000) {
this.state.grid[x][y] = Math.floor(this.angle);
this.state.seeds.push({ x: x, y: y });
}
else if (this.state.grid[x][y] != Math.floor(this.angle)) {
var entry = this.state.getNewEntry();
this.start(entry.x, entry.y, entry.angle);
}
}
else {
var entry = this.state.getNewEntry();
this.start(entry.x, entry.y, entry.angle);
this.state.addCrack();
}
};
return Crack;
}());
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Crack);
/***/ }),
/***/ "./src/hsl.ts":
/*!********************!*\
!*** ./src/hsl.ts ***!
\********************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _rgb__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./rgb */ "./src/rgb.ts");
var HSL = /** @class */ (function () {
function HSL(hue, saturation, lightness) {
this.hue = (hue + 360) % 360;
this.saturation = saturation;
this.lightness = lightness;
}
// https://en.wikipedia.org/wiki/HSL_and_HSV
HSL.fromRgb = function (rgb) {
var redValue = rgb.red / 255, greenValue = rgb.green / 255, blueValue = rgb.blue / 255, max = Math.max(redValue, greenValue, blueValue), min = Math.min(redValue, greenValue, blueValue), chroma = max - min, lightness = .5 * (max + min), saturation = 1 - (3 / (redValue + greenValue + blueValue)) * Math.min(redValue, greenValue, blueValue);
var huePrime = 0;
if (chroma != 0) {
if (redValue == max)
huePrime = ((greenValue - blueValue) / chroma) % 6;
else if (greenValue == max)
huePrime = ((blueValue - redValue) / chroma) + 2;
else
huePrime = ((redValue - greenValue) / chroma) + 4;
}
return new HSL(huePrime * 60, saturation, lightness);
};
HSL.fromHex = function (color) {
return HSL.fromRgb(_rgb__WEBPACK_IMPORTED_MODULE_0__["default"].fromHex(color));
};
HSL.prototype.toHex = function () {
return _rgb__WEBPACK_IMPORTED_MODULE_0__["default"].fromHsl(this).toHex();
};
return HSL;
}());
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (HSL);
/***/ }),
/***/ "./src/rgb.ts":
/*!********************!*\
!*** ./src/rgb.ts ***!
\********************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
var RGB = /** @class */ (function () {
function RGB(red, green, blue) {
this.red = Math.floor(red < 0 ? 0 : red > 255 ? 255 : red);
this.green = Math.floor(green < 0 ? 0 : green > 255 ? 255 : green);
this.blue = Math.floor(blue < 0 ? 0 : blue > 255 ? 255 : blue);
}
RGB.prototype.toHex = function () {
return (this.red << 16) + (this.green << 8) + this.blue;
};
// https://en.wikipedia.org/wiki/HSL_and_HSV
RGB.fromHsl = function (hsl) {
var red = 0, green = 0, blue = 0;
var chroma = (1 - Math.abs(2 * hsl.lightness - 1)) * hsl.saturation, range = hsl.hue / 60, intermediate = chroma * (1 - Math.abs(range % 2 - 1)), match = hsl.lightness - chroma / 2;
if (range >= 0 && range < 1) {
red = chroma;
green = intermediate;
}
else if (range >= 1 && range < 2) {
red = intermediate;
green = chroma;
}
else if (range >= 2 && range < 3) {
green = chroma;
blue = intermediate;
}
else if (range >= 3 && range < 4) {
green = intermediate;
blue = chroma;
}
else if (range >= 4 && range < 5) {
red = intermediate;
blue = chroma;
}
else if (range >= 5 && range < 6) {
red = chroma;
blue = intermediate;
}
return new RGB((red + match) * 255, (green + match) * 255, (blue + match) * 255);
};
RGB.fromHex = function (color) {
var red = color >> 16;
var green = (color - (red << 16)) >> 8;
var blue = color - (red << 16) - (green << 8);
return new RGB(red, green, blue);
};
return RGB;
}());
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (RGB);
/***/ }),
/***/ "./src/sand-painter.ts":
/*!*****************************!*\
!*** ./src/sand-painter.ts ***!
\*****************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
var SandPainter = /** @class */ (function () {
function SandPainter(crack) {
this.crack = crack;
this.color = this.crack.state.getNextColor();
this.gain = Math.random() / 10;
}
SandPainter.prototype.render = function () {
var state = this.crack.state, x = this.crack.x, y = this.crack.y, angle = this.crack.angle;
var open = true, endX = x, endY = y;
while (open) {
endX += .81 * Math.sin(angle * Math.PI / 180);
endY -= .81 * Math.cos(angle * Math.PI / 180);
var gridX = Math.floor(endX);
var gridY = Math.floor(endY);
if (state.isWithinBoundary(gridX, gridY)) {
open = state.grid[gridX][gridY] > 10000;
}
else {
open = false;
}
}
this.gain += (Math.random() / 10 - .05);
if (this.gain < 0)
this.gain = 0;
if (this.gain > 1)
this.gain = 1;
var grains = 64;
var hex = this.color.toString(16);
var w = this.gain / (grains - 1); // some kind of multiplier
var context = state.canvas.getContext("2d");
for (var i = 0; i < grains; i++) {
var alpha = Math.floor((.1 - i / (grains * 10)) * 255);
var paintX = x + (endX - x) * Math.sin(Math.sin(i * w));
var paintY = y + (endY - y) * Math.sin(Math.sin(i * w));
context.fillStyle = "#".concat(hex.padStart(6, "0")).concat(alpha.toString(16).padStart(2, "0"));
context.fillRect(paintX, paintY, 1, 1);
}
};
return SandPainter;
}());
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SandPainter);
/***/ }),
/***/ "./src/state.ts":
/*!**********************!*\
!*** ./src/state.ts ***!
\**********************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _crack__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./crack */ "./src/crack.ts");
var State = /** @class */ (function () {
function State(colors, maxCracks, canvas) {
this.canvasColors = [
"rgb(27 27 27 / 90%)",
"rgb(90 90 90 / 90%)",
"rgb(126 126 126 / 90%)",
"rgb(180 180 180 / 90%)",
"rgb(255 255 255 / 90%)",
"rgb(180 180 180 / 90%)",
"rgb(126 126 126 / 90%)",
"rgb(90 90 90 / 90%)"
];
this.canvasIndex = 0;
this.colorIndex = 0;
this.canvas = canvas;
this.maxCracks = maxCracks;
this.grid = [];
this.colors = colors;
this.cracks = [];
this.seeds = [];
this.init();
}
State.prototype.init = function (colors) {
if (colors)
this.colors = colors;
this.cracks.length = 0;
this.grid.length = 0;
this.seeds.length = 0;
this.colorIndex = 0;
var height = this.canvas.height;
var width = this.canvas.width;
var context = this.canvas.getContext("2d");
context.fillStyle = this.canvasColors[this.canvasIndex++ % this.canvasColors.length];
context.fillRect(0, 0, width, height);
for (var x = 0; x < width; x++) {
this.grid[x] = [];
for (var y = 0; y < height; y++) {
this.grid[x][y] = 10001;
}
}
var random = crypto.getRandomValues(new Uint8Array(9));
for (var i = 0; i < 9; i += 3) {
var x = Math.floor(random[i] * width / 256);
var y = Math.floor(random[i + 1] * height / 256);
var angle = Math.floor(random[i + 2] * 360 / 256);
this.cracks.push(new _crack__WEBPACK_IMPORTED_MODULE_0__["default"](this, x, y, angle));
this.grid[x][y] = angle;
}
};
State.prototype.addCrack = function () {
if (this.cracks.length >= this.maxCracks)
return;
var _a = this.getNewEntry(), x = _a.x, y = _a.y, angle = _a.angle;
this.cracks.push(new _crack__WEBPACK_IMPORTED_MODULE_0__["default"](this, x, y, angle));
};
State.prototype.getNextColor = function () {
return this.colors[this.colorIndex++ % this.colors.length];
};
State.prototype.isWithinBoundary = function (x, y) {
return x >= 0 && x < this.canvas.width && y >= 0 && y < this.canvas.height;
};
State.prototype.getNewEntry = function () {
var random = crypto.getRandomValues(new Uint8Array(4));
if (!this.seeds.length) {
var x = Math.floor(random[0] * this.canvas.width / 256);
var y = Math.floor(random[1] * this.canvas.height / 256);
var angle = this.grid[x][y];
if (angle > 10000) {
angle = Math.floor(random[2] * 360 / 256);
this.grid[x][y] = angle;
}
return { x: x, y: y, angle: angle };
}
var randomIndex = Math.floor(random[3] * this.seeds.length / 256);
var entry = this.seeds.splice(randomIndex, 1)[0];
return {
x: entry.x,
y: entry.y,
angle: this.grid[entry.x][entry.y]
};
};
return State;
}());
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (State);
/***/ }),
/***/ "./src/substrate.ts":
/*!**************************!*\
!*** ./src/substrate.ts ***!
\**************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./state */ "./src/state.ts");
/* harmony import */ var _color_schemes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./color-schemes */ "./src/color-schemes.ts");
// TS attempt of http://www.complexification.net/gallery/machines/substrate/index.php by laniaung.me
var Substrate = /** @class */ (function () {
function Substrate(maxCracks, colors) {
if (!(colors === null || colors === void 0 ? void 0 : colors.length))
colors = [0x3a1e3e, 0x7c2d3b, 0xb94f3c, 0xf4a462, 0xf9c54e]; // https://colormagic.app/palette/671eeb6c42273fc4c1bb1ac7
var canvas = document.createElement("canvas");
canvas.width = document.body.clientWidth;
canvas.height = document.body.clientHeight;
document.body.appendChild(canvas);
this.state = new _state__WEBPACK_IMPORTED_MODULE_0__["default"](colors, maxCracks, canvas);
this.init();
}
Substrate.prototype.init = function () {
var me = this;
var draw = function () {
for (var _i = 0, _a = me.state.cracks; _i < _a.length; _i++) {
var crack = _a[_i];
crack.draw();
}
requestAnimationFrame(draw);
};
setInterval(function () { return me.state.init(me.getRandomColorScheme()); }, 120 * 1000);
draw();
};
Substrate.prototype.getRandomColorScheme = function () {
var color = Math.floor(Math.random() * Math.pow(256, 3));
var scheme;
switch (Math.floor(Math.random() * 6)) {
case 1:
scheme = new _color_schemes__WEBPACK_IMPORTED_MODULE_1__.Monochromatic(color);
break;
case 2:
scheme = new _color_schemes__WEBPACK_IMPORTED_MODULE_1__.SplitComplementary(color);
break;
case 3:
scheme = new _color_schemes__WEBPACK_IMPORTED_MODULE_1__.Triadic(color);
break;
case 4:
scheme = new _color_schemes__WEBPACK_IMPORTED_MODULE_1__.Tetradic(color);
break;
case 5:
scheme = new _color_schemes__WEBPACK_IMPORTED_MODULE_1__.Square(color);
break;
default:
scheme = new _color_schemes__WEBPACK_IMPORTED_MODULE_1__.Analogous(color);
}
console.info(scheme.toString());
return scheme.colors;
};
return Substrate;
}());
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Substrate);
/***/ }),
/***/ "./src/weather.ts":
/*!************************!*\
!*** ./src/weather.ts ***!
\************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var openmeteo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! openmeteo */ "./node_modules/openmeteo/lib/index.js");
/* harmony import */ var openmeteo__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(openmeteo__WEBPACK_IMPORTED_MODULE_0__);
var __assign = (undefined && undefined.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (undefined && undefined.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var Weather = /** @class */ (function () {
function Weather(latitude, longitude) {
this.apiUrl = "https://api.open-meteo.com/v1/forecast";
this.dailyVariables = ["temperature_2m_max", "temperature_2m_min", "sunrise", "sunset", "uv_index_max", "precipitation_sum", "precipitation_hours", "wind_speed_10m_max", "wind_gusts_10m_max", "wind_direction_10m_dominant"];
this.hourlyVariables = ["temperature_2m", "precipitation", "precipitation_probability"];
this.currentVariables = ["temperature_2m", "relative_humidity_2m", "apparent_temperature", "precipitation", "wind_speed_10m", "wind_gusts_10m", "wind_direction_10m", "cloud_cover"];
this.hourly = [];
this.daily = [];
this.options = new WeatherOptions(latitude !== null && latitude !== void 0 ? latitude : 47.61002138071677, longitude !== null && longitude !== void 0 ? longitude : -122.17906310779568);
var me = this;
var time = document.getElementById("time-value");
time.textContent = new Date().toLocaleTimeString("en-US", { hour12: false, timeStyle: "short" });
setInterval(function () { return time.textContent = new Date().toLocaleTimeString("en-US", { hour12: false, timeStyle: "short" }); }, 15000);
setInterval(function () { return me.fetchWeather().then(function () { return me.setDisplay(); }); }, 300000);
me.fetchWeather().then(function () { return me.setDisplay(); });
}
Weather.prototype.fetchWeather = function () {
return __awaiter(this, void 0, void 0, function () {
var me, parameters, needsUpdate, responses, _i, responses_1, response, current, hourly, daily;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
me = this;
parameters = __assign({}, me.options);
needsUpdate = me.needsUpdate(parameters);
if (!needsUpdate)
return [2 /*return*/];
console.info("Getting weather", parameters);
return [4 /*yield*/, (0,openmeteo__WEBPACK_IMPORTED_MODULE_0__.fetchWeatherApi)(me.apiUrl, parameters)];
case 1:
responses = _a.sent();
for (_i = 0, responses_1 = responses; _i < responses_1.length; _i++) {
response = responses_1[_i];
current = response.current();
hourly = response.hourly();
daily = response.daily();
me.offset = response.utcOffsetSeconds();
if (current != null)
me.current = new CurrentWeather(current);
if (hourly != null)
me.setHourlyData(hourly);
if (daily != null)
me.setDailyData(daily);
}
console.info("Timezone: ".concat(responses[0].timezone(), " ").concat(responses[0].timezoneAbbreviation(), "\nTimezone difference to GMT+0: ").concat(me.offset, "s"));
return [2 /*return*/];
}
});
});
};
Weather.prototype.needsUpdate = function (parameters) {
var me = this;
if (!me.lastFetched) {
parameters["daily"] = me.dailyVariables;
parameters["hourly"] = me.hourlyVariables;
parameters["current"] = me.currentVariables;
me.lastFetched = new LastFetched();
return true;
}
else {
// Weather data is updated every 15 minutes starting at :00 but just wait 15 minutes for an update
if (me.lastFetched.minutesSinceCurrent() >= 15) {
var now = new Date();
// Make sure data is over 5 minutes old at least
if ((now.getTime() - me.lastFetched.current.getTime()) > 300000) {
parameters["current"] = me.currentVariables;
me.lastFetched.current = new Date();
return true;
}
}
// Reasonable-ish timers?
if (me.lastFetched.hoursSinceHourly() > 3) {
parameters["hourly"] = me.hourlyVariables;
me.lastFetched.hourly = new Date();
return true;
}
if (me.lastFetched.hoursSinceDaily() > 8) {
parameters["daily"] = me.dailyVariables;
me.lastFetched.daily = new Date();
return true;
}
}
return false;
};
Weather.prototype.setHourlyData = function (hourly) {
var length = Number(hourly.timeEnd() - hourly.time()) / hourly.interval();
var temperatures = hourly.variables(0).valuesArray();
var precipitationTotals = hourly.variables(1).valuesArray();
var precipitationProbabilities = hourly.variables(2).valuesArray();
this.hourly.length = 0;
for (var i = 0; i < length; i++) {
new Date();
this.hourly.push({
time: new Date((Number(hourly.time()) + i * hourly.interval()) * 1000),
temperature: temperatures[i],
precipitation: precipitationTotals[i],
precipitationProbability: precipitationProbabilities[i]
});
}
};
Weather.prototype.setDailyData = function (daily) {
var length = Number(daily.timeEnd() - daily.time()) / daily.interval();
var maxTemperatures = daily.variables(0).valuesArray();
var minTemperatures = daily.variables(1).valuesArray();
var sunrise = daily.variables(2);
var sunset = daily.variables(3);
var maxUVs = daily.variables(4).valuesArray();
var precipitationTotals = daily.variables(5).valuesArray();
var precipitationHours = daily.variables(6).valuesArray();
var maxWindSpeeds = daily.variables(7).valuesArray();
var maxWindGusts = daily.variables(8).valuesArray();
var prominentWindDirections = daily.variables(9).valuesArray();
this.daily.length = 0;
for (var i = 0; i < length; i++) {
var weather = new DailyWeather();
weather.time = new Date((Number(daily.time()) + i * daily.interval()) * 1000);
weather.maxTemperature = maxTemperatures[i];
weather.minTemperature = minTemperatures[i];
weather.sunrise = new Date((Number(sunrise.valuesInt64(i))) * 1000);
weather.sunset = new Date((Number(sunset.valuesInt64(i))) * 1000);
weather.maxUV = maxUVs[i];
weather.totalPrecipitation = precipitationTotals[i];
weather.hoursOfPrecipitation = precipitationHours[i];
weather.maxWindSpeed = maxWindSpeeds[i];
weather.maxWindGusts = maxWindGusts[i];
weather.prominentWindDirection = prominentWindDirections[i];
this.daily.push(weather);
}
};
Weather.prototype.setDisplay = function () {
console.debug(this);
var current = document.getElementById("current");
current.innerHTML = "<div><span class=\"material\">thermostat</span>".concat(Math.round(this.current.temperature), " (").concat(Math.round(this.current.feelsLike), ")</div>\n<div><span class=\"material\">humidity_percentage</span> ").concat(Math.round(this.current.humidity), "%</div>\n<div><span class=\"material\">cloud</span> ").concat(Math.round(this.current.cloudCoverage), "%</div>\n<div><span class=\"material\">weather_mix</span> ").concat(Math.round(this.current.precipitation), "%</div>\n<div><span class=\"material\">air</span> ").concat(Math.round(this.current.windSpeed), " (").concat(Math.round(this.current.windGusts), ") ").concat(this.inCardinals(this.current.windDirection), "</div>");
if (!this.daily)
return;
var icon = document.getElementById("time-icon");
icon.innerText = this.current.getCloudCoverageIcon(this.daily[0].sunrise, this.daily[0].sunset);
var dailySlots = [];
for (var _i = 0, _a = this.daily; _i < _a.length; _i++) {
var day = _a[_i];
dailySlots.push("<div class=\"daily-slot\">\n <span class=\"date\">".concat(day.time.getDate(), "</span>\n <span class=\"range\">").concat(Math.round(day.minTemperature), "&mdash;").concat(Math.round(day.maxTemperature), "</span>\n <span class=\"uv ").concat(day.uvRating(), "\" title=\"").concat(day.uvRating(), "\">").concat(Math.round(day.maxUV), "</span>\n <span class=\"sunrise\">").concat(day.sunrise.toLocaleTimeString("en-US", { timeStyle: "short", hour12: false }), "</span>\n <span class=\"sunset\">").concat(day.sunset.toLocaleTimeString("en-US", { timeStyle: "short", hour12: false }), "</span>\n</div>"));
}
var daily = document.getElementById("daily");
daily.innerHTML = dailySlots.join("\r\n");
if (!this.hourly)
return;
var hourlySlots = [];
var startHour = this.hourly.findIndex(function (x) { return x.time.getTime() > (new Date().getTime()) - 3600000; });
for (var i = 0; i < 10; i++) {
var hour = this.hourly[i + startHour];
hourlySlots.push("<div class=\"hourly-slot\">\n <span class=\"hour\">".concat(hour.time.getHours(), "</span>\n <span class=\"temp\">").concat(Math.round(hour.temperature), "</span>\n <span class=\"precipitation\">").concat(Math.round(hour.precipitation), "<sup>\"</sup></span>\n <span class=\"chance\">").concat(Math.round(hour.precipitationProbability), "<sup>%</sup></span>\n</div>"));
}
var hourly = document.getElementById("hourly");
hourly.innerHTML = hourlySlots.join("\r\n");
};
Weather.prototype.inCardinals = function (direction) {
if (direction > 337.5 || direction <= 22.5)
return "N";
if (direction > 22.5 || direction <= 67.5)
return "NE";
if (direction > 67.5 || direction <= 112.5)
return "E";
if (direction > 112.5 || direction <= 157.5)
return "SE";
if (direction > 157.5 || direction <= 202.5)
return "S";
if (direction > 202.5 || direction <= 249.5)
return "SW";
if (direction > 249.5 || direction <= 294.5)
return "W";
if (direction > 294.5 || direction <= 337.5)
return "NW";
return null;
};
return Weather;
}());
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Weather);
var WeatherOptions = /** @class */ (function () {
function WeatherOptions(latitude, longitude, timezone) {
if (timezone === void 0) { timezone = "America/Los_Angeles"; }
this.timezone = "America/Los_Angeles";
this["wind_speed_unit"] = "mph";
this["temperature_unit"] = "fahrenheit";
this["precipitation_unit"] = "inch";
this.latitude = latitude;
this.longitude = longitude;
this.timezone = timezone;
}
return WeatherOptions;
}());
var CurrentWeather = /** @class */ (function () {
function CurrentWeather(current) {
this.time = new Date(Number(current.time()) * 1000);
this.temperature = current.variables(0).value();
this.humidity = current.variables(1).value();
this.feelsLike = current.variables(2).value();
this.precipitation = current.variables(3).value();
this.windSpeed = current.variables(4).value();
this.windGusts = current.variables(5).value();
this.windDirection = current.variables(6).value();
this.cloudCoverage = current.variables(7).value();
}
CurrentWeather.prototype.getCloudCoverageIcon = function (sunrise, sunset) {
if (this.cloudCoverage > 75 || !sunrise || !sunset)
return "cloud";
if (this.time.getTime() > sunrise.getTime() && this.time.getTime() < sunset.getTime())
return this.cloudCoverage > 25 ? "partly_cloudy_day" : "clear_day";
return this.cloudCoverage > 25 ? "partly_cloudy_night" : "bedtime";
};
return CurrentWeather;
}());
var DailyWeather = /** @class */ (function () {
function DailyWeather() {
}
DailyWeather.prototype.uvRating = function () {
if (this.maxUV < 3)
return "low";
if (this.maxUV < 6)
return "moderate";
if (this.maxUV < 8)
return "high";
if (this.maxUV < 11)
return "very-high";
return "extreme";
};
return DailyWeather;
}());
var LastFetched = /** @class */ (function () {
function LastFetched() {
this.current = new Date();
this.hourly = new Date();
this.daily = new Date();
}
LastFetched.prototype.minutesSinceCurrent = function () {
return Math.floor((new Date().getTime() - this.current.getTime()) / 60000);
};
LastFetched.prototype.hoursSinceHourly = function () {
return Math.floor((new Date().getTime() - this.hourly.getTime()) / 3600000);
};
LastFetched.prototype.hoursSinceDaily = function () {
return Math.floor((new Date().getTime() - this.daily.getTime()) / 3600000);
};
return LastFetched;
}());
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
(() => {
/*!***********************!*\
!*** ./src/launch.ts ***!
\***********************/
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _substrate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./substrate */ "./src/substrate.ts");
/* harmony import */ var _weather__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./weather */ "./src/weather.ts");
var ready = function (func) { return document.readyState !== "loading" ? func() : document.addEventListener("DOMContentLoaded", func); };
ready(function () {
new _substrate__WEBPACK_IMPORTED_MODULE_0__["default"](20);
var weather;
navigator.geolocation.getCurrentPosition(function (position) {
weather = new _weather__WEBPACK_IMPORTED_MODULE_1__["default"](position.coords.latitude, position.coords.longitude);
}, function () {
weather = new _weather__WEBPACK_IMPORTED_MODULE_1__["default"]();
});
});
})();
/******/ })()
;
//# sourceMappingURL=main.js.map