import{j as o,al as f,X as n,f as y,bR as I,aS as v,G as A}from"./vendor-mui-core-CDEc-eG6.js";import{r as N}from"./vendor-react-DX7tU9aY.js";import{l as b,bB as H,W,m as V,p as G}from"./vendor-ux-bFYdDLNG.js";import{k as P}from"./fallback-DtbVvsNl.js";import{M as X}from"./use-blocklet-logo-BSClbuwz.js";import{ah as Y,h as J,E as K}from"./vendor-utils-_C9URqjS.js";import{a as Q}from"./vendor-hooks-BrgYeCrj.js";import{M as O,p as U}from"./index-Ct2LxGuf.js";import{u as Z}from"./use-mobile-DKWj9MJD.js";import{k as ee,S as ne,n as oe,L as te,N as C,p as ie}from"./wallet-hidden-topbar-B5INDesa.js";function E({name:e="",logo:t="",description:i="",...p}){if(!e&&!t&&!i)return null;const c=N.isValidElement(t)?t:o.jsx("img",{src:t,alt:e});return o.jsxs(re,{...p,children:[o.jsxs("div",{children:[t&&o.jsx(f,{component:"a",href:"/",className:"footer-brand-logo",children:c}),e&&o.jsx("div",{className:"footer-brand-name",children:e})]}),i&&o.jsx("div",{className:"footer-brand-desc",children:i})]})}E.propTypes={name:n.node,logo:n.node,description:n.string};const re=b("div")`
  display: flex;
  flex-direction: column;
  font-size: 14px;
  a {
    text-decoration: none;
    color: inherit;
  }
  > div:first-of-type {
    display: flex;
    align-items: center;
  }
  .footer-brand-logo {
    display: flex;
    align-items: center;
    margin-right: 12px;
    line-height: 1;
    img,
    svg {
      width: auto;
      height: 40px;
      max-height: 40px;
    }
  }
  .footer-brand-name {
    font-size: 18px;
    color: ${e=>e.theme.palette.grey[900]};
  }
  .footer-brand-desc {
    white-space: pre-line;
    margin-top: 16px;
    color: ${e=>e.theme.palette.text.secondary};
  }

  ${e=>e.theme.breakpoints.down("sm")} {
    width: auto;
  }

  ${e=>e.theme.breakpoints.down("md")} {
    .footer-brand-logo {
      img,
      svg {
        height: 32px;
        max-height: 32px;
      }
    }
  }
`;function T({links:e=[],flowLayout:t=!1,minColumns:i=1,maxColumns:p=4,...c}){const[d,m]=N.useState(-1),x=Z({key:"md"}),j=e.some(s=>s.items?.length),h=!x&&j&&Y(i)&&i>1&&p>=i,w=h?Math.min(Math.max(e.length,i),p):1,g=({label:s,link:r,icon:l,render:a,props:u})=>{let k=s;if(a)k=a({label:s,link:r,props:u});else if(r&&J(r)){const M=r.startsWith("http")||r.startsWith("//"),B=ne(r)?{}:{target:M?"_blank":"_self",rel:M?"noreferrer noopener":void 0};k=o.jsx("a",{href:r,"aria-label":`Footer link for ${s}`,...B,...u,children:s})}return o.jsxs(o.Fragment,{children:[l&&o.jsx(O,{icon:l,size:20,sx:{mr:.5}}),k]})},$=Q(()=>e?.length?t?e.map((s,r)=>o.jsx("span",{className:"footer-links-item",children:g(s)},r)):h?ee(e,{columns:w}).map((s,r)=>o.jsx("div",{className:"footer-links-column",children:s.filter(l=>l.group).map((l,a)=>{const{items:u}=l;return o.jsxs("div",{className:"footer-links-group",children:[o.jsx("span",{className:"footer-links-item",children:g(l)}),!!u?.length&&o.jsx("div",{className:"footer-links-sub",children:u.map((k,M)=>o.jsx("span",{className:y("footer-links-item",{"footer-links-item--new":k.isNew}),children:g(k)},M))})]},a)})},r)):e.map((s,r)=>{const{items:l}=s,a=r===d;return o.jsxs("div",{className:y("footer-links-group",{"footer-links-group--active":a}),onClick:()=>m(d===r?-1:r),children:[o.jsxs("span",{className:"footer-links-item",children:[g(s),!!l?.length&&o.jsx("span",{className:"footer-links-group-expand-icon",children:o.jsx(I,{style:{transform:`rotate(${a?180:0}deg)`}})})]}),!!l?.length&&o.jsx("div",{className:"footer-links-sub",children:l.map((u,k)=>o.jsx("span",{className:y("footer-links-item",{"footer-links-item--new":u.isNew}),children:g(u)},k))})]},r)}):null,[e,t,h,d]);return e?.length?o.jsx(se,{columns:w,...c,className:y(c.className,{"footer-links--grouped":j,"footer-links--flow":t,"footer-links--columns":h}),children:o.jsx("div",{className:"footer-links-inner",children:$})}):null}T.propTypes={links:n.arrayOf(n.shape({label:n.string,link:n.string,render:n.func,props:n.object})),flowLayout:n.bool,minColumns:n.number,maxColumns:n.number};const se=b("div",{shouldForwardProp:e=>e!=="columns"})`
  overflow: hidden;
  color: ${({theme:e})=>e.palette.text.secondary};
  .footer-links-inner {
    display: flex;
    justify-content: space-between;
    margin: 0 -8px;
  }
  .footer-links-group,
  .footer-links-sub {
    display: flex;
    flex-direction: column;
  }
  .footer-links-group-expand-icon {
    display: none;
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translate(0, -50%);
    line-height: 1;
    svg {
      width: auto;
      height: 0.75em;
    }
  }
  .footer-links-item {
    display: inline-flex;
    align-items: center;
    position: relative;
    padding: 6px 8px;
    font-size: 14px;
    white-space: nowrap;
    &--new::after {
      content: 'New';
      color: ${({theme:e})=>e.palette.info.main};
      background-color: ${({theme:e})=>e.palette.info.light};
      padding: 1px 8px;
      border-radius: 10px/50%;
      margin-left: 8px;
    }
  }
  &.footer-links--grouped {
    .footer-links-group {
      > .footer-links-item {
        font-weight: 600;
        color: ${({theme:e})=>e.palette.text.primary};
      }
      .footer-links-sub {
        margin-top: 8px;
      }
    }
  }
  a {
    display: inline-block;
    max-width: 150px;
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease-in-out;
    &:hover {
      color: ${({theme:e})=>e.palette.text.primary};
    }
  }
  /* columns 布局 */
  &.footer-links--columns {
    .footer-links-inner {
      gap: ${({columns:e})=>`${288/e}px`};
    }
    .footer-links-column {
      display: flex;
      flex-direction: column;
    }
    .footer-links-group {
      .footer-links-sub {
        margin-top: 2px;
        margin-bottom: 12px;
      }
    }
  }

  /* flow 布局 */
  &.footer-links--flow {
    display: inline-flex;
    .footer-links-inner {
      justify-content: center;
      flex-wrap: wrap;
      margin: 0 -8px;
      .footer-links-item {
        padding: 0 8px;
      }
      .footer-links-item + .footer-links-item::before {
        content: '';
        position: absolute;
        left: 0;
        top: 50%;
        transform: translate(0, -50%);
        height: 1em;
        border-left: 1px solid ${e=>e.theme.palette.text.secondary};
      }
    }
  }

  /* 移动端样式 */
  ${e=>e.theme.breakpoints.down("md")} {
    .footer-links-inner {
      flex-direction: column;
      margin: 0;
    }
    .footer-links-sub {
      display: none;
    }
    .footer-links-group {
      position: relative;
      padding: 12px 0;
      .footer-links-item .footer-links-group-expand-icon {
        display: inline-block;
      }
    }
    .footer-links-group + .footer-links-group {
      border-top: 1px solid ${e=>e.theme.palette.grey[200]};
    }
    .footer-links-group--active {
      .footer-links-sub {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        .footer-links-item {
          flex: 0 0 50%;
        }
      }
    }
    .footer-links-item {
      padding-left: 0;
      padding-right: 0;
      font-size: 13px;
    }
    &.footer-links--grouped {
      .footer-links-group {
        > .footer-links-item {
          font-size: 14px;
        }
      }
    }

    &.footer-links--flow {
      .footer-links-inner {
        flex-direction: row;
      }
    }
  }
`;function L({items:e=null,...t}){return e?.length?o.jsx(le,{...t,children:e.map((i,p)=>o.jsx("a",{href:i.link,target:"_blank","aria-label":`Social media icon${i.title?` for ${i.title}`:""}`,rel:"noreferrer",children:o.jsx(O,{icon:i.icon||i.title,size:24,component:"span"})},p))}):null}L.propTypes={items:n.arrayOf(n.shape({icon:n.string,link:n.string}))};const le=b("div")`
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 20px;
  a {
    color: ${e=>e.theme.palette.text.secondary};
    text-decoration: none;
    transition: color 0.2s ease-in-out;
    &:hover {
      color: ${({theme:e})=>e.palette.text.primary};
    }
  }
  ${e=>e.theme.breakpoints.down("md")} {
    gap: 12px;
  }
`;function S({owner:e="ArcBlock",year:t=`${new Date().getFullYear()}`,...i}){return o.jsxs(ae,{...i,children:["Copyright © ",t," ",e]})}S.propTypes={owner:n.string,year:n.string};const ae=b("p")`
  display: flex;
  align-items: center;
  margin: 0;
  font-size: 13px;
`;function z({children:e=null,autoCenter:t=!1,...i}){return e?o.jsx(pe,{...i,className:y(i.className,{"footer-row-auto-center":t}),children:e}):null}z.propTypes={children:n.any,autoCenter:n.bool};const pe=b(f)`
  display: flex;
  justify-content: space-between;
  & + & {
    margin-top: 24px;
  }
  &.footer-row-auto-center > *:only-child {
    margin: 0 auto;
  }

  ${({theme:e})=>e.breakpoints.down("md")} {
    align-items: stretch;
    flex-direction: column;
    gap: ${({theme:e})=>e.spacing(1)};
    > * {
      flex: 1 0 100%;
    }
    &.footer-row-auto-center > * {
      margin: 0 auto;
    }
  }
`;function F({elements:e,data:t,className:i="",...p}){const c=!!t.navigation?.length;let d=null;return c?d=o.jsxs(v,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},justifyContent:"space-between"},children:[o.jsxs(f,{sx:{flex:"1 1 auto",paddingRight:{xs:0,md:3},display:"flex",flexDirection:"column",alignItems:"flex-start",gap:2,pb:3},children:[o.jsx(f,{children:e.brand}),o.jsx(f,{sx:{lineHeight:1},children:e.socialMedia})]}),o.jsx(f,{sx:({palette:m})=>({mb:3,borderTop:{xs:`1px solid ${m.grey[200]}`,md:0}}),children:e.navigation})]}):d=o.jsxs(v,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},justifyContent:"space-between",alignItems:"space-between",gap:2,pb:3},children:[o.jsx(f,{children:e.brand}),o.jsx(f,{sx:{lineHeight:1},children:e.socialMedia})]}),o.jsx(ce,{...p,className:y({"footer--with-navs":c},i),children:o.jsxs(v,{style:{padding:0},children:[d,o.jsx(f,{sx:{pt:3,borderTop:1,borderColor:"divider"}}),o.jsx(v,{children:o.jsxs(z,{autoCenter:!0,children:[e.copyright,e.links]})})]})})}F.propTypes={elements:n.shape({brand:n.element,navigation:n.element,socialMedia:n.element,copyright:n.element,links:n.element}).isRequired,data:n.object.isRequired,className:n.string};const ce=b("div")`
  padding: 32px 0 24px 0;
  .footer-brand-name,
  .footer-brand-desc {
    display: none;
  }
  &.footer--with-navs {
    ${e=>e.theme.breakpoints.up("md")} {
      .footer-brand-desc {
        max-width: 360px;
        display: block;
      }
    }
  }
  && .footer-brand-logo {
    margin-right: 0;
  }
`;function R({elements:e,data:t,...i}){return o.jsx(de,{...i,children:o.jsx(v,{style:{padding:0},children:o.jsxs(v,{className:"plain-layout-container",children:[e.links&&o.jsxs(z,{sx:{width:1},autoCenter:!0,children:[e.copyright,e.links]}),!e.links&&o.jsxs(o.Fragment,{children:[N.cloneElement(e.brand,{name:null,description:null}),e.copyright]})]})})})}R.propTypes={elements:n.shape({brand:n.element,navigation:n.element,socialMedia:n.element,copyright:n.element,links:n.element}).isRequired,data:n.object.isRequired};const de=b("div")`
  padding: 24px 0;
  .plain-layout-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
  }
`,_=[{name:"plain",support:(e,t)=>!t.navigation?.length&&!t.socialMedia?.length,component:R},{name:"standard",support:()=>!0,component:F}],me=_.reduce((e,t)=>({...e,[t.name]:t}),{});function D({...e}){const{brand:t=null,navigation:i=null,socialMedia:p=null,copyright:c=null,links:d=null,layout:m="auto",...x}=e,j=()=>t?o.jsx(E,{...t}):null,h=()=>i?.length?o.jsx(T,{links:i,minColumns:3}):null,w=()=>p?.length?o.jsx(L,{items:p}):null,g=()=>{const l=c?.owner||t?.name;return l?o.jsx(S,{owner:l,year:c?.year||void 0}):null},$=()=>d?.length?o.jsx(T,{flowLayout:!0,links:d}):null,s={brand:j(),navigation:h(),socialMedia:w(),copyright:g(),links:$()};let r=null;if(m==="auto"?r=_.find(l=>l.support(s,e)).component:r=me[m]?.component,!r)throw new Error(`layout ${m} is not supported.`);return o.jsxs(f,{...x,className:y("blocklet__footer",x.className),sx:[{position:"relative"},...Array.isArray(x.sx)?x.sx:[x.sx]],children:[o.jsx(r,{elements:s,data:e}),o.jsx(f,{sx:{position:"absolute",right:16,bottom:0,fontSize:12,color:"transparent","::selection":{background:"#000",color:"#fff"}},children:window?.blocklet?.version})]})}D.propTypes={brand:n.shape({name:n.node,description:n.string,logo:n.node}),navigation:n.arrayOf(n.shape({label:n.node,link:n.string})),socialMedia:n.arrayOf(n.shape({icon:n.node,link:n.string})),copyright:n.shape({owner:n.string,year:n.oneOfType([n.string,n.number])}),links:n.arrayOf(n.shape({label:n.node,link:n.string})),layout:n.oneOf(["auto","standard","plain"])};function q({meta:e={},theme:t={},...i}){const{locale:p,defaultLocale:c}=W()||{},d=A(),m=N.useMemo(()=>{const a=Object.assign({},window.blocklet,e);try{return te(a)}catch(u){return console.error("Failed to format blocklet info",u,a),a}},[e]),x=N.useMemo(()=>V(d,t),[d,t]),j=X({key:"xs",meta:e,theme:t});if(!m.appName)return null;const{appName:h,appDescription:w,description:g,copyright:$}=m,s=x.palette.background.default,r={footerNav:C({navigation:m?.navigation?.footer,locale:p,defaultLocale:c,section:"footer"})||[],socialMedia:C({navigation:m?.navigation?.social,locale:p,defaultLocale:c,section:"footer"})||[],links:C({navigation:m?.navigation?.bottom,locale:p,defaultLocale:c,section:"footer"})||[]},l={brand:{name:h,description:w||g,logo:j},navigation:ie(r.footerNav,a=>({...a,label:a.title,link:a.link}),"items"),copyright:$,socialMedia:r.socialMedia,links:r.links.map(a=>({...a,label:a.title}))};return o.jsx(G,{theme:x,children:o.jsx(fe,{...l,...K(i,["bordered"]),$bordered:i?.bordered,$bgcolor:s})})}q.propTypes={meta:oe,theme:n.object};const fe=b(D)`
  ${({$bordered:e,theme:t})=>`border-top: 1px solid ${e&&t.palette.divider};`}
  color: ${({theme:e})=>e.palette.text.secondary};
  ${({$bgcolor:e})=>e&&`background-color: ${e};`}
`,$e=H(U(q),{FallbackComponent:P});export{$e as _};
