@mattilsynet/design 1.3.2 → 1.3.4

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.
@@ -1,17 +1,17 @@
1
1
  import m from "../styles.module.css.js";
2
- import { onLoaded as C, onMutation as T, on as r, QUICK_EVENT as p, debounce as P } from "../utils.js";
3
- import "./app-toggle2.js";
2
+ import { onLoaded as C, onMutation as T, on as p, QUICK_EVENT as c, debounce as P } from "../utils.js";
3
+ import "./app-toggle.js";
4
4
  const f = m.app.split(" ")[0], _ = m.sticky.split(" ")[0], h = '[data-command="toggle-app-expanded"]', g = `.${f} > dialog,.${f} dialog ~ main`, S = (t) => {
5
5
  document.startViewTransition ? document.startViewTransition(t) : t();
6
6
  }, E = (t) => (
7
7
  // @ts-expect-error window.mtdsAppToggle comes from app-toggle.js
8
8
  S(() => {
9
- var o;
10
- return (o = window.mtdsToggleAppExpanded) == null ? void 0 : o.call(window, t);
9
+ var i;
10
+ return (i = window.mtdsToggleAppExpanded) == null ? void 0 : i.call(window, t);
11
11
  })
12
12
  );
13
- function x({ target: t }) {
14
- if (!(!(t instanceof HTMLButtonElement) || !t.matches(h))) {
13
+ function x({ target: t, defaultPrevented: i }) {
14
+ if (!(i || !(t instanceof HTMLButtonElement) || !t.matches(h))) {
15
15
  if (getComputedStyle(t).position === "sticky") return E();
16
16
  S(() => {
17
17
  const o = document.querySelector(g);
@@ -23,18 +23,18 @@ function I() {
23
23
  var t;
24
24
  (t = document.querySelector(g)) == null || t.close();
25
25
  }
26
- let c = 0, s, n = 0, e, d = 0, l = 0, a = !1, u = 0, i = 0;
26
+ let d = 0, l, n = 0, e, a = 0, r = 0, u = !1, y = 0, s = 0;
27
27
  function H([t]) {
28
28
  e = t, w();
29
29
  }
30
30
  function w() {
31
- var y;
31
+ var o;
32
32
  if (!(e != null && e.isConnected)) return;
33
- const t = window.scrollY, o = t < i;
34
- i = t, o !== s && (c = (((y = e.parentElement) == null ? void 0 : y.getBoundingClientRect().top) || 0) + i, s = o, d = e.offsetHeight, l = e.getBoundingClientRect().top + i, a = e.offsetHeight <= window.innerHeight, u = window.innerHeight), !(n === -1 && a) && (n !== -1 && (a || s && i <= l) ? (e.style.setProperty("--pos", "sticky"), e.style.setProperty("--top", "0px"), n = -1) : n === -1 && !s ? (e.style.setProperty("--pos", "relative"), e.style.setProperty("--top", `${Math.max(0, i - c)}px`), n = 0) : n !== 1 && !s && i + u >= l + d ? (e.style.setProperty("--pos", "sticky"), e.style.setProperty("--top", `${u - d}px`), n = 1) : n === 1 && s && (e.style.setProperty("--pos", "relative"), e.style.setProperty("--top", `${l - c}px`), n = 0));
33
+ const t = window.scrollY, i = t < s;
34
+ s = t, i !== l && (d = (((o = e.parentElement) == null ? void 0 : o.getBoundingClientRect().top) || 0) + s, l = i, a = e.offsetHeight, r = e.getBoundingClientRect().top + s, u = e.offsetHeight <= window.innerHeight, y = window.innerHeight), !(n === -1 && u) && (n !== -1 && (u || l && s <= r) ? (e.style.setProperty("--pos", "sticky"), e.style.setProperty("--top", "0px"), n = -1) : n === -1 && !l ? (e.style.setProperty("--pos", "relative"), e.style.setProperty("--top", `${Math.max(0, s - d)}px`), n = 0) : n !== 1 && !l && s + y >= r + a ? (e.style.setProperty("--pos", "sticky"), e.style.setProperty("--top", `${y - a}px`), n = 1) : n === 1 && l && (e.style.setProperty("--pos", "relative"), e.style.setProperty("--top", `${r - d}px`), n = 0));
35
35
  }
36
36
  C(() => {
37
- T(document.documentElement, _, H), r(document, "click", x, p), r(window, "resize", P(I, 100), p), r(window, "scroll", w, p);
37
+ T(document.documentElement, _, H), p(document, "click", x, c), p(window, "resize", P(I, 100), c), p(window, "scroll", w, c);
38
38
  });
39
39
  export {
40
40
  E as toggleAppExpanded
@@ -1 +1 @@
1
- {"version":3,"file":"app-observer.js","sources":["../../designsystem/app/app-observer.ts"],"sourcesContent":["import styles from \"../styles.module.css\";\nimport { QUICK_EVENT, debounce, on, onLoaded, onMutation } from \"../utils\";\nimport \"./app-toggle\";\n\nconst CSS_APP = styles.app.split(\" \")[0];\nconst CSS_STICKY = styles.sticky.split(\" \")[0];\nconst CSS_TOGGLE = '[data-command=\"toggle-app-expanded\"]';\nconst CSS_SIDEBAR = `.${CSS_APP} > dialog,.${CSS_APP} dialog ~ main`;\n\nconst useTransition = (callback: () => void) => {\n\tif (!document.startViewTransition) callback();\n\telse document.startViewTransition(callback);\n};\n\nexport const toggleAppExpanded = (force?: boolean) =>\n\t// @ts-expect-error window.mtdsAppToggle comes from app-toggle.js\n\tuseTransition(() => window.mtdsToggleAppExpanded?.(force));\n\nfunction handleToggleClick({ target: el }: Event) {\n\tif (!(el instanceof HTMLButtonElement) || !el.matches(CSS_TOGGLE)) return;\n\tif (getComputedStyle(el).position === \"sticky\") return toggleAppExpanded();\n\tuseTransition(() => {\n\t\tconst sidebar = document.querySelector<HTMLDialogElement>(CSS_SIDEBAR);\n\t\tsidebar?.setAttribute(\"data-closedby\", \"any\"); // Allow closing by clicking outside\n\t\tsidebar?.showModal();\n\t});\n}\n\nfunction handleResize() {\n\tdocument.querySelector<HTMLDialogElement>(CSS_SIDEBAR)?.close();\n}\n\n// Scroll state\nlet MIN_Y = 0; // Offset to avoid scroll jump when sticky is set to relative\nlet SCROLL_UP: boolean;\nlet STICK = 0; // -1 = stick top, 0 = relative, 1 = stick bottom\nlet STICK_EL: HTMLElement;\nlet STICK_H = 0;\nlet STICK_Y = 0;\nlet STUCK = false; // Used to figure if nav is larger than viewport\nlet WIN_H = 0;\nlet WIN_Y = 0;\n\nfunction handleMutation([sticky]: HTMLCollectionOf<HTMLElement>) {\n\tSTICK_EL = sticky;\n\thandleScroll(); // Run on connect\n}\n\nfunction handleScroll() {\n\tif (!STICK_EL?.isConnected) return;\n\tconst NEXT_Y = window.scrollY;\n\tconst NEXT_UP = NEXT_Y < WIN_Y;\n\tWIN_Y = NEXT_Y;\n\n\t// Only calculate if scroll direction has changed\n\tif (NEXT_UP !== SCROLL_UP) {\n\t\tMIN_Y = (STICK_EL.parentElement?.getBoundingClientRect().top || 0) + WIN_Y;\n\t\tSCROLL_UP = NEXT_UP;\n\t\tSTICK_H = STICK_EL.offsetHeight;\n\t\tSTICK_Y = STICK_EL.getBoundingClientRect().top + WIN_Y;\n\t\tSTUCK = STICK_EL.offsetHeight <= window.innerHeight;\n\t\tWIN_H = window.innerHeight;\n\t}\n\n\tif (STICK === -1 && STUCK) return; // Allways sticky when sidebar is smaller than viewport\n\tif (STICK !== -1 && (STUCK || (SCROLL_UP && WIN_Y <= STICK_Y))) {\n\t\tSTICK_EL.style.setProperty(\"--pos\", \"sticky\");\n\t\tSTICK_EL.style.setProperty(\"--top\", \"0px\");\n\t\tSTICK = -1; // Not sticking to top and sidebar is smaller than viewport or scrolling up\n\t} else if (STICK === -1 && !SCROLL_UP) {\n\t\tSTICK_EL.style.setProperty(\"--pos\", \"relative\");\n\t\tSTICK_EL.style.setProperty(\"--top\", `${Math.max(0, WIN_Y - MIN_Y)}px`);\n\t\tSTICK = 0; // Sticking to top and scrolling down\n\t} else if (STICK !== 1 && !SCROLL_UP && WIN_Y + WIN_H >= STICK_Y + STICK_H) {\n\t\tSTICK_EL.style.setProperty(\"--pos\", \"sticky\");\n\t\tSTICK_EL.style.setProperty(\"--top\", `${WIN_H - STICK_H}px`);\n\t\tSTICK = 1; // Not sticking to bottom and scrolling down\n\t} else if (STICK === 1 && SCROLL_UP) {\n\t\tSTICK_EL.style.setProperty(\"--pos\", \"relative\");\n\t\tSTICK_EL.style.setProperty(\"--top\", `${STICK_Y - MIN_Y}px`);\n\t\tSTICK = 0; // Sticking to bottom and scrolling up\n\t}\n}\n\nonLoaded(() => {\n\tonMutation(document.documentElement, CSS_STICKY, handleMutation);\n\ton(document, \"click\", handleToggleClick, QUICK_EVENT);\n\ton(window, \"resize\", debounce(handleResize, 100), QUICK_EVENT);\n\ton(window, \"scroll\", handleScroll, QUICK_EVENT);\n});\n"],"names":["CSS_APP","styles","CSS_STICKY","CSS_TOGGLE","CSS_SIDEBAR","useTransition","callback","toggleAppExpanded","force","_a","handleToggleClick","el","sidebar","handleResize","MIN_Y","SCROLL_UP","STICK","STICK_EL","STICK_H","STICK_Y","STUCK","WIN_H","WIN_Y","handleMutation","sticky","handleScroll","NEXT_Y","NEXT_UP","onLoaded","onMutation","on","QUICK_EVENT","debounce"],"mappings":";;;AAIA,MAAMA,IAAUC,EAAO,IAAI,MAAM,GAAG,EAAE,CAAC,GACjCC,IAAaD,EAAO,OAAO,MAAM,GAAG,EAAE,CAAC,GACvCE,IAAa,wCACbC,IAAc,IAAIJ,CAAO,cAAcA,CAAO,kBAE9CK,IAAgB,CAACC,MAAyB;AAC3C,EAAC,SAAS,sBACT,SAAS,oBAAoBA,CAAQ,IADEA,EAAA;AAE7C,GAEaC,IAAoB,CAACC;AAAA;AAAA,EAEjCH,EAAc,MAAM;;AAAA,YAAAI,IAAA,OAAO,0BAAP,gBAAAA,EAAA,aAA+BD;AAAA,GAAM;AAAA;AAE1D,SAASE,EAAkB,EAAE,QAAQC,KAAa;AACjD,MAAI,IAAEA,aAAc,sBAAsB,CAACA,EAAG,QAAQR,CAAU,IAChE;AAAA,QAAI,iBAAiBQ,CAAE,EAAE,aAAa,iBAAiBJ,EAAkB;AACzE,IAAAF,EAAc,MAAM;AACb,YAAAO,IAAU,SAAS,cAAiCR,CAAW;AAC5D,MAAAQ,KAAA,QAAAA,EAAA,aAAa,iBAAiB,QACvCA,KAAA,QAAAA,EAAS;AAAA,IAAU,CACnB;AAAA;AACF;AAEA,SAASC,IAAe;;AACd,GAAAJ,IAAA,SAAA,cAAiCL,CAAW,MAA5C,QAAAK,EAA+C;AACzD;AAGA,IAAIK,IAAQ,GACRC,GACAC,IAAQ,GACRC,GACAC,IAAU,GACVC,IAAU,GACVC,IAAQ,IACRC,IAAQ,GACRC,IAAQ;AAEZ,SAASC,EAAe,CAACC,CAAM,GAAkC;AACrD,EAAAP,IAAAO,GACEC,EAAA;AACd;AAEA,SAASA,IAAe;;AACnB,M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styles from \"../styles.module.css\";\nimport { QUICK_EVENT, debounce, on, onLoaded, onMutation } from \"../utils\";\nimport \"./app-toggle\";\n\nconst CSS_APP = styles.app.split(\" \")[0];\nconst CSS_STICKY = styles.sticky.split(\" \")[0];\nconst CSS_TOGGLE = '[data-command=\"toggle-app-expanded\"]';\nconst CSS_SIDEBAR = `.${CSS_APP} > dialog,.${CSS_APP} dialog ~ main`;\n\nconst useTransition = (callback: () => void) => {\n\tif (!document.startViewTransition) callback();\n\telse document.startViewTransition(callback);\n};\n\nexport const toggleAppExpanded = (force?: boolean) =>\n\t// @ts-expect-error window.mtdsAppToggle comes from app-toggle.js\n\tuseTransition(() => window.mtdsToggleAppExpanded?.(force));\n\nfunction handleToggleClick({ target: el, defaultPrevented: stop }: Event) {\n\tif (stop || !(el instanceof HTMLButtonElement) || !el.matches(CSS_TOGGLE))\n\t\treturn;\n\tif (getComputedStyle(el).position === \"sticky\") return toggleAppExpanded();\n\tuseTransition(() => {\n\t\tconst sidebar = document.querySelector<HTMLDialogElement>(CSS_SIDEBAR);\n\t\tsidebar?.setAttribute(\"data-closedby\", \"any\"); // Allow closing by clicking outside\n\t\tsidebar?.showModal();\n\t});\n}\n\nfunction handleResize() {\n\tdocument.querySelector<HTMLDialogElement>(CSS_SIDEBAR)?.close();\n}\n\n// Scroll state\nlet MIN_Y = 0; // Offset to avoid scroll jump when sticky is set to relative\nlet SCROLL_UP: boolean;\nlet STICK = 0; // -1 = stick top, 0 = relative, 1 = stick bottom\nlet STICK_EL: HTMLElement;\nlet STICK_H = 0;\nlet STICK_Y = 0;\nlet STUCK = false; // Used to figure if nav is larger than viewport\nlet WIN_H = 0;\nlet WIN_Y = 0;\n\nfunction handleMutation([sticky]: HTMLCollectionOf<HTMLElement>) {\n\tSTICK_EL = sticky;\n\thandleScroll(); // Run on connect\n}\n\nfunction handleScroll() {\n\tif (!STICK_EL?.isConnected) return;\n\tconst NEXT_Y = window.scrollY;\n\tconst NEXT_UP = NEXT_Y < WIN_Y;\n\tWIN_Y = NEXT_Y;\n\n\t// Only calculate if scroll direction has changed\n\tif (NEXT_UP !== SCROLL_UP) {\n\t\tMIN_Y = (STICK_EL.parentElement?.getBoundingClientRect().top || 0) + WIN_Y;\n\t\tSCROLL_UP = NEXT_UP;\n\t\tSTICK_H = STICK_EL.offsetHeight;\n\t\tSTICK_Y = STICK_EL.getBoundingClientRect().top + WIN_Y;\n\t\tSTUCK = STICK_EL.offsetHeight <= window.innerHeight;\n\t\tWIN_H = window.innerHeight;\n\t}\n\n\tif (STICK === -1 && STUCK) return; // Allways sticky when sidebar is smaller than viewport\n\tif (STICK !== -1 && (STUCK || (SCROLL_UP && WIN_Y <= STICK_Y))) {\n\t\tSTICK_EL.style.setProperty(\"--pos\", \"sticky\");\n\t\tSTICK_EL.style.setProperty(\"--top\", \"0px\");\n\t\tSTICK = -1; // Not sticking to top and sidebar is smaller than viewport or scrolling up\n\t} else if (STICK === -1 && !SCROLL_UP) {\n\t\tSTICK_EL.style.setProperty(\"--pos\", \"relative\");\n\t\tSTICK_EL.style.setProperty(\"--top\", `${Math.max(0, WIN_Y - MIN_Y)}px`);\n\t\tSTICK = 0; // Sticking to top and scrolling down\n\t} else if (STICK !== 1 && !SCROLL_UP && WIN_Y + WIN_H >= STICK_Y + STICK_H) {\n\t\tSTICK_EL.style.setProperty(\"--pos\", \"sticky\");\n\t\tSTICK_EL.style.setProperty(\"--top\", `${WIN_H - STICK_H}px`);\n\t\tSTICK = 1; // Not sticking to bottom and scrolling down\n\t} else if (STICK === 1 && SCROLL_UP) {\n\t\tSTICK_EL.style.setProperty(\"--pos\", \"relative\");\n\t\tSTICK_EL.style.setProperty(\"--top\", `${STICK_Y - MIN_Y}px`);\n\t\tSTICK = 0; // Sticking to bottom and scrolling up\n\t}\n}\n\nonLoaded(() => {\n\tonMutation(document.documentElement, CSS_STICKY, handleMutation);\n\ton(document, \"click\", handleToggleClick, QUICK_EVENT);\n\ton(window, \"resize\", debounce(handleResize, 100), QUICK_EVENT);\n\ton(window, \"scroll\", handleScroll, QUICK_EVENT);\n});\n"],"names":["CSS_APP","styles","CSS_STICKY","CSS_TOGGLE","CSS_SIDEBAR","useTransition","callback","toggleAppExpanded","force","_a","handleToggleClick","el","stop","sidebar","handleResize","MIN_Y","SCROLL_UP","STICK","STICK_EL","STICK_H","STICK_Y","STUCK","WIN_H","WIN_Y","handleMutation","sticky","handleScroll","NEXT_Y","NEXT_UP","onLoaded","onMutation","on","QUICK_EVENT","debounce"],"mappings":";;;AAIA,MAAMA,IAAUC,EAAO,IAAI,MAAM,GAAG,EAAE,CAAC,GACjCC,IAAaD,EAAO,OAAO,MAAM,GAAG,EAAE,CAAC,GACvCE,IAAa,wCACbC,IAAc,IAAIJ,CAAO,cAAcA,CAAO,kBAE9CK,IAAgB,CAACC,MAAyB;AAC3C,EAAC,SAAS,sBACT,SAAS,oBAAoBA,CAAQ,IADEA,EAAA;AAE7C,GAEaC,IAAoB,CAACC;AAAA;AAAA,EAEjCH,EAAc,MAAM;;AAAA,YAAAI,IAAA,OAAO,0BAAP,gBAAAA,EAAA,aAA+BD;AAAA,GAAM;AAAA;AAE1D,SAASE,EAAkB,EAAE,QAAQC,GAAI,kBAAkBC,KAAe;AACzE,MAAI,EAAAA,KAAQ,EAAED,aAAc,sBAAsB,CAACA,EAAG,QAAQR,CAAU,IAExE;AAAA,QAAI,iBAAiBQ,CAAE,EAAE,aAAa,iBAAiBJ,EAAkB;AACzE,IAAAF,EAAc,MAAM;AACb,YAAAQ,IAAU,SAAS,cAAiCT,CAAW;AAC5D,MAAAS,KAAA,QAAAA,EAAA,aAAa,iBAAiB,QACvCA,KAAA,QAAAA,EAAS;AAAA,IAAU,CACnB;AAAA;AACF;AAEA,SAASC,IAAe;;AACd,GAAAL,IAAA,SAAA,cAAiCL,CAAW,MAA5C,QAAAK,EAA+C;AACzD;AAGA,IAAIM,IAAQ,GACRC,GACAC,IAAQ,GACRC,GACAC,IAAU,GACVC,IAAU,GACVC,IAAQ,IACRC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GAC1DD,EAAA,QAAQ,UAAUL,GAAcM,CAAW;AAC/C,CAAC;"}
@@ -1,27 +1,15 @@
1
- const t = `if (
2
- typeof window !== "undefined" &&
3
- window.CSSStyleSheet &&
4
- document.adoptedStyleSheets
5
- )
6
- (() => {
7
- const key = "--mtds-app-expanded";
8
- const sheet = new CSSStyleSheet();
9
- const prev = () => !window.localStorage.getItem(key)?.includes("false");
10
-
11
- document.adoptedStyleSheets.push(sheet);
12
- window.mtdsToggleAppExpanded = (force) => {
13
- try {
14
- const next = force ?? !prev();
15
- sheet.replaceSync?.(\`:root { \${key}: var(\${key}--\${next})}\`);
16
- window.localStorage.setItem(key, next);
17
- } catch (err) {} // localStorage is full or replaceSync is not supported
18
- };
19
-
20
- // Set and store initial state
21
- window.mtdsToggleAppExpanded(prev());
22
- })();
23
- `;
24
- export {
25
- t as default
26
- };
1
+ typeof window < "u" && window.CSSStyleSheet && document.adoptedStyleSheets && (() => {
2
+ const e = "--mtds-app-expanded", t = new CSSStyleSheet(), n = () => {
3
+ var d;
4
+ return !((d = window.localStorage.getItem(e)) != null && d.includes("false"));
5
+ };
6
+ document.adoptedStyleSheets.push(t), window.mtdsToggleAppExpanded = (d) => {
7
+ var p;
8
+ try {
9
+ const o = d ?? !n();
10
+ (p = t.replaceSync) == null || p.call(t, `:root { ${e}: var(${e}--${o})}`), window.localStorage.setItem(e, o);
11
+ } catch {
12
+ }
13
+ }, window.mtdsToggleAppExpanded(n());
14
+ })();
27
15
  //# sourceMappingURL=app-toggle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"app-toggle.js","sources":["../../designsystem/app/app-toggle.js?raw"],"sourcesContent":["export default \"if (\\n\\ttypeof window !== \\\"undefined\\\" &&\\n\\twindow.CSSStyleSheet &&\\n\\tdocument.adoptedStyleSheets\\n)\\n\\t(() => {\\n\\t\\tconst key = \\\"--mtds-app-expanded\\\";\\n\\t\\tconst sheet = new CSSStyleSheet();\\n\\t\\tconst prev = () => !window.localStorage.getItem(key)?.includes(\\\"false\\\");\\n\\n\\t\\tdocument.adoptedStyleSheets.push(sheet);\\n\\t\\twindow.mtdsToggleAppExpanded = (force) => {\\n\\t\\t\\ttry {\\n\\t\\t\\t\\tconst next = force ?? !prev();\\n\\t\\t\\t\\tsheet.replaceSync?.(`:root { ${key}: var(${key}--${next})}`);\\n\\t\\t\\t\\twindow.localStorage.setItem(key, next);\\n\\t\\t\\t} catch (err) {} // localStorage is full or replaceSync is not supported\\n\\t\\t};\\n\\n\\t\\t// Set and store initial state\\n\\t\\twindow.mtdsToggleAppExpanded(prev());\\n\\t})();\\n\""],"names":["script"],"mappings":"AAAA,MAAeA,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
1
+ {"version":3,"file":"app-toggle.js","sources":["../../designsystem/app/app-toggle.js"],"sourcesContent":["if (\n\ttypeof window !== \"undefined\" &&\n\twindow.CSSStyleSheet &&\n\tdocument.adoptedStyleSheets\n)\n\t(() => {\n\t\tconst key = \"--mtds-app-expanded\";\n\t\tconst sheet = new CSSStyleSheet();\n\t\tconst prev = () => !window.localStorage.getItem(key)?.includes(\"false\");\n\n\t\tdocument.adoptedStyleSheets.push(sheet);\n\t\twindow.mtdsToggleAppExpanded = (force) => {\n\t\t\ttry {\n\t\t\t\tconst next = force ?? !prev();\n\t\t\t\tsheet.replaceSync?.(`:root { ${key}: var(${key}--${next})}`);\n\t\t\t\twindow.localStorage.setItem(key, next);\n\t\t\t} catch (err) {} // localStorage is full or replaceSync is not supported\n\t\t};\n\n\t\t// Set and store initial state\n\t\twindow.mtdsToggleAppExpanded(prev());\n\t})();\n"],"names":["key","sheet","prev","_a","force","next"],"mappings":"AACC,OAAO,SAAW,OAClB,OAAO,iBACP,SAAS,uBAER,MAAM;AACN,QAAMA,IAAM,uBACNC,IAAQ,IAAI,cAAe,GAC3BC,IAAO,MAAM;AARrB,QAAAC;AAQqB,cAACA,IAAA,OAAO,aAAa,QAAQH,CAAG,MAA/B,QAAAG,EAAkC,SAAS;AAAA;AAE/D,WAAS,mBAAmB,KAAKF,CAAK,GACtC,OAAO,wBAAwB,CAACG,MAAU;AAX5C,QAAAD;AAYG,QAAI;AACH,YAAME,IAAOD,KAAS,CAACF,EAAM;AAC7B,OAAAC,IAAAF,EAAM,gBAAN,QAAAE,EAAA,KAAAF,GAAoB,WAAWD,CAAG,SAASA,CAAG,KAAKK,CAAI,OACvD,OAAO,aAAa,QAAQL,GAAKK,CAAI;AAAA,IACzC,QAAiB;AAAA,IAAE;AAAA,EAChB,GAGD,OAAO,sBAAsBH,GAAM;AACrC,GAAK;"}
@@ -1,15 +1,27 @@
1
- typeof window < "u" && window.CSSStyleSheet && document.adoptedStyleSheets && (() => {
2
- const e = "--mtds-app-expanded", t = new CSSStyleSheet(), n = () => {
3
- var d;
4
- return !((d = window.localStorage.getItem(e)) != null && d.includes("false"));
5
- };
6
- document.adoptedStyleSheets.push(t), window.mtdsToggleAppExpanded = (d) => {
7
- var p;
8
- try {
9
- const o = d ?? !n();
10
- (p = t.replaceSync) == null || p.call(t, `:root { ${e}: var(${e}--${o})}`), window.localStorage.setItem(e, o);
11
- } catch {
12
- }
13
- }, window.mtdsToggleAppExpanded(n());
14
- })();
1
+ const t = `if (
2
+ typeof window !== "undefined" &&
3
+ window.CSSStyleSheet &&
4
+ document.adoptedStyleSheets
5
+ )
6
+ (() => {
7
+ const key = "--mtds-app-expanded";
8
+ const sheet = new CSSStyleSheet();
9
+ const prev = () => !window.localStorage.getItem(key)?.includes("false");
10
+
11
+ document.adoptedStyleSheets.push(sheet);
12
+ window.mtdsToggleAppExpanded = (force) => {
13
+ try {
14
+ const next = force ?? !prev();
15
+ sheet.replaceSync?.(\`:root { \${key}: var(\${key}--\${next})}\`);
16
+ window.localStorage.setItem(key, next);
17
+ } catch (err) {} // localStorage is full or replaceSync is not supported
18
+ };
19
+
20
+ // Set and store initial state
21
+ window.mtdsToggleAppExpanded(prev());
22
+ })();
23
+ `;
24
+ export {
25
+ t as default
26
+ };
15
27
  //# sourceMappingURL=app-toggle2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"app-toggle2.js","sources":["../../designsystem/app/app-toggle.js"],"sourcesContent":["if (\n\ttypeof window !== \"undefined\" &&\n\twindow.CSSStyleSheet &&\n\tdocument.adoptedStyleSheets\n)\n\t(() => {\n\t\tconst key = \"--mtds-app-expanded\";\n\t\tconst sheet = new CSSStyleSheet();\n\t\tconst prev = () => !window.localStorage.getItem(key)?.includes(\"false\");\n\n\t\tdocument.adoptedStyleSheets.push(sheet);\n\t\twindow.mtdsToggleAppExpanded = (force) => {\n\t\t\ttry {\n\t\t\t\tconst next = force ?? !prev();\n\t\t\t\tsheet.replaceSync?.(`:root { ${key}: var(${key}--${next})}`);\n\t\t\t\twindow.localStorage.setItem(key, next);\n\t\t\t} catch (err) {} // localStorage is full or replaceSync is not supported\n\t\t};\n\n\t\t// Set and store initial state\n\t\twindow.mtdsToggleAppExpanded(prev());\n\t})();\n"],"names":["key","sheet","prev","_a","force","next"],"mappings":"AACC,OAAO,SAAW,OAClB,OAAO,iBACP,SAAS,uBAER,MAAM;AACN,QAAMA,IAAM,uBACNC,IAAQ,IAAI,cAAe,GAC3BC,IAAO,MAAM;AARrB,QAAAC;AAQqB,cAACA,IAAA,OAAO,aAAa,QAAQH,CAAG,MAA/B,QAAAG,EAAkC,SAAS;AAAA;AAE/D,WAAS,mBAAmB,KAAKF,CAAK,GACtC,OAAO,wBAAwB,CAACG,MAAU;AAX5C,QAAAD;AAYG,QAAI;AACH,YAAME,IAAOD,KAAS,CAACF,EAAM;AAC7B,OAAAC,IAAAF,EAAM,gBAAN,QAAAE,EAAA,KAAAF,GAAoB,WAAWD,CAAG,SAASA,CAAG,KAAKK,CAAI,OACvD,OAAO,aAAa,QAAQL,GAAKK,CAAI;AAAA,IACzC,QAAiB;AAAA,IAAE;AAAA,EAChB,GAGD,OAAO,sBAAsBH,GAAM;AACrC,GAAK;"}
1
+ {"version":3,"file":"app-toggle2.js","sources":["../../designsystem/app/app-toggle.js?raw"],"sourcesContent":["export default \"if (\\n\\ttypeof window !== \\\"undefined\\\" &&\\n\\twindow.CSSStyleSheet &&\\n\\tdocument.adoptedStyleSheets\\n)\\n\\t(() => {\\n\\t\\tconst key = \\\"--mtds-app-expanded\\\";\\n\\t\\tconst sheet = new CSSStyleSheet();\\n\\t\\tconst prev = () => !window.localStorage.getItem(key)?.includes(\\\"false\\\");\\n\\n\\t\\tdocument.adoptedStyleSheets.push(sheet);\\n\\t\\twindow.mtdsToggleAppExpanded = (force) => {\\n\\t\\t\\ttry {\\n\\t\\t\\t\\tconst next = force ?? !prev();\\n\\t\\t\\t\\tsheet.replaceSync?.(`:root { ${key}: var(${key}--${next})}`);\\n\\t\\t\\t\\twindow.localStorage.setItem(key, next);\\n\\t\\t\\t} catch (err) {} // localStorage is full or replaceSync is not supported\\n\\t\\t};\\n\\n\\t\\t// Set and store initial state\\n\\t\\twindow.mtdsToggleAppExpanded(prev());\\n\\t})();\\n\""],"names":["script"],"mappings":"AAAA,MAAeA,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
package/mtds/app/app.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { JSX } from 'react';
2
+ import { ButtonProps } from '../react';
2
3
  import { PolymorphicComponentPropWithRef } from '../react-types';
3
4
  export type AppHeaderProps = React.ComponentPropsWithoutRef<"header">;
4
5
  export type AppSidebarProps = React.ComponentPropsWithoutRef<"dialog">;
@@ -11,6 +12,7 @@ export declare const App: AppComponent & {
11
12
  Header: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>;
12
13
  Sidebar: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement>, "ref"> & React.RefAttributes<HTMLDialogElement>>;
13
14
  Sticky: AppComponent;
15
+ Toggle: React.ForwardRefExoticComponent<Omit<ButtonProps<"button">, "ref"> & React.RefAttributes<HTMLButtonElement>>;
14
16
  Main: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>;
15
17
  Footer: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>;
16
18
  Script: () => import("react/jsx-runtime").JSX.Element;
package/mtds/app/app.js CHANGED
@@ -1,36 +1,80 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
- import { clsx as a } from "../external/clsx/dist/clsx.js";
2
+ import { clsx as e } from "../external/clsx/dist/clsx.js";
3
3
  import { forwardRef as p } from "react";
4
- import c from "../styles.module.css.js";
5
- import m from "./app-toggle.js";
6
- const f = p(function({ as: r, className: t, ...n }, e) {
7
- return /* @__PURE__ */ o(r || "div", { className: a(c.app, t), ref: e, ...n });
8
- }), d = p(function({ as: r, className: t, ...n }, e) {
9
- return /* @__PURE__ */ o(r || "div", { className: a(c.sticky, t), ref: e, ...n });
10
- }), y = Object.assign(f, {
4
+ import "../alert/alert.js";
5
+ import "../avatar/avatar.js";
6
+ import "../badge/badge.js";
7
+ import "../breadcrumbs/breadcrumbs.js";
8
+ import { Button as s } from "../button/button.js";
9
+ import "../card/card.js";
10
+ import "../chip/chip.js";
11
+ import "../details/details.js";
12
+ import "../dialog/dialog.js";
13
+ import "../divider/divider.js";
14
+ import "../errorsummary/errorsummary.js";
15
+ import "../field/field.js";
16
+ import "../fieldset/fieldset.js";
17
+ import "../helptext/helptext.js";
18
+ import "../input/input.js";
19
+ import "../layout/layout.js";
20
+ import "../link/link.js";
21
+ import "../logo/logo.js";
22
+ import "../pagination/pagination.js";
23
+ import "../popover/popover.js";
24
+ import "../progress/progress.js";
25
+ import "../skeleton/skeleton.js";
26
+ import "../spinner/spinner.js";
27
+ import "../steps/steps.js";
28
+ import "../table/table.js";
29
+ import "../tabs/tabs.js";
30
+ import "../tag/tag.js";
31
+ import "../togglegroup/togglegroup.js";
32
+ import "../typography/typography.js";
33
+ import "../validation/validation.js";
34
+ import a from "../styles.module.css.js";
35
+ import d from "./app-toggle2.js";
36
+ const f = p(function({ as: t, className: r, ...m }, n) {
37
+ return /* @__PURE__ */ o(t || "div", { className: e(a.app, r), ref: n, ...m });
38
+ }), u = p(function({ as: t, className: r, ...m }, n) {
39
+ return /* @__PURE__ */ o(t || "div", { className: e(a.sticky, r), ref: n, ...m });
40
+ }), X = Object.assign(f, {
11
41
  Header: p(
12
- function(r, t) {
13
- return /* @__PURE__ */ o("header", { ref: t, ...r });
42
+ function(t, r) {
43
+ return /* @__PURE__ */ o("header", { ref: r, ...t });
14
44
  }
15
45
  ),
16
46
  Sidebar: p(
17
- function(r, t) {
18
- return /* @__PURE__ */ o("dialog", { role: "navigation", ref: t, ...r });
47
+ function(t, r) {
48
+ return /* @__PURE__ */ o("dialog", { role: "navigation", ref: r, ...t });
19
49
  }
20
50
  ),
21
- Sticky: d,
22
- Main: p(function(r, t) {
23
- return /* @__PURE__ */ o("main", { ref: t, ...r });
51
+ Sticky: u,
52
+ Toggle: p(
53
+ function({ children: t, ...r }, m) {
54
+ return /* @__PURE__ */ o(
55
+ s,
56
+ {
57
+ "data-command": "toggle-app-expanded",
58
+ "data-tooltip": "Vis meny",
59
+ ref: m,
60
+ ...r,
61
+ children: t ?? "Skjul meny"
62
+ }
63
+ );
64
+ }
65
+ ),
66
+ Main: p(function(t, r) {
67
+ return /* @__PURE__ */ o("main", { ref: r, ...t });
24
68
  }),
25
69
  Footer: p(
26
- function(r, t) {
27
- return /* @__PURE__ */ o("footer", { ref: t, ...r });
70
+ function(t, r) {
71
+ return /* @__PURE__ */ o("footer", { ref: r, ...t });
28
72
  }
29
73
  ),
30
74
  // Needed to avoid flash of unstyled content and still be Next.js hydration compatible
31
- Script: () => /* @__PURE__ */ o("script", { id: "mtds-app-script", children: m })
75
+ Script: () => /* @__PURE__ */ o("script", { id: "mtds-app-script", children: d })
32
76
  });
33
77
  export {
34
- y as App
78
+ X as App
35
79
  };
36
80
  //# sourceMappingURL=app.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"app.js","sources":["../../designsystem/app/app.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { type JSX, forwardRef } from \"react\";\nimport type {\n\tPolymorphicComponentPropWithRef,\n\tPolymorphicRef,\n} from \"../react-types\";\nimport styles from \"../styles.module.css\";\nimport script from \"./app-toggle.js?raw\";\n\nexport type AppHeaderProps = React.ComponentPropsWithoutRef<\"header\">;\nexport type AppSidebarProps = React.ComponentPropsWithoutRef<\"dialog\">;\nexport type AppStickyProps = React.ComponentPropsWithoutRef<\"div\">;\nexport type AppMainProps = React.ComponentPropsWithoutRef<\"main\">;\nexport type AppFooterProps = React.ComponentPropsWithoutRef<\"footer\">;\nexport type AppProps<As extends React.ElementType = \"div\"> =\n\tPolymorphicComponentPropWithRef<As>;\n\ntype AppComponent = <As extends React.ElementType = \"div\">(\n\tprops: AppProps<As>,\n) => JSX.Element;\n\nconst AppComp = forwardRef<null>(function App<\n\tAs extends React.ElementType = \"div\",\n>({ as, className, ...rest }: AppProps<As>, ref?: PolymorphicRef<As>) {\n\tconst Tag = as || \"div\";\n\n\treturn <Tag className={clsx(styles.app, className)} ref={ref} {...rest} />;\n}) as AppComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n\nconst AppSticky = forwardRef<null>(function App<\n\tAs extends React.ElementType = \"div\",\n>({ as, className, ...rest }: AppProps<As>, ref?: PolymorphicRef<As>) {\n\tconst Tag = as || \"div\";\n\n\treturn <Tag className={clsx(styles.sticky, className)} ref={ref} {...rest} />;\n}) as AppComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n\nexport const App = Object.assign(AppComp, {\n\tHeader: forwardRef<HTMLElement, AppHeaderProps>(\n\t\tfunction AppHeader(rest, ref) {\n\t\t\treturn <header ref={ref} {...rest} />;\n\t\t},\n\t),\n\tSidebar: forwardRef<HTMLDialogElement, AppSidebarProps>(\n\t\tfunction AppSidebar(rest, ref) {\n\t\t\treturn <dialog role=\"navigation\" ref={ref} {...rest} />;\n\t\t},\n\t),\n\tSticky: AppSticky,\n\tMain: forwardRef<HTMLElement, AppMainProps>(function AppMain(rest, ref) {\n\t\treturn <main ref={ref} {...rest} />;\n\t}),\n\tFooter: forwardRef<HTMLElement, AppFooterProps>(\n\t\tfunction AppFooter(rest, ref) {\n\t\t\treturn <footer ref={ref} {...rest} />;\n\t\t},\n\t),\n\t// Needed to avoid flash of unstyled content and still be Next.js hydration compatible\n\tScript: () => <script id=\"mtds-app-script\">{script}</script>,\n});\n"],"names":["AppComp","forwardRef","as","className","rest","ref","jsx","clsx","styles","AppSticky","App","script"],"mappings":";;;;;AAqBA,MAAMA,IAAUC,EAAiB,SAE/B,EAAE,IAAAC,GAAI,WAAAC,GAAW,GAAGC,EAAK,GAAiBC,GAA0B;AAG9D,SAAA,gBAAAC,EAFKJ,KAAM,OAEN,EAAA,WAAWK,EAAKC,EAAO,KAAKL,CAAS,GAAG,KAAAE,GAAW,GAAGD,EAAM,CAAA;AACzE,CAAC,GAEKK,IAAYR,EAAiB,SAEjC,EAAE,IAAAC,GAAI,WAAAC,GAAW,GAAGC,EAAK,GAAiBC,GAA0B;AAG9D,SAAA,gBAAAC,EAFKJ,KAAM,OAEN,EAAA,WAAWK,EAAKC,EAAO,QAAQL,CAAS,GAAG,KAAAE,GAAW,GAAGD,EAAM,CAAA;AAC5E,CAAC,GAEYM,IAAM,OAAO,OAAOV,GAAS;AAAA,EACzC,QAAQC;AAAA,IACP,SAAmBG,GAAMC,GAAK;AAC7B,aAAQ,gBAAAC,EAAA,UAAA,EAAO,KAAAD,GAAW,GAAGD,EAAM,CAAA;AAAA,IAAA;AAAA,EAErC;AAAA,EACA,SAASH;AAAA,IACR,SAAoBG,GAAMC,GAAK;AAC9B,+BAAQ,UAAO,EAAA,MAAK,cAAa,KAAAA,GAAW,GAAGD,GAAM;AAAA,IAAA;AAAA,EAEvD;AAAA,EACA,QAAQK;AAAA,EACR,MAAMR,EAAsC,SAAiBG,GAAMC,GAAK;AACvE,WAAQ,gBAAAC,EAAA,QAAA,EAAK,KAAAD,GAAW,GAAGD,EAAM,CAAA;AAAA,EAAA,CACjC;AAAA,EACD,QAAQH;AAAA,IACP,SAAmBG,GAAMC,GAAK;AAC7B,aAAQ,gBAAAC,EAAA,UAAA,EAAO,KAAAD,GAAW,GAAGD,EAAM,CAAA;AAAA,IAAA;AAAA,EAErC;AAAA;AAAA,EAEA,QAAQ,MAAM,gBAAAE,EAAC,UAAO,EAAA,IAAG,mBAAmB,UAAOK,EAAA,CAAA;AACpD,CAAC;"}
1
+ {"version":3,"file":"app.js","sources":["../../designsystem/app/app.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { type JSX, forwardRef } from \"react\";\nimport { Button, type ButtonProps } from \"../react\";\nimport type {\n\tPolymorphicComponentPropWithRef,\n\tPolymorphicRef,\n} from \"../react-types\";\nimport styles from \"../styles.module.css\";\nimport script from \"./app-toggle.js?raw\";\n\nexport type AppHeaderProps = React.ComponentPropsWithoutRef<\"header\">;\nexport type AppSidebarProps = React.ComponentPropsWithoutRef<\"dialog\">;\nexport type AppStickyProps = React.ComponentPropsWithoutRef<\"div\">;\nexport type AppMainProps = React.ComponentPropsWithoutRef<\"main\">;\nexport type AppFooterProps = React.ComponentPropsWithoutRef<\"footer\">;\nexport type AppProps<As extends React.ElementType = \"div\"> =\n\tPolymorphicComponentPropWithRef<As>;\n\ntype AppComponent = <As extends React.ElementType = \"div\">(\n\tprops: AppProps<As>,\n) => JSX.Element;\n\nconst AppComp = forwardRef<null>(function App<\n\tAs extends React.ElementType = \"div\",\n>({ as, className, ...rest }: AppProps<As>, ref?: PolymorphicRef<As>) {\n\tconst Tag = as || \"div\";\n\n\treturn <Tag className={clsx(styles.app, className)} ref={ref} {...rest} />;\n}) as AppComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n\nconst AppSticky = forwardRef<null>(function App<\n\tAs extends React.ElementType = \"div\",\n>({ as, className, ...rest }: AppProps<As>, ref?: PolymorphicRef<As>) {\n\tconst Tag = as || \"div\";\n\n\treturn <Tag className={clsx(styles.sticky, className)} ref={ref} {...rest} />;\n}) as AppComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n\nexport const App = Object.assign(AppComp, {\n\tHeader: forwardRef<HTMLElement, AppHeaderProps>(\n\t\tfunction AppHeader(rest, ref) {\n\t\t\treturn <header ref={ref} {...rest} />;\n\t\t},\n\t),\n\tSidebar: forwardRef<HTMLDialogElement, AppSidebarProps>(\n\t\tfunction AppSidebar(rest, ref) {\n\t\t\treturn <dialog role=\"navigation\" ref={ref} {...rest} />;\n\t\t},\n\t),\n\tSticky: AppSticky,\n\tToggle: forwardRef<HTMLButtonElement, ButtonProps<\"button\">>(\n\t\tfunction AppToggle({ children, ...rest }: ButtonProps<\"button\">, ref) {\n\t\t\treturn (\n\t\t\t\t<Button\n\t\t\t\t\tdata-command=\"toggle-app-expanded\"\n\t\t\t\t\tdata-tooltip=\"Vis meny\"\n\t\t\t\t\tref={ref as React.Ref<HTMLAnchorElement>}\n\t\t\t\t\t{...rest}\n\t\t\t\t>\n\t\t\t\t\t{children ?? \"Skjul meny\"}\n\t\t\t\t</Button>\n\t\t\t);\n\t\t},\n\t),\n\tMain: forwardRef<HTMLElement, AppMainProps>(function AppMain(rest, ref) {\n\t\treturn <main ref={ref} {...rest} />;\n\t}),\n\tFooter: forwardRef<HTMLElement, AppFooterProps>(\n\t\tfunction AppFooter(rest, ref) {\n\t\t\treturn <footer ref={ref} {...rest} />;\n\t\t},\n\t),\n\t// Needed to avoid flash of unstyled content and still be Next.js hydration compatible\n\tScript: () => <script id=\"mtds-app-script\">{script}</script>,\n});\n"],"names":["AppComp","forwardRef","as","className","rest","ref","jsx","clsx","styles","AppSticky","App","children","Button","script"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAMA,IAAUC,EAAiB,SAE/B,EAAE,IAAAC,GAAI,WAAAC,GAAW,GAAGC,EAAK,GAAiBC,GAA0B;AAG9D,SAAA,gBAAAC,EAFKJ,KAAM,OAEN,EAAA,WAAWK,EAAKC,EAAO,KAAKL,CAAS,GAAG,KAAAE,GAAW,GAAGD,EAAM,CAAA;AACzE,CAAC,GAEKK,IAAYR,EAAiB,SAEjC,EAAE,IAAAC,GAAI,WAAAC,GAAW,GAAGC,EAAK,GAAiBC,GAA0B;AAG9D,SAAA,gBAAAC,EAFKJ,KAAM,OAEN,EAAA,WAAWK,EAAKC,EAAO,QAAQL,CAAS,GAAG,KAAAE,GAAW,GAAGD,EAAM,CAAA;AAC5E,CAAC,GAEYM,IAAM,OAAO,OAAOV,GAAS;AAAA,EACzC,QAAQC;AAAA,IACP,SAAmBG,GAAMC,GAAK;AAC7B,aAAQ,gBAAAC,EAAA,UAAA,EAAO,KAAAD,GAAW,GAAGD,EAAM,CAAA;AAAA,IAAA;AAAA,EAErC;AAAA,EACA,SAASH;AAAA,IACR,SAAoBG,GAAMC,GAAK;AAC9B,+BAAQ,UAAO,EAAA,MAAK,cAAa,KAAAA,GAAW,GAAGD,GAAM;AAAA,IAAA;AAAA,EAEvD;AAAA,EACA,QAAQK;AAAA,EACR,QAAQR;AAAA,IACP,SAAmB,EAAE,UAAAU,GAAU,GAAGP,EAAA,GAA+BC,GAAK;AAEpE,aAAA,gBAAAC;AAAA,QAACM;AAAA,QAAA;AAAA,UACA,gBAAa;AAAA,UACb,gBAAa;AAAA,UACb,KAAAP;AAAA,UACC,GAAGD;AAAA,UAEH,UAAYO,KAAA;AAAA,QAAA;AAAA,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