cloudcommerce 0.0.95 → 0.0.97
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/CHANGELOG.md +22 -0
- package/package.json +3 -3
- package/packages/api/package.json +1 -1
- package/packages/apps/correios/lib-mjs/correios-ws.mjs +2 -1
- package/packages/apps/correios/package.json +1 -1
- package/packages/apps/custom-shipping/package.json +1 -1
- package/packages/apps/discounts/package.json +1 -1
- package/packages/apps/frenet/package.json +1 -1
- package/packages/apps/tiny-erp/package.json +2 -2
- package/packages/cli/package.json +1 -1
- package/packages/config/package.json +1 -1
- package/packages/events/package.json +2 -2
- package/packages/firebase/lib/config.js +25 -27
- package/packages/firebase/lib/const.js +2 -3
- package/packages/firebase/lib/env.js +1 -2
- package/packages/firebase/lib/handlers/check-store-events.js +145 -146
- package/packages/firebase/lib/helpers/pubsub.js +18 -20
- package/packages/firebase/lib/helpers/update-app-data.js +38 -38
- package/packages/firebase/lib/index.js +7 -9
- package/packages/firebase/lib/init.js +1 -2
- package/packages/firebase/package.json +3 -3
- package/packages/modules/package.json +2 -2
- package/packages/passport/package.json +2 -2
- package/packages/ssr/lib/firebase.js +1 -1
- package/packages/ssr/lib/firebase.js.map +1 -1
- package/packages/ssr/package.json +2 -2
- package/packages/ssr/src/firebase.ts +1 -1
- package/packages/storefront/.eslintrc.cjs +1 -0
- package/packages/storefront/astro.config.mjs +11 -1
- package/packages/storefront/example.env +1 -1
- package/packages/storefront/package.json +6 -5
- package/packages/storefront/src/assets/pico.css +0 -1
- package/packages/storefront/src/env.d.ts +1 -1
- package/packages/storefront/src/lib/components/AOffcanvas.vue +98 -0
- package/packages/storefront/src/lib/components/LoginForm.vue +54 -0
- package/packages/storefront/src/lib/components/LoginOffcanvas.vue +41 -0
- package/packages/storefront/src/lib/components/TheHeader.vue +37 -3
- package/packages/storefront/src/lib/components/TopBar.vue +13 -21
- package/packages/storefront/src/lib/layouts/BaseBody.astro +41 -38
- package/packages/storefront/src/lib/layouts/BaseHead.astro +0 -5
- package/packages/storefront/src/lib/layouts/BaseStateJson.astro +12 -11
- package/packages/storefront/src/lib/layouts/PagesHeader.astro +28 -20
- package/packages/storefront/src/lib/scripts/firebase-app.ts +16 -0
- package/packages/storefront/src/lib/{helpers → ssr}/image.ts +4 -2
- package/packages/storefront/src/pages/app/account.astro +0 -0
- package/packages/storefront/storefront.config.mjs +6 -7
- package/packages/storefront/tsconfig.json +4 -1
- package/packages/types/package.json +1 -1
- package/store.renovate.json +55 -0
- package/packages/storefront/dist/client/admin/config.json +0 -1
- package/packages/storefront/dist/client/assets/_...73e01db2.css +0 -4
- package/packages/storefront/dist/client/assets/_...ee104f19.css +0 -1
- package/packages/storefront/dist/client/assets/cms-preview.css +0 -274
- package/packages/storefront/dist/client/assets/cms.css +0 -114
- package/packages/storefront/dist/client/assets/cvv.png +0 -0
- package/packages/storefront/dist/client/assets/icons/bootstrap-icons/font/storefront-icons.woff2 +0 -0
- package/packages/storefront/dist/client/assets/icons/feather-icons/font/storefront-icons.woff2 +0 -0
- package/packages/storefront/dist/client/assets/icons/font-awesome/font/storefront-icons.woff2 +0 -0
- package/packages/storefront/dist/client/assets/icons/line-awesome/font/storefront-icons.woff2 +0 -0
- package/packages/storefront/dist/client/assets/icons/tabler-icons/font/storefront-icons.woff2 +0 -0
- package/packages/storefront/dist/client/assets/img-placeholder.png +0 -0
- package/packages/storefront/dist/client/assets/payments.png +0 -0
- package/packages/storefront/dist/client/assets/ssl-safe.png +0 -0
- package/packages/storefront/dist/client/chunks/workbox-window.prod.es5.4b654ae6.js +0 -2
- package/packages/storefront/dist/client/client.80baece3.js +0 -1
- package/packages/storefront/dist/client/hoisted.46e058d2.js +0 -271
- package/packages/storefront/dist/client/img/icon.png +0 -0
- package/packages/storefront/dist/client/img/large-icon.png +0 -0
- package/packages/storefront/dist/client/img/uploads/banner1.png +0 -0
- package/packages/storefront/dist/client/img/uploads/banner2.png +0 -0
- package/packages/storefront/dist/client/img/uploads/banner2.webp +0 -0
- package/packages/storefront/dist/client/img/uploads/favicon.png +0 -0
- package/packages/storefront/dist/client/img/uploads/headless.png +0 -0
- package/packages/storefront/dist/client/img/uploads/headphone.png +0 -0
- package/packages/storefront/dist/client/img/uploads/headphone.webp +0 -0
- package/packages/storefront/dist/client/img/uploads/icon.png +0 -0
- package/packages/storefront/dist/client/img/uploads/large-icon.png +0 -0
- package/packages/storefront/dist/client/img/uploads/logo.png +0 -0
- package/packages/storefront/dist/client/img/uploads/logo.webp +0 -0
- package/packages/storefront/dist/client/img/uploads/og-image.png +0 -0
- package/packages/storefront/dist/client/img/uploads/passion.png +0 -0
- package/packages/storefront/dist/client/img/uploads/passion.webp +0 -0
- package/packages/storefront/dist/client/img/uploads/pwa-reliable.png +0 -0
- package/packages/storefront/dist/client/img/uploads/rect8589.png +0 -0
- package/packages/storefront/dist/client/img/uploads/rect859.png +0 -0
- package/packages/storefront/dist/client/img/uploads/rect89.png +0 -0
- package/packages/storefront/dist/client/img/uploads/rect89.webp +0 -0
- package/packages/storefront/dist/client/img/uploads/ssl-safe.png +0 -0
- package/packages/storefront/dist/client/manifest.webmanifest +0 -1
- package/packages/storefront/dist/client/page.3aa82516.js +0 -1
- package/packages/storefront/dist/client/robots.txt +0 -8
- package/packages/storefront/dist/client/sw.js +0 -1
- package/packages/storefront/dist/client/workbox-6f0d1f78.js +0 -1
- package/packages/storefront/dist/client/~partytown/partytown-atomics.js +0 -2
- package/packages/storefront/dist/client/~partytown/partytown-media.js +0 -2
- package/packages/storefront/dist/client/~partytown/partytown-sw.js +0 -2
- package/packages/storefront/dist/client/~partytown/partytown.js +0 -2
- package/packages/storefront/dist/server/entry.mjs +0 -2662
- package/packages/storefront/dist/server/manifest.webmanifest +0 -1
- package/packages/storefront/dist/server/registerSW.js +0 -1
- package/packages/storefront/src/lib/components/LoginModal.vue +0 -82
|
@@ -1,2662 +0,0 @@
|
|
|
1
|
-
import * as adapter from '@astrojs/node/server.js';
|
|
2
|
-
import { defineComponent, h, createSSRApp, mergeProps, createVNode as createVNode$1, resolveDynamicComponent, withCtx, createTextVNode, toDisplayString, useSSRContext } from 'vue';
|
|
3
|
-
import { renderToString as renderToString$1, ssrRenderAttrs, ssrRenderSlot, ssrRenderVNode, ssrInterpolate, ssrRenderClass, ssrRenderList, ssrRenderAttr } from 'vue/server-renderer';
|
|
4
|
-
import { escape } from 'html-escaper';
|
|
5
|
-
/* empty css */import { fileURLToPath } from 'url';
|
|
6
|
-
import fs from 'fs';
|
|
7
|
-
import { resolve } from 'path';
|
|
8
|
-
import Deepmerge from '@fastify/deepmerge';
|
|
9
|
-
import * as $$module1$5 from '@ecomplus/utils';
|
|
10
|
-
import $$module1__default from '@ecomplus/utils';
|
|
11
|
-
/* empty css */import * as $$module1$6 from 'color';
|
|
12
|
-
import $$module1__default$1 from 'color';
|
|
13
|
-
import imageSize from 'image-size';
|
|
14
|
-
import 'mime';
|
|
15
|
-
import 'kleur/colors';
|
|
16
|
-
import 'string-width';
|
|
17
|
-
import 'path-browserify';
|
|
18
|
-
import { compile } from 'path-to-regexp';
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Astro passes `children` as a string of HTML, so we need
|
|
22
|
-
* a wrapper `div` to render that content as VNodes.
|
|
23
|
-
*
|
|
24
|
-
* This is the Vue + JSX equivalent of using `<div v-html="value" />`
|
|
25
|
-
*/
|
|
26
|
-
const StaticHtml = defineComponent({
|
|
27
|
-
props: {
|
|
28
|
-
value: String,
|
|
29
|
-
name: String,
|
|
30
|
-
},
|
|
31
|
-
setup({ name, value }) {
|
|
32
|
-
if (!value) return () => null;
|
|
33
|
-
return () => h('astro-slot', { name, innerHTML: value });
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
function check$1(Component) {
|
|
38
|
-
return !!Component['ssrRender'] || !!Component['__ssrInlineRender'];
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
async function renderToStaticMarkup$1(Component, props, slotted) {
|
|
42
|
-
const slots = {};
|
|
43
|
-
for (const [key, value] of Object.entries(slotted)) {
|
|
44
|
-
slots[key] = () => h(StaticHtml, { value, name: key === 'default' ? undefined : key });
|
|
45
|
-
}
|
|
46
|
-
const app = createSSRApp({ render: () => h(Component, props, slots) });
|
|
47
|
-
const html = await renderToString$1(app);
|
|
48
|
-
return { html };
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const _renderer1 = {
|
|
52
|
-
check: check$1,
|
|
53
|
-
renderToStaticMarkup: renderToStaticMarkup$1,
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const ASTRO_VERSION = "1.3.0";
|
|
57
|
-
function createDeprecatedFetchContentFn() {
|
|
58
|
-
return () => {
|
|
59
|
-
throw new Error("Deprecated: Astro.fetchContent() has been replaced with Astro.glob().");
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
function createAstroGlobFn() {
|
|
63
|
-
const globHandler = (importMetaGlobResult, globValue) => {
|
|
64
|
-
let allEntries = [...Object.values(importMetaGlobResult)];
|
|
65
|
-
if (allEntries.length === 0) {
|
|
66
|
-
throw new Error(`Astro.glob(${JSON.stringify(globValue())}) - no matches found.`);
|
|
67
|
-
}
|
|
68
|
-
return Promise.all(allEntries.map((fn) => fn()));
|
|
69
|
-
};
|
|
70
|
-
return globHandler;
|
|
71
|
-
}
|
|
72
|
-
function createAstro(filePathname, _site, projectRootStr) {
|
|
73
|
-
const site = _site ? new URL(_site) : void 0;
|
|
74
|
-
const referenceURL = new URL(filePathname, `http://localhost`);
|
|
75
|
-
const projectRoot = new URL(projectRootStr);
|
|
76
|
-
return {
|
|
77
|
-
site,
|
|
78
|
-
generator: `Astro v${ASTRO_VERSION}`,
|
|
79
|
-
fetchContent: createDeprecatedFetchContentFn(),
|
|
80
|
-
glob: createAstroGlobFn(),
|
|
81
|
-
resolve(...segments) {
|
|
82
|
-
let resolved = segments.reduce((u, segment) => new URL(segment, u), referenceURL).pathname;
|
|
83
|
-
if (resolved.startsWith(projectRoot.pathname)) {
|
|
84
|
-
resolved = "/" + resolved.slice(projectRoot.pathname.length);
|
|
85
|
-
}
|
|
86
|
-
return resolved;
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const escapeHTML = escape;
|
|
92
|
-
class HTMLBytes extends Uint8Array {
|
|
93
|
-
get [Symbol.toStringTag]() {
|
|
94
|
-
return "HTMLBytes";
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
class HTMLString extends String {
|
|
98
|
-
get [Symbol.toStringTag]() {
|
|
99
|
-
return "HTMLString";
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
const markHTMLString = (value) => {
|
|
103
|
-
if (value instanceof HTMLString) {
|
|
104
|
-
return value;
|
|
105
|
-
}
|
|
106
|
-
if (typeof value === "string") {
|
|
107
|
-
return new HTMLString(value);
|
|
108
|
-
}
|
|
109
|
-
return value;
|
|
110
|
-
};
|
|
111
|
-
function markHTMLBytes(bytes) {
|
|
112
|
-
return new HTMLBytes(bytes);
|
|
113
|
-
}
|
|
114
|
-
async function* unescapeChunksAsync(iterable) {
|
|
115
|
-
for await (const chunk of iterable) {
|
|
116
|
-
yield unescapeHTML(chunk);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
function* unescapeChunks(iterable) {
|
|
120
|
-
for (const chunk of iterable) {
|
|
121
|
-
yield unescapeHTML(chunk);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
function unescapeHTML(str) {
|
|
125
|
-
if (!!str && typeof str === "object") {
|
|
126
|
-
if (str instanceof Uint8Array) {
|
|
127
|
-
return markHTMLBytes(str);
|
|
128
|
-
} else if (str instanceof Response && str.body) {
|
|
129
|
-
const body = str.body;
|
|
130
|
-
return unescapeChunksAsync(body);
|
|
131
|
-
} else if (typeof str.then === "function") {
|
|
132
|
-
return Promise.resolve(str).then((value) => {
|
|
133
|
-
return unescapeHTML(value);
|
|
134
|
-
});
|
|
135
|
-
} else if (Symbol.iterator in str) {
|
|
136
|
-
return unescapeChunks(str);
|
|
137
|
-
} else if (Symbol.asyncIterator in str) {
|
|
138
|
-
return unescapeChunksAsync(str);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
return markHTMLString(str);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
class Metadata {
|
|
145
|
-
constructor(filePathname, opts) {
|
|
146
|
-
this.modules = opts.modules;
|
|
147
|
-
this.hoisted = opts.hoisted;
|
|
148
|
-
this.hydratedComponents = opts.hydratedComponents;
|
|
149
|
-
this.clientOnlyComponents = opts.clientOnlyComponents;
|
|
150
|
-
this.hydrationDirectives = opts.hydrationDirectives;
|
|
151
|
-
this.mockURL = new URL(filePathname, "http://example.com");
|
|
152
|
-
this.metadataCache = /* @__PURE__ */ new Map();
|
|
153
|
-
}
|
|
154
|
-
resolvePath(specifier) {
|
|
155
|
-
if (specifier.startsWith(".")) {
|
|
156
|
-
const resolved = new URL(specifier, this.mockURL).pathname;
|
|
157
|
-
if (resolved.startsWith("/@fs") && resolved.endsWith(".jsx")) {
|
|
158
|
-
return resolved.slice(0, resolved.length - 4);
|
|
159
|
-
}
|
|
160
|
-
return resolved;
|
|
161
|
-
}
|
|
162
|
-
return specifier;
|
|
163
|
-
}
|
|
164
|
-
getPath(Component) {
|
|
165
|
-
const metadata = this.getComponentMetadata(Component);
|
|
166
|
-
return (metadata == null ? void 0 : metadata.componentUrl) || null;
|
|
167
|
-
}
|
|
168
|
-
getExport(Component) {
|
|
169
|
-
const metadata = this.getComponentMetadata(Component);
|
|
170
|
-
return (metadata == null ? void 0 : metadata.componentExport) || null;
|
|
171
|
-
}
|
|
172
|
-
getComponentMetadata(Component) {
|
|
173
|
-
if (this.metadataCache.has(Component)) {
|
|
174
|
-
return this.metadataCache.get(Component);
|
|
175
|
-
}
|
|
176
|
-
const metadata = this.findComponentMetadata(Component);
|
|
177
|
-
this.metadataCache.set(Component, metadata);
|
|
178
|
-
return metadata;
|
|
179
|
-
}
|
|
180
|
-
findComponentMetadata(Component) {
|
|
181
|
-
const isCustomElement = typeof Component === "string";
|
|
182
|
-
for (const { module, specifier } of this.modules) {
|
|
183
|
-
const id = this.resolvePath(specifier);
|
|
184
|
-
for (const [key, value] of Object.entries(module)) {
|
|
185
|
-
if (isCustomElement) {
|
|
186
|
-
if (key === "tagName" && Component === value) {
|
|
187
|
-
return {
|
|
188
|
-
componentExport: key,
|
|
189
|
-
componentUrl: id
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
} else if (Component === value) {
|
|
193
|
-
return {
|
|
194
|
-
componentExport: key,
|
|
195
|
-
componentUrl: id
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
return null;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
function createMetadata(filePathname, options) {
|
|
204
|
-
return new Metadata(filePathname, options);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
const PROP_TYPE = {
|
|
208
|
-
Value: 0,
|
|
209
|
-
JSON: 1,
|
|
210
|
-
RegExp: 2,
|
|
211
|
-
Date: 3,
|
|
212
|
-
Map: 4,
|
|
213
|
-
Set: 5,
|
|
214
|
-
BigInt: 6,
|
|
215
|
-
URL: 7,
|
|
216
|
-
Uint8Array: 8,
|
|
217
|
-
Uint16Array: 9,
|
|
218
|
-
Uint32Array: 10
|
|
219
|
-
};
|
|
220
|
-
function serializeArray(value, metadata = {}, parents = /* @__PURE__ */ new WeakSet()) {
|
|
221
|
-
if (parents.has(value)) {
|
|
222
|
-
throw new Error(`Cyclic reference detected while serializing props for <${metadata.displayName} client:${metadata.hydrate}>!
|
|
223
|
-
|
|
224
|
-
Cyclic references cannot be safely serialized for client-side usage. Please remove the cyclic reference.`);
|
|
225
|
-
}
|
|
226
|
-
parents.add(value);
|
|
227
|
-
const serialized = value.map((v) => {
|
|
228
|
-
return convertToSerializedForm(v, metadata, parents);
|
|
229
|
-
});
|
|
230
|
-
parents.delete(value);
|
|
231
|
-
return serialized;
|
|
232
|
-
}
|
|
233
|
-
function serializeObject(value, metadata = {}, parents = /* @__PURE__ */ new WeakSet()) {
|
|
234
|
-
if (parents.has(value)) {
|
|
235
|
-
throw new Error(`Cyclic reference detected while serializing props for <${metadata.displayName} client:${metadata.hydrate}>!
|
|
236
|
-
|
|
237
|
-
Cyclic references cannot be safely serialized for client-side usage. Please remove the cyclic reference.`);
|
|
238
|
-
}
|
|
239
|
-
parents.add(value);
|
|
240
|
-
const serialized = Object.fromEntries(
|
|
241
|
-
Object.entries(value).map(([k, v]) => {
|
|
242
|
-
return [k, convertToSerializedForm(v, metadata, parents)];
|
|
243
|
-
})
|
|
244
|
-
);
|
|
245
|
-
parents.delete(value);
|
|
246
|
-
return serialized;
|
|
247
|
-
}
|
|
248
|
-
function convertToSerializedForm(value, metadata = {}, parents = /* @__PURE__ */ new WeakSet()) {
|
|
249
|
-
const tag = Object.prototype.toString.call(value);
|
|
250
|
-
switch (tag) {
|
|
251
|
-
case "[object Date]": {
|
|
252
|
-
return [PROP_TYPE.Date, value.toISOString()];
|
|
253
|
-
}
|
|
254
|
-
case "[object RegExp]": {
|
|
255
|
-
return [PROP_TYPE.RegExp, value.source];
|
|
256
|
-
}
|
|
257
|
-
case "[object Map]": {
|
|
258
|
-
return [
|
|
259
|
-
PROP_TYPE.Map,
|
|
260
|
-
JSON.stringify(serializeArray(Array.from(value), metadata, parents))
|
|
261
|
-
];
|
|
262
|
-
}
|
|
263
|
-
case "[object Set]": {
|
|
264
|
-
return [
|
|
265
|
-
PROP_TYPE.Set,
|
|
266
|
-
JSON.stringify(serializeArray(Array.from(value), metadata, parents))
|
|
267
|
-
];
|
|
268
|
-
}
|
|
269
|
-
case "[object BigInt]": {
|
|
270
|
-
return [PROP_TYPE.BigInt, value.toString()];
|
|
271
|
-
}
|
|
272
|
-
case "[object URL]": {
|
|
273
|
-
return [PROP_TYPE.URL, value.toString()];
|
|
274
|
-
}
|
|
275
|
-
case "[object Array]": {
|
|
276
|
-
return [PROP_TYPE.JSON, JSON.stringify(serializeArray(value, metadata, parents))];
|
|
277
|
-
}
|
|
278
|
-
case "[object Uint8Array]": {
|
|
279
|
-
return [PROP_TYPE.Uint8Array, JSON.stringify(Array.from(value))];
|
|
280
|
-
}
|
|
281
|
-
case "[object Uint16Array]": {
|
|
282
|
-
return [PROP_TYPE.Uint16Array, JSON.stringify(Array.from(value))];
|
|
283
|
-
}
|
|
284
|
-
case "[object Uint32Array]": {
|
|
285
|
-
return [PROP_TYPE.Uint32Array, JSON.stringify(Array.from(value))];
|
|
286
|
-
}
|
|
287
|
-
default: {
|
|
288
|
-
if (value !== null && typeof value === "object") {
|
|
289
|
-
return [PROP_TYPE.Value, serializeObject(value, metadata, parents)];
|
|
290
|
-
} else {
|
|
291
|
-
return [PROP_TYPE.Value, value];
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
function serializeProps(props, metadata) {
|
|
297
|
-
const serialized = JSON.stringify(serializeObject(props, metadata));
|
|
298
|
-
return serialized;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
function serializeListValue(value) {
|
|
302
|
-
const hash = {};
|
|
303
|
-
push(value);
|
|
304
|
-
return Object.keys(hash).join(" ");
|
|
305
|
-
function push(item) {
|
|
306
|
-
if (item && typeof item.forEach === "function")
|
|
307
|
-
item.forEach(push);
|
|
308
|
-
else if (item === Object(item))
|
|
309
|
-
Object.keys(item).forEach((name) => {
|
|
310
|
-
if (item[name])
|
|
311
|
-
push(name);
|
|
312
|
-
});
|
|
313
|
-
else {
|
|
314
|
-
item = item === false || item == null ? "" : String(item).trim();
|
|
315
|
-
if (item) {
|
|
316
|
-
item.split(/\s+/).forEach((name) => {
|
|
317
|
-
hash[name] = true;
|
|
318
|
-
});
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
const HydrationDirectivesRaw = ["load", "idle", "media", "visible", "only"];
|
|
325
|
-
const HydrationDirectives = new Set(HydrationDirectivesRaw);
|
|
326
|
-
const HydrationDirectiveProps = new Set(HydrationDirectivesRaw.map((n) => `client:${n}`));
|
|
327
|
-
function extractDirectives(inputProps) {
|
|
328
|
-
let extracted = {
|
|
329
|
-
isPage: false,
|
|
330
|
-
hydration: null,
|
|
331
|
-
props: {}
|
|
332
|
-
};
|
|
333
|
-
for (const [key, value] of Object.entries(inputProps)) {
|
|
334
|
-
if (key.startsWith("server:")) {
|
|
335
|
-
if (key === "server:root") {
|
|
336
|
-
extracted.isPage = true;
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
if (key.startsWith("client:")) {
|
|
340
|
-
if (!extracted.hydration) {
|
|
341
|
-
extracted.hydration = {
|
|
342
|
-
directive: "",
|
|
343
|
-
value: "",
|
|
344
|
-
componentUrl: "",
|
|
345
|
-
componentExport: { value: "" }
|
|
346
|
-
};
|
|
347
|
-
}
|
|
348
|
-
switch (key) {
|
|
349
|
-
case "client:component-path": {
|
|
350
|
-
extracted.hydration.componentUrl = value;
|
|
351
|
-
break;
|
|
352
|
-
}
|
|
353
|
-
case "client:component-export": {
|
|
354
|
-
extracted.hydration.componentExport.value = value;
|
|
355
|
-
break;
|
|
356
|
-
}
|
|
357
|
-
case "client:component-hydration": {
|
|
358
|
-
break;
|
|
359
|
-
}
|
|
360
|
-
case "client:display-name": {
|
|
361
|
-
break;
|
|
362
|
-
}
|
|
363
|
-
default: {
|
|
364
|
-
extracted.hydration.directive = key.split(":")[1];
|
|
365
|
-
extracted.hydration.value = value;
|
|
366
|
-
if (!HydrationDirectives.has(extracted.hydration.directive)) {
|
|
367
|
-
throw new Error(
|
|
368
|
-
`Error: invalid hydration directive "${key}". Supported hydration methods: ${Array.from(
|
|
369
|
-
HydrationDirectiveProps
|
|
370
|
-
).join(", ")}`
|
|
371
|
-
);
|
|
372
|
-
}
|
|
373
|
-
if (extracted.hydration.directive === "media" && typeof extracted.hydration.value !== "string") {
|
|
374
|
-
throw new Error(
|
|
375
|
-
'Error: Media query must be provided for "client:media", similar to client:media="(max-width: 600px)"'
|
|
376
|
-
);
|
|
377
|
-
}
|
|
378
|
-
break;
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
} else if (key === "class:list") {
|
|
382
|
-
extracted.props[key.slice(0, -5)] = serializeListValue(value);
|
|
383
|
-
} else {
|
|
384
|
-
extracted.props[key] = value;
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
return extracted;
|
|
388
|
-
}
|
|
389
|
-
async function generateHydrateScript(scriptOptions, metadata) {
|
|
390
|
-
const { renderer, result, astroId, props, attrs } = scriptOptions;
|
|
391
|
-
const { hydrate, componentUrl, componentExport } = metadata;
|
|
392
|
-
if (!componentExport.value) {
|
|
393
|
-
throw new Error(
|
|
394
|
-
`Unable to resolve a valid export for "${metadata.displayName}"! Please open an issue at https://astro.build/issues!`
|
|
395
|
-
);
|
|
396
|
-
}
|
|
397
|
-
const island = {
|
|
398
|
-
children: "",
|
|
399
|
-
props: {
|
|
400
|
-
uid: astroId
|
|
401
|
-
}
|
|
402
|
-
};
|
|
403
|
-
if (attrs) {
|
|
404
|
-
for (const [key, value] of Object.entries(attrs)) {
|
|
405
|
-
island.props[key] = value;
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
island.props["component-url"] = await result.resolve(decodeURI(componentUrl));
|
|
409
|
-
if (renderer.clientEntrypoint) {
|
|
410
|
-
island.props["component-export"] = componentExport.value;
|
|
411
|
-
island.props["renderer-url"] = await result.resolve(decodeURI(renderer.clientEntrypoint));
|
|
412
|
-
island.props["props"] = escapeHTML(serializeProps(props, metadata));
|
|
413
|
-
}
|
|
414
|
-
island.props["ssr"] = "";
|
|
415
|
-
island.props["client"] = hydrate;
|
|
416
|
-
let beforeHydrationUrl = await result.resolve("astro:scripts/before-hydration.js");
|
|
417
|
-
if (beforeHydrationUrl.length) {
|
|
418
|
-
island.props["before-hydration-url"] = beforeHydrationUrl;
|
|
419
|
-
}
|
|
420
|
-
island.props["opts"] = escapeHTML(
|
|
421
|
-
JSON.stringify({
|
|
422
|
-
name: metadata.displayName,
|
|
423
|
-
value: metadata.hydrateArgs || ""
|
|
424
|
-
})
|
|
425
|
-
);
|
|
426
|
-
return island;
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
var idle_prebuilt_default = `(self.Astro=self.Astro||{}).idle=t=>{const e=async()=>{await(await t())()};"requestIdleCallback"in window?window.requestIdleCallback(e):setTimeout(e,200)},window.dispatchEvent(new Event("astro:idle"));`;
|
|
430
|
-
|
|
431
|
-
var load_prebuilt_default = `(self.Astro=self.Astro||{}).load=a=>{(async()=>await(await a())())()},window.dispatchEvent(new Event("astro:load"));`;
|
|
432
|
-
|
|
433
|
-
var media_prebuilt_default = `(self.Astro=self.Astro||{}).media=(s,a)=>{const t=async()=>{await(await s())()};if(a.value){const e=matchMedia(a.value);e.matches?t():e.addEventListener("change",t,{once:!0})}},window.dispatchEvent(new Event("astro:media"));`;
|
|
434
|
-
|
|
435
|
-
var only_prebuilt_default = `(self.Astro=self.Astro||{}).only=t=>{(async()=>await(await t())())()},window.dispatchEvent(new Event("astro:only"));`;
|
|
436
|
-
|
|
437
|
-
var visible_prebuilt_default = `(self.Astro=self.Astro||{}).visible=(s,c,n)=>{const r=async()=>{await(await s())()};let i=new IntersectionObserver(e=>{for(const t of e)if(!!t.isIntersecting){i.disconnect(),r();break}});for(let e=0;e<n.children.length;e++){const t=n.children[e];i.observe(t)}},window.dispatchEvent(new Event("astro:visible"));`;
|
|
438
|
-
|
|
439
|
-
var astro_island_prebuilt_default = `var l;{const c={0:t=>t,1:t=>JSON.parse(t,o),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(JSON.parse(t,o)),5:t=>new Set(JSON.parse(t,o)),6:t=>BigInt(t),7:t=>new URL(t),8:t=>new Uint8Array(JSON.parse(t)),9:t=>new Uint16Array(JSON.parse(t)),10:t=>new Uint32Array(JSON.parse(t))},o=(t,s)=>{if(t===""||!Array.isArray(s))return s;const[e,n]=s;return e in c?c[e](n):void 0};customElements.get("astro-island")||customElements.define("astro-island",(l=class extends HTMLElement{constructor(){super(...arguments);this.hydrate=()=>{if(!this.hydrator||this.parentElement&&this.parentElement.closest("astro-island[ssr]"))return;const s=this.querySelectorAll("astro-slot"),e={},n=this.querySelectorAll("template[data-astro-template]");for(const r of n){const i=r.closest(this.tagName);!i||!i.isSameNode(this)||(e[r.getAttribute("data-astro-template")||"default"]=r.innerHTML,r.remove())}for(const r of s){const i=r.closest(this.tagName);!i||!i.isSameNode(this)||(e[r.getAttribute("name")||"default"]=r.innerHTML)}const a=this.hasAttribute("props")?JSON.parse(this.getAttribute("props"),o):{};this.hydrator(this)(this.Component,a,e,{client:this.getAttribute("client")}),this.removeAttribute("ssr"),window.removeEventListener("astro:hydrate",this.hydrate),window.dispatchEvent(new CustomEvent("astro:hydrate"))}}connectedCallback(){!this.hasAttribute("await-children")||this.firstChild?this.childrenConnectedCallback():new MutationObserver((s,e)=>{e.disconnect(),this.childrenConnectedCallback()}).observe(this,{childList:!0})}async childrenConnectedCallback(){window.addEventListener("astro:hydrate",this.hydrate);let s=this.getAttribute("before-hydration-url");s&&await import(s),this.start()}start(){const s=JSON.parse(this.getAttribute("opts")),e=this.getAttribute("client");if(Astro[e]===void 0){window.addEventListener(\`astro:\${e}\`,()=>this.start(),{once:!0});return}Astro[e](async()=>{const n=this.getAttribute("renderer-url"),[a,{default:r}]=await Promise.all([import(this.getAttribute("component-url")),n?import(n):()=>()=>{}]),i=this.getAttribute("component-export")||"default";if(!i.includes("."))this.Component=a[i];else{this.Component=a;for(const d of i.split("."))this.Component=this.Component[d]}return this.hydrator=r,this.hydrate},s,this)}attributeChangedCallback(){this.hydrator&&this.hydrate()}},l.observedAttributes=["props"],l))}`;
|
|
440
|
-
|
|
441
|
-
function determineIfNeedsHydrationScript(result) {
|
|
442
|
-
if (result._metadata.hasHydrationScript) {
|
|
443
|
-
return false;
|
|
444
|
-
}
|
|
445
|
-
return result._metadata.hasHydrationScript = true;
|
|
446
|
-
}
|
|
447
|
-
const hydrationScripts = {
|
|
448
|
-
idle: idle_prebuilt_default,
|
|
449
|
-
load: load_prebuilt_default,
|
|
450
|
-
only: only_prebuilt_default,
|
|
451
|
-
media: media_prebuilt_default,
|
|
452
|
-
visible: visible_prebuilt_default
|
|
453
|
-
};
|
|
454
|
-
function determinesIfNeedsDirectiveScript(result, directive) {
|
|
455
|
-
if (result._metadata.hasDirectives.has(directive)) {
|
|
456
|
-
return false;
|
|
457
|
-
}
|
|
458
|
-
result._metadata.hasDirectives.add(directive);
|
|
459
|
-
return true;
|
|
460
|
-
}
|
|
461
|
-
function getDirectiveScriptText(directive) {
|
|
462
|
-
if (!(directive in hydrationScripts)) {
|
|
463
|
-
throw new Error(`Unknown directive: ${directive}`);
|
|
464
|
-
}
|
|
465
|
-
const directiveScriptText = hydrationScripts[directive];
|
|
466
|
-
return directiveScriptText;
|
|
467
|
-
}
|
|
468
|
-
function getPrescripts(type, directive) {
|
|
469
|
-
switch (type) {
|
|
470
|
-
case "both":
|
|
471
|
-
return `<style>astro-island,astro-slot{display:contents}</style><script>${getDirectiveScriptText(directive) + astro_island_prebuilt_default}<\/script>`;
|
|
472
|
-
case "directive":
|
|
473
|
-
return `<script>${getDirectiveScriptText(directive)}<\/script>`;
|
|
474
|
-
}
|
|
475
|
-
return "";
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
const Fragment = Symbol.for("astro:fragment");
|
|
479
|
-
const Renderer = Symbol.for("astro:renderer");
|
|
480
|
-
const encoder = new TextEncoder();
|
|
481
|
-
const decoder = new TextDecoder();
|
|
482
|
-
function stringifyChunk(result, chunk) {
|
|
483
|
-
switch (chunk.type) {
|
|
484
|
-
case "directive": {
|
|
485
|
-
const { hydration } = chunk;
|
|
486
|
-
let needsHydrationScript = hydration && determineIfNeedsHydrationScript(result);
|
|
487
|
-
let needsDirectiveScript = hydration && determinesIfNeedsDirectiveScript(result, hydration.directive);
|
|
488
|
-
let prescriptType = needsHydrationScript ? "both" : needsDirectiveScript ? "directive" : null;
|
|
489
|
-
if (prescriptType) {
|
|
490
|
-
let prescripts = getPrescripts(prescriptType, hydration.directive);
|
|
491
|
-
return markHTMLString(prescripts);
|
|
492
|
-
} else {
|
|
493
|
-
return "";
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
default: {
|
|
497
|
-
return chunk.toString();
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
class HTMLParts {
|
|
502
|
-
constructor() {
|
|
503
|
-
this.parts = [];
|
|
504
|
-
}
|
|
505
|
-
append(part, result) {
|
|
506
|
-
if (ArrayBuffer.isView(part)) {
|
|
507
|
-
this.parts.push(part);
|
|
508
|
-
} else {
|
|
509
|
-
this.parts.push(stringifyChunk(result, part));
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
toString() {
|
|
513
|
-
let html = "";
|
|
514
|
-
for (const part of this.parts) {
|
|
515
|
-
if (ArrayBuffer.isView(part)) {
|
|
516
|
-
html += decoder.decode(part);
|
|
517
|
-
} else {
|
|
518
|
-
html += part;
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
return html;
|
|
522
|
-
}
|
|
523
|
-
toArrayBuffer() {
|
|
524
|
-
this.parts.forEach((part, i) => {
|
|
525
|
-
if (typeof part === "string") {
|
|
526
|
-
this.parts[i] = encoder.encode(String(part));
|
|
527
|
-
}
|
|
528
|
-
});
|
|
529
|
-
return concatUint8Arrays(this.parts);
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
function concatUint8Arrays(arrays) {
|
|
533
|
-
let len = 0;
|
|
534
|
-
arrays.forEach((arr) => len += arr.length);
|
|
535
|
-
let merged = new Uint8Array(len);
|
|
536
|
-
let offset = 0;
|
|
537
|
-
arrays.forEach((arr) => {
|
|
538
|
-
merged.set(arr, offset);
|
|
539
|
-
offset += arr.length;
|
|
540
|
-
});
|
|
541
|
-
return merged;
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
function validateComponentProps(props, displayName) {
|
|
545
|
-
var _a;
|
|
546
|
-
if (((_a = {"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true}) == null ? void 0 : _a.DEV) && props != null) {
|
|
547
|
-
for (const prop of Object.keys(props)) {
|
|
548
|
-
if (HydrationDirectiveProps.has(prop)) {
|
|
549
|
-
console.warn(
|
|
550
|
-
`You are attempting to render <${displayName} ${prop} />, but ${displayName} is an Astro component. Astro components do not render in the client and should not have a hydration directive. Please use a framework component for client rendering.`
|
|
551
|
-
);
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
class AstroComponent {
|
|
557
|
-
constructor(htmlParts, expressions) {
|
|
558
|
-
this.htmlParts = htmlParts;
|
|
559
|
-
this.expressions = expressions;
|
|
560
|
-
}
|
|
561
|
-
get [Symbol.toStringTag]() {
|
|
562
|
-
return "AstroComponent";
|
|
563
|
-
}
|
|
564
|
-
async *[Symbol.asyncIterator]() {
|
|
565
|
-
const { htmlParts, expressions } = this;
|
|
566
|
-
for (let i = 0; i < htmlParts.length; i++) {
|
|
567
|
-
const html = htmlParts[i];
|
|
568
|
-
const expression = expressions[i];
|
|
569
|
-
yield markHTMLString(html);
|
|
570
|
-
yield* renderChild(expression);
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
function isAstroComponent(obj) {
|
|
575
|
-
return typeof obj === "object" && Object.prototype.toString.call(obj) === "[object AstroComponent]";
|
|
576
|
-
}
|
|
577
|
-
function isAstroComponentFactory(obj) {
|
|
578
|
-
return obj == null ? false : !!obj.isAstroComponentFactory;
|
|
579
|
-
}
|
|
580
|
-
async function* renderAstroComponent(component) {
|
|
581
|
-
for await (const value of component) {
|
|
582
|
-
if (value || value === 0) {
|
|
583
|
-
for await (const chunk of renderChild(value)) {
|
|
584
|
-
switch (chunk.type) {
|
|
585
|
-
case "directive": {
|
|
586
|
-
yield chunk;
|
|
587
|
-
break;
|
|
588
|
-
}
|
|
589
|
-
default: {
|
|
590
|
-
yield markHTMLString(chunk);
|
|
591
|
-
break;
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
async function renderToString(result, componentFactory, props, children) {
|
|
599
|
-
const Component = await componentFactory(result, props, children);
|
|
600
|
-
if (!isAstroComponent(Component)) {
|
|
601
|
-
const response = Component;
|
|
602
|
-
throw response;
|
|
603
|
-
}
|
|
604
|
-
let parts = new HTMLParts();
|
|
605
|
-
for await (const chunk of renderAstroComponent(Component)) {
|
|
606
|
-
parts.append(chunk, result);
|
|
607
|
-
}
|
|
608
|
-
return parts.toString();
|
|
609
|
-
}
|
|
610
|
-
async function renderToIterable(result, componentFactory, displayName, props, children) {
|
|
611
|
-
validateComponentProps(props, displayName);
|
|
612
|
-
const Component = await componentFactory(result, props, children);
|
|
613
|
-
if (!isAstroComponent(Component)) {
|
|
614
|
-
console.warn(
|
|
615
|
-
`Returning a Response is only supported inside of page components. Consider refactoring this logic into something like a function that can be used in the page.`
|
|
616
|
-
);
|
|
617
|
-
const response = Component;
|
|
618
|
-
throw response;
|
|
619
|
-
}
|
|
620
|
-
return renderAstroComponent(Component);
|
|
621
|
-
}
|
|
622
|
-
async function renderTemplate(htmlParts, ...expressions) {
|
|
623
|
-
return new AstroComponent(htmlParts, expressions);
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
async function* renderChild(child) {
|
|
627
|
-
child = await child;
|
|
628
|
-
if (child instanceof HTMLString) {
|
|
629
|
-
yield child;
|
|
630
|
-
} else if (Array.isArray(child)) {
|
|
631
|
-
for (const value of child) {
|
|
632
|
-
yield markHTMLString(await renderChild(value));
|
|
633
|
-
}
|
|
634
|
-
} else if (typeof child === "function") {
|
|
635
|
-
yield* renderChild(child());
|
|
636
|
-
} else if (typeof child === "string") {
|
|
637
|
-
yield markHTMLString(escapeHTML(child));
|
|
638
|
-
} else if (!child && child !== 0) ; else if (child instanceof AstroComponent || Object.prototype.toString.call(child) === "[object AstroComponent]") {
|
|
639
|
-
yield* renderAstroComponent(child);
|
|
640
|
-
} else if (ArrayBuffer.isView(child)) {
|
|
641
|
-
yield child;
|
|
642
|
-
} else if (typeof child === "object" && (Symbol.asyncIterator in child || Symbol.iterator in child)) {
|
|
643
|
-
yield* child;
|
|
644
|
-
} else {
|
|
645
|
-
yield child;
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
async function renderSlot(result, slotted, fallback) {
|
|
649
|
-
if (slotted) {
|
|
650
|
-
let iterator = renderChild(slotted);
|
|
651
|
-
let content = "";
|
|
652
|
-
for await (const chunk of iterator) {
|
|
653
|
-
if (chunk.type === "directive") {
|
|
654
|
-
content += stringifyChunk(result, chunk);
|
|
655
|
-
} else {
|
|
656
|
-
content += chunk;
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
return markHTMLString(content);
|
|
660
|
-
}
|
|
661
|
-
return fallback;
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
/**
|
|
665
|
-
* shortdash - https://github.com/bibig/node-shorthash
|
|
666
|
-
*
|
|
667
|
-
* @license
|
|
668
|
-
*
|
|
669
|
-
* (The MIT License)
|
|
670
|
-
*
|
|
671
|
-
* Copyright (c) 2013 Bibig <bibig@me.com>
|
|
672
|
-
*
|
|
673
|
-
* Permission is hereby granted, free of charge, to any person
|
|
674
|
-
* obtaining a copy of this software and associated documentation
|
|
675
|
-
* files (the "Software"), to deal in the Software without
|
|
676
|
-
* restriction, including without limitation the rights to use,
|
|
677
|
-
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
678
|
-
* copies of the Software, and to permit persons to whom the
|
|
679
|
-
* Software is furnished to do so, subject to the following
|
|
680
|
-
* conditions:
|
|
681
|
-
*
|
|
682
|
-
* The above copyright notice and this permission notice shall be
|
|
683
|
-
* included in all copies or substantial portions of the Software.
|
|
684
|
-
*
|
|
685
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
686
|
-
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
687
|
-
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
688
|
-
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
689
|
-
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
690
|
-
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
691
|
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
692
|
-
* OTHER DEALINGS IN THE SOFTWARE.
|
|
693
|
-
*/
|
|
694
|
-
const dictionary = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXY";
|
|
695
|
-
const binary = dictionary.length;
|
|
696
|
-
function bitwise(str) {
|
|
697
|
-
let hash = 0;
|
|
698
|
-
if (str.length === 0)
|
|
699
|
-
return hash;
|
|
700
|
-
for (let i = 0; i < str.length; i++) {
|
|
701
|
-
const ch = str.charCodeAt(i);
|
|
702
|
-
hash = (hash << 5) - hash + ch;
|
|
703
|
-
hash = hash & hash;
|
|
704
|
-
}
|
|
705
|
-
return hash;
|
|
706
|
-
}
|
|
707
|
-
function shorthash(text) {
|
|
708
|
-
let num;
|
|
709
|
-
let result = "";
|
|
710
|
-
let integer = bitwise(text);
|
|
711
|
-
const sign = integer < 0 ? "Z" : "";
|
|
712
|
-
integer = Math.abs(integer);
|
|
713
|
-
while (integer >= binary) {
|
|
714
|
-
num = integer % binary;
|
|
715
|
-
integer = Math.floor(integer / binary);
|
|
716
|
-
result = dictionary[num] + result;
|
|
717
|
-
}
|
|
718
|
-
if (integer > 0) {
|
|
719
|
-
result = dictionary[integer] + result;
|
|
720
|
-
}
|
|
721
|
-
return sign + result;
|
|
722
|
-
}
|
|
723
|
-
|
|
724
|
-
const voidElementNames = /^(area|base|br|col|command|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)$/i;
|
|
725
|
-
const htmlBooleanAttributes = /^(allowfullscreen|async|autofocus|autoplay|controls|default|defer|disabled|disablepictureinpicture|disableremoteplayback|formnovalidate|hidden|loop|nomodule|novalidate|open|playsinline|readonly|required|reversed|scoped|seamless|itemscope)$/i;
|
|
726
|
-
const htmlEnumAttributes = /^(contenteditable|draggable|spellcheck|value)$/i;
|
|
727
|
-
const svgEnumAttributes = /^(autoReverse|externalResourcesRequired|focusable|preserveAlpha)$/i;
|
|
728
|
-
const STATIC_DIRECTIVES = /* @__PURE__ */ new Set(["set:html", "set:text"]);
|
|
729
|
-
const toIdent = (k) => k.trim().replace(/(?:(?<!^)\b\w|\s+|[^\w]+)/g, (match, index) => {
|
|
730
|
-
if (/[^\w]|\s/.test(match))
|
|
731
|
-
return "";
|
|
732
|
-
return index === 0 ? match : match.toUpperCase();
|
|
733
|
-
});
|
|
734
|
-
const toAttributeString = (value, shouldEscape = true) => shouldEscape ? String(value).replace(/&/g, "&").replace(/"/g, """) : value;
|
|
735
|
-
const kebab = (k) => k.toLowerCase() === k ? k : k.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
|
|
736
|
-
const toStyleString = (obj) => Object.entries(obj).map(([k, v]) => `${kebab(k)}:${v}`).join(";");
|
|
737
|
-
function defineScriptVars(vars) {
|
|
738
|
-
let output = "";
|
|
739
|
-
for (const [key, value] of Object.entries(vars)) {
|
|
740
|
-
output += `let ${toIdent(key)} = ${JSON.stringify(value)};
|
|
741
|
-
`;
|
|
742
|
-
}
|
|
743
|
-
return markHTMLString(output);
|
|
744
|
-
}
|
|
745
|
-
function formatList(values) {
|
|
746
|
-
if (values.length === 1) {
|
|
747
|
-
return values[0];
|
|
748
|
-
}
|
|
749
|
-
return `${values.slice(0, -1).join(", ")} or ${values[values.length - 1]}`;
|
|
750
|
-
}
|
|
751
|
-
function addAttribute(value, key, shouldEscape = true) {
|
|
752
|
-
if (value == null) {
|
|
753
|
-
return "";
|
|
754
|
-
}
|
|
755
|
-
if (value === false) {
|
|
756
|
-
if (htmlEnumAttributes.test(key) || svgEnumAttributes.test(key)) {
|
|
757
|
-
return markHTMLString(` ${key}="false"`);
|
|
758
|
-
}
|
|
759
|
-
return "";
|
|
760
|
-
}
|
|
761
|
-
if (STATIC_DIRECTIVES.has(key)) {
|
|
762
|
-
console.warn(`[astro] The "${key}" directive cannot be applied dynamically at runtime. It will not be rendered as an attribute.
|
|
763
|
-
|
|
764
|
-
Make sure to use the static attribute syntax (\`${key}={value}\`) instead of the dynamic spread syntax (\`{...{ "${key}": value }}\`).`);
|
|
765
|
-
return "";
|
|
766
|
-
}
|
|
767
|
-
if (key === "class:list") {
|
|
768
|
-
const listValue = toAttributeString(serializeListValue(value));
|
|
769
|
-
if (listValue === "") {
|
|
770
|
-
return "";
|
|
771
|
-
}
|
|
772
|
-
return markHTMLString(` ${key.slice(0, -5)}="${listValue}"`);
|
|
773
|
-
}
|
|
774
|
-
if (key === "style" && !(value instanceof HTMLString) && typeof value === "object") {
|
|
775
|
-
return markHTMLString(` ${key}="${toStyleString(value)}"`);
|
|
776
|
-
}
|
|
777
|
-
if (key === "className") {
|
|
778
|
-
return markHTMLString(` class="${toAttributeString(value, shouldEscape)}"`);
|
|
779
|
-
}
|
|
780
|
-
if (value === true && (key.startsWith("data-") || htmlBooleanAttributes.test(key))) {
|
|
781
|
-
return markHTMLString(` ${key}`);
|
|
782
|
-
} else {
|
|
783
|
-
return markHTMLString(` ${key}="${toAttributeString(value, shouldEscape)}"`);
|
|
784
|
-
}
|
|
785
|
-
}
|
|
786
|
-
function internalSpreadAttributes(values, shouldEscape = true) {
|
|
787
|
-
let output = "";
|
|
788
|
-
for (const [key, value] of Object.entries(values)) {
|
|
789
|
-
output += addAttribute(value, key, shouldEscape);
|
|
790
|
-
}
|
|
791
|
-
return markHTMLString(output);
|
|
792
|
-
}
|
|
793
|
-
function renderElement$1(name, { props: _props, children = "" }, shouldEscape = true) {
|
|
794
|
-
const { lang: _, "data-astro-id": astroId, "define:vars": defineVars, ...props } = _props;
|
|
795
|
-
if (defineVars) {
|
|
796
|
-
if (name === "style") {
|
|
797
|
-
delete props["is:global"];
|
|
798
|
-
delete props["is:scoped"];
|
|
799
|
-
}
|
|
800
|
-
if (name === "script") {
|
|
801
|
-
delete props.hoist;
|
|
802
|
-
children = defineScriptVars(defineVars) + "\n" + children;
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
if ((children == null || children == "") && voidElementNames.test(name)) {
|
|
806
|
-
return `<${name}${internalSpreadAttributes(props, shouldEscape)} />`;
|
|
807
|
-
}
|
|
808
|
-
return `<${name}${internalSpreadAttributes(props, shouldEscape)}>${children}</${name}>`;
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
function componentIsHTMLElement(Component) {
|
|
812
|
-
return typeof HTMLElement !== "undefined" && HTMLElement.isPrototypeOf(Component);
|
|
813
|
-
}
|
|
814
|
-
async function renderHTMLElement(result, constructor, props, slots) {
|
|
815
|
-
const name = getHTMLElementName(constructor);
|
|
816
|
-
let attrHTML = "";
|
|
817
|
-
for (const attr in props) {
|
|
818
|
-
attrHTML += ` ${attr}="${toAttributeString(await props[attr])}"`;
|
|
819
|
-
}
|
|
820
|
-
return markHTMLString(
|
|
821
|
-
`<${name}${attrHTML}>${await renderSlot(result, slots == null ? void 0 : slots.default)}</${name}>`
|
|
822
|
-
);
|
|
823
|
-
}
|
|
824
|
-
function getHTMLElementName(constructor) {
|
|
825
|
-
const definedName = customElements.getName(constructor);
|
|
826
|
-
if (definedName)
|
|
827
|
-
return definedName;
|
|
828
|
-
const assignedName = constructor.name.replace(/^HTML|Element$/g, "").replace(/[A-Z]/g, "-$&").toLowerCase().replace(/^-/, "html-");
|
|
829
|
-
return assignedName;
|
|
830
|
-
}
|
|
831
|
-
|
|
832
|
-
const rendererAliases = /* @__PURE__ */ new Map([["solid", "solid-js"]]);
|
|
833
|
-
function guessRenderers(componentUrl) {
|
|
834
|
-
const extname = componentUrl == null ? void 0 : componentUrl.split(".").pop();
|
|
835
|
-
switch (extname) {
|
|
836
|
-
case "svelte":
|
|
837
|
-
return ["@astrojs/svelte"];
|
|
838
|
-
case "vue":
|
|
839
|
-
return ["@astrojs/vue"];
|
|
840
|
-
case "jsx":
|
|
841
|
-
case "tsx":
|
|
842
|
-
return ["@astrojs/react", "@astrojs/preact"];
|
|
843
|
-
default:
|
|
844
|
-
return ["@astrojs/react", "@astrojs/preact", "@astrojs/vue", "@astrojs/svelte"];
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
function getComponentType(Component) {
|
|
848
|
-
if (Component === Fragment) {
|
|
849
|
-
return "fragment";
|
|
850
|
-
}
|
|
851
|
-
if (Component && typeof Component === "object" && Component["astro:html"]) {
|
|
852
|
-
return "html";
|
|
853
|
-
}
|
|
854
|
-
if (isAstroComponentFactory(Component)) {
|
|
855
|
-
return "astro-factory";
|
|
856
|
-
}
|
|
857
|
-
return "unknown";
|
|
858
|
-
}
|
|
859
|
-
async function renderComponent(result, displayName, Component, _props, slots = {}) {
|
|
860
|
-
var _a;
|
|
861
|
-
Component = await Component;
|
|
862
|
-
switch (getComponentType(Component)) {
|
|
863
|
-
case "fragment": {
|
|
864
|
-
const children2 = await renderSlot(result, slots == null ? void 0 : slots.default);
|
|
865
|
-
if (children2 == null) {
|
|
866
|
-
return children2;
|
|
867
|
-
}
|
|
868
|
-
return markHTMLString(children2);
|
|
869
|
-
}
|
|
870
|
-
case "html": {
|
|
871
|
-
const children2 = {};
|
|
872
|
-
if (slots) {
|
|
873
|
-
await Promise.all(
|
|
874
|
-
Object.entries(slots).map(
|
|
875
|
-
([key, value]) => renderSlot(result, value).then((output) => {
|
|
876
|
-
children2[key] = output;
|
|
877
|
-
})
|
|
878
|
-
)
|
|
879
|
-
);
|
|
880
|
-
}
|
|
881
|
-
const html2 = Component.render({ slots: children2 });
|
|
882
|
-
return markHTMLString(html2);
|
|
883
|
-
}
|
|
884
|
-
case "astro-factory": {
|
|
885
|
-
async function* renderAstroComponentInline() {
|
|
886
|
-
let iterable = await renderToIterable(result, Component, displayName, _props, slots);
|
|
887
|
-
yield* iterable;
|
|
888
|
-
}
|
|
889
|
-
return renderAstroComponentInline();
|
|
890
|
-
}
|
|
891
|
-
}
|
|
892
|
-
if (!Component && !_props["client:only"]) {
|
|
893
|
-
throw new Error(
|
|
894
|
-
`Unable to render ${displayName} because it is ${Component}!
|
|
895
|
-
Did you forget to import the component or is it possible there is a typo?`
|
|
896
|
-
);
|
|
897
|
-
}
|
|
898
|
-
const { renderers } = result._metadata;
|
|
899
|
-
const metadata = { displayName };
|
|
900
|
-
const { hydration, isPage, props } = extractDirectives(_props);
|
|
901
|
-
let html = "";
|
|
902
|
-
let attrs = void 0;
|
|
903
|
-
if (hydration) {
|
|
904
|
-
metadata.hydrate = hydration.directive;
|
|
905
|
-
metadata.hydrateArgs = hydration.value;
|
|
906
|
-
metadata.componentExport = hydration.componentExport;
|
|
907
|
-
metadata.componentUrl = hydration.componentUrl;
|
|
908
|
-
}
|
|
909
|
-
const probableRendererNames = guessRenderers(metadata.componentUrl);
|
|
910
|
-
if (Array.isArray(renderers) && renderers.length === 0 && typeof Component !== "string" && !componentIsHTMLElement(Component)) {
|
|
911
|
-
const message = `Unable to render ${metadata.displayName}!
|
|
912
|
-
|
|
913
|
-
There are no \`integrations\` set in your \`astro.config.mjs\` file.
|
|
914
|
-
Did you mean to add ${formatList(probableRendererNames.map((r) => "`" + r + "`"))}?`;
|
|
915
|
-
throw new Error(message);
|
|
916
|
-
}
|
|
917
|
-
const children = {};
|
|
918
|
-
if (slots) {
|
|
919
|
-
await Promise.all(
|
|
920
|
-
Object.entries(slots).map(
|
|
921
|
-
([key, value]) => renderSlot(result, value).then((output) => {
|
|
922
|
-
children[key] = output;
|
|
923
|
-
})
|
|
924
|
-
)
|
|
925
|
-
);
|
|
926
|
-
}
|
|
927
|
-
let renderer;
|
|
928
|
-
if (metadata.hydrate !== "only") {
|
|
929
|
-
if (Component && Component[Renderer]) {
|
|
930
|
-
const rendererName = Component[Renderer];
|
|
931
|
-
renderer = renderers.find(({ name }) => name === rendererName);
|
|
932
|
-
}
|
|
933
|
-
if (!renderer) {
|
|
934
|
-
let error;
|
|
935
|
-
for (const r of renderers) {
|
|
936
|
-
try {
|
|
937
|
-
if (await r.ssr.check.call({ result }, Component, props, children)) {
|
|
938
|
-
renderer = r;
|
|
939
|
-
break;
|
|
940
|
-
}
|
|
941
|
-
} catch (e) {
|
|
942
|
-
error ?? (error = e);
|
|
943
|
-
}
|
|
944
|
-
}
|
|
945
|
-
if (!renderer && error) {
|
|
946
|
-
throw error;
|
|
947
|
-
}
|
|
948
|
-
}
|
|
949
|
-
if (!renderer && typeof HTMLElement === "function" && componentIsHTMLElement(Component)) {
|
|
950
|
-
const output = renderHTMLElement(result, Component, _props, slots);
|
|
951
|
-
return output;
|
|
952
|
-
}
|
|
953
|
-
} else {
|
|
954
|
-
if (metadata.hydrateArgs) {
|
|
955
|
-
const passedName = metadata.hydrateArgs;
|
|
956
|
-
const rendererName = rendererAliases.has(passedName) ? rendererAliases.get(passedName) : passedName;
|
|
957
|
-
renderer = renderers.find(
|
|
958
|
-
({ name }) => name === `@astrojs/${rendererName}` || name === rendererName
|
|
959
|
-
);
|
|
960
|
-
}
|
|
961
|
-
if (!renderer && renderers.length === 1) {
|
|
962
|
-
renderer = renderers[0];
|
|
963
|
-
}
|
|
964
|
-
if (!renderer) {
|
|
965
|
-
const extname = (_a = metadata.componentUrl) == null ? void 0 : _a.split(".").pop();
|
|
966
|
-
renderer = renderers.filter(
|
|
967
|
-
({ name }) => name === `@astrojs/${extname}` || name === extname
|
|
968
|
-
)[0];
|
|
969
|
-
}
|
|
970
|
-
}
|
|
971
|
-
if (!renderer) {
|
|
972
|
-
if (metadata.hydrate === "only") {
|
|
973
|
-
throw new Error(`Unable to render ${metadata.displayName}!
|
|
974
|
-
|
|
975
|
-
Using the \`client:only\` hydration strategy, Astro needs a hint to use the correct renderer.
|
|
976
|
-
Did you mean to pass <${metadata.displayName} client:only="${probableRendererNames.map((r) => r.replace("@astrojs/", "")).join("|")}" />
|
|
977
|
-
`);
|
|
978
|
-
} else if (typeof Component !== "string") {
|
|
979
|
-
const matchingRenderers = renderers.filter((r) => probableRendererNames.includes(r.name));
|
|
980
|
-
const plural = renderers.length > 1;
|
|
981
|
-
if (matchingRenderers.length === 0) {
|
|
982
|
-
throw new Error(`Unable to render ${metadata.displayName}!
|
|
983
|
-
|
|
984
|
-
There ${plural ? "are" : "is"} ${renderers.length} renderer${plural ? "s" : ""} configured in your \`astro.config.mjs\` file,
|
|
985
|
-
but ${plural ? "none were" : "it was not"} able to server-side render ${metadata.displayName}.
|
|
986
|
-
|
|
987
|
-
Did you mean to enable ${formatList(probableRendererNames.map((r) => "`" + r + "`"))}?`);
|
|
988
|
-
} else if (matchingRenderers.length === 1) {
|
|
989
|
-
renderer = matchingRenderers[0];
|
|
990
|
-
({ html, attrs } = await renderer.ssr.renderToStaticMarkup.call(
|
|
991
|
-
{ result },
|
|
992
|
-
Component,
|
|
993
|
-
props,
|
|
994
|
-
children,
|
|
995
|
-
metadata
|
|
996
|
-
));
|
|
997
|
-
} else {
|
|
998
|
-
throw new Error(`Unable to render ${metadata.displayName}!
|
|
999
|
-
|
|
1000
|
-
This component likely uses ${formatList(probableRendererNames)},
|
|
1001
|
-
but Astro encountered an error during server-side rendering.
|
|
1002
|
-
|
|
1003
|
-
Please ensure that ${metadata.displayName}:
|
|
1004
|
-
1. Does not unconditionally access browser-specific globals like \`window\` or \`document\`.
|
|
1005
|
-
If this is unavoidable, use the \`client:only\` hydration directive.
|
|
1006
|
-
2. Does not conditionally return \`null\` or \`undefined\` when rendered on the server.
|
|
1007
|
-
|
|
1008
|
-
If you're still stuck, please open an issue on GitHub or join us at https://astro.build/chat.`);
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
} else {
|
|
1012
|
-
if (metadata.hydrate === "only") {
|
|
1013
|
-
html = await renderSlot(result, slots == null ? void 0 : slots.fallback);
|
|
1014
|
-
} else {
|
|
1015
|
-
({ html, attrs } = await renderer.ssr.renderToStaticMarkup.call(
|
|
1016
|
-
{ result },
|
|
1017
|
-
Component,
|
|
1018
|
-
props,
|
|
1019
|
-
children,
|
|
1020
|
-
metadata
|
|
1021
|
-
));
|
|
1022
|
-
}
|
|
1023
|
-
}
|
|
1024
|
-
if (renderer && !renderer.clientEntrypoint && renderer.name !== "@astrojs/lit" && metadata.hydrate) {
|
|
1025
|
-
throw new Error(
|
|
1026
|
-
`${metadata.displayName} component has a \`client:${metadata.hydrate}\` directive, but no client entrypoint was provided by ${renderer.name}!`
|
|
1027
|
-
);
|
|
1028
|
-
}
|
|
1029
|
-
if (!html && typeof Component === "string") {
|
|
1030
|
-
const childSlots = Object.values(children).join("");
|
|
1031
|
-
const iterable = renderAstroComponent(
|
|
1032
|
-
await renderTemplate`<${Component}${internalSpreadAttributes(props)}${markHTMLString(
|
|
1033
|
-
childSlots === "" && voidElementNames.test(Component) ? `/>` : `>${childSlots}</${Component}>`
|
|
1034
|
-
)}`
|
|
1035
|
-
);
|
|
1036
|
-
html = "";
|
|
1037
|
-
for await (const chunk of iterable) {
|
|
1038
|
-
html += chunk;
|
|
1039
|
-
}
|
|
1040
|
-
}
|
|
1041
|
-
if (!hydration) {
|
|
1042
|
-
if (isPage || (renderer == null ? void 0 : renderer.name) === "astro:jsx") {
|
|
1043
|
-
return html;
|
|
1044
|
-
}
|
|
1045
|
-
return markHTMLString(html.replace(/\<\/?astro-slot\>/g, ""));
|
|
1046
|
-
}
|
|
1047
|
-
const astroId = shorthash(
|
|
1048
|
-
`<!--${metadata.componentExport.value}:${metadata.componentUrl}-->
|
|
1049
|
-
${html}
|
|
1050
|
-
${serializeProps(
|
|
1051
|
-
props,
|
|
1052
|
-
metadata
|
|
1053
|
-
)}`
|
|
1054
|
-
);
|
|
1055
|
-
const island = await generateHydrateScript(
|
|
1056
|
-
{ renderer, result, astroId, props, attrs },
|
|
1057
|
-
metadata
|
|
1058
|
-
);
|
|
1059
|
-
let unrenderedSlots = [];
|
|
1060
|
-
if (html) {
|
|
1061
|
-
if (Object.keys(children).length > 0) {
|
|
1062
|
-
for (const key of Object.keys(children)) {
|
|
1063
|
-
if (!html.includes(key === "default" ? `<astro-slot>` : `<astro-slot name="${key}">`)) {
|
|
1064
|
-
unrenderedSlots.push(key);
|
|
1065
|
-
}
|
|
1066
|
-
}
|
|
1067
|
-
}
|
|
1068
|
-
} else {
|
|
1069
|
-
unrenderedSlots = Object.keys(children);
|
|
1070
|
-
}
|
|
1071
|
-
const template = unrenderedSlots.length > 0 ? unrenderedSlots.map(
|
|
1072
|
-
(key) => `<template data-astro-template${key !== "default" ? `="${key}"` : ""}>${children[key]}</template>`
|
|
1073
|
-
).join("") : "";
|
|
1074
|
-
island.children = `${html ?? ""}${template}`;
|
|
1075
|
-
if (island.children) {
|
|
1076
|
-
island.props["await-children"] = "";
|
|
1077
|
-
}
|
|
1078
|
-
async function* renderAll() {
|
|
1079
|
-
yield { type: "directive", hydration, result };
|
|
1080
|
-
yield markHTMLString(renderElement$1("astro-island", island, false));
|
|
1081
|
-
}
|
|
1082
|
-
return renderAll();
|
|
1083
|
-
}
|
|
1084
|
-
|
|
1085
|
-
const uniqueElements = (item, index, all) => {
|
|
1086
|
-
const props = JSON.stringify(item.props);
|
|
1087
|
-
const children = item.children;
|
|
1088
|
-
return index === all.findIndex((i) => JSON.stringify(i.props) === props && i.children == children);
|
|
1089
|
-
};
|
|
1090
|
-
const alreadyHeadRenderedResults = /* @__PURE__ */ new WeakSet();
|
|
1091
|
-
function renderHead(result) {
|
|
1092
|
-
alreadyHeadRenderedResults.add(result);
|
|
1093
|
-
const styles = Array.from(result.styles).filter(uniqueElements).map((style) => renderElement$1("style", style));
|
|
1094
|
-
result.styles.clear();
|
|
1095
|
-
const scripts = Array.from(result.scripts).filter(uniqueElements).map((script, i) => {
|
|
1096
|
-
return renderElement$1("script", script, false);
|
|
1097
|
-
});
|
|
1098
|
-
const links = Array.from(result.links).filter(uniqueElements).map((link) => renderElement$1("link", link, false));
|
|
1099
|
-
return markHTMLString(links.join("\n") + styles.join("\n") + scripts.join("\n"));
|
|
1100
|
-
}
|
|
1101
|
-
async function* maybeRenderHead(result) {
|
|
1102
|
-
if (alreadyHeadRenderedResults.has(result)) {
|
|
1103
|
-
return;
|
|
1104
|
-
}
|
|
1105
|
-
yield renderHead(result);
|
|
1106
|
-
}
|
|
1107
|
-
|
|
1108
|
-
typeof process === "object" && Object.prototype.toString.call(process) === "[object process]";
|
|
1109
|
-
|
|
1110
|
-
function createComponent(cb) {
|
|
1111
|
-
cb.isAstroComponentFactory = true;
|
|
1112
|
-
return cb;
|
|
1113
|
-
}
|
|
1114
|
-
function spreadAttributes(values, _name, { class: scopedClassName } = {}) {
|
|
1115
|
-
let output = "";
|
|
1116
|
-
if (scopedClassName) {
|
|
1117
|
-
if (typeof values.class !== "undefined") {
|
|
1118
|
-
values.class += ` ${scopedClassName}`;
|
|
1119
|
-
} else if (typeof values["class:list"] !== "undefined") {
|
|
1120
|
-
values["class:list"] = [values["class:list"], scopedClassName];
|
|
1121
|
-
} else {
|
|
1122
|
-
values.class = scopedClassName;
|
|
1123
|
-
}
|
|
1124
|
-
}
|
|
1125
|
-
for (const [key, value] of Object.entries(values)) {
|
|
1126
|
-
output += addAttribute(value, key, true);
|
|
1127
|
-
}
|
|
1128
|
-
return markHTMLString(output);
|
|
1129
|
-
}
|
|
1130
|
-
function defineStyleVars(defs) {
|
|
1131
|
-
let output = "";
|
|
1132
|
-
let arr = !Array.isArray(defs) ? [defs] : defs;
|
|
1133
|
-
for (const vars of arr) {
|
|
1134
|
-
for (const [key, value] of Object.entries(vars)) {
|
|
1135
|
-
if (value || value === 0) {
|
|
1136
|
-
output += `--${key}: ${value};`;
|
|
1137
|
-
}
|
|
1138
|
-
}
|
|
1139
|
-
}
|
|
1140
|
-
return markHTMLString(output);
|
|
1141
|
-
}
|
|
1142
|
-
|
|
1143
|
-
const AstroJSX = "astro:jsx";
|
|
1144
|
-
const Empty = Symbol("empty");
|
|
1145
|
-
const toSlotName = (str) => str.trim().replace(/[-_]([a-z])/g, (_, w) => w.toUpperCase());
|
|
1146
|
-
function isVNode(vnode) {
|
|
1147
|
-
return vnode && typeof vnode === "object" && vnode[AstroJSX];
|
|
1148
|
-
}
|
|
1149
|
-
function transformSlots(vnode) {
|
|
1150
|
-
if (typeof vnode.type === "string")
|
|
1151
|
-
return vnode;
|
|
1152
|
-
const slots = {};
|
|
1153
|
-
if (isVNode(vnode.props.children)) {
|
|
1154
|
-
const child = vnode.props.children;
|
|
1155
|
-
if (!isVNode(child))
|
|
1156
|
-
return;
|
|
1157
|
-
if (!("slot" in child.props))
|
|
1158
|
-
return;
|
|
1159
|
-
const name = toSlotName(child.props.slot);
|
|
1160
|
-
slots[name] = [child];
|
|
1161
|
-
slots[name]["$$slot"] = true;
|
|
1162
|
-
delete child.props.slot;
|
|
1163
|
-
delete vnode.props.children;
|
|
1164
|
-
}
|
|
1165
|
-
if (Array.isArray(vnode.props.children)) {
|
|
1166
|
-
vnode.props.children = vnode.props.children.map((child) => {
|
|
1167
|
-
if (!isVNode(child))
|
|
1168
|
-
return child;
|
|
1169
|
-
if (!("slot" in child.props))
|
|
1170
|
-
return child;
|
|
1171
|
-
const name = toSlotName(child.props.slot);
|
|
1172
|
-
if (Array.isArray(slots[name])) {
|
|
1173
|
-
slots[name].push(child);
|
|
1174
|
-
} else {
|
|
1175
|
-
slots[name] = [child];
|
|
1176
|
-
slots[name]["$$slot"] = true;
|
|
1177
|
-
}
|
|
1178
|
-
delete child.props.slot;
|
|
1179
|
-
return Empty;
|
|
1180
|
-
}).filter((v) => v !== Empty);
|
|
1181
|
-
}
|
|
1182
|
-
Object.assign(vnode.props, slots);
|
|
1183
|
-
}
|
|
1184
|
-
function markRawChildren(child) {
|
|
1185
|
-
if (typeof child === "string")
|
|
1186
|
-
return markHTMLString(child);
|
|
1187
|
-
if (Array.isArray(child))
|
|
1188
|
-
return child.map((c) => markRawChildren(c));
|
|
1189
|
-
return child;
|
|
1190
|
-
}
|
|
1191
|
-
function transformSetDirectives(vnode) {
|
|
1192
|
-
if (!("set:html" in vnode.props || "set:text" in vnode.props))
|
|
1193
|
-
return;
|
|
1194
|
-
if ("set:html" in vnode.props) {
|
|
1195
|
-
const children = markRawChildren(vnode.props["set:html"]);
|
|
1196
|
-
delete vnode.props["set:html"];
|
|
1197
|
-
Object.assign(vnode.props, { children });
|
|
1198
|
-
return;
|
|
1199
|
-
}
|
|
1200
|
-
if ("set:text" in vnode.props) {
|
|
1201
|
-
const children = vnode.props["set:text"];
|
|
1202
|
-
delete vnode.props["set:text"];
|
|
1203
|
-
Object.assign(vnode.props, { children });
|
|
1204
|
-
return;
|
|
1205
|
-
}
|
|
1206
|
-
}
|
|
1207
|
-
function createVNode(type, props) {
|
|
1208
|
-
const vnode = {
|
|
1209
|
-
[AstroJSX]: true,
|
|
1210
|
-
type,
|
|
1211
|
-
props: props ?? {}
|
|
1212
|
-
};
|
|
1213
|
-
transformSetDirectives(vnode);
|
|
1214
|
-
transformSlots(vnode);
|
|
1215
|
-
return vnode;
|
|
1216
|
-
}
|
|
1217
|
-
|
|
1218
|
-
const ClientOnlyPlaceholder = "astro-client-only";
|
|
1219
|
-
const skipAstroJSXCheck = /* @__PURE__ */ new WeakSet();
|
|
1220
|
-
let originalConsoleError;
|
|
1221
|
-
let consoleFilterRefs = 0;
|
|
1222
|
-
async function renderJSX(result, vnode) {
|
|
1223
|
-
switch (true) {
|
|
1224
|
-
case vnode instanceof HTMLString:
|
|
1225
|
-
if (vnode.toString().trim() === "") {
|
|
1226
|
-
return "";
|
|
1227
|
-
}
|
|
1228
|
-
return vnode;
|
|
1229
|
-
case typeof vnode === "string":
|
|
1230
|
-
return markHTMLString(escapeHTML(vnode));
|
|
1231
|
-
case (!vnode && vnode !== 0):
|
|
1232
|
-
return "";
|
|
1233
|
-
case Array.isArray(vnode):
|
|
1234
|
-
return markHTMLString(
|
|
1235
|
-
(await Promise.all(vnode.map((v) => renderJSX(result, v)))).join("")
|
|
1236
|
-
);
|
|
1237
|
-
}
|
|
1238
|
-
if (isVNode(vnode)) {
|
|
1239
|
-
switch (true) {
|
|
1240
|
-
case vnode.type === Symbol.for("astro:fragment"):
|
|
1241
|
-
return renderJSX(result, vnode.props.children);
|
|
1242
|
-
case vnode.type.isAstroComponentFactory: {
|
|
1243
|
-
let props = {};
|
|
1244
|
-
let slots = {};
|
|
1245
|
-
for (const [key, value] of Object.entries(vnode.props ?? {})) {
|
|
1246
|
-
if (key === "children" || value && typeof value === "object" && value["$$slot"]) {
|
|
1247
|
-
slots[key === "children" ? "default" : key] = () => renderJSX(result, value);
|
|
1248
|
-
} else {
|
|
1249
|
-
props[key] = value;
|
|
1250
|
-
}
|
|
1251
|
-
}
|
|
1252
|
-
return markHTMLString(await renderToString(result, vnode.type, props, slots));
|
|
1253
|
-
}
|
|
1254
|
-
case (!vnode.type && vnode.type !== 0):
|
|
1255
|
-
return "";
|
|
1256
|
-
case (typeof vnode.type === "string" && vnode.type !== ClientOnlyPlaceholder):
|
|
1257
|
-
return markHTMLString(await renderElement(result, vnode.type, vnode.props ?? {}));
|
|
1258
|
-
}
|
|
1259
|
-
if (vnode.type) {
|
|
1260
|
-
let extractSlots2 = function(child) {
|
|
1261
|
-
if (Array.isArray(child)) {
|
|
1262
|
-
return child.map((c) => extractSlots2(c));
|
|
1263
|
-
}
|
|
1264
|
-
if (!isVNode(child)) {
|
|
1265
|
-
_slots.default.push(child);
|
|
1266
|
-
return;
|
|
1267
|
-
}
|
|
1268
|
-
if ("slot" in child.props) {
|
|
1269
|
-
_slots[child.props.slot] = [..._slots[child.props.slot] ?? [], child];
|
|
1270
|
-
delete child.props.slot;
|
|
1271
|
-
return;
|
|
1272
|
-
}
|
|
1273
|
-
_slots.default.push(child);
|
|
1274
|
-
};
|
|
1275
|
-
if (typeof vnode.type === "function" && vnode.type["astro:renderer"]) {
|
|
1276
|
-
skipAstroJSXCheck.add(vnode.type);
|
|
1277
|
-
}
|
|
1278
|
-
if (typeof vnode.type === "function" && vnode.props["server:root"]) {
|
|
1279
|
-
const output2 = await vnode.type(vnode.props ?? {});
|
|
1280
|
-
return await renderJSX(result, output2);
|
|
1281
|
-
}
|
|
1282
|
-
if (typeof vnode.type === "function" && !skipAstroJSXCheck.has(vnode.type)) {
|
|
1283
|
-
useConsoleFilter();
|
|
1284
|
-
try {
|
|
1285
|
-
const output2 = await vnode.type(vnode.props ?? {});
|
|
1286
|
-
if (output2 && output2[AstroJSX]) {
|
|
1287
|
-
return await renderJSX(result, output2);
|
|
1288
|
-
} else if (!output2) {
|
|
1289
|
-
return await renderJSX(result, output2);
|
|
1290
|
-
}
|
|
1291
|
-
} catch (e) {
|
|
1292
|
-
skipAstroJSXCheck.add(vnode.type);
|
|
1293
|
-
} finally {
|
|
1294
|
-
finishUsingConsoleFilter();
|
|
1295
|
-
}
|
|
1296
|
-
}
|
|
1297
|
-
const { children = null, ...props } = vnode.props ?? {};
|
|
1298
|
-
const _slots = {
|
|
1299
|
-
default: []
|
|
1300
|
-
};
|
|
1301
|
-
extractSlots2(children);
|
|
1302
|
-
for (const [key, value] of Object.entries(props)) {
|
|
1303
|
-
if (value["$$slot"]) {
|
|
1304
|
-
_slots[key] = value;
|
|
1305
|
-
delete props[key];
|
|
1306
|
-
}
|
|
1307
|
-
}
|
|
1308
|
-
const slotPromises = [];
|
|
1309
|
-
const slots = {};
|
|
1310
|
-
for (const [key, value] of Object.entries(_slots)) {
|
|
1311
|
-
slotPromises.push(
|
|
1312
|
-
renderJSX(result, value).then((output2) => {
|
|
1313
|
-
if (output2.toString().trim().length === 0)
|
|
1314
|
-
return;
|
|
1315
|
-
slots[key] = () => output2;
|
|
1316
|
-
})
|
|
1317
|
-
);
|
|
1318
|
-
}
|
|
1319
|
-
await Promise.all(slotPromises);
|
|
1320
|
-
let output;
|
|
1321
|
-
if (vnode.type === ClientOnlyPlaceholder && vnode.props["client:only"]) {
|
|
1322
|
-
output = await renderComponent(
|
|
1323
|
-
result,
|
|
1324
|
-
vnode.props["client:display-name"] ?? "",
|
|
1325
|
-
null,
|
|
1326
|
-
props,
|
|
1327
|
-
slots
|
|
1328
|
-
);
|
|
1329
|
-
} else {
|
|
1330
|
-
output = await renderComponent(
|
|
1331
|
-
result,
|
|
1332
|
-
typeof vnode.type === "function" ? vnode.type.name : vnode.type,
|
|
1333
|
-
vnode.type,
|
|
1334
|
-
props,
|
|
1335
|
-
slots
|
|
1336
|
-
);
|
|
1337
|
-
}
|
|
1338
|
-
if (typeof output !== "string" && Symbol.asyncIterator in output) {
|
|
1339
|
-
let parts = new HTMLParts();
|
|
1340
|
-
for await (const chunk of output) {
|
|
1341
|
-
parts.append(chunk, result);
|
|
1342
|
-
}
|
|
1343
|
-
return markHTMLString(parts.toString());
|
|
1344
|
-
} else {
|
|
1345
|
-
return markHTMLString(output);
|
|
1346
|
-
}
|
|
1347
|
-
}
|
|
1348
|
-
}
|
|
1349
|
-
return markHTMLString(`${vnode}`);
|
|
1350
|
-
}
|
|
1351
|
-
async function renderElement(result, tag, { children, ...props }) {
|
|
1352
|
-
return markHTMLString(
|
|
1353
|
-
`<${tag}${spreadAttributes(props)}${markHTMLString(
|
|
1354
|
-
(children == null || children == "") && voidElementNames.test(tag) ? `/>` : `>${children == null ? "" : await renderJSX(result, children)}</${tag}>`
|
|
1355
|
-
)}`
|
|
1356
|
-
);
|
|
1357
|
-
}
|
|
1358
|
-
function useConsoleFilter() {
|
|
1359
|
-
consoleFilterRefs++;
|
|
1360
|
-
if (!originalConsoleError) {
|
|
1361
|
-
originalConsoleError = console.error;
|
|
1362
|
-
try {
|
|
1363
|
-
console.error = filteredConsoleError;
|
|
1364
|
-
} catch (error) {
|
|
1365
|
-
}
|
|
1366
|
-
}
|
|
1367
|
-
}
|
|
1368
|
-
function finishUsingConsoleFilter() {
|
|
1369
|
-
consoleFilterRefs--;
|
|
1370
|
-
}
|
|
1371
|
-
function filteredConsoleError(msg, ...rest) {
|
|
1372
|
-
if (consoleFilterRefs > 0 && typeof msg === "string") {
|
|
1373
|
-
const isKnownReactHookError = msg.includes("Warning: Invalid hook call.") && msg.includes("https://reactjs.org/link/invalid-hook-call");
|
|
1374
|
-
if (isKnownReactHookError)
|
|
1375
|
-
return;
|
|
1376
|
-
}
|
|
1377
|
-
originalConsoleError(msg, ...rest);
|
|
1378
|
-
}
|
|
1379
|
-
|
|
1380
|
-
const slotName = (str) => str.trim().replace(/[-_]([a-z])/g, (_, w) => w.toUpperCase());
|
|
1381
|
-
async function check(Component, props, { default: children = null, ...slotted } = {}) {
|
|
1382
|
-
if (typeof Component !== "function")
|
|
1383
|
-
return false;
|
|
1384
|
-
const slots = {};
|
|
1385
|
-
for (const [key, value] of Object.entries(slotted)) {
|
|
1386
|
-
const name = slotName(key);
|
|
1387
|
-
slots[name] = value;
|
|
1388
|
-
}
|
|
1389
|
-
try {
|
|
1390
|
-
const result = await Component({ ...props, ...slots, children });
|
|
1391
|
-
return result[AstroJSX];
|
|
1392
|
-
} catch (e) {
|
|
1393
|
-
}
|
|
1394
|
-
return false;
|
|
1395
|
-
}
|
|
1396
|
-
async function renderToStaticMarkup(Component, props = {}, { default: children = null, ...slotted } = {}) {
|
|
1397
|
-
const slots = {};
|
|
1398
|
-
for (const [key, value] of Object.entries(slotted)) {
|
|
1399
|
-
const name = slotName(key);
|
|
1400
|
-
slots[name] = value;
|
|
1401
|
-
}
|
|
1402
|
-
const { result } = this;
|
|
1403
|
-
const html = await renderJSX(result, createVNode(Component, { ...props, ...slots, children }));
|
|
1404
|
-
return { html };
|
|
1405
|
-
}
|
|
1406
|
-
var server_default = {
|
|
1407
|
-
check,
|
|
1408
|
-
renderToStaticMarkup
|
|
1409
|
-
};
|
|
1410
|
-
|
|
1411
|
-
if (!globalThis.__apiCache) {
|
|
1412
|
-
globalThis.__apiCache = {};
|
|
1413
|
-
}
|
|
1414
|
-
// @ts-ignore
|
|
1415
|
-
const _env$1 = (Object.assign({"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true},{LANG:process.env.LANG,ECOM_STORE_ID:process.env.ECOM_STORE_ID,SSR:true,BASE_URL:'/',}))
|
|
1416
|
-
|| (typeof process === 'object' && process?.env)
|
|
1417
|
-
|| globalThis;
|
|
1418
|
-
class ApiError extends Error {
|
|
1419
|
-
constructor(config, response, msg, isTimeout = false) {
|
|
1420
|
-
if (response) {
|
|
1421
|
-
super(response.statusText);
|
|
1422
|
-
this.data = response.data;
|
|
1423
|
-
this.statusCode = response.status;
|
|
1424
|
-
} else {
|
|
1425
|
-
super(msg || 'Request error');
|
|
1426
|
-
}
|
|
1427
|
-
this.config = config;
|
|
1428
|
-
this.response = response;
|
|
1429
|
-
this.isTimeout = isTimeout;
|
|
1430
|
-
}
|
|
1431
|
-
}
|
|
1432
|
-
const def = {
|
|
1433
|
-
middleware(config) {
|
|
1434
|
-
const headers = { ...config.headers };
|
|
1435
|
-
if (!config.isNoAuth) {
|
|
1436
|
-
if (config.accessToken) {
|
|
1437
|
-
// eslint-disable-next-line dot-notation
|
|
1438
|
-
headers['Authorization'] = `Bearer ${config.accessToken}`;
|
|
1439
|
-
} else {
|
|
1440
|
-
const authenticationId = config.authenticationId || _env$1.ECOM_AUTHENTICATION_ID;
|
|
1441
|
-
const apiKey = config.apiKey || _env$1.ECOM_API_KEY;
|
|
1442
|
-
if (authenticationId && apiKey) {
|
|
1443
|
-
const rawAuth = `${authenticationId}:${apiKey}`;
|
|
1444
|
-
const base64Auth = typeof Buffer === 'function'
|
|
1445
|
-
? Buffer.from(rawAuth).toString('base64') : btoa(rawAuth);
|
|
1446
|
-
// eslint-disable-next-line dot-notation
|
|
1447
|
-
headers['Authorization'] = `Basic ${base64Auth}`;
|
|
1448
|
-
}
|
|
1449
|
-
}
|
|
1450
|
-
}
|
|
1451
|
-
let url = config.baseUrl || _env$1.API_BASE_URL || 'https://ecomplus.io/v2';
|
|
1452
|
-
const { endpoint, params } = config;
|
|
1453
|
-
if (endpoint !== 'login'
|
|
1454
|
-
&& endpoint !== 'authenticate'
|
|
1455
|
-
&& endpoint !== 'ask-auth-callback'
|
|
1456
|
-
&& endpoint !== 'check-username') {
|
|
1457
|
-
const storeId = config.storeId || _env$1.ECOM_STORE_ID;
|
|
1458
|
-
if (!storeId) {
|
|
1459
|
-
throw new Error('`storeId` must be set in config or `ECOM_STORE_ID` env var');
|
|
1460
|
-
}
|
|
1461
|
-
url += `/:${storeId}`;
|
|
1462
|
-
const lang = config.lang || _env$1.ECOM_LANG;
|
|
1463
|
-
if (lang) {
|
|
1464
|
-
url += `,lang:${lang}`;
|
|
1465
|
-
}
|
|
1466
|
-
}
|
|
1467
|
-
url += `/${endpoint}`;
|
|
1468
|
-
if (params) {
|
|
1469
|
-
if (typeof params === 'string') {
|
|
1470
|
-
url += `?${params}`;
|
|
1471
|
-
} else if (typeof params === 'object') {
|
|
1472
|
-
const searchParams = new URLSearchParams();
|
|
1473
|
-
Object.keys(params).forEach((key) => {
|
|
1474
|
-
const values = params[key];
|
|
1475
|
-
if (Array.isArray(values)) {
|
|
1476
|
-
values.forEach((value) => {
|
|
1477
|
-
// https://github.com/microsoft/TypeScript/issues/32951
|
|
1478
|
-
searchParams.append(key, value);
|
|
1479
|
-
});
|
|
1480
|
-
} else {
|
|
1481
|
-
searchParams.append(key, values);
|
|
1482
|
-
}
|
|
1483
|
-
});
|
|
1484
|
-
url += `?${searchParams.toString()}`;
|
|
1485
|
-
}
|
|
1486
|
-
}
|
|
1487
|
-
return { url, headers };
|
|
1488
|
-
},
|
|
1489
|
-
};
|
|
1490
|
-
const setMiddleware = (middleware) => {
|
|
1491
|
-
def.middleware = middleware;
|
|
1492
|
-
};
|
|
1493
|
-
const api = async (config, retries = 0) => {
|
|
1494
|
-
const { url, headers } = def.middleware(config);
|
|
1495
|
-
const {
|
|
1496
|
-
method = 'get', timeout = 20000, maxRetries = 3, cacheMaxAge = 600000, // 10 minutes
|
|
1497
|
-
} = config;
|
|
1498
|
-
const canCache = method === 'get'
|
|
1499
|
-
&& (config.canCache || (config.canCache === undefined && _env$1.SSR));
|
|
1500
|
-
let cacheKey;
|
|
1501
|
-
if (canCache) {
|
|
1502
|
-
cacheKey = `${url}${JSON.stringify(headers)}`;
|
|
1503
|
-
const cached = globalThis.__apiCache[cacheKey];
|
|
1504
|
-
if (cached && Date.now() - cached.timestamp <= cacheMaxAge) {
|
|
1505
|
-
return { ...cached.res, config };
|
|
1506
|
-
}
|
|
1507
|
-
}
|
|
1508
|
-
const bodyObject = config.body || config.data;
|
|
1509
|
-
let body;
|
|
1510
|
-
if (bodyObject) {
|
|
1511
|
-
body = JSON.stringify(bodyObject);
|
|
1512
|
-
headers['Content-Type'] = 'application/json';
|
|
1513
|
-
headers['Content-Length'] = body.length.toString();
|
|
1514
|
-
}
|
|
1515
|
-
const abortController = new AbortController();
|
|
1516
|
-
let isTimeout = false;
|
|
1517
|
-
const timer = setTimeout(() => {
|
|
1518
|
-
abortController.abort();
|
|
1519
|
-
isTimeout = true;
|
|
1520
|
-
}, timeout);
|
|
1521
|
-
let response;
|
|
1522
|
-
try {
|
|
1523
|
-
response = await (config.fetch || fetch)(url, {
|
|
1524
|
-
method,
|
|
1525
|
-
headers,
|
|
1526
|
-
body,
|
|
1527
|
-
signal: abortController.signal,
|
|
1528
|
-
});
|
|
1529
|
-
} catch (err) {
|
|
1530
|
-
throw new ApiError(config, response, err.message, isTimeout);
|
|
1531
|
-
}
|
|
1532
|
-
clearTimeout(timer);
|
|
1533
|
-
if (response) {
|
|
1534
|
-
if (response.ok) {
|
|
1535
|
-
const res = {
|
|
1536
|
-
...response,
|
|
1537
|
-
data: await response.json(),
|
|
1538
|
-
};
|
|
1539
|
-
if (canCache && cacheKey) {
|
|
1540
|
-
globalThis.__apiCache[cacheKey] = {
|
|
1541
|
-
timestamp: Date.now(),
|
|
1542
|
-
res,
|
|
1543
|
-
};
|
|
1544
|
-
}
|
|
1545
|
-
return { ...res, config };
|
|
1546
|
-
}
|
|
1547
|
-
const { status } = response;
|
|
1548
|
-
if (maxRetries < retries && (status === 429 || status >= 500)) {
|
|
1549
|
-
const retryAfter = response.headers.get('retry-after');
|
|
1550
|
-
return new Promise((resolve, reject) => {
|
|
1551
|
-
setTimeout(() => {
|
|
1552
|
-
api(config, retries + 1).then(resolve).catch(reject);
|
|
1553
|
-
}, (retryAfter && parseInt(retryAfter, 10)) || 5000);
|
|
1554
|
-
});
|
|
1555
|
-
}
|
|
1556
|
-
}
|
|
1557
|
-
try {
|
|
1558
|
-
response.data = await response?.json();
|
|
1559
|
-
} catch (e) {
|
|
1560
|
-
//
|
|
1561
|
-
}
|
|
1562
|
-
throw new ApiError(config, response);
|
|
1563
|
-
};
|
|
1564
|
-
const get = (endpoint, config) => api({ ...config, endpoint });
|
|
1565
|
-
const post = (endpoint, body, config) => api({
|
|
1566
|
-
...config,
|
|
1567
|
-
method: 'post',
|
|
1568
|
-
endpoint,
|
|
1569
|
-
body,
|
|
1570
|
-
});
|
|
1571
|
-
const put = (endpoint, body, config) => api({
|
|
1572
|
-
...config,
|
|
1573
|
-
method: 'put',
|
|
1574
|
-
endpoint,
|
|
1575
|
-
body,
|
|
1576
|
-
});
|
|
1577
|
-
const patch = (endpoint, body, config) => api({
|
|
1578
|
-
...config,
|
|
1579
|
-
method: 'patch',
|
|
1580
|
-
endpoint,
|
|
1581
|
-
body,
|
|
1582
|
-
});
|
|
1583
|
-
const del = (endpoint, config) => api({
|
|
1584
|
-
...config,
|
|
1585
|
-
method: 'delete',
|
|
1586
|
-
endpoint,
|
|
1587
|
-
});
|
|
1588
|
-
api.get = get;
|
|
1589
|
-
api.post = post;
|
|
1590
|
-
api.put = put;
|
|
1591
|
-
api.patch = patch;
|
|
1592
|
-
api.del = del;
|
|
1593
|
-
api.delete = del;
|
|
1594
|
-
// # sourceMappingURL=api.js.map
|
|
1595
|
-
|
|
1596
|
-
const $$module1$4 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
1597
|
-
__proto__: null,
|
|
1598
|
-
default: api,
|
|
1599
|
-
setMiddleware,
|
|
1600
|
-
get,
|
|
1601
|
-
post,
|
|
1602
|
-
put,
|
|
1603
|
-
patch,
|
|
1604
|
-
del,
|
|
1605
|
-
ApiError
|
|
1606
|
-
}, Symbol.toStringTag, { value: 'Module' }));
|
|
1607
|
-
|
|
1608
|
-
const DEFAULT_LANG = 'pt_br';
|
|
1609
|
-
|
|
1610
|
-
const DEFAULT_CURRENCY = 'BRL';
|
|
1611
|
-
|
|
1612
|
-
const DEFAULT_CURRENCY_SYMBOL = 'R$';
|
|
1613
|
-
|
|
1614
|
-
const DEFAULT_COUNTRY_CODE = 'BR';
|
|
1615
|
-
// # sourceMappingURL=defaults.js.map
|
|
1616
|
-
|
|
1617
|
-
// @ts-ignore
|
|
1618
|
-
const _env = (Object.assign({"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true},{LANG:process.env.LANG,ECOM_STORE_ID:process.env.ECOM_STORE_ID,}))
|
|
1619
|
-
|| (typeof process === 'object' && process?.env)
|
|
1620
|
-
|| globalThis;
|
|
1621
|
-
const deepmerge = Deepmerge();
|
|
1622
|
-
const self = globalThis.__cloudCommerce || {
|
|
1623
|
-
config: {},
|
|
1624
|
-
};
|
|
1625
|
-
globalThis.__cloudCommerce = self;
|
|
1626
|
-
|
|
1627
|
-
const config = {
|
|
1628
|
-
get() {
|
|
1629
|
-
return {
|
|
1630
|
-
lang: _env.ECOM_LANG || DEFAULT_LANG,
|
|
1631
|
-
currency: _env.ECOM_CURRENCY || DEFAULT_CURRENCY,
|
|
1632
|
-
currencySymbol: _env.ECOM_CURRENCY_SYMBOL || DEFAULT_CURRENCY_SYMBOL,
|
|
1633
|
-
countryCode: _env.ECOM_COUNTRY_CODE || DEFAULT_COUNTRY_CODE,
|
|
1634
|
-
storeId: Number(_env.ECOM_STORE_ID),
|
|
1635
|
-
...self.config,
|
|
1636
|
-
};
|
|
1637
|
-
},
|
|
1638
|
-
set(config) {
|
|
1639
|
-
self.config = deepmerge(self.config, config);
|
|
1640
|
-
if (config.storeId) {
|
|
1641
|
-
_env.ECOM_STORE_ID = config.storeId;
|
|
1642
|
-
}
|
|
1643
|
-
},
|
|
1644
|
-
};
|
|
1645
|
-
// # sourceMappingURL=config.js.map
|
|
1646
|
-
|
|
1647
|
-
const _getConfig = () => {
|
|
1648
|
-
const {
|
|
1649
|
-
STOREFRONT_BASE_DIR,
|
|
1650
|
-
VITE_ECOM_STORE_ID,
|
|
1651
|
-
} = (Object.assign({"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true},{STOREFRONT_BASE_DIR:process.env.STOREFRONT_BASE_DIR,ECOM_STORE_ID:process.env.ECOM_STORE_ID,})) || process.env;
|
|
1652
|
-
|
|
1653
|
-
let baseDir;
|
|
1654
|
-
if (STOREFRONT_BASE_DIR) {
|
|
1655
|
-
const currentDir = fileURLToPath(new URL('.', import.meta.url));
|
|
1656
|
-
baseDir = resolve(currentDir, STOREFRONT_BASE_DIR);
|
|
1657
|
-
} else {
|
|
1658
|
-
baseDir = process.cwd();
|
|
1659
|
-
}
|
|
1660
|
-
const dirContent = resolve(baseDir, 'content');
|
|
1661
|
-
if (VITE_ECOM_STORE_ID) {
|
|
1662
|
-
config.set({ storeId: Number(VITE_ECOM_STORE_ID) });
|
|
1663
|
-
}
|
|
1664
|
-
|
|
1665
|
-
const {
|
|
1666
|
-
storeId,
|
|
1667
|
-
lang,
|
|
1668
|
-
countryCode,
|
|
1669
|
-
currency,
|
|
1670
|
-
currencySymbol,
|
|
1671
|
-
} = config.get();
|
|
1672
|
-
|
|
1673
|
-
const cms = (filename) => {
|
|
1674
|
-
if (filename.endsWith('/')) {
|
|
1675
|
-
const dirColl = resolve(dirContent, filename);
|
|
1676
|
-
return fs.readdirSync(dirColl).map((_filename) => _filename.replace('.json', ''));
|
|
1677
|
-
}
|
|
1678
|
-
const filepath = resolve(dirContent, `${filename}.json`);
|
|
1679
|
-
return JSON.parse(fs.readFileSync(filepath, 'utf8'));
|
|
1680
|
-
};
|
|
1681
|
-
|
|
1682
|
-
const settings = cms('settings');
|
|
1683
|
-
const { domain } = settings;
|
|
1684
|
-
const primaryColor = settings.primary_color || '#20c997';
|
|
1685
|
-
const secondaryColor = settings.secondary_color || '#343a40';
|
|
1686
|
-
|
|
1687
|
-
return {
|
|
1688
|
-
storeId,
|
|
1689
|
-
lang,
|
|
1690
|
-
countryCode,
|
|
1691
|
-
currency,
|
|
1692
|
-
currencySymbol,
|
|
1693
|
-
domain,
|
|
1694
|
-
primaryColor,
|
|
1695
|
-
secondaryColor,
|
|
1696
|
-
settings,
|
|
1697
|
-
cms,
|
|
1698
|
-
};
|
|
1699
|
-
};
|
|
1700
|
-
|
|
1701
|
-
const getConfig = _getConfig;
|
|
1702
|
-
if (!globalThis.api_prefetch_endpoints) {
|
|
1703
|
-
globalThis.api_prefetch_endpoints = ["categories"];
|
|
1704
|
-
}
|
|
1705
|
-
const setResponseCache = (Astro, maxAge, sMaxAge) => {
|
|
1706
|
-
const headerName = Object.assign({"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true}, { SSR: true }).PROD ? "Cache-Control" : "X-Cache-Control";
|
|
1707
|
-
let cacheControl = `public, max-age=${maxAge}, must-revalidate`;
|
|
1708
|
-
if (sMaxAge) {
|
|
1709
|
-
cacheControl += `, s-maxage=${sMaxAge}, stale-while-revalidate=86400`;
|
|
1710
|
-
}
|
|
1711
|
-
Astro.response.headers.set(headerName, cacheControl);
|
|
1712
|
-
};
|
|
1713
|
-
const loadPageContext = async (Astro, {
|
|
1714
|
-
cmsCollection,
|
|
1715
|
-
apiPrefetchEndpoints = globalThis.api_prefetch_endpoints
|
|
1716
|
-
} = {}) => {
|
|
1717
|
-
const urlPath = Astro.url.pathname;
|
|
1718
|
-
const { slug } = Astro.params;
|
|
1719
|
-
const config = getConfig();
|
|
1720
|
-
let cmsContent;
|
|
1721
|
-
let apiResource;
|
|
1722
|
-
let apiDoc;
|
|
1723
|
-
const apiState = {};
|
|
1724
|
-
const apiOptions = {
|
|
1725
|
-
fetch,
|
|
1726
|
-
isNoAuth: true
|
|
1727
|
-
};
|
|
1728
|
-
const apiFetchings = [
|
|
1729
|
-
null,
|
|
1730
|
-
...apiPrefetchEndpoints.map((endpoint) => api.get(endpoint, apiOptions))
|
|
1731
|
-
];
|
|
1732
|
-
if (slug) {
|
|
1733
|
-
if (cmsCollection) {
|
|
1734
|
-
cmsContent = config.cms(`${cmsCollection}/${slug}`);
|
|
1735
|
-
} else {
|
|
1736
|
-
apiFetchings[0] = api.get(`slugs/${slug}`, apiOptions);
|
|
1737
|
-
}
|
|
1738
|
-
}
|
|
1739
|
-
try {
|
|
1740
|
-
const [slugResponse, ...prefetchResponses] = await Promise.all(apiFetchings);
|
|
1741
|
-
if (slugResponse) {
|
|
1742
|
-
apiResource = slugResponse.data.resource;
|
|
1743
|
-
apiDoc = slugResponse.data.doc;
|
|
1744
|
-
apiState[`${apiResource}/${apiDoc._id}`] = apiDoc;
|
|
1745
|
-
}
|
|
1746
|
-
prefetchResponses.forEach(({ config: { endpoint }, data }) => {
|
|
1747
|
-
apiState[endpoint] = data.result || data;
|
|
1748
|
-
});
|
|
1749
|
-
} catch (err) {
|
|
1750
|
-
const error = err;
|
|
1751
|
-
const status = error.statusCode || 500;
|
|
1752
|
-
if (status === 404) {
|
|
1753
|
-
if (urlPath.endsWith("/")) {
|
|
1754
|
-
err.redirectUrl = urlPath.slice(0, -1);
|
|
1755
|
-
err.astroResponse = Astro.redirect(err.redirectUrl);
|
|
1756
|
-
throw err;
|
|
1757
|
-
}
|
|
1758
|
-
setResponseCache(Astro, 120, 300);
|
|
1759
|
-
} else {
|
|
1760
|
-
console.error(error);
|
|
1761
|
-
setResponseCache(Astro, 30);
|
|
1762
|
-
Astro.response.headers.set("X-SSR-Error", error.message);
|
|
1763
|
-
}
|
|
1764
|
-
Astro.response.status = status;
|
|
1765
|
-
err.responseHTML = `<head>
|
|
1766
|
-
<meta http-equiv="refresh" content="0;
|
|
1767
|
-
url=/fallback?status=${status}&url=${encodeURIComponent(urlPath)}"/>
|
|
1768
|
-
</head>
|
|
1769
|
-
<body></body>`;
|
|
1770
|
-
throw err;
|
|
1771
|
-
}
|
|
1772
|
-
if (urlPath === "/fallback") {
|
|
1773
|
-
setResponseCache(Astro, 3600, 86400);
|
|
1774
|
-
} else {
|
|
1775
|
-
setResponseCache(Astro, 120, 600);
|
|
1776
|
-
}
|
|
1777
|
-
return {
|
|
1778
|
-
...config,
|
|
1779
|
-
cmsContent,
|
|
1780
|
-
apiResource,
|
|
1781
|
-
apiDoc,
|
|
1782
|
-
apiState
|
|
1783
|
-
};
|
|
1784
|
-
};
|
|
1785
|
-
|
|
1786
|
-
const $$module1$3 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
1787
|
-
__proto__: null,
|
|
1788
|
-
default: loadPageContext,
|
|
1789
|
-
getConfig,
|
|
1790
|
-
loadPageContext
|
|
1791
|
-
}, Symbol.toStringTag, { value: 'Module' }));
|
|
1792
|
-
|
|
1793
|
-
const $$metadata$c = createMetadata("/@fs/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/BaseHead.astro", { modules: [{ module: $$module1$5, specifier: "@ecomplus/utils", assert: {} }], hydratedComponents: [], clientOnlyComponents: [], hydrationDirectives: /* @__PURE__ */ new Set([]), hoisted: [] });
|
|
1794
|
-
const $$Astro$c = createAstro("/@fs/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/BaseHead.astro", "https://storefront-demo.e-com.plus/", "file:///home/leo/code/ecomplus/cloud-commerce/packages/storefront/");
|
|
1795
|
-
const $$BaseHead = createComponent(async ($$result, $$props, $$slots) => {
|
|
1796
|
-
const Astro2 = $$result.createAstro($$Astro$c, $$props, $$slots);
|
|
1797
|
-
Astro2.self = $$BaseHead;
|
|
1798
|
-
const {
|
|
1799
|
-
storeId,
|
|
1800
|
-
cmsContent,
|
|
1801
|
-
apiDoc,
|
|
1802
|
-
lang,
|
|
1803
|
-
domain,
|
|
1804
|
-
primaryColor,
|
|
1805
|
-
settings,
|
|
1806
|
-
cms
|
|
1807
|
-
} = Astro2.props.pageContext;
|
|
1808
|
-
const state = apiDoc || cmsContent || {};
|
|
1809
|
-
const title = state.meta_title || state.name || state.title || Astro2.props.title || settings.name;
|
|
1810
|
-
const description = state.meta_description || state.short_description || settings.description;
|
|
1811
|
-
const canonicalUrl = new URL(Astro2.url.pathname, Astro2.site || `https://${domain}`);
|
|
1812
|
-
const cmsSocial = cms("social");
|
|
1813
|
-
const ogLocale = lang.length === 2 ? lang : lang.substring(0, 2) + lang.slice(3).toUpperCase();
|
|
1814
|
-
let ogImage;
|
|
1815
|
-
if (apiDoc) {
|
|
1816
|
-
const picture = $$module1__default.img(state, null, "zoom");
|
|
1817
|
-
ogImage = picture && picture.url;
|
|
1818
|
-
}
|
|
1819
|
-
if (!ogImage) {
|
|
1820
|
-
if (cmsSocial.og_image) {
|
|
1821
|
-
ogImage = cmsSocial.og_image.charAt(0) === "/" ? `https://${domain}${cmsSocial.og_image}` : cmsSocial.og_image;
|
|
1822
|
-
}
|
|
1823
|
-
} else {
|
|
1824
|
-
ogImage = ogImage.replace(/(\w+\.)?(ecoms\d)\.com/i, "$2-nyc3.nyc3.cdn.digitaloceanspaces.com");
|
|
1825
|
-
}
|
|
1826
|
-
return renderTemplate`<meta charset="UTF-8">
|
|
1827
|
-
<meta name="viewport" content="width=device-width">
|
|
1828
|
-
<meta name="theme-color"${addAttribute(primaryColor, "content")}>
|
|
1829
|
-
<link rel="icon"${addAttribute(settings.favicon || "/favicon.ico", "href")}>
|
|
1830
|
-
${renderTemplate`<link rel="manifest" href="/manifest.webmanifest">`}
|
|
1831
|
-
<title>${title}</title>
|
|
1832
|
-
<meta name="description"${addAttribute(description, "content")}>
|
|
1833
|
-
<meta name="author"${addAttribute(settings.name, "content")}>
|
|
1834
|
-
<meta name="generator"${addAttribute(Astro2.generator, "content")}>
|
|
1835
|
-
<link rel="canonical"${addAttribute(canonicalUrl, "href")}>
|
|
1836
|
-
<link rel="apple-touch-icon"${addAttribute(settings.icon, "href")}>
|
|
1837
|
-
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
1838
|
-
<meta name="apple-mobile-web-app-status-bar-style" content="default">
|
|
1839
|
-
|
|
1840
|
-
<meta property="og:site_name"${addAttribute(settings.name, "content")}>
|
|
1841
|
-
<meta property="og:url"${addAttribute(canonicalUrl, "content")}>
|
|
1842
|
-
<meta property="og:title"${addAttribute(title, "content")}>
|
|
1843
|
-
<meta property="og:description"${addAttribute(description, "content")}>
|
|
1844
|
-
<meta property="og:type" content="website">
|
|
1845
|
-
<meta property="og:locale"${addAttribute(ogLocale, "content")}>
|
|
1846
|
-
${ogImage && renderTemplate`<meta property="og:image"${addAttribute(ogImage, "content")}>`}
|
|
1847
|
-
${cmsSocial.fb_app_id && renderTemplate`<meta property="fb:app_id"${addAttribute(cmsSocial.fb_app_id, "content")}>`}
|
|
1848
|
-
<meta name="twitter:card" content="summary">
|
|
1849
|
-
${cmsSocial.twitter_username && renderTemplate`<meta name="twitter:site"${addAttribute(cmsSocial.twitter_username, "content")}>`}
|
|
1850
|
-
|
|
1851
|
-
<link rel="preconnect" href="https://ecomplus.io/" crossorigin>
|
|
1852
|
-
<link rel="dns-prefetch" href="https://ecomplus.io/">
|
|
1853
|
-
<meta name="ecom-store-id"${addAttribute(String(storeId), "content")}>
|
|
1854
|
-
`;
|
|
1855
|
-
});
|
|
1856
|
-
|
|
1857
|
-
const $$file$c = "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/BaseHead.astro";
|
|
1858
|
-
const $$url$c = undefined;
|
|
1859
|
-
|
|
1860
|
-
const $$module1$2 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
1861
|
-
__proto__: null,
|
|
1862
|
-
$$metadata: $$metadata$c,
|
|
1863
|
-
default: $$BaseHead,
|
|
1864
|
-
file: $$file$c,
|
|
1865
|
-
url: $$url$c
|
|
1866
|
-
}, Symbol.toStringTag, { value: 'Module' }));
|
|
1867
|
-
|
|
1868
|
-
var __freeze = Object.freeze;
|
|
1869
|
-
var __defProp = Object.defineProperty;
|
|
1870
|
-
var __template = (cooked, raw) => __freeze(__defProp(cooked, "raw", { value: __freeze(raw || cooked.slice()) }));
|
|
1871
|
-
var _a;
|
|
1872
|
-
const $$metadata$b = createMetadata("/@fs/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/BaseStateJson.astro", { modules: [{ module: $$module1$5, specifier: "@ecomplus/utils", assert: {} }], hydratedComponents: [], clientOnlyComponents: [], hydrationDirectives: /* @__PURE__ */ new Set([]), hoisted: [] });
|
|
1873
|
-
const $$Astro$b = createAstro("/@fs/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/BaseStateJson.astro", "https://storefront-demo.e-com.plus/", "file:///home/leo/code/ecomplus/cloud-commerce/packages/storefront/");
|
|
1874
|
-
const $$BaseStateJson = createComponent(async ($$result, $$props, $$slots) => {
|
|
1875
|
-
const Astro2 = $$result.createAstro($$Astro$b, $$props, $$slots);
|
|
1876
|
-
Astro2.self = $$BaseStateJson;
|
|
1877
|
-
const { pageContext } = Astro2.props;
|
|
1878
|
-
const {
|
|
1879
|
-
storeId,
|
|
1880
|
-
apiResource,
|
|
1881
|
-
apiDoc,
|
|
1882
|
-
lang,
|
|
1883
|
-
countryCode,
|
|
1884
|
-
currency,
|
|
1885
|
-
currencySymbol,
|
|
1886
|
-
domain,
|
|
1887
|
-
settings
|
|
1888
|
-
} = pageContext;
|
|
1889
|
-
let inlineClientJS = `
|
|
1890
|
-
window.storefront = ${JSON.stringify({
|
|
1891
|
-
settings: {
|
|
1892
|
-
...settings,
|
|
1893
|
-
store_id: storeId,
|
|
1894
|
-
lang,
|
|
1895
|
-
country_code: countryCode,
|
|
1896
|
-
currency,
|
|
1897
|
-
currency_symbol: currencySymbol
|
|
1898
|
-
}
|
|
1899
|
-
})};`;
|
|
1900
|
-
if (apiDoc) {
|
|
1901
|
-
if (typeof apiDoc.price === "number") {
|
|
1902
|
-
apiDoc.price = $$module1__default.price(apiDoc);
|
|
1903
|
-
}
|
|
1904
|
-
const slimDocRegex = globalThis.storefront_slim_doc_regex || /body|meta|records|description|i18n/;
|
|
1905
|
-
const minifyApiDoc = (nestedDoc) => {
|
|
1906
|
-
if (typeof nestedDoc === "object" && nestedDoc) {
|
|
1907
|
-
if (Array.isArray(nestedDoc)) {
|
|
1908
|
-
nestedDoc.forEach((item) => minifyApiDoc(item));
|
|
1909
|
-
} else {
|
|
1910
|
-
Object.keys(nestedDoc).forEach((field) => {
|
|
1911
|
-
if (slimDocRegex.test(field)) {
|
|
1912
|
-
delete nestedDoc[field];
|
|
1913
|
-
} else {
|
|
1914
|
-
minifyApiDoc(nestedDoc[field]);
|
|
1915
|
-
}
|
|
1916
|
-
});
|
|
1917
|
-
}
|
|
1918
|
-
}
|
|
1919
|
-
return nestedDoc;
|
|
1920
|
-
};
|
|
1921
|
-
inlineClientJS += `
|
|
1922
|
-
window.storefront.context = ${JSON.stringify({
|
|
1923
|
-
resource: apiResource,
|
|
1924
|
-
doc: minifyApiDoc({ ...apiDoc }),
|
|
1925
|
-
timestamp: Date.now()
|
|
1926
|
-
})};`;
|
|
1927
|
-
}
|
|
1928
|
-
const inlineJSONLd = JSON.stringify({
|
|
1929
|
-
"@context": "http://schema.org",
|
|
1930
|
-
"@type": "Organization",
|
|
1931
|
-
name: settings.name,
|
|
1932
|
-
url: `https://${domain}/`,
|
|
1933
|
-
logo: `https://${domain}${settings.logo}`
|
|
1934
|
-
});
|
|
1935
|
-
return renderTemplate(_a || (_a = __template(["<script>", '<\/script>\n<script type="application/ld+json">', "<\/script>\n"])), unescapeHTML(inlineClientJS), unescapeHTML(inlineJSONLd));
|
|
1936
|
-
});
|
|
1937
|
-
|
|
1938
|
-
const $$file$b = "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/BaseStateJson.astro";
|
|
1939
|
-
const $$url$b = undefined;
|
|
1940
|
-
|
|
1941
|
-
const $$module2$3 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
1942
|
-
__proto__: null,
|
|
1943
|
-
$$metadata: $$metadata$b,
|
|
1944
|
-
default: $$BaseStateJson,
|
|
1945
|
-
file: $$file$b,
|
|
1946
|
-
url: $$url$b
|
|
1947
|
-
}, Symbol.toStringTag, { value: 'Module' }));
|
|
1948
|
-
|
|
1949
|
-
const $$metadata$a = createMetadata("/@fs/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/BaseBody.astro", { modules: [{ module: $$module1$6, specifier: "color", assert: {} }], hydratedComponents: [], clientOnlyComponents: [], hydrationDirectives: /* @__PURE__ */ new Set([]), hoisted: [{ type: "inline", value: `
|
|
1950
|
-
import { registerSW } from 'virtual:pwa-register';
|
|
1951
|
-
import { initializeApp } from 'firebase/app';
|
|
1952
|
-
registerSW();
|
|
1953
|
-
const firebaseConfig = window.firebaseConfig || {
|
|
1954
|
-
apiKey: "AIzaSyCrVzemDgpyp9i6ni7Yc5ZuEVfXYwl-4J0",
|
|
1955
|
-
authDomain: "ecom2-002.firebaseapp.com",
|
|
1956
|
-
projectId: "ecom2-002",
|
|
1957
|
-
storageBucket: "ecom2-002.appspot.com",
|
|
1958
|
-
messagingSenderId: "402807248219",
|
|
1959
|
-
appId: "1:402807248219:web:cf7d57759751e74776367e",
|
|
1960
|
-
measurementId: "G-SC592CE0GB"
|
|
1961
|
-
};
|
|
1962
|
-
initializeApp(firebaseConfig);
|
|
1963
|
-
` }] });
|
|
1964
|
-
const $$Astro$a = createAstro("/@fs/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/BaseBody.astro", "https://storefront-demo.e-com.plus/", "file:///home/leo/code/ecomplus/cloud-commerce/packages/storefront/");
|
|
1965
|
-
const $$BaseBody = createComponent(async ($$result, $$props, $$slots) => {
|
|
1966
|
-
const Astro2 = $$result.createAstro($$Astro$a, $$props, $$slots);
|
|
1967
|
-
Astro2.self = $$BaseBody;
|
|
1968
|
-
const { pageContext } = Astro2.props;
|
|
1969
|
-
const { primaryColor, secondaryColor } = pageContext;
|
|
1970
|
-
const brandColors = {
|
|
1971
|
-
primary: primaryColor,
|
|
1972
|
-
secondary: secondaryColor,
|
|
1973
|
-
...globalThis.storefront_brand_colors
|
|
1974
|
-
};
|
|
1975
|
-
const colorVariants = {
|
|
1976
|
-
"50": -0.75,
|
|
1977
|
-
"100": -0.5,
|
|
1978
|
-
"200": -0.33,
|
|
1979
|
-
"300": -0.21,
|
|
1980
|
-
"400": -0.1,
|
|
1981
|
-
"500": 0,
|
|
1982
|
-
"600": 0.1,
|
|
1983
|
-
"700": 0.16,
|
|
1984
|
-
"800": 0.22,
|
|
1985
|
-
"900": 0.5,
|
|
1986
|
-
...globalThis.storefront_color_variants
|
|
1987
|
-
};
|
|
1988
|
-
const colorCSSVars = {};
|
|
1989
|
-
Object.keys(brandColors).forEach((colorName) => {
|
|
1990
|
-
const color = $$module1__default$1(brandColors[colorName]);
|
|
1991
|
-
Object.keys(colorVariants).forEach((colorVariant) => {
|
|
1992
|
-
const colorShift = colorVariants[colorVariant];
|
|
1993
|
-
const colorLabel = `${colorName}-${colorVariant}`;
|
|
1994
|
-
colorCSSVars[colorLabel] = color.darken(colorShift).hex();
|
|
1995
|
-
if (Number(colorVariant) > 100 && Number(colorVariant) < 900) {
|
|
1996
|
-
colorCSSVars[`${colorLabel}-yiq`] = color.isLight() ? "var(--yiq-text-dark)" : "var(--yiq-text-light)";
|
|
1997
|
-
colorCSSVars[`${colorLabel}-rgb`] = `${color.red()}, ${color.green()}, ${color.blue()}`;
|
|
1998
|
-
}
|
|
1999
|
-
});
|
|
2000
|
-
});
|
|
2001
|
-
const $$definedVars = defineStyleVars([colorCSSVars]);
|
|
2002
|
-
const STYLES = [
|
|
2003
|
-
{ props: { "is:global": true, "define:vars": colorCSSVars }, children: `:root {
|
|
2004
|
-
--content-max-width: 80rem;
|
|
2005
|
-
--white: #fff;
|
|
2006
|
-
--gray-50: #f9fafb;
|
|
2007
|
-
--gray-200: #e5e7eb;
|
|
2008
|
-
--gray-700: #374151;
|
|
2009
|
-
--gray-800: #1f2937;
|
|
2010
|
-
--gray-900: #111827;
|
|
2011
|
-
--surface-color: var(--gray-50);
|
|
2012
|
-
--surface-border-color: var(--gray-200);
|
|
2013
|
-
--yiq-text-light: var(--white);
|
|
2014
|
-
--yiq-text-dark: var(--gray-900);
|
|
2015
|
-
}
|
|
2016
|
-
body,
|
|
2017
|
-
body [data-theme=light],
|
|
2018
|
-
body [data-theme=dark] {
|
|
2019
|
-
--primary: var(--primary-500);
|
|
2020
|
-
--primary-hover: var(--primary-700);
|
|
2021
|
-
--primary-focus: rgba(var(--primary-200-rgb), 0.2);
|
|
2022
|
-
--primary-inverse: var(--primary-500-yiq);
|
|
2023
|
-
--secondary: var(--secondary-500);
|
|
2024
|
-
--secondary-hover: var(--secondary-700);
|
|
2025
|
-
--secondary-focus: rgba(var(--secondary-200-rgb), 0.2);
|
|
2026
|
-
--secondary-inverse: var(--secondary-500-yiq);
|
|
2027
|
-
}
|
|
2028
|
-
@media only screen and (prefers-color-scheme: dark) {
|
|
2029
|
-
:root:not([data-theme=light]) {
|
|
2030
|
-
--surface-color: var(--gray-800);
|
|
2031
|
-
--surface-border-color: var(--gray-700);
|
|
2032
|
-
}
|
|
2033
|
-
:root:not([data-theme=light]) a {
|
|
2034
|
-
--color: var(--primary-200);
|
|
2035
|
-
}
|
|
2036
|
-
:root:not([data-theme=light]) a:is([aria-current], :hover, :active, :focus) {
|
|
2037
|
-
--color: var(--primary-400);
|
|
2038
|
-
}
|
|
2039
|
-
}
|
|
2040
|
-
body {
|
|
2041
|
-
overflow-x: hidden;
|
|
2042
|
-
}` }
|
|
2043
|
-
];
|
|
2044
|
-
for (const STYLE of STYLES)
|
|
2045
|
-
$$result.styles.add(STYLE);
|
|
2046
|
-
return renderTemplate`${maybeRenderHead($$result)}<body${addAttribute($$definedVars, "style")}>
|
|
2047
|
-
${renderSlot($$result, $$slots["default"])}
|
|
2048
|
-
|
|
2049
|
-
${renderSlot($$result, $$slots["before-body-end"])}
|
|
2050
|
-
|
|
2051
|
-
</body>`;
|
|
2052
|
-
});
|
|
2053
|
-
|
|
2054
|
-
const $$file$a = "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/BaseBody.astro";
|
|
2055
|
-
const $$url$a = undefined;
|
|
2056
|
-
|
|
2057
|
-
const $$module3$4 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2058
|
-
__proto__: null,
|
|
2059
|
-
$$metadata: $$metadata$a,
|
|
2060
|
-
default: $$BaseBody,
|
|
2061
|
-
file: $$file$a,
|
|
2062
|
-
url: $$url$a
|
|
2063
|
-
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2064
|
-
|
|
2065
|
-
const $$metadata$9 = createMetadata("/@fs/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/Base.astro", { modules: [{ module: $$module1$2, specifier: "./BaseHead.astro", assert: {} }, { module: $$module2$3, specifier: "./BaseStateJson.astro", assert: {} }, { module: $$module3$4, specifier: "./BaseBody.astro", assert: {} }], hydratedComponents: [], clientOnlyComponents: [], hydrationDirectives: /* @__PURE__ */ new Set([]), hoisted: [] });
|
|
2066
|
-
const $$Astro$9 = createAstro("/@fs/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/Base.astro", "https://storefront-demo.e-com.plus/", "file:///home/leo/code/ecomplus/cloud-commerce/packages/storefront/");
|
|
2067
|
-
const $$Base = createComponent(async ($$result, $$props, $$slots) => {
|
|
2068
|
-
const Astro2 = $$result.createAstro($$Astro$9, $$props, $$slots);
|
|
2069
|
-
Astro2.self = $$Base;
|
|
2070
|
-
const { pageContext, title } = Astro2.props;
|
|
2071
|
-
const { cms } = pageContext;
|
|
2072
|
-
const cmsCustomCode = cms("code");
|
|
2073
|
-
return renderTemplate`<head>
|
|
2074
|
-
${renderComponent($$result, "BaseHead", $$BaseHead, { "pageContext": pageContext, "title": title })}
|
|
2075
|
-
${renderComponent($$result, "BaseStateJson", $$BaseStateJson, { "pageContext": pageContext })}
|
|
2076
|
-
${renderSlot($$result, $$slots["before-head-end"], renderTemplate`
|
|
2077
|
-
${cmsCustomCode.css && renderTemplate`<style>{cmsCustomCode.css}</style>`}
|
|
2078
|
-
`)}${renderHead($$result)}</head>${cmsCustomCode.html_head && renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": () => renderTemplate`${unescapeHTML(cmsCustomCode.html_head)}` })}`}
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
${renderComponent($$result, "BaseBody", $$BaseBody, { "pageContext": pageContext }, { "default": () => renderTemplate`${renderSlot($$result, $$slots["default"])}${renderSlot($$result, $$slots["before-body-end"], renderTemplate`
|
|
2082
|
-
${cmsCustomCode.html_body && renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": () => renderTemplate`${unescapeHTML(cmsCustomCode.html_body)}` })}`}
|
|
2083
|
-
`)}` })}`;
|
|
2084
|
-
});
|
|
2085
|
-
|
|
2086
|
-
const $$file$9 = "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/Base.astro";
|
|
2087
|
-
const $$url$9 = undefined;
|
|
2088
|
-
|
|
2089
|
-
const $$module1$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2090
|
-
__proto__: null,
|
|
2091
|
-
$$metadata: $$metadata$9,
|
|
2092
|
-
default: $$Base,
|
|
2093
|
-
file: $$file$9,
|
|
2094
|
-
url: $$url$9
|
|
2095
|
-
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2096
|
-
|
|
2097
|
-
const tryImageSize = (src) => {
|
|
2098
|
-
let dimensions = {};
|
|
2099
|
-
if (typeof src === "string" && src.startsWith("/")) {
|
|
2100
|
-
try {
|
|
2101
|
-
dimensions = imageSize(`public${src}`);
|
|
2102
|
-
} catch (e) {
|
|
2103
|
-
dimensions = {};
|
|
2104
|
-
}
|
|
2105
|
-
}
|
|
2106
|
-
return dimensions;
|
|
2107
|
-
};
|
|
2108
|
-
const getImageAttrs = async (attrs) => {
|
|
2109
|
-
if (!attrs.width || !attrs.height) {
|
|
2110
|
-
const { width, height } = tryImageSize(attrs.src);
|
|
2111
|
-
if (width) {
|
|
2112
|
-
const aspectRatio = height ? width / height : 1;
|
|
2113
|
-
if (!attrs.width) {
|
|
2114
|
-
attrs.width = attrs.height ? Math.round(attrs.height * aspectRatio) : width;
|
|
2115
|
-
}
|
|
2116
|
-
if (!attrs.height) {
|
|
2117
|
-
attrs.height = Math.round(attrs.width / aspectRatio);
|
|
2118
|
-
}
|
|
2119
|
-
}
|
|
2120
|
-
}
|
|
2121
|
-
return attrs;
|
|
2122
|
-
};
|
|
2123
|
-
|
|
2124
|
-
const $$module1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2125
|
-
__proto__: null,
|
|
2126
|
-
default: getImageAttrs,
|
|
2127
|
-
tryImageSize,
|
|
2128
|
-
getImageAttrs
|
|
2129
|
-
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2130
|
-
|
|
2131
|
-
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
2132
|
-
__name: "TopBar",
|
|
2133
|
-
__ssrInlineRender: true,
|
|
2134
|
-
props: {
|
|
2135
|
-
marketingStripe: null,
|
|
2136
|
-
hasNavbar: { type: Boolean, default: true },
|
|
2137
|
-
pageLinks: null,
|
|
2138
|
-
contacts: null,
|
|
2139
|
-
hasPhoneLinks: { type: Boolean, default: true },
|
|
2140
|
-
hasNetworkLinks: { type: Boolean },
|
|
2141
|
-
socialNetworks: { default() {
|
|
2142
|
-
return ["facebook", "twitter", "youtube", "pinterest", "instagram", "tiktok"];
|
|
2143
|
-
} },
|
|
2144
|
-
countdownClass: null,
|
|
2145
|
-
pageLinksClass: null,
|
|
2146
|
-
contactLinksClass: null,
|
|
2147
|
-
socialNetworksClass: null
|
|
2148
|
-
},
|
|
2149
|
-
setup(__props) {
|
|
2150
|
-
return (_ctx, _push, _parent, _attrs) => {
|
|
2151
|
-
_push(`<div${ssrRenderAttrs(mergeProps({ class: "top-bar w-full bg-surface" }, _attrs))}>`);
|
|
2152
|
-
ssrRenderSlot(_ctx.$slots, "countdown", { marketingStripe: __props.marketingStripe, countdownClass: __props.countdownClass }, () => {
|
|
2153
|
-
if (__props.marketingStripe && __props.marketingStripe.text) {
|
|
2154
|
-
ssrRenderVNode(_push, createVNode$1(resolveDynamicComponent(__props.marketingStripe.link ? "a" : "div"), {
|
|
2155
|
-
class: ["top-bar__countdown block text-sm text-center p-1 whitespace-nowrap overflow-x-auto", [__props.countdownClass, __props.marketingStripe.link ? "primary" : "secondary"]],
|
|
2156
|
-
href: __props.marketingStripe.link
|
|
2157
|
-
}, {
|
|
2158
|
-
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
2159
|
-
if (_push2) {
|
|
2160
|
-
_push2(`${ssrInterpolate(__props.marketingStripe.text)}`);
|
|
2161
|
-
} else {
|
|
2162
|
-
return [
|
|
2163
|
-
createTextVNode(toDisplayString(__props.marketingStripe.text), 1)
|
|
2164
|
-
];
|
|
2165
|
-
}
|
|
2166
|
-
}),
|
|
2167
|
-
_: 1
|
|
2168
|
-
}), _parent);
|
|
2169
|
-
} else {
|
|
2170
|
-
_push(`<!---->`);
|
|
2171
|
-
}
|
|
2172
|
-
}, _push, _parent);
|
|
2173
|
-
if (__props.hasNavbar) {
|
|
2174
|
-
_push(`<div class="top-bar__nav hidden md:block py-2"><div class="container"><div class="flex items-center lg:px-2 xl:px-4"><div class="grow text-xs">`);
|
|
2175
|
-
ssrRenderSlot(_ctx.$slots, "contacts-container", { pageLinks: __props.pageLinks, pageLinksClass: __props.pageLinksClass }, () => {
|
|
2176
|
-
if (__props.pageLinks) {
|
|
2177
|
-
_push(`<nav class="${ssrRenderClass([__props.pageLinksClass, "top-bar__page-links inline-block mr-4 font-semibold"])}"><!--[-->`);
|
|
2178
|
-
ssrRenderList(__props.pageLinks, ({ link, title }, i) => {
|
|
2179
|
-
_push(`<a class="mr-2 lg:mr-3"${ssrRenderAttr("href", link)}>${ssrInterpolate(title)}</a>`);
|
|
2180
|
-
});
|
|
2181
|
-
_push(`<!--]--></nav>`);
|
|
2182
|
-
} else {
|
|
2183
|
-
_push(`<!---->`);
|
|
2184
|
-
}
|
|
2185
|
-
}, _push, _parent);
|
|
2186
|
-
ssrRenderSlot(_ctx.$slots, "contact-links", { contacts: __props.contacts, hasPhoneLinks: __props.hasPhoneLinks, contactLinksClass: __props.contactLinksClass }, () => {
|
|
2187
|
-
if (__props.hasPhoneLinks) {
|
|
2188
|
-
_push(`<div class="${ssrRenderClass([__props.contactLinksClass, "top-bar__contact-links inline-block"])}">`);
|
|
2189
|
-
if (__props.contacts.whatsapp) {
|
|
2190
|
-
_push(`<a href="javascript:;" target="_blank" rel="noopener"${ssrRenderAttr("data-whatsapp-tel", __props.contacts.whatsapp.replace(/\D/g, ""))} class="mr-2"><i class="i-whatsapp"></i> ${ssrInterpolate(__props.contacts.whatsapp)}</a>`);
|
|
2191
|
-
} else {
|
|
2192
|
-
_push(`<!---->`);
|
|
2193
|
-
}
|
|
2194
|
-
if (__props.contacts.phone) {
|
|
2195
|
-
_push(`<a${ssrRenderAttr("href", `tel:+${__props.contacts.phone.replace(/\D/g, "")}`)} target="_blank" rel="noopener" class="mr-2"><i class="i-phone"></i> ${ssrInterpolate(__props.contacts.phone)}</a>`);
|
|
2196
|
-
} else {
|
|
2197
|
-
_push(`<!---->`);
|
|
2198
|
-
}
|
|
2199
|
-
_push(`</div>`);
|
|
2200
|
-
} else {
|
|
2201
|
-
_push(`<!---->`);
|
|
2202
|
-
}
|
|
2203
|
-
}, _push, _parent);
|
|
2204
|
-
_push(`</div>`);
|
|
2205
|
-
ssrRenderSlot(_ctx.$slots, "social-networks", { contacts: __props.contacts, hasNetworkLinks: __props.hasNetworkLinks, socialNetworksClass: __props.socialNetworksClass }, () => {
|
|
2206
|
-
if (__props.hasNetworkLinks) {
|
|
2207
|
-
_push(`<div class="top-bar__social-networks leading-none"><!--[-->`);
|
|
2208
|
-
ssrRenderList(__props.socialNetworks, (network) => {
|
|
2209
|
-
_push(`<!--[-->`);
|
|
2210
|
-
if (__props.contacts[network]) {
|
|
2211
|
-
_push(`<a${ssrRenderAttr("href", __props.contacts[network])} target="_blank" rel="noopener" class="ml-1">`);
|
|
2212
|
-
if (network === "facebook") {
|
|
2213
|
-
_push(`<i class="i-facebook"></i>`);
|
|
2214
|
-
} else if (network === "youtube") {
|
|
2215
|
-
_push(`<i class="i-youtube"></i>`);
|
|
2216
|
-
} else if (network === "twitter") {
|
|
2217
|
-
_push(`<i class="i-twitter"></i>`);
|
|
2218
|
-
} else if (network === "pinterest") {
|
|
2219
|
-
_push(`<i class="i-pinterest"></i>`);
|
|
2220
|
-
} else if (network === "instagram") {
|
|
2221
|
-
_push(`<i class="i-instagram"></i>`);
|
|
2222
|
-
} else if (network === "tiktok") {
|
|
2223
|
-
_push(`<i class="i-tiktok"></i>`);
|
|
2224
|
-
} else {
|
|
2225
|
-
_push(`<!---->`);
|
|
2226
|
-
}
|
|
2227
|
-
_push(`</a>`);
|
|
2228
|
-
} else {
|
|
2229
|
-
_push(`<!---->`);
|
|
2230
|
-
}
|
|
2231
|
-
_push(`<!--]-->`);
|
|
2232
|
-
});
|
|
2233
|
-
_push(`<!--]--></div>`);
|
|
2234
|
-
} else {
|
|
2235
|
-
_push(`<!---->`);
|
|
2236
|
-
}
|
|
2237
|
-
}, _push, _parent);
|
|
2238
|
-
_push(`</div></div></div>`);
|
|
2239
|
-
} else {
|
|
2240
|
-
_push(`<!---->`);
|
|
2241
|
-
}
|
|
2242
|
-
_push(`</div>`);
|
|
2243
|
-
};
|
|
2244
|
-
}
|
|
2245
|
-
});
|
|
2246
|
-
|
|
2247
|
-
const _sfc_setup$1 = _sfc_main$1.setup;
|
|
2248
|
-
_sfc_main$1.setup = (props, ctx) => {
|
|
2249
|
-
const ssrContext = useSSRContext();
|
|
2250
|
-
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/TopBar.vue");
|
|
2251
|
-
return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
|
|
2252
|
-
};
|
|
2253
|
-
|
|
2254
|
-
const $$module2$2 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2255
|
-
__proto__: null,
|
|
2256
|
-
default: _sfc_main$1
|
|
2257
|
-
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2258
|
-
|
|
2259
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
2260
|
-
__name: "TheHeader",
|
|
2261
|
-
__ssrInlineRender: true,
|
|
2262
|
-
setup(__props) {
|
|
2263
|
-
return (_ctx, _push, _parent, _attrs) => {
|
|
2264
|
-
_push(`<header${ssrRenderAttrs(mergeProps({ class: "header bg-surface bg-opacity-70 sticky py-1 sm:py-2" }, _attrs))}><div class="container"><div class="grid items-center"><div class="i-bars-3-bottom-left md:hidden"></div>`);
|
|
2265
|
-
ssrRenderSlot(_ctx.$slots, "logo", {}, null, _push, _parent);
|
|
2266
|
-
_push(`</div></div></header>`);
|
|
2267
|
-
};
|
|
2268
|
-
}
|
|
2269
|
-
});
|
|
2270
|
-
|
|
2271
|
-
const _sfc_setup = _sfc_main.setup;
|
|
2272
|
-
_sfc_main.setup = (props, ctx) => {
|
|
2273
|
-
const ssrContext = useSSRContext();
|
|
2274
|
-
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/TheHeader.vue");
|
|
2275
|
-
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
|
|
2276
|
-
};
|
|
2277
|
-
|
|
2278
|
-
const $$module3$3 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2279
|
-
__proto__: null,
|
|
2280
|
-
default: _sfc_main
|
|
2281
|
-
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2282
|
-
|
|
2283
|
-
const $$metadata$8 = createMetadata("/@fs/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/PagesHeader.astro", { modules: [{ module: $$module1, specifier: "../helpers/image", assert: {} }, { module: $$module2$2, specifier: "../components/TopBar.vue", assert: {} }, { module: $$module3$3, specifier: "../components/TheHeader.vue", assert: {} }], hydratedComponents: [], clientOnlyComponents: [], hydrationDirectives: /* @__PURE__ */ new Set([]), hoisted: [] });
|
|
2284
|
-
const $$Astro$8 = createAstro("/@fs/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/PagesHeader.astro", "https://storefront-demo.e-com.plus/", "file:///home/leo/code/ecomplus/cloud-commerce/packages/storefront/");
|
|
2285
|
-
const $$PagesHeader = createComponent(async ($$result, $$props, $$slots) => {
|
|
2286
|
-
const Astro2 = $$result.createAstro($$Astro$8, $$props, $$slots);
|
|
2287
|
-
Astro2.self = $$PagesHeader;
|
|
2288
|
-
const {
|
|
2289
|
-
pageContext: {
|
|
2290
|
-
apiState,
|
|
2291
|
-
settings,
|
|
2292
|
-
cms
|
|
2293
|
-
},
|
|
2294
|
-
topBarProps,
|
|
2295
|
-
logoTransform
|
|
2296
|
-
} = Astro2.props;
|
|
2297
|
-
const header = cms("header");
|
|
2298
|
-
const contacts = cms("contacts");
|
|
2299
|
-
settings.theme.custom || "";
|
|
2300
|
-
let headerCategories = [];
|
|
2301
|
-
if (header.categories_list) {
|
|
2302
|
-
if (header.categories_list.featured.length) {
|
|
2303
|
-
headerCategories = header.categories_list.featured.map((pathAndName) => {
|
|
2304
|
-
const [path, name] = pathAndName.split("?");
|
|
2305
|
-
return { slug: path.slice(1), name };
|
|
2306
|
-
});
|
|
2307
|
-
}
|
|
2308
|
-
if (header.categories_list.random) {
|
|
2309
|
-
const mainCategories = apiState.categories?.filter(({ parent }) => !parent || !parent.slug);
|
|
2310
|
-
if (mainCategories) {
|
|
2311
|
-
for (let i = 0; i < header.categories_list.random && i < mainCategories.length; i++) {
|
|
2312
|
-
if (!headerCategories.find(({ slug }) => mainCategories[i].slug === slug)) {
|
|
2313
|
-
headerCategories.push({
|
|
2314
|
-
slug: mainCategories[i].slug,
|
|
2315
|
-
name: mainCategories[i].name
|
|
2316
|
-
});
|
|
2317
|
-
}
|
|
2318
|
-
}
|
|
2319
|
-
}
|
|
2320
|
-
}
|
|
2321
|
-
header.categories_list.full_width;
|
|
2322
|
-
}
|
|
2323
|
-
header.desktop_megamenu;
|
|
2324
|
-
header.alphabetical_order_submenu;
|
|
2325
|
-
header.full_width_submenu;
|
|
2326
|
-
globalThis.TopBarProps = {
|
|
2327
|
-
marketingStripe: header.marketing_stripe,
|
|
2328
|
-
pageLinks: header.contacts_stripe.pages,
|
|
2329
|
-
hasPhoneLinks: header.contacts_stripe.phone_wpp,
|
|
2330
|
-
hasNetworkLinks: header.contacts_stripe.socials,
|
|
2331
|
-
contacts,
|
|
2332
|
-
...topBarProps
|
|
2333
|
-
};
|
|
2334
|
-
const logoWebpAttrs = await getImageAttrs({
|
|
2335
|
-
src: settings.logo,
|
|
2336
|
-
width: 150
|
|
2337
|
-
});
|
|
2338
|
-
return renderTemplate`${renderSlot($$result, $$slots["top-bar"], renderTemplate`
|
|
2339
|
-
${renderComponent($$result, "TopBar", _sfc_main$1, { ...globalThis.TopBarProps })}
|
|
2340
|
-
`)}
|
|
2341
|
-
${renderSlot($$result, $$slots["header"], renderTemplate`
|
|
2342
|
-
${renderComponent($$result, "TheHeader", _sfc_main, {}, { "logo": () => renderTemplate`${maybeRenderHead($$result)}<img${spreadAttributes(logoWebpAttrs)}${addAttribute(`${settings.name} (logo)`, "alt")}>` })}
|
|
2343
|
-
`)}`;
|
|
2344
|
-
});
|
|
2345
|
-
|
|
2346
|
-
const $$file$8 = "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/PagesHeader.astro";
|
|
2347
|
-
const $$url$8 = undefined;
|
|
2348
|
-
|
|
2349
|
-
const $$module2$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2350
|
-
__proto__: null,
|
|
2351
|
-
$$metadata: $$metadata$8,
|
|
2352
|
-
default: $$PagesHeader,
|
|
2353
|
-
file: $$file$8,
|
|
2354
|
-
url: $$url$8
|
|
2355
|
-
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2356
|
-
|
|
2357
|
-
const $$metadata$7 = createMetadata("/@fs/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/Pages.astro", { modules: [{ module: $$module1$1, specifier: "./Base.astro", assert: {} }, { module: $$module2$1, specifier: "./PagesHeader.astro", assert: {} }], hydratedComponents: [], clientOnlyComponents: [], hydrationDirectives: /* @__PURE__ */ new Set([]), hoisted: [] });
|
|
2358
|
-
const $$Astro$7 = createAstro("/@fs/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/Pages.astro", "https://storefront-demo.e-com.plus/", "file:///home/leo/code/ecomplus/cloud-commerce/packages/storefront/");
|
|
2359
|
-
const $$Pages = createComponent(async ($$result, $$props, $$slots) => {
|
|
2360
|
-
const Astro2 = $$result.createAstro($$Astro$7, $$props, $$slots);
|
|
2361
|
-
Astro2.self = $$Pages;
|
|
2362
|
-
const { pageContext, title } = Astro2.props;
|
|
2363
|
-
return renderTemplate`${renderComponent($$result, "Base", $$Base, { "pageContext": pageContext, "title": title }, { "before-body-end": () => renderTemplate`${renderComponent($$result, "Fragment", Fragment, { "slot": "before-body-end" }, { "default": () => renderTemplate`${renderSlot($$result, $$slots["before-body-end"])}` })}`, "before-head-end": () => renderTemplate`${renderComponent($$result, "Fragment", Fragment, { "slot": "before-head-end" }, { "default": () => renderTemplate`${renderSlot($$result, $$slots["before-head-end"])}` })}`, "default": () => renderTemplate`${renderSlot($$result, $$slots["header"], renderTemplate`
|
|
2364
|
-
${renderComponent($$result, "Header", $$PagesHeader, { "pageContext": pageContext })}
|
|
2365
|
-
`)}${renderSlot($$result, $$slots["default"])}` })}`;
|
|
2366
|
-
});
|
|
2367
|
-
|
|
2368
|
-
const $$file$7 = "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/Pages.astro";
|
|
2369
|
-
const $$url$7 = undefined;
|
|
2370
|
-
|
|
2371
|
-
const $$module2 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2372
|
-
__proto__: null,
|
|
2373
|
-
$$metadata: $$metadata$7,
|
|
2374
|
-
default: $$Pages,
|
|
2375
|
-
file: $$file$7,
|
|
2376
|
-
url: $$url$7
|
|
2377
|
-
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2378
|
-
|
|
2379
|
-
const $$metadata$6 = createMetadata("/@fs/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/main/Home.astro", { modules: [{ module: $$module1$4, specifier: "@cloudcommerce/api", assert: {} }], hydratedComponents: [], clientOnlyComponents: [], hydrationDirectives: /* @__PURE__ */ new Set([]), hoisted: [] });
|
|
2380
|
-
const $$Astro$6 = createAstro("/@fs/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/main/Home.astro", "https://storefront-demo.e-com.plus/", "file:///home/leo/code/ecomplus/cloud-commerce/packages/storefront/");
|
|
2381
|
-
const $$Home = createComponent(async ($$result, $$props, $$slots) => {
|
|
2382
|
-
const Astro2 = $$result.createAstro($$Astro$6, $$props, $$slots);
|
|
2383
|
-
Astro2.self = $$Home;
|
|
2384
|
-
const products = (await api.get("products")).data.result;
|
|
2385
|
-
return renderTemplate`${maybeRenderHead($$result)}<main>
|
|
2386
|
-
<h1>Welcome to <span class="text-primary">Astro</span></h1>
|
|
2387
|
-
<ul role="list" class="mt-3 fs-20">
|
|
2388
|
-
${products.map((product) => renderTemplate`<li>
|
|
2389
|
-
<a${addAttribute(`/${product.slug}`, "href")}>${product.sku}</a>
|
|
2390
|
-
</li>`)}
|
|
2391
|
-
</ul>
|
|
2392
|
-
</main>`;
|
|
2393
|
-
});
|
|
2394
|
-
|
|
2395
|
-
const $$file$6 = "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/main/Home.astro";
|
|
2396
|
-
const $$url$6 = undefined;
|
|
2397
|
-
|
|
2398
|
-
const $$module3$2 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2399
|
-
__proto__: null,
|
|
2400
|
-
$$metadata: $$metadata$6,
|
|
2401
|
-
default: $$Home,
|
|
2402
|
-
file: $$file$6,
|
|
2403
|
-
url: $$url$6
|
|
2404
|
-
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2405
|
-
|
|
2406
|
-
const $$metadata$5 = createMetadata("/@fs/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/index.astro", { modules: [{ module: $$module1$3, specifier: "../lib/ssr-context", assert: {} }, { module: $$module2, specifier: "../lib/layouts/Pages.astro", assert: {} }, { module: $$module3$2, specifier: "../lib/main/Home.astro", assert: {} }], hydratedComponents: [], clientOnlyComponents: [], hydrationDirectives: /* @__PURE__ */ new Set([]), hoisted: [] });
|
|
2407
|
-
const $$Astro$5 = createAstro("/@fs/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/index.astro", "https://storefront-demo.e-com.plus/", "file:///home/leo/code/ecomplus/cloud-commerce/packages/storefront/");
|
|
2408
|
-
const $$Index$1 = createComponent(async ($$result, $$props, $$slots) => {
|
|
2409
|
-
const Astro2 = $$result.createAstro($$Astro$5, $$props, $$slots);
|
|
2410
|
-
Astro2.self = $$Index$1;
|
|
2411
|
-
let pageContext;
|
|
2412
|
-
let loadError;
|
|
2413
|
-
try {
|
|
2414
|
-
pageContext = await loadPageContext(Astro2);
|
|
2415
|
-
} catch (err) {
|
|
2416
|
-
if (err.astroResponse) {
|
|
2417
|
-
return err.astroResponse;
|
|
2418
|
-
}
|
|
2419
|
-
loadError = err;
|
|
2420
|
-
}
|
|
2421
|
-
return renderTemplate`<html${addAttribute(pageContext?.lang.replace("_", "-"), "lang")}>
|
|
2422
|
-
${pageContext && renderTemplate`${renderComponent($$result, "PagesLayout", $$Pages, { "pageContext": pageContext }, { "default": () => renderTemplate`${renderComponent($$result, "HomeMain", $$Home, { "pageContext": pageContext })}` })}`}
|
|
2423
|
-
${loadError && renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": () => renderTemplate`${unescapeHTML(loadError.responseHTML)}` })}`}
|
|
2424
|
-
|
|
2425
|
-
</html>`;
|
|
2426
|
-
});
|
|
2427
|
-
|
|
2428
|
-
const $$file$5 = "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/index.astro";
|
|
2429
|
-
const $$url$5 = "";
|
|
2430
|
-
|
|
2431
|
-
const _page0 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2432
|
-
__proto__: null,
|
|
2433
|
-
$$metadata: $$metadata$5,
|
|
2434
|
-
default: $$Index$1,
|
|
2435
|
-
file: $$file$5,
|
|
2436
|
-
url: $$url$5
|
|
2437
|
-
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2438
|
-
|
|
2439
|
-
const $$metadata$4 = createMetadata("/@fs/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/main/Fallback.astro", { modules: [], hydratedComponents: [], clientOnlyComponents: [], hydrationDirectives: /* @__PURE__ */ new Set([]), hoisted: [] });
|
|
2440
|
-
const $$Astro$4 = createAstro("/@fs/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/main/Fallback.astro", "https://storefront-demo.e-com.plus/", "file:///home/leo/code/ecomplus/cloud-commerce/packages/storefront/");
|
|
2441
|
-
const $$Fallback$1 = createComponent(async ($$result, $$props, $$slots) => {
|
|
2442
|
-
const Astro2 = $$result.createAstro($$Astro$4, $$props, $$slots);
|
|
2443
|
-
Astro2.self = $$Fallback$1;
|
|
2444
|
-
return renderTemplate`${maybeRenderHead($$result)}<main>
|
|
2445
|
-
<h1>Error :/</h1>
|
|
2446
|
-
<p class="instructions">
|
|
2447
|
-
Check out the <code>src/pages</code> directory to get started.<br>
|
|
2448
|
-
<strong>Code Challenge:</strong> Tweak the "Welcome to Astro" message above.
|
|
2449
|
-
</p>
|
|
2450
|
-
</main>`;
|
|
2451
|
-
});
|
|
2452
|
-
|
|
2453
|
-
const $$file$4 = "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/main/Fallback.astro";
|
|
2454
|
-
const $$url$4 = undefined;
|
|
2455
|
-
|
|
2456
|
-
const $$module3$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2457
|
-
__proto__: null,
|
|
2458
|
-
$$metadata: $$metadata$4,
|
|
2459
|
-
default: $$Fallback$1,
|
|
2460
|
-
file: $$file$4,
|
|
2461
|
-
url: $$url$4
|
|
2462
|
-
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2463
|
-
|
|
2464
|
-
const $$metadata$3 = createMetadata("/@fs/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/fallback.astro", { modules: [{ module: $$module1$3, specifier: "../lib/ssr-context", assert: {} }, { module: $$module2, specifier: "../lib/layouts/Pages.astro", assert: {} }, { module: $$module3$1, specifier: "../lib/main/Fallback.astro", assert: {} }], hydratedComponents: [], clientOnlyComponents: [], hydrationDirectives: /* @__PURE__ */ new Set([]), hoisted: [] });
|
|
2465
|
-
const $$Astro$3 = createAstro("/@fs/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/fallback.astro", "https://storefront-demo.e-com.plus/", "file:///home/leo/code/ecomplus/cloud-commerce/packages/storefront/");
|
|
2466
|
-
const $$Fallback = createComponent(async ($$result, $$props, $$slots) => {
|
|
2467
|
-
const Astro2 = $$result.createAstro($$Astro$3, $$props, $$slots);
|
|
2468
|
-
Astro2.self = $$Fallback;
|
|
2469
|
-
let pageContext;
|
|
2470
|
-
try {
|
|
2471
|
-
pageContext = await loadPageContext(Astro2);
|
|
2472
|
-
} catch (err) {
|
|
2473
|
-
return err.astroResponse;
|
|
2474
|
-
}
|
|
2475
|
-
return renderTemplate`<html${addAttribute(pageContext?.lang.replace("_", "-"), "lang")}>
|
|
2476
|
-
${renderComponent($$result, "PagesLayout", $$Pages, { "pageContext": pageContext }, { "default": () => renderTemplate`${renderComponent($$result, "FallbackMain", $$Fallback$1, { "pageContext": pageContext })}` })}
|
|
2477
|
-
</html>`;
|
|
2478
|
-
});
|
|
2479
|
-
|
|
2480
|
-
const $$file$3 = "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/fallback.astro";
|
|
2481
|
-
const $$url$3 = "/fallback";
|
|
2482
|
-
|
|
2483
|
-
const _page1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2484
|
-
__proto__: null,
|
|
2485
|
-
$$metadata: $$metadata$3,
|
|
2486
|
-
default: $$Fallback,
|
|
2487
|
-
file: $$file$3,
|
|
2488
|
-
url: $$url$3
|
|
2489
|
-
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2490
|
-
|
|
2491
|
-
const $$metadata$2 = createMetadata("/@fs/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/app/index.astro", { modules: [], hydratedComponents: [], clientOnlyComponents: [], hydrationDirectives: /* @__PURE__ */ new Set([]), hoisted: [] });
|
|
2492
|
-
const $$Astro$2 = createAstro("/@fs/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/app/index.astro", "https://storefront-demo.e-com.plus/", "file:///home/leo/code/ecomplus/cloud-commerce/packages/storefront/");
|
|
2493
|
-
const $$Index = createComponent(async ($$result, $$props, $$slots) => {
|
|
2494
|
-
const Astro2 = $$result.createAstro($$Astro$2, $$props, $$slots);
|
|
2495
|
-
Astro2.self = $$Index;
|
|
2496
|
-
return renderTemplate``;
|
|
2497
|
-
});
|
|
2498
|
-
|
|
2499
|
-
const $$file$2 = "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/app/index.astro";
|
|
2500
|
-
const $$url$2 = "/app";
|
|
2501
|
-
|
|
2502
|
-
const _page2 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2503
|
-
__proto__: null,
|
|
2504
|
-
$$metadata: $$metadata$2,
|
|
2505
|
-
default: $$Index,
|
|
2506
|
-
file: $$file$2,
|
|
2507
|
-
url: $$url$2
|
|
2508
|
-
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2509
|
-
|
|
2510
|
-
const $$metadata$1 = createMetadata("/@fs/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/main/Wildcard.astro", { modules: [], hydratedComponents: [], clientOnlyComponents: [], hydrationDirectives: /* @__PURE__ */ new Set([]), hoisted: [] });
|
|
2511
|
-
const $$Astro$1 = createAstro("/@fs/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/main/Wildcard.astro", "https://storefront-demo.e-com.plus/", "file:///home/leo/code/ecomplus/cloud-commerce/packages/storefront/");
|
|
2512
|
-
const $$Wildcard = createComponent(async ($$result, $$props, $$slots) => {
|
|
2513
|
-
const Astro2 = $$result.createAstro($$Astro$1, $$props, $$slots);
|
|
2514
|
-
Astro2.self = $$Wildcard;
|
|
2515
|
-
const {
|
|
2516
|
-
pageContext: { apiResource, apiDoc }
|
|
2517
|
-
} = Astro2.props;
|
|
2518
|
-
return renderTemplate`${maybeRenderHead($$result)}<main>
|
|
2519
|
-
<h1>Hello <span class="text-gradient">${apiDoc.name}</span></h1>
|
|
2520
|
-
<hr>
|
|
2521
|
-
<div class="mt-3">
|
|
2522
|
-
<mark>${apiDoc._id}</mark> from <i>${apiResource}</i>
|
|
2523
|
-
<p>${Math.random()}</p>
|
|
2524
|
-
<em>Lorem ipsum dolor sit amet</em>
|
|
2525
|
-
</div>
|
|
2526
|
-
</main>`;
|
|
2527
|
-
});
|
|
2528
|
-
|
|
2529
|
-
const $$file$1 = "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/main/Wildcard.astro";
|
|
2530
|
-
const $$url$1 = undefined;
|
|
2531
|
-
|
|
2532
|
-
const $$module3 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2533
|
-
__proto__: null,
|
|
2534
|
-
$$metadata: $$metadata$1,
|
|
2535
|
-
default: $$Wildcard,
|
|
2536
|
-
file: $$file$1,
|
|
2537
|
-
url: $$url$1
|
|
2538
|
-
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2539
|
-
|
|
2540
|
-
const $$metadata = createMetadata("/@fs/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/[...slug].astro", { modules: [{ module: $$module1$3, specifier: "../lib/ssr-context", assert: {} }, { module: $$module2, specifier: "../lib/layouts/Pages.astro", assert: {} }, { module: $$module3, specifier: "../lib/main/Wildcard.astro", assert: {} }], hydratedComponents: [], clientOnlyComponents: [], hydrationDirectives: /* @__PURE__ */ new Set([]), hoisted: [] });
|
|
2541
|
-
const $$Astro = createAstro("/@fs/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/[...slug].astro", "https://storefront-demo.e-com.plus/", "file:///home/leo/code/ecomplus/cloud-commerce/packages/storefront/");
|
|
2542
|
-
const $$ = createComponent(async ($$result, $$props, $$slots) => {
|
|
2543
|
-
const Astro2 = $$result.createAstro($$Astro, $$props, $$slots);
|
|
2544
|
-
Astro2.self = $$;
|
|
2545
|
-
if (String(Astro2.params.slug).endsWith(".css.map")) {
|
|
2546
|
-
return new Response(null, { status: 404 });
|
|
2547
|
-
}
|
|
2548
|
-
let pageContext;
|
|
2549
|
-
let loadError;
|
|
2550
|
-
try {
|
|
2551
|
-
pageContext = await loadPageContext(Astro2);
|
|
2552
|
-
} catch (err) {
|
|
2553
|
-
if (err.astroResponse) {
|
|
2554
|
-
return err.astroResponse;
|
|
2555
|
-
}
|
|
2556
|
-
loadError = err;
|
|
2557
|
-
}
|
|
2558
|
-
return renderTemplate`<html${addAttribute(pageContext?.lang.replace("_", "-"), "lang")}>
|
|
2559
|
-
${pageContext && renderTemplate`${renderComponent($$result, "PagesLayout", $$Pages, { "pageContext": pageContext }, { "default": () => renderTemplate`${renderComponent($$result, "WildcardMain", $$Wildcard, { "pageContext": pageContext })}` })}`}
|
|
2560
|
-
${loadError && renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": () => renderTemplate`${unescapeHTML(loadError.responseHTML)}` })}`}
|
|
2561
|
-
|
|
2562
|
-
</html>`;
|
|
2563
|
-
});
|
|
2564
|
-
|
|
2565
|
-
const $$file = "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/[...slug].astro";
|
|
2566
|
-
const $$url = "/[...slug]";
|
|
2567
|
-
|
|
2568
|
-
const _page3 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2569
|
-
__proto__: null,
|
|
2570
|
-
$$metadata,
|
|
2571
|
-
default: $$,
|
|
2572
|
-
file: $$file,
|
|
2573
|
-
url: $$url
|
|
2574
|
-
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2575
|
-
|
|
2576
|
-
const pageMap = new Map([['src/pages/index.astro', _page0],['src/pages/fallback.astro', _page1],['src/pages/app/index.astro', _page2],['src/pages/[...slug].astro', _page3],]);
|
|
2577
|
-
const renderers = [Object.assign({"name":"astro:jsx","serverEntrypoint":"astro/jsx/server.js","jsxImportSource":"astro"}, { ssr: server_default }),Object.assign({"name":"@astrojs/vue","clientEntrypoint":"@astrojs/vue/client.js","serverEntrypoint":"@astrojs/vue/server.js"}, { ssr: _renderer1 }),];
|
|
2578
|
-
|
|
2579
|
-
if (typeof process !== "undefined") {
|
|
2580
|
-
if (process.argv.includes("--verbose")) ; else if (process.argv.includes("--silent")) ; else ;
|
|
2581
|
-
}
|
|
2582
|
-
|
|
2583
|
-
const SCRIPT_EXTENSIONS = /* @__PURE__ */ new Set([".js", ".ts"]);
|
|
2584
|
-
new RegExp(
|
|
2585
|
-
`\\.(${Array.from(SCRIPT_EXTENSIONS).map((s) => s.slice(1)).join("|")})($|\\?)`
|
|
2586
|
-
);
|
|
2587
|
-
|
|
2588
|
-
const STYLE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
2589
|
-
".css",
|
|
2590
|
-
".pcss",
|
|
2591
|
-
".postcss",
|
|
2592
|
-
".scss",
|
|
2593
|
-
".sass",
|
|
2594
|
-
".styl",
|
|
2595
|
-
".stylus",
|
|
2596
|
-
".less"
|
|
2597
|
-
]);
|
|
2598
|
-
new RegExp(
|
|
2599
|
-
`\\.(${Array.from(STYLE_EXTENSIONS).map((s) => s.slice(1)).join("|")})($|\\?)`
|
|
2600
|
-
);
|
|
2601
|
-
|
|
2602
|
-
function getRouteGenerator(segments, addTrailingSlash) {
|
|
2603
|
-
const template = segments.map((segment) => {
|
|
2604
|
-
return segment[0].spread ? `/:${segment[0].content.slice(3)}(.*)?` : "/" + segment.map((part) => {
|
|
2605
|
-
if (part)
|
|
2606
|
-
return part.dynamic ? `:${part.content}` : part.content.normalize().replace(/\?/g, "%3F").replace(/#/g, "%23").replace(/%5B/g, "[").replace(/%5D/g, "]").replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
2607
|
-
}).join("");
|
|
2608
|
-
}).join("");
|
|
2609
|
-
let trailing = "";
|
|
2610
|
-
if (addTrailingSlash === "always" && segments.length) {
|
|
2611
|
-
trailing = "/";
|
|
2612
|
-
}
|
|
2613
|
-
const toPath = compile(template + trailing);
|
|
2614
|
-
return toPath;
|
|
2615
|
-
}
|
|
2616
|
-
|
|
2617
|
-
function deserializeRouteData(rawRouteData) {
|
|
2618
|
-
return {
|
|
2619
|
-
route: rawRouteData.route,
|
|
2620
|
-
type: rawRouteData.type,
|
|
2621
|
-
pattern: new RegExp(rawRouteData.pattern),
|
|
2622
|
-
params: rawRouteData.params,
|
|
2623
|
-
component: rawRouteData.component,
|
|
2624
|
-
generate: getRouteGenerator(rawRouteData.segments, rawRouteData._meta.trailingSlash),
|
|
2625
|
-
pathname: rawRouteData.pathname || void 0,
|
|
2626
|
-
segments: rawRouteData.segments
|
|
2627
|
-
};
|
|
2628
|
-
}
|
|
2629
|
-
|
|
2630
|
-
function deserializeManifest(serializedManifest) {
|
|
2631
|
-
const routes = [];
|
|
2632
|
-
for (const serializedRoute of serializedManifest.routes) {
|
|
2633
|
-
routes.push({
|
|
2634
|
-
...serializedRoute,
|
|
2635
|
-
routeData: deserializeRouteData(serializedRoute.routeData)
|
|
2636
|
-
});
|
|
2637
|
-
const route = serializedRoute;
|
|
2638
|
-
route.routeData = deserializeRouteData(serializedRoute.routeData);
|
|
2639
|
-
}
|
|
2640
|
-
const assets = new Set(serializedManifest.assets);
|
|
2641
|
-
return {
|
|
2642
|
-
...serializedManifest,
|
|
2643
|
-
assets,
|
|
2644
|
-
routes
|
|
2645
|
-
};
|
|
2646
|
-
}
|
|
2647
|
-
|
|
2648
|
-
const _manifest = Object.assign(deserializeManifest({"adapterName":"@astrojs/node","routes":[{"file":"","links":["assets/_...ee104f19.css","assets/_...73e01db2.css"],"scripts":[{"type":"external","value":"hoisted.46e058d2.js"},{"type":"external","value":"page.3aa82516.js"},{"stage":"head-inline","children":"!(function(w,p,f,c){c=w[p]=Object.assign(w[p]||{},{\"lib\":\"/~partytown/\",\"debug\":false});c[f]=(c[f]||[])})(window,'partytown','forward');/* Partytown 0.4.5 - MIT builder.io */\n!function(t,e,n,i,r,o,a,d,s,c,p,l){function u(){l||(l=1,\"/\"==(a=(o.lib||\"/~partytown/\")+(o.debug?\"debug/\":\"\"))[0]&&(s=e.querySelectorAll('script[type=\"text/partytown\"]'),i!=t?i.dispatchEvent(new CustomEvent(\"pt1\",{detail:t})):(d=setTimeout(w,1e4),e.addEventListener(\"pt0\",f),r?h(1):n.serviceWorker?n.serviceWorker.register(a+(o.swPath||\"partytown-sw.js\"),{scope:a}).then((function(t){t.active?h():t.installing&&t.installing.addEventListener(\"statechange\",(function(t){\"activated\"==t.target.state&&h()}))}),console.error):w())))}function h(t){c=e.createElement(t?\"script\":\"iframe\"),t||(c.setAttribute(\"style\",\"display:block;width:0;height:0;border:0;visibility:hidden\"),c.setAttribute(\"aria-hidden\",!0)),c.src=a+\"partytown-\"+(t?\"atomics.js?v=0.4.5\":\"sandbox-sw.html?\"+Date.now()),e.body.appendChild(c)}function w(t,n){for(f(),t=0;t<s.length;t++)(n=e.createElement(\"script\")).innerHTML=s[t].innerHTML,e.head.appendChild(n);c&&c.parentNode.removeChild(c)}function f(){clearTimeout(d)}o=t.partytown||{},i==t&&(o.forward||[]).map((function(e){p=t,e.split(\".\").map((function(e,n,i){p=p[i[n]]=n+1<i.length?\"push\"==i[n+1]?[]:p[i[n]]||{}:function(){(t._ptf=t._ptf||[]).push(i,arguments)}}))})),\"complete\"==e.readyState?u():(t.addEventListener(\"DOMContentLoaded\",u),t.addEventListener(\"load\",u))}(window,document,navigator,top,window.crossOriginIsolated);"}],"routeData":{"route":"/","type":"page","pattern":"^\\/$","segments":[],"params":[],"component":"src/pages/index.astro","pathname":"/","_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["assets/_...ee104f19.css","assets/_...73e01db2.css"],"scripts":[{"type":"external","value":"hoisted.46e058d2.js"},{"type":"external","value":"page.3aa82516.js"},{"stage":"head-inline","children":"!(function(w,p,f,c){c=w[p]=Object.assign(w[p]||{},{\"lib\":\"/~partytown/\",\"debug\":false});c[f]=(c[f]||[])})(window,'partytown','forward');/* Partytown 0.4.5 - MIT builder.io */\n!function(t,e,n,i,r,o,a,d,s,c,p,l){function u(){l||(l=1,\"/\"==(a=(o.lib||\"/~partytown/\")+(o.debug?\"debug/\":\"\"))[0]&&(s=e.querySelectorAll('script[type=\"text/partytown\"]'),i!=t?i.dispatchEvent(new CustomEvent(\"pt1\",{detail:t})):(d=setTimeout(w,1e4),e.addEventListener(\"pt0\",f),r?h(1):n.serviceWorker?n.serviceWorker.register(a+(o.swPath||\"partytown-sw.js\"),{scope:a}).then((function(t){t.active?h():t.installing&&t.installing.addEventListener(\"statechange\",(function(t){\"activated\"==t.target.state&&h()}))}),console.error):w())))}function h(t){c=e.createElement(t?\"script\":\"iframe\"),t||(c.setAttribute(\"style\",\"display:block;width:0;height:0;border:0;visibility:hidden\"),c.setAttribute(\"aria-hidden\",!0)),c.src=a+\"partytown-\"+(t?\"atomics.js?v=0.4.5\":\"sandbox-sw.html?\"+Date.now()),e.body.appendChild(c)}function w(t,n){for(f(),t=0;t<s.length;t++)(n=e.createElement(\"script\")).innerHTML=s[t].innerHTML,e.head.appendChild(n);c&&c.parentNode.removeChild(c)}function f(){clearTimeout(d)}o=t.partytown||{},i==t&&(o.forward||[]).map((function(e){p=t,e.split(\".\").map((function(e,n,i){p=p[i[n]]=n+1<i.length?\"push\"==i[n+1]?[]:p[i[n]]||{}:function(){(t._ptf=t._ptf||[]).push(i,arguments)}}))})),\"complete\"==e.readyState?u():(t.addEventListener(\"DOMContentLoaded\",u),t.addEventListener(\"load\",u))}(window,document,navigator,top,window.crossOriginIsolated);"}],"routeData":{"route":"/fallback","type":"page","pattern":"^\\/fallback\\/?$","segments":[[{"content":"fallback","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/fallback.astro","pathname":"/fallback","_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["assets/_...ee104f19.css"],"scripts":[{"type":"external","value":"page.3aa82516.js"},{"stage":"head-inline","children":"!(function(w,p,f,c){c=w[p]=Object.assign(w[p]||{},{\"lib\":\"/~partytown/\",\"debug\":false});c[f]=(c[f]||[])})(window,'partytown','forward');/* Partytown 0.4.5 - MIT builder.io */\n!function(t,e,n,i,r,o,a,d,s,c,p,l){function u(){l||(l=1,\"/\"==(a=(o.lib||\"/~partytown/\")+(o.debug?\"debug/\":\"\"))[0]&&(s=e.querySelectorAll('script[type=\"text/partytown\"]'),i!=t?i.dispatchEvent(new CustomEvent(\"pt1\",{detail:t})):(d=setTimeout(w,1e4),e.addEventListener(\"pt0\",f),r?h(1):n.serviceWorker?n.serviceWorker.register(a+(o.swPath||\"partytown-sw.js\"),{scope:a}).then((function(t){t.active?h():t.installing&&t.installing.addEventListener(\"statechange\",(function(t){\"activated\"==t.target.state&&h()}))}),console.error):w())))}function h(t){c=e.createElement(t?\"script\":\"iframe\"),t||(c.setAttribute(\"style\",\"display:block;width:0;height:0;border:0;visibility:hidden\"),c.setAttribute(\"aria-hidden\",!0)),c.src=a+\"partytown-\"+(t?\"atomics.js?v=0.4.5\":\"sandbox-sw.html?\"+Date.now()),e.body.appendChild(c)}function w(t,n){for(f(),t=0;t<s.length;t++)(n=e.createElement(\"script\")).innerHTML=s[t].innerHTML,e.head.appendChild(n);c&&c.parentNode.removeChild(c)}function f(){clearTimeout(d)}o=t.partytown||{},i==t&&(o.forward||[]).map((function(e){p=t,e.split(\".\").map((function(e,n,i){p=p[i[n]]=n+1<i.length?\"push\"==i[n+1]?[]:p[i[n]]||{}:function(){(t._ptf=t._ptf||[]).push(i,arguments)}}))})),\"complete\"==e.readyState?u():(t.addEventListener(\"DOMContentLoaded\",u),t.addEventListener(\"load\",u))}(window,document,navigator,top,window.crossOriginIsolated);"}],"routeData":{"route":"/app","type":"page","pattern":"^\\/app\\/?$","segments":[[{"content":"app","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/app/index.astro","pathname":"/app","_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["assets/_...ee104f19.css","assets/_...73e01db2.css"],"scripts":[{"type":"external","value":"hoisted.46e058d2.js"},{"type":"external","value":"page.3aa82516.js"},{"stage":"head-inline","children":"!(function(w,p,f,c){c=w[p]=Object.assign(w[p]||{},{\"lib\":\"/~partytown/\",\"debug\":false});c[f]=(c[f]||[])})(window,'partytown','forward');/* Partytown 0.4.5 - MIT builder.io */\n!function(t,e,n,i,r,o,a,d,s,c,p,l){function u(){l||(l=1,\"/\"==(a=(o.lib||\"/~partytown/\")+(o.debug?\"debug/\":\"\"))[0]&&(s=e.querySelectorAll('script[type=\"text/partytown\"]'),i!=t?i.dispatchEvent(new CustomEvent(\"pt1\",{detail:t})):(d=setTimeout(w,1e4),e.addEventListener(\"pt0\",f),r?h(1):n.serviceWorker?n.serviceWorker.register(a+(o.swPath||\"partytown-sw.js\"),{scope:a}).then((function(t){t.active?h():t.installing&&t.installing.addEventListener(\"statechange\",(function(t){\"activated\"==t.target.state&&h()}))}),console.error):w())))}function h(t){c=e.createElement(t?\"script\":\"iframe\"),t||(c.setAttribute(\"style\",\"display:block;width:0;height:0;border:0;visibility:hidden\"),c.setAttribute(\"aria-hidden\",!0)),c.src=a+\"partytown-\"+(t?\"atomics.js?v=0.4.5\":\"sandbox-sw.html?\"+Date.now()),e.body.appendChild(c)}function w(t,n){for(f(),t=0;t<s.length;t++)(n=e.createElement(\"script\")).innerHTML=s[t].innerHTML,e.head.appendChild(n);c&&c.parentNode.removeChild(c)}function f(){clearTimeout(d)}o=t.partytown||{},i==t&&(o.forward||[]).map((function(e){p=t,e.split(\".\").map((function(e,n,i){p=p[i[n]]=n+1<i.length?\"push\"==i[n+1]?[]:p[i[n]]||{}:function(){(t._ptf=t._ptf||[]).push(i,arguments)}}))})),\"complete\"==e.readyState?u():(t.addEventListener(\"DOMContentLoaded\",u),t.addEventListener(\"load\",u))}(window,document,navigator,top,window.crossOriginIsolated);"}],"routeData":{"route":"/[...slug]","type":"page","pattern":"^(?:\\/(.*?))?\\/?$","segments":[[{"content":"...slug","dynamic":true,"spread":true}]],"params":["...slug"],"component":"src/pages/[...slug].astro","_meta":{"trailingSlash":"ignore"}}}],"site":"https://storefront-demo.e-com.plus/","base":"/","markdown":{"drafts":false,"syntaxHighlight":"shiki","shikiConfig":{"langs":[],"theme":"github-dark","wrap":false},"remarkPlugins":[],"rehypePlugins":[],"remarkRehype":{},"extendDefaultPlugins":false,"isAstroFlavoredMd":false},"pageMap":null,"renderers":[],"entryModules":{"\u0000@astrojs-ssr-virtual-entry":"entry.mjs","@astrojs/vue/client.js":"client.80baece3.js","/astro/hoisted.js?q=0":"hoisted.46e058d2.js","astro:scripts/page.js":"page.3aa82516.js","/home/leo/code/ecomplus/cloud-commerce/node_modules/.pnpm/workbox-window@6.5.4/node_modules/workbox-window/build/workbox-window.prod.es5.mjs":"chunks/workbox-window.prod.es5.4b654ae6.js","astro:scripts/before-hydration.js":""},"assets":["/assets/_...73e01db2.css","/assets/_...ee104f19.css","/manifest.webmanifest","/registerSW.js","/client.80baece3.js","/hoisted.46e058d2.js","/page.3aa82516.js","/robots.txt","/sw.js","/workbox-6f0d1f78.js","/admin/config.json","/assets/cms-preview.css","/assets/cms.css","/assets/cvv.png","/assets/img-placeholder.png","/assets/payments.png","/assets/ssl-safe.png","/chunks/workbox-window.prod.es5.4b654ae6.js","/img/icon.png","/img/large-icon.png","/img/uploads/banner1.png","/img/uploads/banner2.png","/img/uploads/banner2.webp","/img/uploads/favicon.png","/img/uploads/headless.png","/img/uploads/headphone.png","/img/uploads/headphone.webp","/img/uploads/icon.png","/img/uploads/large-icon.png","/img/uploads/logo.png","/img/uploads/logo.webp","/img/uploads/og-image.png","/img/uploads/passion.png","/img/uploads/passion.webp","/img/uploads/pwa-reliable.png","/img/uploads/rect8589.png","/img/uploads/rect859.png","/img/uploads/rect89.png","/img/uploads/rect89.webp","/img/uploads/ssl-safe.png","/assets/icons/bootstrap-icons/font/storefront-icons.woff2","/assets/icons/feather-icons/font/storefront-icons.woff2","/assets/icons/font-awesome/font/storefront-icons.woff2","/assets/icons/line-awesome/font/storefront-icons.woff2","/assets/icons/tabler-icons/font/storefront-icons.woff2","/page.3aa82516.js","/~partytown/partytown-atomics.js","/~partytown/partytown-media.js","/~partytown/partytown-sw.js","/~partytown/partytown.js"]}), {
|
|
2649
|
-
pageMap: pageMap,
|
|
2650
|
-
renderers: renderers
|
|
2651
|
-
});
|
|
2652
|
-
const _args = undefined;
|
|
2653
|
-
|
|
2654
|
-
const _exports = adapter.createExports(_manifest, _args);
|
|
2655
|
-
const handler = _exports['handler'];
|
|
2656
|
-
|
|
2657
|
-
const _start = 'start';
|
|
2658
|
-
if(_start in adapter) {
|
|
2659
|
-
adapter[_start](_manifest, _args);
|
|
2660
|
-
}
|
|
2661
|
-
|
|
2662
|
-
export { handler };
|