@blocklet/pages-kit-inner-components 0.4.117 → 0.4.119

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/lib/cjs/add-component.js +8 -8
  2. package/lib/cjs/chunks/{array-C2Xw0f0u.js → array-DOclwySd.js} +16 -16
  3. package/lib/cjs/chunks/{config-color-C8L0QSPJ.js → config-color-C8kj-s2C.js} +1 -1
  4. package/lib/cjs/chunks/{draft-data-DPTVTTlh.js → draft-data-CRdesc3Z.js} +1 -1
  5. package/lib/cjs/chunks/home-DdhcZ60U.js +38 -0
  6. package/lib/cjs/chunks/publish-button-DrP2fRq-.js +1 -0
  7. package/lib/cjs/chunks/site-state-BMf96RZL.js +57 -0
  8. package/lib/cjs/chunks/state-oc52fQ0j.js +1 -0
  9. package/lib/cjs/components.js +1 -1
  10. package/lib/cjs/home.js +1 -1
  11. package/lib/cjs/locales.js +1 -1
  12. package/lib/cjs/project-html.js +1 -1
  13. package/lib/cjs/resources.js +1 -1
  14. package/lib/cjs/setting.js +1 -1
  15. package/lib/cjs/site-state.js +1 -1
  16. package/lib/es/add-component.js +125 -120
  17. package/lib/es/chunks/{array-HoE78hbE.js → array-BXCsMjKT.js} +295 -290
  18. package/lib/es/chunks/{config-color-JrBPRsTv.js → config-color-CXt_ZsC_.js} +1 -1
  19. package/lib/es/chunks/{draft-data-BFlmvWXx.js → draft-data-BwyMBf8Y.js} +1 -1
  20. package/lib/es/chunks/home-Cqrxr0ko.js +505 -0
  21. package/lib/es/chunks/publish-button-BFkn3oDY.js +295 -0
  22. package/lib/es/chunks/site-state-kjir-UCL.js +1718 -0
  23. package/lib/es/chunks/state-Dz3GnGWC.js +437 -0
  24. package/lib/es/components.js +1 -1
  25. package/lib/es/home.js +10 -8
  26. package/lib/es/locales.js +81 -17
  27. package/lib/es/project-html.js +1 -1
  28. package/lib/es/resources.js +1 -1
  29. package/lib/es/setting.js +2 -2
  30. package/lib/es/site-state.js +13 -12
  31. package/package.json +3 -3
  32. package/lib/cjs/chunks/home-B4-4gx2w.js +0 -38
  33. package/lib/cjs/chunks/publish-button-aUYadvYo.js +0 -1
  34. package/lib/cjs/chunks/site-state-D15mduKB.js +0 -57
  35. package/lib/cjs/chunks/state-DDwYX2mu.js +0 -1
  36. package/lib/es/chunks/home-DEsyT9zq.js +0 -475
  37. package/lib/es/chunks/publish-button-CFMTt6k_.js +0 -282
  38. package/lib/es/chunks/site-state-DJ_KkVbi.js +0 -1548
  39. package/lib/es/chunks/state-BgKqNapt.js +0 -425
