@blocklet/pages-kit-inner-components 0.4.126 → 0.4.128
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/add-component.js +1 -1
- package/lib/cjs/chunks/{array-DOclwySd.js → array-3OBY1z8c.js} +1 -1
- package/lib/cjs/chunks/{config-string-DUTyex-9.js → config-string-BOqUdy2S.js} +1 -1
- package/lib/cjs/chunks/{draft-data-CRdesc3Z.js → draft-data-C4FzOyR5.js} +1 -1
- package/lib/cjs/chunks/home-B6yRf7rx.js +38 -0
- package/lib/cjs/chunks/{publish-button-CpLC1-Bd.js → publish-button-BcyFHcAL.js} +1 -1
- package/lib/cjs/chunks/state-5jwYHuoB.js +1 -0
- package/lib/cjs/home.js +1 -1
- package/lib/cjs/locales.js +1 -1
- package/lib/cjs/setting.js +1 -1
- package/lib/es/add-component.js +3 -3
- package/lib/es/chunks/{array-CUVFSUuJ.js → array-CWudJ_mc.js} +1 -1
- package/lib/es/chunks/{config-string-DZMNWDnb.js → config-string-CcDa1MHl.js} +1 -1
- package/lib/es/chunks/{draft-data-CWtmeHdw.js → draft-data-DoNjnkxB.js} +1 -1
- package/lib/es/chunks/home-Crb2pbrM.js +489 -0
- package/lib/es/chunks/{publish-button-B2tZwJP0.js → publish-button-CAJErJjj.js} +3 -3
- package/lib/es/chunks/state-DNndJ33Y.js +456 -0
- package/lib/es/home.js +3 -3
- package/lib/es/locales.js +41 -5
- package/lib/es/setting.js +2 -2
- package/lib/es/theme.js +1 -0
- package/package.json +3 -3
- package/lib/cjs/chunks/home-q1dzT-BZ.js +0 -38
- package/lib/cjs/chunks/state-oc52fQ0j.js +0 -1
- package/lib/es/chunks/home-CSX7cAwr.js +0 -507
- package/lib/es/chunks/state-DCRhzAYq.js +0 -437
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const _=require("react/jsx-runtime"),D=require("@mui/material"),C=require("ufo"),Z=require("@blocklet/js-sdk"),H=require("lodash/isEmpty"),ee=require("yaml"),te=require("@arcblock/ux/lib/Locale/context"),V=require("@syncedstore/core"),ne=require("@syncedstore/react"),oe=require("ahooks"),x=require("immer"),re=require("js-cookie"),se=require("lodash/debounce"),ce=require("nanoid"),d=require("react"),W=require("react-router-dom"),ie=require("y-indexeddb"),ae=require("y-websocket"),de=require("yjs");require("@blocklet/pages-kit/types");const O=t=>t&&t.__esModule?t:{default:t};function le(t){if(t&&t.__esModule)return t;const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const S=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(n,i,S.get?S:{enumerable:!0,get:()=>t[i]})}}return n.default=t,Object.freeze(n)}const ue=O(H),fe=le(ee),me=O(V),Se=O(re),G=O(se),we=t=>{const n=blocklet==null?void 0:blocklet.componentMountPoints.find(i=>i.name===t);return n?n.mountPoint:"/"};function z(){const{pathname:t}=window.location,n=t.match(/\/admin\/(maker|previewer)\/([^/]+)/),i=n==null?void 0:n[2],S=window.__PROJECT_ID__;if(!i&&!S)throw new Error("Unable to get projectId from pathname");return i||S}function pe(t){return`${t}:pages:version`}function Pe(t,n){return n==="yaml"?ue.default(t)?"":fe.stringify(t,{indent:2}):n==="json"?JSON.parse(JSON.stringify(t||{})):n==="array"?JSON.parse(JSON.stringify(t||[])):t}function Ie({error:t}){return _.jsx(D.Box,{children:_.jsx(D.Alert,{severity:"error",children:t.message})})}var F;const k=((F=window.blocklet)==null?void 0:F.prefix)||"/",L=Z.createAxios({timeout:200*1e3}),ge=window.location.protocol==="https:"?"wss":"ws",je=t=>C.joinURL(`${ge}://${window.location.hostname}`,k,`api/${t}/ws/pages`),ye="z8ia1mAXo8ZE7ytGF36L5uBf9kD2kenhqFGp9";var N;(N=blocklet==null?void 0:blocklet.componentMountPoints.find(t=>t.did===ye))!=null&&N.mountPoint||C.joinURL(k,"/image-bin");function Ce(t){return t&&!/^(https?:\/\/|\/)/.test(t)?window.location.origin+C.joinURL(k,"uploads",t):t}const be=window.innerWidth<=750;function he(t,n,i){if(!t||/\.gif/.test(t))return t;const S=(be?n/1.5:n)*(i==="quality"?1.5:1);return ve(t,{imageFilter:"resize",w:S,f:"webp"})}function ve(t,n){return!t||!n?t:C.withQuery(t,n)}async function xe(t){return L.get(`/api/projects/${t}`).then(n=>n.data)}async function Ee(t){return L.post(`/api/projects/${t.id}/update`,t).then(n=>n.data)}const Oe=500,E=ce.customAlphabet("abcdefghijklmnopqrstuvwxyz0123456789",16),J=d.createContext(null);function _e({url:t,name:n,children:i,waitingSynced:S}){const[g,P]=d.useState(!1),{locale:j}=te.useLocaleContext(),w=A(),e=`${w}:MakerLocalState`,r=`${w}:${n}`,[s,o]=oe.useLocalStorageState(e,{defaultValue:{},listenStorageChange:!0}),c=d.useRef(s);c.current=s;const a=d.useMemo(()=>me.default({pages:{},pageIds:[],routes:{},routeIds:[],components:{},supportedLocales:[],config:{},resources:{}}),[]),l=d.useMemo(()=>V.getYjsDoc(a),[a]);d.useMemo(()=>new ie.IndexeddbPersistence(r,l),[r,l]);const p=d.useMemo(()=>new ae.WebsocketProvider(t,r,l,{params:{token:Se.default.get("login_token")},resyncInterval:5*60*1e3}),[t,r,l]),b=d.useCallback(()=>{p&&(p.disconnect(),p.connect())},[p]),y=d.useMemo(()=>new de.UndoManager([l.getArray("pageIds"),l.getMap("pages"),l.getArray("supportedLocales"),l.getMap("config")],{doc:l}),[l]),[h,v]=d.useState(null),[R,M]=d.useState(!1),[q,U]=d.useState(void 0),$=d.useCallback(async()=>{if(w){M(!0);try{const u=await xe(w);v(u)}catch(u){console.error("Failed to fetch project:",u)}finally{M(!1)}}},[w]),T=d.useCallback(async(u,f)=>{var I;if(U(void 0),!!w){f!=null&&f.optimisticUpdate&&h&&v(m=>({...m,...u}));try{const m=await Ee({...u});v(m)}catch(m){console.error("Failed to update project:",m),f!=null&&f.optimisticUpdate&&v(h),U((I=m==null?void 0:m.response)==null?void 0:I.data)}}},[w,h]);d.useEffect(()=>{w&&$()},[w,$]);const Y=d.useMemo(()=>({doc:l,state:a,localState:{...s,currentLocale:j},setLocalState:u=>o(typeof u=="function"?f=>u(f??{}):u),undoManager:y,projectState:{project:h,isLoadingProject:R,error:q},updateProject:T,forceSync:b}),[l,a,JSON.stringify(s),o,y,h,R,T,q,j,b]);return d.useEffect(()=>{y.on("stack-item-added",({stackItem:u})=>{const{currentPageId:f,currentLocale:I,pages:m}=c.current;u.meta.set("localState",{currentPageId:f,currentLocale:I,pages:m})}),y.on("stack-item-popped",({stackItem:u})=>{const f=u.meta.get("localState");f&&o(I=>({...I,...f}))})},[y,o]),d.useEffect(()=>{p.awareness.setLocalState(s)},[p,s]),d.useEffect(()=>{p.once("synced",()=>P(!0));const u=()=>{o(m=>({...m,networkStatus:void 0}))},f=()=>{o(m=>({...m,networkStatus:"offline"}))},I=G.default(({status:m})=>{m==="connected"?u():m==="disconnected"&&f()},Oe);return p.on("status",I),window.addEventListener("online",u),window.addEventListener("offline",f),()=>{p.off("status",I),window.removeEventListener("online",u),window.removeEventListener("offline",f)}},[p,o]),S&&!g?null:_.jsx(J.Provider,{value:Y,children:i})}const B=()=>{const t=d.useContext(J);if(!t)throw new Error("Context is null");const n=ne.useSyncedStore(t.state),{setLocalState:i,localState:S}=t,g=W.useNavigate(),P=A(),j=d.useMemo(()=>({setCurrentSectionId:(e,r)=>{var s,o;e===S.currentPageId&&r===((o=(s=S.pages)==null?void 0:s[e])==null?void 0:o.currentSectionId)||(g(C.joinURL("/admin/maker",P??"","pages",e)),i(c=>x.produce(c,a=>{var l;a.currentPageId=e,a.currentComponentId=void 0,a.customComponentPreviewerProperties={},r!==void 0&&(a.pages??(a.pages={}),(l=a.pages)[e]??(l[e]={}),a.pages[e].currentSectionId=r??void 0),r?window.sessionStorage.setItem("iframe_show_id",`"${r}"`):window.sessionStorage.removeItem("iframe_show_id")})))},setCurrentComponentId:e=>{e!==S.currentComponentId&&(g(C.joinURL("/admin/maker",P??"","components",e)),i(r=>x.produce(r,s=>{s.currentComponentId=e,s.customComponentPreviewerProperties={}})))},setCurrentRouteId:e=>{i(r=>x.produce(r,s=>{s.currentRouteId=e}))},setCustomComponentPreviewerProperties:(()=>{const e={},r=G.default(()=>{i(s=>x.produce(s,o=>{o.customComponentPreviewerProperties={...o==null?void 0:o.customComponentPreviewerProperties,...e},Object.keys(e).forEach(c=>delete e[c])}))},5);return s=>{Object.assign(e,s),r()}})()}),[i,g,P]),w=d.useMemo(()=>({addPage:(e,r)=>{var c,a,l,p,b,y;const s=(e==null?void 0:e.id)??E(),o={...e,id:s,createdAt:(e==null?void 0:e.createdAt)??new Date().toISOString(),updatedAt:(e==null?void 0:e.updatedAt)??new Date().toISOString(),publishedAt:new Date(0).toISOString(),slug:(e==null?void 0:e.slug)??`/${s}`,sections:(e==null?void 0:e.sections)??{},sectionIds:(e==null?void 0:e.sectionIds)??[],isPublic:(e==null?void 0:e.isPublic)??!0,templateConfig:(e==null?void 0:e.templateConfig)??{isTemplate:((c=e==null?void 0:e.templateConfig)==null?void 0:c.isTemplate)??!0,displayTemplateId:((a=e==null?void 0:e.templateConfig)==null?void 0:a.displayTemplateId)??void 0,dataSourceIds:((l=e==null?void 0:e.templateConfig)==null?void 0:l.dataSourceIds)??void 0,dataSourceParameters:((p=e==null?void 0:e.templateConfig)==null?void 0:p.dataSourceParameters)??{},enabledGenerate:((b=e==null?void 0:e.templateConfig)==null?void 0:b.enabledGenerate)??!1,agentId:((y=e==null?void 0:e.templateConfig)==null?void 0:y.agentId)??void 0}};return t.doc.transact(()=>{n.pages[o.id]=o,n.pageIds.splice(r??n.pageIds.length,0,o.id)}),o},addRoute:(e,r)=>{const s=(e==null?void 0:e.id)??E(),o={...e,id:s,createdAt:(e==null?void 0:e.createdAt)??new Date().toISOString(),updatedAt:(e==null?void 0:e.updatedAt)??new Date().toISOString(),publishedAt:new Date(0).toISOString(),path:(e==null?void 0:e.path)??`/${s}`,handler:(e==null?void 0:e.handler)??"Pages Kit",isPublic:(e==null?void 0:e.isPublic)??!0,params:(e==null?void 0:e.params)??[],enabledGenerate:(e==null?void 0:e.enabledGenerate)??!1,displayTemplateId:(e==null?void 0:e.displayTemplateId)??void 0,dataSource:(e==null?void 0:e.dataSource)??{}};return t.doc.transact(()=>{n.routes??(n.routes={}),n.routeIds??(n.routeIds=[]),n.routes[o.id]=o,n.routeIds.splice(r??n.routeIds.length,0,o.id)}),o},deleteRoute:e=>{var s;if(!e)return;const r=(s=n.routeIds)==null?void 0:s.indexOf(e);r!==void 0&&r!==-1&&t.doc.transact(()=>{var o,c;(o=n.routeIds)==null||o.splice(r,1),(c=n.routes)==null||delete c[e]})},deletePage:e=>{const r=n.pageIds.indexOf(e);r!==-1&&t.doc.transact(()=>{n.pageIds.splice(r,1),delete n.pages[e]})},movePage:(e,r)=>{const{pageIds:s}=n,o=s.indexOf(e);o>=0&&s.splice(r,0,...s.splice(o,1))},addSection:(e,r,s)=>{const o=n.pages[e];if(!o)throw new Error(`Page ${e} is not exists`);const c={...r,id:r.id??E(),isTemplateSection:r.isTemplateSection??!0,llmConfig:r.llmConfig??{}};return t.doc.transact(()=>{o.sections[c.id]=c,o.sectionIds.splice(s??o.sectionIds.length,0,c.id)}),c},deleteSection:(e,r)=>{const s=n.pages[e];if(!s)throw new Error(`Page ${e} is not exists`);const o=s.sectionIds.indexOf(r);o!==-1&&t.doc.transact(()=>{s.sectionIds.splice(o,1),delete s.sections[r]})},toggleSectionVisibility:(e,r,s)=>{const o=n.pages[e];if(!o)throw new Error(`Page ${e} is not exists`);const c=o.sections[r];c&&(c.visibility=s)},moveSection:(e,r,s)=>{const o=n.pages[e];if(!o)throw new Error(`Page ${e} is not exists`);const{sectionIds:c}=o,a=c.indexOf(r);a>=0&&c.splice(s,0,...c.splice(a,1))}}),[n,t.doc]);return{...t,state:n,actions:w,localActions:j,get currentPage(){const{localState:{currentPageId:e}}=t;return e?n.pages[e]:void 0},get currentSection(){var o,c,a;const{localState:{currentPageId:e,...r}}=t;if(!e)return;const s=(c=(o=r.pages)==null?void 0:o[e])==null?void 0:c.currentSectionId;if(s)return(a=n.pages[e])==null?void 0:a.sections[s]},get currentRoute(){var r;const{localState:{currentRouteId:e}}=t;return e?(r=n.routes)==null?void 0:r[e]:void 0}}},A=()=>{const{projectId:t}=W.useParams();return t??z()??""};function K(t){var S,g;const{resources:n}=t;if(!n.components)return{};const i={};return(g=(S=window==null?void 0:window.blocklet)==null?void 0:S.componentMountPoints)==null||g.forEach(P=>{i[P.did]=P}),Object.fromEntries(Object.entries(n.components).map(([P,{blockletId:j,component:w}])=>{var e;return[P,{data:w,blockletId:j,blockletTitle:((e=i[j])==null?void 0:e.title)||j}]}))}function Q(t){const{components:n}=t;return n||{}}function X(t){return{...K(t),...Q(t)}}const ke=()=>X(B().state);exports.ErrorView=Ie;exports.StoreProvider=_e;exports.api=L;exports.autoResizeImage=he;exports.getAllComponents=X;exports.getCustomComponents=Q;exports.getImageAbsoluteUrl=Ce;exports.getMountPoint=we;exports.getProjectIdFromPathnameOrWindow=z;exports.getProjectPageVersionKey=pe;exports.getResourceComponents=K;exports.getWssURL=je;exports.nextId=E;exports.transformValue=Pe;exports.useAllComponents=ke;exports.useProjectId=A;exports.useStore=B;
|
|
@@ -1,507 +0,0 @@
|
|
|
1
|
-
import { jsx as t, jsxs as O } from "react/jsx-runtime";
|
|
2
|
-
import { d as G, e as ce, g as le, u as ue, c as me } from "./state-DCRhzAYq.js";
|
|
3
|
-
import { useLocaleContext as W } from "@arcblock/ux/lib/Locale/context";
|
|
4
|
-
import q from "@arcblock/ux/lib/Result";
|
|
5
|
-
import { useHeaderState as pe } from "@blocklet/pages-kit/builtin/page/header";
|
|
6
|
-
import { useColorConvert as de } from "@blocklet/pages-kit/contexts/color";
|
|
7
|
-
import { setPageDataSource as J } from "@blocklet/pages-kit/utils/data-source";
|
|
8
|
-
import ge from "@blocklet/ui-react/lib/Header";
|
|
9
|
-
import { cx as K } from "@emotion/css";
|
|
10
|
-
import { Global as Q, css as X } from "@emotion/react";
|
|
11
|
-
import Y from "@emotion/styled";
|
|
12
|
-
import { Box as B, CircularProgress as fe, useTheme as he, Button as be, Stack as ye, useMediaQuery as ve } from "@mui/material";
|
|
13
|
-
import { useReactive as Z, useScroll as we } from "ahooks";
|
|
14
|
-
import Se from "isomorphic-dompurify";
|
|
15
|
-
import _ from "lodash/cloneDeep";
|
|
16
|
-
import ke from "lodash/isEmpty";
|
|
17
|
-
import F from "lodash/isEqual";
|
|
18
|
-
import { useEffect as $, useContext as Pe, lazy as ee, useMemo as P, useRef as te, Suspense as xe, useState as Ce } from "react";
|
|
19
|
-
import { Helmet as Re } from "react-helmet";
|
|
20
|
-
import { useSearchParams as oe, Routes as Ee, Route as T, Navigate as Me, ScrollRestoration as Ie } from "react-router-dom";
|
|
21
|
-
import { useAsync as ne } from "react-use";
|
|
22
|
-
import { joinURL as j } from "ufo";
|
|
23
|
-
import { S as Te, n as je, P as $e, a as Be, B as Ne, g as Oe } from "./array-CUVFSUuJ.js";
|
|
24
|
-
import { styled as re, useTheme as _e } from "@arcblock/ux/lib/Theme";
|
|
25
|
-
import Ae from "@blocklet/ui-react/lib/Footer";
|
|
26
|
-
import He from "webfontloader";
|
|
27
|
-
import { createAuthServiceSessionContext as De } from "@arcblock/did-connect/lib/Session";
|
|
28
|
-
const Le = re(Ae, { shouldForwardProp: (e) => !!e })`
|
|
29
|
-
& > div > .MuiContainer-root {
|
|
30
|
-
max-width: unset;
|
|
31
|
-
}
|
|
32
|
-
`;
|
|
33
|
-
function Ue({ meta: e, ...o }) {
|
|
34
|
-
const n = _e();
|
|
35
|
-
return /* @__PURE__ */ t(Le, { ...o, meta: e, theme: n || {} });
|
|
36
|
-
}
|
|
37
|
-
function Ve(e) {
|
|
38
|
-
return /* @__PURE__ */ t(B, { display: "flex", flex: 1, height: "100%", alignItems: "center", justifyContent: "center", ...e, children: /* @__PURE__ */ t(fe, { size: 30 }) });
|
|
39
|
-
}
|
|
40
|
-
function ze(e) {
|
|
41
|
-
return /* @__PURE__ */ t(Ge, { ...e });
|
|
42
|
-
}
|
|
43
|
-
const Ge = re(B)`
|
|
44
|
-
position: fixed;
|
|
45
|
-
left: 0;
|
|
46
|
-
top: 0;
|
|
47
|
-
z-index: 999999999999;
|
|
48
|
-
width: 80px;
|
|
49
|
-
font-size: 12px;
|
|
50
|
-
text-align: center;
|
|
51
|
-
opacity: 0.7;
|
|
52
|
-
transform: translateX(-23%) translateY(70%) rotate(-45deg);
|
|
53
|
-
pointer-events: none;
|
|
54
|
-
`, We = (e) => new Promise((o, n) => {
|
|
55
|
-
(e == null ? void 0 : e.length) > 0 ? He.load({
|
|
56
|
-
google: {
|
|
57
|
-
families: e
|
|
58
|
-
},
|
|
59
|
-
fontactive: () => {
|
|
60
|
-
o("success");
|
|
61
|
-
},
|
|
62
|
-
fontinactive: () => {
|
|
63
|
-
n(new Error("load font fail"));
|
|
64
|
-
}
|
|
65
|
-
}) : o("success");
|
|
66
|
-
}), H = `Avenir, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
|
|
67
|
-
sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'`, z = {};
|
|
68
|
-
function qe({
|
|
69
|
-
titleFontFamily: e,
|
|
70
|
-
descriptionFontFamily: o
|
|
71
|
-
}) {
|
|
72
|
-
var r;
|
|
73
|
-
const n = he(), s = (r = n == null ? void 0 : n.typography) == null ? void 0 : r.fontFamily, i = async (l) => {
|
|
74
|
-
if (l && !document.querySelectorAll(`link[href*="${l}" i]`).length)
|
|
75
|
-
try {
|
|
76
|
-
z[l] || (await We([l]), z[l] = !0);
|
|
77
|
-
} catch (a) {
|
|
78
|
-
console.error(a);
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
return $(() => {
|
|
82
|
-
e && i(e), o && i(o);
|
|
83
|
-
}, [e, o]), /* @__PURE__ */ t(
|
|
84
|
-
Q,
|
|
85
|
-
{
|
|
86
|
-
styles: X`
|
|
87
|
-
#app {
|
|
88
|
-
font-family: ${JSON.stringify(s)}, ${H};
|
|
89
|
-
|
|
90
|
-
.page-kit-section__title {
|
|
91
|
-
font-family: ${JSON.stringify(e ?? s)}, ${H};
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.page-kit-section__description {
|
|
95
|
-
font-family: ${JSON.stringify(o ?? s)}, ${H};
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
`
|
|
99
|
-
}
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
const { SessionProvider: Tt, SessionContext: Je, SessionConsumer: jt, withSession: $t } = De();
|
|
103
|
-
function L() {
|
|
104
|
-
return Pe(Je);
|
|
105
|
-
}
|
|
106
|
-
function Ke(...e) {
|
|
107
|
-
var n;
|
|
108
|
-
const { session: o } = L();
|
|
109
|
-
return e.includes((n = o.user) == null ? void 0 : n.role);
|
|
110
|
-
}
|
|
111
|
-
function Qe(...e) {
|
|
112
|
-
var s;
|
|
113
|
-
const { session: o } = L(), n = Ke(...e);
|
|
114
|
-
return ((s = window.blocklet) == null ? void 0 : s.tenantMode) === "multiple" ? !!o.user : n;
|
|
115
|
-
}
|
|
116
|
-
function Bt() {
|
|
117
|
-
const [e] = oe(), { session: o } = L(), n = Qe("owner", "admin", "pagesEditor", "member"), s = P(() => {
|
|
118
|
-
const r = e.get("mode");
|
|
119
|
-
return Te.includes(r) ? r : "production";
|
|
120
|
-
}, [e]), i = s === "production" ? s : o.user ? n ? s : "production" : null;
|
|
121
|
-
return i ? /* @__PURE__ */ t(Xe, { mode: i }) : null;
|
|
122
|
-
}
|
|
123
|
-
function Xe({ mode: e }) {
|
|
124
|
-
if (e !== "draft") {
|
|
125
|
-
const o = window.__PAGE_STATE__;
|
|
126
|
-
return o ? /* @__PURE__ */ t(D, { mode: e, state: o }) : /* @__PURE__ */ t(Ze, { mode: e, children: ({ state: n }) => /* @__PURE__ */ t(D, { mode: e, state: n }) });
|
|
127
|
-
}
|
|
128
|
-
return /* @__PURE__ */ t(Ye, { children: ({ state: o }) => /* @__PURE__ */ t(D, { mode: e, state: o }) });
|
|
129
|
-
}
|
|
130
|
-
const Ye = ee(() => import("./draft-data-CWtmeHdw.js"));
|
|
131
|
-
function Ze({
|
|
132
|
-
mode: e,
|
|
133
|
-
children: o
|
|
134
|
-
}) {
|
|
135
|
-
const n = document.querySelector('meta[property="pages:version"]'), s = n == null ? void 0 : n.content, i = ue(), r = P(() => {
|
|
136
|
-
if (s === "{{pagesPublishedAt}}") {
|
|
137
|
-
const c = localStorage.getItem(me(i ?? ""));
|
|
138
|
-
return Number(c) ? Number(c) : (/* @__PURE__ */ new Date()).getTime();
|
|
139
|
-
}
|
|
140
|
-
return Number(s);
|
|
141
|
-
}, [s]), { loading: l, value: a } = ne(() => Oe({ mode: e, version: r }), [e, r]);
|
|
142
|
-
return l ? /* @__PURE__ */ t(Ve, {}) : a ? o({ state: a }) : null;
|
|
143
|
-
}
|
|
144
|
-
function D({ mode: e, state: o }) {
|
|
145
|
-
const { t: n, locale: s } = W(), [i] = oe(), r = i.get("hiddenBadge") === "true", l = i.get("showPublish") === "true", {
|
|
146
|
-
pageIds: a,
|
|
147
|
-
pages: c,
|
|
148
|
-
routeIds: g,
|
|
149
|
-
routes: d,
|
|
150
|
-
supportedLocales: m,
|
|
151
|
-
config: { defaultLocale: h },
|
|
152
|
-
resources: b
|
|
153
|
-
} = o, y = G(o), v = P(
|
|
154
|
-
() => m != null && m.some((p) => p.locale === s) ? s : void 0,
|
|
155
|
-
[s, m]
|
|
156
|
-
), f = Object.values(c).find((p) => (p == null ? void 0 : p.slug) === "/") ? void 0 : Object.values(c)[0], N = P(
|
|
157
|
-
() => a.map((p) => {
|
|
158
|
-
const u = c[p];
|
|
159
|
-
return u && {
|
|
160
|
-
id: u.id,
|
|
161
|
-
path: j("/", v || "", u.slug, e !== "production" ? `?mode=${e}` : "")
|
|
162
|
-
};
|
|
163
|
-
}).filter(je),
|
|
164
|
-
[a, c, v, e]
|
|
165
|
-
), S = ([...p]) => (e !== "production" && l && p.unshift(
|
|
166
|
-
/* @__PURE__ */ t(xe, { fallback: /* @__PURE__ */ t("div", {}), children: /* @__PURE__ */ t(et, { mode: "production", state: o }) })
|
|
167
|
-
), p);
|
|
168
|
-
return /* @__PURE__ */ O($e, { value: { pages: N }, children: [
|
|
169
|
-
/* @__PURE__ */ O(Ee, { children: [
|
|
170
|
-
f && /* @__PURE__ */ t(T, { index: !0, element: /* @__PURE__ */ t(Me, { to: j("/", v || "", f.slug) }) }),
|
|
171
|
-
g == null ? void 0 : g.map((p) => {
|
|
172
|
-
var C, R, E, M;
|
|
173
|
-
const u = d == null ? void 0 : d[p];
|
|
174
|
-
if (!u || !u.displayTemplateId) return null;
|
|
175
|
-
const x = c[u.displayTemplateId];
|
|
176
|
-
return x ? /* @__PURE__ */ t(
|
|
177
|
-
T,
|
|
178
|
-
{
|
|
179
|
-
path: j(":projectIdOrSlug?", u.path),
|
|
180
|
-
element: /* @__PURE__ */ t(
|
|
181
|
-
Fe,
|
|
182
|
-
{
|
|
183
|
-
mode: e,
|
|
184
|
-
components: y,
|
|
185
|
-
page: x,
|
|
186
|
-
locale: v,
|
|
187
|
-
defaultLocale: h,
|
|
188
|
-
headerAddons: S,
|
|
189
|
-
state: o,
|
|
190
|
-
pageData: (M = (E = (R = (C = u.dataSource) == null ? void 0 : C.pathDataMappings) == null ? void 0 : R[u.id]) == null ? void 0 : E.dataCache) == null ? void 0 : M[v || h || "en"]
|
|
191
|
-
}
|
|
192
|
-
)
|
|
193
|
-
},
|
|
194
|
-
u.id
|
|
195
|
-
) : null;
|
|
196
|
-
}),
|
|
197
|
-
a.map((p) => {
|
|
198
|
-
const u = c[p];
|
|
199
|
-
return u ? /* @__PURE__ */ t(
|
|
200
|
-
T,
|
|
201
|
-
{
|
|
202
|
-
path: j(":projectIdOrSlug?", u.slug),
|
|
203
|
-
element: /* @__PURE__ */ t(
|
|
204
|
-
A,
|
|
205
|
-
{
|
|
206
|
-
mode: e,
|
|
207
|
-
components: y,
|
|
208
|
-
page: u,
|
|
209
|
-
locale: v,
|
|
210
|
-
defaultLocale: h,
|
|
211
|
-
headerAddons: S
|
|
212
|
-
}
|
|
213
|
-
)
|
|
214
|
-
},
|
|
215
|
-
u.id
|
|
216
|
-
) : null;
|
|
217
|
-
}),
|
|
218
|
-
b.pages && Object.values(b.pages).map(({ blockletId: p, page: u }) => /* @__PURE__ */ t(
|
|
219
|
-
T,
|
|
220
|
-
{
|
|
221
|
-
path: j("/", `@${p}`, u.slug),
|
|
222
|
-
element: /* @__PURE__ */ t(
|
|
223
|
-
A,
|
|
224
|
-
{
|
|
225
|
-
mode: e,
|
|
226
|
-
components: y,
|
|
227
|
-
page: u,
|
|
228
|
-
locale: v,
|
|
229
|
-
defaultLocale: h,
|
|
230
|
-
headerAddons: S
|
|
231
|
-
}
|
|
232
|
-
)
|
|
233
|
-
},
|
|
234
|
-
u.id
|
|
235
|
-
)),
|
|
236
|
-
/* @__PURE__ */ t(
|
|
237
|
-
T,
|
|
238
|
-
{
|
|
239
|
-
path: "*",
|
|
240
|
-
element: /* @__PURE__ */ t(B, { width: "100vw", height: "100vh", display: "flex", justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ t(q, { status: 404, extra: /* @__PURE__ */ t(ie, { href: "/", children: n("common.back") }) }) })
|
|
241
|
-
}
|
|
242
|
-
)
|
|
243
|
-
] }),
|
|
244
|
-
e !== "production" && !r && /* @__PURE__ */ t(ze, { sx: { bgcolor: "info.light" }, children: e }),
|
|
245
|
-
/* @__PURE__ */ t(qe, {})
|
|
246
|
-
] });
|
|
247
|
-
}
|
|
248
|
-
function Fe({
|
|
249
|
-
mode: e,
|
|
250
|
-
pageData: o,
|
|
251
|
-
components: n,
|
|
252
|
-
page: s,
|
|
253
|
-
locale: i,
|
|
254
|
-
defaultLocale: r,
|
|
255
|
-
headerAddons: l,
|
|
256
|
-
state: a
|
|
257
|
-
}) {
|
|
258
|
-
const c = Z({
|
|
259
|
-
page: null
|
|
260
|
-
});
|
|
261
|
-
$(() => {
|
|
262
|
-
const d = s || null;
|
|
263
|
-
d ? c.page = _(d) : c.page = null;
|
|
264
|
-
}, [s, c]);
|
|
265
|
-
const g = te();
|
|
266
|
-
return $(() => {
|
|
267
|
-
F(o, g.current) || o && c.page && (J(c.page, a, i, o), g.current = _(o));
|
|
268
|
-
}, [c.page, o, i, a]), c.page ? /* @__PURE__ */ t(
|
|
269
|
-
A,
|
|
270
|
-
{
|
|
271
|
-
mode: e,
|
|
272
|
-
components: n,
|
|
273
|
-
page: c.page,
|
|
274
|
-
locale: i,
|
|
275
|
-
defaultLocale: r,
|
|
276
|
-
headerAddons: l
|
|
277
|
-
}
|
|
278
|
-
) : null;
|
|
279
|
-
}
|
|
280
|
-
function Nt({
|
|
281
|
-
mode: e,
|
|
282
|
-
state: o,
|
|
283
|
-
path: n,
|
|
284
|
-
pageData: s
|
|
285
|
-
}) {
|
|
286
|
-
const { t: i, locale: r } = W(), {
|
|
287
|
-
pages: l,
|
|
288
|
-
supportedLocales: a,
|
|
289
|
-
config: { defaultLocale: c },
|
|
290
|
-
resources: g
|
|
291
|
-
} = o, d = Object.values(l).find((f) => (f == null ? void 0 : f.slug) === n), m = Object.values(g.pages || {}).find((f) => f.page.slug === n), h = P(
|
|
292
|
-
() => a != null && a.some((f) => f.locale === r) ? r : void 0,
|
|
293
|
-
[r, a]
|
|
294
|
-
), b = Z({
|
|
295
|
-
page: null
|
|
296
|
-
});
|
|
297
|
-
$(() => {
|
|
298
|
-
const f = d || (m == null ? void 0 : m.page) || null;
|
|
299
|
-
f ? b.page = _(f) : b.page = null;
|
|
300
|
-
}, [d, m]);
|
|
301
|
-
const y = te();
|
|
302
|
-
if ($(() => {
|
|
303
|
-
F(s, y.current) || s && b.page && (J(b.page, o, h, s), y.current = _(s));
|
|
304
|
-
}, [{}]), !d && !(m != null && m.page))
|
|
305
|
-
return /* @__PURE__ */ t(B, { width: "100vw", height: "100vh", display: "flex", justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ t(q, { style: { background: "inherit" }, status: 404, extra: /* @__PURE__ */ t(ie, { href: "/", children: i("common.back") }) }) });
|
|
306
|
-
const v = G(o);
|
|
307
|
-
return b.page ? /* @__PURE__ */ t(
|
|
308
|
-
A,
|
|
309
|
-
{
|
|
310
|
-
mode: e,
|
|
311
|
-
components: v,
|
|
312
|
-
page: b.page,
|
|
313
|
-
locale: h,
|
|
314
|
-
defaultLocale: c
|
|
315
|
-
}
|
|
316
|
-
) : null;
|
|
317
|
-
}
|
|
318
|
-
function A({
|
|
319
|
-
mode: e,
|
|
320
|
-
components: o,
|
|
321
|
-
page: n,
|
|
322
|
-
locale: s,
|
|
323
|
-
defaultLocale: i,
|
|
324
|
-
headerAddons: r
|
|
325
|
-
}) {
|
|
326
|
-
var N, S, p, u, x, C, R, E, M;
|
|
327
|
-
const l = de(), a = ((N = n.locales) == null ? void 0 : N[s]) ?? ((S = n.locales) == null ? void 0 : S[i]) ?? {}, c = a.title || ((p = window.blocklet) == null ? void 0 : p.appName), g = a.description || ((u = window.blocklet) == null ? void 0 : u.appDescription), d = ce(le(a.image), 540), { logo: m, brand: h, description: b, ...y } = pe(), v = P(
|
|
328
|
-
() => (k) => {
|
|
329
|
-
var I;
|
|
330
|
-
let w = (r == null ? void 0 : r(k)) ?? k;
|
|
331
|
-
return w = ((I = y.addons) == null ? void 0 : I.call(y, w)) ?? w, w;
|
|
332
|
-
},
|
|
333
|
-
[y.addons, r]
|
|
334
|
-
), f = (x = a.header) != null && x.translucent ? ot : se;
|
|
335
|
-
return /* @__PURE__ */ O(Be, { page: n, defaultLocale: i, currentLocale: s, children: [
|
|
336
|
-
/* @__PURE__ */ t(
|
|
337
|
-
Q,
|
|
338
|
-
{
|
|
339
|
-
styles: X`
|
|
340
|
-
body {
|
|
341
|
-
background-color: ${l(
|
|
342
|
-
!a.backgroundColor || a.backgroundColor === "transparent" ? "background.default" : a.backgroundColor
|
|
343
|
-
)} !important;
|
|
344
|
-
}
|
|
345
|
-
`
|
|
346
|
-
}
|
|
347
|
-
),
|
|
348
|
-
/* @__PURE__ */ t(
|
|
349
|
-
f,
|
|
350
|
-
{
|
|
351
|
-
hideNavMenu: !!((C = a.header) != null && C.hideNavMenus),
|
|
352
|
-
translucentTextColor: (R = a.header) == null ? void 0 : R.translucentTextColor,
|
|
353
|
-
...m ? { logo: m } : {},
|
|
354
|
-
...h ? { brand: h } : {},
|
|
355
|
-
...b ? { description: b } : {},
|
|
356
|
-
className: K(((E = a.header) == null ? void 0 : E.sticky) && "sticky", "page-header"),
|
|
357
|
-
maxWidth: !1,
|
|
358
|
-
addons: v
|
|
359
|
-
}
|
|
360
|
-
),
|
|
361
|
-
/* @__PURE__ */ t(Ie, {}),
|
|
362
|
-
/* @__PURE__ */ O(Re, { children: [
|
|
363
|
-
/* @__PURE__ */ t("title", { children: c }),
|
|
364
|
-
/* @__PURE__ */ t("meta", { name: "og:title", content: c }),
|
|
365
|
-
/* @__PURE__ */ t("meta", { name: "og:description", content: g }),
|
|
366
|
-
/* @__PURE__ */ t("meta", { name: "og:image", content: d }),
|
|
367
|
-
/* @__PURE__ */ t("meta", { name: "twitter:image:src", content: d }),
|
|
368
|
-
/* @__PURE__ */ t("meta", { name: "twitter:image", content: d }),
|
|
369
|
-
/* @__PURE__ */ t("meta", { property: "twitter:description", content: g }),
|
|
370
|
-
/* @__PURE__ */ t("meta", { property: "twitter:title", content: c }),
|
|
371
|
-
/* @__PURE__ */ t("meta", { name: "description", content: g })
|
|
372
|
-
] }),
|
|
373
|
-
/* @__PURE__ */ t(
|
|
374
|
-
ye,
|
|
375
|
-
{
|
|
376
|
-
flexGrow: 1,
|
|
377
|
-
className: "PageView-root",
|
|
378
|
-
sx: {
|
|
379
|
-
// 第一个 .BlockBase-root 的 pt 为 0
|
|
380
|
-
"& .BlockBase-root:first-child": {
|
|
381
|
-
pt: "0 !important"
|
|
382
|
-
}
|
|
383
|
-
},
|
|
384
|
-
children: n.sectionIds.map((k) => {
|
|
385
|
-
var U, V;
|
|
386
|
-
const w = n.sections[k];
|
|
387
|
-
if (!w || w.visibility === "hidden") return null;
|
|
388
|
-
const I = (U = w.locales) == null ? void 0 : U[s], ae = ((V = w.locales) == null ? void 0 : V[i]) ?? {};
|
|
389
|
-
return /* @__PURE__ */ t(
|
|
390
|
-
Ne,
|
|
391
|
-
{
|
|
392
|
-
id: k,
|
|
393
|
-
type: w.component,
|
|
394
|
-
mode: e,
|
|
395
|
-
section: w,
|
|
396
|
-
config: {
|
|
397
|
-
...ke(I) ? ae : I,
|
|
398
|
-
locale: s,
|
|
399
|
-
dev: e === "draft" ? {
|
|
400
|
-
mode: e,
|
|
401
|
-
components: o,
|
|
402
|
-
defaultLocale: i
|
|
403
|
-
} : { mode: e }
|
|
404
|
-
}
|
|
405
|
-
},
|
|
406
|
-
k
|
|
407
|
-
);
|
|
408
|
-
})
|
|
409
|
-
}
|
|
410
|
-
),
|
|
411
|
-
!((M = a.footer) != null && M.hidden) && /* @__PURE__ */ t(Ue, {})
|
|
412
|
-
] });
|
|
413
|
-
}
|
|
414
|
-
const et = ee(() => import("./publish-button-B2tZwJP0.js")), se = Y(ge)`
|
|
415
|
-
&.sticky {
|
|
416
|
-
position: sticky;
|
|
417
|
-
top: 0;
|
|
418
|
-
}
|
|
419
|
-
`;
|
|
420
|
-
function tt({ logo: e }) {
|
|
421
|
-
const [o, n] = Ce(), s = ve((r) => r.breakpoints.down("sm")), { value: i } = ne(() => {
|
|
422
|
-
var a, c;
|
|
423
|
-
const r = new URL(
|
|
424
|
-
s ? ((a = window == null ? void 0 : window.blocklet) == null ? void 0 : a.appLogo) || "/.well-known/service/blocklet/logo" : ((c = window == null ? void 0 : window.blocklet) == null ? void 0 : c.appLogoRect) || "/.well-known/service/blocklet/logo-rect",
|
|
425
|
-
window.location.origin
|
|
426
|
-
);
|
|
427
|
-
r.searchParams.delete("imageFilter"), r.searchParams.delete("f");
|
|
428
|
-
const l = r.toString();
|
|
429
|
-
return new Promise((g) => {
|
|
430
|
-
fetch(l).then((d) => {
|
|
431
|
-
const m = d.headers.get("content-type");
|
|
432
|
-
m != null && m.includes("svg") && d.text().then((h) => {
|
|
433
|
-
n(h), g(null);
|
|
434
|
-
}), g(d.url);
|
|
435
|
-
});
|
|
436
|
-
});
|
|
437
|
-
}, [s]);
|
|
438
|
-
if (e)
|
|
439
|
-
return e;
|
|
440
|
-
if (o)
|
|
441
|
-
return /* @__PURE__ */ t(B, { sx: { filter: "initial !important" }, dangerouslySetInnerHTML: { __html: Se.sanitize(o) } });
|
|
442
|
-
if (i) {
|
|
443
|
-
const r = new URL(i);
|
|
444
|
-
r.searchParams.set("imageFilter", "convert"), r.searchParams.set("f", "png"), r.searchParams.set("h", "80");
|
|
445
|
-
const l = r.toString();
|
|
446
|
-
return /* @__PURE__ */ t("img", { src: l, alt: "logo" });
|
|
447
|
-
}
|
|
448
|
-
return null;
|
|
449
|
-
}
|
|
450
|
-
function ot({
|
|
451
|
-
logo: e,
|
|
452
|
-
translucentTextColor: o,
|
|
453
|
-
...n
|
|
454
|
-
}) {
|
|
455
|
-
const { top: s = 0 } = we(() => document.getElementById("app")) || {};
|
|
456
|
-
let i = Math.min(s / 800, 1), r = "";
|
|
457
|
-
if (i > 0.1) {
|
|
458
|
-
i = Math.max(i, 0.6);
|
|
459
|
-
const l = Math.round(255 * Math.min(1 - i, 0.2));
|
|
460
|
-
r = `rgb(${l}, ${l}, ${l})`;
|
|
461
|
-
} else
|
|
462
|
-
r = o || "#EEEEEE";
|
|
463
|
-
return /* @__PURE__ */ t(
|
|
464
|
-
se,
|
|
465
|
-
{
|
|
466
|
-
logo: /* @__PURE__ */ t(tt, { logo: e }),
|
|
467
|
-
...n,
|
|
468
|
-
className: K(i <= 0.7 && "reverse-color"),
|
|
469
|
-
style: {
|
|
470
|
-
backgroundColor: `rgba(255,255,255,${i})`,
|
|
471
|
-
// @ts-ignore
|
|
472
|
-
"--logo-invert": i <= 0.7 ? 1 - i / 6 : 1 - i
|
|
473
|
-
},
|
|
474
|
-
sx: {
|
|
475
|
-
backdropFilter: i >= 0.6 ? "blur(10px)" : "blur(0px)",
|
|
476
|
-
transition: "all 0.3s ease",
|
|
477
|
-
position: "fixed !important",
|
|
478
|
-
left: 0,
|
|
479
|
-
top: 0,
|
|
480
|
-
right: 0,
|
|
481
|
-
bgcolor: "transparent",
|
|
482
|
-
"&.reverse-color": {
|
|
483
|
-
".navmenu-root>.navmenu-sub>span,\n .navmenu-root>.navmenu-item,\n .header-addons>button,\n .header-addons>a,\n .header-addons>div>button": {
|
|
484
|
-
color: `${r} !important`
|
|
485
|
-
}
|
|
486
|
-
},
|
|
487
|
-
".header-logo > div": {
|
|
488
|
-
filter: "invert(var(--logo-invert))"
|
|
489
|
-
},
|
|
490
|
-
".header-logo": {
|
|
491
|
-
color: r
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
);
|
|
496
|
-
}
|
|
497
|
-
const ie = Y(be)``;
|
|
498
|
-
export {
|
|
499
|
-
Bt as H,
|
|
500
|
-
Ve as L,
|
|
501
|
-
D as P,
|
|
502
|
-
ot as T,
|
|
503
|
-
Xe as a,
|
|
504
|
-
Fe as b,
|
|
505
|
-
Nt as c,
|
|
506
|
-
A as d
|
|
507
|
-
};
|