@blocklet/pages-kit-inner-components 0.4.115 → 0.4.116

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- "use strict";var XI=Object.create;var II=Object.defineProperty;var TI=Object.getOwnPropertyDescriptor;var WI=Object.getOwnPropertyNames;var xI=Object.getPrototypeOf,YI=Object.prototype.hasOwnProperty;var rI=(C,s,w,A)=>{if(s&&typeof s=="object"||typeof s=="function")for(let o of WI(s))!YI.call(C,o)&&o!==w&&II(C,o,{get:()=>s[o],enumerable:!(A=TI(s,o))||A.enumerable});return C};var hI=(C,s,w)=>(w=C!=null?XI(xI(C)):{},rI(s||!C||!C.__esModule?II(w,"default",{value:C,enumerable:!0}):w,C));Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const I=require("react/jsx-runtime"),H=require("./chunks/state-DDwYX2mu.js"),ZI=require("@arcblock/ux/lib/Empty"),X=require("@arcblock/ux/lib/Locale/context"),R=require("@iconify-icon/react"),QI=require("@mui/icons-material/Check"),i=require("@mui/material"),u=require("ahooks"),m=require("react"),r=require("./chunks/array-CnXbKOG_.js"),U=require("./chunks/config-color-BBSht7j-.js"),kI=require("lodash/cloneDeep"),Y=require("@mui/icons-material"),CI=require("react-dnd");require("@arcblock/ux/lib/Tabs");require("@blocklet/pages-kit/utils/style");require("lodash/pick");const f=require("@arcblock/ux/lib/Theme"),RI=require("@mui/lab"),a=require("immer"),pI=require("./theme.js"),v=require("react-use"),JI=require("@arcblock/ux/lib/Toast"),UI=require("@mui/material/Tooltip"),fI=require("@mui/icons-material/KeyboardArrowLeft"),GI=require("@mui/material/Box"),VI=require("@mui/material/DialogTitle"),vI=require("@mui/material/IconButton"),PI=require("@mui/material/Dialog"),_I=require("@mui/material/useMediaQuery"),OI=require("@emotion/react"),qI=require("@mui/material/Alert"),$I=require("@mui/material/AlertTitle"),IC=require("react-error-boundary"),CC=require("ufo"),gC=require("@emotion/styled"),AC=require("@mui/material/Typography"),iC=require("joi"),mI=require("@blocklet/ai-kit/api"),sC=require("@blocklet/js-sdk"),SI=require("@mui/x-date-pickers"),oC=require("@mui/x-date-pickers/AdapterDayjs"),wC=require("@mui/x-date-pickers/LocalizationProvider"),gI=require("circular-natal-horoscope-js/dist"),MC=require("dayjs"),LC=require("dayjs/plugin/timezone"),jC=require("dayjs/plugin/utc"),JC=require("fast-deep-equal"),OC=require("lodash/isNil"),mC=require("tz-lookup"),SC=require("@mui/icons-material/CheckCircleOutline"),BC=require("lodash/uniq"),yC=require("@emotion/css"),DC=require("lodash/get"),eC=require("lodash/set"),bC=require("@blocklet/pages-kit/components"),F=C=>C&&C.__esModule?C:{default:C},BI=F(ZI),NC=F(QI),yI=F(m),KC=F(kI),DI=F(JI),dC=F(UI),P=F(fI),x=F(GI),_=F(VI),q=F(vI),cC=F(PI),zC=F(_I),FC=F(qI),aC=F($I),Z=F(gC),AI=F(AC),E=F(iC),h=F(MC),lC=F(LC),tC=F(jC),HC=F(JC),EC=F(OC),eI=F(mC),uC=F(SC),iI=F(BC),nC=F(DC),XC=F(eC);function TC({htmlId:C,dragType:s,dropType:w=s,index:A,id:o,title:g,move:M,actions:j,...O}){const[{isDragging:L},e,y]=CI.useDrag(()=>({type:s,item:{id:o,index:A},options:{dropEffect:"move"},collect:b=>({isDragging:b.isDragging()}),end:(b,N)=>{const{id:S,index:B}=b;N.didDrop()||M(S,B)}}),[s,o,A,M]),[,J]=CI.useDrop(()=>({accept:w,hover(b){b.id!==o&&M(b.id,A)}}),[w,o,A,M]),D=L?.3:1;return I.jsxs(WC,{...O,id:C,ref:b=>J(y(b)),sx:{...O.sx,opacity:D},children:[I.jsx("div",{className:"drag",ref:b=>e(b),children:I.jsx(Y.DragIndicator,{})}),I.jsx("div",{className:"name",children:g}),I.jsx("div",{className:"actions",onClick:b=>b.stopPropagation(),children:j})]})}const WC=i.styled(i.Box)`
1
+ "use strict";var XI=Object.create;var II=Object.defineProperty;var TI=Object.getOwnPropertyDescriptor;var WI=Object.getOwnPropertyNames;var xI=Object.getPrototypeOf,YI=Object.prototype.hasOwnProperty;var rI=(C,s,w,A)=>{if(s&&typeof s=="object"||typeof s=="function")for(let o of WI(s))!YI.call(C,o)&&o!==w&&II(C,o,{get:()=>s[o],enumerable:!(A=TI(s,o))||A.enumerable});return C};var hI=(C,s,w)=>(w=C!=null?XI(xI(C)):{},rI(s||!C||!C.__esModule?II(w,"default",{value:C,enumerable:!0}):w,C));Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const I=require("react/jsx-runtime"),H=require("./chunks/state-DDwYX2mu.js"),ZI=require("@arcblock/ux/lib/Empty"),X=require("@arcblock/ux/lib/Locale/context"),R=require("@iconify-icon/react"),QI=require("@mui/icons-material/Check"),i=require("@mui/material"),u=require("ahooks"),m=require("react"),r=require("./chunks/array-BwGaBJVb.js"),U=require("./chunks/config-color-C8L0QSPJ.js"),kI=require("lodash/cloneDeep"),Y=require("@mui/icons-material"),CI=require("react-dnd");require("@arcblock/ux/lib/Tabs");require("@blocklet/pages-kit/utils/style");require("lodash/pick");const f=require("@arcblock/ux/lib/Theme"),RI=require("@mui/lab"),a=require("immer"),pI=require("./theme.js"),v=require("react-use"),JI=require("@arcblock/ux/lib/Toast"),UI=require("@mui/material/Tooltip"),fI=require("@mui/icons-material/KeyboardArrowLeft"),GI=require("@mui/material/Box"),VI=require("@mui/material/DialogTitle"),vI=require("@mui/material/IconButton"),PI=require("@mui/material/Dialog"),_I=require("@mui/material/useMediaQuery"),OI=require("@emotion/react"),qI=require("@mui/material/Alert"),$I=require("@mui/material/AlertTitle"),IC=require("react-error-boundary"),CC=require("ufo"),gC=require("@emotion/styled"),AC=require("@mui/material/Typography"),iC=require("joi"),mI=require("@blocklet/ai-kit/api"),sC=require("@blocklet/js-sdk"),SI=require("@mui/x-date-pickers"),oC=require("@mui/x-date-pickers/AdapterDayjs"),wC=require("@mui/x-date-pickers/LocalizationProvider"),gI=require("circular-natal-horoscope-js/dist"),MC=require("dayjs"),LC=require("dayjs/plugin/timezone"),jC=require("dayjs/plugin/utc"),JC=require("fast-deep-equal"),OC=require("lodash/isNil"),mC=require("tz-lookup"),SC=require("@mui/icons-material/CheckCircleOutline"),BC=require("lodash/uniq"),yC=require("@emotion/css"),DC=require("lodash/get"),eC=require("lodash/set"),bC=require("@blocklet/pages-kit/components"),F=C=>C&&C.__esModule?C:{default:C},BI=F(ZI),NC=F(QI),yI=F(m),KC=F(kI),DI=F(JI),dC=F(UI),P=F(fI),x=F(GI),_=F(VI),q=F(vI),cC=F(PI),zC=F(_I),FC=F(qI),aC=F($I),Z=F(gC),AI=F(AC),E=F(iC),h=F(MC),lC=F(LC),tC=F(jC),HC=F(JC),EC=F(OC),eI=F(mC),uC=F(SC),iI=F(BC),nC=F(DC),XC=F(eC);function TC({htmlId:C,dragType:s,dropType:w=s,index:A,id:o,title:g,move:M,actions:j,...O}){const[{isDragging:L},e,y]=CI.useDrag(()=>({type:s,item:{id:o,index:A},options:{dropEffect:"move"},collect:b=>({isDragging:b.isDragging()}),end:(b,N)=>{const{id:S,index:B}=b;N.didDrop()||M(S,B)}}),[s,o,A,M]),[,J]=CI.useDrop(()=>({accept:w,hover(b){b.id!==o&&M(b.id,A)}}),[w,o,A,M]),D=L?.3:1;return I.jsxs(WC,{...O,id:C,ref:b=>J(y(b)),sx:{...O.sx,opacity:D},children:[I.jsx("div",{className:"drag",ref:b=>e(b),children:I.jsx(Y.DragIndicator,{})}),I.jsx("div",{className:"name",children:g}),I.jsx("div",{className:"actions",onClick:b=>b.stopPropagation(),children:j})]})}const WC=i.styled(i.Box)`
2
2
  display: flex;
3
3
  align-items: center;
4
4
  padding: 8px;