@@ -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-C2Xw0f0u.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)`
1
+ "use strict";var XI=Object.create;var CI=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&&CI(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?CI(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-oc52fQ0j.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-DOclwySd.js"),U=require("./chunks/config-color-C8kj-s2C.js"),kI=require("lodash/cloneDeep"),Y=require("@mui/icons-material"),gI=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"),OI=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"),mI=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"),P=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"),AI=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(OI),dC=F(UI),_=F(fI),x=F(GI),q=F(VI),$=F(vI),cC=F(PI),zC=F(_I),FC=F(qI),aC=F($I),Z=F(gC),iI=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),sI=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]=gI.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]=gI.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;
@@ -89,9 +89,9 @@
89
89
  top: 0;
90
90
  transform: translateY(-50%);
91
91
  }
92
- `;function rC({value:C,onChange:s,...w}){const[A,o]=m.useState(""),{t:g}=X.useLocaleContext();return m.useEffect(()=>{o(C||"")},[C,o]),v.useDebounce(()=>{A!==C&&s(A)},300,[A]),I.jsx(i.TextField,{size:"small",fullWidth:!0,label:g("maker.properties.icon"),...w,value:A,onChange:M=>o(M.target.value),InputProps:{startAdornment:I.jsx(i.IconButton,{size:"small",children:I.jsx(r.Icon,{icon:A})}),endAdornment:I.jsx(i.IconButton,{size:"small",href:"https://icones.js.org",target:"_blank",children:I.jsx(Y.SearchRounded,{})})}})}function bI({value:C="",onChange:s,...w}){const{state:{pages:A,pageIds:o}}=H.useStore(),g=m.useMemo(()=>o.map(j=>A[j].slug),[o,A]),[M]=m.useState(()=>{var j;return((j=A[C])==null?void 0:j.slug)||C});return I.jsx(i.Autocomplete,{size:"small",fullWidth:!0,options:g,defaultValue:M,freeSolo:!0,autoSelect:!0,openOnFocus:!0,onChange:(j,O)=>{var L;return s(((L=Object.values(A).find(e=>(e==null?void 0:e.slug)===O))==null?void 0:L.id)||O||"")},renderInput:j=>I.jsx(i.TextField,{...j,...w})})}function G({label:C,placeholder:s,options:w,value:A,onChange:o,...g}){const M=w.find(L=>L.value===A),j=M==null?void 0:M.title,O=L=>{o(L.target.value)};return I.jsxs(i.FormControl,{fullWidth:!0,size:"small",children:[I.jsx(i.InputLabel,{children:C}),I.jsxs(i.Select,{value:A,input:I.jsx(i.OutlinedInput,{defaultValue:j,label:C}),renderValue:L=>{const e=w.find(y=>y.value===L);return e&&e.title&&I.jsxs(i.Box,{children:[I.jsx(i.Typography,{component:"span",children:e.title}),I.jsx(i.Typography,{marginLeft:1,component:"span",variant:"body2",color:"text.secondary",children:e.description})]})},onChange:O,...g,children:[I.jsx(i.MenuItem,{disabled:!0,children:I.jsx("em",{children:s})}),w.map(L=>L&&L.value&&I.jsxs(i.MenuItem,{value:L.value,children:[I.jsx(i.ListItemText,{children:L.title}),L.description&&I.jsx(i.Typography,{variant:"body2",color:"text.secondary",children:L.description})]},L.value))]})]})}const hC=()=>{const{t:C}=X.useLocaleContext(),s=u.useRequest(async()=>{var M;if(!((M=window.blocklet)==null?void 0:M.componentMountPoints.find(j=>j.name==="ai-kit")))return{install:!1};const{data:g}=await H.api.get("/api/ai/status");return{...g,install:!0}}),w=m.useMemo(()=>{var o,g;return!!(s.loading||!((o=s.data)!=null&&o.install)||!((g=s.data)!=null&&g.available))},[s]),A=m.useMemo(()=>{var o,g;return(o=s.data)!=null&&o.install?(g=s.data)!=null&&g.available?"":C("ai.status.available"):C("ai.status.install")},[s]);return[w,A]};function $({children:C,open:s=!0,embed:w=!1,...A}){const o=i.useTheme(),g=zC.default(o.breakpoints.down("md"));return I.jsx(cC.default,{open:s,fullScreen:g,maxWidth:"md",disableEnforceFocus:!0,disableRestoreFocus:!0,disablePortal:!0,sx:{zIndex:13001},PaperProps:{sx:g?{}:{width:1,margin:0,height:w?"100%":"75vh",maxHeight:w?"100%":"75vh"}},...A,children:C})}const NI=m.createContext({embed:!1}),{Provider:ZC}=NI;function QC({children:C,embed:s=!1,api:w,customOutputChildren:A}){const o=u.useReactive({embed:s}),[g,M]=m.useState(void 0),[j,O]=m.useState([]);return I.jsx(ZC,{value:{...o,template:g,response:j,api:w,customOutputChildren:A,setTemplate:M,setResponse:O},children:C})}function p(){return m.useContext(NI)}function KI(C){return m.useMemo(()=>blocklet==null?void 0:blocklet.componentMountPoints.find(s=>s.name===C),[])}async function kC({pageSize:C,composable:s,api:w,sort:A}){const o=await Promise.all(s.items.map(async j=>{if(j.noMore||j.list.length>=C)return j;const O=await w(j)({offset:j.offset,limit:C});return{...j,noMore:O.length<C,list:j.list.concat(O),offset:j.offset+O.length}})),g=[],M=a.produce(o,j=>{var O;for(;g.length<C;){j.sort((e,y)=>{const J=e.list[0],D=y.list[0];return J&&D?A(J,D):J?-1:1});const L=(O=j[0])==null?void 0:O.list.shift();if(!L)break;g.push(a.original(L))}});return[g,{items:M}]}function RC({offset:C,limit:s,sort:w,tag:A}={}){const o=H.getMountPoint("ai-studio"),g=CC.joinURL(o,"/api/templates");return H.api.get(g,{params:{offset:C,limit:s,sort:w,tag:A}}).then(M=>M.data)}const sI=10,pC=m.createContext(void 0);function UC({children:C}){const s=KI("ai-studio"),w=m.useRef({tags:[],data:{},fetchMore:async g=>{const M=["all","builtin","studio"].includes(g)?void 0:g,j=o(g,()=>{});if(!(j.noMore||j.loading)){o(g,O=>O.loading=!0);try{const O=a.produce(j.composable??{items:[]},y=>{y.items.length===0&&s&&y.items.push({offset:0,list:[],noMore:!1,api:J=>RC(J).then(D=>D.templates.map(b=>({...b,source:"studio"})))})}),[L,e]=await kC({pageSize:sI,composable:O,api:y=>J=>y.api({...J,tag:M,sort:"-updatedAt"}),sort:(y,J)=>-y.updatedAt.localeCompare(J.updatedAt)});o(g,y=>{y.composable=e,y.templates.push(...L),y.noMore=L.length<sI})}catch(O){throw o(g,L=>L.error=O),O}finally{o(g,O=>O.loading=!1)}}}}),A=u.useUpdate(),o=m.useCallback((g,M)=>(w.current=a.produce(w.current,j=>(j.data[g]||(j.data[g]={templates:[],loading:!1,noMore:!1}),M(j.data[g]),j)),A(),w.current.data[g]),[]);return I.jsx(pC.Provider,{value:w.current,children:C})}const dI=mI.createStatusApi({axios:H.api,path:"/api/ai/status"}),fC=mI.createTextCompletionApi({fetch:sC.createFetch(),path:"/api/ai/completions"});function GC({text:C,language:s}){return fC({prompt:`Translate this into ${s}:
92
+ `;function rC({value:C,onChange:s,...w}){const[A,o]=m.useState(""),{t:g}=X.useLocaleContext();return m.useEffect(()=>{o(C||"")},[C,o]),v.useDebounce(()=>{A!==C&&s(A)},300,[A]),I.jsx(i.TextField,{size:"small",fullWidth:!0,label:g("maker.properties.icon"),...w,value:A,onChange:M=>o(M.target.value),InputProps:{startAdornment:I.jsx(i.IconButton,{size:"small",children:I.jsx(r.Icon,{icon:A})}),endAdornment:I.jsx(i.IconButton,{size:"small",href:"https://icones.js.org",target:"_blank",children:I.jsx(Y.SearchRounded,{})})}})}function bI({value:C="",onChange:s,...w}){const{state:{pages:A,pageIds:o}}=H.useStore(),g=m.useMemo(()=>o.map(j=>A[j].slug),[o,A]),[M]=m.useState(()=>{var j;return((j=A[C])==null?void 0:j.slug)||C});return I.jsx(i.Autocomplete,{size:"small",fullWidth:!0,options:g,defaultValue:M,freeSolo:!0,autoSelect:!0,openOnFocus:!0,onChange:(j,O)=>{var L;return s(((L=Object.values(A).find(e=>(e==null?void 0:e.slug)===O))==null?void 0:L.id)||O||"")},renderInput:j=>I.jsx(i.TextField,{...j,...w})})}function G({label:C,placeholder:s,options:w,value:A,onChange:o,...g}){const M=w.find(L=>L.value===A),j=M==null?void 0:M.title,O=L=>{o(L.target.value)};return I.jsxs(i.FormControl,{fullWidth:!0,size:"small",children:[I.jsx(i.InputLabel,{children:C}),I.jsxs(i.Select,{value:A,input:I.jsx(i.OutlinedInput,{defaultValue:j,label:C}),renderValue:L=>{const e=w.find(y=>y.value===L);return e&&e.title&&I.jsxs(i.Box,{children:[I.jsx(i.Typography,{component:"span",children:e.title}),I.jsx(i.Typography,{marginLeft:1,component:"span",variant:"body2",color:"text.secondary",children:e.description})]})},onChange:O,...g,children:[I.jsx(i.MenuItem,{disabled:!0,children:I.jsx("em",{children:s})}),w.map(L=>L&&L.value&&I.jsxs(i.MenuItem,{value:L.value,children:[I.jsx(i.ListItemText,{children:L.title}),L.description&&I.jsx(i.Typography,{variant:"body2",color:"text.secondary",children:L.description})]},L.value))]})]})}const hC=()=>{const{t:C}=X.useLocaleContext(),s=u.useRequest(async()=>{var M;if(!((M=window.blocklet)==null?void 0:M.componentMountPoints.find(j=>j.name==="ai-kit")))return{install:!1};const{data:g}=await H.api.get("/api/ai/status");return{...g,install:!0}}),w=m.useMemo(()=>{var o,g;return!!(s.loading||!((o=s.data)!=null&&o.install)||!((g=s.data)!=null&&g.available))},[s]),A=m.useMemo(()=>{var o,g;return(o=s.data)!=null&&o.install?(g=s.data)!=null&&g.available?"":C("ai.status.unavailable"):C("ai.status.install")},[s]);return[w,A]};function II({children:C,open:s=!0,embed:w=!1,...A}){const o=i.useTheme(),g=zC.default(o.breakpoints.down("md"));return I.jsx(cC.default,{open:s,fullScreen:g,maxWidth:"md",disableEnforceFocus:!0,disableRestoreFocus:!0,disablePortal:!0,sx:{zIndex:13001},PaperProps:{sx:g?{}:{width:1,margin:0,height:w?"100%":"75vh",maxHeight:w?"100%":"75vh"}},...A,children:C})}const NI=m.createContext({embed:!1}),{Provider:ZC}=NI;function QC({children:C,embed:s=!1,api:w,customOutputChildren:A}){const o=u.useReactive({embed:s}),[g,M]=m.useState(void 0),[j,O]=m.useState([]);return I.jsx(ZC,{value:{...o,template:g,response:j,api:w,customOutputChildren:A,setTemplate:M,setResponse:O},children:C})}function p(){return m.useContext(NI)}function KI(C){return m.useMemo(()=>blocklet==null?void 0:blocklet.componentMountPoints.find(s=>s.name===C),[])}async function kC({pageSize:C,composable:s,api:w,sort:A}){const o=await Promise.all(s.items.map(async j=>{if(j.noMore||j.list.length>=C)return j;const O=await w(j)({offset:j.offset,limit:C});return{...j,noMore:O.length<C,list:j.list.concat(O),offset:j.offset+O.length}})),g=[],M=a.produce(o,j=>{var O;for(;g.length<C;){j.sort((e,y)=>{const J=e.list[0],D=y.list[0];return J&&D?A(J,D):J?-1:1});const L=(O=j[0])==null?void 0:O.list.shift();if(!L)break;g.push(a.original(L))}});return[g,{items:M}]}function RC({offset:C,limit:s,sort:w,tag:A}={}){const o=H.getMountPoint("ai-studio"),g=CC.joinURL(o,"/api/templates");return H.api.get(g,{params:{offset:C,limit:s,sort:w,tag:A}}).then(M=>M.data)}const oI=10,pC=m.createContext(void 0);function UC({children:C}){const s=KI("ai-studio"),w=m.useRef({tags:[],data:{},fetchMore:async g=>{const M=["all","builtin","studio"].includes(g)?void 0:g,j=o(g,()=>{});if(!(j.noMore||j.loading)){o(g,O=>O.loading=!0);try{const O=a.produce(j.composable??{items:[]},y=>{y.items.length===0&&s&&y.items.push({offset:0,list:[],noMore:!1,api:J=>RC(J).then(D=>D.templates.map(b=>({...b,source:"studio"})))})}),[L,e]=await kC({pageSize:oI,composable:O,api:y=>J=>y.api({...J,tag:M,sort:"-updatedAt"}),sort:(y,J)=>-y.updatedAt.localeCompare(J.updatedAt)});o(g,y=>{y.composable=e,y.templates.push(...L),y.noMore=L.length<oI})}catch(O){throw o(g,L=>L.error=O),O}finally{o(g,O=>O.loading=!1)}}}}),A=u.useUpdate(),o=m.useCallback((g,M)=>(w.current=a.produce(w.current,j=>(j.data[g]||(j.data[g]={templates:[],loading:!1,noMore:!1}),M(j.data[g]),j)),A(),w.current.data[g]),[]);return I.jsx(pC.Provider,{value:w.current,children:C})}const dI=P.createStatusApi({axios:H.api,path:"/api/ai/status"});P.createStatusApi({axios:H.api,path:"/api/ai/agent-status"});const fC=P.createTextCompletionApi({fetch:sC.createFetch(),path:"/api/ai/completions"});function GC({text:C,language:s}){return fC({prompt:`Translate this into ${s}:
93
93
 
94
- ${C}`}).then(w=>w.text??"")}function VC(C){const s=u.useReactive({searching:!1,searchKey:0,resultKey:0,keyword:"",options:[]}),w=m.useCallback(async g=>{const M=s.searchKey;try{if(!g.trim()){s.options=[];return}const j=new URL("https://nominatim.openstreetmap.org/search");j.searchParams.set("q",g),j.searchParams.set("polygon_geojson","1"),j.searchParams.set("format","jsonv2"),j.searchParams.set("limit","10"),j.searchParams.set("accept-language","zh-CN"),j.searchParams.set("polygon_geojson","0");const O=await fetch(j.toString()).then(L=>L.json()).then(L=>L.map(e=>({id:e.place_id,longitude:Number(e.lon),latitude:Number(e.lat),name:e.display_name})));M>s.resultKey&&(s.resultKey=M,s.options=O)}finally{M===s.searchKey&&(s.searching=!1)}},[]),{run:A}=u.useThrottleFn(w,{wait:1e3});m.useEffect(()=>{var g;typeof C.value=="object"&&!Array.isArray(C.value)&&s.keyword===((g=C.value)==null?void 0:g.name)||(s.searchKey+=1,s.searching=!0,A(s.keyword))},[s.keyword]);const{renderInput:o=g=>I.jsx(i.TextField,{...g})}=C;return I.jsx(i.Autocomplete,{...C,inputValue:s.keyword,onInputChange:(g,M)=>s.keyword=M,options:s.options,getOptionLabel:g=>typeof g=="string"?g:g.name||"",isOptionEqualToValue:(g,M)=>g.id===M.id||g.longitude===M.longitude&&g.latitude===M.latitude,filterOptions:g=>g,renderOption:(g,M)=>m.createElement(i.MenuItem,{...g,key:M.id},M.name),loading:s.searching,renderInput:g=>o({...g,InputProps:{...g.InputProps,endAdornment:I.jsxs(I.Fragment,{children:[s.searching&&I.jsx(i.CircularProgress,{size:20}),g.InputProps.endAdornment]})}})})}function vC({min:C,max:s,default:w,onChange:A,...o}){const g=M=>{const j=M.target.value.trim();if(!j)return w;let O=Number(Number(j).toFixed(0));return Number.isInteger(O)?(typeof C=="number"&&(O=Math.max(C,O)),typeof s=="number"&&(O=Math.min(s,O)),O):w};return I.jsx(i.TextField,{onChange:M=>A==null?void 0:A(g(M)),inputProps:{type:"number",inputMode:"numeric",pattern:"[0-9]*",min:C,max:s,...o.inputProps},...o})}h.default.extend(tC.default);h.default.extend(lC.default);function PC({parameter:C,...s}){const w={number:qC,string:_C,select:$C,language:gg,horoscope:Ag,radio:Ig}[C.type||"string"];return I.jsx(w,{parameter:C,...s})}function _C({parameter:C,onChange:s,...w}){return I.jsx(i.TextField,{required:C.required,label:C.label,placeholder:C.placeholder,helperText:C.helper,multiline:C.multiline,minRows:C.multiline?2:void 0,inputProps:{maxLength:C.maxLength},onChange:A=>s(A.target.value),...w})}function qC({parameter:C,...s}){return I.jsx(vC,{required:C.required,label:C.label,placeholder:C.placeholder,helperText:C.helper,min:C.min,max:C.max,...s})}function $C({parameter:C,onChange:s,...w}){return I.jsxs(i.TextField,{required:C.required,label:C.label,placeholder:C.placeholder,helperText:C.helper,select:!0,onChange:A=>s(A.target.value),...w,children:[I.jsx(i.MenuItem,{value:"",children:I.jsx("em",{children:"None"})}),(C.options??[]).map(A=>I.jsx(i.MenuItem,{value:A.value,children:A.label},A.id))]})}function Ig({parameter:C,onChange:s,...w}){return I.jsxs(i.TextField,{required:C.required,label:C.label,placeholder:C.placeholder,helperText:C.helper,select:!0,onChange:A=>s(A.target.value),...w,children:[I.jsx(i.MenuItem,{value:"",children:I.jsx("em",{children:"None"})}),(C.options??[]).map(A=>I.jsx(i.MenuItem,{value:A.value,children:A.label},A.id))]})}const Cg=[{en:"English",cn:"英语"},{en:"Simplified Chinese",cn:"中文-简体"},{en:"Traditional Chinese",cn:"中文-繁体"},{en:"Spanish",cn:"西班牙语"},{en:"French",cn:"法语"},{en:"German",cn:"德语"},{en:"Italian",cn:"意大利语"},{en:"Portuguese",cn:"葡萄牙语"},{en:"Japanese",cn:"日语"},{en:"Korean",cn:"韩语"},{en:"Russian",cn:"俄语"},{en:"Polish",cn:"波兰语"},{en:"Arabic",cn:"阿拉伯语"},{en:"Dutch",cn:"荷兰语"},{en:"Swedish",cn:"瑞典语"},{en:"Finnish",cn:"芬兰语"},{en:"Czech",cn:"捷克语"},{en:"Danish",cn:"丹麦语"},{en:"Greek",cn:"希腊语"},{en:"Romanian",cn:"罗马尼亚语"},{en:"Hungarian",cn:"匈牙利语"},{en:"Bulgarian",cn:"保加利亚语"},{en:"Slovak",cn:"斯洛伐克语"},{en:"Norwegian",cn:"挪威语"},{en:"Hebrew",cn:"希伯来语"},{en:"Turkish",cn:"土耳其语"},{en:"Thai",cn:"泰语"},{en:"Indonesian",cn:"印尼语"},{en:"Vietnamese",cn:"越南语"},{en:"Hindi",cn:"印地语"}];function gg({parameter:C,onChange:s,...w}){const{locale:A}=X.useLocaleContext();return I.jsxs(i.TextField,{required:C.required,label:C.label,placeholder:C.placeholder,helperText:C.helper,select:!0,onChange:o=>s(o.target.value),...w,children:[I.jsx(i.MenuItem,{value:"",children:I.jsx("em",{children:"None"})}),Cg.map(o=>I.jsx(i.MenuItem,{value:o.en,children:A==="zh"?o.cn:o.en},o.en))]})}function Ag({parameter:C,value:s,onChange:w,...A}){const[o,g]=m.useState(()=>({...s}));m.useEffect(()=>{HC.default(o,s)||g({...s})},[s]),m.useEffect(()=>{const{location:O,offset:L,time:e}=o;O&&e?w({location:O,offset:L,time:e}):s&&w(void 0)},[o]);const M=m.useMemo(()=>o.location&&o.time?cI({...C,value:{time:o.time,offset:o.offset,location:o.location}}):"",[o]),j=m.useCallback(({time:O,location:L})=>{const e=h.default(O),y=L&&eI.default(L.latitude,L.longitude),J=y?e.tz(y).utcOffset():null;EC.default(J)||g(D=>({...D,offset:J}))},[]);return I.jsx(wC.LocalizationProvider,{dateAdapter:oC.AdapterDayjs,children:I.jsxs(i.Box,{sx:{width:"100%",display:"flex",flexWrap:"wrap",gap:1},children:[I.jsx(ig,{slotProps:{textField:{size:"small"}},label:"Date",sx:{flex:1,minWidth:200},value:o.time??null,onChange:O=>{g(L=>({...L,time:O??void 0})),j({...o,time:O})}}),I.jsx(VC,{sx:{flex:1,minWidth:200},value:(o==null?void 0:o.location)??null,onChange:(O,L)=>{g(e=>({...e,location:L??void 0})),j({...o,location:L})},renderInput:O=>I.jsx(i.TextField,{...O,label:"Location",size:"small"})}),I.jsx(sg,{label:"Timezone",sx:{flex:1,minWidth:200},value:o.offset??null,onChange:O=>g(L=>({...L,offset:O??void 0})),slotProps:{textField:{size:"small"}}}),I.jsx(i.TextField,{label:A.label,fullWidth:!0,size:"small",multiline:!0,InputProps:{readOnly:!0},value:M,disabled:!0,error:A.error,helperText:A.helperText})]})})}function ig({format:C="YYYY-MM-DD HH:mm:ss",value:s,onChange:w,...A}){const[o,g]=m.useState(()=>s?h.default(s):null);return m.useEffect(()=>{(o==null?void 0:o.format(C))!==s&&g(h.default(s))},[s]),I.jsx(SI.DateTimePicker,{ampm:!1,...A,value:o,onChange:M=>{g(M),w==null||w((M==null?void 0:M.format(C))??null)}})}function sg({value:C,onChange:s,...w}){var O;const A=m.useCallback(L=>typeof L=="number"?h.default().startOf("year").minute(Math.abs(L)):L,[]),o=m.useCallback(L=>L&&L.hour()*60+L.minute(),[]),[g,M]=m.useState(()=>A(C));m.useEffect(()=>{o(g)!==C&&M(A(C))},[C]);const j=typeof C=="number"&&C<0?-1:1;return I.jsx(SI.TimePicker,{ampm:!1,...w,value:g,slots:{actionBar:()=>null},onChange:L=>{M(L),s==null||s(L?(L.hour()*60+L.minute())*j:null)},slotProps:{...w.slotProps,textField:{...(O=w.slotProps)==null?void 0:O.textField,InputProps:{startAdornment:I.jsx(i.InputAdornment,{position:"start",children:I.jsxs(i.Button,{size:"small",color:"inherit",sx:{minWidth:0,p:0},onClick:L=>{L.stopPropagation(),s==null||s(typeof C=="number"?-C:null)},children:[I.jsx(i.Box,{component:"span",sx:{lineHeight:1},children:"UTC"}),j===-1?I.jsx(Y.Remove,{fontSize:"small"}):I.jsx(Y.Add,{fontSize:"small"})]})})}}}})}function cI(C){var s,w;switch(C.type){case void 0:case"string":case"number":case"language":case"select":return((s=C.value)==null?void 0:s.toString())??"";case"radio":return((w=C.value)==null?void 0:w.toString())??"";case"horoscope":{const{time:A,offset:o,location:g}=C.value??{};if(!A||!g)return"";let M=h.default(A);if(!M.isValid())return"";typeof o=="number"&&(M=M.utcOffset(o,!0)),M=M.tz(eI.default(g.latitude,g.longitude),!0);const j=new gI.Horoscope({origin:new gI.Origin({year:M.year(),month:M.month(),date:M.date(),hour:M.hour(),minute:M.minute(),second:M.second(),latitude:g.latitude,longitude:g.longitude})}),O={sun:"太阳",moon:"月亮",mercury:"水星",venus:"金星",mars:"火星",jupiter:"木星",saturn:"土星",uranus:"天王星",neptune:"海王星",pluto:"冥王星",chiron:"凯龙星",sirius:"天狼星",aries:"白羊座",taurus:"金牛座",gemini:"双子座",cancer:"巨蟹座",leo:"狮子座",virgo:"处女座",libra:"天秤座",scorpio:"天蝎座",sagittarius:"射手座",capricorn:"摩羯座",aquarius:"水瓶座",pisces:"双鱼座",ophiuchus:"蛇夫座",ascendant:"上升",midheaven:"中天",northnode:"北交",southnode:"南交"},L=j.CelestialBodies.all,e=j.Houses,y=L.filter(J=>!["chiron","sirius"].includes(J.key));return y.concat([j.CelestialPoints.northnode,j.Ascendant,j.Midheaven]).map(J=>`${O[J.key]}${O[J.Sign.key]}${J.isRetrograde?"(逆行)":""}`).concat(e.map(J=>`${J.id}宫${O[J.Sign.key]}`)).concat(y.concat(j.CelestialPoints.northnode).map(J=>`${O[J.key]}落入${J.House.id}宫`)).join(",")}default:throw new Error(`Unsupported parameter to string value ${C}`)}}function og({template:C,onSubmit:s}){var e;const{t:w}=X.useLocaleContext(),A=m.useMemo(()=>{let y={};return C.parameters&&typeof C.parameters=="object"&&(y=KC.default(C.parameters)),y},[C]),o=m.useMemo(()=>Object.keys(A),[A]),g=v.useAsync(()=>dI(),[]),M=u.useReactive({});m.useEffect(()=>{for(const[y,J]of Object.entries(A))M[y]??(M[y]=J.defaultValue)},[C]);const[j,O]=m.useState(),L=()=>{O(void 0);const y=N=>({string:S=>{let B=E.default.string();return S.required?B=B.required():B=B.allow(""),typeof S.minLength=="number"&&(B=B.min(S.minLength)),typeof S.maxLength=="number"&&(B=B.max(S.maxLength)),B},number:S=>{let B=E.default.number();return S.required&&(B=B.required()),typeof S.min=="number"&&(B=B.min(S.min)),typeof S.max=="number"&&(B=B.max(S.max)),B},select:S=>{let B=E.default.string();return S.required&&(B=B.required()),B},language:S=>{let B=E.default.string();return S.required&&(B=B.required()),B},horoscope:S=>{let B=E.default.object({time:E.default.string().required(),offset:E.default.number().integer(),location:E.default.object({id:E.default.alternatives().try(E.default.string(),E.default.number()).required(),latitude:E.default.number().required(),longitude:E.default.number().required(),name:E.default.string().required()}).required()});return S.required&&(B=B.required()),B},radio:S=>{let B=E.default.string();return S.required&&(B=B.required()),B}})[N.type||"string"](N),J=E.default.object(Object.fromEntries(o.map(N=>{const S=A[N];return[N,S?y(S):void 0]}))),{error:D,value:b}=J.validate(M,{allowUnknown:!0,abortEarly:!1});if(D){O(D);return}s(Object.fromEntries(Object.entries(b).map(([N,S])=>[N,cI({type:A[N].type,value:S})])))};return I.jsxs(wg,{component:"form",onSubmit:y=>y.preventDefault(),children:[I.jsx(i.Grid,{container:!0,spacing:2.5,children:o.map(y=>{const J=A[y]??{},D=j==null?void 0:j.details.find(b=>b.path[0]===y);return I.jsx(i.Grid,{item:!0,xs:12,children:I.jsx(PC,{fullWidth:!0,size:"small",label:J.label||y,parameter:J,error:!!D,helperText:(D==null?void 0:D.message)??J.helper,value:M[y]??"",onChange:b=>M[y]=b})},y)})}),I.jsx(i.Box,{flex:1}),I.jsx(i.Box,{className:"actions",children:I.jsx(i.Box,{my:3,textAlign:"center",children:g.loading?I.jsx(i.CircularProgress,{size:24}):I.jsx(i.Button,{className:"submit",type:"submit",variant:"contained",onClick:L,disabled:!((e=g.value)!=null&&e.available),children:w("ai.generate")})})})]})}const wg=Z.default(i.Box)`
94
+ ${C}`}).then(w=>w.text??"")}function VC(C){const s=u.useReactive({searching:!1,searchKey:0,resultKey:0,keyword:"",options:[]}),w=m.useCallback(async g=>{const M=s.searchKey;try{if(!g.trim()){s.options=[];return}const j=new URL("https://nominatim.openstreetmap.org/search");j.searchParams.set("q",g),j.searchParams.set("polygon_geojson","1"),j.searchParams.set("format","jsonv2"),j.searchParams.set("limit","10"),j.searchParams.set("accept-language","zh-CN"),j.searchParams.set("polygon_geojson","0");const O=await fetch(j.toString()).then(L=>L.json()).then(L=>L.map(e=>({id:e.place_id,longitude:Number(e.lon),latitude:Number(e.lat),name:e.display_name})));M>s.resultKey&&(s.resultKey=M,s.options=O)}finally{M===s.searchKey&&(s.searching=!1)}},[]),{run:A}=u.useThrottleFn(w,{wait:1e3});m.useEffect(()=>{var g;typeof C.value=="object"&&!Array.isArray(C.value)&&s.keyword===((g=C.value)==null?void 0:g.name)||(s.searchKey+=1,s.searching=!0,A(s.keyword))},[s.keyword]);const{renderInput:o=g=>I.jsx(i.TextField,{...g})}=C;return I.jsx(i.Autocomplete,{...C,inputValue:s.keyword,onInputChange:(g,M)=>s.keyword=M,options:s.options,getOptionLabel:g=>typeof g=="string"?g:g.name||"",isOptionEqualToValue:(g,M)=>g.id===M.id||g.longitude===M.longitude&&g.latitude===M.latitude,filterOptions:g=>g,renderOption:(g,M)=>m.createElement(i.MenuItem,{...g,key:M.id},M.name),loading:s.searching,renderInput:g=>o({...g,InputProps:{...g.InputProps,endAdornment:I.jsxs(I.Fragment,{children:[s.searching&&I.jsx(i.CircularProgress,{size:20}),g.InputProps.endAdornment]})}})})}function vC({min:C,max:s,default:w,onChange:A,...o}){const g=M=>{const j=M.target.value.trim();if(!j)return w;let O=Number(Number(j).toFixed(0));return Number.isInteger(O)?(typeof C=="number"&&(O=Math.max(C,O)),typeof s=="number"&&(O=Math.min(s,O)),O):w};return I.jsx(i.TextField,{onChange:M=>A==null?void 0:A(g(M)),inputProps:{type:"number",inputMode:"numeric",pattern:"[0-9]*",min:C,max:s,...o.inputProps},...o})}h.default.extend(tC.default);h.default.extend(lC.default);function PC({parameter:C,...s}){const w={number:qC,string:_C,select:$C,language:gg,horoscope:Ag,radio:Ig}[C.type||"string"];return I.jsx(w,{parameter:C,...s})}function _C({parameter:C,onChange:s,...w}){return I.jsx(i.TextField,{required:C.required,label:C.label,placeholder:C.placeholder,helperText:C.helper,multiline:C.multiline,minRows:C.multiline?2:void 0,inputProps:{maxLength:C.maxLength},onChange:A=>s(A.target.value),...w})}function qC({parameter:C,...s}){return I.jsx(vC,{required:C.required,label:C.label,placeholder:C.placeholder,helperText:C.helper,min:C.min,max:C.max,...s})}function $C({parameter:C,onChange:s,...w}){return I.jsxs(i.TextField,{required:C.required,label:C.label,placeholder:C.placeholder,helperText:C.helper,select:!0,onChange:A=>s(A.target.value),...w,children:[I.jsx(i.MenuItem,{value:"",children:I.jsx("em",{children:"None"})}),(C.options??[]).map(A=>I.jsx(i.MenuItem,{value:A.value,children:A.label},A.id))]})}function Ig({parameter:C,onChange:s,...w}){return I.jsxs(i.TextField,{required:C.required,label:C.label,placeholder:C.placeholder,helperText:C.helper,select:!0,onChange:A=>s(A.target.value),...w,children:[I.jsx(i.MenuItem,{value:"",children:I.jsx("em",{children:"None"})}),(C.options??[]).map(A=>I.jsx(i.MenuItem,{value:A.value,children:A.label},A.id))]})}const Cg=[{en:"English",cn:"英语"},{en:"Simplified Chinese",cn:"中文-简体"},{en:"Traditional Chinese",cn:"中文-繁体"},{en:"Spanish",cn:"西班牙语"},{en:"French",cn:"法语"},{en:"German",cn:"德语"},{en:"Italian",cn:"意大利语"},{en:"Portuguese",cn:"葡萄牙语"},{en:"Japanese",cn:"日语"},{en:"Korean",cn:"韩语"},{en:"Russian",cn:"俄语"},{en:"Polish",cn:"波兰语"},{en:"Arabic",cn:"阿拉伯语"},{en:"Dutch",cn:"荷兰语"},{en:"Swedish",cn:"瑞典语"},{en:"Finnish",cn:"芬兰语"},{en:"Czech",cn:"捷克语"},{en:"Danish",cn:"丹麦语"},{en:"Greek",cn:"希腊语"},{en:"Romanian",cn:"罗马尼亚语"},{en:"Hungarian",cn:"匈牙利语"},{en:"Bulgarian",cn:"保加利亚语"},{en:"Slovak",cn:"斯洛伐克语"},{en:"Norwegian",cn:"挪威语"},{en:"Hebrew",cn:"希伯来语"},{en:"Turkish",cn:"土耳其语"},{en:"Thai",cn:"泰语"},{en:"Indonesian",cn:"印尼语"},{en:"Vietnamese",cn:"越南语"},{en:"Hindi",cn:"印地语"}];function gg({parameter:C,onChange:s,...w}){const{locale:A}=X.useLocaleContext();return I.jsxs(i.TextField,{required:C.required,label:C.label,placeholder:C.placeholder,helperText:C.helper,select:!0,onChange:o=>s(o.target.value),...w,children:[I.jsx(i.MenuItem,{value:"",children:I.jsx("em",{children:"None"})}),Cg.map(o=>I.jsx(i.MenuItem,{value:o.en,children:A==="zh"?o.cn:o.en},o.en))]})}function Ag({parameter:C,value:s,onChange:w,...A}){const[o,g]=m.useState(()=>({...s}));m.useEffect(()=>{HC.default(o,s)||g({...s})},[s]),m.useEffect(()=>{const{location:O,offset:L,time:e}=o;O&&e?w({location:O,offset:L,time:e}):s&&w(void 0)},[o]);const M=m.useMemo(()=>o.location&&o.time?cI({...C,value:{time:o.time,offset:o.offset,location:o.location}}):"",[o]),j=m.useCallback(({time:O,location:L})=>{const e=h.default(O),y=L&&eI.default(L.latitude,L.longitude),J=y?e.tz(y).utcOffset():null;EC.default(J)||g(D=>({...D,offset:J}))},[]);return I.jsx(wC.LocalizationProvider,{dateAdapter:oC.AdapterDayjs,children:I.jsxs(i.Box,{sx:{width:"100%",display:"flex",flexWrap:"wrap",gap:1},children:[I.jsx(ig,{slotProps:{textField:{size:"small"}},label:"Date",sx:{flex:1,minWidth:200},value:o.time??null,onChange:O=>{g(L=>({...L,time:O??void 0})),j({...o,time:O})}}),I.jsx(VC,{sx:{flex:1,minWidth:200},value:(o==null?void 0:o.location)??null,onChange:(O,L)=>{g(e=>({...e,location:L??void 0})),j({...o,location:L})},renderInput:O=>I.jsx(i.TextField,{...O,label:"Location",size:"small"})}),I.jsx(sg,{label:"Timezone",sx:{flex:1,minWidth:200},value:o.offset??null,onChange:O=>g(L=>({...L,offset:O??void 0})),slotProps:{textField:{size:"small"}}}),I.jsx(i.TextField,{label:A.label,fullWidth:!0,size:"small",multiline:!0,InputProps:{readOnly:!0},value:M,disabled:!0,error:A.error,helperText:A.helperText})]})})}function ig({format:C="YYYY-MM-DD HH:mm:ss",value:s,onChange:w,...A}){const[o,g]=m.useState(()=>s?h.default(s):null);return m.useEffect(()=>{(o==null?void 0:o.format(C))!==s&&g(h.default(s))},[s]),I.jsx(SI.DateTimePicker,{ampm:!1,...A,value:o,onChange:M=>{g(M),w==null||w((M==null?void 0:M.format(C))??null)}})}function sg({value:C,onChange:s,...w}){var O;const A=m.useCallback(L=>typeof L=="number"?h.default().startOf("year").minute(Math.abs(L)):L,[]),o=m.useCallback(L=>L&&L.hour()*60+L.minute(),[]),[g,M]=m.useState(()=>A(C));m.useEffect(()=>{o(g)!==C&&M(A(C))},[C]);const j=typeof C=="number"&&C<0?-1:1;return I.jsx(SI.TimePicker,{ampm:!1,...w,value:g,slots:{actionBar:()=>null},onChange:L=>{M(L),s==null||s(L?(L.hour()*60+L.minute())*j:null)},slotProps:{...w.slotProps,textField:{...(O=w.slotProps)==null?void 0:O.textField,InputProps:{startAdornment:I.jsx(i.InputAdornment,{position:"start",children:I.jsxs(i.Button,{size:"small",color:"inherit",sx:{minWidth:0,p:0},onClick:L=>{L.stopPropagation(),s==null||s(typeof C=="number"?-C:null)},children:[I.jsx(i.Box,{component:"span",sx:{lineHeight:1},children:"UTC"}),j===-1?I.jsx(Y.Remove,{fontSize:"small"}):I.jsx(Y.Add,{fontSize:"small"})]})})}}}})}function cI(C){var s,w;switch(C.type){case void 0:case"string":case"number":case"language":case"select":return((s=C.value)==null?void 0:s.toString())??"";case"radio":return((w=C.value)==null?void 0:w.toString())??"";case"horoscope":{const{time:A,offset:o,location:g}=C.value??{};if(!A||!g)return"";let M=h.default(A);if(!M.isValid())return"";typeof o=="number"&&(M=M.utcOffset(o,!0)),M=M.tz(eI.default(g.latitude,g.longitude),!0);const j=new AI.Horoscope({origin:new AI.Origin({year:M.year(),month:M.month(),date:M.date(),hour:M.hour(),minute:M.minute(),second:M.second(),latitude:g.latitude,longitude:g.longitude})}),O={sun:"太阳",moon:"月亮",mercury:"水星",venus:"金星",mars:"火星",jupiter:"木星",saturn:"土星",uranus:"天王星",neptune:"海王星",pluto:"冥王星",chiron:"凯龙星",sirius:"天狼星",aries:"白羊座",taurus:"金牛座",gemini:"双子座",cancer:"巨蟹座",leo:"狮子座",virgo:"处女座",libra:"天秤座",scorpio:"天蝎座",sagittarius:"射手座",capricorn:"摩羯座",aquarius:"水瓶座",pisces:"双鱼座",ophiuchus:"蛇夫座",ascendant:"上升",midheaven:"中天",northnode:"北交",southnode:"南交"},L=j.CelestialBodies.all,e=j.Houses,y=L.filter(J=>!["chiron","sirius"].includes(J.key));return y.concat([j.CelestialPoints.northnode,j.Ascendant,j.Midheaven]).map(J=>`${O[J.key]}${O[J.Sign.key]}${J.isRetrograde?"(逆行)":""}`).concat(e.map(J=>`${J.id}宫${O[J.Sign.key]}`)).concat(y.concat(j.CelestialPoints.northnode).map(J=>`${O[J.key]}落入${J.House.id}宫`)).join(",")}default:throw new Error(`Unsupported parameter to string value ${C}`)}}function og({template:C,onSubmit:s}){var e;const{t:w}=X.useLocaleContext(),A=m.useMemo(()=>{let y={};return C.parameters&&typeof C.parameters=="object"&&(y=KC.default(C.parameters)),y},[C]),o=m.useMemo(()=>Object.keys(A),[A]),g=v.useAsync(()=>dI(),[]),M=u.useReactive({});m.useEffect(()=>{for(const[y,J]of Object.entries(A))M[y]??(M[y]=J.defaultValue)},[C]);const[j,O]=m.useState(),L=()=>{O(void 0);const y=N=>({string:S=>{let B=E.default.string();return S.required?B=B.required():B=B.allow(""),typeof S.minLength=="number"&&(B=B.min(S.minLength)),typeof S.maxLength=="number"&&(B=B.max(S.maxLength)),B},number:S=>{let B=E.default.number();return S.required&&(B=B.required()),typeof S.min=="number"&&(B=B.min(S.min)),typeof S.max=="number"&&(B=B.max(S.max)),B},select:S=>{let B=E.default.string();return S.required&&(B=B.required()),B},language:S=>{let B=E.default.string();return S.required&&(B=B.required()),B},horoscope:S=>{let B=E.default.object({time:E.default.string().required(),offset:E.default.number().integer(),location:E.default.object({id:E.default.alternatives().try(E.default.string(),E.default.number()).required(),latitude:E.default.number().required(),longitude:E.default.number().required(),name:E.default.string().required()}).required()});return S.required&&(B=B.required()),B},radio:S=>{let B=E.default.string();return S.required&&(B=B.required()),B}})[N.type||"string"](N),J=E.default.object(Object.fromEntries(o.map(N=>{const S=A[N];return[N,S?y(S):void 0]}))),{error:D,value:b}=J.validate(M,{allowUnknown:!0,abortEarly:!1});if(D){O(D);return}s(Object.fromEntries(Object.entries(b).map(([N,S])=>[N,cI({type:A[N].type,value:S})])))};return I.jsxs(wg,{component:"form",onSubmit:y=>y.preventDefault(),children:[I.jsx(i.Grid,{container:!0,spacing:2.5,children:o.map(y=>{const J=A[y]??{},D=j==null?void 0:j.details.find(b=>b.path[0]===y);return I.jsx(i.Grid,{item:!0,xs:12,children:I.jsx(PC,{fullWidth:!0,size:"small",label:J.label||y,parameter:J,error:!!D,helperText:(D==null?void 0:D.message)??J.helper,value:M[y]??"",onChange:b=>M[y]=b})},y)})}),I.jsx(i.Box,{flex:1}),I.jsx(i.Box,{className:"actions",children:I.jsx(i.Box,{my:3,textAlign:"center",children:g.loading?I.jsx(i.CircularProgress,{size:24}):I.jsx(i.Button,{className:"submit",type:"submit",variant:"contained",onClick:L,disabled:!((e=g.value)!=null&&e.available),children:w("ai.generate")})})})]})}const wg=Z.default(i.Box)`
95
95
  flex-grow: 1;
96
96
  display: flex;
97
97
  flex-direction: column;
@@ -227,7 +227,7 @@ ${C}`}).then(w=>w.text??"")}function VC(C){const s=u.useReactive({searching:!1,s
227
227
  color: #25292f;
228
228
  cursor: pointer;
229
229
  }
230
- `;function Sg({parameters:C,setParameters:s,setOpen:w,onSelect:A}){const{embed:o,customOutputChildren:g,template:M}=p(),j=()=>w(!1),O=()=>s(void 0),L=J=>{A(J),O(),j()},e=m.useMemo(()=>M&&C&&{parameters:C,template:M},[M,C]);if(!M)return null;const y=()=>g&&typeof g=="function"?g({embed:o,template:M,options:e,onClose:j,onFinish:L}):I.jsx(jg,{options:e,onFinish:L});return I.jsxs($,{open:!0,embed:o,onClose:j,sx:{zIndex:13002},children:[I.jsx(_.default,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:I.jsxs(i.Box,{display:"flex",alignItems:"center",ml:-2,children:[I.jsx(q.default,{onClick:j,sx:{mr:1},children:I.jsx(P.default,{})}),I.jsx(i.Box,{mt:.25,children:M.name})]})}),y()]})}function Bg({onSelect:C,onClose:s=()=>{}}){const{embed:w,template:A,setTemplate:o}=p(),[g,M]=m.useState(),[j,O]=m.useState(!1);if(!A)return null;const L=()=>{s(),o(void 0)},e=()=>j?I.jsx(Sg,{parameters:g,setParameters:M,setOpen:O,onSelect:C}):null;return I.jsxs(Lg,{children:[I.jsxs($,{open:!0,embed:w,onClose:L,children:[I.jsx(_.default,{children:I.jsx(x.default,{ml:-2,display:"flex",alignItems:"center",justifyContent:"space-between",children:I.jsxs(x.default,{display:"flex",alignItems:"center",children:[I.jsx(q.default,{onClick:L,sx:{mr:1},children:I.jsx(P.default,{})}),I.jsx(x.default,{mt:.25,children:A.name})]})})}),I.jsxs(x.default,{sx:{display:"flex",flexDirection:"column",flex:1,px:{xs:2,sm:3}},children:[I.jsx(yg,{sx:{mx:{xs:-2,sm:-3},p:{xs:2,sm:3}},children:I.jsxs(x.default,{display:"flex",alignItems:"center",children:[I.jsxs(x.default,{flex:1,children:[I.jsx(AI.default,{className:"title",variant:"h5",component:"div",children:A.name}),I.jsx(AI.default,{className:"subtitle",variant:"caption",children:A.description})]}),I.jsx(x.default,{fontSize:88,m:-1.25,display:"flex",children:I.jsx(R.Icon,{icon:A.icon??""})})]})}),I.jsx(og,{template:A,onSubmit:y=>{M(y),O(!0)}})]})]}),e()]})}const yg=Z.default(x.default)`
230
+ `;function Sg({parameters:C,setParameters:s,setOpen:w,onSelect:A}){const{embed:o,customOutputChildren:g,template:M}=p(),j=()=>w(!1),O=()=>s(void 0),L=J=>{A(J),O(),j()},e=m.useMemo(()=>M&&C&&{parameters:C,template:M},[M,C]);if(!M)return null;const y=()=>g&&typeof g=="function"?g({embed:o,template:M,options:e,onClose:j,onFinish:L}):I.jsx(jg,{options:e,onFinish:L});return I.jsxs(II,{open:!0,embed:o,onClose:j,sx:{zIndex:13002},children:[I.jsx(q.default,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:I.jsxs(i.Box,{display:"flex",alignItems:"center",ml:-2,children:[I.jsx($.default,{onClick:j,sx:{mr:1},children:I.jsx(_.default,{})}),I.jsx(i.Box,{mt:.25,children:M.name})]})}),y()]})}function Bg({onSelect:C,onClose:s=()=>{}}){const{embed:w,template:A,setTemplate:o}=p(),[g,M]=m.useState(),[j,O]=m.useState(!1);if(!A)return null;const L=()=>{s(),o(void 0)},e=()=>j?I.jsx(Sg,{parameters:g,setParameters:M,setOpen:O,onSelect:C}):null;return I.jsxs(Lg,{children:[I.jsxs(II,{open:!0,embed:w,onClose:L,children:[I.jsx(q.default,{children:I.jsx(x.default,{ml:-2,display:"flex",alignItems:"center",justifyContent:"space-between",children:I.jsxs(x.default,{display:"flex",alignItems:"center",children:[I.jsx($.default,{onClick:L,sx:{mr:1},children:I.jsx(_.default,{})}),I.jsx(x.default,{mt:.25,children:A.name})]})})}),I.jsxs(x.default,{sx:{display:"flex",flexDirection:"column",flex:1,px:{xs:2,sm:3}},children:[I.jsx(yg,{sx:{mx:{xs:-2,sm:-3},p:{xs:2,sm:3}},children:I.jsxs(x.default,{display:"flex",alignItems:"center",children:[I.jsxs(x.default,{flex:1,children:[I.jsx(iI.default,{className:"title",variant:"h5",component:"div",children:A.name}),I.jsx(iI.default,{className:"subtitle",variant:"caption",children:A.description})]}),I.jsx(x.default,{fontSize:88,m:-1.25,display:"flex",children:I.jsx(R.Icon,{icon:A.icon??""})})]})}),I.jsx(og,{template:A,onSubmit:y=>{M(y),O(!0)}})]})]}),e()]})}const yg=Z.default(x.default)`
231
231
  background: #f6f2ff;
232
232
  margin-bottom: 20px;
233
233
 
@@ -277,11 +277,11 @@ ${C}`}).then(w=>w.text??"")}function VC(C){const s=u.useReactive({searching:!1,s
277
277
  -webkit-line-clamp: 2;
278
278
  overflow: hidden;
279
279
  }
280
- `;function bg(C){const s=m.useRef(null),w=m.useCallback(()=>{const o=s.current;if(!o)return;const g=o.getBoundingClientRect();g.bottom<=window.innerHeight+g.height},[C]),{run:A}=u.useThrottleFn(w,{wait:500});return m.useEffect(()=>(window.addEventListener("scroll",A),()=>window.removeEventListener("scroll",A)),[A]),{element:I.jsx("div",{ref:s}),checkReachBottom:A}}function Ng(){const{t:C}=X.useLocaleContext();return I.jsx(i.Box,{sx:{mt:10,textAlign:"center"},children:I.jsx(i.Box,{sx:{color:"text.secondary"},children:C("ai.list.noTemplatesInStudio")})})}function Kg({error:C}){const s=I.jsx("pre",{children:C.message});return I.jsxs(FC.default,{severity:"warning",children:[I.jsx(aC.default,{children:"Oops!"}),"AI Generate is not working properly.",s]})}const dg=OI.css`
280
+ `;function bg(C){const s=m.useRef(null),w=m.useCallback(()=>{const o=s.current;if(!o)return;const g=o.getBoundingClientRect();g.bottom<=window.innerHeight+g.height},[C]),{run:A}=u.useThrottleFn(w,{wait:500});return m.useEffect(()=>(window.addEventListener("scroll",A),()=>window.removeEventListener("scroll",A)),[A]),{element:I.jsx("div",{ref:s}),checkReachBottom:A}}function Ng(){const{t:C}=X.useLocaleContext();return I.jsx(i.Box,{sx:{mt:10,textAlign:"center"},children:I.jsx(i.Box,{sx:{color:"text.secondary"},children:C("ai.list.noTemplatesInStudio")})})}function Kg({error:C}){const s=I.jsx("pre",{children:C.message});return I.jsxs(FC.default,{severity:"warning",children:[I.jsx(aC.default,{children:"Oops!"}),"AI Generate is not working properly.",s]})}const dg=mI.css`
281
281
  .MuiMenu-root {
282
282
  z-index: 13010 !important;
283
283
  }
284
- `;function cg({templates:C,api:s,onSelect:w,onClose:A=()=>{},customOutputChildren:o}){return I.jsxs(IC.ErrorBoundary,{FallbackComponent:Kg,children:[I.jsx(i.CssBaseline,{}),I.jsx(OI.Global,{styles:dg}),I.jsx(UC,{children:I.jsx(QC,{api:s,customOutputChildren:o,children:I.jsxs(JI.ToastProvider,{children:[I.jsx(Dg,{templates:C}),I.jsx(Bg,{onSelect:w,onClose:A})]})})})]})}function zg({templates:C}){const[s,w]=m.useState(),A=m.useCallback(()=>{w(void 0)},[]),o=m.useCallback(M=>{w({open:!0,onClose:A,onChange:M.onChange,customOutputChildren:M==null?void 0:M.customOutputChildren,...M})},[A]);return{dialog:m.useMemo(()=>{if(s){const{onChange:M,onClose:j,api:O,customOutputChildren:L,...e}=s;return I.jsxs($,{open:!0,disablePortal:!1,sx:{zIndex:13001},onClose:j,...e,children:[I.jsx(_.default,{children:I.jsx(x.default,{ml:-2,display:"flex",alignItems:"center",justifyContent:"space-between",children:I.jsx(x.default,{display:"flex",alignItems:"center",children:I.jsx(q.default,{onClick:j,sx:{mr:1},children:I.jsx(P.default,{})})})})}),I.jsx(x.default,{flex:1,p:"0px 24px 16px",children:I.jsx(cg,{api:O,templates:C,onSelect:y=>{M(y||""),A()},onClose:j,customOutputChildren:L})})]})}return null},[s,C]),onShowDialog:o,onCloseDialog:A}}function Fg({options:C,onFinish:s}){const{t:w}=X.useLocaleContext(),{api:A}=p(),[o,g]=m.useState([]),[M,j]=m.useState(),[O,L]=m.useState(!1),[e,y]=m.useState(-1),J=m.useRef([]),D=async()=>{if(!C)return;j(void 0);const{template:N,...S}=C;try{L(!0);const B=A?{template:N}:{};if(A){const c=await A({...S,...B});g(z=>c?Array.isArray(c)?iI.default([...c,...z]):typeof c=="string"?iI.default([...z,c]):[...z]:[...z])}}catch(B){throw j(B),B}finally{L(!1)}};u.useAsyncEffect(async()=>{await D()},[C]);const b=()=>{var N;return M?I.jsxs(i.Box,{width:240,height:240,m:"auto",mt:"100px",children:[I.jsx(Q,{src:zI},"error"),I.jsx(i.Box,{textAlign:"center",color:"#25292F",children:w("ai.output.errorMessage")}),I.jsx(i.Button,{size:"small",onClick:D,sx:{display:"block",margin:"0 auto"},children:w("common.retry")})]}):C&&O?I.jsx(i.Box,{width:240,height:240,m:"auto",mt:"100px",children:I.jsx(Q,{src:FI},"loading")}):o&&Array.isArray(o)&&o.length>0?I.jsxs(I.Fragment,{children:[I.jsxs(i.Box,{flexGrow:1,sx:{height:0,overflow:"hidden",margin:"0 24px",display:"flex",gap:1},children:[I.jsxs(i.Box,{flex:1,sx:{bgcolor:"grey.200",borderRadius:1},children:[I.jsx(i.Box,{component:"h3",sx:{margin:"8px"},children:w("ai.text.original")}),I.jsx(i.Box,{p:1,children:(N=C==null?void 0:C.parameters)==null?void 0:N.theme})]}),I.jsxs(i.Box,{flex:1,sx:{borderColor:"grey.200",borderStyle:"dotted",borderRadius:1,overflow:"hidden",display:"flex",flexDirection:"column"},children:[I.jsx(i.Box,{component:"h3",sx:{margin:"8px"},children:w("ai.text.improve")}),I.jsx(i.Box,{flex:1,p:1,sx:{display:"flex",flexDirection:"column",gap:1,overflow:"auto"},children:o.map((S,B)=>I.jsx(yI.default.Fragment,{children:I.jsx(lg,{ref:c=>{J.current[B]=c},text:S,selected:e===B,onClick:()=>y(B)})},`${S}-${B}`))})]})]}),I.jsxs(i.Stack,{direction:"row",sx:{alignSelf:"end",gap:1,m:2},children:[I.jsx(i.Button,{size:"small",disabled:O,onClick:D,children:w("common.retry")}),I.jsx(i.Button,{size:"small",color:"primary",variant:"contained",disabled:e===-1||O,onClick:()=>{const S=J.current[e];s(S?(S==null?void 0:S.value)||" ":o[e]||"")},children:w("common.confirmDialogTitle")})]})]}):I.jsx(i.Box,{width:300,height:300,m:"auto",mt:"100px",children:I.jsx(Q,{src:aI},"welcome")})};return I.jsx(ag,{children:b()})}const ag=Z.default(i.Box)`
284
+ `;function cg({templates:C,api:s,onSelect:w,onClose:A=()=>{},customOutputChildren:o}){return I.jsxs(IC.ErrorBoundary,{FallbackComponent:Kg,children:[I.jsx(i.CssBaseline,{}),I.jsx(mI.Global,{styles:dg}),I.jsx(UC,{children:I.jsx(QC,{api:s,customOutputChildren:o,children:I.jsxs(OI.ToastProvider,{children:[I.jsx(Dg,{templates:C}),I.jsx(Bg,{onSelect:w,onClose:A})]})})})]})}function zg({templates:C}){const[s,w]=m.useState(),A=m.useCallback(()=>{w(void 0)},[]),o=m.useCallback(M=>{w({open:!0,onClose:A,onChange:M.onChange,customOutputChildren:M==null?void 0:M.customOutputChildren,...M})},[A]);return{dialog:m.useMemo(()=>{if(s){const{onChange:M,onClose:j,api:O,customOutputChildren:L,...e}=s;return I.jsxs(II,{open:!0,disablePortal:!1,sx:{zIndex:13001},onClose:j,...e,children:[I.jsx(q.default,{children:I.jsx(x.default,{ml:-2,display:"flex",alignItems:"center",justifyContent:"space-between",children:I.jsx(x.default,{display:"flex",alignItems:"center",children:I.jsx($.default,{onClick:j,sx:{mr:1},children:I.jsx(_.default,{})})})})}),I.jsx(x.default,{flex:1,p:"0px 24px 16px",children:I.jsx(cg,{api:O,templates:C,onSelect:y=>{M(y||""),A()},onClose:j,customOutputChildren:L})})]})}return null},[s,C]),onShowDialog:o,onCloseDialog:A}}function Fg({options:C,onFinish:s}){const{t:w}=X.useLocaleContext(),{api:A}=p(),[o,g]=m.useState([]),[M,j]=m.useState(),[O,L]=m.useState(!1),[e,y]=m.useState(-1),J=m.useRef([]),D=async()=>{if(!C)return;j(void 0);const{template:N,...S}=C;try{L(!0);const B=A?{template:N}:{};if(A){const c=await A({...S,...B});g(z=>c?Array.isArray(c)?sI.default([...c,...z]):typeof c=="string"?sI.default([...z,c]):[...z]:[...z])}}catch(B){throw j(B),B}finally{L(!1)}};u.useAsyncEffect(async()=>{await D()},[C]);const b=()=>{var N;return M?I.jsxs(i.Box,{width:240,height:240,m:"auto",mt:"100px",children:[I.jsx(Q,{src:zI},"error"),I.jsx(i.Box,{textAlign:"center",color:"#25292F",children:w("ai.output.errorMessage")}),I.jsx(i.Button,{size:"small",onClick:D,sx:{display:"block",margin:"0 auto"},children:w("common.retry")})]}):C&&O?I.jsx(i.Box,{width:240,height:240,m:"auto",mt:"100px",children:I.jsx(Q,{src:FI},"loading")}):o&&Array.isArray(o)&&o.length>0?I.jsxs(I.Fragment,{children:[I.jsxs(i.Box,{flexGrow:1,sx:{height:0,overflow:"hidden",margin:"0 24px",display:"flex",gap:1},children:[I.jsxs(i.Box,{flex:1,sx:{bgcolor:"grey.200",borderRadius:1},children:[I.jsx(i.Box,{component:"h3",sx:{margin:"8px"},children:w("ai.text.original")}),I.jsx(i.Box,{p:1,children:(N=C==null?void 0:C.parameters)==null?void 0:N.theme})]}),I.jsxs(i.Box,{flex:1,sx:{borderColor:"grey.200",borderStyle:"dotted",borderRadius:1,overflow:"hidden",display:"flex",flexDirection:"column"},children:[I.jsx(i.Box,{component:"h3",sx:{margin:"8px"},children:w("ai.text.improve")}),I.jsx(i.Box,{flex:1,p:1,sx:{display:"flex",flexDirection:"column",gap:1,overflow:"auto"},children:o.map((S,B)=>I.jsx(yI.default.Fragment,{children:I.jsx(lg,{ref:c=>{J.current[B]=c},text:S,selected:e===B,onClick:()=>y(B)})},`${S}-${B}`))})]})]}),I.jsxs(i.Stack,{direction:"row",sx:{alignSelf:"end",gap:1,m:2},children:[I.jsx(i.Button,{size:"small",disabled:O,onClick:D,children:w("common.retry")}),I.jsx(i.Button,{size:"small",color:"primary",variant:"contained",disabled:e===-1||O,onClick:()=>{const S=J.current[e];s(S?(S==null?void 0:S.value)||" ":o[e]||"")},children:w("common.confirmDialogTitle")})]})]}):I.jsx(i.Box,{width:300,height:300,m:"auto",mt:"100px",children:I.jsx(Q,{src:aI},"welcome")})};return I.jsx(ag,{children:b()})}const ag=Z.default(i.Box)`
285
285
  display: flex;
286
286
  flex-direction: column;
287
287
  flex: 1;
@@ -334,7 +334,7 @@ ${C}`}).then(w=>w.text??"")}function VC(C){const s=u.useReactive({searching:!1,s
334
334
  margin: auto;
335
335
  }
336
336
  }
337
- `;function ng(){const[C,s]=m.useState(),w=m.useMemo(()=>C?I.jsx(i.Menu,{...C}):null,[C]),A=m.useCallback(()=>{s(void 0)},[]),o=m.useCallback(g=>{s({...g,open:!0,onClose:g.onClose??A,onClick:A})},[A]);return{menu:w,showMenu:o,closeMenu:A}}let oI;function Xg({locale:C,locales:s,path:w,children:A,onChange:o,value:g}){var B;const M=!!KI("ai-kit"),j=v.useAsync(()=>(oI??(oI=M?dI():Promise.resolve({available:!1})),oI),[M]),{t:O}=X.useLocaleContext(),{menu:L,showMenu:e}=ng(),{state:{supportedLocales:y}}=H.useStore(),[J,D]=m.useState(!1),b=y.filter(c=>c.locale!==C).map(c=>{var T,W;const z=(W=(T=nC.default(s[c.locale],w))==null?void 0:T.trim)==null?void 0:W.call(T);return typeof z!="string"||!z?null:{locale:c.locale,language:c.name,text:z}}).filter(r.nonNullable);if(!M)return I.jsx(wI,{children:A});const N=!b.length&&!g,S=[g?{locale:C,language:O("translate.localInput"),text:g}:null,...b].filter(r.nonNullable);return I.jsxs(wI,{children:[I.jsxs(i.IconButton,{disabled:N||!((B=j.value)!=null&&B.available),className:yC.cx("language-button",(!!L||J)&&"active"),size:"small",onClick:c=>e({anchorEl:c.currentTarget,anchorOrigin:{horizontal:"right",vertical:"bottom"},transformOrigin:{horizontal:"right",vertical:"top"},sx:{maxWidth:400},children:S.map(z=>I.jsx(i.MenuItem,{onClick:async()=>{var T,W;D(!0);try{await GC({text:z.text,language:C}).then(d=>{o&&typeof o=="function"?o(d):XC.default(s[C],w,d)})}catch(d){throw DI.default.error(((W=(T=d.response)==null?void 0:T.data)==null?void 0:W.message)||d.message),d}finally{D(!1)}},children:I.jsx(i.ListItemText,{primary:`${O("maker.properties.translateFrom")} ${z.language}`,secondary:z.text,primaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"},secondaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"}})},z.locale))}),children:[I.jsx(Y.Language,{fontSize:"small"}),J&&I.jsx(i.CircularProgress,{size:22})]}),L,A]})}const wI=f.styled(i.Box)`
337
+ `;function ng(){const[C,s]=m.useState(),w=m.useMemo(()=>C?I.jsx(i.Menu,{...C}):null,[C]),A=m.useCallback(()=>{s(void 0)},[]),o=m.useCallback(g=>{s({...g,open:!0,onClose:g.onClose??A,onClick:A})},[A]);return{menu:w,showMenu:o,closeMenu:A}}let wI;function Xg({locale:C,locales:s,path:w,children:A,onChange:o,value:g}){var B;const M=!!KI("ai-kit"),j=v.useAsync(()=>(wI??(wI=M?dI():Promise.resolve({available:!1})),wI),[M]),{t:O}=X.useLocaleContext(),{menu:L,showMenu:e}=ng(),{state:{supportedLocales:y}}=H.useStore(),[J,D]=m.useState(!1),b=y.filter(c=>c.locale!==C).map(c=>{var T,W;const z=(W=(T=nC.default(s[c.locale],w))==null?void 0:T.trim)==null?void 0:W.call(T);return typeof z!="string"||!z?null:{locale:c.locale,language:c.name,text:z}}).filter(r.nonNullable);if(!M)return I.jsx(MI,{children:A});const N=!b.length&&!g,S=[g?{locale:C,language:O("translate.localInput"),text:g}:null,...b].filter(r.nonNullable);return I.jsxs(MI,{children:[I.jsxs(i.IconButton,{disabled:N||!((B=j.value)!=null&&B.available),className:yC.cx("language-button",(!!L||J)&&"active"),size:"small",onClick:c=>e({anchorEl:c.currentTarget,anchorOrigin:{horizontal:"right",vertical:"bottom"},transformOrigin:{horizontal:"right",vertical:"top"},sx:{maxWidth:400},children:S.map(z=>I.jsx(i.MenuItem,{onClick:async()=>{var T,W;D(!0);try{await GC({text:z.text,language:C}).then(d=>{o&&typeof o=="function"?o(d):XC.default(s[C],w,d)})}catch(d){throw DI.default.error(((W=(T=d.response)==null?void 0:T.data)==null?void 0:W.message)||d.message),d}finally{D(!1)}},children:I.jsx(i.ListItemText,{primary:`${O("maker.properties.translateFrom")} ${z.language}`,secondary:z.text,primaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"},secondaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"}})},z.locale))}),children:[I.jsx(Y.Language,{fontSize:"small"}),J&&I.jsx(i.CircularProgress,{size:22})]}),L,A]})}const MI=f.styled(i.Box)`
338
338
  > .language-button {
339
339
  display: none;
340
340
  z-index: 1;
@@ -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:"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;
378
+ `,Wg="primary",xg="contained",LI={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({...LI}),[y,J]=m.useState(-1),D=m.useCallback(()=>{j()},[j]);m.useImperativeHandle(o,()=>({open(S,B){e(a.produce(L,c=>{Object.assign(c,{...LI},{...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 jI={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({...jI,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,{...jI},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 kt=Object.create;var ot=Object.defineProperty;var $t=Object.getOwnPropertyDescriptor;var St=Object.getOwnPropertyNames;var Nt=Object.getPrototypeOf,Ct=Object.prototype.hasOwnProperty;var Bt=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of St(e))!Ct.call(t,n)&&n!==r&&ot(t,n,{get:()=>e[n],enumerable:!(i=$t(e,n))||i.enumerable});return t};var It=(t,e,r)=>(r=t!=null?kt(Nt(t)):{},Bt(e||!t||!t.__esModule?ot(r,"default",{value:t,enumerable:!0}):r,t));const o=require("react/jsx-runtime");require("@mui/icons-material");const x=require("@mui/material"),f=require("react"),Pt=require("lodash/keyBy"),j=require("./state-DDwYX2mu.js"),U=require("@blocklet/ai-runtime/components"),Rt=require("@mui/utils"),Wt=require("lodash/pick"),Tt=require("react-error-boundary"),zt=require("@blocklet/pages-kit/builtin/markdown/markdown-renderer"),mt=require("@blocklet/pages-kit/contexts/color"),g=require("@emotion/css"),Et=require("react-syntax-highlighter/dist/esm/styles/prism"),k=require("@arcblock/ux/lib/Theme"),qt=require("@arcblock/react-hooks/lib/useBrowser"),Lt=require("@arcblock/ux/lib/Colors"),J=require("@blocklet/pages-kit/components"),nt=require("@blocklet/pages-kit/utils/style"),At=require("@mui/material/useMediaQuery"),Ot=require("lodash/omit"),pt=require("@iconify-icon/react"),Ut=require("@arcblock/ux/lib/Screenshot"),G=require("react-router-dom"),Ft=require("@arcblock/ux/lib/Button"),Dt=require("is-uri"),F=require("pathe"),W=require("ufo"),Mt=require("@blocklet/embed/message"),Vt=require("ahooks"),Ht=require("lodash/isEqual"),Yt=require("@blocklet/embed/react"),Jt=require("react-twitter-embed"),rt=require("react-use"),$=t=>t&&t.__esModule?t:{default:t},Gt=$(f),M=$(Pt),K=$(Wt),Kt=$(zt),Xt=$(qt),it=$(Lt),xt=$(At),N=$(Ot),Qt=$(Ut),Zt=$(Ft),V=$(Dt),te=$(Ht),ht="{{CUSTOM_VALUE}}",ee=[{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}}}],oe=[{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}}}],ne=[{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}}}],D=(t,e,r)=>{const i=t.breakpoints.values[r];return`${e}${i?` (${i}px)`:""}`},re=[{title:"100%",value:"full",sx:{maxWidth:"100%"}},{title:t=>D(t,"Small","sm"),value:"sm",sx:{maxWidth:t=>t.breakpoints.values.sm,width:"100%",mx:"auto"}},{title:t=>D(t,"Normal","md"),value:"md",sx:{maxWidth:t=>t.breakpoints.values.md,width:"100%",mx:"auto"}},{title:t=>D(t,"Large","lg"),value:"lg",sx:{maxWidth:t=>t.breakpoints.values.lg,width:"100%",mx:"auto"}},{title:t=>D(t,"Extra Large","xl"),value:"xl",sx:{maxWidth:t=>t.breakpoints.values.xl,width:"100%",mx:"auto"}},{title:"Custom",value:"custom",sx:{maxWidth:ht,width:"100%",mx:"auto"}}],ie=M.default(ee,"value"),se=M.default(oe,"value"),ae=M.default(ne,"value"),le=M.default(re,"value"),ce=new Map([["baseSectionPaddingY",ie],["maxWidth",le],["paddingY",se],["paddingX",ae]]);function ft(t){var l;const{type:e,value:r,format:i="sx",defaultValue:n=null}=t,s=ce.get(e);if(!s)return n;const d=r.startsWith("custom:"),a=d?"custom":r;if(s!=null&&s[a]&&((l=s==null?void 0:s[a])!=null&&l[i])){const c=s[a][i];if(d){const u=r.replace("custom:","");try{return JSON.parse(JSON.stringify(c||{}).replaceAll(ht,u))}catch{}}return c}return n}const gt=f.createContext({page:null,getPageMeta:()=>({}),getPageMetaStyle:()=>({})});function de(){return f.useContext(gt)}function ue({page:t,children:e,defaultLocale:r="en",currentLocale:i}){const n=f.useMemo(()=>t?JSON.parse(JSON.stringify(t)):null,[JSON.stringify(t)]),s=f.useCallback(()=>{var c;if(!n)return{};const l=i||r;return((c=n.locales)==null?void 0:c[l])??{}},[n,r,i]),d=f.useCallback((l="sx")=>{const c=s();return!c||!c.style?{}:Object.entries(c.style||{}).reduce((m,[h,p])=>{if(!p)return m;const y=`${h}Custom`;c.style[y];const w=ft({type:h,value:p,format:l});return w?{...m,...w}:m},{})},[s]),a=f.useMemo(()=>({page:n,getPageMeta:s,getPageMetaStyle:d}),[n,s,d]);return o.jsx(gt.Provider,{value:a,children:e})}function R({actions:t,center:e,className:r,align:i}){return t&&(t!=null&&t.length)?o.jsx(x.Box,{className:g.cx("flex gap-4 flex-wrap","lg:flex-row lg:gap-8",(e||i==="center")&&"justify-center",!e&&i==="right"&&"justify-end",!e&&i==="left"&&"justify-start",r),sx:{alignItems:"center"},children:t}):null}const me="section",pe=x.styled(x.Box)`
1
+ "use strict";var kt=Object.create;var ot=Object.defineProperty;var $t=Object.getOwnPropertyDescriptor;var St=Object.getOwnPropertyNames;var Nt=Object.getPrototypeOf,Ct=Object.prototype.hasOwnProperty;var Bt=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of St(e))!Ct.call(t,n)&&n!==r&&ot(t,n,{get:()=>e[n],enumerable:!(i=$t(e,n))||i.enumerable});return t};var Pt=(t,e,r)=>(r=t!=null?kt(Nt(t)):{},Bt(e||!t||!t.__esModule?ot(r,"default",{value:t,enumerable:!0}):r,t));const o=require("react/jsx-runtime");require("@mui/icons-material");const x=require("@mui/material"),f=require("react"),It=require("lodash/keyBy"),j=require("./state-oc52fQ0j.js"),F=require("@blocklet/ai-runtime/components"),Rt=require("@mui/utils"),Wt=require("lodash/pick"),Tt=require("react-error-boundary"),zt=require("@blocklet/pages-kit/builtin/markdown/markdown-renderer"),mt=require("@blocklet/pages-kit/contexts/color"),g=require("@emotion/css"),Et=require("react-syntax-highlighter/dist/esm/styles/prism"),k=require("@arcblock/ux/lib/Theme"),qt=require("@arcblock/react-hooks/lib/useBrowser"),Lt=require("@arcblock/ux/lib/Colors"),J=require("@blocklet/pages-kit/components"),nt=require("@blocklet/pages-kit/utils/style"),At=require("@mui/material/useMediaQuery"),Ot=require("lodash/omit"),pt=require("@iconify-icon/react"),Ut=require("@arcblock/ux/lib/Screenshot"),G=require("react-router-dom"),Ft=require("@arcblock/ux/lib/Button"),Dt=require("is-uri"),D=require("pathe"),W=require("ufo"),Mt=require("@blocklet/embed/message"),Vt=require("ahooks"),Ht=require("lodash/isEqual"),Yt=require("@blocklet/embed/react"),Jt=require("react-twitter-embed"),rt=require("react-use"),$=t=>t&&t.__esModule?t:{default:t},Gt=$(f),V=$(It),K=$(Wt),Kt=$(zt),Xt=$(qt),it=$(Lt),xt=$(At),N=$(Ot),Qt=$(Ut),Zt=$(Ft),H=$(Dt),te=$(Ht),ht="{{CUSTOM_VALUE}}",ee=[{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}}}],oe=[{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}}}],ne=[{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,r)=>{const i=t.breakpoints.values[r];return`${e}${i?` (${i}px)`:""}`},re=[{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:ht,width:"100%",mx:"auto"}}],ie=V.default(ee,"value"),se=V.default(oe,"value"),ae=V.default(ne,"value"),le=V.default(re,"value"),ce=new Map([["baseSectionPaddingY",ie],["maxWidth",le],["paddingY",se],["paddingX",ae]]);function ft(t){var l;const{type:e,value:r,format:i="sx",defaultValue:n=null}=t,s=ce.get(e);if(!s)return n;const d=r.startsWith("custom:"),a=d?"custom":r;if(s!=null&&s[a]&&((l=s==null?void 0:s[a])!=null&&l[i])){const c=s[a][i];if(d){const u=r.replace("custom:","");try{return JSON.parse(JSON.stringify(c||{}).replaceAll(ht,u))}catch{}}return c}return n}const gt=f.createContext({page:null,getPageMeta:()=>({}),getPageMetaStyle:()=>({})});function de(){return f.useContext(gt)}function ue({page:t,children:e,defaultLocale:r="en",currentLocale:i}){const n=f.useMemo(()=>t?JSON.parse(JSON.stringify(t)):null,[JSON.stringify(t)]),s=f.useCallback(()=>{var c;if(!n)return{};const l=i||r;return((c=n.locales)==null?void 0:c[l])??{}},[n,r,i]),d=f.useCallback((l="sx")=>{const c=s();return!c||!c.style?{}:Object.entries(c.style||{}).reduce((m,[h,p])=>{if(!p)return m;const y=`${h}Custom`;c.style[y];const w=ft({type:h,value:p,format:l});return w?{...m,...w}:m},{})},[s]),a=f.useMemo(()=>({page:n,getPageMeta:s,getPageMetaStyle:d}),[n,s,d]);return o.jsx(gt.Provider,{value:a,children:e})}function R({actions:t,center:e,className:r,align:i}){return t&&(t!=null&&t.length)?o.jsx(x.Box,{className:g.cx("flex gap-4 flex-wrap","lg:flex-row lg:gap-8",(e||i==="center")&&"justify-center",!e&&i==="right"&&"justify-end",!e&&i==="left"&&"justify-start",r),sx:{alignItems:"center"},children:t}):null}const me="section",pe=x.styled(x.Box)`
2
2
  overflow: hidden;
3
3
 
4
4
  .section__title {
@@ -60,7 +60,7 @@
60
60
  margin-bottom: 40px;
61
61
  }
62
62
  }
63
- `;function z({title:t,description:e,descriptionMarkdown:r,actions:i,className:n="",classes:s={},prepend:d,append:a,level:l=2,tag:c,badge:u,center:m,logo:h,titleAppearance:p,descriptionAppearance:y,...w}){const b=mt.useColorConvert();if(!t&&!e&&!i&&!u&&!c&&!d&&!a&&!h)return null;const v=Math.max(Math.min(5,l+1),1),_={1:"xl:!text-3xl lg:!text-2xl md:!text-xl",2:"xl:!text-2xl lg:!text-xl md:!text-lg",3:"xl:!text-2xl lg:!text-xl md:!text-lg",4:"xl:!text-xl lg:!text-lg md:!text-md",5:"xl:!text-lg md:!text-md sm:!text-sm",6:"!text-sm"},I=l===0?"big":`h${v}`,P=l===0;return o.jsxs(pe,{className:g.cx("base-info","lg:text-left",m&&"!text-center",n),...w,children:[d&&o.jsx("div",{children:d}),(c||u)&&o.jsx("div",{className:g.cx("section__tag",(s==null?void 0:s.tag)||(s==null?void 0:s.badge)),children:c||u}),h&&o.jsx("img",{className:"w-[120px] m-auto mb-8",src:h,alt:"info",loading:"lazy"}),t&&o.jsx(x.Typography,{sx:{whiteSpace:"pre-wrap",mb:e?"2vw":0,...(p==null?void 0:p.color)&&{color:`${b(p.color)} !important`}},className:g.cx("section__title","text-gray-800","dark:text-gray-50",s.title,"page-kit-section__title",P?"":"section__title_non_big"),component:`h${Math.max(l,1)}`,variant:I,children:t}),e&&(r?o.jsx(x.Box,{sx:{...(y==null?void 0:y.color)&&{color:`${b(y.color)} !important`}},className:g.cx("section__description","text-gray-800","dark:text-gray-100",_[v],s.description,"page-kit-section__description"),children:o.jsx(Kt.default,{codeOptions:{showActionButton:!1,theme:Et.materialDark},children:e})}):o.jsx(x.Typography,{sx:{whiteSpace:"pre-wrap",...(y==null?void 0:y.color)&&{color:`${b(y.color)} !important`}},className:g.cx("section__description","text-gray-800","dark:text-gray-100",_[v],s.description,"page-kit-section__description"),component:"div",variant:"body1",gutterBottom:!0,children:e})),o.jsx(R,{actions:i,center:m,className:"mt-8"}),a&&o.jsx("div",{children:a})]})}const E=["actions","append","badge","tag","center","description","descriptionMarkdown","level","logo","prepend","title","titleAppearance","descriptionAppearance"];function yt(t){if(t.type===f.Fragment){const r=(t.props.children||[]).filter(i=>f.isValidElement(i));return r.length===1?yt(r[0]):r.length>1}return Array.isArray(t)}const C="&>*";function X({children:t,col:e,gap:r,className:i,align:n,sx:s,type:d,...a}={children:null,className:"",col:3,gap:void 0,sx:{},align:"center",type:"default"}){const l=k.useTheme(),c=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"},m=u[n]||u.center;let p=r??({2:6,3:4,4:4,5:3,6:3}[e]||0);yt(t)||(p=0);const w=(e-1)*p/e;let b={...s,gap:`${p}rem`};const v={[C]:{width:"100%"}},_={},I={},P={};switch(v.gap="1rem",_.gap=`${p/2}rem`,e){case 3:case 4:_[C]={width:`calc(50% - ${p/2}rem)`};break;case 5:case 6:v[C]={width:`calc(50% - ${p/2/2}rem)`},_[C]={width:`calc(50% - ${p/2/2}rem)`},I[C]={width:`calc(33.33% - ${p*2/3}rem)`};break}return b[C]={width:`calc(${c}% - ${w}rem)`},b[`@media (max-width: ${l.breakpoints.values.xl}px)`]=P,b[`@media (max-width: ${l.breakpoints.values.lg}px)`]=I,b[`@media (max-width: ${l.breakpoints.values.md}px)`]=_,b[`@media (max-width: ${l.breakpoints.values.sm}px)`]=v,d==="wall"&&(b={...s,gap:`${p}rem`},b[C]={width:`calc(${c}% - ${w}rem)`},v[C]={width:`calc(45% - ${p/2/2}rem)`},b[`@media (max-width: ${l.breakpoints.values.sm}px)`]=v),o.jsx(x.Box,{className:g.cx("flex flex-wrap flex-row h-full",m,i),sx:b,...a,children:t})}function xe(){const t=navigator.userAgent.toLowerCase();return t.includes("safari")&&!t.includes("chrome")}function he(t=""){if(t.startsWith("data:image/svg+xml,"))return!0;const e=/^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/,r=/^(\/|\.\/|\.\.\/)(?:[^/]+\/)*[^/]+$/;return e.test(t)||r.test(t)}function H(t){return(t==null?void 0:t.endsWith(".mp4"))||(t==null?void 0:t.endsWith(".m4v"))||(t==null?void 0:t.endsWith(".webm"))}function fe(t){return t!=null&&t.endsWith(".mp4")||t!=null&&t.endsWith(".m4v")?"video/mp4":t!=null&&t.endsWith(".webm")?"video/webm":void 0}function ge(t){let e={};return typeof t=="string"?nt.isGradient(t)?e.image=t:(e.image=j.getImageAbsoluteUrl(t),nt.isColorString(t)&&(e.color=t,e.image="")):e=t,e}function ye(){const[t,e]=f.useState(Date.now());return f.useEffect(()=>{const r=()=>{e(Date.now())};return document.addEventListener("visibilitychange",r),()=>{document.removeEventListener("visibilitychange",r)}},[]),t}function st(t,e,r,i,n){let s=null;const{color:d="",image:a}=ge(e);return a&&he(a)?(delete r.backgroundColor,!(t.mobile.apple.device||xe())&&H(a)?s=o.jsx(x.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:H(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(J.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"}},n||a)):a?r.backgroundImage=`${a} !important`:d&&(r.backgroundColor=`${d} !important`),s}function be({autoWidth:t,children:e,...r}){return t?o.jsx(x.Box,{display:"flex",...r,children:e}):o.jsx(x.Container,{...r,children:e})}function q({dark:t=!1,children:e,className:r,sx:i={},boxed:n={show:!1},padding:s="normal",boxProps:d,type:a,...l}){const c={...i},u=xt.default(p=>p.breakpoints.down("md"));t&&(c.color=it.default.common.white,c.backgroundColor=`${it.default.grey[900]} !important`),n.show&&(c.display="flex");const m=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=ft({type:"baseSectionPaddingY",value:s||"normal",defaultValue:""});return o.jsx(we,{component:"section",styles:{...c,...h},className:g.cx("base-section","px-2 md:px-5 lg:px-5 xl:px-10",r,{dark:t}),...N.default(l,"hoverStyle","boxMaxWidth","embedUrl","autoWidth","paddingXY","iframeHeight","titleAppearance","descriptionAppearance"),children:o.jsx(be,{autoWidth:l==null?void 0:l.autoWidth,className:g.cx("section-content h-full"),sx:m,children:n.show?o.jsx(bt,{...d,boxed:n,children:e}):e})})}function bt({background:t="",backgroundVideoPoster:e,children:r,sx:i={},boxed:n={show:!1},className:s="",styles:d={},...a}){const l={...d,...i},c=mt.useColorConvert();let u=null;const m=xt.default(y=>y.breakpoints.up("sm")),h=Xt.default(),p=ye();return t&&(u=st(h,typeof t=="string"?c(t):t,l,e,p)),n.show&&(l.borderRadius="10px",l.padding===void 0&&(l.padding=m?"50px":"20px"),n!=null&&n.border&&(l.border="1px solid #c0c0c0"),n!=null&&n.background&&(u=st(h,typeof(n==null?void 0:n.background)=="string"?c(n==null?void 0:n.background):n==null?void 0:n.background,l,n==null?void 0:n.backgroundVideoPoster,p))),o.jsxs(x.Box,{...a,sx:{...l,...u?{position:"relative",overflow:"hidden",zIndex:0}:{}},className:g.cx(s,(n==null?void 0:n.boxShadow)&&"shadow-xl"),children:[u,r]})}const we=k.styled(bt)`
63
+ `;function E({title:t,description:e,descriptionMarkdown:r,actions:i,className:n="",classes:s={},prepend:d,append:a,level:l=2,tag:c,badge:u,center:m,logo:h,titleAppearance:p,descriptionAppearance:y,...w}){const b=mt.useColorConvert();if(!t&&!e&&!i&&!u&&!c&&!d&&!a&&!h)return null;const v=Math.max(Math.min(5,l+1),1),_={1:"xl:!text-3xl lg:!text-2xl md:!text-xl",2:"xl:!text-2xl lg:!text-xl md:!text-lg",3:"xl:!text-2xl lg:!text-xl md:!text-lg",4:"xl:!text-xl lg:!text-lg md:!text-md",5:"xl:!text-lg md:!text-md sm:!text-sm",6:"!text-sm"},P=l===0?"big":`h${v}`,I=l===0;return o.jsxs(pe,{className:g.cx("base-info","lg:text-left",m&&"!text-center",n),...w,children:[d&&o.jsx("div",{children:d}),(c||u)&&o.jsx("div",{className:g.cx("section__tag",(s==null?void 0:s.tag)||(s==null?void 0:s.badge)),children:c||u}),h&&o.jsx("img",{className:"w-[120px] m-auto mb-8",src:h,alt:"info",loading:"lazy"}),t&&o.jsx(x.Typography,{sx:{whiteSpace:"pre-wrap",mb:e?"2vw":0,...(p==null?void 0:p.color)&&{color:`${b(p.color)} !important`}},className:g.cx("section__title","text-gray-800","dark:text-gray-50",s.title,"page-kit-section__title",I?"":"section__title_non_big"),component:`h${Math.max(l,1)}`,variant:P,children:t}),e&&(r?o.jsx(x.Box,{sx:{...(y==null?void 0:y.color)&&{color:`${b(y.color)} !important`}},className:g.cx("section__description","text-gray-800","dark:text-gray-100",_[v],s.description,"page-kit-section__description"),children:o.jsx(Kt.default,{codeOptions:{showActionButton:!1,theme:Et.materialDark},children:e})}):o.jsx(x.Typography,{sx:{whiteSpace:"pre-wrap",...(y==null?void 0:y.color)&&{color:`${b(y.color)} !important`}},className:g.cx("section__description","text-gray-800","dark:text-gray-100",_[v],s.description,"page-kit-section__description"),component:"div",variant:"body1",gutterBottom:!0,children:e})),o.jsx(R,{actions:i,center:m,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 yt(t){if(t.type===f.Fragment){const r=(t.props.children||[]).filter(i=>f.isValidElement(i));return r.length===1?yt(r[0]):r.length>1}return Array.isArray(t)}const C="&>*";function X({children:t,col:e,gap:r,className:i,align:n,sx:s,type:d,...a}={children:null,className:"",col:3,gap:void 0,sx:{},align:"center",type:"default"}){const l=k.useTheme(),c=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"},m=u[n]||u.center;let p=r??({2:6,3:4,4:4,5:3,6:3}[e]||0);yt(t)||(p=0);const w=(e-1)*p/e;let b={...s,gap:`${p}rem`};const v={[C]:{width:"100%"}},_={},P={},I={};switch(v.gap="1rem",_.gap=`${p/2}rem`,e){case 3:case 4:_[C]={width:`calc(50% - ${p/2}rem)`};break;case 5:case 6:v[C]={width:`calc(50% - ${p/2/2}rem)`},_[C]={width:`calc(50% - ${p/2/2}rem)`},P[C]={width:`calc(33.33% - ${p*2/3}rem)`};break}return b[C]={width:`calc(${c}% - ${w}rem)`},b[`@media (max-width: ${l.breakpoints.values.xl}px)`]=I,b[`@media (max-width: ${l.breakpoints.values.lg}px)`]=P,b[`@media (max-width: ${l.breakpoints.values.md}px)`]=_,b[`@media (max-width: ${l.breakpoints.values.sm}px)`]=v,d==="wall"&&(b={...s,gap:`${p}rem`},b[C]={width:`calc(${c}% - ${w}rem)`},v[C]={width:`calc(45% - ${p/2/2}rem)`},b[`@media (max-width: ${l.breakpoints.values.sm}px)`]=v),o.jsx(x.Box,{className:g.cx("flex flex-wrap flex-row h-full",m,i),sx:b,...a,children:t})}function xe(){const t=navigator.userAgent.toLowerCase();return t.includes("safari")&&!t.includes("chrome")}function he(t=""){if(t.startsWith("data:image/svg+xml,"))return!0;const e=/^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/,r=/^(\/|\.\/|\.\.\/)(?:[^/]+\/)*[^/]+$/;return e.test(t)||r.test(t)}function T(t){return(t==null?void 0:t.endsWith(".mp4"))||(t==null?void 0:t.endsWith(".m4v"))||(t==null?void 0:t.endsWith(".webm"))}function fe(t){return t!=null&&t.endsWith(".mp4")||t!=null&&t.endsWith(".m4v")?"video/mp4":t!=null&&t.endsWith(".webm")?"video/webm":void 0}function ge(t){let e={};return typeof t=="string"?nt.isGradient(t)?e.image=t:(e.image=j.getImageAbsoluteUrl(t),nt.isColorString(t)&&(e.color=t,e.image="")):e=t,e}function ye(){const[t,e]=f.useState(Date.now());return f.useEffect(()=>{const r=()=>{e(Date.now())};return document.addEventListener("visibilitychange",r),()=>{document.removeEventListener("visibilitychange",r)}},[]),t}function st(t,e,r,i,n){let s=null;const{color:d="",image:a}=ge(e);if(a&&he(a)){delete r.backgroundColor;const l=!(t.mobile.apple.device||xe())&&T(a),c=T(a)&&i?j.autoResizeImage(j.getImageAbsoluteUrl(i),1200,"quality"):"";l?s=o.jsx(x.Box,{component:"video",className:"section-bg",width:"100%",autoPlay:!0,loop:!0,muted:!0,controls:!1,playsInline:!0,poster:c,src:T(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(J.ResponsiveImage,{src:T(a)&&i?c: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"}},n||a)}else a?r.backgroundImage=`${a} !important`:d&&(r.backgroundColor=`${d} !important`);return s}function be({autoWidth:t,children:e,...r}){return t?o.jsx(x.Box,{display:"flex",...r,children:e}):o.jsx(x.Container,{...r,children:e})}function L({dark:t=!1,children:e,className:r,sx:i={},boxed:n={show:!1},padding:s="normal",boxProps:d,type:a,...l}){const c={...i},u=xt.default(p=>p.breakpoints.down("md"));t&&(c.color=it.default.common.white,c.backgroundColor=`${it.default.grey[900]} !important`),n.show&&(c.display="flex");const m=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=ft({type:"baseSectionPaddingY",value:s||"normal",defaultValue:""});return o.jsx(we,{component:"section",styles:{...c,...h},className:g.cx("base-section","px-2 md:px-5 lg:px-5 xl:px-10",r,{dark:t}),...N.default(l,"hoverStyle","boxMaxWidth","embedUrl","autoWidth","paddingXY","iframeHeight","titleAppearance","descriptionAppearance"),children:o.jsx(be,{autoWidth:l==null?void 0:l.autoWidth,className:g.cx("section-content h-full"),sx:m,children:n.show?o.jsx(bt,{...d,boxed:n,children:e}):e})})}function bt({background:t="",backgroundVideoPoster:e,children:r,sx:i={},boxed:n={show:!1},className:s="",styles:d={},...a}){const l={...d,...i},c=mt.useColorConvert();let u=null;const m=xt.default(y=>y.breakpoints.up("sm")),h=Xt.default(),p=ye();return t&&(u=st(h,typeof t=="string"?c(t):t,l,e,p)),n.show&&(l.borderRadius="10px",l.padding===void 0&&(l.padding=m?"50px":"20px"),n!=null&&n.border&&(l.border="1px solid #c0c0c0"),n!=null&&n.background&&(u=st(h,typeof(n==null?void 0:n.background)=="string"?c(n==null?void 0:n.background):n==null?void 0:n.background,l,n==null?void 0:n.backgroundVideoPoster,p))),o.jsxs(x.Box,{...a,sx:{...l,...u?{position:"relative",overflow:"hidden",zIndex:0}:{}},className:g.cx(s,(n==null?void 0:n.boxShadow)&&"shadow-xl"),children:[u,r]})}const we=k.styled(bt)`
64
64
  &:nth-of-type(even) {
65
65
  background: #f8f8f8;
66
66
  }
@@ -76,7 +76,7 @@
76
76
  }
77
77
  }
78
78
  }
79
- `;function Q({icon:t,...e}){return o.jsx(pt.Icon,{icon:t,...e,ref:null})}function S(t,e){const r=K.default(t,e),i=N.default(t,e);return[r,i]}const wt=["title","description","actions","badge","tag","prepend","append","logo"];function je({image:t,imageBorder:e,imageShadow:r,className:i,reverse:n=!1,fullSizeImage:s,...d}){const[a,l]=S(d,E),c=Object.keys(a).length>0&&Object.values(K.default(a,wt)).filter(Boolean).length>0&&o.jsx(z,{...a}),u=f.isValidElement(t)?t:o.jsx(x.Box,{component:"img",src:t,alt:"",className:"block"}),m=["phone","macbook"].includes(e),h=t&&o.jsx(x.Box,{className:g.cx("section__image","m-auto, leading-[1] text-center",r&&"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":m?{width:"100%",video:{borderRadius:"0 !important"}}:void 0},children:m?o.jsx(Qt.default,{type:e,sx:{width:"100%"},children:u}):u});return o.jsx(q,{className:g.cx("section--block",i,s&&!n&&g.css`
79
+ `;function Q({icon:t,...e}){return o.jsx(pt.Icon,{icon:t,...e,ref:null})}function S(t,e){const r=K.default(t,e),i=N.default(t,e);return[r,i]}const wt=["title","description","actions","badge","tag","prepend","append","logo"];function je({image:t,imageBorder:e,imageShadow:r,className:i,reverse:n=!1,fullSizeImage:s,...d}){const[a,l]=S(d,q),c=Object.keys(a).length>0&&Object.values(K.default(a,wt)).filter(Boolean).length>0&&o.jsx(E,{...a}),u=f.isValidElement(t)?t:o.jsx(x.Box,{component:"img",src:t,alt:"",className:"block"}),m=["phone","macbook"].includes(e),h=t&&o.jsx(x.Box,{className:g.cx("section__image","m-auto, leading-[1] text-center",r&&"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":m?{width:"100%",video:{borderRadius:"0 !important"}}:void 0},children:m?o.jsx(Qt.default,{type:e,sx:{width:"100%"},children:u}):u});return o.jsx(L,{className:g.cx("section--block",i,s&&!n&&g.css`
80
80
  .section-bg {
81
81
  height: 80%;
82
82
  }
@@ -93,10 +93,10 @@
93
93
  width: 100%;
94
94
  }
95
95
  }
96
- `:void 0,children:n?o.jsxs(o.Fragment,{children:[h,c]}):o.jsxs(o.Fragment,{children:[c,h]})})})}const L=["editing","height","locale","dev","sx"];function _e(t){const{className:e,...r}=t;return o.jsx(ve,{...r,className:g.cx("BlockBase-root",e)})}const ve=k.styled(x.Box)`
96
+ `:void 0,children:n?o.jsxs(o.Fragment,{children:[h,c]}):o.jsxs(o.Fragment,{children:[c,h]})})})}const A=["editing","height","locale","dev","sx"];function _e(t){const{className:e,...r}=t;return o.jsx(ve,{...r,className:g.cx("BlockBase-root",e)})}const ve=k.styled(x.Box)`
97
97
  position: relative;
98
98
  color: ${({theme:t})=>t.palette.text.primary};
99
- `;function ke({widget:t,reverse:e,projectId:r,assistantId:i,working:n,submitTitle:s,submitIcon:d,submitColor:a,placeholder:l,loadingIndicator:c,section:u,...m}){const[{editing:h},p]=S(m,L),[y,w]=S(p,E),b=r&&i?{projectId:r,gitRef:"main",assistantId:i,working:!0}:void 0,v={children:s,endIcon:d?o.jsx(Q,{icon:d}):void 0,sx:{background:a||void 0,":hover":{background:a||void 0,opacity:.8}}},_=[],I=l&&o.jsx(x.Typography,{variant:"caption",color:"text.disabled",children:l}),P=c&&o.jsx(x.Typography,{variant:"caption",color:"text.disabled",children:c});Object.keys(y).length>0&&Object.values(K.default(y,wt)).filter(Boolean).length>0&&_.push(o.jsx(z,{...y},"base-info")),b&&(t==="form"?_.push(o.jsx(U.AIForm,{identifier:b,SubmitProps:v},"form")):t==="result"?_.push(o.jsx(U.AIFormResult,{identifier:b,placeholder:I,loadingIndicator:P},"result")):_.push(o.jsxs(x.Stack,{width:"100%",gap:2,direction:"row",children:[o.jsx(U.AIForm,{identifier:b,BoxProps:{flex:1},SubmitProps:v}),o.jsx(U.AIFormResult,{identifier:b,BoxProps:{flex:1},placeholder:I,loadingIndicator:P})]},"form-result"))),e&&_.reverse();const et=x.useTheme(),vt=f.useMemo(()=>x.createTheme(Rt.deepmerge(et,{palette:{primary:a?{main:a}:void 0}})),[a,et]);return o.jsx(Tt.ErrorBoundary,{fallbackRender:j.ErrorView,children:o.jsx(x.ThemeProvider,{theme:vt,children:o.jsx(q,{...w,sx:h?{pointerEvents:"none"}:{},children:o.jsx(X,{col:_.length,children:_})})})})}const jt=f.createContext({pages:[],project:void 0}),{Provider:$e,Consumer:vo}=jt;function _t(){return f.useContext(jt)}function Se({icon:t,className:e="",size:r="1rem",...i}){return o.jsx(Ne,{component:Q,className:g.cx("css-icon",e),size:r,...i,icon:t})}const Ne=k.styled(x.Box)`
99
+ `;function ke({widget:t,reverse:e,projectId:r,assistantId:i,working:n,submitTitle:s,submitIcon:d,submitColor:a,placeholder:l,loadingIndicator:c,section:u,...m}){const[{editing:h},p]=S(m,A),[y,w]=S(p,q),b=r&&i?{projectId:r,gitRef:"main",assistantId:i,working:!0}:void 0,v={children:s,endIcon:d?o.jsx(Q,{icon:d}):void 0,sx:{background:a||void 0,":hover":{background:a||void 0,opacity:.8}}},_=[],P=l&&o.jsx(x.Typography,{variant:"caption",color:"text.disabled",children:l}),I=c&&o.jsx(x.Typography,{variant:"caption",color:"text.disabled",children:c});Object.keys(y).length>0&&Object.values(K.default(y,wt)).filter(Boolean).length>0&&_.push(o.jsx(E,{...y},"base-info")),b&&(t==="form"?_.push(o.jsx(F.AIForm,{identifier:b,SubmitProps:v},"form")):t==="result"?_.push(o.jsx(F.AIFormResult,{identifier:b,placeholder:P,loadingIndicator:I},"result")):_.push(o.jsxs(x.Stack,{width:"100%",gap:2,direction:"row",children:[o.jsx(F.AIForm,{identifier:b,BoxProps:{flex:1},SubmitProps:v}),o.jsx(F.AIFormResult,{identifier:b,BoxProps:{flex:1},placeholder:P,loadingIndicator:I})]},"form-result"))),e&&_.reverse();const et=x.useTheme(),vt=f.useMemo(()=>x.createTheme(Rt.deepmerge(et,{palette:{primary:a?{main:a}:void 0}})),[a,et]);return o.jsx(Tt.ErrorBoundary,{fallbackRender:j.ErrorView,children:o.jsx(x.ThemeProvider,{theme:vt,children:o.jsx(L,{...w,sx:h?{pointerEvents:"none"}:{},children:o.jsx(X,{col:_.length,children:_})})})})}const jt=f.createContext({pages:[],project:void 0}),{Provider:$e,Consumer:vo}=jt;function _t(){return f.useContext(jt)}function Se({icon:t,className:e="",size:r="1rem",...i}){return o.jsx(Ne,{component:Q,className:g.cx("css-icon",e),size:r,...i,icon:t})}const Ne=k.styled(x.Box)`
100
100
  &.css-icon {
101
101
  display: inline-block;
102
102
  width: ${({size:t})=>t};
@@ -111,9 +111,9 @@
111
111
  height: 100%;
112
112
  width: 100%;
113
113
  }
114
- `,Z=t=>typeof t=="string"&&/^[\w-_]+:[\w-_]+$/.test(t);function Y({icon:t,size:e="1rem",imageMeta:r,...i}){const n=window.isNaN(e)?e:`${e}px`;return Z(t)?o.jsx(pt.Icon,{icon:t}):o.jsx(Ie,{component:Ce,imageMeta:r,className:"base-icon",icon:t,size:n,...i})}const Ie=k.styled(x.Box)`
114
+ `,Z=t=>typeof t=="string"&&/^[\w-_]+:[\w-_]+$/.test(t);function Y({icon:t,size:e="1rem",imageMeta:r,...i}){const n=window.isNaN(e)?e:`${e}px`;return Z(t)?o.jsx(pt.Icon,{icon:t}):o.jsx(Pe,{component:Ce,imageMeta:r,className:"base-icon",icon:t,size:n,...i})}const Pe=k.styled(x.Box)`
115
115
  flex-shrink: 0;
116
- `;function T({text:t,children:e,icon:r="",endIcon:i,color:n="primary",link:s="",href:d="",...a}){const l=r?o.jsx(Y,{icon:r}):null,c=i?o.jsx(Y,{icon:i}):null,u=s||d,m={...a};return u&&(m.href=u,V.default(u)&&(m.target=m.target||"_blank")),o.jsx(Zt.default,{startIcon:l,endIcon:c,color:n,...m,children:t||e})}function tt({editing:t,text:e,...r}){const{pages:i=[]}=_t(),n=i.find(s=>s.id===(r.link||r.linkId));if(t)return o.jsx(T,{...N.default(r,["link","linkId"]),children:e});if(n){const s=n.path||"/";return o.jsx(G.Link,{to:s,children:o.jsx(T,{...N.default(r,["link","linkId"]),children:e})})}return o.jsx(T,{...N.default(r,"linkId"),children:e})}function B({type:t="",icon:e="",size:r="3rem",className:i="",...n}){return o.jsx(Y,{icon:e||t,size:r,className:g.cx("content-icon",i),...n})}B.propTypes={};B.defaultProps={type:"",icon:"",size:"3rem",color:"inherit",className:""};function Pe({to:t,base:e,children:r,className:i,activeClassName:n="active",target:s="auto",autoExternalMark:d=!1,useRouterLink:a,...l}){const{pages:c=[],locale:u=""}={},m=e?F.join("/",e):e||"";let h=s==="auto"?"_self":s,p=F.join(m,t);const y=d?V.default(p):!1;if(e)return p=F.join(m,u,t),o.jsx("a",{className:`no-underline ${i}`,href:W.withoutTrailingSlash(p),rel:"noreferrer noopener",target:h,...l,children:r});if(V.default(t))s==="auto"&&(h="_blank"),p=t;else{W.isRelative(p)&&(p=F.join(window.location.pathname,p));const w=W.parseURL(`${window.location.origin}${p}`),b=c.some(v=>v.pathname===w.pathname);if(a||b)return o.jsx(G.NavLink,{end:!0,to:W.withoutTrailingSlash(p),className:({isActive:v})=>g.cx(i,v?n:""),...l,children:r})}return o.jsxs("a",{className:`no-underline ${i}`,href:W.withoutTrailingSlash(p),rel:"noreferrer noopener",target:h,...l,children:[r,y&&o.jsx(B,{icon:"i-mdi:arrow-top-right",size:"0.9em",className:"smart-link__mark",style:{marginLeft:5}})]})}function A({prepend:t,append:e,children:r,className:i="",dark:n=!1,border:s=!0,...d}){let a={};const{pages:l=[]}=_t(),c=l.find(h=>h.id===d.link),u=!r||Gt.default.Children.toArray(r).every(h=>h===null);d.link&&(a={component:Pe,to:(c==null?void 0:c.path)||d.link,useRouterLink:!0});const m=n&&s;return o.jsxs(Re,{className:g.cx("base-card card",{"border-gray-200":s},{"dark:border-gray-500":m},{dark:n,"border-transparent":!s},i),...a,...N.default(d,["listType","dark","iconColor","link","hoverStyle","imageSize"]),children:[t,!u&&o.jsx("div",{className:"card__body",children:r}),e]})}const Re=k.styled(x.Box)`
116
+ `;function z({text:t,children:e,icon:r="",endIcon:i,color:n="primary",link:s="",href:d="",...a}){const l=r?o.jsx(Y,{icon:r}):null,c=i?o.jsx(Y,{icon:i}):null,u=s||d,m={...a};return u&&(m.href=u,H.default(u)&&(m.target=m.target||"_blank")),o.jsx(Zt.default,{startIcon:l,endIcon:c,color:n,...m,children:t||e})}function tt({editing:t,text:e,...r}){const{pages:i=[]}=_t(),n=i.find(s=>s.id===(r.link||r.linkId));if(t)return o.jsx(z,{...N.default(r,["link","linkId"]),children:e});if(n){const s=n.path||"/";return o.jsx(G.Link,{to:s,children:o.jsx(z,{...N.default(r,["link","linkId"]),children:e})})}return o.jsx(z,{...N.default(r,"linkId"),children:e})}function B({type:t="",icon:e="",size:r="3rem",className:i="",...n}){return o.jsx(Y,{icon:e||t,size:r,className:g.cx("content-icon",i),...n})}B.propTypes={};B.defaultProps={type:"",icon:"",size:"3rem",color:"inherit",className:""};function Ie({to:t,base:e,children:r,className:i,activeClassName:n="active",target:s="auto",autoExternalMark:d=!1,useRouterLink:a,...l}){const{pages:c=[],locale:u=""}={},m=e?D.join("/",e):e||"";let h=s==="auto"?"_self":s,p=D.join(m,t);const y=d?H.default(p):!1;if(e)return p=D.join(m,u,t),o.jsx("a",{className:`no-underline ${i}`,href:W.withoutTrailingSlash(p),rel:"noreferrer noopener",target:h,...l,children:r});if(H.default(t))s==="auto"&&(h="_blank"),p=t;else{W.isRelative(p)&&(p=D.join(window.location.pathname,p));const w=W.parseURL(`${window.location.origin}${p}`),b=c.some(v=>v.pathname===w.pathname);if(a||b)return o.jsx(G.NavLink,{end:!0,to:W.withoutTrailingSlash(p),className:({isActive:v})=>g.cx(i,v?n:""),...l,children:r})}return o.jsxs("a",{className:`no-underline ${i}`,href:W.withoutTrailingSlash(p),rel:"noreferrer noopener",target:h,...l,children:[r,y&&o.jsx(B,{icon:"i-mdi:arrow-top-right",size:"0.9em",className:"smart-link__mark",style:{marginLeft:5}})]})}function O({prepend:t,append:e,children:r,className:i="",dark:n=!1,border:s=!0,...d}){let a={};const{pages:l=[]}=_t(),c=l.find(h=>h.id===d.link),u=!r||Gt.default.Children.toArray(r).every(h=>h===null);d.link&&(a={component:Ie,to:(c==null?void 0:c.path)||d.link,useRouterLink:!0});const m=n&&s;return o.jsxs(Re,{className:g.cx("base-card card",{"border-gray-200":s},{"dark:border-gray-500":m},{dark:n,"border-transparent":!s},i),...a,...N.default(d,["listType","dark","iconColor","link","hoverStyle","imageSize"]),children:[t,!u&&o.jsx("div",{className:"card__body",children:r}),e]})}const Re=k.styled(x.Box)`
117
117
  &.base-card {
118
118
  text-align: left;
119
119
  border-width: 1px;
@@ -128,7 +128,7 @@
128
128
  .card__body {
129
129
  padding: 15px 15px;
130
130
  }
131
- `;function O({align:t="left",title:e,titleProps:r={},description:i,descriptionProps:n={}}){return o.jsxs(o.Fragment,{children:[e&&o.jsx(x.Typography,{className:g.cx("card__title text-gray-800","dark:text-gray-50"),component:"h5",variant:"h5",gutterBottom:!0,align:t,...r,children:e}),i&&o.jsx(x.Typography,{className:g.cx("card__description","text-gray-500","dark:text-gray-400"),component:"div",variant:"body1",gutterBottom:!0,align:t,...n,children:i})]})}function We({image:t,title:e,description:r,imageProps:i={},imageMeta:n,imageSize:s,titleProps:d={},descriptionProps:a={},actions:l,align:c,...u}){const m=Z(t),h=j.autoResizeImage(j.getImageAbsoluteUrl(t),540);return o.jsxs(Te,{className:"card-article",...u,prepend:o.jsx("div",{className:"card__image__wrap",children:m&&t?o.jsx(x.Box,{sx:{position:"absolute",left:0,top:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},children:o.jsx(B,{icon:t,color:"primary.main"})}):h&&o.jsx("img",{className:"card__image",src:h,...i,alt:i.alt||(n==null?void 0:n.filename)||"card-image",width:n==null?void 0:n.naturalWidth,height:n==null?void 0:n.naturalHeight,style:{width:"100%",height:"100%",objectFit:s||"cover",objectPosition:"center"},loading:"lazy"})}),children:[e||r?o.jsx(O,{align:c,title:e,titleProps:d,description:r,descriptionProps:a}):null,l!=null&&l.length?o.jsx(R,{align:c,actions:l,className:"mt-4"}):null]})}const Te=k.styled(A)`
131
+ `;function U({align:t="left",title:e,titleProps:r={},description:i,descriptionProps:n={}}){return o.jsxs(o.Fragment,{children:[e&&o.jsx(x.Typography,{className:g.cx("card__title text-gray-800","dark:text-gray-50"),component:"h5",variant:"h5",gutterBottom:!0,align:t,...r,children:e}),i&&o.jsx(x.Typography,{className:g.cx("card__description","text-gray-500","dark:text-gray-400"),component:"div",variant:"body1",gutterBottom:!0,align:t,...n,children:i})]})}function We({image:t,title:e,description:r,imageProps:i={},imageMeta:n,imageSize:s,titleProps:d={},descriptionProps:a={},actions:l,align:c,...u}){const m=Z(t),h=j.autoResizeImage(j.getImageAbsoluteUrl(t),540);return o.jsxs(Te,{className:"card-article",...u,prepend:o.jsx("div",{className:"card__image__wrap",children:m&&t?o.jsx(x.Box,{sx:{position:"absolute",left:0,top:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},children:o.jsx(B,{icon:t,color:"primary.main"})}):h&&o.jsx("img",{className:"card__image",src:h,...i,alt:i.alt||(n==null?void 0:n.filename)||"card-image",width:n==null?void 0:n.naturalWidth,height:n==null?void 0:n.naturalHeight,style:{width:"100%",height:"100%",objectFit:s||"cover",objectPosition:"center"},loading:"lazy"})}),children:[e||r?o.jsx(U,{align:c,title:e,titleProps:d,description:r,descriptionProps:a}):null,l!=null&&l.length?o.jsx(R,{align:c,actions:l,className:"mt-4"}):null]})}const Te=k.styled(O)`
132
132
  ${t=>t.hoverStyle==="none"?"":t.link?`transition: box-shadow ease .3s;
