Files
worldwideview/public/plugins/nuclear/frontend.mjs

182 lines
5.0 KiB
JavaScript

//#region ../../node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.js
var e = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), t = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), n = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), r = (e) => {
let t = n(e);
return t.charAt(0).toUpperCase() + t.slice(1);
}, i = {
xmlns: "http://www.w3.org/2000/svg",
width: 24,
height: 24,
viewBox: "0 0 24 24",
fill: "none",
stroke: "currentColor",
strokeWidth: 2,
strokeLinecap: "round",
strokeLinejoin: "round"
}, a = (e) => {
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
return !1;
}, o = globalThis.__WWV_HOST__.React.forwardRef(({ color: t = "currentColor", size: n = 24, strokeWidth: r = 2, absoluteStrokeWidth: o, className: s = "", children: c, iconNode: l, ...u }, d) => globalThis.__WWV_HOST__.React.createElement("svg", {
ref: d,
...i,
width: n,
height: n,
stroke: t,
strokeWidth: o ? Number(r) * 24 / Number(n) : r,
className: e("lucide", s),
...!c && !a(u) && { "aria-hidden": "true" },
...u
}, [...l.map(([e, t]) => globalThis.__WWV_HOST__.React.createElement(e, t)), ...Array.isArray(c) ? c : [c]])), s = (n, i) => {
let a = globalThis.__WWV_HOST__.React.forwardRef(({ className: a, ...s }, c) => globalThis.__WWV_HOST__.React.createElement(o, {
ref: c,
iconNode: i,
className: e(`lucide-${t(r(n))}`, `lucide-${n}`, a),
...s
}));
return a.displayName = r(n), a;
}, c = s("atom", [
["circle", {
cx: "12",
cy: "12",
r: "1",
key: "41hilf"
}],
["path", {
d: "M20.2 20.2c2.04-2.03.02-7.36-4.5-11.9-4.54-4.52-9.87-6.54-11.9-4.5-2.04 2.03-.02 7.36 4.5 11.9 4.54 4.52 9.87 6.54 11.9 4.5Z",
key: "1l2ple"
}],
["path", {
d: "M15.7 15.7c4.52-4.54 6.54-9.87 4.5-11.9-2.03-2.04-7.36-.02-11.9 4.5-4.52 4.54-6.54 9.87-4.5 11.9 2.03 2.04 7.36.02 11.9-4.5Z",
key: "1wam0m"
}]
]), l = s("radiation", [
["path", {
d: "M12 12h.01",
key: "1mp3jc"
}],
["path", {
d: "M14 15.4641a4 4 0 0 1-4 0L7.52786 19.74597 A 1 1 0 0 0 7.99303 21.16211 10 10 0 0 0 16.00697 21.16211 1 1 0 0 0 16.47214 19.74597z",
key: "1y4lzb"
}],
["path", {
d: "M16 12a4 4 0 0 0-2-3.464l2.472-4.282a1 1 0 0 1 1.46-.305 10 10 0 0 1 4.006 6.94A1 1 0 0 1 21 12z",
key: "163ggk"
}],
["path", {
d: "M8 12a4 4 0 0 1 2-3.464L7.528 4.254a1 1 0 0 0-1.46-.305 10 10 0 0 0-4.006 6.94A1 1 0 0 0 3 12z",
key: "1l9i0b"
}]
]), u = class {
context = null;
iconUrls = {};
defaultLayerColor = "#3b82f6";
clusterDistance = 50;
maxEntities = 5e3;
iconScale = 1;
async initialize(e) {
this.context = e;
}
destroy() {
this.context = null;
}
async fetch(e) {
return [];
}
getPollingInterval() {
return 0;
}
getLayerConfig() {
return {
color: this.defaultLayerColor,
clusterEnabled: !0,
clusterDistance: this.clusterDistance,
maxEntities: this.maxEntities
};
}
getEntityColor(e) {
return this.defaultLayerColor;
}
getEntityIcon(e) {
return this.icon;
}
renderEntity(e) {
let t = this.getEntityColor(e), n = this.getEntityIcon(e), r = `${n?.displayName || n?.name || "default"}-${t}`;
return this.iconUrls[r] || (this.iconUrls[r] = globalThis.__WWV_HOST__.WWVPluginSDK.createSvgIconUrl(n, { color: t })), {
type: "billboard",
iconUrl: this.iconUrls[r],
color: t,
iconScale: this.iconScale
};
}
}, d = {
operational: "#22c55e",
"under construction": "#eab308",
decommissioned: "#64748b",
abandoned: "#ef4444"
}, f = class extends u {
constructor(...e) {
super(...e), this.id = "nuclear", this.name = "Nuclear Facilities", this.description = "Global nuclear power plants and reactors from OSM.", this.icon = c, this.category = "infrastructure", this.version = "1.0.2", this.defaultLayerColor = "#22d3ee", this.maxEntities = 1e3;
}
getEntityColor(e) {
return d[(e.properties?.status)?.toLowerCase() || "unknown"] || this.defaultLayerColor;
}
getEntityIcon(e) {
return d[(e.properties?.status)?.toLowerCase() || "unknown"] ? l : c;
}
getFilterDefinitions() {
return [{
id: "status",
label: "Facility Status",
propertyKey: "status",
type: "select",
options: [
{
value: "operational",
label: "Operational"
},
{
value: "under construction",
label: "Under Construction"
},
{
value: "decommissioned",
label: "Decommissioned"
},
{
value: "abandoned",
label: "Abandoned"
}
]
}];
}
getLegend() {
return [
{
label: "Operational",
color: d.operational,
filterId: "status",
filterValue: "operational"
},
{
label: "Under Const.",
color: d["under construction"],
filterId: "status",
filterValue: "under construction"
},
{
label: "Decommissioned",
color: d.decommissioned,
filterId: "status",
filterValue: "decommissioned"
},
{
label: "Abandoned",
color: d.abandoned,
filterId: "status",
filterValue: "abandoned"
}
];
}
};
//#endregion
export { f as NuclearPlugin };