@datawheel/bespoke 0.1.9 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.js +245 -2298
  2. package/dist/server.js +100 -64
  3. package/package.json +1 -2
package/dist/index.js CHANGED
@@ -1,8 +1,6 @@
1
1
  import * as d3Array from 'd3-array';
2
- import { sum, max, min, ticks, tickIncrement, tickStep, bisect } from 'd3-array';
3
2
  import * as d3Collection from 'd3-collection';
4
3
  import * as d3Format from 'd3-format';
5
- import { formatSpecifier, precisionFixed, precisionRound, precisionPrefix, formatPrefix, format as format$1 } from 'd3-format';
6
4
  import * as d3TimeFormat from 'd3-time-format';
7
5
  import { formatAbbreviate } from 'd3plus-format';
8
6
  import { date } from 'd3plus-axis';
@@ -14,13 +12,12 @@ import { schema, normalize } from 'normalizr';
14
12
  import { createSlice, configureStore } from '@reduxjs/toolkit';
15
13
  import { HYDRATE, createWrapper } from 'next-redux-wrapper';
16
14
  import { NotificationsProvider, showNotification } from '@mantine/notifications';
17
- import React, { forwardRef, useMemo, useState, useCallback, useContext, useEffect, createContext, useRef, Component, createElement, Fragment as Fragment$1 } from 'react';
15
+ import React, { forwardRef, useMemo, useState, useCallback, useContext, useEffect, createContext, useRef, createElement, Fragment as Fragment$1 } from 'react';
18
16
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
19
17
  import { useDispatch, useSelector } from 'react-redux';
20
18
  import { Stack, Text, Badge, Group, Tooltip, ActionIcon, Center, useMantineTheme, Modal, Button, Title, Select, MultiSelect, MantineProvider, AppShell, Navbar, UnstyledButton, Skeleton, Container, TextInput, Loader, LoadingOverlay, Alert, Autocomplete, Chip, Card, Space, Code, Divider, SegmentedControl, Overlay, Grid, ThemeIcon, Burger, Popover, Checkbox, Radio, Switch, ScrollArea, Drawer, Header, Input, Avatar, Textarea, Tabs, FileInput, SimpleGrid, Image, Accordion, NumberInput, CopyButton, Col, Menu } from '@mantine/core';
21
19
  import { IconInfoCircle, IconCircleDashed, IconSearch, IconTrash, IconDatabase, IconServer, IconPencil, IconAlertCircle, IconCircleCheck, IconPlayerPlay, IconCirclePlus, IconCircleX, IconFileAnalytics, IconPlus, IconBoxMargin, IconTable, IconMathFunction, IconChevronLeft, IconSettings, IconAlignLeft, IconAlignCenter, IconAlignRight, IconMenu, IconRefresh, IconPolaroid, IconCircleMinus, IconEyeOff, IconLogout, IconLogin, IconWorld, IconCamera, IconShare, IconVariable, IconArrowRightCircle, IconUpload, IconPalette, IconCode, IconExternalLink, IconDownload, IconTemplate, IconChartBar, IconLink, IconClipboardCheck, IconClipboardCopy, IconEye, IconRss, IconGlobe } from '@tabler/icons';
22
- import { dataConcat, dataLoad } from 'd3plus-viz';
23
- import ReactTable from 'react-table-6';
20
+ import { dataConcat } from 'd3plus-viz';
24
21
  import * as d3plus from 'd3plus-react';
25
22
  import { useDebouncedValue, useMediaQuery, useDisclosure, useHotkeys, useUncontrolled, getHotkeyHandler } from '@mantine/hooks';
26
23
  import Link$1 from 'next/link';
@@ -42,39 +39,15 @@ import { saveElement } from 'd3plus-export';
42
39
  import { FacebookShareButton, FacebookIcon, TwitterShareButton, TwitterIcon, TelegramShareButton, TelegramIcon, WhatsappShareButton, WhatsappIcon, LinkedinShareButton, LinkedinIcon, RedditShareButton, RedditIcon, EmailShareButton, EmailIcon } from 'react-share';
43
40
  import { useForm } from '@mantine/form';
44
41
 
45
- var __create = Object.create;
46
42
  var __defProp = Object.defineProperty;
47
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
48
43
  var __getOwnPropNames = Object.getOwnPropertyNames;
49
- var __getProtoOf = Object.getPrototypeOf;
50
- var __hasOwnProp = Object.prototype.hasOwnProperty;
51
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
52
44
  var __esm = (fn, res) => function __init() {
53
45
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
54
46
  };
55
- var __commonJS = (cb, mod) => function __require() {
56
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
57
- };
58
47
  var __export = (target, all) => {
59
48
  for (var name in all)
60
49
  __defProp(target, name, { get: all[name], enumerable: true });
61
50
  };
62
- var __copyProps = (to, from, except, desc) => {
63
- if (from && typeof from === "object" || typeof from === "function") {
64
- for (let key of __getOwnPropNames(from))
65
- if (!__hasOwnProp.call(to, key) && key !== except)
66
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
67
- }
68
- return to;
69
- };
70
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
71
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
72
- mod
73
- ));
74
- var __publicField = (obj, key, value) => {
75
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
76
- return value;
77
- };
78
51
 
79
52
  // ../../node_modules/tsup/assets/esm_shims.js
