@blocklet/pages-kit-inner-components 0.4.90 → 0.4.92

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 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),t=require("./state-BjeG4kYg.js");function n({children:e}){const r=t.useProjectId();return s.jsx(t.StoreProvider,{url:t.getWssURL(r??""),name:"root",waitingSynced:!0,children:s.jsx(o,{children:e})})}function o({children:e}){const{state:r}=t.useStore();return e({state:r})}exports.default=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),t=require("./state-oKsa8z3D.js");function n({children:e}){const r=t.useProjectId();return s.jsx(t.StoreProvider,{url:t.getWssURL(r??""),name:"root",waitingSynced:!0,children:s.jsx(o,{children:e})})}function o({children:e}){const{state:r}=t.useStore();return e({state:r})}exports.default=n;
@@ -1,4 +1,4 @@
1
- "use strict";var Ge=Object.create;var me=Object.defineProperty;var De=Object.getOwnPropertyDescriptor;var Je=Object.getOwnPropertyNames;var Ke=Object.getPrototypeOf,Xe=Object.prototype.hasOwnProperty;var Ye=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Je(t))!Xe.call(e,i)&&i!==o&&me(e,i,{get:()=>t[i],enumerable:!(r=De(t,i))||r.enumerable});return e};var pe=(e,t,o)=>(o=e!=null?Ge(Ke(e)):{},Ye(t||!e||!e.__esModule?me(o,"default",{value:e,enumerable:!0}):o,e));const n=require("react/jsx-runtime"),w=require("./state-BjeG4kYg.js"),ke=require("@arcblock/ux/lib/Locale/context"),Qe=require("@arcblock/ux/lib/Result"),Ze=require("@blocklet/pages-kit/builtin/page/header"),et=require("@blocklet/ui-react/lib/Header"),_=require("@emotion/css"),Y=require("@emotion/react"),tt=require("@emotion/styled"),p=require("@mui/material"),$e=require("ahooks"),nt=require("isomorphic-dompurify"),ot=require("lodash/cloneDeep"),rt=require("lodash/isEmpty"),it=require("lodash/isEqual"),g=require("react"),st=require("react-helmet"),B=require("react-router-dom"),O=require("react-use"),P=require("ufo");require("@mui/icons-material");const J=require("@blocklet/ai-runtime/components"),at=require("@mui/utils"),ct=require("lodash/pick"),lt=require("react-error-boundary"),Z=require("@iconify/react"),dt=require("react-markdown"),ut=require("remark-gfm"),mt=require("@mui/lab"),$=require("@arcblock/ux/lib/Theme"),pt=require("@arcblock/react-hooks/lib/useBrowser"),xt=require("@arcblock/ux/lib/Colors"),oe=require("@blocklet/pages-kit/components"),ft=require("@mui/material/useMediaQuery"),ht=require("lodash/omit"),Se=require("@iconify-icon/react"),gt=require("@arcblock/ux/lib/Screenshot"),bt=require("@arcblock/ux/lib/Button"),yt=require("is-uri"),K=require("pathe"),jt=require("@blocklet/embed/message"),wt=require("@blocklet/embed/react"),_t=require("react-twitter-embed"),vt=require("@blocklet/ui-react/lib/Footer"),kt=require("webfontloader"),$t=require("@arcblock/did-connect/lib/Session"),S=e=>e&&e.__esModule?e:{default:e},Ce=S(Qe),St=S(et),Be=S(tt),Ct=S(nt),xe=S(ot),Bt=S(rt),Ie=S(it),Ne=S(g),re=S(ct),It=S(dt),Nt=S(ut),Pt=S(pt),fe=S(xt),Pe=S(ft),R=S(ht),Rt=S(gt),Tt=S(bt),ee=S(yt),qt=S(vt),Et=S(kt);function zt(e,t,o,r){e.locales||(e.locales={}),e.locales[o]=e.locales[o]||{},e.locales[o].title=r.title??e.locales[o].title,e.locales[o].image=r.image??e.locales[o].image,e.locales[o].description=r.description??e.locales[o].description,Object.entries(r.sectionsData).forEach(([i,s])=>{var c,l,d,u;const a=Object.values(e.sections).find(m=>m.id===i||m.name===i);if(a&&a.isTemplateSection)if(a.locales=a.locales||{},a.locales[o]=a.locales[o]||{},a.component==="custom-component"){const m=(c=a.config)==null?void 0:c.componentId;if(!m)return;const f=((l=t.components[m])==null?void 0:l.data)||((u=(d=t.resources.components)==null?void 0:d[m])==null?void 0:u.component);if(!f)return;a.locales[o].properties=a.locales[o].properties||{},Object.entries(s||{}).forEach(([x,y])=>{var h,v;const j=((h=f==null?void 0:f.properties)==null?void 0:h[x])||Object.values((f==null?void 0:f.properties)||{}).find(b=>{var k;return((k=b.data)==null?void 0:k.key)===x});j&&(a.locales[o].properties[(v=j.data)==null?void 0:v.id]={value:y})})}else a.locales[o]={...a.locales[o],...s||{}}})}const Wt=g.forwardRef(({onClick:e,...t},o)=>{const[r,i]=g.useState(!1),s=g.useCallback(async a=>{try{i(!0),await(e==null?void 0:e(a))}finally{i(!1)}},[e]);return n.jsx(mt.LoadingButton,{ref:o,...t,loading:t.loading||r,onClick:s})});function Lt({tip:e,tipSucceed:t,title:o,titleSucceed:r,icon:i,iconSucceed:s,autoReset:a,placement:c="top",...l}){const[d,u]=g.useState(!1),[m,f]=g.useState(),x=g.useRef(),y=()=>{f(void 0),a&&(x.current=window.setTimeout(()=>{u(!1)},3e3))},j=()=>{clearTimeout(x.current)},h=d?s:i,v=m?n.jsx(p.Box,{color:"error",children:m.message}):d&&t||e,b=d?r:o;return n.jsx(p.Tooltip,{title:v,disableInteractive:!0,placement:c,onClose:y,onOpen:j,children:n.jsx("span",{children:n.jsx(Wt,{startIcon:h&&(typeof h=="string"?n.jsx(Z.Icon,{icon:h}):h),loadingPosition:h?"start":void 0,...l,onClick:async k=>{if(l.onClick)try{await l.onClick(k),u(!0)}catch(N){f(N)}},children:b})})})}const At=Ne.default.lazy(()=>import("react-syntax-highlighter").then(e=>({default:e.Prism}))),Ot=p.styled(e=>n.jsx(It.default,{...e,remarkPlugins:[Nt.default],components:{pre:Ut,code:({node:t,inline:o,className:r,children:i,...s})=>{if(!i)return null;const a=/language-(\w+)/.exec(r||"");return o?n.jsx(p.Box,{component:"code",className:r,...s,children:i}):n.jsx(p.Box,{component:At,language:a==null?void 0:a[1],...s,sx:{borderRadius:1},children:String(i).replace(/\n$/,"")})},table:({className:t,children:o})=>n.jsx(p.Box,{sx:{overflow:"auto",my:1},children:n.jsx("table",{className:t,children:o})})}}))`
1
+ "use strict";var Ge=Object.create;var pe=Object.defineProperty;var Je=Object.getOwnPropertyDescriptor;var Ke=Object.getOwnPropertyNames;var Xe=Object.getPrototypeOf,Ye=Object.prototype.hasOwnProperty;var Qe=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ke(t))!Ye.call(e,i)&&i!==o&&pe(e,i,{get:()=>t[i],enumerable:!(r=Je(t,i))||r.enumerable});return e};var xe=(e,t,o)=>(o=e!=null?Ge(Xe(e)):{},Qe(t||!e||!e.__esModule?pe(o,"default",{value:e,enumerable:!0}):o,e));const n=require("react/jsx-runtime"),w=require("./state-oKsa8z3D.js"),A=require("lodash"),$e=require("@arcblock/ux/lib/Locale/context"),Ze=require("@arcblock/ux/lib/Result"),et=require("@blocklet/pages-kit/builtin/page/header"),tt=require("@blocklet/ui-react/lib/Header"),_=require("@emotion/css"),Q=require("@emotion/react"),nt=require("@emotion/styled"),p=require("@mui/material"),Se=require("ahooks"),ot=require("isomorphic-dompurify"),rt=require("lodash/cloneDeep"),it=require("lodash/isEmpty"),st=require("lodash/isEqual"),g=require("react"),at=require("react-helmet"),B=require("react-router-dom"),U=require("react-use"),P=require("ufo");require("@mui/icons-material");const K=require("@blocklet/ai-runtime/components"),ct=require("@mui/utils"),lt=require("lodash/pick"),dt=require("react-error-boundary"),ee=require("@iconify/react"),ut=require("react-markdown"),mt=require("remark-gfm"),pt=require("@mui/lab"),$=require("@arcblock/ux/lib/Theme"),xt=require("@arcblock/react-hooks/lib/useBrowser"),ft=require("@arcblock/ux/lib/Colors"),re=require("@blocklet/pages-kit/components"),ht=require("@mui/material/useMediaQuery"),gt=require("lodash/omit"),Ce=require("@iconify-icon/react"),bt=require("@arcblock/ux/lib/Screenshot"),yt=require("@arcblock/ux/lib/Button"),jt=require("is-uri"),X=require("pathe"),wt=require("@blocklet/embed/message"),_t=require("@blocklet/embed/react"),vt=require("react-twitter-embed"),kt=require("@blocklet/ui-react/lib/Footer"),$t=require("webfontloader"),St=require("@arcblock/did-connect/lib/Session"),S=e=>e&&e.__esModule?e:{default:e},Be=S(Ze),Ct=S(tt),Ie=S(nt),Bt=S(ot),fe=S(rt),It=S(it),Ne=S(st),Pe=S(g),ie=S(lt),Nt=S(ut),Pt=S(mt),Rt=S(xt),he=S(ft),Re=S(ht),R=S(gt),Tt=S(bt),qt=S(yt),te=S(jt),Et=S(kt),zt=S($t);function Wt(e,t,o,r){e.locales||(e.locales={}),e.locales[o]=A.cloneDeep(e.locales[o]||{}),e.locales[o].title=r.title??e.locales[o].title,e.locales[o].image=r.image??e.locales[o].image,e.locales[o].description=r.description??e.locales[o].description,Object.entries(r.sectionsData).forEach(([i,s])=>{var c,l,d,u;const a=Object.values(e.sections).find(m=>m.id===i||m.name===i);if(a&&a.isTemplateSection)if(a.locales=A.cloneDeep(a.locales||{}),a.locales[o]=A.cloneDeep(a.locales[o]||{}),a.component==="custom-component"){const m=(c=a.config)==null?void 0:c.componentId;if(!m)return;const f=((l=t.components[m])==null?void 0:l.data)||((u=(d=t.resources.components)==null?void 0:d[m])==null?void 0:u.component);if(!f)return;a.locales[o].properties=A.cloneDeep(a.locales[o].properties||{}),Object.entries(s||{}).forEach(([x,y])=>{var h,v;const j=((h=f==null?void 0:f.properties)==null?void 0:h[x])||Object.values((f==null?void 0:f.properties)||{}).find(b=>{var k;return((k=b.data)==null?void 0:k.key)===x});j&&(a.locales[o].properties[(v=j.data)==null?void 0:v.id]={value:y})})}else a.locales[o]={...A.cloneDeep(a.locales[o]),...s||{}}})}const Lt=g.forwardRef(({onClick:e,...t},o)=>{const[r,i]=g.useState(!1),s=g.useCallback(async a=>{try{i(!0),await(e==null?void 0:e(a))}finally{i(!1)}},[e]);return n.jsx(pt.LoadingButton,{ref:o,...t,loading:t.loading||r,onClick:s})});function At({tip:e,tipSucceed:t,title:o,titleSucceed:r,icon:i,iconSucceed:s,autoReset:a,placement:c="top",...l}){const[d,u]=g.useState(!1),[m,f]=g.useState(),x=g.useRef(),y=()=>{f(void 0),a&&(x.current=window.setTimeout(()=>{u(!1)},3e3))},j=()=>{clearTimeout(x.current)},h=d?s:i,v=m?n.jsx(p.Box,{color:"error",children:m.message}):d&&t||e,b=d?r:o;return n.jsx(p.Tooltip,{title:v,disableInteractive:!0,placement:c,onClose:y,onOpen:j,children:n.jsx("span",{children:n.jsx(Lt,{startIcon:h&&(typeof h=="string"?n.jsx(ee.Icon,{icon:h}):h),loadingPosition:h?"start":void 0,...l,onClick:async k=>{if(l.onClick)try{await l.onClick(k),u(!0)}catch(N){f(N)}},children:b})})})}const Ot=Pe.default.lazy(()=>import("react-syntax-highlighter").then(e=>({default:e.Prism}))),Ut=p.styled(e=>n.jsx(Nt.default,{...e,remarkPlugins:[Pt.default],components:{pre:Mt,code:({node:t,inline:o,className:r,children:i,...s})=>{if(!i)return null;const a=/language-(\w+)/.exec(r||"");return o?n.jsx(p.Box,{component:"code",className:r,...s,children:i}):n.jsx(p.Box,{component:Ot,language:a==null?void 0:a[1],...s,sx:{borderRadius:1},children:String(i).replace(/\n$/,"")})},table:({className:t,children:o})=>n.jsx(p.Box,{sx:{overflow:"auto",my:1},children:n.jsx("table",{className:t,children:o})})}}))`
2
2
  width: 100%;
3
3
  overflow: hidden;
4
4
  word-break: break-word;
@@ -70,7 +70,7 @@
70
70
  }
71
71
  }
72
72
  }
73
- `;function Ut({children:e}){const t=e==null?void 0:e.props;if(!(t!=null&&t.children))return null;const o=/language-(\w+)/.exec(t.className||""),r=o==null?void 0:o[1];return n.jsxs(p.Box,{component:"div",sx:{fontSize:14,borderRadius:1,bgcolor:"rgb(245, 242, 240)","> pre":{mt:"0 !important"}},children:[n.jsxs(p.Stack,{direction:"row",alignItems:"center",p:.5,pl:1.5,borderBottom:1,borderColor:"grey.200",children:[n.jsx(p.Box,{children:r}),n.jsx(p.Box,{flex:1}),n.jsx(Lt,{autoReset:!0,title:n.jsx(Z.Icon,{icon:"tabler:copy"}),titleSucceed:n.jsx(Z.Icon,{icon:"tabler:copy-check"}),sx:{minWidth:32,minHeight:32,p:0,fontSize:18},onClick:()=>{window.navigator.clipboard.writeText(t.children)}})]}),e]})}function z({actions:e,center:t,className:o,align:r}){return e&&(e!=null&&e.length)?n.jsx(p.Box,{className:_.cx("flex gap-4 flex-wrap","lg:flex-row lg:gap-8",(t||r==="center")&&"justify-center",!t&&r==="right"&&"justify-end",!t&&r==="left"&&"justify-start",o),sx:{alignItems:"center"},children:e}):null}const Mt="section",Ht=p.styled(p.Box)`
73
+ `;function Mt({children:e}){const t=e==null?void 0:e.props;if(!(t!=null&&t.children))return null;const o=/language-(\w+)/.exec(t.className||""),r=o==null?void 0:o[1];return n.jsxs(p.Box,{component:"div",sx:{fontSize:14,borderRadius:1,bgcolor:"rgb(245, 242, 240)","> pre":{mt:"0 !important"}},children:[n.jsxs(p.Stack,{direction:"row",alignItems:"center",p:.5,pl:1.5,borderBottom:1,borderColor:"grey.200",children:[n.jsx(p.Box,{children:r}),n.jsx(p.Box,{flex:1}),n.jsx(At,{autoReset:!0,title:n.jsx(ee.Icon,{icon:"tabler:copy"}),titleSucceed:n.jsx(ee.Icon,{icon:"tabler:copy-check"}),sx:{minWidth:32,minHeight:32,p:0,fontSize:18},onClick:()=>{window.navigator.clipboard.writeText(t.children)}})]}),e]})}function z({actions:e,center:t,className:o,align:r}){return e&&(e!=null&&e.length)?n.jsx(p.Box,{className:_.cx("flex gap-4 flex-wrap","lg:flex-row lg:gap-8",(t||r==="center")&&"justify-center",!t&&r==="right"&&"justify-end",!t&&r==="left"&&"justify-start",o),sx:{alignItems:"center"},children:e}):null}const Ht="section",Ft=p.styled(p.Box)`
74
74
  overflow: hidden;
