qumra-engine 1.0.128 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/addFilter.js +10 -0
  2. package/dist/filters/addFilter.js +6 -0
  3. package/dist/filters/capitalize.js +8 -0
  4. package/dist/filters/discountLabel.js +8 -0
  5. package/dist/filters/formatDate.js +9 -0
  6. package/dist/filters/formatMoney.js +8 -0
  7. package/dist/filters/index.js +16 -0
  8. package/dist/filters/logic/capitalize.js +8 -0
  9. package/dist/filters/logic/component.js +6 -0
  10. package/dist/filters/logic/discountLabel.js +8 -0
  11. package/dist/filters/logic/formatDate.js +9 -0
  12. package/dist/filters/logic/formatMoney.js +8 -0
  13. package/dist/filters/registerAllFilters.js +47 -0
  14. package/dist/index.js +7 -0
  15. package/dist/middleware.js +10 -0
  16. package/dist/middlewares/errorHandler.js +33 -0
  17. package/dist/middlewares/pathMiddleware.js +19 -0
  18. package/dist/middlewares/prepareDataMiddleware.js +28 -0
  19. package/dist/middlewares/themeMiddleware.js +29 -0
  20. package/dist/nunjucksEnv.js +21 -0
  21. package/dist/registerAllFilters.js +44 -0
  22. package/dist/render.js +19 -0
  23. package/dist/services/getRenderData.js +9 -0
  24. package/dist/services/prepareData.js +32 -0
  25. package/dist/services/prepareDataMiddleware.js +28 -0
  26. package/dist/services/renderHandler.js +31 -0
  27. package/dist/types/sharedTypes.js +3 -0
  28. package/dist/utils/logger.js +21 -0
  29. package/dist/utils/render.js +23 -0
  30. package/package.json +19 -31
  31. package/views/home.njk +15 -0
  32. package/dist/bundle.cjs.js +0 -2
  33. package/dist/bundle.cjs.js.LICENSE.txt +0 -1
  34. package/dist/bundle.esm.js +0 -2
  35. package/dist/bundle.esm.js.LICENSE.txt +0 -1
  36. package/rollup.config.js +0 -42
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.default = addFilter;
7
+ const nunjucksEnv_1 = __importDefault(require("./nunjucksEnv"));
8
+ function addFilter(name, fn) {
9
+ nunjucksEnv_1.default.addFilter(name, fn);
10
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = addFilter;
4
+ function addFilter(env, name, fn) {
5
+ env.addFilter(name, fn);
6
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = capitalize;
4
+ function capitalize(str) {
5
+ if (typeof str !== 'string' || !str.length)
6
+ return str;
7
+ return str.charAt(0).toUpperCase() + str.slice(1);
8
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = discountLabel;
4
+ function discountLabel(value) {
5
+ if (typeof value !== 'number')
6
+ return value;
7
+ return value > 0 ? `-${value}%` : '';
8
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = formatDate;
4
+ function formatDate(date, locale = 'en-US') {
5
+ const d = typeof date === 'string' ? new Date(date) : date;
6
+ if (isNaN(d.getTime()))
7
+ return date;
8
+ return d.toLocaleDateString(locale, { year: 'numeric', month: 'short', day: 'numeric' });
9
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = formatMoney;
4
+ function formatMoney(value, currency = 'USD') {
5
+ if (typeof value !== 'number')
6
+ return value;
7
+ return value.toFixed(2) + ' ' + currency;
8
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.component = exports.discountLabel = exports.capitalize = exports.formatDate = exports.formatMoney = void 0;
7
+ var formatMoney_1 = require("./logic/formatMoney");
8
+ Object.defineProperty(exports, "formatMoney", { enumerable: true, get: function () { return __importDefault(formatMoney_1).default; } });
9
+ var formatDate_1 = require("./logic/formatDate");
10
+ Object.defineProperty(exports, "formatDate", { enumerable: true, get: function () { return __importDefault(formatDate_1).default; } });
11
+ var capitalize_1 = require("./logic/capitalize");
12
+ Object.defineProperty(exports, "capitalize", { enumerable: true, get: function () { return __importDefault(capitalize_1).default; } });
13
+ var discountLabel_1 = require("./logic/discountLabel");
14
+ Object.defineProperty(exports, "discountLabel", { enumerable: true, get: function () { return __importDefault(discountLabel_1).default; } });
15
+ var component_1 = require("./logic/component");
16
+ Object.defineProperty(exports, "component", { enumerable: true, get: function () { return __importDefault(component_1).default; } });
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = capitalize;
4
+ function capitalize(str) {
5
+ if (typeof str !== 'string' || !str.length)
6
+ return str;
7
+ return str.charAt(0).toUpperCase() + str.slice(1);
8
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = component;
4
+ function component(str, data, env) {
5
+ console.log("🚀 ~ env:", env);
6
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = discountLabel;
4
+ function discountLabel(value) {
5
+ if (typeof value !== 'number')
6
+ return value;
7
+ return value > 0 ? `-${value}%` : '';
8
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = formatDate;
4
+ function formatDate(date, locale = 'en-US') {
5
+ const d = typeof date === 'string' ? new Date(date) : date;
6
+ if (isNaN(d.getTime()))
7
+ return date;
8
+ return d.toLocaleDateString(locale, { year: 'numeric', month: 'short', day: 'numeric' });
9
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = formatMoney;
4
+ function formatMoney(value, currency = 'USD') {
5
+ if (typeof value !== 'number')
6
+ return value;
7
+ return value.toFixed(2) + ' ' + currency;
8
+ }
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.default = registerAllFilters;
37
+ const filters = __importStar(require("./"));
38
+ function registerAllFilters(env) {
39
+ Object.entries(filters).forEach(([name, fn]) => {
40
+ if (typeof fn === 'function') {
41
+ env.addFilter(name, fn);
42
+ }
43
+ else {
44
+ console.warn(`[nunjucks-middleware] تخطى الفلتر '${name}' لأنه ليس دالة صالحة.`);
45
+ }
46
+ });
47
+ }
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const middleware_1 = __importDefault(require("./middleware"));
7
+ exports.default = middleware_1.default;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = nunjucksMiddleware;
4
+ const prepareData_1 = require("./services/prepareData");
5
+ const renderHandler_1 = require("./services/renderHandler");
6
+ async function nunjucksMiddleware(req, res, next) {
7
+ await (0, prepareData_1.prepareData)(res, res.locals.fullUrl);
8
+ await (0, renderHandler_1.renderHandler)(res);
9
+ next();
10
+ }
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.errorHandler = exports.AppError = void 0;
7
+ const logger_1 = __importDefault(require("../config/logger"));
8
+ class AppError extends Error {
9
+ constructor(message, statusCode) {
10
+ super(message);
11
+ this.statusCode = statusCode;
12
+ this.status = `${statusCode}`.startsWith('4') ? 'fail' : 'error';
13
+ this.isOperational = true;
14
+ Error.captureStackTrace(this, this.constructor);
15
+ }
16
+ }
17
+ exports.AppError = AppError;
18
+ const errorHandler = (err, req, res, next) => {
19
+ if (err instanceof AppError) {
20
+ logger_1.default.error(`[${err.statusCode}] ${err.message}`);
21
+ return res.status(err.statusCode).json({
22
+ status: err.status,
23
+ message: err.message,
24
+ });
25
+ }
26
+ // Programming or other unknown error: don't leak error details
27
+ logger_1.default.error('Unhandled Error:', err);
28
+ return res.status(500).json({
29
+ status: 'error',
30
+ message: 'Something went wrong!',
31
+ });
32
+ };
33
+ exports.errorHandler = errorHandler;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.pathMiddleware = void 0;
4
+ const pathMiddleware = async (req, res, next) => {
5
+ try {
6
+ // تكوين الـ URL الكامل
7
+ let fullUrl = `${req.protocol}://${req.get("host")}${req.originalUrl}`;
8
+ if (fullUrl.includes("localhost")) {
9
+ fullUrl = 'https://qumra-electronics.qumra.store/';
10
+ }
11
+ res.locals.fullUrl = fullUrl;
12
+ next();
13
+ }
14
+ catch (err) {
15
+ console.error("🚀 ~ Middleware error:", err);
16
+ return res.status(500).json({ message: "Internal Server Error" });
17
+ }
18
+ };
19
+ exports.pathMiddleware = pathMiddleware;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.prepareDataMiddleware = void 0;
4
+ const node_consul_service_1 = require("node-consul-service");
5
+ const prepareDataMiddleware = async (req, res, next) => {
6
+ try {
7
+ const engineResponse = await (0, node_consul_service_1.callService)("engine-service", {
8
+ path: "/v1/render",
9
+ method: "POST",
10
+ data: {
11
+ url: res.locals.fullUrl,
12
+ },
13
+ });
14
+ if (engineResponse.success) {
15
+ res.locals.render = engineResponse.data;
16
+ }
17
+ else {
18
+ res.locals.render = null;
19
+ }
20
+ console.log("🚀 ~ prepareDataMiddleware ~ res.locals:", res.locals);
21
+ next();
22
+ }
23
+ catch (err) {
24
+ console.error("🚀 ~ Middleware error:", err);
25
+ return res.status(500).json({ message: "Internal Server Error" });
26
+ }
27
+ };
28
+ exports.prepareDataMiddleware = prepareDataMiddleware;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.themeMiddleware = void 0;
7
+ const path_1 = __importDefault(require("path"));
8
+ const themeMiddleware = (req, res, next) => {
9
+ try {
10
+ if (!res.locals.render.theme) {
11
+ throw new Error("Theme data not found in res.locals");
12
+ }
13
+ const folderPath = process.env.THEMES_REPO;
14
+ if (!folderPath) {
15
+ throw new Error("THEMES_REPO is not defined in environment variables");
16
+ }
17
+ const themePath = path_1.default.join(__dirname, folderPath, res.locals.render.theme);
18
+ res.locals.themePath = themePath;
19
+ console.log("🚀 ~ Theme Path Set To:", themePath);
20
+ next();
21
+ }
22
+ catch (error) {
23
+ console.log("🚀 ~ res.locals:", res.locals.render);
24
+ console.log("🚀 ~ res.locals:", res.locals.render.theme);
25
+ console.error("Error setting theme path:", error.message);
26
+ res.status(500).send("An error occurred while setting the theme path");
27
+ }
28
+ };
29
+ exports.themeMiddleware = themeMiddleware;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.configureNunjucks = configureNunjucks;
7
+ const nunjucks_1 = __importDefault(require("nunjucks"));
8
+ const registerAllFilters_1 = __importDefault(require("./filters/registerAllFilters"));
9
+ /**
10
+ * إعداد Nunjucks مع مسار مخصص للقوالب
11
+ * @param viewsPath المسار الكامل لملفات القوالب
12
+ */
13
+ function configureNunjucks(viewsPath) {
14
+ const env = nunjucks_1.default.configure(viewsPath, {
15
+ autoescape: true,
16
+ noCache: true,
17
+ watch: false,
18
+ });
19
+ (0, registerAllFilters_1.default)(env);
20
+ return env;
21
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.default = registerAllFilters;
37
+ const filters = __importStar(require("./filters"));
38
+ function registerAllFilters(env) {
39
+ Object.entries(filters).forEach(([name, fn]) => {
40
+ if (typeof fn === 'function') {
41
+ env.addFilter(name, fn);
42
+ }
43
+ });
44
+ }
package/dist/render.js ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.render = render;
7
+ const nunjucksEnv_1 = __importDefault(require("./nunjucksEnv"));
8
+ function render(view, context = {}) {
9
+ return new Promise((resolve, reject) => {
10
+ nunjucksEnv_1.default.render(view, context, (err, html) => {
11
+ if (err)
12
+ reject(err);
13
+ else if (html !== null)
14
+ resolve(html);
15
+ else
16
+ reject(new Error('Nunjucks returned null HTML'));
17
+ });
18
+ });
19
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRenderData = void 0;
4
+ const getRenderData = (req, res, next) => {
5
+ // return {
6
+ // fullUrl:
7
+ // }
8
+ };
9
+ exports.getRenderData = getRenderData;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.prepareData = void 0;
4
+ const prepareData = async (res, url) => {
5
+ try {
6
+ if (res.locals.cache.getRender) {
7
+ // أول حاجة نحاول نجيب البيانات من الكاش
8
+ const dataFromCache = await res.locals.cache.getRender(url, "");
9
+ if (dataFromCache) {
10
+ res.locals.render = dataFromCache;
11
+ return; // طالما موجودة في الكاش مش محتاج أكمل
12
+ }
13
+ // لو مش موجودة في الكاش، أجيبها من السيرفر
14
+ const engineResponse = await fetch("https://store-gate.qumra-dev.site/render", {
15
+ method: "POST",
16
+ headers: {
17
+ 'Content-Type': 'application/json',
18
+ },
19
+ body: JSON.stringify({ url }),
20
+ });
21
+ if (engineResponse.ok) {
22
+ const data = await engineResponse.json();
23
+ res.locals.cache.setRender(url, "", data);
24
+ res.locals.render = data;
25
+ }
26
+ }
27
+ }
28
+ catch (err) {
29
+ console.error("🚀 ~ prepareData error:", err);
30
+ }
31
+ };
32
+ exports.prepareData = prepareData;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.prepareDataMiddleware = void 0;
4
+ const node_consul_service_1 = require("node-consul-service");
5
+ const prepareDataMiddleware = async (req, res, next) => {
6
+ try {
7
+ const engineResponse = await (0, node_consul_service_1.callService)("engine-service", {
8
+ path: "/v1/render",
9
+ method: "POST",
10
+ data: {
11
+ url: res.locals.fullUrl,
12
+ },
13
+ });
14
+ if (engineResponse.success) {
15
+ res.locals.render = engineResponse.data;
16
+ }
17
+ else {
18
+ res.locals.render = null;
19
+ }
20
+ console.log(res.locals);
21
+ next();
22
+ }
23
+ catch (err) {
24
+ console.error("🚀 ~ Middleware error:", err);
25
+ return res.status(500).json({ message: "Internal Server Error" });
26
+ }
27
+ };
28
+ exports.prepareDataMiddleware = prepareDataMiddleware;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.renderHandler = void 0;
4
+ const render_1 = require("../utils/render");
5
+ const renderHandler = async (res) => {
6
+ try {
7
+ const page = res.locals.render.context?.page;
8
+ if (page) {
9
+ await (0, render_1.render)(page.fileName, {}, res);
10
+ }
11
+ else {
12
+ await safeRender("404.njk", res, 404, "Page not found");
13
+ }
14
+ }
15
+ catch (error) {
16
+ // console.error("🚀 ~ renderHandler ~ error:", error);
17
+ await safeRender("404.njk", res, 404, "Page not found");
18
+ }
19
+ };
20
+ exports.renderHandler = renderHandler;
21
+ const safeRender = async (fileName, res, statusCode, fallbackMessage) => {
22
+ try {
23
+ await (0, render_1.render)(fileName, {}, res);
24
+ }
25
+ catch (error) {
26
+ // console.error(`🚀 ~ safeRender ~ error rendering ${fileName}:`, error);
27
+ if (!res.headersSent) {
28
+ res.status(statusCode).send(fallbackMessage);
29
+ }
30
+ }
31
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // types/sharedTypes.ts
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.error = exports.warn = exports.log = exports.logger = void 0;
7
+ const pino_1 = __importDefault(require("pino"));
8
+ exports.logger = (0, pino_1.default)({
9
+ name: 'nunjucks-middleware',
10
+ transport: {
11
+ target: 'pino-pretty',
12
+ options: {
13
+ colorize: true,
14
+ translateTime: 'SYS:standard',
15
+ ignore: 'pid,hostname',
16
+ },
17
+ },
18
+ });
19
+ exports.log = exports.logger.info.bind(exports.logger);
20
+ exports.warn = exports.logger.warn.bind(exports.logger);
21
+ exports.error = exports.logger.error.bind(exports.logger);
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.render = render;
7
+ const nunjucksEnv_1 = require("../nunjucksEnv");
8
+ const path_1 = __importDefault(require("path"));
9
+ function render(view, context = {}, res) {
10
+ return new Promise((resolve, reject) => {
11
+ const viewsPath = path_1.default.join(res.locals.themesPath ?? process.cwd(), "views");
12
+ const env = (0, nunjucksEnv_1.configureNunjucks)(viewsPath);
13
+ env.render(view, context, (err, html) => {
14
+ if (err)
15
+ return reject(err);
16
+ if (html !== null) {
17
+ res.send(html);
18
+ return resolve();
19
+ }
20
+ return reject(new Error('Nunjucks returned null HTML'));
21
+ });
22
+ });
23
+ }
package/package.json CHANGED
@@ -1,41 +1,29 @@
1
1
  {
2
2
  "name": "qumra-engine",
3
- "version": "1.0.128",
4
- "main": "dist/bundle.cjs.js",
5
- "module": "dist/bundle.esm.js",
3
+ "version": "2.0.0",
4
+ "main": "dist/index.js",
5
+ "types": "dist/index.d.ts",
6
6
  "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1",
8
- "build": "rollup -c --bundleConfigAsCjs",
9
- "upload": "npx webpack && git add -A && git commit -m 'save' && git push origin main && npm version patch && npm publish"
7
+ "build": "tsc -w",
8
+ "start:dev": "ts-node test/test-app.ts",
9
+ "dev": "nodemon --watch src --watch test --ext ts,njk --exec ts-node test/test-app.ts"
10
10
  },
11
- "keywords": [],
12
- "author": "",
13
- "license": "ISC",
14
- "description": "",
15
11
  "dependencies": {
16
- "@rollup/plugin-babel": "^6.0.4",
17
- "cache-express": "^1.0.2",
18
- "compression": "^1.7.5",
19
- "cookie-parser": "^1.4.6",
20
- "dinero.js": "^1.9.1",
21
- "express-fingerprint": "^1.2.2",
22
- "express-minify-html": "^0.12.0",
12
+ "chalk": "^5.4.1",
13
+ "express": "^4.18.2",
14
+ "morgan": "^1.10.0",
23
15
  "nunjucks": "^3.2.4",
24
- "qumra-cli": "^1.1.8",
25
- "ua-parser-js": "^1.0.39"
16
+ "pino": "^9.7.0",
17
+ "pino-pretty": "^13.0.0"
26
18
  },
27
19
  "devDependencies": {
28
- "@babel/core": "^7.25.2",
29
- "@babel/preset-env": "^7.25.4",
30
- "@rollup/plugin-commonjs": "^26.0.1",
31
- "@rollup/plugin-json": "^6.1.0",
32
- "@rollup/plugin-node-resolve": "^15.2.3",
33
- "babel-loader": "^9.1.3",
34
- "copy-webpack-plugin": "^12.0.2",
35
- "rollup-plugin-babel": "^4.4.0",
36
- "rollup-plugin-terser": "^7.0.2",
37
- "webpack": "^5.94.0",
38
- "webpack-cli": "^5.1.4",
39
- "webpack-node-externals": "^3.0.0"
20
+ "@types/chalk": "^0.4.31",
21
+ "@types/express": "^4.17.21",
22
+ "@types/morgan": "^1.9.10",
23
+ "@types/node": "^20.4.2",
24
+ "@types/nunjucks": "^3.2.6",
25
+ "nodemon": "^3.1.10",
26
+ "ts-node": "^10.9.1",
27
+ "typescript": "^5.2.2"
40
28
  }
41
29
  }
package/views/home.njk ADDED
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html lang="ar">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>{{ title }}</title>
6
+ </head>
7
+ <body>
8
+ <h1>{{ title }}</h1>
9
+ <p>تم عرض هذا القالب باستخدام Nunjucks وExpress Middleware!</p>
10
+ <p>سعر المنتج: {{ 1234.5 | formatMoney('aaa') }}</p>
11
+ <p>تاريخ الطلب: {{ '2024-06-01' | formatDate('ar-EG') }}</p>
12
+ <p>اسم العميل: {{ 'ahmed' | capitalize }}</p>
13
+ <p>اsdssdلخصم: {{ 20 | discountLabel }}</p>
14
+ </body>
15
+ </html>
@@ -1,2 +0,0 @@
1
- /*! For license information please see bundle.cjs.js.LICENSE.txt */
2
- (()=>{var t={516:(t,e,r)=>{"use strict";r.r(e),r.d(e,{pagesData:()=>o,targets:()=>n});var n={theme:"theme",widget:"widget"},o={home:"/",cart:"cart",bestSeller:"best-seller",latest:"latest",category:"category/[slug]",product:"product/[slug]",order:"thanks/[id]",search:"search",page:"page/[slug]",blog:"blog/[slug]",latest_blogs:"latest_blogs"}},432:(t,e,r)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(){"use strict";o=function(){return e};var t,e={},r=Object.prototype,i=r.hasOwnProperty,a=Object.defineProperty||function(t,e,r){t[e]=r.value},c="function"==typeof Symbol?Symbol:{},u=c.iterator||"@@iterator",l=c.asyncIterator||"@@asyncIterator",s=c.toStringTag||"@@toStringTag";function p(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{p({},"")}catch(t){p=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var o=e&&e.prototype instanceof b?e:b,i=Object.create(o.prototype),c=new G(n||[]);return a(i,"_invoke",{value:k(t,r,c)}),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var d="suspendedStart",y="suspendedYield",v="executing",g="completed",m={};function b(){}function w(){}function x(){}var j={};p(j,u,(function(){return this}));var O=Object.getPrototypeOf,S=O&&O(O(T([])));S&&S!==r&&i.call(S,u)&&(j=S);var L=x.prototype=b.prototype=Object.create(j);function E(t){["next","throw","return"].forEach((function(e){p(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function r(o,a,c,u){var l=h(t[o],t,a);if("throw"!==l.type){var s=l.arg,p=s.value;return p&&"object"==n(p)&&i.call(p,"__await")?e.resolve(p.__await).then((function(t){r("next",t,c,u)}),(function(t){r("throw",t,c,u)})):e.resolve(p).then((function(t){s.value=t,c(s)}),(function(t){return r("throw",t,c,u)}))}u(l.arg)}var o;a(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}})}function k(e,r,n){var o=d;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===g){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=P(c,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var l=h(e,r,n);if("normal"===l.type){if(o=n.done?g:y,l.arg===m)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=g,n.method="throw",n.arg=l.arg)}}}function P(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,P(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=h(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function D(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function N(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function G(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(D,this),this.reset(!0)}function T(e){if(e||""===e){var r=e[u];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(i.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(n(e)+" is not iterable")}return w.prototype=x,a(L,"constructor",{value:x,configurable:!0}),a(x,"constructor",{value:w,configurable:!0}),w.displayName=p(x,s,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,x):(t.__proto__=x,p(t,s,"GeneratorFunction")),t.prototype=Object.create(L),t},e.awrap=function(t){return{__await:t}},E(_.prototype),p(_.prototype,l,(function(){return this})),e.AsyncIterator=_,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new _(f(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(L),p(L,s,"Generator"),p(L,u,(function(){return this})),p(L,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=T,G.prototype={constructor:G,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(N),!e)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),l=i.call(a,"finallyLoc");if(u&&l){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),N(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;N(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:T(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function i(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function a(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?i(Object(r),!0).forEach((function(e){c(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function c(t,e,r){return(e=function(t){var e=function(t){if("object"!=n(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function u(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}var l=r(271),s=r(928),p=r(915),f=r(896),h=r(863),d=r(908),y=r(926),v=r(985).setLocales,g=r(93).setGlobal,m=r(525).createHooks;t.exports=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"production";return function(){var n,i=(n=o().mark((function n(i,c,u){var b,w,x,j,O,S,L,E,_,k,P,D,N,G,T,q,A,C,F,I,z;return o().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(x=c.locals.render,j=x.global,O=x.context,S=x.engine,x.app,L=null!==(b=c.locals.customer)&&void 0!==b?b:null,E=null!==(w=c.locals.cart)&&void 0!==w?w:{},_=i.originalUrl,k=i.protocol,!p(_)){n.next=7;break}return u(),n.abrupt("return");case 7:for(T in P=e.viewsDirectory,D=s.join(null!=P?P:c.locals.themePath,"views"),N=s.join(null!=P?P:c.locals.themePath,"locales"),G=l.configure(D,{autoescape:!0,express:t,watch:e.watch||!1,noCache:e.noCache||!1}),h)G.addFilter(T,h[T]);for(q in f.existsSync(N)&&f.statSync(N).isDirectory()?f.readdirSync(N).forEach((function(t){if(t.endsWith(".json")){var e=s.basename(t,".json"),r=s.join(N,t);if(f.existsSync(r)){var n=f.readFileSync(r,"utf-8");v(e,JSON.parse(n))}}})):console.log("المجلد غير موجود أو أنه ليس مجلدًا."),d)G.addGlobal(q,d[q]);for(F in A=y(_),g("lang",A.language),C="".concat(k,"://").concat(i.get("host")).concat(A.path),j)Object.hasOwnProperty.call(j,F)&&g(F,j[F]);null!=O&&O.page?(I=a({},j),z=m({global:j,engine:S,fullUrl:C,env:G,data:I,mode:r,context:O,customer:L,cart:E}),c.render(O.page.fileName,{global:j,context:O,hooks:z})):c.render("404",{global:j,context:O});case 19:case"end":return n.stop()}}),n)})),function(){var t=this,e=arguments;return new Promise((function(r,o){var i=n.apply(t,e);function a(t){u(i,r,o,a,c,"next",t)}function c(t){u(i,r,o,a,c,"throw",t)}a(void 0)}))});return function(t,e,r){return i.apply(this,arguments)}}()}},511:(t,e,r)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(){"use strict";o=function(){return e};var t,e={},r=Object.prototype,i=r.hasOwnProperty,a=Object.defineProperty||function(t,e,r){t[e]=r.value},c="function"==typeof Symbol?Symbol:{},u=c.iterator||"@@iterator",l=c.asyncIterator||"@@asyncIterator",s=c.toStringTag||"@@toStringTag";function p(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{p({},"")}catch(t){p=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var o=e&&e.prototype instanceof b?e:b,i=Object.create(o.prototype),c=new G(n||[]);return a(i,"_invoke",{value:k(t,r,c)}),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var d="suspendedStart",y="suspendedYield",v="executing",g="completed",m={};function b(){}function w(){}function x(){}var j={};p(j,u,(function(){return this}));var O=Object.getPrototypeOf,S=O&&O(O(T([])));S&&S!==r&&i.call(S,u)&&(j=S);var L=x.prototype=b.prototype=Object.create(j);function E(t){["next","throw","return"].forEach((function(e){p(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function r(o,a,c,u){var l=h(t[o],t,a);if("throw"!==l.type){var s=l.arg,p=s.value;return p&&"object"==n(p)&&i.call(p,"__await")?e.resolve(p.__await).then((function(t){r("next",t,c,u)}),(function(t){r("throw",t,c,u)})):e.resolve(p).then((function(t){s.value=t,c(s)}),(function(t){return r("throw",t,c,u)}))}u(l.arg)}var o;a(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}})}function k(e,r,n){var o=d;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===g){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=P(c,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var l=h(e,r,n);if("normal"===l.type){if(o=n.done?g:y,l.arg===m)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=g,n.method="throw",n.arg=l.arg)}}}function P(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,P(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=h(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function D(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function N(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function G(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(D,this),this.reset(!0)}function T(e){if(e||""===e){var r=e[u];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(i.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(n(e)+" is not iterable")}return w.prototype=x,a(L,"constructor",{value:x,configurable:!0}),a(x,"constructor",{value:w,configurable:!0}),w.displayName=p(x,s,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,x):(t.__proto__=x,p(t,s,"GeneratorFunction")),t.prototype=Object.create(L),t},e.awrap=function(t){return{__await:t}},E(_.prototype),p(_.prototype,l,(function(){return this})),e.AsyncIterator=_,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new _(f(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(L),p(L,s,"Generator"),p(L,u,(function(){return this})),p(L,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=T,G.prototype={constructor:G,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(N),!e)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),l=i.call(a,"finallyLoc");if(u&&l){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),N(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;N(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:T(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function i(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function a(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?i(Object(r),!0).forEach((function(e){c(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function c(t,e,r){return(e=function(t){var e=function(t){if("object"!=n(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function u(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}var l=r(271),s=r(928),p=r(915),f=r(896),h=r(863),d=r(908),y=r(926),v=r(985).setLocales,g=r(93).setGlobal,m=r(525).createHooks,b=r(409);t.exports=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"production";return function(){var n,i=(n=o().mark((function n(i,c,u){var w,x,j,O,S,L,E,_,k,P,D,N,G,T,q,A,C,F,I,z,U,J,Y,M,$,H,R,W,B,K,V,Q,X,Z,tt,et,rt;return o().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(c.locals.render.app,j=null!==(w=c.locals.customer)&&void 0!==w?w:null,console.log("🚀 ~ return ~ res.locals.render:",c.locals.render),O=null!==(x=c.locals.cart)&&void 0!==x?x:{},S=i.originalUrl,L=i.protocol,!p(S)){n.next=8;break}return u(),n.abrupt("return");case 8:return E=y(S),g("lang",E.language),_="".concat(L,"://").concat(i.get("host")).concat(E.path),k=e.viewsDirectory,P=s.join(null!=k?k:c.locals.themePath,"views"),D=s.join(null!=k?k:c.locals.themePath,"locales"),N=l.configure(P,{autoescape:!0,express:t,watch:e.watch||!1,noCache:e.noCache||!1}),G=s.join(k,"schema.json"),f.existsSync(G)||console.log("schema.js is not found in src Directory"),T=s.join(k,"data.json"),f.existsSync(T)||console.log("data.js is not found in src Directory"),q=s.join(k,"widget.njk"),f.existsSync(T)||console.log("data.js is not found in src Directory"),A=JSON.parse(f.readFileSync(T,"utf-8")),C=JSON.parse(f.readFileSync(G,"utf-8")),F=f.readFileSync(q,"utf-8"),n.next=26,b({data:A,schema:C});case 26:if(n.sent.valid){n.next=30;break}return console.error("data not vaild with schema"),n.abrupt("return",c.status(401).json({error:"data.json not vaild with data.json"}));case 30:return I={view:F,schema:C,data:A},z={},U=i.cookies,J=U.token,Y=U.qvid,M=U.qaid,J&&(z.Authorization=J),Y&&(z.qvid=Y),M&&(z.qaid=M),z["x-subdomain"]="minikid",$=a({"Content-Type":"application/json"},z),H="staging"===process.env.MODE?"https://api.qumra-dev.site":"https://api.qumra.cloud",n.next=41,fetch("".concat(H,"/templateEngine/v1/renderWidget?path=").concat(encodeURIComponent(_)),{method:"POST",headers:$,body:JSON.stringify(I)});case 41:return R=n.sent,n.next=44,R.json();case 44:for(Q in W=n.sent,B=W.global,K=W.context,V=W.engine,h)N.addFilter(Q,h[Q]);for(X in f.existsSync(D)&&f.statSync(D).isDirectory()?f.readdirSync(D).forEach((function(t){if(t.endsWith(".json")){var e=s.basename(t,".json"),r=s.join(D,t);if(f.existsSync(r)){var n=f.readFileSync(r,"utf-8");v(e,JSON.parse(n))}}})):console.log("المجلد غير موجود أو أنه ليس مجلدًا."),d)N.addGlobal(X,d[X]);for(Z in B)Object.hasOwnProperty.call(B,Z)&&g(Z,B[Z]);null!=K&&K.page?(tt=a({},B),et=m({global:B,engine:V,fullUrl:_,env:N,data:tt,mode:r,context:K,customer:j,cart:O}),rt='\n <!DOCTYPE html>\n<html lang="ar">\n\n <head>\n <meta charset="utf-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n {{ hooks.seo | safe }}\n {{ hooks.head | safe }}\n <link rel="stylesheet" href={{"style.css" | assets}}>\n {# <script src="http://127.0.0.1:5501/dist/gearbox/qumra-gearbox.js" defer><\/script> #}\n {# <script type="module" src="http://127.0.0.1:5502/dist/esm/qumra-ui.js"><\/script> #}\n {# <script src="http://127.0.0.1:5501/dist/gearbox/qumra-gearbox.js" defer><\/script> #}\n {# <script src="//unpkg.com/alpinejs" defer><\/script> #}\n <link rel=\'stylesheet\' href=\'https://cdn-uicons.flaticon.com/2.6.0/uicons-regular-rounded/css/uicons-regular-rounded.css\'>\n <link rel=\'stylesheet\' href=\'https://cdn-uicons.flaticon.com/2.6.0/uicons-regular-straight/css/uicons-regular-straight.css\'>\n <style>\n * {\n font-family: "{{global.app.settings.font.title}}" !important;\n }\n :root {\n --mainRadius: 0;\n }\n </style>\n\n </head>\n <body dir="rtl" >\n {{ hooks.widget | safe}}\n <script src={{"app.js" | assets }} ><\/script>\n {{ hooks.body | safe }}\n </body>\n\n</html>',console.log("🚀 ~ env.renderString ~ templateString:",rt),N.renderString(rt,{global:B,hooks:et},(function(t,e){if(console.log("🚀 ~ env.renderString ~ output:",e),t)return u(t);c.send(e)}))):c.render("404",{global:B,context:K});case 51:case"end":return n.stop()}}),n)})),function(){var t=this,e=arguments;return new Promise((function(r,o){var i=n.apply(t,e);function a(t){u(i,r,o,a,c,"next",t)}function c(t){u(i,r,o,a,c,"throw",t)}a(void 0)}))});return function(t,e,r){return i.apply(this,arguments)}}()}},863:(t,e,r)=>{var n=r(93).getGlobal;r(38),t.exports={upperCase:function(t){return t.toUpperCase()},reverse:function(t){return t.split("").reverse().join("")},capitalize:function(t){return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()},formatCurrency:function(t){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"$")+parseFloat(t).toFixed(2)},money:function(t){if(t){var e=n("app").currency;return"".concat(t.toFixed(2)," ").concat(e.currencySymbol)}return"يجب ان يكون رقم"},date:function(t){return new Date(t).toISOString().split("T")[0]},applyDiscount:function(t,e){return t-t*(e/100)},addVAT:function(t){return t+t*((arguments.length>1&&void 0!==arguments[1]?arguments[1]:15)/100)},pluralize:function(t,e,r){return 1===t?e:r},truncate:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;return t.length>e?t.slice(0,e)+"...":t},trimSpaces:function(t){return t.trim()},isEmpty:function(t){return!t||0===t.trim().length},slugify:function(t){var e;return null===(e=t.toLowerCase())||void 0===e||null===(e=e.replace(/\s+/g,"-"))||void 0===e?void 0:e.replace(/[^\w-]+/g,"")},formatNumber:function(t){var e;return null==t||null===(e=t.toString())||void 0===e?void 0:e.replace(/\B(?=(\d{3})+(?!\d))/g,",")},assets:function(t){return n("assets")+t},cdn:function(t){return n("cdn")},rgba:function(t,e){return/^#([0-9A-F]{3}){1,2}$/i.test(t)?(4===t.length?(r=parseInt(t[1]+t[1],16),n=parseInt(t[2]+t[2],16),o=parseInt(t[3]+t[3],16)):(r=parseInt(t[1]+t[2],16),n=parseInt(t[3]+t[4],16),o=parseInt(t[5]+t[6],16)),e=Math.min(1,Math.max(0,parseFloat(e))),"rgba(".concat(r,", ").concat(n,", ").concat(o,", ").concat(e,")")):t;var r,n,o},seo:function(){return'<title>متجر تجريبي</title>\n<meta name="description" content="متجر تجريبي - Demo Store">\n<meta name="keywords" content="متجر,تجريبي,-,Demo,Store">\n<meta property="store:published_time" content="2024-08-09T06:03:33+03:00">\n<meta property="og:description" content="متجر تجريبي - Demo Store">\n<meta property="og:title" content="متجر تجريبي">\n<meta property="og:type" content="store">\n<meta property="og:locale" content="ar_AR">\n<meta property=":locale:alternate" content="ar_AR">\n<meta property=":locale:alternate" content="en_US">\n<meta property="og:url" content="https://salla.design/dev-ruj4uvkrq9hz389z">\n<meta property="og:image" content="https://salla-dev.s3.eu-central-1.amazonaws.com/logo/logo-fashion.jpg">\n<meta property="og:image:width" content="600">\n<meta property="og:image:height" content="300">\n<meta name="twitter:description" content="متجر تجريبي - Demo Store">\n<meta name="twitter:image" content="https://salla-dev.s3.eu-central-1.amazonaws.com/logo/logo-fashion.jpg">\n<meta name="twitter:card" content="summary_large_image">\n<meta name="twitter:title" content="متجر تجريبي">\n<meta name="twitter:url" content="https://salla.design/dev-ruj4uvkrq9hz389z">\n<meta name="twitter:site" content="@SallaApp">\n<meta name="twitter:creator" content="@SallaApp">\n<script type="application/ld+json">{"@context":"https://schema.org","@type":"Organization","name":"متجر تجريبي","description":"متجر تجريبي - Demo Store","url":"https://salla.design/dev-ruj4uvkrq9hz389z","logo":"https://salla-dev.s3.eu-central-1.amazonaws.com/logo/logo-fashion.jpg"}<\/script>'}}},908:(t,e,r)=>{var n=r(93),o=n.getGlobal,i=n.setGlobal,a=r(985).getLocales,c=r(413);t.exports={set:function(t,e){i(t,e)},get:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return o(t)||e},t:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=o("lang")||"ar",n=a(r);return n&&c(n,t)||e}}},99:(t,e,r)=>{var n=r(516).targets,o=r(432),i=r(511),a=r(961);t.exports=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"production",c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n.theme;return a(t),c===n.theme?o(t,e,r):c===n.widget?i(t,e,r):void 0}},91:(t,e,r)=>{var n=r(757),o=n({parameters:[n.acceptHeaders,n.geoip]});t.exports=function(t,e,r){o(t,e,(function(){r()}))}},93:t=>{var e={};t.exports={getGlobal:function(t,r){var n;return null!==(n=e[t])&&void 0!==n?n:r},setGlobal:function(t,r){e[t]=r}}},985:t=>{var e={};t.exports={getLocales:function(t){return e[t]},setLocales:function(t,r){e[t]=r}}},552:t=>{t.exports=function(t,e){return{content:t,priority:e}}},389:(t,e,r)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?o(Object(r),!0).forEach((function(e){a(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function a(t,e,r){return(e=function(t){var e=function(t){if("object"!=n(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var c=r(516).pagesData,u=r(552),l=r(301),s=r(852);t.exports=function(t){var e,r,n,o,a,p,f,h,d,y,v=t.global,g=t.fullUrl,m=t.engine,b=t.env,w=t.data,x=t.mode,j=t.context,O=t.customer,S=t.cart;console.log("🚀 ~ data:",w);var L=null===(e=m.widgets)||void 0===e?void 0:e.map((function(t){return b.renderString(t.view,i(i({global:v,context:j},null==t?void 0:t.data),{},{_id:t._id}))})).join(""),E=j.page.title,_="".concat(v.app.name," - ").concat(j.page.title),k=v.app.description,P=v.app.logoUrl,D=v.app.logoUrl,N=w.app.url,G=[{"@type":"ListItem",position:1,name:v.app.name,item:N}];j.page.path!==c.home&&G.push({"@type":"ListItem",position:2,name:E,item:g});var T,q,A,C,F,I,z={event:"view_content",page:{title:_,url:g},user:{user_id:null!==(r=null==w||null===(n=w.customer)||void 0===n?void 0:n.id)&&void 0!==r?r:0,user_type:null!=w&&w.customer?"logged-in":"guest"},cart:{total_items:null!==(o=null==j||null===(a=j.cart)||void 0===a||null===(a=a.items)||void 0===a?void 0:a.length)&&void 0!==o?o:0,total_price:null!==(p=parseFloat(null==j||null===(f=j.cart)||void 0===f?void 0:f.totalProductsAfterDiscount))&&void 0!==p?p:0,currency:null!==(h=w.settings.currency[0].currencyCode)&&void 0!==h?h:"LE"}};j.page.path===c.product&&(z.product={name:E,category:null==j||null===(T=j.product)||void 0===T||null===(T=T.category)||void 0===T?void 0:T.title,id:null==j||null===(q=j.product)||void 0===q?void 0:q.id,price:null==j||null===(A=j.product)||void 0===A?void 0:A.priceAfterDiscount,currency:null!==(C=w.settings.currency[0].currencyCode)&&void 0!==C?C:"LE"}),j.page.path===c.product&&(P=null===(F=j.product)||void 0===F||null===(F=F.images[0])||void 0===F?void 0:F.imageUrl,k=l(null===(I=j.product)||void 0===I?void 0:I.content));var U,J,Y,M,$,H,R,W,B,K,V,Q,X,Z={widgets:[u(L,15)],seo:[u('<link rel="icon" type="image/png" sizes="32x32" href="'.concat(D,'">')),u("<title>".concat(_,"</title>")),u('<meta name="description" content="'.concat(k,'">')),u('<meta property="og:title" content="'.concat(_,'">')),u('<meta property="og:description" content="'.concat(k,'">')),u('<meta property="og:type" content="website">'),u('<meta property="og:locale" content="ar_AR">'),u('<meta property="og:url" content="'.concat(g,'">')),u('<meta property="og:image" content="'.concat(P,'">')),u('<meta property="og:image:width" content="600">'),u('<meta property="og:image:height" content="300">'),u('<meta name="twitter:card" content="summary_large_image">'),u('<meta name="twitter:title" content="'.concat(_,'">')),u('<meta name="twitter:description" content="'.concat(k,'">')),u('<meta name="twitter:image" content="'.concat(P,'">')),u('<meta name="twitter:site" content="@qumracloud">'),u('<meta name="twitter:creator" content="@qumracloud">'),u('<link rel="canonical" href="'.concat(g,'">')),u('<script type="application/ld+json">{"@context": "https://schema.org","@type": "Organization","name": "'.concat(_,'","description": "').concat(k,'","url": "').concat(g,'","logo": "').concat(P,'"}<\/script>')),u('<script type="application/ld+json">\n {\n "@context": "https://schema.org",\n "@type": "BreadcrumbList",\n "itemListElement": '.concat(JSON.stringify(G),"\n }\n <\/script>"))],head:[u("<script>\n window.__qumra__ = window.__qumra__ || {}; window.__qumra__.data = ".concat(s(JSON.stringify(i(i({},w),{},{mode:x}))),";\n \n window.__qumra__.customer = ").concat(s(JSON.stringify(O)),";\n window.__qumra__.cart = ").concat(s(JSON.stringify(S)),";\n <\/script>")),u("<script>\n window.dataLayer = window.dataLayer || []; window.dataLayer.push(".concat(JSON.stringify(z),");\n ;<\/script>"))],body:[]};return null!=m&&null!==(d=m.injectionCode)&&void 0!==d&&d.head&&Z.head.push(u(null!==(U=null===(J=m.injectionCode)||void 0===J?void 0:J.head)&&void 0!==U?U:null,16)),null!=m&&null!==(y=m.injectionCode)&&void 0!==y&&y.body&&Z.body.push(u(null!==(Y=null===(M=m.injectionCode)||void 0===M?void 0:M.body)&&void 0!==Y?Y:null,16)),j.page.path===c.product&&Z.seo.push(u('<script type="application/ld+json">\n{\n "@context": "https://schema.org",\n "@type": "Product",\n "productID": "'.concat(j.product.id,'",\n "offers": [{\n "@type": "Offer",\n "name": "').concat(E,'",\n "availability":"https://schema.org/InStock",\n "price": ').concat(null==j||null===($=j.product)||void 0===$?void 0:$.priceAfterDiscount,',\n "priceCurrency": "').concat(null!==(H=w.settings.currency[0].currencyCode)&&void 0!==H?H:"LE",'",\n \n "sku": "').concat(null==j||null===(R=j.product)||void 0===R?void 0:R.SKU,'",\n "url": "').concat(g,'"\n }\n],"brand": {\n "@type": "Brand",\n "name": "').concat(w.app.name,'"\n },\n "name": "').concat(null===(W=j.product)||void 0===W?void 0:W.title,'",\n "description": "').concat(l(null==j||null===(B=j.product)||void 0===B?void 0:B.content),'",\n "category": "').concat(null==j||null===(K=j.product)||void 0===K||null===(K=K.category)||void 0===K?void 0:K.title,'",\n "url": "').concat(g,'",\n "sku": "').concat(null==j||null===(V=j.product)||void 0===V?void 0:V.SKU,'",\n "weight": {\n "@type": "QuantitativeValue",\n "unitCode": "kg",\n "value": 0.0\n },\n "image": {\n "@type": "ImageObject",\n "url": "').concat(null==j||null===(Q=j.product)||void 0===Q||null===(Q=Q.images[0])||void 0===Q?void 0:Q.imageUrl,'",\n "image": "').concat(null==j||null===(X=j.product)||void 0===X||null===(X=X.images[0])||void 0===X?void 0:X.imageUrl,'",\n "name": "",\n "width": "1024",\n "height": "1024"\n }\n}\n<\/script>'))),Object.keys(Z).forEach((function(t){Z[t]=Z[t].sort((function(t,e){return e.priority-t.priority})).map((function(t){return b.renderString(t.content)})).join("")})),Z}},961:(t,e,r)=>{r(355);var n=r(174),o=(r(285),r(898)),i=r(91);t.exports=function(t){t.set("view engine","njk"),t.use(o()),t.use(i),t.use(n())}},926:t=>{t.exports=function(t){var e={language:"ar",path:null},r=t.match(/^\/([a-z]{2})\/(.*)$/);return r?(e.language=r[1],e.path="/".concat(r[2])):(r=t.match(/^\/([a-z]{2})$/))?(e.language=r[1],e.path="/"):e.path=t,e}},413:t=>{t.exports=function(t,e){return e.split(".").reduce((function(t,e){return t&&t[e]}),t)}},525:(t,e,r)=>{var n=r(552),o=r(389),i=r(852);t.exports={addToHook:n,sanitizeInput:i,createHooks:o}},915:(t,e,r)=>{var n=r(516).targets;t.exports=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.theme;return e===n.theme?[".jpg",".jpeg",".png",".webp",".gif",".svg",".js",".css",".woff",".woff2",".ttf",".ico"].some((function(e){return t.endsWith(e)})):e===n.widget?!["/"].includes(t):void 0}},301:t=>{t.exports=function(t){return null==t?void 0:t.replace(/<\/?[^>]+(>|$)/g,"")}},852:t=>{t.exports=function(t){return null==t?void 0:t.replace(/<script.*?>.*?<\/script>/gi,"")}},409:t=>{function e(){"use strict";e=function(){return r};var t,r={},n=Object.prototype,o=n.hasOwnProperty,a=Object.defineProperty||function(t,e,r){t[e]=r.value},c="function"==typeof Symbol?Symbol:{},u=c.iterator||"@@iterator",l=c.asyncIterator||"@@asyncIterator",s=c.toStringTag||"@@toStringTag";function p(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{p({},"")}catch(t){p=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var o=e&&e.prototype instanceof b?e:b,i=Object.create(o.prototype),c=new G(n||[]);return a(i,"_invoke",{value:k(t,r,c)}),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}r.wrap=f;var d="suspendedStart",y="suspendedYield",v="executing",g="completed",m={};function b(){}function w(){}function x(){}var j={};p(j,u,(function(){return this}));var O=Object.getPrototypeOf,S=O&&O(O(T([])));S&&S!==n&&o.call(S,u)&&(j=S);var L=x.prototype=b.prototype=Object.create(j);function E(t){["next","throw","return"].forEach((function(e){p(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function r(n,a,c,u){var l=h(t[n],t,a);if("throw"!==l.type){var s=l.arg,p=s.value;return p&&"object"==i(p)&&o.call(p,"__await")?e.resolve(p.__await).then((function(t){r("next",t,c,u)}),(function(t){r("throw",t,c,u)})):e.resolve(p).then((function(t){s.value=t,c(s)}),(function(t){return r("throw",t,c,u)}))}u(l.arg)}var n;a(this,"_invoke",{value:function(t,o){function i(){return new e((function(e,n){r(t,o,e,n)}))}return n=n?n.then(i,i):i()}})}function k(e,r,n){var o=d;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===g){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=P(c,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var l=h(e,r,n);if("normal"===l.type){if(o=n.done?g:y,l.arg===m)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=g,n.method="throw",n.arg=l.arg)}}}function P(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,P(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=h(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function D(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function N(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function G(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(D,this),this.reset(!0)}function T(e){if(e||""===e){var r=e[u];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,a=function r(){for(;++n<e.length;)if(o.call(e,n))return r.value=e[n],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(i(e)+" is not iterable")}return w.prototype=x,a(L,"constructor",{value:x,configurable:!0}),a(x,"constructor",{value:w,configurable:!0}),w.displayName=p(x,s,"GeneratorFunction"),r.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,x):(t.__proto__=x,p(t,s,"GeneratorFunction")),t.prototype=Object.create(L),t},r.awrap=function(t){return{__await:t}},E(_.prototype),p(_.prototype,l,(function(){return this})),r.AsyncIterator=_,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new _(f(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(L),p(L,s,"Generator"),p(L,u,(function(){return this})),p(L,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=T,G.prototype={constructor:G,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(N),!e)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),l=o.call(a,"finallyLoc");if(u&&l){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),N(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;N(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:T(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},r}function r(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=n(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var o=0,i=function(){};return{s:i,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,c=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return c=t.done,t},e:function(t){u=!0,a=t},f:function(){try{c||null==r.return||r.return()}finally{if(u)throw a}}}}function n(t,e){if(t){if("string"==typeof t)return o(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function a(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}var c=function(){var t,u=(t=e().mark((function t(a){var u,l,s,p,f,h,d,y,v,g,m,b,w,x,j,O,S,L,E,_,k,P,D;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:u=a.data,l=a.schema,s=a.oldData,p=void 0===s?{}:s,f=[],h={},t.t0=e().keys(l);case 4:if((t.t1=t.t0()).done){t.next=69;break}if(d=t.t1.value,y=l[d],v=u[d],g=p[d],!v||"object"!==i(v.promise)){t.next=13;break}return t.next=12,v.promise;case 12:v=t.sent;case 13:if(!y.required||null!=v&&""!==v){t.next=16;break}return f.push("خطأ: ".concat(y.title," لا يمكن ان يكون فارغاً.")),t.abrupt("continue",4);case 16:if(void 0===v){t.next=67;break}if("string"!==y.type.toLowerCase()||"string"==typeof v){t.next=20;break}return f.push("Error: ".concat(y.title," يجب ان يكون نصاً.")),t.abrupt("continue",4);case 20:if("file"!==y.type.toLowerCase()){t.next=31;break}if(g&&"string"==typeof v){t.next=31;break}if(!v||!v.mimetype){t.next=29;break}if(b=(null!==(m=v.filename)&&void 0!==m?m:v.originalname).split(".").pop().toLowerCase(),!y.extensions||y.extensions.includes(b)){t.next=27;break}return f.push("Error: ".concat(y.title," يجب ان يكون امتداد (").concat(y.extensions.join(", "),").")),t.abrupt("continue",4);case 27:t.next=31;break;case 29:return f.push("Error: ".concat(y.title," يجب ان يكون ملفاً.")),t.abrupt("continue",4);case 31:if("number"!==y.type.toLowerCase()||"number"==typeof v){t.next=34;break}return f.push("Error: ".concat(y.title," يجب ان يكون رقماً.")),t.abrupt("continue",4);case 34:if("boolean"!==y.type.toLowerCase()||"boolean"==typeof v){t.next=37;break}return f.push("Error: ".concat(y.title," يجب ان تكون قيمة منطقية.")),t.abrupt("continue",4);case 37:if("list"!==y.type.toLowerCase()||!Array.isArray(v)){t.next=66;break}w=[],x=0,j=r(v),t.prev=41,j.s();case 43:if((O=j.n()).done){t.next=56;break}return L=O.value,E=g&&null!==(S=g[x])&&void 0!==S?S:{},t.next=48,c({data:L,schema:y.schema,oldData:E});case 48:_=t.sent,k=_.valid,P=_.errors,D=_.data,k?w.push(D):f.push.apply(f,function(t){if(Array.isArray(t))return o(t)}(N=P)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(N)||n(N)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),x++;case 54:t.next=43;break;case 56:t.next=61;break;case 58:t.prev=58,t.t2=t.catch(41),j.e(t.t2);case 61:return t.prev=61,j.f(),t.finish(61);case 64:return h[d]=w,t.abrupt("continue",4);case 66:h[d]=v;case 67:t.next=4;break;case 69:return t.abrupt("return",f.length>0?{valid:!1,errors:f,data:h}:{valid:!0,data:h});case 70:case"end":return t.stop()}var N}),t,null,[[41,58,61,64]])})),function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function c(t){a(i,n,o,c,u,"next",t)}function u(t){a(i,n,o,c,u,"throw",t)}c(void 0)}))});return function(t){return u.apply(this,arguments)}}();t.exports=c},355:t=>{"use strict";t.exports=require("cache-express")},174:t=>{"use strict";t.exports=require("compression")},898:t=>{"use strict";t.exports=require("cookie-parser")},38:t=>{"use strict";t.exports=require("dinero.js")},757:t=>{"use strict";t.exports=require("express-fingerprint")},285:t=>{"use strict";t.exports=require("express-minify-html")},271:t=>{"use strict";t.exports=require("nunjucks")},896:t=>{"use strict";t.exports=require("fs")},928:t=>{"use strict";t.exports=require("path")}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n=r(99);module.exports=n})();
@@ -1 +0,0 @@
1
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
@@ -1,2 +0,0 @@
1
- /*! For license information please see bundle.esm.js.LICENSE.txt */
2
- import{createRequire as t}from"node:module";var e={516:(t,e,r)=>{r.r(e),r.d(e,{pagesData:()=>o,targets:()=>n});var n={theme:"theme",widget:"widget"},o={home:"/",cart:"cart",bestSeller:"best-seller",latest:"latest",category:"category/[slug]",product:"product/[slug]",order:"thanks/[id]",search:"search",page:"page/[slug]",blog:"blog/[slug]",latest_blogs:"latest_blogs"}},432:(t,e,r)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(){o=function(){return e};var t,e={},r=Object.prototype,i=r.hasOwnProperty,a=Object.defineProperty||function(t,e,r){t[e]=r.value},c="function"==typeof Symbol?Symbol:{},u=c.iterator||"@@iterator",l=c.asyncIterator||"@@asyncIterator",s=c.toStringTag||"@@toStringTag";function p(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{p({},"")}catch(t){p=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var o=e&&e.prototype instanceof b?e:b,i=Object.create(o.prototype),c=new G(n||[]);return a(i,"_invoke",{value:k(t,r,c)}),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var d="suspendedStart",y="suspendedYield",v="executing",g="completed",m={};function b(){}function w(){}function x(){}var j={};p(j,u,(function(){return this}));var O=Object.getPrototypeOf,S=O&&O(O(T([])));S&&S!==r&&i.call(S,u)&&(j=S);var L=x.prototype=b.prototype=Object.create(j);function E(t){["next","throw","return"].forEach((function(e){p(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function r(o,a,c,u){var l=h(t[o],t,a);if("throw"!==l.type){var s=l.arg,p=s.value;return p&&"object"==n(p)&&i.call(p,"__await")?e.resolve(p.__await).then((function(t){r("next",t,c,u)}),(function(t){r("throw",t,c,u)})):e.resolve(p).then((function(t){s.value=t,c(s)}),(function(t){return r("throw",t,c,u)}))}u(l.arg)}var o;a(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}})}function k(e,r,n){var o=d;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===g){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=P(c,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var l=h(e,r,n);if("normal"===l.type){if(o=n.done?g:y,l.arg===m)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=g,n.method="throw",n.arg=l.arg)}}}function P(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,P(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=h(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function D(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function N(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function G(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(D,this),this.reset(!0)}function T(e){if(e||""===e){var r=e[u];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(i.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(n(e)+" is not iterable")}return w.prototype=x,a(L,"constructor",{value:x,configurable:!0}),a(x,"constructor",{value:w,configurable:!0}),w.displayName=p(x,s,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,x):(t.__proto__=x,p(t,s,"GeneratorFunction")),t.prototype=Object.create(L),t},e.awrap=function(t){return{__await:t}},E(_.prototype),p(_.prototype,l,(function(){return this})),e.AsyncIterator=_,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new _(f(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(L),p(L,s,"Generator"),p(L,u,(function(){return this})),p(L,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=T,G.prototype={constructor:G,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(N),!e)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),l=i.call(a,"finallyLoc");if(u&&l){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),N(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;N(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:T(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function i(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function a(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?i(Object(r),!0).forEach((function(e){c(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function c(t,e,r){return(e=function(t){var e=function(t){if("object"!=n(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function u(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}var l=r(271),s=r(928),p=r(915),f=r(896),h=r(863),d=r(908),y=r(926),v=r(985).setLocales,g=r(93).setGlobal,m=r(525).createHooks;t.exports=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"production";return function(){var n,i=(n=o().mark((function n(i,c,u){var b,w,x,j,O,S,L,E,_,k,P,D,N,G,T,A,C,q,F,I,z;return o().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(x=c.locals.render,j=x.global,O=x.context,S=x.engine,x.app,L=null!==(b=c.locals.customer)&&void 0!==b?b:null,E=null!==(w=c.locals.cart)&&void 0!==w?w:{},_=i.originalUrl,k=i.protocol,!p(_)){n.next=7;break}return u(),n.abrupt("return");case 7:for(T in P=e.viewsDirectory,D=s.join(null!=P?P:c.locals.themePath,"views"),N=s.join(null!=P?P:c.locals.themePath,"locales"),G=l.configure(D,{autoescape:!0,express:t,watch:e.watch||!1,noCache:e.noCache||!1}),h)G.addFilter(T,h[T]);for(A in f.existsSync(N)&&f.statSync(N).isDirectory()?f.readdirSync(N).forEach((function(t){if(t.endsWith(".json")){var e=s.basename(t,".json"),r=s.join(N,t);if(f.existsSync(r)){var n=f.readFileSync(r,"utf-8");v(e,JSON.parse(n))}}})):console.log("المجلد غير موجود أو أنه ليس مجلدًا."),d)G.addGlobal(A,d[A]);for(F in C=y(_),g("lang",C.language),q="".concat(k,"://").concat(i.get("host")).concat(C.path),j)Object.hasOwnProperty.call(j,F)&&g(F,j[F]);null!=O&&O.page?(I=a({},j),z=m({global:j,engine:S,fullUrl:q,env:G,data:I,mode:r,context:O,customer:L,cart:E}),c.render(O.page.fileName,{global:j,context:O,hooks:z})):c.render("404",{global:j,context:O});case 19:case"end":return n.stop()}}),n)})),function(){var t=this,e=arguments;return new Promise((function(r,o){var i=n.apply(t,e);function a(t){u(i,r,o,a,c,"next",t)}function c(t){u(i,r,o,a,c,"throw",t)}a(void 0)}))});return function(t,e,r){return i.apply(this,arguments)}}()}},511:(t,e,r)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(){o=function(){return e};var t,e={},r=Object.prototype,i=r.hasOwnProperty,a=Object.defineProperty||function(t,e,r){t[e]=r.value},c="function"==typeof Symbol?Symbol:{},u=c.iterator||"@@iterator",l=c.asyncIterator||"@@asyncIterator",s=c.toStringTag||"@@toStringTag";function p(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{p({},"")}catch(t){p=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var o=e&&e.prototype instanceof b?e:b,i=Object.create(o.prototype),c=new G(n||[]);return a(i,"_invoke",{value:k(t,r,c)}),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var d="suspendedStart",y="suspendedYield",v="executing",g="completed",m={};function b(){}function w(){}function x(){}var j={};p(j,u,(function(){return this}));var O=Object.getPrototypeOf,S=O&&O(O(T([])));S&&S!==r&&i.call(S,u)&&(j=S);var L=x.prototype=b.prototype=Object.create(j);function E(t){["next","throw","return"].forEach((function(e){p(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function r(o,a,c,u){var l=h(t[o],t,a);if("throw"!==l.type){var s=l.arg,p=s.value;return p&&"object"==n(p)&&i.call(p,"__await")?e.resolve(p.__await).then((function(t){r("next",t,c,u)}),(function(t){r("throw",t,c,u)})):e.resolve(p).then((function(t){s.value=t,c(s)}),(function(t){return r("throw",t,c,u)}))}u(l.arg)}var o;a(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}})}function k(e,r,n){var o=d;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===g){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=P(c,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var l=h(e,r,n);if("normal"===l.type){if(o=n.done?g:y,l.arg===m)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=g,n.method="throw",n.arg=l.arg)}}}function P(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,P(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=h(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function D(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function N(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function G(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(D,this),this.reset(!0)}function T(e){if(e||""===e){var r=e[u];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(i.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(n(e)+" is not iterable")}return w.prototype=x,a(L,"constructor",{value:x,configurable:!0}),a(x,"constructor",{value:w,configurable:!0}),w.displayName=p(x,s,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,x):(t.__proto__=x,p(t,s,"GeneratorFunction")),t.prototype=Object.create(L),t},e.awrap=function(t){return{__await:t}},E(_.prototype),p(_.prototype,l,(function(){return this})),e.AsyncIterator=_,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new _(f(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(L),p(L,s,"Generator"),p(L,u,(function(){return this})),p(L,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=T,G.prototype={constructor:G,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(N),!e)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),l=i.call(a,"finallyLoc");if(u&&l){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),N(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;N(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:T(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function i(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function a(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?i(Object(r),!0).forEach((function(e){c(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function c(t,e,r){return(e=function(t){var e=function(t){if("object"!=n(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function u(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}var l=r(271),s=r(928),p=r(915),f=r(896),h=r(863),d=r(908),y=r(926),v=r(985).setLocales,g=r(93).setGlobal,m=r(525).createHooks,b=r(409);t.exports=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"production";return function(){var n,i=(n=o().mark((function n(i,c,u){var w,x,j,O,S,L,E,_,k,P,D,N,G,T,A,C,q,F,I,z,U,J,Y,M,R,$,H,W,B,K,V,Q,X,Z,tt,et,rt;return o().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(c.locals.render.app,j=null!==(w=c.locals.customer)&&void 0!==w?w:null,console.log("🚀 ~ return ~ res.locals.render:",c.locals.render),O=null!==(x=c.locals.cart)&&void 0!==x?x:{},S=i.originalUrl,L=i.protocol,!p(S)){n.next=8;break}return u(),n.abrupt("return");case 8:return E=y(S),g("lang",E.language),_="".concat(L,"://").concat(i.get("host")).concat(E.path),k=e.viewsDirectory,P=s.join(null!=k?k:c.locals.themePath,"views"),D=s.join(null!=k?k:c.locals.themePath,"locales"),N=l.configure(P,{autoescape:!0,express:t,watch:e.watch||!1,noCache:e.noCache||!1}),G=s.join(k,"schema.json"),f.existsSync(G)||console.log("schema.js is not found in src Directory"),T=s.join(k,"data.json"),f.existsSync(T)||console.log("data.js is not found in src Directory"),A=s.join(k,"widget.njk"),f.existsSync(T)||console.log("data.js is not found in src Directory"),C=JSON.parse(f.readFileSync(T,"utf-8")),q=JSON.parse(f.readFileSync(G,"utf-8")),F=f.readFileSync(A,"utf-8"),n.next=26,b({data:C,schema:q});case 26:if(n.sent.valid){n.next=30;break}return console.error("data not vaild with schema"),n.abrupt("return",c.status(401).json({error:"data.json not vaild with data.json"}));case 30:return I={view:F,schema:q,data:C},z={},U=i.cookies,J=U.token,Y=U.qvid,M=U.qaid,J&&(z.Authorization=J),Y&&(z.qvid=Y),M&&(z.qaid=M),z["x-subdomain"]="minikid",R=a({"Content-Type":"application/json"},z),$="staging"===process.env.MODE?"https://api.qumra-dev.site":"https://api.qumra.cloud",n.next=41,fetch("".concat($,"/templateEngine/v1/renderWidget?path=").concat(encodeURIComponent(_)),{method:"POST",headers:R,body:JSON.stringify(I)});case 41:return H=n.sent,n.next=44,H.json();case 44:for(Q in W=n.sent,B=W.global,K=W.context,V=W.engine,h)N.addFilter(Q,h[Q]);for(X in f.existsSync(D)&&f.statSync(D).isDirectory()?f.readdirSync(D).forEach((function(t){if(t.endsWith(".json")){var e=s.basename(t,".json"),r=s.join(D,t);if(f.existsSync(r)){var n=f.readFileSync(r,"utf-8");v(e,JSON.parse(n))}}})):console.log("المجلد غير موجود أو أنه ليس مجلدًا."),d)N.addGlobal(X,d[X]);for(Z in B)Object.hasOwnProperty.call(B,Z)&&g(Z,B[Z]);null!=K&&K.page?(tt=a({},B),et=m({global:B,engine:V,fullUrl:_,env:N,data:tt,mode:r,context:K,customer:j,cart:O}),rt='\n <!DOCTYPE html>\n<html lang="ar">\n\n <head>\n <meta charset="utf-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n {{ hooks.seo | safe }}\n {{ hooks.head | safe }}\n <link rel="stylesheet" href={{"style.css" | assets}}>\n {# <script src="http://127.0.0.1:5501/dist/gearbox/qumra-gearbox.js" defer><\/script> #}\n {# <script type="module" src="http://127.0.0.1:5502/dist/esm/qumra-ui.js"><\/script> #}\n {# <script src="http://127.0.0.1:5501/dist/gearbox/qumra-gearbox.js" defer><\/script> #}\n {# <script src="//unpkg.com/alpinejs" defer><\/script> #}\n <link rel=\'stylesheet\' href=\'https://cdn-uicons.flaticon.com/2.6.0/uicons-regular-rounded/css/uicons-regular-rounded.css\'>\n <link rel=\'stylesheet\' href=\'https://cdn-uicons.flaticon.com/2.6.0/uicons-regular-straight/css/uicons-regular-straight.css\'>\n <style>\n * {\n font-family: "{{global.app.settings.font.title}}" !important;\n }\n :root {\n --mainRadius: 0;\n }\n </style>\n\n </head>\n <body dir="rtl" >\n {{ hooks.widget | safe}}\n <script src={{"app.js" | assets }} ><\/script>\n {{ hooks.body | safe }}\n </body>\n\n</html>',console.log("🚀 ~ env.renderString ~ templateString:",rt),N.renderString(rt,{global:B,hooks:et},(function(t,e){if(console.log("🚀 ~ env.renderString ~ output:",e),t)return u(t);c.send(e)}))):c.render("404",{global:B,context:K});case 51:case"end":return n.stop()}}),n)})),function(){var t=this,e=arguments;return new Promise((function(r,o){var i=n.apply(t,e);function a(t){u(i,r,o,a,c,"next",t)}function c(t){u(i,r,o,a,c,"throw",t)}a(void 0)}))});return function(t,e,r){return i.apply(this,arguments)}}()}},863:(t,e,r)=>{var n=r(93).getGlobal;r(38),t.exports={upperCase:function(t){return t.toUpperCase()},reverse:function(t){return t.split("").reverse().join("")},capitalize:function(t){return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()},formatCurrency:function(t){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"$")+parseFloat(t).toFixed(2)},money:function(t){if(t){var e=n("app").currency;return"".concat(t.toFixed(2)," ").concat(e.currencySymbol)}return"يجب ان يكون رقم"},date:function(t){return new Date(t).toISOString().split("T")[0]},applyDiscount:function(t,e){return t-t*(e/100)},addVAT:function(t){return t+t*((arguments.length>1&&void 0!==arguments[1]?arguments[1]:15)/100)},pluralize:function(t,e,r){return 1===t?e:r},truncate:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;return t.length>e?t.slice(0,e)+"...":t},trimSpaces:function(t){return t.trim()},isEmpty:function(t){return!t||0===t.trim().length},slugify:function(t){var e;return null===(e=t.toLowerCase())||void 0===e||null===(e=e.replace(/\s+/g,"-"))||void 0===e?void 0:e.replace(/[^\w-]+/g,"")},formatNumber:function(t){var e;return null==t||null===(e=t.toString())||void 0===e?void 0:e.replace(/\B(?=(\d{3})+(?!\d))/g,",")},assets:function(t){return n("assets")+t},cdn:function(t){return n("cdn")},rgba:function(t,e){return/^#([0-9A-F]{3}){1,2}$/i.test(t)?(4===t.length?(r=parseInt(t[1]+t[1],16),n=parseInt(t[2]+t[2],16),o=parseInt(t[3]+t[3],16)):(r=parseInt(t[1]+t[2],16),n=parseInt(t[3]+t[4],16),o=parseInt(t[5]+t[6],16)),e=Math.min(1,Math.max(0,parseFloat(e))),"rgba(".concat(r,", ").concat(n,", ").concat(o,", ").concat(e,")")):t;var r,n,o},seo:function(){return'<title>متجر تجريبي</title>\n<meta name="description" content="متجر تجريبي - Demo Store">\n<meta name="keywords" content="متجر,تجريبي,-,Demo,Store">\n<meta property="store:published_time" content="2024-08-09T06:03:33+03:00">\n<meta property="og:description" content="متجر تجريبي - Demo Store">\n<meta property="og:title" content="متجر تجريبي">\n<meta property="og:type" content="store">\n<meta property="og:locale" content="ar_AR">\n<meta property=":locale:alternate" content="ar_AR">\n<meta property=":locale:alternate" content="en_US">\n<meta property="og:url" content="https://salla.design/dev-ruj4uvkrq9hz389z">\n<meta property="og:image" content="https://salla-dev.s3.eu-central-1.amazonaws.com/logo/logo-fashion.jpg">\n<meta property="og:image:width" content="600">\n<meta property="og:image:height" content="300">\n<meta name="twitter:description" content="متجر تجريبي - Demo Store">\n<meta name="twitter:image" content="https://salla-dev.s3.eu-central-1.amazonaws.com/logo/logo-fashion.jpg">\n<meta name="twitter:card" content="summary_large_image">\n<meta name="twitter:title" content="متجر تجريبي">\n<meta name="twitter:url" content="https://salla.design/dev-ruj4uvkrq9hz389z">\n<meta name="twitter:site" content="@SallaApp">\n<meta name="twitter:creator" content="@SallaApp">\n<script type="application/ld+json">{"@context":"https://schema.org","@type":"Organization","name":"متجر تجريبي","description":"متجر تجريبي - Demo Store","url":"https://salla.design/dev-ruj4uvkrq9hz389z","logo":"https://salla-dev.s3.eu-central-1.amazonaws.com/logo/logo-fashion.jpg"}<\/script>'}}},908:(t,e,r)=>{var n=r(93),o=n.getGlobal,i=n.setGlobal,a=r(985).getLocales,c=r(413);t.exports={set:function(t,e){i(t,e)},get:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return o(t)||e},t:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=o("lang")||"ar",n=a(r);return n&&c(n,t)||e}}},99:(t,e,r)=>{var n=r(516).targets,o=r(432),i=r(511),a=r(961);t.exports=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"production",c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n.theme;return a(t),c===n.theme?o(t,e,r):c===n.widget?i(t,e,r):void 0}},91:(t,e,r)=>{var n=r(757),o=n({parameters:[n.acceptHeaders,n.geoip]});t.exports=function(t,e,r){o(t,e,(function(){r()}))}},93:t=>{var e={};t.exports={getGlobal:function(t,r){var n;return null!==(n=e[t])&&void 0!==n?n:r},setGlobal:function(t,r){e[t]=r}}},985:t=>{var e={};t.exports={getLocales:function(t){return e[t]},setLocales:function(t,r){e[t]=r}}},552:t=>{t.exports=function(t,e){return{content:t,priority:e}}},389:(t,e,r)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?o(Object(r),!0).forEach((function(e){a(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function a(t,e,r){return(e=function(t){var e=function(t){if("object"!=n(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var c=r(516).pagesData,u=r(552),l=r(301),s=r(852);t.exports=function(t){var e,r,n,o,a,p,f,h,d,y,v=t.global,g=t.fullUrl,m=t.engine,b=t.env,w=t.data,x=t.mode,j=t.context,O=t.customer,S=t.cart;console.log("🚀 ~ data:",w);var L=null===(e=m.widgets)||void 0===e?void 0:e.map((function(t){return b.renderString(t.view,i(i({global:v,context:j},null==t?void 0:t.data),{},{_id:t._id}))})).join(""),E=j.page.title,_="".concat(v.app.name," - ").concat(j.page.title),k=v.app.description,P=v.app.logoUrl,D=v.app.logoUrl,N=w.app.url,G=[{"@type":"ListItem",position:1,name:v.app.name,item:N}];j.page.path!==c.home&&G.push({"@type":"ListItem",position:2,name:E,item:g});var T,A,C,q,F,I,z={event:"view_content",page:{title:_,url:g},user:{user_id:null!==(r=null==w||null===(n=w.customer)||void 0===n?void 0:n.id)&&void 0!==r?r:0,user_type:null!=w&&w.customer?"logged-in":"guest"},cart:{total_items:null!==(o=null==j||null===(a=j.cart)||void 0===a||null===(a=a.items)||void 0===a?void 0:a.length)&&void 0!==o?o:0,total_price:null!==(p=parseFloat(null==j||null===(f=j.cart)||void 0===f?void 0:f.totalProductsAfterDiscount))&&void 0!==p?p:0,currency:null!==(h=w.settings.currency[0].currencyCode)&&void 0!==h?h:"LE"}};j.page.path===c.product&&(z.product={name:E,category:null==j||null===(T=j.product)||void 0===T||null===(T=T.category)||void 0===T?void 0:T.title,id:null==j||null===(A=j.product)||void 0===A?void 0:A.id,price:null==j||null===(C=j.product)||void 0===C?void 0:C.priceAfterDiscount,currency:null!==(q=w.settings.currency[0].currencyCode)&&void 0!==q?q:"LE"}),j.page.path===c.product&&(P=null===(F=j.product)||void 0===F||null===(F=F.images[0])||void 0===F?void 0:F.imageUrl,k=l(null===(I=j.product)||void 0===I?void 0:I.content));var U,J,Y,M,R,$,H,W,B,K,V,Q,X,Z={widgets:[u(L,15)],seo:[u('<link rel="icon" type="image/png" sizes="32x32" href="'.concat(D,'">')),u("<title>".concat(_,"</title>")),u('<meta name="description" content="'.concat(k,'">')),u('<meta property="og:title" content="'.concat(_,'">')),u('<meta property="og:description" content="'.concat(k,'">')),u('<meta property="og:type" content="website">'),u('<meta property="og:locale" content="ar_AR">'),u('<meta property="og:url" content="'.concat(g,'">')),u('<meta property="og:image" content="'.concat(P,'">')),u('<meta property="og:image:width" content="600">'),u('<meta property="og:image:height" content="300">'),u('<meta name="twitter:card" content="summary_large_image">'),u('<meta name="twitter:title" content="'.concat(_,'">')),u('<meta name="twitter:description" content="'.concat(k,'">')),u('<meta name="twitter:image" content="'.concat(P,'">')),u('<meta name="twitter:site" content="@qumracloud">'),u('<meta name="twitter:creator" content="@qumracloud">'),u('<link rel="canonical" href="'.concat(g,'">')),u('<script type="application/ld+json">{"@context": "https://schema.org","@type": "Organization","name": "'.concat(_,'","description": "').concat(k,'","url": "').concat(g,'","logo": "').concat(P,'"}<\/script>')),u('<script type="application/ld+json">\n {\n "@context": "https://schema.org",\n "@type": "BreadcrumbList",\n "itemListElement": '.concat(JSON.stringify(G),"\n }\n <\/script>"))],head:[u("<script>\n window.__qumra__ = window.__qumra__ || {}; window.__qumra__.data = ".concat(s(JSON.stringify(i(i({},w),{},{mode:x}))),";\n \n window.__qumra__.customer = ").concat(s(JSON.stringify(O)),";\n window.__qumra__.cart = ").concat(s(JSON.stringify(S)),";\n <\/script>")),u("<script>\n window.dataLayer = window.dataLayer || []; window.dataLayer.push(".concat(JSON.stringify(z),");\n ;<\/script>"))],body:[]};return null!=m&&null!==(d=m.injectionCode)&&void 0!==d&&d.head&&Z.head.push(u(null!==(U=null===(J=m.injectionCode)||void 0===J?void 0:J.head)&&void 0!==U?U:null,16)),null!=m&&null!==(y=m.injectionCode)&&void 0!==y&&y.body&&Z.body.push(u(null!==(Y=null===(M=m.injectionCode)||void 0===M?void 0:M.body)&&void 0!==Y?Y:null,16)),j.page.path===c.product&&Z.seo.push(u('<script type="application/ld+json">\n{\n "@context": "https://schema.org",\n "@type": "Product",\n "productID": "'.concat(j.product.id,'",\n "offers": [{\n "@type": "Offer",\n "name": "').concat(E,'",\n "availability":"https://schema.org/InStock",\n "price": ').concat(null==j||null===(R=j.product)||void 0===R?void 0:R.priceAfterDiscount,',\n "priceCurrency": "').concat(null!==($=w.settings.currency[0].currencyCode)&&void 0!==$?$:"LE",'",\n \n "sku": "').concat(null==j||null===(H=j.product)||void 0===H?void 0:H.SKU,'",\n "url": "').concat(g,'"\n }\n],"brand": {\n "@type": "Brand",\n "name": "').concat(w.app.name,'"\n },\n "name": "').concat(null===(W=j.product)||void 0===W?void 0:W.title,'",\n "description": "').concat(l(null==j||null===(B=j.product)||void 0===B?void 0:B.content),'",\n "category": "').concat(null==j||null===(K=j.product)||void 0===K||null===(K=K.category)||void 0===K?void 0:K.title,'",\n "url": "').concat(g,'",\n "sku": "').concat(null==j||null===(V=j.product)||void 0===V?void 0:V.SKU,'",\n "weight": {\n "@type": "QuantitativeValue",\n "unitCode": "kg",\n "value": 0.0\n },\n "image": {\n "@type": "ImageObject",\n "url": "').concat(null==j||null===(Q=j.product)||void 0===Q||null===(Q=Q.images[0])||void 0===Q?void 0:Q.imageUrl,'",\n "image": "').concat(null==j||null===(X=j.product)||void 0===X||null===(X=X.images[0])||void 0===X?void 0:X.imageUrl,'",\n "name": "",\n "width": "1024",\n "height": "1024"\n }\n}\n<\/script>'))),Object.keys(Z).forEach((function(t){Z[t]=Z[t].sort((function(t,e){return e.priority-t.priority})).map((function(t){return b.renderString(t.content)})).join("")})),Z}},961:(t,e,r)=>{r(355);var n=r(174),o=(r(285),r(898)),i=r(91);t.exports=function(t){t.set("view engine","njk"),t.use(o()),t.use(i),t.use(n())}},926:t=>{t.exports=function(t){var e={language:"ar",path:null},r=t.match(/^\/([a-z]{2})\/(.*)$/);return r?(e.language=r[1],e.path="/".concat(r[2])):(r=t.match(/^\/([a-z]{2})$/))?(e.language=r[1],e.path="/"):e.path=t,e}},413:t=>{t.exports=function(t,e){return e.split(".").reduce((function(t,e){return t&&t[e]}),t)}},525:(t,e,r)=>{var n=r(552),o=r(389),i=r(852);t.exports={addToHook:n,sanitizeInput:i,createHooks:o}},915:(t,e,r)=>{var n=r(516).targets;t.exports=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.theme;return e===n.theme?[".jpg",".jpeg",".png",".webp",".gif",".svg",".js",".css",".woff",".woff2",".ttf",".ico"].some((function(e){return t.endsWith(e)})):e===n.widget?!["/"].includes(t):void 0}},301:t=>{t.exports=function(t){return null==t?void 0:t.replace(/<\/?[^>]+(>|$)/g,"")}},852:t=>{t.exports=function(t){return null==t?void 0:t.replace(/<script.*?>.*?<\/script>/gi,"")}},409:t=>{function e(){e=function(){return r};var t,r={},n=Object.prototype,o=n.hasOwnProperty,a=Object.defineProperty||function(t,e,r){t[e]=r.value},c="function"==typeof Symbol?Symbol:{},u=c.iterator||"@@iterator",l=c.asyncIterator||"@@asyncIterator",s=c.toStringTag||"@@toStringTag";function p(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{p({},"")}catch(t){p=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var o=e&&e.prototype instanceof b?e:b,i=Object.create(o.prototype),c=new G(n||[]);return a(i,"_invoke",{value:k(t,r,c)}),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}r.wrap=f;var d="suspendedStart",y="suspendedYield",v="executing",g="completed",m={};function b(){}function w(){}function x(){}var j={};p(j,u,(function(){return this}));var O=Object.getPrototypeOf,S=O&&O(O(T([])));S&&S!==n&&o.call(S,u)&&(j=S);var L=x.prototype=b.prototype=Object.create(j);function E(t){["next","throw","return"].forEach((function(e){p(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function r(n,a,c,u){var l=h(t[n],t,a);if("throw"!==l.type){var s=l.arg,p=s.value;return p&&"object"==i(p)&&o.call(p,"__await")?e.resolve(p.__await).then((function(t){r("next",t,c,u)}),(function(t){r("throw",t,c,u)})):e.resolve(p).then((function(t){s.value=t,c(s)}),(function(t){return r("throw",t,c,u)}))}u(l.arg)}var n;a(this,"_invoke",{value:function(t,o){function i(){return new e((function(e,n){r(t,o,e,n)}))}return n=n?n.then(i,i):i()}})}function k(e,r,n){var o=d;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===g){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=P(c,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var l=h(e,r,n);if("normal"===l.type){if(o=n.done?g:y,l.arg===m)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=g,n.method="throw",n.arg=l.arg)}}}function P(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,P(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=h(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function D(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function N(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function G(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(D,this),this.reset(!0)}function T(e){if(e||""===e){var r=e[u];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,a=function r(){for(;++n<e.length;)if(o.call(e,n))return r.value=e[n],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(i(e)+" is not iterable")}return w.prototype=x,a(L,"constructor",{value:x,configurable:!0}),a(x,"constructor",{value:w,configurable:!0}),w.displayName=p(x,s,"GeneratorFunction"),r.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,x):(t.__proto__=x,p(t,s,"GeneratorFunction")),t.prototype=Object.create(L),t},r.awrap=function(t){return{__await:t}},E(_.prototype),p(_.prototype,l,(function(){return this})),r.AsyncIterator=_,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new _(f(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(L),p(L,s,"Generator"),p(L,u,(function(){return this})),p(L,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=T,G.prototype={constructor:G,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(N),!e)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),l=o.call(a,"finallyLoc");if(u&&l){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),N(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;N(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:T(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},r}function r(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=n(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var o=0,i=function(){};return{s:i,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,c=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return c=t.done,t},e:function(t){u=!0,a=t},f:function(){try{c||null==r.return||r.return()}finally{if(u)throw a}}}}function n(t,e){if(t){if("string"==typeof t)return o(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function a(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}var c=function(){var t,u=(t=e().mark((function t(a){var u,l,s,p,f,h,d,y,v,g,m,b,w,x,j,O,S,L,E,_,k,P,D;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:u=a.data,l=a.schema,s=a.oldData,p=void 0===s?{}:s,f=[],h={},t.t0=e().keys(l);case 4:if((t.t1=t.t0()).done){t.next=69;break}if(d=t.t1.value,y=l[d],v=u[d],g=p[d],!v||"object"!==i(v.promise)){t.next=13;break}return t.next=12,v.promise;case 12:v=t.sent;case 13:if(!y.required||null!=v&&""!==v){t.next=16;break}return f.push("خطأ: ".concat(y.title," لا يمكن ان يكون فارغاً.")),t.abrupt("continue",4);case 16:if(void 0===v){t.next=67;break}if("string"!==y.type.toLowerCase()||"string"==typeof v){t.next=20;break}return f.push("Error: ".concat(y.title," يجب ان يكون نصاً.")),t.abrupt("continue",4);case 20:if("file"!==y.type.toLowerCase()){t.next=31;break}if(g&&"string"==typeof v){t.next=31;break}if(!v||!v.mimetype){t.next=29;break}if(b=(null!==(m=v.filename)&&void 0!==m?m:v.originalname).split(".").pop().toLowerCase(),!y.extensions||y.extensions.includes(b)){t.next=27;break}return f.push("Error: ".concat(y.title," يجب ان يكون امتداد (").concat(y.extensions.join(", "),").")),t.abrupt("continue",4);case 27:t.next=31;break;case 29:return f.push("Error: ".concat(y.title," يجب ان يكون ملفاً.")),t.abrupt("continue",4);case 31:if("number"!==y.type.toLowerCase()||"number"==typeof v){t.next=34;break}return f.push("Error: ".concat(y.title," يجب ان يكون رقماً.")),t.abrupt("continue",4);case 34:if("boolean"!==y.type.toLowerCase()||"boolean"==typeof v){t.next=37;break}return f.push("Error: ".concat(y.title," يجب ان تكون قيمة منطقية.")),t.abrupt("continue",4);case 37:if("list"!==y.type.toLowerCase()||!Array.isArray(v)){t.next=66;break}w=[],x=0,j=r(v),t.prev=41,j.s();case 43:if((O=j.n()).done){t.next=56;break}return L=O.value,E=g&&null!==(S=g[x])&&void 0!==S?S:{},t.next=48,c({data:L,schema:y.schema,oldData:E});case 48:_=t.sent,k=_.valid,P=_.errors,D=_.data,k?w.push(D):f.push.apply(f,function(t){if(Array.isArray(t))return o(t)}(N=P)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(N)||n(N)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),x++;case 54:t.next=43;break;case 56:t.next=61;break;case 58:t.prev=58,t.t2=t.catch(41),j.e(t.t2);case 61:return t.prev=61,j.f(),t.finish(61);case 64:return h[d]=w,t.abrupt("continue",4);case 66:h[d]=v;case 67:t.next=4;break;case 69:return t.abrupt("return",f.length>0?{valid:!1,errors:f,data:h}:{valid:!0,data:h});case 70:case"end":return t.stop()}var N}),t,null,[[41,58,61,64]])})),function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function c(t){a(i,n,o,c,u,"next",t)}function u(t){a(i,n,o,c,u,"throw",t)}c(void 0)}))});return function(t){return u.apply(this,arguments)}}();t.exports=c},355:t=>{t.exports=require("cache-express")},174:t=>{t.exports=require("compression")},898:t=>{t.exports=require("cookie-parser")},38:t=>{t.exports=require("dinero.js")},757:t=>{t.exports=require("express-fingerprint")},285:t=>{t.exports=require("express-minify-html")},271:t=>{t.exports=require("nunjucks")},896:e=>{e.exports=t(import.meta.url)("fs")},928:e=>{e.exports=t(import.meta.url)("path")}},r={};function n(t){var o=r[t];if(void 0!==o)return o.exports;var i=r[t]={exports:{}};return e[t](i,i.exports,n),i.exports}n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n(99);
@@ -1 +0,0 @@
1
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
package/rollup.config.js DELETED
@@ -1,42 +0,0 @@
1
- import path from 'path';
2
- import { nodeResolve } from '@rollup/plugin-node-resolve';
3
- import commonjs from '@rollup/plugin-commonjs';
4
- import babel from '@rollup/plugin-babel';
5
- import { terser } from 'rollup-plugin-terser';
6
- import json from '@rollup/plugin-json'
7
- const isDev = process.env.NODE_ENV === 'development';
8
-
9
- export default [
10
- {
11
- // Configuration for CommonJS
12
- input: './lib/index.js',
13
- output: {
14
- file: path.resolve(__dirname, 'dist/bundle.cjs.js'),
15
- format: 'cjs',
16
- sourcemap: !isDev,
17
- },
18
- plugins: [
19
- json(),
20
- nodeResolve(),
21
- commonjs(),
22
- babel({ babelHelpers: 'bundled', exclude: 'node_modules/**' }),
23
- !isDev && terser(),
24
- ],
25
- },
26
- {
27
- // Configuration for ESM
28
- input: './lib/index.js',
29
- output: {
30
- file: path.resolve(__dirname, 'dist/bundle.esm.js'),
31
- format: 'esm',
32
- sourcemap: !isDev,
33
- },
34
- plugins: [
35
- json(),
36
- nodeResolve(),
37
- commonjs(),
38
- babel({ babelHelpers: 'bundled', exclude: 'node_modules/**' }),
39
- !isDev && terser(),
40
- ],
41
- },
42
- ];