cloudcommerce 2.13.0 → 2.14.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 (168) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/ecomplus-stores/barradoce/conf/firebase.json +1 -0
  3. package/ecomplus-stores/barradoce/functions/many/package.json +3 -3
  4. package/ecomplus-stores/barradoce/functions/ssr/content/extra-pages/promocoes.md +1 -1
  5. package/ecomplus-stores/barradoce/functions/ssr/package.json +6 -6
  6. package/ecomplus-stores/barradoce/functions/ssr/src/components/AccountMenu.vue +18 -15
  7. package/ecomplus-stores/barradoce/functions/ssr/src/components/AccountPage.vue +5 -5
  8. package/ecomplus-stores/barradoce/functions/ssr/src/components/LoginForm.vue +16 -10
  9. package/ecomplus-stores/barradoce/functions/ssr/src/components/ShopFooter.vue +1 -1
  10. package/ecomplus-stores/barradoce/functions/ssr/src/pages/sitemap-[index].xml.astro +75 -0
  11. package/ecomplus-stores/barradoce/functions/with-apps/package.json +3 -3
  12. package/ecomplus-stores/barradoce/package.json +2 -2
  13. package/package.json +2 -2
  14. package/packages/api/package.json +1 -1
  15. package/packages/apps/affiliate-program/package.json +1 -1
  16. package/packages/apps/correios/package.json +1 -1
  17. package/packages/apps/custom-payment/package.json +1 -1
  18. package/packages/apps/custom-shipping/package.json +1 -1
  19. package/packages/apps/datafrete/package.json +1 -1
  20. package/packages/apps/discounts/package.json +1 -1
  21. package/packages/apps/emails/package.json +1 -1
  22. package/packages/apps/fb-conversions/package.json +1 -1
  23. package/packages/apps/flash-courier/package.json +1 -1
  24. package/packages/apps/frenet/package.json +1 -1
  25. package/packages/apps/galaxpay/package.json +1 -1
  26. package/packages/apps/google-analytics/package.json +1 -1
  27. package/packages/apps/jadlog/package.json +1 -1
  28. package/packages/apps/loyalty-points/package.json +1 -1
  29. package/packages/apps/mandae/package.json +1 -1
  30. package/packages/apps/melhor-envio/package.json +1 -1
  31. package/packages/apps/mercadopago/package.json +1 -1
  32. package/packages/apps/pagaleve/package.json +1 -1
  33. package/packages/apps/pagarme/package.json +1 -1
  34. package/packages/apps/pagarme-v5/package.json +1 -1
  35. package/packages/apps/paghiper/package.json +1 -1
  36. package/packages/apps/pix/package.json +1 -1
  37. package/packages/apps/tiny-erp/package.json +1 -1
  38. package/packages/apps/webhooks/package.json +1 -1
  39. package/packages/cli/ci/bunny-config-base.sh +4 -6
  40. package/packages/cli/config/firebase.json +1 -1
  41. package/packages/cli/package.json +1 -1
  42. package/packages/config/package.json +1 -1
  43. package/packages/emails/package.json +1 -1
  44. package/packages/eslint/package.json +1 -1
  45. package/packages/events/package.json +1 -1
  46. package/packages/feeds/lib/firebase/render-catalog.js +272 -0
  47. package/packages/feeds/lib/firebase/render-catalog.js.map +1 -0
  48. package/packages/feeds/lib/firebase/render-sitemap.js +42 -0
  49. package/packages/feeds/lib/firebase/render-sitemap.js.map +1 -0
  50. package/packages/feeds/lib/firebase/serve-feeds.js +22 -270
  51. package/packages/feeds/lib/firebase/serve-feeds.js.map +1 -1
  52. package/packages/feeds/package.json +1 -1
  53. package/packages/feeds/src/firebase/render-catalog.ts +286 -0
  54. package/packages/feeds/src/firebase/render-sitemap.ts +46 -0
  55. package/packages/feeds/src/firebase/serve-feeds.ts +22 -283
  56. package/packages/firebase/package.json +1 -1
  57. package/packages/i18n/package.json +1 -1
  58. package/packages/modules/package.json +1 -1
  59. package/packages/passport/package.json +1 -1
  60. package/packages/ssr/package.json +1 -1
  61. package/packages/storefront/dist/client/_astro/{AccountPage.Cf0WE6GF.js → AccountPage.CKu0oakN.js} +1 -1
  62. package/packages/storefront/dist/client/_astro/{CartSidebar.DAvJKL2c.js → CartSidebar.Bxz7ZD9N.js} +1 -1
  63. package/packages/storefront/dist/client/_astro/{ProductDetails.BpZtnS8j.js → ProductDetails.PkZr50hA.js} +1 -1
  64. package/packages/storefront/dist/client/_astro/{ProductShelf.C0TU_sRb.js → ProductShelf.BKz6WXbp.js} +1 -1
  65. package/packages/storefront/dist/client/_astro/{SearchModal.DWNSfxML.js → SearchModal.BIrixnFb.js} +1 -1
  66. package/packages/storefront/dist/client/_astro/SearchShowcase.YMZqG8rj.js +1 -0
  67. package/packages/storefront/dist/client/_astro/ShopHeader.BOLegIRO.js +7 -0
  68. package/packages/storefront/dist/client/_astro/{_slug_.HhgCFKHv.css → _slug_.oAbCb631.css} +1 -1
  69. package/packages/storefront/dist/client/_astro/customer-session.B9MvrBAQ.js +7 -0
  70. package/packages/storefront/dist/client/_astro/ecom-icon.png +0 -0
  71. package/packages/storefront/dist/client/_astro/ecom-icon_12falx.png +0 -0
  72. package/packages/storefront/dist/client/_astro/ecom-icon_15pqnO.png +0 -0
  73. package/packages/storefront/dist/client/_astro/ecom-icon_t3guw.png +0 -0
  74. package/packages/storefront/dist/client/_astro/{firebase-app.CmI1zl7o.js → firebase-app.DPioxxma.js} +1 -1
  75. package/packages/storefront/dist/client/_astro/headphone.webp +0 -0
  76. package/packages/storefront/dist/client/_astro/headphone_T2Jjc.avif +0 -0
  77. package/packages/storefront/dist/client/_astro/headphone_Z1CG18r.webp +0 -0
  78. package/packages/storefront/dist/client/_astro/{hoisted.BeKMioW4.js → hoisted.8Sq2YuJM.js} +1 -1
  79. package/packages/storefront/dist/client/_astro/{hoisted.Bf1gCkSN.js → hoisted.BzVcl7We.js} +1 -1
  80. package/packages/storefront/dist/client/_astro/{hoisted.-C0vLMXT.js → hoisted.CPcG9RpX.js} +1 -1
  81. package/packages/storefront/dist/client/_astro/{index-a8cf6c8f.k99a-gIB.js → index-219c3cac.78peI8kt.js} +3 -3
  82. package/packages/storefront/dist/client/_astro/logo.png +0 -0
  83. package/packages/storefront/dist/client/_astro/logo_1UBsBq.webp +0 -0
  84. package/packages/storefront/dist/client/_astro/logo_Z1K5PE9.png +0 -0
  85. package/packages/storefront/dist/client/_astro/logo_Z1KIIl1.avif +0 -0
  86. package/packages/storefront/dist/client/_astro/passion.webp +0 -0
  87. package/packages/storefront/dist/client/_astro/passion_LHbe9.webp +0 -0
  88. package/packages/storefront/dist/client/_astro/passion_Z23MeUb.avif +0 -0
  89. package/packages/storefront/dist/client/_astro/rect8589.png +0 -0
  90. package/packages/storefront/dist/client/_astro/rect8589_1TtOHY.png +0 -0
  91. package/packages/storefront/dist/client/_astro/rect8589_1f5opX.webp +0 -0
  92. package/packages/storefront/dist/client/_astro/rect8589_IUskt.webp +0 -0
  93. package/packages/storefront/dist/client/_astro/rect8589_Uxfdf.png +0 -0
  94. package/packages/storefront/dist/client/_astro/rect8589_Z15uApA.png +0 -0
  95. package/packages/storefront/dist/client/_astro/rect8589_Z1Ap1Im.avif +0 -0
  96. package/packages/storefront/dist/client/_astro/rect8589_Z1JT1HB.webp +0 -0
  97. package/packages/storefront/dist/client/_astro/rect8589_ZY9mtN.avif +0 -0
  98. package/packages/storefront/dist/client/_astro/rect8589_tMFW0.avif +0 -0
  99. package/packages/storefront/dist/client/_astro/rect859.png +0 -0
  100. package/packages/storefront/dist/client/_astro/rect859_1TgQXS.avif +0 -0
  101. package/packages/storefront/dist/client/_astro/rect859_2Nm1z.avif +0 -0
  102. package/packages/storefront/dist/client/_astro/rect859_DIqwR.png +0 -0
  103. package/packages/storefront/dist/client/_astro/rect859_Z1IKDb2.png +0 -0
  104. package/packages/storefront/dist/client/_astro/rect859_Z29FI4V.webp +0 -0
  105. package/packages/storefront/dist/client/_astro/rect859_Z2kFHGk.avif +0 -0
  106. package/packages/storefront/dist/client/_astro/rect859_ZkpPFI.webp +0 -0
  107. package/packages/storefront/dist/client/_astro/rect859_jXzBi.png +0 -0
  108. package/packages/storefront/dist/client/_astro/rect859_x1l16.webp +0 -0
  109. package/packages/storefront/dist/client/_astro/rect89.webp +0 -0
  110. package/packages/storefront/dist/client/_astro/rect89_1TSfW7.avif +0 -0
  111. package/packages/storefront/dist/client/_astro/rect89_Z1re32x.webp +0 -0
  112. package/packages/storefront/dist/client/_astro/{shopping-cart.Cqc6p5UR.js → shopping-cart.D8fbm2Dv.js} +1 -1
  113. package/packages/storefront/dist/client/_astro/{use-analytics.bP3a5cR0.js → use-analytics.D_peWG3X.js} +1 -1
  114. package/packages/storefront/dist/client/_astro/{use-product-card.Cj9Q-Y1A.js → use-product-card.BCGHZKB5.js} +1 -1
  115. package/packages/storefront/dist/client/_astro/{use-text-value.DT0v9Yj_.js → use-text-value.BFLvKnYE.js} +1 -1
  116. package/packages/storefront/dist/client/assets/cvv.png +0 -0
  117. package/packages/storefront/dist/client/assets/payments.png +0 -0
  118. package/packages/storefront/dist/client/robots.txt +2 -0
  119. package/packages/storefront/dist/client/~fallback.html +112 -0
  120. package/packages/storefront/dist/client/~index.html +137 -0
  121. package/packages/storefront/dist/server/_astro-internal_middleware.mjs +2 -2
  122. package/packages/storefront/dist/server/chunks/404_BUZm2bP1.mjs +5 -0
  123. package/packages/storefront/dist/server/chunks/{CartSidebar_tmly-0ip.mjs → CartSidebar_kQSDOTj2.mjs} +2 -2
  124. package/packages/storefront/dist/server/chunks/{SearchModal_CGNQss2j.mjs → SearchModal_O1xTrm-9.mjs} +2 -2
  125. package/packages/storefront/dist/server/chunks/{_.._Bt6Uzpk2.mjs → _.._6Bd7O3FD.mjs} +1 -1
  126. package/packages/storefront/dist/server/chunks/{_astro-internal_middleware_CqUpziyW.mjs → _astro-internal_middleware_BnKXd-Ev.mjs} +1 -1
  127. package/packages/storefront/dist/server/chunks/{_page__Dz-iZHMh.mjs → _page__CXnal5Rn.mjs} +1 -1
  128. package/packages/storefront/dist/server/chunks/{account_tfs9KFTy.mjs → account_C6XTKIP9.mjs} +1 -1
  129. package/packages/storefront/dist/server/chunks/astro/{assets-service_DSoC_W52.mjs → assets-service_146xb0vN.mjs} +11 -67
  130. package/packages/storefront/dist/server/chunks/{astro_Cu3MZ9xv.mjs → astro_DIU6qHCh.mjs} +34 -79
  131. package/packages/storefront/dist/server/chunks/{index_CGzMgZTN.mjs → index_EbDDnIXs.mjs} +1 -1
  132. package/packages/storefront/dist/server/chunks/{index_BKS_40rA.mjs → index_STpvD2cy.mjs} +1 -1
  133. package/packages/storefront/dist/server/chunks/{node_lZaNT3E1.mjs → node_DHQVZgH_.mjs} +1 -1
  134. package/packages/storefront/dist/server/chunks/pages/{404_CMwuVMu1.mjs → 404_n3mvoSWv.mjs} +94 -1140
  135. package/packages/storefront/dist/server/chunks/pages/{__Dz53F-0T.mjs → __C9Nd4c7_.mjs} +11 -42
  136. package/packages/storefront/dist/server/chunks/pages/{_page__C1x19nYF.mjs → _page__BnXBvVvn.mjs} +4 -20
  137. package/packages/storefront/dist/server/chunks/pages/account_Dk-8R3rY.mjs +22 -0
  138. package/packages/storefront/dist/server/chunks/pages/{index_CqvjdvSg.mjs → index_us3QX6kE.mjs} +5 -22
  139. package/packages/storefront/dist/server/chunks/pages/node_BGdGQ52C.mjs +1864 -0
  140. package/packages/storefront/dist/server/chunks/pages/sitemap-_index__rcX10oKd.mjs +32 -0
  141. package/packages/storefront/dist/server/chunks/pages/~fallback_BNfV6ECv.mjs +22 -0
  142. package/packages/storefront/dist/server/chunks/sitemap-_index__e6mToVZH.mjs +5 -0
  143. package/packages/storefront/dist/server/chunks/{~fallback_CrFe__-f.mjs → ~fallback_Cg1Pbe1d.mjs} +1 -1
  144. package/packages/storefront/dist/server/entry.mjs +18 -17
  145. package/packages/storefront/dist/server/images.dist.csv +37 -0
  146. package/packages/storefront/dist/server/images.src.csv +13 -0
  147. package/packages/storefront/dist/server/manifest_xBcEm6Np.mjs +206 -0
  148. package/packages/storefront/dist/server/middleware.mjs +2 -2
  149. package/packages/storefront/dist/server/renderers.mjs +1 -1
  150. package/packages/storefront/dist/server/static-builds.csv +80 -0
  151. package/packages/storefront/package.json +1 -1
  152. package/packages/storefront/scripts/build-prod.sh +17 -0
  153. package/packages/storefront/src/lib/components/AccountLink.vue +16 -11
  154. package/packages/storefront/src/lib/components/globals/Skeleton.vue +6 -4
  155. package/packages/storefront/src/lib/composables/use-login-form.ts +6 -1
  156. package/packages/storefront/src/lib/scripts/vbeta-app.ts +11 -2
  157. package/packages/storefront/src/lib/state/customer-session.ts +8 -1
  158. package/packages/test-base/package.json +1 -1
  159. package/packages/types/package.json +1 -1
  160. package/packages/storefront/dist/client/_astro/SearchShowcase.CUkbXIRk.js +0 -1
  161. package/packages/storefront/dist/client/_astro/ShopHeader.D7qqQxFD.js +0 -7
  162. package/packages/storefront/dist/client/_astro/customer-session.Cctko5_9.js +0 -7
  163. package/packages/storefront/dist/client/assets/.gitkeep +0 -2
  164. package/packages/storefront/dist/server/chunks/404_BcY_5eJJ.mjs +0 -5
  165. package/packages/storefront/dist/server/chunks/pages/account_B5Z6wDBy.mjs +0 -32
  166. package/packages/storefront/dist/server/chunks/pages/node_mvX6Tssv.mjs +0 -879
  167. package/packages/storefront/dist/server/chunks/pages/~fallback_D2ugBVgc.mjs +0 -32
  168. package/packages/storefront/dist/server/manifest_D4v8KX-D.mjs +0 -206