75
75
 
76
76
  .section__title {
@@ -119,7 +119,7 @@
119
119
  margin-bottom: 0.5rem;
120
120
  }
121
121
  }
122
- @media (min-width: ${({theme:e})=>e.breakpoints.values[Mt]}px) {
122
+ @media (min-width: ${({theme:e})=>e.breakpoints.values[Ht]}px) {
123
123
  .section__tag {
124
124
  margin-bottom: 32px;
125
125
  }
@@ -130,7 +130,7 @@
130
130
  margin-bottom: 40px;
131
131
  }
132
132
  }
133
- `;function U({title:e,description:t,descriptionMarkdown:o,actions:r,className:i="",classes:s={},prepend:a,append:c,level:l=2,tag:d,badge:u,center:m,logo:f,titleAppearance:x,descriptionAppearance:y,...j}){if(!e&&!t&&!r&&!u&&!d&&!a&&!c&&!f)return null;const h=Math.max(Math.min(5,l+1),1),v={1:"xl:!text-3xl lg:!text-2xl md:!text-xl",2:"xl:!text-2xl lg:!text-xl md:!text-lg",3:"xl:!text-2xl lg:!text-xl md:!text-lg",4:"xl:!text-xl lg:!text-lg md:!text-md",5:"xl:!text-lg md:!text-md sm:!text-sm",6:"!text-sm"},b=l===0?"big":`h${h}`,k=l===0;return n.jsxs(Ht,{className:_.cx("base-info","lg:text-left",m&&"!text-center",i),...j,children:[a&&n.jsx("div",{children:a}),(d||u)&&n.jsx("div",{className:_.cx("section__tag",(s==null?void 0:s.tag)||(s==null?void 0:s.badge)),children:d||u}),f&&n.jsx("img",{className:"w-[120px] m-auto mb-8",src:f,alt:"info",loading:"lazy"}),e&&n.jsx(p.Typography,{sx:{whiteSpace:"pre-wrap",mb:t?"2vw":0,...(x==null?void 0:x.color)&&{color:`${x.color} !important`}},className:_.cx("section__title","text-gray-800","dark:text-gray-50",s.title,"page-kit-section__title",k?"":"section__title_non_big"),component:`h${Math.max(l,1)}`,variant:b,children:e}),t&&(o?n.jsx(p.Box,{sx:{...(y==null?void 0:y.color)&&{color:`${y.color} !important`}},component:Ot,className:_.cx("section__description","text-gray-800","dark:text-gray-100",v[h],s.description,"page-kit-section__description"),children:t}):n.jsx(p.Typography,{sx:{whiteSpace:"pre-wrap",...(y==null?void 0:y.color)&&{color:`${y.color} !important`}},className:_.cx("section__description","text-gray-800","dark:text-gray-100",v[h],s.description,"page-kit-section__description"),component:"div",variant:"body1",gutterBottom:!0,children:t})),n.jsx(z,{actions:r,center:m,className:"mt-8"}),c&&n.jsx("div",{children:c})]})}const M=["actions","append","badge","tag","center","description","descriptionMarkdown","level","logo","prepend","title","titleAppearance","descriptionAppearance"];function Re(e){if(e.type===g.Fragment){const o=(e.props.children||[]).filter(r=>g.isValidElement(r));return o.length===1?Re(o[0]):o.length>1}return Array.isArray(e)}const T="&>*";function ie({children:e,col:t,gap:o,className:r,align:i,sx:s,type:a,...c}={children:null,className:"",col:3,gap:void 0,sx:{},align:"center",type:"default"}){const l=$.useTheme(),d=Number(Math.floor(100/t*100)/100),u={center:"justify-center items-center",left:"justify-start items-center",right:"justify-end items-center",top:"justify-center items-start",bottom:"justify-center items-end","top-left":"justify-start items-start","top-right":"justify-end items-start","bottom-left":"justify-start items-end","bottom-right":"justify-end items-end"},m=u[i]||u.center;let x=o??({2:6,3:4,4:4,5:3,6:3}[t]||0);Re(e)||(x=0);const j=(t-1)*x/t;let h={...s,gap:`${x}rem`};const v={[T]:{width:"100%"}},b={},k={},N={};switch(v.gap="1rem",b.gap=`${x/2}rem`,t){case 3:case 4:b[T]={width:`calc(50% - ${x/2}rem)`};break;case 5:case 6:v[T]={width:`calc(50% - ${x/2/2}rem)`},b[T]={width:`calc(50% - ${x/2/2}rem)`},k[T]={width:`calc(33.33% - ${x*2/3}rem)`};break}return h[T]={width:`calc(${d}% - ${j}rem)`},h[`@media (max-width: ${l.breakpoints.values.xl}px)`]=N,h[`@media (max-width: ${l.breakpoints.values.lg}px)`]=k,h[`@media (max-width: ${l.breakpoints.values.md}px)`]=b,h[`@media (max-width: ${l.breakpoints.values.sm}px)`]=v,a==="wall"&&(h={...s,gap:`${x}rem`},h[T]={width:`calc(${d}% - ${j}rem)`},v[T]={width:`calc(45% - ${x/2/2}rem)`},h[`@media (max-width: ${l.breakpoints.values.sm}px)`]=v),n.jsx(p.Box,{className:_.cx("flex flex-wrap flex-row h-full",m,r),sx:h,...c,children:e})}function Ft(){const e=navigator.userAgent.toLowerCase();return e.includes("safari")&&!e.includes("chrome")}function Vt(e=""){if(e.startsWith("data:image/svg+xml,"))return!0;const t=/^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/,o=/^(\/|\.\/|\.\.\/)(?:[^/]+\/)*[^/]+$/;return t.test(e)||o.test(e)}function te(e){return(e==null?void 0:e.endsWith(".mp4"))||(e==null?void 0:e.endsWith(".m4v"))||(e==null?void 0:e.endsWith(".webm"))}function Gt(e){return e!=null&&e.endsWith(".mp4")||e!=null&&e.endsWith(".m4v")?"video/mp4":e!=null&&e.endsWith(".webm")?"video/webm":void 0}function Dt(e){let t={};return typeof e=="string"?w.isGradient(e)?t.image=e:(t.image=w.getImageAbsoluteUrl(e),w.isColorString(e)&&(t.color=e,t.image="")):t=e,t}function Jt(){const[e,t]=g.useState(Date.now());return g.useEffect(()=>{const o=()=>{t(Date.now())};return document.addEventListener("visibilitychange",o),()=>{document.removeEventListener("visibilitychange",o)}},[]),e}function he(e,t,o,r,i){let s=null;const{color:a="",image:c}=Dt(t);return c&&Vt(c)?(delete o.backgroundColor,!(e.mobile.apple.device||Ft())&&te(c)?s=n.jsx(p.Box,{component:"video",className:"section-bg",width:"100%",autoPlay:!0,loop:!0,muted:!0,controls:!1,playsInline:!0,poster:w.autoResizeImage(w.getImageAbsoluteUrl(r),1200,"quality"),src:te(c)?c:w.autoResizeImage(c,1200,"quality"),sx:{position:"absolute",zIndex:-9999,right:0,left:0,top:0,width:"100%",height:"100%",objectFit:"cover"}},c):s=n.jsx(oe.ResponsiveImage,{src:c,sizesAttr:{sm:600,md:900,lg:1200},className:"section-bg",alt:"",width:"100%",loading:"lazy",sx:{position:"absolute",zIndex:-9999,right:0,left:0,top:0,width:"100%",height:"100%",objectFit:"cover"}},i||c)):c?o.backgroundImage=`${c} !important`:a&&(o.backgroundColor=`${a} !important`),s}function Kt({autoWidth:e,children:t,...o}){return e?n.jsx(p.Box,{display:"flex",...o,children:t}):n.jsx(p.Container,{...o,children:t})}function H({dark:e=!1,children:t,className:o,sx:r={},boxed:i={show:!1},padding:s="normal",boxProps:a,type:c,...l}){const d={...r},u=Pe.default(x=>x.breakpoints.down("md"));e&&(d.color=fe.default.common.white,d.backgroundColor=`${fe.default.grey[900]} !important`);const m={none:"py-0",small:"py-5 md:py-8 lg:py-8 xl:py-12",normal:"py-10 md:py-15 lg:py-20 xl:py-25",large:"py-15 md:py-20 lg:py-25 xl:py-30"};i.show&&(d.display="flex");const f=g.useMemo(()=>!Number(l.boxMaxWidth)||u?{width:"100%"}:c==="wall"&&l.boxMaxWidth?{maxWidth:`${l.boxMaxWidth}px !important`,width:"100%"}:{width:"100%"},[l.boxMaxWidth,u,c]);return n.jsx(Xt,{component:"section",styles:{...d},className:_.cx("base-section","px-2 md:px-5 lg:px-5 xl:px-10",m[s],o,{dark:e}),...R.default(l,"hoverStyle","boxMaxWidth","embedUrl","autoWidth","paddingXY","iframeHeight","titleAppearance","descriptionAppearance"),children:n.jsx(Kt,{autoWidth:l==null?void 0:l.autoWidth,className:_.cx("section-content h-full"),sx:f,children:i.show?n.jsx(Te,{...a,boxed:i,children:t}):t})})}function Te({background:e="",backgroundVideoPoster:t,children:o,sx:r={},boxed:i={show:!1},className:s="",styles:a={},...c}){const l={...a,...r};let d=null;const u=Pe.default(x=>x.breakpoints.up("sm")),m=Pt.default(),f=Jt();return e&&(d=he(m,e,l,t,f)),i.show&&(l.borderRadius="10px",l.padding===void 0&&(l.padding=u?"50px":"20px"),i!=null&&i.border&&(l.border="1px solid #c0c0c0"),i!=null&&i.background&&(d=he(m,i==null?void 0:i.background,l,i==null?void 0:i.backgroundVideoPoster,f))),n.jsxs(p.Box,{...c,sx:{...l,...d?{position:"relative",overflow:"hidden",zIndex:0}:{}},className:_.cx(s,(i==null?void 0:i.boxShadow)&&"shadow-xl"),children:[d,o]})}const Xt=$.styled(Te)`
133
+ `;function M({title:e,description:t,descriptionMarkdown:o,actions:r,className:i="",classes:s={},prepend:a,append:c,level:l=2,tag:d,badge:u,center:m,logo:f,titleAppearance:x,descriptionAppearance:y,...j}){if(!e&&!t&&!r&&!u&&!d&&!a&&!c&&!f)return null;const h=Math.max(Math.min(5,l+1),1),v={1:"xl:!text-3xl lg:!text-2xl md:!text-xl",2:"xl:!text-2xl lg:!text-xl md:!text-lg",3:"xl:!text-2xl lg:!text-xl md:!text-lg",4:"xl:!text-xl lg:!text-lg md:!text-md",5:"xl:!text-lg md:!text-md sm:!text-sm",6:"!text-sm"},b=l===0?"big":`h${h}`,k=l===0;return n.jsxs(Ft,{className:_.cx("base-info","lg:text-left",m&&"!text-center",i),...j,children:[a&&n.jsx("div",{children:a}),(d||u)&&n.jsx("div",{className:_.cx("section__tag",(s==null?void 0:s.tag)||(s==null?void 0:s.badge)),children:d||u}),f&&n.jsx("img",{className:"w-[120px] m-auto mb-8",src:f,alt:"info",loading:"lazy"}),e&&n.jsx(p.Typography,{sx:{whiteSpace:"pre-wrap",mb:t?"2vw":0,...(x==null?void 0:x.color)&&{color:`${x.color} !important`}},className:_.cx("section__title","text-gray-800","dark:text-gray-50",s.title,"page-kit-section__title",k?"":"section__title_non_big"),component:`h${Math.max(l,1)}`,variant:b,children:e}),t&&(o?n.jsx(p.Box,{sx:{...(y==null?void 0:y.color)&&{color:`${y.color} !important`}},component:Ut,className:_.cx("section__description","text-gray-800","dark:text-gray-100",v[h],s.description,"page-kit-section__description"),children:t}):n.jsx(p.Typography,{sx:{whiteSpace:"pre-wrap",...(y==null?void 0:y.color)&&{color:`${y.color} !important`}},className:_.cx("section__description","text-gray-800","dark:text-gray-100",v[h],s.description,"page-kit-section__description"),component:"div",variant:"body1",gutterBottom:!0,children:t})),n.jsx(z,{actions:r,center:m,className:"mt-8"}),c&&n.jsx("div",{children:c})]})}const H=["actions","append","badge","tag","center","description","descriptionMarkdown","level","logo","prepend","title","titleAppearance","descriptionAppearance"];function Te(e){if(e.type===g.Fragment){const o=(e.props.children||[]).filter(r=>g.isValidElement(r));return o.length===1?Te(o[0]):o.length>1}return Array.isArray(e)}const T="&>*";function se({children:e,col:t,gap:o,className:r,align:i,sx:s,type:a,...c}={children:null,className:"",col:3,gap:void 0,sx:{},align:"center",type:"default"}){const l=$.useTheme(),d=Number(Math.floor(100/t*100)/100),u={center:"justify-center items-center",left:"justify-start items-center",right:"justify-end items-center",top:"justify-center items-start",bottom:"justify-center items-end","top-left":"justify-start items-start","top-right":"justify-end items-start","bottom-left":"justify-start items-end","bottom-right":"justify-end items-end"},m=u[i]||u.center;let x=o??({2:6,3:4,4:4,5:3,6:3}[t]||0);Te(e)||(x=0);const j=(t-1)*x/t;let h={...s,gap:`${x}rem`};const v={[T]:{width:"100%"}},b={},k={},N={};switch(v.gap="1rem",b.gap=`${x/2}rem`,t){case 3:case 4:b[T]={width:`calc(50% - ${x/2}rem)`};break;case 5:case 6:v[T]={width:`calc(50% - ${x/2/2}rem)`},b[T]={width:`calc(50% - ${x/2/2}rem)`},k[T]={width:`calc(33.33% - ${x*2/3}rem)`};break}return h[T]={width:`calc(${d}% - ${j}rem)`},h[`@media (max-width: ${l.breakpoints.values.xl}px)`]=N,h[`@media (max-width: ${l.breakpoints.values.lg}px)`]=k,h[`@media (max-width: ${l.breakpoints.values.md}px)`]=b,h[`@media (max-width: ${l.breakpoints.values.sm}px)`]=v,a==="wall"&&(h={...s,gap:`${x}rem`},h[T]={width:`calc(${d}% - ${j}rem)`},v[T]={width:`calc(45% - ${x/2/2}rem)`},h[`@media (max-width: ${l.breakpoints.values.sm}px)`]=v),n.jsx(p.Box,{className:_.cx("flex flex-wrap flex-row h-full",m,r),sx:h,...c,children:e})}function Vt(){const e=navigator.userAgent.toLowerCase();return e.includes("safari")&&!e.includes("chrome")}function Dt(e=""){if(e.startsWith("data:image/svg+xml,"))return!0;const t=/^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/,o=/^(\/|\.\/|\.\.\/)(?:[^/]+\/)*[^/]+$/;return t.test(e)||o.test(e)}function ne(e){return(e==null?void 0:e.endsWith(".mp4"))||(e==null?void 0:e.endsWith(".m4v"))||(e==null?void 0:e.endsWith(".webm"))}function Gt(e){return e!=null&&e.endsWith(".mp4")||e!=null&&e.endsWith(".m4v")?"video/mp4":e!=null&&e.endsWith(".webm")?"video/webm":void 0}function Jt(e){let t={};return typeof e=="string"?w.isGradient(e)?t.image=e:(t.image=w.getImageAbsoluteUrl(e),w.isColorString(e)&&(t.color=e,t.image="")):t=e,t}function Kt(){const[e,t]=g.useState(Date.now());return g.useEffect(()=>{const o=()=>{t(Date.now())};return document.addEventListener("visibilitychange",o),()=>{document.removeEventListener("visibilitychange",o)}},[]),e}function ge(e,t,o,r,i){let s=null;const{color:a="",image:c}=Jt(t);return c&&Dt(c)?(delete o.backgroundColor,!(e.mobile.apple.device||Vt())&&ne(c)?s=n.jsx(p.Box,{component:"video",className:"section-bg",width:"100%",autoPlay:!0,loop:!0,muted:!0,controls:!1,playsInline:!0,poster:w.autoResizeImage(w.getImageAbsoluteUrl(r),1200,"quality"),src:ne(c)?c:w.autoResizeImage(c,1200,"quality"),sx:{position:"absolute",zIndex:-9999,right:0,left:0,top:0,width:"100%",height:"100%",objectFit:"cover"}},c):s=n.jsx(re.ResponsiveImage,{src:c,sizesAttr:{sm:600,md:900,lg:1200},className:"section-bg",alt:"",width:"100%",loading:"lazy",sx:{position:"absolute",zIndex:-9999,right:0,left:0,top:0,width:"100%",height:"100%",objectFit:"cover"}},i||c)):c?o.backgroundImage=`${c} !important`:a&&(o.backgroundColor=`${a} !important`),s}function Xt({autoWidth:e,children:t,...o}){return e?n.jsx(p.Box,{display:"flex",...o,children:t}):n.jsx(p.Container,{...o,children:t})}function F({dark:e=!1,children:t,className:o,sx:r={},boxed:i={show:!1},padding:s="normal",boxProps:a,type:c,...l}){const d={...r},u=Re.default(x=>x.breakpoints.down("md"));e&&(d.color=he.default.common.white,d.backgroundColor=`${he.default.grey[900]} !important`);const m={none:"py-0",small:"py-5 md:py-8 lg:py-8 xl:py-12",normal:"py-10 md:py-15 lg:py-20 xl:py-25",large:"py-15 md:py-20 lg:py-25 xl:py-30"};i.show&&(d.display="flex");const f=g.useMemo(()=>!Number(l.boxMaxWidth)||u?{width:"100%"}:c==="wall"&&l.boxMaxWidth?{maxWidth:`${l.boxMaxWidth}px !important`,width:"100%"}:{width:"100%"},[l.boxMaxWidth,u,c]);return n.jsx(Yt,{component:"section",styles:{...d},className:_.cx("base-section","px-2 md:px-5 lg:px-5 xl:px-10",m[s],o,{dark:e}),...R.default(l,"hoverStyle","boxMaxWidth","embedUrl","autoWidth","paddingXY","iframeHeight","titleAppearance","descriptionAppearance"),children:n.jsx(Xt,{autoWidth:l==null?void 0:l.autoWidth,className:_.cx("section-content h-full"),sx:f,children:i.show?n.jsx(qe,{...a,boxed:i,children:t}):t})})}function qe({background:e="",backgroundVideoPoster:t,children:o,sx:r={},boxed:i={show:!1},className:s="",styles:a={},...c}){const l={...a,...r};let d=null;const u=Re.default(x=>x.breakpoints.up("sm")),m=Rt.default(),f=Kt();return e&&(d=ge(m,e,l,t,f)),i.show&&(l.borderRadius="10px",l.padding===void 0&&(l.padding=u?"50px":"20px"),i!=null&&i.border&&(l.border="1px solid #c0c0c0"),i!=null&&i.background&&(d=ge(m,i==null?void 0:i.background,l,i==null?void 0:i.backgroundVideoPoster,f))),n.jsxs(p.Box,{...c,sx:{...l,...d?{position:"relative",overflow:"hidden",zIndex:0}:{}},className:_.cx(s,(i==null?void 0:i.boxShadow)&&"shadow-xl"),children:[d,o]})}const Yt=$.styled(qe)`
134
134
  &:nth-of-type(even) {
135
135
  background: #f8f8f8;
136
136
  }
