@blocklet/pages-kit-inner-components 0.6.6 → 0.6.8

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.
Files changed (33) hide show
  1. package/lib/cjs/add-component.js +1 -1
  2. package/lib/cjs/chunks/components--WuwSB_H.js +57 -0
  3. package/lib/cjs/chunks/{draft-data-D44_IEV2.js → draft-data-CVjF01PQ.js} +1 -1
  4. package/lib/cjs/chunks/{home-BYk01EUy.js → home-BarvCpAK.js} +2 -2
  5. package/lib/cjs/chunks/index-DH8UBqWG.js +475 -0
  6. package/lib/cjs/chunks/{publish-button-C8XPA4g_.js → publish-button-CNo2gT6Q.js} +1 -1
  7. package/lib/cjs/chunks/site-state-C4Zpym9P.js +1 -0
  8. package/lib/cjs/chunks/state-DCxHc_MB.js +1 -0
  9. package/lib/cjs/components.js +1 -1
  10. package/lib/cjs/home.js +1 -1
  11. package/lib/cjs/project-html.js +6 -9
  12. package/lib/cjs/resources.js +1 -1
  13. package/lib/cjs/setting.js +2 -2
  14. package/lib/cjs/site-state.js +1 -1
  15. package/lib/es/add-component.js +2 -2
  16. package/lib/es/chunks/components-B8AH-ivu.js +596 -0
  17. package/lib/es/chunks/{draft-data-CafrGKeh.js → draft-data-BiayOfQz.js} +1 -1
  18. package/lib/es/chunks/{home-DW8SdyfO.js → home-DBc-g4K0.js} +3 -3
  19. package/lib/es/chunks/{index-D5gXPe_7.js → index-DaF8ujCZ.js} +675 -763
  20. package/lib/es/chunks/{publish-button-XSZrDaTQ.js → publish-button-DiKDLFU8.js} +3 -3
  21. package/lib/es/chunks/site-state-sUwlP4XQ.js +1586 -0
  22. package/lib/es/chunks/{state-0gvZF3k2.js → state-C3hsEhCe.js} +117 -121
  23. package/lib/es/components.js +7 -7
  24. package/lib/es/home.js +3 -3
  25. package/lib/es/project-html.js +132 -121
  26. package/lib/es/resources.js +28 -29
  27. package/lib/es/setting.js +148 -145
  28. package/lib/es/site-state.js +16 -15
  29. package/package.json +4 -4
  30. package/lib/cjs/chunks/index-BRgYwvuv.js +0 -475
  31. package/lib/cjs/chunks/site-state-BlQzwACl.js +0 -57
  32. package/lib/cjs/chunks/state-B6BF5wJ-.js +0 -1
  33. package/lib/es/chunks/site-state-BdLTu3Od.js +0 -2123
