boreal-ui 0.0.894 → 0.0.896

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.
@@ -5,7 +5,7 @@ import { c as o } from "./classNames-Dz0_huu_.js";
5
5
  import { g as Ee, f as Le } from "./boreal-style-config-rYvfCHLY.js";
6
6
  import { c as p } from "./capitalize-D_pj4b3P.js";
7
7
  import { I as Pe } from "./IconButton-Dq8m4yuP.js";
8
- import { U as Ue } from "./ThemeSelect-C8cxeht_.js";
8
+ import { U as Ue } from "./ThemeSelect-BEv_eHJd.js";
9
9
  import './Footer.css';const B = (h) => h.toLowerCase().trim().replace(/\s+/g, "-"), de = ({
10
10
  theme: h = Ee(),
11
11
  glass: F = Le(),
@@ -1 +1 @@
1
- "use strict";require('./Footer.css');const t=require("react/jsx-runtime"),ie=require("./propAliases-Bfsf5cJN.cjs"),Be=require("react"),r=require("./classNames-C7V3kfBj.cjs"),se=require("./boreal-style-config-BB8MdwYx.cjs"),y=require("./capitalize-CnTiekgk.cjs"),Ge=require("./IconButton-O0x6cSnS.cjs"),Re=require("./ThemeSelect-B7LNF0B5.cjs"),k=c=>c.toLowerCase().trim().replace(/\s+/g,"-"),le=({theme:c=se.getDefaultTheme(),glass:v=se.getDefaultGlass(),attachment:ce="static",shadow:S="none",rounding:w="none",layout:m="inline",className:z="","data-testid":me,testId:n=me??"footer",copyright:i,copyrightInBottom:he,links:b=[],sections:q,logo:l,brandTitle:u,brandDescription:B,brandHref:G,brandTarget:R,brandRel:fe,socialLinks:N=[],showThemeSelect:E=!1,themeSelectLabel:be="Theme",bottomEnd:F,contentClassName:L,leftClassName:P,linksClassName:ue,linkClassName:Ne,logoClassName:T,socialClassName:xe,themeToggleClassName:je,brandClassName:_e,brandLinkClassName:U,brandTitleClassName:ge,brandDescriptionClassName:$e,sectionsClassName:Ce,sectionTitleClassName:H,actionsClassName:ye,actionGroupClassName:ve,bottomClassName:Se,bottomCopyrightClassName:we,bottomEndClassName:qe,copyrightClassName:J,IconButton:Fe,ImageComponent:K="img",ThemeSelect:Te,classMap:o,LinkWrapper:O=({href:j,children:_,...A})=>t.jsx("a",{href:j,...A,children:_}),"aria-label":Q,"aria-labelledby":V,"aria-describedby":W,navAriaLabel:X="Footer site links",socialNavAriaLabel:pe="Social media",themeSelectAriaLabel:Y="Theme selector",logoAriaLabel:x="Logo",logoDecorative:d=!1,labelId:f,...Z})=>{const j=ie.resolvePropAlias(ce),_=Be.useMemo(()=>r.combineClassNames(o.footer,o[c],v&&o.glass,m!=="inline"&&o[`layout${y.capitalize(m)}`],S!=="none"&&o[`shadow${y.capitalize(S)}`],w!=="none"&&o[`round${y.capitalize(w)}`],o[`attachment${y.capitalize(j)}`],z),[o,c,v,m,S,w,j,z]),D=typeof l=="string"||(e=>typeof e=="object"&&e!==null&&"src"in e)(l),a=D?typeof l=="string"?{src:l}:l:void 0,p=a==null?void 0:a.src,I=(a==null?void 0:a.width)??20,M=(a==null?void 0:a.height)??20,ee=q&&q.length>0?q:b.length>0?[{title:"Links",links:b,"aria-label":X,testId:"links"}]:[],te=he??m==="columns",oe=()=>D&&p?typeof K=="string"?t.jsx("img",{className:r.combineClassNames(o.logo,T),"data-testid":`${n}-logo`,loading:"lazy",src:p,alt:d?"":x,"aria-hidden":d?!0:void 0,height:M,width:I}):t.jsx(K,{className:r.combineClassNames(o.logo,T),"data-testid":`${n}-logo`,src:p,alt:d?"":x,"aria-hidden":d?!0:void 0,height:M,width:I}):l?t.jsx("span",{className:r.combineClassNames(o.logo,T),role:d?void 0:"img","aria-label":d?void 0:x,"aria-hidden":d?!0:void 0,"data-testid":`${n}-logo`,children:l}):null,re=(e,s,g)=>{const h=k(e.label||e.href||`link-${s}`),$=`${e.href??h}-${s}`,C=r.combineClassNames(o.link,g);return e.disabled?t.jsx("li",{children:t.jsx("span",{className:C,"data-testid":`${n}-link-${h}`,"aria-disabled":"true",title:e.title,children:e.label})},$):t.jsx("li",{children:t.jsx(O,{href:e.href,className:C,"data-testid":`${n}-link-${h}`,"aria-label":e["aria-label"],"aria-current":e["aria-current"],title:e.title,rel:e.rel,target:e.target,children:e.label})},$)},ne=()=>N.length===0?null:t.jsx("nav",{className:r.combineClassNames(o.social,xe),"aria-label":pe,"data-testid":`${n}-social`,children:N.map((e,s)=>t.jsx(Fe,{icon:e.icon,href:e.href,isExternal:e.isExternal??!0,shadow:"none","aria-label":e["aria-label"]??e.title,title:e.tooltip??e.title,theme:"clear",glass:v,disabled:e.disabled,rel:e.rel,target:e.target,"data-testid":`${n}-social-${k(e.title)}`},`${e.href??e.title}-${s}`))}),ae=()=>E?t.jsx("div",{className:r.combineClassNames(o.themeToggle,je),"data-testid":`${n}-theme-select`,"aria-label":Y,children:t.jsx(Te,{theme:"clear",label:be,labelPosition:m==="columns"?"top":"left",shadow:"none","aria-label":Y})}):null,ke=()=>{const e=t.jsxs(t.Fragment,{children:[oe(),u&&t.jsx("span",{className:r.combineClassNames(o.brandTitle,ge),"data-testid":`${n}-brand-title`,children:u})]});return t.jsxs("div",{className:r.combineClassNames(o.brand,_e),"data-testid":`${n}-brand`,children:[G?t.jsx(O,{href:G,className:r.combineClassNames(o.brandLink,U),target:R,rel:fe??(R==="_blank"?"noopener noreferrer":void 0),"aria-label":typeof u=="string"?u:x,children:e}):t.jsx("div",{className:r.combineClassNames(o.brandLink,U),children:e}),B&&t.jsx("p",{className:r.combineClassNames(o.brandDescription,$e),"data-testid":`${n}-brand-description`,children:B}),i&&!te&&t.jsx("div",{className:r.combineClassNames(o.copyright,J),"data-testid":`${n}-copyright`,children:t.jsx("p",{id:f,children:i})})]})},ze=()=>ee.length===0?null:t.jsx("div",{className:r.combineClassNames(o.sections,Ce),"data-testid":`${n}-sections`,children:ee.map((e,s)=>{const g=typeof e.title=="string"?e.title:`section-${s+1}`,h=e.testId??k(g);return t.jsxs("nav",{className:r.combineClassNames(o.section,e.className),"aria-label":e["aria-label"]??`${g} links`,"data-testid":`${n}-section-${h}`,children:[t.jsx("h2",{className:r.combineClassNames(o.sectionTitle,H,e.titleClassName),children:e.title}),t.jsx("ul",{className:r.combineClassNames(o.sectionList,e.listClassName),children:e.links.map(($,C)=>re($,C,e.linkClassName))})]},h)})});return m==="columns"?t.jsxs("footer",{className:_,"data-testid":n,role:"contentinfo","aria-label":Q,"aria-labelledby":V??f,"aria-describedby":W,...Z,children:[t.jsxs("div",{className:r.combineClassNames(o.content,L),children:[ke(),ze(),(N.length>0||E)&&t.jsxs("div",{className:r.combineClassNames(o.actions,ye),"data-testid":`${n}-actions`,children:[N.length>0&&t.jsxs("div",{className:r.combineClassNames(o.actionGroup,ve),children:[t.jsx("h2",{className:r.combineClassNames(o.sectionTitle,H),children:"Connect"}),ne()]}),ae()]})]}),(i||F)&&t.jsxs("div",{className:r.combineClassNames(o.bottom,Se),"data-testid":`${n}-bottom`,children:[i&&te&&t.jsx("p",{id:f,className:r.combineClassNames(o.bottomCopyright,we),"data-testid":`${n}-copyright`,children:i}),F&&t.jsx("div",{className:r.combineClassNames(o.bottomEnd,qe),"data-testid":`${n}-bottom-end`,children:F})]})]}):t.jsx("footer",{className:_,"data-testid":n,role:"contentinfo","aria-label":Q,"aria-labelledby":V??f,"aria-describedby":W,...Z,children:t.jsxs("div",{className:r.combineClassNames(o.content,L),children:[t.jsxs("div",{className:r.combineClassNames(o.left,P),"data-testid":`${n}-left`,children:[oe(),i&&t.jsx("div",{className:r.combineClassNames(o.copyright,J)??r.combineClassNames(o.left,P),"data-testid":`${n}-copyright`,children:t.jsx("p",{id:f,children:i})})]}),b.length>0&&t.jsx("nav",{className:r.combineClassNames(o.links,ue),"aria-label":X,"data-testid":`${n}-nav`,children:t.jsx("ul",{children:b.map((e,s)=>re(e,s,Ne))})}),ae(),ne()]})})};le.displayName="FooterBase";const Ee={footer:"footer",glass:"footer_glass",primary:"footer_primary",secondary:"footer_secondary",tertiary:"footer_tertiary",quaternary:"footer_quaternary",clear:"footer_clear",layoutColumns:"footer_layout-columns",shadowNone:"footer_shadow-None",shadowLight:"footer_shadow-Light",shadowMedium:"footer_shadow-Medium",shadowStrong:"footer_shadow-Strong",shadowIntense:"footer_shadow-Intense",roundNone:"footer_round-None",roundSmall:"footer_round-Small",roundMedium:"footer_round-Medium",roundLarge:"footer_round-Large",attachmentStatic:"footer_attachment-static",attachmentFixed:"footer_attachment-fixed",attachmentSticky:"footer_attachment-sticky",content:"footer_content",logo:"footer_logo",left:"footer_left",links:"footer_links",link:"footer_link",social:"footer_social",themeToggle:"footer_theme-toggle",copyright:"footer_copyright",brand:"footer_brand",brandLink:"footer_brand-link",brandTitle:"footer_brand-title",brandDescription:"footer_brand-description",sections:"footer_sections",section:"footer_section",sectionTitle:"footer_section-title",sectionList:"footer_section-list",actions:"footer_actions",actionGroup:"footer_action-group",bottom:"footer_bottom",bottomCopyright:"footer_bottom-copyright",bottomEnd:"footer_bottom-end"},de=c=>t.jsx(le,{...c,IconButton:Ge.IconButton,ThemeSelect:Re.UserThemeSettings,classMap:ie.expandClassMap(Ee)});de.displayName="Footer";exports.Footer=de;
1
+ "use strict";require('./Footer.css');const t=require("react/jsx-runtime"),ie=require("./propAliases-Bfsf5cJN.cjs"),Be=require("react"),r=require("./classNames-C7V3kfBj.cjs"),se=require("./boreal-style-config-BB8MdwYx.cjs"),y=require("./capitalize-CnTiekgk.cjs"),Ge=require("./IconButton-O0x6cSnS.cjs"),Re=require("./ThemeSelect-CM4xjgiQ.cjs"),k=c=>c.toLowerCase().trim().replace(/\s+/g,"-"),le=({theme:c=se.getDefaultTheme(),glass:v=se.getDefaultGlass(),attachment:ce="static",shadow:S="none",rounding:w="none",layout:m="inline",className:z="","data-testid":me,testId:n=me??"footer",copyright:i,copyrightInBottom:he,links:b=[],sections:q,logo:l,brandTitle:u,brandDescription:B,brandHref:G,brandTarget:R,brandRel:fe,socialLinks:N=[],showThemeSelect:E=!1,themeSelectLabel:be="Theme",bottomEnd:F,contentClassName:L,leftClassName:P,linksClassName:ue,linkClassName:Ne,logoClassName:T,socialClassName:xe,themeToggleClassName:je,brandClassName:_e,brandLinkClassName:U,brandTitleClassName:ge,brandDescriptionClassName:$e,sectionsClassName:Ce,sectionTitleClassName:H,actionsClassName:ye,actionGroupClassName:ve,bottomClassName:Se,bottomCopyrightClassName:we,bottomEndClassName:qe,copyrightClassName:J,IconButton:Fe,ImageComponent:K="img",ThemeSelect:Te,classMap:o,LinkWrapper:O=({href:j,children:_,...A})=>t.jsx("a",{href:j,...A,children:_}),"aria-label":Q,"aria-labelledby":V,"aria-describedby":W,navAriaLabel:X="Footer site links",socialNavAriaLabel:pe="Social media",themeSelectAriaLabel:Y="Theme selector",logoAriaLabel:x="Logo",logoDecorative:d=!1,labelId:f,...Z})=>{const j=ie.resolvePropAlias(ce),_=Be.useMemo(()=>r.combineClassNames(o.footer,o[c],v&&o.glass,m!=="inline"&&o[`layout${y.capitalize(m)}`],S!=="none"&&o[`shadow${y.capitalize(S)}`],w!=="none"&&o[`round${y.capitalize(w)}`],o[`attachment${y.capitalize(j)}`],z),[o,c,v,m,S,w,j,z]),D=typeof l=="string"||(e=>typeof e=="object"&&e!==null&&"src"in e)(l),a=D?typeof l=="string"?{src:l}:l:void 0,p=a==null?void 0:a.src,I=(a==null?void 0:a.width)??20,M=(a==null?void 0:a.height)??20,ee=q&&q.length>0?q:b.length>0?[{title:"Links",links:b,"aria-label":X,testId:"links"}]:[],te=he??m==="columns",oe=()=>D&&p?typeof K=="string"?t.jsx("img",{className:r.combineClassNames(o.logo,T),"data-testid":`${n}-logo`,loading:"lazy",src:p,alt:d?"":x,"aria-hidden":d?!0:void 0,height:M,width:I}):t.jsx(K,{className:r.combineClassNames(o.logo,T),"data-testid":`${n}-logo`,src:p,alt:d?"":x,"aria-hidden":d?!0:void 0,height:M,width:I}):l?t.jsx("span",{className:r.combineClassNames(o.logo,T),role:d?void 0:"img","aria-label":d?void 0:x,"aria-hidden":d?!0:void 0,"data-testid":`${n}-logo`,children:l}):null,re=(e,s,g)=>{const h=k(e.label||e.href||`link-${s}`),$=`${e.href??h}-${s}`,C=r.combineClassNames(o.link,g);return e.disabled?t.jsx("li",{children:t.jsx("span",{className:C,"data-testid":`${n}-link-${h}`,"aria-disabled":"true",title:e.title,children:e.label})},$):t.jsx("li",{children:t.jsx(O,{href:e.href,className:C,"data-testid":`${n}-link-${h}`,"aria-label":e["aria-label"],"aria-current":e["aria-current"],title:e.title,rel:e.rel,target:e.target,children:e.label})},$)},ne=()=>N.length===0?null:t.jsx("nav",{className:r.combineClassNames(o.social,xe),"aria-label":pe,"data-testid":`${n}-social`,children:N.map((e,s)=>t.jsx(Fe,{icon:e.icon,href:e.href,isExternal:e.isExternal??!0,shadow:"none","aria-label":e["aria-label"]??e.title,title:e.tooltip??e.title,theme:"clear",glass:v,disabled:e.disabled,rel:e.rel,target:e.target,"data-testid":`${n}-social-${k(e.title)}`},`${e.href??e.title}-${s}`))}),ae=()=>E?t.jsx("div",{className:r.combineClassNames(o.themeToggle,je),"data-testid":`${n}-theme-select`,"aria-label":Y,children:t.jsx(Te,{theme:"clear",label:be,labelPosition:m==="columns"?"top":"left",shadow:"none","aria-label":Y})}):null,ke=()=>{const e=t.jsxs(t.Fragment,{children:[oe(),u&&t.jsx("span",{className:r.combineClassNames(o.brandTitle,ge),"data-testid":`${n}-brand-title`,children:u})]});return t.jsxs("div",{className:r.combineClassNames(o.brand,_e),"data-testid":`${n}-brand`,children:[G?t.jsx(O,{href:G,className:r.combineClassNames(o.brandLink,U),target:R,rel:fe??(R==="_blank"?"noopener noreferrer":void 0),"aria-label":typeof u=="string"?u:x,children:e}):t.jsx("div",{className:r.combineClassNames(o.brandLink,U),children:e}),B&&t.jsx("p",{className:r.combineClassNames(o.brandDescription,$e),"data-testid":`${n}-brand-description`,children:B}),i&&!te&&t.jsx("div",{className:r.combineClassNames(o.copyright,J),"data-testid":`${n}-copyright`,children:t.jsx("p",{id:f,children:i})})]})},ze=()=>ee.length===0?null:t.jsx("div",{className:r.combineClassNames(o.sections,Ce),"data-testid":`${n}-sections`,children:ee.map((e,s)=>{const g=typeof e.title=="string"?e.title:`section-${s+1}`,h=e.testId??k(g);return t.jsxs("nav",{className:r.combineClassNames(o.section,e.className),"aria-label":e["aria-label"]??`${g} links`,"data-testid":`${n}-section-${h}`,children:[t.jsx("h2",{className:r.combineClassNames(o.sectionTitle,H,e.titleClassName),children:e.title}),t.jsx("ul",{className:r.combineClassNames(o.sectionList,e.listClassName),children:e.links.map(($,C)=>re($,C,e.linkClassName))})]},h)})});return m==="columns"?t.jsxs("footer",{className:_,"data-testid":n,role:"contentinfo","aria-label":Q,"aria-labelledby":V??f,"aria-describedby":W,...Z,children:[t.jsxs("div",{className:r.combineClassNames(o.content,L),children:[ke(),ze(),(N.length>0||E)&&t.jsxs("div",{className:r.combineClassNames(o.actions,ye),"data-testid":`${n}-actions`,children:[N.length>0&&t.jsxs("div",{className:r.combineClassNames(o.actionGroup,ve),children:[t.jsx("h2",{className:r.combineClassNames(o.sectionTitle,H),children:"Connect"}),ne()]}),ae()]})]}),(i||F)&&t.jsxs("div",{className:r.combineClassNames(o.bottom,Se),"data-testid":`${n}-bottom`,children:[i&&te&&t.jsx("p",{id:f,className:r.combineClassNames(o.bottomCopyright,we),"data-testid":`${n}-copyright`,children:i}),F&&t.jsx("div",{className:r.combineClassNames(o.bottomEnd,qe),"data-testid":`${n}-bottom-end`,children:F})]})]}):t.jsx("footer",{className:_,"data-testid":n,role:"contentinfo","aria-label":Q,"aria-labelledby":V??f,"aria-describedby":W,...Z,children:t.jsxs("div",{className:r.combineClassNames(o.content,L),children:[t.jsxs("div",{className:r.combineClassNames(o.left,P),"data-testid":`${n}-left`,children:[oe(),i&&t.jsx("div",{className:r.combineClassNames(o.copyright,J)??r.combineClassNames(o.left,P),"data-testid":`${n}-copyright`,children:t.jsx("p",{id:f,children:i})})]}),b.length>0&&t.jsx("nav",{className:r.combineClassNames(o.links,ue),"aria-label":X,"data-testid":`${n}-nav`,children:t.jsx("ul",{children:b.map((e,s)=>re(e,s,Ne))})}),ae(),ne()]})})};le.displayName="FooterBase";const Ee={footer:"footer",glass:"footer_glass",primary:"footer_primary",secondary:"footer_secondary",tertiary:"footer_tertiary",quaternary:"footer_quaternary",clear:"footer_clear",layoutColumns:"footer_layout-columns",shadowNone:"footer_shadow-None",shadowLight:"footer_shadow-Light",shadowMedium:"footer_shadow-Medium",shadowStrong:"footer_shadow-Strong",shadowIntense:"footer_shadow-Intense",roundNone:"footer_round-None",roundSmall:"footer_round-Small",roundMedium:"footer_round-Medium",roundLarge:"footer_round-Large",attachmentStatic:"footer_attachment-static",attachmentFixed:"footer_attachment-fixed",attachmentSticky:"footer_attachment-sticky",content:"footer_content",logo:"footer_logo",left:"footer_left",links:"footer_links",link:"footer_link",social:"footer_social",themeToggle:"footer_theme-toggle",copyright:"footer_copyright",brand:"footer_brand",brandLink:"footer_brand-link",brandTitle:"footer_brand-title",brandDescription:"footer_brand-description",sections:"footer_sections",section:"footer_section",sectionTitle:"footer_section-title",sectionList:"footer_section-list",actions:"footer_actions",actionGroup:"footer_action-group",bottom:"footer_bottom",bottomCopyright:"footer_bottom-copyright",bottomEnd:"footer_bottom-end"},de=c=>t.jsx(le,{...c,IconButton:Ge.IconButton,ThemeSelect:Re.UserThemeSettings,classMap:ie.expandClassMap(Ee)});de.displayName="Footer";exports.Footer=de;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Footer-CqEL5lCo.cjs");exports.default=e.Footer;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Footer-Z9Cs3krN.cjs");exports.default=e.Footer;
@@ -1,4 +1,4 @@
1
- import { F as f } from "./Footer-W9ItlBXS.js";
1
+ import { F as f } from "./Footer-Dxs6VCx2.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,33 +1,33 @@
1
- import { jsxs as z, jsx as P } from "react/jsx-runtime";
2
- import { useMemo as T, useCallback as k, useState as F, useEffect as I, useInsertionEffect as B, createContext as D } from "react";
3
- import { c as H } from "./boreal-style-config-rYvfCHLY.js";
4
- import { defaultColorSchemes as G } from "./colorSchemes.js";
5
- const b = "boreal:selectedSchemeName", N = "boreal:theme-change", w = 4.5, _ = 3;
6
- function K(t, e = []) {
1
+ import { jsxs as F, jsx as D } from "react/jsx-runtime";
2
+ import { createContext as G, useMemo as I, useState as O, useCallback as E, useInsertionEffect as K, useEffect as L, useLayoutEffect as U } from "react";
3
+ import { c as j } from "./boreal-style-config-rYvfCHLY.js";
4
+ import { defaultColorSchemes as W } from "./colorSchemes.js";
5
+ const b = "boreal:selectedSchemeName", $ = "boreal:theme-change", T = 4.5, H = 3;
6
+ function X(t, e = []) {
7
7
  const r = [...t];
8
8
  for (const o of e) {
9
- const n = r.findIndex((c) => c.name === o.name);
9
+ const n = r.findIndex((a) => a.name === o.name);
10
10
  n >= 0 ? r[n] = o : r.push(o);
11
11
  }
12
12
  return r;
13
13
  }
14
- function x(t, e) {
14
+ function v(t, e) {
15
15
  return e ? t.findIndex((r) => r.name === e) : -1;
16
16
  }
17
- function J({
17
+ function V({
18
18
  customSchemes: t = [],
19
19
  useOnlyCustomSchemes: e = !1
20
20
  }) {
21
- return e ? [...t] : K([...G], t);
21
+ return e ? [...t] : X([...W], t);
22
22
  }
23
- function U(t, {
23
+ function Y(t, {
24
24
  initialSchemeName: e,
25
25
  savedSchemeName: r
26
26
  }) {
27
- const o = x(t, e), n = x(t, r), c = x(t, H());
28
- return o !== -1 ? o : n !== -1 ? n : c !== -1 ? c : 0;
27
+ const o = v(t, e), n = v(t, r), a = v(t, j());
28
+ return o !== -1 ? o : n !== -1 ? n : a !== -1 ? a : 0;
29
29
  }
30
- function E(t) {
30
+ function N(t) {
31
31
  if (!t) return null;
32
32
  try {
33
33
  return t.getItem(b);
@@ -35,7 +35,7 @@ function E(t) {
35
35
  return console.error("Failed to load saved theme name"), null;
36
36
  }
37
37
  }
38
- function W(t, e) {
38
+ function Q(t, e) {
39
39
  if (!t) return !1;
40
40
  try {
41
41
  return t.getItem(b) === e ? !1 : (t.setItem(b, e), !0);
@@ -43,311 +43,313 @@ function W(t, e) {
43
43
  return console.error("Failed to save theme name"), !1;
44
44
  }
45
45
  }
46
- function X(t, e = typeof window > "u" ? void 0 : window) {
46
+ function Z(t, e = typeof window > "u" ? void 0 : window) {
47
47
  e && e.dispatchEvent(
48
- new CustomEvent(N, {
48
+ new CustomEvent($, {
49
49
  detail: { schemeName: t }
50
50
  })
51
51
  );
52
52
  }
53
- function j(t) {
53
+ function z(t) {
54
54
  const e = t.trim(), r = /^#([\da-f])([\da-f])([\da-f])$/i.exec(e);
55
55
  return r ? `#${r[1]}${r[1]}${r[2]}${r[2]}${r[3]}${r[3]}`.toLowerCase() : /^#[\da-f]{6}([\da-f]{2})?$/i.exec(e) ? e.slice(0, 7).toLowerCase() : null;
56
56
  }
57
- function $(t) {
58
- const e = j(t) ?? "#000000", r = parseInt(e.slice(1, 3), 16) / 255, o = parseInt(e.slice(3, 5), 16) / 255, n = parseInt(e.slice(5, 7), 16) / 255, c = Math.max(r, o, n), i = Math.min(r, o, n);
59
- let a = 0, l = 0;
60
- const h = (c + i) / 2;
61
- if (c !== i) {
62
- const u = c - i;
63
- switch (l = h > 0.5 ? u / (2 - c - i) : u / (c + i), c) {
57
+ function q(t) {
58
+ const e = z(t) ?? "#000000", r = parseInt(e.slice(1, 3), 16) / 255, o = parseInt(e.slice(3, 5), 16) / 255, n = parseInt(e.slice(5, 7), 16) / 255, a = Math.max(r, o, n), i = Math.min(r, o, n);
59
+ let l = 0, u = 0;
60
+ const c = (a + i) / 2;
61
+ if (a !== i) {
62
+ const f = a - i;
63
+ switch (u = c > 0.5 ? f / (2 - a - i) : f / (a + i), a) {
64
64
  case r:
65
- a = (o - n) / u + (o < n ? 6 : 0);
65
+ l = (o - n) / f + (o < n ? 6 : 0);
66
66
  break;
67
67
  case o:
68
- a = (n - r) / u + 2;
68
+ l = (n - r) / f + 2;
69
69
  break;
70
70
  case n:
71
- a = (r - o) / u + 4;
71
+ l = (r - o) / f + 4;
72
72
  break;
73
73
  }
74
- a /= 6;
74
+ l /= 6;
75
75
  }
76
76
  return {
77
- h: Math.round(a * 360),
78
- s: Math.round(l * 100),
79
- l: Math.round(h * 100)
77
+ h: Math.round(l * 360),
78
+ s: Math.round(u * 100),
79
+ l: Math.round(c * 100)
80
80
  };
81
81
  }
82
- function L(t, e, r) {
82
+ function _(t, e, r) {
83
83
  e /= 100, r /= 100;
84
- const o = (i) => (i + t / 30) % 12, n = e * Math.min(r, 1 - r), c = (i) => Math.round(
84
+ const o = (i) => (i + t / 30) % 12, n = e * Math.min(r, 1 - r), a = (i) => Math.round(
85
85
  255 * (r - n * Math.max(-1, Math.min(o(i) - 3, Math.min(9 - o(i), 1))))
86
86
  );
87
- return `#${[c(0), c(8), c(4)].map((i) => i.toString(16).padStart(2, "0")).join("")}`;
87
+ return `#${[a(0), a(8), a(4)].map((i) => i.toString(16).padStart(2, "0")).join("")}`;
88
88
  }
89
89
  function y(t, e) {
90
- const { h: r, s: o, l: n } = $(t);
91
- return L(r, o, Math.min(100, Math.max(0, n + e)));
90
+ const { h: r, s: o, l: n } = q(t);
91
+ return _(r, o, Math.min(100, Math.max(0, n + e)));
92
92
  }
93
- function A(t) {
94
- const e = j(t) ?? "#000000", r = [1, 3, 5].map((o) => {
93
+ function R(t) {
94
+ const e = z(t) ?? "#000000", r = [1, 3, 5].map((o) => {
95
95
  const n = parseInt(e.slice(o, o + 2), 16) / 255;
96
96
  return n <= 0.03928 ? n / 12.92 : Math.pow((n + 0.055) / 1.055, 2.4);
97
97
  });
98
98
  return 0.2126 * r[0] + 0.7152 * r[1] + 0.0722 * r[2];
99
99
  }
100
- function g(t, e) {
101
- const r = A(t), o = A(e), n = Math.max(r, o), c = Math.min(r, o);
102
- return (n + 0.05) / (c + 0.05);
100
+ function p(t, e) {
101
+ const r = R(t), o = R(e), n = Math.max(r, o), a = Math.min(r, o);
102
+ return (n + 0.05) / (a + 0.05);
103
103
  }
104
- function C(t, e, r = w) {
105
- if (e && g(t, e) >= r)
104
+ function w(t, e, r = T) {
105
+ if (e && p(t, e) >= r)
106
106
  return e;
107
- const o = g(t, "#000000"), n = g(t, "#ffffff");
107
+ const o = p(t, "#000000"), n = p(t, "#ffffff");
108
108
  return o >= n ? "#000000" : "#ffffff";
109
109
  }
110
- function Y(t, e, r) {
110
+ function ee(t, e, r) {
111
111
  const o = y(e, r);
112
- return g(t, o) >= w ? o : e;
112
+ return p(t, o) >= T ? o : e;
113
113
  }
114
- function O(t, e) {
114
+ function J(t, e) {
115
115
  const r = e === "#000000" ? 1 : -1;
116
116
  for (let o = 30; o >= 0; o -= 5) {
117
117
  const n = y(e, o * r);
118
- if (g(t, n) >= w)
118
+ if (p(t, n) >= T)
119
119
  return n;
120
120
  }
121
121
  return e;
122
122
  }
123
- function p(t, e, r) {
123
+ function x(t, e, r) {
124
124
  const o = y(t, r);
125
- if (g(o, e) >= w)
125
+ if (p(o, e) >= T)
126
126
  return o;
127
- const { h: n, s: c, l: i } = $(t), a = e === "#ffffff";
128
- for (let l = 4; l <= 48; l += 4) {
129
- const h = a ? Math.max(0, i - l) : Math.min(100, i + l), u = L(n, c, h);
130
- if (g(u, e) >= w)
131
- return u;
127
+ const { h: n, s: a, l: i } = q(t), l = e === "#ffffff";
128
+ for (let u = 4; u <= 48; u += 4) {
129
+ const c = l ? Math.max(0, i - u) : Math.min(100, i + u), f = _(n, a, c);
130
+ if (p(f, e) >= T)
131
+ return f;
132
132
  }
133
133
  return t;
134
134
  }
135
- function M(t, e = 14, r = 14) {
136
- const { h: o, s: n, l: c } = $(t), i = c >= 50 ? Math.max(0, c - r) : Math.min(100, c + e), a = n > 8 ? Math.max(0, n - 8) : n, l = L(o, a, i);
137
- return g(t, l) >= _ ? l : C(t, void 0, _);
135
+ function k(t, e = 14, r = 14) {
136
+ const { h: o, s: n, l: a } = q(t), i = a >= 50 ? Math.max(0, a - r) : Math.min(100, a + e), l = n > 8 ? Math.max(0, n - 8) : n, u = _(o, l, i);
137
+ return p(t, u) >= H ? u : w(t, void 0, H);
138
138
  }
139
- function Q(t) {
139
+ function te(t) {
140
140
  const {
141
141
  primaryColor: e,
142
142
  secondaryColor: r,
143
143
  tertiaryColor: o,
144
144
  quaternaryColor: n,
145
- backgroundColor: c,
145
+ backgroundColor: a,
146
146
  forceTextColor: i
147
- } = t, a = C(c, i), l = C(e, i), h = C(r), u = C(o), v = C(n);
147
+ } = t, l = w(a, i), u = w(e, i), c = w(r), f = w(o), g = w(n);
148
148
  return {
149
149
  "--primary-color": e,
150
150
  "--primary-color-light": y(e, 10),
151
- "--primary-color-hover": p(
151
+ "--primary-color-hover": x(
152
152
  e,
153
- l,
153
+ u,
154
154
  -10
155
155
  ),
156
- "--text-color-primary": l,
157
- "--text-color-primary-contrast": a,
158
- "--text-color": a,
159
- "--text-color-light": O(c, a),
160
- "--text-color-lighter": O(
161
- c,
162
- a
156
+ "--text-color-primary": u,
157
+ "--text-color-primary-contrast": l,
158
+ "--text-color": l,
159
+ "--text-color-light": J(a, l),
160
+ "--text-color-lighter": J(
161
+ a,
162
+ l
163
163
  ),
164
164
  "--secondary-color": r,
165
165
  "--secondary-color-light": y(r, 10),
166
- "--secondary-color-hover": p(
166
+ "--secondary-color-hover": x(
167
167
  r,
168
- h,
168
+ c,
169
169
  -10
170
170
  ),
171
- "--text-color-secondary": h,
171
+ "--text-color-secondary": c,
172
172
  "--tertiary-color": o,
173
173
  "--tertiary-color-light": y(o, 10),
174
- "--tertiary-color-hover": p(
174
+ "--tertiary-color-hover": x(
175
175
  o,
176
- u,
176
+ f,
177
177
  -10
178
178
  ),
179
- "--text-color-tertiary": u,
179
+ "--text-color-tertiary": f,
180
180
  "--quaternary-color": n,
181
181
  "--quaternary-color-light": y(n, 10),
182
- "--quaternary-color-hover": p(
182
+ "--quaternary-color-hover": x(
183
183
  n,
184
- v,
184
+ g,
185
185
  -10
186
186
  ),
187
- "--text-color-quaternary": v,
188
- "--background-color": c,
189
- "--background-color-dark": y(c, -10),
190
- "--background-color-darker": y(c, -25),
191
- "--background-color-light": y(c, 10),
192
- "--background-color-lighter": y(c, 20),
193
- "--link-color": a,
194
- "--link-hover-color": Y(
195
- c,
187
+ "--text-color-quaternary": g,
188
+ "--background-color": a,
189
+ "--background-color-dark": y(a, -10),
190
+ "--background-color-darker": y(a, -25),
191
+ "--background-color-light": y(a, 10),
192
+ "--background-color-lighter": y(a, 20),
193
+ "--link-color": l,
194
+ "--link-hover-color": ee(
196
195
  a,
197
- a === "#ffffff" ? -20 : 20
196
+ l,
197
+ l === "#ffffff" ? -20 : 20
198
198
  ),
199
- "--link-hover-color-primary": p(
199
+ "--link-hover-color-primary": x(
200
200
  e,
201
- l,
201
+ u,
202
202
  -10
203
203
  ),
204
- "--link-hover-color-secondary": p(
204
+ "--link-hover-color-secondary": x(
205
205
  r,
206
- h,
206
+ c,
207
207
  -10
208
208
  ),
209
- "--link-hover-color-tertiary": p(
209
+ "--link-hover-color-tertiary": x(
210
210
  o,
211
- u,
211
+ f,
212
212
  -10
213
213
  ),
214
- "--link-hover-color-quaternary": p(
214
+ "--link-hover-color-quaternary": x(
215
215
  n,
216
- v,
216
+ g,
217
217
  -10
218
218
  ),
219
- "--focus-outline-color": a,
220
- "--divider-color": M(c),
221
- "--border-color": M(c),
222
- "--border-color-subtle": M(c, 10, 10),
223
- "--border-color-strong": M(c, 20, 20)
219
+ "--focus-outline-color": l,
220
+ "--divider-color": k(a),
221
+ "--border-color": k(a),
222
+ "--border-color-subtle": k(a, 10, 10),
223
+ "--border-color-strong": k(a, 20, 20)
224
224
  };
225
225
  }
226
- function Z(t, e) {
226
+ function re(t, e) {
227
227
  for (const [r, o] of Object.entries(e))
228
228
  t.setProperty(r, o);
229
229
  }
230
- function ee(t, e = document) {
231
- Z(
230
+ function oe(t, e = document) {
231
+ re(
232
232
  e.documentElement.style,
233
- Q(t)
233
+ te(t)
234
234
  ), e.documentElement.dataset.borealTheme = t.name;
235
235
  }
236
- function te({
236
+ function ne({
237
237
  customSchemes: t = [],
238
238
  initialSchemeName: e,
239
239
  useOnlyCustomSchemes: r = !1
240
240
  } = {}) {
241
- const o = J({ customSchemes: t, useOnlyCustomSchemes: r }), n = H();
241
+ const o = V({ customSchemes: t, useOnlyCustomSchemes: r }), n = j();
242
242
  return `(function(){try{var s=${JSON.stringify(o).replace(/</g, "\\u003c")};var k=${JSON.stringify(b)};var initial=${JSON.stringify(e ?? null)};var fallback=${JSON.stringify(n)};var saved=null;try{saved=localStorage.getItem(k)}catch(e){}var name=initial||saved||fallback;var scheme=s.find(function(x){return x.name===name})||s.find(function(x){return x.name===fallback})||s[0];if(!scheme)return;var d=document.documentElement.style;var hex=function(v){v=String(v||"").trim();var m=/^#([\\da-f])([\\da-f])([\\da-f])$/i.exec(v);if(m)return("#"+m[1]+m[1]+m[2]+m[2]+m[3]+m[3]).toLowerCase();return /^#[\\da-f]{6}([\\da-f]{2})?$/i.test(v)?v.slice(0,7).toLowerCase():"#000000"};var lum=function(v){v=hex(v);var r=[1,3,5].map(function(i){var c=parseInt(v.slice(i,i+2),16)/255;return c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4)});return .2126*r[0]+.7152*r[1]+.0722*r[2]};var contrast=function(a,b){var x=lum(a),y=lum(b),l=Math.max(x,y),q=Math.min(x,y);return(l+.05)/(q+.05)};var text=function(bg,preferred,min){min=min||4.5;if(preferred&&contrast(bg,preferred)>=min)return preferred;return contrast(bg,"#000000")>=contrast(bg,"#ffffff")?"#000000":"#ffffff"};var set=function(n,v){d.setProperty(n,v)};var page=text(scheme.backgroundColor,scheme.forceTextColor);set("--primary-color",scheme.primaryColor);set("--secondary-color",scheme.secondaryColor);set("--tertiary-color",scheme.tertiaryColor);set("--quaternary-color",scheme.quaternaryColor);set("--background-color",scheme.backgroundColor);set("--text-color",page);set("--text-color-primary",text(scheme.primaryColor,scheme.forceTextColor));set("--text-color-primary-contrast",page);set("--text-color-secondary",text(scheme.secondaryColor));set("--text-color-tertiary",text(scheme.tertiaryColor));set("--text-color-quaternary",text(scheme.quaternaryColor));set("--link-color",page);set("--focus-outline-color",page);document.documentElement.dataset.borealTheme=scheme.name}catch(e){}})();`;
243
243
  }
244
- const re = D(
244
+ const ae = G(
245
245
  void 0
246
- ), se = ({
246
+ ), ce = typeof window > "u" ? L : U, fe = ({
247
247
  children: t,
248
248
  customSchemes: e = [],
249
249
  enableThemeScript: r = !0,
250
250
  initialSchemeName: o,
251
251
  useOnlyCustomSchemes: n = !1
252
252
  }) => {
253
- const c = T(
253
+ const a = I(
254
254
  () => JSON.stringify(e ?? []),
255
255
  [e]
256
- ), i = T(() => {
256
+ ), [i, l] = O(!1), u = I(() => {
257
257
  try {
258
- const s = JSON.parse(c);
258
+ const s = JSON.parse(a);
259
259
  if (Array.isArray(s))
260
260
  return s;
261
261
  } catch {
262
262
  console.error("Failed to parse custom schemes");
263
263
  }
264
264
  return [];
265
- }, [c]), a = T(
266
- () => J({
267
- customSchemes: i,
265
+ }, [a]), c = I(
266
+ () => V({
267
+ customSchemes: u,
268
268
  useOnlyCustomSchemes: n
269
269
  }),
270
- [i, n]
271
- ), l = k(
270
+ [u, n]
271
+ ), f = E(
272
272
  (s) => {
273
- var f, d;
274
- const m = U(a, {
273
+ var m, d;
274
+ const h = Y(c, {
275
275
  initialSchemeName: o,
276
276
  savedSchemeName: s
277
277
  });
278
- return ((f = a[m]) == null ? void 0 : f.name) ?? ((d = a[0]) == null ? void 0 : d.name) ?? "";
278
+ return ((m = c[h]) == null ? void 0 : m.name) ?? ((d = c[0]) == null ? void 0 : d.name) ?? "";
279
279
  },
280
- [o, a]
281
- ), [h, u] = F(
282
- () => l(
283
- typeof window > "u" ? null : E(window.localStorage)
284
- )
285
- ), v = T(() => {
286
- const s = x(a, h);
280
+ [o, c]
281
+ ), [g, M] = O(
282
+ () => {
283
+ const s = typeof window > "u" ? null : N(window.localStorage);
284
+ return f(s);
285
+ }
286
+ ), C = I(() => {
287
+ const s = v(c, g);
287
288
  return s === -1 ? 0 : s;
288
- }, [a, h]), R = k(
289
+ }, [c, g]), P = E(
289
290
  (s) => {
290
- u((m) => {
291
- const f = typeof s == "function" ? s(m) : s;
292
- return x(a, f) === -1 ? m : f;
291
+ M((h) => {
292
+ const m = typeof s == "function" ? s(h) : s;
293
+ return v(c, m) === -1 ? h : m;
293
294
  });
294
295
  },
295
- [a]
296
- ), V = k(
296
+ [c]
297
+ ), B = E(
297
298
  (s) => {
298
- u((m) => {
299
+ M((h) => {
299
300
  var S;
300
- const f = x(a, m), d = typeof s == "function" ? s(f === -1 ? 0 : f) : s;
301
- return ((S = a[d]) == null ? void 0 : S.name) ?? m;
301
+ const m = v(c, h), d = typeof s == "function" ? s(m === -1 ? 0 : m) : s;
302
+ return ((S = c[d]) == null ? void 0 : S.name) ?? h;
302
303
  });
303
304
  },
304
- [a]
305
+ [c]
305
306
  );
306
- return I(() => {
307
- const s = typeof window > "u" ? null : E(window.localStorage), m = x(a, s), f = l(s);
308
- u((d) => o ? f : m !== -1 ? s : x(a, d) !== -1 ? d : f);
309
- }, [o, l, a]), B(() => {
310
- const s = a[v] ?? a[0];
311
- !s || typeof document > "u" || ee(s, document);
312
- }, [v, a]), I(() => {
307
+ return ce(() => {
308
+ const s = typeof window > "u" ? null : N(window.localStorage), h = v(c, s), m = f(s);
309
+ M((d) => o ? m : h !== -1 ? s : v(c, d) !== -1 ? d : m), l(!0);
310
+ }, [o, f, c]), K(() => {
311
+ const s = c[C] ?? c[0];
312
+ !s || typeof document > "u" || oe(s, document);
313
+ }, [C, c]), L(() => {
313
314
  if (typeof window > "u") return;
314
315
  const s = (d) => {
315
- x(a, d) !== -1 && u(
316
+ v(c, d) !== -1 && M(
316
317
  (S) => S === d ? S : d
317
318
  );
319
+ }, h = (d) => {
320
+ var A;
321
+ s((A = d.detail) == null ? void 0 : A.schemeName);
318
322
  }, m = (d) => {
319
- var q;
320
- s((q = d.detail) == null ? void 0 : q.schemeName);
321
- }, f = (d) => {
322
323
  d.key === b && s(d.newValue);
323
324
  };
324
- return window.addEventListener(N, m), window.addEventListener("storage", f), s(E(window.localStorage)), () => {
325
- window.removeEventListener(N, m), window.removeEventListener("storage", f);
325
+ return window.addEventListener($, h), window.addEventListener("storage", m), s(N(window.localStorage)), () => {
326
+ window.removeEventListener($, h), window.removeEventListener("storage", m);
326
327
  };
327
- }, [a]), I(() => {
328
- const s = a[v] ?? a[0];
328
+ }, [c]), L(() => {
329
+ if (!i) return;
330
+ const s = c[C] ?? c[0];
329
331
  if (!s) return;
330
- W(
332
+ Q(
331
333
  typeof window > "u" ? void 0 : window.localStorage,
332
334
  s.name
333
- ) && X(s.name);
334
- }, [v, a]), /* @__PURE__ */ z(
335
- re.Provider,
335
+ ) && Z(s.name);
336
+ }, [i, C, c]), /* @__PURE__ */ F(
337
+ ae.Provider,
336
338
  {
337
339
  value: {
338
- selectedScheme: v,
339
- selectedSchemeName: h,
340
- setSelectedScheme: V,
341
- setSelectedSchemeName: R,
342
- schemes: a
340
+ selectedScheme: C,
341
+ selectedSchemeName: g,
342
+ setSelectedScheme: B,
343
+ setSelectedSchemeName: P,
344
+ schemes: c
343
345
  },
344
346
  children: [
345
- r ? /* @__PURE__ */ P(
347
+ r ? /* @__PURE__ */ D(
346
348
  "script",
347
349
  {
348
350
  dangerouslySetInnerHTML: {
349
- __html: te({
350
- customSchemes: i,
351
+ __html: ne({
352
+ customSchemes: u,
351
353
  initialSchemeName: o,
352
354
  useOnlyCustomSchemes: n
353
355
  })
@@ -361,7 +363,7 @@ const re = D(
361
363
  );
362
364
  };
363
365
  export {
364
- re as T,
365
- se as a,
366
- te as g
366
+ ae as T,
367
+ fe as a,
368
+ ne as g
367
369
  };
@@ -0,0 +1 @@
1
+ "use strict";const _=require("react/jsx-runtime"),m=require("react"),H=require("./boreal-style-config-BB8MdwYx.cjs"),D=require("./colorSchemes.cjs.js"),T="boreal:selectedSchemeName",N="boreal:theme-change",M=4.5,A=3;function F(t,e=[]){const r=[...t];for(const o of e){const n=r.findIndex(a=>a.name===o.name);n>=0?r[n]=o:r.push(o)}return r}function x(t,e){return e?t.findIndex(r=>r.name===e):-1}function j({customSchemes:t=[],useOnlyCustomSchemes:e=!1}){return e?[...t]:F([...D.defaultColorSchemes],t)}function G(t,{initialSchemeName:e,savedSchemeName:r}){const o=x(t,e),n=x(t,r),a=x(t,H.getDefaultColorSchemeName());return o!==-1?o:n!==-1?n:a!==-1?a:0}function E(t){if(!t)return null;try{return t.getItem(T)}catch{return console.error("Failed to load saved theme name"),null}}function K(t,e){if(!t)return!1;try{return t.getItem(T)===e?!1:(t.setItem(T,e),!0)}catch{return console.error("Failed to save theme name"),!1}}function U(t,e=typeof window>"u"?void 0:window){e&&e.dispatchEvent(new CustomEvent(N,{detail:{schemeName:t}}))}function J(t){const e=t.trim(),r=/^#([\da-f])([\da-f])([\da-f])$/i.exec(e);return r?`#${r[1]}${r[1]}${r[2]}${r[2]}${r[3]}${r[3]}`.toLowerCase():/^#[\da-f]{6}([\da-f]{2})?$/i.exec(e)?e.slice(0,7).toLowerCase():null}function q(t){const e=J(t)??"#000000",r=parseInt(e.slice(1,3),16)/255,o=parseInt(e.slice(3,5),16)/255,n=parseInt(e.slice(5,7),16)/255,a=Math.max(r,o,n),i=Math.min(r,o,n);let l=0,u=0;const c=(a+i)/2;if(a!==i){const f=a-i;switch(u=c>.5?f/(2-a-i):f/(a+i),a){case r:l=(o-n)/f+(o<n?6:0);break;case o:l=(n-r)/f+2;break;case n:l=(r-o)/f+4;break}l/=6}return{h:Math.round(l*360),s:Math.round(u*100),l:Math.round(c*100)}}function L(t,e,r){e/=100,r/=100;const o=i=>(i+t/30)%12,n=e*Math.min(r,1-r),a=i=>Math.round(255*(r-n*Math.max(-1,Math.min(o(i)-3,Math.min(9-o(i),1)))));return`#${[a(0),a(8),a(4)].map(i=>i.toString(16).padStart(2,"0")).join("")}`}function v(t,e){const{h:r,s:o,l:n}=q(t);return L(r,o,Math.min(100,Math.max(0,n+e)))}function R(t){const e=J(t)??"#000000",r=[1,3,5].map(o=>{const n=parseInt(e.slice(o,o+2),16)/255;return n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4)});return .2126*r[0]+.7152*r[1]+.0722*r[2]}function p(t,e){const r=R(t),o=R(e),n=Math.max(r,o),a=Math.min(r,o);return(n+.05)/(a+.05)}function b(t,e,r=M){if(e&&p(t,e)>=r)return e;const o=p(t,"#000000"),n=p(t,"#ffffff");return o>=n?"#000000":"#ffffff"}function W(t,e,r){const o=v(e,r);return p(t,o)>=M?o:e}function O(t,e){const r=e==="#000000"?1:-1;for(let o=30;o>=0;o-=5){const n=v(e,o*r);if(p(t,n)>=M)return n}return e}function g(t,e,r){const o=v(t,r);if(p(o,e)>=M)return o;const{h:n,s:a,l:i}=q(t),l=e==="#ffffff";for(let u=4;u<=48;u+=4){const c=l?Math.max(0,i-u):Math.min(100,i+u),f=L(n,a,c);if(p(f,e)>=M)return f}return t}function k(t,e=14,r=14){const{h:o,s:n,l:a}=q(t),i=a>=50?Math.max(0,a-r):Math.min(100,a+e),l=n>8?Math.max(0,n-8):n,u=L(o,l,i);return p(t,u)>=A?u:b(t,void 0,A)}function X(t){const{primaryColor:e,secondaryColor:r,tertiaryColor:o,quaternaryColor:n,backgroundColor:a,forceTextColor:i}=t,l=b(a,i),u=b(e,i),c=b(r),f=b(o),S=b(n);return{"--primary-color":e,"--primary-color-light":v(e,10),"--primary-color-hover":g(e,u,-10),"--text-color-primary":u,"--text-color-primary-contrast":l,"--text-color":l,"--text-color-light":O(a,l),"--text-color-lighter":O(a,l),"--secondary-color":r,"--secondary-color-light":v(r,10),"--secondary-color-hover":g(r,c,-10),"--text-color-secondary":c,"--tertiary-color":o,"--tertiary-color-light":v(o,10),"--tertiary-color-hover":g(o,f,-10),"--text-color-tertiary":f,"--quaternary-color":n,"--quaternary-color-light":v(n,10),"--quaternary-color-hover":g(n,S,-10),"--text-color-quaternary":S,"--background-color":a,"--background-color-dark":v(a,-10),"--background-color-darker":v(a,-25),"--background-color-light":v(a,10),"--background-color-lighter":v(a,20),"--link-color":l,"--link-hover-color":W(a,l,l==="#ffffff"?-20:20),"--link-hover-color-primary":g(e,u,-10),"--link-hover-color-secondary":g(r,c,-10),"--link-hover-color-tertiary":g(o,f,-10),"--link-hover-color-quaternary":g(n,S,-10),"--focus-outline-color":l,"--divider-color":k(a),"--border-color":k(a),"--border-color-subtle":k(a,10,10),"--border-color-strong":k(a,20,20)}}function Y(t,e){for(const[r,o]of Object.entries(e))t.setProperty(r,o)}function Q(t,e=document){Y(e.documentElement.style,X(t)),e.documentElement.dataset.borealTheme=t.name}function z({customSchemes:t=[],initialSchemeName:e,useOnlyCustomSchemes:r=!1}={}){const o=j({customSchemes:t,useOnlyCustomSchemes:r}),n=H.getDefaultColorSchemeName();return`(function(){try{var s=${JSON.stringify(o).replace(/</g,"\\u003c")};var k=${JSON.stringify(T)};var initial=${JSON.stringify(e??null)};var fallback=${JSON.stringify(n)};var saved=null;try{saved=localStorage.getItem(k)}catch(e){}var name=initial||saved||fallback;var scheme=s.find(function(x){return x.name===name})||s.find(function(x){return x.name===fallback})||s[0];if(!scheme)return;var d=document.documentElement.style;var hex=function(v){v=String(v||"").trim();var m=/^#([\\da-f])([\\da-f])([\\da-f])$/i.exec(v);if(m)return("#"+m[1]+m[1]+m[2]+m[2]+m[3]+m[3]).toLowerCase();return /^#[\\da-f]{6}([\\da-f]{2})?$/i.test(v)?v.slice(0,7).toLowerCase():"#000000"};var lum=function(v){v=hex(v);var r=[1,3,5].map(function(i){var c=parseInt(v.slice(i,i+2),16)/255;return c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4)});return .2126*r[0]+.7152*r[1]+.0722*r[2]};var contrast=function(a,b){var x=lum(a),y=lum(b),l=Math.max(x,y),q=Math.min(x,y);return(l+.05)/(q+.05)};var text=function(bg,preferred,min){min=min||4.5;if(preferred&&contrast(bg,preferred)>=min)return preferred;return contrast(bg,"#000000")>=contrast(bg,"#ffffff")?"#000000":"#ffffff"};var set=function(n,v){d.setProperty(n,v)};var page=text(scheme.backgroundColor,scheme.forceTextColor);set("--primary-color",scheme.primaryColor);set("--secondary-color",scheme.secondaryColor);set("--tertiary-color",scheme.tertiaryColor);set("--quaternary-color",scheme.quaternaryColor);set("--background-color",scheme.backgroundColor);set("--text-color",page);set("--text-color-primary",text(scheme.primaryColor,scheme.forceTextColor));set("--text-color-primary-contrast",page);set("--text-color-secondary",text(scheme.secondaryColor));set("--text-color-tertiary",text(scheme.tertiaryColor));set("--text-color-quaternary",text(scheme.quaternaryColor));set("--link-color",page);set("--focus-outline-color",page);document.documentElement.dataset.borealTheme=scheme.name}catch(e){}})();`}const P=m.createContext(void 0),Z=typeof window>"u"?m.useEffect:m.useLayoutEffect,ee=({children:t,customSchemes:e=[],enableThemeScript:r=!0,initialSchemeName:o,useOnlyCustomSchemes:n=!1})=>{const a=m.useMemo(()=>JSON.stringify(e??[]),[e]),[i,l]=m.useState(!1),u=m.useMemo(()=>{try{const s=JSON.parse(a);if(Array.isArray(s))return s}catch{console.error("Failed to parse custom schemes")}return[]},[a]),c=m.useMemo(()=>j({customSchemes:u,useOnlyCustomSchemes:n}),[u,n]),f=m.useCallback(s=>{var h,d;const y=G(c,{initialSchemeName:o,savedSchemeName:s});return((h=c[y])==null?void 0:h.name)??((d=c[0])==null?void 0:d.name)??""},[o,c]),[S,I]=m.useState(()=>{const s=typeof window>"u"?null:E(window.localStorage);return f(s)}),w=m.useMemo(()=>{const s=x(c,S);return s===-1?0:s},[c,S]),V=m.useCallback(s=>{I(y=>{const h=typeof s=="function"?s(y):s;return x(c,h)===-1?y:h})},[c]),B=m.useCallback(s=>{I(y=>{var C;const h=x(c,y),d=typeof s=="function"?s(h===-1?0:h):s;return((C=c[d])==null?void 0:C.name)??y})},[c]);return Z(()=>{const s=typeof window>"u"?null:E(window.localStorage),y=x(c,s),h=f(s);I(d=>o?h:y!==-1?s:x(c,d)!==-1?d:h),l(!0)},[o,f,c]),m.useInsertionEffect(()=>{const s=c[w]??c[0];!s||typeof document>"u"||Q(s,document)},[w,c]),m.useEffect(()=>{if(typeof window>"u")return;const s=d=>{x(c,d)!==-1&&I(C=>C===d?C:d)},y=d=>{var $;s(($=d.detail)==null?void 0:$.schemeName)},h=d=>{d.key===T&&s(d.newValue)};return window.addEventListener(N,y),window.addEventListener("storage",h),s(E(window.localStorage)),()=>{window.removeEventListener(N,y),window.removeEventListener("storage",h)}},[c]),m.useEffect(()=>{if(!i)return;const s=c[w]??c[0];if(!s)return;K(typeof window>"u"?void 0:window.localStorage,s.name)&&U(s.name)},[i,w,c]),_.jsxs(P.Provider,{value:{selectedScheme:w,selectedSchemeName:S,setSelectedScheme:B,setSelectedSchemeName:V,schemes:c},children:[r?_.jsx("script",{dangerouslySetInnerHTML:{__html:z({customSchemes:u,initialSchemeName:o,useOnlyCustomSchemes:n})},suppressHydrationWarning:!0}):null,t]})};exports.ThemeContext=P;exports.ThemeProvider=ee;exports.getThemeInitializationScript=z;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./ThemeContext-BNZ28nPu.cjs");exports.ThemeContext=e.ThemeContext;exports.ThemeProvider=e.ThemeProvider;exports.getThemeInitializationScript=e.getThemeInitializationScript;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./ThemeContext-DBR6j3a_.cjs");exports.ThemeContext=e.ThemeContext;exports.ThemeProvider=e.ThemeProvider;exports.getThemeInitializationScript=e.getThemeInitializationScript;
@@ -1,4 +1,4 @@
1
- import { T as a, a as i, g as o } from "./ThemeContext-wbHzxDs2.js";
1
+ import { T as a, a as i, g as o } from "./ThemeContext-B0vk0hrb.js";
2
2
  export {
3
3
  a as ThemeContext,
4
4
  i as ThemeProvider,