@@ -146,11 +146,11 @@
146
146
  }
147
147
  }
148
148
  }
149
- `;function qe({icon:e,...t}){return n.jsx(Se.Icon,{icon:e,...t,ref:null})}function I(e,t){const o=re.default(e,t),r=R.default(e,t);return[o,r]}const Ee=["title","description","actions","badge","tag","prepend","append","logo"];function Yt({image:e,imageBorder:t,imageShadow:o,className:r,reverse:i=!1,fullSizeImage:s,...a}){const[c,l]=I(a,M),d=Object.keys(c).length>0&&Object.values(re.default(c,Ee)).filter(Boolean).length>0&&n.jsx(U,{...c}),u=g.isValidElement(e)?e:n.jsx(p.Box,{component:"img",src:e,alt:"",className:"block"}),m=["phone","macbook"].includes(t),f=e&&n.jsx(p.Box,{className:_.cx("section__image","m-auto, leading-[1] text-center",o&&"shadow-xl",c!=null&&c.center?"flex justify-center items-center":""),sx:{border:t===!0?"1px solid #c0c0c0":void 0,borderRadius:2,overflow:"hidden","> div":m?{width:"100%",video:{borderRadius:"0 !important"}}:void 0},children:m?n.jsx(Rt.default,{type:t,sx:{width:"100%"},children:u}):u});return n.jsx(H,{className:_.cx("section--block",r,s&&!i&&_.css`
149
+ `;function Ee({icon:e,...t}){return n.jsx(Ce.Icon,{icon:e,...t,ref:null})}function I(e,t){const o=ie.default(e,t),r=R.default(e,t);return[o,r]}const ze=["title","description","actions","badge","tag","prepend","append","logo"];function Qt({image:e,imageBorder:t,imageShadow:o,className:r,reverse:i=!1,fullSizeImage:s,...a}){const[c,l]=I(a,H),d=Object.keys(c).length>0&&Object.values(ie.default(c,ze)).filter(Boolean).length>0&&n.jsx(M,{...c}),u=g.isValidElement(e)?e:n.jsx(p.Box,{component:"img",src:e,alt:"",className:"block"}),m=["phone","macbook"].includes(t),f=e&&n.jsx(p.Box,{className:_.cx("section__image","m-auto, leading-[1] text-center",o&&"shadow-xl",c!=null&&c.center?"flex justify-center items-center":""),sx:{border:t===!0?"1px solid #c0c0c0":void 0,borderRadius:2,overflow:"hidden","> div":m?{width:"100%",video:{borderRadius:"0 !important"}}:void 0},children:m?n.jsx(Tt.default,{type:t,sx:{width:"100%"},children:u}):u});return n.jsx(F,{className:_.cx("section--block",r,s&&!i&&_.css`
150
150
  .section-bg {
151
151
  height: 80%;
152
152
  }
153
- `),...l,boxProps:s?{sx:{padding:0,overflow:"hidden"}}:void 0,children:n.jsx(ie,{col:e?2:1,className:s?_.css`
153
+ `),...l,boxProps:s?{sx:{padding:0,overflow:"hidden"}}:void 0,children:n.jsx(se,{col:e?2:1,className:s?_.css`
154
154
  display: flex;
155
155
  flex-direction: column;
156
156
 
@@ -163,15 +163,15 @@
163
163
  width: 100%;
164
164
  }
165
165
  }
166
- `:void 0,children:i?n.jsxs(n.Fragment,{children:[f,d]}):n.jsxs(n.Fragment,{children:[d,f]})})})}const F=["editing","height","locale","dev","sx"];function Qt(e){return n.jsx(Zt,{...e})}const Zt=$.styled(p.Box)`
166
+ `:void 0,children:i?n.jsxs(n.Fragment,{children:[f,d]}):n.jsxs(n.Fragment,{children:[d,f]})})})}const V=["editing","height","locale","dev","sx"];function Zt(e){return n.jsx(en,{...e})}const en=$.styled(p.Box)`
167
167
  position: relative;
168
- `;function en({widget:e,reverse:t,projectId:o,assistantId:r,working:i,submitTitle:s,submitIcon:a,submitColor:c,placeholder:l,loadingIndicator:d,section:u,...m}){const[{editing:f},x]=I(m,F),[y,j]=I(x,M),h=o&&r?{projectId:o,gitRef:"main",assistantId:r,working:!0}:void 0,v={children:s,endIcon:a?n.jsx(qe,{icon:a}):void 0,sx:{background:c||void 0,":hover":{background:c||void 0,opacity:.8}}},b=[],k=l&&n.jsx(p.Typography,{variant:"caption",color:"text.disabled",children:l}),N=d&&n.jsx(p.Typography,{variant:"caption",color:"text.disabled",children:d});Object.keys(y).length>0&&Object.values(re.default(y,Ee)).filter(Boolean).length>0&&b.push(n.jsx(U,{...y},"base-info")),h&&(e==="form"?b.push(n.jsx(J.AIForm,{identifier:h,SubmitProps:v},"form")):e==="result"?b.push(n.jsx(J.AIFormResult,{identifier:h,placeholder:k,loadingIndicator:N},"result")):b.push(n.jsxs(p.Stack,{width:"100%",gap:2,direction:"row",children:[n.jsx(J.AIForm,{identifier:h,BoxProps:{flex:1},SubmitProps:v}),n.jsx(J.AIFormResult,{identifier:h,BoxProps:{flex:1},placeholder:k,loadingIndicator:N})]},"form-result"))),t&&b.reverse();const W=p.useTheme(),D=g.useMemo(()=>p.createTheme(at.deepmerge(W,{palette:{primary:c?{main:c}:void 0}})),[c,W]);return n.jsx(lt.ErrorBoundary,{fallbackRender:w.ErrorView,children:n.jsx(p.ThemeProvider,{theme:D,children:n.jsx(H,{...j,sx:f?{pointerEvents:"none"}:{},children:n.jsx(ie,{col:b.length,children:b})})})})}const ze=g.createContext({pages:[],project:void 0}),{Provider:tn,Consumer:uo}=ze;function We(){return g.useContext(ze)}function nn({icon:e,className:t="",size:o="1rem",...r}){return n.jsx(on,{component:qe,className:_.cx("css-icon",t),size:o,...r,icon:e})}const on=$.styled(p.Box)`
168
+ `;function tn({widget:e,reverse:t,projectId:o,assistantId:r,working:i,submitTitle:s,submitIcon:a,submitColor:c,placeholder:l,loadingIndicator:d,section:u,...m}){const[{editing:f},x]=I(m,V),[y,j]=I(x,H),h=o&&r?{projectId:o,gitRef:"main",assistantId:r,working:!0}:void 0,v={children:s,endIcon:a?n.jsx(Ee,{icon:a}):void 0,sx:{background:c||void 0,":hover":{background:c||void 0,opacity:.8}}},b=[],k=l&&n.jsx(p.Typography,{variant:"caption",color:"text.disabled",children:l}),N=d&&n.jsx(p.Typography,{variant:"caption",color:"text.disabled",children:d});Object.keys(y).length>0&&Object.values(ie.default(y,ze)).filter(Boolean).length>0&&b.push(n.jsx(M,{...y},"base-info")),h&&(e==="form"?b.push(n.jsx(K.AIForm,{identifier:h,SubmitProps:v},"form")):e==="result"?b.push(n.jsx(K.AIFormResult,{identifier:h,placeholder:k,loadingIndicator:N},"result")):b.push(n.jsxs(p.Stack,{width:"100%",gap:2,direction:"row",children:[n.jsx(K.AIForm,{identifier:h,BoxProps:{flex:1},SubmitProps:v}),n.jsx(K.AIFormResult,{identifier:h,BoxProps:{flex:1},placeholder:k,loadingIndicator:N})]},"form-result"))),t&&b.reverse();const W=p.useTheme(),J=g.useMemo(()=>p.createTheme(ct.deepmerge(W,{palette:{primary:c?{main:c}:void 0}})),[c,W]);return n.jsx(dt.ErrorBoundary,{fallbackRender:w.ErrorView,children:n.jsx(p.ThemeProvider,{theme:J,children:n.jsx(F,{...j,sx:f?{pointerEvents:"none"}:{},children:n.jsx(se,{col:b.length,children:b})})})})}const We=g.createContext({pages:[],project:void 0}),{Provider:nn,Consumer:mo}=We;function Le(){return g.useContext(We)}function on({icon:e,className:t="",size:o="1rem",...r}){return n.jsx(rn,{component:Ee,className:_.cx("css-icon",t),size:o,...r,icon:e})}const rn=$.styled(p.Box)`
169
169
  &.css-icon {
170
170
  display: inline-block;
171
171
  width: ${({size:e})=>e};
172
172
  height: ${({size:e})=>e};
173
173
  }
174
- `;function rn({icon:e,className:t="",size:o="1rem",imageMeta:r,...i}){const s=w.autoResizeImage(w.getImageAbsoluteUrl(e),540),[a,c]=g.useState(!1),l=$.useTheme();return a?n.jsx(nn,{icon:"i-mdi:image",color:l.palette.grey[500],size:o,className:t,...i}):n.jsx(sn,{className:_.cx("image-icon",t),size:o,...i,children:n.jsx("img",{className:"image-icon__image",src:s,onError:()=>c(!0),width:r==null?void 0:r.naturalWidth,height:r==null?void 0:r.naturalHeight,alt:(r==null?void 0:r.filename)||"card-icon",loading:"lazy"})})}const sn=$.styled(p.Box)`
174
+ `;function sn({icon:e,className:t="",size:o="1rem",imageMeta:r,...i}){const s=w.autoResizeImage(w.getImageAbsoluteUrl(e),540),[a,c]=g.useState(!1),l=$.useTheme();return a?n.jsx(on,{icon:"i-mdi:image",color:l.palette.grey[500],size:o,className:t,...i}):n.jsx(an,{className:_.cx("image-icon",t),size:o,...i,children:n.jsx("img",{className:"image-icon__image",src:s,onError:()=>c(!0),width:r==null?void 0:r.naturalWidth,height:r==null?void 0:r.naturalHeight,alt:(r==null?void 0:r.filename)||"card-icon",loading:"lazy"})})}const an=$.styled(p.Box)`
175
175
  display: inline-block;
176
176
  width: ${({size:e})=>e};
177
177
  height: ${({size:e})=>e};
@@ -180,9 +180,9 @@
180
180
  height: 100%;
181
181
  width: 100%;
182
182
  }
183
- `,se=e=>typeof e=="string"&&/^[\w-_]+:[\w-_]+$/.test(e);function ne({icon:e,size:t="1rem",imageMeta:o,...r}){const i=window.isNaN(t)?t:`${t}px`;return se(e)?n.jsx(Se.Icon,{icon:e}):n.jsx(an,{component:rn,imageMeta:o,className:"base-icon",icon:e,size:i,...r})}const an=$.styled(p.Box)`
183
+ `,ae=e=>typeof e=="string"&&/^[\w-_]+:[\w-_]+$/.test(e);function oe({icon:e,size:t="1rem",imageMeta:o,...r}){const i=window.isNaN(t)?t:`${t}px`;return ae(e)?n.jsx(Ce.Icon,{icon:e}):n.jsx(cn,{component:sn,imageMeta:o,className:"base-icon",icon:e,size:i,...r})}const cn=$.styled(p.Box)`
184
184
  flex-shrink: 0;