133
133
  &:hover {
134
134
  box-shadow: 0 0 10px rgba(95, 142, 244, 0.42);
@@ -149,7 +149,7 @@
149
149
  height: 100%;
150
150
  object-position: top center;
151
151
  }
152
- `,at="section";function lt({title:t,image:e,imageMeta:r,description:i,actions:n,align:s,listType:d="",className:a="",...l}){return o.jsxs(ze,{className:g.cx("card",`list-type-${d}`,a),align:s,...l,children:[e&&o.jsx(B,{icon:e,color:"primary.main",size:d==="icon-title"?"1.2rem":"3rem",imageMeta:r}),t||i?o.jsx(O,{align:s,title:t,description:i}):null,n!=null&&n.length?o.jsx(R,{align:s,actions:n,className:"mt-4"}):null]})}const ze=k.styled(A)`
152
+ `,at="section";function lt({title:t,image:e,imageMeta:r,description:i,actions:n,align:s,listType:d="",className:a="",...l}){return o.jsxs(ze,{className:g.cx("card",`list-type-${d}`,a),align:s,...l,children:[e&&o.jsx(B,{icon:e,color:"primary.main",size:d==="icon-title"?"1.2rem":"3rem",imageMeta:r}),t||i?o.jsx(U,{align:s,title:t,description:i}):null,n!=null&&n.length?o.jsx(R,{align:s,actions:n,className:"mt-4"}):null]})}const ze=k.styled(O)`
153
153
  padding: 5vw 4vw;
