@deriv-web-design/ui 0.1.39 → 0.1.41

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.
package/dist/index.js CHANGED
@@ -1165,6 +1165,7 @@ var Pagination = ({
1165
1165
  {
1166
1166
  className: ["pagination", className ?? ""].filter(Boolean).join(" "),
1167
1167
  "aria-label": "Pagination navigation",
1168
+ dir: "ltr",
1168
1169
  children: [
1169
1170
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1170
1171
  "button",
@@ -4893,7 +4894,7 @@ var import_framer_motion3 = require("framer-motion");
4893
4894
 
4894
4895
  // templates/DayNightTransition/webflowDayNightV2Ix.ts
4895
4896
  var DESC_SWATCH = { r: 24, g: 28, b: 37 };
4896
- var BODY_TEXT = { r: 51, g: 51, b: 51 };
4897
+ var DAY_TEXT = { r: 0, g: 0, b: 0 };
4897
4898
  var rgb = (r, g, b) => `rgb(${r},${g},${b})`;
4898
4899
  var lerp = (a, b, u) => a + (b - a) * u;
4899
4900
  var seg = (t, t0, t1, v0, v1) => {
@@ -4903,33 +4904,33 @@ var seg = (t, t0, t1, v0, v1) => {
4903
4904
  };
4904
4905
  function webflowV2DescriptionColor(t, media) {
4905
4906
  if (media === "desktop") {
4906
- const body2 = rgb(BODY_TEXT.r, BODY_TEXT.g, BODY_TEXT.b);
4907
+ const day2 = rgb(DAY_TEXT.r, DAY_TEXT.g, DAY_TEXT.b);
4907
4908
  const dark2 = rgb(DESC_SWATCH.r, DESC_SWATCH.g, DESC_SWATCH.b);
4908
4909
  const white2 = rgb(255, 255, 255);
4909
- if (t < 0.49) return body2;
4910
+ if (t < 0.49) return day2;
4910
4911
  if (t < 0.5) return dark2;
4911
4912
  return white2;
4912
4913
  }
4913
4914
  const white = rgb(255, 255, 255);
4914
4915
  const dark = rgb(DESC_SWATCH.r, DESC_SWATCH.g, DESC_SWATCH.b);
4915
- const body = rgb(BODY_TEXT.r, BODY_TEXT.g, BODY_TEXT.b);
4916
- if (t < 0.58) return body;
4916
+ const day = rgb(DAY_TEXT.r, DAY_TEXT.g, DAY_TEXT.b);
4917
+ if (t < 0.58) return day;
4917
4918
  if (t < 0.59) return dark;
4918
4919
  return white;
4919
4920
  }
4920
4921
  function webflowV2TitleColor(t, media) {
4921
4922
  if (media === "desktop") {
4922
- const body2 = rgb(BODY_TEXT.r, BODY_TEXT.g, BODY_TEXT.b);
4923
+ const day2 = rgb(DAY_TEXT.r, DAY_TEXT.g, DAY_TEXT.b);
4923
4924
  const black = rgb(0, 0, 0);
4924
4925
  const white2 = rgb(255, 255, 255);
4925
- if (t < 0.51) return body2;
4926
+ if (t < 0.51) return day2;
4926
4927
  if (t >= 0.52) return white2;
4927
4928
  return seg(t, 0.51, 0.52, black, white2);
4928
4929
  }
4929
4930
  const dark = rgb(DESC_SWATCH.r, DESC_SWATCH.g, DESC_SWATCH.b);
4930
4931
  const white = rgb(255, 255, 255);
4931
- const body = rgb(BODY_TEXT.r, BODY_TEXT.g, BODY_TEXT.b);
4932
- if (t < 0.6) return body;
4932
+ const day = rgb(DAY_TEXT.r, DAY_TEXT.g, DAY_TEXT.b);
4933
+ if (t < 0.6) return day;
4933
4934
  if (t >= 0.61) return white;
4934
4935
  const u = (t - 0.6) / 0.01;
4935
4936
  return rgb(
@@ -5002,6 +5003,7 @@ var DayNightTransition = ({
5002
5003
  const [nightMarginStart, setNightMarginStart] = (0, import_react20.useState)("0px");
5003
5004
  const [nightMarginEnd, setNightMarginEnd] = (0, import_react20.useState)("0px");
5004
5005
  const [ixMedia, setIxMedia] = (0, import_react20.useState)("desktop");
5006
+ const [isRtl, setIsRtl] = (0, import_react20.useState)(false);
5005
5007
  const webflowV2 = scrollPreset === "webflow-day-night-v2";
5006
5008
  (0, import_react20.useEffect)(() => {
5007
5009
  const mq = window.matchMedia("(max-width: 991px)");
@@ -5010,6 +5012,21 @@ var DayNightTransition = ({
5010
5012
  mq.addEventListener("change", sync);
5011
5013
  return () => mq.removeEventListener("change", sync);
5012
5014
  }, []);
5015
+ (0, import_react20.useEffect)(() => {
5016
+ const syncRtl = () => {
5017
+ const doc = document.documentElement;
5018
+ setIsRtl(
5019
+ doc.getAttribute("dir") === "rtl" || doc.lang.toLowerCase().startsWith("ar")
5020
+ );
5021
+ };
5022
+ syncRtl();
5023
+ const mo = new MutationObserver(syncRtl);
5024
+ mo.observe(document.documentElement, {
5025
+ attributes: true,
5026
+ attributeFilter: ["dir", "lang"]
5027
+ });
5028
+ return () => mo.disconnect();
5029
+ }, []);
5013
5030
  const MotionHeadline = headlineLevel === "h1" ? import_framer_motion3.motion.h1 : import_framer_motion3.motion.h2;
5014
5031
  (0, import_react20.useLayoutEffect)(() => {
5015
5032
  if (!inlineDayNightHeadline) return;
@@ -5031,8 +5048,14 @@ var DayNightTransition = ({
5031
5048
  const ro = new ResizeObserver(syncNightPull);
5032
5049
  if (dayWordRef.current) ro.observe(dayWordRef.current);
5033
5050
  window.addEventListener("resize", syncNightPull);
5051
+ const mo = new MutationObserver(syncNightPull);
5052
+ mo.observe(document.documentElement, {
5053
+ attributes: true,
5054
+ attributeFilter: ["dir", "lang"]
5055
+ });
5034
5056
  return () => {
5035
5057
  ro.disconnect();
5058
+ mo.disconnect();
5036
5059
  window.removeEventListener("resize", syncNightPull);
5037
5060
  };
5038
5061
  }, [
@@ -5092,7 +5115,7 @@ var DayNightTransition = ({
5092
5115
  const v2NightWordOp = (0, import_framer_motion3.useTransform)(progress, (t) => webflowV2NightWordOpacity(t, ixMedia));
5093
5116
  const v2DayHeight = (0, import_framer_motion3.useTransform)(
5094
5117
  progress,
5095
- (t) => ixMedia === "mobile" ? `${webflowV2DayClipPercent(t, ixMedia)}%` : "100vh"
5118
+ (t) => ixMedia === "mobile" || isRtl ? `${webflowV2DayClipPercent(t, "mobile")}%` : "100vh"
5096
5119
  );
5097
5120
  const hasDescription = Boolean(dayDescription || nightDescription);
5098
5121
  const useInlineHeadline = Boolean(inlineDayNightHeadline);
@@ -5114,19 +5137,23 @@ var DayNightTransition = ({
5114
5137
  import_framer_motion3.motion.div,
5115
5138
  {
5116
5139
  className: "dnt__v2-bg-day trade-day-night_background-day is-alternative",
5117
- style: {
5118
- backgroundImage: `url(${dayImageUrl})`,
5119
- height: v2DayHeight
5120
- }
5140
+ style: { height: v2DayHeight },
5141
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
5142
+ "div",
5143
+ {
5144
+ className: "dnt__v2-bg-media",
5145
+ style: { backgroundImage: `url(${dayImageUrl})` }
5146
+ }
5147
+ )
5121
5148
  }
5122
5149
  ),
5123
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
5150
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "dnt__v2-bg-night trade-day-night_background-night is-alternative", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
5124
5151
  "div",
5125
5152
  {
5126
- className: "dnt__v2-bg-night trade-day-night_background-night is-alternative",
5153
+ className: "dnt__v2-bg-media",
5127
5154
  style: { backgroundImage: `url(${nightImageUrl})` }
5128
5155
  }
5129
- )
5156
+ ) })
5130
5157
  ] }),
5131
5158
  /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: webflowV2 ? "dnt__sticky dnt__sticky--webflow-v2" : "dnt__sticky", children: [
5132
5159
  !webflowV2 && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
@@ -7383,6 +7410,9 @@ var CoralBanner = ({
7383
7410
  ] }) }) });
7384
7411
  };
7385
7412
 
7413
+ // templates/FeatureAwards/FeatureAwards.tsx
7414
+ var import_react29 = require("react");
7415
+
7386
7416
  // assets/award-leaf-left.png
7387
7417
  var award_leaf_left_default = "data:image/png;base64,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";
7388
7418
 
@@ -7424,9 +7454,12 @@ var LaurelIcon = ({ side }) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
7424
7454
  draggable: false
7425
7455
  }
7426
7456
  );
7427
- var AwardBadge2 = ({ award }) => /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "fa__item", role: "listitem", children: [
7457
+ var AwardBadge2 = ({
7458
+ award,
7459
+ textDir
7460
+ }) => /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "fa__item", role: "listitem", dir: "ltr", children: [
7428
7461
  /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(LaurelIcon, { side: "left" }),
7429
- /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "fa__item-text", children: [
7462
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "fa__item-text", dir: textDir, children: [
7430
7463
  /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("p", { className: "fa__item-title", children: award.title }),
7431
7464
  /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("p", { className: "fa__item-subtitle", children: award.subtitle })
7432
7465
  ] }),
@@ -7439,6 +7472,21 @@ var FeatureAwards = ({
7439
7472
  className,
7440
7473
  ...props
7441
7474
  }) => {
7475
+ const [textDir, setTextDir] = (0, import_react29.useState)("ltr");
7476
+ (0, import_react29.useEffect)(() => {
7477
+ const sync = () => {
7478
+ setTextDir(
7479
+ document.documentElement.getAttribute("dir") === "rtl" ? "rtl" : "ltr"
7480
+ );
7481
+ };
7482
+ sync();
7483
+ const mo = new MutationObserver(sync);
7484
+ mo.observe(document.documentElement, {
7485
+ attributes: true,
7486
+ attributeFilter: ["dir"]
7487
+ });
7488
+ return () => mo.disconnect();
7489
+ }, []);
7442
7490
  if (!awards || awards.length === 0) return null;
7443
7491
  const trackStyle = {
7444
7492
  "--fa-duration": `${autoScrollDuration}s`
@@ -7450,16 +7498,16 @@ var FeatureAwards = ({
7450
7498
  ...props,
7451
7499
  children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "fa__inner", children: [
7452
7500
  title && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("h2", { className: "fa__title", children: title }),
7453
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "fa__grid", role: "list", children: awards.map((award, i) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(AwardBadge2, { award }, `g-${i}`)) }),
7454
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "fa__scroller", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "fa__track fa__track--auto", style: trackStyle, children: [
7455
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "fa__track-group", role: "list", children: awards.map((award, i) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(AwardBadge2, { award }, `m-${i}`)) }),
7501
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "fa__grid", role: "list", children: awards.map((award, i) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(AwardBadge2, { award, textDir }, `g-${i}`)) }),
7502
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "fa__scroller", dir: "ltr", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "fa__track fa__track--auto", style: trackStyle, children: [
7503
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "fa__track-group", role: "list", children: awards.map((award, i) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(AwardBadge2, { award, textDir }, `m-${i}`)) }),
7456
7504
  /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
7457
7505
  "div",
7458
7506
  {
7459
7507
  className: "fa__track-group",
7460
7508
  role: "presentation",
7461
7509
  "aria-hidden": "true",
7462
- children: awards.map((award, i) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(AwardBadge2, { award }, `m-dup-${i}`))
7510
+ children: awards.map((award, i) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(AwardBadge2, { award, textDir }, `m-dup-${i}`))
7463
7511
  }
7464
7512
  )
7465
7513
  ] }) })