185
- `;function A({text:e,children:t,icon:o="",endIcon:r,color:i="primary",link:s="",href:a="",...c}){const l=o?n.jsx(ne,{icon:o}):null,d=r?n.jsx(ne,{icon:r}):null,u=s||a,m={...c};return u&&(m.href=u,ee.default(u)&&(m.target=m.target||"_blank")),n.jsx(Tt.default,{startIcon:l,endIcon:d,color:i,...m,children:e||t})}function Le({editing:e,text:t,...o}){const{pages:r=[]}=We(),i=r.find(s=>s.id===(o.link||o.linkId));if(e)return n.jsx(A,{...R.default(o,["link","linkId"]),children:t});if(i){const s=i.path||"/";return n.jsx(B.Link,{to:s,children:n.jsx(A,{...R.default(o,["link","linkId"]),children:t})})}return n.jsx(A,{...R.default(o,"linkId"),children:t})}function q({type:e="",icon:t="",size:o="3rem",className:r="",...i}){return n.jsx(ne,{icon:t||e,size:o,className:_.cx("content-icon",r),...i})}q.propTypes={};q.defaultProps={type:"",icon:"",size:"3rem",color:"inherit",className:""};function cn({to:e,base:t,children:o,className:r,activeClassName:i="active",target:s="auto",autoExternalMark:a=!1,useRouterLink:c,...l}){const{pages:d=[],locale:u=""}={},m=t?K.join("/",t):t||"";let f=s==="auto"?"_self":s,x=K.join(m,e);const y=a?ee.default(x):!1;if(t)return x=K.join(m,u,e),n.jsx("a",{className:`no-underline ${r}`,href:P.withoutTrailingSlash(x),rel:"noreferrer noopener",target:f,...l,children:o});if(ee.default(e))s==="auto"&&(f="_blank"),x=e;else{P.isRelative(x)&&(x=K.join(window.location.pathname,x));const j=P.parseURL(`${window.location.origin}${x}`),h=d.some(v=>v.pathname===j.pathname);if(c||h)return n.jsx(B.NavLink,{end:!0,to:P.withoutTrailingSlash(x),className:({isActive:v})=>_.cx(r,v?i:""),...l,children:o})}return n.jsxs("a",{className:`no-underline ${r}`,href:P.withoutTrailingSlash(x),rel:"noreferrer noopener",target:f,...l,children:[o,y&&n.jsx(q,{icon:"i-mdi:arrow-top-right",size:"0.9em",className:"smart-link__mark",style:{marginLeft:5}})]})}function V({prepend:e,append:t,children:o,className:r="",dark:i=!1,border:s=!0,...a}){let c={};const{pages:l=[]}=We(),d=l.find(f=>f.id===a.link),u=!o||Ne.default.Children.toArray(o).every(f=>f===null);a.link&&(c={component:cn,to:(d==null?void 0:d.path)||a.link,useRouterLink:!0});const m=i&&s;return n.jsxs(ln,{className:_.cx("base-card card",{"border-gray-200":s},{"dark:border-gray-500":m},{dark:i,"border-transparent":!s},r),...c,...R.default(a,["listType","dark","iconColor","link","hoverStyle","imageSize"]),children:[e,!u&&n.jsx("div",{className:"card__body",children:o}),t]})}const ln=$.styled(p.Box)`
185
+ `;function O({text:e,children:t,icon:o="",endIcon:r,color:i="primary",link:s="",href:a="",...c}){const l=o?n.jsx(oe,{icon:o}):null,d=r?n.jsx(oe,{icon:r}):null,u=s||a,m={...c};return u&&(m.href=u,te.default(u)&&(m.target=m.target||"_blank")),n.jsx(qt.default,{startIcon:l,endIcon:d,color:i,...m,children:e||t})}function Ae({editing:e,text:t,...o}){const{pages:r=[]}=Le(),i=r.find(s=>s.id===(o.link||o.linkId));if(e)return n.jsx(O,{...R.default(o,["link","linkId"]),children:t});if(i){const s=i.path||"/";return n.jsx(B.Link,{to:s,children:n.jsx(O,{...R.default(o,["link","linkId"]),children:t})})}return n.jsx(O,{...R.default(o,"linkId"),children:t})}function q({type:e="",icon:t="",size:o="3rem",className:r="",...i}){return n.jsx(oe,{icon:t||e,size:o,className:_.cx("content-icon",r),...i})}q.propTypes={};q.defaultProps={type:"",icon:"",size:"3rem",color:"inherit",className:""};function ln({to:e,base:t,children:o,className:r,activeClassName:i="active",target:s="auto",autoExternalMark:a=!1,useRouterLink:c,...l}){const{pages:d=[],locale:u=""}={},m=t?X.join("/",t):t||"";let f=s==="auto"?"_self":s,x=X.join(m,e);const y=a?te.default(x):!1;if(t)return x=X.join(m,u,e),n.jsx("a",{className:`no-underline ${r}`,href:P.withoutTrailingSlash(x),rel:"noreferrer noopener",target:f,...l,children:o});if(te.default(e))s==="auto"&&(f="_blank"),x=e;else{P.isRelative(x)&&(x=X.join(window.location.pathname,x));const j=P.parseURL(`${window.location.origin}${x}`),h=d.some(v=>v.pathname===j.pathname);if(c||h)return n.jsx(B.NavLink,{end:!0,to:P.withoutTrailingSlash(x),className:({isActive:v})=>_.cx(r,v?i:""),...l,children:o})}return n.jsxs("a",{className:`no-underline ${r}`,href:P.withoutTrailingSlash(x),rel:"noreferrer noopener",target:f,...l,children:[o,y&&n.jsx(q,{icon:"i-mdi:arrow-top-right",size:"0.9em",className:"smart-link__mark",style:{marginLeft:5}})]})}function D({prepend:e,append:t,children:o,className:r="",dark:i=!1,border:s=!0,...a}){let c={};const{pages:l=[]}=Le(),d=l.find(f=>f.id===a.link),u=!o||Pe.default.Children.toArray(o).every(f=>f===null);a.link&&(c={component:ln,to:(d==null?void 0:d.path)||a.link,useRouterLink:!0});const m=i&&s;return n.jsxs(dn,{className:_.cx("base-card card",{"border-gray-200":s},{"dark:border-gray-500":m},{dark:i,"border-transparent":!s},r),...c,...R.default(a,["listType","dark","iconColor","link","hoverStyle","imageSize"]),children:[e,!u&&n.jsx("div",{className:"card__body",children:o}),t]})}const dn=$.styled(p.Box)`
186
186
  &.base-card {
187
187
  text-align: left;
188
188
  border-width: 1px;
@@ -197,7 +197,7 @@
197
197
  .card__body {
198
198
  padding: 15px 15px;
199
199
  }
200
- `;function G({align:e="left",title:t,titleProps:o={},description:r,descriptionProps:i={}}){return n.jsxs(n.Fragment,{children:[t&&n.jsx(p.Typography,{className:_.cx("card__title text-gray-800","dark:text-gray-50"),component:"h5",variant:"h5",gutterBottom:!0,align:e,...o,children:t}),r&&n.jsx(p.Typography,{className:_.cx("card__description","text-gray-500","dark:text-gray-400"),component:"div",variant:"body1",gutterBottom:!0,align:e,...i,children:r})]})}function dn({image:e,title:t,description:o,imageProps:r={},imageMeta:i,imageSize:s,titleProps:a={},descriptionProps:c={},actions:l,align:d,...u}){const m=se(e),f=w.autoResizeImage(w.getImageAbsoluteUrl(e),540);return n.jsxs(un,{className:"card-article",...u,prepend:n.jsx("div",{className:"card__image__wrap",children:m&&e?n.jsx(p.Box,{sx:{position:"absolute",left:0,top:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},children:n.jsx(q,{icon:e,color:"primary.main"})}):f&&n.jsx("img",{className:"card__image",src:f,...r,alt:r.alt||(i==null?void 0:i.filename)||"card-image",width:i==null?void 0:i.naturalWidth,height:i==null?void 0:i.naturalHeight,style:{width:"100%",height:"100%",objectFit:s||"cover",objectPosition:"center"},loading:"lazy"})}),children:[t||o?n.jsx(G,{align:d,title:t,titleProps:a,description:o,descriptionProps:c}):null,l!=null&&l.length?n.jsx(z,{align:d,actions:l,className:"mt-4"}):null]})}const un=$.styled(V)`
200
+ `;function G({align:e="left",title:t,titleProps:o={},description:r,descriptionProps:i={}}){return n.jsxs(n.Fragment,{children:[t&&n.jsx(p.Typography,{className:_.cx("card__title text-gray-800","dark:text-gray-50"),component:"h5",variant:"h5",gutterBottom:!0,align:e,...o,children:t}),r&&n.jsx(p.Typography,{className:_.cx("card__description","text-gray-500","dark:text-gray-400"),component:"div",variant:"body1",gutterBottom:!0,align:e,...i,children:r})]})}function un({image:e,title:t,description:o,imageProps:r={},imageMeta:i,imageSize:s,titleProps:a={},descriptionProps:c={},actions:l,align:d,...u}){const m=ae(e),f=w.autoResizeImage(w.getImageAbsoluteUrl(e),540);return n.jsxs(mn,{className:"card-article",...u,prepend:n.jsx("div",{className:"card__image__wrap",children:m&&e?n.jsx(p.Box,{sx:{position:"absolute",left:0,top:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},children:n.jsx(q,{icon:e,color:"primary.main"})}):f&&n.jsx("img",{className:"card__image",src:f,...r,alt:r.alt||(i==null?void 0:i.filename)||"card-image",width:i==null?void 0:i.naturalWidth,height:i==null?void 0:i.naturalHeight,style:{width:"100%",height:"100%",objectFit:s||"cover",objectPosition:"center"},loading:"lazy"})}),children:[t||o?n.jsx(G,{align:d,title:t,titleProps:a,description:o,descriptionProps:c}):null,l!=null&&l.length?n.jsx(z,{align:d,actions:l,className:"mt-4"}):null]})}const mn=$.styled(D)`
201
201
  ${e=>e.hoverStyle==="none"?"":e.link?`transition: box-shadow ease .3s;
202
202
  &:hover {
203
203
  box-shadow: 0 0 10px rgba(95, 142, 244, 0.42);
@@ -218,14 +218,14 @@
218
218
  height: 100%;
219
219
  object-position: top center;
220
220
  }
221
- `,ge="section";function be({title:e,image:t,imageMeta:o,description:r,actions:i,align:s,listType:a="",className:c="",...l}){return n.jsxs(mn,{className:_.cx("card",`list-type-${a}`,c),align:s,...l,children:[t&&n.jsx(q,{icon:t,color:"primary.main",size:a==="icon-title"?"1.2rem":"3rem",imageMeta:o}),e||r?n.jsx(G,{align:s,title:e,description:r}):null,i!=null&&i.length?n.jsx(z,{align:s,actions:i,className:"mt-4"}):null]})}const mn=$.styled(V)`
221
+ `,be="section";function ye({title:e,image:t,imageMeta:o,description:r,actions:i,align:s,listType:a="",className:c="",...l}){return n.jsxs(pn,{className:_.cx("card",`list-type-${a}`,c),align:s,...l,children:[t&&n.jsx(q,{icon:t,color:"primary.main",size:a==="icon-title"?"1.2rem":"3rem",imageMeta:o}),e||r?n.jsx(G,{align:s,title:e,description:r}):null,i!=null&&i.length?n.jsx(z,{align:s,actions:i,className:"mt-4"}):null]})}const pn=$.styled(D)`
222
222
  padding: 5vw 4vw;
223
223
  box-sizing: border-box;
224
224
  /* min-height: 320px; */
225
225
  color: inherit !important;
226
226
  border-radius: 0.5rem;
227
227
  /* ${({dark:e,theme:t})=>`background-color:${e?t.palette.grey[900]:t.palette.common.white};`} */
228
- @media (max-width: ${({theme:e})=>e.breakpoints.values[ge]}px) {
228
+ @media (max-width: ${({theme:e})=>e.breakpoints.values[be]}px) {
229
229
  padding: 1.5rem 2rem;
230
230
  }
231
231
  @media (max-width: ${({theme:e})=>e.breakpoints.values.sm}px) {
@@ -270,12 +270,12 @@
270
270
  }
271
271
  }
272
272
 
273
- @media (min-width: ${({theme:e})=>e.breakpoints.values[ge]}px) {
273
+ @media (min-width: ${({theme:e})=>e.breakpoints.values[be]}px) {
274
274
  padding: 2rem 2rem;
275
275
  text-align: left;
276
276
  box-sizing: border-box;
277
277
  }
278
- `;function pn({image:e,title:t,description:o,imageProps:r={},imageMeta:i,imageSize:s,titleProps:a={},descriptionProps:c={},actions:l,align:d,...u}){const m=se(e),f=w.autoResizeImage(w.getImageAbsoluteUrl(e),540);return n.jsxs(xn,{className:"card-article",...u,prepend:n.jsx("div",{className:"card__image__wrap",children:m&&e?n.jsx(p.Box,{sx:{position:"absolute",left:0,top:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},children:n.jsx(q,{icon:e,color:"primary.main"})}):f&&n.jsx(p.Box,{component:"img",className:"card__image",src:f,...r,alt:r.alt||(i==null?void 0:i.filename)||"card-image",width:i==null?void 0:i.naturalWidth,height:i==null?void 0:i.naturalHeight,style:{width:"100%",height:"100%",objectFit:s||"contain",objectPosition:"center"},loading:"lazy"})}),children:[t||o?n.jsx(G,{align:d,title:t,titleProps:a,description:o,descriptionProps:c}):null,l!=null&&l.length?n.jsx(z,{align:d,actions:l,className:"mt-4"}):null]})}const xn=$.styled(V)`
278
+ `;function xn({image:e,title:t,description:o,imageProps:r={},imageMeta:i,imageSize:s,titleProps:a={},descriptionProps:c={},actions:l,align:d,...u}){const m=ae(e),f=w.autoResizeImage(w.getImageAbsoluteUrl(e),540);return n.jsxs(fn,{className:"card-article",...u,prepend:n.jsx("div",{className:"card__image__wrap",children:m&&e?n.jsx(p.Box,{sx:{position:"absolute",left:0,top:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},children:n.jsx(q,{icon:e,color:"primary.main"})}):f&&n.jsx(p.Box,{component:"img",className:"card__image",src:f,...r,alt:r.alt||(i==null?void 0:i.filename)||"card-image",width:i==null?void 0:i.naturalWidth,height:i==null?void 0:i.naturalHeight,style:{width:"100%",height:"100%",objectFit:s||"contain",objectPosition:"center"},loading:"lazy"})}),children:[t||o?n.jsx(G,{align:d,title:t,titleProps:a,description:o,descriptionProps:c}):null,l!=null&&l.length?n.jsx(z,{align:d,actions:l,className:"mt-4"}):null]})}const fn=$.styled(D)`
279
279
  ${e=>e.hoverStyle==="none"?"":e.link?`transition: box-shadow ease .3s;
280
280
  &:hover {
281
281
  box-shadow: 0 0 10px rgba(95, 142, 244, 0.42);
@@ -299,7 +299,7 @@
299
299
  .card__image {
300
300
  max-height: 60px;
301
301
  }
302
- `,ye="section";function fn({title:e,image:t,imageMeta:o,iconSize:r=100,description:i,actions:s,align:a,className:c="",...l}){return n.jsx(hn,{className:_.cx("card",c),...l,children:n.jsxs(p.Box,{className:"flex items-center",children:[t&&n.jsx(q,{icon:t,color:"primary.main",size:r,imageMeta:o}),n.jsxs(p.Box,{className:"flex-1 ml-4",children:[n.jsx(G,{align:a,title:e,description:i}),n.jsx(z,{align:a,actions:s,className:"mt-4"})]})]})})}const hn=$.styled(V)`
302
+ `,je="section";function hn({title:e,image:t,imageMeta:o,iconSize:r=100,description:i,actions:s,align:a,className:c="",...l}){return n.jsx(gn,{className:_.cx("card",c),...l,children:n.jsxs(p.Box,{className:"flex items-center",children:[t&&n.jsx(q,{icon:t,color:"primary.main",size:r,imageMeta:o}),n.jsxs(p.Box,{className:"flex-1 ml-4",children:[n.jsx(G,{align:a,title:e,description:i}),n.jsx(z,{align:a,actions:s,className:"mt-4"})]})]})})}const gn=$.styled(D)`
303
303
  padding: 5vw 4vw;
304
304
  text-align: left;
305
305
  box-sizing: border-box;
@@ -307,7 +307,7 @@
307
307
  color: inherit !important;
308
308
  border-radius: 0.5rem;
309
309
  /* ${({dark:e,theme:t})=>`background-color:${e?t.palette.grey[900]:t.palette.common.white};`} */
310
- @media (max-width: ${({theme:e})=>e.breakpoints.values[ye]}px) {
310
+ @media (max-width: ${({theme:e})=>e.breakpoints.values[je]}px) {
311
311
  padding: 1.5rem 2rem;
312
312
  }
313
313
  @media (max-width: ${({theme:e})=>e.breakpoints.values.sm}px) {
@@ -350,12 +350,12 @@
350
350
  }
351
351
  }
352
352
 
353
- @media (min-width: ${({theme:e})=>e.breakpoints.values[ye]}px) {
353
+ @media (min-width: ${({theme:e})=>e.breakpoints.values[je]}px) {
354
354
  padding: 2rem 2rem;
355
355
  text-align: left;
356
356
  box-sizing: border-box;
357
357
  }
358
- `;function gn({title:e,titleProps:t={},description:o,descriptionProps:r={},image:i,imageMeta:s,className:a="",align:c,hoverStyle:l,...d}){return n.jsxs(bn,{className:_.cx("card-simple",a,`hover-style__${l}`),align:c,...d,children:[i&&n.jsx(q,{icon:i,color:"primary.main",imageMeta:s}),e||o?n.jsx(G,{align:c,title:e,titleProps:t,description:o,descriptionProps:r}):null]})}const bn=$.styled(V)`
358
+ `;function bn({title:e,titleProps:t={},description:o,descriptionProps:r={},image:i,imageMeta:s,className:a="",align:c,hoverStyle:l,...d}){return n.jsxs(yn,{className:_.cx("card-simple",a,`hover-style__${l}`),align:c,...d,children:[i&&n.jsx(q,{icon:i,color:"primary.main",imageMeta:s}),e||o?n.jsx(G,{align:c,title:e,titleProps:t,description:o,descriptionProps:r}):null]})}const yn=$.styled(D)`
359
359
  ${({dark:e,theme:t})=>`background-color:${e?t.palette.grey[900]:t.palette.common.white};`}
360
360
 
361
361
  &.hover-style__default {
@@ -440,7 +440,7 @@
440
440
  }
441
441
  }
442
442
  }
443
- `;function yn({type:e="default",...t}){const r={article:dn,simple:gn,news:fn,default:be,wall:pn}[e]||be;return n.jsx(r,{...e==="news"?t:R.default(t,"iconSize")})}function jn({list:e=[],align:t="top",cards:o,listBorder:r=!0,listType:i="",col:s=3,gap:a,iconColor:c,className:l="",type:d="default",dark:u=!1,textAlign:m="left",hoverStyle:f,...x}){return n.jsx(ie,{type:d,className:_.cx("card-list py-1",l,"items-stretch"),col:s,gap:a,align:t,...x,children:o||e.map(y=>n.jsx(yn,{borderColor:r,iconColor:c,type:d,listType:i,dark:u,...y,align:m,sx:{bgcolor:d==="wall"?void 0:u?"grey.900":"common.white"},style:a===0&&e.length>1?{borderRadius:0,marginRight:"-1px",marginBottom:"-1px"}:{}},y.id))})}const wn=["align","cards","list","listBorder","listType","col","gap","iconColor","type","textAlign"],_n=$.styled(H)`
443
+ `;function jn({type:e="default",...t}){const r={article:un,simple:bn,news:hn,default:ye,wall:xn}[e]||ye;return n.jsx(r,{...e==="news"?t:R.default(t,"iconSize")})}function wn({list:e=[],align:t="top",cards:o,listBorder:r=!0,listType:i="",col:s=3,gap:a,iconColor:c,className:l="",type:d="default",dark:u=!1,textAlign:m="left",hoverStyle:f,...x}){return n.jsx(se,{type:d,className:_.cx("card-list py-1",l,"items-stretch"),col:s,gap:a,align:t,...x,children:o||e.map(y=>n.jsx(jn,{borderColor:r,iconColor:c,type:d,listType:i,dark:u,...y,align:m,sx:{bgcolor:d==="wall"?void 0:u?"grey.900":"common.white"},style:a===0&&e.length>1?{borderRadius:0,marginRight:"-1px",marginBottom:"-1px"}:{}},y.id))})}const _n=["align","cards","list","listBorder","listType","col","gap","iconColor","type","textAlign"],vn=$.styled(F)`
444
444
  a .card {
445
445
  color: #404040;
446
446
  cursor: pointer;
@@ -455,7 +455,7 @@
455
455
  a:hover .card {
456
456
  color: #404040;
457
457
  }
458
- `;function vn({className:e,...t}){const[o,r]=I(t,M),[i,s]=I(r,wn);return n.jsxs(_n,{className:_.cx("section--card-list",e),type:t.type,...s,children:[Object.keys(o).length>0&&n.jsx(U,{center:!0,...o,className:"mb-[2.5vw]"}),n.jsx(jn,{...i,dark:!!t.dark})]})}const kn=$.styled(vn)`
458
+ `;function kn({className:e,...t}){const[o,r]=I(t,H),[i,s]=I(r,_n);return n.jsxs(vn,{className:_.cx("section--card-list",e),type:t.type,...s,children:[Object.keys(o).length>0&&n.jsx(M,{center:!0,...o,className:"mb-[2.5vw]"}),n.jsx(wn,{...i,dark:!!t.dark})]})}const $n=$.styled(kn)`
459
459
  .card__description {
460
460
  white-space: pre-wrap;
461
461
  }
@@ -470,21 +470,21 @@
470
470
  .card-simple .card__body::after {
471
471
  background: inherit !important;
472
472
  }
473
- `;function $n({section:e,...t}){const[{editing:o},r]=I(t,F),i=g.useMemo(()=>{var s;return{...R.default(r,["listBorder","list","iconSize","imageSize"]),list:(s=r.list)==null?void 0:s.map(a=>{var c,l;return{...R.default(a,"icon","iconColor"),image:["news","simple","default"].includes(r.type)&&a.icon?a.icon:a.image,actions:(l=(c=a.actions)==null?void 0:c.map)==null?void 0:l.call(c,d=>n.jsx(Le,{...d,editing:o},d.id)),border:r.listBorder,iconSize:r.iconSize,imageSize:r.imageSize,hoverStyle:r.hoverStyle}})}},[r]);return n.jsx(kn,{style:o?{pointerEvents:"none"}:{},...i})}function Sn({properties:e,section:t,locale:o,dev:r}){var i;return(i=t==null?void 0:t.config)!=null&&i.componentId?n.jsx(oe.CustomComponentRenderer,{instanceId:t.id,componentId:t.config.componentId,blockletId:t.config.blockletId,blockletTitle:t.config.blockletTitle,componentName:t.config.componentName,locale:o,properties:e,dev:r}):n.jsx(p.Box,{textAlign:"center",py:2,children:n.jsx(p.Typography,{variant:"caption",color:"text.secondary",children:"Please select component to render"})})}function Cn({src:e,dataId:t,isEdit:o=!1,height:r="100%",onLoad:i=()=>{}}){return n.jsx(wt.EmbedIframe,{isEdit:o,embedId:t,src:e,height:r,onLoad:()=>{i()}})}function Bn({dataId:e,src:t,actions:o,center:r,onLoad:i,...s}){const[a,c]=I(s,M);return n.jsxs(H,{...c,children:[Object.keys(a).length>0&&n.jsx(U,{center:r,...a}),n.jsx(Cn,{dataId:e,src:t,onLoad:i,height:s.iframeHeight?`${s.iframeHeight}px`:"100%"}),n.jsx(z,{actions:o,center:r})]})}function In({section:e,id:t,src:o,...r}){const i=`${t}-${r.locale}`,[{editing:s},a]=I(r,F),c=g.useRef({}),l=JSON.parse(JSON.stringify(a)),{message:d}=jt.useMessage(i,"server"),u=$e.useLatest(JSON.parse(JSON.stringify(a.config)||"{}"));return g.useEffect(()=>{d&&d.onInit(()=>u.current)},[d]),g.useEffect(()=>{const m=JSON.parse(JSON.stringify(a.config)||"{}");Ie.default(c.current,m)||(c.current=m,d==null||d.send("config-set",m))},[d,a.config]),o?n.jsx(Bn,{...l,dataId:i,src:o,style:s?{pointerEvents:"none"}:{}}):n.jsx(Nn,{children:'Please set the "src" attribute for this block'})}const Nn=$.styled("div")`
473
+ `;function Sn({section:e,...t}){const[{editing:o},r]=I(t,V),i=g.useMemo(()=>{var s;return{...R.default(r,["listBorder","list","iconSize","imageSize"]),list:(s=r.list)==null?void 0:s.map(a=>{var c,l;return{...R.default(a,"icon","iconColor"),image:["news","simple","default"].includes(r.type)&&a.icon?a.icon:a.image,actions:(l=(c=a.actions)==null?void 0:c.map)==null?void 0:l.call(c,d=>n.jsx(Ae,{...d,editing:o},d.id)),border:r.listBorder,iconSize:r.iconSize,imageSize:r.imageSize,hoverStyle:r.hoverStyle}})}},[r]);return n.jsx($n,{style:o?{pointerEvents:"none"}:{},...i})}function Cn({properties:e,section:t,locale:o,dev:r}){var i;return(i=t==null?void 0:t.config)!=null&&i.componentId?n.jsx(re.CustomComponentRenderer,{instanceId:t.id,componentId:t.config.componentId,blockletId:t.config.blockletId,blockletTitle:t.config.blockletTitle,componentName:t.config.componentName,locale:o,properties:e,dev:r}):n.jsx(p.Box,{textAlign:"center",py:2,children:n.jsx(p.Typography,{variant:"caption",color:"text.secondary",children:"Please select component to render"})})}function Bn({src:e,dataId:t,isEdit:o=!1,height:r="100%",onLoad:i=()=>{}}){return n.jsx(_t.EmbedIframe,{isEdit:o,embedId:t,src:e,height:r,onLoad:()=>{i()}})}function In({dataId:e,src:t,actions:o,center:r,onLoad:i,...s}){const[a,c]=I(s,H);return n.jsxs(F,{...c,children:[Object.keys(a).length>0&&n.jsx(M,{center:r,...a}),n.jsx(Bn,{dataId:e,src:t,onLoad:i,height:s.iframeHeight?`${s.iframeHeight}px`:"100%"}),n.jsx(z,{actions:o,center:r})]})}function Nn({section:e,id:t,src:o,...r}){const i=`${t}-${r.locale}`,[{editing:s},a]=I(r,V),c=g.useRef({}),l=JSON.parse(JSON.stringify(a)),{message:d}=wt.useMessage(i,"server"),u=Se.useLatest(JSON.parse(JSON.stringify(a.config)||"{}"));return g.useEffect(()=>{d&&d.onInit(()=>u.current)},[d]),g.useEffect(()=>{const m=JSON.parse(JSON.stringify(a.config)||"{}");Ne.default(c.current,m)||(c.current=m,d==null||d.send("config-set",m))},[d,a.config]),o?n.jsx(In,{...l,dataId:i,src:o,style:s?{pointerEvents:"none"}:{}}):n.jsx(Pn,{children:'Please set the "src" attribute for this block'})}const Pn=$.styled("div")`
474
474
  user-select: none;
475
475
  color: #999;
476
476
  padding: 8px;
477
477
  height: 200px;
478
- `,Pn=[/youtu\.be\/([^#&?]{11})/,/\?v=([^#&?]{11})/,/&v=([^#&?]{11})/,/embed\/([^#&?]{11})/,/\/v\/([^#&?]{11})/];function Rn(e){var t;if(/youtu\.?be/.test(e))for(const o of Pn){const r=(t=o.exec(e))==null?void 0:t[1];if(r)return r}}function Tn(e){const t=Rn(e);if(t)return`https://youtube.com/embed/${t}`}function qn({src:e}){return g.useEffect(()=>{import("@lottiefiles/lottie-player")},[]),n.jsx("lottie-player",{autoplay:!0,loop:!0,mode:"normal",src:e})}function En(e){return n.jsx(p.Box,{maxHeight:400,overflow:"hidden auto",children:n.jsx(_t.TwitterTimelineEmbed,{...e})})}function zn({url:e}){const t=g.useRef(null),o=495,[r,i]=g.useState(t.current?t.current.offsetWidth*.5625:o),s=g.useCallback(()=>{const a=window.innerWidth>990?1:window.innerWidth>522?1.2:window.innerWidth>400?1.45:1.85,c=t.current?t.current.offsetWidth*.5625:o;return i(Math.floor(c*a))},[]);return g.useEffect(()=>{window.addEventListener("resize",s);const a=window.innerWidth>990?1:window.innerWidth>522?1.2:window.innerWidth>400?1.45:1.85,c=t.current?t.current.offsetWidth*.5625:o;return i(Math.floor(c*a)),function(){window.removeEventListener("resize",s)}},[r,s]),n.jsx(p.Box,{component:"iframe",ref:t,title:"youtube",width:"100%",height:`${r}px`,src:e,frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,sx:{display:"block"}})}const Wn=$.styled(Yt)`
478
+ `,Rn=[/youtu\.be\/([^#&?]{11})/,/\?v=([^#&?]{11})/,/&v=([^#&?]{11})/,/embed\/([^#&?]{11})/,/\/v\/([^#&?]{11})/];function Tn(e){var t;if(/youtu\.?be/.test(e))for(const o of Rn){const r=(t=o.exec(e))==null?void 0:t[1];if(r)return r}}function qn(e){const t=Tn(e);if(t)return`https://youtube.com/embed/${t}`}function En({src:e}){return g.useEffect(()=>{import("@lottiefiles/lottie-player")},[]),n.jsx("lottie-player",{autoplay:!0,loop:!0,mode:"normal",src:e})}function zn(e){return n.jsx(p.Box,{maxHeight:400,overflow:"hidden auto",children:n.jsx(vt.TwitterTimelineEmbed,{...e})})}function Wn({url:e}){const t=g.useRef(null),o=495,[r,i]=g.useState(t.current?t.current.offsetWidth*.5625:o),s=g.useCallback(()=>{const a=window.innerWidth>990?1:window.innerWidth>522?1.2:window.innerWidth>400?1.45:1.85,c=t.current?t.current.offsetWidth*.5625:o;return i(Math.floor(c*a))},[]);return g.useEffect(()=>{window.addEventListener("resize",s);const a=window.innerWidth>990?1:window.innerWidth>522?1.2:window.innerWidth>400?1.45:1.85,c=t.current?t.current.offsetWidth*.5625:o;return i(Math.floor(c*a)),function(){window.removeEventListener("resize",s)}},[r,s]),n.jsx(p.Box,{component:"iframe",ref:t,title:"youtube",width:"100%",height:`${r}px`,src:e,frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,sx:{display:"block"}})}const Ln=$.styled(Qt)`
479
479
  .section__description {
480
480
  }
481
- `;function Ln({hasImage:e,fullSizeImage:t,boxed:o,videoPoster:r,imageMeta:i,imageOptimization:s,imageSize:a,section:c,...l}){var x,y;const[{editing:d},u]=I({...l,boxed:t?void 0:o},F);let m=An(u.image,r,t,i,s,a);e||(m=null);let f=null;return u.actions&&(f=(y=(x=u.actions)==null?void 0:x.map)==null?void 0:y.call(x,(j,h)=>n.jsx(Le,{...j,editing:d},h))),n.jsx(Wn,{...u,style:d?{pointerEvents:"none"}:{},image:m,fullSizeImage:e&&t,actions:f})}function An(e,t,o,r,i,s){if(e){if(e.endsWith(".json"))return n.jsx(qn,{src:e});if(e.indexOf("twitter.com")!==-1)return n.jsx(En,{sourceType:"url",url:e});const a=Tn(e);if(a)return n.jsx(zn,{url:a});const{naturalWidth:c,naturalHeight:l,filename:d}=r||{};if(te(e))return n.jsx("video",{width:c&&`${c}px`,height:l&&`${l}px`,controls:!0,autoPlay:!0,muted:!0,style:{display:"block",objectFit:s||"contain",borderRadius:"8px",width:"100%",height:"100%"},poster:w.autoResizeImage(w.getImageAbsoluteUrl(t),o?1200:540,i),children:n.jsx("source",{src:w.getImageAbsoluteUrl(e),type:Gt(e)})},e);const u=i==="quality"?1:.6;return n.jsx(oe.ResponsiveImage,{src:w.getImageAbsoluteUrl(e),sizesAttr:{sm:600*u,md:450*u,lg:540*u,...o&&{md:900*u,lg:1200*u}},width:c&&`${c}px`,height:l&&`${l}px`,alt:d??e,style:{objectFit:s||"contain",display:"block",width:"100%",height:"100%"},loading:"lazy"})}return null}const On=["production","draft"];function Ae({mode:e,version:t}={}){const o=t&&typeof t=="number"?{mode:e,version:t}:{mode:e};return w.api.get(`/api/${w.getProjectIdFromPathnameOrWindow()}/pages`,{params:o}).then(r=>r.data)}function Un({mode:e,pages:t}){return w.api.post(`/api/${w.getProjectIdFromPathnameOrWindow()}/pages/publish`,{mode:e,pages:t}).then(o=>o.data)}function Mn({locale:e,sort:t,page:o,limit:r,mode:i}={}){return w.api.get(`/api/${w.getProjectIdFromPathnameOrWindow()}/pages/toc`,{params:{locale:e,sort:t,page:o,limit:r,mode:i}}).then(s=>s.data)}const je=20;function Hn({style:e,sort:t,section:o,...r}){const[{editing:i,locale:s},a]=I(r,F),[c,l]=I(a,M),[d,u]=g.useState(),m=g.useRef(!1),f=O.useUpdate(),x=B.useNavigate(),y=g.useCallback(async()=>{if(!m.current){m.current=!0,f();try{const j=d?Math.floor(d.list.length/je)+1:1,{list:h,total:v}=await Mn({locale:s,sort:t,page:j,limit:je});u(b=>({list:((b==null?void 0:b.list)??[]).concat(h),total:v}))}finally{m.current=!1,f()}}},[d,s,t,f]);return O.useMount(()=>{y()}),n.jsxs(H,{...l,sx:i?{pointerEvents:"none"}:{},children:[Object.keys(c).length>0&&n.jsx(U,{...c}),d?n.jsxs(n.Fragment,{children:[n.jsx(p.Grid,{container:!0,spacing:2,justifyContent:"center",children:d==null?void 0:d.list.map(j=>n.jsx(p.Grid,{item:!0,xs:12,sm:e==="card"?6:12,md:e==="card"?3:12,children:n.jsxs(Fn,{elevation:0,className:_.cx(e==="card"&&"style-card"),onClick:i?void 0:()=>x(j.slug),children:[!!j.image&&n.jsx(p.CardMedia,{component:"img",alt:"",image:w.autoResizeImage(w.getImageAbsoluteUrl(j.image),540),loading:"lazy"}),n.jsxs(p.CardContent,{children:[n.jsx(p.Typography,{variant:"h6",component:"div",className:we,children:j.title||j.id}),n.jsx(p.Typography,{variant:"body2",className:we,children:j.description})]})]})},j.id))}),n.jsx(p.Box,{textAlign:"center",mt:2,children:d.total>d.list.length?n.jsx(A,{variant:"outlined",color:"secondary",onClick:y,loading:m.current,children:"More"}):n.jsx(A,{variant:"outlined",color:"secondary",disabled:!0,children:"No More"})})]}):n.jsx(p.Box,{p:2,textAlign:"center",children:n.jsx(p.CircularProgress,{size:24})})]})}const we=_.css`
481
+ `;function An({hasImage:e,fullSizeImage:t,boxed:o,videoPoster:r,imageMeta:i,imageOptimization:s,imageSize:a,section:c,...l}){var x,y;const[{editing:d},u]=I({...l,boxed:t?void 0:o},V);let m=On(u.image,r,t,i,s,a);e||(m=null);let f=null;return u.actions&&(f=(y=(x=u.actions)==null?void 0:x.map)==null?void 0:y.call(x,(j,h)=>n.jsx(Ae,{...j,editing:d},h))),n.jsx(Ln,{...u,style:d?{pointerEvents:"none"}:{},image:m,fullSizeImage:e&&t,actions:f})}function On(e,t,o,r,i,s){if(e){if(e.endsWith(".json"))return n.jsx(En,{src:e});if(e.indexOf("twitter.com")!==-1)return n.jsx(zn,{sourceType:"url",url:e});const a=qn(e);if(a)return n.jsx(Wn,{url:a});const{naturalWidth:c,naturalHeight:l,filename:d}=r||{};if(ne(e))return n.jsx("video",{width:c&&`${c}px`,height:l&&`${l}px`,controls:!0,autoPlay:!0,muted:!0,style:{display:"block",objectFit:s||"contain",borderRadius:"8px",width:"100%",height:"100%"},poster:w.autoResizeImage(w.getImageAbsoluteUrl(t),o?1200:540,i),children:n.jsx("source",{src:w.getImageAbsoluteUrl(e),type:Gt(e)})},e);const u=i==="quality"?1:.6;return n.jsx(re.ResponsiveImage,{src:w.getImageAbsoluteUrl(e),sizesAttr:{sm:600*u,md:450*u,lg:540*u,...o&&{md:900*u,lg:1200*u}},width:c&&`${c}px`,height:l&&`${l}px`,alt:d??e,style:{objectFit:s||"contain",display:"block",width:"100%",height:"100%"},loading:"lazy"})}return null}const Un=["production","draft"];function Oe({mode:e,version:t}={}){const o=t&&typeof t=="number"?{mode:e,version:t}:{mode:e};return w.api.get(`/api/${w.getProjectIdFromPathnameOrWindow()}/pages`,{params:o}).then(r=>r.data)}function Mn({mode:e,pages:t}){return w.api.post(`/api/${w.getProjectIdFromPathnameOrWindow()}/pages/publish`,{mode:e,pages:t}).then(o=>o.data)}function Hn({locale:e,sort:t,page:o,limit:r,mode:i}={}){return w.api.get(`/api/${w.getProjectIdFromPathnameOrWindow()}/pages/toc`,{params:{locale:e,sort:t,page:o,limit:r,mode:i}}).then(s=>s.data)}const we=20;function Fn({style:e,sort:t,section:o,...r}){const[{editing:i,locale:s},a]=I(r,V),[c,l]=I(a,H),[d,u]=g.useState(),m=g.useRef(!1),f=U.useUpdate(),x=B.useNavigate(),y=g.useCallback(async()=>{if(!m.current){m.current=!0,f();try{const j=d?Math.floor(d.list.length/we)+1:1,{list:h,total:v}=await Hn({locale:s,sort:t,page:j,limit:we});u(b=>({list:((b==null?void 0:b.list)??[]).concat(h),total:v}))}finally{m.current=!1,f()}}},[d,s,t,f]);return U.useMount(()=>{y()}),n.jsxs(F,{...l,sx:i?{pointerEvents:"none"}:{},children:[Object.keys(c).length>0&&n.jsx(M,{...c}),d?n.jsxs(n.Fragment,{children:[n.jsx(p.Grid,{container:!0,spacing:2,justifyContent:"center",children:d==null?void 0:d.list.map(j=>n.jsx(p.Grid,{item:!0,xs:12,sm:e==="card"?6:12,md:e==="card"?3:12,children:n.jsxs(Vn,{elevation:0,className:_.cx(e==="card"&&"style-card"),onClick:i?void 0:()=>x(j.slug),children:[!!j.image&&n.jsx(p.CardMedia,{component:"img",alt:"",image:w.autoResizeImage(w.getImageAbsoluteUrl(j.image),540),loading:"lazy"}),n.jsxs(p.CardContent,{children:[n.jsx(p.Typography,{variant:"h6",component:"div",className:_e,children:j.title||j.id}),n.jsx(p.Typography,{variant:"body2",className:_e,children:j.description})]})]})},j.id))}),n.jsx(p.Box,{textAlign:"center",mt:2,children:d.total>d.list.length?n.jsx(O,{variant:"outlined",color:"secondary",onClick:y,loading:m.current,children:"More"}):n.jsx(O,{variant:"outlined",color:"secondary",disabled:!0,children:"No More"})})]}):n.jsx(p.Box,{p:2,textAlign:"center",children:n.jsx(p.CircularProgress,{size:24})})]})}const _e=_.css`
482
482
  display: -webkit-box;
483
483
  -webkit-box-orient: vertical;
484
484
  -webkit-line-clamp: 2;
485
485
  overflow: hidden;
486
486
  text-overflow: ellipsis;
487
- `,Fn=$.styled(p.Card)`
487
+ `,Vn=$.styled(p.Card)`
488
488
  border: 1px solid #e0e0e0;
489
489
  background-color: transparent;
490
490
  cursor: pointer;
@@ -504,11 +504,11 @@
504
504
  max-height: 50vw;
505
505
  }
506
506
  }
507
- `,Vn={iframe:In,section:Ln,"section-card-list":$n,toc:Hn,"ai-runtime":en,"custom-component":Sn};function Gn({id:e,type:t,mode:o,config:r,section:i,...s}){const a=Vn[t],c=g.useMemo(()=>{const{sx:u,height:m,...f}=r;return f},[r]),l=g.useMemo(()=>{const u={sx:r.sx};return t!=="custom-component"&&(u.height=r.height),u},[r.sx,r.height,t]),d=a&&n.jsx(a,{mode:o,...c,id:e,section:i});return n.jsx(Qt,{...s,...l,children:d})}const Dn=$.styled(qt.default,{shouldForwardProp:e=>!!e})`
507
+ `,Dn={iframe:Nn,section:An,"section-card-list":Sn,toc:Fn,"ai-runtime":tn,"custom-component":Cn};function Gn({id:e,type:t,mode:o,config:r,section:i,...s}){const a=Dn[t],c=g.useMemo(()=>{const{sx:u,height:m,...f}=r;return f},[r]),l=g.useMemo(()=>{const u={sx:r.sx};return t!=="custom-component"&&(u.height=r.height),u},[r.sx,r.height,t]),d=a&&n.jsx(a,{mode:o,...c,id:e,section:i});return n.jsx(Zt,{...s,...l,children:d})}const Jn=$.styled(Et.default,{shouldForwardProp:e=>!!e})`
508
508
  & > div > .MuiContainer-root {
509
509
  max-width: unset;
510
510
  }
511
- `;function Jn({meta:e,...t}){const o=$.useTheme();return n.jsx(Dn,{...t,meta:e,theme:o||{}})}function Oe(e){return n.jsx(p.Box,{display:"flex",flex:1,height:"100%",alignItems:"center",justifyContent:"center",...e,children:n.jsx(p.CircularProgress,{size:30})})}function Kn(e){return n.jsx(Xn,{...e})}const Xn=$.styled(p.Box)`
511
+ `;function Kn({meta:e,...t}){const o=$.useTheme();return n.jsx(Jn,{...t,meta:e,theme:o||{}})}function Ue(e){return n.jsx(p.Box,{display:"flex",flex:1,height:"100%",alignItems:"center",justifyContent:"center",...e,children:n.jsx(p.CircularProgress,{size:30})})}function Xn(e){return n.jsx(Yn,{...e})}const Yn=$.styled(p.Box)`
512
512
  position: fixed;
513
513
  left: 0;
514
514
  top: 0;
@@ -519,24 +519,24 @@
519
519
  opacity: 0.7;
520
520
  transform: translateX(-23%) translateY(70%) rotate(-45deg);
521
521
  pointer-events: none;
522
- `,Yn=e=>new Promise((t,o)=>{(e==null?void 0:e.length)>0?Et.default.load({google:{families:e},fontactive:()=>{t("success")},fontinactive:()=>{o(new Error("load font fail"))}}):t("success")}),_e=`Avenir, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
523
- sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'`,ve={};function Qn({titleFontFamily:e,descriptionFontFamily:t}){const o=async r=>{if(r&&!document.querySelectorAll(`link[href*="${r}" i]`).length)try{ve[r]||(await Yn([r]),ve[r]=!0)}catch(i){console.error(i)}};return g.useEffect(()=>{e&&o(e),t&&o(t)},[e,t]),n.jsx(Y.Global,{styles:Y.css`
522
+ `,Qn=e=>new Promise((t,o)=>{(e==null?void 0:e.length)>0?zt.default.load({google:{families:e},fontactive:()=>{t("success")},fontinactive:()=>{o(new Error("load font fail"))}}):t("success")}),ve=`Avenir, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
523
+ sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'`,ke={};function Zn({titleFontFamily:e,descriptionFontFamily:t}){const o=async r=>{if(r&&!document.querySelectorAll(`link[href*="${r}" i]`).length)try{ke[r]||(await Qn([r]),ke[r]=!0)}catch(i){console.error(i)}};return g.useEffect(()=>{e&&o(e),t&&o(t)},[e,t]),n.jsx(Q.Global,{styles:Q.css`
524
524
  #app {
525
525
  .page-kit-section__title {
526
- font-family: ${JSON.stringify(e)}, ${_e};
526
+ font-family: ${JSON.stringify(e)}, ${ve};
527
527
  }
528
528
 
529
529
  .page-kit-section__description {
530
- font-family: ${JSON.stringify(t)}, ${_e};
530
+ font-family: ${JSON.stringify(t)}, ${ve};
531
531
  }
532
532
  }
