@blocklet/pages-kit-inner-components 0.0.7 → 0.0.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.
- package/lib/cjs/home.js +1 -1
- package/lib/cjs/locales.js +1 -0
- package/lib/cjs/resources.js +1 -1
- package/lib/cjs/setting.js +31 -0
- package/lib/cjs/site-state.js +1 -1
- package/lib/{draft-data-B1uf57Cy.mjs → draft-data-Bs6uEYy4.mjs} +3 -3
- package/lib/draft-data-DJNZo1YQ.js +1 -0
- package/lib/es/home.js +6 -5
- package/lib/es/locales.js +701 -0
- package/lib/es/resources.js +1 -1
- package/lib/es/setting.js +1329 -0
- package/lib/es/site-state.js +1 -1
- package/lib/home-Cn3Pji4Z.mjs +2280 -0
- package/lib/home-DHx60V0N.js +542 -0
- package/lib/publish-button-B_ySfzVo.js +1 -0
- package/lib/{publish-button-CP42jrDJ.mjs → publish-button-C-CnCCa5.mjs} +85 -83
- package/lib/{site-state-BmPKdiAM.mjs → site-state-CUnFMunr.mjs} +264 -254
- package/lib/site-state-DR63hFZ4.js +1 -0
- package/lib/state-C6rI6VKx.mjs +376 -0
- package/lib/state-CfaAw7fr.js +1 -0
- package/package.json +59 -38
- package/lib/draft-data-Wp7NHQJ8.js +0 -1
- package/lib/home-DZ1HSzX6.js +0 -542
- package/lib/home-NljemGBa.mjs +0 -2619
- package/lib/publish-button-h0M1NWWo.js +0 -1
- package/lib/site-state-CD1Wvsfh.js +0 -1
package/lib/home-DZ1HSzX6.js
DELETED
|
@@ -1,542 +0,0 @@
|
|
|
1
|
-
"use strict";var tt=Object.create;var ye=Object.defineProperty;var nt=Object.getOwnPropertyDescriptor;var ot=Object.getOwnPropertyNames;var rt=Object.getPrototypeOf,it=Object.prototype.hasOwnProperty;var st=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ot(t))!it.call(e,o)&&o!==r&&ye(e,o,{get:()=>t[o],enumerable:!(i=nt(t,o))||i.enumerable});return e};var be=(e,t,r)=>(r=e!=null?tt(rt(e)):{},st(t||!e||!e.__esModule?ye(r,"default",{value:e,enumerable:!0}):r,e));const n=require("react/jsx-runtime"),ct=require("@arcblock/ux/lib/Locale/context"),at=require("@arcblock/ux/lib/Result"),lt=require("@blocklet/pages-kit/builtin/page/header"),dt=require("@blocklet/ui-react/lib/Header"),_=require("@emotion/css"),ne=require("@emotion/react"),ut=require("@emotion/styled"),p=require("@mui/material"),ft=require("isomorphic-dompurify"),pt=require("lodash/isEmpty"),h=require("react"),mt=require("react-helmet"),N=require("react-router-dom"),H=require("react-use"),B=require("ufo");require("@mui/icons-material");const Z=require("@blocklet/ai-runtime/components"),ht=require("@mui/utils"),xt=require("lodash/pick"),gt=require("react-error-boundary"),ie=require("@iconify/react"),yt=require("react-markdown"),bt=require("remark-gfm"),wt=require("@mui/lab"),C=require("@arcblock/ux/lib/Theme"),jt=require("@arcblock/react-hooks/lib/useBrowser"),_t=require("@arcblock/ux/lib/Colors"),de=require("@blocklet/pages-kit/components"),kt=require("@mui/material/useMediaQuery"),Ee=require("lodash"),vt=require("@blocklet/js-sdk"),St=require("gradient-parser"),$t=require("tinycolor2"),qe=require("@iconify-icon/react"),Ct=require("@arcblock/ux/lib/Screenshot"),Pt=require("lodash/omit"),It=require("@arcblock/ux/lib/Button"),Bt=require("is-uri"),ee=require("pathe"),Nt=require("@blocklet/embed/message"),Te=require("ahooks"),Rt=require("lodash/isEqual"),Et=require("@blocklet/embed/react"),qt=require("react-twitter-embed"),Tt=require("@blocklet/ui-react/lib/Footer"),Lt=require("webfontloader"),Wt=require("@arcblock/did-connect/lib/Session"),Le=require("@syncedstore/core"),zt=require("@syncedstore/react"),we=require("immer"),Mt=require("js-cookie"),At=require("lodash/debounce"),Ot=require("nanoid"),Ut=require("y-indexeddb"),Ft=require("y-websocket"),Ht=require("yjs"),$=e=>e&&e.__esModule?e:{default:e},Dt=$(at),Vt=$(dt),We=$(ut),Gt=$(ft),Kt=$(pt),ze=$(h),ue=$(xt),Jt=$(yt),Xt=$(bt),Yt=$(jt),je=$(_t),Me=$(kt),Qt=$(St),Zt=$($t),en=$(Ct),A=$(Pt),tn=$(It),se=$(Bt),nn=$(Rt),on=$(Tt),rn=$(Lt),sn=$(Le),cn=$(Mt),an=$(At);function oe(){const{pathname:e}=window.location,t=e.match(/\/admin\/(maker|previewer)\/([^/]+)/),r=t==null?void 0:t[2],i=window.__PROJECT_ID__;if(!r&&!i)throw new Error("Unable to get projectId from pathname");return r||i}function Ae(e){return`${e}:pages:version`}function ln({error:e}){return n.jsx(p.Box,{children:n.jsx(p.Alert,{severity:"error",children:e.message})})}const dn=h.forwardRef(({onClick:e,...t},r)=>{const[i,o]=h.useState(!1),c=h.useCallback(async l=>{try{o(!0),await(e==null?void 0:e(l))}finally{o(!1)}},[e]);return n.jsx(wt.LoadingButton,{ref:r,...t,loading:t.loading||i,onClick:c})});function un({tip:e,tipSucceed:t,title:r,titleSucceed:i,icon:o,iconSucceed:c,autoReset:l,placement:s="top",...a}){const[d,u]=h.useState(!1),[f,x]=h.useState(),m=h.useRef(),b=()=>{x(void 0),l&&(m.current=window.setTimeout(()=>{u(!1)},3e3))},w=()=>{clearTimeout(m.current)},g=d?c:o,j=f?n.jsx(p.Box,{color:"error",children:f.message}):d&&t||e,y=d?i:r;return n.jsx(p.Tooltip,{title:j,disableInteractive:!0,placement:s,onClose:b,onOpen:w,children:n.jsx("span",{children:n.jsx(dn,{startIcon:g&&(typeof g=="string"?n.jsx(ie.Icon,{icon:g}):g),loadingPosition:g?"start":void 0,...a,onClick:async v=>{if(a.onClick)try{await a.onClick(v),u(!0)}catch(R){x(R)}},children:y})})})}const fn=ze.default.lazy(()=>import("react-syntax-highlighter").then(e=>({default:e.Prism}))),pn=p.styled(e=>n.jsx(Jt.default,{...e,remarkPlugins:[Xt.default],components:{pre:mn,code:({node:t,inline:r,className:i,children:o,...c})=>{if(!o)return null;const l=/language-(\w+)/.exec(i||"");return r?n.jsx(p.Box,{component:"code",className:i,...c,children:o}):n.jsx(p.Box,{component:fn,language:l==null?void 0:l[1],...c,sx:{borderRadius:1},children:String(o).replace(/\n$/,"")})},table:({className:t,children:r})=>n.jsx(p.Box,{sx:{overflow:"auto",my:1},children:n.jsx("table",{className:t,children:r})})}}))`
|
|
2
|
-
width: 100%;
|
|
3
|
-
overflow: hidden;
|
|
4
|
-
word-break: break-word;
|
|
5
|
-
|
|
6
|
-
> * {
|
|
7
|
-
&:first-child /* emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason */ {
|
|
8
|
-
margin-top: 0;
|
|
9
|
-
}
|
|
10
|
-
&:last-child /* emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason */ {
|
|
11
|
-
margin-bottom: 0;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
pre {
|
|
16
|
-
overflow: auto;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
li {
|
|
20
|
-
margin: 0;
|
|
21
|
-
padding: 0;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
li p {
|
|
25
|
-
display: inline-block;
|
|
26
|
-
vertical-align: top;
|
|
27
|
-
margin: 0;
|
|
28
|
-
padding: 0;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
table {
|
|
32
|
-
border-collapse: collapse;
|
|
33
|
-
white-space: nowrap;
|
|
34
|
-
|
|
35
|
-
th,
|
|
36
|
-
td {
|
|
37
|
-
border: 1px solid grey;
|
|
38
|
-
padding: 4px 8px;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
a {
|
|
43
|
-
color: ${({theme:e})=>e.palette.primary.main};
|
|
44
|
-
|
|
45
|
-
:hover {
|
|
46
|
-
text-decoration: underline;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
&.writing > *:last-child {
|
|
51
|
-
&:after {
|
|
52
|
-
content: '';
|
|
53
|
-
display: inline-block;
|
|
54
|
-
vertical-align: middle;
|
|
55
|
-
height: 1.2em;
|
|
56
|
-
margin-top: -0.2em;
|
|
57
|
-
margin-left: 0.1em;
|
|
58
|
-
border-right: 0.2em solid orange;
|
|
59
|
-
border-radius: 10px;
|
|
60
|
-
animation: blink-caret 0.75s step-end infinite;
|
|
61
|
-
|
|
62
|
-
@keyframes blink-caret {
|
|
63
|
-
from,
|
|
64
|
-
to {
|
|
65
|
-
border-color: transparent;
|
|
66
|
-
}
|
|
67
|
-
50% {
|
|
68
|
-
border-color: ${({theme:e})=>e.palette.secondary.main};
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
`;function mn({children:e}){const t=e==null?void 0:e.props;if(!(t!=null&&t.children))return null;const r=/language-(\w+)/.exec(t.className||""),i=r==null?void 0:r[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:i}),n.jsx(p.Box,{flex:1}),n.jsx(un,{autoReset:!0,title:n.jsx(ie.Icon,{icon:"tabler:copy"}),titleSucceed:n.jsx(ie.Icon,{icon:"tabler:copy-check"}),sx:{minWidth:32,minHeight:32,p:0,fontSize:18},onClick:()=>{window.navigator.clipboard.writeText(t.children)}})]}),e]})}function O({actions:e,center:t,className:r,align:i}){return e&&(e!=null&&e.length)?n.jsx(p.Box,{className:_.cx("flex gap-4 flex-wrap","lg:flex-row lg:gap-8",(t||i==="center")&&"justify-center",!t&&i==="right"&&"justify-end",!t&&i==="left"&&"justify-start",r),sx:{alignItems:"center"},children:e}):null}const hn="section",xn=p.styled(p.Box)`
|
|
74
|
-
overflow: hidden;
|
|
75
|
-
|
|
76
|
-
.section__title {
|
|
77
|
-
margin-top: 0;
|
|
78
|
-
font-weight: 700;
|
|
79
|
-
}
|
|
80
|
-
.section__title_non_big {
|
|
81
|
-
font-size: 32px;
|
|
82
|
-
@media (max-width: 600px) {
|
|
83
|
-
font-size: 24px;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
&.base-info .section__tag {
|
|
87
|
-
margin-top: 0;
|
|
88
|
-
margin-bottom: 2vw;
|
|
89
|
-
background-color: ${({theme:e})=>e.palette.primary.main};
|
|
90
|
-
white-space: nowrap;
|
|
91
|
-
max-width: 100%;
|
|
92
|
-
display: inline-block;
|
|
93
|
-
padding: 0 10px;
|
|
94
|
-
justify-content: flex-start;
|
|
95
|
-
overflow: hidden;
|
|
96
|
-
text-overflow: ellipsis;
|
|
97
|
-
font-size: 12px;
|
|
98
|
-
color: #fff;
|
|
99
|
-
border-radius: 4px;
|
|
100
|
-
line-height: 20px;
|
|
101
|
-
}
|
|
102
|
-
.section__title {
|
|
103
|
-
a {
|
|
104
|
-
color: ${({theme:e})=>e.palette.primary.main};
|
|
105
|
-
}
|
|
106
|
-
p {
|
|
107
|
-
margin-top: 0;
|
|
108
|
-
margin-bottom: 0;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
.section__description {
|
|
112
|
-
margin-bottom: 4vw;
|
|
113
|
-
margin-top: 0;
|
|
114
|
-
a {
|
|
115
|
-
color: ${({theme:e})=>e.palette.primary.main};
|
|
116
|
-
}
|
|
117
|
-
p {
|
|
118
|
-
margin-top: 0;
|
|
119
|
-
margin-bottom: 0.5rem;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
@media (min-width: ${({theme:e})=>e.breakpoints.values[hn]}px) {
|
|
123
|
-
.section__tag {
|
|
124
|
-
margin-bottom: 32px;
|
|
125
|
-
}
|
|
126
|
-
.section__title {
|
|
127
|
-
margin-bottom: 32px;
|
|
128
|
-
}
|
|
129
|
-
.section__description {
|
|
130
|
-
margin-bottom: 40px;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
`;function D({title:e,description:t,descriptionMarkdown:r,actions:i,className:o="",classes:c={},prepend:l,append:s,level:a=2,tag:d,badge:u,center:f,logo:x,titleAppearance:m,descriptionAppearance:b,...w}){if(!e&&!t&&!i&&!u&&!d&&!l&&!s&&!x)return null;const g=Math.max(Math.min(5,a+1),1),j={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"},y=a===0?"big":`h${g}`,v=a===0;return n.jsxs(xn,{className:_.cx("base-info","lg:text-left",f&&"!text-center",o),...w,children:[l&&n.jsx("div",{children:l}),(d||u)&&n.jsx("div",{className:_.cx("section__tag",(c==null?void 0:c.tag)||(c==null?void 0:c.badge)),children:d||u}),x&&n.jsx("img",{className:"w-[120px] m-auto mb-8",src:x,alt:"info",loading:"lazy"}),e&&n.jsx(p.Typography,{sx:{whiteSpace:"pre-wrap",mb:t?"2vw":0,...(m==null?void 0:m.color)&&{color:`${m.color} !important`}},className:_.cx("section__title","text-gray-800","dark:text-gray-50",c.title,"page-kit-section__title",v?"":"section__title_non_big"),component:`h${Math.max(a,1)}`,variant:y,children:e}),t&&(r?n.jsx(p.Box,{sx:{...(b==null?void 0:b.color)&&{color:`${b.color} !important`}},component:pn,className:_.cx("section__description","text-gray-800","dark:text-gray-100",j[g],c.description,"page-kit-section__description"),children:t}):n.jsx(p.Typography,{sx:{whiteSpace:"pre-wrap",...(b==null?void 0:b.color)&&{color:`${b.color} !important`}},className:_.cx("section__description","text-gray-800","dark:text-gray-100",j[g],c.description,"page-kit-section__description"),component:"div",variant:"body1",gutterBottom:!0,children:t})),n.jsx(O,{actions:i,center:f,className:"mt-8"}),s&&n.jsx("div",{children:s})]})}const V=["actions","append","badge","tag","center","description","descriptionMarkdown","level","logo","prepend","title","titleAppearance","descriptionAppearance"];function Oe(e){if(e.type===h.Fragment){const r=(e.props.children||[]).filter(i=>h.isValidElement(i));return r.length===1?Oe(r[0]):r.length>1}return Array.isArray(e)}const L="&>*";function fe({children:e,col:t,gap:r,className:i,align:o,sx:c,type:l,...s}={children:null,className:"",col:3,gap:void 0,sx:{},align:"center",type:"default"}){const a=C.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"},f=u[o]||u.center;let m=r??({2:6,3:4,4:4,5:3,6:3}[t]||0);Oe(e)||(m=0);const w=(t-1)*m/t;let g={...c,gap:`${m}rem`};const j={[L]:{width:"100%"}},y={},v={},R={};switch(j.gap="1rem",y.gap=`${m/2}rem`,t){case 3:case 4:y[L]={width:`calc(50% - ${m/2}rem)`};break;case 5:case 6:j[L]={width:`calc(50% - ${m/2/2}rem)`},y[L]={width:`calc(50% - ${m/2/2}rem)`},v[L]={width:`calc(33.33% - ${m*2/3}rem)`};break}return g[L]={width:`calc(${d}% - ${w}rem)`},g[`@media (max-width: ${a.breakpoints.values.xl}px)`]=R,g[`@media (max-width: ${a.breakpoints.values.lg}px)`]=v,g[`@media (max-width: ${a.breakpoints.values.md}px)`]=y,g[`@media (max-width: ${a.breakpoints.values.sm}px)`]=j,l==="wall"&&(g={...c,gap:`${m}rem`},g[L]={width:`calc(${d}% - ${w}rem)`},j[L]={width:`calc(45% - ${m/2/2}rem)`},g[`@media (max-width: ${a.breakpoints.values.sm}px)`]=j),n.jsx(p.Box,{className:_.cx("flex flex-wrap flex-row h-full",f,i),sx:g,...s,children:e})}function gn(){const e=navigator.userAgent.toLowerCase();return e.includes("safari")&&!e.includes("chrome")}var Ne;const pe=((Ne=window.blocklet)==null?void 0:Ne.prefix)||"/",G=vt.createAxios({timeout:200*1e3}),yn=window.location.protocol==="https:"?"wss":"ws",bn=e=>B.joinURL(`${yn}://${window.location.hostname}`,pe,`api/${e}/ws/pages`),wn="z8ia1mAXo8ZE7ytGF36L5uBf9kD2kenhqFGp9";var Re;(Re=blocklet==null?void 0:blocklet.componentMountPoints.find(e=>e.did===wn))!=null&&Re.mountPoint||B.joinURL(pe,"/image-bin");function q(e){return e&&!/^(https?:\/\/|\/)/.test(e)?window.location.origin+B.joinURL(pe,"uploads",e):e}const jn=window.innerWidth<=750;function W(e,t,r){if(!e||/\.gif/.test(e))return e;const i=(jn?t/1.5:t)*(r==="quality"?1.5:1);return _n(e,{imageFilter:"resize",w:i,f:"webp"})}function _n(e,t){return!e||!t?e:B.withQuery(e,t)}function kn(e=""){if(e.startsWith("data:image/svg+xml,"))return!0;const t=/^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/,r=/^(\/|\.\/|\.\.\/)(?:[^/]+\/)*[^/]+$/;return t.test(e)||r.test(e)}function ce(e){return(e==null?void 0:e.endsWith(".mp4"))||(e==null?void 0:e.endsWith(".m4v"))||(e==null?void 0:e.endsWith(".webm"))}function vn(e){return e!=null&&e.endsWith(".mp4")||e!=null&&e.endsWith(".m4v")?"video/mp4":e!=null&&e.endsWith(".webm")?"video/webm":void 0}function Ue(e){if(e!=null&&e.trim())try{return Qt.default.parse(e),!0}catch{return!1}return!1}function Sn(e){return typeof e!="string"?!1:!!(Ue(e)||Zt.default(e).isValid())}function $n(e){let t={};return typeof e=="string"?Ue(e)?t.image=e:(t.image=q(e),Sn(e)&&(t.color=e,t.image="")):t=e,t}function Cn(){const[e,t]=h.useState(Date.now());return h.useEffect(()=>{const r=()=>{t(Date.now())};return document.addEventListener("visibilitychange",r),()=>{document.removeEventListener("visibilitychange",r)}},[]),e}function _e(e,t,r,i,o){let c=null;const{color:l="",image:s}=$n(t);return s&&kn(s)?(delete r.backgroundColor,!(e.mobile.apple.device||gn())&&ce(s)?c=n.jsx(p.Box,{component:"video",className:"section-bg",width:"100%",autoPlay:!0,loop:!0,muted:!0,controls:!1,playsInline:!0,poster:W(q(i),1200,"quality"),src:ce(s)?s:W(s,1200,"quality"),sx:{position:"absolute",zIndex:-9999,right:0,left:0,top:0,width:"100%",height:"100%",objectFit:"cover"}},s):c=n.jsx(de.ResponsiveImage,{src:s,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"}},o||s)):s?r.backgroundImage=`${s} !important`:l&&(r.backgroundColor=`${l} !important`),c}function Pn({autoWidth:e,children:t,...r}){return e?n.jsx(p.Box,{display:"flex",...r,children:t}):n.jsx(p.Container,{...r,children:t})}function K({dark:e=!1,children:t,className:r,sx:i={},boxed:o={show:!1},padding:c="normal",boxProps:l,type:s,...a}){const d={...i},u=Me.default(m=>m.breakpoints.down("md"));e&&(d.color=je.default.common.white,d.backgroundColor=`${je.default.grey[900]} !important`);const f={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"};o.show&&(d.display="flex");const x=h.useMemo(()=>!Number(a.boxMaxWidth)||u?{width:"100%"}:s==="wall"&&a.boxMaxWidth?{maxWidth:`${a.boxMaxWidth}px !important`,width:"100%"}:{width:"100%"},[a.boxMaxWidth,u,s]);return n.jsx(In,{component:"section",styles:{...d},className:_.cx("base-section","px-2 md:px-5 lg:px-5 xl:px-10",f[c],r,{dark:e}),...Ee.omit(a,"hoverStyle","boxMaxWidth","embedUrl","autoWidth","paddingXY","iframeHeight","titleAppearance","descriptionAppearance"),children:n.jsx(Pn,{autoWidth:a==null?void 0:a.autoWidth,className:_.cx("section-content h-full"),sx:x,children:o.show?n.jsx(Fe,{...l,boxed:o,children:t}):t})})}function Fe({background:e="",backgroundVideoPoster:t,children:r,sx:i={},boxed:o={show:!1},className:c="",styles:l={},...s}){const a={...l,...i};let d=null;const u=Me.default(m=>m.breakpoints.up("sm")),f=Yt.default(),x=Cn();return e&&(d=_e(f,e,a,t,x)),o.show&&(a.borderRadius="10px",a.padding===void 0&&(a.padding=u?"50px":"20px"),o!=null&&o.border&&(a.border="1px solid #c0c0c0"),o!=null&&o.background&&(d=_e(f,o==null?void 0:o.background,a,o==null?void 0:o.backgroundVideoPoster,x))),n.jsxs(p.Box,{...s,sx:{...a,...d?{position:"relative",overflow:"hidden",zIndex:0}:{}},className:_.cx(c,(o==null?void 0:o.boxShadow)&&"shadow-xl"),children:[d,r]})}const In=C.styled(Fe)`
|
|
134
|
-
&:nth-of-type(even) {
|
|
135
|
-
background: #f8f8f8;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
@media (max-width: 600px) {
|
|
139
|
-
.section__title {
|
|
140
|
-
font-size: 24px;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.base-info {
|
|
144
|
-
> *:last-child {
|
|
145
|
-
margin-bottom: 0;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
`;function He({icon:e,...t}){return n.jsx(qe.Icon,{icon:e,...t,ref:null})}function E(e,t){const r=ue.default(e,t),i=A.default(e,t);return[r,i]}const De=["title","description","actions","badge","tag","prepend","append","logo"];function Bn({image:e,imageBorder:t,imageShadow:r,className:i,reverse:o=!1,fullSizeImage:c,...l}){const[s,a]=E(l,V),d=Object.keys(s).length>0&&Object.values(ue.default(s,De)).filter(Boolean).length>0&&n.jsx(D,{...s}),u=h.isValidElement(e)?e:n.jsx(p.Box,{component:"img",src:e,alt:"",className:"block"}),f=["phone","macbook"].includes(t),x=e&&n.jsx(p.Box,{className:_.cx("section__image","m-auto, leading-[1] text-center",r&&"shadow-xl",s!=null&&s.center?"flex justify-center items-center":""),sx:{border:t===!0?"1px solid #c0c0c0":void 0,borderRadius:2,overflow:"hidden","> div":f?{width:"100%",video:{borderRadius:"0 !important"}}:void 0},children:f?n.jsx(en.default,{type:t,sx:{width:"100%"},children:u}):u});return n.jsx(K,{className:_.cx("section--block",i,c&&!o&&_.css`
|
|
150
|
-
.section-bg {
|
|
151
|
-
height: 80%;
|
|
152
|
-
}
|
|
153
|
-
`),...a,boxProps:c?{sx:{padding:0,overflow:"hidden"}}:void 0,children:n.jsx(fe,{col:e?2:1,className:c?_.css`
|
|
154
|
-
display: flex;
|
|
155
|
-
flex-direction: column;
|
|
156
|
-
|
|
157
|
-
> .base-info,
|
|
158
|
-
> .section__image {
|
|
159
|
-
width: 100%;
|
|
160
|
-
|
|
161
|
-
> img,
|
|
162
|
-
> video {
|
|
163
|
-
width: 100%;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
`:void 0,children:o?n.jsxs(n.Fragment,{children:[x,d]}):n.jsxs(n.Fragment,{children:[d,x]})})})}const J=["editing","height","locale","dev"];function Nn(e){return n.jsx(Rn,{...e})}const Rn=C.styled(p.Box)`
|
|
167
|
-
position: relative;
|
|
168
|
-
`;function En({widget:e,reverse:t,projectId:r,assistantId:i,working:o,submitTitle:c,submitIcon:l,submitColor:s,placeholder:a,loadingIndicator:d,section:u,...f}){const[{editing:x},m]=E(f,J),[b,w]=E(m,V),g=r&&i?{projectId:r,gitRef:"main",assistantId:i,working:!0}:void 0,j={children:c,endIcon:l?n.jsx(He,{icon:l}):void 0,sx:{background:s||void 0,":hover":{background:s||void 0,opacity:.8}}},y=[],v=a&&n.jsx(p.Typography,{variant:"caption",color:"text.disabled",children:a}),R=d&&n.jsx(p.Typography,{variant:"caption",color:"text.disabled",children:d});Object.keys(b).length>0&&Object.values(ue.default(b,De)).filter(Boolean).length>0&&y.push(n.jsx(D,{...b},"base-info")),g&&(e==="form"?y.push(n.jsx(Z.AIForm,{identifier:g,SubmitProps:j},"form")):e==="result"?y.push(n.jsx(Z.AIFormResult,{identifier:g,placeholder:v,loadingIndicator:R},"result")):y.push(n.jsxs(p.Stack,{width:"100%",gap:2,direction:"row",children:[n.jsx(Z.AIForm,{identifier:g,BoxProps:{flex:1},SubmitProps:j}),n.jsx(Z.AIFormResult,{identifier:g,BoxProps:{flex:1},placeholder:v,loadingIndicator:R})]},"form-result"))),t&&y.reverse();const T=p.useTheme(),M=h.useMemo(()=>p.createTheme(ht.deepmerge(T,{palette:{primary:s?{main:s}:void 0}})),[s,T]);return n.jsx(gt.ErrorBoundary,{fallbackRender:ln,children:n.jsx(p.ThemeProvider,{theme:M,children:n.jsx(K,{...w,sx:x?{pointerEvents:"none"}:{},children:n.jsx(fe,{col:y.length,children:y})})})})}const Ve=h.createContext({pages:[],project:void 0}),{Provider:qn,Consumer:Zo}=Ve;function Ge(){return h.useContext(Ve)}function Tn({icon:e,className:t="",size:r="1rem",...i}){return n.jsx(Ln,{component:He,className:_.cx("css-icon",t),size:r,...i,icon:e})}const Ln=C.styled(p.Box)`
|
|
169
|
-
&.css-icon {
|
|
170
|
-
display: inline-block;
|
|
171
|
-
width: ${({size:e})=>e};
|
|
172
|
-
height: ${({size:e})=>e};
|
|
173
|
-
}
|
|
174
|
-
`;function Wn({icon:e,className:t="",size:r="1rem",imageMeta:i,...o}){const c=W(q(e),540),[l,s]=h.useState(!1),a=C.useTheme();return l?n.jsx(Tn,{icon:"i-mdi:image",color:a.palette.grey[500],size:r,className:t,...o}):n.jsx(zn,{className:_.cx("image-icon",t),size:r,...o,children:n.jsx("img",{className:"image-icon__image",src:c,onError:()=>s(!0),width:i==null?void 0:i.naturalWidth,height:i==null?void 0:i.naturalHeight,alt:(i==null?void 0:i.filename)||"card-icon",loading:"lazy"})})}const zn=C.styled(p.Box)`
|
|
175
|
-
display: inline-block;
|
|
176
|
-
width: ${({size:e})=>e};
|
|
177
|
-
height: ${({size:e})=>e};
|
|
178
|
-
.image-icon__image {
|
|
179
|
-
object-fit: contain;
|
|
180
|
-
height: 100%;
|
|
181
|
-
width: 100%;
|
|
182
|
-
}
|
|
183
|
-
`,me=e=>typeof e=="string"&&/^[\w-_]+:[\w-_]+$/.test(e);function ae({icon:e,size:t="1rem",imageMeta:r,...i}){const o=window.isNaN(t)?t:`${t}px`;return me(e)?n.jsx(qe.Icon,{icon:e}):n.jsx(Mn,{component:Wn,imageMeta:r,className:"base-icon",icon:e,size:o,...i})}const Mn=C.styled(p.Box)`
|
|
184
|
-
flex-shrink: 0;
|
|
185
|
-
`;function F({text:e,children:t,icon:r="",endIcon:i,color:o="primary",link:c="",href:l="",...s}){const a=r?n.jsx(ae,{icon:r}):null,d=i?n.jsx(ae,{icon:i}):null,u=c||l,f={...s};return u&&(f.href=u,se.default(u)&&(f.target=f.target||"_blank")),n.jsx(tn.default,{startIcon:a,endIcon:d,color:o,...f,children:e||t})}function Ke({editing:e,text:t,...r}){const{pages:i=[]}=Ge(),o=i.find(c=>c.id===(r.link||r.linkId));if(e)return n.jsx(F,{...A.default(r,["link","linkId"]),children:t});if(o){const c=o.path||"/";return n.jsx(N.Link,{to:c,children:n.jsx(F,{...A.default(r,["link","linkId"]),children:t})})}return n.jsx(F,{...A.default(r,"linkId"),children:t})}function z({type:e="",icon:t="",size:r="3rem",className:i="",...o}){return n.jsx(ae,{icon:t||e,size:r,className:_.cx("content-icon",i),...o})}z.propTypes={};z.defaultProps={type:"",icon:"",size:"3rem",color:"inherit",className:""};function An({to:e,base:t,children:r,className:i,activeClassName:o="active",target:c="auto",autoExternalMark:l=!1,useRouterLink:s,...a}){const{pages:d=[],locale:u=""}={},f=t?ee.join("/",t):t||"";let x=c==="auto"?"_self":c,m=ee.join(f,e);const b=l?se.default(m):!1;if(t)return m=ee.join(f,u,e),n.jsx("a",{className:`no-underline ${i}`,href:B.withoutTrailingSlash(m),rel:"noreferrer noopener",target:x,...a,children:r});if(se.default(e))c==="auto"&&(x="_blank"),m=e;else{B.isRelative(m)&&(m=ee.join(window.location.pathname,m));const w=B.parseURL(`${window.location.origin}${m}`),g=d.some(j=>j.pathname===w.pathname);if(s||g)return n.jsx(N.NavLink,{end:!0,to:B.withoutTrailingSlash(m),className:({isActive:j})=>_.cx(i,j?o:""),...a,children:r})}return n.jsxs("a",{className:`no-underline ${i}`,href:B.withoutTrailingSlash(m),rel:"noreferrer noopener",target:x,...a,children:[r,b&&n.jsx(z,{icon:"i-mdi:arrow-top-right",size:"0.9em",className:"smart-link__mark",style:{marginLeft:5}})]})}function X({prepend:e,append:t,children:r,className:i="",dark:o=!1,border:c=!0,...l}){let s={};const{pages:a=[]}=Ge(),d=a.find(x=>x.id===l.link),u=!r||ze.default.Children.toArray(r).every(x=>x===null);l.link&&(s={component:An,to:(d==null?void 0:d.path)||l.link,useRouterLink:!0});const f=o&&c;return n.jsxs(On,{className:_.cx("base-card card",{"border-gray-200":c},{"dark:border-gray-500":f},{dark:o,"border-transparent":!c},i),...s,...A.default(l,["listType","dark","iconColor","link","hoverStyle","imageSize"]),children:[e,!u&&n.jsx("div",{className:"card__body",children:r}),t]})}const On=C.styled(p.Box)`
|
|
186
|
-
&.base-card {
|
|
187
|
-
text-align: left;
|
|
188
|
-
border-width: 1px;
|
|
189
|
-
border-style: solid;
|
|
190
|
-
border-radius: 12px;
|
|
191
|
-
overflow: hidden;
|
|
192
|
-
&,
|
|
193
|
-
&:hover {
|
|
194
|
-
text-decoration: none;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
.card__body {
|
|
198
|
-
padding: 15px 15px;
|
|
199
|
-
}
|
|
200
|
-
`;function Y({align:e="left",title:t,titleProps:r={},description:i,descriptionProps:o={}}){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,...r,children:t}),i&&n.jsx(p.Typography,{className:_.cx("card__description","text-gray-500","dark:text-gray-400"),component:"div",variant:"body1",gutterBottom:!0,align:e,...o,children:i})]})}function Un({image:e,title:t,description:r,imageProps:i={},imageMeta:o,imageSize:c,titleProps:l={},descriptionProps:s={},actions:a,align:d,...u}){const f=me(e),x=W(q(e),540);return n.jsxs(Fn,{className:"card-article",...u,prepend:n.jsx("div",{className:"card__image__wrap",children:f&&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(z,{icon:e,color:"primary.main"})}):x&&n.jsx("img",{className:"card__image",src:x,...i,alt:i.alt||(o==null?void 0:o.filename)||"card-image",width:o==null?void 0:o.naturalWidth,height:o==null?void 0:o.naturalHeight,style:{width:"100%",height:"100%",objectFit:c||"cover",objectPosition:"center"},loading:"lazy"})}),children:[t||r?n.jsx(Y,{align:d,title:t,titleProps:l,description:r,descriptionProps:s}):null,a!=null&&a.length?n.jsx(O,{align:d,actions:a,className:"mt-4"}):null]})}const Fn=C.styled(X)`
|
|
201
|
-
${e=>e.hoverStyle==="none"?"":e.link?`transition: box-shadow ease .3s;
|
|
202
|
-
&:hover {
|
|
203
|
-
box-shadow: 0 0 10px rgba(95, 142, 244, 0.42);
|
|
204
|
-
}`:""}
|
|
205
|
-
|
|
206
|
-
.card__image__wrap {
|
|
207
|
-
padding-top: 61.8%;
|
|
208
|
-
width: 100%;
|
|
209
|
-
position: relative;
|
|
210
|
-
}
|
|
211
|
-
.card__image {
|
|
212
|
-
position: absolute;
|
|
213
|
-
top: 0;
|
|
214
|
-
left: 0;
|
|
215
|
-
bottom: 0;
|
|
216
|
-
right: 0;
|
|
217
|
-
width: 100%;
|
|
218
|
-
height: 100%;
|
|
219
|
-
object-position: top center;
|
|
220
|
-
}
|
|
221
|
-
`,ke="section";function ve({title:e,image:t,imageMeta:r,description:i,actions:o,align:c,listType:l="",className:s="",...a}){return n.jsxs(Hn,{className:_.cx("card",`list-type-${l}`,s),align:c,...a,children:[t&&n.jsx(z,{icon:t,color:"primary.main",size:l==="icon-title"?"1.2rem":"3rem",imageMeta:r}),e||i?n.jsx(Y,{align:c,title:e,description:i}):null,o!=null&&o.length?n.jsx(O,{align:c,actions:o,className:"mt-4"}):null]})}const Hn=C.styled(X)`
|
|
222
|
-
padding: 5vw 4vw;
|
|
223
|
-
box-sizing: border-box;
|
|
224
|
-
/* min-height: 320px; */
|
|
225
|
-
color: inherit !important;
|
|
226
|
-
border-radius: 0.5rem;
|
|
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[ke]}px) {
|
|
229
|
-
padding: 1.5rem 2rem;
|
|
230
|
-
}
|
|
231
|
-
@media (max-width: ${({theme:e})=>e.breakpoints.values.sm}px) {
|
|
232
|
-
height: auto;
|
|
233
|
-
min-height: unset;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
${e=>e.hoverStyle==="none"?"":e.link?`transition: box-shadow ease .3s;
|
|
237
|
-
&:hover {
|
|
238
|
-
box-shadow: 0 0 10px rgba(95, 142, 244, 0.42);
|
|
239
|
-
}`:""}
|
|
240
|
-
|
|
241
|
-
.card__title {
|
|
242
|
-
font-weight: 700;
|
|
243
|
-
margin-top: 24px;
|
|
244
|
-
margin-bottom: 12px;
|
|
245
|
-
a {
|
|
246
|
-
color: ${({theme:e})=>e.palette.primary.main};
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
.card__description {
|
|
250
|
-
a {
|
|
251
|
-
color: ${({theme:e})=>e.palette.primary.main};
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
.card__body {
|
|
255
|
-
padding: 0;
|
|
256
|
-
${({align:e})=>`text-align:${e||"left"};`}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
&.list-type-icon-title {
|
|
260
|
-
padding: 1.2rem;
|
|
261
|
-
.title-line {
|
|
262
|
-
display: flex;
|
|
263
|
-
}
|
|
264
|
-
.card__title {
|
|
265
|
-
margin: 0;
|
|
266
|
-
font-size: 1em;
|
|
267
|
-
}
|
|
268
|
-
.css-icon {
|
|
269
|
-
margin-right: 0.5rem;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
@media (min-width: ${({theme:e})=>e.breakpoints.values[ke]}px) {
|
|
274
|
-
padding: 2rem 2rem;
|
|
275
|
-
text-align: left;
|
|
276
|
-
box-sizing: border-box;
|
|
277
|
-
}
|
|
278
|
-
`;function Dn({image:e,title:t,description:r,imageProps:i={},imageMeta:o,imageSize:c,titleProps:l={},descriptionProps:s={},actions:a,align:d,...u}){const f=me(e),x=W(q(e),540);return n.jsxs(Vn,{className:"card-article",...u,prepend:n.jsx("div",{className:"card__image__wrap",children:f&&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(z,{icon:e,color:"primary.main"})}):x&&n.jsx(p.Box,{component:"img",className:"card__image",src:x,...i,alt:i.alt||(o==null?void 0:o.filename)||"card-image",width:o==null?void 0:o.naturalWidth,height:o==null?void 0:o.naturalHeight,style:{width:"100%",height:"100%",objectFit:c||"contain",objectPosition:"center"},loading:"lazy"})}),children:[t||r?n.jsx(Y,{align:d,title:t,titleProps:l,description:r,descriptionProps:s}):null,a!=null&&a.length?n.jsx(O,{align:d,actions:a,className:"mt-4"}):null]})}const Vn=C.styled(X)`
|
|
279
|
-
${e=>e.hoverStyle==="none"?"":e.link?`transition: box-shadow ease .3s;
|
|
280
|
-
&:hover {
|
|
281
|
-
box-shadow: 0 0 10px rgba(95, 142, 244, 0.42);
|
|
282
|
-
}`:""}
|
|
283
|
-
|
|
284
|
-
border-radius: 0 !important;
|
|
285
|
-
|
|
286
|
-
.card__body {
|
|
287
|
-
${({align:e})=>`text-align:${e||"left"};`}
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
.card__image__wrap {
|
|
291
|
-
width: 100%;
|
|
292
|
-
height: 100%;
|
|
293
|
-
position: relative;
|
|
294
|
-
display: flex;
|
|
295
|
-
justify-content: center;
|
|
296
|
-
align-items: center;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
.card__image {
|
|
300
|
-
max-height: 60px;
|
|
301
|
-
}
|
|
302
|
-
`,Se="section";function Gn({title:e,image:t,imageMeta:r,iconSize:i=100,description:o,actions:c,align:l,className:s="",...a}){return n.jsx(Kn,{className:_.cx("card",s),...a,children:n.jsxs(p.Box,{className:"flex items-center",children:[t&&n.jsx(z,{icon:t,color:"primary.main",size:i,imageMeta:r}),n.jsxs(p.Box,{className:"flex-1 ml-4",children:[n.jsx(Y,{align:l,title:e,description:o}),n.jsx(O,{align:l,actions:c,className:"mt-4"})]})]})})}const Kn=C.styled(X)`
|
|
303
|
-
padding: 5vw 4vw;
|
|
304
|
-
text-align: left;
|
|
305
|
-
box-sizing: border-box;
|
|
306
|
-
/* min-height: 320px; */
|
|
307
|
-
color: inherit !important;
|
|
308
|
-
border-radius: 0.5rem;
|
|
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[Se]}px) {
|
|
311
|
-
padding: 1.5rem 2rem;
|
|
312
|
-
}
|
|
313
|
-
@media (max-width: ${({theme:e})=>e.breakpoints.values.sm}px) {
|
|
314
|
-
height: auto;
|
|
315
|
-
min-height: unset;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
${e=>e.hoverStyle==="none"?"":e.link?`transition: box-shadow ease .3s;
|
|
319
|
-
&:hover {
|
|
320
|
-
box-shadow: 0 0 10px rgba(95, 142, 244, 0.42);
|
|
321
|
-
}`:""}
|
|
322
|
-
|
|
323
|
-
.card__title {
|
|
324
|
-
font-weight: 700;
|
|
325
|
-
margin-bottom: 12px;
|
|
326
|
-
a {
|
|
327
|
-
color: ${({theme:e})=>e.palette.primary.main};
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
.card__description {
|
|
331
|
-
a {
|
|
332
|
-
color: ${({theme:e})=>e.palette.primary.main};
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
.card__body {
|
|
336
|
-
padding: 0;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
&.list-type-icon-title {
|
|
340
|
-
padding: 1.2rem;
|
|
341
|
-
.title-line {
|
|
342
|
-
display: flex;
|
|
343
|
-
}
|
|
344
|
-
.card__title {
|
|
345
|
-
margin: 0;
|
|
346
|
-
font-size: 1em;
|
|
347
|
-
}
|
|
348
|
-
.css-icon {
|
|
349
|
-
margin-right: 0.5rem;
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
@media (min-width: ${({theme:e})=>e.breakpoints.values[Se]}px) {
|
|
354
|
-
padding: 2rem 2rem;
|
|
355
|
-
text-align: left;
|
|
356
|
-
box-sizing: border-box;
|
|
357
|
-
}
|
|
358
|
-
`;function Jn({title:e,titleProps:t={},description:r,descriptionProps:i={},image:o,imageMeta:c,className:l="",align:s,hoverStyle:a,...d}){return n.jsxs(Xn,{className:_.cx("card-simple",l,`hover-style__${a}`),align:s,...d,children:[o&&n.jsx(z,{icon:o,color:"primary.main",imageMeta:c}),e||r?n.jsx(Y,{align:s,title:e,titleProps:t,description:r,descriptionProps:i}):null]})}const Xn=C.styled(X)`
|
|
359
|
-
${({dark:e,theme:t})=>`background-color:${e?t.palette.grey[900]:t.palette.common.white};`}
|
|
360
|
-
|
|
361
|
-
&.hover-style__default {
|
|
362
|
-
&.card-simple {
|
|
363
|
-
&:hover {
|
|
364
|
-
border-top-right-radius: 36px;
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
.card__body {
|
|
368
|
-
&:hover {
|
|
369
|
-
&::before {
|
|
370
|
-
width: 42px;
|
|
371
|
-
height: 42px;
|
|
372
|
-
transform: translate(50%, -50%) rotate(45deg);
|
|
373
|
-
}
|
|
374
|
-
&::after {
|
|
375
|
-
transform: none;
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
&.card-simple {
|
|
382
|
-
border-radius: 8px;
|
|
383
|
-
border-top-right-radius: 26px;
|
|
384
|
-
|
|
385
|
-
.card__body {
|
|
386
|
-
${({align:e})=>`text-align:${e||"left"};`}
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
${e=>e.link?`
|
|
390
|
-
cursor: pointer;
|
|
391
|
-
`:""}
|
|
392
|
-
/* cursor: pointer; */
|
|
393
|
-
/* &:hover {
|
|
394
|
-
border-top-right-radius: 36px;
|
|
395
|
-
} */
|
|
396
|
-
transition: all 180ms ease 0s;
|
|
397
|
-
overflow: visible;
|
|
398
|
-
.card__title {
|
|
399
|
-
margin: 12px 0;
|
|
400
|
-
}
|
|
401
|
-
.card__body {
|
|
402
|
-
position: relative;
|
|
403
|
-
padding: 20px 16px 18px;
|
|
404
|
-
overflow: hidden;
|
|
405
|
-
transition: all 180ms ease 0s;
|
|
406
|
-
/* &:hover {
|
|
407
|
-
&::before {
|
|
408
|
-
width: 42px;
|
|
409
|
-
height: 42px;
|
|
410
|
-
transform: translate(50%, -50%) rotate(45deg);
|
|
411
|
-
}
|
|
412
|
-
&::after {
|
|
413
|
-
transform: none;
|
|
414
|
-
}
|
|
415
|
-
} */
|
|
416
|
-
&::before,
|
|
417
|
-
&::after {
|
|
418
|
-
content: ${({border:e})=>e?'""':""};
|
|
419
|
-
transition: inherit;
|
|
420
|
-
position: absolute;
|
|
421
|
-
top: 0px;
|
|
422
|
-
right: 0px;
|
|
423
|
-
}
|
|
424
|
-
&::before {
|
|
425
|
-
z-index: 3;
|
|
426
|
-
background: #fff;
|
|
427
|
-
width: 30px;
|
|
428
|
-
height: 30px;
|
|
429
|
-
transform: translate(50%, -50%) rotate(45deg);
|
|
430
|
-
box-shadow: 0 1px 0 0 #e9eaec;
|
|
431
|
-
}
|
|
432
|
-
&::after {
|
|
433
|
-
z-index: 2;
|
|
434
|
-
width: 28px;
|
|
435
|
-
height: 28px;
|
|
436
|
-
border-bottom-left-radius: 6px;
|
|
437
|
-
background: #fcfcfd;
|
|
438
|
-
box-shadow: -1px 1px 0 0 #e9eaec;
|
|
439
|
-
transform: translate(8px, -8px);
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
`;function Yn({type:e="default",...t}){const i={article:Un,simple:Jn,news:Gn,default:ve,wall:Dn}[e]||ve;return n.jsx(i,{...e==="news"?t:Ee.omit(t,"iconSize")})}function Qn({list:e=[],align:t="top",cards:r,listBorder:i=!0,listType:o="",col:c=3,gap:l,iconColor:s,className:a="",type:d="default",dark:u=!1,textAlign:f="left",hoverStyle:x,...m}){return n.jsx(fe,{type:d,className:_.cx("card-list py-1",a,"items-stretch"),col:c,gap:l,align:t,...m,children:r||e.map(b=>n.jsx(Yn,{borderColor:i,iconColor:s,type:d,listType:o,dark:u,...b,align:f,sx:{bgcolor:d==="wall"?void 0:u?"grey.900":"common.white"},style:l===0&&e.length>1?{borderRadius:0,marginRight:"-1px",marginBottom:"-1px"}:{}},b.id))})}const Zn=["align","cards","list","listBorder","listType","col","gap","iconColor","type","textAlign"],eo=C.styled(K)`
|
|
444
|
-
a .card {
|
|
445
|
-
color: #404040;
|
|
446
|
-
cursor: pointer;
|
|
447
|
-
}
|
|
448
|
-
a:not(.MuiButton-root) {
|
|
449
|
-
color: ${({theme:e})=>e.palette.primary.main};
|
|
450
|
-
&:hover,
|
|
451
|
-
&:active {
|
|
452
|
-
color: ${({theme:e})=>e.palette.primary.main};
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
a:hover .card {
|
|
456
|
-
color: #404040;
|
|
457
|
-
}
|
|
458
|
-
`;function to({className:e,...t}){const[r,i]=E(t,V),[o,c]=E(i,Zn);return n.jsxs(eo,{className:_.cx("section--card-list",e),type:t.type,...c,children:[Object.keys(r).length>0&&n.jsx(D,{center:!0,...r,className:"mb-[2.5vw]"}),n.jsx(Qn,{...o,dark:!!t.dark})]})}const no=C.styled(to)`
|
|
459
|
-
.card__description {
|
|
460
|
-
white-space: pre-wrap;
|
|
461
|
-
}
|
|
462
|
-
.section__description {
|
|
463
|
-
}
|
|
464
|
-
.card {
|
|
465
|
-
/* background: inherit !important; */
|
|
466
|
-
}
|
|
467
|
-
&.dark .card-simple .card__body::before {
|
|
468
|
-
background: #212121 !important;
|
|
469
|
-
}
|
|
470
|
-
.card-simple .card__body::after {
|
|
471
|
-
background: inherit !important;
|
|
472
|
-
}
|
|
473
|
-
`;function oo({section:e,...t}){const[{editing:r},i]=E(t,J),o=h.useMemo(()=>{var c;return{...A.default(i,["listBorder","list","iconSize","imageSize"]),list:(c=i.list)==null?void 0:c.map(l=>{var s,a;return{...A.default(l,"icon","iconColor"),image:["news","simple","default"].includes(i.type)&&l.icon?l.icon:l.image,actions:(a=(s=l.actions)==null?void 0:s.map)==null?void 0:a.call(s,d=>n.jsx(Ke,{...d,editing:r},d.id)),border:i.listBorder,iconSize:i.iconSize,imageSize:i.imageSize,hoverStyle:i.hoverStyle}})}},[i]);return n.jsx(no,{style:r?{pointerEvents:"none"}:{},...o})}function ro({properties:e,section:t,locale:r,dev:i}){var o;return(o=t==null?void 0:t.config)!=null&&o.componentId?n.jsx(de.CustomComponentRenderer,{instanceId:t.id,componentId:t.config.componentId,blockletId:t.config.blockletId,blockletTitle:t.config.blockletTitle,componentName:t.config.componentName,locale:r,properties:e,dev:i}):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 io({src:e,dataId:t,isEdit:r=!1,height:i="100%",onLoad:o=()=>{}}){return n.jsx(Et.EmbedIframe,{isEdit:r,embedId:t,src:e,height:i,onLoad:()=>{o()}})}function so({dataId:e,src:t,actions:r,center:i,onLoad:o,...c}){const[l,s]=E(c,V);return n.jsxs(K,{...s,children:[Object.keys(l).length>0&&n.jsx(D,{center:i,...l}),n.jsx(io,{dataId:e,src:t,onLoad:o,height:c.iframeHeight?`${c.iframeHeight}px`:"100%"}),n.jsx(O,{actions:r,center:i})]})}function co({section:e,id:t,src:r,...i}){const o=`${t}-${i.locale}`,[{editing:c},l]=E(i,J),s=h.useRef({}),a=JSON.parse(JSON.stringify(l)),{message:d}=Nt.useMessage(o,"server"),u=Te.useLatest(JSON.parse(JSON.stringify(l.config)||"{}"));return h.useEffect(()=>{d&&d.onInit(()=>u.current)},[d]),h.useEffect(()=>{const f=JSON.parse(JSON.stringify(l.config)||"{}");nn.default(s.current,f)||(s.current=f,d==null||d.send("config-set",f))},[d,l.config]),r?n.jsx(so,{...a,dataId:o,src:r,style:c?{pointerEvents:"none"}:{}}):n.jsx(ao,{children:'Please set the "src" attribute for this block'})}const ao=C.styled("div")`
|
|
474
|
-
user-select: none;
|
|
475
|
-
color: #999;
|
|
476
|
-
padding: 8px;
|
|
477
|
-
height: 200px;
|
|
478
|
-
`,lo=[/youtu\.be\/([^#&?]{11})/,/\?v=([^#&?]{11})/,/&v=([^#&?]{11})/,/embed\/([^#&?]{11})/,/\/v\/([^#&?]{11})/];function uo(e){var t;if(/youtu\.?be/.test(e))for(const r of lo){const i=(t=r.exec(e))==null?void 0:t[1];if(i)return i}}function fo(e){const t=uo(e);if(t)return`https://youtube.com/embed/${t}`}function po({src:e}){return h.useEffect(()=>{import("@lottiefiles/lottie-player")},[]),n.jsx("lottie-player",{autoplay:!0,loop:!0,mode:"normal",src:e})}function mo(e){return n.jsx(p.Box,{maxHeight:400,overflow:"hidden auto",children:n.jsx(qt.TwitterTimelineEmbed,{...e})})}function ho({url:e}){const t=h.useRef(null),r=495,[i,o]=h.useState(t.current?t.current.offsetWidth*.5625:r),c=h.useCallback(()=>{const l=window.innerWidth>990?1:window.innerWidth>522?1.2:window.innerWidth>400?1.45:1.85,s=t.current?t.current.offsetWidth*.5625:r;return o(Math.floor(s*l))},[]);return h.useEffect(()=>{window.addEventListener("resize",c);const l=window.innerWidth>990?1:window.innerWidth>522?1.2:window.innerWidth>400?1.45:1.85,s=t.current?t.current.offsetWidth*.5625:r;return o(Math.floor(s*l)),function(){window.removeEventListener("resize",c)}},[i,c]),n.jsx(p.Box,{component:"iframe",ref:t,title:"youtube",width:"100%",height:`${i}px`,src:e,frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,sx:{display:"block"}})}const xo=C.styled(Bn)`
|
|
479
|
-
.section__description {
|
|
480
|
-
}
|
|
481
|
-
`;function go({hasImage:e,fullSizeImage:t,boxed:r,videoPoster:i,imageMeta:o,imageOptimization:c,imageSize:l,section:s,...a}){var m,b;const[{editing:d},u]=E({...a,boxed:t?void 0:r},J);let f=yo(u.image,i,t,o,c,l);e||(f=null);let x=null;return u.actions&&(x=(b=(m=u.actions)==null?void 0:m.map)==null?void 0:b.call(m,(w,g)=>n.jsx(Ke,{...w,editing:d},g))),n.jsx(xo,{...u,style:d?{pointerEvents:"none"}:{},image:f,fullSizeImage:e&&t,actions:x})}function yo(e,t,r,i,o,c){if(e){if(e.endsWith(".json"))return n.jsx(po,{src:e});if(e.indexOf("twitter.com")!==-1)return n.jsx(mo,{sourceType:"url",url:e});const l=fo(e);if(l)return n.jsx(ho,{url:l});const{naturalWidth:s,naturalHeight:a,filename:d}=i||{};if(ce(e))return n.jsx("video",{width:s&&`${s}px`,height:a&&`${a}px`,controls:!0,autoPlay:!0,muted:!0,style:{display:"block",objectFit:c||"contain",borderRadius:"8px",width:"100%",height:"100%"},poster:W(q(t),r?1200:540,o),children:n.jsx("source",{src:q(e),type:vn(e)})},e);const u=o==="quality"?1:.6;return n.jsx(de.ResponsiveImage,{src:q(e),sizesAttr:{sm:600*u,md:450*u,lg:540*u,...r&&{md:900*u,lg:1200*u}},width:s&&`${s}px`,height:a&&`${a}px`,alt:d??e,style:{objectFit:c||"contain",display:"block",width:"100%",height:"100%"},loading:"lazy"})}return null}const bo=["production","draft"];function Je({mode:e,version:t}={}){const r=t&&typeof t=="number"?{mode:e,version:t}:{mode:e};return G.get(`/api/${oe()}/pages`,{params:r}).then(i=>i.data)}function wo({mode:e,pages:t}){return G.post(`/api/${oe()}/pages/publish`,{mode:e,pages:t}).then(r=>r.data)}function jo({locale:e,sort:t,page:r,limit:i,mode:o}={}){return G.get(`/api/${oe()}/pages/toc`,{params:{locale:e,sort:t,page:r,limit:i,mode:o}}).then(c=>c.data)}const $e=20;function _o({style:e,sort:t,section:r,...i}){const[{editing:o,locale:c},l]=E(i,J),[s,a]=E(l,V),[d,u]=h.useState(),f=h.useRef(!1),x=H.useUpdate(),m=N.useNavigate(),b=h.useCallback(async()=>{if(!f.current){f.current=!0,x();try{const w=d?Math.floor(d.list.length/$e)+1:1,{list:g,total:j}=await jo({locale:c,sort:t,page:w,limit:$e});u(y=>({list:((y==null?void 0:y.list)??[]).concat(g),total:j}))}finally{f.current=!1,x()}}},[d,c,t,x]);return H.useMount(()=>{b()}),n.jsxs(K,{...a,sx:o?{pointerEvents:"none"}:{},children:[Object.keys(s).length>0&&n.jsx(D,{...s}),d?n.jsxs(n.Fragment,{children:[n.jsx(p.Grid,{container:!0,spacing:2,justifyContent:"center",children:d==null?void 0:d.list.map(w=>n.jsx(p.Grid,{item:!0,xs:12,sm:e==="card"?6:12,md:e==="card"?3:12,children:n.jsxs(ko,{elevation:0,className:_.cx(e==="card"&&"style-card"),onClick:o?void 0:()=>m(w.slug),children:[!!w.image&&n.jsx(p.CardMedia,{component:"img",alt:"",image:W(q(w.image),540),loading:"lazy"}),n.jsxs(p.CardContent,{children:[n.jsx(p.Typography,{variant:"h6",component:"div",className:Ce,children:w.title||w.id}),n.jsx(p.Typography,{variant:"body2",className:Ce,children:w.description})]})]})},w.id))}),n.jsx(p.Box,{textAlign:"center",mt:2,children:d.total>d.list.length?n.jsx(F,{variant:"outlined",color:"secondary",onClick:b,loading:f.current,children:"More"}):n.jsx(F,{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 Ce=_.css`
|
|
482
|
-
display: -webkit-box;
|
|
483
|
-
-webkit-box-orient: vertical;
|
|
484
|
-
-webkit-line-clamp: 2;
|
|
485
|
-
overflow: hidden;
|
|
486
|
-
text-overflow: ellipsis;
|
|
487
|
-
`,ko=C.styled(p.Card)`
|
|
488
|
-
border: 1px solid #e0e0e0;
|
|
489
|
-
background-color: transparent;
|
|
490
|
-
cursor: pointer;
|
|
491
|
-
display: flex;
|
|
492
|
-
color: inherit;
|
|
493
|
-
|
|
494
|
-
> .MuiCardMedia-root {
|
|
495
|
-
width: 30vw;
|
|
496
|
-
max-height: 50vw;
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
&.style-card {
|
|
500
|
-
display: block;
|
|
501
|
-
|
|
502
|
-
> .MuiCardMedia-root {
|
|
503
|
-
width: 100%;
|
|
504
|
-
max-height: 50vw;
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
`,vo={iframe:co,section:go,"section-card-list":oo,toc:_o,"ai-runtime":En,"custom-component":ro};function So({id:e,type:t,mode:r,config:i,section:o,...c}){const l=vo[t],s=l&&n.jsx(l,{mode:r,...i,id:e,section:o});return t==="custom-component"?s:n.jsx(Nn,{...c,height:i.height,children:s})}const $o=C.styled(on.default,{shouldForwardProp:e=>!!e})`
|
|
508
|
-
& > div > .MuiContainer-root {
|
|
509
|
-
max-width: unset;
|
|
510
|
-
}
|
|
511
|
-
`;function Co({meta:e,...t}){const r=C.useTheme();return n.jsx($o,{...t,meta:e,theme:r||{}})}function Xe(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 Po(e){return n.jsx(Io,{...e})}const Io=C.styled(p.Box)`
|
|
512
|
-
position: fixed;
|
|
513
|
-
left: 0;
|
|
514
|
-
top: 0;
|
|
515
|
-
z-index: 999999999999;
|
|
516
|
-
width: 80px;
|
|
517
|
-
font-size: 12px;
|
|
518
|
-
text-align: center;
|
|
519
|
-
opacity: 0.7;
|
|
520
|
-
transform: translateX(-23%) translateY(70%) rotate(-45deg);
|
|
521
|
-
pointer-events: none;
|
|
522
|
-
`,Bo=e=>new Promise((t,r)=>{(e==null?void 0:e.length)>0?rn.default.load({google:{families:e},fontactive:()=>{t("success")},fontinactive:()=>{r(new Error("load font fail"))}}):t("success")}),Pe=`Avenir, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
|
|
523
|
-
sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'`,Ie={};function No({titleFontFamily:e,descriptionFontFamily:t}){const r=async i=>{if(i&&!document.querySelectorAll(`link[href*="${i}" i]`).length)try{Ie[i]||(await Bo([i]),Ie[i]=!0)}catch(o){console.error(o)}};return h.useEffect(()=>{e&&r(e),t&&r(t)},[e,t]),n.jsx(ne.Global,{styles:ne.css`
|
|
524
|
-
#app {
|
|
525
|
-
.page-kit-section__title {
|
|
526
|
-
font-family: ${JSON.stringify(e)}, ${Pe};
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
.page-kit-section__description {
|
|
530
|
-
font-family: ${JSON.stringify(t)}, ${Pe};
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
`})}const{SessionProvider:er,SessionContext:Ro,SessionConsumer:tr,withSession:nr}=Wt.createAuthServiceSessionContext();function he(){return h.useContext(Ro)}function Eo(...e){var r;const{session:t}=he();return e.includes((r=t.user)==null?void 0:r.role)}function qo(...e){var i;const{session:t}=he(),r=Eo(...e);return((i=window.blocklet)==null?void 0:i.tenantMode)==="multiple"?!!t.user:r}function To(e){return e!=null}async function Lo(e){return G.get(`/api/projects/${e}`).then(t=>t.data)}async function Wo(e){return G.post(`/api/projects/${e.id}/update`,e).then(t=>t.data)}const zo=500,Be=Ot.customAlphabet("abcdefghijklmnopqrstuvwxyz0123456789",16),Ye=h.createContext(null);function Mo({url:e,name:t,children:r,waitingSynced:i}){const[o,c]=h.useState(!1),l=re(),s=`${l}:MakerLocalState`,a=`${l}:${t}`,[d,u]=Te.useLocalStorageState(s,{defaultValue:{}}),f=h.useRef(d);f.current=d;const x=h.useMemo(()=>sn.default({pages:{},pageIds:[],components:{},supportedLocales:[],config:{},resources:{}}),[]),m=h.useMemo(()=>Le.getYjsDoc(x),[x]);h.useMemo(()=>new Ut.IndexeddbPersistence(a,m),[a,m]);const b=h.useMemo(()=>new Ft.WebsocketProvider(e,a,m,{params:{token:cn.default.get("login_token")}}),[e,a,m]),w=h.useMemo(()=>new Ht.UndoManager([m.getArray("pageIds"),m.getMap("pages"),m.getArray("supportedLocales"),m.getMap("config")],{doc:m}),[m]),[g,j]=h.useState(null),[y,v]=h.useState(!1),[R,T]=h.useState(void 0),M=h.useCallback(async()=>{if(l){v(!0);try{const S=await Lo(l);j(S)}catch(S){console.error("Failed to fetch project:",S)}finally{v(!1)}}},[l]),U=h.useCallback(async(S,k)=>{var I;if(T(void 0),!!l){k!=null&&k.optimisticUpdate&&g&&j(P=>({...P,...S}));try{const P=await Wo({...S});j(P)}catch(P){console.error("Failed to update project:",P),k!=null&&k.optimisticUpdate&&j(g),T((I=P==null?void 0:P.response)==null?void 0:I.data)}}},[l,g]);h.useEffect(()=>{l&&M()},[l,M]);const Q=h.useMemo(()=>({doc:m,state:x,localState:d,setLocalState:S=>u(typeof S=="function"?k=>S(k??{}):S),undoManager:w,projectState:{project:g,isLoadingProject:y,error:R},updateProject:U}),[m,x,d,u,w,g,y,U,R]);return h.useEffect(()=>{w.on("stack-item-added",({stackItem:S})=>{const{currentPageId:k,currentLocale:I,pages:P}=f.current;S.meta.set("localState",{currentPageId:k,currentLocale:I,pages:P})}),w.on("stack-item-popped",({stackItem:S})=>{const k=S.meta.get("localState");k&&u(I=>({...I,...k}))})},[w,u]),h.useEffect(()=>{b.awareness.setLocalState(d)},[b,d]),h.useEffect(()=>{b.once("synced",()=>c(!0));const S=()=>{u(P=>({...P,networkStatus:void 0}))},k=()=>{u(P=>({...P,networkStatus:"offline"}))},I=an.default(({status:P})=>{P==="connected"?S():P==="disconnected"&&k()},zo);return b.on("status",I),window.addEventListener("online",S),window.addEventListener("offline",k),()=>{b.off("status",I),window.removeEventListener("online",S),window.removeEventListener("offline",k)}},[b,u]),i&&!o?null:n.jsx(Ye.Provider,{value:Q,children:r})}const Ao=()=>{const e=h.useContext(Ye);if(!e)throw new Error("Context is null");const t=zt.useSyncedStore(e.state),{setLocalState:r}=e,i=N.useNavigate(),o=re(),c=h.useMemo(()=>({setCurrentSectionId:(s,a)=>{i(B.joinURL("/admin/maker",o??"","pages",s)),r(d=>we.produce(d,u=>{var f;u.currentPageId=s,u.currentComponentId=void 0,a!==void 0&&(u.pages??(u.pages={}),(f=u.pages)[s]??(f[s]={}),u.pages[s].currentSectionId=a??void 0),a?window.sessionStorage.setItem("iframe_show_id",`"${a}"`):window.sessionStorage.removeItem("iframe_show_id")}))},setCurrentComponentId:s=>{i(B.joinURL("/admin/maker",o??"","components",s)),r(a=>we.produce(a,d=>{d.currentComponentId=s}))}}),[r,i,o]),l=h.useMemo(()=>({addPage:(s,a)=>{const d=(s==null?void 0:s.id)??Be(),u={...s,id:d,createdAt:(s==null?void 0:s.createdAt)??new Date().toISOString(),updatedAt:(s==null?void 0:s.updatedAt)??new Date().toISOString(),publishedAt:new Date(0).toISOString(),slug:(s==null?void 0:s.slug)??`/${d}`,sections:(s==null?void 0:s.sections)??{},sectionIds:(s==null?void 0:s.sectionIds)??[]};return e.doc.transact(()=>{t.pages[u.id]=u,t.pageIds.splice(a??t.pageIds.length,0,u.id)}),u},deletePage:s=>{const a=t.pageIds.indexOf(s);a!==-1&&e.doc.transact(()=>{t.pageIds.splice(a,1),delete t.pages[s]})},movePage:(s,a)=>{const{pageIds:d}=t,u=d.indexOf(s);u>=0&&d.splice(a,0,...d.splice(u,1))},addSection:(s,a,d)=>{const u=t.pages[s];if(!u)throw new Error(`Page ${s} is not exists`);const f={...a,id:a.id??Be()};return e.doc.transact(()=>{u.sections[f.id]=f,u.sectionIds.splice(d??u.sectionIds.length,0,f.id)}),f},deleteSection:(s,a)=>{const d=t.pages[s];if(!d)throw new Error(`Page ${s} is not exists`);const u=d.sectionIds.indexOf(a);u!==-1&&e.doc.transact(()=>{d.sectionIds.splice(u,1),delete d.sections[a]})},toggleSectionVisibility:(s,a,d)=>{const u=t.pages[s];if(!u)throw new Error(`Page ${s} is not exists`);const f=u.sections[a];f&&(f.visibility=d)},moveSection:(s,a,d)=>{const u=t.pages[s];if(!u)throw new Error(`Page ${s} is not exists`);const{sectionIds:f}=u,x=f.indexOf(a);x>=0&&f.splice(d,0,...f.splice(x,1))}}),[t,e.doc]);return{...e,state:t,actions:l,localActions:c,get currentPage(){const{localState:{currentPageId:s}}=e;return s?t.pages[s]:void 0},get currentSection(){var u,f,x;const{localState:{currentPageId:s,...a}}=e;if(!s)return;const d=(f=(u=a.pages)==null?void 0:u[s])==null?void 0:f.currentSectionId;if(d)return(x=t.pages[s])==null?void 0:x.sections[d]}}},re=()=>{const{projectId:e}=N.useParams();return e??oe()};function Oo(e){var i,o;const{resources:t}=e;if(!t.components)return{};const r={};return(o=(i=window==null?void 0:window.blocklet)==null?void 0:i.componentMountPoints)==null||o.forEach(c=>{r[c.did]=c}),Object.fromEntries(Object.entries(t.components).map(([c,{blockletId:l,component:s}])=>{var a;return[c,{data:s,blockletId:l,blockletTitle:((a=r[l])==null?void 0:a.title)||l}]}))}function Uo(e){const{components:t}=e;return t||{}}function Fo(e){return{...Oo(e),...Uo(e)}}function Ho(e,t,r){const i=[];{let o;t.slug?t.slug.startsWith("/")?t.slug!=="/"&&t.slug.endsWith("/")?o=e("maker.properties.pathCheckEndWithoutSlash"):/\/{2,}/.test(t.slug)?o=e("maker.properties.pathCheckConsecutiveSlash"):/\s/.test(t.slug)?o=e("maker.properties.pathCheckWhitespace"):/^(\/|(\/[^/\s]+)+)$/.test(t.slug)?Object.values(r.pages).some(c=>(c==null?void 0:c.id)!==t.id&&(c==null?void 0:c.slug)===t.slug)&&(o=e("maker.properties.pathCheckAlreadyExist")):o=e("maker.properties.pathCheckInvalid"):o=e("maker.properties.pathCheckStartWithSlash"):o=e("maker.properties.pathCheckRequired"),o&&i.push({path:["path"],message:o})}return i.length>0?i:null}function Do({errors:e,...t}){return e!=null&&e.length?n.jsx(p.Tooltip,{...t,title:n.jsx(p.Box,{children:e.map((r,i)=>n.jsx(p.Box,{children:r.message},i))})}):null}function Vo(){const[e]=N.useSearchParams(),{session:t}=he(),r=qo("owner","admin","pagesEditor","member"),i=h.useMemo(()=>{const c=e.get("mode");return bo.includes(c)?c:"production"},[e]),o=i==="production"?i:t.user?r?i:"production":null;return o?n.jsx(Qe,{mode:o}):null}function Qe({mode:e}){if(e!=="draft"){const t=window.__PAGE_STATE__;return t?n.jsx(te,{mode:e,state:t}):n.jsx(Ko,{mode:e,children:({state:r})=>n.jsx(te,{mode:e,state:r})})}return n.jsx(Go,{children:({state:t})=>n.jsx(te,{mode:e,state:t})})}const Go=h.lazy(()=>Promise.resolve().then(()=>require("./draft-data-Wp7NHQJ8.js")));function Ko({mode:e,children:t}){const r=document.querySelector('meta[property="pages:version"]'),i=r==null?void 0:r.content,o=re(),c=h.useMemo(()=>{if(i==="{{pagesPublishedAt}}"){const a=localStorage.getItem(Ae(o??""));return Number(a)?Number(a):new Date().getTime()}return Number(i)},[i]),{loading:l,value:s}=H.useAsync(()=>Je({mode:e,version:c}),[e,c]);return l?n.jsx(Xe,{}):s?t({state:s}):null}function te({mode:e,state:t}){var b,w,g,j;const{t:r,locale:i}=ct.useLocaleContext(),{pageIds:o,pages:c,supportedLocales:l,config:{defaultLocale:s},resources:a}=t,d=Fo(t),u=h.useMemo(()=>l!=null&&l.some(y=>y.locale===i)?i:void 0,[i,l]),f=Object.values(c).find(y=>(y==null?void 0:y.slug)==="/")?void 0:Object.values(c)[0],x=h.useMemo(()=>o.map(y=>{const v=c[y];return v&&{id:v.id,path:B.joinURL("/",u||"",v.slug,e!=="production"?`?mode=${e}`:"")}}).filter(To),[o,c,u,e]),m=([...y])=>(e!=="production"&&y.unshift(n.jsx(h.Suspense,{fallback:n.jsx("div",{}),children:n.jsx(Jo,{mode:"production",state:t})})),y);return n.jsxs(qn,{value:{pages:x},children:[n.jsxs(N.Routes,{children:[f&&n.jsx(N.Route,{index:!0,element:n.jsx(N.Navigate,{to:B.joinURL("/",u||"",f.slug)})}),o.map(y=>{const v=c[y];return v?n.jsx(N.Route,{path:B.joinURL(":projectIdOrSlug?",v.slug),element:n.jsx(le,{mode:e,components:d,page:v,locale:u,defaultLocale:s,headerAddons:m})},v.id):null}),a.pages&&Object.values(a.pages).map(({blockletId:y,page:v})=>n.jsx(N.Route,{path:B.joinURL("/",`@${y}`,v.slug),element:n.jsx(le,{mode:e,components:d,page:v,locale:u,defaultLocale:s,headerAddons:m})},v.id)),n.jsx(N.Route,{path:"*",element:n.jsx(p.Box,{width:"100vw",height:"100vh",display:"flex",justifyContent:"center",alignItems:"center",children:n.jsx(Dt.default,{style:{background:"inherit"},status:404,extra:n.jsx(Yo,{href:"/",children:r("common.back")})})})})]}),e!=="production"&&n.jsx(Po,{sx:{bgcolor:"info.light"},children:e}),n.jsx(No,{titleFontFamily:(w=(b=t.config)==null?void 0:b.fontFamily)==null?void 0:w.title,descriptionFontFamily:(j=(g=t.config)==null?void 0:g.fontFamily)==null?void 0:j.description})]})}function le({mode:e,components:t,page:r,locale:i,defaultLocale:o,headerAddons:c}){var g,j,y,v,R,T,M,U,Q;const l=((g=r.locales)==null?void 0:g[i])??((j=r.locales)==null?void 0:j[o])??{},s=l.title||((y=window.blocklet)==null?void 0:y.appName),a=l.description||((v=window.blocklet)==null?void 0:v.appDescription),d=W(q(l.image),540),{logo:u,brand:f,description:x,...m}=lt.useHeaderState(),b=h.useMemo(()=>S=>{var I;let k=(c==null?void 0:c(S))??S;return k=((I=m.addons)==null?void 0:I.call(m,k))??k,k},[m.addons,c]),w=(R=l.header)!=null&&R.translucent?et:Ze;return n.jsxs(n.Fragment,{children:[!!l.backgroundColor&&n.jsx(ne.Global,{styles:ne.css`
|
|
534
|
-
body {
|
|
535
|
-
background-color: ${l.backgroundColor} !important;
|
|
536
|
-
}
|
|
537
|
-
`}),n.jsx(w,{hideNavMenu:!!((T=l.header)!=null&&T.hideNavMenus),translucentTextColor:(M=l.header)==null?void 0:M.translucentTextColor,...u?{logo:u}:{},...f?{brand:f}:{},...x?{description:x}:{},className:_.cx(((U=l.header)==null?void 0:U.sticky)&&"sticky","page-header"),maxWidth:!1,addons:b}),n.jsx(N.ScrollRestoration,{}),n.jsxs(mt.Helmet,{children:[n.jsx("title",{children:s}),n.jsx("meta",{name:"og:title",content:s}),n.jsx("meta",{name:"og:description",content:a}),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:a}),n.jsx("meta",{property:"twitter:title",content:s}),n.jsx("meta",{name:"description",content:a})]}),n.jsx(p.Stack,{flexGrow:1,children:r.sectionIds.map(S=>{var xe,ge;const k=r.sections[S];if(!k||k.visibility==="hidden")return null;const I=(xe=k.locales)==null?void 0:xe[i],P=((ge=k.locales)==null?void 0:ge[o])??{};return n.jsx(So,{id:S,type:k.component,mode:e,section:k,config:{...Kt.default(I)?P:I,locale:i,dev:e==="draft"?{mode:e,components:t,defaultLocale:o}:{mode:e}}},S)})}),!((Q=l.footer)!=null&&Q.hidden)&&n.jsx(Co,{})]})}const Jo=h.lazy(()=>Promise.resolve().then(()=>require("./publish-button-h0M1NWWo.js"))),Ze=We.default(Vt.default)`
|
|
538
|
-
&.sticky {
|
|
539
|
-
position: sticky;
|
|
540
|
-
top: 0;
|
|
541
|
-
}
|
|
542
|
-
`;function Xo({logo:e}){const[t,r]=h.useState(),{value:i}=H.useAsync(()=>new Promise(o=>{fetch("/.well-known/service/blocklet/logo-rect").then(c=>{const l=c.headers.get("content-type");l!=null&&l.includes("svg")&&c.text().then(s=>{r(s),o(null)}),o(c.url)})}),[]);if(e)return e;if(t)return n.jsx(p.Box,{sx:{filter:"initial !important"},dangerouslySetInnerHTML:{__html:Gt.default.sanitize(t)}});if(i){const o=new URL(i);o.searchParams.set("imageFilter","convert"),o.searchParams.set("f","png"),o.searchParams.set("h","88"),o.searchParams.set("hash","00c22ff");const c=o.toString();return n.jsx("img",{src:c,alt:"logo"})}return null}function et({logo:e,translucentTextColor:t,...r}){const{y:i}=H.useWindowScroll();let o=Math.min(i/800,1),c="";if(o>.1){o=Math.max(o,.6);const l=Math.round(255*Math.min(1-o,.2));c=`rgb(${l}, ${l}, ${l})`}else c=t||"#EEEEEE";return n.jsx(Ze,{logo:n.jsx(Xo,{logo:e}),...r,className:_.cx(o<=.7&&"reverse-color"),style:{backgroundColor:`rgba(255,255,255,${o})`,"--logo-invert":o<=.7?1-o/6:1-o},sx:{backdropFilter:o>=.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:`${c} !important`}},".header-logo > div":{filter:"invert(var(--logo-invert))"},".header-logo":{color:c}}})}const Yo=We.default(p.Button)``;exports.Home=Vo;exports.HomeView=Qe;exports.Loading=Xe;exports.PageErrorTip=Do;exports.PageRoutes=te;exports.PageView=le;exports.StoreProvider=Mo;exports.TranslucentHeader=et;exports.checkPage=Ho;exports.getPages=Je;exports.getProjectPageVersionKey=Ae;exports.getWssURL=bn;exports.publishPages=wo;exports.useProjectId=re;exports.useStore=Ao;
|