@soma-vertical-web/multi-lib 1.0.40 → 1.0.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index2.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("react/jsx-runtime"),_=require("./index-HEA7MkPc.js"),z=require("@soma-vertical-web/core-components"),mt=require("yup"),gt=require("sanitize-html"),bt=require("jose");function wt(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const l=wt(mt),vt=async({children:e,ClientCartProvider:t,...r})=>{const{data:n}=await _.fetchContentType("mini_cart",r);return S.jsx(t,{...n?Array.isArray(n)?{data:n[0]}:{data:n}:{},children:e})},yt=({slug:e,data:t,SectionZone:r,COMMON_PAGE_COLUMN_GAP:n,identifyWhoIsFirst:o})=>{const a=t==null?void 0:t.find(d=>{var w,v,y,P;return((v=(w=d.config)==null?void 0:w.responsive)==null?void 0:v.deviceType)==="desktop"&&((P=(y=d.config)==null?void 0:y.seo)==null?void 0:P.slug)===e}),c=a==null?void 0:a.config.responsive.gapCustom,i=a==null?void 0:a.config.responsive.gapSections,u=t==null?void 0:t.find(d=>{var w,v,y,P;return((v=(w=d.config)==null?void 0:w.responsive)==null?void 0:v.deviceType)==="mobile"&&((P=(y=d.config)==null?void 0:y.seo)==null?void 0:P.slug)===e}),g=u==null?void 0:u.config.responsive.gapCustom,s=u==null?void 0:u.config.responsive.gapSections;return S.jsxs(S.Fragment,{children:[S.jsx(z.Utils.Column,{gap:c&&i?i:n,className:z.helpers.classNameConcat(_.responsive["responsive-desktop-flex"],"utils-column-modifier"),children:S.jsx(r,{data:(a==null?void 0:a.sections)??[],identifyWhoIsFirst:o})}),S.jsx(z.Utils.Column,{gap:g&&s?s:n,className:z.helpers.classNameConcat(_.responsive["responsive-mobile-flex"],"utils-column-modifier"),children:S.jsx(r,{data:(u==null?void 0:u.sections)??[],identifyWhoIsFirst:o})})]})},_t=async({slug:e,SectionZone:t,COMMON_PAGE_COLUMN_GAP:r,identifyWhoIsFirst:n=!1,...o})=>{const{data:a}=await _.fetchContentType("common_page",o);return!a||!Array.isArray(a)||a.length===0?null:S.jsx(yt,{data:a,slug:e,SectionZone:t,COMMON_PAGE_COLUMN_GAP:r,identifyWhoIsFirst:n})},xt=async({children:e,ClientFlagsAndTagsProvider:t,...r})=>{const{data:n}=await _.fetchContentType("flags_and_tags",r);return!n||!Array.isArray(n)?null:S.jsx(t,{data:n[0],children:e})},Pt=async({className:e,PAYMENT_FLAGS_DICTIONARY:t,PAYMENT_FLAGS:r,LEGAL_INFORMATION_TEXT:n,ICONS:o,SectionZone:a,Footer:c,FooterSupport:i,hasFooterStamps:u,...g})=>{var v,y,P,p,b,f,h,m,T,A,x;const{data:s}=await _.fetchContentType("footer",g),d=Array.isArray(s)&&((v=s[0])==null?void 0:v.type)==="footer"?s[0]:null,w={...(y=d==null?void 0:d.paymentInfo)==null?void 0:y.paymentInfo,acceptedFlags:Array.isArray((P=d==null?void 0:d.paymentInfo)==null?void 0:P.paymentInfo.acceptedFlags)?(p=d==null?void 0:d.paymentInfo)==null?void 0:p.paymentInfo.acceptedFlags.filter(R=>!!t[R]).map(R=>t[R]):[]};return d?S.jsx(c,{className:e,data:{...d},socialInfo:(b=d.socialMedia)==null?void 0:b.socialMedia,socialMedias:(h=(f=d.socialMedia)==null?void 0:f.socialMedia)==null?void 0:h.medias,payments:w,hasFooterStamps:u,adornment:{...(T=(m=d.supportInfo)==null?void 0:m.supportInfo)!=null&&T.content?{bottom:S.jsx(i,{content:(x=(A=d.supportInfo)==null?void 0:A.supportInfo)==null?void 0:x.content,CONSTANTS:{ICONS:o,PAYMENT_FLAGS:r,PAYMENT_FLAGS_DICTIONARY:t}})}:{},...d.sections.length?{top:S.jsx(a,{data:d.sections})}:{}},LEGAL_INFORMATION_TEXT:n,ICONS:o}):null},Rt=async({children:e,ClientHeaderProvider:t,...r})=>{var a,c,i,u,g,s;const{data:n}=await _.fetchContentType("header",r),o=Array.isArray(n)?n[0]:void 0;return S.jsx(t,{headerData:{...((a=o==null?void 0:o.layerConfig)==null?void 0:a.config)??{},subMenus:((c=o==null?void 0:o.sections)==null?void 0:c.map(d=>d.data))??[],categories:((u=(i=o==null?void 0:o.categories)==null?void 0:i.categories)==null?void 0:u.items)??[],navigationLinks:((s=(g=o==null?void 0:o.navigationLinks)==null?void 0:g.navigationLinks)==null?void 0:s.items)??[]},children:e})},It=e=>{var c,i;const t=(i=(c=e[0])==null?void 0:c.items)==null?void 0:i.items;if((t==null?void 0:t.items.length)===0||e.length===0)return{iconLabel:"",label:"",content:[]};const r=t==null?void 0:t.iconLabel,n=t==null?void 0:t.label,o=t==null?void 0:t.helpButtonSize,a=t.items.map((u,g)=>({type:u.type,id:`${g.toString()}-${u.title.toLowerCase()}`,title:u.title,subtitle:u.subtitle,description:u.description,buttonLabel:u.buttonLabel,buttonHref:u.buttonHref,buttonMode:u.buttonMode,buttonSize:u.buttonSize,buttonIcon:u.buttonIcon}));return{iconLabel:r,label:n,helpButtonSize:o,content:a}},Ct=async({HelpButton:e,ICONS:t,className:r,...n})=>{const{data:o}=await _.fetchContentType("helpbutton",n);if(!o||!Array.isArray(o)||o.length===0)return null;const a=It(o);return S.jsx(e,{data:a,ICONS:t,className:r})},St=async({SectionZone:e,LPCadastro:t,...r})=>{var u;const{data:n}=await _.fetchContentType("lp_cadastro",r);if(!n||!Array.isArray(n)||n.length===0)return null;const[o]=n,a=(o==null?void 0:o.sections)||[],c=((u=o==null?void 0:o.content)==null?void 0:u.conteúdo)||{},i=o==null?void 0:o.sections;return S.jsxs(S.Fragment,{children:[S.jsx(t,{sections:a,content:c}),S.jsx(e,{data:i})]})},kt=async({LPLOJAS_TEMPLATE_RETURN_BUTTON:e,ICONS:t,entity:r,showVendor:n,LPStoresClientWrapper:o,...a})=>{var g;const{data:c}=await _.fetchContentType("lp_lojas",a),u=(g=(Array.isArray(c)?c:[])[0])==null?void 0:g.config.config;return S.jsx(o,{entity:r,content:u,data:c,showVendor:n,ICONS:t,LPLOJAS_TEMPLATE_RETURN_BUTTON:e})},Tt=async({ERROR_TEMPLATE_RETURN_BUTTON:e,ErrorTemplate:t,...r})=>{var a;const{data:n}=await _.fetchContentType("notfound_page",r),o=Array.isArray(n)?(a=n[0])==null?void 0:a.config.config:null;return n&&o?S.jsx(t,{data:o,ERROR_TEMPLATE_RETURN_BUTTON:e}):S.jsx(S.Fragment,{})},Ot=async({children:e,productId:t,COMMON_PAGE_COLUMN_GAP:r,SectionZone:n,PDPContentProvider:o,...a})=>{const{data:c}=await _.fetchContentType("product_page",a);return!c||!Array.isArray(c)||c.length===0?null:S.jsx(o,{data:c[0],productId:t,COMMON_PAGE_COLUMN_GAP:r,SectionZone:n,children:e})},Et={"column-modifier":"_column-modifier_1tqap_1"},jt=async({className:e,children:t,slug:r,SectionZone:n,COMMON_PAGE_COLUMN_GAP_PDC:o,PLPContentProvider:a,...c})=>{const{data:i}=await _.fetchContentType("categories_page",c);if(!i||!Array.isArray(i))return null;const u=i.find(v=>{var y,P,p;return((y=v.config)==null?void 0:y.seo.slug)===r&&((p=(P=v.config)==null?void 0:P.responsive)==null?void 0:p.deviceType)==="desktop"}),g=i.find(v=>{var y,P,p;return((y=v.config)==null?void 0:y.seo.slug)===r&&((p=(P=v.config)==null?void 0:P.responsive)==null?void 0:p.deviceType)==="mobile"}),s=i.find(v=>{var y,P,p;return((y=v.config)==null?void 0:y.seo.slug)==="default"&&((p=(P=v.config)==null?void 0:P.responsive)==null?void 0:p.deviceType)==="desktop"}),d=i.find(v=>{var y,P,p;return((y=v.config)==null?void 0:y.seo.slug)==="default"&&((p=(P=v.config)==null?void 0:P.responsive)==null?void 0:p.deviceType)==="mobile"}),w=Array.isArray(e)?e:[e];return S.jsxs(S.Fragment,{children:[S.jsx(z.Utils.Column,{className:z.helpers.classNameConcat(_.responsive["responsive-desktop-flex"],[Et["column-modifier"],...w]),style:{minHeight:"100vh"},children:S.jsx(a,{data:u??s,device:"desktop",SectionZone:n,COMMON_PAGE_COLUMN_GAP_PDC:o,children:t})}),S.jsx(z.Utils.Column,{className:z.helpers.classNameConcat(_.responsive["responsive-mobile-flex"],e),children:S.jsx(a,{data:g??d,device:"mobile",SectionZone:n,COMMON_PAGE_COLUMN_GAP_PDC:o,children:t})})]})},At=async({slug:e,...t})=>{var c,i,u;const{data:r}=await _.fetchContentType("redirect_to_search",t);if(!r||!Array.isArray(r))return{slug:e,query:null,redirect:!1};const n=((u=(i=(c=r[0])==null?void 0:c.redirectToSearch)==null?void 0:i.redirectToSearch)==null?void 0:u.paths)??[];if(!!!n.length)return{slug:e,query:null,redirect:!1};const a=n.find(g=>{var s,d;return((s=g.path)==null?void 0:s.replace(/\//g,"-").toLowerCase())===e.replace(/\//g,"-").toLowerCase()||((d=g.path)==null?void 0:d.replace(/\//g,"-").toLowerCase())===`/${e}`.replace(/\//g,"-").toLowerCase()});return a?{slug:e,query:a==null?void 0:a.searchQuery,redirect:!0,collectionId:a==null?void 0:a.collectionId,filters:a==null?void 0:a.filters,sort:a==null?void 0:a.sort}:{slug:e,query:null,redirect:!1,collectionId:null,filters:null,sort:null}},qt=async({slug:e,...t})=>{var c,i,u;const{data:r}=await _.fetchContentType("redirect_to_search",t);if(!r||!Array.isArray(r))return null;const n=((u=(i=(c=r[0])==null?void 0:c.redirectToSearch)==null?void 0:i.redirectToSearch)==null?void 0:u.paths)??[];if(!!!n.length)return null;const a=n.find(g=>{var s,d;return((s=g.path)==null?void 0:s.replace(/\//g,"-").toLowerCase())===e.replace(/\//g,"-").toLowerCase()||((d=g.path)==null?void 0:d.replace(/\//g,"-").toLowerCase())===`/${e}`.replace(/\//g,"-").toLowerCase()});return a?{slug:e,title:a.pageTitle,description:a.pageDescription}:null},Nt=async({slug:e,Politicas:t,SectionZone:r,oneTrust:n,...o})=>{const{data:a}=await _.fetchContentType("policy_page",o),{data:c}=await _.fetchContentType("policy_tab",o),i=Array.isArray(a)?a:null,u=Array.isArray(c)?c:null,g=i?i[0].sections:null;return!i||!u?null:S.jsxs(S.Fragment,{children:[S.jsx(t,{slug:e,pageData:i[0],tabsData:u,oneTrust:n}),g&&S.jsx(r,{data:g})]})},Ft=async({children:e,SectionZone:t,className:r,...n})=>{const{data:o}=await _.fetchContentType("search_page",n);return Array.isArray(o)&&o.length>0?S.jsx(_.SearchPageScreening,{data:o,SectionZone:t,className:r,children:e}):S.jsx(S.Fragment,{children:"children"})},$t=async({ClientTipbarContent:e,...t})=>{const{data:r}=await _.fetchContentType("tipbar",t);return S.jsx(e,{data:r})},Lt=async({children:e,SectionZone:t,WishlistScreening:r,...n})=>{const{data:o}=await _.fetchContentType("wishlist_page",n);return S.jsx(r,{data:Array.isArray(o)?o:[],SectionZone:t,children:e})},Dt={CommonPageContent:_t,CartContent:vt,FlagsAndTagsContent:xt,HeaderContent:Rt,TipbarContent:$t,FooterContent:Pt,PLPContent:jt,PDPContent:Ot,getRedirectData:At,getPLPSynteticMetaData:qt,SearchPageContent:Ft,HelpButtonContent:Ct,LPCadastroContent:St,LPLojasContent:kt,PolicyPageContent:Nt,NotFoundContent:Tt,WishlistContent:Lt},Ut={Components:Dt},Mt=l.object({country:l.string().length(3,"Country code must be 3 characters long").required("Country is required"),postalCode:l.string().nullable()});async function Ht({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await Mt.validate(t);const{country:n,postalCode:o}=t;return await _.fetchVtex(`${e}/api/checkout/pub/postal-code/${n}/${o}`,{method:"POST",body:t,...r})}const Bt=l.object({orderFormId:l.string().nullable(),sellerCode:l.string().nullable(),sellerName:l.string().nullable()});async function Le({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await Bt.validate(t);const{orderFormId:n,sellerCode:o,sellerName:a}=t,c=o?`${o.trim()} - ${a}`:null;return _.fetchVtex(`${e}/api/checkout/pub/orderForm/${n}/attachments/openTextField`,{method:"POST",body:{value:c},...r})}const zt=l.object({orderFormId:l.string().nullable(),sellerCode:l.string().nullable(),marketingData:l.object()});async function De({apiUrl:e,body:t,extraData:r={},fetchOptions:n}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await zt.validate(t);const{orderFormId:o,sellerCode:a,marketingData:c}=t,i=a?{utmCampaign:a?a.toUpperCase():"",utmiCampaign:a?`${r.VENDOR_CODE}`:"semcodigo"}:{};return _.fetchVtex(`${e}/api/checkout/pub/orderForm/${o}/attachments/marketingData`,{method:"POST",body:{...c,...i},...n})}const Vt=l.object({orderFormId:l.string().nullable(),sellerCode:l.string().nullable(),sellerName:l.string().nullable()});async function Gt({apiUrl:e,body:t,fetchOptions:r,extraData:n}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await Vt.validate(t);const o=await Le({apiUrl:e,body:t,fetchOptions:r});return De({apiUrl:e,body:{...t,marketingData:o==null?void 0:o.marketingData},extraData:n,fetchOptions:r})}const Wt=l.object({orderFormId:l.string().nullable(),coupon:l.string().nullable()});async function Qt({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await Wt.validate(t);const{coupon:n="",orderFormId:o}=t;return _.fetchVtex(`${e}/api/checkout/pub/orderForm/${o}/coupons`,{method:"POST",body:{text:n},...r})}const Xt=l.object({appId:l.string().required("App ID is required"),orderFormId:l.string().nullable(),key:l.array().of(l.string())});async function Kt({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await Xt.validate(t);const{appId:n="faststore",orderFormId:o,key:a}=t;return _.fetchVtex(`${e}/api/checkout/pub/orderForm/${o}/customData/${n}/${a}`,{method:"PUT",...r})}const Jt=l.object().shape({name:l.string().required("Attachment name is required"),content:l.object().nullable()});var Fe;const Zt=l.object().shape({attachments:(Fe=l.array().of(Jt))==null?void 0:Fe.nullable(),id:l.string().required("ID of SKU is required"),index:l.number().integer().nullable(),quantity:l.number().integer().nullable(),seller:l.string().required("Seller is required"),price:l.number().integer()}),Yt=l.object({orderFormId:l.string().required("OrderFormId is required"),orderItems:l.array().of(Zt)});async function er({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await Yt.validate(t);const{orderFormId:n,orderItems:o}=t;return _.fetchVtex(`${e}/api/checkout/pub/orderForm/${n}/items`,{method:"POST",body:{orderItems:o},...r})}const tr=l.object({orderFormId:l.string().nullable()});async function rr({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await tr.validate(t);const{orderFormId:n}=t;return _.fetchVtex(`${e}/api/checkout/pub/orderForm/${n}/items/removeAll`,{method:"POST",...r})}const nr=l.object().shape({name:l.string().required("Attachment name is required"),content:l.object().nullable()});var $e;const or=l.object().shape({attachments:($e=l.array().of(nr))==null?void 0:$e.nullable(),id:l.string().required("ID of SKU is required"),index:l.number().integer().nullable(),quantity:l.number().integer().nullable(),seller:l.string().required("Seller is required"),price:l.number().integer()}),ir=l.object({orderFormId:l.string().nullable(),orderItems:l.array().of(or)});async function ar({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await ir.validate(t);const{orderFormId:n,orderItems:o}=t;return _.fetchVtex(`${e}/api/checkout/pub/orderForm/${n}/items/update`,{method:"POST",body:{orderItems:o},...r})}const sr=l.object({orderFormId:l.string().nullable()});async function cr({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await sr.validate(t);const{orderFormId:n}=t;return _.fetchVtex(`${e}/api/checkout/pub/orderForm/${n}/messages/clear`,{method:"POST",...r})}const lr=l.object({id:l.string().nullable(),itemIndex:l.number().nullable(),orderFormId:l.string().nullable(),remove:l.boolean().nullable()});async function ur({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await lr.validate(t);const{itemIndex:n,orderFormId:o,id:a,remove:c}=t,i=c?`/${a}/remove`:"",u=`${e}/api/checkout/pub/orderForm/${o}/items/${n}/offerings${i}`;return _.fetchVtex(u,{method:"POST",body:{id:a},...r})}const dr=l.object({orderFormId:l.string().nullable()});async function pr({apiUrl:e,body:t,fetchOptions:r,extraData:n}){var c;if(!t){console.error("[ERROR FETCHING] Body is required");return}await dr.validate(t);const o=new URLSearchParams({refreshOutdatedData:"true"}),a=t.orderFormId&&((c=n.orderFormPurchaseId)==null?void 0:c.value)!==t.orderFormId?`${e}/api/checkout/pub/orderForm/${t.orderFormId}?${String(o)}`:`${e}/api/checkout/pub/orderForm`;return _.fetchVtex(a,{method:"GET",...r})}const fr=l.object({orderFormId:l.string().nullable(),email:l.string().email().required(),firstName:l.string().required(),lastName:l.string().required(),documentType:l.string().required(),document:l.string().required(),phone:l.string().matches(/^\+\d{1,3}\d{10,11}$/)});async function hr({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await fr.validate(t);const{orderFormId:n,...o}=t;return _.fetchVtex(`${e}/api/checkout/pub/orderForm/${n}/attachments/clientProfileData`,{method:"POST",body:{...o},...r})}const mr=l.object({sellerCode:l.string().nullable()});async function gr({apiUrl:e,body:t,extraData:r,fetchOptions:n}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await mr.validate(t);const{sellerCode:o=""}=t;return _.fetchVtex(`${e}/api/dataentities/${r.ENTITIES}/search?_fields=${r.FIELDS}&${r.FILTER}=${o}`,{method:"GET",headers:{Accept:"application/vnd.vtex.ds.v10+json"},...n})}const br=l.object().shape({country:l.string().length(3,"Country code must be 3 characters long").required("Country is required"),orderFormId:l.string().nullable(),postalCode:l.string().nullable()});async function wr({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await br.validate(t);const{country:n,orderFormId:o,postalCode:a}=t,c=a?{address:{addressType:"residential",postalCode:a,country:n}}:{logisticsInfo:[],clearAddressIfPostalCodeNotFound:!0};return _.fetchVtex(`${e}/api/checkout/pub/orderForm/${o}/attachments/shippingData`,{method:"POST",body:c,...r})}const vr=l.object().shape({orderFormId:l.string().nullable(),options:l.array().of(l.object().shape({itemIndex:l.number(),selectedDeliveryChannel:l.string(),selectedSla:l.string()})),selectedAddresses:l.array().of(l.object().shape({addressId:l.string().required(),addressType:l.string().required(),city:l.string().nullable(),complement:l.string().nullable(),country:l.string().required().length(3),geoCoordinates:l.array().of(l.number()).required().min(0),isDisposable:l.boolean().required(),neighborhood:l.string().nullable(),number:l.string().nullable(),postalCode:l.string().required(),receiverName:l.string().nullable(),reference:l.string().nullable(),state:l.string().nullable(),street:l.string().nullable()}))});async function yr({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await vr.validate(t);const{orderFormId:n,options:o,selectedAddresses:a}=t;return _.fetchVtex(`${e}/api/checkout/pub/orderForm/${n}/attachments/shippingData`,{method:"POST",body:{selectedAddresses:a,clearAddressIfPostalCodeNotFound:!1,logisticsInfo:o},...r})}const _r=l.object({country:l.string().length(3,"Country code must be 3 characters long").required("Country is required"),postalCode:l.string().nullable(),geoCoordinates:l.object().shape({longitude:l.number().required(),latitude:l.number().required()})});async function xr({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await _r.validate(t);const{country:n="",geoCoordinates:o,postalCode:a=""}=t,c=new URLSearchParams({country:String(n)});return a?c.append("postalCode",a):c.append("geoCoordinates",`${o==null?void 0:o.longitude};${o==null?void 0:o.latitude}`),await _.fetchVtex(`${e}/api/checkout/pub/regions/?${c.toString()}`,{method:"GET",...r})}const Pr=l.object({id:l.string().required("ID of SKU is required"),quantity:l.number().integer().required("Quantity of item is required"),seller:l.string()}),Rr=l.object({items:l.array().of(Pr),country:l.string().length(3,"Country code must be 3 characters long").required("Country is required"),postalCode:l.string().nullable(),geoCoordinates:l.array().nullable().of(l.number()).length(2)});async function Ir({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}return await Rr.validate(t),_.fetchVtex(`${e}/api/checkout/pub/orderForms/simulation`,{method:"POST",body:t,...r})}const Cr=Object.freeze(Object.defineProperty({__proto__:null,getMasterDataSellerCode:gr,getOrderForm:pr,postOrderFormAddCoupon:Qt,postOrderFormAttachClientProfileData:hr,postOrderFormAttachOrderFormData:Gt,postOrderFormAttachShippingData:wr,postOrderFormAttachmentsMarketingData:De,postOrderFormAttachmentsOpenTextField:Le,postOrderFormClearMessages:cr,postOrderFormFreightSimulation:Ir,postOrderFormItems:er,postOrderFormRegion:xr,postOrderFormRemoveAllItems:rr,postOrderFormUpdateItems:ar,postOrderFormUpdateShippingData:yr,postOrderformAddress:Ht,putOrderFormCustomData:Kt,updateOrderFormOffering:ur},Symbol.toStringTag,{value:"Module"})),Sr=l.object({skuId:l.string()});async function kr({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await Sr.validate(t);const{skuId:n}=t;return _.fetchVtex(`${e}/api/catalog/pvt/stockkeepingunitkit?parentSkuId=${n}`,{...r})}const Tr=l.object({ids:l.array().of(l.string().required("ID are required")).required("IDs are required")});async function Or({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await Tr.validate(t);const{ids:n}=t;return _.fetchVtex(`${e}/api/catalog_system/pub/products/search?fq=${n.map(o=>`productId:${o}`).join("&fq=")}`,{...r})}const Er=l.object({productId:l.number().required("Product ID is required")});async function jr({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await Er.validate(t);const{productId:n}=t;return _.fetchVtex(`${e}/api/catalog_system/pub/products/crossselling/similars/${n.toString()}`,{...r})}async function Ar({apiUrl:e,params:t,fetchOptions:r}){return t!=null&&t.slug?_.fetchVtex(`${e}/api/catalog_system/pub/portal/pagetype/${t.slug}`,{...r}):(console.error("[ERROR FETCHING] slug is required"),null)}const qr=Object.freeze(Object.defineProperty({__proto__:null,getCatalogKitProducts:kr,getCatalogPageInfo:Ar,getCatalogProducts:Or,getCatalogSimilars:jr},Symbol.toStringTag,{value:"Module"})),Nr=l.object({query:l.string()});async function Fr({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await Nr.validate(t);const{query:n=""}=t,o=new URLSearchParams({query:n});return _.fetchVtex(`${e}/api/io/_v/api/intelligent-search/autocomplete_suggestions?${o.toString()}`,{...r})}const $r=(e,t)=>gt(e,t),Lr=e=>({...e,description:e.description?$r(e.description):e.description}),Dr=({offer:e,seller:t,product:r})=>({...e,product:r,seller:t}),Ue=(e,t)=>({...e,isVariantOf:Lr(t)}),Ur=e=>e?"https://schema.org/InStock":"https://schema.org/OutOfStock",oe=e=>e.AvailableQuantity>0,Ae=e=>e.spotPrice??0,Mr=e=>e.Price??0,Me=(e,t)=>oe(e)&&!oe(t)?-1:!oe(e)&&oe(t)?1:Ae(e)-Ae(t),Hr=(e,t)=>{let r=0;for(let n=1;n<e.length;n++)t(e[r],e[n])>0&&(r=n);return e[r]},He=e=>{const t=e.flatMap(n=>n.sellers.map(o=>({offer:o.commertialOffer,sku:n}))),r=Hr(t,({offer:n},{offer:o})=>Me(n,o));return r?r.sku:e[0]},Be=e=>e.map(({imageUrl:t,imageText:r,imageLabel:n})=>({alternateName:r??"",url:t.replace("vteximg.com.br","vtexassets.com"),keywords:n})),ie={attachment:"ATTACHMENT",specification:"SPECIFICATION",attribute:"ATTRIBUTE"},Br=e=>({name:e.name,value:e.content,valueReference:ie.attachment}),zr=e=>({propertyID:e.id,name:e.name,value:e.value,valueReference:{valueReference:ie.attribute,visible:e.visible}}),ae=(e,t,r)=>{const n=e.flatMap(({name:c,values:i})=>i?i.map(u=>({name:c,value:u,valueReference:ie.specification})):{name:c,value:"",valueReference:ie.specification}),o=Array.isArray(r)?r.map(Br):[],a=t?t.map(zr):[];return[...n,...o,...a]},qe="ÁÄÂÀÃÅČÇĆĎÉĚËÈÊẼĔȆÍÌÎÏŇÑÓÖÒÔÕØŘŔŠŤÚŮÜÙÛÝŸŽáäâàãåčçćďéěëèêẽĕȇíìîïňñóöòôõøðřŕšťúůüùûýÿžþÞĐđ߯a",Vr="AAAAAACCCDEEEEEEEEIIIINNOOOOOORRSTUUUUUYYZaaaaaacccdeeeeeeeeiiiinnooooooorrstuuuuuyyzbBDdBAa",Gr=e=>{let t=e.slice(0);for(let r=0;r<qe.length;r++)t=t.replace(new RegExp(qe.charAt(r),"g"),Vr.charAt(r));return t},Wr=e=>e.replace(/[·/_,:]/,"-"),ze=e=>{const r=e.replace(/,/g,"").replace(/[*+~.()'"!:@&\[\]`/ %$#?{}|><=_^]/g,"-");return Wr(Gr(r)).toLowerCase()},Ve=e=>`/${e}/p`,Ge=e=>{const t=Math.max(...e.map(n=>n.NumberOfInstallments)),r=e.find(n=>n.NumberOfInstallments===t);return{count:(r==null?void 0:r.NumberOfInstallments)??0,value:(r==null?void 0:r.Value)??0}},We=(e,t)=>{const r={price:0,listPrice:0,sellerDefault:!1},o=e.map(a=>Dr({offer:a.commertialOffer,seller:a,product:t})).sort(Me).map(a=>(a.seller.sellerId==="1"&&a.AvailableQuantity>0&&(r.price=a.Price,r.listPrice=a.ListPrice,r.sellerDefault=!0),{availability:a.AvailableQuantity>0,listPrice:a.ListPrice,price:Mr(a),priceValidUntil:a.PriceValidUntil,priceCurrency:"BRL",installments:a.Installments,lowPrice:a.spotPrice,quantity:a.AvailableQuantity,seller:{identifier:a.seller.sellerId}}));return{lowPrice:r.sellerDefault?r.price:o[0].price,highPrice:r.sellerDefault?r.listPrice:o[0].listPrice,offers:o}},Qe=e=>{const{attributes:t,itemId:r,name:n,sellers:o,variations:a}=e;return{additionalProperty:ae(a,t,[]),name:n,offers:{offers:o==null?void 0:o.map(({sellerId:c,commertialOffer:i})=>({availability:Ur(i.AvailableQuantity>0),listPrice:i.ListPrice,price:i.Price,quantity:i.AvailableQuantity,seller:{identifier:c}}))},sku:r}},Qr=e=>{var R;const{attributes:t,referenceId:r,isVariantOf:n,images:o,itemId:a,name:c,sellers:i,videos:u,variations:g}=e,{brand:s,categories:d,categoriesIds:w,description:v,linkText:y,productClusters:P,clusterHighlights:p,productName:b,properties:f,productId:h,productReference:m}=n,T=d.slice().reverse(),A=We(i,e.isVariantOf),x=Ge(A.offers[0].installments);return{sku:a,gtin:((R=r==null?void 0:r[0])==null?void 0:R.Value)??m??"",name:b??c,description:v,releaseDate:n.releaseDate??"",slug:y,video:u[0],categories:d,categoriesIds:w,id:h,brand:{name:s,brandName:s},seo:{description:v,title:b,canonical:Ve(y)},cluster:{generals:P,highlights:p},properties:f,availability:{status:A.offers[0].availability},breadcrumbList:{itemListElement:[...T.map((O,N)=>{const F=O.split("/"),L=F[F.length-2],D=F.map(ze).join("/");return{name:L,item:D,position:N+1}}),{name:n.productName,item:y,position:d.length+1}],numberOfItems:d.length},image:Be(o),offers:A,additionalProperty:ae(g,t,[]),isVariantOf:{productGroupID:n.productId,hasVariant:n.items.map(O=>Qe(O))},installments:x}},Xr=e=>{var x;const{attributes:t,referenceId:r,isVariantOf:n,images:o,itemId:a,name:c,sellers:i,Videos:u,variations:g}=e,{brand:s,categories:d,categoriesIds:w,description:v,linkText:y,productClusters:P,productName:p,Coleção:b,"ID Coleção":f,productId:h}=n,m=d.slice().reverse(),T=We(i,e.isVariantOf),A=Ge(T.offers[0].installments);return{sku:a,gtin:((x=r[0])==null?void 0:x.Value)??"",name:p??c,description:v,releaseDate:n.releaseDate??"",slug:y,video:u[0],categories:d,categoriesIds:w,collection:b,collectionId:f,id:h,brand:{name:s,brandName:s},seo:{description:v,title:p,canonical:Ve(y)},cluster:{generals:P,highlights:[]},availability:{status:T.offers[0].availability},breadcrumbList:{itemListElement:[...m.map((R,O)=>{const N=R.split("/"),F=N[N.length-2],L=N.map(ze).join("/");return{name:F,item:L,position:O+1}}),{name:n.productName,item:y,position:d.length+1}],numberOfItems:d.length},image:Be(o),offers:T,additionalProperty:ae(g,t,[]),isVariantOf:{productGroupID:n.productId,hasVariant:n.items.map(R=>{const{variations:O}=R,N=O.map(F=>({name:F,values:R[F]}));return{...Qe(R),additionalProperty:ae(N,t,[])}})},installments:A}},Kr=l.array().of(l.object({key:l.string().required(),value:l.string().required()})).required("Facets are required");async function Jr({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await Kr.validate(t);const n=new URLSearchParams({}),o=t.map(({key:c,value:i})=>`${c}/${i}`).join("/");_.addSearchParamsFacets(t,n);const a=`${e}/api/catalog_system/pub/products/crossselling/${o}`;return _.fetchVtex(a,{cache:"no-store",...r}).then(c=>c.map(u=>{const g=He(u.items);return g&&Ue(g,u)}).filter(u=>!!u).map(u=>({node:Xr(u)})))}const Xe=({apiUrl:e,body:t,fetchOptions:r,extraData:n})=>{if(!t){console.error("[ERROR FETCHING] Body is required");return}const{query:o="",page:a=1,count:c,sort:i="",facets:u=[],type:g,hideUnavailableItems:s=!0,locale:d=""}=t,w=new URLSearchParams({page:a.toString(),count:(c==null?void 0:c.toString())??(n==null?void 0:n.ITEMS_PER_PAGE)??24,query:o,sort:i,locale:d});s!==void 0&&w.append("hideUnavailableItems",s.toString());const v=u.map(y=>`${y.key}/${y.value}`).join("/")??"";return _.fetchVtexWithAbortController(`${e}/api/io/_v/api/intelligent-search/${g}/${v}?${w.toString()}`,{headers:{Accept:"application/json","content-type":"application/json"},...r})};async function Zr({body:e,extraData:t,...r}){if(!e){console.error("[ERROR FETCHING] Body is required");return}const n=await Xe({body:{...e,type:"product_search"},extraData:t,...r}),o=(n==null?void 0:n.products.map(i=>{const u=He(i.items);return u&&Ue(u,i)}).filter(i=>!!i))??[],{pagination:a,recordsFiltered:c}=n;return{data:{pagination:{nextPage:a.after.length>0,previousPage:a.before.length>0,startCursor:"0",endCursor:c.toString(),count:c,total:a.count},products:o.map((i,u)=>({node:Qr(i),cursor:u.toString()}))}}}async function Yr({body:e,extraData:t,...r}){if(!e){console.error("[ERROR FETCHING] Body is required");return}const n=await Xe({body:{...e,type:"facets"},extraData:t,...r});return!n||!n.facets?(console.error("[ERROR FETCHING] No facets found"),{data:{facets:[]}}):{data:{...n,facets:_.formattedFacets(n,e==null?void 0:e.selectedFacets,(e==null?void 0:e.query)??"")}}}const en=l.object({query:l.string().optional(),locale:l.string().optional()});async function tn({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await en.validate(t);const{query:n="",locale:o="default_locale"}=t,a=new URLSearchParams({query:n,locale:o});return _.fetchVtex(`${e}/api/io/_v/api/intelligent-search/search_suggestions?${a.toString()}`,{...r})}async function rn({apiUrl:e}){return _.fetchVtex(`${e}/api/io/_v/api/intelligent-search/top_searches`)}const nn=Object.freeze(Object.defineProperty({__proto__:null,getSearchAutoCompleteSuggestions:Fr,getSearchCrossellingProducts:Jr,getSearchFacets:Yr,getSearchProducts:Zr,getSearchSuggestedTerms:tn,getSearchTopSearchs:rn},Symbol.toStringTag,{value:"Module"})),on=l.object({masterDataEntity:l.string().nonNullable(),payload:l.object().shape({}).nullable()});async function an({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await on.validate(t);const{masterDataEntity:n,payload:o}=t,a=`${e}/api/dataentities/${n}/documents`;return _.fetchVtex(a,{method:"POST",body:{payload:o},...r})}const sn=l.object().shape({_where:l.string().optional(),_fields:l.string().optional(),_sort:l.string().optional(),_from:l.number().integer().min(0).optional(),_to:l.number().integer().min(0).optional(),_keyword:l.string().optional()}),cn=l.object({masterDataEntity:l.string().required(),searchFields:sn,headers:l.object().shape({"REST-Range":l.string().notRequired()})});async function Ke({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}const n=new URLSearchParams;await cn.validate(t);const{masterDataEntity:o,searchFields:a,headers:c}=t;a&&Object.entries(a).forEach(([g,s])=>{n.append(g,String(s))}),"_fields"in a||n==null||n.append("_fields","_all");let i=[],u=null;do{u&&n.set("_scroll",u);const g=await fetch(`${e}/api/dataentities/${o}/search?${n.toString()}`,{method:"GET",headers:{"REST-Range":(c==null?void 0:c["REST-Range"])??"resources=0-100",...r==null?void 0:r.headers},cache:"no-store"});if(!g.ok)throw new Error(`[MasterData] ${g.status} - ${g.statusText}`);const s=await g.json();i.push(...s),u=g.headers.get("x-vtex-md-scroll")}while(u);return i}const ln=l.object({dataEntityName:l.string().required(),id:l.string().required(),fieldsToBeUpdated:l.object().shape({})});async function un({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await ln.validate(t);const{dataEntityName:n,id:o,fieldsToBeUpdated:a}=t,c=`${e}/api/dataentities/${n}/documents/${o}`;return _.fetchVtex(c,{body:{fieldsToBeUpdated:a},method:"PATCH",...r})}const dn=Object.freeze(Object.defineProperty({__proto__:null,getSearchMasterdata:Ke,patchUpdateMasterdata:un,postMasterdata:an},Symbol.toStringTag,{value:"Module"}));async function pn({body:e,apiUrl:t,extraData:r,fetchOptions:n}){const{productIds:o}=e;if(!o)return console.error("[ERROR FETCHING] productIds is required"),[];const{NAME_SPLIT_SYMBOL:a}=r;if(!a)return console.error("[ERROR FETCHING] NAME_SPLIT_SYMBOL is required"),[];const c=o.map(s=>typeof s=="string"||typeof s=="number"?`productId:${s}`:"").join("&fq="),i=await _.fetchVtex(`${t}/api/catalog_system/pub/products/search?fq=${c}`,{...n}),u=s=>Object.keys(s).map(d=>({id:d,name:s[d]}));return i.map((s,d)=>{var h;const{installments:w,price:v,listPrice:y,sizes:P,allSizesAvailable:p}=_.getSkuInfos({items:s.items,NAME_SPLIT_SYMBOL:a}),b=p?!0:P.some(m=>m.available),f=s.items[0].sellers[0].commertialOffer;return{node:{sku:s.items[0].itemId,gtin:s.productReference,name:s.productName,description:s.description,releaseDate:s.releaseDate,slug:s.linkText,categories:s.categories,categoriesIds:s.categoriesIds,id:s.items[0].itemId,brand:{name:s.brand,brandName:s.brand},seo:{description:s.description,title:s.productName,canonical:`/${s.linkText}/p`},cluster:{generals:u(s.productClusters),highlights:u(s.clusterHighlights)},availability:{status:b},image:s.items[0].images.map(({imageLabel:m,imageUrl:T})=>({alternateName:m,url:T,keywords:m})),offers:{lowPrice:v,highPrice:y,offers:[{availability:b,listPrice:y,price:v,priceValidUntil:f.PriceValidUntil,priceCurrency:"BRL",installments:f.Installments,lowPrice:v,quantity:f.AvailableQuantity,seller:{identifier:s.items[0].sellers[0].sellerId}}]},additionalProperty:(h=s==null?void 0:s.skuSpecifications)==null?void 0:h.map(m=>({name:s==null?void 0:s.skuSpecifications[0].field.name,value:m,valueReference:"SPECIFICATION"})),isVariantOf:{productGroupID:s.productId,hasVariant:s.items.map(m=>{var T;return{additionalProperty:m==null?void 0:m.variations.map(()=>{var A,x,R;return{name:(A=m==null?void 0:m.variations)==null?void 0:A[0],value:(R=m==null?void 0:m[(x=m==null?void 0:m.variations)==null?void 0:x[0]])==null?void 0:R[0],valueReference:"SPECIFICATION"}}),name:m.name,offers:{offers:(T=m.sellers)==null?void 0:T.map(({commertialOffer:A,sellerId:x})=>({availability:"https://schema.org/InStock",listPrice:A.ListPrice,price:A.Price,quantity:A.AvailableQuantity,seller:{identifier:x}}))},sku:m.itemId,slug:`-${m.itemId}`}})},installments:w},cursor:d.toString()}})}const fn=Object.freeze(Object.defineProperty({__proto__:null,getWishlistProducts:pn},Symbol.toStringTag,{value:"Module"}));var ge={exports:{}},Je={},we={},Ze={},Ye={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"addPathSuffix",{enumerable:!0,get:function(){return r}});const t=_.parsePath;function r(n,o){if(!n.startsWith("/")||!o)return n;const{pathname:a,query:c,hash:i}=(0,t.parsePath)(n);return""+a+o+c+i}})(Ye);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"formatNextPathnameInfo",{enumerable:!0,get:function(){return a}});const t=_.removeTrailingSlash,r=_.addPathPrefix,n=Ye,o=_.addLocale;function a(c){let i=(0,o.addLocale)(c.pathname,c.locale,c.buildId?void 0:c.defaultLocale,c.ignorePrefix);return(c.buildId||!c.trailingSlash)&&(i=(0,t.removeTrailingSlash)(i)),c.buildId&&(i=(0,n.addPathSuffix)((0,r.addPathPrefix)(i,"/_next/data/"+c.buildId),c.pathname==="/"?"index.json":".json")),i=(0,r.addPathPrefix)(i,c.basePath),!c.buildId&&c.trailingSlash?i.endsWith("/")?i:(0,n.addPathSuffix)(i,"/"):(0,t.removeTrailingSlash)(i)}})(Ze);var et={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"getHostname",{enumerable:!0,get:function(){return t}});function t(r,n){let o;if(n!=null&&n.host&&!Array.isArray(n.host))o=n.host.toString().split(":",1)[0];else if(r.hostname)o=r.hostname;else return;return o.toLowerCase()}})(et);var tt={},rt={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"removePathPrefix",{enumerable:!0,get:function(){return r}});const t=_.pathHasPrefix;function r(n,o){if(!(0,t.pathHasPrefix)(n,o))return n;const a=n.slice(o.length);return a.startsWith("/")?a:"/"+a}})(rt);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"getNextPathnameInfo",{enumerable:!0,get:function(){return o}});const t=_.normalizeLocalePath,r=rt,n=_.pathHasPrefix;function o(a,c){var i;const{basePath:u,i18n:g,trailingSlash:s}=(i=c.nextConfig)!=null?i:{},d={pathname:a,trailingSlash:a!=="/"?a.endsWith("/"):s};u&&(0,n.pathHasPrefix)(d.pathname,u)&&(d.pathname=(0,r.removePathPrefix)(d.pathname,u),d.basePath=u);let w=d.pathname;if(d.pathname.startsWith("/_next/data/")&&d.pathname.endsWith(".json")){const y=d.pathname.replace(/^\/_next\/data\//,"").replace(/\.json$/,"").split("/"),P=y[0];d.buildId=P,w=y[1]!=="index"?"/"+y.slice(1).join("/"):"/",c.parseData===!0&&(d.pathname=w)}if(g){let y=c.i18nProvider?c.i18nProvider.analyze(d.pathname):(0,t.normalizeLocalePath)(d.pathname,g.locales);d.locale=y.detectedLocale;var v;d.pathname=(v=y.pathname)!=null?v:d.pathname,!y.detectedLocale&&d.buildId&&(y=c.i18nProvider?c.i18nProvider.analyze(w):(0,t.normalizeLocalePath)(w,g.locales),y.detectedLocale&&(d.locale=y.detectedLocale))}return d}})(tt);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"NextURL",{enumerable:!0,get:function(){return u}});const t=_.detectDomainLocale,r=Ze,n=et,o=tt,a=/(?!^https?:\/\/)(127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}|\[::1\]|localhost)/;function c(g,s){return new URL(String(g).replace(a,"localhost"),s&&String(s).replace(a,"localhost"))}const i=Symbol("NextURLInternal");class u{constructor(s,d,w){let v,y;typeof d=="object"&&"pathname"in d||typeof d=="string"?(v=d,y=w||{}):y=w||d||{},this[i]={url:c(s,v??y.base),options:y,basePath:""},this.analyze()}analyze(){var s,d,w,v,y;const P=(0,o.getNextPathnameInfo)(this[i].url.pathname,{nextConfig:this[i].options.nextConfig,parseData:!process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE,i18nProvider:this[i].options.i18nProvider}),p=(0,n.getHostname)(this[i].url,this[i].options.headers);this[i].domainLocale=this[i].options.i18nProvider?this[i].options.i18nProvider.detectDomainLocale(p):(0,t.detectDomainLocale)((d=this[i].options.nextConfig)==null||(s=d.i18n)==null?void 0:s.domains,p);const b=((w=this[i].domainLocale)==null?void 0:w.defaultLocale)||((y=this[i].options.nextConfig)==null||(v=y.i18n)==null?void 0:v.defaultLocale);this[i].url.pathname=P.pathname,this[i].defaultLocale=b,this[i].basePath=P.basePath??"",this[i].buildId=P.buildId,this[i].locale=P.locale??b,this[i].trailingSlash=P.trailingSlash}formatPathname(){return(0,r.formatNextPathnameInfo)({basePath:this[i].basePath,buildId:this[i].buildId,defaultLocale:this[i].options.forceLocale?void 0:this[i].defaultLocale,locale:this[i].locale,pathname:this[i].url.pathname,trailingSlash:this[i].trailingSlash})}formatSearch(){return this[i].url.search}get buildId(){return this[i].buildId}set buildId(s){this[i].buildId=s}get locale(){return this[i].locale??""}set locale(s){var d,w;if(!this[i].locale||!(!((w=this[i].options.nextConfig)==null||(d=w.i18n)==null)&&d.locales.includes(s)))throw new TypeError(`The NextURL configuration includes no locale "${s}"`);this[i].locale=s}get defaultLocale(){return this[i].defaultLocale}get domainLocale(){return this[i].domainLocale}get searchParams(){return this[i].url.searchParams}get host(){return this[i].url.host}set host(s){this[i].url.host=s}get hostname(){return this[i].url.hostname}set hostname(s){this[i].url.hostname=s}get port(){return this[i].url.port}set port(s){this[i].url.port=s}get protocol(){return this[i].url.protocol}set protocol(s){this[i].url.protocol=s}get href(){const s=this.formatPathname(),d=this.formatSearch();return`${this.protocol}//${this.host}${s}${d}${this.hash}`}set href(s){this[i].url=c(s),this.analyze()}get origin(){return this[i].url.origin}get pathname(){return this[i].url.pathname}set pathname(s){this[i].url.pathname=s}get hash(){return this[i].url.hash}set hash(s){this[i].url.hash=s}get search(){return this[i].url.search}set search(s){this[i].url.search=s}get password(){return this[i].url.password}set password(s){this[i].url.password=s}get username(){return this[i].url.username}set username(s){this[i].url.username=s}get basePath(){return this[i].basePath}set basePath(s){this[i].basePath=s.startsWith("/")?s:`/${s}`}toString(){return this.href}toJSON(){return this.href}[Symbol.for("edge-runtime.inspect.custom")](){return{href:this.href,origin:this.origin,protocol:this.protocol,username:this.username,password:this.password,host:this.host,hostname:this.hostname,port:this.port,pathname:this.pathname,search:this.search,searchParams:this.searchParams,hash:this.hash}}clone(){return new u(String(this),this[i].options)}}})(we);var ve={};(function(e){Object.defineProperty(e,"__esModule",{value:!0});function t(u,g){for(var s in g)Object.defineProperty(u,s,{enumerable:!0,get:g[s]})}t(e,{fromNodeOutgoingHttpHeaders:function(){return n},normalizeNextQueryParam:function(){return i},splitCookiesString:function(){return o},toNodeOutgoingHttpHeaders:function(){return a},validateURL:function(){return c}});const r=_.constants;function n(u){const g=new Headers;for(let[s,d]of Object.entries(u)){const w=Array.isArray(d)?d:[d];for(let v of w)typeof v>"u"||(typeof v=="number"&&(v=v.toString()),g.append(s,v))}return g}function o(u){var g=[],s=0,d,w,v,y,P;function p(){for(;s<u.length&&/\s/.test(u.charAt(s));)s+=1;return s<u.length}function b(){return w=u.charAt(s),w!=="="&&w!==";"&&w!==","}for(;s<u.length;){for(d=s,P=!1;p();)if(w=u.charAt(s),w===","){for(v=s,s+=1,p(),y=s;s<u.length&&b();)s+=1;s<u.length&&u.charAt(s)==="="?(P=!0,s=y,g.push(u.substring(d,v)),d=s):s=v+1}else s+=1;(!P||s>=u.length)&&g.push(u.substring(d,u.length))}return g}function a(u){const g={},s=[];if(u)for(const[d,w]of u.entries())d.toLowerCase()==="set-cookie"?(s.push(...o(w)),g[d]=s.length===1?s[0]:s):g[d]=w;return g}function c(u){try{return String(new URL(String(u)))}catch(g){throw new Error(`URL is malformed "${String(u)}". Please use only absolute URLs - https://nextjs.org/docs/messages/middleware-relative-urls`,{cause:g})}}function i(u,g){const s=[r.NEXT_QUERY_PARAM_PREFIX,r.NEXT_INTERCEPTION_MARKER_PREFIX];for(const d of s)if(u!==d&&u.startsWith(d)){const w=u.substring(d.length);g(w)}}})(ve);var nt={};(function(e){Object.defineProperty(e,"__esModule",{value:!0});function t(a,c){for(var i in c)Object.defineProperty(a,i,{enumerable:!0,get:c[i]})}t(e,{PageSignatureError:function(){return r},RemovedPageError:function(){return n},RemovedUAError:function(){return o}});class r extends Error{constructor({page:c}){super(`The middleware "${c}" accepts an async API directly with the form:
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("react/jsx-runtime"),_=require("./index-DsX1pAV4.js"),z=require("@soma-vertical-web/core-components"),mt=require("yup"),gt=require("sanitize-html"),bt=require("jose");function wt(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const l=wt(mt),vt=async({children:e,ClientCartProvider:t,...r})=>{const{data:n}=await _.fetchContentType("mini_cart",r);return S.jsx(t,{...n?Array.isArray(n)?{data:n[0]}:{data:n}:{},children:e})},yt=({slug:e,data:t,SectionZone:r,COMMON_PAGE_COLUMN_GAP:n,identifyWhoIsFirst:o})=>{const a=t==null?void 0:t.find(d=>{var w,v,y,P;return((v=(w=d.config)==null?void 0:w.responsive)==null?void 0:v.deviceType)==="desktop"&&((P=(y=d.config)==null?void 0:y.seo)==null?void 0:P.slug)===e}),c=a==null?void 0:a.config.responsive.gapCustom,i=a==null?void 0:a.config.responsive.gapSections,u=t==null?void 0:t.find(d=>{var w,v,y,P;return((v=(w=d.config)==null?void 0:w.responsive)==null?void 0:v.deviceType)==="mobile"&&((P=(y=d.config)==null?void 0:y.seo)==null?void 0:P.slug)===e}),g=u==null?void 0:u.config.responsive.gapCustom,s=u==null?void 0:u.config.responsive.gapSections;return S.jsxs(S.Fragment,{children:[S.jsx(z.Utils.Column,{gap:c&&i?i:n,className:z.helpers.classNameConcat(_.responsive["responsive-desktop-flex"],"utils-column-modifier"),children:S.jsx(r,{data:(a==null?void 0:a.sections)??[],identifyWhoIsFirst:o})}),S.jsx(z.Utils.Column,{gap:g&&s?s:n,className:z.helpers.classNameConcat(_.responsive["responsive-mobile-flex"],"utils-column-modifier"),children:S.jsx(r,{data:(u==null?void 0:u.sections)??[],identifyWhoIsFirst:o})})]})},_t=async({slug:e,SectionZone:t,COMMON_PAGE_COLUMN_GAP:r,identifyWhoIsFirst:n=!1,...o})=>{const{data:a}=await _.fetchContentType("common_page",o);return!a||!Array.isArray(a)||a.length===0?null:S.jsx(yt,{data:a,slug:e,SectionZone:t,COMMON_PAGE_COLUMN_GAP:r,identifyWhoIsFirst:n})},xt=async({children:e,ClientFlagsAndTagsProvider:t,...r})=>{const{data:n}=await _.fetchContentType("flags_and_tags",r);return!n||!Array.isArray(n)?null:S.jsx(t,{data:n[0],children:e})},Pt=async({className:e,PAYMENT_FLAGS_DICTIONARY:t,PAYMENT_FLAGS:r,LEGAL_INFORMATION_TEXT:n,ICONS:o,SectionZone:a,Footer:c,FooterSupport:i,hasFooterStamps:u,...g})=>{var v,y,P,p,b,f,h,m,T,A,x;const{data:s}=await _.fetchContentType("footer",g),d=Array.isArray(s)&&((v=s[0])==null?void 0:v.type)==="footer"?s[0]:null,w={...(y=d==null?void 0:d.paymentInfo)==null?void 0:y.paymentInfo,acceptedFlags:Array.isArray((P=d==null?void 0:d.paymentInfo)==null?void 0:P.paymentInfo.acceptedFlags)?(p=d==null?void 0:d.paymentInfo)==null?void 0:p.paymentInfo.acceptedFlags.filter(R=>!!t[R]).map(R=>t[R]):[]};return d?S.jsx(c,{className:e,data:{...d},socialInfo:(b=d.socialMedia)==null?void 0:b.socialMedia,socialMedias:(h=(f=d.socialMedia)==null?void 0:f.socialMedia)==null?void 0:h.medias,payments:w,hasFooterStamps:u,adornment:{...(T=(m=d.supportInfo)==null?void 0:m.supportInfo)!=null&&T.content?{bottom:S.jsx(i,{content:(x=(A=d.supportInfo)==null?void 0:A.supportInfo)==null?void 0:x.content,CONSTANTS:{ICONS:o,PAYMENT_FLAGS:r,PAYMENT_FLAGS_DICTIONARY:t}})}:{},...d.sections.length?{top:S.jsx(a,{data:d.sections})}:{}},LEGAL_INFORMATION_TEXT:n,ICONS:o}):null},Rt=async({children:e,ClientHeaderProvider:t,...r})=>{var a,c,i,u,g,s;const{data:n}=await _.fetchContentType("header",r),o=Array.isArray(n)?n[0]:void 0;return S.jsx(t,{headerData:{...((a=o==null?void 0:o.layerConfig)==null?void 0:a.config)??{},subMenus:((c=o==null?void 0:o.sections)==null?void 0:c.map(d=>d.data))??[],categories:((u=(i=o==null?void 0:o.categories)==null?void 0:i.categories)==null?void 0:u.items)??[],navigationLinks:((s=(g=o==null?void 0:o.navigationLinks)==null?void 0:g.navigationLinks)==null?void 0:s.items)??[]},children:e})},It=e=>{var c,i;const t=(i=(c=e[0])==null?void 0:c.items)==null?void 0:i.items;if((t==null?void 0:t.items.length)===0||e.length===0)return{iconLabel:"",label:"",content:[]};const r=t==null?void 0:t.iconLabel,n=t==null?void 0:t.label,o=t==null?void 0:t.helpButtonSize,a=t.items.map((u,g)=>({type:u.type,id:`${g.toString()}-${u.title.toLowerCase()}`,title:u.title,subtitle:u.subtitle,description:u.description,buttonLabel:u.buttonLabel,buttonHref:u.buttonHref,buttonMode:u.buttonMode,buttonSize:u.buttonSize,buttonIcon:u.buttonIcon}));return{iconLabel:r,label:n,helpButtonSize:o,content:a}},Ct=async({HelpButton:e,ICONS:t,className:r,...n})=>{const{data:o}=await _.fetchContentType("helpbutton",n);if(!o||!Array.isArray(o)||o.length===0)return null;const a=It(o);return S.jsx(e,{data:a,ICONS:t,className:r})},St=async({SectionZone:e,LPCadastro:t,...r})=>{var u;const{data:n}=await _.fetchContentType("lp_cadastro",r);if(!n||!Array.isArray(n)||n.length===0)return null;const[o]=n,a=(o==null?void 0:o.sections)||[],c=((u=o==null?void 0:o.content)==null?void 0:u.conteúdo)||{},i=o==null?void 0:o.sections;return S.jsxs(S.Fragment,{children:[S.jsx(t,{sections:a,content:c}),S.jsx(e,{data:i})]})},kt=async({LPLOJAS_TEMPLATE_RETURN_BUTTON:e,ICONS:t,entity:r,showVendor:n,LPStoresClientWrapper:o,...a})=>{var g;const{data:c}=await _.fetchContentType("lp_lojas",a),u=(g=(Array.isArray(c)?c:[])[0])==null?void 0:g.config.config;return S.jsx(o,{entity:r,content:u,data:c,showVendor:n,ICONS:t,LPLOJAS_TEMPLATE_RETURN_BUTTON:e})},Tt=async({ERROR_TEMPLATE_RETURN_BUTTON:e,ErrorTemplate:t,...r})=>{var a;const{data:n}=await _.fetchContentType("notfound_page",r),o=Array.isArray(n)?(a=n[0])==null?void 0:a.config.config:null;return n&&o?S.jsx(t,{data:o,ERROR_TEMPLATE_RETURN_BUTTON:e}):S.jsx(S.Fragment,{})},Ot=async({children:e,productId:t,COMMON_PAGE_COLUMN_GAP:r,SectionZone:n,PDPContentProvider:o,...a})=>{const{data:c}=await _.fetchContentType("product_page",a);return!c||!Array.isArray(c)||c.length===0?null:S.jsx(o,{data:c[0],productId:t,COMMON_PAGE_COLUMN_GAP:r,SectionZone:n,children:e})},Et={"column-modifier":"_column-modifier_1tqap_1"},jt=async({className:e,children:t,slug:r,SectionZone:n,COMMON_PAGE_COLUMN_GAP_PDC:o,PLPContentProvider:a,...c})=>{const{data:i}=await _.fetchContentType("categories_page",c);if(!i||!Array.isArray(i))return null;const u=i.find(v=>{var y,P,p;return((y=v.config)==null?void 0:y.seo.slug)===r&&((p=(P=v.config)==null?void 0:P.responsive)==null?void 0:p.deviceType)==="desktop"}),g=i.find(v=>{var y,P,p;return((y=v.config)==null?void 0:y.seo.slug)===r&&((p=(P=v.config)==null?void 0:P.responsive)==null?void 0:p.deviceType)==="mobile"}),s=i.find(v=>{var y,P,p;return((y=v.config)==null?void 0:y.seo.slug)==="default"&&((p=(P=v.config)==null?void 0:P.responsive)==null?void 0:p.deviceType)==="desktop"}),d=i.find(v=>{var y,P,p;return((y=v.config)==null?void 0:y.seo.slug)==="default"&&((p=(P=v.config)==null?void 0:P.responsive)==null?void 0:p.deviceType)==="mobile"}),w=Array.isArray(e)?e:[e];return S.jsxs(S.Fragment,{children:[S.jsx(z.Utils.Column,{className:z.helpers.classNameConcat(_.responsive["responsive-desktop-flex"],[Et["column-modifier"],...w]),style:{minHeight:"100vh"},children:S.jsx(a,{data:u??s,device:"desktop",SectionZone:n,COMMON_PAGE_COLUMN_GAP_PDC:o,children:t})}),S.jsx(z.Utils.Column,{className:z.helpers.classNameConcat(_.responsive["responsive-mobile-flex"],e),children:S.jsx(a,{data:g??d,device:"mobile",SectionZone:n,COMMON_PAGE_COLUMN_GAP_PDC:o,children:t})})]})},At=async({slug:e,...t})=>{var c,i,u;const{data:r}=await _.fetchContentType("redirect_to_search",t);if(!r||!Array.isArray(r))return{slug:e,query:null,redirect:!1};const n=((u=(i=(c=r[0])==null?void 0:c.redirectToSearch)==null?void 0:i.redirectToSearch)==null?void 0:u.paths)??[];if(!!!n.length)return{slug:e,query:null,redirect:!1};const a=n.find(g=>{var s,d;return((s=g.path)==null?void 0:s.replace(/\//g,"-").toLowerCase())===e.replace(/\//g,"-").toLowerCase()||((d=g.path)==null?void 0:d.replace(/\//g,"-").toLowerCase())===`/${e}`.replace(/\//g,"-").toLowerCase()});return a?{slug:e,query:a==null?void 0:a.searchQuery,redirect:!0,collectionId:a==null?void 0:a.collectionId,filters:a==null?void 0:a.filters,sort:a==null?void 0:a.sort}:{slug:e,query:null,redirect:!1,collectionId:null,filters:null,sort:null}},qt=async({slug:e,...t})=>{var c,i,u;const{data:r}=await _.fetchContentType("redirect_to_search",t);if(!r||!Array.isArray(r))return null;const n=((u=(i=(c=r[0])==null?void 0:c.redirectToSearch)==null?void 0:i.redirectToSearch)==null?void 0:u.paths)??[];if(!!!n.length)return null;const a=n.find(g=>{var s,d;return((s=g.path)==null?void 0:s.replace(/\//g,"-").toLowerCase())===e.replace(/\//g,"-").toLowerCase()||((d=g.path)==null?void 0:d.replace(/\//g,"-").toLowerCase())===`/${e}`.replace(/\//g,"-").toLowerCase()});return a?{slug:e,title:a.pageTitle,description:a.pageDescription}:null},Nt=async({slug:e,Politicas:t,SectionZone:r,oneTrust:n,...o})=>{const{data:a}=await _.fetchContentType("policy_page",o),{data:c}=await _.fetchContentType("policy_tab",o),i=Array.isArray(a)?a:null,u=Array.isArray(c)?c:null,g=i?i[0].sections:null;return!i||!u?null:S.jsxs(S.Fragment,{children:[S.jsx(t,{slug:e,pageData:i[0],tabsData:u,oneTrust:n}),g&&S.jsx(r,{data:g})]})},Ft=async({children:e,SectionZone:t,className:r,...n})=>{const{data:o}=await _.fetchContentType("search_page",n);return Array.isArray(o)&&o.length>0?S.jsx(_.SearchPageScreening,{data:o,SectionZone:t,className:r,children:e}):S.jsx(S.Fragment,{children:"children"})},$t=async({ClientTipbarContent:e,...t})=>{const{data:r}=await _.fetchContentType("tipbar",t);return S.jsx(e,{data:r})},Lt=async({children:e,SectionZone:t,WishlistScreening:r,...n})=>{const{data:o}=await _.fetchContentType("wishlist_page",n);return S.jsx(r,{data:Array.isArray(o)?o:[],SectionZone:t,children:e})},Dt={CommonPageContent:_t,CartContent:vt,FlagsAndTagsContent:xt,HeaderContent:Rt,TipbarContent:$t,FooterContent:Pt,PLPContent:jt,PDPContent:Ot,getRedirectData:At,getPLPSynteticMetaData:qt,SearchPageContent:Ft,HelpButtonContent:Ct,LPCadastroContent:St,LPLojasContent:kt,PolicyPageContent:Nt,NotFoundContent:Tt,WishlistContent:Lt},Ut={Components:Dt},Mt=l.object({country:l.string().length(3,"Country code must be 3 characters long").required("Country is required"),postalCode:l.string().nullable()});async function Ht({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await Mt.validate(t);const{country:n,postalCode:o}=t;return await _.fetchVtex(`${e}/api/checkout/pub/postal-code/${n}/${o}`,{method:"POST",body:t,...r})}const Bt=l.object({orderFormId:l.string().nullable(),sellerCode:l.string().nullable(),sellerName:l.string().nullable()});async function Le({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await Bt.validate(t);const{orderFormId:n,sellerCode:o,sellerName:a}=t,c=o?`${o.trim()} - ${a}`:null;return _.fetchVtex(`${e}/api/checkout/pub/orderForm/${n}/attachments/openTextField`,{method:"POST",body:{value:c},...r})}const zt=l.object({orderFormId:l.string().nullable(),sellerCode:l.string().nullable(),marketingData:l.object()});async function De({apiUrl:e,body:t,extraData:r={},fetchOptions:n}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await zt.validate(t);const{orderFormId:o,sellerCode:a,marketingData:c}=t,i=a?{utmCampaign:a?a.toUpperCase():"",utmiCampaign:a?`${r.VENDOR_CODE}`:"semcodigo"}:{};return _.fetchVtex(`${e}/api/checkout/pub/orderForm/${o}/attachments/marketingData`,{method:"POST",body:{...c,...i},...n})}const Vt=l.object({orderFormId:l.string().nullable(),sellerCode:l.string().nullable(),sellerName:l.string().nullable()});async function Gt({apiUrl:e,body:t,fetchOptions:r,extraData:n}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await Vt.validate(t);const o=await Le({apiUrl:e,body:t,fetchOptions:r});return De({apiUrl:e,body:{...t,marketingData:o==null?void 0:o.marketingData},extraData:n,fetchOptions:r})}const Wt=l.object({orderFormId:l.string().nullable(),coupon:l.string().nullable()});async function Qt({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await Wt.validate(t);const{coupon:n="",orderFormId:o}=t;return _.fetchVtex(`${e}/api/checkout/pub/orderForm/${o}/coupons`,{method:"POST",body:{text:n},...r})}const Xt=l.object({appId:l.string().required("App ID is required"),orderFormId:l.string().nullable(),key:l.array().of(l.string())});async function Kt({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await Xt.validate(t);const{appId:n="faststore",orderFormId:o,key:a}=t;return _.fetchVtex(`${e}/api/checkout/pub/orderForm/${o}/customData/${n}/${a}`,{method:"PUT",...r})}const Jt=l.object().shape({name:l.string().required("Attachment name is required"),content:l.object().nullable()});var Fe;const Zt=l.object().shape({attachments:(Fe=l.array().of(Jt))==null?void 0:Fe.nullable(),id:l.string().required("ID of SKU is required"),index:l.number().integer().nullable(),quantity:l.number().integer().nullable(),seller:l.string().required("Seller is required"),price:l.number().integer()}),Yt=l.object({orderFormId:l.string().required("OrderFormId is required"),orderItems:l.array().of(Zt)});async function er({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await Yt.validate(t);const{orderFormId:n,orderItems:o}=t;return _.fetchVtex(`${e}/api/checkout/pub/orderForm/${n}/items`,{method:"POST",body:{orderItems:o},...r})}const tr=l.object({orderFormId:l.string().nullable()});async function rr({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await tr.validate(t);const{orderFormId:n}=t;return _.fetchVtex(`${e}/api/checkout/pub/orderForm/${n}/items/removeAll`,{method:"POST",...r})}const nr=l.object().shape({name:l.string().required("Attachment name is required"),content:l.object().nullable()});var $e;const or=l.object().shape({attachments:($e=l.array().of(nr))==null?void 0:$e.nullable(),id:l.string().required("ID of SKU is required"),index:l.number().integer().nullable(),quantity:l.number().integer().nullable(),seller:l.string().required("Seller is required"),price:l.number().integer()}),ir=l.object({orderFormId:l.string().nullable(),orderItems:l.array().of(or)});async function ar({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await ir.validate(t);const{orderFormId:n,orderItems:o}=t;return _.fetchVtex(`${e}/api/checkout/pub/orderForm/${n}/items/update`,{method:"POST",body:{orderItems:o},...r})}const sr=l.object({orderFormId:l.string().nullable()});async function cr({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await sr.validate(t);const{orderFormId:n}=t;return _.fetchVtex(`${e}/api/checkout/pub/orderForm/${n}/messages/clear`,{method:"POST",...r})}const lr=l.object({id:l.string().nullable(),itemIndex:l.number().nullable(),orderFormId:l.string().nullable(),remove:l.boolean().nullable()});async function ur({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await lr.validate(t);const{itemIndex:n,orderFormId:o,id:a,remove:c}=t,i=c?`/${a}/remove`:"",u=`${e}/api/checkout/pub/orderForm/${o}/items/${n}/offerings${i}`;return _.fetchVtex(u,{method:"POST",body:{id:a},...r})}const dr=l.object({orderFormId:l.string().nullable()});async function pr({apiUrl:e,body:t,fetchOptions:r,extraData:n}){var c;if(!t){console.error("[ERROR FETCHING] Body is required");return}await dr.validate(t);const o=new URLSearchParams({refreshOutdatedData:"true"}),a=t.orderFormId&&((c=n.orderFormPurchaseId)==null?void 0:c.value)!==t.orderFormId?`${e}/api/checkout/pub/orderForm/${t.orderFormId}?${String(o)}`:`${e}/api/checkout/pub/orderForm`;return _.fetchVtex(a,{method:"GET",...r})}const fr=l.object({orderFormId:l.string().nullable(),email:l.string().email().required(),firstName:l.string().required(),lastName:l.string().required(),documentType:l.string().required(),document:l.string().required(),phone:l.string().matches(/^\+\d{1,3}\d{10,11}$/)});async function hr({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await fr.validate(t);const{orderFormId:n,...o}=t;return _.fetchVtex(`${e}/api/checkout/pub/orderForm/${n}/attachments/clientProfileData`,{method:"POST",body:{...o},...r})}const mr=l.object({sellerCode:l.string().nullable()});async function gr({apiUrl:e,body:t,extraData:r,fetchOptions:n}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await mr.validate(t);const{sellerCode:o=""}=t;return _.fetchVtex(`${e}/api/dataentities/${r.ENTITIES}/search?_fields=${r.FIELDS}&${r.FILTER}=${o}`,{method:"GET",headers:{Accept:"application/vnd.vtex.ds.v10+json"},...n})}const br=l.object().shape({country:l.string().length(3,"Country code must be 3 characters long").required("Country is required"),orderFormId:l.string().nullable(),postalCode:l.string().nullable()});async function wr({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await br.validate(t);const{country:n,orderFormId:o,postalCode:a}=t,c=a?{address:{addressType:"residential",postalCode:a,country:n}}:{logisticsInfo:[],clearAddressIfPostalCodeNotFound:!0};return _.fetchVtex(`${e}/api/checkout/pub/orderForm/${o}/attachments/shippingData`,{method:"POST",body:c,...r})}const vr=l.object().shape({orderFormId:l.string().nullable(),options:l.array().of(l.object().shape({itemIndex:l.number(),selectedDeliveryChannel:l.string(),selectedSla:l.string()})),selectedAddresses:l.array().of(l.object().shape({addressId:l.string().required(),addressType:l.string().required(),city:l.string().nullable(),complement:l.string().nullable(),country:l.string().required().length(3),geoCoordinates:l.array().of(l.number()).required().min(0),isDisposable:l.boolean().required(),neighborhood:l.string().nullable(),number:l.string().nullable(),postalCode:l.string().required(),receiverName:l.string().nullable(),reference:l.string().nullable(),state:l.string().nullable(),street:l.string().nullable()}))});async function yr({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await vr.validate(t);const{orderFormId:n,options:o,selectedAddresses:a}=t;return _.fetchVtex(`${e}/api/checkout/pub/orderForm/${n}/attachments/shippingData`,{method:"POST",body:{selectedAddresses:a,clearAddressIfPostalCodeNotFound:!1,logisticsInfo:o},...r})}const _r=l.object({country:l.string().length(3,"Country code must be 3 characters long").required("Country is required"),postalCode:l.string().nullable(),geoCoordinates:l.object().shape({longitude:l.number().required(),latitude:l.number().required()})});async function xr({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await _r.validate(t);const{country:n="",geoCoordinates:o,postalCode:a=""}=t,c=new URLSearchParams({country:String(n)});return a?c.append("postalCode",a):c.append("geoCoordinates",`${o==null?void 0:o.longitude};${o==null?void 0:o.latitude}`),await _.fetchVtex(`${e}/api/checkout/pub/regions/?${c.toString()}`,{method:"GET",...r})}const Pr=l.object({id:l.string().required("ID of SKU is required"),quantity:l.number().integer().required("Quantity of item is required"),seller:l.string()}),Rr=l.object({items:l.array().of(Pr),country:l.string().length(3,"Country code must be 3 characters long").required("Country is required"),postalCode:l.string().nullable(),geoCoordinates:l.array().nullable().of(l.number()).length(2)});async function Ir({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}return await Rr.validate(t),_.fetchVtex(`${e}/api/checkout/pub/orderForms/simulation`,{method:"POST",body:t,...r})}const Cr=Object.freeze(Object.defineProperty({__proto__:null,getMasterDataSellerCode:gr,getOrderForm:pr,postOrderFormAddCoupon:Qt,postOrderFormAttachClientProfileData:hr,postOrderFormAttachOrderFormData:Gt,postOrderFormAttachShippingData:wr,postOrderFormAttachmentsMarketingData:De,postOrderFormAttachmentsOpenTextField:Le,postOrderFormClearMessages:cr,postOrderFormFreightSimulation:Ir,postOrderFormItems:er,postOrderFormRegion:xr,postOrderFormRemoveAllItems:rr,postOrderFormUpdateItems:ar,postOrderFormUpdateShippingData:yr,postOrderformAddress:Ht,putOrderFormCustomData:Kt,updateOrderFormOffering:ur},Symbol.toStringTag,{value:"Module"})),Sr=l.object({skuId:l.string()});async function kr({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await Sr.validate(t);const{skuId:n}=t;return _.fetchVtex(`${e}/api/catalog/pvt/stockkeepingunitkit?parentSkuId=${n}`,{...r})}const Tr=l.object({ids:l.array().of(l.string().required("ID are required")).required("IDs are required")});async function Or({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await Tr.validate(t);const{ids:n}=t;return _.fetchVtex(`${e}/api/catalog_system/pub/products/search?fq=${n.map(o=>`productId:${o}`).join("&fq=")}`,{...r})}const Er=l.object({productId:l.number().required("Product ID is required")});async function jr({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await Er.validate(t);const{productId:n}=t;return _.fetchVtex(`${e}/api/catalog_system/pub/products/crossselling/similars/${n.toString()}`,{...r})}async function Ar({apiUrl:e,params:t,fetchOptions:r}){return t!=null&&t.slug?_.fetchVtex(`${e}/api/catalog_system/pub/portal/pagetype/${t.slug}`,{...r}):(console.error("[ERROR FETCHING] slug is required"),null)}const qr=Object.freeze(Object.defineProperty({__proto__:null,getCatalogKitProducts:kr,getCatalogPageInfo:Ar,getCatalogProducts:Or,getCatalogSimilars:jr},Symbol.toStringTag,{value:"Module"})),Nr=l.object({query:l.string()});async function Fr({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await Nr.validate(t);const{query:n=""}=t,o=new URLSearchParams({query:n});return _.fetchVtex(`${e}/api/io/_v/api/intelligent-search/autocomplete_suggestions?${o.toString()}`,{...r})}const $r=(e,t)=>gt(e,t),Lr=e=>({...e,description:e.description?$r(e.description):e.description}),Dr=({offer:e,seller:t,product:r})=>({...e,product:r,seller:t}),Ue=(e,t)=>({...e,isVariantOf:Lr(t)}),Ur=e=>e?"https://schema.org/InStock":"https://schema.org/OutOfStock",oe=e=>e.AvailableQuantity>0,Ae=e=>e.spotPrice??0,Mr=e=>e.Price??0,Me=(e,t)=>oe(e)&&!oe(t)?-1:!oe(e)&&oe(t)?1:Ae(e)-Ae(t),Hr=(e,t)=>{let r=0;for(let n=1;n<e.length;n++)t(e[r],e[n])>0&&(r=n);return e[r]},He=e=>{const t=e.flatMap(n=>n.sellers.map(o=>({offer:o.commertialOffer,sku:n}))),r=Hr(t,({offer:n},{offer:o})=>Me(n,o));return r?r.sku:e[0]},Be=e=>e.map(({imageUrl:t,imageText:r,imageLabel:n})=>({alternateName:r??"",url:t.replace("vteximg.com.br","vtexassets.com"),keywords:n})),ie={attachment:"ATTACHMENT",specification:"SPECIFICATION",attribute:"ATTRIBUTE"},Br=e=>({name:e.name,value:e.content,valueReference:ie.attachment}),zr=e=>({propertyID:e.id,name:e.name,value:e.value,valueReference:{valueReference:ie.attribute,visible:e.visible}}),ae=(e,t,r)=>{const n=e.flatMap(({name:c,values:i})=>i?i.map(u=>({name:c,value:u,valueReference:ie.specification})):{name:c,value:"",valueReference:ie.specification}),o=Array.isArray(r)?r.map(Br):[],a=t?t.map(zr):[];return[...n,...o,...a]},qe="ÁÄÂÀÃÅČÇĆĎÉĚËÈÊẼĔȆÍÌÎÏŇÑÓÖÒÔÕØŘŔŠŤÚŮÜÙÛÝŸŽáäâàãåčçćďéěëèêẽĕȇíìîïňñóöòôõøðřŕšťúůüùûýÿžþÞĐđ߯a",Vr="AAAAAACCCDEEEEEEEEIIIINNOOOOOORRSTUUUUUYYZaaaaaacccdeeeeeeeeiiiinnooooooorrstuuuuuyyzbBDdBAa",Gr=e=>{let t=e.slice(0);for(let r=0;r<qe.length;r++)t=t.replace(new RegExp(qe.charAt(r),"g"),Vr.charAt(r));return t},Wr=e=>e.replace(/[·/_,:]/,"-"),ze=e=>{const r=e.replace(/,/g,"").replace(/[*+~.()'"!:@&\[\]`/ %$#?{}|><=_^]/g,"-");return Wr(Gr(r)).toLowerCase()},Ve=e=>`/${e}/p`,Ge=e=>{const t=Math.max(...e.map(n=>n.NumberOfInstallments)),r=e.find(n=>n.NumberOfInstallments===t);return{count:(r==null?void 0:r.NumberOfInstallments)??0,value:(r==null?void 0:r.Value)??0}},We=(e,t)=>{const r={price:0,listPrice:0,sellerDefault:!1},o=e.map(a=>Dr({offer:a.commertialOffer,seller:a,product:t})).sort(Me).map(a=>(a.seller.sellerId==="1"&&a.AvailableQuantity>0&&(r.price=a.Price,r.listPrice=a.ListPrice,r.sellerDefault=!0),{availability:a.AvailableQuantity>0,listPrice:a.ListPrice,price:Mr(a),priceValidUntil:a.PriceValidUntil,priceCurrency:"BRL",installments:a.Installments,lowPrice:a.spotPrice,quantity:a.AvailableQuantity,seller:{identifier:a.seller.sellerId}}));return{lowPrice:r.sellerDefault?r.price:o[0].price,highPrice:r.sellerDefault?r.listPrice:o[0].listPrice,offers:o}},Qe=e=>{const{attributes:t,itemId:r,name:n,sellers:o,variations:a}=e;return{additionalProperty:ae(a,t,[]),name:n,offers:{offers:o==null?void 0:o.map(({sellerId:c,commertialOffer:i})=>({availability:Ur(i.AvailableQuantity>0),listPrice:i.ListPrice,price:i.Price,quantity:i.AvailableQuantity,seller:{identifier:c}}))},sku:r}},Qr=e=>{var R;const{attributes:t,referenceId:r,isVariantOf:n,images:o,itemId:a,name:c,sellers:i,videos:u,variations:g}=e,{brand:s,categories:d,categoriesIds:w,description:v,linkText:y,productClusters:P,clusterHighlights:p,productName:b,properties:f,productId:h,productReference:m}=n,T=d.slice().reverse(),A=We(i,e.isVariantOf),x=Ge(A.offers[0].installments);return{sku:a,gtin:((R=r==null?void 0:r[0])==null?void 0:R.Value)??m??"",name:b??c,description:v,releaseDate:n.releaseDate??"",slug:y,video:u[0],categories:d,categoriesIds:w,id:h,brand:{name:s,brandName:s},seo:{description:v,title:b,canonical:Ve(y)},cluster:{generals:P,highlights:p},properties:f,availability:{status:A.offers[0].availability},breadcrumbList:{itemListElement:[...T.map((O,N)=>{const F=O.split("/"),L=F[F.length-2],D=F.map(ze).join("/");return{name:L,item:D,position:N+1}}),{name:n.productName,item:y,position:d.length+1}],numberOfItems:d.length},image:Be(o),offers:A,additionalProperty:ae(g,t,[]),isVariantOf:{productGroupID:n.productId,hasVariant:n.items.map(O=>Qe(O))},installments:x}},Xr=e=>{var x;const{attributes:t,referenceId:r,isVariantOf:n,images:o,itemId:a,name:c,sellers:i,Videos:u,variations:g}=e,{brand:s,categories:d,categoriesIds:w,description:v,linkText:y,productClusters:P,productName:p,Coleção:b,"ID Coleção":f,productId:h}=n,m=d.slice().reverse(),T=We(i,e.isVariantOf),A=Ge(T.offers[0].installments);return{sku:a,gtin:((x=r[0])==null?void 0:x.Value)??"",name:p??c,description:v,releaseDate:n.releaseDate??"",slug:y,video:u[0],categories:d,categoriesIds:w,collection:b,collectionId:f,id:h,brand:{name:s,brandName:s},seo:{description:v,title:p,canonical:Ve(y)},cluster:{generals:P,highlights:[]},availability:{status:T.offers[0].availability},breadcrumbList:{itemListElement:[...m.map((R,O)=>{const N=R.split("/"),F=N[N.length-2],L=N.map(ze).join("/");return{name:F,item:L,position:O+1}}),{name:n.productName,item:y,position:d.length+1}],numberOfItems:d.length},image:Be(o),offers:T,additionalProperty:ae(g,t,[]),isVariantOf:{productGroupID:n.productId,hasVariant:n.items.map(R=>{const{variations:O}=R,N=O.map(F=>({name:F,values:R[F]}));return{...Qe(R),additionalProperty:ae(N,t,[])}})},installments:A}},Kr=l.array().of(l.object({key:l.string().required(),value:l.string().required()})).required("Facets are required");async function Jr({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await Kr.validate(t);const n=new URLSearchParams({}),o=t.map(({key:c,value:i})=>`${c}/${i}`).join("/");_.addSearchParamsFacets(t,n);const a=`${e}/api/catalog_system/pub/products/crossselling/${o}`;return _.fetchVtex(a,{cache:"no-store",...r}).then(c=>c.map(u=>{const g=He(u.items);return g&&Ue(g,u)}).filter(u=>!!u).map(u=>({node:Xr(u)})))}const Xe=({apiUrl:e,body:t,fetchOptions:r,extraData:n})=>{if(!t){console.error("[ERROR FETCHING] Body is required");return}const{query:o="",page:a=1,count:c,sort:i="",facets:u=[],type:g,hideUnavailableItems:s=!0,locale:d=""}=t,w=new URLSearchParams({page:a.toString(),count:(c==null?void 0:c.toString())??(n==null?void 0:n.ITEMS_PER_PAGE)??24,query:o,sort:i,locale:d});s!==void 0&&w.append("hideUnavailableItems",s.toString());const v=u.map(y=>`${y.key}/${y.value}`).join("/")??"";return _.fetchVtexWithAbortController(`${e}/api/io/_v/api/intelligent-search/${g}/${v}?${w.toString()}`,{headers:{Accept:"application/json","content-type":"application/json"},...r})};async function Zr({body:e,extraData:t,...r}){var i;if(!e){console.error("[ERROR FETCHING] Body is required");return}const n=await Xe({body:{...e,type:"product_search"},extraData:t,...r}),o=(n==null?void 0:n.products.map(u=>{const g=He(u.items);return g&&Ue(g,u)}).filter(u=>!!u))??[],{pagination:a,recordsFiltered:c}=n;return{data:{pagination:{nextPage:a.after.length>0,previousPage:a.before.length>0,startCursor:"0",endCursor:c.toString(),count:c,total:a.count},products:o.map((u,g)=>({node:Qr(u),cursor:g.toString()})),misspelled:(i=n.correction)==null?void 0:i.misspelled,operator:n.operator}}}async function Yr({body:e,extraData:t,...r}){if(!e){console.error("[ERROR FETCHING] Body is required");return}const n=await Xe({body:{...e,type:"facets"},extraData:t,...r});return!n||!n.facets?(console.error("[ERROR FETCHING] No facets found"),{data:{facets:[]}}):{data:{...n,facets:_.formattedFacets(n,e==null?void 0:e.selectedFacets,(e==null?void 0:e.query)??"")}}}const en=l.object({query:l.string().optional(),locale:l.string().optional()});async function tn({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await en.validate(t);const{query:n="",locale:o="default_locale"}=t,a=new URLSearchParams({query:n,locale:o});return _.fetchVtex(`${e}/api/io/_v/api/intelligent-search/search_suggestions?${a.toString()}`,{...r})}async function rn({apiUrl:e}){return _.fetchVtex(`${e}/api/io/_v/api/intelligent-search/top_searches`)}const nn=Object.freeze(Object.defineProperty({__proto__:null,getSearchAutoCompleteSuggestions:Fr,getSearchCrossellingProducts:Jr,getSearchFacets:Yr,getSearchProducts:Zr,getSearchSuggestedTerms:tn,getSearchTopSearchs:rn},Symbol.toStringTag,{value:"Module"})),on=l.object({masterDataEntity:l.string().nonNullable(),payload:l.object().shape({}).nullable()});async function an({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await on.validate(t);const{masterDataEntity:n,payload:o}=t,a=`${e}/api/dataentities/${n}/documents`;return _.fetchVtex(a,{method:"POST",body:{payload:o},...r})}const sn=l.object().shape({_where:l.string().optional(),_fields:l.string().optional(),_sort:l.string().optional(),_from:l.number().integer().min(0).optional(),_to:l.number().integer().min(0).optional(),_keyword:l.string().optional()}),cn=l.object({masterDataEntity:l.string().required(),searchFields:sn,headers:l.object().shape({"REST-Range":l.string().notRequired()})});async function Ke({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}const n=new URLSearchParams;await cn.validate(t);const{masterDataEntity:o,searchFields:a,headers:c}=t;a&&Object.entries(a).forEach(([g,s])=>{n.append(g,String(s))}),"_fields"in a||n==null||n.append("_fields","_all");let i=[],u=null;do{u&&n.set("_scroll",u);const g=await fetch(`${e}/api/dataentities/${o}/search?${n.toString()}`,{method:"GET",headers:{"REST-Range":(c==null?void 0:c["REST-Range"])??"resources=0-100",...r==null?void 0:r.headers},cache:"no-store"});if(!g.ok)throw new Error(`[MasterData] ${g.status} - ${g.statusText}`);const s=await g.json();i.push(...s),u=g.headers.get("x-vtex-md-scroll")}while(u);return i}const ln=l.object({dataEntityName:l.string().required(),id:l.string().required(),fieldsToBeUpdated:l.object().shape({})});async function un({apiUrl:e,body:t,fetchOptions:r}){if(!t){console.error("[ERROR FETCHING] Body is required");return}await ln.validate(t);const{dataEntityName:n,id:o,fieldsToBeUpdated:a}=t,c=`${e}/api/dataentities/${n}/documents/${o}`;return _.fetchVtex(c,{body:{fieldsToBeUpdated:a},method:"PATCH",...r})}const dn=Object.freeze(Object.defineProperty({__proto__:null,getSearchMasterdata:Ke,patchUpdateMasterdata:un,postMasterdata:an},Symbol.toStringTag,{value:"Module"}));async function pn({body:e,apiUrl:t,extraData:r,fetchOptions:n}){const{productIds:o}=e;if(!o)return console.error("[ERROR FETCHING] productIds is required"),[];const{NAME_SPLIT_SYMBOL:a}=r;if(!a)return console.error("[ERROR FETCHING] NAME_SPLIT_SYMBOL is required"),[];const c=o.map(s=>typeof s=="string"||typeof s=="number"?`productId:${s}`:"").join("&fq="),i=await _.fetchVtex(`${t}/api/catalog_system/pub/products/search?fq=${c}`,{...n}),u=s=>Object.keys(s).map(d=>({id:d,name:s[d]}));return i.map((s,d)=>{var h;const{installments:w,price:v,listPrice:y,sizes:P,allSizesAvailable:p}=_.getSkuInfos({items:s.items,NAME_SPLIT_SYMBOL:a}),b=p?!0:P.some(m=>m.available),f=s.items[0].sellers[0].commertialOffer;return{node:{sku:s.items[0].itemId,gtin:s.productReference,name:s.productName,description:s.description,releaseDate:s.releaseDate,slug:s.linkText,categories:s.categories,categoriesIds:s.categoriesIds,id:s.items[0].itemId,brand:{name:s.brand,brandName:s.brand},seo:{description:s.description,title:s.productName,canonical:`/${s.linkText}/p`},cluster:{generals:u(s.productClusters),highlights:u(s.clusterHighlights)},availability:{status:b},image:s.items[0].images.map(({imageLabel:m,imageUrl:T})=>({alternateName:m,url:T,keywords:m})),offers:{lowPrice:v,highPrice:y,offers:[{availability:b,listPrice:y,price:v,priceValidUntil:f.PriceValidUntil,priceCurrency:"BRL",installments:f.Installments,lowPrice:v,quantity:f.AvailableQuantity,seller:{identifier:s.items[0].sellers[0].sellerId}}]},additionalProperty:(h=s==null?void 0:s.skuSpecifications)==null?void 0:h.map(m=>({name:s==null?void 0:s.skuSpecifications[0].field.name,value:m,valueReference:"SPECIFICATION"})),isVariantOf:{productGroupID:s.productId,hasVariant:s.items.map(m=>{var T;return{additionalProperty:m==null?void 0:m.variations.map(()=>{var A,x,R;return{name:(A=m==null?void 0:m.variations)==null?void 0:A[0],value:(R=m==null?void 0:m[(x=m==null?void 0:m.variations)==null?void 0:x[0]])==null?void 0:R[0],valueReference:"SPECIFICATION"}}),name:m.name,offers:{offers:(T=m.sellers)==null?void 0:T.map(({commertialOffer:A,sellerId:x})=>({availability:"https://schema.org/InStock",listPrice:A.ListPrice,price:A.Price,quantity:A.AvailableQuantity,seller:{identifier:x}}))},sku:m.itemId,slug:`-${m.itemId}`}})},installments:w},cursor:d.toString()}})}const fn=Object.freeze(Object.defineProperty({__proto__:null,getWishlistProducts:pn},Symbol.toStringTag,{value:"Module"}));var ge={exports:{}},Je={},we={},Ze={},Ye={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"addPathSuffix",{enumerable:!0,get:function(){return r}});const t=_.parsePath;function r(n,o){if(!n.startsWith("/")||!o)return n;const{pathname:a,query:c,hash:i}=(0,t.parsePath)(n);return""+a+o+c+i}})(Ye);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"formatNextPathnameInfo",{enumerable:!0,get:function(){return a}});const t=_.removeTrailingSlash,r=_.addPathPrefix,n=Ye,o=_.addLocale;function a(c){let i=(0,o.addLocale)(c.pathname,c.locale,c.buildId?void 0:c.defaultLocale,c.ignorePrefix);return(c.buildId||!c.trailingSlash)&&(i=(0,t.removeTrailingSlash)(i)),c.buildId&&(i=(0,n.addPathSuffix)((0,r.addPathPrefix)(i,"/_next/data/"+c.buildId),c.pathname==="/"?"index.json":".json")),i=(0,r.addPathPrefix)(i,c.basePath),!c.buildId&&c.trailingSlash?i.endsWith("/")?i:(0,n.addPathSuffix)(i,"/"):(0,t.removeTrailingSlash)(i)}})(Ze);var et={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"getHostname",{enumerable:!0,get:function(){return t}});function t(r,n){let o;if(n!=null&&n.host&&!Array.isArray(n.host))o=n.host.toString().split(":",1)[0];else if(r.hostname)o=r.hostname;else return;return o.toLowerCase()}})(et);var tt={},rt={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"removePathPrefix",{enumerable:!0,get:function(){return r}});const t=_.pathHasPrefix;function r(n,o){if(!(0,t.pathHasPrefix)(n,o))return n;const a=n.slice(o.length);return a.startsWith("/")?a:"/"+a}})(rt);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"getNextPathnameInfo",{enumerable:!0,get:function(){return o}});const t=_.normalizeLocalePath,r=rt,n=_.pathHasPrefix;function o(a,c){var i;const{basePath:u,i18n:g,trailingSlash:s}=(i=c.nextConfig)!=null?i:{},d={pathname:a,trailingSlash:a!=="/"?a.endsWith("/"):s};u&&(0,n.pathHasPrefix)(d.pathname,u)&&(d.pathname=(0,r.removePathPrefix)(d.pathname,u),d.basePath=u);let w=d.pathname;if(d.pathname.startsWith("/_next/data/")&&d.pathname.endsWith(".json")){const y=d.pathname.replace(/^\/_next\/data\//,"").replace(/\.json$/,"").split("/"),P=y[0];d.buildId=P,w=y[1]!=="index"?"/"+y.slice(1).join("/"):"/",c.parseData===!0&&(d.pathname=w)}if(g){let y=c.i18nProvider?c.i18nProvider.analyze(d.pathname):(0,t.normalizeLocalePath)(d.pathname,g.locales);d.locale=y.detectedLocale;var v;d.pathname=(v=y.pathname)!=null?v:d.pathname,!y.detectedLocale&&d.buildId&&(y=c.i18nProvider?c.i18nProvider.analyze(w):(0,t.normalizeLocalePath)(w,g.locales),y.detectedLocale&&(d.locale=y.detectedLocale))}return d}})(tt);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"NextURL",{enumerable:!0,get:function(){return u}});const t=_.detectDomainLocale,r=Ze,n=et,o=tt,a=/(?!^https?:\/\/)(127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}|\[::1\]|localhost)/;function c(g,s){return new URL(String(g).replace(a,"localhost"),s&&String(s).replace(a,"localhost"))}const i=Symbol("NextURLInternal");class u{constructor(s,d,w){let v,y;typeof d=="object"&&"pathname"in d||typeof d=="string"?(v=d,y=w||{}):y=w||d||{},this[i]={url:c(s,v??y.base),options:y,basePath:""},this.analyze()}analyze(){var s,d,w,v,y;const P=(0,o.getNextPathnameInfo)(this[i].url.pathname,{nextConfig:this[i].options.nextConfig,parseData:!process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE,i18nProvider:this[i].options.i18nProvider}),p=(0,n.getHostname)(this[i].url,this[i].options.headers);this[i].domainLocale=this[i].options.i18nProvider?this[i].options.i18nProvider.detectDomainLocale(p):(0,t.detectDomainLocale)((d=this[i].options.nextConfig)==null||(s=d.i18n)==null?void 0:s.domains,p);const b=((w=this[i].domainLocale)==null?void 0:w.defaultLocale)||((y=this[i].options.nextConfig)==null||(v=y.i18n)==null?void 0:v.defaultLocale);this[i].url.pathname=P.pathname,this[i].defaultLocale=b,this[i].basePath=P.basePath??"",this[i].buildId=P.buildId,this[i].locale=P.locale??b,this[i].trailingSlash=P.trailingSlash}formatPathname(){return(0,r.formatNextPathnameInfo)({basePath:this[i].basePath,buildId:this[i].buildId,defaultLocale:this[i].options.forceLocale?void 0:this[i].defaultLocale,locale:this[i].locale,pathname:this[i].url.pathname,trailingSlash:this[i].trailingSlash})}formatSearch(){return this[i].url.search}get buildId(){return this[i].buildId}set buildId(s){this[i].buildId=s}get locale(){return this[i].locale??""}set locale(s){var d,w;if(!this[i].locale||!(!((w=this[i].options.nextConfig)==null||(d=w.i18n)==null)&&d.locales.includes(s)))throw new TypeError(`The NextURL configuration includes no locale "${s}"`);this[i].locale=s}get defaultLocale(){return this[i].defaultLocale}get domainLocale(){return this[i].domainLocale}get searchParams(){return this[i].url.searchParams}get host(){return this[i].url.host}set host(s){this[i].url.host=s}get hostname(){return this[i].url.hostname}set hostname(s){this[i].url.hostname=s}get port(){return this[i].url.port}set port(s){this[i].url.port=s}get protocol(){return this[i].url.protocol}set protocol(s){this[i].url.protocol=s}get href(){const s=this.formatPathname(),d=this.formatSearch();return`${this.protocol}//${this.host}${s}${d}${this.hash}`}set href(s){this[i].url=c(s),this.analyze()}get origin(){return this[i].url.origin}get pathname(){return this[i].url.pathname}set pathname(s){this[i].url.pathname=s}get hash(){return this[i].url.hash}set hash(s){this[i].url.hash=s}get search(){return this[i].url.search}set search(s){this[i].url.search=s}get password(){return this[i].url.password}set password(s){this[i].url.password=s}get username(){return this[i].url.username}set username(s){this[i].url.username=s}get basePath(){return this[i].basePath}set basePath(s){this[i].basePath=s.startsWith("/")?s:`/${s}`}toString(){return this.href}toJSON(){return this.href}[Symbol.for("edge-runtime.inspect.custom")](){return{href:this.href,origin:this.origin,protocol:this.protocol,username:this.username,password:this.password,host:this.host,hostname:this.hostname,port:this.port,pathname:this.pathname,search:this.search,searchParams:this.searchParams,hash:this.hash}}clone(){return new u(String(this),this[i].options)}}})(we);var ve={};(function(e){Object.defineProperty(e,"__esModule",{value:!0});function t(u,g){for(var s in g)Object.defineProperty(u,s,{enumerable:!0,get:g[s]})}t(e,{fromNodeOutgoingHttpHeaders:function(){return n},normalizeNextQueryParam:function(){return i},splitCookiesString:function(){return o},toNodeOutgoingHttpHeaders:function(){return a},validateURL:function(){return c}});const r=_.constants;function n(u){const g=new Headers;for(let[s,d]of Object.entries(u)){const w=Array.isArray(d)?d:[d];for(let v of w)typeof v>"u"||(typeof v=="number"&&(v=v.toString()),g.append(s,v))}return g}function o(u){var g=[],s=0,d,w,v,y,P;function p(){for(;s<u.length&&/\s/.test(u.charAt(s));)s+=1;return s<u.length}function b(){return w=u.charAt(s),w!=="="&&w!==";"&&w!==","}for(;s<u.length;){for(d=s,P=!1;p();)if(w=u.charAt(s),w===","){for(v=s,s+=1,p(),y=s;s<u.length&&b();)s+=1;s<u.length&&u.charAt(s)==="="?(P=!0,s=y,g.push(u.substring(d,v)),d=s):s=v+1}else s+=1;(!P||s>=u.length)&&g.push(u.substring(d,u.length))}return g}function a(u){const g={},s=[];if(u)for(const[d,w]of u.entries())d.toLowerCase()==="set-cookie"?(s.push(...o(w)),g[d]=s.length===1?s[0]:s):g[d]=w;return g}function c(u){try{return String(new URL(String(u)))}catch(g){throw new Error(`URL is malformed "${String(u)}". Please use only absolute URLs - https://nextjs.org/docs/messages/middleware-relative-urls`,{cause:g})}}function i(u,g){const s=[r.NEXT_QUERY_PARAM_PREFIX,r.NEXT_INTERCEPTION_MARKER_PREFIX];for(const d of s)if(u!==d&&u.startsWith(d)){const w=u.substring(d.length);g(w)}}})(ve);var nt={};(function(e){Object.defineProperty(e,"__esModule",{value:!0});function t(a,c){for(var i in c)Object.defineProperty(a,i,{enumerable:!0,get:c[i]})}t(e,{PageSignatureError:function(){return r},RemovedPageError:function(){return n},RemovedUAError:function(){return o}});class r extends Error{constructor({page:c}){super(`The middleware "${c}" accepts an async API directly with the form:
2
2
 
3
3
  export function middleware(request, event) {
4
4
  return NextResponse.redirect('/new-location')