533
- `})}const{SessionProvider:mo,SessionContext:Zn,SessionConsumer:po,withSession:xo}=$t.createAuthServiceSessionContext();function ae(){return g.useContext(Zn)}function eo(...e){var o;const{session:t}=ae();return e.includes((o=t.user)==null?void 0:o.role)}function to(...e){var r;const{session:t}=ae(),o=eo(...e);return((r=window.blocklet)==null?void 0:r.tenantMode)==="multiple"?!!t.user:o}function no(e){return e!=null}function oo(){const[e]=B.useSearchParams(),{session:t}=ae(),o=to("owner","admin","pagesEditor","member"),r=g.useMemo(()=>{const s=e.get("mode");return On.includes(s)?s:"production"},[e]),i=r==="production"?r:t.user?o?r:"production":null;return i?n.jsx(Ue,{mode:i}):null}function Ue({mode:e}){if(e!=="draft"){const t=window.__PAGE_STATE__;return t?n.jsx(X,{mode:e,state:t}):n.jsx(io,{mode:e,children:({state:o})=>n.jsx(X,{mode:e,state:o})})}return n.jsx(ro,{children:({state:t})=>n.jsx(X,{mode:e,state:t})})}const ro=g.lazy(()=>Promise.resolve().then(()=>require("./draft-data-CMqq2YH1.js")));function io({mode:e,children:t}){const o=document.querySelector('meta[property="pages:version"]'),r=o==null?void 0:o.content,i=w.useProjectId(),s=g.useMemo(()=>{if(r==="{{pagesPublishedAt}}"){const l=localStorage.getItem(w.getProjectPageVersionKey(i??""));return Number(l)?Number(l):new Date().getTime()}return Number(r)},[r]),{loading:a,value:c}=O.useAsync(()=>Ae({mode:e,version:s}),[e,s]);return a?n.jsx(Oe,{}):c?t({state:c}):null}function X({mode:e,state:t}){var y,j,h,v;const{t:o,locale:r}=ke.useLocaleContext(),{pageIds:i,pages:s,supportedLocales:a,config:{defaultLocale:c},resources:l}=t,d=w.getAllComponents(t),u=g.useMemo(()=>a!=null&&a.some(b=>b.locale===r)?r:void 0,[r,a]),m=Object.values(s).find(b=>(b==null?void 0:b.slug)==="/")?void 0:Object.values(s)[0],f=g.useMemo(()=>i.map(b=>{const k=s[b];return k&&{id:k.id,path:P.joinURL("/",u||"",k.slug,e!=="production"?`?mode=${e}`:"")}}).filter(no),[i,s,u,e]),x=([...b])=>(e!=="production"&&b.unshift(n.jsx(g.Suspense,{fallback:n.jsx("div",{}),children:n.jsx(ao,{mode:"production",state:t})})),b);return n.jsxs(tn,{value:{pages:f},children:[n.jsxs(B.Routes,{children:[m&&n.jsx(B.Route,{index:!0,element:n.jsx(B.Navigate,{to:P.joinURL("/",u||"",m.slug)})}),i.map(b=>{const k=s[b];return k?n.jsx(B.Route,{path:P.joinURL(":projectIdOrSlug?",k.slug),element:n.jsx(Q,{mode:e,components:d,page:k,locale:u,defaultLocale:c,headerAddons:x})},k.id):null}),l.pages&&Object.values(l.pages).map(({blockletId:b,page:k})=>n.jsx(B.Route,{path:P.joinURL("/",`@${b}`,k.slug),element:n.jsx(Q,{mode:e,components:d,page:k,locale:u,defaultLocale:c,headerAddons:x})},k.id)),n.jsx(B.Route,{path:"*",element:n.jsx(p.Box,{width:"100vw",height:"100vh",display:"flex",justifyContent:"center",alignItems:"center",children:n.jsx(Ce.default,{style:{background:"inherit"},status:404,extra:n.jsx(Fe,{href:"/",children:o("common.back")})})})})]}),e!=="production"&&n.jsx(Kn,{sx:{bgcolor:"info.light"},children:e}),n.jsx(Qn,{titleFontFamily:(j=(y=t.config)==null?void 0:y.fontFamily)==null?void 0:j.title,descriptionFontFamily:(v=(h=t.config)==null?void 0:h.fontFamily)==null?void 0:v.description})]})}function so({mode:e,state:t,path:o,pageData:r}){const{t:i,locale:s}=ke.useLocaleContext(),{pages:a,supportedLocales:c,config:{defaultLocale:l},resources:d}=t,u=Object.values(a).find(h=>(h==null?void 0:h.slug)===o),m=Object.values(d.pages||{}).find(h=>h.page.slug===o),f=g.useMemo(()=>c!=null&&c.some(h=>h.locale===s)?s:void 0,[s,c]),x=$e.useReactive({page:null});g.useEffect(()=>{const h=u||(m==null?void 0:m.page)||null;h?x.page=xe.default(h):x.page=null},[u,m]);const y=g.useRef();if(g.useEffect(()=>{Ie.default(r,y.current)||r&&x.page&&(zt(x.page,t,f,r),y.current=xe.default(r))},[{}]),!u&&!(m!=null&&m.page))return n.jsx(p.Box,{width:"100vw",height:"100vh",display:"flex",justifyContent:"center",alignItems:"center",children:n.jsx(Ce.default,{style:{background:"inherit"},status:404,extra:n.jsx(Fe,{href:"/",children:i("common.back")})})});const j=w.getAllComponents(t);return x.page?n.jsx(Q,{mode:e,components:j,page:x.page,locale:f,defaultLocale:l}):null}function Q({mode:e,components:t,page:o,locale:r,defaultLocale:i,headerAddons:s}){var h,v,b,k,N,W,D,ce,le;const a=((h=o.locales)==null?void 0:h[r])??((v=o.locales)==null?void 0:v[i])??{},c=a.title||((b=window.blocklet)==null?void 0:b.appName),l=a.description||((k=window.blocklet)==null?void 0:k.appDescription),d=w.autoResizeImage(w.getImageAbsoluteUrl(a.image),540),{logo:u,brand:m,description:f,...x}=Ze.useHeaderState(),y=g.useMemo(()=>E=>{var L;let C=(s==null?void 0:s(E))??E;return C=((L=x.addons)==null?void 0:L.call(x,C))??C,C},[x.addons,s]),j=(N=a.header)!=null&&N.translucent?He:Me;return n.jsxs(n.Fragment,{children:[!!a.backgroundColor&&n.jsx(Y.Global,{styles:Y.css`
533
+ `})}const{SessionProvider:po,SessionContext:eo,SessionConsumer:xo,withSession:fo}=St.createAuthServiceSessionContext();function ce(){return g.useContext(eo)}function to(...e){var o;const{session:t}=ce();return e.includes((o=t.user)==null?void 0:o.role)}function no(...e){var r;const{session:t}=ce(),o=to(...e);return((r=window.blocklet)==null?void 0:r.tenantMode)==="multiple"?!!t.user:o}function oo(e){return e!=null}function ro(){const[e]=B.useSearchParams(),{session:t}=ce(),o=no("owner","admin","pagesEditor","member"),r=g.useMemo(()=>{const s=e.get("mode");return Un.includes(s)?s:"production"},[e]),i=r==="production"?r:t.user?o?r:"production":null;return i?n.jsx(Me,{mode:i}):null}function Me({mode:e}){if(e!=="draft"){const t=window.__PAGE_STATE__;return t?n.jsx(Y,{mode:e,state:t}):n.jsx(so,{mode:e,children:({state:o})=>n.jsx(Y,{mode:e,state:o})})}return n.jsx(io,{children:({state:t})=>n.jsx(Y,{mode:e,state:t})})}const io=g.lazy(()=>Promise.resolve().then(()=>require("./draft-data-CE4YeR_n.js")));function so({mode:e,children:t}){const o=document.querySelector('meta[property="pages:version"]'),r=o==null?void 0:o.content,i=w.useProjectId(),s=g.useMemo(()=>{if(r==="{{pagesPublishedAt}}"){const l=localStorage.getItem(w.getProjectPageVersionKey(i??""));return Number(l)?Number(l):new Date().getTime()}return Number(r)},[r]),{loading:a,value:c}=U.useAsync(()=>Oe({mode:e,version:s}),[e,s]);return a?n.jsx(Ue,{}):c?t({state:c}):null}function Y({mode:e,state:t}){var y,j,h,v;const{t:o,locale:r}=$e.useLocaleContext(),{pageIds:i,pages:s,supportedLocales:a,config:{defaultLocale:c},resources:l}=t,d=w.getAllComponents(t),u=g.useMemo(()=>a!=null&&a.some(b=>b.locale===r)?r:void 0,[r,a]),m=Object.values(s).find(b=>(b==null?void 0:b.slug)==="/")?void 0:Object.values(s)[0],f=g.useMemo(()=>i.map(b=>{const k=s[b];return k&&{id:k.id,path:P.joinURL("/",u||"",k.slug,e!=="production"?`?mode=${e}`:"")}}).filter(oo),[i,s,u,e]),x=([...b])=>(e!=="production"&&b.unshift(n.jsx(g.Suspense,{fallback:n.jsx("div",{}),children:n.jsx(co,{mode:"production",state:t})})),b);return n.jsxs(nn,{value:{pages:f},children:[n.jsxs(B.Routes,{children:[m&&n.jsx(B.Route,{index:!0,element:n.jsx(B.Navigate,{to:P.joinURL("/",u||"",m.slug)})}),i.map(b=>{const k=s[b];return k?n.jsx(B.Route,{path:P.joinURL(":projectIdOrSlug?",k.slug),element:n.jsx(Z,{mode:e,components:d,page:k,locale:u,defaultLocale:c,headerAddons:x})},k.id):null}),l.pages&&Object.values(l.pages).map(({blockletId:b,page:k})=>n.jsx(B.Route,{path:P.joinURL("/",`@${b}`,k.slug),element:n.jsx(Z,{mode:e,components:d,page:k,locale:u,defaultLocale:c,headerAddons:x})},k.id)),n.jsx(B.Route,{path:"*",element:n.jsx(p.Box,{width:"100vw",height:"100vh",display:"flex",justifyContent:"center",alignItems:"center",children:n.jsx(Be.default,{status:404,extra:n.jsx(Ve,{href:"/",children:o("common.back")})})})})]}),e!=="production"&&n.jsx(Xn,{sx:{bgcolor:"info.light"},children:e}),n.jsx(Zn,{titleFontFamily:(j=(y=t.config)==null?void 0:y.fontFamily)==null?void 0:j.title,descriptionFontFamily:(v=(h=t.config)==null?void 0:h.fontFamily)==null?void 0:v.description})]})}function ao({mode:e,state:t,path:o,pageData:r}){const{t:i,locale:s}=$e.useLocaleContext(),{pages:a,supportedLocales:c,config:{defaultLocale:l},resources:d}=t,u=Object.values(a).find(h=>(h==null?void 0:h.slug)===o),m=Object.values(d.pages||{}).find(h=>h.page.slug===o),f=g.useMemo(()=>c!=null&&c.some(h=>h.locale===s)?s:void 0,[s,c]),x=Se.useReactive({page:null});g.useEffect(()=>{const h=u||(m==null?void 0:m.page)||null;h?x.page=fe.default(h):x.page=null},[u,m]);const y=g.useRef();if(g.useEffect(()=>{Ne.default(r,y.current)||r&&x.page&&(Wt(x.page,t,f,r),y.current=fe.default(r))},[{}]),!u&&!(m!=null&&m.page))return n.jsx(p.Box,{width:"100vw",height:"100vh",display:"flex",justifyContent:"center",alignItems:"center",children:n.jsx(Be.default,{style:{background:"inherit"},status:404,extra:n.jsx(Ve,{href:"/",children:i("common.back")})})});const j=w.getAllComponents(t);return x.page?n.jsx(Z,{mode:e,components:j,page:x.page,locale:f,defaultLocale:l}):null}function Z({mode:e,components:t,page:o,locale:r,defaultLocale:i,headerAddons:s}){var h,v,b,k,N,W,J,le,de;const a=((h=o.locales)==null?void 0:h[r])??((v=o.locales)==null?void 0:v[i])??{},c=a.title||((b=window.blocklet)==null?void 0:b.appName),l=a.description||((k=window.blocklet)==null?void 0:k.appDescription),d=w.autoResizeImage(w.getImageAbsoluteUrl(a.image),540),{logo:u,brand:m,description:f,...x}=et.useHeaderState(),y=g.useMemo(()=>E=>{var L;let C=(s==null?void 0:s(E))??E;return C=((L=x.addons)==null?void 0:L.call(x,C))??C,C},[x.addons,s]),j=(N=a.header)!=null&&N.translucent?Fe:He;return n.jsxs(n.Fragment,{children:[!!a.backgroundColor&&n.jsx(Q.Global,{styles:Q.css`
534
534
  body {
535
535
  background-color: ${a.backgroundColor} !important;
536
536
  }