@@ -1,20 +1,17 @@
1
1
  import { img, imgSizes, i18n, formatMoney, price, randomObjectId, nickname } from '@ecomplus/utils';
2
- import '@astrojs/internal-helpers/path';
3
- import { A as AstroError, c as ExpectedImageOptions, E as ExpectedImage, F as FailedToFetchRemoteImageDimensions, d as InvalidImageService, e as createAstro, f as createComponent, g as ImageMissingAlt, r as renderTemplate, m as maybeRenderHead, h as addAttribute, s as spreadAttributes, u as unescapeHTML, i as renderSlotToString, j as renderAllHeadContent, k as renderSlot$1, l as renderComponent, n as Fragment } from '../astro_Cu3MZ9xv.mjs';
2
+ import { c as createAstro, b as createComponent, r as renderTemplate, u as unescapeHTML, d as addAttribute, s as spreadAttributes, e as renderSlotToString, f as renderAllHeadContent, m as maybeRenderHead, g as renderSlot$1, h as renderComponent, F as Fragment } from '../astro_DIU6qHCh.mjs';
4
3
  import 'kleur/colors';
5
4
  import { EventEmitter } from 'node:events';
6
5
  import api from '@cloudcommerce/api';
7
6
  import { AsyncLocalStorage } from 'node:async_hooks';
8
- import fs, { copyFileSync } from 'node:fs';
9
- import { resolve, join, basename as basename$1 } from 'node:path';
7
+ import fs, { readFileSync } from 'node:fs';
8
+ import { resolve, join } from 'node:path';
10
9
  import { parse } from 'yaml';
11
10
  import config from '@cloudcommerce/config';
12
11
  import 'clsx';
13
12
  import { renderSync, parse as parse$1, walkSync, ELEMENT_NODE } from 'ultrahtml';
14
13
  /* empty css */
15
14
  import mime from 'mime/lite.js';
16
- import { r as resolveSrc, i as isRemoteImage, a as isESMImportedImage, b as isLocalService, D as DEFAULT_HASH_PROPS } from '../astro/assets-service_DSoC_W52.mjs';
17
- import imageSize from 'image-size';
18
15
  import { useSSRContext, defineComponent, computed, ref, onMounted, watch, createVNode, resolveDynamicComponent, mergeProps, withCtx, renderSlot, inject, toRef, onBeforeUnmount, provide, reactive, shallowRef, resolveComponent, withDirectives, vShow, openBlock, createBlock, createCommentVNode, Fragment as Fragment$1, renderList, mergeModels, useModel, nextTick, withModifiers, Teleport, createTextVNode, toDisplayString, defineAsyncComponent, vModelText, Suspense, createSlots } from 'vue';
19
16
  import { ssrRenderSlotInner, ssrRenderVNode, ssrRenderSlot, ssrRenderAttrs, ssrRenderClass, ssrRenderList, ssrRenderComponent, ssrRenderStyle, ssrIncludeBooleanAttr, ssrRenderAttr, ssrRenderTeleport, ssrInterpolate, ssrRenderSuspense } from 'vue/server-renderer';
20
17
  import { useElementVisibility, useElementHover, useScroll, useDebounceFn, watchDebounced, useTimeout, promiseTimeout, onClickOutside } from '@vueuse/core';
@@ -822,995 +819,6 @@ function onRequest(ctx, next) {
822
819
  return asyncLocalStorage$1.run({ sid: `${Date.now() + Math.random()}` }, next);
823
820
  }
824
821
 