@@ -375,4 +375,4 @@ ${C}`}).then(w=>w.text??"")}function VC(C){const s=u.useReactive({searching:!1,s
375
375
  display: inline-flex;
376
376
  }
377
377
  }
378
- `,Wg="primary",xg="contained",MI={id:H.nextId(),color:Wg,variant:xg,text:"",link:"",icon:"",size:"medium"};function Yg({children:C}){return C}const rg=m.forwardRef(function({locale:s,locales:w,onSave:A=()=>{}},o){const{t:g}=X.useLocaleContext(),[M,{setFalse:j,setTrue:O}]=u.useBoolean(!1),[L,e]=m.useState({...MI}),[y,J]=m.useState(-1),D=m.useCallback(()=>{j()},[j]);m.useImperativeHandle(o,()=>({open(S,B){e(a.produce(L,c=>{Object.assign(c,{...MI},{...S,link:(S==null?void 0:S.link)||(S==null?void 0:S.linkId)})})),O(),J(B===void 0?-1:B)},close(){D()}}));const b=()=>{A(L,D)},N=y>-1?lI:Yg;return I.jsxs(i.Dialog,{open:M,onClose:D,children:[I.jsx(i.DialogTitle,{children:g("maker.properties.button")}),I.jsxs(i.DialogContent,{sx:{width:350},children:[I.jsx(i.Box,{my:2,children:I.jsx(rC,{value:L.icon||"",onChange:S=>{e(a.produce(L,B=>{B.icon=S}))}})}),I.jsx(i.Box,{my:2,children:I.jsx(N,{locale:s,locales:w,path:["actions",y,"text"],value:L.text,onChange:S=>{y>-1&&typeof S=="string"&&e(a.produce(L,B=>{B.text=S}))},children:I.jsx(U.ConfigString,{label:g("maker.properties.title"),value:L.text,onChange:S=>{e(a.produce(L,B=>{B.text=S}))}})})}),I.jsx(i.Box,{my:2,children:I.jsx(G,{label:g("maker.properties.color"),options:[{value:"primary",title:"Primary"},{value:"secondary",title:"Secondary"},{value:"info",title:"Info"},{value:"success",title:"Success"},{value:"warning",title:"Warning"},{value:"error",title:"Error"}],value:L.color||"",onChange:S=>{e(a.produce(L,B=>{B.color=S}))}})}),I.jsx(i.Box,{my:2,children:I.jsx(G,{label:g("maker.properties.variant"),options:[{value:"contained",title:"Contained"},{value:"outlined",title:"Outlined"}],value:L.variant||"",onChange:S=>{e(a.produce(L,B=>{B.variant=S}))}})}),I.jsx(i.Box,{my:2,children:I.jsx(G,{label:g("maker.properties.size"),options:[{value:"large",title:"Large"},{value:"medium",title:"Medium"},{value:"small",title:"Small"}],value:L.size||"",onChange:S=>{e(a.produce(L,B=>{B.size=S}))}})}),I.jsx(i.Box,{my:2,children:I.jsx(bI,{label:g("maker.properties.link"),value:L.link,onChange:S=>{e(a.produce(L,B=>{B.link=S}))}})})]}),I.jsxs(i.DialogActions,{children:[I.jsx(i.Button,{variant:"outlined",size:"small",onClick:D,children:g("common.cancel")}),I.jsx(i.Button,{variant:"contained",size:"small",onClick:b,children:g("maker.save")})]})]})});function hg({value:C,locale:s,locales:w,onChange:A=()=>{}}){var J;const o=m.useRef(null),{t:g}=X.useLocaleContext(),M=u.useReactive({actionIndex:void 0}),j=()=>{var D;M.actionIndex=void 0,(D=o.current)==null||D.open({id:H.nextId()},-1)},O=D=>{var N;const b=C==null?void 0:C.findIndex(S=>S===D);M.actionIndex=b,(N=o.current)==null||N.open(D,b===void 0?-1:b)},L=D=>{A(a.produce(C,b=>{b.splice(D,1)}))},e=(D,b)=>{A(a.produce(C,N=>{N&&M.actionIndex!==void 0?Object.assign(N[M.actionIndex],D):N.push(D)})),b()},y=(D,b)=>{A(a.produce(C,N=>{N.splice(b,0,...N.splice(N.findIndex(S=>S.id===D),1))}))};return I.jsxs(I.Fragment,{children:[I.jsxs(xC,{label:g("maker.properties.buttons"),children:[I.jsx(i.ThemeProvider,{theme:pI.pagesTheme,children:(J=C.map)==null?void 0:J.call(C,(D,b)=>I.jsx(TC,{dragType:"SECTION_ACTION_DND_TYPE",dropType:"SECTION_ACTION_DND_TYPE",id:D.id,index:b,title:I.jsx(r.Action,{...D,size:"small",editing:!0}),move:(N,S)=>y(N,S),actions:I.jsxs(I.Fragment,{children:[I.jsx(i.Box,{mr:.35,onClick:()=>A(a.produce(C,N=>{N.splice(b+1,0,{...D,id:H.nextId()})})),children:I.jsx(Y.CopyAll,{})}),I.jsx(i.Box,{mr:.35,onClick:()=>O(D),children:I.jsx(Y.Settings,{})}),I.jsx(i.Box,{onClick:()=>L(b),children:I.jsx(Y.Delete,{})})]})},D.id))}),I.jsxs(i.Button,{onClick:j,startIcon:I.jsx(Y.Add,{}),fullWidth:!0,children:[g("common.add")," ",g("maker.properties.button")]})]}),I.jsx(rg,{ref:o,onSave:e,locale:s,locales:w})]})}const LI={align:"left",actions:[],title:"",description:"",icon:"",image:"",link:""};function Zg({children:C}){return C}m.forwardRef(function({onSave:s=()=>{},type:w,locale:A,locales:o},g){const{t:M}=X.useLocaleContext(),[j,{setFalse:O,setTrue:L}]=u.useBoolean(!1),e=u.useUpdate(),y=m.useRef({...LI,id:H.nextId()}),J=y.current,D=m.useCallback(d=>{y.current=typeof d=="function"?d(y.current):d,e()},[]),b=m.useCallback(()=>{O()},[O]),[N,S]=m.useState(-1);m.useImperativeHandle(g,()=>({open(d={},t=-1){D(a.produce(J,K=>{Object.assign(K,{...LI},d||{},{})})),L(),S(t===void 0?-1:t)},close(){b()}}));const[B,c]=m.useState(!1),z=m.useRef(null),T=async()=>{var d;try{c(!0),await((d=z.current)==null?void 0:d.submit()),s(y.current,b)}finally{c(!1)}},W=N>-1?lI:Zg;return I.jsxs(i.Dialog,{open:j,onClose:b,disableEnforceFocus:!0,children:[I.jsx(i.DialogTitle,{children:M("section.card.title")}),I.jsx(i.DialogContent,{sx:{width:500},children:I.jsxs(i.Box,{children:[I.jsx(i.Box,{my:2,children:I.jsx(W,{locale:A,locales:o,path:["list",N,"title"],value:J.title,onChange:d=>{N>-1&&typeof d=="string"&&D(a.produce(J,t=>{t.title=d}))},children:I.jsx(U.ConfigString,{label:M("maker.properties.title"),value:J.title,onChange:d=>{D(a.produce(J,t=>{t.title=d}))}})})}),I.jsx(i.Box,{my:2,children:I.jsx(W,{locale:A,locales:o,path:["list",N,"description"],value:J.description,onChange:d=>{N>-1&&typeof d=="string"&&D(a.produce(J,t=>{t.description=d}))},children:I.jsx(U.ConfigString,{label:M("maker.properties.description"),multiline:!0,minRows:3,value:J.description,onChange:d=>{D(a.produce(J,t=>{t.description=d}))}})})}),I.jsx(i.Box,{my:2,children:I.jsx(bI,{label:M("maker.properties.link"),value:J.link,onChange:d=>{D(a.produce(J,t=>{t.link=d}))}})}),I.jsx(i.Box,{my:2,children:I.jsx(U.ConfigString,{ref:z,label:M("maker.properties.image"),value:J.image,onChange:(d,t)=>{D(a.produce(J,K=>{K.image=d,K.imageMeta=t}))},showUploader:!0})}),w!=="simple"&&I.jsx(hg,{value:J.actions||[],onChange:d=>{D(a.produce(J,t=>{t.actions=d}))},locale:A,locales:o})]})}),I.jsxs(i.DialogActions,{children:[I.jsx(i.Button,{variant:"outlined",size:"small",onClick:b,children:M("common.cancel")}),I.jsx(RI.LoadingButton,{loading:B,variant:"contained",size:"small",onClick:T,children:M("maker.save")})]})]})});const Qg={type:"default",title:"Section CardList",description:"This is Section CardList",center:!0,dark:!1,background:"",col:3,gap:2,align:"top",textAlign:"left",iconSize:100,padding:"normal",list:[{id:H.nextId(),title:"Simplified Service Delivery",description:"Block Server's Service Gateway makes networking easy with access to load balancing, SSL termination, automatic and customizable URL mapping, and redirects.",image:"https://www.arcblock.io/static/ead0cabde7f2b7ff34db8f3e8ceca271/afc4b/builder.png"}]};function kg({componentId:C,locale:s,components:w}){const{state:{config:{defaultLocale:A}},localState:{customComponentPreviewerProperties:o}}=H.useStore(),g=H.useAllComponents();return I.jsx(bC.CustomComponentRenderer,{componentId:C,locale:s,dev:{mode:"draft",components:w||g,defaultLocale:A},properties:o})}const jI=260,Rg=5,tI="IGNORE_RENDER_BLOCKLET_TITLE",V=(C,s)=>C?Object.entries(C).map(([w,A])=>{var o,g,M;return{id:w,component:w,name:((o=A==null?void 0:A.data)==null?void 0:o.name)||((g=A==null?void 0:A.component)==null?void 0:g.name)||w,properties:(A==null?void 0:A.data)||A.component,previewImage:((M=A==null?void 0:A.data)==null?void 0:M.previewImage)||null,type:s,blockletId:A==null?void 0:A.blockletId,blockletTitle:A==null?void 0:A.blockletTitle}}):[],HI=[{id:"iframe",name:"Embed",properties:r.IFrameBlockDefaultProps},{id:"section",name:"Section",properties:r.SectionBlockDefaultProps},{id:"section-card-list",name:"SectionCardList",properties:Qg},{id:"toc",name:"Toc",properties:r.TocDefaultProps}].map(C=>({...C,type:"basic",component:C.id}));function EI({state:C,open:s,onClose:w,onSelect:A,defaultTab:o,title:g,componentGroups:M,components:j,multiple:O=!1,defaultSelected:L,emptyText:e}){var t;const{t:y}=X.useLocaleContext(),J=u.useReactive({selectedComponent:null,activeTab:o,searchQuery:""}),D=m.useMemo(()=>M||[{name:"basic",label:y("maker.components.basicGroup"),components:HI},C&&{name:"custom",label:y("maker.components.customGroup"),components:V(H.getCustomComponents(C),"custom")},C&&{name:"resource",label:y("maker.components.resourceGroup"),components:V(H.getResourceComponents(C),"resource")}].filter(Boolean),[M,y,C,s]),b=J.activeTab||((t=D[0])==null?void 0:t.name),N=()=>{J.selectedComponent&&(A(J.selectedComponent),w())},S=K=>{if(K){if(B(K)){O?J.selectedComponent=J.selectedComponent.filter(l=>l.id!==K.id):J.selectedComponent=null;return}if(O){const l=Array.isArray(J.selectedComponent)?J.selectedComponent:[],n=l.some(k=>k.id===K.id);J.selectedComponent=n?l.filter(k=>k.id!==K.id):[...l,K]}else J.selectedComponent=K}},B=K=>J.selectedComponent?O?J.selectedComponent.some(l=>l.id===K.id):J.selectedComponent.id===K.id:!1,c=(D==null?void 0:D.length)===0,z=m.useMemo(()=>{var l;const K=((l=D.find(n=>(n==null?void 0:n.name)===b))==null?void 0:l.components)||[];return J.searchQuery?K.filter(n=>n.name.toLowerCase().includes(J.searchQuery.toLowerCase())):K},[b,D,J.searchQuery]);m.useEffect(()=>{J.searchQuery="",s&&L?J.selectedComponent=O?Array.isArray(L)?L:[L]:L:J.selectedComponent=null},[s,L,O]);const T=(z==null?void 0:z.length)===0,W=e||y(b==="resource"?"maker.components.needAddResource":"maker.components.noComponents"),d=m.useMemo(()=>z?z.reduce((K,l)=>{const n=l.blockletId||tI,k=l.blockletTitle||y("maker.components.defaultGroup");return K[n]||(K[n]={title:k,components:[]}),K[n].components.push(l),K},{}):{},[z]);return I.jsxs(i.Dialog,{open:s,onClose:w,maxWidth:"lg",fullWidth:!0,PaperProps:{sx:{height:"80vh",maxHeight:"80vh",display:"flex",flexDirection:"column"}},children:[I.jsxs(i.DialogTitle,{className:"between",sx:{display:"flex",gap:2},children:[I.jsx(i.Box,{children:g||y("maker.components.addComponent")}),I.jsx(i.TextField,{size:"small",placeholder:y("maker.components.searchComponent"),value:J.searchQuery,onChange:K=>J.searchQuery=K.target.value,sx:{flex:1,maxWidth:350},InputProps:{startAdornment:I.jsx(R.Icon,{icon:"tabler:search",style:{marginRight:8,color:"rgba(0, 0, 0, 0.54)"}})}}),I.jsx(i.IconButton,{size:"small",onClick:w,children:I.jsx(R.Icon,{icon:"tabler:x"})})]}),I.jsxs(i.DialogContent,{sx:{display:"flex",gap:2,pl:"8px !important",flex:1,overflow:"hidden"},children:[!c&&I.jsx(i.Box,{sx:{width:150,borderRight:1,borderColor:"divider"},children:I.jsx(i.Tabs,{orientation:"vertical",value:b,onChange:(K,l)=>J.activeTab=l,sx:{"& .MuiTab-root":{alignItems:"flex-start",textAlign:"left",minHeight:48,py:1.5,px:2}},children:D.map((K,l)=>I.jsx(i.Tab,{label:K==null?void 0:K.label,value:K==null?void 0:K.name},l))})}),I.jsx(i.Box,{sx:{flex:1,overflowX:"hidden",overflowY:"auto",pr:1},children:T?I.jsx(BI.default,{children:W}):I.jsx(nI,{wrapperComponent:i.Grid,wrapperComponentProps:{container:!0,spacing:2,sx:T?{height:"100%"}:{}},groups:d,emptyText:W,renderItem:K=>{const l=B(K);return I.jsx(i.Grid,{item:!0,xs:12,md:6,lg:4,sx:{width:"100%","& .add-component-card":{boxShadow:"none",border:1,borderColor:l?"primary.main":"grey.200","& .check-container":{display:l?"flex":"none",position:"absolute",right:0,bottom:0,justifyContent:"flex-end",alignItems:"flex-end",width:30,height:30,overflow:"hidden",transition:"all 0.3s ease",color:"white","&::after":{position:"absolute",zIndex:0,display:"block",width:0,height:0,borderTop:"transparent solid 15px",borderLeft:"transparent solid 15px",borderBottom:n=>`solid 15px ${n.palette.primary.main}`,borderRight:n=>`solid 15px ${n.palette.primary.main}`,transition:"all 0.1s ease",content:'""'},"& .check-icon":{position:"relative",zIndex:2,margin:"0 1px 1px 0",fontSize:16,transition:"all 0.2s ease"}}}},children:I.jsxs(i.Card,{className:"add-component-card",sx:{position:"relative",width:"100%",cursor:"pointer"},onClick:()=>S(K),children:[I.jsx(i.CardMedia,{sx:{width:"100%",height:jI,overflow:"auto",position:"relative"},children:I.jsx(uI,{components:j,containerHeight:jI,component:K},K.id)}),I.jsx(i.CardContent,{sx:{bgcolor:"background.paper",borderTop:1,borderColor:l?"primary.main":"grey.200"},children:I.jsx(i.Typography,{variant:"body1",noWrap:!0,sx:{fontWeight:"bold"},children:K.name})}),I.jsx(i.Box,{className:"check-container",children:I.jsx(NC.default,{className:"check-icon"})})]})},K.id)}})})]}),I.jsxs(i.DialogActions,{sx:{borderTop:1,borderColor:"divider",p:2},children:[I.jsx(i.Button,{onClick:w,variant:"outlined",children:y("common.cancel")}),I.jsx(i.Button,{onClick:N,variant:"contained",disabled:!J.selectedComponent||O&&Array.isArray(J.selectedComponent)&&J.selectedComponent.length===0,children:O&&Array.isArray(J.selectedComponent)&&J.selectedComponent.length>0?y("common.addMultiple",{count:J.selectedComponent.length}):y("common.add")})]})]})}function uI({containerHeight:C,component:s,minScale:w=.1,components:A}){const{locale:o}=X.useLocaleContext(),g=u.useReactive({scale:1,shouldScroll:!1,isVisible:!1,hadInit:!1}),M=m.useRef(null),j=m.useRef(null),O=m.useRef(0),L=m.useRef(null);m.useEffect(()=>{const S=new IntersectionObserver(([B])=>{g.isVisible=B.isIntersecting},{root:null,rootMargin:"50px",threshold:0});return j.current&&S.observe(j.current),()=>S.disconnect()},[]),m.useEffect(()=>{const S=()=>{if(O.current+=1,O.current>Rg){B.disconnect();return}if(!s.previewImage&&M.current){const c=M.current.scrollHeight,z=C/c;z<w?(g.scale=w,g.shouldScroll=!0):z<1?(g.scale=z,g.shouldScroll=!1):(g.scale=1,g.shouldScroll=!1)}L.current&&clearTimeout(L.current),L.current=setTimeout(()=>{g.hadInit=!0},200)},B=new ResizeObserver(()=>{setTimeout(S,20)});return M.current&&g.isVisible&&B.observe(M.current),()=>{B.disconnect()}},[C,w,g.isVisible,s]);const{id:e,type:y,component:J,properties:D,previewImage:b}=s,N=m.useMemo(()=>g.isVisible?b?I.jsx(i.Box,{component:"img",loading:"lazy",sx:{objectFit:"cover",borderRadius:1,cursor:"pointer"},src:H.getImageAbsoluteUrl(b),alt:s.name,width:"100%",height:"100%"},e):y==="basic"?I.jsx(r.BlockRenderer,{id:e,type:J,section:D,config:{...D,locale:o,editing:!1,dev:{mode:"draft"}}},e):I.jsx(kg,{componentId:e,locale:o,components:A},e):null,[e,y,J,D,o,b,g.isVisible]);return I.jsx(i.Box,{ref:j,sx:{position:"relative",width:"100%",height:"100%",overflowX:"hidden",overflowY:g.shouldScroll?"auto":"hidden",transition:"all 0.3s ease"},children:I.jsxs(i.Box,{sx:{transform:`scale(${g.scale})`,transformOrigin:"top left",width:`${100/g.scale}%`,height:g.hadInit&&g.shouldScroll?"100%":`${100/g.scale}%`},children:[!g.hadInit&&I.jsx(i.Skeleton,{variant:"rectangular",width:"100%",height:"100%"}),I.jsx(i.Box,{ref:M,sx:{width:"100%",height:b?"100%":"auto",pointerEvents:"none",opacity:g.hadInit?1:0},children:N})]})})}function nI({groups:C,emptyText:s,renderItem:w,wrapperComponent:A=i.Box,wrapperComponentProps:o={display:"inline-flex",flexWrap:"wrap",gap:1}}){return I.jsx(i.Box,{children:Object.keys(C).length>0?Object.entries(C).map(([g,{title:M,components:j}])=>I.jsxs(i.Box,{mb:3,children:[g!==tI&&I.jsxs(i.Typography,{className:"blocklet-title",variant:"subtitle2",sx:{mb:2,fontWeight:500,color:"text.primary",display:"flex",alignItems:"center",gap:1},children:[I.jsx(i.Box,{component:"span",sx:{width:4,height:20,backgroundColor:"primary.main",borderRadius:1,display:"inline-block"}}),M]}),I.jsx(A,{...o,children:j.map(O=>w(O))})]},g)):I.jsx(BI.default,{children:s})})}exports.AddComponent=EI;exports.AutoScaledComponentRenderer=uI;exports.BASIC_COMPONENT_LIST=HI;exports.GroupedComponentsList=nI;exports.default=EI;exports.formatComponent=V;
378
+ `,Wg="primary",xg="contained",MI={id:H.nextId(),color:Wg,variant:xg,text:"",link:"",icon:"",size:"medium"};function Yg({children:C}){return C}const rg=m.forwardRef(function({locale:s,locales:w,onSave:A=()=>{}},o){const{t:g}=X.useLocaleContext(),[M,{setFalse:j,setTrue:O}]=u.useBoolean(!1),[L,e]=m.useState({...MI}),[y,J]=m.useState(-1),D=m.useCallback(()=>{j()},[j]);m.useImperativeHandle(o,()=>({open(S,B){e(a.produce(L,c=>{Object.assign(c,{...MI},{...S,link:(S==null?void 0:S.link)||(S==null?void 0:S.linkId)})})),O(),J(B===void 0?-1:B)},close(){D()}}));const b=()=>{A(L,D)},N=y>-1?lI:Yg;return I.jsxs(i.Dialog,{open:M,onClose:D,children:[I.jsx(i.DialogTitle,{children:g("maker.properties.button")}),I.jsxs(i.DialogContent,{sx:{width:350},children:[I.jsx(i.Box,{my:2,children:I.jsx(rC,{value:L.icon||"",onChange:S=>{e(a.produce(L,B=>{B.icon=S}))}})}),I.jsx(i.Box,{my:2,children:I.jsx(N,{locale:s,locales:w,path:["actions",y,"text"],value:L.text,onChange:S=>{y>-1&&typeof S=="string"&&e(a.produce(L,B=>{B.text=S}))},children:I.jsx(U.ConfigString,{label:g("maker.properties.title"),value:L.text,onChange:S=>{e(a.produce(L,B=>{B.text=S}))}})})}),I.jsx(i.Box,{my:2,children:I.jsx(G,{label:g("maker.properties.color"),options:[{value:"primary",title:"Primary"},{value:"secondary",title:"Secondary"},{value:"info",title:"Info"},{value:"success",title:"Success"},{value:"warning",title:"Warning"},{value:"error",title:"Error"}],value:L.color||"",onChange:S=>{e(a.produce(L,B=>{B.color=S}))}})}),I.jsx(i.Box,{my:2,children:I.jsx(G,{label:g("maker.properties.variant"),options:[{value:"contained",title:"Contained"},{value:"outlined",title:"Outlined"}],value:L.variant||"",onChange:S=>{e(a.produce(L,B=>{B.variant=S}))}})}),I.jsx(i.Box,{my:2,children:I.jsx(G,{label:g("maker.properties.size"),options:[{value:"large",title:"Large"},{value:"medium",title:"Medium"},{value:"small",title:"Small"}],value:L.size||"",onChange:S=>{e(a.produce(L,B=>{B.size=S}))}})}),I.jsx(i.Box,{my:2,children:I.jsx(bI,{label:g("maker.properties.link"),value:L.link,onChange:S=>{e(a.produce(L,B=>{B.link=S}))}})})]}),I.jsxs(i.DialogActions,{children:[I.jsx(i.Button,{variant:"outlined",size:"small",onClick:D,children:g("common.cancel")}),I.jsx(i.Button,{variant:"contained",size:"small",onClick:b,children:g("maker.save")})]})]})});function hg({value:C,locale:s,locales:w,onChange:A=()=>{}}){var J;const o=m.useRef(null),{t:g}=X.useLocaleContext(),M=u.useReactive({actionIndex:void 0}),j=()=>{var D;M.actionIndex=void 0,(D=o.current)==null||D.open({id:H.nextId()},-1)},O=D=>{var N;const b=C==null?void 0:C.findIndex(S=>S===D);M.actionIndex=b,(N=o.current)==null||N.open(D,b===void 0?-1:b)},L=D=>{A(a.produce(C,b=>{b.splice(D,1)}))},e=(D,b)=>{A(a.produce(C,N=>{N&&M.actionIndex!==void 0?Object.assign(N[M.actionIndex],D):N.push(D)})),b()},y=(D,b)=>{A(a.produce(C,N=>{N.splice(b,0,...N.splice(N.findIndex(S=>S.id===D),1))}))};return I.jsxs(I.Fragment,{children:[I.jsxs(xC,{label:g("maker.properties.buttons"),children:[I.jsx(i.ThemeProvider,{theme:pI.pagesTheme,children:(J=C.map)==null?void 0:J.call(C,(D,b)=>I.jsx(TC,{dragType:"SECTION_ACTION_DND_TYPE",dropType:"SECTION_ACTION_DND_TYPE",id:D.id,index:b,title:I.jsx(r.Action,{...D,size:"small",editing:!0}),move:(N,S)=>y(N,S),actions:I.jsxs(I.Fragment,{children:[I.jsx(i.Box,{mr:.35,onClick:()=>A(a.produce(C,N=>{N.splice(b+1,0,{...D,id:H.nextId()})})),children:I.jsx(Y.CopyAll,{})}),I.jsx(i.Box,{mr:.35,onClick:()=>O(D),children:I.jsx(Y.Settings,{})}),I.jsx(i.Box,{onClick:()=>L(b),children:I.jsx(Y.Delete,{})})]})},D.id))}),I.jsxs(i.Button,{onClick:j,startIcon:I.jsx(Y.Add,{}),fullWidth:!0,children:[g("common.add")," ",g("maker.properties.button")]})]}),I.jsx(rg,{ref:o,onSave:e,locale:s,locales:w})]})}const LI={align:"left",actions:[],title:"",description:"",icon:"",image:"",link:""};function Zg({children:C}){return C}m.forwardRef(function({onSave:s=()=>{},type:w,locale:A,locales:o},g){const{t:M}=X.useLocaleContext(),[j,{setFalse:O,setTrue:L}]=u.useBoolean(!1),e=u.useUpdate(),y=m.useRef({...LI,id:H.nextId()}),J=y.current,D=m.useCallback(d=>{y.current=typeof d=="function"?d(y.current):d,e()},[]),b=m.useCallback(()=>{O()},[O]),[N,S]=m.useState(-1);m.useImperativeHandle(g,()=>({open(d={},t=-1){D(a.produce(J,K=>{Object.assign(K,{...LI},d||{},{})})),L(),S(t===void 0?-1:t)},close(){b()}}));const[B,c]=m.useState(!1),z=m.useRef(null),T=async()=>{var d;try{c(!0),await((d=z.current)==null?void 0:d.submit()),s(y.current,b)}finally{c(!1)}},W=N>-1?lI:Zg;return I.jsxs(i.Dialog,{open:j,onClose:b,disableEnforceFocus:!0,children:[I.jsx(i.DialogTitle,{children:M("section.card.title")}),I.jsx(i.DialogContent,{sx:{width:500},children:I.jsxs(i.Box,{children:[I.jsx(i.Box,{my:2,children:I.jsx(W,{locale:A,locales:o,path:["list",N,"title"],value:J.title,onChange:d=>{N>-1&&typeof d=="string"&&D(a.produce(J,t=>{t.title=d}))},children:I.jsx(U.ConfigString,{label:M("maker.properties.title"),value:J.title,onChange:d=>{D(a.produce(J,t=>{t.title=d}))}})})}),I.jsx(i.Box,{my:2,children:I.jsx(W,{locale:A,locales:o,path:["list",N,"description"],value:J.description,onChange:d=>{N>-1&&typeof d=="string"&&D(a.produce(J,t=>{t.description=d}))},children:I.jsx(U.ConfigString,{label:M("maker.properties.description"),multiline:!0,minRows:3,value:J.description,onChange:d=>{D(a.produce(J,t=>{t.description=d}))}})})}),I.jsx(i.Box,{my:2,children:I.jsx(bI,{label:M("maker.properties.link"),value:J.link,onChange:d=>{D(a.produce(J,t=>{t.link=d}))}})}),I.jsx(i.Box,{my:2,children:I.jsx(U.ConfigString,{ref:z,label:M("maker.properties.image"),value:J.image,onChange:(d,t)=>{D(a.produce(J,K=>{K.image=d,K.imageMeta=t}))},showUploader:!0})}),w!=="simple"&&I.jsx(hg,{value:J.actions||[],onChange:d=>{D(a.produce(J,t=>{t.actions=d}))},locale:A,locales:o})]})}),I.jsxs(i.DialogActions,{children:[I.jsx(i.Button,{variant:"outlined",size:"small",onClick:b,children:M("common.cancel")}),I.jsx(RI.LoadingButton,{loading:B,variant:"contained",size:"small",onClick:T,children:M("maker.save")})]})]})});const Qg={type:"default",title:"Section CardList",description:"This is Section CardList",center:!0,dark:!1,background:"",col:3,gap:2,align:"top",textAlign:"left",iconSize:100,padding:"normal",list:[{id:H.nextId(),title:"Simplified Service Delivery",description:"Block Server's Service Gateway makes networking easy with access to load balancing, SSL termination, automatic and customizable URL mapping, and redirects.",image:"https://www.arcblock.io/static/ead0cabde7f2b7ff34db8f3e8ceca271/afc4b/builder.png"}]};function kg({componentId:C,locale:s,components:w}){const{state:{config:{defaultLocale:A}},localState:{customComponentPreviewerProperties:o}}=H.useStore(),g=H.useAllComponents();return I.jsx(bC.CustomComponentRenderer,{componentId:C,locale:s,dev:{mode:"draft",components:w||g,defaultLocale:A},properties:o})}const jI=260,Rg=5,tI="IGNORE_RENDER_BLOCKLET_TITLE",V=(C,s)=>C?Object.entries(C).map(([w,A])=>{var o,g,M;return{id:w,component:w,name:((o=A==null?void 0:A.data)==null?void 0:o.name)||((g=A==null?void 0:A.component)==null?void 0:g.name)||w,properties:(A==null?void 0:A.data)||A.component,previewImage:((M=A==null?void 0:A.data)==null?void 0:M.previewImage)||null,type:s,blockletId:A==null?void 0:A.blockletId,blockletTitle:A==null?void 0:A.blockletTitle}}):[],HI=[{id:"section",name:"Section",properties:r.SectionBlockDefaultProps},{id:"section-card-list",name:"SectionCardList",properties:Qg},{id:"toc",name:"Toc",properties:r.TocDefaultProps},{id:"iframe",name:"Embed",properties:r.IFrameBlockDefaultProps}].map(C=>({...C,type:"basic",component:C.id}));function EI({state:C,open:s,onClose:w,onSelect:A,defaultTab:o,title:g,componentGroups:M,components:j,multiple:O=!1,defaultSelected:L,emptyText:e}){var t;const{t:y}=X.useLocaleContext(),J=u.useReactive({selectedComponent:null,activeTab:o,searchQuery:""}),D=m.useMemo(()=>M||[{name:"basic",label:y("maker.components.basicGroup"),components:HI},C&&{name:"custom",label:y("maker.components.customGroup"),components:V(H.getCustomComponents(C),"custom")},C&&{name:"resource",label:y("maker.components.resourceGroup"),components:V(H.getResourceComponents(C),"resource")}].filter(Boolean),[M,y,C,s]),b=J.activeTab||((t=D[0])==null?void 0:t.name),N=()=>{J.selectedComponent&&(A(J.selectedComponent),w())},S=K=>{if(K){if(B(K)){O?J.selectedComponent=J.selectedComponent.filter(l=>l.id!==K.id):J.selectedComponent=null;return}if(O){const l=Array.isArray(J.selectedComponent)?J.selectedComponent:[],n=l.some(k=>k.id===K.id);J.selectedComponent=n?l.filter(k=>k.id!==K.id):[...l,K]}else J.selectedComponent=K}},B=K=>J.selectedComponent?O?J.selectedComponent.some(l=>l.id===K.id):J.selectedComponent.id===K.id:!1,c=(D==null?void 0:D.length)===0,z=m.useMemo(()=>{var l;const K=((l=D.find(n=>(n==null?void 0:n.name)===b))==null?void 0:l.components)||[];return J.searchQuery?K.filter(n=>n.name.toLowerCase().includes(J.searchQuery.toLowerCase())):K},[b,D,J.searchQuery]);m.useEffect(()=>{J.searchQuery="",s&&L?J.selectedComponent=O?Array.isArray(L)?L:[L]:L:J.selectedComponent=null},[s,L,O]);const T=(z==null?void 0:z.length)===0,W=e||y(b==="resource"?"maker.components.needAddResource":"maker.components.noComponents"),d=m.useMemo(()=>z?z.reduce((K,l)=>{const n=l.blockletId||tI,k=l.blockletTitle||y("maker.components.defaultGroup");return K[n]||(K[n]={title:k,components:[]}),K[n].components.push(l),K},{}):{},[z]);return I.jsxs(i.Dialog,{open:s,onClose:w,maxWidth:"lg",fullWidth:!0,PaperProps:{sx:{height:"80vh",maxHeight:"80vh",display:"flex",flexDirection:"column"}},children:[I.jsxs(i.DialogTitle,{className:"between",sx:{display:"flex",gap:2},children:[I.jsx(i.Box,{children:g||y("maker.components.addComponent")}),I.jsx(i.TextField,{size:"small",placeholder:y("maker.components.searchComponent"),value:J.searchQuery,onChange:K=>J.searchQuery=K.target.value,sx:{flex:1,maxWidth:350},InputProps:{startAdornment:I.jsx(R.Icon,{icon:"tabler:search",style:{marginRight:8,color:"rgba(0, 0, 0, 0.54)"}})}}),I.jsx(i.IconButton,{size:"small",onClick:w,children:I.jsx(R.Icon,{icon:"tabler:x"})})]}),I.jsxs(i.DialogContent,{sx:{display:"flex",gap:2,pl:"8px !important",flex:1,overflow:"hidden"},children:[!c&&I.jsx(i.Box,{sx:{width:150,borderRight:1,borderColor:"divider"},children:I.jsx(i.Tabs,{orientation:"vertical",value:b,onChange:(K,l)=>J.activeTab=l,sx:{"& .MuiTab-root":{alignItems:"flex-start",textAlign:"left",minHeight:48,py:1.5,px:2}},children:D.map((K,l)=>I.jsx(i.Tab,{label:K==null?void 0:K.label,value:K==null?void 0:K.name},l))})}),I.jsx(i.Box,{sx:{flex:1,overflowX:"hidden",overflowY:"auto",pr:1},children:T?I.jsx(BI.default,{children:W}):I.jsx(nI,{wrapperComponent:i.Grid,wrapperComponentProps:{container:!0,spacing:2,sx:T?{height:"100%"}:{}},groups:d,emptyText:W,renderItem:K=>{const l=B(K);return I.jsx(i.Grid,{item:!0,xs:12,md:6,lg:4,sx:{width:"100%","& .add-component-card":{boxShadow:"none",border:1,borderColor:l?"primary.main":"grey.200","& .check-container":{display:l?"flex":"none",position:"absolute",right:0,bottom:0,justifyContent:"flex-end",alignItems:"flex-end",width:30,height:30,overflow:"hidden",transition:"all 0.3s ease",color:"white","&::after":{position:"absolute",zIndex:0,display:"block",width:0,height:0,borderTop:"transparent solid 15px",borderLeft:"transparent solid 15px",borderBottom:n=>`solid 15px ${n.palette.primary.main}`,borderRight:n=>`solid 15px ${n.palette.primary.main}`,transition:"all 0.1s ease",content:'""'},"& .check-icon":{position:"relative",zIndex:2,margin:"0 1px 1px 0",fontSize:16,transition:"all 0.2s ease"}}}},children:I.jsxs(i.Card,{className:"add-component-card",sx:{position:"relative",width:"100%",cursor:"pointer"},onClick:()=>S(K),children:[I.jsx(i.CardMedia,{sx:{width:"100%",height:jI,overflow:"auto",position:"relative"},children:I.jsx(uI,{components:j,containerHeight:jI,component:K},K.id)}),I.jsx(i.CardContent,{sx:{bgcolor:"background.paper",borderTop:1,borderColor:l?"primary.main":"grey.200"},children:I.jsx(i.Typography,{variant:"body1",noWrap:!0,sx:{fontWeight:"bold"},children:K.name})}),I.jsx(i.Box,{className:"check-container",children:I.jsx(NC.default,{className:"check-icon"})})]})},K.id)}})})]}),I.jsxs(i.DialogActions,{sx:{borderTop:1,borderColor:"divider",p:2},children:[I.jsx(i.Button,{onClick:w,variant:"outlined",children:y("common.cancel")}),I.jsx(i.Button,{onClick:N,variant:"contained",disabled:!J.selectedComponent||O&&Array.isArray(J.selectedComponent)&&J.selectedComponent.length===0,children:O&&Array.isArray(J.selectedComponent)&&J.selectedComponent.length>0?y("common.addMultiple",{count:J.selectedComponent.length}):y("common.add")})]})]})}function uI({containerHeight:C,component:s,minScale:w=.1,components:A}){const{locale:o}=X.useLocaleContext(),g=u.useReactive({scale:1,shouldScroll:!1,isVisible:!1,hadInit:!1}),M=m.useRef(null),j=m.useRef(null),O=m.useRef(0),L=m.useRef(null);m.useEffect(()=>{const S=new IntersectionObserver(([B])=>{g.isVisible=B.isIntersecting},{root:null,rootMargin:"50px",threshold:0});return j.current&&S.observe(j.current),()=>S.disconnect()},[]),m.useEffect(()=>{const S=()=>{if(O.current+=1,O.current>Rg){B.disconnect();return}if(!s.previewImage&&M.current){const c=M.current.scrollHeight,z=C/c;z<w?(g.scale=w,g.shouldScroll=!0):z<1?(g.scale=z,g.shouldScroll=!1):(g.scale=1,g.shouldScroll=!1)}L.current&&clearTimeout(L.current),L.current=setTimeout(()=>{g.hadInit=!0},200)},B=new ResizeObserver(()=>{setTimeout(S,20)});return M.current&&g.isVisible&&B.observe(M.current),()=>{B.disconnect()}},[C,w,g.isVisible,s]);const{id:e,type:y,component:J,properties:D,previewImage:b}=s,N=m.useMemo(()=>g.isVisible?b?I.jsx(i.Box,{component:"img",loading:"lazy",sx:{objectFit:"cover",borderRadius:1,cursor:"pointer"},src:H.getImageAbsoluteUrl(b),alt:s.name,width:"100%",height:"100%"},e):y==="basic"?I.jsx(r.BlockRenderer,{id:e,type:J,section:D,config:{...D,locale:o,editing:!1,dev:{mode:"draft"}}},e):I.jsx(kg,{componentId:e,locale:o,components:A},e):null,[e,y,J,D,o,b,g.isVisible]);return I.jsx(i.Box,{ref:j,sx:{position:"relative",width:"100%",height:"100%",overflowX:"hidden",overflowY:g.shouldScroll?"auto":"hidden",transition:"all 0.3s ease"},children:I.jsxs(i.Box,{sx:{transform:`scale(${g.scale})`,transformOrigin:"top left",width:`${100/g.scale}%`,height:g.hadInit&&g.shouldScroll?"100%":`${100/g.scale}%`},children:[!g.hadInit&&I.jsx(i.Skeleton,{variant:"rectangular",width:"100%",height:"100%"}),I.jsx(i.Box,{ref:M,sx:{width:"100%",height:b?"100%":"auto",pointerEvents:"none",opacity:g.hadInit?1:0},children:N})]})})}function nI({groups:C,emptyText:s,renderItem:w,wrapperComponent:A=i.Box,wrapperComponentProps:o={display:"inline-flex",flexWrap:"wrap",gap:1}}){return I.jsx(i.Box,{children:Object.keys(C).length>0?Object.entries(C).map(([g,{title:M,components:j}])=>I.jsxs(i.Box,{mb:3,children:[g!==tI&&I.jsxs(i.Typography,{className:"blocklet-title",variant:"subtitle2",sx:{mb:2,fontWeight:500,color:"text.primary",display:"flex",alignItems:"center",gap:1},children:[I.jsx(i.Box,{component:"span",sx:{width:4,height:20,backgroundColor:"primary.main",borderRadius:1,display:"inline-block"}}),M]}),I.jsx(A,{...o,children:j.map(O=>w(O))})]},g)):I.jsx(BI.default,{children:s})})}exports.AddComponent=EI;exports.AutoScaledComponentRenderer=uI;exports.BASIC_COMPONENT_LIST=HI;exports.GroupedComponentsList=nI;exports.default=EI;exports.formatComponent=V;
@@ -1,4 +1,4 @@
1
- "use strict";var Bt=Object.create;var nt=Object.defineProperty;var Ct=Object.getOwnPropertyDescriptor;var Nt=Object.getOwnPropertyNames;var It=Object.getPrototypeOf,Pt=Object.prototype.hasOwnProperty;var Rt=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Nt(e))!Pt.call(t,r)&&r!==n&&nt(t,r,{get:()=>e[r],enumerable:!(i=Ct(e,r))||i.enumerable});return t};var rt=(t,e,n)=>(n=t!=null?Bt(It(t)):{},Rt(e||!t||!t.__esModule?nt(n,"default",{value:t,enumerable:!0}):n,t));const o=require("react/jsx-runtime");require("@mui/icons-material");const m=require("@mui/material"),f=require("react"),Tt=require("lodash/keyBy"),j=require("./state-DDwYX2mu.js"),U=require("@blocklet/ai-runtime/components"),Wt=require("@mui/utils"),zt=require("lodash/pick"),qt=require("react-error-boundary"),pt=require("@blocklet/pages-kit/contexts/color"),b=require("@emotion/css"),V=require("@iconify/react"),Et=require("react-markdown"),Lt=require("remark-gfm"),At=require("@mui/lab"),_=require("@arcblock/ux/lib/Theme"),Ot=require("@arcblock/react-hooks/lib/useBrowser"),Ut=require("@arcblock/ux/lib/Colors"),G=require("@blocklet/pages-kit/components"),it=require("@blocklet/pages-kit/utils/style"),Ft=require("@mui/material/useMediaQuery"),Mt=require("lodash/omit"),ht=require("@iconify-icon/react"),Dt=require("@arcblock/ux/lib/Screenshot"),K=require("react-router-dom"),Vt=require("@arcblock/ux/lib/Button"),Ht=require("is-uri"),F=require("pathe"),T=require("ufo"),Yt=require("@blocklet/embed/message"),Jt=require("ahooks"),Gt=require("lodash/isEqual"),Kt=require("@blocklet/embed/react"),Xt=require("react-twitter-embed"),st=require("react-use"),$=t=>t&&t.__esModule?t:{default:t},ft=$(f),D=$(Tt),X=$(zt),Qt=$(Et),Zt=$(Lt),te=$(Ot),at=$(Ut),gt=$(Ft),C=$(Mt),ee=$(Dt),oe=$(Vt),H=$(Ht),ne=$(Gt),yt="{{CUSTOM_VALUE}}",re=[{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}}}],ie=[{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}}}],se=[{title:"None",value:"none",sx:{px:0}},{title:"Small",value:"small",sx:{px:{xs:2.5,md:4,lg:4,xl:6}}},{title:"Normal",value:"normal",sx:{px:{xs:5,md:7.5,lg:10,xl:12.5}}},{title:"Large",value:"large",sx:{px:{xs:7.5,md:10,lg:12.5,xl:15}}}],M=(t,e,n)=>{const i=t.breakpoints.values[n];return`${e}${i?` (${i}px)`:""}`},ae=[{title:"100%",value:"full",sx:{maxWidth:"100%"}},{title:t=>M(t,"Small","sm"),value:"sm",sx:{maxWidth:t=>t.breakpoints.values.sm,width:"100%",mx:"auto"}},{title:t=>M(t,"Normal","md"),value:"md",sx:{maxWidth:t=>t.breakpoints.values.md,width:"100%",mx:"auto"}},{title:t=>M(t,"Large","lg"),value:"lg",sx:{maxWidth:t=>t.breakpoints.values.lg,width:"100%",mx:"auto"}},{title:t=>M(t,"Extra Large","xl"),value:"xl",sx:{maxWidth:t=>t.breakpoints.values.xl,width:"100%",mx:"auto"}},{title:"Custom",value:"custom",sx:{maxWidth:yt,width:"100%",mx:"auto"}}],le=D.default(re,"value"),ce=D.default(ie,"value"),de=D.default(se,"value"),ue=D.default(ae,"value"),me=new Map([["baseSectionPaddingY",le],["maxWidth",ue],["paddingY",ce],["paddingX",de]]);function bt(t){var l;const{type:e,value:n,format:i="sx",defaultValue:r=null}=t,s=me.get(e);if(!s)return r;const c=n.startsWith("custom:"),a=c?"custom":n;if(s!=null&&s[a]&&((l=s==null?void 0:s[a])!=null&&l[i])){const d=s[a][i];if(c){const u=n.replace("custom:","");try{return JSON.parse(JSON.stringify(d||{}).replaceAll(yt,u))}catch{}}return d}return r}const wt=f.createContext({page:null,getPageMeta:()=>({}),getPageMetaStyle:()=>({})});function xe(){return f.useContext(wt)}function pe({page:t,children:e,defaultLocale:n="en",currentLocale:i}){const r=f.useMemo(()=>t?JSON.parse(JSON.stringify(t)):null,[JSON.stringify(t)]),s=f.useCallback(()=>{var d;if(!r)return{};const l=i||n;return((d=r.locales)==null?void 0:d[l])??{}},[r,n,i]),c=f.useCallback((l="sx")=>{const d=s();return!d||!d.style?{}:Object.entries(d.style||{}).reduce((x,[h,p])=>{if(!p)return x;const y=`${h}Custom`;d.style[y];const w=bt({type:h,value:p,format:l});return w?{...x,...w}:x},{})},[s]),a=f.useMemo(()=>({page:r,getPageMeta:s,getPageMetaStyle:c}),[r,s,c]);return o.jsx(wt.Provider,{value:a,children:e})}const he=f.forwardRef(({onClick:t,...e},n)=>{const[i,r]=f.useState(!1),s=f.useCallback(async c=>{try{r(!0),await(t==null?void 0:t(c))}finally{r(!1)}},[t]);return o.jsx(At.LoadingButton,{ref:n,...e,loading:e.loading||i,onClick:s})});function fe({tip:t,tipSucceed:e,title:n,titleSucceed:i,icon:r,iconSucceed:s,autoReset:c,placement:a="top",...l}){const[d,u]=f.useState(!1),[x,h]=f.useState(),p=f.useRef(),y=()=>{h(void 0),c&&(p.current=window.setTimeout(()=>{u(!1)},3e3))},w=()=>{clearTimeout(p.current)},g=d?s:r,k=x?o.jsx(m.Box,{color:"error",children:x.message}):d&&e||t,v=d?i:n;return o.jsx(m.Tooltip,{title:k,disableInteractive:!0,placement:a,onClose:y,onOpen:w,children:o.jsx("span",{children:o.jsx(he,{startIcon:g&&(typeof g=="string"?o.jsx(V.Icon,{icon:g}):g),loadingPosition:g?"start":void 0,...l,onClick:async B=>{if(l.onClick)try{await l.onClick(B),u(!0)}catch(N){h(N)}},children:v})})})}const ge=ft.default.lazy(()=>import("react-syntax-highlighter").then(t=>({default:t.Prism}))),ye=m.styled(t=>o.jsx(Qt.default,{...t,remarkPlugins:[Zt.default],components:{pre:be,code:({node:e,inline:n,className:i,children:r,...s})=>{if(!r)return null;const c=/language-(\w+)/.exec(i||"");return n?o.jsx(m.Box,{component:"code",className:i,...s,children:r}):o.jsx(m.Box,{component:ge,language:c==null?void 0:c[1],...s,sx:{borderRadius:1},children:String(r).replace(/\n$/,"")})},table:({className:e,children:n})=>o.jsx(m.Box,{sx:{overflow:"auto",my:1},children:o.jsx("table",{className:e,children:n})})}}))`
1
+ "use strict";var Bt=Object.create;var nt=Object.defineProperty;var Ct=Object.getOwnPropertyDescriptor;var Nt=Object.getOwnPropertyNames;var It=Object.getPrototypeOf,Pt=Object.prototype.hasOwnProperty;var Rt=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Nt(e))!Pt.call(t,r)&&r!==n&&nt(t,r,{get:()=>e[r],enumerable:!(i=Ct(e,r))||i.enumerable});return t};var rt=(t,e,n)=>(n=t!=null?Bt(It(t)):{},Rt(e||!t||!t.__esModule?nt(n,"default",{value:t,enumerable:!0}):n,t));const o=require("react/jsx-runtime");require("@mui/icons-material");const m=require("@mui/material"),f=require("react"),Tt=require("lodash/keyBy"),j=require("./state-DDwYX2mu.js"),U=require("@blocklet/ai-runtime/components"),Wt=require("@mui/utils"),zt=require("lodash/pick"),qt=require("react-error-boundary"),xt=require("@blocklet/pages-kit/contexts/color"),b=require("@emotion/css"),V=require("@iconify/react"),Et=require("react-markdown"),Lt=require("remark-gfm"),At=require("@mui/lab"),_=require("@arcblock/ux/lib/Theme"),Ot=require("@arcblock/react-hooks/lib/useBrowser"),Ut=require("@arcblock/ux/lib/Colors"),G=require("@blocklet/pages-kit/components"),it=require("@blocklet/pages-kit/utils/style"),Ft=require("@mui/material/useMediaQuery"),Mt=require("lodash/omit"),ht=require("@iconify-icon/react"),Dt=require("@arcblock/ux/lib/Screenshot"),K=require("react-router-dom"),Vt=require("@arcblock/ux/lib/Button"),Ht=require("is-uri"),F=require("pathe"),T=require("ufo"),Yt=require("@blocklet/embed/message"),Jt=require("ahooks"),Gt=require("lodash/isEqual"),Kt=require("@blocklet/embed/react"),Xt=require("react-twitter-embed"),st=require("react-use"),$=t=>t&&t.__esModule?t:{default:t},ft=$(f),D=$(Tt),X=$(zt),Qt=$(Et),Zt=$(Lt),te=$(Ot),at=$(Ut),gt=$(Ft),C=$(Mt),ee=$(Dt),oe=$(Vt),H=$(Ht),ne=$(Gt),yt="{{CUSTOM_VALUE}}",re=[{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}}}],ie=[{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}}}],se=[{title:"None",value:"none",sx:{px:0}},{title:"Small",value:"small",sx:{px:{xs:2.5,md:4,lg:4,xl:6}}},{title:"Normal",value:"normal",sx:{px:{xs:5,md:7.5,lg:10,xl:12.5}}},{title:"Large",value:"large",sx:{px:{xs:7.5,md:10,lg:12.5,xl:15}}}],M=(t,e,n)=>{const i=t.breakpoints.values[n];return`${e}${i?` (${i}px)`:""}`},ae=[{title:"100%",value:"full",sx:{maxWidth:"100%"}},{title:t=>M(t,"Small","sm"),value:"sm",sx:{maxWidth:t=>t.breakpoints.values.sm,width:"100%",mx:"auto"}},{title:t=>M(t,"Normal","md"),value:"md",sx:{maxWidth:t=>t.breakpoints.values.md,width:"100%",mx:"auto"}},{title:t=>M(t,"Large","lg"),value:"lg",sx:{maxWidth:t=>t.breakpoints.values.lg,width:"100%",mx:"auto"}},{title:t=>M(t,"Extra Large","xl"),value:"xl",sx:{maxWidth:t=>t.breakpoints.values.xl,width:"100%",mx:"auto"}},{title:"Custom",value:"custom",sx:{maxWidth:yt,width:"100%",mx:"auto"}}],le=D.default(re,"value"),ce=D.default(ie,"value"),de=D.default(se,"value"),ue=D.default(ae,"value"),me=new Map([["baseSectionPaddingY",le],["maxWidth",ue],["paddingY",ce],["paddingX",de]]);function bt(t){var l;const{type:e,value:n,format:i="sx",defaultValue:r=null}=t,s=me.get(e);if(!s)return r;const c=n.startsWith("custom:"),a=c?"custom":n;if(s!=null&&s[a]&&((l=s==null?void 0:s[a])!=null&&l[i])){const d=s[a][i];if(c){const u=n.replace("custom:","");try{return JSON.parse(JSON.stringify(d||{}).replaceAll(yt,u))}catch{}}return d}return r}const wt=f.createContext({page:null,getPageMeta:()=>({}),getPageMetaStyle:()=>({})});function pe(){return f.useContext(wt)}function xe({page:t,children:e,defaultLocale:n="en",currentLocale:i}){const r=f.useMemo(()=>t?JSON.parse(JSON.stringify(t)):null,[JSON.stringify(t)]),s=f.useCallback(()=>{var d;if(!r)return{};const l=i||n;return((d=r.locales)==null?void 0:d[l])??{}},[r,n,i]),c=f.useCallback((l="sx")=>{const d=s();return!d||!d.style?{}:Object.entries(d.style||{}).reduce((p,[h,x])=>{if(!x)return p;const y=`${h}Custom`;d.style[y];const w=bt({type:h,value:x,format:l});return w?{...p,...w}:p},{})},[s]),a=f.useMemo(()=>({page:r,getPageMeta:s,getPageMetaStyle:c}),[r,s,c]);return o.jsx(wt.Provider,{value:a,children:e})}const he=f.forwardRef(({onClick:t,...e},n)=>{const[i,r]=f.useState(!1),s=f.useCallback(async c=>{try{r(!0),await(t==null?void 0:t(c))}finally{r(!1)}},[t]);return o.jsx(At.LoadingButton,{ref:n,...e,loading:e.loading||i,onClick:s})});function fe({tip:t,tipSucceed:e,title:n,titleSucceed:i,icon:r,iconSucceed:s,autoReset:c,placement:a="top",...l}){const[d,u]=f.useState(!1),[p,h]=f.useState(),x=f.useRef(),y=()=>{h(void 0),c&&(x.current=window.setTimeout(()=>{u(!1)},3e3))},w=()=>{clearTimeout(x.current)},g=d?s:r,k=p?o.jsx(m.Box,{color:"error",children:p.message}):d&&e||t,v=d?i:n;return o.jsx(m.Tooltip,{title:k,disableInteractive:!0,placement:a,onClose:y,onOpen:w,children:o.jsx("span",{children:o.jsx(he,{startIcon:g&&(typeof g=="string"?o.jsx(V.Icon,{icon:g}):g),loadingPosition:g?"start":void 0,...l,onClick:async B=>{if(l.onClick)try{await l.onClick(B),u(!0)}catch(N){h(N)}},children:v})})})}const ge=ft.default.lazy(()=>import("react-syntax-highlighter").then(t=>({default:t.Prism}))),ye=m.styled(t=>o.jsx(Qt.default,{...t,remarkPlugins:[Zt.default],components:{pre:be,code:({node:e,inline:n,className:i,children:r,...s})=>{if(!r)return null;const c=/language-(\w+)/.exec(i||"");return n?o.jsx(m.Box,{component:"code",className:i,...s,children:r}):o.jsx(m.Box,{component:ge,language:c==null?void 0:c[1],...s,sx:{borderRadius:1},children:String(r).replace(/\n$/,"")})},table:({className:e,children:n})=>o.jsx(m.Box,{sx:{overflow:"auto",my:1},children:o.jsx("table",{className:e,children:n})})}}))`
2
2
  width: 100%;
3
3
  overflow: hidden;
4
4
  word-break: break-word;
@@ -100,6 +100,7 @@
100
100
  line-height: 20px;
101
101
  }
102
102
  .section__title {
103
+ color: ${({theme:t})=>t.palette.text.primary};
103
104
  a {
104
105
  color: ${({theme:t})=>t.palette.primary.main};
105
106
  }
@@ -109,6 +110,7 @@
109
110
  }
110
111
  }
111
112
  .section__description {
113
+ color: ${({theme:t})=>t.palette.text.primary};
112
114
  margin-bottom: 4vw;
113
115
  margin-top: 0;
114
116
  a {
@@ -130,7 +132,7 @@
130
132
  margin-bottom: 40px;
131
133
  }
132
134
  }
133
- `;function z({title:t,description:e,descriptionMarkdown:n,actions:i,className:r="",classes:s={},prepend:c,append:a,level:l=2,tag:d,badge:u,center:x,logo:h,titleAppearance:p,descriptionAppearance:y,...w}){const g=pt.useColorConvert();if(!t&&!e&&!i&&!u&&!d&&!c&&!a&&!h)return null;const k=Math.max(Math.min(5,l+1),1),v={1:"xl:!text-3xl lg:!text-2xl md:!text-xl",2:"xl:!text-2xl lg:!text-xl md:!text-lg",3:"xl:!text-2xl lg:!text-xl md:!text-lg",4:"xl:!text-xl lg:!text-lg md:!text-md",5:"xl:!text-lg md:!text-md sm:!text-sm",6:"!text-sm"},B=l===0?"big":`h${k}`,N=l===0;return o.jsxs(je,{className:b.cx("base-info","lg:text-left",x&&"!text-center",r),...w,children:[c&&o.jsx("div",{children:c}),(d||u)&&o.jsx("div",{className:b.cx("section__tag",(s==null?void 0:s.tag)||(s==null?void 0:s.badge)),children:d||u}),h&&o.jsx("img",{className:"w-[120px] m-auto mb-8",src:h,alt:"info",loading:"lazy"}),t&&o.jsx(m.Typography,{sx:{whiteSpace:"pre-wrap",mb:e?"2vw":0,...(p==null?void 0:p.color)&&{color:`${g(p.color)} !important`}},className:b.cx("section__title","text-gray-800","dark:text-gray-50",s.title,"page-kit-section__title",N?"":"section__title_non_big"),component:`h${Math.max(l,1)}`,variant:B,children:t}),e&&(n?o.jsx(m.Box,{sx:{...(y==null?void 0:y.color)&&{color:`${g(y.color)} !important`}},component:ye,className:b.cx("section__description","text-gray-800","dark:text-gray-100",v[k],s.description,"page-kit-section__description"),children:e}):o.jsx(m.Typography,{sx:{whiteSpace:"pre-wrap",...(y==null?void 0:y.color)&&{color:`${g(y.color)} !important`}},className:b.cx("section__description","text-gray-800","dark:text-gray-100",v[k],s.description,"page-kit-section__description"),component:"div",variant:"body1",gutterBottom:!0,children:e})),o.jsx(R,{actions:i,center:x,className:"mt-8"}),a&&o.jsx("div",{children:a})]})}const q=["actions","append","badge","tag","center","description","descriptionMarkdown","level","logo","prepend","title","titleAppearance","descriptionAppearance"];function jt(t){if(t.type===f.Fragment){const n=(t.props.children||[]).filter(i=>f.isValidElement(i));return n.length===1?jt(n[0]):n.length>1}return Array.isArray(t)}const I="&>*";function Q({children:t,col:e,gap:n,className:i,align:r,sx:s,type:c,...a}={children:null,className:"",col:3,gap:void 0,sx:{},align:"center",type:"default"}){const l=_.useTheme(),d=Number(Math.floor(100/e*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"},x=u[r]||u.center;let p=n??({2:6,3:4,4:4,5:3,6:3}[e]||0);jt(t)||(p=0);const w=(e-1)*p/e;let g={...s,gap:`${p}rem`};const k={[I]:{width:"100%"}},v={},B={},N={};switch(k.gap="1rem",v.gap=`${p/2}rem`,e){case 3:case 4:v[I]={width:`calc(50% - ${p/2}rem)`};break;case 5:case 6:k[I]={width:`calc(50% - ${p/2/2}rem)`},v[I]={width:`calc(50% - ${p/2/2}rem)`},B[I]={width:`calc(33.33% - ${p*2/3}rem)`};break}return g[I]={width:`calc(${d}% - ${w}rem)`},g[`@media (max-width: ${l.breakpoints.values.xl}px)`]=N,g[`@media (max-width: ${l.breakpoints.values.lg}px)`]=B,g[`@media (max-width: ${l.breakpoints.values.md}px)`]=v,g[`@media (max-width: ${l.breakpoints.values.sm}px)`]=k,c==="wall"&&(g={...s,gap:`${p}rem`},g[I]={width:`calc(${d}% - ${w}rem)`},k[I]={width:`calc(45% - ${p/2/2}rem)`},g[`@media (max-width: ${l.breakpoints.values.sm}px)`]=k),o.jsx(m.Box,{className:b.cx("flex flex-wrap flex-row h-full",x,i),sx:g,...a,children:t})}function ve(){const t=navigator.userAgent.toLowerCase();return t.includes("safari")&&!t.includes("chrome")}function ke(t=""){if(t.startsWith("data:image/svg+xml,"))return!0;const e=/^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/,n=/^(\/|\.\/|\.\.\/)(?:[^/]+\/)*[^/]+$/;return e.test(t)||n.test(t)}function Y(t){return(t==null?void 0:t.endsWith(".mp4"))||(t==null?void 0:t.endsWith(".m4v"))||(t==null?void 0:t.endsWith(".webm"))}function _e(t){return t!=null&&t.endsWith(".mp4")||t!=null&&t.endsWith(".m4v")?"video/mp4":t!=null&&t.endsWith(".webm")?"video/webm":void 0}function $e(t){let e={};return typeof t=="string"?it.isGradient(t)?e.image=t:(e.image=j.getImageAbsoluteUrl(t),it.isColorString(t)&&(e.color=t,e.image="")):e=t,e}function Se(){const[t,e]=f.useState(Date.now());return f.useEffect(()=>{const n=()=>{e(Date.now())};return document.addEventListener("visibilitychange",n),()=>{document.removeEventListener("visibilitychange",n)}},[]),t}function lt(t,e,n,i,r){let s=null;const{color:c="",image:a}=$e(e);return a&&ke(a)?(delete n.backgroundColor,!(t.mobile.apple.device||ve())&&Y(a)?s=o.jsx(m.Box,{component:"video",className:"section-bg",width:"100%",autoPlay:!0,loop:!0,muted:!0,controls:!1,playsInline:!0,poster:j.autoResizeImage(j.getImageAbsoluteUrl(i),1200,"quality"),src:Y(a)?a:j.autoResizeImage(a,1200,"quality"),sx:{position:"absolute",zIndex:-9999,right:0,left:0,top:0,width:"100%",height:"100%",objectFit:"cover"}},a):s=o.jsx(G.ResponsiveImage,{src: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"}},r||a)):a?n.backgroundImage=`${a} !important`:c&&(n.backgroundColor=`${c} !important`),s}function Be({autoWidth:t,children:e,...n}){return t?o.jsx(m.Box,{display:"flex",...n,children:e}):o.jsx(m.Container,{...n,children:e})}function E({dark:t=!1,children:e,className:n,sx:i={},boxed:r={show:!1},padding:s="normal",boxProps:c,type:a,...l}){const d={...i},u=gt.default(p=>p.breakpoints.down("md"));t&&(d.color=at.default.common.white,d.backgroundColor=`${at.default.grey[900]} !important`),r.show&&(d.display="flex");const x=f.useMemo(()=>!Number(l.boxMaxWidth)||u?{width:"100%"}:a==="wall"&&l.boxMaxWidth?{maxWidth:`${l.boxMaxWidth}px !important`,width:"100%"}:{width:"100%"},[l.boxMaxWidth,u,a]),h=bt({type:"baseSectionPaddingY",value:s||"normal",defaultValue:""});return o.jsx(Ce,{component:"section",styles:{...d,...h},className:b.cx("base-section","px-2 md:px-5 lg:px-5 xl:px-10",n,{dark:t}),...C.default(l,"hoverStyle","boxMaxWidth","embedUrl","autoWidth","paddingXY","iframeHeight","titleAppearance","descriptionAppearance"),children:o.jsx(Be,{autoWidth:l==null?void 0:l.autoWidth,className:b.cx("section-content h-full"),sx:x,children:r.show?o.jsx(vt,{...c,boxed:r,children:e}):e})})}function vt({background:t="",backgroundVideoPoster:e,children:n,sx:i={},boxed:r={show:!1},className:s="",styles:c={},...a}){const l={...c,...i},d=pt.useColorConvert();let u=null;const x=gt.default(y=>y.breakpoints.up("sm")),h=te.default(),p=Se();return t&&(u=lt(h,typeof t=="string"?d(t):t,l,e,p)),r.show&&(l.borderRadius="10px",l.padding===void 0&&(l.padding=x?"50px":"20px"),r!=null&&r.border&&(l.border="1px solid #c0c0c0"),r!=null&&r.background&&(u=lt(h,typeof(r==null?void 0:r.background)=="string"?d(r==null?void 0:r.background):r==null?void 0:r.background,l,r==null?void 0:r.backgroundVideoPoster,p))),o.jsxs(m.Box,{...a,sx:{...l,...u?{position:"relative",overflow:"hidden",zIndex:0}:{}},className:b.cx(s,(r==null?void 0:r.boxShadow)&&"shadow-xl"),children:[u,n]})}const Ce=_.styled(vt)`
135
+ `;function z({title:t,description:e,descriptionMarkdown:n,actions:i,className:r="",classes:s={},prepend:c,append:a,level:l=2,tag:d,badge:u,center:p,logo:h,titleAppearance:x,descriptionAppearance:y,...w}){const g=xt.useColorConvert();if(!t&&!e&&!i&&!u&&!d&&!c&&!a&&!h)return null;const k=Math.max(Math.min(5,l+1),1),v={1:"xl:!text-3xl lg:!text-2xl md:!text-xl",2:"xl:!text-2xl lg:!text-xl md:!text-lg",3:"xl:!text-2xl lg:!text-xl md:!text-lg",4:"xl:!text-xl lg:!text-lg md:!text-md",5:"xl:!text-lg md:!text-md sm:!text-sm",6:"!text-sm"},B=l===0?"big":`h${k}`,N=l===0;return o.jsxs(je,{className:b.cx("base-info","lg:text-left",p&&"!text-center",r),...w,children:[c&&o.jsx("div",{children:c}),(d||u)&&o.jsx("div",{className:b.cx("section__tag",(s==null?void 0:s.tag)||(s==null?void 0:s.badge)),children:d||u}),h&&o.jsx("img",{className:"w-[120px] m-auto mb-8",src:h,alt:"info",loading:"lazy"}),t&&o.jsx(m.Typography,{sx:{whiteSpace:"pre-wrap",mb:e?"2vw":0,...(x==null?void 0:x.color)&&{color:`${g(x.color)} !important`}},className:b.cx("section__title","text-gray-800","dark:text-gray-50",s.title,"page-kit-section__title",N?"":"section__title_non_big"),component:`h${Math.max(l,1)}`,variant:B,children:t}),e&&(n?o.jsx(m.Box,{sx:{...(y==null?void 0:y.color)&&{color:`${g(y.color)} !important`}},component:ye,className:b.cx("section__description","text-gray-800","dark:text-gray-100",v[k],s.description,"page-kit-section__description"),children:e}):o.jsx(m.Typography,{sx:{whiteSpace:"pre-wrap",...(y==null?void 0:y.color)&&{color:`${g(y.color)} !important`}},className:b.cx("section__description","text-gray-800","dark:text-gray-100",v[k],s.description,"page-kit-section__description"),component:"div",variant:"body1",gutterBottom:!0,children:e})),o.jsx(R,{actions:i,center:p,className:"mt-8"}),a&&o.jsx("div",{children:a})]})}const q=["actions","append","badge","tag","center","description","descriptionMarkdown","level","logo","prepend","title","titleAppearance","descriptionAppearance"];function jt(t){if(t.type===f.Fragment){const n=(t.props.children||[]).filter(i=>f.isValidElement(i));return n.length===1?jt(n[0]):n.length>1}return Array.isArray(t)}const I="&>*";function Q({children:t,col:e,gap:n,className:i,align:r,sx:s,type:c,...a}={children:null,className:"",col:3,gap:void 0,sx:{},align:"center",type:"default"}){const l=_.useTheme(),d=Number(Math.floor(100/e*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"},p=u[r]||u.center;let x=n??({2:6,3:4,4:4,5:3,6:3}[e]||0);jt(t)||(x=0);const w=(e-1)*x/e;let g={...s,gap:`${x}rem`};const k={[I]:{width:"100%"}},v={},B={},N={};switch(k.gap="1rem",v.gap=`${x/2}rem`,e){case 3:case 4:v[I]={width:`calc(50% - ${x/2}rem)`};break;case 5:case 6:k[I]={width:`calc(50% - ${x/2/2}rem)`},v[I]={width:`calc(50% - ${x/2/2}rem)`},B[I]={width:`calc(33.33% - ${x*2/3}rem)`};break}return g[I]={width:`calc(${d}% - ${w}rem)`},g[`@media (max-width: ${l.breakpoints.values.xl}px)`]=N,g[`@media (max-width: ${l.breakpoints.values.lg}px)`]=B,g[`@media (max-width: ${l.breakpoints.values.md}px)`]=v,g[`@media (max-width: ${l.breakpoints.values.sm}px)`]=k,c==="wall"&&(g={...s,gap:`${x}rem`},g[I]={width:`calc(${d}% - ${w}rem)`},k[I]={width:`calc(45% - ${x/2/2}rem)`},g[`@media (max-width: ${l.breakpoints.values.sm}px)`]=k),o.jsx(m.Box,{className:b.cx("flex flex-wrap flex-row h-full",p,i),sx:g,...a,children:t})}function ve(){const t=navigator.userAgent.toLowerCase();return t.includes("safari")&&!t.includes("chrome")}function ke(t=""){if(t.startsWith("data:image/svg+xml,"))return!0;const e=/^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/,n=/^(\/|\.\/|\.\.\/)(?:[^/]+\/)*[^/]+$/;return e.test(t)||n.test(t)}function Y(t){return(t==null?void 0:t.endsWith(".mp4"))||(t==null?void 0:t.endsWith(".m4v"))||(t==null?void 0:t.endsWith(".webm"))}function _e(t){return t!=null&&t.endsWith(".mp4")||t!=null&&t.endsWith(".m4v")?"video/mp4":t!=null&&t.endsWith(".webm")?"video/webm":void 0}function $e(t){let e={};return typeof t=="string"?it.isGradient(t)?e.image=t:(e.image=j.getImageAbsoluteUrl(t),it.isColorString(t)&&(e.color=t,e.image="")):e=t,e}function Se(){const[t,e]=f.useState(Date.now());return f.useEffect(()=>{const n=()=>{e(Date.now())};return document.addEventListener("visibilitychange",n),()=>{document.removeEventListener("visibilitychange",n)}},[]),t}function lt(t,e,n,i,r){let s=null;const{color:c="",image:a}=$e(e);return a&&ke(a)?(delete n.backgroundColor,!(t.mobile.apple.device||ve())&&Y(a)?s=o.jsx(m.Box,{component:"video",className:"section-bg",width:"100%",autoPlay:!0,loop:!0,muted:!0,controls:!1,playsInline:!0,poster:j.autoResizeImage(j.getImageAbsoluteUrl(i),1200,"quality"),src:Y(a)?a:j.autoResizeImage(a,1200,"quality"),sx:{position:"absolute",zIndex:-9999,right:0,left:0,top:0,width:"100%",height:"100%",objectFit:"cover"}},a):s=o.jsx(G.ResponsiveImage,{src: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"}},r||a)):a?n.backgroundImage=`${a} !important`:c&&(n.backgroundColor=`${c} !important`),s}function Be({autoWidth:t,children:e,...n}){return t?o.jsx(m.Box,{display:"flex",...n,children:e}):o.jsx(m.Container,{...n,children:e})}function E({dark:t=!1,children:e,className:n,sx:i={},boxed:r={show:!1},padding:s="normal",boxProps:c,type:a,...l}){const d={...i},u=gt.default(x=>x.breakpoints.down("md"));t&&(d.color=at.default.common.white,d.backgroundColor=`${at.default.grey[900]} !important`),r.show&&(d.display="flex");const p=f.useMemo(()=>!Number(l.boxMaxWidth)||u?{width:"100%"}:a==="wall"&&l.boxMaxWidth?{maxWidth:`${l.boxMaxWidth}px !important`,width:"100%"}:{width:"100%"},[l.boxMaxWidth,u,a]),h=bt({type:"baseSectionPaddingY",value:s||"normal",defaultValue:""});return o.jsx(Ce,{component:"section",styles:{...d,...h},className:b.cx("base-section","px-2 md:px-5 lg:px-5 xl:px-10",n,{dark:t}),...C.default(l,"hoverStyle","boxMaxWidth","embedUrl","autoWidth","paddingXY","iframeHeight","titleAppearance","descriptionAppearance"),children:o.jsx(Be,{autoWidth:l==null?void 0:l.autoWidth,className:b.cx("section-content h-full"),sx:p,children:r.show?o.jsx(vt,{...c,boxed:r,children:e}):e})})}function vt({background:t="",backgroundVideoPoster:e,children:n,sx:i={},boxed:r={show:!1},className:s="",styles:c={},...a}){const l={...c,...i},d=xt.useColorConvert();let u=null;const p=gt.default(y=>y.breakpoints.up("sm")),h=te.default(),x=Se();return t&&(u=lt(h,typeof t=="string"?d(t):t,l,e,x)),r.show&&(l.borderRadius="10px",l.padding===void 0&&(l.padding=p?"50px":"20px"),r!=null&&r.border&&(l.border="1px solid #c0c0c0"),r!=null&&r.background&&(u=lt(h,typeof(r==null?void 0:r.background)=="string"?d(r==null?void 0:r.background):r==null?void 0:r.background,l,r==null?void 0:r.backgroundVideoPoster,x))),o.jsxs(m.Box,{...a,sx:{...l,...u?{position:"relative",overflow:"hidden",zIndex:0}:{}},className:b.cx(s,(r==null?void 0:r.boxShadow)&&"shadow-xl"),children:[u,n]})}const Ce=_.styled(vt)`
134
136
  &:nth-of-type(even) {
135
137
  background: #f8f8f8;
136
138
  }
@@ -146,7 +148,7 @@
146
148
  }
147
149
  }
148
150
  }
149
- `;function Z({icon:t,...e}){return o.jsx(ht.Icon,{icon:t,...e,ref:null})}function S(t,e){const n=X.default(t,e),i=C.default(t,e);return[n,i]}const kt=["title","description","actions","badge","tag","prepend","append","logo"];function Ne({image:t,imageBorder:e,imageShadow:n,className:i,reverse:r=!1,fullSizeImage:s,...c}){const[a,l]=S(c,q),d=Object.keys(a).length>0&&Object.values(X.default(a,kt)).filter(Boolean).length>0&&o.jsx(z,{...a}),u=f.isValidElement(t)?t:o.jsx(m.Box,{component:"img",src:t,alt:"",className:"block"}),x=["phone","macbook"].includes(e),h=t&&o.jsx(m.Box,{className:b.cx("section__image","m-auto, leading-[1] text-center",n&&"shadow-xl",a!=null&&a.center?"flex justify-center items-center":""),sx:{border:e===!0?"1px solid #c0c0c0":void 0,borderRadius:2,overflow:"hidden","> div":x?{width:"100%",video:{borderRadius:"0 !important"}}:void 0},children:x?o.jsx(ee.default,{type:e,sx:{width:"100%"},children:u}):u});return o.jsx(E,{className:b.cx("section--block",i,s&&!r&&b.css`
151
+ `;function Z({icon:t,...e}){return o.jsx(ht.Icon,{icon:t,...e,ref:null})}function S(t,e){const n=X.default(t,e),i=C.default(t,e);return[n,i]}const kt=["title","description","actions","badge","tag","prepend","append","logo"];function Ne({image:t,imageBorder:e,imageShadow:n,className:i,reverse:r=!1,fullSizeImage:s,...c}){const[a,l]=S(c,q),d=Object.keys(a).length>0&&Object.values(X.default(a,kt)).filter(Boolean).length>0&&o.jsx(z,{...a}),u=f.isValidElement(t)?t:o.jsx(m.Box,{component:"img",src:t,alt:"",className:"block"}),p=["phone","macbook"].includes(e),h=t&&o.jsx(m.Box,{className:b.cx("section__image","m-auto, leading-[1] text-center",n&&"shadow-xl",a!=null&&a.center?"flex justify-center items-center":""),sx:{border:e===!0?"1px solid #c0c0c0":void 0,borderRadius:2,overflow:"hidden","> div":p?{width:"100%",video:{borderRadius:"0 !important"}}:void 0},children:p?o.jsx(ee.default,{type:e,sx:{width:"100%"},children:u}):u});return o.jsx(E,{className:b.cx("section--block",i,s&&!r&&b.css`
150
152
  .section-bg {
151
153
  height: 80%;
152
154
  }
@@ -165,7 +167,8 @@
165
167
  }
166
168
  `:void 0,children:r?o.jsxs(o.Fragment,{children:[h,d]}):o.jsxs(o.Fragment,{children:[d,h]})})})}const L=["editing","height","locale","dev","sx"];function Ie(t){const{className:e,...n}=t;return o.jsx(Pe,{...n,className:b.cx("BlockBase-root",e)})}const Pe=_.styled(m.Box)`
167
169
  position: relative;
168
- `;function Re({widget:t,reverse:e,projectId:n,assistantId:i,working:r,submitTitle:s,submitIcon:c,submitColor:a,placeholder:l,loadingIndicator:d,section:u,...x}){const[{editing:h},p]=S(x,L),[y,w]=S(p,q),g=n&&i?{projectId:n,gitRef:"main",assistantId:i,working:!0}:void 0,k={children:s,endIcon:c?o.jsx(Z,{icon:c}):void 0,sx:{background:a||void 0,":hover":{background:a||void 0,opacity:.8}}},v=[],B=l&&o.jsx(m.Typography,{variant:"caption",color:"text.disabled",children:l}),N=d&&o.jsx(m.Typography,{variant:"caption",color:"text.disabled",children:d});Object.keys(y).length>0&&Object.values(X.default(y,kt)).filter(Boolean).length>0&&v.push(o.jsx(z,{...y},"base-info")),g&&(t==="form"?v.push(o.jsx(U.AIForm,{identifier:g,SubmitProps:k},"form")):t==="result"?v.push(o.jsx(U.AIFormResult,{identifier:g,placeholder:B,loadingIndicator:N},"result")):v.push(o.jsxs(m.Stack,{width:"100%",gap:2,direction:"row",children:[o.jsx(U.AIForm,{identifier:g,BoxProps:{flex:1},SubmitProps:k}),o.jsx(U.AIFormResult,{identifier:g,BoxProps:{flex:1},placeholder:B,loadingIndicator:N})]},"form-result"))),e&&v.reverse();const ot=m.useTheme(),St=f.useMemo(()=>m.createTheme(Wt.deepmerge(ot,{palette:{primary:a?{main:a}:void 0}})),[a,ot]);return o.jsx(qt.ErrorBoundary,{fallbackRender:j.ErrorView,children:o.jsx(m.ThemeProvider,{theme:St,children:o.jsx(E,{...w,sx:h?{pointerEvents:"none"}:{},children:o.jsx(Q,{col:v.length,children:v})})})})}const _t=f.createContext({pages:[],project:void 0}),{Provider:Te,Consumer:Po}=_t;function $t(){return f.useContext(_t)}function We({icon:t,className:e="",size:n="1rem",...i}){return o.jsx(ze,{component:Z,className:b.cx("css-icon",e),size:n,...i,icon:t})}const ze=_.styled(m.Box)`
170
+ color: ${({theme:t})=>t.palette.text.primary};
171
+ `;function Re({widget:t,reverse:e,projectId:n,assistantId:i,working:r,submitTitle:s,submitIcon:c,submitColor:a,placeholder:l,loadingIndicator:d,section:u,...p}){const[{editing:h},x]=S(p,L),[y,w]=S(x,q),g=n&&i?{projectId:n,gitRef:"main",assistantId:i,working:!0}:void 0,k={children:s,endIcon:c?o.jsx(Z,{icon:c}):void 0,sx:{background:a||void 0,":hover":{background:a||void 0,opacity:.8}}},v=[],B=l&&o.jsx(m.Typography,{variant:"caption",color:"text.disabled",children:l}),N=d&&o.jsx(m.Typography,{variant:"caption",color:"text.disabled",children:d});Object.keys(y).length>0&&Object.values(X.default(y,kt)).filter(Boolean).length>0&&v.push(o.jsx(z,{...y},"base-info")),g&&(t==="form"?v.push(o.jsx(U.AIForm,{identifier:g,SubmitProps:k},"form")):t==="result"?v.push(o.jsx(U.AIFormResult,{identifier:g,placeholder:B,loadingIndicator:N},"result")):v.push(o.jsxs(m.Stack,{width:"100%",gap:2,direction:"row",children:[o.jsx(U.AIForm,{identifier:g,BoxProps:{flex:1},SubmitProps:k}),o.jsx(U.AIFormResult,{identifier:g,BoxProps:{flex:1},placeholder:B,loadingIndicator:N})]},"form-result"))),e&&v.reverse();const ot=m.useTheme(),St=f.useMemo(()=>m.createTheme(Wt.deepmerge(ot,{palette:{primary:a?{main:a}:void 0}})),[a,ot]);return o.jsx(qt.ErrorBoundary,{fallbackRender:j.ErrorView,children:o.jsx(m.ThemeProvider,{theme:St,children:o.jsx(E,{...w,sx:h?{pointerEvents:"none"}:{},children:o.jsx(Q,{col:v.length,children:v})})})})}const _t=f.createContext({pages:[],project:void 0}),{Provider:Te,Consumer:Po}=_t;function $t(){return f.useContext(_t)}function We({icon:t,className:e="",size:n="1rem",...i}){return o.jsx(ze,{component:Z,className:b.cx("css-icon",e),size:n,...i,icon:t})}const ze=_.styled(m.Box)`
169
172
  &.css-icon {
170
173
  display: inline-block;
171
174
  width: ${({size:t})=>t};
@@ -182,7 +185,7 @@
182
185
  }
183
186
  `,tt=t=>typeof t=="string"&&/^[\w-_]+:[\w-_]+$/.test(t);function J({icon:t,size:e="1rem",imageMeta:n,...i}){const r=window.isNaN(e)?e:`${e}px`;return tt(t)?o.jsx(ht.Icon,{icon:t}):o.jsx(Le,{component:qe,imageMeta:n,className:"base-icon",icon:t,size:r,...i})}const Le=_.styled(m.Box)`
184
187
  flex-shrink: 0;
185
- `;function W({text:t,children:e,icon:n="",endIcon:i,color:r="primary",link:s="",href:c="",...a}){const l=n?o.jsx(J,{icon:n}):null,d=i?o.jsx(J,{icon:i}):null,u=s||c,x={...a};return u&&(x.href=u,H.default(u)&&(x.target=x.target||"_blank")),o.jsx(oe.default,{startIcon:l,endIcon:d,color:r,...x,children:t||e})}function et({editing:t,text:e,...n}){const{pages:i=[]}=$t(),r=i.find(s=>s.id===(n.link||n.linkId));if(t)return o.jsx(W,{...C.default(n,["link","linkId"]),children:e});if(r){const s=r.path||"/";return o.jsx(K.Link,{to:s,children:o.jsx(W,{...C.default(n,["link","linkId"]),children:e})})}return o.jsx(W,{...C.default(n,"linkId"),children:e})}function P({type:t="",icon:e="",size:n="3rem",className:i="",...r}){return o.jsx(J,{icon:e||t,size:n,className:b.cx("content-icon",i),...r})}P.propTypes={};P.defaultProps={type:"",icon:"",size:"3rem",color:"inherit",className:""};function Ae({to:t,base:e,children:n,className:i,activeClassName:r="active",target:s="auto",autoExternalMark:c=!1,useRouterLink:a,...l}){const{pages:d=[],locale:u=""}={},x=e?F.join("/",e):e||"";let h=s==="auto"?"_self":s,p=F.join(x,t);const y=c?H.default(p):!1;if(e)return p=F.join(x,u,t),o.jsx("a",{className:`no-underline ${i}`,href:T.withoutTrailingSlash(p),rel:"noreferrer noopener",target:h,...l,children:n});if(H.default(t))s==="auto"&&(h="_blank"),p=t;else{T.isRelative(p)&&(p=F.join(window.location.pathname,p));const w=T.parseURL(`${window.location.origin}${p}`),g=d.some(k=>k.pathname===w.pathname);if(a||g)return o.jsx(K.NavLink,{end:!0,to:T.withoutTrailingSlash(p),className:({isActive:k})=>b.cx(i,k?r:""),...l,children:n})}return o.jsxs("a",{className:`no-underline ${i}`,href:T.withoutTrailingSlash(p),rel:"noreferrer noopener",target:h,...l,children:[n,y&&o.jsx(P,{icon:"i-mdi:arrow-top-right",size:"0.9em",className:"smart-link__mark",style:{marginLeft:5}})]})}function A({prepend:t,append:e,children:n,className:i="",dark:r=!1,border:s=!0,...c}){let a={};const{pages:l=[]}=$t(),d=l.find(h=>h.id===c.link),u=!n||ft.default.Children.toArray(n).every(h=>h===null);c.link&&(a={component:Ae,to:(d==null?void 0:d.path)||c.link,useRouterLink:!0});const x=r&&s;return o.jsxs(Oe,{className:b.cx("base-card card",{"border-gray-200":s},{"dark:border-gray-500":x},{dark:r,"border-transparent":!s},i),...a,...C.default(c,["listType","dark","iconColor","link","hoverStyle","imageSize"]),children:[t,!u&&o.jsx("div",{className:"card__body",children:n}),e]})}const Oe=_.styled(m.Box)`
188
+ `;function W({text:t,children:e,icon:n="",endIcon:i,color:r="primary",link:s="",href:c="",...a}){const l=n?o.jsx(J,{icon:n}):null,d=i?o.jsx(J,{icon:i}):null,u=s||c,p={...a};return u&&(p.href=u,H.default(u)&&(p.target=p.target||"_blank")),o.jsx(oe.default,{startIcon:l,endIcon:d,color:r,...p,children:t||e})}function et({editing:t,text:e,...n}){const{pages:i=[]}=$t(),r=i.find(s=>s.id===(n.link||n.linkId));if(t)return o.jsx(W,{...C.default(n,["link","linkId"]),children:e});if(r){const s=r.path||"/";return o.jsx(K.Link,{to:s,children:o.jsx(W,{...C.default(n,["link","linkId"]),children:e})})}return o.jsx(W,{...C.default(n,"linkId"),children:e})}function P({type:t="",icon:e="",size:n="3rem",className:i="",...r}){return o.jsx(J,{icon:e||t,size:n,className:b.cx("content-icon",i),...r})}P.propTypes={};P.defaultProps={type:"",icon:"",size:"3rem",color:"inherit",className:""};function Ae({to:t,base:e,children:n,className:i,activeClassName:r="active",target:s="auto",autoExternalMark:c=!1,useRouterLink:a,...l}){const{pages:d=[],locale:u=""}={},p=e?F.join("/",e):e||"";let h=s==="auto"?"_self":s,x=F.join(p,t);const y=c?H.default(x):!1;if(e)return x=F.join(p,u,t),o.jsx("a",{className:`no-underline ${i}`,href:T.withoutTrailingSlash(x),rel:"noreferrer noopener",target:h,...l,children:n});if(H.default(t))s==="auto"&&(h="_blank"),x=t;else{T.isRelative(x)&&(x=F.join(window.location.pathname,x));const w=T.parseURL(`${window.location.origin}${x}`),g=d.some(k=>k.pathname===w.pathname);if(a||g)return o.jsx(K.NavLink,{end:!0,to:T.withoutTrailingSlash(x),className:({isActive:k})=>b.cx(i,k?r:""),...l,children:n})}return o.jsxs("a",{className:`no-underline ${i}`,href:T.withoutTrailingSlash(x),rel:"noreferrer noopener",target:h,...l,children:[n,y&&o.jsx(P,{icon:"i-mdi:arrow-top-right",size:"0.9em",className:"smart-link__mark",style:{marginLeft:5}})]})}function A({prepend:t,append:e,children:n,className:i="",dark:r=!1,border:s=!0,...c}){let a={};const{pages:l=[]}=$t(),d=l.find(h=>h.id===c.link),u=!n||ft.default.Children.toArray(n).every(h=>h===null);c.link&&(a={component:Ae,to:(d==null?void 0:d.path)||c.link,useRouterLink:!0});const p=r&&s;return o.jsxs(Oe,{className:b.cx("base-card card",{"border-gray-200":s},{"dark:border-gray-500":p},{dark:r,"border-transparent":!s},i),...a,...C.default(c,["listType","dark","iconColor","link","hoverStyle","imageSize"]),children:[t,!u&&o.jsx("div",{className:"card__body",children:n}),e]})}const Oe=_.styled(m.Box)`
186
189
  &.base-card {
187
190
  text-align: left;
188
191
  border-width: 1px;
@@ -197,7 +200,7 @@
197
200
  .card__body {
198
201
  padding: 15px 15px;
199
202
  }
200
- `;function O({align:t="left",title:e,titleProps:n={},description:i,descriptionProps:r={}}){return o.jsxs(o.Fragment,{children:[e&&o.jsx(m.Typography,{className:b.cx("card__title text-gray-800","dark:text-gray-50"),component:"h5",variant:"h5",gutterBottom:!0,align:t,...n,children:e}),i&&o.jsx(m.Typography,{className:b.cx("card__description","text-gray-500","dark:text-gray-400"),component:"div",variant:"body1",gutterBottom:!0,align:t,...r,children:i})]})}function Ue({image:t,title:e,description:n,imageProps:i={},imageMeta:r,imageSize:s,titleProps:c={},descriptionProps:a={},actions:l,align:d,...u}){const x=tt(t),h=j.autoResizeImage(j.getImageAbsoluteUrl(t),540);return o.jsxs(Fe,{className:"card-article",...u,prepend:o.jsx("div",{className:"card__image__wrap",children:x&&t?o.jsx(m.Box,{sx:{position:"absolute",left:0,top:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},children:o.jsx(P,{icon:t,color:"primary.main"})}):h&&o.jsx("img",{className:"card__image",src:h,...i,alt:i.alt||(r==null?void 0:r.filename)||"card-image",width:r==null?void 0:r.naturalWidth,height:r==null?void 0:r.naturalHeight,style:{width:"100%",height:"100%",objectFit:s||"cover",objectPosition:"center"},loading:"lazy"})}),children:[e||n?o.jsx(O,{align:d,title:e,titleProps:c,description:n,descriptionProps:a}):null,l!=null&&l.length?o.jsx(R,{align:d,actions:l,className:"mt-4"}):null]})}const Fe=_.styled(A)`
203
+ `;function O({align:t="left",title:e,titleProps:n={},description:i,descriptionProps:r={}}){return o.jsxs(o.Fragment,{children:[e&&o.jsx(m.Typography,{className:b.cx("card__title text-gray-800","dark:text-gray-50"),component:"h5",variant:"h5",gutterBottom:!0,align:t,...n,children:e}),i&&o.jsx(m.Typography,{className:b.cx("card__description","text-gray-500","dark:text-gray-400"),component:"div",variant:"body1",gutterBottom:!0,align:t,...r,children:i})]})}function Ue({image:t,title:e,description:n,imageProps:i={},imageMeta:r,imageSize:s,titleProps:c={},descriptionProps:a={},actions:l,align:d,...u}){const p=tt(t),h=j.autoResizeImage(j.getImageAbsoluteUrl(t),540);return o.jsxs(Fe,{className:"card-article",...u,prepend:o.jsx("div",{className:"card__image__wrap",children:p&&t?o.jsx(m.Box,{sx:{position:"absolute",left:0,top:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},children:o.jsx(P,{icon:t,color:"primary.main"})}):h&&o.jsx("img",{className:"card__image",src:h,...i,alt:i.alt||(r==null?void 0:r.filename)||"card-image",width:r==null?void 0:r.naturalWidth,height:r==null?void 0:r.naturalHeight,style:{width:"100%",height:"100%",objectFit:s||"cover",objectPosition:"center"},loading:"lazy"})}),children:[e||n?o.jsx(O,{align:d,title:e,titleProps:c,description:n,descriptionProps:a}):null,l!=null&&l.length?o.jsx(R,{align:d,actions:l,className:"mt-4"}):null]})}const Fe=_.styled(A)`
201
204
  ${t=>t.hoverStyle==="none"?"":t.link?`transition: box-shadow ease .3s;
202
205
  &:hover {
203
206
  box-shadow: 0 0 10px rgba(95, 142, 244, 0.42);
@@ -242,16 +245,19 @@
242
245
  font-weight: 700;
243
246
  margin-top: 24px;
244
247
  margin-bottom: 12px;
248
+ color: ${({theme:t})=>t.palette.text.primary};
245
249
  a {
246
250
  color: ${({theme:t})=>t.palette.primary.main};
247
251
  }
248
252
  }
249
253
  .card__description {
254
+ color: ${({theme:t})=>t.palette.text.primary};
250
255
  a {
251
256
  color: ${({theme:t})=>t.palette.primary.main};
252
257
  }
253
258
  }
254
259
  .card__body {
260
+ color: ${({theme:t})=>t.palette.text.primary};
255
261
  padding: 0;
256
262
  ${({align:t})=>`text-align:${t||"left"};`}
257
263
  }
@@ -275,7 +281,7 @@
275
281
  text-align: left;
276
282
  box-sizing: border-box;
277
283
  }
278
- `;function De({image:t,title:e,description:n,imageProps:i={},imageMeta:r,imageSize:s,titleProps:c={},descriptionProps:a={},actions:l,align:d,...u}){const x=tt(t),h=j.autoResizeImage(j.getImageAbsoluteUrl(t),540);return o.jsxs(Ve,{className:"card-article",...u,prepend:o.jsx("div",{className:"card__image__wrap",children:x&&t?o.jsx(m.Box,{sx:{position:"absolute",left:0,top:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},children:o.jsx(P,{icon:t,color:"primary.main"})}):h&&o.jsx(m.Box,{component:"img",className:"card__image",src:h,...i,alt:i.alt||(r==null?void 0:r.filename)||"card-image",width:r==null?void 0:r.naturalWidth,height:r==null?void 0:r.naturalHeight,style:{width:"100%",height:"100%",objectFit:s||"contain",objectPosition:"center"},loading:"lazy"})}),children:[e||n?o.jsx(O,{align:d,title:e,titleProps:c,description:n,descriptionProps:a}):null,l!=null&&l.length?o.jsx(R,{align:d,actions:l,className:"mt-4"}):null]})}const Ve=_.styled(A)`
284
+ `;function De({image:t,title:e,description:n,imageProps:i={},imageMeta:r,imageSize:s,titleProps:c={},descriptionProps:a={},actions:l,align:d,...u}){const p=tt(t),h=j.autoResizeImage(j.getImageAbsoluteUrl(t),540);return o.jsxs(Ve,{className:"card-article",...u,prepend:o.jsx("div",{className:"card__image__wrap",children:p&&t?o.jsx(m.Box,{sx:{position:"absolute",left:0,top:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},children:o.jsx(P,{icon:t,color:"primary.main"})}):h&&o.jsx(m.Box,{component:"img",className:"card__image",src:h,...i,alt:i.alt||(r==null?void 0:r.filename)||"card-image",width:r==null?void 0:r.naturalWidth,height:r==null?void 0:r.naturalHeight,style:{width:"100%",height:"100%",objectFit:s||"contain",objectPosition:"center"},loading:"lazy"})}),children:[e||n?o.jsx(O,{align:d,title:e,titleProps:c,description:n,descriptionProps:a}):null,l!=null&&l.length?o.jsx(R,{align:d,actions:l,className:"mt-4"}):null]})}const Ve=_.styled(A)`
279
285
  ${t=>t.hoverStyle==="none"?"":t.link?`transition: box-shadow ease .3s;
280
286
  &:hover {
281
287
  box-shadow: 0 0 10px rgba(95, 142, 244, 0.42);
@@ -440,7 +446,7 @@
440
446
  }
441
447
  }
442
448
  }
443
- `;function Ke({type:t="default",...e}){const i={article:Ue,simple:Je,news:He,default:dt,wall:De}[t]||dt;return o.jsx(i,{...t==="news"?e:C.default(e,"iconSize")})}function Xe({list:t=[],align:e="top",cards:n,listBorder:i=!0,listType:r="",col:s=3,gap:c,iconColor:a,className:l="",type:d="default",dark:u=!1,textAlign:x="left",hoverStyle:h,...p}){return o.jsx(Q,{type:d,className:b.cx("card-list py-1",l,"items-stretch"),col:s,gap:c,align:e,...p,children:n||t.map(y=>o.jsx(Ke,{borderColor:i,iconColor:a,type:d,listType:r,dark:u,...y,align:x,sx:{bgcolor:d==="wall"?void 0:u?"grey.900":"common.white"},style:c===0&&t.length>1?{borderRadius:0,marginRight:"-1px",marginBottom:"-1px"}:{}},y.id))})}const Qe=["align","cards","list","listBorder","listType","col","gap","iconColor","type","textAlign"],Ze=_.styled(E)`
449
+ `;function Ke({type:t="default",...e}){const i={article:Ue,simple:Je,news:He,default:dt,wall:De}[t]||dt;return o.jsx(i,{...t==="news"?e:C.default(e,"iconSize")})}function Xe({list:t=[],align:e="top",cards:n,listBorder:i=!0,listType:r="",col:s=3,gap:c,iconColor:a,className:l="",type:d="default",dark:u=!1,textAlign:p="left",hoverStyle:h,...x}){return o.jsx(Q,{type:d,className:b.cx("card-list py-1",l,"items-stretch"),col:s,gap:c,align:e,...x,children:n||t.map(y=>o.jsx(Ke,{borderColor:i,iconColor:a,type:d,listType:r,dark:u,...y,align:p,sx:{bgcolor:d==="wall"?void 0:u?"grey.900":"common.white"},style:c===0&&t.length>1?{borderRadius:0,marginRight:"-1px",marginBottom:"-1px"}:{}},y.id))})}const Qe=["align","cards","list","listBorder","listType","col","gap","iconColor","type","textAlign"],Ze=_.styled(E)`
444
450
  a .card {
445
451
  color: #404040;
446
452
  cursor: pointer;
@@ -470,15 +476,15 @@
470
476
  .card-simple .card__body::after {
471
477
  background: inherit !important;
472
478
  }
473
- `;function oo({section:t,...e}){const[{editing:n},i]=S(e,L),r=f.useMemo(()=>{var s;return{...C.default(i,["listBorder","list","iconSize","imageSize"]),list:(s=i.list)==null?void 0:s.map(c=>{var a,l;return{...C.default(c,"icon","iconColor"),image:["news","simple","default"].includes(i.type)&&c.icon?c.icon:c.image,actions:(l=(a=c.actions)==null?void 0:a.map)==null?void 0:l.call(a,d=>o.jsx(et,{...d,editing:n},d.id)),border:i.listBorder,iconSize:i.iconSize,imageSize:i.imageSize,hoverStyle:i.hoverStyle}})}},[i]);return o.jsx(eo,{style:n?{pointerEvents:"none"}:{},...r})}function no({properties:t,section:e,locale:n,dev:i}){var r;return(r=e==null?void 0:e.config)!=null&&r.componentId?o.jsx(G.CustomComponentRenderer,{instanceId:e.id,componentId:e.config.componentId,blockletId:e.config.blockletId,blockletTitle:e.config.blockletTitle,componentName:e.config.componentName,locale:n,properties:t,dev:i}):o.jsx(m.Box,{textAlign:"center",py:2,children:o.jsx(m.Typography,{variant:"caption",color:"text.secondary",children:"Please select component to render"})})}function ro({src:t,dataId:e,isEdit:n=!1,height:i="100%",onLoad:r=()=>{}}){return o.jsx(Kt.EmbedIframe,{isEdit:n,embedId:e,src:t,height:i,onLoad:()=>{r()}})}function io({dataId:t,src:e,actions:n,center:i,onLoad:r,...s}){const[c,a]=S(s,q);return o.jsxs(E,{...a,children:[Object.keys(c).length>0&&o.jsx(z,{center:i,...c}),o.jsx(ro,{dataId:t,src:e,onLoad:r,height:s.iframeHeight?`${s.iframeHeight}px`:"100%"}),o.jsx(R,{actions:n,center:i})]})}const so={src:"",embedUrl:"",title:"",description:"",dark:!1,background:"",center:!0,config:{},id:""};function ao({section:t,id:e,src:n,...i}){const r=`${e}-${i.locale}`,[{editing:s},c]=S(i,L),a=f.useRef({}),l=JSON.parse(JSON.stringify(c)),{message:d}=Yt.useMessage(r,"server"),u=Jt.useLatest(JSON.parse(JSON.stringify(c.config)||"{}"));return f.useEffect(()=>{d&&d.onInit(()=>u.current)},[d]),f.useEffect(()=>{const x=JSON.parse(JSON.stringify(c.config)||"{}");ne.default(a.current,x)||(a.current=x,d==null||d.send("config-set",x))},[d,c.config]),n?o.jsx(io,{...l,dataId:r,src:n,style:s?{pointerEvents:"none"}:{}}):o.jsx(lo,{children:'Please set the "src" attribute for this block'})}const lo=_.styled("div")`
479
+ `;function oo({section:t,...e}){const[{editing:n},i]=S(e,L),r=f.useMemo(()=>{var s;return{...C.default(i,["listBorder","list","iconSize","imageSize"]),list:(s=i.list)==null?void 0:s.map(c=>{var a,l;return{...C.default(c,"icon","iconColor"),image:["news","simple","default"].includes(i.type)&&c.icon?c.icon:c.image,actions:(l=(a=c.actions)==null?void 0:a.map)==null?void 0:l.call(a,d=>o.jsx(et,{...d,editing:n},d.id)),border:i.listBorder,iconSize:i.iconSize,imageSize:i.imageSize,hoverStyle:i.hoverStyle}})}},[i]);return o.jsx(eo,{style:n?{pointerEvents:"none"}:{},...r})}function no({properties:t,section:e,locale:n,dev:i}){var r;return(r=e==null?void 0:e.config)!=null&&r.componentId?o.jsx(G.CustomComponentRenderer,{instanceId:e.id,componentId:e.config.componentId,blockletId:e.config.blockletId,blockletTitle:e.config.blockletTitle,componentName:e.config.componentName,locale:n,properties:t,dev:i}):o.jsx(m.Box,{textAlign:"center",py:2,children:o.jsx(m.Typography,{variant:"caption",color:"text.secondary",children:"Please select component to render"})})}function ro({src:t,dataId:e,isEdit:n=!1,height:i="100%",onLoad:r=()=>{}}){return o.jsx(Kt.EmbedIframe,{isEdit:n,embedId:e,src:t,height:i,onLoad:()=>{r()}})}function io({dataId:t,src:e,actions:n,center:i,onLoad:r,...s}){const[c,a]=S(s,q);return o.jsxs(E,{...a,children:[Object.keys(c).length>0&&o.jsx(z,{center:i,...c}),o.jsx(ro,{dataId:t,src:e,onLoad:r,height:s.iframeHeight?`${s.iframeHeight}px`:"100%"}),o.jsx(R,{actions:n,center:i})]})}const so={src:"",embedUrl:"",title:"",description:"",dark:!1,background:"",center:!0,config:{},id:""};function ao({section:t,id:e,src:n,...i}){const r=`${e}-${i.locale}`,[{editing:s},c]=S(i,L),a=f.useRef({}),l=JSON.parse(JSON.stringify(c)),{message:d}=Yt.useMessage(r,"server"),u=Jt.useLatest(JSON.parse(JSON.stringify(c.config)||"{}"));return f.useEffect(()=>{d&&d.onInit(()=>u.current)},[d]),f.useEffect(()=>{const p=JSON.parse(JSON.stringify(c.config)||"{}");ne.default(a.current,p)||(a.current=p,d==null||d.send("config-set",p))},[d,c.config]),n?o.jsx(io,{...l,dataId:r,src:n,style:s?{pointerEvents:"none"}:{}}):o.jsx(lo,{children:'Please set the "src" attribute for this block'})}const lo=_.styled("div")`
474
480
  user-select: none;
475
481
  color: #999;
476
482
  padding: 8px;
477
483
  height: 200px;
478
- `,co=[/youtu\.be\/([^#&?]{11})/,/\?v=([^#&?]{11})/,/&v=([^#&?]{11})/,/embed\/([^#&?]{11})/,/\/v\/([^#&?]{11})/];function uo(t){var e;if(/youtu\.?be/.test(t))for(const n of co){const i=(e=n.exec(t))==null?void 0:e[1];if(i)return i}}function mo(t){const e=uo(t);if(e)return`https://youtube.com/embed/${e}`}function xo({src:t}){return f.useEffect(()=>{import("@lottiefiles/lottie-player")},[]),o.jsx("lottie-player",{autoplay:!0,loop:!0,mode:"normal",src:t})}function po(t){return o.jsx(m.Box,{maxHeight:400,overflow:"hidden auto",children:o.jsx(Xt.TwitterTimelineEmbed,{...t})})}function ho({url:t}){const e=f.useRef(null),n=495,[i,r]=f.useState(e.current?e.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=e.current?e.current.offsetWidth*.5625:n;return r(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=e.current?e.current.offsetWidth*.5625:n;return r(Math.floor(a*c)),function(){window.removeEventListener("resize",s)}},[i,s]),o.jsx(m.Box,{component:"iframe",ref:e,title:"youtube",width:"100%",height:`${i}px`,src:t,frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,sx:{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},go=_.styled(Ne)`
484
+ `,co=[/youtu\.be\/([^#&?]{11})/,/\?v=([^#&?]{11})/,/&v=([^#&?]{11})/,/embed\/([^#&?]{11})/,/\/v\/([^#&?]{11})/];function uo(t){var e;if(/youtu\.?be/.test(t))for(const n of co){const i=(e=n.exec(t))==null?void 0:e[1];if(i)return i}}function mo(t){const e=uo(t);if(e)return`https://youtube.com/embed/${e}`}function po({src:t}){return f.useEffect(()=>{import("@lottiefiles/lottie-player")},[]),o.jsx("lottie-player",{autoplay:!0,loop:!0,mode:"normal",src:t})}function xo(t){return o.jsx(m.Box,{maxHeight:400,overflow:"hidden auto",children:o.jsx(Xt.TwitterTimelineEmbed,{...t})})}function ho({url:t}){const e=f.useRef(null),n=495,[i,r]=f.useState(e.current?e.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=e.current?e.current.offsetWidth*.5625:n;return r(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=e.current?e.current.offsetWidth*.5625:n;return r(Math.floor(a*c)),function(){window.removeEventListener("resize",s)}},[i,s]),o.jsx(m.Box,{component:"iframe",ref:e,title:"youtube",width:"100%",height:`${i}px`,src:t,frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,sx:{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},go=_.styled(Ne)`
479
485
  .section__description {
480
486
  }
481
- `;function yo({hasImage:t,fullSizeImage:e,boxed:n,videoPoster:i,imageMeta:r,imageOptimization:s,imageSize:c,section:a,...l}){var p,y;const[{editing:d},u]=S({...l,boxed:e?void 0:n},L);let x=bo(u.image,i,e,r,s,c);t||(x=null);let h=null;return u.actions&&(h=(y=(p=u.actions)==null?void 0:p.map)==null?void 0:y.call(p,(w,g)=>o.jsx(et,{...w,editing:d},g))),o.jsx(go,{...u,style:d?{pointerEvents:"none"}:{},image:x,fullSizeImage:t&&e,actions:h})}function bo(t,e,n,i,r,s){if(t){if(t.endsWith(".json"))return o.jsx(xo,{src:t});if(t.indexOf("twitter.com")!==-1)return o.jsx(po,{sourceType:"url",url:t});const c=mo(t);if(c)return o.jsx(ho,{url:c});const{naturalWidth:a,naturalHeight:l,filename:d}=i||{};if(Y(t))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(e),n?1200:540,r),children:o.jsx("source",{src:j.getImageAbsoluteUrl(t),type:_e(t)})},t);const u=r==="quality"?1:.6;return o.jsx(G.ResponsiveImage,{src:j.getImageAbsoluteUrl(t),sizesAttr:{sm:600*u,md:450*u,lg:540*u,...n&&{md:900*u,lg:1200*u}},width:a&&`${a}px`,height:l&&`${l}px`,alt:d??t,style:{objectFit:s||"contain",display:"block",width:"100%",height:"100%"},loading:"lazy"})}return null}const wo=["production","draft"];function jo({mode:t,version:e}={}){const n=e&&typeof e=="number"?{mode:t,version:e}:{mode:t};return j.api.get(`/api/${j.getProjectIdFromPathnameOrWindow()}/pages`,{params:n}).then(i=>i.data)}function vo({mode:t,pages:e}){return j.api.post(`/api/${j.getProjectIdFromPathnameOrWindow()}/pages/publish`,{mode:t,pages:e}).then(n=>n.data)}function ko({locale:t,sort:e,page:n,limit:i,mode:r}={}){return j.api.get(`/api/${j.getProjectIdFromPathnameOrWindow()}/pages/toc`,{params:{locale:t,sort:e,page:n,limit:i,mode:r}}).then(s=>s.data)}const _o={style:"list",sort:"-updatedAt"},mt=20;function $o({style:t,sort:e,section:n,...i}){const[{editing:r,locale:s},c]=S(i,L),[a,l]=S(c,q),[d,u]=f.useState(),x=f.useRef(!1),h=st.useUpdate(),p=K.useNavigate(),y=f.useCallback(async()=>{if(!x.current){x.current=!0,h();try{const w=d?Math.floor(d.list.length/mt)+1:1,{list:g,total:k}=await ko({locale:s,sort:e,page:w,limit:mt});u(v=>({list:((v==null?void 0:v.list)??[]).concat(g),total:k}))}finally{x.current=!1,h()}}},[d,s,e,h]);return st.useMount(()=>{y()}),o.jsxs(E,{...l,sx:r?{pointerEvents:"none"}:{},children:[Object.keys(a).length>0&&o.jsx(z,{...a}),d?o.jsxs(o.Fragment,{children:[o.jsx(m.Grid,{container:!0,spacing:2,justifyContent:"center",children:d==null?void 0:d.list.map(w=>o.jsx(m.Grid,{item:!0,xs:12,sm:t==="card"?6:12,md:t==="card"?3:12,children:o.jsxs(So,{elevation:0,className:b.cx(t==="card"&&"style-card"),onClick:r?void 0:()=>p(w.slug),children:[!!w.image&&o.jsx(m.CardMedia,{component:"img",alt:"",image:j.autoResizeImage(j.getImageAbsoluteUrl(w.image),540),loading:"lazy"}),o.jsxs(m.CardContent,{children:[o.jsx(m.Typography,{variant:"h6",component:"div",className:xt,children:w.title||w.id}),o.jsx(m.Typography,{variant:"body2",className:xt,children:w.description})]})]})},w.id))}),o.jsx(m.Box,{textAlign:"center",mt:2,children:d.total>d.list.length?o.jsx(W,{variant:"outlined",color:"secondary",onClick:y,loading:x.current,children:"More"}):o.jsx(W,{variant:"outlined",color:"secondary",disabled:!0,children:"No More"})})]}):o.jsx(m.Box,{p:2,textAlign:"center",children:o.jsx(m.CircularProgress,{size:24})})]})}const xt=b.css`
487
+ `;function yo({hasImage:t,fullSizeImage:e,boxed:n,videoPoster:i,imageMeta:r,imageOptimization:s,imageSize:c,section:a,...l}){var x,y;const[{editing:d},u]=S({...l,boxed:e?void 0:n},L);let p=bo(u.image,i,e,r,s,c);t||(p=null);let h=null;return u.actions&&(h=(y=(x=u.actions)==null?void 0:x.map)==null?void 0:y.call(x,(w,g)=>o.jsx(et,{...w,editing:d},g))),o.jsx(go,{...u,style:d?{pointerEvents:"none"}:{},image:p,fullSizeImage:t&&e,actions:h})}function bo(t,e,n,i,r,s){if(t){if(t.endsWith(".json"))return o.jsx(po,{src:t});if(t.indexOf("twitter.com")!==-1)return o.jsx(xo,{sourceType:"url",url:t});const c=mo(t);if(c)return o.jsx(ho,{url:c});const{naturalWidth:a,naturalHeight:l,filename:d}=i||{};if(Y(t))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(e),n?1200:540,r),children:o.jsx("source",{src:j.getImageAbsoluteUrl(t),type:_e(t)})},t);const u=r==="quality"?1:.6;return o.jsx(G.ResponsiveImage,{src:j.getImageAbsoluteUrl(t),sizesAttr:{sm:600*u,md:450*u,lg:540*u,...n&&{md:900*u,lg:1200*u}},width:a&&`${a}px`,height:l&&`${l}px`,alt:d??t,style:{objectFit:s||"contain",display:"block",width:"100%",height:"100%"},loading:"lazy"})}return null}const wo=["production","draft"];function jo({mode:t,version:e}={}){const n=e&&typeof e=="number"?{mode:t,version:e}:{mode:t};return j.api.get(`/api/${j.getProjectIdFromPathnameOrWindow()}/pages`,{params:n}).then(i=>i.data)}function vo({mode:t,pages:e}){return j.api.post(`/api/${j.getProjectIdFromPathnameOrWindow()}/pages/publish`,{mode:t,pages:e}).then(n=>n.data)}function ko({locale:t,sort:e,page:n,limit:i,mode:r}={}){return j.api.get(`/api/${j.getProjectIdFromPathnameOrWindow()}/pages/toc`,{params:{locale:t,sort:e,page:n,limit:i,mode:r}}).then(s=>s.data)}const _o={style:"list",sort:"-updatedAt"},mt=20;function $o({style:t,sort:e,section:n,...i}){const[{editing:r,locale:s},c]=S(i,L),[a,l]=S(c,q),[d,u]=f.useState(),p=f.useRef(!1),h=st.useUpdate(),x=K.useNavigate(),y=f.useCallback(async()=>{if(!p.current){p.current=!0,h();try{const w=d?Math.floor(d.list.length/mt)+1:1,{list:g,total:k}=await ko({locale:s,sort:e,page:w,limit:mt});u(v=>({list:((v==null?void 0:v.list)??[]).concat(g),total:k}))}finally{p.current=!1,h()}}},[d,s,e,h]);return st.useMount(()=>{y()}),o.jsxs(E,{...l,sx:r?{pointerEvents:"none"}:{},children:[Object.keys(a).length>0&&o.jsx(z,{...a}),d?o.jsxs(o.Fragment,{children:[o.jsx(m.Grid,{container:!0,spacing:2,justifyContent:"center",children:d==null?void 0:d.list.map(w=>o.jsx(m.Grid,{item:!0,xs:12,sm:t==="card"?6:12,md:t==="card"?3:12,children:o.jsxs(So,{elevation:0,className:b.cx(t==="card"&&"style-card"),onClick:r?void 0:()=>x(w.slug),children:[!!w.image&&o.jsx(m.CardMedia,{component:"img",alt:"",image:j.autoResizeImage(j.getImageAbsoluteUrl(w.image),540),loading:"lazy"}),o.jsxs(m.CardContent,{children:[o.jsx(m.Typography,{variant:"h6",component:"div",className:pt,children:w.title||w.id}),o.jsx(m.Typography,{variant:"body2",className:pt,children:w.description})]})]})},w.id))}),o.jsx(m.Box,{textAlign:"center",mt:2,children:d.total>d.list.length?o.jsx(W,{variant:"outlined",color:"secondary",onClick:y,loading:p.current,children:"More"}):o.jsx(W,{variant:"outlined",color:"secondary",disabled:!0,children:"No More"})})]}):o.jsx(m.Box,{p:2,textAlign:"center",children:o.jsx(m.CircularProgress,{size:24})})]})}const pt=b.css`
482
488
  display: -webkit-box;
483
489
  -webkit-box-orient: vertical;
484
490
  -webkit-line-clamp: 2;
@@ -504,4 +510,4 @@
504
510
  max-height: 50vw;
505
511
  }
506
512
  }
507
- `,Bo={iframe:ao,section:yo,"section-card-list":oo,toc:$o,"ai-runtime":Re,"custom-component":no};function Co({id:t,type:e,mode:n,config:i,section:r,...s}){const c=Bo[e],{getPageMetaStyle:a}=xe(),l=f.useMemo(()=>{const{height:x,...h}=i;return h},[i]),d=f.useMemo(()=>{const x={};return e!=="custom-component"&&(x.height=i.height),x.sx=a("sx"),x},[i.height,e,a]),u=c&&o.jsx(c,{mode:n,...l,id:t,section:r});return o.jsx(Ie,{...s,...d,children:u})}function No(t){return t!=null}exports.Action=et;exports.BlockRenderer=Co;exports.IFrameBlockDefaultProps=so;exports.Icon=Z;exports.PageProvider=pe;exports.Provider=Te;exports.STATE_MODES=wo;exports.SectionBlockDefaultProps=fo;exports.TocDefaultProps=_o;exports.getPages=jo;exports.nonNullable=No;exports.publishPages=vo;
513
+ `,Bo={iframe:ao,section:yo,"section-card-list":oo,toc:$o,"ai-runtime":Re,"custom-component":no};function Co({id:t,type:e,mode:n,config:i,section:r,...s}){const c=Bo[e],{getPageMetaStyle:a}=pe(),l=f.useMemo(()=>{const{height:p,...h}=i;return h},[i]),d=f.useMemo(()=>{const p={};return e!=="custom-component"&&(p.height=i.height),p.sx=a("sx"),p},[i.height,e,a]),u=c&&o.jsx(c,{mode:n,...l,id:t,section:r});return o.jsx(Ie,{...s,...d,children:u})}function No(t){return t!=null}exports.Action=et;exports.BlockRenderer=Co;exports.IFrameBlockDefaultProps=so;exports.Icon=Z;exports.PageProvider=xe;exports.Provider=Te;exports.STATE_MODES=wo;exports.SectionBlockDefaultProps=fo;exports.TocDefaultProps=_o;exports.getPages=jo;exports.nonNullable=No;exports.publishPages=vo;
@@ -1,4 +1,4 @@
1
- "use strict";const r=require("react/jsx-runtime");require("@arcblock/ux/lib/Locale/context");const S=require("@arcblock/ux/lib/Theme");require("@blocklet/pages-kit/builtin/color-picker");require("@emotion/css");const n=require("@mui/material");require("ahooks");require("lodash/without");const a=require("react"),e=require("@mui/material/colors"),l=require("@blocklet/pages-kit/builtin/uploader"),z=require("@iconify-icon/react"),v=require("react-use"),q=require("./state-DDwYX2mu.js");e.red[300],e.pink[300],e.purple[300],e.indigo[300],e.blue[300],e.cyan[300],e.teal[300],e.green[300],e.lime[300],e.yellow[300],e.amber[300],e.orange[300],e.brown[300],e.grey[300],e.blueGrey[300];const w=a.forwardRef(function({showMarkdown:y,markdown:h,onMarkdownChange:u,showUploader:I,value:c,meta:P,onChange:s,...m},j){const[i,d]=a.useState("");a.useEffect(()=>{d(c||"")},[c,d]);const f=async()=>{if(i!==c){const t=q.getImageAbsoluteUrl(i);if(!t){s(i,void 0);return}const o=await l.getImageSize(t).catch(()=>l.getVideoSize(t)).catch(()=>{});s(i,{...o,filename:i})}};v.useDebounce(()=>{i!==c&&s(i)},300,[i]),a.useImperativeHandle(j,()=>({submit:f}));const b={};return I&&(b.InputProps={sx:{pr:0},endAdornment:r.jsx(n.InputAdornment,{position:"end",sx:{mx:.5},children:r.jsx(l.UploaderButton,{onChange:async({response:t})=>{var p;const o=(p=t==null?void 0:t.data)==null?void 0:p.filename,g=q.getImageAbsoluteUrl(o)||"";let x={};g&&(x=await l.getImageSize(g).catch(()=>l.getVideoSize(g)).catch(()=>{})),s(o,{...x,filename:o})}})})}),r.jsx(n.TextField,{size:"small",fullWidth:!0,...m,label:r.jsxs(n.Stack,{direction:"row",spacing:1,alignItems:"center",children:[m.label,y&&r.jsxs(r.Fragment,{children:[" (",r.jsx(n.FormControlLabel,{checked:h,label:r.jsx(n.Box,{component:z.Icon,icon:"tabler:markdown",sx:{verticalAlign:"middle"}}),labelPlacement:"start",control:r.jsx(n.Switch,{size:"small"}),sx:{ml:.25,pr:1},onChange:(t,o)=>u==null?void 0:u(o)}),")"]})]}),InputLabelProps:{shrink:!0,...m.InputLabelProps},value:i,onChange:t=>d(t.target.value),...b,onKeyDown:t=>{t.keyCode!==229&&t.key==="Enter"&&f()}})});S.styled(n.Box)`
1
+ "use strict";const i=require("react/jsx-runtime");require("@arcblock/ux/lib/Locale/context");const S=require("@arcblock/ux/lib/Theme");require("@blocklet/pages-kit/builtin/color-picker");require("@emotion/css");const n=require("@mui/material");require("ahooks");require("lodash/without");const a=require("react"),e=require("@mui/material/colors"),l=require("@blocklet/pages-kit/builtin/uploader"),z=require("@iconify-icon/react"),v=require("react-use"),q=require("./state-DDwYX2mu.js");e.red[300],e.pink[300],e.purple[300],e.indigo[300],e.blue[300],e.cyan[300],e.teal[300],e.green[300],e.lime[300],e.yellow[300],e.amber[300],e.orange[300],e.brown[300],e.grey[300],e.blueGrey[300];const w=a.forwardRef(function({showMarkdown:y,markdown:h,onMarkdownChange:u,showUploader:I,value:s,meta:P,onChange:c,...m},j){const[r,d]=a.useState("");a.useEffect(()=>{d(s||"")},[s,d]);const f=async()=>{if(r!==s){const t=q.getImageAbsoluteUrl(r);if(!t){c(r,void 0);return}const o=await l.getImageSize(t).catch(()=>l.getVideoSize(t)).catch(()=>{});c(r,{...o,filename:r})}};v.useDebounce(()=>{r!==s&&c(r)},300,[r]),a.useImperativeHandle(j,()=>({submit:f}));const b={};return I&&(b.InputProps={sx:{pr:0},endAdornment:i.jsx(n.InputAdornment,{position:"end",sx:{mx:.5},children:i.jsx(l.UploaderButton,{onChange:async({response:t})=>{var p;const o=(p=t==null?void 0:t.data)==null?void 0:p.filename,g=q.getImageAbsoluteUrl(o)||"";let x={};g&&(x=await l.getImageSize(g).catch(()=>l.getVideoSize(g)).catch(()=>{})),c(o,{...x,filename:o})}})})}),i.jsx(n.TextField,{size:"small",fullWidth:!0,...m,label:i.jsxs(n.Stack,{direction:"row",spacing:1,alignItems:"center",children:[m.label,y&&i.jsxs(i.Fragment,{children:[" (",i.jsx(n.FormControlLabel,{checked:h,label:i.jsx(n.Box,{component:z.Icon,icon:"tabler:markdown",sx:{verticalAlign:"middle"}}),labelPlacement:"start",control:i.jsx(n.Switch,{size:"small"}),sx:{ml:.25,pr:1},onChange:(t,o)=>u==null?void 0:u(o)}),")"]})]}),InputLabelProps:{shrink:!0,...m.InputLabelProps},value:r,onChange:t=>d(t.target.value),...b,onKeyDown:t=>{t.keyCode!==229&&t.key==="Enter"&&f()}})});S.styled(n.Box)`
2
2
  .color-item {
3
3
  position: relative;
4
4
  }
@@ -1,4 +1,4 @@
1
- "use strict";const t=require("react/jsx-runtime"),k=require("./state-DDwYX2mu.js"),C=require("lodash"),X=require("@arcblock/ux/lib/Locale/context"),re=require("@arcblock/ux/lib/Result"),ie=require("@blocklet/pages-kit/builtin/page/header"),ce=require("@blocklet/pages-kit/contexts/color"),le=require("@blocklet/ui-react/lib/Header"),Y=require("@emotion/css"),T=require("@emotion/react"),ae=require("@emotion/styled"),y=require("@mui/material"),ue=require("ahooks"),de=require("isomorphic-dompurify"),fe=require("lodash/cloneDeep"),me=require("lodash/isEmpty"),ge=require("lodash/isEqual"),x=require("react"),pe=require("react-helmet"),w=require("react-router-dom"),H=require("react-use"),E=require("ufo"),P=require("./array-CnXbKOG_.js"),N=require("@arcblock/ux/lib/Theme"),he=require("@blocklet/ui-react/lib/Footer"),xe=require("webfontloader"),je=require("@arcblock/did-connect/lib/Session"),v=e=>e&&e.__esModule?e:{default:e},F=v(re),be=v(le),Z=v(ae),ye=v(de),J=v(fe),ve=v(me),we=v(ge),Se=v(he),ke=v(xe);function Pe(e,s,o,r){e.locales||(e.locales={}),e.locales[o]=C.cloneDeep(e.locales[o]||{}),e.locales[o].title=r.title??e.locales[o].title,e.locales[o].image=r.image??e.locales[o].image,e.locales[o].description=r.description??e.locales[o].description,Object.entries(r.sectionsData).forEach(([c,n])=>{var l,m,j,d;const i=Object.values(e.sections).find(a=>a.id===c||a.name===c);if(i&&i.isTemplateSection)if(i.locales=C.cloneDeep(i.locales||{}),i.locales[o]=C.cloneDeep(i.locales[o]||{}),i.component==="custom-component"){const a=(l=i.config)==null?void 0:l.componentId;if(!a)return;const g=((m=s.components[a])==null?void 0:m.data)||((d=(j=s.resources.components)==null?void 0:j[a])==null?void 0:d.component);if(!g)return;i.locales[o].properties=C.cloneDeep(i.locales[o].properties||{}),Object.entries(n||{}).forEach(([p,u])=>{var h,_;const f=((h=g==null?void 0:g.properties)==null?void 0:h[p])||Object.values((g==null?void 0:g.properties)||{}).find(M=>{var q;return((q=M.data)==null?void 0:q.key)===p});f&&(i.locales[o].properties[(_=f.data)==null?void 0:_.id]={value:u})})}else i.locales[o]={...C.cloneDeep(i.locales[o]),...n||{}}})}const _e=N.styled(Se.default,{shouldForwardProp:e=>!!e})`
1
+ "use strict";const t=require("react/jsx-runtime"),k=require("./state-DDwYX2mu.js"),C=require("lodash"),Q=require("@arcblock/ux/lib/Locale/context"),re=require("@arcblock/ux/lib/Result"),ie=require("@blocklet/pages-kit/builtin/page/header"),ce=require("@blocklet/pages-kit/contexts/color"),le=require("@blocklet/ui-react/lib/Header"),X=require("@emotion/css"),T=require("@emotion/react"),ae=require("@emotion/styled"),y=require("@mui/material"),ue=require("ahooks"),de=require("isomorphic-dompurify"),fe=require("lodash/cloneDeep"),me=require("lodash/isEmpty"),ge=require("lodash/isEqual"),x=require("react"),pe=require("react-helmet"),w=require("react-router-dom"),H=require("react-use"),E=require("ufo"),P=require("./array-BwGaBJVb.js"),N=require("@arcblock/ux/lib/Theme"),he=require("@blocklet/ui-react/lib/Footer"),xe=require("webfontloader"),je=require("@arcblock/did-connect/lib/Session"),v=e=>e&&e.__esModule?e:{default:e},Y=v(re),be=v(le),Z=v(ae),ye=v(de),J=v(fe),ve=v(me),we=v(ge),Se=v(he),ke=v(xe);function Pe(e,s,o,r){e.locales||(e.locales={}),e.locales[o]=C.cloneDeep(e.locales[o]||{}),e.locales[o].title=r.title??e.locales[o].title,e.locales[o].image=r.image??e.locales[o].image,e.locales[o].description=r.description??e.locales[o].description,Object.entries(r.sectionsData).forEach(([c,n])=>{var l,m,j,d;const i=Object.values(e.sections).find(a=>a.id===c||a.name===c);if(i&&i.isTemplateSection)if(i.locales=C.cloneDeep(i.locales||{}),i.locales[o]=C.cloneDeep(i.locales[o]||{}),i.component==="custom-component"){const a=(l=i.config)==null?void 0:l.componentId;if(!a)return;const g=((m=s.components[a])==null?void 0:m.data)||((d=(j=s.resources.components)==null?void 0:j[a])==null?void 0:d.component);if(!g)return;i.locales[o].properties=C.cloneDeep(i.locales[o].properties||{}),Object.entries(n||{}).forEach(([p,u])=>{var h,_;const f=((h=g==null?void 0:g.properties)==null?void 0:h[p])||Object.values((g==null?void 0:g.properties)||{}).find(M=>{var q;return((q=M.data)==null?void 0:q.key)===p});f&&(i.locales[o].properties[(_=f.data)==null?void 0:_.id]={value:u})})}else i.locales[o]={...C.cloneDeep(i.locales[o]),...n||{}}})}const _e=N.styled(Se.default,{shouldForwardProp:e=>!!e})`
2
2
  & > div > .MuiContainer-root {
3
3
  max-width: unset;
4
4
  }
@@ -14,7 +14,7 @@
14
14
  transform: translateX(-23%) translateY(70%) rotate(-45deg);
15
15
  pointer-events: none;
16
16
  `,Me=e=>new Promise((s,o)=>{(e==null?void 0:e.length)>0?ke.default.load({google:{families:e},fontactive:()=>{s("success")},fontinactive:()=>{o(new Error("load font fail"))}}):s("success")}),O=`Avenir, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
17
- sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'`,Q={};function Ee({titleFontFamily:e,descriptionFontFamily:s}){var n;const o=y.useTheme(),r=(n=o==null?void 0:o.typography)==null?void 0:n.fontFamily,c=async i=>{if(i&&!document.querySelectorAll(`link[href*="${i}" i]`).length)try{Q[i]||(await Me([i]),Q[i]=!0)}catch(l){console.error(l)}};return x.useEffect(()=>{e&&c(e),s&&c(s)},[e,s]),t.jsx(T.Global,{styles:T.css`
17
+ sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'`,F={};function Ee({titleFontFamily:e,descriptionFontFamily:s}){var n;const o=y.useTheme(),r=(n=o==null?void 0:o.typography)==null?void 0:n.fontFamily,c=async i=>{if(i&&!document.querySelectorAll(`link[href*="${i}" i]`).length)try{F[i]||(await Me([i]),F[i]=!0)}catch(l){console.error(l)}};return x.useEffect(()=>{e&&c(e),s&&c(s)},[e,s]),t.jsx(T.Global,{styles:T.css`
18
18
  #app {
19
19
  font-family: ${JSON.stringify(r)}, ${O};
20
20
 
@@ -26,13 +26,13 @@
26
26
  font-family: ${JSON.stringify(s??r)}, ${O};
27
27
  }
28
28
  }
29
- `})}const{SessionProvider:De,SessionContext:Ie,SessionConsumer:$e,withSession:Ve}=je.createAuthServiceSessionContext();function A(){return x.useContext(Ie)}function Te(...e){var o;const{session:s}=A();return e.includes((o=s.user)==null?void 0:o.role)}function Be(...e){var r;const{session:s}=A(),o=Te(...e);return((r=window.blocklet)==null?void 0:r.tenantMode)==="multiple"?!!s.user:o}function Oe(){const[e]=w.useSearchParams(),{session:s}=A(),o=Be("owner","admin","pagesEditor","member"),r=x.useMemo(()=>{const n=e.get("mode");return P.STATE_MODES.includes(n)?n:"production"},[e]),c=r==="production"?r:s.user?o?r:"production":null;return c?t.jsx(ee,{mode:c}):null}function ee({mode:e}){if(e!=="draft"){const s=window.__PAGE_STATE__;return s?t.jsx(I,{mode:e,state:s}):t.jsx(Ne,{mode:e,children:({state:o})=>t.jsx(I,{mode:e,state:o})})}return t.jsx(He,{children:({state:s})=>t.jsx(I,{mode:e,state:s})})}const He=x.lazy(()=>Promise.resolve().then(()=>require("./draft-data-DPTVTTlh.js")));function Ne({mode:e,children:s}){const o=document.querySelector('meta[property="pages:version"]'),r=o==null?void 0:o.content,c=k.useProjectId(),n=x.useMemo(()=>{if(r==="{{pagesPublishedAt}}"){const m=localStorage.getItem(k.getProjectPageVersionKey(c??""));return Number(m)?Number(m):new Date().getTime()}return Number(r)},[r]),{loading:i,value:l}=H.useAsync(()=>P.getPages({mode:e,version:n}),[e,n]);return i?t.jsx(K,{}):l?s({state:l}):null}function I({mode:e,state:s}){const{t:o,locale:r}=X.useLocaleContext(),{pageIds:c,pages:n,supportedLocales:i,config:{defaultLocale:l},resources:m}=s,j=k.getAllComponents(s),d=x.useMemo(()=>i!=null&&i.some(u=>u.locale===r)?r:void 0,[r,i]),a=Object.values(n).find(u=>(u==null?void 0:u.slug)==="/")?void 0:Object.values(n)[0],g=x.useMemo(()=>c.map(u=>{const f=n[u];return f&&{id:f.id,path:E.joinURL("/",d||"",f.slug,e!=="production"?`?mode=${e}`:"")}}).filter(P.nonNullable),[c,n,d,e]),p=([...u])=>(e!=="production"&&u.unshift(t.jsx(x.Suspense,{fallback:t.jsx("div",{}),children:t.jsx(Le,{mode:"production",state:s})})),u);return t.jsxs(P.Provider,{value:{pages:g},children:[t.jsxs(w.Routes,{children:[a&&t.jsx(w.Route,{index:!0,element:t.jsx(w.Navigate,{to:E.joinURL("/",d||"",a.slug)})}),c.map(u=>{const f=n[u];return f?t.jsx(w.Route,{path:E.joinURL(":projectIdOrSlug?",f.slug),element:t.jsx(B,{mode:e,components:j,page:f,locale:d,defaultLocale:l,headerAddons:p})},f.id):null}),m.pages&&Object.values(m.pages).map(({blockletId:u,page:f})=>t.jsx(w.Route,{path:E.joinURL("/",`@${u}`,f.slug),element:t.jsx(B,{mode:e,components:j,page:f,locale:d,defaultLocale:l,headerAddons:p})},f.id)),t.jsx(w.Route,{path:"*",element:t.jsx(y.Box,{width:"100vw",height:"100vh",display:"flex",justifyContent:"center",alignItems:"center",children:t.jsx(F.default,{status:404,extra:t.jsx(ne,{href:"/",children:o("common.back")})})})})]}),e!=="production"&&t.jsx(Re,{sx:{bgcolor:"info.light"},children:e}),t.jsx(Ee,{})]})}function Ae({mode:e,state:s,path:o,pageData:r}){const{t:c,locale:n}=X.useLocaleContext(),{pages:i,supportedLocales:l,config:{defaultLocale:m},resources:j}=s,d=Object.values(i).find(h=>(h==null?void 0:h.slug)===o),a=Object.values(j.pages||{}).find(h=>h.page.slug===o),g=x.useMemo(()=>l!=null&&l.some(h=>h.locale===n)?n:void 0,[n,l]),p=ue.useReactive({page:null});x.useEffect(()=>{const h=d||(a==null?void 0:a.page)||null;h?p.page=J.default(h):p.page=null},[d,a]);const u=x.useRef();if(x.useEffect(()=>{we.default(r,u.current)||r&&p.page&&(Pe(p.page,s,g,r),u.current=J.default(r))},[{}]),!d&&!(a!=null&&a.page))return t.jsx(y.Box,{width:"100vw",height:"100vh",display:"flex",justifyContent:"center",alignItems:"center",children:t.jsx(F.default,{style:{background:"inherit"},status:404,extra:t.jsx(ne,{href:"/",children:c("common.back")})})});const f=k.getAllComponents(s);return p.page?t.jsx(B,{mode:e,components:f,page:p.page,locale:g,defaultLocale:m}):null}function B({mode:e,components:s,page:o,locale:r,defaultLocale:c,headerAddons:n}){var _,M,q,L,U,D,$,V,z;const i=ce.useColorConvert(),l=((_=o.locales)==null?void 0:_[r])??((M=o.locales)==null?void 0:M[c])??{},m=l.title||((q=window.blocklet)==null?void 0:q.appName),j=l.description||((L=window.blocklet)==null?void 0:L.appDescription),d=k.autoResizeImage(k.getImageAbsoluteUrl(l.image),540),{logo:a,brand:g,description:p,...u}=ie.useHeaderState(),f=x.useMemo(()=>S=>{var R;let b=(n==null?void 0:n(S))??S;return b=((R=u.addons)==null?void 0:R.call(u,b))??b,b},[u.addons,n]),h=(U=l.header)!=null&&U.translucent?oe:te;return t.jsxs(P.PageProvider,{page:o,defaultLocale:c,currentLocale:r,children:[!!l.backgroundColor&&t.jsx(T.Global,{styles:T.css`
29
+ `})}const{SessionProvider:De,SessionContext:Ie,SessionConsumer:$e,withSession:Ve}=je.createAuthServiceSessionContext();function A(){return x.useContext(Ie)}function Te(...e){var o;const{session:s}=A();return e.includes((o=s.user)==null?void 0:o.role)}function Be(...e){var r;const{session:s}=A(),o=Te(...e);return((r=window.blocklet)==null?void 0:r.tenantMode)==="multiple"?!!s.user:o}function Oe(){const[e]=w.useSearchParams(),{session:s}=A(),o=Be("owner","admin","pagesEditor","member"),r=x.useMemo(()=>{const n=e.get("mode");return P.STATE_MODES.includes(n)?n:"production"},[e]),c=r==="production"?r:s.user?o?r:"production":null;return c?t.jsx(ee,{mode:c}):null}function ee({mode:e}){if(e!=="draft"){const s=window.__PAGE_STATE__;return s?t.jsx(I,{mode:e,state:s}):t.jsx(Ne,{mode:e,children:({state:o})=>t.jsx(I,{mode:e,state:o})})}return t.jsx(He,{children:({state:s})=>t.jsx(I,{mode:e,state:s})})}const He=x.lazy(()=>Promise.resolve().then(()=>require("./draft-data-DPTVTTlh.js")));function Ne({mode:e,children:s}){const o=document.querySelector('meta[property="pages:version"]'),r=o==null?void 0:o.content,c=k.useProjectId(),n=x.useMemo(()=>{if(r==="{{pagesPublishedAt}}"){const m=localStorage.getItem(k.getProjectPageVersionKey(c??""));return Number(m)?Number(m):new Date().getTime()}return Number(r)},[r]),{loading:i,value:l}=H.useAsync(()=>P.getPages({mode:e,version:n}),[e,n]);return i?t.jsx(K,{}):l?s({state:l}):null}function I({mode:e,state:s}){const{t:o,locale:r}=Q.useLocaleContext(),{pageIds:c,pages:n,supportedLocales:i,config:{defaultLocale:l},resources:m}=s,j=k.getAllComponents(s),d=x.useMemo(()=>i!=null&&i.some(u=>u.locale===r)?r:void 0,[r,i]),a=Object.values(n).find(u=>(u==null?void 0:u.slug)==="/")?void 0:Object.values(n)[0],g=x.useMemo(()=>c.map(u=>{const f=n[u];return f&&{id:f.id,path:E.joinURL("/",d||"",f.slug,e!=="production"?`?mode=${e}`:"")}}).filter(P.nonNullable),[c,n,d,e]),p=([...u])=>(e!=="production"&&u.unshift(t.jsx(x.Suspense,{fallback:t.jsx("div",{}),children:t.jsx(Le,{mode:"production",state:s})})),u);return t.jsxs(P.Provider,{value:{pages:g},children:[t.jsxs(w.Routes,{children:[a&&t.jsx(w.Route,{index:!0,element:t.jsx(w.Navigate,{to:E.joinURL("/",d||"",a.slug)})}),c.map(u=>{const f=n[u];return f?t.jsx(w.Route,{path:E.joinURL(":projectIdOrSlug?",f.slug),element:t.jsx(B,{mode:e,components:j,page:f,locale:d,defaultLocale:l,headerAddons:p})},f.id):null}),m.pages&&Object.values(m.pages).map(({blockletId:u,page:f})=>t.jsx(w.Route,{path:E.joinURL("/",`@${u}`,f.slug),element:t.jsx(B,{mode:e,components:j,page:f,locale:d,defaultLocale:l,headerAddons:p})},f.id)),t.jsx(w.Route,{path:"*",element:t.jsx(y.Box,{width:"100vw",height:"100vh",display:"flex",justifyContent:"center",alignItems:"center",children:t.jsx(Y.default,{status:404,extra:t.jsx(ne,{href:"/",children:o("common.back")})})})})]}),e!=="production"&&t.jsx(Re,{sx:{bgcolor:"info.light"},children:e}),t.jsx(Ee,{})]})}function Ae({mode:e,state:s,path:o,pageData:r}){const{t:c,locale:n}=Q.useLocaleContext(),{pages:i,supportedLocales:l,config:{defaultLocale:m},resources:j}=s,d=Object.values(i).find(h=>(h==null?void 0:h.slug)===o),a=Object.values(j.pages||{}).find(h=>h.page.slug===o),g=x.useMemo(()=>l!=null&&l.some(h=>h.locale===n)?n:void 0,[n,l]),p=ue.useReactive({page:null});x.useEffect(()=>{const h=d||(a==null?void 0:a.page)||null;h?p.page=J.default(h):p.page=null},[d,a]);const u=x.useRef();if(x.useEffect(()=>{we.default(r,u.current)||r&&p.page&&(Pe(p.page,s,g,r),u.current=J.default(r))},[{}]),!d&&!(a!=null&&a.page))return t.jsx(y.Box,{width:"100vw",height:"100vh",display:"flex",justifyContent:"center",alignItems:"center",children:t.jsx(Y.default,{style:{background:"inherit"},status:404,extra:t.jsx(ne,{href:"/",children:c("common.back")})})});const f=k.getAllComponents(s);return p.page?t.jsx(B,{mode:e,components:f,page:p.page,locale:g,defaultLocale:m}):null}function B({mode:e,components:s,page:o,locale:r,defaultLocale:c,headerAddons:n}){var _,M,q,L,U,D,$,V,z;const i=ce.useColorConvert(),l=((_=o.locales)==null?void 0:_[r])??((M=o.locales)==null?void 0:M[c])??{},m=l.title||((q=window.blocklet)==null?void 0:q.appName),j=l.description||((L=window.blocklet)==null?void 0:L.appDescription),d=k.autoResizeImage(k.getImageAbsoluteUrl(l.image),540),{logo:a,brand:g,description:p,...u}=ie.useHeaderState(),f=x.useMemo(()=>S=>{var R;let b=(n==null?void 0:n(S))??S;return b=((R=u.addons)==null?void 0:R.call(u,b))??b,b},[u.addons,n]),h=(U=l.header)!=null&&U.translucent?oe:te;return t.jsxs(P.PageProvider,{page:o,defaultLocale:c,currentLocale:r,children:[!!l.backgroundColor&&t.jsx(T.Global,{styles:T.css`
30
30
  body {
31
31
  background-color: ${i(l.backgroundColor)} !important;
32
32
  }
33
- `}),t.jsx(h,{hideNavMenu:!!((D=l.header)!=null&&D.hideNavMenus),translucentTextColor:($=l.header)==null?void 0:$.translucentTextColor,...a?{logo:a}:{},...g?{brand:g}:{},...p?{description:p}:{},className:Y.cx(((V=l.header)==null?void 0:V.sticky)&&"sticky","page-header"),maxWidth:!1,addons:f}),t.jsx(w.ScrollRestoration,{}),t.jsxs(pe.Helmet,{children:[t.jsx("title",{children:m}),t.jsx("meta",{name:"og:title",content:m}),t.jsx("meta",{name:"og:description",content:j}),t.jsx("meta",{name:"og:image",content:d}),t.jsx("meta",{name:"twitter:image:src",content:d}),t.jsx("meta",{name:"twitter:image",content:d}),t.jsx("meta",{property:"twitter:description",content:j}),t.jsx("meta",{property:"twitter:title",content:m}),t.jsx("meta",{name:"description",content:j})]}),t.jsx(y.Stack,{flexGrow:1,className:"PageView-root",sx:{"& .BlockBase-root:first-child":{pt:"0 !important"}},children:o.sectionIds.map(S=>{var G,W;const b=o.sections[S];if(!b||b.visibility==="hidden")return null;const R=(G=b.locales)==null?void 0:G[r],se=((W=b.locales)==null?void 0:W[c])??{};return t.jsx(P.BlockRenderer,{id:S,type:b.component,mode:e,section:b,config:{...ve.default(R)?se:R,locale:r,dev:e==="draft"?{mode:e,components:s,defaultLocale:c}:{mode:e}}},S)})}),!((z=l.footer)!=null&&z.hidden)&&t.jsx(qe,{})]})}const Le=x.lazy(()=>Promise.resolve().then(()=>require("./publish-button-B7nhzpwi.js"))),te=Z.default(be.default)`
33
+ `}),t.jsx(h,{hideNavMenu:!!((D=l.header)!=null&&D.hideNavMenus),translucentTextColor:($=l.header)==null?void 0:$.translucentTextColor,...a?{logo:a}:{},...g?{brand:g}:{},...p?{description:p}:{},className:X.cx(((V=l.header)==null?void 0:V.sticky)&&"sticky","page-header"),maxWidth:!1,addons:f}),t.jsx(w.ScrollRestoration,{}),t.jsxs(pe.Helmet,{children:[t.jsx("title",{children:m}),t.jsx("meta",{name:"og:title",content:m}),t.jsx("meta",{name:"og:description",content:j}),t.jsx("meta",{name:"og:image",content:d}),t.jsx("meta",{name:"twitter:image:src",content:d}),t.jsx("meta",{name:"twitter:image",content:d}),t.jsx("meta",{property:"twitter:description",content:j}),t.jsx("meta",{property:"twitter:title",content:m}),t.jsx("meta",{name:"description",content:j})]}),t.jsx(y.Stack,{flexGrow:1,className:"PageView-root",sx:{"& .BlockBase-root:first-child":{pt:"0 !important"}},children:o.sectionIds.map(S=>{var G,W;const b=o.sections[S];if(!b||b.visibility==="hidden")return null;const R=(G=b.locales)==null?void 0:G[r],se=((W=b.locales)==null?void 0:W[c])??{};return t.jsx(P.BlockRenderer,{id:S,type:b.component,mode:e,section:b,config:{...ve.default(R)?se:R,locale:r,dev:e==="draft"?{mode:e,components:s,defaultLocale:c}:{mode:e}}},S)})}),!((z=l.footer)!=null&&z.hidden)&&t.jsx(qe,{})]})}const Le=x.lazy(()=>Promise.resolve().then(()=>require("./publish-button-TrJpN62K.js"))),te=Z.default(be.default)`
34
34
  &.sticky {
35
35
  position: sticky;
36
36
  top: 0;
37
37
  }
38
- `;function Ue({logo:e}){const[s,o]=x.useState(),r=y.useMediaQuery(n=>n.breakpoints.down("sm")),{value:c}=H.useAsync(()=>{var l,m;const n=new URL(r?((l=window==null?void 0:window.blocklet)==null?void 0:l.appLogo)||"/.well-known/service/blocklet/logo":((m=window==null?void 0:window.blocklet)==null?void 0:m.appLogoRect)||"/.well-known/service/blocklet/logo-rect",window.location.origin);n.searchParams.delete("imageFilter"),n.searchParams.delete("f");const i=n.toString();return new Promise(j=>{fetch(i).then(d=>{const a=d.headers.get("content-type");a!=null&&a.includes("svg")&&d.text().then(g=>{o(g),j(null)}),j(d.url)})})},[r]);if(e)return e;if(s)return t.jsx(y.Box,{sx:{filter:"initial !important"},dangerouslySetInnerHTML:{__html:ye.default.sanitize(s)}});if(c){const n=new URL(c);n.searchParams.set("imageFilter","convert"),n.searchParams.set("f","png"),n.searchParams.set("h","80");const i=n.toString();return t.jsx("img",{src:i,alt:"logo"})}return null}function oe({logo:e,translucentTextColor:s,...o}){const{y:r}=H.useWindowScroll();let c=Math.min(r/800,1),n="";if(c>.1){c=Math.max(c,.6);const i=Math.round(255*Math.min(1-c,.2));n=`rgb(${i}, ${i}, ${i})`}else n=s||"#EEEEEE";return t.jsx(te,{logo:t.jsx(Ue,{logo:e}),...o,className:Y.cx(c<=.7&&"reverse-color"),style:{backgroundColor:`rgba(255,255,255,${c})`,"--logo-invert":c<=.7?1-c/6:1-c},sx:{backdropFilter:c>=.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:`${n} !important`}},".header-logo > div":{filter:"invert(var(--logo-invert))"},".header-logo":{color:n}}})}const ne=Z.default(y.Button)``;exports.Home=Oe;exports.HomeView=ee;exports.Loading=K;exports.PageRoutes=I;exports.PageView=B;exports.PageViewByPath=Ae;exports.TranslucentHeader=oe;
38
+ `;function Ue({logo:e}){const[s,o]=x.useState(),r=y.useMediaQuery(n=>n.breakpoints.down("sm")),{value:c}=H.useAsync(()=>{var l,m;const n=new URL(r?((l=window==null?void 0:window.blocklet)==null?void 0:l.appLogo)||"/.well-known/service/blocklet/logo":((m=window==null?void 0:window.blocklet)==null?void 0:m.appLogoRect)||"/.well-known/service/blocklet/logo-rect",window.location.origin);n.searchParams.delete("imageFilter"),n.searchParams.delete("f");const i=n.toString();return new Promise(j=>{fetch(i).then(d=>{const a=d.headers.get("content-type");a!=null&&a.includes("svg")&&d.text().then(g=>{o(g),j(null)}),j(d.url)})})},[r]);if(e)return e;if(s)return t.jsx(y.Box,{sx:{filter:"initial !important"},dangerouslySetInnerHTML:{__html:ye.default.sanitize(s)}});if(c){const n=new URL(c);n.searchParams.set("imageFilter","convert"),n.searchParams.set("f","png"),n.searchParams.set("h","80");const i=n.toString();return t.jsx("img",{src:i,alt:"logo"})}return null}function oe({logo:e,translucentTextColor:s,...o}){const{y:r}=H.useWindowScroll();let c=Math.min(r/800,1),n="";if(c>.1){c=Math.max(c,.6);const i=Math.round(255*Math.min(1-c,.2));n=`rgb(${i}, ${i}, ${i})`}else n=s||"#EEEEEE";return t.jsx(te,{logo:t.jsx(Ue,{logo:e}),...o,className:X.cx(c<=.7&&"reverse-color"),style:{backgroundColor:`rgba(255,255,255,${c})`,"--logo-invert":c<=.7?1-c/6:1-c},sx:{backdropFilter:c>=.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:`${n} !important`}},".header-logo > div":{filter:"invert(var(--logo-invert))"},".header-logo":{color:n}}})}const ne=Z.default(y.Button)``;exports.Home=Oe;exports.HomeView=ee;exports.Loading=K;exports.PageRoutes=I;exports.PageView=B;exports.PageViewByPath=Ae;exports.TranslucentHeader=oe;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),v=require("./state-DDwYX2mu.js"),D=require("@arcblock/ux/lib/Locale/context"),O=require("@arcblock/ux/lib/Toast"),S=require("@mui/icons-material"),q=require("@mui/lab"),s=require("@mui/material"),W=require("immer"),z=require("lodash/difference"),c=require("react"),_=require("react-use"),N=require("./home-BXkUy2B8.js"),E=require("./array-CnXbKOG_.js"),M=t=>t&&t.__esModule?t:{default:t},A=M(O),C=M(z);function R(t){const[d,b]=c.useState(!1);return e.jsx(q.LoadingButton,{...t,loading:t.loading||d,onClick:i=>{var h;const m=(h=t.onClick)==null?void 0:h.call(t,i);m instanceof Promise&&(b(!0),m.finally(()=>{b(!1)}))}})}const F=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 H(){const[t,d]=c.useState(),b=c.useMemo(()=>t?e.jsx(s.Dialog,{...t}):null,[t]),i=c.useCallback(()=>{d(void 0)},[]),m=c.useCallback(({title:h,content:g,cancelText:T="Cancel",okText:p="Ok",onOk:f,onClose:k,okIcon:L,okColor:n="primary",cancelColor:y="primary",DialogContentProps:u,form:x,...I})=>{d({...I,open:!0,children:e.jsxs("form",{onSubmit:P=>P.preventDefault(),children:[h&&e.jsxs(s.DialogTitle,{className:"between",zIndex:"appBar",bgcolor:"background.paper",sx:{borderBottom:"1px solid #E5E7EB"},children:[e.jsx(s.Box,{children:h}),e.jsx(s.IconButton,{size:"small",onClick:async()=>{i(),k==null||k()},children:e.jsx(F,{})})]}),g&&e.jsx(s.DialogContent,{...u,sx:{mt:-3,...u==null?void 0:u.sx},children:e.jsx(s.Box,{pt:3,children:g})}),e.jsxs(s.DialogActions,{children:[e.jsx(s.Button,{variant:"outlined",color:y||"primary",onClick:k??i,children:T}),e.jsx(R,{variant:"contained",color:n||"primary",startIcon:L,loadingPosition:L?"start":"center",onClick:async()=>{await(f==null?void 0:f()),i()},type:"submit",children:p})]})]}),onClose:k??i})},[i]);return{dialog:b,showDialog:m,closeDialog:i}}const J=c.forwardRef(({mode:t,state:d},b)=>{const{t:i}=D.useLocaleContext(),[m,h]=c.useState(!1),{dialog:g,showDialog:T}=H(),p=v.useProjectId(),f=c.useCallback(L=>{let n=[];T({title:i("maker.publishToProduction"),content:e.jsxs(s.Box,{sx:{minWidth:300},children:[e.jsx(s.Alert,{color:"warning",icon:e.jsx(S.Warning,{}),children:i("maker.publishToProductionTip")}),e.jsx(s.Box,{maxHeight:"50vh",overflow:"auto",mt:2,children:e.jsx(V,{state:d,toMode:t,onChange:y=>n=y,defaultPageIds:L})})]}),okText:i("maker.publish"),cancelText:i("common.cancel"),onOk:async()=>{var y,u;if((n==null?void 0:n.length)===0){const x=i("maker.publishSelectPagesMessage");throw A.default.error(x),new Error(x)}for(const x of n??d.pageIds){const I=d.pages[x];if(I){const P=(u=(y=v.checkPage(i,I,d))==null?void 0:y[0])==null?void 0:u.message;if(P)throw A.default.error(P),new Error(P)}}localStorage.setItem(v.getProjectPageVersionKey(p??""),String(new Date().getTime())),h(!0);try{await E.publishPages({mode:t,pages:n}),A.default.success(i("maker.publishSuccessMessage"))}catch(x){throw A.default.error(x.message),x}finally{h(!1)}}})},[t,d,i,p,T]);c.useImperativeHandle(b,()=>({openPublishDialog:f}));const k=c.useCallback(()=>{f()},[f]);return e.jsxs(e.Fragment,{children:[e.jsx(q.LoadingButton,{color:"primary",variant:"contained",size:"small",sx:{mr:1},onClick:k,loading:m,disabled:m,children:i("maker.publishToProduction")}),g]})});function V({state:t,toMode:d,onChange:b,defaultPageIds:i}){const{t:m,locale:h}=D.useLocaleContext(),[g,T]=c.useState(!1),[p,f]=c.useState(()=>i?Object.fromEntries(i.map(r=>[r,!0])):{}),{loading:k,error:L,value:n}=_.useAsync(()=>E.getPages({mode:d}),[d]);if(L)throw L;const y=c.useMemo(()=>JSON.parse(JSON.stringify(t.pageIds)).sort((a,j)=>{const o=t.pages[a],l=t.pages[j];return o!=null&&o.publishedAt&&new Date(o.publishedAt).getTime()<new Date(o.updatedAt).getTime()?-1:l!=null&&l.publishedAt&&new Date(l.publishedAt).getTime()<new Date(l.updatedAt).getTime()?1:new Date((o==null?void 0:o.updatedAt)??"").getTime()-new Date((l==null?void 0:l.updatedAt)??"").getTime()}),[t]),u=c.useMemo(()=>n?C.default(n.pageIds,t.pageIds):[],[t,n]),x=c.useMemo(()=>[...t.pageIds].concat(u),[t,u]),I=c.useCallback(r=>{f(a=>{const j=W.produce(a,o=>{g?(Object.assign(o,Object.fromEntries(x.map(l=>[l,!0]))),delete o[r]):o[r]?(delete o[r],u.includes(r)&&t.pageIds.filter(l=>{var w,B;return((w=t.pages[l])==null?void 0:w.slug)===((B=n==null?void 0:n.pages[r])==null?void 0:B.slug)}).forEach(l=>{delete o[l]})):(o[r]=!0,t.pageIds.includes(r)&&u.filter(l=>{var w,B;return((w=n==null?void 0:n.pages[l])==null?void 0:w.slug)===((B=t.pages[r])==null?void 0:B.slug)}).forEach(l=>{o[l]=!0}))});return T(C.default(x,Object.keys(j)).length===0),j})},[g,x,u,t,n]),P=c.useCallback(()=>{T(r=>(r&&f({}),!r))},[p]);return c.useEffect(()=>{b(g?null:Object.keys(p))},[g,p,b]),k?e.jsx(N.Loading,{sx:{my:4}}):e.jsxs(s.List,{disablePadding:!0,sx:{maxWidth:500},children:[e.jsx(s.ListItem,{sx:{position:"sticky",top:0,bgcolor:"background.paper",zIndex:1},disablePadding:!0,children:e.jsxs(s.ListItemButton,{onClick:P,dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:g,tabIndex:-1})}),e.jsx(s.ListItemText,{primary:m("common.all")})]})}),y.map(r=>{var l,w;const a=t.pages[r];if(!a)return null;const j=v.checkPage(m,a,t),o=!a.publishedAt||a.updatedAt&&new Date(a.updatedAt).getTime()>new Date(a.publishedAt).getTime();return e.jsx(s.ListItem,{disablePadding:!0,secondaryAction:e.jsxs(e.Fragment,{children:[o&&e.jsx(s.Tooltip,{title:m("maker.pages.needPublish"),children:e.jsx(S.Sync,{fontSize:"small",sx:{color:"warning.main",fontSize:16,mr:.35}})}),!a.isPublic&&e.jsx(s.Tooltip,{title:m("maker.pages.notPublic"),children:e.jsx(S.VisibilityOff,{fontSize:"small",sx:{color:"warning.main",fontSize:16,mr:.35}})}),j&&e.jsx(v.PageErrorTip,{errors:j,children:e.jsx(S.Warning,{sx:{color:"error.dark",mr:.35}})})]}),children:e.jsxs(s.ListItemButton,{onClick:()=>I(r),dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:g||!!p[r],tabIndex:-1})}),e.jsx(s.ListItemText,{primary:a.slug,secondary:(w=(l=a.locales)==null?void 0:l[h])==null?void 0:w.title,primaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"},secondaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"}})]})},r)}),u.map(r=>{var j,o;const a=n==null?void 0:n.pages[r];return a?e.jsx(s.ListItem,{disablePadding:!0,secondaryAction:e.jsx(s.Chip,{color:"warning",label:"deleted",size:"small"}),children:e.jsxs(s.ListItemButton,{onClick:()=>I(r),dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:g||!!p[r],tabIndex:-1})}),e.jsx(s.ListItemText,{primary:a.slug,secondary:(o=(j=a.locales)==null?void 0:j[h])==null?void 0:o.title,primaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"},secondaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"}})]})},r):null})]})}exports.default=J;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),v=require("./state-DDwYX2mu.js"),D=require("@arcblock/ux/lib/Locale/context"),O=require("@arcblock/ux/lib/Toast"),S=require("@mui/icons-material"),q=require("@mui/lab"),s=require("@mui/material"),W=require("immer"),z=require("lodash/difference"),c=require("react"),_=require("react-use"),N=require("./home-CXupaCeO.js"),E=require("./array-BwGaBJVb.js"),M=t=>t&&t.__esModule?t:{default:t},A=M(O),C=M(z);function R(t){const[d,b]=c.useState(!1);return e.jsx(q.LoadingButton,{...t,loading:t.loading||d,onClick:i=>{var h;const m=(h=t.onClick)==null?void 0:h.call(t,i);m instanceof Promise&&(b(!0),m.finally(()=>{b(!1)}))}})}const F=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 H(){const[t,d]=c.useState(),b=c.useMemo(()=>t?e.jsx(s.Dialog,{...t}):null,[t]),i=c.useCallback(()=>{d(void 0)},[]),m=c.useCallback(({title:h,content:g,cancelText:T="Cancel",okText:p="Ok",onOk:f,onClose:k,okIcon:L,okColor:n="primary",cancelColor:y="primary",DialogContentProps:u,form:x,...I})=>{d({...I,open:!0,children:e.jsxs("form",{onSubmit:P=>P.preventDefault(),children:[h&&e.jsxs(s.DialogTitle,{className:"between",zIndex:"appBar",bgcolor:"background.paper",sx:{borderBottom:"1px solid #E5E7EB"},children:[e.jsx(s.Box,{children:h}),e.jsx(s.IconButton,{size:"small",onClick:async()=>{i(),k==null||k()},children:e.jsx(F,{})})]}),g&&e.jsx(s.DialogContent,{...u,sx:{mt:-3,...u==null?void 0:u.sx},children:e.jsx(s.Box,{pt:3,children:g})}),e.jsxs(s.DialogActions,{children:[e.jsx(s.Button,{variant:"outlined",color:y||"primary",onClick:k??i,children:T}),e.jsx(R,{variant:"contained",color:n||"primary",startIcon:L,loadingPosition:L?"start":"center",onClick:async()=>{await(f==null?void 0:f()),i()},type:"submit",children:p})]})]}),onClose:k??i})},[i]);return{dialog:b,showDialog:m,closeDialog:i}}const J=c.forwardRef(({mode:t,state:d},b)=>{const{t:i}=D.useLocaleContext(),[m,h]=c.useState(!1),{dialog:g,showDialog:T}=H(),p=v.useProjectId(),f=c.useCallback(L=>{let n=[];T({title:i("maker.publishToProduction"),content:e.jsxs(s.Box,{sx:{minWidth:300},children:[e.jsx(s.Alert,{color:"warning",icon:e.jsx(S.Warning,{}),children:i("maker.publishToProductionTip")}),e.jsx(s.Box,{maxHeight:"50vh",overflow:"auto",mt:2,children:e.jsx(V,{state:d,toMode:t,onChange:y=>n=y,defaultPageIds:L})})]}),okText:i("maker.publish"),cancelText:i("common.cancel"),onOk:async()=>{var y,u;if((n==null?void 0:n.length)===0){const x=i("maker.publishSelectPagesMessage");throw A.default.error(x),new Error(x)}for(const x of n??d.pageIds){const I=d.pages[x];if(I){const P=(u=(y=v.checkPage(i,I,d))==null?void 0:y[0])==null?void 0:u.message;if(P)throw A.default.error(P),new Error(P)}}localStorage.setItem(v.getProjectPageVersionKey(p??""),String(new Date().getTime())),h(!0);try{await E.publishPages({mode:t,pages:n}),A.default.success(i("maker.publishSuccessMessage"))}catch(x){throw A.default.error(x.message),x}finally{h(!1)}}})},[t,d,i,p,T]);c.useImperativeHandle(b,()=>({openPublishDialog:f}));const k=c.useCallback(()=>{f()},[f]);return e.jsxs(e.Fragment,{children:[e.jsx(q.LoadingButton,{color:"primary",variant:"contained",size:"small",sx:{mr:1},onClick:k,loading:m,disabled:m,children:i("maker.publishToProduction")}),g]})});function V({state:t,toMode:d,onChange:b,defaultPageIds:i}){const{t:m,locale:h}=D.useLocaleContext(),[g,T]=c.useState(!1),[p,f]=c.useState(()=>i?Object.fromEntries(i.map(r=>[r,!0])):{}),{loading:k,error:L,value:n}=_.useAsync(()=>E.getPages({mode:d}),[d]);if(L)throw L;const y=c.useMemo(()=>JSON.parse(JSON.stringify(t.pageIds)).sort((a,j)=>{const o=t.pages[a],l=t.pages[j];return o!=null&&o.publishedAt&&new Date(o.publishedAt).getTime()<new Date(o.updatedAt).getTime()?-1:l!=null&&l.publishedAt&&new Date(l.publishedAt).getTime()<new Date(l.updatedAt).getTime()?1:new Date((o==null?void 0:o.updatedAt)??"").getTime()-new Date((l==null?void 0:l.updatedAt)??"").getTime()}),[t]),u=c.useMemo(()=>n?C.default(n.pageIds,t.pageIds):[],[t,n]),x=c.useMemo(()=>[...t.pageIds].concat(u),[t,u]),I=c.useCallback(r=>{f(a=>{const j=W.produce(a,o=>{g?(Object.assign(o,Object.fromEntries(x.map(l=>[l,!0]))),delete o[r]):o[r]?(delete o[r],u.includes(r)&&t.pageIds.filter(l=>{var w,B;return((w=t.pages[l])==null?void 0:w.slug)===((B=n==null?void 0:n.pages[r])==null?void 0:B.slug)}).forEach(l=>{delete o[l]})):(o[r]=!0,t.pageIds.includes(r)&&u.filter(l=>{var w,B;return((w=n==null?void 0:n.pages[l])==null?void 0:w.slug)===((B=t.pages[r])==null?void 0:B.slug)}).forEach(l=>{o[l]=!0}))});return T(C.default(x,Object.keys(j)).length===0),j})},[g,x,u,t,n]),P=c.useCallback(()=>{T(r=>(r&&f({}),!r))},[p]);return c.useEffect(()=>{b(g?null:Object.keys(p))},[g,p,b]),k?e.jsx(N.Loading,{sx:{my:4}}):e.jsxs(s.List,{disablePadding:!0,sx:{maxWidth:500},children:[e.jsx(s.ListItem,{sx:{position:"sticky",top:0,bgcolor:"background.paper",zIndex:1},disablePadding:!0,children:e.jsxs(s.ListItemButton,{onClick:P,dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:g,tabIndex:-1})}),e.jsx(s.ListItemText,{primary:m("common.all")})]})}),y.map(r=>{var l,w;const a=t.pages[r];if(!a)return null;const j=v.checkPage(m,a,t),o=!a.publishedAt||a.updatedAt&&new Date(a.updatedAt).getTime()>new Date(a.publishedAt).getTime();return e.jsx(s.ListItem,{disablePadding:!0,secondaryAction:e.jsxs(e.Fragment,{children:[o&&e.jsx(s.Tooltip,{title:m("maker.pages.needPublish"),children:e.jsx(S.Sync,{fontSize:"small",sx:{color:"warning.main",fontSize:16,mr:.35}})}),!a.isPublic&&e.jsx(s.Tooltip,{title:m("maker.pages.notPublic"),children:e.jsx(S.VisibilityOff,{fontSize:"small",sx:{color:"warning.main",fontSize:16,mr:.35}})}),j&&e.jsx(v.PageErrorTip,{errors:j,children:e.jsx(S.Warning,{sx:{color:"error.dark",mr:.35}})})]}),children:e.jsxs(s.ListItemButton,{onClick:()=>I(r),dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:g||!!p[r],tabIndex:-1})}),e.jsx(s.ListItemText,{primary:a.slug,secondary:(w=(l=a.locales)==null?void 0:l[h])==null?void 0:w.title,primaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"},secondaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"}})]})},r)}),u.map(r=>{var j,o;const a=n==null?void 0:n.pages[r];return a?e.jsx(s.ListItem,{disablePadding:!0,secondaryAction:e.jsx(s.Chip,{color:"warning",label:"deleted",size:"small"}),children:e.jsxs(s.ListItemButton,{onClick:()=>I(r),dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:g||!!p[r],tabIndex:-1})}),e.jsx(s.ListItemText,{primary:a.slug,secondary:(o=(j=a.locales)==null?void 0:j[h])==null?void 0:o.title,primaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"},secondaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"}})]})},r):null})]})}exports.default=J;
package/lib/cjs/home.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("react/jsx-runtime");require("./chunks/state-DDwYX2mu.js");const e=require("./chunks/home-BXkUy2B8.js");require("@arcblock/ux/lib/Locale/context");require("@arcblock/ux/lib/Result");require("@blocklet/pages-kit/builtin/page/header");require("@blocklet/pages-kit/contexts/color");require("@blocklet/ui-react/lib/Header");require("@emotion/css");require("@emotion/react");require("@emotion/styled");require("@mui/material");require("ahooks");require("isomorphic-dompurify");require("lodash/cloneDeep");require("lodash/isEmpty");require("lodash/isEqual");require("react");require("react-helmet");require("react-router-dom");require("react-use");require("ufo");require("./chunks/array-CnXbKOG_.js");exports.HomeView=e.HomeView;exports.PageRoutes=e.PageRoutes;exports.PageView=e.PageView;exports.PageViewByPath=e.PageViewByPath;exports.TranslucentHeader=e.TranslucentHeader;exports.default=e.Home;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("react/jsx-runtime");require("./chunks/state-DDwYX2mu.js");const e=require("./chunks/home-CXupaCeO.js");require("@arcblock/ux/lib/Locale/context");require("@arcblock/ux/lib/Result");require("@blocklet/pages-kit/builtin/page/header");require("@blocklet/pages-kit/contexts/color");require("@blocklet/ui-react/lib/Header");require("@emotion/css");require("@emotion/react");require("@emotion/styled");require("@mui/material");require("ahooks");require("isomorphic-dompurify");require("lodash/cloneDeep");require("lodash/isEmpty");require("lodash/isEqual");require("react");require("react-helmet");require("react-router-dom");require("react-use");require("ufo");require("./chunks/array-BwGaBJVb.js");exports.HomeView=e.HomeView;exports.PageRoutes=e.PageRoutes;exports.PageView=e.PageView;exports.PageViewByPath=e.PageViewByPath;exports.TranslucentHeader=e.TranslucentHeader;exports.default=e.Home;