80
53
  var init_esm_shims = __esm({
@@ -916,12 +889,12 @@ function apiFactory(baseURL) {
916
889
  updateVariant: httpPOST(axios7, "update/variant"),
917
890
  searchReport: httpGET(axios7, "search/reports"),
918
891
  validateVariantSlug: httpGET(axios7, "validate/variant"),
919
- readMember: httpGET(axios7, "read/member"),
892
+ readMember: httpGET(axios7, "read/members"),
920
893
  readMemberImage: httpGET(axios7, {
921
894
  url: "member/image.png",
922
895
  responseType: "blob"
923
896
  }),
924
- searchMember: httpGET(axios7, "memberSearch"),
897
+ searchMember: httpGET(axios7, "search/members"),
925
898
  updateMember: httpGET(axios7, "update/member"),
926
899
  imageLocalSearch: httpImageSearchFactory(axios7, "local"),
927
900
  imageLocalSave: httpImageSaveFactory(axios7, "local"),
@@ -1189,6 +1162,18 @@ var init_previewsToAttributes = __esm({
1189
1162
  }
1190
1163
  });
1191
1164
 
1165
+ // store/envvars.ts
1166
+ var localeDefault3, locales;
1167
+ var init_envvars = __esm({
1168
+ "store/envvars.ts"() {
1169
+ init_esm_shims();
1170
+ localeDefault3 = process.env.NEXT_PUBLIC_REPORTS_LOCALE_DEFAULT || "en";
1171
+ locales = process.env.NEXT_PUBLIC_REPORTS_LOCALES?.split(",") || [localeDefault3];
1172
+ if (!locales.includes(localeDefault3))
1173
+ locales.push(localeDefault3);
1174
+ }
1175
+ });
1176
+
1192
1177
  // libs/ordering.ts
1193
1178
  function assertDev(expr) {
1194
1179
  if (!expr) {
@@ -1298,8 +1283,8 @@ function determineOrdering(entities, entityIds, destination, isNew = false, desc
1298
1283
  );
1299
1284
  }
1300
1285
  function findMaxOrdering(positions, next = false) {
1301
- const max2 = positions.reduce((acc, d) => comparePositions(d, acc) < 0 ? d : acc, FIRST_POSITION);
1302
- return next ? positionAfter(max2) : max2;
1286
+ const max = positions.reduce((acc, d) => comparePositions(d, acc) < 0 ? d : acc, FIRST_POSITION);
1287
+ return next ? positionAfter(max) : max;
1303
1288
  }
1304
1289
  var START_CHAR_CODE, END_CHAR_CODE, FIRST_POSITION;
1305
1290
  var init_ordering = __esm({
@@ -1364,14 +1349,14 @@ function normalizeEntity(type, entities) {
1364
1349
  function getTypedRecord(record, key) {
1365
1350
  return record.hasOwnProperty(key) ? record[key] : {};
1366
1351
  }
1367
- var localeDefault3, blockSchema, variantSchema, dimensionSchema, sectionSchema, reportSchema, formatterSchema, entitySchema, parseVariableUpdateParams, funcifyFormattersByLocale;
1352
+ var localeDefault4, blockSchema, variantSchema, dimensionSchema, sectionSchema, reportSchema, formatterSchema, entitySchema, parseVariableUpdateParams, funcifyFormattersByLocale;
1368
1353
  var init_lib2 = __esm({
1369
1354
  "store/lib.ts"() {
1370
1355
  init_esm_shims();
1371
1356
  init_ordering();
1372
1357
  init_FUNC();
1373
1358
  init_getLocales();
1374
- ({ localeDefault: localeDefault3 } = getLocales_default());
1359
+ ({ localeDefault: localeDefault4 } = getLocales_default());
1375
1360
  blockSchema = new schema.Entity("block" /* BLOCKS */);
1376
1361
  blockSchema.define({
1377
1362
  consumers: [blockSchema],
@@ -1443,7 +1428,7 @@ var init_lib2 = __esm({
1443
1428
  statusPayload
1444
1429
  };
1445
1430
  };
1446
- funcifyFormattersByLocale = (formatters = [], locale = localeDefault3) => formatters.reduce((acc, f) => {
1431
+ funcifyFormattersByLocale = (formatters = [], locale = localeDefault4) => formatters.reduce((acc, f) => {
1447
1432
  const formatterFn = parse({ vars: ["n"], logic: f.content.logic }, {}, locale, {});
1448
1433
  acc[f.name] = formatterFn;
1449
1434
  return acc;
@@ -1842,25 +1827,13 @@ var init_recordsActions = __esm({
1842
1827
  });
1843
1828
  }
1844
1829
  });
1845
-
1846
- // store/envvars.ts
1847
- var localeDefault4, locales;
1848
- var init_envvars = __esm({
1849
- "store/envvars.ts"() {
1850
- init_esm_shims();
1851
- localeDefault4 = process.env.NEXT_PUBLIC_REPORTS_LOCALE_DEFAULT || "en";
1852
- locales = process.env.NEXT_PUBLIC_REPORTS_LOCALES?.split(",") || [localeDefault4];
1853
- if (!locales.includes(localeDefault4))
1854
- locales.push(localeDefault4);
1855
- }
1856
- });
1857
1830
  var initialState2, statusSlice;
1858
1831
  var init_statusSlice = __esm({
1859
1832
  "store/statusSlice.ts"() {
1860
1833
  init_esm_shims();
1861
1834
  init_envvars();
1862
1835
  initialState2 = {
1863
- localeDefault: localeDefault4,
1836
+ localeDefault: localeDefault3,
1864
1837
  locales,
1865
1838
  showToolbar: false,
1866
1839
  activeSection: null,
@@ -1914,8 +1887,8 @@ __export(actions_exports, {
1914
1887
  deleteEntity: () => deleteEntity,
1915
1888
  deleteQueryParam: () => deleteQueryParam,
1916
1889
  initialize: () => initialize,
1917
- memberRead: () => memberRead,
1918
1890
  readEntity: () => readEntity,
1891
+ readMember: () => readMember,
1919
1892
  readMetadata: () => readMetadata,
1920
1893
  recalculateVariables: () => recalculateVariables,
1921
1894
  reportSearch: () => reportSearch,
@@ -1958,7 +1931,7 @@ function searchRegenerate() {
1958
1931
  return result.data;
1959
1932
  };
1960
1933
  }
1961
- function memberRead(params) {
1934
+ function readMember(params) {
1962
1935
  return async (_, __, api) => {
1963
1936
  const result = await api.readMember(params);
1964
1937
  if ("error" in result) {
@@ -1988,7 +1961,7 @@ function recalculateVariables(resource, params) {
1988
1961
  return async (dispatch, getState) => {
1989
1962
  const state = getState();
1990
1963
  const blocks = state.records.entities.block;
1991
- const formatterFunctions = resource.formatterFunctions[localeDefault4];
1964
+ const formatterFunctions = resource.formatterFunctions[localeDefault3];
1992
1965
  const { parsedParams, statusPayload } = parseVariableUpdateParams(state.status, params);
1993
1966
  const {
1994
1967
  sid,
@@ -2037,29 +2010,25 @@ var init_actions = __esm({
2037
2010
  init_esm_shims();
2038
2011
  init_runConsumers();
2039
2012
  init_previewsToAttributes();
2013
+ init_envvars();
2040
2014
  init_lib2();
2041
2015
  init_recordsActions();
2042
2016
  init_statusSlice();
2043
2017
  init_variablesSlice();
2044
- init_envvars();
2045
2018
  init_recordsActions();
2046
2019
  }
2047
2020
  });
2048
2021
  function ResourceProvider({ children }) {
2049
2022
  const formatters = useFormatterList();
2050
2023
  const value = useMemo(() => ({
2051
- formatterFunctions: locales2.reduce((acc, locale) => ({
2052
- ...acc,
2053
- [locale]: formatters.data ? funcifyFormattersByLocale(formatters.data, locale) : {}
2054
- }), {})
2024
+ formatterFunctions: Object.fromEntries(
2025
+ locales2.map((locale) => [
2026
+ locale,
2027
+ formatters.data ? funcifyFormattersByLocale(formatters.data, locale) : {}
2028
+ ])
2029
+ )
2055
2030
  }), [formatters]);
2056
- return /* @__PURE__ */ jsx(
2057
- ResourceContext.Provider,
2058
- {
2059
- value,
2060
- children
2061
- }
2062
- );
2031
+ return /* @__PURE__ */ jsx(ResourceContext.Provider, { value, children });
2063
2032
  }
2064
2033
  var locales2, initialContext, ResourceContext;
2065
2034
  var init_ResourceProvider = __esm({
@@ -2259,2018 +2228,183 @@ var init_store = __esm({
2259
2228
  storeWrapper = createWrapper(storeFactory);
2260
2229
  }
2261
2230
  });
2262
- function withFetcher(Component2, useRef7) {
2263
- const ComponentWithFetcher = (props) => {
2264
- const {
2265
- id,
2266
- skelHeight,
2267
- skelWidth,
2268
- ...otherProps
2269
- } = props;
2270
- const ref = useRef7(id);
2271
- if (ref.isUninitialized || ref.isFetching) {
2272
- return /* @__PURE__ */ jsx(Skeleton, { width: skelWidth, height: skelHeight });
2273
- }
2274
- if (ref.isError) {
2275
- return null;
2276
- }
2277
- return /* @__PURE__ */ jsx(Component2, { ...otherProps, for: ref.data });
2278
- };
2279
- ComponentWithFetcher.displayName = `withFetcher(${Component2.displayName || Component2.name || "Component"})`;
2280
- return ComponentWithFetcher;
2281
- }
2282
- var init_withFetcher = __esm({
2283
- "store/withFetcher.tsx"() {
2284
- init_esm_shims();
2285
- }
2286
- });
2287
-
2288
- // store/index.ts
2289
- var init_store2 = __esm({
2290
- "store/index.ts"() {
2291
- init_esm_shims();
2292
- init_actions();
2293
- init_hooks();
2294
- init_store();
2295
- init_withFetcher();
2296
- }
2297
- });
2298
-
2299
- // libs/js/stripHTML.ts
2300
- function stripHTML(n) {
2301
- const entities = {
2302
- "&amp;": "&",
2303
- "&lt;": "<",
2304
- "&gt;": ">",
2305
- "&quot;": '"',
2306
- "&#x27;": "'",
2307
- "&#x60;": "`",
2308
- "&nbsp;": ""
2309
- };
2310
- const source = `(?:${Object.keys(entities).join("|")})`;
2311
- const testRegexp = RegExp(source);
2312
- const replaceRegexp = RegExp(source, "g");
2313
- const s = String(n).replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
2314
- return testRegexp.test(s) ? s.replace(replaceRegexp, (match) => entities[match]) : s;
2315
- }
2316
- var init_stripHTML = __esm({
2317
- "libs/js/stripHTML.ts"() {
2318
- init_esm_shims();
2319
- }
2320
- });
2321
-
2322
- // libs/blocks/sanitizeBlockContent.ts
2323
- var stripTrail, clearBlank, stripOuterTags, sanitizeBlockContent, sanitizeBlockContent_default;
2324
- var init_sanitizeBlockContent = __esm({
2325
- "libs/blocks/sanitizeBlockContent.ts"() {
2326
- init_esm_shims();
2327
- stripTrail = (d) => typeof d === "string" ? d.replace(/\&nbsp;<\/p>/g, "</p>") : d;
2328
- clearBlank = (d) => typeof d === "string" && d === "<p><br></p>" ? "" : d;
2329
- stripOuterTags = (d) => typeof d === "string" ? d.replace(/^<p>(.*)<\/p>$/, "$1") : d;
2330
- sanitizeBlockContent = (d) => d ? stripOuterTags(clearBlank(stripTrail(d))) : d;
2331
- sanitizeBlockContent_default = sanitizeBlockContent;
2332
- }
2333
- });
2334
- function StatPreview({
2335
- subtitle,
2336
- title,
2337
- value,
2338
- tooltip
2339
- }) {
2340
- let titleHTML = sanitizeBlockContent_default(title);
2341
- let valueHTML = sanitizeBlockContent_default(value);
2342
- let subtitleHTML = sanitizeBlockContent_default(subtitle);
2343
- const tooltipHTML = sanitizeBlockContent_default(tooltip);
2344
- if (!titleHTML && !valueHTML && !subtitleHTML) {
2345
- titleHTML = "<span class='cr-block-placeholder'>Title</span>";
2346
- valueHTML = "<span class='cr-block-placeholder'>Big Stat</span>";
2347
- subtitleHTML = "<span class='cr-block-placeholder'>Subtitle</span>";
2348
- }
2349
- return /* @__PURE__ */ jsxs("div", { children: [
2350
- tooltip && /* @__PURE__ */ jsx("div", { style: { position: "absolute", right: "50px" }, children: /* @__PURE__ */ jsx(Tooltip, { label: tooltipHTML, withArrow: true, withinPortal: true, children: /* @__PURE__ */ jsx(ActionIcon, { children: /* @__PURE__ */ jsx(IconInfoCircle, {}) }) }) }, "tooltip"),
2351
- /* @__PURE__ */ jsxs("div", { children: [
2352
- /* @__PURE__ */ jsx(Text, { size: "md", dangerouslySetInnerHTML: { __html: titleHTML } }),
2353
- /* @__PURE__ */ jsx(Text, { size: "xl", dangerouslySetInnerHTML: { __html: valueHTML } }),
2354
- /* @__PURE__ */ jsx(Text, { size: "sm", dangerouslySetInnerHTML: { __html: subtitleHTML } })
2355
- ] }, "stat")
2356
- ] });
2357
- }
2358
- var init_Stat = __esm({
2359
- "components/blocks/types/renderers/Stat.tsx"() {
2360
- init_esm_shims();
2361
- init_sanitizeBlockContent();
2362
- }
2363
- });
2364
-
2365
- // libs/viz/defaultConfig.ts
2366
- var defaultConfig_default;
2367
- var init_defaultConfig = __esm({
2368
- "libs/viz/defaultConfig.ts"() {
2369
- init_esm_shims();
2370
- defaultConfig_default = {
2371
- loadingHTML: `<div style="left: 50%; top: 50%; position: absolute; transform: translate(-50%, -50%);">
2372
- <svg class="cp-viz-spinner" width="60px" height="60px" viewBox="0 0 317 317" xmlns="http://www.w3.org/2000/svg">
2373
- <path class="outer" d="M16.43 157.072c0 34.797 12.578 66.644 33.428 91.277l-11.144 11.141c-23.673-27.496-37.992-63.283-37.992-102.418 0-39.133 14.319-74.921 37.992-102.423l11.144 11.144c-20.85 24.63-33.428 56.481-33.428 91.279z"/>
2374
- <path class="outer" d="M157.793 15.708c34.798 0 66.648 12.58 91.28 33.427l11.143-11.144c-27.502-23.676-63.29-37.991-102.423-37.991-39.132 0-74.919 14.315-102.422 37.991l11.148 11.144c24.627-20.847 56.477-33.427 91.274-33.427"/>
2375
- <path class="outer" d="M299.159 157.072c0 34.797-12.578 66.644-33.43 91.277l11.145 11.141c23.674-27.496 37.992-63.283 37.992-102.418 0-39.133-14.318-74.921-37.992-102.423l-11.145 11.144c20.852 24.63 33.43 56.481 33.43 91.279"/>
2376
- <path class="outer" d="M157.793 298.432c-34.797 0-66.647-12.574-91.274-33.424l-11.148 11.138c27.503 23.682 63.29 37.997 102.422 37.997 39.133 0 74.921-14.315 102.423-37.997l-11.143-11.138c-24.632 20.85-56.482 33.424-91.28 33.424"/>
2377
- <path class="middle" d="M226.59 61.474l-7.889 13.659c24.997 18.61 41.184 48.382 41.184 81.94 0 33.555-16.187 63.329-41.184 81.936l7.889 13.664c29.674-21.394 49.004-56.23 49.004-95.6 0-39.373-19.33-74.21-49.004-95.599"/>
2378
- <path class="middle" d="M157.793 259.169c-52.398 0-95.553-39.485-101.399-90.317h-15.814c5.912 59.524 56.131 106.018 117.213 106.018 17.26 0 33.633-3.742 48.404-10.406l-7.893-13.672c-12.425 5.38-26.114 8.377-40.511 8.377"/>
2379
- <path class="middle" d="M157.793 54.976c14.397 0 28.086 2.993 40.511 8.371l7.893-13.667c-14.771-6.669-31.144-10.412-48.404-10.412-61.082 0-111.301 46.493-117.213 106.021h15.814c5.846-50.831 49.001-90.313 101.399-90.313"/>
2380
- <path class="inner" d="M95.371 164.193c-3.476-30.475 15.471-58.324 43.723-67.097l-1.804-15.842c-36.899 9.931-61.986 45.602-57.524 84.719 4.461 39.115 36.934 68.219 75.122 69.584l-1.806-15.838c-29.504-2.186-54.235-25.054-57.711-55.526"/>
2381
- <path class="inner" d="M162.504 94.425c29.508 2.185 54.235 25.053 57.711 55.529 3.476 30.469-15.466 58.319-43.724 67.096l1.806 15.834c36.898-9.927 61.986-45.598 57.525-84.712-4.461-39.117-36.936-68.223-75.125-69.588l1.807 15.841z"/>
2382
- </svg>
2383
- <strong>Loading</strong>
2384
- <sub style="bottom: 0; display: block; line-height: 1; margin-top: 5px;">
2385
- <a style="color: inherit;" href="https://www.datawheel.us/" target="_blank">
2386
- Built by Datawheel
2387
- </a>
2388
- </sub>
2389
- </div>`,
2390
- noDataHTML: `<div style="left: 50%; top: 50%; position: absolute; transform: translate(-50%, -50%);">
2391
- <strong>No Data Available</strong>
2392
- </div>`
2393
- };
2394
- }
2395
- });
2396
-
2397
- // cms/components/reportVizes/Graphic.css
2398
- var init_ = __esm({
2399
- "cms/components/reportVizes/Graphic.css"() {
2400
- }
2401
- });
2402
- function Graphic({ config, dataFormat }) {
2403
- const [builtConfig, setBuiltConfig] = useState();
2404
- useEffect(() => {
2405
- const defaults = {
2406
- numberFormat: (d, value, total) => {
2407
- const perc = Number(d[value] / total * 100);
2408
- return isNaN(perc) ? "No Data" : `${perc.toFixed(2)}%`;
2409
- }
2410
- };
2411
- let rebuiltConfig = { ...defaults, ...config };
2412
- if (!rebuiltConfig || !rebuiltConfig.data) {
2413
- console.log("no config/data");
2414
- } else if (typeof rebuiltConfig.data === "string") {
2415
- axios.get(rebuiltConfig.data).then((resp) => {
2416
- rebuiltConfig.data = dataFormat(resp.data);
2417
- if (typeof rebuiltConfig.data === "object" && !(rebuiltConfig.data instanceof Array))
2418
- rebuiltConfig = Object.assign(rebuiltConfig, rebuiltConfig.data);
2419
- if (!rebuiltConfig.total)
2420
- rebuiltConfig.total = rebuiltConfig.data.reduce((acc, d) => isNaN(d[rebuiltConfig.value]) ? acc : acc + Number(d[rebuiltConfig.value]), 0);
2421
- setBuiltConfig(rebuiltConfig);
2422
- });
2423
- } else {
2424
- rebuiltConfig.data = dataFormat(rebuiltConfig.data);
2425
- if (typeof rebuiltConfig.data === "object" && !(rebuiltConfig.data instanceof Array))
2426
- rebuiltConfig = Object.assign(rebuiltConfig, rebuiltConfig.data);
2427
- if (!rebuiltConfig.total)
2428
- rebuiltConfig.total = rebuiltConfig.data.reduce((acc, d) => isNaN(d[rebuiltConfig.value]) ? acc : acc + Number(d[rebuiltConfig.value]), 0);
2429
- setBuiltConfig(rebuiltConfig);
2430
- }
2431
- }, [config]);
2432
- if (!builtConfig)
2433
- return null;
2434
- return /* @__PURE__ */ jsxs("div", { className: "cp-graphic", children: [
2435
- builtConfig.imageURL && /* @__PURE__ */ jsx("img", { src: builtConfig.imageURL, className: "cp-graphic-img", alt: "" }),
2436
- builtConfig.value && /* @__PURE__ */ jsx(
2437
- StatPreview,
2438
- {
2439
- title: builtConfig.label,
2440
- value: builtConfig.value,
2441
- subtitle: builtConfig.subtitle,
2442
- tooltip: builtConfig.tooltip
2443
- }
2444
- )
2445
- ] });
2446
- }
2447
- var init_Graphic = __esm({
2448
- "cms/components/reportVizes/Graphic.tsx"() {
2449
- init_esm_shims();
2450
- init_Stat();
2451
- init_();
2452
- }
2453
- });
2454
- function HTML({ config }) {
2455
- if (!config || !config.html)
2456
- return null;
2457
- return /* @__PURE__ */ jsx("div", { className: "cp-viz cp-html", dangerouslySetInnerHTML: { __html: config.html } });
2458
- }
2459
- var init_HTML = __esm({
2460
- "cms/components/reportVizes/HTML.tsx"() {
2461
- init_esm_shims();
2462
- }
2463
- });
2464
-
2465
- // ../../node_modules/react-is/cjs/react-is.production.min.js
2466
- var require_react_is_production_min = __commonJS({
2467
- "../../node_modules/react-is/cjs/react-is.production.min.js"(exports) {
2468
- init_esm_shims();
2469
- var b = "function" === typeof Symbol && Symbol.for;
2470
- var c = b ? Symbol.for("react.element") : 60103;
2471
- var d = b ? Symbol.for("react.portal") : 60106;
2472
- var e = b ? Symbol.for("react.fragment") : 60107;
2473
- var f = b ? Symbol.for("react.strict_mode") : 60108;
2474
- var g = b ? Symbol.for("react.profiler") : 60114;
2475
- var h = b ? Symbol.for("react.provider") : 60109;
2476
- var k = b ? Symbol.for("react.context") : 60110;
2477
- var l = b ? Symbol.for("react.async_mode") : 60111;
2478
- var m = b ? Symbol.for("react.concurrent_mode") : 60111;
2479
- var n = b ? Symbol.for("react.forward_ref") : 60112;
2480
- var p = b ? Symbol.for("react.suspense") : 60113;
2481
- var q = b ? Symbol.for("react.suspense_list") : 60120;
2482
- var r = b ? Symbol.for("react.memo") : 60115;
2483
- var t = b ? Symbol.for("react.lazy") : 60116;
2484
- var v = b ? Symbol.for("react.block") : 60121;
2485
- var w = b ? Symbol.for("react.fundamental") : 60117;
2486
- var x = b ? Symbol.for("react.responder") : 60118;
2487
- var y = b ? Symbol.for("react.scope") : 60119;
2488
- function z(a) {
2489
- if ("object" === typeof a && null !== a) {
2490
- var u = a.$$typeof;
2491
- switch (u) {
2492
- case c:
2493
- switch (a = a.type, a) {
2494
- case l:
2495
- case m:
2496
- case e:
2497
- case g:
2498
- case f:
2499
- case p:
2500
- return a;
2501
- default:
2502
- switch (a = a && a.$$typeof, a) {
2503
- case k:
2504
- case n:
2505
- case t:
2506
- case r:
2507
- case h:
2508
- return a;
2509
- default:
2510
- return u;
2511
- }
2512
- }
2513
- case d:
2514
- return u;
2515
- }
2516
- }
2517
- }
2518
- function A(a) {
2519
- return z(a) === m;
2520
- }
2521
- exports.AsyncMode = l;
2522
- exports.ConcurrentMode = m;
2523
- exports.ContextConsumer = k;
2524
- exports.ContextProvider = h;
2525
- exports.Element = c;
2526
- exports.ForwardRef = n;
2527
- exports.Fragment = e;
2528
- exports.Lazy = t;
2529
- exports.Memo = r;
2530
- exports.Portal = d;
2531
- exports.Profiler = g;
2532
- exports.StrictMode = f;
2533
- exports.Suspense = p;
2534
- exports.isAsyncMode = function(a) {
2535
- return A(a) || z(a) === l;
2536
- };
2537
- exports.isConcurrentMode = A;
2538
- exports.isContextConsumer = function(a) {
2539
- return z(a) === k;
2540
- };
2541
- exports.isContextProvider = function(a) {
2542
- return z(a) === h;
2543
- };
2544
- exports.isElement = function(a) {
2545
- return "object" === typeof a && null !== a && a.$$typeof === c;
2546
- };
2547
- exports.isForwardRef = function(a) {
2548
- return z(a) === n;
2549
- };
2550
- exports.isFragment = function(a) {
2551
- return z(a) === e;
2552
- };
2553
- exports.isLazy = function(a) {
2554
- return z(a) === t;
2555
- };
2556
- exports.isMemo = function(a) {
2557
- return z(a) === r;
2558
- };
2559
- exports.isPortal = function(a) {
2560
- return z(a) === d;
2561
- };
2562
- exports.isProfiler = function(a) {
2563
- return z(a) === g;
2564
- };
2565
- exports.isStrictMode = function(a) {
2566
- return z(a) === f;
2567
- };
2568
- exports.isSuspense = function(a) {
2569
- return z(a) === p;
2570
- };
2571
- exports.isValidElementType = function(a) {
2572
- return "string" === typeof a || "function" === typeof a || a === e || a === m || a === g || a === f || a === p || a === q || "object" === typeof a && null !== a && (a.$$typeof === t || a.$$typeof === r || a.$$typeof === h || a.$$typeof === k || a.$$typeof === n || a.$$typeof === w || a.$$typeof === x || a.$$typeof === y || a.$$typeof === v);
2573
- };
2574
- exports.typeOf = z;
2575
- }
2576
- });
2577
-
2578
- // ../../node_modules/react-is/cjs/react-is.development.js
2579
- var require_react_is_development = __commonJS({
2580
- "../../node_modules/react-is/cjs/react-is.development.js"(exports) {
2581
- init_esm_shims();
2582
- if (process.env.NODE_ENV !== "production") {
2583
- (function() {
2584
- var hasSymbol = typeof Symbol === "function" && Symbol.for;
2585
- var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 60103;
2586
- var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 60106;
2587
- var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for("react.fragment") : 60107;
2588
- var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for("react.strict_mode") : 60108;
2589
- var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for("react.profiler") : 60114;
2590
- var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for("react.provider") : 60109;
2591
- var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for("react.context") : 60110;
2592
- var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for("react.async_mode") : 60111;
2593
- var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for("react.concurrent_mode") : 60111;
2594
- var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for("react.forward_ref") : 60112;
2595
- var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for("react.suspense") : 60113;
2596
- var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for("react.suspense_list") : 60120;
2597
- var REACT_MEMO_TYPE = hasSymbol ? Symbol.for("react.memo") : 60115;
2598
- var REACT_LAZY_TYPE = hasSymbol ? Symbol.for("react.lazy") : 60116;
2599
- var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for("react.block") : 60121;
2600
- var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for("react.fundamental") : 60117;
2601
- var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for("react.responder") : 60118;
2602
- var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for("react.scope") : 60119;
2603
- function isValidElementType(type) {
2604
- return typeof type === "string" || typeof type === "function" || type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === "object" && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
2605
- }
2606
- function typeOf(object) {
2607
- if (typeof object === "object" && object !== null) {
2608
- var $$typeof = object.$$typeof;
2609
- switch ($$typeof) {
2610
- case REACT_ELEMENT_TYPE:
2611
- var type = object.type;
2612
- switch (type) {
2613
- case REACT_ASYNC_MODE_TYPE:
2614
- case REACT_CONCURRENT_MODE_TYPE:
2615
- case REACT_FRAGMENT_TYPE:
2616
- case REACT_PROFILER_TYPE:
2617
- case REACT_STRICT_MODE_TYPE:
2618
- case REACT_SUSPENSE_TYPE:
2619
- return type;
2620
- default:
2621
- var $$typeofType = type && type.$$typeof;
2622
- switch ($$typeofType) {
2623
- case REACT_CONTEXT_TYPE:
2624
- case REACT_FORWARD_REF_TYPE:
2625
- case REACT_LAZY_TYPE:
2626
- case REACT_MEMO_TYPE:
2627
- case REACT_PROVIDER_TYPE:
2628
- return $$typeofType;
2629
- default:
2630
- return $$typeof;
2631
- }
2632
- }
2633
- case REACT_PORTAL_TYPE:
2634
- return $$typeof;
2635
- }
2636
- }
2637
- return void 0;
2638
- }
2639
- var AsyncMode = REACT_ASYNC_MODE_TYPE;
2640
- var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
2641
- var ContextConsumer = REACT_CONTEXT_TYPE;
2642
- var ContextProvider = REACT_PROVIDER_TYPE;
2643
- var Element = REACT_ELEMENT_TYPE;
2644
- var ForwardRef = REACT_FORWARD_REF_TYPE;
2645
- var Fragment17 = REACT_FRAGMENT_TYPE;
2646
- var Lazy = REACT_LAZY_TYPE;
2647
- var Memo = REACT_MEMO_TYPE;
2648
- var Portal = REACT_PORTAL_TYPE;
2649
- var Profiler = REACT_PROFILER_TYPE;
2650
- var StrictMode = REACT_STRICT_MODE_TYPE;
2651
- var Suspense = REACT_SUSPENSE_TYPE;
2652
- var hasWarnedAboutDeprecatedIsAsyncMode = false;
2653
- function isAsyncMode(object) {
2654
- {
2655
- if (!hasWarnedAboutDeprecatedIsAsyncMode) {
2656
- hasWarnedAboutDeprecatedIsAsyncMode = true;
2657
- console["warn"]("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.");
2658
- }
2659
- }
2660
- return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
2661
- }
2662
- function isConcurrentMode(object) {
2663
- return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
2664
- }
2665
- function isContextConsumer(object) {
2666
- return typeOf(object) === REACT_CONTEXT_TYPE;
2667
- }
2668
- function isContextProvider(object) {
2669
- return typeOf(object) === REACT_PROVIDER_TYPE;
2670
- }
2671
- function isElement(object) {
2672
- return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
2673
- }
2674
- function isForwardRef(object) {
2675
- return typeOf(object) === REACT_FORWARD_REF_TYPE;
2676
- }
2677
- function isFragment(object) {
2678
- return typeOf(object) === REACT_FRAGMENT_TYPE;
2679
- }
2680
- function isLazy(object) {
2681
- return typeOf(object) === REACT_LAZY_TYPE;
2682
- }
2683
- function isMemo(object) {
2684
- return typeOf(object) === REACT_MEMO_TYPE;
2685
- }
2686
- function isPortal(object) {
2687
- return typeOf(object) === REACT_PORTAL_TYPE;
2688
- }
2689
- function isProfiler(object) {
2690
- return typeOf(object) === REACT_PROFILER_TYPE;
2691
- }
2692
- function isStrictMode(object) {
2693
- return typeOf(object) === REACT_STRICT_MODE_TYPE;
2694
- }
2695
- function isSuspense(object) {
2696
- return typeOf(object) === REACT_SUSPENSE_TYPE;
2697
- }
2698
- exports.AsyncMode = AsyncMode;
2699
- exports.ConcurrentMode = ConcurrentMode;
2700
- exports.ContextConsumer = ContextConsumer;
2701
- exports.ContextProvider = ContextProvider;
2702
- exports.Element = Element;
2703
- exports.ForwardRef = ForwardRef;
2704
- exports.Fragment = Fragment17;
2705
- exports.Lazy = Lazy;
2706
- exports.Memo = Memo;
2707
- exports.Portal = Portal;
2708
- exports.Profiler = Profiler;
2709
- exports.StrictMode = StrictMode;
2710
- exports.Suspense = Suspense;
2711
- exports.isAsyncMode = isAsyncMode;
2712
- exports.isConcurrentMode = isConcurrentMode;
2713
- exports.isContextConsumer = isContextConsumer;
2714
- exports.isContextProvider = isContextProvider;
2715
- exports.isElement = isElement;
2716
- exports.isForwardRef = isForwardRef;
2717
- exports.isFragment = isFragment;
2718
- exports.isLazy = isLazy;
2719
- exports.isMemo = isMemo;
2720
- exports.isPortal = isPortal;
2721
- exports.isProfiler = isProfiler;
2722
- exports.isStrictMode = isStrictMode;
2723
- exports.isSuspense = isSuspense;
2724
- exports.isValidElementType = isValidElementType;
2725
- exports.typeOf = typeOf;
2726
- })();
2727
- }
2728
- }
2729
- });
2730
-
2731
- // ../../node_modules/react-is/index.js
2732
- var require_react_is = __commonJS({
2733
- "../../node_modules/react-is/index.js"(exports, module) {
2734
- init_esm_shims();
2735
- if (process.env.NODE_ENV === "production") {
2736
- module.exports = require_react_is_production_min();
2737
- } else {
2738
- module.exports = require_react_is_development();
2739
- }
2740
- }
2741
- });
2742
-
2743
- // ../../node_modules/object-assign/index.js
2744
- var require_object_assign = __commonJS({
2745
- "../../node_modules/object-assign/index.js"(exports, module) {
2746
- init_esm_shims();
2747
- var getOwnPropertySymbols = Object.getOwnPropertySymbols;
2748
- var hasOwnProperty = Object.prototype.hasOwnProperty;
2749
- var propIsEnumerable = Object.prototype.propertyIsEnumerable;
2750
- function toObject(val) {
2751
- if (val === null || val === void 0) {
2752
- throw new TypeError("Object.assign cannot be called with null or undefined");
2753
- }
2754
- return Object(val);
2755
- }
2756
- function shouldUseNative() {
2757
- try {
2758
- if (!Object.assign) {
2759
- return false;
2760
- }
2761
- var test1 = new String("abc");
2762
- test1[5] = "de";
2763
- if (Object.getOwnPropertyNames(test1)[0] === "5") {
2764
- return false;
2765
- }
2766
- var test2 = {};
2767
- for (var i = 0; i < 10; i++) {
2768
- test2["_" + String.fromCharCode(i)] = i;
2769
- }
2770
- var order2 = Object.getOwnPropertyNames(test2).map(function(n) {
2771
- return test2[n];
2772
- });
2773
- if (order2.join("") !== "0123456789") {
2774
- return false;
2775
- }
2776
- var test3 = {};
2777
- "abcdefghijklmnopqrst".split("").forEach(function(letter) {
2778
- test3[letter] = letter;
2779
- });
2780
- if (Object.keys(Object.assign({}, test3)).join("") !== "abcdefghijklmnopqrst") {
2781
- return false;
2782
- }
2783
- return true;
2784
- } catch (err) {
2785
- return false;
2786
- }
2787
- }
2788
- module.exports = shouldUseNative() ? Object.assign : function(target, source) {
2789
- var from;
2790
- var to = toObject(target);
2791
- var symbols;
2792
- for (var s = 1; s < arguments.length; s++) {
2793
- from = Object(arguments[s]);
2794
- for (var key in from) {
2795
- if (hasOwnProperty.call(from, key)) {
2796
- to[key] = from[key];
2797
- }
2798
- }
2799
- if (getOwnPropertySymbols) {
2800
- symbols = getOwnPropertySymbols(from);
2801
- for (var i = 0; i < symbols.length; i++) {
2802
- if (propIsEnumerable.call(from, symbols[i])) {
2803
- to[symbols[i]] = from[symbols[i]];
2804
- }
2805
- }
2806
- }
2807
- }
2808
- return to;
2809
- };
2810
- }
2811
- });
2812
-
2813
- // ../../node_modules/prop-types/lib/ReactPropTypesSecret.js
2814
- var require_ReactPropTypesSecret = __commonJS({
2815
- "../../node_modules/prop-types/lib/ReactPropTypesSecret.js"(exports, module) {
2816
- init_esm_shims();
2817
- var ReactPropTypesSecret = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
2818
- module.exports = ReactPropTypesSecret;
2819
- }
2820
- });
2821
-
2822
- // ../../node_modules/prop-types/lib/has.js
2823
- var require_has = __commonJS({
2824
- "../../node_modules/prop-types/lib/has.js"(exports, module) {
2825
- init_esm_shims();
2826
- module.exports = Function.call.bind(Object.prototype.hasOwnProperty);
2827
- }
2828
- });
2829
-
2830
- // ../../node_modules/prop-types/checkPropTypes.js
2831
- var require_checkPropTypes = __commonJS({
2832
- "../../node_modules/prop-types/checkPropTypes.js"(exports, module) {
2833
- init_esm_shims();
2834
- var printWarning = function() {
2835
- };
2836
- if (process.env.NODE_ENV !== "production") {
2837
- ReactPropTypesSecret = require_ReactPropTypesSecret();
2838
- loggedTypeFailures = {};
2839
- has = require_has();
2840
- printWarning = function(text) {
2841
- var message = "Warning: " + text;
2842
- if (typeof console !== "undefined") {
2843
- console.error(message);
2844
- }
2845
- try {
2846
- throw new Error(message);
2847
- } catch (x) {
2848
- }
2849
- };
2850
- }
2851
- var ReactPropTypesSecret;
2852
- var loggedTypeFailures;
2853
- var has;
2854
- function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
2855
- if (process.env.NODE_ENV !== "production") {
2856
- for (var typeSpecName in typeSpecs) {
2857
- if (has(typeSpecs, typeSpecName)) {
2858
- var error;
2859
- try {
2860
- if (typeof typeSpecs[typeSpecName] !== "function") {
2861
- var err = Error(
2862
- (componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."
2863
- );
2864
- err.name = "Invariant Violation";
2865
- throw err;
2866
- }
2867
- error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
2868
- } catch (ex) {
2869
- error = ex;
2870
- }
2871
- if (error && !(error instanceof Error)) {
2872
- printWarning(
2873
- (componentName || "React class") + ": type specification of " + location + " `" + typeSpecName + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof error + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."
2874
- );
2875
- }
2876
- if (error instanceof Error && !(error.message in loggedTypeFailures)) {
2877
- loggedTypeFailures[error.message] = true;
2878
- var stack = getStack ? getStack() : "";
2879
- printWarning(
2880
- "Failed " + location + " type: " + error.message + (stack != null ? stack : "")
2881
- );
2882
- }
2883
- }
2884
- }
2885
- }
2886
- }
2887
- checkPropTypes.resetWarningCache = function() {
2888
- if (process.env.NODE_ENV !== "production") {
2889
- loggedTypeFailures = {};
2890
- }
2891
- };
2892
- module.exports = checkPropTypes;
2893
- }
2894
- });
2895
-
2896
- // ../../node_modules/prop-types/factoryWithTypeCheckers.js
2897
- var require_factoryWithTypeCheckers = __commonJS({
2898
- "../../node_modules/prop-types/factoryWithTypeCheckers.js"(exports, module) {
2899
- init_esm_shims();
2900
- var ReactIs = require_react_is();
2901
- var assign2 = require_object_assign();
2902
- var ReactPropTypesSecret = require_ReactPropTypesSecret();
2903
- var has = require_has();
2904
- var checkPropTypes = require_checkPropTypes();
2905
- var printWarning = function() {
2906
- };
2907
- if (process.env.NODE_ENV !== "production") {
2908
- printWarning = function(text) {
2909
- var message = "Warning: " + text;
2910
- if (typeof console !== "undefined") {
2911
- console.error(message);
2912
- }
2913
- try {
2914
- throw new Error(message);
2915
- } catch (x) {
2916
- }
2917
- };
2918
- }
2919
- function emptyFunctionThatReturnsNull() {
2920
- return null;
2921
- }
2922
- module.exports = function(isValidElement, throwOnDirectAccess) {
2923
- var ITERATOR_SYMBOL = typeof Symbol === "function" && Symbol.iterator;
2924
- var FAUX_ITERATOR_SYMBOL = "@@iterator";
2925
- function getIteratorFn(maybeIterable) {
2926
- var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
2927
- if (typeof iteratorFn === "function") {
2928
- return iteratorFn;
2929
- }
2930
- }
2931
- var ANONYMOUS = "<<anonymous>>";
2932
- var ReactPropTypes = {
2933
- array: createPrimitiveTypeChecker("array"),
2934
- bigint: createPrimitiveTypeChecker("bigint"),
2935
- bool: createPrimitiveTypeChecker("boolean"),
2936
- func: createPrimitiveTypeChecker("function"),
2937
- number: createPrimitiveTypeChecker("number"),
2938
- object: createPrimitiveTypeChecker("object"),
2939
- string: createPrimitiveTypeChecker("string"),
2940
- symbol: createPrimitiveTypeChecker("symbol"),
2941
- any: createAnyTypeChecker(),
2942
- arrayOf: createArrayOfTypeChecker,
2943
- element: createElementTypeChecker(),
2944
- elementType: createElementTypeTypeChecker(),
2945
- instanceOf: createInstanceTypeChecker,
2946
- node: createNodeChecker(),
2947
- objectOf: createObjectOfTypeChecker,
2948
- oneOf: createEnumTypeChecker,
2949
- oneOfType: createUnionTypeChecker,
2950
- shape: createShapeTypeChecker,
2951
- exact: createStrictShapeTypeChecker
2952
- };
2953
- function is(x, y) {
2954
- if (x === y) {
2955
- return x !== 0 || 1 / x === 1 / y;
2956
- } else {
2957
- return x !== x && y !== y;
2958
- }
2959
- }
2960
- function PropTypeError(message, data) {
2961
- this.message = message;
2962
- this.data = data && typeof data === "object" ? data : {};
2963
- this.stack = "";
2964
- }
2965
- PropTypeError.prototype = Error.prototype;
2966
- function createChainableTypeChecker(validate) {
2967
- if (process.env.NODE_ENV !== "production") {
2968
- var manualPropTypeCallCache = {};
2969
- var manualPropTypeWarningCount = 0;
2970
- }
2971
- function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
2972
- componentName = componentName || ANONYMOUS;
2973
- propFullName = propFullName || propName;
2974
- if (secret !== ReactPropTypesSecret) {
2975
- if (throwOnDirectAccess) {
2976
- var err = new Error(
2977
- "Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types"
2978
- );
2979
- err.name = "Invariant Violation";
2980
- throw err;
2981
- } else if (process.env.NODE_ENV !== "production" && typeof console !== "undefined") {
2982
- var cacheKey = componentName + ":" + propName;
2983
- if (!manualPropTypeCallCache[cacheKey] && manualPropTypeWarningCount < 3) {
2984
- printWarning(
2985
- "You are manually calling a React.PropTypes validation function for the `" + propFullName + "` prop on `" + componentName + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."
2986
- );
2987
- manualPropTypeCallCache[cacheKey] = true;
2988
- manualPropTypeWarningCount++;
2989
- }
2990
- }
2991
- }
2992
- if (props[propName] == null) {
2993
- if (isRequired) {
2994
- if (props[propName] === null) {
2995
- return new PropTypeError("The " + location + " `" + propFullName + "` is marked as required " + ("in `" + componentName + "`, but its value is `null`."));
2996
- }
2997
- return new PropTypeError("The " + location + " `" + propFullName + "` is marked as required in " + ("`" + componentName + "`, but its value is `undefined`."));
2998
- }
2999
- return null;
3000
- } else {
3001
- return validate(props, propName, componentName, location, propFullName);
3002
- }
3003
- }
3004
- var chainedCheckType = checkType.bind(null, false);
3005
- chainedCheckType.isRequired = checkType.bind(null, true);
3006
- return chainedCheckType;
3007
- }
3008
- function createPrimitiveTypeChecker(expectedType) {
3009
- function validate(props, propName, componentName, location, propFullName, secret) {
3010
- var propValue = props[propName];
3011
- var propType = getPropType(propValue);
3012
- if (propType !== expectedType) {
3013
- var preciseType = getPreciseType(propValue);
3014
- return new PropTypeError(
3015
- "Invalid " + location + " `" + propFullName + "` of type " + ("`" + preciseType + "` supplied to `" + componentName + "`, expected ") + ("`" + expectedType + "`."),
3016
- { expectedType }
3017
- );
3018
- }
3019
- return null;
3020
- }
3021
- return createChainableTypeChecker(validate);
3022
- }
3023
- function createAnyTypeChecker() {
3024
- return createChainableTypeChecker(emptyFunctionThatReturnsNull);
3025
- }
3026
- function createArrayOfTypeChecker(typeChecker) {
3027
- function validate(props, propName, componentName, location, propFullName) {
3028
- if (typeof typeChecker !== "function") {
3029
- return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside arrayOf.");
3030
- }
3031
- var propValue = props[propName];
3032
- if (!Array.isArray(propValue)) {
3033
- var propType = getPropType(propValue);
3034
- return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an array."));
3035
- }
3036
- for (var i = 0; i < propValue.length; i++) {
3037
- var error = typeChecker(propValue, i, componentName, location, propFullName + "[" + i + "]", ReactPropTypesSecret);
3038
- if (error instanceof Error) {
3039
- return error;
3040
- }
3041
- }
3042
- return null;
3043
- }
3044
- return createChainableTypeChecker(validate);
3045
- }
3046
- function createElementTypeChecker() {
3047
- function validate(props, propName, componentName, location, propFullName) {
3048
- var propValue = props[propName];
3049
- if (!isValidElement(propValue)) {
3050
- var propType = getPropType(propValue);
3051
- return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement."));
3052
- }
3053
- return null;
3054
- }
3055
- return createChainableTypeChecker(validate);
3056
- }
3057
- function createElementTypeTypeChecker() {
3058
- function validate(props, propName, componentName, location, propFullName) {
3059
- var propValue = props[propName];
3060
- if (!ReactIs.isValidElementType(propValue)) {
3061
- var propType = getPropType(propValue);
3062
- return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement type."));
3063
- }
3064
- return null;
3065
- }
3066
- return createChainableTypeChecker(validate);
3067
- }
3068
- function createInstanceTypeChecker(expectedClass) {
3069
- function validate(props, propName, componentName, location, propFullName) {
3070
- if (!(props[propName] instanceof expectedClass)) {
3071
- var expectedClassName = expectedClass.name || ANONYMOUS;
3072
- var actualClassName = getClassName(props[propName]);
3073
- return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + actualClassName + "` supplied to `" + componentName + "`, expected ") + ("instance of `" + expectedClassName + "`."));
3074
- }
3075
- return null;
3076
- }
3077
- return createChainableTypeChecker(validate);
3078
- }
3079
- function createEnumTypeChecker(expectedValues) {
3080
- if (!Array.isArray(expectedValues)) {
3081
- if (process.env.NODE_ENV !== "production") {
3082
- if (arguments.length > 1) {
3083
- printWarning(
3084
- "Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."
3085
- );
3086
- } else {
3087
- printWarning("Invalid argument supplied to oneOf, expected an array.");
3088
- }
3089
- }
3090
- return emptyFunctionThatReturnsNull;
3091
- }
3092
- function validate(props, propName, componentName, location, propFullName) {
3093
- var propValue = props[propName];
3094
- for (var i = 0; i < expectedValues.length; i++) {
3095
- if (is(propValue, expectedValues[i])) {
3096
- return null;
3097
- }
3098
- }
3099
- var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
3100
- var type = getPreciseType(value);
3101
- if (type === "symbol") {
3102
- return String(value);
3103
- }
3104
- return value;
3105
- });
3106
- return new PropTypeError("Invalid " + location + " `" + propFullName + "` of value `" + String(propValue) + "` " + ("supplied to `" + componentName + "`, expected one of " + valuesString + "."));
3107
- }
3108
- return createChainableTypeChecker(validate);
3109
- }
3110
- function createObjectOfTypeChecker(typeChecker) {
3111
- function validate(props, propName, componentName, location, propFullName) {
3112
- if (typeof typeChecker !== "function") {
3113
- return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside objectOf.");
3114
- }
3115
- var propValue = props[propName];
3116
- var propType = getPropType(propValue);
3117
- if (propType !== "object") {
3118
- return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an object."));
3119
- }
3120
- for (var key in propValue) {
3121
- if (has(propValue, key)) {
3122
- var error = typeChecker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
3123
- if (error instanceof Error) {
3124
- return error;
3125
- }
3126
- }
3127
- }
3128
- return null;
3129
- }
3130
- return createChainableTypeChecker(validate);
3131
- }
3132
- function createUnionTypeChecker(arrayOfTypeCheckers) {
3133
- if (!Array.isArray(arrayOfTypeCheckers)) {
3134
- process.env.NODE_ENV !== "production" ? printWarning("Invalid argument supplied to oneOfType, expected an instance of array.") : void 0;
3135
- return emptyFunctionThatReturnsNull;
3136
- }
3137
- for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
3138
- var checker = arrayOfTypeCheckers[i];
3139
- if (typeof checker !== "function") {
3140
- printWarning(
3141
- "Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + getPostfixForTypeWarning(checker) + " at index " + i + "."
3142
- );
3143
- return emptyFunctionThatReturnsNull;
3144
- }
3145
- }
3146
- function validate(props, propName, componentName, location, propFullName) {
3147
- var expectedTypes = [];
3148
- for (var i2 = 0; i2 < arrayOfTypeCheckers.length; i2++) {
3149
- var checker2 = arrayOfTypeCheckers[i2];
3150
- var checkerResult = checker2(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
3151
- if (checkerResult == null) {
3152
- return null;
3153
- }
3154
- if (checkerResult.data && has(checkerResult.data, "expectedType")) {
3155
- expectedTypes.push(checkerResult.data.expectedType);
3156
- }
3157
- }
3158
- var expectedTypesMessage = expectedTypes.length > 0 ? ", expected one of type [" + expectedTypes.join(", ") + "]" : "";
3159
- return new PropTypeError("Invalid " + location + " `" + propFullName + "` supplied to " + ("`" + componentName + "`" + expectedTypesMessage + "."));
3160
- }
3161
- return createChainableTypeChecker(validate);
3162
- }
3163
- function createNodeChecker() {
3164
- function validate(props, propName, componentName, location, propFullName) {
3165
- if (!isNode(props[propName])) {
3166
- return new PropTypeError("Invalid " + location + " `" + propFullName + "` supplied to " + ("`" + componentName + "`, expected a ReactNode."));
3167
- }
3168
- return null;
3169
- }
3170
- return createChainableTypeChecker(validate);
3171
- }
3172
- function invalidValidatorError(componentName, location, propFullName, key, type) {
3173
- return new PropTypeError(
3174
- (componentName || "React class") + ": " + location + " type `" + propFullName + "." + key + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + type + "`."
3175
- );
3176
- }
3177
- function createShapeTypeChecker(shapeTypes) {
3178
- function validate(props, propName, componentName, location, propFullName) {
3179
- var propValue = props[propName];
3180
- var propType = getPropType(propValue);
3181
- if (propType !== "object") {
3182
- return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected `object`."));
3183
- }
3184
- for (var key in shapeTypes) {
3185
- var checker = shapeTypes[key];
3186
- if (typeof checker !== "function") {
3187
- return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
3188
- }
3189
- var error = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
3190
- if (error) {
3191
- return error;
3192
- }
3193
- }
3194
- return null;
3195
- }
3196
- return createChainableTypeChecker(validate);
3197
- }
3198
- function createStrictShapeTypeChecker(shapeTypes) {
3199
- function validate(props, propName, componentName, location, propFullName) {
3200
- var propValue = props[propName];
3201
- var propType = getPropType(propValue);
3202
- if (propType !== "object") {
3203
- return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected `object`."));
3204
- }
3205
- var allKeys = assign2({}, props[propName], shapeTypes);
3206
- for (var key in allKeys) {
3207
- var checker = shapeTypes[key];
3208
- if (has(shapeTypes, key) && typeof checker !== "function") {
3209
- return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
3210
- }
3211
- if (!checker) {
3212
- return new PropTypeError(
3213
- "Invalid " + location + " `" + propFullName + "` key `" + key + "` supplied to `" + componentName + "`.\nBad object: " + JSON.stringify(props[propName], null, " ") + "\nValid keys: " + JSON.stringify(Object.keys(shapeTypes), null, " ")
3214
- );
3215
- }
3216
- var error = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
3217
- if (error) {
3218
- return error;
3219
- }
3220
- }
3221
- return null;
3222
- }
3223
- return createChainableTypeChecker(validate);
3224
- }
3225
- function isNode(propValue) {
3226
- switch (typeof propValue) {
3227
- case "number":
3228
- case "string":
3229
- case "undefined":
3230
- return true;
3231
- case "boolean":
3232
- return !propValue;
3233
- case "object":
3234
- if (Array.isArray(propValue)) {
3235
- return propValue.every(isNode);
3236
- }
3237
- if (propValue === null || isValidElement(propValue)) {
3238
- return true;
3239
- }
3240
- var iteratorFn = getIteratorFn(propValue);
3241
- if (iteratorFn) {
3242
- var iterator = iteratorFn.call(propValue);
3243
- var step;
3244
- if (iteratorFn !== propValue.entries) {
3245
- while (!(step = iterator.next()).done) {
3246
- if (!isNode(step.value)) {
3247
- return false;
3248
- }
3249
- }
3250
- } else {
3251
- while (!(step = iterator.next()).done) {
3252
- var entry = step.value;
3253
- if (entry) {
3254
- if (!isNode(entry[1])) {
3255
- return false;
3256
- }
3257
- }
3258
- }
3259
- }
3260
- } else {
3261
- return false;
3262
- }
3263
- return true;
3264
- default:
3265
- return false;
3266
- }
3267
- }
3268
- function isSymbol(propType, propValue) {
3269
- if (propType === "symbol") {
3270
- return true;
3271
- }
3272
- if (!propValue) {
3273
- return false;
3274
- }
3275
- if (propValue["@@toStringTag"] === "Symbol") {
3276
- return true;
3277
- }
3278
- if (typeof Symbol === "function" && propValue instanceof Symbol) {
3279
- return true;
3280
- }
3281
- return false;
3282
- }
3283
- function getPropType(propValue) {
3284
- var propType = typeof propValue;
3285
- if (Array.isArray(propValue)) {
3286
- return "array";
3287
- }
3288
- if (propValue instanceof RegExp) {
3289
- return "object";
3290
- }
3291
- if (isSymbol(propType, propValue)) {
3292
- return "symbol";
3293
- }
3294
- return propType;
3295
- }
3296
- function getPreciseType(propValue) {
3297
- if (typeof propValue === "undefined" || propValue === null) {
3298
- return "" + propValue;
3299
- }
3300
- var propType = getPropType(propValue);
3301
- if (propType === "object") {
3302
- if (propValue instanceof Date) {
3303
- return "date";
3304
- } else if (propValue instanceof RegExp) {
3305
- return "regexp";
3306
- }
3307
- }
3308
- return propType;
3309
- }
3310
- function getPostfixForTypeWarning(value) {
3311
- var type = getPreciseType(value);
3312
- switch (type) {
3313
- case "array":
3314
- case "object":
3315
- return "an " + type;
3316
- case "boolean":
3317
- case "date":
3318
- case "regexp":
3319
- return "a " + type;
3320
- default:
3321
- return type;
3322
- }
3323
- }
3324
- function getClassName(propValue) {
3325
- if (!propValue.constructor || !propValue.constructor.name) {
3326
- return ANONYMOUS;
3327
- }
3328
- return propValue.constructor.name;
3329
- }
3330
- ReactPropTypes.checkPropTypes = checkPropTypes;
3331
- ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
3332
- ReactPropTypes.PropTypes = ReactPropTypes;
3333
- return ReactPropTypes;
3334
- };
3335
- }
3336
- });
3337
-
3338
- // ../../node_modules/prop-types/factoryWithThrowingShims.js
3339
- var require_factoryWithThrowingShims = __commonJS({
3340
- "../../node_modules/prop-types/factoryWithThrowingShims.js"(exports, module) {
3341
- init_esm_shims();
3342
- var ReactPropTypesSecret = require_ReactPropTypesSecret();
3343
- function emptyFunction() {
3344
- }
3345
- function emptyFunctionWithReset() {
3346
- }
3347
- emptyFunctionWithReset.resetWarningCache = emptyFunction;
3348
- module.exports = function() {
3349
- function shim(props, propName, componentName, location, propFullName, secret) {
3350
- if (secret === ReactPropTypesSecret) {
3351
- return;
3352
- }
3353
- var err = new Error(
3354
- "Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
3355
- );
3356
- err.name = "Invariant Violation";
3357
- throw err;
3358
- }
3359
- shim.isRequired = shim;
3360
- function getShim() {
3361
- return shim;
3362
- }
3363
- var ReactPropTypes = {
3364
- array: shim,
3365
- bigint: shim,
3366
- bool: shim,
3367
- func: shim,
3368
- number: shim,
3369
- object: shim,
3370
- string: shim,
3371
- symbol: shim,
3372
- any: shim,
3373
- arrayOf: getShim,
3374
- element: shim,
3375
- elementType: shim,
3376
- instanceOf: getShim,
3377
- node: shim,
3378
- objectOf: getShim,
3379
- oneOf: getShim,
3380
- oneOfType: getShim,
3381
- shape: getShim,
3382
- exact: getShim,
3383
- checkPropTypes: emptyFunctionWithReset,
3384
- resetWarningCache: emptyFunction
3385
- };
3386
- ReactPropTypes.PropTypes = ReactPropTypes;
3387
- return ReactPropTypes;
3388
- };
3389
- }
3390
- });
3391
-
3392
- // ../../node_modules/prop-types/index.js
3393
- var require_prop_types = __commonJS({
3394
- "../../node_modules/prop-types/index.js"(exports, module) {
3395
- init_esm_shims();
3396
- if (process.env.NODE_ENV !== "production") {
3397
- ReactIs = require_react_is();
3398
- throwOnDirectAccess = true;
3399
- module.exports = require_factoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
3400
- } else {
3401
- module.exports = require_factoryWithThrowingShims()();
3402
- }
3403
- var ReactIs;
3404
- var throwOnDirectAccess;
3405
- }
3406
- });
3407
-
3408
- // ../../node_modules/d3-scale/src/init.js
3409
- function initRange(domain, range) {
3410
- switch (arguments.length) {
3411
- case 0:
3412
- break;
3413
- case 1:
3414
- this.range(domain);
3415
- break;
3416
- default:
3417
- this.range(range).domain(domain);
3418
- break;
3419
- }
3420
- return this;
3421
- }
3422
- var init_init = __esm({
3423
- "../../node_modules/d3-scale/src/init.js"() {
3424
- init_esm_shims();
3425
- }
3426
- });
3427
-
3428
- // ../../node_modules/d3-color/src/define.js
3429
- function define_default(constructor, factory, prototype) {
3430
- constructor.prototype = factory.prototype = prototype;
3431
- prototype.constructor = constructor;
3432
- }
3433
- function extend(parent, definition) {
3434
- var prototype = Object.create(parent.prototype);
3435
- for (var key in definition)
3436
- prototype[key] = definition[key];
3437
- return prototype;
3438
- }
3439
- var init_define = __esm({
3440
- "../../node_modules/d3-color/src/define.js"() {
3441
- init_esm_shims();
3442
- }
3443
- });
3444
-
3445
- // ../../node_modules/d3-color/src/color.js
3446
- function Color() {
3447
- }
3448
- function color_formatHex() {
3449
- return this.rgb().formatHex();
3450
- }
3451
- function color_formatHsl() {
3452
- return hslConvert(this).formatHsl();
3453
- }
3454
- function color_formatRgb() {
3455
- return this.rgb().formatRgb();
3456
- }
3457
- function color(format3) {
3458
- var m, l;
3459
- format3 = (format3 + "").trim().toLowerCase();
3460
- return (m = reHex.exec(format3)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) : l === 3 ? new Rgb(m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, (m & 15) << 4 | m & 15, 1) : l === 8 ? rgba(m >> 24 & 255, m >> 16 & 255, m >> 8 & 255, (m & 255) / 255) : l === 4 ? rgba(m >> 12 & 15 | m >> 8 & 240, m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, ((m & 15) << 4 | m & 15) / 255) : null) : (m = reRgbInteger.exec(format3)) ? new Rgb(m[1], m[2], m[3], 1) : (m = reRgbPercent.exec(format3)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) : (m = reRgbaInteger.exec(format3)) ? rgba(m[1], m[2], m[3], m[4]) : (m = reRgbaPercent.exec(format3)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) : (m = reHslPercent.exec(format3)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) : (m = reHslaPercent.exec(format3)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) : named.hasOwnProperty(format3) ? rgbn(named[format3]) : format3 === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null;
3461
- }
3462
- function rgbn(n) {
3463
- return new Rgb(n >> 16 & 255, n >> 8 & 255, n & 255, 1);
3464
- }
3465
- function rgba(r, g, b, a) {
3466
- if (a <= 0)
3467
- r = g = b = NaN;
3468
- return new Rgb(r, g, b, a);
3469
- }
3470
- function rgbConvert(o) {
3471
- if (!(o instanceof Color))
3472
- o = color(o);
3473
- if (!o)
3474
- return new Rgb();
3475
- o = o.rgb();
3476
- return new Rgb(o.r, o.g, o.b, o.opacity);
3477
- }
3478
- function rgb(r, g, b, opacity) {
3479
- return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
3480
- }
3481
- function Rgb(r, g, b, opacity) {
3482
- this.r = +r;
3483
- this.g = +g;
3484
- this.b = +b;
3485
- this.opacity = +opacity;
3486
- }
3487
- function rgb_formatHex() {
3488
- return "#" + hex(this.r) + hex(this.g) + hex(this.b);
3489
- }
3490
- function rgb_formatRgb() {
3491
- var a = this.opacity;
3492
- a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
3493
- return (a === 1 ? "rgb(" : "rgba(") + Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", " + Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", " + Math.max(0, Math.min(255, Math.round(this.b) || 0)) + (a === 1 ? ")" : ", " + a + ")");
3494
- }
3495
- function hex(value) {
3496
- value = Math.max(0, Math.min(255, Math.round(value) || 0));
3497
- return (value < 16 ? "0" : "") + value.toString(16);
3498
- }
3499
- function hsla(h, s, l, a) {
3500
- if (a <= 0)
3501
- h = s = l = NaN;
3502
- else if (l <= 0 || l >= 1)
3503
- h = s = NaN;
3504
- else if (s <= 0)
3505
- h = NaN;
3506
- return new Hsl(h, s, l, a);
3507
- }
3508
- function hslConvert(o) {
3509
- if (o instanceof Hsl)
3510
- return new Hsl(o.h, o.s, o.l, o.opacity);
3511
- if (!(o instanceof Color))
3512
- o = color(o);
3513
- if (!o)
3514
- return new Hsl();
3515
- if (o instanceof Hsl)
3516
- return o;
3517
- o = o.rgb();
3518
- var r = o.r / 255, g = o.g / 255, b = o.b / 255, min2 = Math.min(r, g, b), max2 = Math.max(r, g, b), h = NaN, s = max2 - min2, l = (max2 + min2) / 2;
3519
- if (s) {
3520
- if (r === max2)
3521
- h = (g - b) / s + (g < b) * 6;
3522
- else if (g === max2)
3523
- h = (b - r) / s + 2;
3524
- else
3525
- h = (r - g) / s + 4;
3526
- s /= l < 0.5 ? max2 + min2 : 2 - max2 - min2;
3527
- h *= 60;
3528
- } else {
3529
- s = l > 0 && l < 1 ? 0 : h;
3530
- }
3531
- return new Hsl(h, s, l, o.opacity);
3532
- }
3533
- function hsl(h, s, l, opacity) {
3534
- return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
3535
- }
3536
- function Hsl(h, s, l, opacity) {
3537
- this.h = +h;
3538
- this.s = +s;
3539
- this.l = +l;
3540
- this.opacity = +opacity;
3541
- }
3542
- function hsl2rgb(h, m1, m2) {
3543
- return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255;
3544
- }
3545
- var darker, brighter, reI, reN, reP, reHex, reRgbInteger, reRgbPercent, reRgbaInteger, reRgbaPercent, reHslPercent, reHslaPercent, named;
3546
- var init_color = __esm({
3547
- "../../node_modules/d3-color/src/color.js"() {
3548
- init_esm_shims();
3549
- init_define();
3550
- darker = 0.7;
3551
- brighter = 1 / darker;
3552
- reI = "\\s*([+-]?\\d+)\\s*";
3553
- reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*";
3554
- reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*";
3555
- reHex = /^#([0-9a-f]{3,8})$/;
3556
- reRgbInteger = new RegExp("^rgb\\(" + [reI, reI, reI] + "\\)$");
3557
- reRgbPercent = new RegExp("^rgb\\(" + [reP, reP, reP] + "\\)$");
3558
- reRgbaInteger = new RegExp("^rgba\\(" + [reI, reI, reI, reN] + "\\)$");
3559
- reRgbaPercent = new RegExp("^rgba\\(" + [reP, reP, reP, reN] + "\\)$");
3560
- reHslPercent = new RegExp("^hsl\\(" + [reN, reP, reP] + "\\)$");
3561
- reHslaPercent = new RegExp("^hsla\\(" + [reN, reP, reP, reN] + "\\)$");
3562
- named = {
3563
- aliceblue: 15792383,
3564
- antiquewhite: 16444375,
3565
- aqua: 65535,
3566
- aquamarine: 8388564,
3567
- azure: 15794175,
3568
- beige: 16119260,
3569
- bisque: 16770244,
3570
- black: 0,
3571
- blanchedalmond: 16772045,
3572
- blue: 255,
3573
- blueviolet: 9055202,
3574
- brown: 10824234,
3575
- burlywood: 14596231,
3576
- cadetblue: 6266528,
3577
- chartreuse: 8388352,
3578
- chocolate: 13789470,
3579
- coral: 16744272,
3580
- cornflowerblue: 6591981,
3581
- cornsilk: 16775388,
3582
- crimson: 14423100,
3583
- cyan: 65535,
3584
- darkblue: 139,
3585
- darkcyan: 35723,
3586
- darkgoldenrod: 12092939,
3587
- darkgray: 11119017,
3588
- darkgreen: 25600,
3589
- darkgrey: 11119017,
3590
- darkkhaki: 12433259,
3591
- darkmagenta: 9109643,
3592
- darkolivegreen: 5597999,
3593
- darkorange: 16747520,
3594
- darkorchid: 10040012,
3595
- darkred: 9109504,
3596
- darksalmon: 15308410,
3597
- darkseagreen: 9419919,
3598
- darkslateblue: 4734347,
3599
- darkslategray: 3100495,
3600
- darkslategrey: 3100495,
3601
- darkturquoise: 52945,
3602
- darkviolet: 9699539,
3603
- deeppink: 16716947,
3604
- deepskyblue: 49151,
3605
- dimgray: 6908265,
3606
- dimgrey: 6908265,
3607
- dodgerblue: 2003199,
3608
- firebrick: 11674146,
3609
- floralwhite: 16775920,
3610
- forestgreen: 2263842,
3611
- fuchsia: 16711935,
3612
- gainsboro: 14474460,
3613
- ghostwhite: 16316671,
3614
- gold: 16766720,
3615
- goldenrod: 14329120,
3616
- gray: 8421504,
3617
- green: 32768,
3618
- greenyellow: 11403055,
3619
- grey: 8421504,
3620
- honeydew: 15794160,
3621
- hotpink: 16738740,
3622
- indianred: 13458524,
3623
- indigo: 4915330,
3624
- ivory: 16777200,
3625
- khaki: 15787660,
3626
- lavender: 15132410,
3627
- lavenderblush: 16773365,
3628
- lawngreen: 8190976,
3629
- lemonchiffon: 16775885,
3630
- lightblue: 11393254,
3631
- lightcoral: 15761536,
3632
- lightcyan: 14745599,
3633
- lightgoldenrodyellow: 16448210,
3634
- lightgray: 13882323,
3635
- lightgreen: 9498256,
3636
- lightgrey: 13882323,
3637
- lightpink: 16758465,
3638
- lightsalmon: 16752762,
3639
- lightseagreen: 2142890,
3640
- lightskyblue: 8900346,
3641
- lightslategray: 7833753,
3642
- lightslategrey: 7833753,
3643
- lightsteelblue: 11584734,
3644
- lightyellow: 16777184,
3645
- lime: 65280,
3646
- limegreen: 3329330,
3647
- linen: 16445670,
3648
- magenta: 16711935,
3649
- maroon: 8388608,
3650
- mediumaquamarine: 6737322,
3651
- mediumblue: 205,
3652
- mediumorchid: 12211667,
3653
- mediumpurple: 9662683,
3654
- mediumseagreen: 3978097,
3655
- mediumslateblue: 8087790,
3656
- mediumspringgreen: 64154,
3657
- mediumturquoise: 4772300,
3658
- mediumvioletred: 13047173,
3659
- midnightblue: 1644912,
3660
- mintcream: 16121850,
3661
- mistyrose: 16770273,
3662
- moccasin: 16770229,
3663
- navajowhite: 16768685,
3664
- navy: 128,
3665
- oldlace: 16643558,
3666
- olive: 8421376,
3667
- olivedrab: 7048739,
3668
- orange: 16753920,
3669
- orangered: 16729344,
3670
- orchid: 14315734,
3671
- palegoldenrod: 15657130,
3672
- palegreen: 10025880,
3673
- paleturquoise: 11529966,
3674
- palevioletred: 14381203,
3675
- papayawhip: 16773077,
3676
- peachpuff: 16767673,
3677
- peru: 13468991,
3678
- pink: 16761035,
3679
- plum: 14524637,
3680
- powderblue: 11591910,
3681
- purple: 8388736,
3682
- rebeccapurple: 6697881,
3683
- red: 16711680,
3684
- rosybrown: 12357519,
3685
- royalblue: 4286945,
3686
- saddlebrown: 9127187,
3687
- salmon: 16416882,
3688
- sandybrown: 16032864,
3689
- seagreen: 3050327,
3690
- seashell: 16774638,
3691
- sienna: 10506797,
3692
- silver: 12632256,
3693
- skyblue: 8900331,
3694
- slateblue: 6970061,
3695
- slategray: 7372944,
3696
- slategrey: 7372944,
3697
- snow: 16775930,
3698
- springgreen: 65407,
3699
- steelblue: 4620980,
3700
- tan: 13808780,
3701
- teal: 32896,
3702
- thistle: 14204888,
3703
- tomato: 16737095,
3704
- turquoise: 4251856,
3705
- violet: 15631086,
3706
- wheat: 16113331,
3707
- white: 16777215,
3708
- whitesmoke: 16119285,
3709
- yellow: 16776960,
3710
- yellowgreen: 10145074
3711
- };
3712
- define_default(Color, color, {
3713
- copy: function(channels) {
3714
- return Object.assign(new this.constructor(), this, channels);
3715
- },
3716
- displayable: function() {
3717
- return this.rgb().displayable();
3718
- },
3719
- hex: color_formatHex,
3720
- formatHex: color_formatHex,
3721
- formatHsl: color_formatHsl,
3722
- formatRgb: color_formatRgb,
3723
- toString: color_formatRgb
3724
- });
3725
- define_default(Rgb, rgb, extend(Color, {
3726
- brighter: function(k) {
3727
- k = k == null ? brighter : Math.pow(brighter, k);
3728
- return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
3729
- },
3730
- darker: function(k) {
3731
- k = k == null ? darker : Math.pow(darker, k);
3732
- return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
3733
- },
3734
- rgb: function() {
3735
- return this;
3736
- },
3737
- displayable: function() {
3738
- return -0.5 <= this.r && this.r < 255.5 && (-0.5 <= this.g && this.g < 255.5) && (-0.5 <= this.b && this.b < 255.5) && (0 <= this.opacity && this.opacity <= 1);
3739
- },
3740
- hex: rgb_formatHex,
3741
- formatHex: rgb_formatHex,
3742
- formatRgb: rgb_formatRgb,
3743
- toString: rgb_formatRgb
3744
- }));
3745
- define_default(Hsl, hsl, extend(Color, {
3746
- brighter: function(k) {
3747
- k = k == null ? brighter : Math.pow(brighter, k);
3748
- return new Hsl(this.h, this.s, this.l * k, this.opacity);
3749
- },
3750
- darker: function(k) {
3751
- k = k == null ? darker : Math.pow(darker, k);
3752
- return new Hsl(this.h, this.s, this.l * k, this.opacity);
3753
- },
3754
- rgb: function() {
3755
- var h = this.h % 360 + (this.h < 0) * 360, s = isNaN(h) || isNaN(this.s) ? 0 : this.s, l = this.l, m2 = l + (l < 0.5 ? l : 1 - l) * s, m1 = 2 * l - m2;
3756
- return new Rgb(
3757
- hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
3758
- hsl2rgb(h, m1, m2),
3759
- hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
3760
- this.opacity
3761
- );
3762
- },
3763
- displayable: function() {
3764
- return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && (0 <= this.l && this.l <= 1) && (0 <= this.opacity && this.opacity <= 1);
3765
- },
3766
- formatHsl: function() {
3767
- var a = this.opacity;
3768
- a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
3769
- return (a === 1 ? "hsl(" : "hsla(") + (this.h || 0) + ", " + (this.s || 0) * 100 + "%, " + (this.l || 0) * 100 + "%" + (a === 1 ? ")" : ", " + a + ")");
3770
- }
3771
- }));
3772
- }
3773
- });
3774
-
3775
- // ../../node_modules/d3-color/src/index.js
3776
- var init_src = __esm({
3777
- "../../node_modules/d3-color/src/index.js"() {
3778
- init_esm_shims();
3779
- init_color();
3780
- }
3781
- });
3782
- var init_basis = __esm({
3783
- "../../node_modules/d3-interpolate/src/basis.js"() {
3784
- init_esm_shims();
3785
- }
3786
- });
3787
- var init_basisClosed = __esm({
3788
- "../../node_modules/d3-interpolate/src/basisClosed.js"() {
3789
- init_esm_shims();
3790
- init_basis();
3791
- }
3792
- });
3793
-
3794
- // ../../node_modules/d3-interpolate/src/constant.js
3795
- var constant_default;
3796
- var init_constant = __esm({
3797
- "../../node_modules/d3-interpolate/src/constant.js"() {
3798
- init_esm_shims();
3799
- constant_default = (x) => () => x;
3800
- }
3801
- });
3802
-
3803
- // ../../node_modules/d3-interpolate/src/color.js
3804
- function linear(a, d) {
3805
- return function(t) {
3806
- return a + t * d;
3807
- };
3808
- }
3809
- function exponential(a, b, y) {
3810
- return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {
3811
- return Math.pow(a + t * b, y);
3812
- };
3813
- }
3814
- function gamma(y) {
3815
- return (y = +y) === 1 ? nogamma : function(a, b) {
3816
- return b - a ? exponential(a, b, y) : constant_default(isNaN(a) ? b : a);
3817
- };
3818
- }
3819
- function nogamma(a, b) {
3820
- var d = b - a;
3821
- return d ? linear(a, d) : constant_default(isNaN(a) ? b : a);
3822
- }
3823
- var init_color2 = __esm({
3824
- "../../node_modules/d3-interpolate/src/color.js"() {
3825
- init_esm_shims();
3826
- init_constant();
3827
- }
3828
- });
3829
- var rgb_default;
3830
- var init_rgb = __esm({
3831
- "../../node_modules/d3-interpolate/src/rgb.js"() {
3832
- init_esm_shims();
3833
- init_src();
3834
- init_basis();
3835
- init_basisClosed();
3836
- init_color2();
3837
- rgb_default = function rgbGamma(y) {
3838
- var color2 = gamma(y);
3839
- function rgb2(start, end) {
3840
- var r = color2((start = rgb(start)).r, (end = rgb(end)).r), g = color2(start.g, end.g), b = color2(start.b, end.b), opacity = nogamma(start.opacity, end.opacity);
3841
- return function(t) {
3842
- start.r = r(t);
3843
- start.g = g(t);
3844
- start.b = b(t);
3845
- start.opacity = opacity(t);
3846
- return start + "";
3847
- };
3848
- }
3849
- rgb2.gamma = rgbGamma;
3850
- return rgb2;
3851
- }(1);
3852
- }
3853
- });
3854
-
3855
- // ../../node_modules/d3-interpolate/src/numberArray.js
3856
- function numberArray_default(a, b) {
3857
- if (!b)
3858
- b = [];
3859
- var n = a ? Math.min(b.length, a.length) : 0, c = b.slice(), i;
3860
- return function(t) {
3861
- for (i = 0; i < n; ++i)
3862
- c[i] = a[i] * (1 - t) + b[i] * t;
3863
- return c;
3864
- };
3865
- }
3866
- function isNumberArray(x) {
3867
- return ArrayBuffer.isView(x) && !(x instanceof DataView);
3868
- }
3869
- var init_numberArray = __esm({
3870
- "../../node_modules/d3-interpolate/src/numberArray.js"() {
3871
- init_esm_shims();
3872
- }
3873
- });
3874
-
3875
- // ../../node_modules/d3-interpolate/src/array.js
3876
- function genericArray(a, b) {
3877
- var nb = b ? b.length : 0, na = a ? Math.min(nb, a.length) : 0, x = new Array(na), c = new Array(nb), i;
3878
- for (i = 0; i < na; ++i)
3879
- x[i] = value_default(a[i], b[i]);
3880
- for (; i < nb; ++i)
3881
- c[i] = b[i];
3882
- return function(t) {
3883
- for (i = 0; i < na; ++i)
3884
- c[i] = x[i](t);
3885
- return c;
3886
- };
3887
- }
3888
- var init_array = __esm({
3889
- "../../node_modules/d3-interpolate/src/array.js"() {
3890
- init_esm_shims();
3891
- init_value();
3892
- }
3893
- });
3894
-
3895
- // ../../node_modules/d3-interpolate/src/date.js
3896
- function date_default(a, b) {
3897
- var d = new Date();
3898
- return a = +a, b = +b, function(t) {
3899
- return d.setTime(a * (1 - t) + b * t), d;
3900
- };
3901
- }
3902
- var init_date = __esm({
3903
- "../../node_modules/d3-interpolate/src/date.js"() {
3904
- init_esm_shims();
3905
- }
3906
- });
3907
-
3908
- // ../../node_modules/d3-interpolate/src/number.js
3909
- function number_default(a, b) {
3910
- return a = +a, b = +b, function(t) {
3911
- return a * (1 - t) + b * t;
3912
- };
3913
- }
3914
- var init_number = __esm({
3915
- "../../node_modules/d3-interpolate/src/number.js"() {
3916
- init_esm_shims();
3917
- }
3918
- });
3919
-
3920
- // ../../node_modules/d3-interpolate/src/object.js
3921
- function object_default(a, b) {
3922
- var i = {}, c = {}, k;
3923
- if (a === null || typeof a !== "object")
3924
- a = {};
3925
- if (b === null || typeof b !== "object")
3926
- b = {};
3927
- for (k in b) {
3928
- if (k in a) {
3929
- i[k] = value_default(a[k], b[k]);
3930
- } else {
3931
- c[k] = b[k];
3932
- }
3933
- }
3934
- return function(t) {
3935
- for (k in i)
3936
- c[k] = i[k](t);
3937
- return c;
3938
- };
3939
- }
3940
- var init_object = __esm({
3941
- "../../node_modules/d3-interpolate/src/object.js"() {
3942
- init_esm_shims();
3943
- init_value();
3944
- }
3945
- });
3946
-
3947
- // ../../node_modules/d3-interpolate/src/string.js
3948
- function zero(b) {
3949
- return function() {
3950
- return b;
3951
- };
3952
- }
3953
- function one(b) {
3954
- return function(t) {
3955
- return b(t) + "";
3956
- };
3957
- }
3958
- function string_default(a, b) {
3959
- var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i = -1, s = [], q = [];
3960
- a = a + "", b = b + "";
3961
- while ((am = reA.exec(a)) && (bm = reB.exec(b))) {
3962
- if ((bs = bm.index) > bi) {
3963
- bs = b.slice(bi, bs);
3964
- if (s[i])
3965
- s[i] += bs;
3966
- else
3967
- s[++i] = bs;
3968
- }
3969
- if ((am = am[0]) === (bm = bm[0])) {
3970
- if (s[i])
3971
- s[i] += bm;
3972
- else
3973
- s[++i] = bm;
3974
- } else {
3975
- s[++i] = null;
3976
- q.push({ i, x: number_default(am, bm) });
3977
- }
3978
- bi = reB.lastIndex;
3979
- }
3980
- if (bi < b.length) {
3981
- bs = b.slice(bi);
3982
- if (s[i])
3983
- s[i] += bs;
3984
- else
3985
- s[++i] = bs;
3986
- }
3987
- return s.length < 2 ? q[0] ? one(q[0].x) : zero(b) : (b = q.length, function(t) {
3988
- for (var i2 = 0, o; i2 < b; ++i2)
3989
- s[(o = q[i2]).i] = o.x(t);
3990
- return s.join("");
3991
- });
3992
- }
3993
- var reA, reB;
3994
- var init_string = __esm({
3995
- "../../node_modules/d3-interpolate/src/string.js"() {
3996
- init_esm_shims();
3997
- init_number();
3998
- reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
3999
- reB = new RegExp(reA.source, "g");
4000
- }
4001
- });
4002
-
4003
- // ../../node_modules/d3-interpolate/src/value.js
4004
- function value_default(a, b) {
4005
- var t = typeof b, c;
4006
- return b == null || t === "boolean" ? constant_default(b) : (t === "number" ? number_default : t === "string" ? (c = color(b)) ? (b = c, rgb_default) : string_default : b instanceof color ? rgb_default : b instanceof Date ? date_default : isNumberArray(b) ? numberArray_default : Array.isArray(b) ? genericArray : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? object_default : number_default)(a, b);
4007
- }
4008
- var init_value = __esm({
4009
- "../../node_modules/d3-interpolate/src/value.js"() {
4010
- init_esm_shims();
4011
- init_src();
4012
- init_rgb();
4013
- init_array();
4014
- init_date();
4015
- init_number();
4016
- init_object();
4017
- init_string();
4018
- init_constant();
4019
- init_numberArray();
4020
- }
4021
- });
4022
-
4023
- // ../../node_modules/d3-interpolate/src/round.js
4024
- function round_default(a, b) {
4025
- return a = +a, b = +b, function(t) {
4026
- return Math.round(a * (1 - t) + b * t);
2231
+ function withFetcher(Component, useRef7) {
2232
+ const ComponentWithFetcher = (props) => {
2233
+ const {
2234
+ id,
2235
+ skelHeight,
2236
+ skelWidth,
2237
+ ...otherProps
2238
+ } = props;
2239
+ const ref = useRef7(id);
2240
+ if (ref.isUninitialized || ref.isFetching) {
2241
+ return /* @__PURE__ */ jsx(Skeleton, { width: skelWidth, height: skelHeight });
2242
+ }
2243
+ if (ref.isError) {
2244
+ return null;
2245
+ }
2246
+ return /* @__PURE__ */ jsx(Component, { ...otherProps, for: ref.data });
4027
2247
  };
2248
+ ComponentWithFetcher.displayName = `withFetcher(${Component.displayName || Component.name || "Component"})`;
2249
+ return ComponentWithFetcher;
4028
2250
  }
4029
- var init_round = __esm({
4030
- "../../node_modules/d3-interpolate/src/round.js"() {
2251
+ var init_withFetcher = __esm({
2252
+ "store/withFetcher.tsx"() {
4031
2253
  init_esm_shims();
4032
2254
  }
4033
2255
  });
4034
2256
 
4035
- // ../../node_modules/d3-interpolate/src/index.js
4036
- var init_src2 = __esm({
4037
- "../../node_modules/d3-interpolate/src/index.js"() {
2257
+ // store/index.ts
2258
+ var init_store2 = __esm({
2259
+ "store/index.ts"() {
4038
2260
  init_esm_shims();
4039
- init_value();
4040
- init_number();
4041
- init_round();
2261
+ init_actions();
2262
+ init_hooks();
2263
+ init_store();
2264
+ init_withFetcher();
4042
2265
  }
4043
2266
  });
4044
2267
 
4045
- // ../../node_modules/d3-scale/src/constant.js
4046
- function constants(x) {
4047
- return function() {
4048
- return x;
4049
- };
4050
- }
4051
- var init_constant2 = __esm({
4052
- "../../node_modules/d3-scale/src/constant.js"() {
2268
+ // libs/blocks/sanitizeBlockContent.ts
2269
+ var stripTrail, clearBlank, stripOuterTags, sanitizeBlockContent, sanitizeBlockContent_default;
2270
+ var init_sanitizeBlockContent = __esm({
2271
+ "libs/blocks/sanitizeBlockContent.ts"() {
4053
2272
  init_esm_shims();
2273
+ stripTrail = (d) => typeof d === "string" ? d.replace(/\&nbsp;<\/p>/g, "</p>") : d;
2274
+ clearBlank = (d) => typeof d === "string" && d === "<p><br></p>" ? "" : d;
2275
+ stripOuterTags = (d) => typeof d === "string" ? d.replace(/^<p>(.*)<\/p>$/, "$1") : d;
2276
+ sanitizeBlockContent = (d) => d ? stripOuterTags(clearBlank(stripTrail(d))) : d;
2277
+ sanitizeBlockContent_default = sanitizeBlockContent;
4054
2278
  }
4055
2279
  });
4056
-
4057
- // ../../node_modules/d3-scale/src/number.js
4058
- function number(x) {
4059
- return +x;
2280
+ function StatPreview({
2281
+ subtitle,
2282
+ title,
2283
+ value,
2284
+ tooltip
2285
+ }) {
2286
+ let titleHTML = sanitizeBlockContent_default(title);
2287
+ let valueHTML = sanitizeBlockContent_default(value);
2288
+ let subtitleHTML = sanitizeBlockContent_default(subtitle);
2289
+ const tooltipHTML = sanitizeBlockContent_default(tooltip);
2290
+ if (!titleHTML && !valueHTML && !subtitleHTML) {
2291
+ titleHTML = "<span class='cr-block-placeholder'>Title</span>";
2292
+ valueHTML = "<span class='cr-block-placeholder'>Big Stat</span>";
2293
+ subtitleHTML = "<span class='cr-block-placeholder'>Subtitle</span>";
2294
+ }
2295
+ return /* @__PURE__ */ jsxs("div", { children: [
2296
+ tooltip && /* @__PURE__ */ jsx("div", { style: { position: "absolute", right: "50px" }, children: /* @__PURE__ */ jsx(Tooltip, { label: tooltipHTML, withArrow: true, withinPortal: true, children: /* @__PURE__ */ jsx(ActionIcon, { children: /* @__PURE__ */ jsx(IconInfoCircle, {}) }) }) }, "tooltip"),
2297
+ /* @__PURE__ */ jsxs("div", { children: [
2298
+ /* @__PURE__ */ jsx(Text, { size: "md", dangerouslySetInnerHTML: { __html: titleHTML } }),
2299
+ /* @__PURE__ */ jsx(Text, { size: "xl", dangerouslySetInnerHTML: { __html: valueHTML } }),
2300
+ /* @__PURE__ */ jsx(Text, { size: "sm", dangerouslySetInnerHTML: { __html: subtitleHTML } })
2301
+ ] }, "stat")
2302
+ ] });
4060
2303
  }
4061
- var init_number2 = __esm({
4062
- "../../node_modules/d3-scale/src/number.js"() {
2304
+ var init_Stat = __esm({
2305
+ "components/blocks/types/renderers/Stat.tsx"() {
4063
2306
  init_esm_shims();
2307
+ init_sanitizeBlockContent();
4064
2308
  }
4065
2309
  });
4066
- function identity(x) {
4067
- return x;
4068
- }
4069
- function normalize2(a, b) {
4070
- return (b -= a = +a) ? function(x) {
4071
- return (x - a) / b;
4072
- } : constants(isNaN(b) ? NaN : 0.5);
4073
- }
4074
- function clamper(a, b) {
4075
- var t;
4076
- if (a > b)
4077
- t = a, a = b, b = t;
4078
- return function(x) {
4079
- return Math.max(a, Math.min(b, x));
4080
- };
4081
- }
4082
- function bimap(domain, range, interpolate) {
4083
- var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1];
4084
- if (d1 < d0)
4085
- d0 = normalize2(d1, d0), r0 = interpolate(r1, r0);
4086
- else
4087
- d0 = normalize2(d0, d1), r0 = interpolate(r0, r1);
4088
- return function(x) {
4089
- return r0(d0(x));
4090
- };
4091
- }
4092
- function polymap(domain, range, interpolate) {
4093
- var j = Math.min(domain.length, range.length) - 1, d = new Array(j), r = new Array(j), i = -1;
4094
- if (domain[j] < domain[0]) {
4095
- domain = domain.slice().reverse();
4096
- range = range.slice().reverse();
4097
- }
4098
- while (++i < j) {
4099
- d[i] = normalize2(domain[i], domain[i + 1]);
4100
- r[i] = interpolate(range[i], range[i + 1]);
4101
- }
4102
- return function(x) {
4103
- var i2 = bisect(domain, x, 1, j) - 1;
4104
- return r[i2](d[i2](x));
4105
- };
4106
- }
4107
- function copy(source, target) {
4108
- return target.domain(source.domain()).range(source.range()).interpolate(source.interpolate()).clamp(source.clamp()).unknown(source.unknown());
4109
- }
4110
- function transformer() {
4111
- var domain = unit, range = unit, interpolate = value_default, transform, untransform, unknown, clamp = identity, piecewise, output, input;
4112
- function rescale() {
4113
- var n = Math.min(domain.length, range.length);
4114
- if (clamp !== identity)
4115
- clamp = clamper(domain[0], domain[n - 1]);
4116
- piecewise = n > 2 ? polymap : bimap;
4117
- output = input = null;
4118
- return scale;
4119
- }
4120
- function scale(x) {
4121
- return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate)))(transform(clamp(x)));
4122
- }
4123
- scale.invert = function(y) {
4124
- return clamp(untransform((input || (input = piecewise(range, domain.map(transform), number_default)))(y)));
4125
- };
4126
- scale.domain = function(_) {
4127
- return arguments.length ? (domain = Array.from(_, number), rescale()) : domain.slice();
4128
- };
4129
- scale.range = function(_) {
4130
- return arguments.length ? (range = Array.from(_), rescale()) : range.slice();
4131
- };
4132
- scale.rangeRound = function(_) {
4133
- return range = Array.from(_), interpolate = round_default, rescale();
4134
- };
4135
- scale.clamp = function(_) {
4136
- return arguments.length ? (clamp = _ ? true : identity, rescale()) : clamp !== identity;
4137
- };
4138
- scale.interpolate = function(_) {
4139
- return arguments.length ? (interpolate = _, rescale()) : interpolate;
4140
- };
4141
- scale.unknown = function(_) {
4142
- return arguments.length ? (unknown = _, scale) : unknown;
4143
- };
4144
- return function(t, u) {
4145
- transform = t, untransform = u;
4146
- return rescale();
4147
- };
4148
- }
4149
- function continuous() {
4150
- return transformer()(identity, identity);
4151
- }
4152
- var unit;
4153
- var init_continuous = __esm({
4154
- "../../node_modules/d3-scale/src/continuous.js"() {
2310
+
2311
+ // libs/viz/defaultConfig.ts
2312
+ var defaultConfig_default;
2313
+ var init_defaultConfig = __esm({
2314
+ "libs/viz/defaultConfig.ts"() {
4155
2315
  init_esm_shims();
4156
- init_src2();
4157
- init_constant2();
4158
- init_number2();
4159
- unit = [0, 1];
2316
+ defaultConfig_default = {
2317
+ loadingHTML: `<div style="left: 50%; top: 50%; position: absolute; transform: translate(-50%, -50%);">
2318
+ <svg class="cp-viz-spinner" width="60px" height="60px" viewBox="0 0 317 317" xmlns="http://www.w3.org/2000/svg">
2319
+ <path class="outer" d="M16.43 157.072c0 34.797 12.578 66.644 33.428 91.277l-11.144 11.141c-23.673-27.496-37.992-63.283-37.992-102.418 0-39.133 14.319-74.921 37.992-102.423l11.144 11.144c-20.85 24.63-33.428 56.481-33.428 91.279z"/>
2320
+ <path class="outer" d="M157.793 15.708c34.798 0 66.648 12.58 91.28 33.427l11.143-11.144c-27.502-23.676-63.29-37.991-102.423-37.991-39.132 0-74.919 14.315-102.422 37.991l11.148 11.144c24.627-20.847 56.477-33.427 91.274-33.427"/>
2321
+ <path class="outer" d="M299.159 157.072c0 34.797-12.578 66.644-33.43 91.277l11.145 11.141c23.674-27.496 37.992-63.283 37.992-102.418 0-39.133-14.318-74.921-37.992-102.423l-11.145 11.144c20.852 24.63 33.43 56.481 33.43 91.279"/>
2322
+ <path class="outer" d="M157.793 298.432c-34.797 0-66.647-12.574-91.274-33.424l-11.148 11.138c27.503 23.682 63.29 37.997 102.422 37.997 39.133 0 74.921-14.315 102.423-37.997l-11.143-11.138c-24.632 20.85-56.482 33.424-91.28 33.424"/>
2323
+ <path class="middle" d="M226.59 61.474l-7.889 13.659c24.997 18.61 41.184 48.382 41.184 81.94 0 33.555-16.187 63.329-41.184 81.936l7.889 13.664c29.674-21.394 49.004-56.23 49.004-95.6 0-39.373-19.33-74.21-49.004-95.599"/>
2324
+ <path class="middle" d="M157.793 259.169c-52.398 0-95.553-39.485-101.399-90.317h-15.814c5.912 59.524 56.131 106.018 117.213 106.018 17.26 0 33.633-3.742 48.404-10.406l-7.893-13.672c-12.425 5.38-26.114 8.377-40.511 8.377"/>
2325
+ <path class="middle" d="M157.793 54.976c14.397 0 28.086 2.993 40.511 8.371l7.893-13.667c-14.771-6.669-31.144-10.412-48.404-10.412-61.082 0-111.301 46.493-117.213 106.021h15.814c5.846-50.831 49.001-90.313 101.399-90.313"/>
2326
+ <path class="inner" d="M95.371 164.193c-3.476-30.475 15.471-58.324 43.723-67.097l-1.804-15.842c-36.899 9.931-61.986 45.602-57.524 84.719 4.461 39.115 36.934 68.219 75.122 69.584l-1.806-15.838c-29.504-2.186-54.235-25.054-57.711-55.526"/>
2327
+ <path class="inner" d="M162.504 94.425c29.508 2.185 54.235 25.053 57.711 55.529 3.476 30.469-15.466 58.319-43.724 67.096l1.806 15.834c36.898-9.927 61.986-45.598 57.525-84.712-4.461-39.117-36.936-68.223-75.125-69.588l1.807 15.841z"/>
2328
+ </svg>
2329
+ <strong>Loading</strong>
2330
+ <sub style="bottom: 0; display: block; line-height: 1; margin-top: 5px;">
2331
+ <a style="color: inherit;" href="https://www.datawheel.us/" target="_blank">
2332
+ Built by Datawheel
2333
+ </a>
2334
+ </sub>
2335
+ </div>`,
2336
+ noDataHTML: `<div style="left: 50%; top: 50%; position: absolute; transform: translate(-50%, -50%);">
2337
+ <strong>No Data Available</strong>
2338
+ </div>`
2339
+ };
4160
2340
  }
4161
2341
  });
4162
- function tickFormat(start, stop, count, specifier) {
4163
- var step = tickStep(start, stop, count), precision;
4164
- specifier = formatSpecifier(specifier == null ? ",f" : specifier);
4165
- switch (specifier.type) {
4166
- case "s": {
4167
- var value = Math.max(Math.abs(start), Math.abs(stop));
4168
- if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value)))
4169
- specifier.precision = precision;
4170
- return formatPrefix(specifier, value);
4171
- }
4172
- case "":
4173
- case "e":
4174
- case "g":
4175
- case "p":
4176
- case "r": {
4177
- if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop)))))
4178
- specifier.precision = precision - (specifier.type === "e");
4179
- break;
4180
- }
4181
- case "f":
4182
- case "%": {
4183
- if (specifier.precision == null && !isNaN(precision = precisionFixed(step)))
4184
- specifier.precision = precision - (specifier.type === "%") * 2;
4185
- break;
4186
- }
4187
- }
4188
- return format$1(specifier);
4189
- }
4190
- var init_tickFormat = __esm({
4191
- "../../node_modules/d3-scale/src/tickFormat.js"() {
4192
- init_esm_shims();
2342
+
2343
+ // cms/components/reportVizes/Graphic.css
2344
+ var init_ = __esm({
2345
+ "cms/components/reportVizes/Graphic.css"() {
4193
2346
  }
4194
2347
  });
4195
- function linearish(scale) {
4196
- var domain = scale.domain;
4197
- scale.ticks = function(count) {
4198
- var d = domain();
4199
- return ticks(d[0], d[d.length - 1], count == null ? 10 : count);
4200
- };
4201
- scale.tickFormat = function(count, specifier) {
4202
- var d = domain();
4203
- return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier);
4204
- };
4205
- scale.nice = function(count) {
4206
- if (count == null)
4207
- count = 10;
4208
- var d = domain();
4209
- var i0 = 0;
4210
- var i1 = d.length - 1;
4211
- var start = d[i0];
4212
- var stop = d[i1];
4213
- var prestep;
4214
- var step;
4215
- var maxIter = 10;
4216
- if (stop < start) {
4217
- step = start, start = stop, stop = step;
4218
- step = i0, i0 = i1, i1 = step;
4219
- }
4220
- while (maxIter-- > 0) {
4221
- step = tickIncrement(start, stop, count);
4222
- if (step === prestep) {
4223
- d[i0] = start;
4224
- d[i1] = stop;
4225
- return domain(d);
4226
- } else if (step > 0) {
4227
- start = Math.floor(start / step) * step;
4228
- stop = Math.ceil(stop / step) * step;
4229
- } else if (step < 0) {
4230
- start = Math.ceil(start * step) / step;
4231
- stop = Math.floor(stop * step) / step;
4232
- } else {
4233
- break;
2348
+ function Graphic({ config, dataFormat }) {
2349
+ const [builtConfig, setBuiltConfig] = useState();
2350
+ useEffect(() => {
2351
+ const defaults = {
2352
+ numberFormat: (d, value, total) => {
2353
+ const perc = Number(d[value] / total * 100);
2354
+ return isNaN(perc) ? "No Data" : `${perc.toFixed(2)}%`;
4234
2355
  }
4235
- prestep = step;
2356
+ };
2357
+ let rebuiltConfig = { ...defaults, ...config };
2358
+ if (!rebuiltConfig || !rebuiltConfig.data) {
2359
+ console.log("no config/data");
2360
+ } else if (typeof rebuiltConfig.data === "string") {
2361
+ axios.get(rebuiltConfig.data).then((resp) => {
2362
+ rebuiltConfig.data = dataFormat(resp.data);
2363
+ if (typeof rebuiltConfig.data === "object" && !(rebuiltConfig.data instanceof Array))
2364
+ rebuiltConfig = Object.assign(rebuiltConfig, rebuiltConfig.data);
2365
+ if (!rebuiltConfig.total)
2366
+ rebuiltConfig.total = rebuiltConfig.data.reduce((acc, d) => isNaN(d[rebuiltConfig.value]) ? acc : acc + Number(d[rebuiltConfig.value]), 0);
2367
+ setBuiltConfig(rebuiltConfig);
2368
+ });
2369
+ } else {
2370
+ rebuiltConfig.data = dataFormat(rebuiltConfig.data);
2371
+ if (typeof rebuiltConfig.data === "object" && !(rebuiltConfig.data instanceof Array))
2372
+ rebuiltConfig = Object.assign(rebuiltConfig, rebuiltConfig.data);
2373
+ if (!rebuiltConfig.total)
2374
+ rebuiltConfig.total = rebuiltConfig.data.reduce((acc, d) => isNaN(d[rebuiltConfig.value]) ? acc : acc + Number(d[rebuiltConfig.value]), 0);
2375
+ setBuiltConfig(rebuiltConfig);
4236
2376
  }
4237
- return scale;
4238
- };
4239
- return scale;
4240
- }
4241
- function linear2() {
4242
- var scale = continuous();
4243
- scale.copy = function() {
4244
- return copy(scale, linear2());
4245
- };
4246
- initRange.apply(scale, arguments);
4247
- return linearish(scale);
2377
+ }, [config]);
2378
+ if (!builtConfig)
2379
+ return null;
2380
+ return /* @__PURE__ */ jsxs("div", { className: "cp-graphic", children: [
2381
+ builtConfig.imageURL && /* @__PURE__ */ jsx("img", { src: builtConfig.imageURL, className: "cp-graphic-img", alt: "" }),
2382
+ builtConfig.value && /* @__PURE__ */ jsx(
2383
+ StatPreview,
2384
+ {
2385
+ title: builtConfig.label,
2386
+ value: builtConfig.value,
2387
+ subtitle: builtConfig.subtitle,
2388
+ tooltip: builtConfig.tooltip
2389
+ }
2390
+ )
2391
+ ] });
4248
2392
  }
4249
- var init_linear = __esm({
4250
- "../../node_modules/d3-scale/src/linear.js"() {
4251
- init_esm_shims();
4252
- init_continuous();
4253
- init_init();
4254
- init_tickFormat();
4255
- }
4256
- });
4257
-
4258
- // ../../node_modules/d3-scale/src/index.js
4259
- var init_src3 = __esm({
4260
- "../../node_modules/d3-scale/src/index.js"() {
2393
+ var init_Graphic = __esm({
2394
+ "cms/components/reportVizes/Graphic.tsx"() {
4261
2395
  init_esm_shims();
4262
- init_linear();
2396
+ init_Stat();
2397
+ init_();
4263
2398
  }
4264
2399
  });
4265
-
4266
- // libs/js/abbreviate.ts
4267
- function abbreviate(n) {
4268
- return libs_default.d3plus.formatAbbreviate(n);
2400
+ function HTML({ config }) {
2401
+ if (!config || !config.html)
2402
+ return null;
2403
+ return /* @__PURE__ */ jsx("div", { className: "cp-viz cp-html", dangerouslySetInnerHTML: { __html: config.html } });
4269
2404
  }
4270
- var init_abbreviate = __esm({
4271
- "libs/js/abbreviate.ts"() {
2405
+ var init_HTML = __esm({
2406
+ "cms/components/reportVizes/HTML.tsx"() {
4272
2407
  init_esm_shims();
4273
- init_libs();
4274
2408
  }
4275
2409
  });
4276
2410
 
@@ -4279,217 +2413,31 @@ var init_2 = __esm({
4279
2413
  "cms/components/reportVizes/Table.css"() {
4280
2414
  }
4281
2415
  });
4282
- function spanify(html, cell, onClick) {
4283
- return /* @__PURE__ */ jsx("span", { className: `cp-table-cell-inner cp-table-cell-inner-${onClick ? "clickable" : "static"}`, onClick: onClick ? onClick.bind(this, cell.original) : void 0, dangerouslySetInnerHTML: { __html: html } });
2416
+ function Table({ config, dataFormat }) {
2417
+ console.log("TO-DO, implement table using mantine and pagination");
2418
+ return /* @__PURE__ */ jsxs("table", { children: [
2419
+ /* @__PURE__ */ jsxs("tr", { children: [
2420
+ /* @__PURE__ */ jsx("th", { children: "ID" }),
2421
+ /* @__PURE__ */ jsx("th", { children: "Foo" }),
2422
+ /* @__PURE__ */ jsx("th", { children: "Var" })
2423
+ ] }),
2424
+ /* @__PURE__ */ jsxs("tr", { children: [
2425
+ /* @__PURE__ */ jsx("td", { children: "1" }),
2426
+ /* @__PURE__ */ jsx("td", { children: "123123" }),
2427
+ /* @__PURE__ */ jsx("td", { children: "4234234" })
2428
+ ] }),
2429
+ /* @__PURE__ */ jsxs("tr", { children: [
2430
+ /* @__PURE__ */ jsx("td", { children: "2" }),
2431
+ /* @__PURE__ */ jsx("td", { children: "23432" }),
2432
+ /* @__PURE__ */ jsx("td", { children: "45435" })
2433
+ ] })
2434
+ ] });
4284
2435
  }
4285
- var import_prop_types, letters, measureString, defaultCellFormat, Table, Table_default;
2436
+ var Table_default;
4286
2437
  var init_Table = __esm({
4287
2438
  "cms/components/reportVizes/Table.jsx"() {
4288
2439
  init_esm_shims();
4289
- import_prop_types = __toESM(require_prop_types());
4290
- init_src3();
4291
- init_stripHTML();
4292
- init_abbreviate();
4293
2440
  init_2();
4294
- letters = {
4295
- i: 2,
4296
- l: 2,
4297
- I: 2,
4298
- " ": 4
4299
- };
4300
- measureString = (str) => typeof str === "string" ? sum(str.split("").map((l) => letters[l] || l.toUpperCase() === l ? 8 : 6)) : 0;
4301
- defaultCellFormat = (d, val) => isNaN(val) || d.column.id.includes("Year") || val === "" || val === " " ? val : abbreviate(val);
4302
- Table = class extends Component {
4303
- constructor(props) {
4304
- super(props);
4305
- __publicField(this, "renderGrouping", (currColumn, config) => {
4306
- const { headerFormat } = config;
4307
- let groupingTitle;
4308
- let nestedColumns;
4309
- if (currColumn[0] && typeof currColumn[0] === "string")
4310
- groupingTitle = currColumn[0];
4311
- if (currColumn[1] && Array.isArray(currColumn[1]))
4312
- nestedColumns = currColumn[1];
4313
- if (nestedColumns) {
4314
- if (typeof nestedColumns[0] === "string") {
4315
- return {
4316
- Header: headerFormat(groupingTitle),
4317
- accessor: (d) => d[nestedColumns[0]],
4318
- id: groupingTitle,
4319
- columns: nestedColumns.map((col) => this.renderColumn(col))
4320
- };
4321
- }
4322
- if (Array.isArray(nestedColumns[0])) {
4323
- return {
4324
- Header: headerFormat(groupingTitle),
4325
- id: groupingTitle,
4326
- columns: nestedColumns.map((col) => this.renderGrouping(col))
4327
- };
4328
- }
4329
- }
4330
- console.log("Invalid columns config passed to table viz; expected either an array of strings, or an array of arrays, each with a string first (table heading grouping title) and an array of strings.");
4331
- return void 0;
4332
- });
4333
- __publicField(this, "renderColumn", (obj, config) => {
4334
- const { data, headerFormat, cellFormat } = config;
4335
- const col = typeof obj === "string" ? obj : obj.accessor;
4336
- const onClick = typeof obj === "object" ? obj.onClick : void 0;
4337
- const header = obj.Header ? obj.Header : col;
4338
- const title = headerFormat ? headerFormat(header) : header;
4339
- const { print } = this.context;
4340
- function formatValue(cell, value) {
4341
- try {
4342
- return cellFormat ? cellFormat(cell, value) : defaultCellFormat(cell, value);
4343
- } catch (e) {
4344
- console.log("Error in cellFormat: ", e);
4345
- return defaultCellFormat(cell, value);
4346
- }
4347
- }
4348
- const padding = 20;
4349
- const sortIconWidth = 30;
4350
- const values = data.reduce((arr, d) => {
4351
- const html = formatValue({ original: d, value: d[col], column: { id: col } }, d[col]);
4352
- const text = stripHTML(html);
4353
- if (!text) {
4354
- const inlineWidth = html.match(/width[:="'\s]{1,}([0-9]{1,})px/);
4355
- arr.push(inlineWidth ? +inlineWidth[1] : 0);
4356
- } else {
4357
- arr.push(measureString(text));
4358
- }
4359
- return arr;
4360
- }, [measureString(title) + sortIconWidth]);
4361
- const columnWidth = max(values) + padding;
4362
- const calculatedMinWidth = min([200, max([padding * 2, columnWidth])]);
4363
- const minWidth = obj.minWidth !== void 0 ? obj.minWidth : calculatedMinWidth;
4364
- const maxWidth = obj.maxWidth !== void 0 ? obj.maxWidth : calculatedMinWidth < 100 ? calculatedMinWidth : void 0;
4365
- const { width } = obj;
4366
- return {
4367
- Header: print ? /* @__PURE__ */ jsx("button", { className: "cp-table-header-button", children: title }) : /* @__PURE__ */ jsxs("button", { className: "cp-table-header-button", children: [
4368
- title,
4369
- " ",
4370
- /* @__PURE__ */ jsx("span", { className: "u-visually-hidden", children: ", sort by column" }),
4371
- /* @__PURE__ */ jsx(Icon, { className: "cp-table-header-icon", icon: "caret-down" })
4372
- ] }),
4373
- id: col,
4374
- accessor: (d) => d[col],
4375
- minWidth,
4376
- maxWidth,
4377
- width,
4378
- Cell: (cell) => {
4379
- if (obj.cellStyle) {
4380
- try {
4381
- const newCell = obj.cellStyle(cell);
4382
- if (newCell)
4383
- cell = newCell;
4384
- } catch (e) {
4385
- console.error("Error in cellStyle");
4386
- }
4387
- }
4388
- const html = formatValue(cell, cell.value);
4389
- const span = spanify.bind(this)(html, cell, onClick);
4390
- return span;
4391
- }
4392
- };
4393
- });
4394
- this.state = {
4395
- data: [],
4396
- error: false,
4397
- loading: false
4398
- };
4399
- this.viz = React.createRef();
4400
- }
4401
- componentDidMount() {
4402
- this.loadData.bind(this)();
4403
- }
4404
- loadData() {
4405
- const { config, dataFormat } = this.props;
4406
- const url = config.data;
4407
- if (url) {
4408
- const fetch = () => dataLoad.bind({})(url, dataFormat, void 0, (error, data) => {
4409
- if (this.state.loading === JSON.stringify(url)) {
4410
- if (error) {
4411
- console.error(error);
4412
- this.setState({ error, loading: false });
4413
- } else
4414
- this.setState({ data, loading: false });
4415
- }
4416
- });
4417
- this.setState({ error: false, loading: JSON.stringify(url) }, fetch.bind(this));
4418
- }
4419
- }
4420
- componentDidUpdate(prevProps) {
4421
- const { data } = this.props.config;
4422
- const { loading } = this.state;
4423
- if (loading !== data && JSON.stringify(prevProps.config.data) !== JSON.stringify(data)) {
4424
- this.loadData.bind(this)();
4425
- }
4426
- }
4427
- render() {
4428
- const { data, loading } = this.state;
4429
- const { minRowsForPagination, size, t } = this.props;
4430
- const config = { ...this.props.config };
4431
- const { d3plus: d3plus2, print } = this.context;
4432
- config.data = data;
4433
- if (config.column)
4434
- delete config.column;
4435
- let columns = data.length ? Object.keys(data[0]) : [];
4436
- if (Array.isArray(config.columns))
4437
- columns = config.columns;
4438
- else if (typeof config.columns === "string")
4439
- columns = [config.columns];
4440
- else if (typeof config.columns === "function")
4441
- columns = config.columns(columns);
4442
- const tableStructure = columns.map((col) => {
4443
- if (typeof col === "string" || typeof col === "object" && col.accessor) {
4444
- return this.renderColumn(col, config);
4445
- }
4446
- if (Array.isArray(col)) {
4447
- return this.renderGrouping(col, config);
4448
- }
4449
- return {};
4450
- }).filter(Boolean).map((d) => {
4451
- if (d.cellStyle)
4452
- delete d.cellStyle;
4453
- return d;
4454
- });
4455
- if (print && typeof window !== "undefined") {
4456
- const totalWidth = sum(tableStructure, (d) => d.minWidth);
4457
- const widthScale = linear2().domain([0, totalWidth]).range([0, size.width - 6]);
4458
- tableStructure.forEach((col) => {
4459
- col.maxWidth = void 0;
4460
- col.minWidth = widthScale(col.minWidth);
4461
- });
4462
- }
4463
- return /* @__PURE__ */ jsxs("div", { className: "cp-table-wrapper", ref: this.viz, children: [
4464
- tableStructure.length ? /* @__PURE__ */ jsx(
4465
- ReactTable,
4466
- {
4467
- resizable: !print,
4468
- sortable: !print,
4469
- loadingText: t("CMS.Table.Loading"),
4470
- nextText: t("CMS.Table.Next"),
4471
- noDataText: t("CMS.Table.No rows found"),
4472
- ofText: t("CMS.Table.of"),
4473
- pageText: t("CMS.Table.Page"),
4474
- previousText: t("CMS.Table.Previous"),
4475
- rowsText: t("CMS.Table.rows"),
4476
- showPagination: data.length >= minRowsForPagination,
4477
- ...config,
4478
- className: `cp-table ${loading ? "cp-table-loading" : ""}`,
4479
- columns: tableStructure
4480
- }
4481
- ) : null,
4482
- loading && /* @__PURE__ */ jsx("div", { className: "cp-loading", dangerouslySetInnerHTML: { __html: config.loadingHTML || d3plus2.loadingHTML } })
4483
- ] });
4484
- }
4485
- };
4486
- Table.contextTypes = {
4487
- d3plus: import_prop_types.default.object,
4488
- print: import_prop_types.default.bool
4489
- };
4490
- Table.defaultProps = {
4491
- minRowsForPagination: 15
4492
- };
4493
2441
  Table_default = Table;
4494
2442
  }
4495
2443
  });
@@ -4950,7 +2898,7 @@ function BespokeExplore({
4950
2898
  rightSectionWidth: 100,
4951
2899
  rightSectionProps: {
4952
2900
  style: {
4953
- "justify-content": "flex-end",
2901
+ justifyContent: "flex-end",
4954
2902
  padding: "0 15px 0 0"
4955
2903
  }
4956
2904
  },
@@ -5426,7 +3374,25 @@ init_esm_shims();
5426
3374
 
5427
3375
  // libs/js/slugify.ts
5428
3376
  init_esm_shims();
5429
- init_stripHTML();
3377
+
3378
+ // libs/js/stripHTML.ts
3379
+ init_esm_shims();
3380
+ function stripHTML(n) {
3381
+ const entities = {
3382
+ "&amp;": "&",
3383
+ "&lt;": "<",
3384
+ "&gt;": ">",
3385
+ "&quot;": '"',
3386
+ "&#x27;": "'",
3387
+ "&#x60;": "`",
3388
+ "&nbsp;": ""
3389
+ };
3390
+ const source = `(?:${Object.keys(entities).join("|")})`;
3391
+ const testRegexp = RegExp(source);
3392
+ const replaceRegexp = RegExp(source, "g");
3393
+ const s = String(n).replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
3394
+ return testRegexp.test(s) ? s.replace(replaceRegexp, (match) => entities[match]) : s;
3395
+ }
5430
3396
 
5431
3397
  // libs/js/stripEntities.ts
5432
3398
  init_esm_shims();
@@ -6285,7 +4251,7 @@ function ReportEditor({ id, onClose: closeHandler }) {
6285
4251
  }, [id]);
6286
4252
  const submitHandler = useCallback(() => {
6287
4253
  dispatch(actions_exports.updateEntity("report", { ...config, id })).then(closeHandler);
6288
- }, [id]);
4254
+ }, [id, config]);
6289
4255
  const onChange = useCallback((field, value) => {
6290
4256
  setConfig({ ...config, [field]: value });
6291
4257
  }, []);
@@ -8473,7 +6439,7 @@ function CopyInput(props) {
8473
6439
  icon: /* @__PURE__ */ jsx(IconLink, {}),
8474
6440
  value: url,
8475
6441
  readOnly: true,
8476
- rightSection: /* @__PURE__ */ jsx(CopyButton, { value: url, timeout: 2e3, children: ({ copied, copy: copy2 }) => /* @__PURE__ */ jsx(Tooltip, { label: copied ? "Copied" : "Copy", withArrow: true, position: "right", children: /* @__PURE__ */ jsx(ActionIcon, { color: "blue", variant: copied ? "filled" : "subtle", onClick: copy2, children: copied ? /* @__PURE__ */ jsx(IconClipboardCheck, { size: 16 }) : /* @__PURE__ */ jsx(IconClipboardCopy, { size: 16 }) }) }) })
6442
+ rightSection: /* @__PURE__ */ jsx(CopyButton, { value: url, timeout: 2e3, children: ({ copied, copy }) => /* @__PURE__ */ jsx(Tooltip, { label: copied ? "Copied" : "Copy", withArrow: true, position: "right", children: /* @__PURE__ */ jsx(ActionIcon, { color: "blue", variant: copied ? "filled" : "subtle", onClick: copy, children: copied ? /* @__PURE__ */ jsx(IconClipboardCheck, { size: 16 }) : /* @__PURE__ */ jsx(IconClipboardCopy, { size: 16 }) }) }) })
8477
6443
  }
8478
6444
  ) });
8479
6445
  }
@@ -8507,7 +6473,6 @@ function SortableTable({ data, customIdAccessor = "id" }) {
8507
6473
  setSortStatus(void 0);
8508
6474
  setRecords(getSortedData(void 0));
8509
6475
  }, [data]);
8510
- console.log("records", records);
8511
6476
  return /* @__PURE__ */ jsx(
8512
6477
  DataTable,
8513
6478
  {
@@ -8553,10 +6518,10 @@ function DataTab(props) {
8553
6518
  setSelectedSource(sourcesOptions[0]);
8554
6519
  }
8555
6520
  }, []);
8556
- const getFileName = (format3) => {
6521
+ const getFileName = (format2) => {
8557
6522
  const sectionId = section.id;
8558
6523
  const sourceId = selectedSource.id;
8559
- return `data_section_${sectionId}_block_${sourceId}.${format3.toLowerCase()}`;
6524
+ return `data_section_${sectionId}_block_${sourceId}.${format2.toLowerCase()}`;
8560
6525
  };
8561
6526
  const onSaveClick = async () => {
8562
6527
  if (selectedSource) {
@@ -8625,16 +6590,16 @@ function DataTab(props) {
8625
6590
  selectedSource && selectedSource.data && selectedSource.data.length > 0 && /* @__PURE__ */ jsxs(Stack, { children: [
8626
6591
  /* @__PURE__ */ jsx(Input.Wrapper, { label: `Formatted ${selectedSource.title}:`, style: { height: "300px" }, children: /* @__PURE__ */ jsx(SortableTable, { data: selectedSource.data }) }),
8627
6592
  /* @__PURE__ */ jsx(Space, { h: "xs" }),
8628
- /* @__PURE__ */ jsx(Input.Wrapper, { label: "Choose format:", children: /* @__PURE__ */ jsx(Button.Group, { children: Object.keys(formatOptions).map((format3) => /* @__PURE__ */ jsx(
6593
+ /* @__PURE__ */ jsx(Input.Wrapper, { label: "Choose format:", children: /* @__PURE__ */ jsx(Button.Group, { children: Object.keys(formatOptions).map((format2) => /* @__PURE__ */ jsx(
8629
6594
  Button,
8630
6595
  {
8631
6596
  leftIcon: /* @__PURE__ */ jsx(IconTable, { size: 16 }),
8632
- onClick: () => setFileFormat(formatOptions[format3]),
8633
- variant: fileFormat === formatOptions[format3] ? "filled" : "default",
6597
+ onClick: () => setFileFormat(formatOptions[format2]),
6598
+ variant: fileFormat === formatOptions[format2] ? "filled" : "default",
8634
6599
  fullWidth: true,
8635
- children: formatOptions[format3]
6600
+ children: formatOptions[format2]
8636
6601
  },
8637
- `format-${format3}`
6602
+ `format-${format2}`
8638
6603
  )) }) }),
8639
6604
  /* @__PURE__ */ jsx(
8640
6605
  Button,
@@ -8700,9 +6665,9 @@ function ImageTab(props) {
8700
6665
  const getBackground = (elem) => {
8701
6666
  if (transparentBackground)
8702
6667
  return "transparent";
8703
- const color2 = select(elem).style("background-color");
8704
- if (color2 !== "rgba(0, 0, 0, 0)" && color2 !== "transparent")
8705
- return color2;
6668
+ const color = select(elem).style("background-color");
6669
+ if (color !== "rgba(0, 0, 0, 0)" && color !== "transparent")
6670
+ return color;
8706
6671
  if (elem === document.body)
8707
6672
  return "white";
8708
6673
  return getBackground(elem.parentNode);
@@ -9952,22 +7917,22 @@ function MemberForm({ memberId, onEditEnd }) {
9952
7917
  acc[item] = useForm({});
9953
7918
  return acc;
9954
7919
  }, {});
7920
+ const dispatch = useAppDispatch();
9955
7921
  const fetchMemberData = async () => {
9956
7922
  setLoading(true);
9957
7923
  setError(false);
9958
- const memberRecord = await axios.get(
9959
- "/api/cms/read/members",
7924
+ const memberRecord = await dispatch(actions_exports.readMember(
9960
7925
  {
9961
- params: {
9962
- ids: memberId,
9963
- locale: "all"
9964
- }
7926
+ locale: "all",
7927
+ content_ids: memberId,
7928
+ all: false,
7929
+ mode: "content_ids"
9965
7930
  }
9966
- ).then((response) => {
7931
+ )).then((response) => {
9967
7932
  let obj;
9968
- if (response.data && response.data.data && response.data.data.results && response.data.data.results[0]) {
7933
+ if (response.results && response.results[0]) {
9969
7934
  setError(false);
9970
- obj = response.data.data.results[0];
7935
+ obj = response.results[0];
9971
7936
  } else {
9972
7937
  setError(true);
9973
7938
  }
@@ -10206,7 +8171,10 @@ function MemberForm({ memberId, onEditEnd }) {
10206
8171
  {
10207
8172
  onClick: () => {
10208
8173
  const current = localizedForms[selectedLocale].values.keywords;
10209
- localizedForms[selectedLocale].setFieldValue("keywords", current.filter((k) => k !== label));
8174
+ localizedForms[selectedLocale].setFieldValue(
8175
+ "keywords",
8176
+ current.filter((k) => k !== label)
8177
+ );
10210
8178
  },
10211
8179
  children: [
10212
8180
  label,
@@ -11141,26 +9109,5 @@ init_esm_shims();
11141
9109
  function BespokeRenderer() {
11142
9110
  return /* @__PURE__ */ jsx("div", { children: "Report COMING SOON" });
11143
9111
  }
11144
- /*
11145
- object-assign
11146
- (c) Sindre Sorhus
11147
- @license MIT
11148
- */
11149
- /** @license React v16.13.1
11150
- * react-is.development.js
11151
- *
11152
- * Copyright (c) Facebook, Inc. and its affiliates.
11153
- *
11154
- * This source code is licensed under the MIT license found in the
11155
- * LICENSE file in the root directory of this source tree.
11156
- */
11157
- /** @license React v16.13.1
11158
- * react-is.production.min.js
11159
- *
11160
- * Copyright (c) Facebook, Inc. and its affiliates.
11161
- *
11162
- * This source code is licensed under the MIT license found in the
11163
- * LICENSE file in the root directory of this source tree.
11164
- */
11165
9112
 
11166
9113
  export { BespokeCMS, Explore_default as BespokeExplore, ExploreModal_default as BespokeExploreModal, BespokeRenderer, Report_default as BespokeReport, Search_default as BespokeSearch, DialogProvider, actions_exports as actions, storeWrapper, useAppDispatch as useBespokeDispatch, useAppSelector as useBespokeSelector, useDialog };