537
- `}),n.jsx(j,{hideNavMenu:!!((W=a.header)!=null&&W.hideNavMenus),translucentTextColor:(D=a.header)==null?void 0:D.translucentTextColor,...u?{logo:u}:{},...m?{brand:m}:{},...f?{description:f}:{},className:_.cx(((ce=a.header)==null?void 0:ce.sticky)&&"sticky","page-header"),maxWidth:!1,addons:y}),n.jsx(B.ScrollRestoration,{}),n.jsxs(st.Helmet,{children:[n.jsx("title",{children:c}),n.jsx("meta",{name:"og:title",content:c}),n.jsx("meta",{name:"og:description",content:l}),n.jsx("meta",{name:"og:image",content:d}),n.jsx("meta",{name:"twitter:image:src",content:d}),n.jsx("meta",{name:"twitter:image",content:d}),n.jsx("meta",{property:"twitter:description",content:l}),n.jsx("meta",{property:"twitter:title",content:c}),n.jsx("meta",{name:"description",content:l})]}),n.jsx(p.Stack,{flexGrow:1,children:o.sectionIds.map(E=>{var de,ue;const C=o.sections[E];if(!C||C.visibility==="hidden")return null;const L=(de=C.locales)==null?void 0:de[r],Ve=((ue=C.locales)==null?void 0:ue[i])??{};return n.jsx(Gn,{id:E,type:C.component,mode:e,section:C,config:{...Bt.default(L)?Ve:L,locale:r,dev:e==="draft"?{mode:e,components:t,defaultLocale:i}:{mode:e}}},E)})}),!((le=a.footer)!=null&&le.hidden)&&n.jsx(Jn,{})]})}const ao=g.lazy(()=>Promise.resolve().then(()=>require("./publish-button-DEx0XGBW.js"))),Me=Be.default(St.default)`
537
+ `}),n.jsx(j,{hideNavMenu:!!((W=a.header)!=null&&W.hideNavMenus),translucentTextColor:(J=a.header)==null?void 0:J.translucentTextColor,...u?{logo:u}:{},...m?{brand:m}:{},...f?{description:f}:{},className:_.cx(((le=a.header)==null?void 0:le.sticky)&&"sticky","page-header"),maxWidth:!1,addons:y}),n.jsx(B.ScrollRestoration,{}),n.jsxs(at.Helmet,{children:[n.jsx("title",{children:c}),n.jsx("meta",{name:"og:title",content:c}),n.jsx("meta",{name:"og:description",content:l}),n.jsx("meta",{name:"og:image",content:d}),n.jsx("meta",{name:"twitter:image:src",content:d}),n.jsx("meta",{name:"twitter:image",content:d}),n.jsx("meta",{property:"twitter:description",content:l}),n.jsx("meta",{property:"twitter:title",content:c}),n.jsx("meta",{name:"description",content:l})]}),n.jsx(p.Stack,{flexGrow:1,children:o.sectionIds.map(E=>{var ue,me;const C=o.sections[E];if(!C||C.visibility==="hidden")return null;const L=(ue=C.locales)==null?void 0:ue[r],De=((me=C.locales)==null?void 0:me[i])??{};return n.jsx(Gn,{id:E,type:C.component,mode:e,section:C,config:{...It.default(L)?De:L,locale:r,dev:e==="draft"?{mode:e,components:t,defaultLocale:i}:{mode:e}}},E)})}),!((de=a.footer)!=null&&de.hidden)&&n.jsx(Kn,{})]})}const co=g.lazy(()=>Promise.resolve().then(()=>require("./publish-button-BRVXtU3n.js"))),He=Ie.default(Ct.default)`
538
538
  &.sticky {
539
539
  position: sticky;
540
540
  top: 0;
541
541
  }