154
154
  box-sizing: border-box;
155
155
  /* min-height: 320px; */
@@ -209,7 +209,7 @@
209
209
  text-align: left;
210
210
  box-sizing: border-box;
211
211
  }
212
- `;function Ee({image:t,title:e,description:r,imageProps:i={},imageMeta:n,imageSize:s,titleProps:d={},descriptionProps:a={},actions:l,align:c,...u}){const m=Z(t),h=j.autoResizeImage(j.getImageAbsoluteUrl(t),540);return o.jsxs(qe,{className:"card-article",...u,prepend:o.jsx("div",{className:"card__image__wrap",children:m&&t?o.jsx(x.Box,{sx:{position:"absolute",left:0,top:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},children:o.jsx(B,{icon:t,color:"primary.main"})}):h&&o.jsx(x.Box,{component:"img",className:"card__image",src:h,...i,alt:i.alt||(n==null?void 0:n.filename)||"card-image",width:n==null?void 0:n.naturalWidth,height:n==null?void 0:n.naturalHeight,style:{width:"100%",height:"100%",objectFit:s||"contain",objectPosition:"center"},loading:"lazy"})}),children:[e||r?o.jsx(O,{align:c,title:e,titleProps:d,description:r,descriptionProps:a}):null,l!=null&&l.length?o.jsx(R,{align:c,actions:l,className:"mt-4"}):null]})}const qe=k.styled(A)`
212
+ `;function Ee({image:t,title:e,description:r,imageProps:i={},imageMeta:n,imageSize:s,titleProps:d={},descriptionProps:a={},actions:l,align:c,...u}){const m=Z(t),h=j.autoResizeImage(j.getImageAbsoluteUrl(t),540);return o.jsxs(qe,{className:"card-article",...u,prepend:o.jsx("div",{className:"card__image__wrap",children:m&&t?o.jsx(x.Box,{sx:{position:"absolute",left:0,top:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},children:o.jsx(B,{icon:t,color:"primary.main"})}):h&&o.jsx(x.Box,{component:"img",className:"card__image",src:h,...i,alt:i.alt||(n==null?void 0:n.filename)||"card-image",width:n==null?void 0:n.naturalWidth,height:n==null?void 0:n.naturalHeight,style:{width:"100%",height:"100%",objectFit:s||"contain",objectPosition:"center"},loading:"lazy"})}),children:[e||r?o.jsx(U,{align:c,title:e,titleProps:d,description:r,descriptionProps:a}):null,l!=null&&l.length?o.jsx(R,{align:c,actions:l,className:"mt-4"}):null]})}const qe=k.styled(O)`
213
213
  ${t=>t.hoverStyle==="none"?"":t.link?`transition: box-shadow ease .3s;
214
214
  &:hover {
215
215
  box-shadow: 0 0 10px rgba(95, 142, 244, 0.42);
@@ -233,7 +233,7 @@
233
233
  .card__image {
234
234
  max-height: 60px;
235
235
  }
236
- `,ct="section";function Le({title:t,image:e,imageMeta:r,iconSize:i=100,description:n,actions:s,align:d,className:a="",...l}){return o.jsx(Ae,{className:g.cx("card",a),...l,children:o.jsxs(x.Box,{className:"flex items-center",children:[e&&o.jsx(B,{icon:e,color:"primary.main",size:i,imageMeta:r}),o.jsxs(x.Box,{className:"flex-1 ml-4",children:[o.jsx(O,{align:d,title:t,description:n}),o.jsx(R,{align:d,actions:s,className:"mt-4"})]})]})})}const Ae=k.styled(A)`
236
+ `,ct="section";function Le({title:t,image:e,imageMeta:r,iconSize:i=100,description:n,actions:s,align:d,className:a="",...l}){return o.jsx(Ae,{className:g.cx("card",a),...l,children:o.jsxs(x.Box,{className:"flex items-center",children:[e&&o.jsx(B,{icon:e,color:"primary.main",size:i,imageMeta:r}),o.jsxs(x.Box,{className:"flex-1 ml-4",children:[o.jsx(U,{align:d,title:t,description:n}),o.jsx(R,{align:d,actions:s,className:"mt-4"})]})]})})}const Ae=k.styled(O)`
237
237
  padding: 5vw 4vw;
238
238
  text-align: left;
239
239
  box-sizing: border-box;
@@ -289,7 +289,7 @@
289
289
  text-align: left;
290
290
  box-sizing: border-box;
291
291
  }
292
- `;function Oe({title:t,titleProps:e={},description:r,descriptionProps:i={},image:n,imageMeta:s,className:d="",align:a,hoverStyle:l,...c}){return o.jsxs(Ue,{className:g.cx("card-simple",d,`hover-style__${l}`),align:a,...c,children:[n&&o.jsx(B,{icon:n,color:"primary.main",imageMeta:s}),t||r?o.jsx(O,{align:a,title:t,titleProps:e,description:r,descriptionProps:i}):null]})}const Ue=k.styled(A)`
292
+ `;function Oe({title:t,titleProps:e={},description:r,descriptionProps:i={},image:n,imageMeta:s,className:d="",align:a,hoverStyle:l,...c}){return o.jsxs(Ue,{className:g.cx("card-simple",d,`hover-style__${l}`),align:a,...c,children:[n&&o.jsx(B,{icon:n,color:"primary.main",imageMeta:s}),t||r?o.jsx(U,{align:a,title:t,titleProps:e,description:r,descriptionProps:i}):null]})}const Ue=k.styled(O)`
293
293
  ${({dark:t,theme:e})=>`background-color:${t?e.palette.grey[900]:e.palette.common.white};`}
294
294
 
295
295
  &.hover-style__default {
@@ -374,7 +374,7 @@
374
374
  }
375
375
  }
376
376
  }
377
- `;function Fe({type:t="default",...e}){const i={article:We,simple:Oe,news:Le,default:lt,wall:Ee}[t]||lt;return o.jsx(i,{...t==="news"?e:N.default(e,"iconSize")})}function De({list:t=[],align:e="top",cards:r,listBorder:i=!0,listType:n="",col:s=3,gap:d,iconColor:a,className:l="",type:c="default",dark:u=!1,textAlign:m="left",hoverStyle:h,...p}){return o.jsx(X,{type:c,className:g.cx("card-list py-1",l,"items-stretch"),col:s,gap:d,align:e,...p,children:r||t.map(y=>o.jsx(Fe,{borderColor:i,iconColor:a,type:c,listType:n,dark:u,...y,align:m,sx:{bgcolor:c==="wall"?void 0:u?"grey.900":"common.white"},style:d===0&&t.length>1?{borderRadius:0,marginRight:"-1px",marginBottom:"-1px"}:{}},y.id))})}const Me=["align","cards","list","listBorder","listType","col","gap","iconColor","type","textAlign"],Ve=k.styled(q)`
377
+ `;function Fe({type:t="default",...e}){const i={article:We,simple:Oe,news:Le,default:lt,wall:Ee}[t]||lt;return o.jsx(i,{...t==="news"?e:N.default(e,"iconSize")})}function De({list:t=[],align:e="top",cards:r,listBorder:i=!0,listType:n="",col:s=3,gap:d,iconColor:a,className:l="",type:c="default",dark:u=!1,textAlign:m="left",hoverStyle:h,...p}){return o.jsx(X,{type:c,className:g.cx("card-list py-1",l,"items-stretch"),col:s,gap:d,align:e,...p,children:r||t.map(y=>o.jsx(Fe,{borderColor:i,iconColor:a,type:c,listType:n,dark:u,...y,align:m,sx:{bgcolor:c==="wall"?void 0:u?"grey.900":"common.white"},style:d===0&&t.length>1?{borderRadius:0,marginRight:"-1px",marginBottom:"-1px"}:{}},y.id))})}const Me=["align","cards","list","listBorder","listType","col","gap","iconColor","type","textAlign"],Ve=k.styled(L)`
378
378
  a .card {
379
379
  color: #404040;
380
380
  cursor: pointer;
@@ -389,7 +389,7 @@
389
389
  a:hover .card {
390
390
  color: #404040;
391
391
  }
392
- `;function He({className:t,...e}){const[r,i]=S(e,E),[n,s]=S(i,Me);return o.jsxs(Ve,{className:g.cx("section--card-list",t),type:e.type,...s,children:[Object.keys(r).length>0&&o.jsx(z,{center:!0,...r,className:"mb-[2.5vw]"}),o.jsx(De,{...n,dark:!!e.dark})]})}const Ye=k.styled(He)`
392
+ `;function He({className:t,...e}){const[r,i]=S(e,q),[n,s]=S(i,Me);return o.jsxs(Ve,{className:g.cx("section--card-list",t),type:e.type,...s,children:[Object.keys(r).length>0&&o.jsx(E,{center:!0,...r,className:"mb-[2.5vw]"}),o.jsx(De,{...n,dark:!!e.dark})]})}const Ye=k.styled(He)`
393
393
  .card__description {
394
394
  white-space: pre-wrap;
395
395
  }
@@ -404,7 +404,7 @@
404
404
  .card-simple .card__body::after {
405
405
  background: inherit !important;
406
406
  }
407
- `;function Je({section:t,...e}){const[{editing:r},i]=S(e,L),n=f.useMemo(()=>{var s;return{...N.default(i,["listBorder","list","iconSize","imageSize"]),list:(s=i.list)==null?void 0:s.map(d=>{var a,l;return{...N.default(d,"icon","iconColor"),image:["news","simple","default"].includes(i.type)&&d.icon?d.icon:d.image,actions:(l=(a=d.actions)==null?void 0:a.map)==null?void 0:l.call(a,c=>o.jsx(tt,{...c,editing:r},c.id)),border:i.listBorder,iconSize:i.iconSize,imageSize:i.imageSize,hoverStyle:i.hoverStyle}})}},[i]);return o.jsx(Ye,{style:r?{pointerEvents:"none"}:{},...n})}function Ge({properties:t,section:e,locale:r,dev:i}){var n;return(n=e==null?void 0:e.config)!=null&&n.componentId?o.jsx(J.CustomComponentRenderer,{instanceId:e.id,componentId:e.config.componentId,blockletId:e.config.blockletId,blockletTitle:e.config.blockletTitle,componentName:e.config.componentName,locale:r,properties:t,dev:i}):o.jsx(x.Box,{textAlign:"center",py:2,children:o.jsx(x.Typography,{variant:"caption",color:"text.secondary",children:"Please select component to render"})})}function Ke({src:t,dataId:e,isEdit:r=!1,height:i="100%",onLoad:n=()=>{}}){return o.jsx(Yt.EmbedIframe,{isEdit:r,embedId:e,src:t,height:i,onLoad:()=>{n()}})}function Xe({dataId:t,src:e,actions:r,center:i,onLoad:n,...s}){const[d,a]=S(s,E);return o.jsxs(q,{...a,children:[Object.keys(d).length>0&&o.jsx(z,{center:i,...d}),o.jsx(Ke,{dataId:t,src:e,onLoad:n,height:s.iframeHeight?`${s.iframeHeight}px`:"100%"}),o.jsx(R,{actions:r,center:i})]})}const Qe={src:"",embedUrl:"",title:"",description:"",dark:!1,background:"",center:!0,config:{},id:""};function Ze({section:t,id:e,src:r,...i}){const n=`${e}-${i.locale}`,[{editing:s},d]=S(i,L),a=f.useRef({}),l=JSON.parse(JSON.stringify(d)),{message:c}=Mt.useMessage(n,"server"),u=Vt.useLatest(JSON.parse(JSON.stringify(d.config)||"{}"));return f.useEffect(()=>{c&&c.onInit(()=>u.current)},[c]),f.useEffect(()=>{const m=JSON.parse(JSON.stringify(d.config)||"{}");te.default(a.current,m)||(a.current=m,c==null||c.send("config-set",m))},[c,d.config]),r?o.jsx(Xe,{...l,dataId:n,src:r,style:s?{pointerEvents:"none"}:{}}):o.jsx(to,{children:'Please set the "src" attribute for this block'})}const to=k.styled("div")`
407
+ `;function Je({section:t,...e}){const[{editing:r},i]=S(e,A),n=f.useMemo(()=>{var s;return{...N.default(i,["listBorder","list","iconSize","imageSize"]),list:(s=i.list)==null?void 0:s.map(d=>{var a,l;return{...N.default(d,"icon","iconColor"),image:["news","simple","default"].includes(i.type)&&d.icon?d.icon:d.image,actions:(l=(a=d.actions)==null?void 0:a.map)==null?void 0:l.call(a,c=>o.jsx(tt,{...c,editing:r},c.id)),border:i.listBorder,iconSize:i.iconSize,imageSize:i.imageSize,hoverStyle:i.hoverStyle}})}},[i]);return o.jsx(Ye,{style:r?{pointerEvents:"none"}:{},...n})}function Ge({properties:t,section:e,locale:r,dev:i}){var n;return(n=e==null?void 0:e.config)!=null&&n.componentId?o.jsx(J.CustomComponentRenderer,{instanceId:e.id,componentId:e.config.componentId,blockletId:e.config.blockletId,blockletTitle:e.config.blockletTitle,componentName:e.config.componentName,locale:r,properties:t,dev:i}):o.jsx(x.Box,{textAlign:"center",py:2,children:o.jsx(x.Typography,{variant:"caption",color:"text.secondary",children:"Please select component to render"})})}function Ke({src:t,dataId:e,isEdit:r=!1,height:i="100%",onLoad:n=()=>{}}){return o.jsx(Yt.EmbedIframe,{isEdit:r,embedId:e,src:t,height:i,onLoad:()=>{n()}})}function Xe({dataId:t,src:e,actions:r,center:i,onLoad:n,...s}){const[d,a]=S(s,q);return o.jsxs(L,{...a,children:[Object.keys(d).length>0&&o.jsx(E,{center:i,...d}),o.jsx(Ke,{dataId:t,src:e,onLoad:n,height:s.iframeHeight?`${s.iframeHeight}px`:"100%"}),o.jsx(R,{actions:r,center:i})]})}const Qe={src:"",embedUrl:"",title:"",description:"",dark:!1,background:"",center:!0,config:{},id:""};function Ze({section:t,id:e,src:r,...i}){const n=`${e}-${i.locale}`,[{editing:s},d]=S(i,A),a=f.useRef({}),l=JSON.parse(JSON.stringify(d)),{message:c}=Mt.useMessage(n,"server"),u=Vt.useLatest(JSON.parse(JSON.stringify(d.config)||"{}"));return f.useEffect(()=>{c&&c.onInit(()=>u.current)},[c]),f.useEffect(()=>{const m=JSON.parse(JSON.stringify(d.config)||"{}");te.default(a.current,m)||(a.current=m,c==null||c.send("config-set",m))},[c,d.config]),r?o.jsx(Xe,{...l,dataId:n,src:r,style:s?{pointerEvents:"none"}:{}}):o.jsx(to,{children:'Please set the "src" attribute for this block'})}const to=k.styled("div")`
408
408
  user-select: none;
409
409
  color: #999;
410
410
  padding: 8px;
@@ -412,7 +412,7 @@
412
412
  `,eo=[/youtu\.be\/([^#&?]{11})/,/\?v=([^#&?]{11})/,/&v=([^#&?]{11})/,/embed\/([^#&?]{11})/,/\/v\/([^#&?]{11})/];function oo(t){var e;if(/youtu\.?be/.test(t))for(const r of eo){const i=(e=r.exec(t))==null?void 0:e[1];if(i)return i}}function no(t){const e=oo(t);if(e)return`https://youtube.com/embed/${e}`}function ro({src:t}){return f.useEffect(()=>{import("@lottiefiles/lottie-player")},[]),o.jsx("lottie-player",{autoplay:!0,loop:!0,mode:"normal",src:t})}function io(t){return o.jsx(x.Box,{maxHeight:400,overflow:"hidden auto",children:o.jsx(Jt.TwitterTimelineEmbed,{...t})})}function so({url:t}){const e=f.useRef(null),r=495,[i,n]=f.useState(e.current?e.current.offsetWidth*.5625:r),s=f.useCallback(()=>{const d=window.innerWidth>990?1:window.innerWidth>522?1.2:window.innerWidth>400?1.45:1.85,a=e.current?e.current.offsetWidth*.5625:r;return n(Math.floor(a*d))},[]);return f.useEffect(()=>{window.addEventListener("resize",s);const d=window.innerWidth>990?1:window.innerWidth>522?1.2:window.innerWidth>400?1.45:1.85,a=e.current?e.current.offsetWidth*.5625:r;return n(Math.floor(a*d)),function(){window.removeEventListener("resize",s)}},[i,s]),o.jsx(x.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 ao={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},lo=k.styled(je)`
413
413
  .section__description {
414
414
  }
415
- `;function co({hasImage:t,fullSizeImage:e,boxed:r,videoPoster:i,imageMeta:n,imageOptimization:s,imageSize:d,section:a,...l}){var p,y;const[{editing:c},u]=S({...l,boxed:e?void 0:r},L);let m=uo(u.image,i,e,n,s,d);t||(m=null);let h=null;return u.actions&&(h=(y=(p=u.actions)==null?void 0:p.map)==null?void 0:y.call(p,(w,b)=>o.jsx(tt,{...w,editing:c},b))),o.jsx(lo,{...u,style:c?{pointerEvents:"none"}:{},image:m,fullSizeImage:t&&e,actions:h})}function uo(t,e,r,i,n,s){if(t){if(t.endsWith(".json"))return o.jsx(ro,{src:t});if(t.indexOf("twitter.com")!==-1)return o.jsx(io,{sourceType:"url",url:t});const d=no(t);if(d)return o.jsx(so,{url:d});const{naturalWidth:a,naturalHeight:l,filename:c}=i||{};if(H(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),r?1200:540,n),children:o.jsx("source",{src:j.getImageAbsoluteUrl(t),type:fe(t)})},t);const u=n==="quality"?1:.6;return o.jsx(J.ResponsiveImage,{src:j.getImageAbsoluteUrl(t),sizesAttr:{sm:600*u,md:450*u,lg:540*u,...r&&{md:900*u,lg:1200*u}},width:a&&`${a}px`,height:l&&`${l}px`,alt:c??t,style:{objectFit:s||"contain",display:"block",width:"100%",height:"100%"},loading:"lazy"})}return null}const mo=["production","draft"];function po({mode:t,version:e}={}){const r=e&&typeof e=="number"?{mode:t,version:e}:{mode:t};return j.api.get(`/api/${j.getProjectIdFromPathnameOrWindow()}/pages`,{params:r}).then(i=>i.data)}function xo({mode:t,pages:e}){return j.api.post(`/api/${j.getProjectIdFromPathnameOrWindow()}/pages/publish`,{mode:t,pages:e}).then(r=>r.data)}function ho({locale:t,sort:e,page:r,limit:i,mode:n}={}){return j.api.get(`/api/${j.getProjectIdFromPathnameOrWindow()}/pages/toc`,{params:{locale:t,sort:e,page:r,limit:i,mode:n}}).then(s=>s.data)}const fo={style:"list",sort:"-updatedAt"},dt=20;function go({style:t,sort:e,section:r,...i}){const[{editing:n,locale:s},d]=S(i,L),[a,l]=S(d,E),[c,u]=f.useState(),m=f.useRef(!1),h=rt.useUpdate(),p=G.useNavigate(),y=f.useCallback(async()=>{if(!m.current){m.current=!0,h();try{const w=c?Math.floor(c.list.length/dt)+1:1,{list:b,total:v}=await ho({locale:s,sort:e,page:w,limit:dt});u(_=>({list:((_==null?void 0:_.list)??[]).concat(b),total:v}))}finally{m.current=!1,h()}}},[c,s,e,h]);return rt.useMount(()=>{y()}),o.jsxs(q,{...l,sx:n?{pointerEvents:"none"}:{},children:[Object.keys(a).length>0&&o.jsx(z,{...a}),c?o.jsxs(o.Fragment,{children:[o.jsx(x.Grid,{container:!0,spacing:2,justifyContent:"center",children:c==null?void 0:c.list.map(w=>o.jsx(x.Grid,{item:!0,xs:12,sm:t==="card"?6:12,md:t==="card"?3:12,children:o.jsxs(yo,{elevation:0,className:g.cx(t==="card"&&"style-card"),onClick:n?void 0:()=>p(w.slug),children:[!!w.image&&o.jsx(x.CardMedia,{component:"img",alt:"",image:j.autoResizeImage(j.getImageAbsoluteUrl(w.image),540),loading:"lazy"}),o.jsxs(x.CardContent,{children:[o.jsx(x.Typography,{variant:"h6",component:"div",className:ut,children:w.title||w.id}),o.jsx(x.Typography,{variant:"body2",className:ut,children:w.description})]})]})},w.id))}),o.jsx(x.Box,{textAlign:"center",mt:2,children:c.total>c.list.length?o.jsx(T,{variant:"outlined",color:"secondary",onClick:y,loading:m.current,children:"More"}):o.jsx(T,{variant:"outlined",color:"secondary",disabled:!0,children:"No More"})})]}):o.jsx(x.Box,{p:2,textAlign:"center",children:o.jsx(x.CircularProgress,{size:24})})]})}const ut=g.css`
415
+ `;function co({hasImage:t,fullSizeImage:e,boxed:r,videoPoster:i,imageMeta:n,imageOptimization:s,imageSize:d,section:a,...l}){var p,y;const[{editing:c},u]=S({...l,boxed:e?void 0:r},A);let m=uo(u.image,i,e,n,s,d);t||(m=null);let h=null;return u.actions&&(h=(y=(p=u.actions)==null?void 0:p.map)==null?void 0:y.call(p,(w,b)=>o.jsx(tt,{...w,editing:c},b))),o.jsx(lo,{...u,style:c?{pointerEvents:"none"}:{},image:m,fullSizeImage:t&&e,actions:h})}function uo(t,e,r,i,n,s){if(t){if(t.endsWith(".json"))return o.jsx(ro,{src:t});if(t.indexOf("twitter.com")!==-1)return o.jsx(io,{sourceType:"url",url:t});const d=no(t);if(d)return o.jsx(so,{url:d});const{naturalWidth:a,naturalHeight:l,filename:c}=i||{};if(T(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),r?1200:540,n),children:o.jsx("source",{src:j.getImageAbsoluteUrl(t),type:fe(t)})},t);const u=n==="quality"?1:.6;return o.jsx(J.ResponsiveImage,{src:j.getImageAbsoluteUrl(t),sizesAttr:{sm:600*u,md:450*u,lg:540*u,...r&&{md:900*u,lg:1200*u}},width:a&&`${a}px`,height:l&&`${l}px`,alt:c??t,style:{objectFit:s||"contain",display:"block",width:"100%",height:"100%"},loading:"lazy"})}return null}const mo=["production","draft"];function po({mode:t,version:e}={}){const r=e&&typeof e=="number"?{mode:t,version:e}:{mode:t};return j.api.get(`/api/${j.getProjectIdFromPathnameOrWindow()}/pages`,{params:r}).then(i=>i.data)}function xo({mode:t,routes:e}){return j.api.post(`/api/${j.getProjectIdFromPathnameOrWindow()}/pages/publish`,{mode:t,routes:e}).then(r=>r.data)}function ho({locale:t,sort:e,page:r,limit:i,mode:n}={}){return j.api.get(`/api/${j.getProjectIdFromPathnameOrWindow()}/pages/toc`,{params:{locale:t,sort:e,page:r,limit:i,mode:n}}).then(s=>s.data)}const fo={style:"list",sort:"-updatedAt"},dt=20;function go({style:t,sort:e,section:r,...i}){const[{editing:n,locale:s},d]=S(i,A),[a,l]=S(d,q),[c,u]=f.useState(),m=f.useRef(!1),h=rt.useUpdate(),p=G.useNavigate(),y=f.useCallback(async()=>{if(!m.current){m.current=!0,h();try{const w=c?Math.floor(c.list.length/dt)+1:1,{list:b,total:v}=await ho({locale:s,sort:e,page:w,limit:dt});u(_=>({list:((_==null?void 0:_.list)??[]).concat(b),total:v}))}finally{m.current=!1,h()}}},[c,s,e,h]);return rt.useMount(()=>{y()}),o.jsxs(L,{...l,sx:n?{pointerEvents:"none"}:{},children:[Object.keys(a).length>0&&o.jsx(E,{...a}),c?o.jsxs(o.Fragment,{children:[o.jsx(x.Grid,{container:!0,spacing:2,justifyContent:"center",children:c==null?void 0:c.list.map(w=>o.jsx(x.Grid,{item:!0,xs:12,sm:t==="card"?6:12,md:t==="card"?3:12,children:o.jsxs(yo,{elevation:0,className:g.cx(t==="card"&&"style-card"),onClick:n?void 0:()=>p(w.slug),children:[!!w.image&&o.jsx(x.CardMedia,{component:"img",alt:"",image:j.autoResizeImage(j.getImageAbsoluteUrl(w.image),540),loading:"lazy"}),o.jsxs(x.CardContent,{children:[o.jsx(x.Typography,{variant:"h6",component:"div",className:ut,children:w.title||w.id}),o.jsx(x.Typography,{variant:"body2",className:ut,children:w.description})]})]})},w.id))}),o.jsx(x.Box,{textAlign:"center",mt:2,children:c.total>c.list.length?o.jsx(z,{variant:"outlined",color:"secondary",onClick:y,loading:m.current,children:"More"}):o.jsx(z,{variant:"outlined",color:"secondary",disabled:!0,children:"No More"})})]}):o.jsx(x.Box,{p:2,textAlign:"center",children:o.jsx(x.CircularProgress,{size:24})})]})}const ut=g.css`
416
416
  display: -webkit-box;
417
417
  -webkit-box-orient: vertical;
418
418
  -webkit-line-clamp: 2;
@@ -1,4 +1,4 @@
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)`
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-oc52fQ0j.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 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),t=require("./state-DDwYX2mu.js");function n({children:e}){const r=t.useProjectId();return s.jsx(t.StoreProvider,{url:t.getWssURL(r??""),name:"root",waitingSynced:!0,children:s.jsx(o,{children:e})})}function o({children:e}){const{state:r}=t.useStore();return e({state:r})}exports.default=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),t=require("./state-oc52fQ0j.js");function n({children:e}){const r=t.useProjectId();return s.jsx(t.StoreProvider,{url:t.getWssURL(r??""),name:"root",waitingSynced:!0,children:s.jsx(o,{children:e})})}function o({children:e}){const{state:r}=t.useStore();return e({state:r})}exports.default=n;