@@ -0,0 +1,475 @@
1
+ "use strict";var Se=Object.create;var ee=Object.defineProperty;var Ce=Object.getOwnPropertyDescriptor;var Be=Object.getOwnPropertyNames;var Ne=Object.getPrototypeOf,Ie=Object.prototype.hasOwnProperty;var Me=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Be(t))!Ie.call(e,i)&&i!==n&&ee(e,i,{get:()=>t[i],enumerable:!(r=Ce(t,i))||r.enumerable});return e};var Pe=(e,t,n)=>(n=e!=null?Se(Ne(e)):{},Me(t||!e||!e.__esModule?ee(n,"default",{value:e,enumerable:!0}):n,e));const o=require("react/jsx-runtime"),Re=require("@mui/icons-material"),x=require("@mui/material"),We=require("lodash/isEmpty"),ze=require("lodash/pick"),f=require("react"),Ee=require("lodash/keyBy"),k=require("@arcblock/ux/lib/Theme"),b=require("@emotion/css"),Te=require("lodash/omit"),K=require("react-router-dom"),Ae=require("@arcblock/ux/lib/Button"),Le=require("is-uri"),de=require("@iconify-icon/react"),j=require("./state-DCxHc_MB.js"),qe=require("@blocklet/pages-kit/builtin/markdown/markdown-renderer"),ue=require("@blocklet/pages-kit/contexts/color"),Ue=require("react-syntax-highlighter/dist/esm/styles/prism"),Oe=require("@arcblock/react-hooks/lib/useBrowser"),Fe=require("@arcblock/ux/lib/Colors"),X=require("@blocklet/pages-kit/components"),te=require("@blocklet/pages-kit/utils/style"),He=require("@mui/material/useMediaQuery"),U=require("pathe"),W=require("ufo"),De=require("@blocklet/embed/message"),Ve=require("ahooks"),Ye=require("lodash/isEqual"),Je=require("@blocklet/embed/react"),Ge=require("@arcblock/ux/lib/Locale/context"),Ke=require("@arcblock/ux/lib/Screenshot"),Xe=require("react-twitter-embed"),oe=require("react-use"),S=e=>e&&e.__esModule?e:{default:e},Qe=S(We),Q=S(ze),Ze=S(f),F=S(Ee),B=S(Te),et=S(Ae),J=S(Le),tt=S(qe),ot=S(Oe),ne=S(Fe),me=S(He),nt=S(Ye),rt=S(Ke),xe="{{CUSTOM_VALUE}}",it=[{title:"None",value:"none",sx:{py:0}},{title:"Small",value:"small",sx:{py:{xs:2.5,md:4,lg:4,xl:6}}},{title:"Normal",value:"normal",sx:{py:{xs:5,md:7.5,lg:10,xl:12.5}}},{title:"Large",value:"large",sx:{py:{xs:7.5,md:10,lg:12.5,xl:15}}}],st=[{title:"None",value:"none",sx:{py:0}},{title:"Small",value:"small",sx:{py:{xs:2.5,md:4,lg:4,xl:6}}},{title:"Normal",value:"normal",sx:{py:{xs:5,md:7,lg:7,xl:9}}},{title:"Large",value:"large",sx:{py:{xs:6,md:9,lg:9,xl:11}}}],at=[{title:"None",value:"none",sx:{px:0}},{title:"Small",value:"small",sx:{px:{xs:2,md:4,lg:4,xl:6}}},{title:"Normal",value:"normal",sx:{px:{xs:2.5,md:7.5,lg:10,xl:12.5}}},{title:"Large",value:"large",sx:{px:{xs:2.5,md:10,lg:12.5,xl:15}}}],O=(e,t,n)=>{const r=e.breakpoints.values[n];return`${t}${r?` (${r}px)`:""}`},lt=[{title:"100%",value:"full",sx:{maxWidth:"100%"}},{title:e=>O(e,"Small","sm"),value:"sm",sx:{maxWidth:e=>e.breakpoints.values.sm,width:"100%",mx:"auto"}},{title:e=>O(e,"Normal","md"),value:"md",sx:{maxWidth:e=>e.breakpoints.values.md,width:"100%",mx:"auto"}},{title:e=>O(e,"Large","lg"),value:"lg",sx:{maxWidth:e=>e.breakpoints.values.lg,width:"100%",mx:"auto"}},{title:e=>O(e,"Extra Large","xl"),value:"xl",sx:{maxWidth:e=>e.breakpoints.values.xl,width:"100%",mx:"auto"}},{title:"Custom",value:"custom",sx:{maxWidth:xe,width:"100%",mx:"auto"}}],ct=F.default(it,"value"),dt=F.default(st,"value"),ut=F.default(at,"value"),mt=F.default(lt,"value"),xt=new Map([["baseSectionPaddingY",ct],["maxWidth",mt],["paddingY",dt],["paddingX",ut]]);function pe(e){const{type:t,value:n,format:r="sx",defaultValue:i=null}=e,s=xt.get(t);if(!s)return i;const c=n.startsWith("custom:"),a=c?"custom":n;if(s?.[a]&&s?.[a]?.[r]){const l=s[a][r];if(c){const d=n.replace("custom:","");try{return JSON.parse(JSON.stringify(l||{}).replaceAll(xe,d))}catch{}}return l}return i}const he=f.createContext({page:null,getPageMeta:()=>({}),getPageMetaStyle:()=>({})});function pt(){return f.useContext(he)}function ht({page:e,children:t,defaultLocale:n="en",currentLocale:r}){const i=f.useMemo(()=>e?JSON.parse(JSON.stringify(e)):null,[JSON.stringify(e)]),s=f.useCallback(()=>{if(!i)return{};const l=r||n;return i.locales?.[l]??{}},[i,n,r]),c=f.useCallback((l="sx")=>{const d=s();return!d||!d.style?{}:Object.entries(d.style||{}).reduce((u,[h,p])=>{if(!p)return u;const w=`${h}Custom`;d.style[w];const y=pe({type:h,value:p,format:l});return y?{...u,...y}:u},{})},[s]),a=f.useMemo(()=>({page:i,getPageMeta:s,getPageMetaStyle:c}),[i,s,c]);return o.jsx(he.Provider,{value:a,children:t})}const H=["editing","height","locale","dev","sx"];function gt(e){const{className:t,...n}=e;return o.jsx(ft,{...n,className:b.cx("BlockBase-root",t)})}const ft=k.styled(x.Box)`
2
+ position: relative;
3
+ color: ${({theme:e})=>e.palette.text.primary};
4
+ `,ge=f.createContext({pages:[],project:void 0}),{Provider:yt,Consumer:Mo}=ge;function fe(){return f.useContext(ge)}function bt({icon:e,...t}){return o.jsx(de.Icon,{icon:e,...t,ref:null})}function wt({icon:e,className:t="",size:n="1rem",...r}){return o.jsx(jt,{component:bt,className:b.cx("css-icon",t),size:n,...r,icon:e})}const jt=k.styled(x.Box)`
5
+ &.css-icon {
6
+ display: inline-block;
7
+ width: ${({size:e})=>e};
8
+ height: ${({size:e})=>e};
9
+ }
10
+ `;function vt({icon:e,className:t="",size:n="1rem",imageMeta:r,...i}){const s=j.autoResizeImage(j.getImageAbsoluteUrl(e),540),[c,a]=f.useState(!1),l=k.useTheme();return c?o.jsx(wt,{icon:"i-mdi:image",color:l.palette.grey[500],size:n,className:t,...i}):o.jsx(_t,{className:b.cx("image-icon",t),size:n,...i,children:o.jsx("img",{className:"image-icon__image",src:s,onError:()=>a(!0),width:r?.naturalWidth,height:r?.naturalHeight,alt:r?.filename||"card-icon",loading:"lazy"})})}const _t=k.styled(x.Box)`
11
+ display: inline-block;
12
+ width: ${({size:e})=>e};
13
+ height: ${({size:e})=>e};
14
+ .image-icon__image {
15
+ object-fit: contain;
16
+ height: 100%;
17
+ width: 100%;
18
+ }
19
+ `,Z=e=>typeof e=="string"&&/^[\w-_]+:[\w-_]+$/.test(e);function G({icon:e,size:t="1rem",imageMeta:n,...r}){const i=window.isNaN(t)?t:`${t}px`;return Z(e)?o.jsx(de.Icon,{icon:e}):o.jsx(kt,{component:vt,imageMeta:n,className:"base-icon",icon:e,size:i,...r})}const kt=k.styled(x.Box)`
20
+ flex-shrink: 0;
21
+ `;function E({text:e,children:t,icon:n="",endIcon:r,color:i="primary",link:s="",href:c="",...a}){const l=n?o.jsx(G,{icon:n}):null,d=r?o.jsx(G,{icon:r}):null,m=s||c,u={...a};return m&&(u.href=m,J.default(m)&&(u.target=u.target||"_blank")),o.jsx(et.default,{startIcon:l,endIcon:d,color:i,...u,children:e||t})}function ye({editing:e,text:t,...n}){const{pages:r=[]}=fe(),i=r.find(s=>s.id===(n.link||n.linkId));if(e)return o.jsx(E,{...B.default(n,["link","linkId"]),children:t});if(i){const s=i.path||"/";return o.jsx(K.Link,{to:s,children:o.jsx(E,{...B.default(n,["link","linkId"]),children:t})})}return o.jsx(E,{...B.default(n,"linkId"),children:t})}function M({actions:e,center:t,className:n,align:r}){return e&&e?.length?o.jsx(x.Box,{className:b.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",n),sx:{alignItems:"center"},children:e}):null}const $t="section",St=x.styled(x.Box)`
22
+ overflow: hidden;
23
+
24
+ .section__title {
25
+ margin-top: 0;
26
+ font-weight: 700;
27
+ }
28
+ .section__title_non_big {
29
+ font-size: 32px;
30
+ @media (max-width: 600px) {
31
+ font-size: 24px;
32
+ }
33
+ }
34
+ &.base-info .section__tag {
35
+ margin-top: 0;
36
+ margin-bottom: 2vw;
37
+ background-color: ${({theme:e})=>e.palette.primary.main};
38
+ white-space: nowrap;
39
+ max-width: 100%;
40
+ display: inline-block;
41
+ padding: 0 10px;
42
+ justify-content: flex-start;
43
+ overflow: hidden;
44
+ text-overflow: ellipsis;
45
+ font-size: 12px;
46
+ color: #fff;
47
+ border-radius: 4px;
48
+ line-height: 20px;
49
+ }
50
+ .section__title {
51
+ color: ${({theme:e})=>e.palette.text.primary};
52
+ a {
53
+ color: ${({theme:e})=>e.palette.primary.main};
54
+ }
55
+ p {
56
+ margin-top: 0;
57
+ margin-bottom: 0;
58
+ }
59
+ }
60
+ .section__description {
61
+ color: ${({theme:e})=>e.palette.text.primary};
62
+ margin-bottom: 4vw;
63
+ margin-top: 0;
64
+ a {
65
+ color: ${({theme:e})=>e.palette.primary.main};
66
+ }
67
+ p {
68
+ margin-top: 0;
69
+ margin-bottom: 0.5rem;
70
+ }
71
+ }
72
+ @media (min-width: ${({theme:e})=>e.breakpoints.values[$t]}px) {
73
+ .section__tag {
74
+ margin-bottom: 32px;
75
+ }
76
+ .section__title {
77
+ margin-bottom: 32px;
78
+ }
79
+ .section__description {
80
+ margin-bottom: 40px;
81
+ }
82
+ }
83
+ `;function D({title:e,description:t,descriptionMarkdown:n,actions:r,className:i="",classes:s={},prepend:c,append:a,level:l=2,tag:d,badge:m,center:u,logo:h,titleAppearance:p,descriptionAppearance:w,...y}){const v=ue.useColorConvert();if(!e&&!t&&!r&&!m&&!d&&!c&&!a&&!h)return null;const g=Math.max(Math.min(5,l+1),1),_={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"},C=l===0?"big":`h${g}`,$=l===0;return o.jsxs(St,{className:b.cx("base-info","lg:text-left",u&&"!text-center",i),...y,children:[c&&o.jsx("div",{children:c}),(d||m)&&o.jsx("div",{className:b.cx("section__tag",s?.tag||s?.badge),children:d||m}),h&&o.jsx("img",{className:"w-[120px] m-auto mb-8",src:h,alt:"info",loading:"lazy"}),e&&o.jsx(x.Typography,{sx:{whiteSpace:"pre-wrap",mb:t?"2vw":0,...p?.color&&{color:`${v(p.color)} !important`}},className:b.cx("section__title","text-gray-800","dark:text-gray-50",s.title,"page-kit-section__title",$?"":"section__title_non_big"),component:`h${Math.max(l,1)}`,variant:C,children:e}),t&&(n?o.jsx(x.Box,{sx:{...w?.color&&{color:`${v(w.color)} !important`}},className:b.cx("section__description","text-gray-800","dark:text-gray-100",_[g],s.description,"page-kit-section__description"),children:o.jsx(tt.default,{codeOptions:{showActionButton:!1,theme:Ue.materialDark},children:t})}):o.jsx(x.Typography,{sx:{whiteSpace:"pre-wrap",...w?.color&&{color:`${v(w.color)} !important`}},className:b.cx("section__description","text-gray-800","dark:text-gray-100",_[g],s.description,"page-kit-section__description"),component:"div",variant:"body1",gutterBottom:!0,children:t})),o.jsx(M,{actions:r,center:u,className:"mt-8"}),a&&o.jsx("div",{children:a})]})}const V=["actions","append","badge","tag","center","description","descriptionMarkdown","level","logo","prepend","title","titleAppearance","descriptionAppearance"];function Ct(){const e=navigator.userAgent.toLowerCase();return e.includes("safari")&&!e.includes("chrome")}function Bt(e=""){if(e.startsWith("data:image/svg+xml,"))return!0;const t=/^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/,n=/^(\/|\.\/|\.\.\/)(?:[^/]+\/)*[^/]+$/;return t.test(e)||n.test(e)}function z(e){return e?.endsWith(".mp4")||e?.endsWith(".m4v")||e?.endsWith(".webm")}function Nt(e){return e?.endsWith(".mp4")||e?.endsWith(".m4v")?"video/mp4":e?.endsWith(".webm")?"video/webm":void 0}function It(e){let t={};return typeof e=="string"?te.isGradient(e)?t.image=e:(t.image=j.getImageAbsoluteUrl(e),te.isColorString(e)&&(t.color=e,t.image="")):t=e,t}function Mt(){const[e,t]=f.useState(Date.now());return f.useEffect(()=>{const n=()=>{t(Date.now())};return document.addEventListener("visibilitychange",n),()=>{document.removeEventListener("visibilitychange",n)}},[]),e}function re(e,t,n,r,i){let s=null;const{color:c="",image:a}=It(t);if(a&&Bt(a)){delete n.backgroundColor;const l=!(e.mobile.apple.device||Ct())&&z(a),d=z(a)&&r?j.autoResizeImage(j.getImageAbsoluteUrl(r),1200,"quality"):"";l?s=o.jsx(x.Box,{component:"video",className:"section-bg",autoPlay:!0,loop:!0,muted:!0,controls:!1,playsInline:!0,poster:d,src:z(a)?a:j.autoResizeImage(a,1200,"quality"),sx:{width:"100%",position:"absolute",zIndex:-9999,right:0,left:0,top:0,height:"100%",objectFit:"cover"}},a):s=o.jsx(X.ResponsiveImage,{src:z(a)&&r?d:a,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||a)}else a?n.backgroundImage=`${a} !important`:c&&(n.backgroundColor=`${c} !important`);return s}function Pt({autoWidth:e,children:t,...n}){return e?o.jsx(x.Box,{...n,sx:[{display:"flex"},...Array.isArray(n.sx)?n.sx:[n.sx]],children:t}):o.jsx(x.Container,{...n,children:t})}function Y({dark:e=!1,children:t,className:n,sx:r={},boxed:i={show:!1},padding:s="normal",boxProps:c,type:a,...l}){const d={...r},m=me.default(p=>p.breakpoints.down("md"));e&&(d.color=ne.default.common.white,d.backgroundColor=`${ne.default.grey[900]} !important`),i.show&&(d.display="flex");const u=f.useMemo(()=>!Number(l.boxMaxWidth)||m?{width:"100%"}:a==="wall"&&l.boxMaxWidth?{maxWidth:`${l.boxMaxWidth}px !important`,width:"100%"}:{width:"100%"},[l.boxMaxWidth,m,a]),h=pe({type:"baseSectionPaddingY",value:s||"normal",defaultValue:""});return o.jsx(Rt,{component:"section",styles:{...d,...h},className:b.cx("base-section","px-2 md:px-5 lg:px-5 xl:px-10",n,{dark:e}),...B.default(l,"hoverStyle","boxMaxWidth","embedUrl","autoWidth","paddingXY","iframeHeight","titleAppearance","descriptionAppearance"),children:o.jsx(Pt,{autoWidth:l?.autoWidth,className:b.cx("section-content h-full"),sx:u,children:i.show?o.jsx(be,{...c,boxed:i,children:t}):t})})}function be({background:e="",backgroundVideoPoster:t,children:n,sx:r={},boxed:i={show:!1},className:s="",styles:c={},...a}){const l={...c,...r},d=ue.useColorConvert();let m=null;const u=me.default(w=>w.breakpoints.up("sm")),h=ot.default(),p=Mt();return e&&(m=re(h,typeof e=="string"?d(e):e,l,t,p)),i.show&&(l.borderRadius="10px",l.padding===void 0&&(l.padding=u?"50px":"20px"),i?.border&&(l.border="1px solid #c0c0c0"),i?.background&&(m=re(h,typeof i?.background=="string"?d(i?.background):i?.background,l,i?.backgroundVideoPoster,p))),o.jsxs(x.Box,{...a,sx:{...l,...m?{position:"relative",overflow:"hidden",zIndex:0}:{}},className:b.cx(s,i?.boxShadow&&"shadow-xl"),children:[m,n]})}const Rt=k.styled(be)`
84
+ &:nth-of-type(even) {
85
+ background: #f8f8f8;
86
+ }
87
+
88
+ @media (max-width: 600px) {
89
+ .section__title {
90
+ font-size: 24px;
91
+ }
92
+
93
+ .base-info {
94
+ > *:last-child {
95
+ margin-bottom: 0;
96
+ }
97
+ }
98
+ }
99
+ `;function we(e){if(e.type===f.Fragment){const n=(e.props.children||[]).filter(r=>f.isValidElement(r));return n.length===1?we(n[0]):n.length>1}return Array.isArray(e)}const I="&>*";function je({children:e,col:t,gap:n,className:r,align:i,sx:s,type:c,...a}={children:null,className:"",col:3,gap:void 0,sx:{},align:"center",type:"default"}){const l=k.useTheme(),d=Number(Math.floor(100/t*100)/100),m={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"},u=m[i]||m.center;let p=n??({2:6,3:4,4:4,5:3,6:3}[t]||0);we(e)||(p=0);const y=(t-1)*p/t;let v={...s,gap:`${p}rem`};const g={[I]:{width:"100%"}},_={},C={},$={};switch(g.gap="1rem",_.gap=`${p/2}rem`,t){case 3:case 4:_[I]={width:`calc(50% - ${p/2}rem)`};break;case 5:case 6:g[I]={width:`calc(50% - ${p/2/2}rem)`},_[I]={width:`calc(50% - ${p/2/2}rem)`},C[I]={width:`calc(33.33% - ${p*2/3}rem)`};break}return v[I]={width:`calc(${d}% - ${y}rem)`},v[`@media (max-width: ${l.breakpoints.values.xl}px)`]=$,v[`@media (max-width: ${l.breakpoints.values.lg}px)`]=C,v[`@media (max-width: ${l.breakpoints.values.md}px)`]=_,v[`@media (max-width: ${l.breakpoints.values.sm}px)`]=g,c==="wall"&&(v={...s,gap:`${p}rem`},v[I]={width:`calc(${d}% - ${y}rem)`},g[I]={width:`calc(45% - ${p/2/2}rem)`},v[`@media (max-width: ${l.breakpoints.values.sm}px)`]=g),o.jsx(x.Box,{className:b.cx("flex flex-wrap flex-row h-full",u,r),sx:v,...a,children:e})}function P({type:e="",icon:t="",size:n="3rem",className:r="",...i}){return o.jsx(G,{icon:t||e,size:n,className:b.cx("content-icon",r),...i,color:typeof i.color>"u"?"inherit":i.color})}function Wt({to:e,base:t,children:n,className:r,activeClassName:i="active",target:s="auto",autoExternalMark:c=!1,useRouterLink:a,...l}){const{pages:d=[],locale:m=""}={},u=t?U.join("/",t):t||"";let h=s==="auto"?"_self":s,p=U.join(u,e);const w=c?J.default(p):!1;if(t)return p=U.join(u,m,e),o.jsx("a",{className:`no-underline ${r}`,href:W.withoutTrailingSlash(p),rel:"noreferrer noopener",target:h,...l,children:n});if(J.default(e))s==="auto"&&(h="_blank"),p=e;else{W.isRelative(p)&&(p=U.join(window.location.pathname,p));const y=W.parseURL(`${window.location.origin}${p}`),v=d.some(g=>g.pathname===y.pathname);if(a||v)return o.jsx(K.NavLink,{end:!0,to:W.withoutTrailingSlash(p),className:({isActive:g})=>b.cx(r,g?i:""),...l,children:n})}return o.jsxs("a",{className:`no-underline ${r}`,href:W.withoutTrailingSlash(p),rel:"noreferrer noopener",target:h,...l,children:[n,w&&o.jsx(P,{icon:"i-mdi:arrow-top-right",size:"0.9em",className:"smart-link__mark",style:{marginLeft:5}})]})}function T({prepend:e,append:t,children:n,className:r="",dark:i=!1,border:s=!0,...c}){let a={};const{pages:l=[]}=fe(),d=l.find(h=>h.id===c.link),m=!n||Ze.default.Children.toArray(n).every(h=>h===null);c.link&&(a={component:Wt,to:d?.path||c.link,useRouterLink:!0});const u=x.useTheme();return o.jsxs(zt,{className:b.cx("base-card card",{dark:i,"border-transparent":!s},r),sx:{borderColor:u.palette.divider},...a,...B.default(c,["listType","dark","iconColor","link","hoverStyle","imageSize"]),children:[e,!m&&o.jsx("div",{className:"card__body",children:n}),t]})}const zt=k.styled(x.Box)`
100
+ &.base-card {
101
+ text-align: left;
102
+ border-width: 1px;
103
+ border-style: solid;
104
+ border-radius: 12px;
105
+ overflow: hidden;
106
+ &,
107
+ &:hover {
108
+ text-decoration: none;
109
+ }
110
+ }
111
+ .card__body {
112
+ padding: 15px 15px;
113
+ }
114
+ `;function A({align:e="left",title:t,titleProps:n={},description:r,descriptionProps:i={}}){return o.jsxs(o.Fragment,{children:[t&&o.jsx(x.Typography,{className:b.cx("card__title text-gray-800","dark:text-gray-50"),component:"h5",variant:"h5",gutterBottom:!0,align:e,...n,children:t}),r&&o.jsx(x.Typography,{className:b.cx("card__description","text-gray-500","dark:text-gray-400"),component:"div",variant:"body1",gutterBottom:!0,align:e,...i,children:r})]})}function Et({image:e,title:t,description:n,imageProps:r={},imageMeta:i,imageSize:s,titleProps:c={},descriptionProps:a={},actions:l,align:d,...m}){const u=Z(e),h=j.autoResizeImage(j.getImageAbsoluteUrl(e),540);return o.jsxs(Tt,{className:"card-article",...m,prepend:o.jsx("div",{className:"card__image__wrap",children:u&&e?o.jsx(x.Box,{sx:{position:"absolute",left:0,top:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},children:o.jsx(P,{icon:e,color:"primary.main"})}):h&&o.jsx("img",{className:"card__image",src:h,...r,alt:r.alt||i?.filename||"card-image",width:i?.naturalWidth,height:i?.naturalHeight,style:{width:"100%",height:"100%",objectFit:s||"cover",objectPosition:"center"},loading:"lazy"})}),children:[t||n?o.jsx(A,{align:d,title:t,titleProps:c,description:n,descriptionProps:a}):null,l?.length?o.jsx(M,{align:d,actions:l,className:"mt-4"}):null]})}const Tt=k.styled(T)`
115
+ ${e=>e.hoverStyle==="none"?"":e.link?`transition: box-shadow ease .3s;
116
+ &:hover {
117
+ box-shadow: 0 0 10px rgba(95, 142, 244, 0.42);
118
+ }`:""}
119
+
120
+ .card__title {
121
+ color: ${({theme:e})=>e.palette.text.primary};
122
+ a {
123
+ color: ${({theme:e})=>e.palette.primary.main};
124
+ }
125
+ }
126
+ .card__description {
127
+ color: ${({theme:e})=>e.palette.text.primary};
128
+ a {
129
+ color: ${({theme:e})=>e.palette.primary.main};
130
+ }
131
+ }
132
+
133
+ .card__image__wrap {
134
+ padding-top: 61.8%;
135
+ width: 100%;
136
+ position: relative;
137
+ }
138
+ .card__image {
139
+ position: absolute;
140
+ top: 0;
141
+ left: 0;
142
+ bottom: 0;
143
+ right: 0;
144
+ width: 100%;
145
+ height: 100%;
146
+ object-position: top center;
147
+ }
148
+ `,ie="section";function se({title:e,image:t,imageMeta:n,description:r,actions:i,align:s,listType:c="",className:a="",...l}){return o.jsxs(At,{className:b.cx("card",`list-type-${c}`,a),align:s,...l,children:[t&&o.jsx(P,{icon:t,color:"primary.main",size:c==="icon-title"?"1.2rem":"3rem",imageMeta:n}),e||r?o.jsx(A,{align:s,title:e,description:r}):null,i?.length?o.jsx(M,{align:s,actions:i,className:"mt-4"}):null]})}const At=k.styled(T)`
149
+ padding: 5vw 4vw;
150
+ box-sizing: border-box;
151
+ /* min-height: 320px; */
152
+ color: inherit !important;
153
+ border-radius: 0.5rem;
154
+ /* ${({dark:e,theme:t})=>`background-color:${e?t.palette.grey[900]:t.palette.common.white};`} */
155
+ @media (max-width: ${({theme:e})=>e.breakpoints.values[ie]}px) {
156
+ padding: 1.5rem 2rem;
157
+ }
158
+ @media (max-width: ${({theme:e})=>e.breakpoints.values.sm}px) {
159
+ height: auto;
160
+ min-height: unset;
161
+ }
162
+
163
+ ${e=>e.hoverStyle==="none"?"":e.link?`transition: box-shadow ease .3s;
164
+ &:hover {
165
+ box-shadow: 0 0 10px rgba(95, 142, 244, 0.42);
166
+ }`:""}
167
+
168
+ .card__title {
169
+ font-weight: 700;
170
+ margin-top: 24px;
171
+ margin-bottom: 12px;
172
+ color: ${({theme:e})=>e.palette.text.primary};
173
+ a {
174
+ color: ${({theme:e})=>e.palette.primary.main};
175
+ }
176
+ }
177
+ .card__description {
178
+ color: ${({theme:e})=>e.palette.text.primary};
179
+ a {
180
+ color: ${({theme:e})=>e.palette.primary.main};
181
+ }
182
+ }
183
+ .card__body {
184
+ color: ${({theme:e})=>e.palette.text.primary};
185
+ padding: 0;
186
+ ${({align:e})=>`text-align:${e||"left"};`}
187
+ }
188
+
189
+ &.list-type-icon-title {
190
+ padding: 1.2rem;
191
+ .title-line {
192
+ display: flex;
193
+ }
194
+ .card__title {
195
+ margin: 0;
196
+ font-size: 1em;
197
+ }
198
+ .css-icon {
199
+ margin-right: 0.5rem;
200
+ }
201
+ }
202
+
203
+ @media (min-width: ${({theme:e})=>e.breakpoints.values[ie]}px) {
204
+ padding: 2rem 2rem;
205
+ text-align: left;
206
+ box-sizing: border-box;
207
+ }
208
+ `;function Lt({image:e,title:t,description:n,imageProps:r={},imageMeta:i,imageSize:s,titleProps:c={},descriptionProps:a={},actions:l,align:d,...m}){const u=Z(e),h=j.autoResizeImage(j.getImageAbsoluteUrl(e),540);return o.jsxs(qt,{className:"card-article",...m,prepend:o.jsx("div",{className:"card__image__wrap",children:u&&e?o.jsx(x.Box,{sx:{position:"absolute",left:0,top:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},children:o.jsx(P,{icon:e,color:"primary.main"})}):h&&o.jsx(x.Box,{component:"img",className:"card__image",src:h,...r,alt:r.alt||i?.filename||"card-image",style:{width:"100%",height:"100%",objectFit:s||"contain",objectPosition:"center"},loading:"lazy",sx:[{width:i?.naturalWidth,height:i?.naturalHeight},...Array.isArray(r.sx)?r.sx:[r.sx]]})}),children:[t||n?o.jsx(A,{align:d,title:t,titleProps:c,description:n,descriptionProps:a}):null,l?.length?o.jsx(M,{align:d,actions:l,className:"mt-4"}):null]})}const qt=k.styled(T)`
209
+ ${e=>e.hoverStyle==="none"?"":e.link?`transition: box-shadow ease .3s;
210
+ &:hover {
211
+ box-shadow: 0 0 10px rgba(95, 142, 244, 0.42);
212
+ }`:""}
213
+
214
+ border-radius: 0 !important;
215
+
216
+ .card__body {
217
+ ${({align:e})=>`text-align:${e||"left"};`}
218
+ }
219
+
220
+ .card__image__wrap {
221
+ width: 100%;
222
+ height: 100%;
223
+ position: relative;
224
+ display: flex;
225
+ justify-content: center;
226
+ align-items: center;
227
+ }
228
+
229
+ .card__image {
230
+ max-height: 60px;
231
+ }
232
+ `,ae="section";function Ut({title:e,image:t,imageMeta:n,iconSize:r=100,description:i,actions:s,align:c,className:a="",...l}){return o.jsx(Ot,{className:b.cx("card",a),...l,children:o.jsxs(x.Box,{className:"flex items-center",children:[t&&o.jsx(P,{icon:t,color:"primary.main",size:r,imageMeta:n}),o.jsxs(x.Box,{className:"flex-1 ml-4",children:[o.jsx(A,{align:c,title:e,description:i}),o.jsx(M,{align:c,actions:s,className:"mt-4"})]})]})})}const Ot=k.styled(T)`
233
+ padding: 5vw 4vw;
234
+ text-align: left;
235
+ box-sizing: border-box;
236
+ /* min-height: 320px; */
237
+ color: inherit !important;
238
+ border-radius: 0.5rem;
239
+ /* ${({dark:e,theme:t})=>`background-color:${e?t.palette.grey[900]:t.palette.common.white};`} */
240
+ @media (max-width: ${({theme:e})=>e.breakpoints.values[ae]}px) {
241
+ padding: 1.5rem 2rem;
242
+ }
243
+ @media (max-width: ${({theme:e})=>e.breakpoints.values.sm}px) {
244
+ height: auto;
245
+ min-height: unset;
246
+ }
247
+
248
+ ${e=>e.hoverStyle==="none"?"":e.link?`transition: box-shadow ease .3s;
249
+ &:hover {
250
+ box-shadow: 0 0 10px rgba(95, 142, 244, 0.42);
251
+ }`:""}
252
+
253
+ .card__title {
254
+ font-weight: 700;
255
+ margin-bottom: 12px;
256
+ color: ${({theme:e})=>e.palette.text.primary};
257
+ a {
258
+ color: ${({theme:e})=>e.palette.primary.main};
259
+ }
260
+ }
261
+ .card__description {
262
+ color: ${({theme:e})=>e.palette.text.primary};
263
+ a {
264
+ color: ${({theme:e})=>e.palette.primary.main};
265
+ }
266
+ }
267
+ .card__body {
268
+ padding: 0;
269
+ }
270
+
271
+ &.list-type-icon-title {
272
+ padding: 1.2rem;
273
+ .title-line {
274
+ display: flex;
275
+ }
276
+ .card__title {
277
+ margin: 0;
278
+ font-size: 1em;
279
+ }
280
+ .css-icon {
281
+ margin-right: 0.5rem;
282
+ }
283
+ }
284
+
285
+ @media (min-width: ${({theme:e})=>e.breakpoints.values[ae]}px) {
286
+ padding: 2rem 2rem;
287
+ text-align: left;
288
+ box-sizing: border-box;
289
+ }
290
+ `;function Ft({title:e,titleProps:t={},description:n,descriptionProps:r={},image:i,imageMeta:s,className:c="",align:a,hoverStyle:l,...d}){return o.jsxs(Ht,{className:b.cx("card-simple",c,`hover-style__${l}`),align:a,...d,children:[i&&o.jsx(P,{icon:i,color:"primary.main",imageMeta:s}),e||n?o.jsx(A,{align:a,title:e,titleProps:t,description:n,descriptionProps:r}):null]})}const Ht=k.styled(T)`
291
+ .card__title {
292
+ color: ${({theme:e})=>e.palette.text.primary};
293
+ a {
294
+ color: ${({theme:e})=>e.palette.primary.main};
295
+ }
296
+ }
297
+ .card__description {
298
+ color: ${({theme:e})=>e.palette.text.primary};
299
+ a {
300
+ color: ${({theme:e})=>e.palette.primary.main};
301
+ }
302
+ }
303
+
304
+ &.hover-style__default {
305
+ &.card-simple {
306
+ &:hover {
307
+ border-top-right-radius: 36px;
308
+ }
309
+ }
310
+ .card__body {
311
+ &:hover {
312
+ &::before {
313
+ width: 42px;
314
+ height: 42px;
315
+ transform: translate(50%, -50%) rotate(45deg);
316
+ }
317
+ &::after {
318
+ transform: none;
319
+ }
320
+ }
321
+ }
322
+ }
323
+
324
+ &.card-simple {
325
+ border-radius: 8px;
326
+ border-top-right-radius: 26px;
327
+
328
+ .card__body {
329
+ ${({align:e})=>`text-align:${e||"left"};`}
330
+ }
331
+
332
+ ${e=>e.link?`
333
+ cursor: pointer;
334
+ `:""}
335
+ /* cursor: pointer; */
336
+ /* &:hover {
337
+ border-top-right-radius: 36px;
338
+ } */
339
+ transition: all 180ms ease 0s;
340
+ overflow: visible;
341
+ .card__title {
342
+ margin: 12px 0;
343
+ }
344
+ .card__body {
345
+ position: relative;
346
+ padding: 20px 16px 18px;
347
+ overflow: hidden;
348
+ transition: all 180ms ease 0s;
349
+ /* &:hover {
350
+ &::before {
351
+ width: 42px;
352
+ height: 42px;
353
+ transform: translate(50%, -50%) rotate(45deg);
354
+ }
355
+ &::after {
356
+ transform: none;
357
+ }
358
+ } */
359
+ &::before,
360
+ &::after {
361
+ content: ${({border:e})=>e?'""':""};
362
+ transition: inherit;
363
+ position: absolute;
364
+ top: 0px;
365
+ right: 0px;
366
+ }
367
+ &::before {
368
+ z-index: 3;
369
+ background: #fff;
370
+ width: 30px;
371
+ height: 30px;
372
+ transform: translate(50%, -50%) rotate(45deg);
373
+ box-shadow: 0 1px 0 0 #e9eaec;
374
+ }
375
+ &::after {
376
+ z-index: 2;
377
+ width: 28px;
378
+ height: 28px;
379
+ border-bottom-left-radius: 6px;
380
+ background: #fcfcfd;
381
+ box-shadow: -1px 1px 0 0 #e9eaec;
382
+ transform: translate(8px, -8px);
383
+ }
384
+ }
385
+ }
386
+ `;function Dt({type:e="default",...t}){const r={article:Et,simple:Ft,news:Ut,default:se,wall:Lt}[e]||se;return o.jsx(r,{...e==="news"?t:B.default(t,"iconSize")})}function Vt({list:e=[],align:t="top",cards:n,listBorder:r=!0,listType:i="",col:s=3,gap:c,iconColor:a,className:l="",type:d="default",dark:m=!1,textAlign:u="left",hoverStyle:h,...p}){return o.jsx(je,{type:d,className:b.cx("card-list py-1",l,"items-stretch"),col:s,gap:c,align:t,...p,children:n||e.map(w=>o.jsx(Dt,{borderColor:r,iconColor:a,type:d,listType:i,dark:m,...w,align:u,style:c===0&&e.length>1?{borderRadius:0,marginRight:"-1px",marginBottom:"-1px"}:{}},w.id))})}const Yt=["align","cards","list","listBorder","listType","col","gap","iconColor","type","textAlign"];function N(e,t){const n=Q.default(e,t),r=B.default(e,t);return[n,r]}const Jt=k.styled(Y)`
387
+ a .card {
388
+ color: #404040;
389
+ cursor: pointer;
390
+ }
391
+ a:not(.MuiButton-root) {
392
+ color: ${({theme:e})=>e.palette.primary.main};
393
+ &:hover,
394
+ &:active {
395
+ color: ${({theme:e})=>e.palette.primary.main};
396
+ }
397
+ }
398
+ a:hover .card {
399
+ color: #404040;
400
+ }
401
+ `;function Gt({className:e,...t}){const[n,r]=N(t,V),[i,s]=N(r,Yt);return o.jsxs(Jt,{className:b.cx("section--card-list",e),type:t.type,...s,children:[Object.keys(n).length>0&&o.jsx(D,{center:!0,...n,className:"mb-[2.5vw]"}),o.jsx(Vt,{...i,dark:!!t.dark})]})}const Kt=k.styled(Gt)`
402
+ .card__description {
403
+ white-space: pre-wrap;
404
+ }
405
+ .section__description {
406
+ }
407
+ .card {
408
+ /* background: inherit !important; */
409
+ }
410
+ &.dark .card-simple .card__body::before {
411
+ background: #212121 !important;
412
+ }
413
+ .card-simple .card__body::after {
414
+ background: inherit !important;
415
+ }
416
+ `;function Xt({section:e,...t}){const[{editing:n},r]=N(t,H),i=f.useMemo(()=>({...B.default(r,["listBorder","list","iconSize","imageSize"]),list:r.list?.map(s=>({...B.default(s,"icon","iconColor"),image:["news","simple","default"].includes(r.type)&&s.icon?s.icon:s.image,actions:s.actions?.map?.(c=>o.jsx(ye,{...c,editing:n},c.id)),border:r.listBorder,iconSize:r.iconSize,imageSize:r.imageSize,hoverStyle:r.hoverStyle}))}),[r]);return o.jsx(Kt,{style:n?{pointerEvents:"none"}:{},...i})}function Qt({properties:e,section:t,locale:n,dev:r}){return t?.config?.componentId?o.jsx(X.CustomComponentRenderer,{instanceId:t.id,componentId:t.config.componentId,blockletId:t.config.blockletId,blockletTitle:t.config.blockletTitle,componentName:t.config.componentName,locale:n,properties:e,dev:r}):o.jsx(x.Box,{sx:{textAlign:"center",py:2},children:o.jsx(x.Typography,{variant:"caption",sx:{color:"text.secondary"},children:"Please select component to render"})})}function Zt({src:e,dataId:t,isEdit:n=!1,height:r="100%",onLoad:i=()=>{}}){return o.jsx(Je.EmbedIframe,{isEdit:n,embedId:t,src:e,height:r,onLoad:()=>{i()}})}function eo({dataId:e,src:t,actions:n,center:r,onLoad:i,...s}){const[c,a]=N(s,V);return o.jsxs(Y,{...a,children:[Object.keys(c).length>0&&o.jsx(D,{center:r,...c}),o.jsx(Zt,{dataId:e,src:t,onLoad:i,height:s.iframeHeight?`${s.iframeHeight}px`:"100%"}),o.jsx(M,{actions:n,center:r})]})}const to={src:"",embedUrl:"",title:"",description:"",dark:!1,background:"",center:!0,config:{},id:""};function oo({section:e,id:t,src:n,...r}){const i=`${t}-${r.locale}`,[{editing:s},c]=N(r,H),a=f.useRef({}),l=JSON.parse(JSON.stringify(c)),{message:d}=De.useMessage(i,"server"),m=Ve.useLatest(JSON.parse(JSON.stringify(c.config)||"{}"));return f.useEffect(()=>{d&&d.onInit(()=>m.current)},[d]),f.useEffect(()=>{const u=JSON.parse(JSON.stringify(c.config)||"{}");nt.default(a.current,u)||(a.current=u,d?.send("config-set",u))},[d,c.config]),n?o.jsx(eo,{...l,dataId:i,src:n,style:s?{pointerEvents:"none"}:{}}):o.jsx(no,{children:'Please set the "src" attribute for this block'})}const no=k.styled("div")`
417
+ user-select: none;
418
+ color: #999;
419
+ padding: 8px;
420
+ height: 200px;
421
+ `,ro=12,io=({gridSettings:e,section:t,index:n,columns:r,simulateMode:i="desktop",isBackground:s})=>{const c=e?.[i]??{},a=c[t.id],l=so(c);return{i:t.id,static:t?.locked||s,...s?{x:0,y:0,w:r,h:1,isResizable:!1}:{x:a?.x??0,y:a?.y??n,w:a?.w??r,h:a?.h??1,isResizable:!0},minH:1,maxH:1,maxY:l}},so=e=>Object.values(e).reduce((t,n)=>Math.max(t,n.y||0),0)||0,ao=e=>{const{dev:t,id:n,section:r,onBlockRender:i}=e,s=t?.mode,c=x.useMediaQuery(g=>g.breakpoints.down("sm")),{t:a}=Ge.useLocaleContext(),{sections:l,sectionIds:d,config:m}=r,{columns:u=ro,gridSettings:h}=m||{},p=f.useCallback((g,_=!1,C=0)=>{if(!i||!g||!g.component||g.visibility==="hidden")return null;const $=io({gridSettings:h,section:g,index:C,columns:u,simulateMode:c?"mobile":"desktop",isBackground:_}),L=$?.x??0,q=$?.y??0,R=$?.w??u,_e=$?.h??1,ke=$?.maxY??0,$e=!!r?.config?.backgroundSectionId;return o.jsx(x.Box,{className:_?"layout-block-background":"layout-block-section",sx:{..._?{gridColumn:"1 / -1",gridRow:`1 / ${ke+1}`,zIndex:0,width:"100%",height:"100%","& .BlockBase-root":{width:"100%",height:"100%"}}:{position:"relative",gridColumn:`${L+1} / span ${R}`,gridRow:`${q+($e?0:1)} / span ${_e}`,zIndex:1}},children:i({id:g.id,type:g.component,config:{},section:{...g},mode:s})},g.id)},[n,s,i,h,u,c]),{backgroundElements:w,contentElements:y}=f.useMemo(()=>{if(!d||!d.length||!l||!Object.keys(l).length)return{backgroundElements:[],contentElements:[]};const g=[],_=[];return d?.forEach((C,$)=>{const L=l[C];if(!L)return;const q=r?.config?.backgroundSectionId===C,R=p(L,q,$);R&&(q?g.push(R):_.push(R))}),{backgroundElements:g,contentElements:_}},[p,l,d]);return s==="draft"&&!w?.length&&!y?.length?o.jsxs(x.Box,{sx:{gridColumn:"1 / -1",gridRow:"1",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,border:g=>`2px dashed ${g.palette.divider}`,borderRadius:2,padding:4,color:"text.secondary",textAlign:"center",minHeight:"160px"},children:[o.jsx(x.Box,{sx:{fontSize:"48px",opacity:.5},children:"📐"}),o.jsx(x.Box,{sx:{fontSize:"16px",fontWeight:500,marginBottom:1},children:"Section Layout"}),o.jsx(x.Box,{sx:{opacity:.7,whiteSpace:"pre-line"},children:a("maker.layoutBlock.draftPlaceholder")}),o.jsx(x.Box,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",opacity:.1,background:g=>`
422
+ repeating-linear-gradient(
423
+ 90deg,
424
+ transparent,
425
+ transparent calc(100% / ${u} - 1px),
426
+ ${g.palette.grey[400]} calc(100% / ${u} - 1px),
427
+ ${g.palette.grey[400]} calc(100% / ${u})
428
+ )
429
+ `}})]}):o.jsxs(x.Box,{sx:{position:"relative",display:"grid",gridTemplateColumns:`repeat(${u}, 1fr)`,alignItems:"center",width:"100%",height:"100%"},children:[w,y]})},lo=["title","description","actions","badge","tag","prepend","append","logo"];function co({image:e,imageBorder:t,imageShadow:n,className:r,reverse:i=!1,fullSizeImage:s,...c}){const[a,l]=N(c,V),d=Object.keys(a).length>0&&Object.values(Q.default(a,lo)).filter(Boolean).length>0&&o.jsx(D,{...a}),m=f.isValidElement(e)?e:o.jsx(x.Box,{component:"img",src:e,alt:"",className:"block"}),u=["phone","macbook"].includes(t),h=e&&o.jsx(x.Box,{className:b.cx("section__image","m-auto, leading-[1] text-center",n&&"shadow-xl",a?.center?"flex justify-center items-center":""),sx:{border:t===!0?"1px solid #c0c0c0":void 0,borderRadius:2,overflow:"hidden","> div":u?{width:"100%",video:{borderRadius:"0 !important"}}:void 0},children:u?o.jsx(rt.default,{type:t,sx:{width:"100%"},children:m}):m});return o.jsx(Y,{className:b.cx("section--block",r,s&&!i&&b.css`
430
+ .section-bg {
431
+ height: 80%;
432
+ }
433
+ `),...l,boxProps:s?{sx:{padding:0,overflow:"hidden"}}:void 0,children:o.jsx(je,{col:e?2:1,className:s?b.css`
434
+ display: flex;
435
+ flex-direction: column;
436
+
437
+ > .base-info,
438
+ > .section__image {
439
+ width: 100%;
440
+
441
+ > img,
442
+ > video {
443
+ width: 100%;
444
+ }
445
+ }
446
+ `:void 0,children:i?o.jsxs(o.Fragment,{children:[h,d]}):o.jsxs(o.Fragment,{children:[d,h]})})})}const uo=[/youtu\.be\/([^#&?]{11})/,/\?v=([^#&?]{11})/,/&v=([^#&?]{11})/,/embed\/([^#&?]{11})/,/\/v\/([^#&?]{11})/];function mo(e){if(/youtu\.?be/.test(e))for(const t of uo){const n=t.exec(e)?.[1];if(n)return n}}function xo(e){const t=mo(e);if(t)return`https://youtube.com/embed/${t}`}function po({src:e}){return f.useEffect(()=>{import("@lottiefiles/lottie-player")},[]),o.jsx("lottie-player",{autoplay:!0,loop:!0,mode:"normal",src:e})}function ho(e){return o.jsx(x.Box,{sx:{maxHeight:400,overflow:"hidden auto"},children:o.jsx(Xe.TwitterTimelineEmbed,{...e})})}function go({url:e}){const t=f.useRef(null),n=495,[r,i]=f.useState(t.current?t.current.offsetWidth*.5625:n),s=f.useCallback(()=>{const c=window.innerWidth>990?1:window.innerWidth>522?1.2:window.innerWidth>400?1.45:1.85,a=t.current?t.current.offsetWidth*.5625:n;return i(Math.floor(a*c))},[]);return f.useEffect(()=>{window.addEventListener("resize",s);const c=window.innerWidth>990?1:window.innerWidth>522?1.2:window.innerWidth>400?1.45:1.85,a=t.current?t.current.offsetWidth*.5625:n;return i(Math.floor(a*c)),function(){window.removeEventListener("resize",s)}},[r,s]),o.jsx(x.Box,{component:"iframe",ref:t,title:"youtube",src:e,frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,sx:{width:"100%",height:`${r}px`,display:"block"}})}const fo={image:"https://www.arcblock.io/static/ead0cabde7f2b7ff34db8f3e8ceca271/afc4b/builder.png",badge:"Develop · Deploy · Run",title:"The Future is Here: Blockchain and Decentralized Application Development",description:"ArcBlock, your exclusive new decentralized development platform, makes developing decentralized applications, blockchain, and distributed ledger technology straightforward.",reverse:!1,dark:!1,background:"",actions:void 0,hasImage:!0,center:!1},yo=k.styled(co)`
447
+ .section__description {
448
+ }
449
+ `;function bo({hasImage:e,fullSizeImage:t,boxed:n,videoPoster:r,imageMeta:i,imageOptimization:s,imageSize:c,section:a,...l}){const[{editing:d},m]=N({...l,boxed:t?void 0:n},H);let u=wo(m.image,r,t,i,s,c);e||(u=null);let h=null;return m.actions&&(h=m.actions?.map?.((p,w)=>o.jsx(ye,{...p,editing:d},w))),o.jsx(yo,{...m,style:d?{pointerEvents:"none"}:{},image:u,fullSizeImage:e&&t,actions:h})}function wo(e,t,n,r,i,s){if(e){if(e.endsWith(".json"))return o.jsx(po,{src:e});if(e.indexOf("twitter.com")!==-1)return o.jsx(ho,{sourceType:"url",url:e});const c=xo(e);if(c)return o.jsx(go,{url:c});const{naturalWidth:a,naturalHeight:l,filename:d}=r||{};if(z(e))return o.jsx("video",{width:a&&`${a}px`,height:l&&`${l}px`,controls:!0,autoPlay:!0,muted:!0,style:{display:"block",objectFit:s||"contain",borderRadius:"8px",width:"100%",height:"100%"},poster:j.autoResizeImage(j.getImageAbsoluteUrl(t),n?1200:540,i),children:o.jsx("source",{src:j.getImageAbsoluteUrl(e),type:Nt(e)})},e);const m=i==="quality"?1:.6;return o.jsx(X.ResponsiveImage,{src:j.getImageAbsoluteUrl(e),sizesAttr:{sm:600*m,md:450*m,lg:540*m,...n&&{md:900*m,lg:1200*m}},width:a&&`${a}px`,height:l&&`${l}px`,alt:d??e,style:{objectFit:s||"contain",display:"block",width:"100%",height:"100%"},loading:"lazy"})}return null}const jo=["production","draft"];function vo({mode:e,version:t}={}){const n=t&&typeof t=="number"?{mode:e,version:t}:{mode:e};return j.api.get(`/api/${j.getProjectIdFromPathnameOrWindow()}/pages`,{params:n}).then(r=>r.data)}function _o({mode:e,routes:t}){return j.api.post(`/api/${j.getProjectIdFromPathnameOrWindow()}/pages/publish`,{mode:e,routes:t}).then(n=>n.data)}function ko({locale:e,sort:t,page:n,limit:r,mode:i}={}){return j.api.get(`/api/${j.getProjectIdFromPathnameOrWindow()}/pages/toc`,{params:{locale:e,sort:t,page:n,limit:r,mode:i}}).then(s=>s.data)}const $o={style:"list",sort:"-updatedAt"},le=20;function So({style:e,sort:t,section:n,...r}){const[{editing:i,locale:s},c]=N(r,H),[a,l]=N(c,V),[d,m]=f.useState(),u=f.useRef(!1),h=oe.useUpdate(),p=K.useNavigate(),w=f.useCallback(async()=>{if(!u.current){u.current=!0,h();try{const y=d?Math.floor(d.list.length/le)+1:1,{list:v,total:g}=await ko({locale:s,sort:t,page:y,limit:le});m(_=>({list:(_?.list??[]).concat(v),total:g}))}finally{u.current=!1,h()}}},[d,s,t,h]);return oe.useMount(()=>{w()}),o.jsxs(Y,{...l,sx:i?{pointerEvents:"none"}:{},children:[Object.keys(a).length>0&&o.jsx(D,{...a}),d?o.jsxs(o.Fragment,{children:[o.jsx(x.Grid,{container:!0,spacing:2,sx:{justifyContent:"center"},children:d?.list.map(y=>o.jsx(x.Grid,{size:{xs:12,sm:e==="card"?6:12,md:e==="card"?3:12},children:o.jsxs(Co,{elevation:0,className:b.cx(e==="card"&&"style-card"),onClick:i?void 0:()=>p(y.slug),children:[!!y.image&&o.jsx(x.CardMedia,{component:"img",alt:"",image:j.autoResizeImage(j.getImageAbsoluteUrl(y.image),540),loading:"lazy"}),o.jsxs(x.CardContent,{children:[o.jsx(x.Typography,{variant:"h6",component:"div",className:ce,children:y.title||y.id}),o.jsx(x.Typography,{variant:"body2",className:ce,children:y.description})]})]})},y.id))}),o.jsx(x.Box,{sx:{textAlign:"center",mt:2},children:d.total>d.list.length?o.jsx(E,{variant:"outlined",color:"secondary",onClick:w,loading:u.current,children:"More"}):o.jsx(E,{variant:"outlined",color:"secondary",disabled:!0,children:"No More"})})]}):o.jsx(x.Box,{sx:{p:2,textAlign:"center"},children:o.jsx(x.CircularProgress,{size:24})})]})}const ce=b.css`
450
+ display: -webkit-box;
451
+ -webkit-box-orient: vertical;
452
+ -webkit-line-clamp: 2;
453
+ overflow: hidden;
454
+ text-overflow: ellipsis;
455
+ `,Co=k.styled(x.Card)`
456
+ border: 1px solid #e0e0e0;
457
+ background-color: transparent;
458
+ cursor: pointer;
459
+ display: flex;
460
+ color: inherit;
461
+
462
+ > .MuiCardMedia-root {
463
+ width: 30vw;
464
+ max-height: 50vw;
465
+ }
466
+
467
+ &.style-card {
468
+ display: block;
469
+
470
+ > .MuiCardMedia-root {
471
+ width: 100%;
472
+ max-height: 50vw;
473
+ }
474
+ }
475
+ `,Bo={iframe:oo,section:bo,"section-card-list":Xt,toc:So,"custom-component":Qt,"layout-block":ao};function ve({id:e,type:t,mode:n,config:r,section:i,ignorePageMetaStyle:s,page:c,...a}){const l=Bo[t],{getPageMetaStyle:d}=pt(),m=f.useMemo(()=>{const{height:p,...w}=r;return t==="layout-block"&&(w.onBlockRender=y=>{const v={...r?.dev,...y?.config?.dev},{defaultLocale:g}=v,_={...Q.default(r,["locale","editing"]),...y?.config,dev:v},{locale:C}=_;let $=c?.dataSource?.[y?.id]?.[C];return Qe.default($)&&($=c?.dataSource?.[y?.id]?.[g??"en"]),o.jsx(ve,{...y,config:{...y?.section?.properties,...$,..._},page:c,ignorePageMetaStyle:!0})}),w},[r,t]),u=f.useMemo(()=>{const p={};return t!=="custom-component"&&(p.height=r.height),p.sx=s?void 0:d("sx"),p.id=`BlockBase-${e}`,p},[r.height,s,t,d]),h=l&&o.jsx(l,{mode:n,...m,id:e,section:i});return h?o.jsx(gt,{...a,...u,children:h}):o.jsx(No,{type:t})}function No({type:e}){return o.jsx(x.Box,{sx:{p:2},children:o.jsxs(x.Alert,{icon:o.jsx(Re.ErrorOutline,{}),color:"error",children:["Unsupported Block `",e,"`"]})})}exports.BlockRenderer=ve;exports.IFrameBlockDefaultProps=to;exports.PageProvider=ht;exports.Provider=yt;exports.STATE_MODES=jo;exports.SectionBlockDefaultProps=fo;exports.TocDefaultProps=$o;exports.getPages=vo;exports.publishPages=_o;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),N=require("./state-B6BF5wJ-.js"),q=require("@arcblock/ux/lib/Locale/context"),Y=require("@arcblock/ux/lib/Toast"),Z=require("@blocklet/pages-kit/utils/route"),C=require("@mui/icons-material"),F=require("@mui/lab"),s=require("@mui/material"),ee=require("immer"),te=require("lodash/difference"),a=require("react"),se=require("react-use"),ne=require("./home-BYk01EUy.js"),H=require("./index-BRgYwvuv.js"),J=o=>o&&o.__esModule?o:{default:o},z=J(Y),V=J(te);function ie(o){const[x,g]=a.useState(!1);return e.jsx(F.LoadingButton,{...o,loading:o.loading||x,onClick:c=>{const m=o.onClick?.(c);m instanceof Promise&&(g(!0),m.finally(()=>{g(!1)}))}})}const oe=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 re(){const[o,x]=a.useState(),g=a.useMemo(()=>o?e.jsx(s.Dialog,{...o}):null,[o]),c=a.useCallback(()=>{x(void 0)},[]),m=a.useCallback(({title:b,content:d,cancelText:P="Cancel",okText:f="Ok",onOk:y,onClose:u,okIcon:L,okColor:k="primary",cancelColor:h="primary",DialogContentProps:v,form:R,...I})=>{x({...I,open:!0,children:e.jsxs("form",{onSubmit:B=>B.preventDefault(),children:[b&&e.jsxs(s.DialogTitle,{className:"between",zIndex:"appBar",bgcolor:"background.paper",sx:{borderBottom:B=>`1px solid ${B.palette.divider}`},children:[e.jsx(s.Box,{children:b}),e.jsx(s.IconButton,{size:"small",onClick:async()=>{c(),u?.()},children:e.jsx(oe,{})})]}),d&&e.jsx(s.DialogContent,{...v,sx:{mt:-3,...v?.sx,bgcolor:"background.paper"},children:e.jsx(s.Box,{sx:{pt:3},children:d})}),e.jsxs(s.DialogActions,{sx:{bgcolor:"background.paper"},children:[e.jsx(s.Button,{variant:"outlined",color:h||"primary",onClick:u??c,children:P}),e.jsx(ie,{variant:"contained",color:k||"primary",startIcon:L,loadingPosition:L?"start":"center",onClick:async()=>{await y?.(),c()},type:"submit",children:f})]})]}),onClose:u??c})},[c]);return{dialog:g,showDialog:m,closeDialog:c}}const ae=({ref:o,mode:x,state:g})=>{const{t:c}=q.useLocaleContext(),[m,b]=a.useState(!1),{dialog:d,showDialog:P}=re(),f=N.useProjectId(),y=a.useCallback(L=>{let k=[];P({title:c("maker.publishToProduction"),content:e.jsxs(s.Box,{sx:{minWidth:300},children:[e.jsx(s.Alert,{color:"warning",icon:e.jsx(C.Warning,{}),children:c("maker.publishToProductionTip")}),e.jsx(s.Box,{sx:{maxHeight:"50vh",overflow:"auto",mt:2},children:e.jsx(ce,{state:g,toMode:x,onChange:h=>k=h,defaultRouteIds:L})})]}),okText:c("maker.publish"),cancelText:c("common.cancel"),onOk:async()=>{if(k?.length===0){const h=c("maker.publishSelectPagesMessage");throw z.default.error(h),new Error(h)}localStorage.setItem(N.getProjectPageVersionKey(f??""),String(new Date().getTime())),b(!0);try{await H.publishPages({mode:x,routes:k}),z.default.success(c("maker.publishSuccessMessage"))}catch(h){throw z.default.error(h.message),h}finally{b(!1)}}})},[x,g,c,f,P]);a.useImperativeHandle(o,()=>({openPublishDialog:y}));const u=a.useCallback(()=>{y()},[y]);return e.jsxs(e.Fragment,{children:[e.jsx(F.LoadingButton,{color:"primary",variant:"contained",size:"small",sx:{mr:1},onClick:u,loading:m,disabled:m,children:c("maker.publish")}),d]})};function le({routePathInfo:o,checked:x,onClick:g,route:c}){const{t:m}=q.useLocaleContext(),b=!o.routeMetaData?.publishedAt||o.routeMetaData?.updatedAt&&new Date(o.routeMetaData?.updatedAt)>new Date(o.routeMetaData?.publishedAt);return e.jsx(s.ListItem,{sx:{pl:4,pr:3},disablePadding:!0,secondaryAction:e.jsxs(s.Box,{sx:{display:"flex",alignItems:"center",minWidth:"auto"},children:[b&&e.jsx(s.Box,{className:"visible",title:m("maker.pages.needPublish"),sx:{mr:.35,color:"warning.main",display:"flex",alignItems:"center"},children:e.jsx(s.Tooltip,{title:m("maker.pages.needPublish"),children:e.jsx(C.Sync,{fontSize:"small",sx:{fontSize:"16px"}})})}),(!o.routeMetaData?.isPublic||!c.isPublic)&&e.jsx(s.Box,{className:"visible",sx:{color:"warning.main"},children:e.jsx(s.Tooltip,{title:m("maker.pages.notPublic"),children:e.jsx(C.VisibilityOff,{fontSize:"small",sx:{fontSize:"16px"}})})})]}),children:e.jsxs(s.ListItemButton,{onClick:g,dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:x,tabIndex:-1})}),e.jsx(s.ListItemText,{primary:o.path,slotProps:{primary:{fontSize:"0.8rem",fontStyle:"italic",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",pr:1}}})]})})}function ce({state:o,toMode:x,onChange:g,defaultRouteIds:c}){const{t:m,locale:b}=q.useLocaleContext(),[d,P]=a.useState(!1),[f,y]=a.useState(()=>c?Object.fromEntries(c.filter(t=>!t.includes("-")).map(t=>[t,!0])):{}),[u,L]=a.useState({}),[k,h]=a.useState(()=>c?Object.fromEntries(c.filter(t=>t.includes("-")).map(t=>[t,!0])):{}),[v,R]=a.useState({}),{loading:I,error:B,value:w}=se.useAsync(()=>H.getPages({mode:x}),[x]);if(B)throw B;const j=a.useMemo(()=>o.routeIds||[],[o]),M=a.useMemo(()=>w?.pageIds||[],[w]),D=a.useMemo(()=>!j||!o.routes?[]:JSON.parse(JSON.stringify(j)).sort((n,i)=>{const r=o.routes?.[n],l=o.routes?.[i];return r?.publishedAt&&new Date(r.publishedAt).getTime()<new Date(r.updatedAt).getTime()?-1:l?.publishedAt&&new Date(l.publishedAt).getTime()<new Date(l.updatedAt).getTime()?1:new Date(r?.updatedAt??"").getTime()-new Date(l?.updatedAt??"").getTime()}),[o,j]),E=a.useMemo(()=>{if(!D)return[];if(!u)return D;const t=[...D].filter(n=>!u[n]);return Object.values(u).forEach(n=>{n.forEach(i=>{t.push(`${i.originalRouteId}-${i.paramOptionIds.join("-")}`)})}),t},[D,u]),O=a.useMemo(()=>!w||!M||!E?[]:V.default(M,E),[E,w,M]),T=a.useMemo(()=>j?[...j].concat(O):O,[j,O]),$=a.useCallback(()=>{const t={};D?.forEach(n=>{const i=o.routes?.[n];if(i&&i.params&&i.params.length>0&&i.paramsOptions&&i.paramsOptions.length>0){const r=Z.generateParamCombinations({basePath:i.path,params:i.params,routeId:i.id,paramsOptions:i.paramsOptions,currentIndex:0,currentParams:[],currentOptionIds:[],result:[]});r.length>0&&(t[i.id]=r)}}),L(t)},[D,o.routes]);a.useEffect(()=>{$()},[$]),a.useEffect(()=>{R(t=>{const n={...t};return Object.keys(u).forEach(i=>{u[i]&&u[i]?.length>0&&n[i]===void 0&&(n[i]=!0)}),n})},[u]);const W=a.useRef(!0);a.useEffect(()=>{h(t=>{const n={...t};return Object.keys(u).length===0||(Object.keys(u).forEach(i=>{const r=u[i]||[],l=d||!!f[i];r.forEach(A=>{const p=`${i}-${A.paramOptionIds.join("-")}`;W.current?n[p]=l||t[p]||!1:n[p]=l})}),W.current=!1),n})},[f,u,d]);const U=(t,n)=>{n.stopPropagation(),R(i=>{const r={...i};return r[t]=!r[t],r})},_=a.useCallback(t=>{y(n=>{const i=ee.produce(n,r=>{d?(Object.assign(r,Object.fromEntries(T.map(l=>[l,!0]))),delete r[t]):r[t]?(delete r[t],O.includes(t)&&(j||[]).filter(l=>o.pages[l]?.slug===w?.pages[t]?.slug).forEach(l=>{delete r[l]})):(r[t]=!0,j&&j.includes(t)&&O.filter(l=>w?.pages[l]?.slug===o.pages[t]?.slug).forEach(l=>{r[l]=!0}))});return P(V.default(T,Object.keys(i)).length===0),i})},[d,T,O,o,w,j]),G=a.useCallback((t,n)=>{const i=`${t}-${n.paramOptionIds.join("-")}`;h(r=>{const l={...r};l[i]=!l[i];const A=u[t]?.every(p=>l[`${t}-${p.paramOptionIds.join("-")}`])??!1;return y(p=>{if(A&&!p[t])return{...p,[t]:!0};if(!A&&p[t]){const S={...p};return delete S[t],S}return p}),l})},[u]),Q=a.useCallback(()=>{P(t=>(t&&y({}),!t))},[]);return a.useEffect(()=>{const t=d?T:Object.keys(f),n=Object.entries(k).filter(([,r])=>r).map(([r])=>r).filter(r=>r!==void 0),i=Array.from(new Set([...t,...n]));g(d?null:i)},[d,f,k,T,g]),I?e.jsx(ne.Loading,{sx:{my:4}}):e.jsxs(s.List,{disablePadding:!0,sx:{maxWidth:700},children:[e.jsx(s.ListItem,{sx:{position:"sticky",top:0,zIndex:1},disablePadding:!0,children:e.jsxs(s.ListItemButton,{onClick:Q,dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:d,tabIndex:-1})}),e.jsx(s.ListItemText,{primary:m("common.all")})]})}),D.map(t=>{const n=o.routes?.[t];if(!n)return null;const i=!1,r=u&&u[t]&&u[t]?.length>0,l=v[t]!==!1,A=u[t]||[],p=!n.publishedAt||n.updatedAt&&new Date(n.updatedAt).getTime()>new Date(n.publishedAt).getTime();return e.jsxs(s.Box,{children:[e.jsx(s.ListItem,{sx:{pr:4},disablePadding:!0,secondaryAction:e.jsxs(s.Box,{sx:{display:"flex",alignItems:"center"},children:[p&&e.jsx(s.Tooltip,{title:m("maker.pages.needPublish"),children:e.jsx(C.Sync,{fontSize:"small",sx:{color:"warning.main",fontSize:16,mr:.35}})}),!n.isPublic&&e.jsx(s.Tooltip,{title:m("maker.pages.notPublic"),children:e.jsx(C.VisibilityOff,{fontSize:"small",sx:{color:"warning.main",fontSize:16,mr:.35}})}),i,r&&e.jsx(s.Box,{onClick:S=>U(t,S),sx:{display:"inline-flex",alignItems:"center",mr:.35,cursor:"pointer",color:"info.main"},children:l?e.jsx(C.KeyboardArrowDown,{fontSize:"small",sx:{fontSize:"18px"}}):e.jsx(C.KeyboardArrowRight,{fontSize:"small",sx:{fontSize:"18px"}})})]}),children:e.jsxs(s.ListItemButton,{onClick:()=>_(t),dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:d||!!f[t],tabIndex:-1})}),e.jsx(s.ListItemText,{primary:n.path,slotProps:{primary:{noWrap:!0,textOverflow:"ellipsis"},secondary:{noWrap:!0,textOverflow:"ellipsis"}}})]})}),r&&e.jsx(s.Collapse,{in:l,children:e.jsx(s.Box,{children:A.map(S=>{const K=`${t}-${S.paramOptionIds.join("-")}`,X=k[K]||!1;return e.jsx(le,{routePathInfo:S,checked:d||X,onClick:()=>G(t,S),route:n},K)})})})]},t)}),O.map(t=>{const n=w?.pages[t];return n?e.jsx(s.ListItem,{disablePadding:!0,secondaryAction:e.jsx(s.Chip,{color:"warning",label:"deleted",size:"small"}),children:e.jsxs(s.ListItemButton,{onClick:()=>_(t),dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:d||!!f[t],tabIndex:-1})}),e.jsx(s.ListItemText,{primary:n.slug,secondary:n.locales?.[b]?.title,slotProps:{primary:{noWrap:!0,textOverflow:"ellipsis"},secondary:{noWrap:!0,textOverflow:"ellipsis"}}})]})},t):null})]})}exports.default=ae;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),N=require("./state-DCxHc_MB.js"),q=require("@arcblock/ux/lib/Locale/context"),Y=require("@arcblock/ux/lib/Toast"),Z=require("@blocklet/pages-kit/utils/route"),C=require("@mui/icons-material"),F=require("@mui/lab"),s=require("@mui/material"),ee=require("immer"),te=require("lodash/difference"),a=require("react"),se=require("react-use"),ne=require("./home-BarvCpAK.js"),H=require("./index-DH8UBqWG.js"),J=o=>o&&o.__esModule?o:{default:o},z=J(Y),V=J(te);function ie(o){const[x,g]=a.useState(!1);return e.jsx(F.LoadingButton,{...o,loading:o.loading||x,onClick:c=>{const m=o.onClick?.(c);m instanceof Promise&&(g(!0),m.finally(()=>{g(!1)}))}})}const oe=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 re(){const[o,x]=a.useState(),g=a.useMemo(()=>o?e.jsx(s.Dialog,{...o}):null,[o]),c=a.useCallback(()=>{x(void 0)},[]),m=a.useCallback(({title:b,content:d,cancelText:P="Cancel",okText:f="Ok",onOk:y,onClose:u,okIcon:L,okColor:k="primary",cancelColor:h="primary",DialogContentProps:v,form:R,...I})=>{x({...I,open:!0,children:e.jsxs("form",{onSubmit:B=>B.preventDefault(),children:[b&&e.jsxs(s.DialogTitle,{className:"between",zIndex:"appBar",bgcolor:"background.paper",sx:{borderBottom:B=>`1px solid ${B.palette.divider}`},children:[e.jsx(s.Box,{children:b}),e.jsx(s.IconButton,{size:"small",onClick:async()=>{c(),u?.()},children:e.jsx(oe,{})})]}),d&&e.jsx(s.DialogContent,{...v,sx:{mt:-3,...v?.sx,bgcolor:"background.paper"},children:e.jsx(s.Box,{sx:{pt:3},children:d})}),e.jsxs(s.DialogActions,{sx:{bgcolor:"background.paper"},children:[e.jsx(s.Button,{variant:"outlined",color:h||"primary",onClick:u??c,children:P}),e.jsx(ie,{variant:"contained",color:k||"primary",startIcon:L,loadingPosition:L?"start":"center",onClick:async()=>{await y?.(),c()},type:"submit",children:f})]})]}),onClose:u??c})},[c]);return{dialog:g,showDialog:m,closeDialog:c}}const ae=({ref:o,mode:x,state:g})=>{const{t:c}=q.useLocaleContext(),[m,b]=a.useState(!1),{dialog:d,showDialog:P}=re(),f=N.useProjectId(),y=a.useCallback(L=>{let k=[];P({title:c("maker.publishToProduction"),content:e.jsxs(s.Box,{sx:{minWidth:300},children:[e.jsx(s.Alert,{color:"warning",icon:e.jsx(C.Warning,{}),children:c("maker.publishToProductionTip")}),e.jsx(s.Box,{sx:{maxHeight:"50vh",overflow:"auto",mt:2},children:e.jsx(ce,{state:g,toMode:x,onChange:h=>k=h,defaultRouteIds:L})})]}),okText:c("maker.publish"),cancelText:c("common.cancel"),onOk:async()=>{if(k?.length===0){const h=c("maker.publishSelectPagesMessage");throw z.default.error(h),new Error(h)}localStorage.setItem(N.getProjectPageVersionKey(f??""),String(new Date().getTime())),b(!0);try{await H.publishPages({mode:x,routes:k}),z.default.success(c("maker.publishSuccessMessage"))}catch(h){throw z.default.error(h.message),h}finally{b(!1)}}})},[x,g,c,f,P]);a.useImperativeHandle(o,()=>({openPublishDialog:y}));const u=a.useCallback(()=>{y()},[y]);return e.jsxs(e.Fragment,{children:[e.jsx(F.LoadingButton,{color:"primary",variant:"contained",size:"small",sx:{mr:1},onClick:u,loading:m,disabled:m,children:c("maker.publish")}),d]})};function le({routePathInfo:o,checked:x,onClick:g,route:c}){const{t:m}=q.useLocaleContext(),b=!o.routeMetaData?.publishedAt||o.routeMetaData?.updatedAt&&new Date(o.routeMetaData?.updatedAt)>new Date(o.routeMetaData?.publishedAt);return e.jsx(s.ListItem,{sx:{pl:4,pr:3},disablePadding:!0,secondaryAction:e.jsxs(s.Box,{sx:{display:"flex",alignItems:"center",minWidth:"auto"},children:[b&&e.jsx(s.Box,{className:"visible",title:m("maker.pages.needPublish"),sx:{mr:.35,color:"warning.main",display:"flex",alignItems:"center"},children:e.jsx(s.Tooltip,{title:m("maker.pages.needPublish"),children:e.jsx(C.Sync,{fontSize:"small",sx:{fontSize:"16px"}})})}),(!o.routeMetaData?.isPublic||!c.isPublic)&&e.jsx(s.Box,{className:"visible",sx:{color:"warning.main"},children:e.jsx(s.Tooltip,{title:m("maker.pages.notPublic"),children:e.jsx(C.VisibilityOff,{fontSize:"small",sx:{fontSize:"16px"}})})})]}),children:e.jsxs(s.ListItemButton,{onClick:g,dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:x,tabIndex:-1})}),e.jsx(s.ListItemText,{primary:o.path,slotProps:{primary:{fontSize:"0.8rem",fontStyle:"italic",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",pr:1}}})]})})}function ce({state:o,toMode:x,onChange:g,defaultRouteIds:c}){const{t:m,locale:b}=q.useLocaleContext(),[d,P]=a.useState(!1),[f,y]=a.useState(()=>c?Object.fromEntries(c.filter(t=>!t.includes("-")).map(t=>[t,!0])):{}),[u,L]=a.useState({}),[k,h]=a.useState(()=>c?Object.fromEntries(c.filter(t=>t.includes("-")).map(t=>[t,!0])):{}),[v,R]=a.useState({}),{loading:I,error:B,value:w}=se.useAsync(()=>H.getPages({mode:x}),[x]);if(B)throw B;const j=a.useMemo(()=>o.routeIds||[],[o]),M=a.useMemo(()=>w?.pageIds||[],[w]),D=a.useMemo(()=>!j||!o.routes?[]:JSON.parse(JSON.stringify(j)).sort((n,i)=>{const r=o.routes?.[n],l=o.routes?.[i];return r?.publishedAt&&new Date(r.publishedAt).getTime()<new Date(r.updatedAt).getTime()?-1:l?.publishedAt&&new Date(l.publishedAt).getTime()<new Date(l.updatedAt).getTime()?1:new Date(r?.updatedAt??"").getTime()-new Date(l?.updatedAt??"").getTime()}),[o,j]),E=a.useMemo(()=>{if(!D)return[];if(!u)return D;const t=[...D].filter(n=>!u[n]);return Object.values(u).forEach(n=>{n.forEach(i=>{t.push(`${i.originalRouteId}-${i.paramOptionIds.join("-")}`)})}),t},[D,u]),O=a.useMemo(()=>!w||!M||!E?[]:V.default(M,E),[E,w,M]),T=a.useMemo(()=>j?[...j].concat(O):O,[j,O]),$=a.useCallback(()=>{const t={};D?.forEach(n=>{const i=o.routes?.[n];if(i&&i.params&&i.params.length>0&&i.paramsOptions&&i.paramsOptions.length>0){const r=Z.generateParamCombinations({basePath:i.path,params:i.params,routeId:i.id,paramsOptions:i.paramsOptions,currentIndex:0,currentParams:[],currentOptionIds:[],result:[]});r.length>0&&(t[i.id]=r)}}),L(t)},[D,o.routes]);a.useEffect(()=>{$()},[$]),a.useEffect(()=>{R(t=>{const n={...t};return Object.keys(u).forEach(i=>{u[i]&&u[i]?.length>0&&n[i]===void 0&&(n[i]=!0)}),n})},[u]);const W=a.useRef(!0);a.useEffect(()=>{h(t=>{const n={...t};return Object.keys(u).length===0||(Object.keys(u).forEach(i=>{const r=u[i]||[],l=d||!!f[i];r.forEach(A=>{const p=`${i}-${A.paramOptionIds.join("-")}`;W.current?n[p]=l||t[p]||!1:n[p]=l})}),W.current=!1),n})},[f,u,d]);const U=(t,n)=>{n.stopPropagation(),R(i=>{const r={...i};return r[t]=!r[t],r})},_=a.useCallback(t=>{y(n=>{const i=ee.produce(n,r=>{d?(Object.assign(r,Object.fromEntries(T.map(l=>[l,!0]))),delete r[t]):r[t]?(delete r[t],O.includes(t)&&(j||[]).filter(l=>o.pages[l]?.slug===w?.pages[t]?.slug).forEach(l=>{delete r[l]})):(r[t]=!0,j&&j.includes(t)&&O.filter(l=>w?.pages[l]?.slug===o.pages[t]?.slug).forEach(l=>{r[l]=!0}))});return P(V.default(T,Object.keys(i)).length===0),i})},[d,T,O,o,w,j]),G=a.useCallback((t,n)=>{const i=`${t}-${n.paramOptionIds.join("-")}`;h(r=>{const l={...r};l[i]=!l[i];const A=u[t]?.every(p=>l[`${t}-${p.paramOptionIds.join("-")}`])??!1;return y(p=>{if(A&&!p[t])return{...p,[t]:!0};if(!A&&p[t]){const S={...p};return delete S[t],S}return p}),l})},[u]),Q=a.useCallback(()=>{P(t=>(t&&y({}),!t))},[]);return a.useEffect(()=>{const t=d?T:Object.keys(f),n=Object.entries(k).filter(([,r])=>r).map(([r])=>r).filter(r=>r!==void 0),i=Array.from(new Set([...t,...n]));g(d?null:i)},[d,f,k,T,g]),I?e.jsx(ne.Loading,{sx:{my:4}}):e.jsxs(s.List,{disablePadding:!0,sx:{maxWidth:700},children:[e.jsx(s.ListItem,{sx:{position:"sticky",top:0,zIndex:1},disablePadding:!0,children:e.jsxs(s.ListItemButton,{onClick:Q,dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:d,tabIndex:-1})}),e.jsx(s.ListItemText,{primary:m("common.all")})]})}),D.map(t=>{const n=o.routes?.[t];if(!n)return null;const i=!1,r=u&&u[t]&&u[t]?.length>0,l=v[t]!==!1,A=u[t]||[],p=!n.publishedAt||n.updatedAt&&new Date(n.updatedAt).getTime()>new Date(n.publishedAt).getTime();return e.jsxs(s.Box,{children:[e.jsx(s.ListItem,{sx:{pr:4},disablePadding:!0,secondaryAction:e.jsxs(s.Box,{sx:{display:"flex",alignItems:"center"},children:[p&&e.jsx(s.Tooltip,{title:m("maker.pages.needPublish"),children:e.jsx(C.Sync,{fontSize:"small",sx:{color:"warning.main",fontSize:16,mr:.35}})}),!n.isPublic&&e.jsx(s.Tooltip,{title:m("maker.pages.notPublic"),children:e.jsx(C.VisibilityOff,{fontSize:"small",sx:{color:"warning.main",fontSize:16,mr:.35}})}),i,r&&e.jsx(s.Box,{onClick:S=>U(t,S),sx:{display:"inline-flex",alignItems:"center",mr:.35,cursor:"pointer",color:"info.main"},children:l?e.jsx(C.KeyboardArrowDown,{fontSize:"small",sx:{fontSize:"18px"}}):e.jsx(C.KeyboardArrowRight,{fontSize:"small",sx:{fontSize:"18px"}})})]}),children:e.jsxs(s.ListItemButton,{onClick:()=>_(t),dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:d||!!f[t],tabIndex:-1})}),e.jsx(s.ListItemText,{primary:n.path,slotProps:{primary:{noWrap:!0,textOverflow:"ellipsis"},secondary:{noWrap:!0,textOverflow:"ellipsis"}}})]})}),r&&e.jsx(s.Collapse,{in:l,children:e.jsx(s.Box,{children:A.map(S=>{const K=`${t}-${S.paramOptionIds.join("-")}`,X=k[K]||!1;return e.jsx(le,{routePathInfo:S,checked:d||X,onClick:()=>G(t,S),route:n},K)})})})]},t)}),O.map(t=>{const n=w?.pages[t];return n?e.jsx(s.ListItem,{disablePadding:!0,secondaryAction:e.jsx(s.Chip,{color:"warning",label:"deleted",size:"small"}),children:e.jsxs(s.ListItemButton,{onClick:()=>_(t),dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:d||!!f[t],tabIndex:-1})}),e.jsx(s.ListItemText,{primary:n.slug,secondary:n.locales?.[b]?.title,slotProps:{primary:{noWrap:!0,textOverflow:"ellipsis"},secondary:{noWrap:!0,textOverflow:"ellipsis"}}})]})},t):null})]})}exports.default=ae;