@@ -7546,7 +7594,7 @@ var FeatureBlog = ({
7546
7594
  };
7547
7595
 
7548
7596
  // templates/FeatureBlogCategories/FeatureBlogCategories.tsx
7549
- var import_react29 = require("react");
7597
+ var import_react30 = require("react");
7550
7598
  var import_jsx_runtime54 = require("react/jsx-runtime");
7551
7599
  var isExternalUrl = (href) => Boolean(href && /^https?:\/\//i.test(href));
7552
7600
  var FEATURE_BLOG_CATEGORIES_TEXT_CONTENT = {
@@ -7610,20 +7658,20 @@ var FeatureBlogCategories = ({
7610
7658
  className,
7611
7659
  ...props
7612
7660
  }) => {
7613
- const [search, setSearch] = (0, import_react29.useState)("");
7614
- const [internalActiveId, setInternalActiveId] = (0, import_react29.useState)(defaultActiveCategoryId ?? allCategoryId);
7661
+ const [search, setSearch] = (0, import_react30.useState)("");
7662
+ const [internalActiveId, setInternalActiveId] = (0, import_react30.useState)(defaultActiveCategoryId ?? allCategoryId);
7615
7663
  const isControlled = activeCategoryId !== void 0;
7616
7664
  const activeId = isControlled ? activeCategoryId : internalActiveId;
7617
- const tabs = (0, import_react29.useMemo)(
7665
+ const tabs = (0, import_react30.useMemo)(
7618
7666
  () => [{ id: allCategoryId, label: allCategoryLabel }, ...categories],
7619
7667
  [allCategoryId, allCategoryLabel, categories]
7620
7668
  );
7621
- const categoryLabelById = (0, import_react29.useMemo)(() => {
7669
+ const categoryLabelById = (0, import_react30.useMemo)(() => {
7622
7670
  const map = /* @__PURE__ */ new Map();
7623
7671
  categories.forEach((category) => map.set(category.id, category.label));
7624
7672
  return map;
7625
7673
  }, [categories]);
7626
- const filteredPosts = (0, import_react29.useMemo)(() => {
7674
+ const filteredPosts = (0, import_react30.useMemo)(() => {
7627
7675
  const query = search.trim().toLowerCase();
7628
7676
  return posts.filter((post) => {
7629
7677
  const matchesCategory = activeId === allCategoryId || post.category === activeId;
@@ -7719,7 +7767,7 @@ var HelpCentreCategories = ({
7719
7767
  };
7720
7768
 
7721
7769
  // templates/HelpCentreSubCategories/HelpCentreSubCategories.tsx
7722
- var import_react30 = require("react");
7770
+ var import_react31 = require("react");
7723
7771
  var import_jsx_runtime56 = require("react/jsx-runtime");
7724
7772
  var externalLinkRel4 = (href) => href && /^https?:\/\//i.test(href) ? "noopener noreferrer" : void 0;
7725
7773
  var QuestionCard = ({ item }) => {
@@ -7736,8 +7784,8 @@ var HelpCentreSubCategories = ({
7736
7784
  noResultsText = 'No results found for "{query}"',
7737
7785
  onSearchChange
7738
7786
  }) => {
7739
- const [search, setSearch] = (0, import_react30.useState)("");
7740
- const filtered = (0, import_react30.useMemo)(() => {
7787
+ const [search, setSearch] = (0, import_react31.useState)("");
7788
+ const filtered = (0, import_react31.useMemo)(() => {
7741
7789
  const q = search.trim().toLowerCase();
7742
7790
  if (!q) return items;
7743
7791
  return items.filter((item) => item.question.toLowerCase().includes(q));
@@ -7768,7 +7816,7 @@ var HelpCentreSubCategories = ({
7768
7816
  };
7769
7817
 
7770
7818
  // templates/HelpCenterPage/HelpCenterPage.tsx
7771
- var import_react31 = require("react");
7819
+ var import_react32 = require("react");
7772
7820
  var import_jsx_runtime57 = require("react/jsx-runtime");
7773
7821
  var externalLinkRel5 = (href) => href && /^https?:\/\//i.test(href) ? "noopener noreferrer" : void 0;
7774
7822
  var ChevronDownIcon5 = () => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("svg", { "aria-hidden": "true", fill: "none", height: "16", viewBox: "0 0 16 16", width: "16", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("path", { d: "M4 6l4 4 4-4", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.5" }) });
@@ -7834,13 +7882,13 @@ var HelpCenterPage = ({
7834
7882
  articlesSheetTitle = "Articles in this section",
7835
7883
  className
7836
7884
  }) => {
7837
- const [search, setSearch] = (0, import_react31.useState)("");
7838
- const [internalActiveId, setInternalActiveId] = (0, import_react31.useState)(defaultActiveQuestionId ?? questions[0]?.id);
7839
- const [sheetOpen, setSheetOpen] = (0, import_react31.useState)(false);
7885
+ const [search, setSearch] = (0, import_react32.useState)("");
7886
+ const [internalActiveId, setInternalActiveId] = (0, import_react32.useState)(defaultActiveQuestionId ?? questions[0]?.id);
7887
+ const [sheetOpen, setSheetOpen] = (0, import_react32.useState)(false);
7840
7888
  const isControlled = activeQuestionId !== void 0;
7841
7889
  const activeId = isControlled ? activeQuestionId : internalActiveId;
7842
7890
  const activeItem = questions.find((item) => item.id === activeId);
7843
- const filtered = (0, import_react31.useMemo)(() => {
7891
+ const filtered = (0, import_react32.useMemo)(() => {
7844
7892
  const q = search.trim().toLowerCase();
7845
7893
  if (!q) return questions;
7846
7894
  return questions.filter((item) => item.question.toLowerCase().includes(q));
@@ -7903,7 +7951,7 @@ var HelpCenterPage = ({
7903
7951
  };
7904
7952
 
7905
7953
  // templates/FeatureBlogPage/FeatureBlogPage.tsx
7906
- var import_react32 = require("react");
7954
+ var import_react33 = require("react");
7907
7955
 
7908
7956
  // assets/share-link.png
7909
7957
  var share_link_default = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAABYklEQVR4AezVgU3DMBAFUMRAzMEQzMEQzMEQzMFE+FX5kuNGF4cgIVWp8us73/n/76vaPj/98+sycE3gmsBDTuCl/bQELayfv5zAW5P6avgYwEzb2n7OGBiJGYjK9xLoYWhJ75ffGCCUm2bF/N7e4HVZxS28Pc7cgvHtiAG3ITiSZd+tIRrizyXRs4TrZdYAgowyxG4IcqyjMXupOS+/w4wBh3txoojsqUVky0D20uPcCnsGCBByCEnEe2JjVtOj3wpiEKcuXmHPwJZ4SBEhloM8kPdnmUxttVYGeoLcfHV4SJiBUbw8WxkI/+ieSGo+CoL29IkPGa8MIIvQuBKz1xvQf0gcQWXArfQgtvZgoK8zAnrUyrFrCmYMIAZnmBEDEWAECAd6p1AZ6MkI+hU0YjEQIMwE9P1qU6gMIAgpITlkT3waewYIEHRDfzIgB7XTmDFwWqQiuAxcE3j8CVTfALUfAAAA//85/ClxAAAABklEQVQDABFpTkF24Li2AAAAAElFTkSuQmCC";
@@ -7960,7 +8008,7 @@ var TocCard = ({
7960
8008
  idSuffix,
7961
8009
  collapsible
7962
8010
  }) => {
7963
- const [open, setOpen] = (0, import_react32.useState)(defaultOpen);
8011
+ const [open, setOpen] = (0, import_react33.useState)(defaultOpen);
7964
8012
  const panelId = `fbp-toc-panel-${idSuffix}`;
7965
8013
  const isOpen = collapsible ? open : true;
7966
8014
  const list = /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("ol", { className: "fbp-tocList", id: panelId, children: headings.map((heading) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("li", { className: "fbp-tocItem", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
@@ -8002,7 +8050,7 @@ var ShareRow = ({
8002
8050
  onShare,
8003
8051
  copiedLabel
8004
8052
  }) => {
8005
- const [copied, setCopied] = (0, import_react32.useState)(false);
8053
+ const [copied, setCopied] = (0, import_react33.useState)(false);
8006
8054
  const handleCopy = async () => {
8007
8055
  onShare?.("copy");
8008
8056
  try {
@@ -8094,7 +8142,7 @@ var FeatureBlogPage = ({
8094
8142
  copiedLabel = "Copied!",
8095
8143
  className
8096
8144
  }) => {
8097
- const headingIds = (0, import_react32.useMemo)(() => {
8145
+ const headingIds = (0, import_react33.useMemo)(() => {
8098
8146
  const seen = /* @__PURE__ */ new Map();
8099
8147
  const ids = /* @__PURE__ */ new Map();
8100
8148
  content.forEach((block, i) => {
@@ -8106,14 +8154,14 @@ var FeatureBlogPage = ({
8106
8154
  });
8107
8155
  return ids;
8108
8156
  }, [content]);
8109
- const headings = (0, import_react32.useMemo)(
8157
+ const headings = (0, import_react33.useMemo)(
8110
8158
  () => content.map((block, i) => ({ block, i })).filter(
8111
8159
  ({ block }) => block.type === "steps" || block.type === "heading" && (block.level ?? 2) === 2
8112
8160
  ).map(({ block, i }) => ({ id: headingIds.get(i), text: block.text ?? "" })),
8113
8161
  [content, headingIds]
8114
8162
  );
8115
- const [activeId, setActiveId] = (0, import_react32.useState)(null);
8116
- (0, import_react32.useEffect)(() => {
8163
+ const [activeId, setActiveId] = (0, import_react33.useState)(null);
8164
+ (0, import_react33.useEffect)(() => {
8117
8165
  if (typeof IntersectionObserver === "undefined" || headings.length === 0) return;
8118
8166
  const elements = headings.map((heading) => document.getElementById(heading.id)).filter((el) => el !== null);
8119
8167
  if (elements.length === 0) return;
@@ -8218,7 +8266,7 @@ var FeatureBlogPage = ({
8218
8266
  };
8219
8267
 
8220
8268
  // templates/ParallaxBanner/ParallaxBanner.tsx
8221
- var import_react33 = require("react");
8269
+ var import_react34 = require("react");
8222
8270
  var import_framer_motion5 = require("framer-motion");
8223
8271
  var import_jsx_runtime59 = require("react/jsx-runtime");
8224
8272
  var PARALLAX_BANNER_TEXT_CONTENT = {
@@ -8261,7 +8309,7 @@ var ParallaxBanner = ({
8261
8309
  className,
8262
8310
  ...props
8263
8311
  }) => {
8264
- const sectionRef = (0, import_react33.useRef)(null);
8312
+ const sectionRef = (0, import_react34.useRef)(null);
8265
8313
  const prefersReducedMotion = (0, import_framer_motion5.useReducedMotion)();
8266
8314
  const parallaxActive = enableParallax && !prefersReducedMotion;
8267
8315
  const showCards = variant !== "banner-only" && cards.length > 0;
@@ -8327,7 +8375,7 @@ var ParallaxBanner = ({
8327
8375
  };
8328
8376
 
8329
8377
  // templates/TradingCalculator/TradingCalculator.tsx
8330
- var import_react34 = require("react");
8378
+ var import_react35 = require("react");
8331
8379
 
8332
8380
  // templates/TradingCalculator/TradingCalculator.types.ts
8333
8381
  var DEFAULT_TRADING_CALCULATOR_LABELS = {
@@ -8412,13 +8460,13 @@ function computeResults(symbol, volumeInLots, assetPrice, rates) {
8412
8460
  return { marginRequired, tradeVolume, pipValue, swapChargeLong, swapChargeShort };
8413
8461
  }
8414
8462
  function useExchangeRates(wsUrl) {
8415
- const socketRef = (0, import_react34.useRef)(null);
8416
- const reqIdRef = (0, import_react34.useRef)(1);
8417
- const pendingRef = (0, import_react34.useRef)(
8463
+ const socketRef = (0, import_react35.useRef)(null);
8464
+ const reqIdRef = (0, import_react35.useRef)(1);
8465
+ const pendingRef = (0, import_react35.useRef)(
8418
8466
  /* @__PURE__ */ new Map()
8419
8467
  );
8420
- const cacheRef = (0, import_react34.useRef)(/* @__PURE__ */ new Map());
8421
- (0, import_react34.useEffect)(() => {
8468
+ const cacheRef = (0, import_react35.useRef)(/* @__PURE__ */ new Map());
8469
+ (0, import_react35.useEffect)(() => {
8422
8470
  const pending = pendingRef.current;
8423
8471
  return () => {
8424
8472
  socketRef.current?.close();
@@ -8427,7 +8475,7 @@ function useExchangeRates(wsUrl) {
8427
8475
  pending.clear();
8428
8476
  };
8429
8477
  }, [wsUrl]);
8430
- const getRates = (0, import_react34.useCallback)(
8478
+ const getRates = (0, import_react35.useCallback)(
8431
8479
  (baseCurrency) => {
8432
8480
  if (!wsUrl) return Promise.reject(new Error("Live exchange rate conversion is disabled"));
8433
8481
  const cached = cacheRef.current.get(baseCurrency);
@@ -8489,11 +8537,11 @@ function useExchangeRates(wsUrl) {
8489
8537
  return getRates;
8490
8538
  }
8491
8539
  function useSymbols(symbolsProp, endpoint) {
8492
- const [state, setState] = (0, import_react34.useState)(
8540
+ const [state, setState] = (0, import_react35.useState)(
8493
8541
  symbolsProp ? { status: "ready", data: symbolsProp } : { status: "loading" }
8494
8542
  );
8495
- const [retryToken, setRetryToken] = (0, import_react34.useState)(0);
8496
- (0, import_react34.useEffect)(() => {
8543
+ const [retryToken, setRetryToken] = (0, import_react35.useState)(0);
8544
+ (0, import_react35.useEffect)(() => {
8497
8545
  if (symbolsProp) {
8498
8546
  setState({ status: "ready", data: symbolsProp });
8499
8547
  return;
@@ -8515,7 +8563,7 @@ function useSymbols(symbolsProp, endpoint) {
8515
8563
  cancelled = true;
8516
8564
  };
8517
8565
  }, [symbolsProp, endpoint, retryToken]);
8518
- const retry = (0, import_react34.useCallback)(() => setRetryToken((n) => n + 1), []);
8566
+ const retry = (0, import_react35.useCallback)(() => setRetryToken((n) => n + 1), []);
8519
8567
  return [state, retry];
8520
8568
  }
8521
8569
  var ErrorIcon = () => /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
@@ -8545,24 +8593,24 @@ var SymbolCombobox = ({
8545
8593
  inputId,
8546
8594
  copy
8547
8595
  }) => {
8548
- const [query, setQuery] = (0, import_react34.useState)("");
8549
- const [isOpen, setIsOpen] = (0, import_react34.useState)(false);
8550
- const [activeIndex, setActiveIndex] = (0, import_react34.useState)(-1);
8551
- const wrapperRef = (0, import_react34.useRef)(null);
8552
- const listboxId = (0, import_react34.useId)();
8596
+ const [query, setQuery] = (0, import_react35.useState)("");
8597
+ const [isOpen, setIsOpen] = (0, import_react35.useState)(false);
8598
+ const [activeIndex, setActiveIndex] = (0, import_react35.useState)(-1);
8599
+ const wrapperRef = (0, import_react35.useRef)(null);
8600
+ const listboxId = (0, import_react35.useId)();
8553
8601
  const isLoading = symbolsState.status === "loading";
8554
8602
  const isError = symbolsState.status === "error";
8555
8603
  const allSymbols = symbolsState.status === "ready" ? symbolsState.data : [];
8556
- const filtered = (0, import_react34.useMemo)(() => {
8604
+ const filtered = (0, import_react35.useMemo)(() => {
8557
8605
  const term = query.trim().toLowerCase();
8558
8606
  if (!term) return allSymbols;
8559
8607
  return allSymbols.filter(
8560
8608
  (item) => item.symbol.toLowerCase().includes(term) || item.description.toLowerCase().includes(term) || item.asset_class.toLowerCase().includes(term)
8561
8609
  );
8562
8610
  }, [allSymbols, query]);
8563
- const grouped = (0, import_react34.useMemo)(() => groupByAssetClass(filtered), [filtered]);
8564
- const flatOptions = (0, import_react34.useMemo)(() => grouped.flatMap(([, items]) => items), [grouped]);
8565
- (0, import_react34.useEffect)(() => {
8611
+ const grouped = (0, import_react35.useMemo)(() => groupByAssetClass(filtered), [filtered]);
8612
+ const flatOptions = (0, import_react35.useMemo)(() => grouped.flatMap(([, items]) => items), [grouped]);
8613
+ (0, import_react35.useEffect)(() => {
8566
8614
  if (!isOpen) return;
8567
8615
  const handlePointerDown = (event) => {
8568
8616
  if (wrapperRef.current && !wrapperRef.current.contains(event.target)) {
@@ -8704,15 +8752,15 @@ var TradingCalculator = ({
8704
8752
  const showTradeVolume = variant === "main";
8705
8753
  const [symbolsState, retrySymbols] = useSymbols(symbolsProp, symbolsEndpoint);
8706
8754
  const getRates = useExchangeRates(exchangeRateWsUrl);
8707
- const [selectedSymbol, setSelectedSymbol] = (0, import_react34.useState)(null);
8708
- const [volumeInLots, setVolumeInLots] = (0, import_react34.useState)("");
8709
- const [assetPrice, setAssetPrice] = (0, import_react34.useState)("");
8710
- const [errors, setErrors] = (0, import_react34.useState)({});
8711
- const [results, setResults] = (0, import_react34.useState)(null);
8712
- const [isCalculating, setIsCalculating] = (0, import_react34.useState)(false);
8713
- const [calcError, setCalcError] = (0, import_react34.useState)(null);
8714
- const didPreselect = (0, import_react34.useRef)(false);
8715
- (0, import_react34.useEffect)(() => {
8755
+ const [selectedSymbol, setSelectedSymbol] = (0, import_react35.useState)(null);
8756
+ const [volumeInLots, setVolumeInLots] = (0, import_react35.useState)("");
8757
+ const [assetPrice, setAssetPrice] = (0, import_react35.useState)("");
8758
+ const [errors, setErrors] = (0, import_react35.useState)({});
8759
+ const [results, setResults] = (0, import_react35.useState)(null);
8760
+ const [isCalculating, setIsCalculating] = (0, import_react35.useState)(false);
8761
+ const [calcError, setCalcError] = (0, import_react35.useState)(null);
8762
+ const didPreselect = (0, import_react35.useRef)(false);
8763
+ (0, import_react35.useEffect)(() => {
8716
8764
  if (didPreselect.current || !defaultSymbol || symbolsState.status !== "ready") return;
8717
8765
  const match = symbolsState.data.find((item) => item.symbol === defaultSymbol);
8718
8766
  if (match) {
@@ -8769,9 +8817,9 @@ var TradingCalculator = ({
8769
8817
  setIsCalculating(false);
8770
8818
  }
8771
8819
  };
8772
- const symbolInputId = (0, import_react34.useId)();
8773
- const volumeInputId = (0, import_react34.useId)();
8774
- const priceInputId = (0, import_react34.useId)();
8820
+ const symbolInputId = (0, import_react35.useId)();
8821
+ const volumeInputId = (0, import_react35.useId)();
8822
+ const priceInputId = (0, import_react35.useId)();
8775
8823
  return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("section", { className: ["tcalc-section", className ?? ""].filter(Boolean).join(" "), ...props, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "tcalc-container", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "tcalc-card", children: [
8776
8824
  /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "tcalc-column", children: [
8777
8825
  /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("h3", { className: "tcalc-panelTitle", children: copy.calculatorPanel }),
@@ -8922,7 +8970,7 @@ var TradingCalculator = ({
8922
8970
  };
8923
8971
 
8924
8972
  // templates/TradingCalculatorHowTo/TradingCalculatorHowTo.tsx
8925
- var import_react35 = require("react");
8973
+ var import_react36 = require("react");
8926
8974
 
8927
8975
  // templates/TradingCalculatorHowTo/TradingCalculatorHowTo.types.ts
8928
8976
  var DEFAULT_TRADING_CALCULATOR_HOWTO_LABELS = {
@@ -9123,7 +9171,7 @@ function swapTabsForLabels(labels) {
9123
9171
  { id: "percentage", label: percentage }
9124
9172
  ];
9125
9173
  }
9126
- var useIsomorphicLayoutEffect = typeof window !== "undefined" ? import_react35.useLayoutEffect : import_react35.useEffect;
9174
+ var useIsomorphicLayoutEffect = typeof window !== "undefined" ? import_react36.useLayoutEffect : import_react36.useEffect;
9127
9175
  var FormulaBlockView = ({ block }) => {
9128
9176
  if (block.type === "footnote") {
9129
9177
  return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("p", { className: "tchow-footnote", children: block.content });
@@ -9145,9 +9193,9 @@ var ConnectorArrow = () => /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("svg",
9145
9193
  /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("path", { d: "M1.4 5.6L4 8.6L6.6 5.6", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round" })
9146
9194
  ] });
9147
9195
  var CalculationStrip = ({ tokens }) => {
9148
- const wrapperRef = (0, import_react35.useRef)(null);
9149
- const stripRef = (0, import_react35.useRef)(null);
9150
- const [fit, setFit] = (0, import_react35.useState)({ scale: 1, naturalHeight: 0 });
9196
+ const wrapperRef = (0, import_react36.useRef)(null);
9197
+ const stripRef = (0, import_react36.useRef)(null);
9198
+ const [fit, setFit] = (0, import_react36.useState)({ scale: 1, naturalHeight: 0 });
9151
9199
  useIsomorphicLayoutEffect(() => {
9152
9200
  const wrapper = wrapperRef.current;
9153
9201
  const strip = stripRef.current;
@@ -9184,7 +9232,7 @@ var CalculationStrip = ({ tokens }) => {
9184
9232
  style: isShrunk ? { transform: `scale(${fit.scale})` } : void 0,
9185
9233
  role: "img",
9186
9234
  "aria-label": tokens.map((token) => token.text).join(" "),
9187
- children: tokens.map((token, i) => /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_react35.Fragment, { children: [
9235
+ children: tokens.map((token, i) => /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_react36.Fragment, { children: [
9188
9236
  /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
9189
9237
  "span",
9190
9238
  {
@@ -9231,8 +9279,8 @@ var TradingCalculatorHowTo = ({
9231
9279
  ...props
9232
9280
  }) => {
9233
9281
  const isSwap = variant === "swap-points" || variant === "swap-percentage";
9234
- const [swapTab, setSwapTab] = (0, import_react35.useState)(() => swapModeForVariant(variant));
9235
- (0, import_react35.useEffect)(() => {
9282
+ const [swapTab, setSwapTab] = (0, import_react36.useState)(() => swapModeForVariant(variant));
9283
+ (0, import_react36.useEffect)(() => {
9236
9284
  setSwapTab(swapModeForVariant(variant));
9237
9285
  }, [variant]);
9238
9286
  const baseContent = variant === "pip" ? PIP_CONTENT : isSwap ? swapTab === "percentage" ? SWAP_PERCENTAGE_CONTENT : SWAP_POINTS_CONTENT : MARGIN_CONTENT;
@@ -9275,7 +9323,7 @@ var TradingCalculatorHowTo = ({
9275
9323
  };
9276
9324
 
9277
9325
  // templates/CryptoTradeConverter/CryptoTradeConverter.tsx
9278
- var import_react37 = require("react");
9326
+ var import_react38 = require("react");
9279
9327
 
9280
9328
  // templates/cryptoMarketData/origins.ts
9281
9329
  var DEFAULT_API_ORIGIN = "https://deriv.exchange";
@@ -10110,7 +10158,7 @@ function getSharedMarketDataClient(apiOrigin) {
10110
10158
  }
10111
10159
 
10112
10160
  // templates/cryptoMarketData/useCryptoMarketData.ts
10113
- var import_react36 = require("react");
10161
+ var import_react37 = require("react");
10114
10162
  var EMPTY = {
10115
10163
  kind: "spot",
10116
10164
  status: "idle",
@@ -10123,8 +10171,8 @@ var EMPTY = {
10123
10171
  };
10124
10172
  function useCryptoMarketData(options) {
10125
10173
  const { kind, kline, apiOrigin, enabled = true } = options;
10126
- const [snapshot, setSnapshot] = (0, import_react36.useState)({ ...EMPTY, kind });
10127
- (0, import_react36.useEffect)(() => {
10174
+ const [snapshot, setSnapshot] = (0, import_react37.useState)({ ...EMPTY, kind });
10175
+ (0, import_react37.useEffect)(() => {
10128
10176
  if (!enabled || typeof window === "undefined") return;
10129
10177
  const client = getSharedMarketDataClient(apiOrigin);
10130
10178
  return client.subscribe({ kind, kline }, setSnapshot);
@@ -10174,7 +10222,7 @@ function matchPair(rows, defaultPair) {
10174
10222
  return rows.find((r) => r.id === needle) ?? rows.find((r) => r.name.toLowerCase() === needle) ?? rows.find((r) => r.name.replace("/", "").toLowerCase() === needle.replace("/", "")) ?? rows[0] ?? null;
10175
10223
  }
10176
10224
  function CoinAvatar({ base, icon, label }) {
10177
- const [failed, setFailed] = (0, import_react37.useState)(false);
10225
+ const [failed, setFailed] = (0, import_react38.useState)(false);
10178
10226
  if (failed) {
10179
10227
  return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "ctc-avatar ctc-avatar--fallback", "aria-hidden": "true", children: base.slice(0, 3) });
10180
10228
  }
@@ -10223,28 +10271,28 @@ var CryptoTradeConverter = ({
10223
10271
  className
10224
10272
  }) => {
10225
10273
  const copy = mergeLabels2(labelsProp);
10226
- const reactId = (0, import_react37.useId)().replace(/:/g, "");
10274
+ const reactId = (0, import_react38.useId)().replace(/:/g, "");
10227
10275
  const listboxId = `ctc-listbox-${reactId}`;
10228
10276
  const payId = `ctc-pay-${reactId}`;
10229
10277
  const receiveId = `ctc-receive-${reactId}`;
10230
10278
  const statusId = `ctc-status-${reactId}`;
10231
10279
  const snapshot = useCryptoMarketData({ kind: "spot", kline: false, apiOrigin });
10232
- const rows = (0, import_react37.useMemo)(() => [...snapshot.rows.values()], [snapshot.rows]);
10233
- const [side, setSide] = (0, import_react37.useState)("buy");
10234
- const [selectedId, setSelectedId] = (0, import_react37.useState)(null);
10235
- const [pay, setPay] = (0, import_react37.useState)("");
10236
- const [receive, setReceive] = (0, import_react37.useState)("");
10237
- const [edited, setEdited] = (0, import_react37.useState)("pay");
10238
- const [pickerOpen, setPickerOpen] = (0, import_react37.useState)(false);
10239
- const [activeOption, setActiveOption] = (0, import_react37.useState)(0);
10240
- const rootRef = (0, import_react37.useRef)(null);
10241
- const buttonRef = (0, import_react37.useRef)(null);
10242
- const listRef = (0, import_react37.useRef)(null);
10280
+ const rows = (0, import_react38.useMemo)(() => [...snapshot.rows.values()], [snapshot.rows]);
10281
+ const [side, setSide] = (0, import_react38.useState)("buy");
10282
+ const [selectedId, setSelectedId] = (0, import_react38.useState)(null);
10283
+ const [pay, setPay] = (0, import_react38.useState)("");
10284
+ const [receive, setReceive] = (0, import_react38.useState)("");
10285
+ const [edited, setEdited] = (0, import_react38.useState)("pay");
10286
+ const [pickerOpen, setPickerOpen] = (0, import_react38.useState)(false);
10287
+ const [activeOption, setActiveOption] = (0, import_react38.useState)(0);
10288
+ const rootRef = (0, import_react38.useRef)(null);
10289
+ const buttonRef = (0, import_react38.useRef)(null);
10290
+ const listRef = (0, import_react38.useRef)(null);
10243
10291
  const selected = (selectedId ? rows.find((r) => r.id === selectedId) : null) ?? matchPair(rows, defaultPair);
10244
- (0, import_react37.useEffect)(() => {
10292
+ (0, import_react38.useEffect)(() => {
10245
10293
  if (!selectedId && selected) setSelectedId(selected.id);
10246
10294
  }, [selected, selectedId]);
10247
- const conversion = (0, import_react37.useMemo)(
10295
+ const conversion = (0, import_react38.useMemo)(
10248
10296
  () => convertAmounts({
10249
10297
  side,
10250
10298
  price: selected?.last ?? null,
@@ -10258,16 +10306,16 @@ var CryptoTradeConverter = ({
10258
10306
  }),
10259
10307
  [side, selected?.last, pay, receive, edited, copy.waitingForPrice, copy.invalidAmount]
10260
10308
  );
10261
- (0, import_react37.useEffect)(() => {
10309
+ (0, import_react38.useEffect)(() => {
10262
10310
  if (edited === "pay") setReceive(conversion.receive);
10263
10311
  else setPay(conversion.pay);
10264
10312
  }, [conversion.pay, conversion.receive, edited]);
10265
10313
  const labels = currenciesForSide(side, selected?.base ?? "\u2014", selected?.quote ?? "\u2014");
10266
- const closePicker = (0, import_react37.useCallback)(() => {
10314
+ const closePicker = (0, import_react38.useCallback)(() => {
10267
10315
  setPickerOpen(false);
10268
10316
  buttonRef.current?.focus();
10269
10317
  }, []);
10270
- (0, import_react37.useEffect)(() => {
10318
+ (0, import_react38.useEffect)(() => {
10271
10319
  if (!pickerOpen) return;
10272
10320
  const onDoc = (event) => {
10273
10321
  if (!rootRef.current?.contains(event.target)) setPickerOpen(false);
@@ -10285,7 +10333,7 @@ var CryptoTradeConverter = ({
10285
10333
  document.removeEventListener("keydown", onKey);
10286
10334
  };
10287
10335
  }, [pickerOpen, closePicker]);
10288
- const sortedRows = (0, import_react37.useMemo)(
10336
+ const sortedRows = (0, import_react38.useMemo)(
10289
10337
  () => [...rows].sort((a, b) => a.name.localeCompare(b.name)),
10290
10338
  [rows]
10291
10339
  );
@@ -10315,7 +10363,7 @@ var CryptoTradeConverter = ({
10315
10363
  closePicker();
10316
10364
  }
10317
10365
  };
10318
- (0, import_react37.useEffect)(() => {
10366
+ (0, import_react38.useEffect)(() => {
10319
10367
  if (!pickerOpen) return;
10320
10368
  listRef.current?.querySelectorAll('[role="option"]')[activeOption]?.scrollIntoView({
10321
10369
  block: "nearest"
@@ -10577,7 +10625,7 @@ var CryptoTradeConverter = ({
10577
10625
  };
10578
10626
 
10579
10627
  // templates/CryptoMarketsTable/CryptoMarketsTable.tsx
10580
- var import_react38 = require("react");
10628
+ var import_react39 = require("react");
10581
10629
 
10582
10630
  // templates/CryptoMarketsTable/CryptoMarketsTable.types.ts
10583
10631
  var DEFAULT_CRYPTO_MARKETS_TABLE_TITLE = "Explore the markets";
@@ -10610,7 +10658,7 @@ function mergeLabels3(overrides) {
10610
10658
  return { ...DEFAULT_CRYPTO_MARKETS_TABLE_LABELS, ...overrides };
10611
10659
  }
10612
10660
  function CoinAvatar2({ base, icon }) {
10613
- const [failed, setFailed] = (0, import_react38.useState)(false);
10661
+ const [failed, setFailed] = (0, import_react39.useState)(false);
10614
10662
  if (failed) {
10615
10663
  return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "cmt-avatar cmt-avatar--fallback", "aria-hidden": "true", children: base.slice(0, 3) });
10616
10664
  }
@@ -10634,8 +10682,8 @@ function Sparkline({
10634
10682
  label,
10635
10683
  reducedMotion
10636
10684
  }) {
10637
- const canvasRef = (0, import_react38.useRef)(null);
10638
- (0, import_react38.useEffect)(() => {
10685
+ const canvasRef = (0, import_react39.useRef)(null);
10686
+ (0, import_react39.useEffect)(() => {
10639
10687
  const canvas = canvasRef.current;
10640
10688
  if (!canvas) return;
10641
10689
  const points = values.map(Number).filter(Number.isFinite);
@@ -10719,16 +10767,16 @@ var CryptoMarketsTable = ({
10719
10767
  className
10720
10768
  }) => {
10721
10769
  const copy = mergeLabels3(labelsProp);
10722
- const reactId = (0, import_react38.useId)().replace(/:/g, "");
10723
- const [kind, setKind] = (0, import_react38.useState)(initialMarket);
10724
- const [quote, setQuote] = (0, import_react38.useState)(initialQuoteCurrency.toUpperCase());
10725
- const [sortKey, setSortKey] = (0, import_react38.useState)("last");
10726
- const [sortDir, setSortDir] = (0, import_react38.useState)("desc");
10727
- const [reducedMotion, setReducedMotion] = (0, import_react38.useState)(false);
10728
- const scrollRef = (0, import_react38.useRef)(null);
10729
- const [scrolled, setScrolled] = (0, import_react38.useState)(false);
10770
+ const reactId = (0, import_react39.useId)().replace(/:/g, "");
10771
+ const [kind, setKind] = (0, import_react39.useState)(initialMarket);
10772
+ const [quote, setQuote] = (0, import_react39.useState)(initialQuoteCurrency.toUpperCase());
10773
+ const [sortKey, setSortKey] = (0, import_react39.useState)("last");
10774
+ const [sortDir, setSortDir] = (0, import_react39.useState)("desc");
10775
+ const [reducedMotion, setReducedMotion] = (0, import_react39.useState)(false);
10776
+ const scrollRef = (0, import_react39.useRef)(null);
10777
+ const [scrolled, setScrolled] = (0, import_react39.useState)(false);
10730
10778
  const snapshot = useCryptoMarketData({ kind, kline: true, apiOrigin });
10731
- (0, import_react38.useEffect)(() => {
10779
+ (0, import_react39.useEffect)(() => {
10732
10780
  if (typeof window === "undefined") return;
10733
10781
  const mq = window.matchMedia("(prefers-reduced-motion: reduce)");
10734
10782
  const update = () => setReducedMotion(mq.matches);
@@ -10736,7 +10784,7 @@ var CryptoMarketsTable = ({
10736
10784
  mq.addEventListener?.("change", update);
10737
10785
  return () => mq.removeEventListener?.("change", update);
10738
10786
  }, []);
10739
- (0, import_react38.useEffect)(() => {
10787
+ (0, import_react39.useEffect)(() => {
10740
10788
  const node = scrollRef.current;
10741
10789
  if (!node) return;
10742
10790
  const onScroll = () => setScrolled(node.scrollLeft > 0);
@@ -10744,12 +10792,12 @@ var CryptoMarketsTable = ({
10744
10792
  node.addEventListener("scroll", onScroll, { passive: true });
10745
10793
  return () => node.removeEventListener("scroll", onScroll);
10746
10794
  }, []);
10747
- (0, import_react38.useEffect)(() => {
10795
+ (0, import_react39.useEffect)(() => {
10748
10796
  if (snapshot.quotes.length && !snapshot.quotes.includes(quote)) {
10749
10797
  setQuote(snapshot.quotes[0]);
10750
10798
  }
10751
10799
  }, [snapshot.quotes, quote]);
10752
- const filtered = (0, import_react38.useMemo)(() => {
10800
+ const filtered = (0, import_react39.useMemo)(() => {
10753
10801
  const rows = [...snapshot.rows.values()].filter(
10754
10802
  (row) => row.quote.toUpperCase() === quote.toUpperCase()
10755
10803
  );
@@ -10884,7 +10932,7 @@ var CryptoMarketsTable = ({
10884
10932
  };
10885
10933
 
10886
10934
  // templates/FeatureOffices/FeatureOffices.tsx
10887
- var import_react39 = require("react");
10935
+ var import_react40 = require("react");
10888
10936
  var import_jsx_runtime64 = require("react/jsx-runtime");
10889
10937
  var isExternalUrl2 = (href) => Boolean(href && /^https?:\/\//i.test(href));
10890
10938
  var FEATURE_OFFICES_TEXT_CONTENT = {
@@ -10938,12 +10986,12 @@ var FeatureOffices = ({
10938
10986
  className,
10939
10987
  ...props
10940
10988
  }) => {
10941
- const [internalActiveId, setInternalActiveId] = (0, import_react39.useState)(
10989
+ const [internalActiveId, setInternalActiveId] = (0, import_react40.useState)(
10942
10990
  defaultActiveRegionId ?? regions[0]?.id
10943
10991
  );
10944
10992
  const isControlled = activeRegionId !== void 0;
10945
10993
  const activeId = isControlled ? activeRegionId : internalActiveId;
10946
- const filteredOffices = (0, import_react39.useMemo)(
10994
+ const filteredOffices = (0, import_react40.useMemo)(
10947
10995
  () => offices.filter((office) => office.region === activeId),
10948
10996
  [offices, activeId]
10949
10997
  );
@@ -11201,7 +11249,7 @@ var ResourceBanner = ({
11201
11249
  };
11202
11250
 
11203
11251
  // templates/OptionsTypes/OptionsTypes.tsx
11204
- var import_react40 = require("react");
11252
+ var import_react41 = require("react");
11205
11253
  var import_jsx_runtime69 = require("react/jsx-runtime");
11206
11254
  var OPTIONS_TYPES_PLACEHOLDER_ITEMS = [
11207
11255
  {
@@ -11408,10 +11456,10 @@ function TogglePanel({
11408
11456
  setPlaying
11409
11457
  }) {
11410
11458
  const animations = item.animations;
11411
- const [activeIndex, setActiveIndex] = (0, import_react40.useState)(0);
11412
- const switchRefs = (0, import_react40.useRef)([]);
11459
+ const [activeIndex, setActiveIndex] = (0, import_react41.useState)(0);
11460
+ const switchRefs = (0, import_react41.useRef)([]);
11413
11461
  const safeIndex = Math.min(activeIndex, Math.max(animations.length - 1, 0));
11414
- (0, import_react40.useEffect)(() => {
11462
+ (0, import_react41.useEffect)(() => {
11415
11463
  setPlaying({});
11416
11464
  }, [safeIndex, setPlaying]);
11417
11465
  const hasMarkets = Boolean(item.markets && item.markets.length > 0);
@@ -11534,15 +11582,15 @@ function OptionsTypes({
11534
11582
  ...props
11535
11583
  }) {
11536
11584
  const usableItems = Array.isArray(items) ? items.filter((item) => item?.id) : [];
11537
- const [internalActiveId, setInternalActiveId] = (0, import_react40.useState)(
11585
+ const [internalActiveId, setInternalActiveId] = (0, import_react41.useState)(
11538
11586
  defaultActiveId ?? usableItems[0]?.id ?? ""
11539
11587
  );
11540
11588
  const selectedId = usableItems.find((item) => item.id === activeId)?.id ?? usableItems.find((item) => item.id === internalActiveId)?.id ?? usableItems[0]?.id ?? "";
11541
- const [playing, setPlaying] = (0, import_react40.useState)({});
11542
- const generatedId = (0, import_react40.useId)().replace(/:/g, "");
11589
+ const [playing, setPlaying] = (0, import_react41.useState)({});
11590
+ const generatedId = (0, import_react41.useId)().replace(/:/g, "");
11543
11591
  const tabPrefix = `options-types-${generatedId}`;
11544
11592
  const Heading = headingLevel;
11545
- (0, import_react40.useEffect)(() => {
11593
+ (0, import_react41.useEffect)(() => {
11546
11594
  setPlaying({});
11547
11595
  }, [selectedId]);
11548
11596
  const selectItem = (id) => {
@@ -11958,7 +12006,7 @@ var CountryLinkGrid = ({
11958
12006
  };
11959
12007
 
11960
12008
  // templates/DocumentChips/DocumentChips.tsx
11961
- var import_react41 = require("react");
12009
+ var import_react42 = require("react");
11962
12010
  var import_jsx_runtime72 = require("react/jsx-runtime");
11963
12011
  var DEFAULT_GROUPS = [
11964
12012
  {
@@ -12062,7 +12110,7 @@ var DocumentChips = ({
12062
12110
  }) => {
12063
12111
  const resolvedGroups = groups && groups.length > 0 ? groups : DEFAULT_GROUPS;
12064
12112
  const groupKeys = resolvedGroups.map((group, i) => String(group.id ?? i));
12065
- const [openKeys, setOpenKeys] = (0, import_react41.useState)(void 0);
12113
+ const [openKeys, setOpenKeys] = (0, import_react42.useState)(void 0);
12066
12114
  const resolvedOpenKeys = openKeys === void 0 ? groupKeys.slice(0, 1) : openKeys;
12067
12115
  const handleToggle = (key, next) => {
12068
12116
  setOpenKeys((current) => {
@@ -12113,7 +12161,7 @@ var DocumentChips = ({
12113
12161
  };
12114
12162
 
12115
12163
  // components/LinkModal/LinkModal.tsx
12116
- var import_react42 = require("react");
12164
+ var import_react43 = require("react");
12117
12165
  var import_react_dom2 = require("react-dom");
12118
12166
  var import_jsx_runtime73 = require("react/jsx-runtime");
12119
12167
  var XMarkIcon3 = () => /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
@@ -12155,17 +12203,17 @@ var LinkModal = ({
12155
12203
  className,
12156
12204
  ...props
12157
12205
  }) => {
12158
- const titleId = (0, import_react42.useId)();
12159
- const panelRef = (0, import_react42.useRef)(null);
12160
- const triggerRef = (0, import_react42.useRef)(null);
12161
- const getFocusable = (0, import_react42.useCallback)(() => {
12206
+ const titleId = (0, import_react43.useId)();
12207
+ const panelRef = (0, import_react43.useRef)(null);
12208
+ const triggerRef = (0, import_react43.useRef)(null);
12209
+ const getFocusable = (0, import_react43.useCallback)(() => {
12162
12210
  const panel = panelRef.current;
12163
12211
  if (!panel) return [];
12164
12212
  return Array.from(panel.querySelectorAll(FOCUSABLE_SELECTOR)).filter(
12165
12213
  (el) => el.offsetParent !== null || el === document.activeElement
12166
12214
  );
12167
12215
  }, []);
12168
- (0, import_react42.useEffect)(() => {
12216
+ (0, import_react43.useEffect)(() => {
12169
12217
  if (!open || typeof document === "undefined") return;
12170
12218
  triggerRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
12171
12219
  panelRef.current?.focus();
@@ -12175,7 +12223,7 @@ var LinkModal = ({
12175
12223
  if (trigger && document.contains(trigger)) trigger.focus();
12176
12224
  };
12177
12225
  }, [open]);
12178
- (0, import_react42.useEffect)(() => {
12226
+ (0, import_react43.useEffect)(() => {
12179
12227
  if (!open || typeof document === "undefined") return;
12180
12228
  const handleKeyDown = (event) => {
12181
12229
  if (event.key === "Escape") {
@@ -12186,7 +12234,7 @@ var LinkModal = ({
12186
12234
  document.addEventListener("keydown", handleKeyDown);
12187
12235
  return () => document.removeEventListener("keydown", handleKeyDown);
12188
12236
  }, [open, onClose]);
12189
- (0, import_react42.useEffect)(() => {
12237
+ (0, import_react43.useEffect)(() => {
12190
12238
  if (!open || typeof document === "undefined") return;
12191
12239
  const body = document.body;
12192
12240
  const previousOverflow = body.style.overflow;
@@ -12326,7 +12374,7 @@ var LanguageSelectModal = ({
12326
12374
  };
12327
12375
 
12328
12376
  // templates/AffiliatesSlider/AffiliatesSlider.tsx
12329
- var import_react43 = require("react");
12377
+ var import_react44 = require("react");
12330
12378
  var import_jsx_runtime75 = require("react/jsx-runtime");
12331
12379
  var ArrowIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
12332
12380
  "svg",
@@ -12411,16 +12459,16 @@ var AffiliatesSlider = ({
12411
12459
  className,
12412
12460
  ...props
12413
12461
  }) => {
12414
- const [internalValue, setInternalValue] = (0, import_react43.useState)(defaultValue);
12462
+ const [internalValue, setInternalValue] = (0, import_react44.useState)(defaultValue);
12415
12463
  const currentValue = value ?? internalValue;
12416
- const handleChange = (0, import_react43.useCallback)(
12464
+ const handleChange = (0, import_react44.useCallback)(
12417
12465
  (next) => {
12418
12466
  if (value === void 0) setInternalValue(next);
12419
12467
  onValueChange?.(next);
12420
12468
  },
12421
12469
  [onValueChange, value]
12422
12470
  );
12423
- const ticks = (0, import_react43.useMemo)(
12471
+ const ticks = (0, import_react44.useMemo)(
12424
12472
  () => tickValues ?? buildDefaultTicks(min, max),
12425
12473
  [max, min, tickValues]
12426
12474
  );