import e from "/resources/libraries/reactesm/react@19.2.5"; import t from "/resources/libraries/reactesm/react-dom@19.2.5/client"; //#region \0rolldown/runtime.js var n = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), r = /* @__PURE__ */ n(((e) => { var t = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment"); function r(e, n, r) { var i = null; if (r !== void 0 && (i = "" + r), n.key !== void 0 && (i = "" + n.key), "key" in n) for (var a in r = {}, n) a !== "key" && (r[a] = n[a]); else r = n; return n = r.ref, { $$typeof: t, type: e, key: i, ref: n === void 0 ? null : n, props: r }; } e.Fragment = n, e.jsx = r, e.jsxs = r; })), i = (/* @__PURE__ */ n(((e, t) => { t.exports = r(); })))(); function a() { let [t, n] = e.useState([]); window.setAlertsData = n; let r = t.sort((e, t) => new Date(t.date) - new Date(e.date)), a = { emergency: /* @__PURE__ */ (0, i.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 512", children: /* @__PURE__ */ (0, i.jsx)("path", { d: "M256 32a224 224 0 1 1 0 448 224 224 0 1 1 0-448zm0 480A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm0-384c-8.8 0-16 7.2-16 16V272c0 8.8 7.2 16 16 16s16-7.2 16-16V144c0-8.8-7.2-16-16-16zm24 224a24 24 0 1 0 -48 0 24 24 0 1 0 48 0z" }) }), warning: /* @__PURE__ */ (0, i.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 448 512", children: /* @__PURE__ */ (0, i.jsx)("path", { d: "M208 16c0-8.8 7.2-16 16-16s16 7.2 16 16V32.8c80.9 8 144 76.2 144 159.2v29.1c0 43.7 17.4 85.6 48.3 116.6l2.8 2.8c8.3 8.3 13 19.6 13 31.3c0 24.5-19.8 44.3-44.3 44.3H44.3C19.8 416 0 396.2 0 371.7c0-11.7 4.7-23 13-31.3l2.8-2.8C46.6 306.7 64 264.8 64 221.1V192c0-83 63.1-151.2 144-159.2V16zm16 48C153.3 64 96 121.3 96 192v29.1c0 52.2-20.7 102.3-57.7 139.2L35.6 363c-2.3 2.3-3.6 5.4-3.6 8.7c0 6.8 5.5 12.3 12.3 12.3H403.7c6.8 0 12.3-5.5 12.3-12.3c0-3.3-1.3-6.4-3.6-8.7l-2.8-2.8c-36.9-36.9-57.7-87-57.7-139.2V192c0-70.7-57.3-128-128-128zM193.8 458.7c4.4 12.4 16.3 21.3 30.2 21.3s25.8-8.9 30.2-21.3c2.9-8.3 12.1-12.7 20.4-9.8s12.7 12.1 9.8 20.4C275.6 494.2 251.9 512 224 512s-51.6-17.8-60.4-42.7c-2.9-8.3 1.4-17.5 9.8-20.4s17.5 1.4 20.4 9.8z" }) }), notice: /* @__PURE__ */ (0, i.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 576 512", children: /* @__PURE__ */ (0, i.jsx)("path", { d: "M560 32c-8.8 0-16 7.2-16 16V59.5L32 187.5V176c0-8.8-7.2-16-16-16s-16 7.2-16 16v19.5V208v96 12.5V336c0 8.8 7.2 16 16 16s16-7.2 16-16V324.5l131.7 32.9c-2.4 8.4-3.7 17.4-3.7 26.6c0 53 43 96 96 96c46.2 0 84.7-32.6 93.9-76L544 452.5V464c0 8.8 7.2 16 16 16s16-7.2 16-16V440 72 48c0-8.8-7.2-16-16-16zM544 419.5L32 291.5v-71l512-128v327zM192 384c0-6.5 1-12.9 2.8-18.8l124 31C313.1 425.7 287.2 448 256 448c-35.3 0-64-28.7-64-64z" }) }) }; return /* @__PURE__ */ (0, i.jsx)(i.Fragment, { children: r.map((e, t) => { var n = { __html: e.body }, r = new Date(e.date); return /* @__PURE__ */ (0, i.jsx)("div", { role: "alert", id: "quur-block-emergency-emergency-alert-" + t, className: "quur-emergency-alert-level-" + e.level.toLowerCase() + " quur-block-emergency-emergency-alert", children: /* @__PURE__ */ (0, i.jsxs)("div", { className: "container", children: [ /* @__PURE__ */ (0, i.jsx)("div", { className: "quur-icon", children: a[e.level.toLowerCase()] }), /* @__PURE__ */ (0, i.jsxs)("div", { id: "quur-emergency-message-content-area-" + t, className: "quur-alert-message", children: [/* @__PURE__ */ (0, i.jsx)("h2", { className: "quur-alert-title", children: e.title }), /* @__PURE__ */ (0, i.jsx)("div", { className: "quur-alert-content", dangerouslySetInnerHTML: n })] }), /* @__PURE__ */ (0, i.jsx)("div", { className: "quur-alert-link", children: /* @__PURE__ */ (0, i.jsx)(o, { link: e.link, title: e.title }) }), /* @__PURE__ */ (0, i.jsx)("div", { className: "quur-emergency-timestamp", children: /* @__PURE__ */ (0, i.jsxs)("span", { id: "quur-emergency-message-timestamp-value", className: "quur-emergency-timestamp-value", children: [ /* @__PURE__ */ (0, i.jsxs)("nobr", { children: [ r.toLocaleString("en-CA", { month: "short" }), " ", r.toLocaleString("en-CA", { day: "numeric" }), ", ", r.toLocaleString("en-CA", { year: "numeric" }) ] }), " ", /* @__PURE__ */ (0, i.jsx)("nobr", { children: r.toLocaleString("en-CA", { hour: "numeric", hour12: !0, minute: "2-digit" }).replaceAll(".", "") }) ] }) }) ] }) }, "quur-block-emergency-emergency-alert-" + t); }) }); } function o(e) { if (e.link != null) return /* @__PURE__ */ (0, i.jsx)("a", { href: e.link, "aria-label": "View details for " + e.title, children: "Details" }); } function s(e) { if (e.type === "drupaljsonapi" && e.data.map((e, t) => { let n = { id: e.id, date: e.attributes.field_notification_date, title: e.attributes.title, body: e.attributes.body.value, level: e.attributes.field_level, link: null }; setAlertsData((e) => [...e, n]); }), e.type === "alertable") { let t = { critical: "emergency", advisory: "warning", information: "notice", test: "notice" }; e.data.map((e, n) => { let r = { id: e.id, date: e.properties.sent, title: e.properties.title, body: "
" + e.properties.description + "
", level: t[e.properties.level], link: e.properties.link }; setAlertsData((e) => [...e, r]); }); } } function c(e) { let n = document.querySelector("#quur-emergency-alerts"); t.createRoot(n, { identifierPrefix: "quurEmergencyAlertIds" }).render(/* @__PURE__ */ (0, i.jsx)(a, {})); } function l() { c(); let e = window.location.search, t = new URLSearchParams(e); var n = !1; if (t.get("testemergencyalerts") != null && (n = !0), n == 1) var r = "/contentapi/jsonapi/node/test_notifications?sort=field_notification_date"; else var r = "/contentapi/jsonapi/node/notifications?sort=field_notification_date"; if (fetch(r).then((e) => { e.json().then((e) => { var t = e.data; s({ type: "drupaljsonapi", data: t }); }); }).catch((e) => { console.log(e); }), n == 1) var r = "/alertsapi/testfeed"; else var r = "/alertsapi/feed"; fetch(r).then((e) => { e.json().then((e) => { var t = e.features; n == 1 && (t.push({ geometry: { type: "Point", coordinates: [-76.515496, 44.229505] }, type: "Feature", properties: { cap_link: "https://demo.peasi.ca/demo1/2025/7511.cap", description: "For testing purposes, this alert is not generated by the alertable practice system, it is hard coded into the QU emergency alerts test code block.", msg_type: "Update", author: "¾ÅÐãÖ±²¥", title: "Simulated Critical Alert", geocode: "360302", link: "https://web-demo.peasi.ca/#/incidents/036a0ede-a95f-4a9a-b26d-ee18a018a3a3", level: "critical", event: "wildfire", sent: "2026-01-01T15:00:00-00:00", icon: "https://demo.peasi.ca/demo1/geo/v1/icons/critical-fire.png" }, id: 7511 }), t.push({ geometry: { type: "Point", coordinates: [-76.515496, 44.229505] }, type: "Feature", properties: { cap_link: "https://demo.peasi.ca/demo1/2025/7511.cap", description: "For testing purposes, this alert is not generated by the alertable practice system, it is hard coded into the QU emergency alerts test code block.", msg_type: "Update", author: "¾ÅÐãÖ±²¥", title: "Simulated Advisory Alert", geocode: "360302", link: "https://web-demo.peasi.ca/#/incidents/036a0ede-a95f-4a9a-b26d-ee18a018a3a3", level: "advisory", event: "wildfire", sent: "2026-01-01T14:00:00-00:00", icon: "https://demo.peasi.ca/demo1/geo/v1/icons/critical-fire.png" }, id: 7511 }), t.push({ geometry: { type: "Point", coordinates: [-76.515496, 44.229505] }, type: "Feature", properties: { cap_link: "https://demo.peasi.ca/demo1/2025/7511.cap", description: "For testing purposes, this alert is not generated by the alertable practice system, it is hard coded into the QU emergency alerts test code block.", msg_type: "Update", author: "¾ÅÐãÖ±²¥", title: "Simulated Information Alert", geocode: "360302", link: "https://web-demo.peasi.ca/#/incidents/036a0ede-a95f-4a9a-b26d-ee18a018a3a3", level: "information", event: "wildfire", sent: "2026-01-01T13:00:00-00:00", icon: "https://demo.peasi.ca/demo1/geo/v1/icons/critical-fire.png" }, id: 7511 })), s({ type: "alertable", data: t }); }); }).catch((e) => { console.log(e); }); } function u() { function n() { e !== void 0 && t !== void 0 && (clearInterval(r), l()); } let r = setInterval(n, 5); } function d() { document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", u) : u(); } var f = d(); //#endregion export { f as default };