825
- const decoder = new TextDecoder();
826
- const toUTF8String = (input, start = 0, end = input.length) => decoder.decode(input.slice(start, end));
827
- const toHexString = (input, start = 0, end = input.length) => input.slice(start, end).reduce((memo, i) => memo + ("0" + i.toString(16)).slice(-2), "");
828
- const readInt16LE = (input, offset = 0) => {
829
- const val = input[offset] + input[offset + 1] * 2 ** 8;
830
- return val | (val & 2 ** 15) * 131070;
831
- };
832
- const readUInt16BE = (input, offset = 0) => input[offset] * 2 ** 8 + input[offset + 1];
833
- const readUInt16LE = (input, offset = 0) => input[offset] + input[offset + 1] * 2 ** 8;
834
- const readUInt24LE = (input, offset = 0) => input[offset] + input[offset + 1] * 2 ** 8 + input[offset + 2] * 2 ** 16;
835
- const readInt32LE = (input, offset = 0) => input[offset] + input[offset + 1] * 2 ** 8 + input[offset + 2] * 2 ** 16 + (input[offset + 3] << 24);
836
- const readUInt32BE = (input, offset = 0) => input[offset] * 2 ** 24 + input[offset + 1] * 2 ** 16 + input[offset + 2] * 2 ** 8 + input[offset + 3];
837
- const readUInt32LE = (input, offset = 0) => input[offset] + input[offset + 1] * 2 ** 8 + input[offset + 2] * 2 ** 16 + input[offset + 3] * 2 ** 24;
838
- const methods = {
839
- readUInt16BE,
840
- readUInt16LE,
841
- readUInt32BE,
842
- readUInt32LE
843
- };
844
- function readUInt(input, bits, offset, isBigEndian) {
845
- offset = offset || 0;
846
- const endian = isBigEndian ? "BE" : "LE";
847
- const methodName = "readUInt" + bits + endian;
848
- return methods[methodName](input, offset);
849
- }
850
- function readBox(buffer, offset) {
851
- if (buffer.length - offset < 4)
852
- return;
853
- const boxSize = readUInt32BE(buffer, offset);
854
- if (buffer.length - offset < boxSize)
855
- return;
856
- return {
857
- name: toUTF8String(buffer, 4 + offset, 8 + offset),
858
- offset,
859
- size: boxSize
860
- };
861
- }
862
- function findBox(buffer, boxName, offset) {
863
- while (offset < buffer.length) {
864
- const box = readBox(buffer, offset);
865
- if (!box)
866
- break;
867
- if (box.name === boxName)
868
- return box;
869
- offset += box.size;
870
- }
871
- }
872
-
873
- const BMP = {
874
- validate: (input) => toUTF8String(input, 0, 2) === "BM",
875
- calculate: (input) => ({
876
- height: Math.abs(readInt32LE(input, 22)),
877
- width: readUInt32LE(input, 18)
878
- })
879
- };
880
-
881
- const TYPE_ICON = 1;
882
- const SIZE_HEADER$1 = 2 + 2 + 2;
883
- const SIZE_IMAGE_ENTRY = 1 + 1 + 1 + 1 + 2 + 2 + 4 + 4;
884
- function getSizeFromOffset(input, offset) {
885
- const value = input[offset];
886
- return value === 0 ? 256 : value;
887
- }
888
- function getImageSize$1(input, imageIndex) {
889
- const offset = SIZE_HEADER$1 + imageIndex * SIZE_IMAGE_ENTRY;
890
- return {
891
- height: getSizeFromOffset(input, offset + 1),
892
- width: getSizeFromOffset(input, offset)
893
- };
894
- }
895
- const ICO = {
896
- validate(input) {
897
- const reserved = readUInt16LE(input, 0);
898
- const imageCount = readUInt16LE(input, 4);
899
- if (reserved !== 0 || imageCount === 0)
900
- return false;
901
- const imageType = readUInt16LE(input, 2);
902
- return imageType === TYPE_ICON;
903
- },
904
- calculate(input) {
905
- const nbImages = readUInt16LE(input, 4);
906
- const imageSize = getImageSize$1(input, 0);
907
- if (nbImages === 1)
908
- return imageSize;
909
- const imgs = [imageSize];
910
- for (let imageIndex = 1; imageIndex < nbImages; imageIndex += 1) {
911
- imgs.push(getImageSize$1(input, imageIndex));
912
- }
913
- return {
914
- height: imageSize.height,
915
- images: imgs,
916
- width: imageSize.width
917
- };
918
- }
919
- };
920
-
921
- const TYPE_CURSOR = 2;
922
- const CUR = {
923
- validate(input) {
924
- const reserved = readUInt16LE(input, 0);
925
- const imageCount = readUInt16LE(input, 4);
926
- if (reserved !== 0 || imageCount === 0)
927
- return false;
928
- const imageType = readUInt16LE(input, 2);
929
- return imageType === TYPE_CURSOR;
930
- },
931
- calculate: (input) => ICO.calculate(input)
932
- };
933
-
934
- const DDS = {
935
- validate: (input) => readUInt32LE(input, 0) === 542327876,
936
- calculate: (input) => ({
937
- height: readUInt32LE(input, 12),
938
- width: readUInt32LE(input, 16)
939
- })
940
- };
941
-
942
- const gifRegexp = /^GIF8[79]a/;
943
- const GIF = {
944
- validate: (input) => gifRegexp.test(toUTF8String(input, 0, 6)),
945
- calculate: (input) => ({
946
- height: readUInt16LE(input, 8),
947
- width: readUInt16LE(input, 6)
948
- })
949
- };
950
-
951
- const brandMap = {
952
- avif: "avif",
953
- mif1: "heif",
954
- msf1: "heif",
955
- // hief-sequence
956
- heic: "heic",
957
- heix: "heic",
958
- hevc: "heic",
959
- // heic-sequence
960
- hevx: "heic"
961
- // heic-sequence
962
- };
963
- function detectBrands(buffer, start, end) {
964
- let brandsDetected = {};
965
- for (let i = start; i <= end; i += 4) {
966
- const brand = toUTF8String(buffer, i, i + 4);
967
- if (brand in brandMap) {
968
- brandsDetected[brand] = 1;
969
- }
970
- }
971
- if ("avif" in brandsDetected) {
972
- return "avif";
973
- } else if ("heic" in brandsDetected || "heix" in brandsDetected || "hevc" in brandsDetected || "hevx" in brandsDetected) {
974
- return "heic";
975
- } else if ("mif1" in brandsDetected || "msf1" in brandsDetected) {
976
- return "heif";
977
- }
978
- }
979
- const HEIF = {
980
- validate(buffer) {
981
- const ftype = toUTF8String(buffer, 4, 8);
982
- const brand = toUTF8String(buffer, 8, 12);
983
- return "ftyp" === ftype && brand in brandMap;
984
- },
985
- calculate(buffer) {
986
- const metaBox = findBox(buffer, "meta", 0);
987
- const iprpBox = metaBox && findBox(buffer, "iprp", metaBox.offset + 12);
988
- const ipcoBox = iprpBox && findBox(buffer, "ipco", iprpBox.offset + 8);
989
- const ispeBox = ipcoBox && findBox(buffer, "ispe", ipcoBox.offset + 8);
990
- if (ispeBox) {
991
- return {
992
- height: readUInt32BE(buffer, ispeBox.offset + 16),
993
- width: readUInt32BE(buffer, ispeBox.offset + 12),
994
- type: detectBrands(buffer, 8, metaBox.offset)
995
- };
996
- }
997
- throw new TypeError("Invalid HEIF, no size found");
998
- }
999
- };
1000
-
1001
- const SIZE_HEADER = 4 + 4;
1002
- const FILE_LENGTH_OFFSET = 4;
1003
- const ENTRY_LENGTH_OFFSET = 4;
1004
- const ICON_TYPE_SIZE = {
1005
- ICON: 32,
1006
- "ICN#": 32,
1007
- // m => 16 x 16
1008
- "icm#": 16,
1009
- icm4: 16,
1010
- icm8: 16,
1011
- // s => 16 x 16
1012
- "ics#": 16,
1013
- ics4: 16,
1014
- ics8: 16,
1015
- is32: 16,
1016
- s8mk: 16,
1017
- icp4: 16,
1018
- // l => 32 x 32
1019
- icl4: 32,
1020
- icl8: 32,
1021
- il32: 32,
1022
- l8mk: 32,
1023
- icp5: 32,
1024
- ic11: 32,
1025
- // h => 48 x 48
1026
- ich4: 48,
1027
- ich8: 48,
1028
- ih32: 48,
1029
- h8mk: 48,
1030
- // . => 64 x 64
1031
- icp6: 64,
1032
- ic12: 32,
1033
- // t => 128 x 128
1034
- it32: 128,
1035
- t8mk: 128,
1036
- ic07: 128,
1037
- // . => 256 x 256
1038
- ic08: 256,
1039
- ic13: 256,
1040
- // . => 512 x 512
1041
- ic09: 512,
1042
- ic14: 512,
1043
- // . => 1024 x 1024
1044
- ic10: 1024
1045
- };
1046
- function readImageHeader(input, imageOffset) {
1047
- const imageLengthOffset = imageOffset + ENTRY_LENGTH_OFFSET;
1048
- return [
1049
- toUTF8String(input, imageOffset, imageLengthOffset),
1050
- readUInt32BE(input, imageLengthOffset)
1051
- ];
1052
- }
1053
- function getImageSize(type) {
1054
- const size = ICON_TYPE_SIZE[type];
1055
- return { width: size, height: size, type };
1056
- }
1057
- const ICNS = {
1058
- validate: (input) => toUTF8String(input, 0, 4) === "icns",
1059
- calculate(input) {
1060
- const inputLength = input.length;
1061
- const fileLength = readUInt32BE(input, FILE_LENGTH_OFFSET);
1062
- let imageOffset = SIZE_HEADER;
1063
- let imageHeader = readImageHeader(input, imageOffset);
1064
- let imageSize = getImageSize(imageHeader[0]);
1065
- imageOffset += imageHeader[1];
1066
- if (imageOffset === fileLength)
1067
- return imageSize;
1068
- const result = {
1069
- height: imageSize.height,
1070
- images: [imageSize],
1071
- width: imageSize.width
1072
- };
1073
- while (imageOffset < fileLength && imageOffset < inputLength) {
1074
- imageHeader = readImageHeader(input, imageOffset);
1075
- imageSize = getImageSize(imageHeader[0]);
1076
- imageOffset += imageHeader[1];
1077
- result.images.push(imageSize);
1078
- }
1079
- return result;
1080
- }
1081
- };
1082
-
1083
- const J2C = {
1084
- // TODO: this doesn't seem right. SIZ marker doesn't have to be right after the SOC
1085
- validate: (input) => toHexString(input, 0, 4) === "ff4fff51",
1086
- calculate: (input) => ({
1087
- height: readUInt32BE(input, 12),
1088
- width: readUInt32BE(input, 8)
1089
- })
1090
- };
1091
-
1092
- const JP2 = {
1093
- validate(input) {
1094
- if (readUInt32BE(input, 4) !== 1783636e3 || readUInt32BE(input, 0) < 1)
1095
- return false;
1096
- const ftypBox = findBox(input, "ftyp", 0);
1097
- if (!ftypBox)
1098
- return false;
1099
- return readUInt32BE(input, ftypBox.offset + 4) === 1718909296;
1100
- },
1101
- calculate(input) {
1102
- const jp2hBox = findBox(input, "jp2h", 0);
1103
- const ihdrBox = jp2hBox && findBox(input, "ihdr", jp2hBox.offset + 8);
1104
- if (ihdrBox) {
1105
- return {
1106
- height: readUInt32BE(input, ihdrBox.offset + 8),
1107
- width: readUInt32BE(input, ihdrBox.offset + 12)
1108
- };
1109
- }
1110
- throw new TypeError("Unsupported JPEG 2000 format");
1111
- }
1112
- };
1113
-
1114
- const EXIF_MARKER = "45786966";
1115
- const APP1_DATA_SIZE_BYTES = 2;
1116
- const EXIF_HEADER_BYTES = 6;
1117
- const TIFF_BYTE_ALIGN_BYTES = 2;
1118
- const BIG_ENDIAN_BYTE_ALIGN = "4d4d";
1119
- const LITTLE_ENDIAN_BYTE_ALIGN = "4949";
1120
- const IDF_ENTRY_BYTES = 12;
1121
- const NUM_DIRECTORY_ENTRIES_BYTES = 2;
1122
- function isEXIF(input) {
1123
- return toHexString(input, 2, 6) === EXIF_MARKER;
1124
- }
1125
- function extractSize(input, index) {
1126
- return {
1127
- height: readUInt16BE(input, index),
1128
- width: readUInt16BE(input, index + 2)
1129
- };
1130
- }
1131
- function extractOrientation(exifBlock, isBigEndian) {
1132
- const idfOffset = 8;
1133
- const offset = EXIF_HEADER_BYTES + idfOffset;
1134
- const idfDirectoryEntries = readUInt(exifBlock, 16, offset, isBigEndian);
1135
- for (let directoryEntryNumber = 0; directoryEntryNumber < idfDirectoryEntries; directoryEntryNumber++) {
1136
- const start = offset + NUM_DIRECTORY_ENTRIES_BYTES + directoryEntryNumber * IDF_ENTRY_BYTES;
1137
- const end = start + IDF_ENTRY_BYTES;
1138
- if (start > exifBlock.length) {
1139
- return;
1140
- }
1141
- const block = exifBlock.slice(start, end);
1142
- const tagNumber = readUInt(block, 16, 0, isBigEndian);
1143
- if (tagNumber === 274) {
1144
- const dataFormat = readUInt(block, 16, 2, isBigEndian);
1145
- if (dataFormat !== 3) {
1146
- return;
1147
- }
1148
- const numberOfComponents = readUInt(block, 32, 4, isBigEndian);
1149
- if (numberOfComponents !== 1) {
1150
- return;
1151
- }
1152
- return readUInt(block, 16, 8, isBigEndian);
1153
- }
1154
- }
1155
- }
1156
- function validateExifBlock(input, index) {
1157
- const exifBlock = input.slice(APP1_DATA_SIZE_BYTES, index);
1158
- const byteAlign = toHexString(
1159
- exifBlock,
1160
- EXIF_HEADER_BYTES,
1161
- EXIF_HEADER_BYTES + TIFF_BYTE_ALIGN_BYTES
1162
- );
1163
- const isBigEndian = byteAlign === BIG_ENDIAN_BYTE_ALIGN;
1164
- const isLittleEndian = byteAlign === LITTLE_ENDIAN_BYTE_ALIGN;
1165
- if (isBigEndian || isLittleEndian) {
1166
- return extractOrientation(exifBlock, isBigEndian);
1167
- }
1168
- }
1169
- function validateInput(input, index) {
1170
- if (index > input.length) {
1171
- throw new TypeError("Corrupt JPG, exceeded buffer limits");
1172
- }
1173
- }
1174
- const JPG = {
1175
- validate: (input) => toHexString(input, 0, 2) === "ffd8",
1176
- calculate(input) {
1177
- input = input.slice(4);
1178
- let orientation;
1179
- let next;
1180
- while (input.length) {
1181
- const i = readUInt16BE(input, 0);
1182
- if (input[i] !== 255) {
1183
- input = input.slice(1);
1184
- continue;
1185
- }
1186
- if (isEXIF(input)) {
1187
- orientation = validateExifBlock(input, i);
1188
- }
1189
- validateInput(input, i);
1190
- next = input[i + 1];
1191
- if (next === 192 || next === 193 || next === 194) {
1192
- const size = extractSize(input, i + 5);
1193
- if (!orientation) {
1194
- return size;
1195
- }
1196
- return {
1197
- height: size.height,
1198
- orientation,
1199
- width: size.width
1200
- };
1201
- }
1202
- input = input.slice(i + 2);
1203
- }
1204
- throw new TypeError("Invalid JPG, no size found");
1205
- }
1206
- };
1207
-
1208
- const KTX = {
1209
- validate: (input) => {
1210
- const signature = toUTF8String(input, 1, 7);
1211
- return ["KTX 11", "KTX 20"].includes(signature);
1212
- },
1213
- calculate: (input) => {
1214
- const type = input[5] === 49 ? "ktx" : "ktx2";
1215
- const offset = type === "ktx" ? 36 : 20;
1216
- return {
1217
- height: readUInt32LE(input, offset + 4),
1218
- width: readUInt32LE(input, offset),
1219
- type
1220
- };
1221
- }
1222
- };
1223
-
1224
- const pngSignature = "PNG\r\n\n";
1225
- const pngImageHeaderChunkName = "IHDR";
1226
- const pngFriedChunkName = "CgBI";
1227
- const PNG = {
1228
- validate(input) {
1229
- if (pngSignature === toUTF8String(input, 1, 8)) {
1230
- let chunkName = toUTF8String(input, 12, 16);
1231
- if (chunkName === pngFriedChunkName) {
1232
- chunkName = toUTF8String(input, 28, 32);
1233
- }
1234
- if (chunkName !== pngImageHeaderChunkName) {
1235
- throw new TypeError("Invalid PNG");
1236
- }
1237
- return true;
1238
- }
1239
- return false;
1240
- },
1241
- calculate(input) {
1242
- if (toUTF8String(input, 12, 16) === pngFriedChunkName) {
1243
- return {
1244
- height: readUInt32BE(input, 36),
1245
- width: readUInt32BE(input, 32)
1246
- };
1247
- }
1248
- return {
1249
- height: readUInt32BE(input, 20),
1250
- width: readUInt32BE(input, 16)
1251
- };
1252
- }
1253
- };
1254
-
1255
- const PNMTypes = {
1256
- P1: "pbm/ascii",
1257
- P2: "pgm/ascii",
1258
- P3: "ppm/ascii",
1259
- P4: "pbm",
1260
- P5: "pgm",
1261
- P6: "ppm",
1262
- P7: "pam",
1263
- PF: "pfm"
1264
- };
1265
- const handlers = {
1266
- default: (lines) => {
1267
- let dimensions = [];
1268
- while (lines.length > 0) {
1269
- const line = lines.shift();
1270
- if (line[0] === "#") {
1271
- continue;
1272
- }
1273
- dimensions = line.split(" ");
1274
- break;
1275
- }
1276
- if (dimensions.length === 2) {
1277
- return {
1278
- height: parseInt(dimensions[1], 10),
1279
- width: parseInt(dimensions[0], 10)
1280
- };
1281
- } else {
1282
- throw new TypeError("Invalid PNM");
1283
- }
1284
- },
1285
- pam: (lines) => {
1286
- const size = {};
1287
- while (lines.length > 0) {
1288
- const line = lines.shift();
1289
- if (line.length > 16 || line.charCodeAt(0) > 128) {
1290
- continue;
1291
- }
1292
- const [key, value] = line.split(" ");
1293
- if (key && value) {
1294
- size[key.toLowerCase()] = parseInt(value, 10);
1295
- }
1296
- if (size.height && size.width) {
1297
- break;
1298
- }
1299
- }
1300
- if (size.height && size.width) {
1301
- return {
1302
- height: size.height,
1303
- width: size.width
1304
- };
1305
- } else {
1306
- throw new TypeError("Invalid PAM");
1307
- }
1308
- }
1309
- };
1310
- const PNM = {
1311
- validate: (input) => toUTF8String(input, 0, 2) in PNMTypes,
1312
- calculate(input) {
1313
- const signature = toUTF8String(input, 0, 2);
1314
- const type = PNMTypes[signature];
1315
- const lines = toUTF8String(input, 3).split(/[\r\n]+/);
1316
- const handler = handlers[type] || handlers.default;
1317
- return handler(lines);
1318
- }
1319
- };
1320
-
1321
- const PSD = {
1322
- validate: (input) => toUTF8String(input, 0, 4) === "8BPS",
1323
- calculate: (input) => ({
1324
- height: readUInt32BE(input, 14),
1325
- width: readUInt32BE(input, 18)
1326
- })
1327
- };
1328
-
1329
- const svgReg = /<svg\s([^>"']|"[^"]*"|'[^']*')*>/;
1330
- const extractorRegExps = {
1331
- height: /\sheight=(['"])([^%]+?)\1/,
1332
- root: svgReg,
1333
- viewbox: /\sviewBox=(['"])(.+?)\1/i,
1334
- width: /\swidth=(['"])([^%]+?)\1/
1335
- };
1336
- const INCH_CM = 2.54;
1337
- const units = {
1338
- in: 96,
1339
- cm: 96 / INCH_CM,
1340
- em: 16,
1341
- ex: 8,
1342
- m: 96 / INCH_CM * 100,
1343
- mm: 96 / INCH_CM / 10,
1344
- pc: 96 / 72 / 12,
1345
- pt: 96 / 72,
1346
- px: 1
1347
- };
1348
- const unitsReg = new RegExp(
1349
- `^([0-9.]+(?:e\\d+)?)(${Object.keys(units).join("|")})?$`
1350
- );
1351
- function parseLength(len) {
1352
- const m = unitsReg.exec(len);
1353
- if (!m) {
1354
- return void 0;
1355
- }
1356
- return Math.round(Number(m[1]) * (units[m[2]] || 1));
1357
- }
1358
- function parseViewbox(viewbox) {
1359
- const bounds = viewbox.split(" ");
1360
- return {
1361
- height: parseLength(bounds[3]),
1362
- width: parseLength(bounds[2])
1363
- };
1364
- }
1365
- function parseAttributes(root) {
1366
- const width = root.match(extractorRegExps.width);
1367
- const height = root.match(extractorRegExps.height);
1368
- const viewbox = root.match(extractorRegExps.viewbox);
1369
- return {
1370
- height: height && parseLength(height[2]),
1371
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
1372
- viewbox: viewbox && parseViewbox(viewbox[2]),
1373
- width: width && parseLength(width[2])
1374
- };
1375
- }
1376
- function calculateByDimensions(attrs) {
1377
- return {
1378
- height: attrs.height,
1379
- width: attrs.width
1380
- };
1381
- }
1382
- function calculateByViewbox(attrs, viewbox) {
1383
- const ratio = viewbox.width / viewbox.height;
1384
- if (attrs.width) {
1385
- return {
1386
- height: Math.floor(attrs.width / ratio),
1387
- width: attrs.width
1388
- };
1389
- }
1390
- if (attrs.height) {
1391
- return {
1392
- height: attrs.height,
1393
- width: Math.floor(attrs.height * ratio)
1394
- };
1395
- }
1396
- return {
1397
- height: viewbox.height,
1398
- width: viewbox.width
1399
- };
1400
- }
1401
- const SVG = {
1402
- // Scan only the first kilo-byte to speed up the check on larger files
1403
- validate: (input) => svgReg.test(toUTF8String(input, 0, 1e3)),
1404
- calculate(input) {
1405
- const root = toUTF8String(input).match(extractorRegExps.root);
1406
- if (root) {
1407
- const attrs = parseAttributes(root[0]);
1408
- if (attrs.width && attrs.height) {
1409
- return calculateByDimensions(attrs);
1410
- }
1411
- if (attrs.viewbox) {
1412
- return calculateByViewbox(attrs, attrs.viewbox);
1413
- }
1414
- }
1415
- throw new TypeError("Invalid SVG");
1416
- }
1417
- };
1418
-
1419
- const TGA = {
1420
- validate(input) {
1421
- return readUInt16LE(input, 0) === 0 && readUInt16LE(input, 4) === 0;
1422
- },
1423
- calculate(input) {
1424
- return {
1425
- height: readUInt16LE(input, 14),
1426
- width: readUInt16LE(input, 12)
1427
- };
1428
- }
1429
- };
1430
-
1431
- function readIFD(input, isBigEndian) {
1432
- const ifdOffset = readUInt(input, 32, 4, isBigEndian);
1433
- return input.slice(ifdOffset + 2);
1434
- }
1435
- function readValue(input, isBigEndian) {
1436
- const low = readUInt(input, 16, 8, isBigEndian);
1437
- const high = readUInt(input, 16, 10, isBigEndian);
1438
- return (high << 16) + low;
1439
- }
1440
- function nextTag(input) {
1441
- if (input.length > 24) {
1442
- return input.slice(12);
1443
- }
1444
- }
1445
- function extractTags(input, isBigEndian) {
1446
- const tags = {};
1447
- let temp = input;
1448
- while (temp && temp.length) {
1449
- const code = readUInt(temp, 16, 0, isBigEndian);
1450
- const type = readUInt(temp, 16, 2, isBigEndian);
1451
- const length = readUInt(temp, 32, 4, isBigEndian);
1452
- if (code === 0) {
1453
- break;
1454
- } else {
1455
- if (length === 1 && (type === 3 || type === 4)) {
1456
- tags[code] = readValue(temp, isBigEndian);
1457
- }
1458
- temp = nextTag(temp);
1459
- }
1460
- }
1461
- return tags;
1462
- }
1463
- function determineEndianness(input) {
1464
- const signature = toUTF8String(input, 0, 2);
1465
- if ("II" === signature) {
1466
- return "LE";
1467
- } else if ("MM" === signature) {
1468
- return "BE";
1469
- }
1470
- }
1471
- const signatures = [
1472
- // '492049', // currently not supported
1473
- "49492a00",
1474
- // Little endian
1475
- "4d4d002a"
1476
- // Big Endian
1477
- // '4d4d002a', // BigTIFF > 4GB. currently not supported
1478
- ];
1479
- const TIFF = {
1480
- validate: (input) => signatures.includes(toHexString(input, 0, 4)),
1481
- calculate(input) {
1482
- const isBigEndian = determineEndianness(input) === "BE";
1483
- const ifdBuffer = readIFD(input, isBigEndian);
1484
- const tags = extractTags(ifdBuffer, isBigEndian);
1485
- const width = tags[256];
1486
- const height = tags[257];
1487
- if (!width || !height) {
1488
- throw new TypeError("Invalid Tiff. Missing tags");
1489
- }
1490
- return { height, width };
1491
- }
1492
- };
1493
-
1494
- function calculateExtended(input) {
1495
- return {
1496
- height: 1 + readUInt24LE(input, 7),
1497
- width: 1 + readUInt24LE(input, 4)
1498
- };
1499
- }
1500
- function calculateLossless(input) {
1501
- return {
1502
- height: 1 + ((input[4] & 15) << 10 | input[3] << 2 | (input[2] & 192) >> 6),
1503
- width: 1 + ((input[2] & 63) << 8 | input[1])
1504
- };
1505
- }
1506
- function calculateLossy(input) {
1507
- return {
1508
- height: readInt16LE(input, 8) & 16383,
1509
- width: readInt16LE(input, 6) & 16383
1510
- };
1511
- }
1512
- const WEBP = {
1513
- validate(input) {
1514
- const riffHeader = "RIFF" === toUTF8String(input, 0, 4);
1515
- const webpHeader = "WEBP" === toUTF8String(input, 8, 12);
1516
- const vp8Header = "VP8" === toUTF8String(input, 12, 15);
1517
- return riffHeader && webpHeader && vp8Header;
1518
- },
1519
- calculate(input) {
1520
- const chunkHeader = toUTF8String(input, 12, 16);
1521
- input = input.slice(20, 30);
1522
- if (chunkHeader === "VP8X") {
1523
- const extendedHeader = input[0];
1524
- const validStart = (extendedHeader & 192) === 0;
1525
- const validEnd = (extendedHeader & 1) === 0;
1526
- if (validStart && validEnd) {
1527
- return calculateExtended(input);
1528
- } else {
1529
- throw new TypeError("Invalid WebP");
1530
- }
1531
- }
1532
- if (chunkHeader === "VP8 " && input[0] !== 47) {
1533
- return calculateLossy(input);
1534
- }
1535
- const signature = toHexString(input, 3, 6);
1536
- if (chunkHeader === "VP8L" && signature !== "9d012a") {
1537
- return calculateLossless(input);
1538
- }
1539
- throw new TypeError("Invalid WebP");
1540
- }
1541
- };
1542
-
1543
- const typeHandlers = /* @__PURE__ */ new Map([
1544
- ["bmp", BMP],
1545
- ["cur", CUR],
1546
- ["dds", DDS],
1547
- ["gif", GIF],
1548
- ["heif", HEIF],
1549
- ["icns", ICNS],
1550
- ["ico", ICO],
1551
- ["j2c", J2C],
1552
- ["jp2", JP2],
1553
- ["jpg", JPG],
1554
- ["ktx", KTX],
1555
- ["png", PNG],
1556
- ["pnm", PNM],
1557
- ["psd", PSD],
1558
- ["svg", SVG],
1559
- ["tga", TGA],
1560
- ["tiff", TIFF],
1561
- ["webp", WEBP]
1562
- ]);
1563
- const types = Array.from(typeHandlers.keys());
1564
-
1565
- const firstBytes = /* @__PURE__ */ new Map([
1566
- [56, "psd"],
1567
- [66, "bmp"],
1568
- [68, "dds"],
1569
- [71, "gif"],
1570
- [73, "tiff"],
1571
- [77, "tiff"],
1572
- [82, "webp"],
1573
- [105, "icns"],
1574
- [137, "png"],
1575
- [255, "jpg"]
1576
- ]);
1577
- function detector(input) {
1578
- const byte = input[0];
1579
- const type = firstBytes.get(byte);
1580
- if (type && typeHandlers.get(type).validate(input)) {
1581
- return type;
1582
- }
1583
- return types.find((fileType) => typeHandlers.get(fileType).validate(input));
1584
- }
1585
-
1586
- const globalOptions = {
1587
- disabledTypes: []
1588
- };
1589
- function lookup(input) {
1590
- const type = detector(input);
1591
- if (typeof type !== "undefined") {
1592
- if (globalOptions.disabledTypes.indexOf(type) > -1) {
1593
- throw new TypeError("disabled file type: " + type);
1594
- }
1595
- const size = typeHandlers.get(type).calculate(input);
1596
- if (size !== void 0) {
1597
- size.type = size.type ?? type;
1598
- return size;
1599
- }
1600
- }
1601
- throw new TypeError("unsupported file type: " + type);
1602
- }
1603
-
1604
- async function probe(url) {
1605
- const response = await fetch(url);
1606
- if (!response.body || !response.ok) {
1607
- throw new Error("Failed to fetch image");
1608
- }
1609
- const reader = response.body.getReader();
1610
- let done, value;
1611
- let accumulatedChunks = new Uint8Array();
1612
- while (!done) {
1613
- const readResult = await reader.read();
1614
- done = readResult.done;
1615
- if (done)
1616
- break;
1617
- if (readResult.value) {
1618
- value = readResult.value;
1619
- let tmp = new Uint8Array(accumulatedChunks.length + value.length);
1620
- tmp.set(accumulatedChunks, 0);
1621
- tmp.set(value, accumulatedChunks.length);
1622
- accumulatedChunks = tmp;
1623
- try {
1624
- const dimensions = lookup(accumulatedChunks);
1625
- if (dimensions) {
1626
- await reader.cancel();
1627
- return dimensions;
1628
- }
1629
- } catch (error) {
1630
- }
1631
- }
1632
- }
1633
- throw new Error("Failed to parse the size");
1634
- }
1635
-
1636
- async function getConfiguredImageService() {
1637
- if (!globalThis?.astroAsset?.imageService) {
1638
- const { default: service } = await import(
1639
- // @ts-expect-error
1640
- '../astro/assets-service_DSoC_W52.mjs'
1641
- ).then(n => n.s).catch((e) => {
1642
- const error = new AstroError(InvalidImageService);
1643
- error.cause = e;
1644
- throw error;
1645
- });
1646
- if (!globalThis.astroAsset)
1647
- globalThis.astroAsset = {};
1648
- globalThis.astroAsset.imageService = service;
1649
- return service;
1650
- }
1651
- return globalThis.astroAsset.imageService;
1652
- }
1653
- async function getImage$1(options, imageConfig) {
1654
- if (!options || typeof options !== "object") {
1655
- throw new AstroError({
1656
- ...ExpectedImageOptions,
1657
- message: ExpectedImageOptions.message(JSON.stringify(options))
1658
- });
1659
- }
1660
- if (typeof options.src === "undefined") {
1661
- throw new AstroError({
1662
- ...ExpectedImage,
1663
- message: ExpectedImage.message(
1664
- options.src,
1665
- "undefined",
1666
- JSON.stringify(options)
1667
- )
1668
- });
1669
- }
1670
- const service = await getConfiguredImageService();
1671
- const resolvedOptions = {
1672
- ...options,
1673
- src: await resolveSrc(options.src)
1674
- };
1675
- if (options.inferSize && isRemoteImage(resolvedOptions.src)) {
1676
- try {
1677
- const result = await probe(resolvedOptions.src);
1678
- resolvedOptions.width ??= result.width;
1679
- resolvedOptions.height ??= result.height;
1680
- delete resolvedOptions.inferSize;
1681
- } catch {
1682
- throw new AstroError({
1683
- ...FailedToFetchRemoteImageDimensions,
1684
- message: FailedToFetchRemoteImageDimensions.message(resolvedOptions.src)
1685
- });
1686
- }
1687
- }
1688
- const originalFilePath = isESMImportedImage(resolvedOptions.src) ? resolvedOptions.src.fsPath : void 0;
1689
- const clonedSrc = isESMImportedImage(resolvedOptions.src) ? (
1690
- // @ts-expect-error - clone is a private, hidden prop
1691
- resolvedOptions.src.clone ?? resolvedOptions.src
1692
- ) : resolvedOptions.src;
1693
- resolvedOptions.src = clonedSrc;
1694
- const validatedOptions = service.validateOptions ? await service.validateOptions(resolvedOptions, imageConfig) : resolvedOptions;
1695
- const srcSetTransforms = service.getSrcSet ? await service.getSrcSet(validatedOptions, imageConfig) : [];
1696
- let imageURL = await service.getURL(validatedOptions, imageConfig);
1697
- let srcSets = await Promise.all(
1698
- srcSetTransforms.map(async (srcSet) => ({
1699
- transform: srcSet.transform,
1700
- url: await service.getURL(srcSet.transform, imageConfig),
1701
- descriptor: srcSet.descriptor,
1702
- attributes: srcSet.attributes
1703
- }))
1704
- );
1705
- if (isLocalService(service) && globalThis.astroAsset.addStaticImage && !(isRemoteImage(validatedOptions.src) && imageURL === validatedOptions.src)) {
1706
- const propsToHash = service.propertiesToHash ?? DEFAULT_HASH_PROPS;
1707
- imageURL = globalThis.astroAsset.addStaticImage(
1708
- validatedOptions,
1709
- propsToHash,
1710
- originalFilePath
1711
- );
1712
- srcSets = srcSetTransforms.map((srcSet) => ({
1713
- transform: srcSet.transform,
1714
- url: globalThis.astroAsset.addStaticImage(srcSet.transform, propsToHash, originalFilePath),
1715
- descriptor: srcSet.descriptor,
1716
- attributes: srcSet.attributes
1717
- }));
1718
- }
1719
- return {
1720
- rawOptions: resolvedOptions,
1721
- options: validatedOptions,
1722
- src: imageURL,
1723
- srcSet: {
1724
- values: srcSets,
1725
- attribute: srcSets.map((srcSet) => `${srcSet.url} ${srcSet.descriptor}`).join(", ")
1726
- },
1727
- attributes: service.getHTMLAttributes !== void 0 ? await service.getHTMLAttributes(validatedOptions, imageConfig) : {}
1728
- };
1729
- }
1730
-
1731
- const $$Astro$b = createAstro("https://demo.ecomplus.app");
1732
- const $$Image = createComponent(async ($$result, $$props, $$slots) => {
1733
- const Astro2 = $$result.createAstro($$Astro$b, $$props, $$slots);
1734
- Astro2.self = $$Image;
1735
- const props = Astro2.props;
1736
- if (props.alt === void 0 || props.alt === null) {
1737
- throw new AstroError(ImageMissingAlt);
1738
- }
1739
- if (typeof props.width === "string") {
1740
- props.width = parseInt(props.width);
1741
- }
1742
- if (typeof props.height === "string") {
1743
- props.height = parseInt(props.height);
1744
- }
1745
- const image = await getImage(props);
1746
- const additionalAttributes = {};
1747
- if (image.srcSet.values.length > 0) {
1748
- additionalAttributes.srcset = image.srcSet.attribute;
1749
- }
1750
- return renderTemplate`${maybeRenderHead()}<img${addAttribute(image.src, "src")}${spreadAttributes(additionalAttributes)}${spreadAttributes(image.attributes)}>`;
1751
- }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/node_modules/astro/components/Image.astro", void 0);
1752
-
1753
- const $$Astro$a = createAstro("https://demo.ecomplus.app");
1754
- const $$Picture$1 = createComponent(async ($$result, $$props, $$slots) => {
1755
- const Astro2 = $$result.createAstro($$Astro$a, $$props, $$slots);
1756
- Astro2.self = $$Picture$1;
1757
- const defaultFormats = ["webp"];
1758
- const defaultFallbackFormat = "png";
1759
- const specialFormatsFallback = ["gif", "svg", "jpg", "jpeg"];
1760
- const { formats = defaultFormats, pictureAttributes = {}, fallbackFormat, ...props } = Astro2.props;
1761
- if (props.alt === void 0 || props.alt === null) {
1762
- throw new AstroError(ImageMissingAlt);
1763
- }
1764
- const originalSrc = await resolveSrc(props.src);
1765
- const optimizedImages = await Promise.all(
1766
- formats.map(
1767
- async (format) => await getImage({
1768
- ...props,
1769
- src: originalSrc,
1770
- format,
1771
- widths: props.widths,
1772
- densities: props.densities
1773
- })
1774
- )
1775
- );
1776
- let resultFallbackFormat = fallbackFormat ?? defaultFallbackFormat;
1777
- if (!fallbackFormat && isESMImportedImage(originalSrc) && originalSrc.format in specialFormatsFallback) {
1778
- resultFallbackFormat = originalSrc.format;
1779
- }
1780
- const fallbackImage = await getImage({
1781
- ...props,
1782
- format: resultFallbackFormat,
1783
- widths: props.widths,
1784
- densities: props.densities
1785
- });
1786
- const imgAdditionalAttributes = {};
1787
- const sourceAdditionalAttributes = {};
1788
- if (props.sizes) {
1789
- sourceAdditionalAttributes.sizes = props.sizes;
1790
- }
1791
- if (fallbackImage.srcSet.values.length > 0) {
1792
- imgAdditionalAttributes.srcset = fallbackImage.srcSet.attribute;
1793
- }
1794
- return renderTemplate`${maybeRenderHead()}<picture${spreadAttributes(pictureAttributes)}>
1795
- ${Object.entries(optimizedImages).map(([_, image]) => {
1796
- const srcsetAttribute = props.densities || !props.densities && !props.widths ? `${image.src}${image.srcSet.values.length > 0 ? ", " + image.srcSet.attribute : ""}` : image.srcSet.attribute;
1797
- return renderTemplate`<source${addAttribute(srcsetAttribute, "srcset")}${addAttribute("image/" + image.options.format, "type")}${spreadAttributes(sourceAdditionalAttributes)}>`;
1798
- })}
1799
- <img${addAttribute(fallbackImage.src, "src")}${spreadAttributes(imgAdditionalAttributes)}${spreadAttributes(fallbackImage.attributes)}>
1800
- </picture>`;
1801
- }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/node_modules/astro/components/Picture.astro", void 0);
1802
-
1803
- const imageConfig = {"service":{"entrypoint":"astro/assets/services/sharp","config":{}},"domains":[],"remotePatterns":[],"endpoint":"astro/assets/endpoint/node"};
1804
- // This is used by the @astrojs/node integration to locate images.
1805
- // It's unused on other platforms, but on some platforms like Netlify (and presumably also Vercel)
1806
- // new URL("dist/...") is interpreted by the bundler as a signal to include that directory
1807
- // in the Lambda bundle, which would bloat the bundle with images.
1808
- // To prevent this, we mark the URL construction as pure,
1809
- // so that it's tree-shaken away for all platforms that don't need it.
1810
- const outDir = /* #__PURE__ */ new URL("file:///home/leo/code/ecomplus/cloud-commerce/packages/storefront/dist/client/");
1811
- const assetsDir = /* #__PURE__ */ new URL("_astro", outDir);
1812
- const getImage = async (options) => await getImage$1(options, imageConfig);
1813
-
1814
822
  const i19aboveOf = "Acima de";
1815
823
  const i19brands = "Marcas";
1816
824
  const i19categories = "Categorias";
@@ -2004,9 +1012,8 @@ if (!globalThis.$apiPrefetchEndpoints) {
2004
1012
  }
2005
1013
  const sessions = {};
2006
1014
  global.__sfSessions = sessions;
2007
- const $str = "$storefront";
2008
- if (!globalThis[$str]) {
2009
- globalThis[$str] = new Proxy({
1015
+ if (!globalThis.$storefront) {
1016
+ globalThis.$storefront = new Proxy({
2010
1017
  settings: {},
2011
1018
  data: {},
2012
1019
  url: void 0,
@@ -2348,7 +1355,7 @@ window.ECOM_LANG = '${lang}';
2348
1355
  window.ECOM_CURRENCY = '${currency}';
2349
1356
  window.ECOM_CURRENCY_SYMBOL = '${currencySymbol}';
2350
1357
  window.ECOM_COUNTRY_CODE = '${countryCode}';
2351
- window.GIT_BRANCH = '${{"BASE_URL": "/", "MODE": "production", "DEV": false, "PROD": true, "SSR": true, "SITE": "https://demo.ecomplus.app", "ASSETS_PREFIX": undefined}.GIT_BRANCH || ""}';
1358
+ window.GIT_BRANCH = '${process.env.GIT_BRANCH || ""}';
2352
1359
  window.$storefront = ${JSON.stringify({ settings, data: {} })};`;
2353
1360
  if (apiContext.error) {
2354
1361
  const { message, statusCode } = apiContext.error;
@@ -2415,7 +1422,7 @@ window.$isCmsPreview = true;`;
2415
1422
  logo: `https://${domain}${settings.logo}`
2416
1423
  });
2417
1424
  const generator = `e-com.plus @cloudcommerce/storefront, ${Astro2.generator}`;
2418
- return renderTemplate(_c || (_c = __template$3(['<meta charset="UTF-8">\n<meta name="viewport" content="width=device-width">\n<meta name="theme-color"', '>\n<link rel="icon" type="image/png"', ' sizes="32x32">\n', "\n", "\n", '\n<meta name="author"', '>\n<meta name="generator"', '>\n<link rel="canonical"', ">\n", '\n<meta name="apple-mobile-web-app-capable" content="yes">\n<meta name="apple-mobile-web-app-status-bar-style" content="default">\n<meta property="og:site_name"', '>\n<meta property="og:url"', '>\n<meta property="og:title"', '>\n<meta property="og:description"', '>\n<meta property="og:type" content="website">\n<meta property="og:locale"', ">\n", "\n", '\n<meta name="twitter:card" content="summary">\n', '\n<meta name="ecom-store-id"', ">\n\n", "\n\n<script>", '</script>\n<script type="application/ld+json">', "</script>\n\n", ""])), addAttribute(primaryColor, "content"), addAttribute(favicon, "href"), shortcutIcon && renderTemplate`<link rel="icon" type="image/png"${addAttribute(shortcutIcon, "href")} sizes="192x192">`, title && renderTemplate`<title>${title}</title>`, description && renderTemplate`<meta name="description"${addAttribute(description, "content")}>`, addAttribute(settings.name, "content"), addAttribute(generator, "content"), addAttribute(canonicalUrl, "href"), shortcutIcon && renderTemplate`<link rel="apple-touch-icon"${addAttribute(shortcutIcon, "href")}>`, addAttribute(settings.name, "content"), addAttribute(canonicalUrl, "content"), addAttribute(title, "content"), addAttribute(description, "content"), addAttribute(ogLocale, "content"), ogImage && renderTemplate`<meta property="og:image"${addAttribute(ogImage, "content")}>`, metatagsContent?.fbAppId && renderTemplate`<meta property="fb:app_id"${addAttribute(metatagsContent.fbAppId, "content")}>`, metatagsContent?.twitterUsername && renderTemplate`<meta name="twitter:site"${addAttribute(metatagsContent.twitterUsername, "content")}>`, addAttribute(String(storeId), "content"), isPWA , unescapeHTML(inlineClientJS), unescapeHTML(inlineJSONLd), contextInlineClientJS && renderTemplate(_b || (_b = __template$3(["<script>", "</script>"])), unescapeHTML(contextInlineClientJS)));
1425
+ return renderTemplate(_c || (_c = __template$3(['<meta charset="UTF-8"><meta name="viewport" content="width=device-width"><meta name="theme-color"', '><link rel="icon" type="image/png"', ' sizes="32x32">', "", "", '<meta name="author"', '><meta name="generator"', '><link rel="canonical"', ">", '<meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta property="og:site_name"', '><meta property="og:url"', '><meta property="og:title"', '><meta property="og:description"', '><meta property="og:type" content="website"><meta property="og:locale"', ">", "", '<meta name="twitter:card" content="summary">', '<meta name="ecom-store-id"', ">", "<script>", '</script><script type="application/ld+json">', "</script>", ""])), addAttribute(primaryColor, "content"), addAttribute(favicon, "href"), shortcutIcon && renderTemplate`<link rel="icon" type="image/png"${addAttribute(shortcutIcon, "href")} sizes="192x192">`, title && renderTemplate`<title>${title}</title>`, description && renderTemplate`<meta name="description"${addAttribute(description, "content")}>`, addAttribute(settings.name, "content"), addAttribute(generator, "content"), addAttribute(canonicalUrl, "href"), shortcutIcon && renderTemplate`<link rel="apple-touch-icon"${addAttribute(shortcutIcon, "href")}>`, addAttribute(settings.name, "content"), addAttribute(canonicalUrl, "content"), addAttribute(title, "content"), addAttribute(description, "content"), addAttribute(ogLocale, "content"), ogImage && renderTemplate`<meta property="og:image"${addAttribute(ogImage, "content")}>`, metatagsContent?.fbAppId && renderTemplate`<meta property="fb:app_id"${addAttribute(metatagsContent.fbAppId, "content")}>`, metatagsContent?.twitterUsername && renderTemplate`<meta name="twitter:site"${addAttribute(metatagsContent.twitterUsername, "content")}>`, addAttribute(String(storeId), "content"), isPWA , unescapeHTML(inlineClientJS), unescapeHTML(inlineJSONLd), contextInlineClientJS && renderTemplate(_b || (_b = __template$3(["<script>", "</script>"])), unescapeHTML(contextInlineClientJS)));
2419
1426
  }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/BaseHead.astro", void 0);
2420
1427
 
2421
1428
  function has(value) {
@@ -2652,6 +1659,54 @@ const createPictureGetter = (getImage) => {
2652
1659
  };
2653
1660
  };
2654
1661
 
1662
+ const { STOREFRONT_BASE_DIR } = process.env;
1663
+ const baseDir = STOREFRONT_BASE_DIR || process.cwd();
1664
+ const builtImages = [];
1665
+ const manifestFilepath = join(baseDir, "dist/server/images.dist.csv");
1666
+ try {
1667
+ readFileSync(manifestFilepath, "utf-8").split(/\n/).forEach((line) => {
1668
+ const [filename, width, height] = line.split(",");
1669
+ builtImages.push({
1670
+ filename,
1671
+ width: Number(width),
1672
+ height: Number(height)
1673
+ });
1674
+ });
1675
+ } catch (err) {
1676
+ if (global.$renderStorefront) {
1677
+ console.error(err);
1678
+ }
1679
+ }
1680
+ builtImages.sort((a, b) => {
1681
+ if (a.width < b.width)
1682
+ return -1;
1683
+ return 1;
1684
+ });
1685
+ const getBuiltImage = async ({ src, width, format }) => {
1686
+ const filename = src.replace(/^.*\//, "").replace(/.\w+(\?.*)?$/, "");
1687
+ const filenameRegExp = new RegExp(`[_.][a-z0-9]+\\.${format}$`, "i");
1688
+ const matchFilename = (_builtImage) => {
1689
+ return filename === _builtImage.filename.replace(filenameRegExp, "");
1690
+ };
1691
+ let builtImage = builtImages.find((_builtImage) => {
1692
+ return _builtImage.width >= width && matchFilename(_builtImage);
1693
+ });
1694
+ if (!builtImage) {
1695
+ builtImage = builtImages.find(matchFilename);
1696
+ }
1697
+ if (builtImage) {
1698
+ return {
1699
+ src: `/_astro/${builtImage.filename}`,
1700
+ width: builtImage.width,
1701
+ height: builtImage.height
1702
+ };
1703
+ }
1704
+ console.warn(`Could not match built ${format} image for ${src} ${width}px`);
1705
+ return { src, width };
1706
+ };
1707
+
1708
+ const getBuiltPicture = createPictureGetter(getBuiltImage);
1709
+
2655
1710
  const getAspectRatio = (src, tryImageSize) => {
2656
1711
  if (typeof src === "string") {
2657
1712
  src = tryImageSize(src);
@@ -2804,31 +1859,27 @@ const $$Astro$8 = createAstro("https://demo.ecomplus.app");
2804
1859
  const $$Picture = createComponent(async ($$result, $$props, $$slots) => {
2805
1860
  const Astro2 = $$result.createAstro($$Astro$8, $$props, $$slots);
2806
1861
  Astro2.self = $$Picture;
2807
- const deployRand = {"BASE_URL": "/", "MODE": "production", "DEV": false, "PROD": true, "SSR": true, "SITE": "https://demo.ecomplus.app", "ASSETS_PREFIX": undefined}.DEPLOY_RAND;
2808
- const versionSuffix = {"BASE_URL": "/", "MODE": "production", "DEV": false, "PROD": true, "SSR": true, "SITE": "https://demo.ecomplus.app", "ASSETS_PREFIX": undefined}.BUILD_OUTPUT !== "static" && deployRand ? `&V=${deployRand}` : "";
2809
- const getImageFilepath = (src) => {
2810
- const filepath = resolve(process.env.STOREFRONT_BASE_DIR, `public${src}`);
2811
- if ({"BASE_URL": "/", "MODE": "production", "DEV": false, "PROD": true, "SSR": true, "SITE": "https://demo.ecomplus.app", "ASSETS_PREFIX": undefined}.BUILD_OUTPUT === "static") {
2812
- try {
2813
- copyFileSync(filepath, resolve(
2814
- process.env.STOREFRONT_BASE_DIR,
2815
- {"BASE_URL": "/", "MODE": "production", "DEV": false, "PROD": true, "SSR": true, "SITE": "https://demo.ecomplus.app", "ASSETS_PREFIX": undefined}.BUILD_OUT_DIR || "dist/client",
2816
- "_astro",
2817
- basename$1(filepath)
2818
- ));
2819
- } catch (err) {
2820
- console.error(err);
2821
- }
2822
- }
2823
- return filepath;
2824
- };
1862
+ const { STOREFRONT_BASE_DIR } = process.env;
1863
+ const baseDir = STOREFRONT_BASE_DIR || process.cwd();
1864
+ const originalImages = [];
1865
+ const manifestFilepath = join(baseDir, "dist/server/images.src.csv");
1866
+ readFileSync(manifestFilepath, "utf-8").split(/\n/).forEach((line) => {
1867
+ const [filepath, width, height] = line.split(",");
1868
+ originalImages.push({
1869
+ filepath,
1870
+ width: Number(width),
1871
+ height: Number(height)
1872
+ });
1873
+ });
2825
1874
  const tryImageSize = (src) => {
2826
1875
  let dimensions = {};
2827
1876
  if (typeof src === "string" && src.startsWith("/")) {
2828
- try {
2829
- dimensions = imageSize(getImageFilepath(src));
2830
- } catch (e) {
2831
- dimensions = {};
1877
+ const originalImage = originalImages.find(({ filepath }) => {
1878
+ return new RegExp(`^/${filepath}\\??.*`).test(src);
1879
+ });
1880
+ if (originalImage) {
1881
+ const { width, height } = originalImage;
1882
+ dimensions = { width, height };
2832
1883
  }
2833
1884
  }
2834
1885
  return dimensions;
@@ -2841,62 +1892,18 @@ const $$Picture = createComponent(async ($$result, $$props, $$slots) => {
2841
1892
  } = await useSSRPicture({
2842
1893
  ...Astro2.props,
2843
1894
  tryImageSize,
2844
- getPicture: createPictureGetter(async (imageOptions) => {
2845
- let imageMetadata;
2846
- if (imageOptions.src.startsWith("/")) {
2847
- const imageFilepath = getImageFilepath(imageOptions.src);
2848
- const { width: width2, height: height2 } = tryImageSize(imageOptions.src);
2849
- if (width2 && height2) {
2850
- const mimeType = mime.getType(imageFilepath);
2851
- if (mimeType?.startsWith("image/")) {
2852
- imageMetadata = {
2853
- src: imageFilepath,
2854
- width: width2,
2855
- height: height2,
2856
- // @ts-ignore
2857
- format: mimeType.replace("image/", "")
2858
- };
2859
- }
2860
- }
2861
- }
2862
- const {
2863
- src,
2864
- attributes: { width, height }
2865
- } = await getImage({
2866
- ...imageOptions,
2867
- src: imageMetadata || imageOptions.src
2868
- });
2869
- return { src, width, height };
2870
- }),
1895
+ getPicture: getBuiltPicture,
2871
1896
  assetsPrefix: Astro2.locals.assetsPrefix
2872
1897
  });
2873
- if (imgAttrs) {
2874
- imgAttrs.src += versionSuffix;
2875
- }
2876
- return renderTemplate`${maybeRenderHead()}<picture${spreadAttributes(pictureAttrs)}>
2877
- ${sources.map((attrs) => {
2878
- if (versionSuffix) {
2879
- attrs.srcset = attrs.srcset.replace(/\s(\w+)$/, `${versionSuffix} $1`);
2880
- }
2881
- return renderTemplate`<source${spreadAttributes(attrs)}${addAttribute(sizes, "sizes")}>`;
2882
- })}
2883
- ${imgAttrs && renderTemplate`<img${spreadAttributes(imgAttrs)}>`}
2884
- </picture>`;
2885
- }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/components/Picture.astro", void 0);
1898
+ return renderTemplate`${maybeRenderHead()}<picture${spreadAttributes(pictureAttrs)}> ${sources.map((attrs) => renderTemplate`<source${spreadAttributes(attrs)}${addAttribute(sizes, "sizes")}>`)} ${imgAttrs && renderTemplate`<img${spreadAttributes(imgAttrs)}>`} </picture>`;
1899
+ }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/images/Picture.runtime.astro", void 0);
2886
1900
 
2887
1901
  const $$Astro$7 = createAstro("https://demo.ecomplus.app");
2888
1902
  const $$BaseBody = createComponent(async ($$result, $$props, $$slots) => {
2889
1903
  const Astro2 = $$result.createAstro($$Astro$7, $$props, $$slots);
2890
1904
  Astro2.self = $$BaseBody;
2891
1905
  const { settings } = Astro2.locals.routeContext;
2892
- return renderTemplate`${maybeRenderHead()}<body style="visibility:hidden" class="!visible"> <!-- Prevent FOUC -->
2893
- <div id="teleported-overlap" class="relative z-[59]"></div>
2894
- <div id="teleported-top" class="relative z-[19]"></div>
2895
- ${renderSlot$1($$result, $$slots["default"])}
2896
- ${renderSlot$1($$result, $$slots["before-body-end"])}
2897
- <div id="teleported-bottom" class="relative z-[19]"></div>
2898
- ${settings.icon && renderTemplate`${renderComponent($$result, "Picture", $$Picture, { "src": settings.icon, "alt": "Icon", "formats": ["png"], "widths": [32, 192, 512], "sizes": "32px", "class": "absolute hidden", "style": "bottom: -1000px", "hasImg": false })}`}
2899
- </body>`;
1906
+ return renderTemplate`${maybeRenderHead()}<body style="visibility:hidden" class="!visible"> <!-- Prevent FOUC --> <div id="teleported-overlap" class="relative z-[59]"></div> <div id="teleported-top" class="relative z-[19]"></div> ${renderSlot$1($$result, $$slots["default"])} ${renderSlot$1($$result, $$slots["before-body-end"])} <div id="teleported-bottom" class="relative z-[19]"></div> ${settings.icon && renderTemplate`${renderComponent($$result, "Picture", $$Picture, { "src": settings.icon, "alt": "Icon", "formats": ["png"], "widths": [32, 192, 512], "sizes": "32px", "class": "absolute hidden", "style": "bottom: -1000px", "hasImg": false })}`} </body>`;
2900
1907
  }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/BaseBody.astro", void 0);
2901
1908
 
2902
1909
  const $$Astro$6 = createAstro("https://demo.ecomplus.app");
@@ -2905,16 +1912,7 @@ const $$Base$1 = createComponent(async ($$result, $$props, $$slots) => {
2905
1912
  Astro2.self = $$Base$1;
2906
1913
  const { getContent } = Astro2.locals.routeContext;
2907
1914
  const { customCode } = await getContent("layout");
2908
- return renderTemplate`${renderComponent($$result, "Head", Head, {}, { "default": ($$result2) => renderTemplate`
2909
- ${renderSlot$1($$result2, $$slots["base-head"])}
2910
- ${customCode?.css && renderTemplate`<style>{customCode.css}</style>`}${customCode?.htmlHead && renderTemplate`${renderComponent($$result2, "Fragment", Fragment, {}, { "default": ($$result3) => renderTemplate`${unescapeHTML(customCode.htmlHead)}` })}`}${renderSlot$1($$result2, $$slots["base-head-scripts"])}
2911
- ${renderSlot$1($$result2, $$slots["before-head-end"])}
2912
- ` })}
2913
- ${renderComponent($$result, "BaseBody", $$BaseBody, {}, { "default": ($$result2) => renderTemplate`
2914
- ${renderSlot$1($$result2, $$slots["default"])}
2915
- ${customCode?.htmlBody && renderTemplate`${renderComponent($$result2, "Fragment", Fragment, {}, { "default": ($$result3) => renderTemplate`${unescapeHTML(customCode.htmlBody)}` })}`}${renderSlot$1($$result2, $$slots["base-body-scripts"])}
2916
- ${renderSlot$1($$result2, $$slots["before-body-end"])}
2917
- ` })}`;
1915
+ return renderTemplate`${renderComponent($$result, "Head", Head, {}, { "default": ($$result2) => renderTemplate` ${renderSlot$1($$result2, $$slots["base-head"])} ${customCode?.css && renderTemplate`<style>{customCode.css}</style>`}${customCode?.htmlHead && renderTemplate`${renderComponent($$result2, "Fragment", Fragment, {}, { "default": ($$result3) => renderTemplate`${unescapeHTML(customCode.htmlHead)}` })}`}${renderSlot$1($$result2, $$slots["base-head-scripts"])} ${renderSlot$1($$result2, $$slots["before-head-end"])} ` })} ${renderComponent($$result, "BaseBody", $$BaseBody, {}, { "default": ($$result2) => renderTemplate` ${renderSlot$1($$result2, $$slots["default"])} ${customCode?.htmlBody && renderTemplate`${renderComponent($$result2, "Fragment", Fragment, {}, { "default": ($$result3) => renderTemplate`${unescapeHTML(customCode.htmlBody)}` })}`}${renderSlot$1($$result2, $$slots["base-body-scripts"])} ${renderSlot$1($$result2, $$slots["before-body-end"])} ` })}`;
2918
1916
  }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/Base.astro", void 0);
2919
1917
 
2920
1918
  var __freeze$2 = Object.freeze;
@@ -2932,13 +1930,7 @@ const $$Astro$4 = createAstro("https://demo.ecomplus.app");
2932
1930
  const $$Base = createComponent(async ($$result, $$props, $$slots) => {
2933
1931
  const Astro2 = $$result.createAstro($$Astro$4, $$props, $$slots);
2934
1932
  Astro2.self = $$Base;
2935
- return renderTemplate`${renderComponent($$result, "SfBase", $$Base$1, {}, { "base-head": ($$result2) => renderTemplate`${renderComponent($$result2, "Fragment", Fragment, { "slot": "base-head" }, { "default": ($$result3) => renderTemplate`
2936
- ${renderSlot$1($$result3, $$slots["base-head"])}
2937
- ` })}`, "before-head-end": ($$result2) => renderTemplate`${renderComponent($$result2, "InlineScripts", $$InlineScripts, { "slot": "before-head-end" })}`, "default": ($$result2) => renderTemplate`
2938
-
2939
-
2940
- ${renderSlot$1($$result2, $$slots["default"])}
2941
- ` })}`;
1933
+ return renderTemplate`${renderComponent($$result, "SfBase", $$Base$1, {}, { "base-head": ($$result2) => renderTemplate`${renderComponent($$result2, "Fragment", Fragment, { "slot": "base-head" }, { "default": ($$result3) => renderTemplate` ${renderSlot$1($$result3, $$slots["base-head"])} ` })}`, "before-head-end": ($$result2) => renderTemplate`${renderComponent($$result2, "InlineScripts", $$InlineScripts, { "slot": "before-head-end" })}`, "default": ($$result2) => renderTemplate` ${renderSlot$1($$result2, $$slots["default"])} ` })}`;
2942
1934
  }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/layouts/Base.astro", void 0);
2943
1935
 
2944
1936
  const emitter = new EventEmitter();
@@ -4018,10 +3010,11 @@ const isLogged = computed(() => {
4018
3010
  return isAuthenticated.value || !!firebaseAuth?.currentUser?.emailVerified;
4019
3011
  });
4020
3012
  const logout = () => {
4021
- session.auth = emptySession.auth;
4022
- session.customer = emptySession.customer;
4023
- localStorage.removeItem(storageKey);
4024
- firebaseAuth.signOut();
3013
+ firebaseAuth.signOut().then(() => {
3014
+ session.auth = emptySession.auth;
3015
+ session.customer = emptySession.customer;
3016
+ localStorage.removeItem(storageKey);
3017
+ });
4025
3018
  };
4026
3019
  const initializeFirebaseAuth = (canWaitIdle) => {
4027
3020
  return;
@@ -5636,8 +4629,8 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
5636
4629
  },
5637
4630
  setup(__props, { expose: __expose }) {
5638
4631
  __expose();
5639
- const SearchModal = defineAsyncComponent(() => import('../SearchModal_CGNQss2j.mjs'));
5640
- const CartSidebar = defineAsyncComponent(() => import('../CartSidebar_tmly-0ip.mjs'));
4632
+ const SearchModal = defineAsyncComponent(() => import('../SearchModal_O1xTrm-9.mjs'));
4633
+ const CartSidebar = defineAsyncComponent(() => import('../CartSidebar_kQSDOTj2.mjs'));
5641
4634
  const props = __props;
5642
4635
  const header = ref(null);
5643
4636
  const searchInput = ref(null);
@@ -5912,13 +4905,7 @@ const $$PageHeader = createComponent(async ($$result, $$props, $$slots) => {
5912
4905
  shopHeader
5913
4906
  } = await usePageHeader({ routeContext });
5914
4907
  const { getInlineClientJS } = await useSharedData({ field: "categories" });
5915
- return renderTemplate`${renderSlot$1($$result, $$slots["pitch-bar"], renderTemplate(_a$1 || (_a$1 = __template$1(["\n ", "\n\n<script async>", "<\/script>\n", ""])), pitchBar.slides.length > 1 || isPreview ? renderTemplate`${renderComponent($$result, "PitchBar", PitchBar, { ...pitchBar, "client:sf": "lazy", "client:component-hydration": "sf", "client:component-path": "~/components/PitchBar.vue", "client:component-export": "default" })}` : renderTemplate`${renderComponent($$result, "PitchBar", PitchBar, { ...pitchBar })}`, unescapeHTML(getInlineClientJS()), renderComponent($$result, "ShopHeader", ShopHeader, { ...shopHeader, "client:sf": "data:categories", "client:component-hydration": "sf", "client:component-path": "~/components/ShopHeader.vue", "client:component-export": "default" }, { "logo": ($$result2) => renderTemplate`${renderComponent($$result2, "Fragment", Fragment, { "slot": "logo" }, { "default": ($$result3) => renderTemplate`
5916
- ${maybeRenderHead()}<a href="/">
5917
- ${renderComponent($$result3, "LogoHeading", LogoHeading, {}, { "default": ($$result4) => renderTemplate`
5918
- ${renderComponent($$result4, "Picture", $$Picture, { "src": settings.logo, "alt": settings.name, "widths": [300], "fetchpriority": "high", "loading": "eager", "class": "mx-auto max-w-[150px] hover:drop-shadow-sm" })}
5919
- ` })}
5920
- </a>
5921
- ` })}` })))}`;
4908
+ return renderTemplate`${renderSlot$1($$result, $$slots["pitch-bar"], renderTemplate(_a$1 || (_a$1 = __template$1([" ", " <script async>", "<\/script> ", ""])), pitchBar.slides.length > 1 || isPreview ? renderTemplate`${renderComponent($$result, "PitchBar", PitchBar, { ...pitchBar, "client:sf": "lazy", "client:component-hydration": "sf", "client:component-path": "~/components/PitchBar.vue", "client:component-export": "default" })}` : renderTemplate`${renderComponent($$result, "PitchBar", PitchBar, { ...pitchBar })}`, unescapeHTML(getInlineClientJS()), renderComponent($$result, "ShopHeader", ShopHeader, { ...shopHeader, "client:sf": "data:categories", "client:component-hydration": "sf", "client:component-path": "~/components/ShopHeader.vue", "client:component-export": "default" }, { "logo": ($$result2) => renderTemplate`${renderComponent($$result2, "Fragment", Fragment, { "slot": "logo" }, { "default": ($$result3) => renderTemplate` ${maybeRenderHead()}<a href="/"> ${renderComponent($$result3, "LogoHeading", LogoHeading, {}, { "default": ($$result4) => renderTemplate` ${renderComponent($$result4, "Picture", $$Picture, { "src": settings.logo, "alt": settings.name, "widths": [300], "fetchpriority": "high", "loading": "eager", "class": "mx-auto max-w-[150px] hover:drop-shadow-sm" })} ` })} </a> ` })}` })))}`;
5922
4909
  }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/layouts/PageHeader.astro", void 0);
5923
4910
 
5924
4911
  var __freeze = Object.freeze;
@@ -5930,27 +4917,10 @@ const $$Fallback = createComponent(async ($$result, $$props, $$slots) => {
5930
4917
  const Astro2 = $$result.createAstro($$Astro$2, $$props, $$slots);
5931
4918
  Astro2.self = $$Fallback;
5932
4919
  const { statusCode } = Astro2.props;
5933
- return renderTemplate`${maybeRenderHead()}<main>
5934
- <article class="mx-auto px-8 pb-32 pt-20 prose">
5935
- <h1>${i19error} :/</h1>
5936
- <p${addAttribute(`${!statusCode || statusCode === 404 ? "hidden " : ""}text-xl`, "class")} id="errorMsg">
5937
- ${i19errorMsg}
5938
- </p>
5939
- <p${addAttribute(`${statusCode !== 404 ? "hidden " : ""}text-xl`, "class")} id="404Msg">
5940
- ${i19notFound} (404)
5941
- </p>
5942
- ${!statusCode && renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": ($$result2) => renderTemplate`
5943
- <p class="text-xl" id="loadingMsg">
5944
- ... ... ...
5945
- </p>
5946
- ` })}`}
5947
- <a href="/" class="text-2xl">
5948
- <i class="mr-1 rotate-180 i-arrow-right"></i>
5949
- ${i19home}
5950
- </a>
5951
- </article>
5952
- ${!statusCode && renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": ($$result2) => renderTemplate(_a || (_a = __template(["\n <script>\n const msgId = window.location.search.includes('status=404')\n ? '404Msg' : '5xxMsg';\n document.getElementById(msgId)!.style.display = 'block';\n document.getElementById('loadingMsg')!.style.display = 'none';\n <\/script>\n "]))) })}`}
5953
- </main>`;
4920
+ return renderTemplate`${maybeRenderHead()}<main> <article class="mx-auto px-8 pb-32 pt-20 prose"> <h1>${i19error} :/</h1> <p${addAttribute(`${!statusCode || statusCode === 404 ? "hidden " : ""}text-xl`, "class")} id="errorMsg"> ${i19errorMsg} </p> <p${addAttribute(`${statusCode !== 404 ? "hidden " : ""}text-xl`, "class")} id="404Msg"> ${i19notFound} (404)
4921
+ </p> ${!statusCode && renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": ($$result2) => renderTemplate` <p class="text-xl" id="loadingMsg">
4922
+ ... ... ...
4923
+ </p> ` })}`} <a href="/" class="text-2xl"> <i class="mr-1 rotate-180 i-arrow-right"></i> ${i19home} </a> </article> ${!statusCode && renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": ($$result2) => renderTemplate(_a || (_a = __template([" <script>\n const msgId = window.location.search.includes('status=404')\n ? '404Msg' : '5xxMsg';\n document.getElementById(msgId)!.style.display = 'block';\n document.getElementById('loadingMsg')!.style.display = 'none';\n <\/script> "]))) })}`} </main>`;
5954
4924
  }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/main/Fallback.astro", void 0);
5955
4925
 
5956
4926
  const _sfc_main$2 = /* @__PURE__ */ defineComponent({
@@ -6291,13 +5261,7 @@ const $$PageFooter = createComponent(async ($$result, $$props, $$slots) => {
6291
5261
  }
6292
5262
  }
6293
5263
  }
6294
- return renderTemplate`${renderComponent($$result, "ShopFooter", ShopFooter, { "stamps": stamps, "categories": mainCategories, "categoriesColTitle": categoriesList?.title, "pageLinks": pageLinks, "pagesColTitle": pagesList?.title }, { "logo": ($$result2) => renderTemplate`${renderComponent($$result2, "Fragment", Fragment, { "slot": "logo" }, { "default": ($$result3) => renderTemplate`
6295
- ${maybeRenderHead()}<a href="/">
6296
- ${renderComponent($$result3, "LogoHeading", LogoHeading, {}, { "default": ($$result4) => renderTemplate`
6297
- ${renderComponent($$result4, "Picture", $$Picture, { "src": settings.logo, "alt": settings.name, "widths": [300], "loading": "lazy", "class": "max-w-[150px]" })}
6298
- ` })}
6299
- </a>
6300
- ` })}` })}`;
5264
+ return renderTemplate`${renderComponent($$result, "ShopFooter", ShopFooter, { "stamps": stamps, "categories": mainCategories, "categoriesColTitle": categoriesList?.title, "pageLinks": pageLinks, "pagesColTitle": pagesList?.title }, { "logo": ($$result2) => renderTemplate`${renderComponent($$result2, "Fragment", Fragment, { "slot": "logo" }, { "default": ($$result3) => renderTemplate` ${maybeRenderHead()}<a href="/"> ${renderComponent($$result3, "LogoHeading", LogoHeading, {}, { "default": ($$result4) => renderTemplate` ${renderComponent($$result4, "Picture", $$Picture, { "src": settings.logo, "alt": settings.name, "widths": [300], "loading": "lazy", "class": "max-w-[150px]" })} ` })} </a> ` })}` })}`;
6301
5265
  }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/layouts/PageFooter.astro", void 0);
6302
5266
 
6303
5267
  const $$Astro = createAstro("https://demo.ecomplus.app");
@@ -6311,17 +5275,7 @@ const $$404 = createComponent(async ($$result, $$props, $$slots) => {
6311
5275
  return err.astroResponse;
6312
5276
  }
6313
5277
  const { settings } = routeContext;
6314
- return renderTemplate`<html${addAttribute(routeContext?.lang.replace("_", "-"), "lang")}>
6315
- ${renderComponent($$result, "Base", $$Base, {}, { "base-head": ($$result2) => renderTemplate`${renderComponent($$result2, "Fragment", Fragment, { "slot": "base-head" }, { "default": ($$result3) => renderTemplate`
6316
- ${renderComponent($$result3, "BaseHead", $$BaseHead, {})}
6317
- <title>${`${i19notFound} | ${settings.name}`}</title>
6318
- ` })}`, "default": ($$result2) => renderTemplate`
6319
-
6320
- ${renderComponent($$result2, "PageHeader", $$PageHeader, {})}
6321
- ${renderComponent($$result2, "FallbackMain", $$Fallback, { "statusCode": 404 })}
6322
- ${renderComponent($$result2, "PageFooter", $$PageFooter, {})}
6323
- ` })}
6324
- </html>`;
5278
+ return renderTemplate`<html${addAttribute(routeContext?.lang.replace("_", "-"), "lang")}> ${renderComponent($$result, "Base", $$Base, {}, { "base-head": ($$result2) => renderTemplate`${renderComponent($$result2, "Fragment", Fragment, { "slot": "base-head" }, { "default": ($$result3) => renderTemplate`${renderComponent($$result3, "BaseHead", $$BaseHead, {})}<title>${`${i19notFound} | ${settings.name}`}</title>` })}`, "default": ($$result2) => renderTemplate`${renderComponent($$result2, "PageHeader", $$PageHeader, {})}${renderComponent($$result2, "FallbackMain", $$Fallback, { "statusCode": 404 })}${renderComponent($$result2, "PageFooter", $$PageFooter, {})}` })}</html>`;
6325
5279
  }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/404.astro", void 0);
6326
5280
 
6327
5281
  const $$file = "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/404.astro";
@@ -6334,4 +5288,4 @@ const _404 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
6334
5288
  url: $$url
6335
5289
  }, Symbol.toStringTag, { value: 'Module' }));
6336
5290
 
6337
- export { $$Picture as $, fetchModule as A, i19workingDays as B, i19days as C, i19untilTomorrow as D, i19pickUpToday as E, i19receiveToday as F, i19free as G, i19freeShipping as H, Drawer as I, getConfig as J, loadRouteContext as K, $$Base as L, $$BaseHead as M, $$PageHeader as N, $$PageFooter as O, i19myAccount as P, FooterStamps as Q, i19shoppingCart as R, imageConfig as S, assetsDir as T, outDir as U, i19error as V, $$Fallback as W, mod as X, createApp as Y, onRequest as Z, _export_sfc as _, useSectionPreview as a, clearAccents as a0, getSearchUrl as a1, parseProduct as a2, removeCartItem as a3, freeShippingFromValue as a4, shoppingCart as a5, totalItems as a6, _404 as a7, useStorage as b, i19brands as c, i19categories as d, i19upTo as e, i19aboveOf as f, i19relevance as g, i19sales as h, i19relatedProducts as i, i19lowestPrice as j, i19highestPrice as k, i19discount as l, i19releases as m, i19name as n, isScreenLg as o, parseShippingPhrase as p, slugify as q, availableExtraDiscount as r, scrollToEl as s, installmentsOption as t, useSharedData as u, discountOption as v, loyaltyPointsPrograms as w, addProductToCart as x, isMobile as y, useId as z };
5291
+ export { $$Picture as $, fetchModule as A, i19workingDays as B, i19days as C, i19untilTomorrow as D, i19pickUpToday as E, i19receiveToday as F, i19free as G, i19freeShipping as H, Drawer as I, getConfig as J, loadRouteContext as K, $$Base as L, $$BaseHead as M, $$PageHeader as N, $$PageFooter as O, i19myAccount as P, FooterStamps as Q, i19shoppingCart as R, i19error as S, $$Fallback as T, mod as U, createApp as V, onRequest as W, clearAccents as X, getSearchUrl as Y, parseProduct as Z, _export_sfc as _, useSectionPreview as a, removeCartItem as a0, freeShippingFromValue as a1, shoppingCart as a2, totalItems as a3, _404 as a4, useStorage as b, i19brands as c, i19categories as d, i19upTo as e, i19aboveOf as f, i19relevance as g, i19sales as h, i19relatedProducts as i, i19lowestPrice as j, i19highestPrice as k, i19discount as l, i19releases as m, i19name as n, isScreenLg as o, parseShippingPhrase as p, slugify as q, availableExtraDiscount as r, scrollToEl as s, installmentsOption as t, useSharedData as u, discountOption as v, loyaltyPointsPrograms as w, addProductToCart as x, isMobile as y, useId as z };