542
- `;function co({logo:e}){const[t,o]=g.useState(),{value:r}=O.useAsync(()=>new Promise(i=>{fetch("/.well-known/service/blocklet/logo-rect").then(s=>{const a=s.headers.get("content-type");a!=null&&a.includes("svg")&&s.text().then(c=>{o(c),i(null)}),i(s.url)})}),[]);if(e)return e;if(t)return n.jsx(p.Box,{sx:{filter:"initial !important"},dangerouslySetInnerHTML:{__html:Ct.default.sanitize(t)}});if(r){const i=new URL(r);i.searchParams.set("imageFilter","convert"),i.searchParams.set("f","png"),i.searchParams.set("h","80");const s=i.toString();return n.jsx("img",{src:s,alt:"logo"})}return null}function He({logo:e,translucentTextColor:t,...o}){const{y:r}=O.useWindowScroll();let i=Math.min(r/800,1),s="";if(i>.1){i=Math.max(i,.6);const a=Math.round(255*Math.min(1-i,.2));s=`rgb(${a}, ${a}, ${a})`}else s=t||"#EEEEEE";return n.jsx(Me,{logo:n.jsx(co,{logo:e}),...o,className:_.cx(i<=.7&&"reverse-color"),style:{backgroundColor:`rgba(255,255,255,${i})`,"--logo-invert":i<=.7?1-i/6:1-i},sx:{backdropFilter:i>=.6?"blur(10px)":"blur(0px)",transition:"all 0.3s ease",position:"fixed !important",left:0,top:0,right:0,bgcolor:"transparent","&.reverse-color":{".navmenu-root>.navmenu-sub>span,\n .navmenu-root>.navmenu-item,\n .header-addons>button,\n .header-addons>a,\n .header-addons>div>button":{color:`${s} !important`}},".header-logo > div":{filter:"invert(var(--logo-invert))"},".header-logo":{color:s}}})}const Fe=Be.default(p.Button)``;exports.Home=oo;exports.HomeView=Ue;exports.Loading=Oe;exports.PageRoutes=X;exports.PageView=Q;exports.PageViewByPath=so;exports.TranslucentHeader=He;exports.getPages=Ae;exports.publishPages=Un;
542
+ `;function lo({logo:e}){const[t,o]=g.useState(),{value:r}=U.useAsync(()=>new Promise(i=>{fetch("/.well-known/service/blocklet/logo-rect").then(s=>{const a=s.headers.get("content-type");a!=null&&a.includes("svg")&&s.text().then(c=>{o(c),i(null)}),i(s.url)})}),[]);if(e)return e;if(t)return n.jsx(p.Box,{sx:{filter:"initial !important"},dangerouslySetInnerHTML:{__html:Bt.default.sanitize(t)}});if(r){const i=new URL(r);i.searchParams.set("imageFilter","convert"),i.searchParams.set("f","png"),i.searchParams.set("h","80");const s=i.toString();return n.jsx("img",{src:s,alt:"logo"})}return null}function Fe({logo:e,translucentTextColor:t,...o}){const{y:r}=U.useWindowScroll();let i=Math.min(r/800,1),s="";if(i>.1){i=Math.max(i,.6);const a=Math.round(255*Math.min(1-i,.2));s=`rgb(${a}, ${a}, ${a})`}else s=t||"#EEEEEE";return n.jsx(He,{logo:n.jsx(lo,{logo:e}),...o,className:_.cx(i<=.7&&"reverse-color"),style:{backgroundColor:`rgba(255,255,255,${i})`,"--logo-invert":i<=.7?1-i/6:1-i},sx:{backdropFilter:i>=.6?"blur(10px)":"blur(0px)",transition:"all 0.3s ease",position:"fixed !important",left:0,top:0,right:0,bgcolor:"transparent","&.reverse-color":{".navmenu-root>.navmenu-sub>span,\n .navmenu-root>.navmenu-item,\n .header-addons>button,\n .header-addons>a,\n .header-addons>div>button":{color:`${s} !important`}},".header-logo > div":{filter:"invert(var(--logo-invert))"},".header-logo":{color:s}}})}const Ve=Ie.default(p.Button)``;exports.Home=ro;exports.HomeView=Me;exports.Loading=Ue;exports.PageRoutes=Y;exports.PageView=Z;exports.PageViewByPath=ao;exports.TranslucentHeader=Fe;exports.getPages=Oe;exports.publishPages=Mn;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),v=require("./state-BjeG4kYg.js"),q=require("@arcblock/ux/lib/Locale/context"),O=require("@arcblock/ux/lib/Toast"),S=require("@mui/icons-material"),E=require("@mui/lab"),s=require("@mui/material"),W=require("immer"),z=require("lodash/difference"),c=require("react"),_=require("react-use"),C=require("./home-O1tb16Jn.js"),M=t=>t&&t.__esModule?t:{default:t},A=M(O),D=M(z);function N(t){const[d,b]=c.useState(!1);return e.jsx(E.LoadingButton,{...t,loading:t.loading||d,onClick:i=>{var h;const m=(h=t.onClick)==null?void 0:h.call(t,i);m instanceof Promise&&(b(!0),m.finally(()=>{b(!1)}))}})}const R=s.createSvgIcon(e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M7.75732 16.2426L16.2426 7.75736",stroke:"#4B5563",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M16.2426 16.2426L7.75732 7.75735",stroke:"#4B5563",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Close");function F(){const[t,d]=c.useState(),b=c.useMemo(()=>t?e.jsx(s.Dialog,{...t}):null,[t]),i=c.useCallback(()=>{d(void 0)},[]),m=c.useCallback(({title:h,content:g,cancelText:T="Cancel",okText:p="Ok",onOk:f,onClose:k,okIcon:L,okColor:n="primary",cancelColor:y="primary",DialogContentProps:u,form:x,...I})=>{d({...I,open:!0,children:e.jsxs("form",{onSubmit:P=>P.preventDefault(),children:[h&&e.jsxs(s.DialogTitle,{className:"between",zIndex:"appBar",bgcolor:"background.paper",sx:{borderBottom:"1px solid #E5E7EB"},children:[e.jsx(s.Box,{children:h}),e.jsx(s.IconButton,{size:"small",onClick:async()=>{i(),k==null||k()},children:e.jsx(R,{})})]}),g&&e.jsx(s.DialogContent,{...u,sx:{mt:-3,...u==null?void 0:u.sx},children:e.jsx(s.Box,{pt:3,children:g})}),e.jsxs(s.DialogActions,{children:[e.jsx(s.Button,{variant:"outlined",color:y||"primary",onClick:k??i,children:T}),e.jsx(N,{variant:"contained",color:n||"primary",startIcon:L,loadingPosition:L?"start":"center",onClick:async()=>{await(f==null?void 0:f()),i()},type:"submit",children:p})]})]}),onClose:k??i})},[i]);return{dialog:b,showDialog:m,closeDialog:i}}const H=c.forwardRef(({mode:t,state:d},b)=>{const{t:i}=q.useLocaleContext(),[m,h]=c.useState(!1),{dialog:g,showDialog:T}=F(),p=v.useProjectId(),f=c.useCallback(L=>{let n=[];T({title:i("maker.publishToProduction"),content:e.jsxs(s.Box,{sx:{minWidth:300},children:[e.jsx(s.Alert,{color:"warning",icon:e.jsx(S.Warning,{}),children:i("maker.publishToProductionTip")}),e.jsx(s.Box,{maxHeight:"50vh",overflow:"auto",mt:2,children:e.jsx(J,{state:d,toMode:t,onChange:y=>n=y,defaultPageIds:L})})]}),okText:i("maker.publish"),cancelText:i("common.cancel"),onOk:async()=>{var y,u;if((n==null?void 0:n.length)===0){const x=i("maker.publishSelectPagesMessage");throw A.default.error(x),new Error(x)}for(const x of n??d.pageIds){const I=d.pages[x];if(I){const P=(u=(y=v.checkPage(i,I,d))==null?void 0:y[0])==null?void 0:u.message;if(P)throw A.default.error(P),new Error(P)}}localStorage.setItem(v.getProjectPageVersionKey(p??""),String(new Date().getTime())),h(!0);try{await C.publishPages({mode:t,pages:n}),A.default.success(i("maker.publishSuccessMessage"))}catch(x){throw A.default.error(x.message),x}finally{h(!1)}}})},[t,d,i,p,T]);c.useImperativeHandle(b,()=>({openPublishDialog:f}));const k=c.useCallback(()=>{f()},[f]);return e.jsxs(e.Fragment,{children:[e.jsx(E.LoadingButton,{color:"primary",variant:"contained",size:"small",sx:{mr:2},onClick:k,loading:m,disabled:m,children:i("maker.publishToProduction")}),g]})});function J({state:t,toMode:d,onChange:b,defaultPageIds:i}){const{t:m,locale:h}=q.useLocaleContext(),[g,T]=c.useState(!1),[p,f]=c.useState(()=>i?Object.fromEntries(i.map(r=>[r,!0])):{}),{loading:k,error:L,value:n}=_.useAsync(()=>C.getPages({mode:d}),[d]);if(L)throw L;const y=c.useMemo(()=>JSON.parse(JSON.stringify(t.pageIds)).sort((a,j)=>{const o=t.pages[a],l=t.pages[j];return o!=null&&o.publishedAt&&new Date(o.publishedAt).getTime()<new Date(o.updatedAt).getTime()?-1:l!=null&&l.publishedAt&&new Date(l.publishedAt).getTime()<new Date(l.updatedAt).getTime()?1:new Date((o==null?void 0:o.updatedAt)??"").getTime()-new Date((l==null?void 0:l.updatedAt)??"").getTime()}),[t]),u=c.useMemo(()=>n?D.default(n.pageIds,t.pageIds):[],[t,n]),x=c.useMemo(()=>[...t.pageIds].concat(u),[t,u]),I=c.useCallback(r=>{f(a=>{const j=W.produce(a,o=>{g?(Object.assign(o,Object.fromEntries(x.map(l=>[l,!0]))),delete o[r]):o[r]?(delete o[r],u.includes(r)&&t.pageIds.filter(l=>{var w,B;return((w=t.pages[l])==null?void 0:w.slug)===((B=n==null?void 0:n.pages[r])==null?void 0:B.slug)}).forEach(l=>{delete o[l]})):(o[r]=!0,t.pageIds.includes(r)&&u.filter(l=>{var w,B;return((w=n==null?void 0:n.pages[l])==null?void 0:w.slug)===((B=t.pages[r])==null?void 0:B.slug)}).forEach(l=>{o[l]=!0}))});return T(D.default(x,Object.keys(j)).length===0),j})},[g,x,u,t,n]),P=c.useCallback(()=>{T(r=>(r&&f({}),!r))},[p]);return c.useEffect(()=>{b(g?null:Object.keys(p))},[g,p,b]),k?e.jsx(C.Loading,{sx:{my:4}}):e.jsxs(s.List,{disablePadding:!0,sx:{maxWidth:500},children:[e.jsx(s.ListItem,{sx:{position:"sticky",top:0,bgcolor:"background.paper",zIndex:1},disablePadding:!0,children:e.jsxs(s.ListItemButton,{onClick:P,dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:g,tabIndex:-1})}),e.jsx(s.ListItemText,{primary:m("common.all")})]})}),y.map(r=>{var l,w;const a=t.pages[r];if(!a)return null;const j=v.checkPage(m,a,t),o=!a.publishedAt||a.updatedAt&&new Date(a.updatedAt).getTime()>new Date(a.publishedAt).getTime();return e.jsx(s.ListItem,{disablePadding:!0,secondaryAction:e.jsxs(e.Fragment,{children:[o&&e.jsx(s.Tooltip,{title:m("maker.pages.needPublish"),children:e.jsx(S.Sync,{fontSize:"small",sx:{color:"warning.main",fontSize:16,mr:.35}})}),!a.isPublic&&e.jsx(s.Tooltip,{title:m("maker.pages.notPublic"),children:e.jsx(S.VisibilityOff,{fontSize:"small",sx:{color:"warning.main",fontSize:16,mr:.35}})}),j&&e.jsx(v.PageErrorTip,{errors:j,children:e.jsx(S.Warning,{sx:{color:"error.dark",mr:.35}})})]}),children:e.jsxs(s.ListItemButton,{onClick:()=>I(r),dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:g||!!p[r],tabIndex:-1})}),e.jsx(s.ListItemText,{primary:a.slug,secondary:(w=(l=a.locales)==null?void 0:l[h])==null?void 0:w.title,primaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"},secondaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"}})]})},r)}),u.map(r=>{var j,o;const a=n==null?void 0:n.pages[r];return a?e.jsx(s.ListItem,{disablePadding:!0,secondaryAction:e.jsx(s.Chip,{color:"warning",label:"deleted",size:"small"}),children:e.jsxs(s.ListItemButton,{onClick:()=>I(r),dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:g||!!p[r],tabIndex:-1})}),e.jsx(s.ListItemText,{primary:a.slug,secondary:(o=(j=a.locales)==null?void 0:j[h])==null?void 0:o.title,primaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"},secondaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"}})]})},r):null})]})}exports.default=H;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),v=require("./state-oKsa8z3D.js"),q=require("@arcblock/ux/lib/Locale/context"),O=require("@arcblock/ux/lib/Toast"),S=require("@mui/icons-material"),E=require("@mui/lab"),s=require("@mui/material"),W=require("immer"),z=require("lodash/difference"),c=require("react"),_=require("react-use"),C=require("./home-BW7VfExi.js"),M=t=>t&&t.__esModule?t:{default:t},A=M(O),D=M(z);function N(t){const[d,b]=c.useState(!1);return e.jsx(E.LoadingButton,{...t,loading:t.loading||d,onClick:i=>{var h;const m=(h=t.onClick)==null?void 0:h.call(t,i);m instanceof Promise&&(b(!0),m.finally(()=>{b(!1)}))}})}const R=s.createSvgIcon(e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M7.75732 16.2426L16.2426 7.75736",stroke:"#4B5563",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M16.2426 16.2426L7.75732 7.75735",stroke:"#4B5563",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Close");function F(){const[t,d]=c.useState(),b=c.useMemo(()=>t?e.jsx(s.Dialog,{...t}):null,[t]),i=c.useCallback(()=>{d(void 0)},[]),m=c.useCallback(({title:h,content:g,cancelText:T="Cancel",okText:p="Ok",onOk:f,onClose:k,okIcon:L,okColor:n="primary",cancelColor:y="primary",DialogContentProps:u,form:x,...I})=>{d({...I,open:!0,children:e.jsxs("form",{onSubmit:P=>P.preventDefault(),children:[h&&e.jsxs(s.DialogTitle,{className:"between",zIndex:"appBar",bgcolor:"background.paper",sx:{borderBottom:"1px solid #E5E7EB"},children:[e.jsx(s.Box,{children:h}),e.jsx(s.IconButton,{size:"small",onClick:async()=>{i(),k==null||k()},children:e.jsx(R,{})})]}),g&&e.jsx(s.DialogContent,{...u,sx:{mt:-3,...u==null?void 0:u.sx},children:e.jsx(s.Box,{pt:3,children:g})}),e.jsxs(s.DialogActions,{children:[e.jsx(s.Button,{variant:"outlined",color:y||"primary",onClick:k??i,children:T}),e.jsx(N,{variant:"contained",color:n||"primary",startIcon:L,loadingPosition:L?"start":"center",onClick:async()=>{await(f==null?void 0:f()),i()},type:"submit",children:p})]})]}),onClose:k??i})},[i]);return{dialog:b,showDialog:m,closeDialog:i}}const H=c.forwardRef(({mode:t,state:d},b)=>{const{t:i}=q.useLocaleContext(),[m,h]=c.useState(!1),{dialog:g,showDialog:T}=F(),p=v.useProjectId(),f=c.useCallback(L=>{let n=[];T({title:i("maker.publishToProduction"),content:e.jsxs(s.Box,{sx:{minWidth:300},children:[e.jsx(s.Alert,{color:"warning",icon:e.jsx(S.Warning,{}),children:i("maker.publishToProductionTip")}),e.jsx(s.Box,{maxHeight:"50vh",overflow:"auto",mt:2,children:e.jsx(J,{state:d,toMode:t,onChange:y=>n=y,defaultPageIds:L})})]}),okText:i("maker.publish"),cancelText:i("common.cancel"),onOk:async()=>{var y,u;if((n==null?void 0:n.length)===0){const x=i("maker.publishSelectPagesMessage");throw A.default.error(x),new Error(x)}for(const x of n??d.pageIds){const I=d.pages[x];if(I){const P=(u=(y=v.checkPage(i,I,d))==null?void 0:y[0])==null?void 0:u.message;if(P)throw A.default.error(P),new Error(P)}}localStorage.setItem(v.getProjectPageVersionKey(p??""),String(new Date().getTime())),h(!0);try{await C.publishPages({mode:t,pages:n}),A.default.success(i("maker.publishSuccessMessage"))}catch(x){throw A.default.error(x.message),x}finally{h(!1)}}})},[t,d,i,p,T]);c.useImperativeHandle(b,()=>({openPublishDialog:f}));const k=c.useCallback(()=>{f()},[f]);return e.jsxs(e.Fragment,{children:[e.jsx(E.LoadingButton,{color:"primary",variant:"contained",size:"small",sx:{mr:1},onClick:k,loading:m,disabled:m,children:i("maker.publishToProduction")}),g]})});function J({state:t,toMode:d,onChange:b,defaultPageIds:i}){const{t:m,locale:h}=q.useLocaleContext(),[g,T]=c.useState(!1),[p,f]=c.useState(()=>i?Object.fromEntries(i.map(r=>[r,!0])):{}),{loading:k,error:L,value:n}=_.useAsync(()=>C.getPages({mode:d}),[d]);if(L)throw L;const y=c.useMemo(()=>JSON.parse(JSON.stringify(t.pageIds)).sort((a,j)=>{const o=t.pages[a],l=t.pages[j];return o!=null&&o.publishedAt&&new Date(o.publishedAt).getTime()<new Date(o.updatedAt).getTime()?-1:l!=null&&l.publishedAt&&new Date(l.publishedAt).getTime()<new Date(l.updatedAt).getTime()?1:new Date((o==null?void 0:o.updatedAt)??"").getTime()-new Date((l==null?void 0:l.updatedAt)??"").getTime()}),[t]),u=c.useMemo(()=>n?D.default(n.pageIds,t.pageIds):[],[t,n]),x=c.useMemo(()=>[...t.pageIds].concat(u),[t,u]),I=c.useCallback(r=>{f(a=>{const j=W.produce(a,o=>{g?(Object.assign(o,Object.fromEntries(x.map(l=>[l,!0]))),delete o[r]):o[r]?(delete o[r],u.includes(r)&&t.pageIds.filter(l=>{var w,B;return((w=t.pages[l])==null?void 0:w.slug)===((B=n==null?void 0:n.pages[r])==null?void 0:B.slug)}).forEach(l=>{delete o[l]})):(o[r]=!0,t.pageIds.includes(r)&&u.filter(l=>{var w,B;return((w=n==null?void 0:n.pages[l])==null?void 0:w.slug)===((B=t.pages[r])==null?void 0:B.slug)}).forEach(l=>{o[l]=!0}))});return T(D.default(x,Object.keys(j)).length===0),j})},[g,x,u,t,n]),P=c.useCallback(()=>{T(r=>(r&&f({}),!r))},[p]);return c.useEffect(()=>{b(g?null:Object.keys(p))},[g,p,b]),k?e.jsx(C.Loading,{sx:{my:4}}):e.jsxs(s.List,{disablePadding:!0,sx:{maxWidth:500},children:[e.jsx(s.ListItem,{sx:{position:"sticky",top:0,bgcolor:"background.paper",zIndex:1},disablePadding:!0,children:e.jsxs(s.ListItemButton,{onClick:P,dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:g,tabIndex:-1})}),e.jsx(s.ListItemText,{primary:m("common.all")})]})}),y.map(r=>{var l,w;const a=t.pages[r];if(!a)return null;const j=v.checkPage(m,a,t),o=!a.publishedAt||a.updatedAt&&new Date(a.updatedAt).getTime()>new Date(a.publishedAt).getTime();return e.jsx(s.ListItem,{disablePadding:!0,secondaryAction:e.jsxs(e.Fragment,{children:[o&&e.jsx(s.Tooltip,{title:m("maker.pages.needPublish"),children:e.jsx(S.Sync,{fontSize:"small",sx:{color:"warning.main",fontSize:16,mr:.35}})}),!a.isPublic&&e.jsx(s.Tooltip,{title:m("maker.pages.notPublic"),children:e.jsx(S.VisibilityOff,{fontSize:"small",sx:{color:"warning.main",fontSize:16,mr:.35}})}),j&&e.jsx(v.PageErrorTip,{errors:j,children:e.jsx(S.Warning,{sx:{color:"error.dark",mr:.35}})})]}),children:e.jsxs(s.ListItemButton,{onClick:()=>I(r),dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:g||!!p[r],tabIndex:-1})}),e.jsx(s.ListItemText,{primary:a.slug,secondary:(w=(l=a.locales)==null?void 0:l[h])==null?void 0:w.title,primaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"},secondaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"}})]})},r)}),u.map(r=>{var j,o;const a=n==null?void 0:n.pages[r];return a?e.jsx(s.ListItem,{disablePadding:!0,secondaryAction:e.jsx(s.Chip,{color:"warning",label:"deleted",size:"small"}),children:e.jsxs(s.ListItemButton,{onClick:()=>I(r),dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:g||!!p[r],tabIndex:-1})}),e.jsx(s.ListItemText,{primary:a.slug,secondary:(o=(j=a.locales)==null?void 0:j[h])==null?void 0:o.title,primaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"},secondaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"}})]})},r):null})]})}exports.default=H;