PageSourceSearch

https://dentaltanaka.vercel.app/_next/static/chunks/pages/finalizar-pedido-fd93133988d254f2.js

js dentaltanaka.vercel.app collected 2026-10-03 06:42:11 UTC 131,410 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6404],{50342:function(e,t,i){(window.__NEXT_P=window.__NEXT_P||[]).push(["/finalizar-pedido",function(){return i(56005)}])},50866:function(e,t,i){"use strict";i.d(t,{G:function(){return r},s:function(){return a}});let n="global-loader-overlay";function r(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];if("undefined"!=typeof document){if(!1===e){var t;null===(t=document.getElementById(n))||void 0===t||t.remove();return}document.getElementById(n)||function(){let e=document.createElement("div");e.id=n,e.style.cssText="position: fixed;width: 100%;height: 100%;background-color: rgba(255, 255, 255, 0.6);left: 0;top: 0;z-index: 1056;display: flex;justify-content: center;align-items: center";let t=document.createElement("div");t.className="spinner-border text-success",t.setAttribute("role","status"),e.appendChild(t),document.body.appendChild(e)}()}}function a(e){r(),window.location.assign(e)}},62968:function(e,t,i){"use strict";i.d(t,{Ht:function(){return a},ki:function(){return r}});let n=[1,3,6,9,12];function r(e){return n.filter(t=>t<=e)}function a(e){let t=r(e);return t.length?t[t.length-1]:0}},76931:function(e,t,i){"use strict";function n(e,t){let i=()=>{try{var i;if("function"!=typeof(null===(i=window.rdtracker)||void 0===i?void 0:i[e]))return!1;return t(window.rdtracker),!0}catch(t){return console.error("RD Tracker call failed",{method:e,error:t instanceof Error?t.message:t}),!0}};try{if(i())return;let e=Date.now(),t=window.setInterval(()=>{(i()||Date.now()-e>5e3)&&window.clearInterval(t)},200)}catch(t){console.error("RD Tracker schedule failed",{method:e,error:t instanceof Error?t.message:t})}}function r(e){try{if(!(null==e?void 0:e.email))return;n("identify",t=>{let i={email:e.email};e.name&&(i.name=e.name),e.mobile_phone&&(i.mobile_phone=e.mobile_phone),e.personal_phone&&(i.personal_phone=e.personal_phone),t.identify(i);let[n,r]=i.email.split("@")})}catch(e){console.error("RD Tracker identify failed",{error:e instanceof Error?e.message:e})}}function a(e,t){try{if(!e)return;n("track",i=>{i.track(e,t)})}catch(t){console.error("RD Tracker event failed",{event:e,error:t instanceof Error?t.message:t})}}i.d(t,{f:function(){return a},l:function(){return r}})},73143:function(e,t,i){"use strict";function n(e){return!0===e||"true"===e}function r(e,t){let i="".concat(e,"/getShippingOptions");return n(t)?"".concat(i,"?sandboxEstafeta=true"):i}function a(e,t){return n(t)&&e&&"object"==typeof e?{...e,sandboxEstafeta:!0}:e}i.d(t,{G1:function(){return a},RI:function(){return r}})},28980:function(e,t,i){"use strict";i.d(t,{n:function(){return a}});var n=i(12589),r=i(69283);async function a(e){let{products:t,cart:i,dentalId:a,onCheckComplete:l}=e;try{let e={},d={};null==t||t.forEach(t=>{if(t.priceOptions&&Array.isArray(t.priceOptions)){let l=t.priceOptions.filter(e=>"studentList"===e.ref&&e.refId).reduceRight((e,t)=>{let i=String(t.refId);return e.some(e=>String(e.refId)===i)||e.unshift(t),e},[]);if(l.length>0){var n,r;let o=(null===(r=i[a])||void 0===r?void 0:null===(n=r.products)||void 0===n?void 0:n[t.id])||0;d[t.id]||(d[t.id]={}),l.forEach(i=>{let n=i.refId;d[t.id][n]={useSpecialPrice:!1,priceOption:{price:i.price,formattedPrice:i.formattedPrice,ref:i.ref,refId:i.refId},listId:n},e[n]||(e[n]={listId:n,products:[]}),e[n].products.push({productId:t.id,quantity:o})})}}});let s=Object.keys(e);if(0===s.length)return l&&l({lists:[],products:{}}),{lists:[],products:{}};let c=[];for(let t of s)try{let i=await (0,r.v)("".concat(n.Y,"/getStudentList?listId=").concat(t,"&sellerId=").concat(a),{method:"GET",requestedTokenType:"guest"});if(200!==i.status){console.log("Erro ao buscar lista ".concat(t));continue}let l=await i.json();if(l.isValidListStudentDateRange&&l.showSpecialPricesForList){var o;let i=e[t].products.reduce((e,t)=>e+t.quantity,0),n=(null===(o=l.products)||void 0===o?void 0:o.reduce((e,t)=>{let i=Number(t.quantity)||0;return e+i},0))||0,r={};(l.products||[]).forEach(e=>{if(null==e?void 0:e.id){let t=Number(e.price)||0;r[e.id]=t}});let a=(l.products||[]).reduce((e,t)=>
1{let i=Number(t.quantity)||0,n=Number(t.price)||0;return e+i*n},0),s=0;e[t].products.forEach(e=>{let{productId:t,quantity:i}=e,n=r[t]||0;s+=n*i});let u=!0===l.useListValueForSpecialPriceThreshold?a>0?s/a*100:0:n>0?i/n*100:0,p=l.specialPricePercentage||0,m=u>=p;e[t].products.forEach(e=>{var i;let{productId:n}=e;(null===(i=d[n])||void 0===i?void 0:i[t])&&(d[n][t].useSpecialPrice=m)});let v={};e[t].products.forEach(e=>{var i;let{productId:n}=e;(null===(i=d[n])||void 0===i?void 0:i[t])&&(v[t]||(v[t]={}),v[t][n]=d[n][t])});let h={listId:t,title:"".concat(t,", disciplina ").concat(l.subject," - ").concat(l.school),showSpecialPricesForList:l.showSpecialPricesForList,salesManResponsible:l.salesManResponsible,specialPricePercentage:p,totalUnitsInList:n,totalUnitsInCart:i,percentage:u,useSpecialPrice:m,products:v};c.push(h)}else e[t].products.forEach(e=>{var i;let{productId:n}=e;(null===(i=d[n])||void 0===i?void 0:i[t])&&(d[n][t].useSpecialPrice=!1)}),c.push({listId:t,title:l.title||t,showSpecialPricesForList:!1,useSpecialPrice:!1})}catch(e){console.log("Erro ao processar lista ".concat(t,":"),e)}let u=Object.values(d).some(e=>Object.values(e).some(e=>e.useSpecialPrice)),p={lists:c,products:d,anyProductWithSpecialPrice:u};return l&&l(p),p}catch(e){return console.log("Erro ao verificar listas de estudantes:",e),l&&l({lists:[],products:{}}),{lists:[],products:{}}}}},56005:function(e,t,i){"use strict";i.r(t),i.d(t,{__N_SSP:function(){return tT},default:function(){return tM}});var n=i(85893),r=i(67294),a=i(9008),l=i.n(a),o=i(14416),d=i(11163),s=i(33299),c=i(16218),u=i(6253),p=i(12589),m=i(17834),v=i(10267),h=i(51252),y=i(56941),f=i(97975),g=i(36955),C=i(54981),b=i.n(C),x=i(76524),j=i.n(x),N=i(15538),w=i(91121),S=i(609),I=i(70474),k=i(49573),T=i(13152),M=i(36895);let D=e=>{var t,i,r,a,l;let{seller:o,shippingOptions:d,fields:s}=e,{t:c}=(0,k.$G)("common"),u=(0,M.Z)(null==o?void 0:o.whats,null==o?void 0:null===(i=o.countryRules)||void 0===i?void 0:null===(t=i.phone)||void 0===t?void 0:t.countryCodePrefix),p="https://api.whatsapp.com/send?phone=".concat(u,"&text=").concat(null==o?void 0:o.whatsMessage);return(0,n.jsx)(n.Fragment,{children:0===d.length?(0,n.jsx)("li",{children:(0,n.jsx)(y.Z,{children:(0,n.jsx)(w.Z,{children:(null==o?void 0:null===(r=o.shipping)||void 0===r?void 0:r.allowNewOrderOutShippingRange)===!1?(0,n.jsxs)("div",{style:{display:"flex",flexDirection:"column"},children:[(0,n.jsx)("div",{children:(null==o?void 0:null===(a=o.shipping)||void 0===a?void 0:a.messageToShowWhenCepIsOutShippingRange)?(0,n.jsx)(m.Z,{color:"danger",children:null==o?void 0:null===(l=o.shipping)||void 0===l?void 0:l.messageToShowWhenCepIsOutShippingRange}):(0,n.jsx)(m.Z,{color:"danger",children:(0,n.jsxs)("p",{className:"mb-0 font-small-3",children:["Lamentamos informar que n\xe3o podemos entregar seu pedido no endere\xe7o fornecido.",(0,n.jsx)("br",{}),"Pedimos desculpas pelo inconveniente. Por favor, verifique se o endere\xe7o de entrega est\xe1 correto e completo ao fazer novas compras.",(0,n.jsx)("br",{}),"Se precisar de ajuda, entre em contato conosco.",(0,n.jsx)("br",{})]})})}),(0,n.jsx)("div",{children:(0,n.jsx)("a",{className:"btn btn-sm btn-success mt-2 trigger-gtm-whats",target:"_blank",href:p,onClick:e=>(0,T.Ec)(e,{href:p,dental:o}),children:"Entrar em Contato"})})]}):(0,n.jsxs)("div",{className:j().label,children:[(0,n.jsx)(S.Z,{checked:"toBeConfirmed"===s.shipping.id,type:"radio",name:"shipping",readOnly:!0}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h2",{className:"mb-25",children:c("shippingWarningTitle")}),(0,n.jsxs)("p",{className:"mb-0 font-small-2",children:[c("shippingWarningMessage"),(0,n.jsx)("br",{}),c("shippingWarningMessage2")," ",(0,n.jsx)("strong",{className:"text-success",children:c("shippingWarningMessage3")}),(0,n.jsx)("br",{}),c("shippingWarningMessage4")]})]})]})})})}):""})},O=e=>{let{item:t,sellerId:i}=e,{t:r}=(0,k.$G)("common");return t.address||t.hours?(0,n.jsxs)(n.Fragment,{children:[r("pickUpIn"),": ",t.deliveryTimeToShow,t.address&&(0,n.jsx)("div",{children:t.address}),t.hours&&(0,n.jsx)("div",{children:t.hours})]}):(0,n.jsxs)(n.Fragment,{children:["Dispon\xedvel para retirada em: ",t.deliveryTimeToShow]})};var P=i(78058);function E(e){return!!e&&"object"==typeof e&&(!!e.id||!!e.ref||null!=e.service||null!=e.price||null!=e.title)}function F(e,t){if(E(e)){var i;return{service:t,id:(null==e?void 0:e.id)||"toBeConfirmed",...e.service&&{service:e.service},...e.deliveryTime&&{deliveryTime:e.deliveryTime},...null!=e.price&&{price:e.price},...e.title&&{title:e.title},...null!=e.priceBeforeSubsidy&&{priceBeforeSubsidy:e.priceBeforeSubsidy},..."calendar"===e.deliveryEstimateKind&&e.deliveryTimeToShow&&{deliveryTimeToShow:e.deliveryTimeToShow,deliveryEstimateKind:"calendar"},...!!(i=e.deliveryRange)&&Number.isInteger(i.min)&&Number.isInteger(i.max)&&i.min<=i.max&&{deliveryRange:{min:e.deliveryRange.min,max:e.deliveryRange.max}},...!0===e.sandboxEstafeta&&{sandboxEstafeta:!0}}}}function q(e,t){let i=F(e,t);return i?{freight:i}:{}}var R=i(73143),_=function(e){var t,i,a;let{isOpen:l,orderData:o,initialProps:c,handleSaveData:u}=e,{dental:m}=c||{},{allFields:v,productsOnCart:h,dynamicData:C}=o,{data:b}
1=(0,s.useSession)(),[x,T]=(0,r.useState)({shipping:{}}),M={shipping:""},[F,q]=(0,r.useState)(M),[_,A]=(0,r.useState)([]),[B,L]=(0,r.useState)(!1),Z="vDtapPOnKTETjUImXtE9"===m.id,W=(null==m?void 0:null===(i=m.countryRules)||void 0===i?void 0:null===(t=i.countryCode)||void 0===t?void 0:t.toUpperCase())==="PE",{t:V}=(0,k.$G)("common"),U=(0,d.useRouter)(),G=U.query.sandboxEstafeta;return((0,r.useEffect)(()=>{l&&U.isReady&&e();async function e(){try{var e,t,i,n,r,a,l,o,d;L(!1);let s={service:null==m?void 0:null===(e=m.shipping)||void 0===e?void 0:e.service,userId:null==b?void 0:null===(t=b.user)||void 0===t?void 0:t.id,appId:null==m?void 0:m.id,sellerCEP:null==m?void 0:null===(i=m.splittedAddress)||void 0===i?void 0:i.cep,recipientCEP:null!==(o=null!==(l=v.cep)&&void 0!==l?l:null===(n=v.address)||void 0===n?void 0:n.cep)&&void 0!==o?o:null===(r=v.address)||void 0===r?void 0:r.postalCode,sellerDoc:null==m?void 0:m.doc,totalInDiscounts:function(){var e;let t=null==C?void 0:null===(e=C.discounts)||void 0===e?void 0:e.reduce((e,t)=>{var i;return e+=null==t?void 0:null===(i=t.total)||void 0===i?void 0:i.raw},0);return t>0?t.toFixed(2):0}(),products:h.map(e=>({quantity:parseInt(e.quantity)||null,price:e.price,height:e.height||null,width:e.width||null,length:e.length||null,weight:e.weight||null,internalId:e.internalId||null,title:e.title||null,categoriesTitle:e.categoriesTitle||null})),subsidy:null!==(d=null==m?void 0:null===(a=m.shipping)||void 0===a?void 0:a.subsidy)&&void 0!==d?d:null,nationalities:P.nationalities},c=await fetch((0,R.RI)(p.Y,G),{method:"POST",body:JSON.stringify(s)});if(200!==c.status||!(c=await c.json()).length||0===c.length)return T({...x,shipping:{id:"toBeConfirmed"}}),A([]),L(!0);return A(c.map(e=>(0,R.G1)(e,G))),T({...x,shipping:{}}),L(!0)}catch(e){return T({...x,shipping:{id:"toBeConfirmed"}}),A([]),L(!0)}}},[l,G,U.isReady]),l)?(0,n.jsxs)("div",{children:[B&&(0,n.jsxs)(N.Z,{onSubmit:function(e){e.preventDefault(),q(M),(E(x.shipping)||(q({...M,shipping:V("selectFreight")}),0))&&u(x)},children:[(0,n.jsxs)("ul",{className:j().paymentMethods,children:[(0,n.jsx)("li",{children:(0,n.jsx)("div",{children:(0,n.jsx)("p",{className:"mb-0 font-small-3",children:0===_.length?V("deliveryTimeNoticeToBeConfirmed"):V(W?"deliveryTimeNoticePE":"deliveryTimeNotice")})})}),_.length>0&&_.map(e=>(0,n.jsx)("li",{onClick:()=>T({...x,shipping:e}),children:(0,n.jsx)(y.Z,{children:(0,n.jsx)(w.Z,{children:(0,n.jsxs)("div",{className:j().label,children:[(0,n.jsx)(S.Z,{checked:x.shipping.ref===e.ref,type:"radio",name:"shipping",readOnly:!0}),Z&&0===e.price&&"pickUpInStore"!==e.ref?(0,n.jsxs)("div",{children:[(0,n.jsx)("h2",{className:"mb-25",children:"Entrega Expressa"}),(0,n.jsx)("p",{className:"mb-50 text-success",children:e.priceToShow}),(0,n.jsx)("p",{className:"mb-0 font-small-2",children:"pickUpInStore"===e.ref?(0,n.jsx)(O,{item:e,sellerId:m.id}):(0,n.jsxs)(n.Fragment,{children:["Previs\xe3o de entrega: ",e.deliveryTimeToShow]})})]}):(0,n.jsxs)("div",{children:[(0,n.jsx)("h2",{className:"mb-25",children:e.titleToShow}),(0,n.jsx)("p",{className:"mb-50 text-success",children:e.priceToShow}),(0,n.jsx)("p",{className:"mb-0 font-small-2",children:"pickUpInStore"===e.ref?(0,n.jsx)(O,{item:e,sellerId:m.id}):(0,n.jsxs)(n.Fragment,{children:[V(W?"freightDeliveryTimePE":"freightDeliveryTime"),": ",e.deliveryTimeToShow]})})]})]})})})},e.ref)),(0,n.jsx)(D,{seller:m,fields:x,shippingOptions:_})]}),F.shipping&&(0,n.jsx)(I.Z,{className:"d-block mb-2",children:F.shipping}),0===_.length?(0,n.jsx)(n.Fragment,{children:(null==m?void 0:null===(a=m.shipping)||void 0===a?void 0:a.allowNewOrderOutShippingRange)===!1?"":(0,n.jsx)(f.Z,{type:"submit",color:"success",children:V("actionContinue")})}):(0,n.jsx)(f.Z,{type:"submit",color:"success",children:V("actionContinue")})]}),!B&&(0,n.jsx)(g.Z,{color:"success"})]}):(0,n.jsx)("span",{})},A=i(5152),B=i.n(A),L=i(69283),Z=i(86708),W=i(82669),V=i(67954),U=(0,o.$j)(e=>({cart:e.cart}),null)(function(e){let{isOpen:t,data:i,initialProps:a,total:l,handleUpdateFields:o,...d}=e,{cart:s}=d,{dental:c}=a||{},[u,p]=(0,r.useState)({parcel:""}),[m,v]=(0,r.useState)(null);return((0,r.useEffect)(()=>
1{if(!s.isLoaded)return;let{maxNumParcel:e,priceMinParcel:t}=i;try{var r;let i=(null===(r=s[null==c?void 0:c.id])||void 0===r?void 0:r.price)/t;(i=i>e?e:Math.floor(i))<=0&&(i=1);let a=[];for(let e=1;e<=i;e++){let t=(l.raw/e).toFixed(2);a.push((0,n.jsxs)("option",{value:e,children:[e,"x de ","R$ ".concat(t.replace(".",","))]},e))}return v(a)}catch(e){console.log(e)}},[s,l]),t)?(0,n.jsx)("div",{children:(0,n.jsxs)(W.Z,{children:[(0,n.jsx)(V.Z,{for:"bankSlipWithParcel__parcel",className:"mb-25",children:(0,n.jsx)("strong",{children:"Em quantas vezes?"})}),(0,n.jsxs)(S.Z,{required:!0,type:"select",name:"select",id:"bankSlipWithParcel__parcel",value:u.parcel,onChange:e=>{var t,i;return t="parcel",i=e.target.value,void(p({...u,[t]:i}),o({[t]:i}))},children:[(0,n.jsx)("option",{value:"",children:"Selecione"}),m]})]})}):(0,n.jsx)("span",{})}),G=i(28898),J=i.n(G),z=i(76627),H=i.n(z),$=i(4883),Q=i.n($),Y=i(67421),X=(0,o.$j)(e=>({cart:e.cart}),null)(function(e){var t;let{isOpen:i,needToPersonalData:a,invalidMessages:l,handleUpdateFields:o}=e,d={cardholderDoc:"",cardholderBirthDay:"",creditCardNumber:"",creditCardName:"",creditCardValid:"",creditCardCod:""},[s,c]=(0,r.useState)(d),[u,p]=(0,r.useState)(!1),{t:m}=(0,Y.$G)("common");function y(e,t){c({...s,[e]:t}),o({[e]:t})}return((0,r.useEffect)(()=>{if(l.cardholderDoc){let e=document.getElementById("cardholderDoc");return e.blur(),e.focus()}if(l.cardholderBirthDay){let e=document.getElementById("cardholderBirthDay");return e.blur(),e.focus()}if(l.creditCardNumber){let e=document.getElementById("randomFieldCCNum");return e.blur(),e.focus()}if(l.creditCardName){let e=document.getElementById("randomFieldCCNa");return e.blur(),e.focus()}if(l.creditCardValid){let e=document.getElementById("randomFieldCCV");return e.blur(),e.focus()}if(l.creditCardCod){let e=document.getElementById("randomFieldCCC");return e.blur(),e.focus()}},[l]),(0,r.useEffect)(()=>{i?u||p(!0):(p(!1),c(d))},[i]),i)?(0,n.jsxs)("div",{children:[a&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(W.Z,{className:"mb-2",style:{paddingLeft:"calc(1em + 1rem)"},children:[(0,n.jsx)(V.Z,{for:"cardholderDoc",className:"mb-25",children:(0,n.jsx)("strong",{children:"CPF ou CNPJ do titular:"})}),(0,n.jsx)(J(),{id:"cardholderDoc",className:"form-control",value:s.cardholderDoc,onChange:e=>y("cardholderDoc",e.target.value)}),l.cardholderDoc&&(0,n.jsx)(I.Z,{className:"d-block",children:l.cardholderDoc})]}),(null===(t=s.cardholderDoc)||void 0===t?void 0:t.length)===14&&(0,n.jsxs)(W.Z,{className:"mb-2",style:{paddingLeft:"calc(1em + 1rem)"},children:[(0,n.jsx)(V.Z,{for:"cardholderBirthDay",className:"mb-25",children:(0,n.jsx)("strong",{children:"Data de nascimento do titular:"})}),(0,n.jsx)(H(),{className:"form-control",type:"tel",autoComplete:"off",id:"cardholderBirthDay",mask:"99/99/9999",value:s.cardholderBirthDay,onChange:e=>y("cardholderBirthDay",e.target.value)}),l.cardholderBirthDay&&(0,n.jsx)(I.Z,{className:"d-block",children:l.cardholderBirthDay})]})]}),(0,n.jsxs)(W.Z,{className:"mt-2 mb-2",style:{paddingLeft:"calc(1em + 1rem)"},children:[(0,n.jsx)(V.Z,{for:"randomFieldCCNum",className:"".concat(Q().label," mb-25"),children:m("labelCreditCardNumber")}),(0,n.jsx)(H(),{autoComplete:"off",className:"form-control",required:!0,type:"tel",id:"randomFieldCCNum",mask:"9999 9999 9999 9999",minLength:16,value:s.creditCardNumber,onChange:e=>y("creditCardNumber",e.target.value)}),l.creditCardNumber&&(0,n.jsx)(I.Z,{className:"d-block mb-2",children:l.creditCardNumber})]}),(0,n.jsxs)(W.Z,{className:"mb-2",style:{paddingLeft:"calc(1em + 1rem)"},children:[(0,n.jsx)(V.Z,{for:"randomFieldCCNa",className:"".concat(Q().label," mb-25"),children:m("labelCreditCardName")}),(0,n.jsx)(S.Z,{required:!0,autoComplete:"off",minLength:2,type:"text",id:"randomFieldCCNa",value:s.creditCardName,onChange:e=>y("creditCardName",e.target.value)}),l.creditCardName&&(0,n.jsx)(I.Z,{className:"d-block mb-2",children:l.creditCardName})]}),(0,n.jsxs)(v.Z,{children:[(0,n.jsx)(h.Z,{xs:12,sm:6,children:(0,n.jsxs)(W.Z,{className:"mb-2",style:{paddingLeft:"calc(1em + 1rem)"},children:[(0,n.jsx)(V.Z,{for:"randomFieldCCV",className:"".concat(Q().label," mb-25"),children:m("labelCreditCardValid")}),(0,n.jsx)(H(),{autoComplete:"off",className:"form-control",required:!0,type:"tel",id:"randomFieldCCV",mask:"99/99",value:s.creditCardValid,onChange:e=>y("creditCardValid",e.target.value)}
1),l.creditCardValid&&(0,n.jsx)(I.Z,{className:"d-block mb-2",children:l.creditCardValid})]})}),(0,n.jsx)(h.Z,{xs:12,sm:6,children:(0,n.jsxs)(W.Z,{className:"mb-2",style:{paddingLeft:"calc(1em + 1rem)"},children:[(0,n.jsx)(V.Z,{for:"randomFieldCCC",className:"".concat(Q().label," mb-25"),children:m("labelCreditCardCod")}),(0,n.jsx)(S.Z,{autoComplete:"off",required:!0,minLength:3,maxLength:4,type:"tel",id:"randomFieldCCC",value:s.creditCardCod,onChange:e=>y("creditCardCod",e.target.value)}),l.creditCardCod&&(0,n.jsx)(I.Z,{className:"d-block mb-2",children:l.creditCardCod})]})})]})]}):(0,n.jsx)("span",{})}),K=i(36595),ee=i(62968),et=function(e){let{data:t,cart:i,total:a,sellerId:l,value:o,onUpdate:d,service:s}=e,[c,u]=(0,r.useState)(null),p="A6AzXXIB6Q6Yqa5lBlhE"===l,{t:m}=(0,Y.$G)("common");return(0,r.useEffect)(()=>{try{let r,o;if(!i.isLoaded)return;if("uPlXfDU6pJjoWdr3bNnv"===l){var e;r=(e=a.raw)>1500?6:e>=800?5:e>=400?4:e>=300?3:e>=200?2:1}else{let{maxNumParcel:e,priceMinParcel:i}=t;(r=(r=a.raw/i)>e?e:Math.floor(r))<=0&&(r=1)}o="openpay"===s?(0,ee.ki)(r):Array.from({length:r},(e,t)=>t+1);let d=[];for(let e of o){let t=(a.raw/e).toFixed(2);d.push((0,n.jsxs)("option",{value:e,children:[e,"x de ","".concat(t.replace(".",","))," ",p&&"sem juros"]},e))}return u(d)}catch(e){console.log(e)}},[i,a,s]),(0,n.jsxs)(W.Z,{children:[(0,n.jsx)(V.Z,{for:"bankSlipWithParcel__parcel",className:"mb-25",children:(0,n.jsx)("strong",{children:m("installments_creditCard")})}),(0,n.jsxs)(S.Z,{required:!0,type:"select",name:"select",id:"bankSlipWithParcel__parcel",value:o,onChange:e=>d(e.target.value),children:[(0,n.jsx)("option",{value:"",children:m("select")}),c]})]})},ei=function(e){let{cart:t,total:i,value:a,onUpdate:l}=e,[o,d]=(0,r.useState)(null),s=e=>{let t=[(0,n.jsxs)("option",{value:1,children:["1x de ","R$ ".concat(e)]},1)];for(let i=2;i<=5;i++)if(e>=300+(i-2)*150){let r=(e/i).toFixed(2);t.push((0,n.jsxs)("option",{value:i,children:[i,"x de ","R$ ".concat(r)]},i))}for(let i=6;i<=10;i++)if(e>=1250+(i-6)*500){let r=(e/i).toFixed(2);t.push((0,n.jsxs)("option",{value:i,children:[i,"x de ","R$ ".concat(r)]},i))}return t};return(0,r.useEffect)(()=>{try{if(!t.isLoaded)return;d(s(i.raw))}catch(e){console.log(e)}},[t,i]),(0,n.jsxs)(W.Z,{children:[(0,n.jsx)(V.Z,{for:"bankSlipWithParcel__parcel",className:"mb-25",children:(0,n.jsx)("strong",{children:"Em quantas vezes?"})}),(0,n.jsxs)(S.Z,{required:!0,type:"select",name:"select",id:"bankSlipWithParcel__parcel",value:a,onChange:e=>l(e.target.value),children:[(0,n.jsx)("option",{value:"",children:"Selecione"}),o]})]})},en=i(50616),er=(0,o.$j)(e=>({cart:e.cart}),null)(function(e){let{isOpen:t,data:i,total:a,initialProps:l,currentFields:o,handleUpdateFields:d,...s}=e,{cart:c}=s,{dental:u,paymentMethods:p}=l||{},m={parcel:"",creditCardBrand:""},v=()=>o?{parcel:o.firstParcel||o.secondParcel||"",creditCardBrand:o.firstCardBrand||o.secondCardBrand||""}:m,h=(0,r.useMemo)(()=>v(),[o]),[y,f]=(0,r.useState)(h),[g,C]=(0,r.useState)(h.creditCardBrand),[b,x]=(0,r.useState)(!1),j=(0,r.useRef)(y),N=(0,en.LA)(i),w=(0,en.ku)(i,(null==p?void 0:p.creditCardFlags)||[]),I=(null==u?void 0:u.id)==="3Qq3nylbqe0d4fLFejA1",k=(0,r.useMemo)(()=>{let e=(null==o?void 0:o.firstCardBrand)!==void 0?"firstCard":(null==o?void 0:o.secondCardBrand)!==void 0?"secondCard":"card";return"".concat(e,"CreditCardBrand_").concat(Date.now())},[o]),T=["aura","jcb","hiper","discover"],M=(null==u?void 0:u.id)==="A6AzXXIB6Q6Yqa5lBlhE";function D(e,t){"creditCardBrand"===e&&N&&C(t);let i={...y,[e]:t};f(i),j.current=i,d(i)}return((0,r.useEffect)(()=>{t?b||x(!0):(x(!1),f(m),C(""))},[t]),(0,r.useEffect)(()=>{j.current=y},[y]),(0,r.useEffect)(()=>{if(o){let e={parcel:o.firstParcel||o.secondParcel||"",creditCardBrand:o.firstCardBrand||o.secondCardBrand||""};f(e),C(e.creditCardBrand)}},[o]),t)?(0,n.jsxs)("div",{children:[I?(0,n.jsx)(ei,{value:y.parcel,onUpdate:e=>D("parcel",e),total:a,cart:c}):(0,n.jsx)(et,{value:y.parcel,onUpdate:e=>D("parcel",e),data:i,total:a,cart:c,sellerId:null==u?void 0:u.id,service:(null==i?void 0:i.service)||""}),(0,n.jsx)(W.Z,{children:N&&(0,n.jsxs)("div",{className:"mb-2 mt-1",children:[(0,n.jsx)(V.Z,{children:(0,n.jsx)("strong",{children:"Selecione a bandeira:"})}),(0,n.jsx)(K.Z,{responsive:!0,children:(0,n.jsx)("tbody",{children:(0,n.jsx)("tr",{children:w.map(e=>M&&T.includes(e.id)?null:(0,n.jsx)("td",{children:(0,n.jsxs)("div",{className:"d-flex flex-column align-items-center",children:[(0,n.jsx)("img",{src:e.src,onClick:()=>D("creditCardBrand",e.id),style:{width:"50px",height:"50px",maxWidth:"50px",maxHeight:"50px"},alt:e.label}),(0,n.jsxs)("div",{className:"mt-50 text-center",children:[(0,n.jsx)("span",{className:"d-block text-center",children:e.label}),(0,n.jsx)(S.Z,{type:"radio",name:k,required:!0,className:"mt-50 mr-0 ml-25",checked:g===e.id,value:e.id,onChange:()=>D("creditCardBrand",e.id)})]})]})},e.id))})})})]})})]}):(0,n.jsx)("span",{})}),ea=i(40782),el=e=>{var t;let{isOpen:i,sellerId:a,orderData:l,handleUpdateFields:o,initialProps:c}=e,[u,m]=(0,r.useState)(!1),[v,h]=(0,r.useState)(""),y=(0,r.useRef)(""),f=(0,r.useRef)(null),C=(0,d.useRouter)(),{data:b}
1=(0,s.useSession)(),{paymentMethods:{methods:x=[]}={},dental:j}=c||{},{t:N}=(0,Y.$G)("common");function w(){var e,t;null===(t=f.current)||void 0===t||null===(e=t.close)||void 0===e||e.call(t),f.current=null,y.current="";let i=document.getElementById("paypal-button-container");i&&(i.innerHTML="")}function S(e){y.current=e,o({paymentReference:e})}async function I(){var e;if(!(null===(e=window)||void 0===e?void 0:e.paypal))return;w();let t=window.paypal.Buttons({expandCardForm:!0,createOrder:async()=>{m(!0);let e="ptbr"===P.language?function(e){var t;let{allFields:{name:i,lastName:n,tel:r,email:l,cep:o,street:d,number:s,complement:c,city:u,uf:p}}=e;return{sellerId:a,from:"br",payer:{name:i,lastName:n,tel:r.replace(/[()\s-]/g,""),email:l,address:{postalCode:o,addressLine1:"".concat(d,", ").concat(s),addressLine2:c,adminArea1:p,adminArea2:u}},amount:parseFloat(null==e?void 0:null===(t=e.total)||void 0===t?void 0:t.raw.toFixed(2))}}(l):function(e){var t;let{allFields:{customer:{name:i,lastName:n,tel:r,email:l},address:{postalCode:o,calle:d,numeroExterior:s,numeroInterior:c,colonia:u,estado:p,delegationMunicipio:m}}}=e;return{sellerId:a,from:"mx",payer:{name:i,lastName:n,tel:r.replace(/^(\+52)/,"").replace(/\s+/g,""),email:l,address:{postalCode:o,addressLine1:"".concat(d," ").concat(s),addressLine2:"".concat(c," ").concat(u),adminArea1:p,adminArea2:m}},amount:parseFloat(null==e?void 0:null===(t=e.total)||void 0===t?void 0:t.raw.toFixed(2))}}(l),t=await (0,L.v)("".concat(p.q,"/prePayment"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),requestedTokenType:"user"}),i=await t.json();return m(!1),S(i.id),i.id},onApprove:async(e,t)=>{m(!0);let i=(null==e?void 0:e.orderID)||y.current;S(i);let n=await (0,L.v)("".concat(p.q,"/payment"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sellerId:a,paymentReference:i,service:"paypal",kind:"creditCard"}),requestedTokenType:"user"}),r=await n.json();if("INSTRUMENT_DECLINED"===r.error){m(!1);let e=N("paypalInstrumentDeclined");return h(e),ea.Am.error(e),t.restart()}if(!(null==r?void 0:r.success)){var l;return m(!1),ea.Am.error(null!==(l=r.message)&&void 0!==l?l:N("errorAction"))}let o=r.paymentReference||i;S(o),console.log(">>> passed (success)");let d=await T(o);return d?C.push("/pedido-enviado/".concat(d)):(m(!1),ea.Am.error(N("errorAction")))},onCancel:e=>{console.log(">>> cancel"),console.log(e)},onError:e=>{console.log(">>> error"),console.log(e),ea.Am.error(N("errorAction"))}});return f.current=t,t.render("#paypal-button-container")}async function k(e,t){try{var i;let{allFields:n,productsOnCart:r,dynamicData:a,cart:l,total:o}=e,{customer:d,address:s,shipping:c}=n,u=await fetch("/api/order/setOrderV2",{method:"POST",body:JSON.stringify({sellerId:j.id,nationality:"mx",customer:{id:b.user.id,needInvoice:"true"===d.needInvoice,...d.rfc&&{rfc:d.rfc},name:d.name,lastName:d.lastName,...d.birthDate&&{birthDate:d.birthDate},...d.yearOfGraduation&&{yearOfGraduation:d.yearOfGraduation},email:d.email,tel:d.tel,...d.businessActivity&&{businessActivity:d.businessActivity},...d.postalCode&&{postalCode:d.postalCode},...d.estado&&{estado:d.estado},...d.colonia&&{colonia:d.colonia},...d.calle&&{calle:d.calle},...d.numeroExterior&&{numeroExterior:d.numeroExterior},...d.fiscalRegime&&{fiscalRegime:d.fiscalRegime},...d.cfdiUse&&{cfdiUse:d.cfdiUse},...d.rfcName&&{rfcName:d.rfcName},...d.rfcLastname&&{rfcLastname:d.rfcLastname},...d.socialReason&&{socialReason:d.socialReason},...d.occupation&&{occupation:d.occupation},...d.educationalInstitution&&{educationalInstitution:d.educationalInstitution},...d.occupationQuestion&&{occupationQuestion:d.occupationQuestion},...d.specialty&&{specialty:d.specialty}},address:{postalCode:s.postalCode,pais:s.pais,estado:s.estado,colonia:s.colonia,delegationMunicipio:s.delegationMunicipio,calle:s.calle,numeroExterior:s.numeroExterior,...s.numeroInterior&&{numeroInterior:s.numeroInterior},entreCalles:s.entreCalles,additionalInfo:s.additionalInfo},products:r.map(e=>{let{id:t,internalId:i,price:n,quantity:r,brand:a}=e;return{id:t,internalId:i,price:n,quantity:r,...a&&{brand:a}}}),discounts:O(n,a),freight:F(c,null==j?void 0:null===(i=j.shipping)||void 0===i?void 0:i.service),payment:{paymentMethod:"creditCard",paymentService:"paypal",...t&&{paymentReference:t}},total:function(e,t,i,n){let{price:r,total:a,quantity:l}=D(e,t,i,n);return{subtotal:r,total:a,quantity:l}}(n,a,l,null==o?void 0:o.raw)})}),{orderCode:p}=u=await u.json();if(!p)throw Error(N("errorAction"));return p}catch(e){return console.log(e),null}}async function T(e){try{var t,i,n;if(P.nationalities.includes("mx"))return await k(l,e);let{allFields:r,productsOnCart:o,studentListWithPricesHidden:d,giftsOnCart:s,startingAt:c,cart:u,dynamicData:v,total:h}=l,y=await (0,L.v)("".concat(p.Y,"/setOrder"),{method:"POST",requestedTokenType:"user",headers:{"Content-Type":"application/json"},body:JSON.stringify({sellerId:a,customerId:b.user.id,preOrderId:"".concat(b.user.id,"-").concat(c),adminId:null,freightService:null==j?void 0:null===(t=j.shipping)||void 0===t?void 0:t.service,willPayAfterCheckout:!1,...r,paymentMethod:"creditCard",paymentReference:e,paymentService:"paypal",discounts:O(r,v),total:D(r,v,u,null==h?void 0:h.raw),...(null===(i=u[null==j?void 0:j.id])||void 0===i?void 0:i.studentListId)&&{studentListId:null===(n=u[null==j?void 0:j.id])||void 0===n?void 0:n.studentListId},products:o.map(e=>({id:e.id,internalId:e.internalId,price:e.price,unitDiscount:0,quantity:e.quantity,...(null==e?void 0:e.smallStimulus)&&{smallStimulus:e.smallStimulus},...(null==e?void 0:e.stimulus)&&{stimulus:e.stimulus},...(null==e?void 0:e.branch)&&{branch:e.branch},title:e.title})),studentListWithPricesHidden:d.map(e=>
1({id:e.id,title:e.title,description:e.description,price:e.price.raw,quantity:e.quantity,products:e.products.map(e=>({id:e.id,internalId:e.internalId,quantity:e.quantity,price:e.price,stimulus:e.stimulus,smallStimulus:e.smallStimulus}))})),gifts:s})});if(200!==y.status)return ea.Am.error(N("errorAction")),m(!1);return y=await y.json()}catch(e){return console.log(e),null}}function M(e){return e&&new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"}).format(e)||null}function D(e,t,i,n){var r,a,l,o,d,s,c,u;let p=(null==t?void 0:null===(a=t.totalWithPaymentDiscount)||void 0===a?void 0:null===(r=a.find(t=>t.id===e.paymentMethod))||void 0===r?void 0:r.raw)||0,m=((null==t?void 0:null===(l=t.discounts)||void 0===l?void 0:l.reduce((e,t)=>{var i;return e+(null==t?void 0:null===(i=t.total)||void 0===i?void 0:i.raw)},0))||0)+((null==t?void 0:null===(o=t.discounts)||void 0===o?void 0:o.some(e=>null==e?void 0:e.notCumulativeWithPixDiscount))?0:(null==t?void 0:null===(d=t.total)||void 0===d?void 0:d.raw)-p);return{price:null==t?void 0:null===(s=t.subtotal)||void 0===s?void 0:s.raw,priceToShow:M(null==t?void 0:null===(c=t.subtotal)||void 0===c?void 0:c.raw),quantity:null===(u=i[null==j?void 0:j.id])||void 0===u?void 0:u.total,discounts:{raw:m,formatted:M(m)},total:n}}function O(e,t){var i,n,r,a,l;let o=[];(null==t?void 0:null===(i=t.discounts)||void 0===i?void 0:i.length)&&o.push(...null==t?void 0:t.discounts);let d=!(null==t?void 0:null===(n=t.discounts)||void 0===n?void 0:n.some(e=>null==e?void 0:e.notCumulativeWithPixDiscount)),s=null!=x&&null!==(r=x.find(t=>t.id===e.paymentMethod))&&void 0!==r&&!!r.discount;if(d&&s){let i=null==t?void 0:null===(a=t.totalWithPaymentDiscount)||void 0===a?void 0:a.find(t=>t.id===e.paymentMethod),n=(null==t?void 0:null===(l=t.total)||void 0===l?void 0:l.raw)-i.raw;o.push({id:i.id,name:"Desconto ".concat(i.title," (").concat(i.discount,"%)"),total:{raw:n,formatted:M(-n)}})}return o}return(0,r.useEffect)(()=>{if(!i)return;let e=setTimeout(async()=>{I()},100);return()=>{clearTimeout(e),w()}},[i,null==l?void 0:null===(t=l.total)||void 0===t?void 0:t.raw]),(0,n.jsx)(n.Fragment,{children:i&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{id:"paypal-button-container"}),v&&(0,n.jsx)("p",{style:{color:"#c0392b",marginTop:"12px"},children:v}),u&&(0,n.jsx)("div",{children:(0,n.jsx)(g.Z,{color:"success"})})]})})},eo=i(58009),ed=i(4298),es=i.n(ed);let ec=["creditCard","creditCard2","debitCard"],eu={yfgPgWkz37esRS0kr5LM:{merchantId:"mlvobipz4m4kodfkmkzt",publicApiKey:"pk_9534366b22bb436f84d57f753b138078"},n36bgGeZl5dmDDqcleCd:{merchantId:"mwotujfauxmw2wshfyvi",publicApiKey:"pk_32d5e44866f2484daa231024fec530e0"}},ep=/^[a-z0-9]{20}$/i,em=/^pk_[a-f0-9]{24,40}$/i;function ev(e,t,i){var n,r;let a=null!==(n=null==t?void 0:t.merchantId)&&void 0!==n?n:"",l=null!==(r=null==t?void 0:t.publicApiKey)&&void 0!==r?r:"",o=[];return ep.test(a)||o.push("merchantId fora do padr\xe3o (len=".concat(a.length,", esperado 20)")),em.test(l)||o.push("publicKey fora do padr\xe3o (len=".concat(l.length,", esperado pk_ + 24 a 40 hex)")),o.length&&console.warn("[openpay] credencial p\xfablica fora do padr\xe3o para o seller ".concat(e," (fonte: ").concat(i,"): ").concat(o.join("; "),". O fingerprint antifraude do OpenPay tende a falhar (antifraudkeys 401) — conferir a chave no painel do OpenPay.")),0===o.length}function eh(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;try{var n,r;if(!(null===(r=window.OpenPay)||void 0===r?void 0:null===(n=r.deviceData)||void 0===n?void 0:n.setup))return null;let a=function(e,t){let i=null==t?void 0:t.openpay;if((null==i?void 0:i.merchantId)&&(null==i?void 0:i.publicKey)){let t={merchantId:String(i.merchantId).trim(),publicApiKey:String(i.publicKey).trim()};return ev(e,t,"paymentMethods"),t}let n=eu[e];return n?(ev(e,n,"hardcoded"),n):(console.log("merchantId not founded for sellerId: ".concat(e)),null)}(e,i);if(!a)return null;window.OpenPay.setId(a.merchantId),window.OpenPay.setApiKey(a.publicApiKey),window.OpenPay.setSandboxMode(!!t);let l=window.OpenPay.deviceData.setup();return"string"==typeof l&&l.trim()?l:null}catch(e){return console.error("error on generate deviceSessionId:",e),null}}var ey=e=>{var t,i;let{sellerId:a,isSandbox:l=!1,openpayMethod:o=null,handleUpdateFields:d}
1=e,[s,c]=(0,r.useState)(()=>!!window.OpenPay),[u,p]=(0,r.useState)(()=>{var e;return!!(null===(e=window.OpenPay)||void 0===e?void 0:e.deviceData)});return(0,r.useEffect)(()=>{if(!s||!u)return;let e=eh(a,l,o);e&&d({deviceSessionId:e})},[s,u,a,l,null==o?void 0:null===(t=o.openpay)||void 0===t?void 0:t.merchantId,null==o?void 0:null===(i=o.openpay)||void 0===i?void 0:i.publicKey]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(es(),{type:"text/javascript",src:"https://resources.openpay.mx/lib/openpay-js/1.2.38/openpay.v1.min.js",onLoad:()=>c(!0),onError:()=>console.error("Failed to load OpenPay script")}),(0,n.jsx)(es(),{type:"text/javascript",src:"https://resources.openpay.mx/lib/openpay-data-js/1.2.38/openpay-data.v1.min.js",onLoad:()=>p(!0),onError:()=>console.error("Failed to load OpenPay Data script")})]})},ef=i(87462),eg=i(63366),eC=i(45697),eb=i.n(eC),ex=i(93967),ej=i.n(ex),eN=i(23663),ew=["className","cssModule","tabs","pills","vertical","horizontal","justified","fill","navbar","card","tag"],eS={tabs:eb().bool,pills:eb().bool,vertical:eb().oneOfType([eb().bool,eb().string]),horizontal:eb().string,justified:eb().bool,fill:eb().bool,navbar:eb().bool,card:eb().bool,tag:eN.iC,className:eb().string,cssModule:eb().object},eI=function(e){var t=e.className,i=e.cssModule,n=e.tabs,a=e.pills,l=e.vertical,o=e.horizontal,d=e.justified,s=e.fill,c=e.navbar,u=e.card,p=e.tag,m=(0,eg.Z)(e,ew),v=(0,eN.mx)(ej()(t,c?"navbar-nav":"nav",!!o&&"justify-content-"+o,!1!==l&&(!0===l||"xs"===l?"flex-column":"flex-"+l+"-column"),{"nav-tabs":n,"card-header-tabs":u&&n,"nav-pills":a,"card-header-pills":u&&a,"nav-justified":d,"nav-fill":s}),i);return r.createElement(p,(0,ef.Z)({},m,{className:v}))};eI.propTypes=eS,eI.defaultProps={tag:"ul",vertical:!1};var ek=["className","cssModule","active","tag"],eT={tag:eN.iC,active:eb().bool,className:eb().string,cssModule:eb().object},eM=function(e){var t=e.className,i=e.cssModule,n=e.active,a=e.tag,l=(0,eg.Z)(e,ek),o=(0,eN.mx)(ej()(t,"nav-item",!!n&&"active"),i);return r.createElement(a,(0,ef.Z)({},l,{className:o}))};eM.propTypes=eT,eM.defaultProps={tag:"li"};var eD=i(97326),eO=i(75068),eP=["className","cssModule","active","tag","innerRef"],eE={tag:eN.iC,innerRef:eb().oneOfType([eb().object,eb().func,eb().string]),disabled:eb().bool,active:eb().bool,className:eb().string,cssModule:eb().object,onClick:eb().func,href:eb().any},eF=function(e){function t(t){var i;return(i=e.call(this,t)||this).onClick=i.onClick.bind((0,eD.Z)(i)),i}(0,eO.Z)(t,e);var i=t.prototype;return i.onClick=function(e){if(this.props.disabled){e.preventDefault();return}"#"===this.props.href&&e.preventDefault(),this.props.onClick&&this.props.onClick(e)},i.render=function(){var e=this.props,t=e.className,i=e.cssModule,n=e.active,a=e.tag,l=e.innerRef,o=(0,eg.Z)(e,eP),d=(0,eN.mx)(ej()(t,"nav-link",{disabled:o.disabled,active:n}),i);return r.createElement(a,(0,ef.Z)({},o,{ref:l,onClick:this.onClick,className:d}))},t}(r.Component);eF.propTypes=eE,eF.defaultProps={tag:"a"};var eq=r.createContext({}),eR={tag:eN.iC,activeTab:eb().any,className:eb().string,cssModule:eb().object},e_=function(e){function t(t){var i;return(i=e.call(this,t)||this).state={activeTab:i.props.activeTab},i}return(0,eO.Z)(t,e),t.getDerivedStateFromProps=function(e,t){return t.activeTab!==e.activeTab?{activeTab:e.activeTab}:null},t.prototype.render=function(){var e=this.props,t=e.className,i=e.cssModule,n=e.tag,a=(0,eN.CE)(this.props,Object.keys(eR)),l=(0,eN.mx)(ej()("tab-content",t),i);return r.createElement(eq.Provider,{value:{activeTabId:this.state.activeTab}},r.createElement(n,(0,ef.Z)({},a,{className:l})))},t}(r.Component);e_.propTypes=eR,e_.defaultProps={tag:"div"};var eA=["className","cssModule","tabId","tag"],eB={tag:eN.iC,className:eb().string,cssModule:eb().object,tabId:eb().any};function eL(e){var t=e.className,i=e.cssModule,n=e.tabId,a=e.tag,l=(0,eg.Z)(e,eA);return r.createElement(eq.Consumer,null,function(e){var o=e.activeTabId;return r.createElement(a,(0,ef.Z)({},l,{className:(0,eN.mx)(ej()("tab-pane",t,{active:n===o}),i)}))})}eL.propTypes=eB,eL.defaultProps={tag:"div"};var eZ=(0,o.$j)(e=>({cart:e.cart}),null)(function(e){let{isOpen:t,data:i,needToPersonalData:a,invalidMessages:l,initialProps:o,total:d,handleUpdateFields:s}=e,[c,u]=(0,r.useState)({}),[p,m]=(0,r.useState)({}),[v,h]=(0,r.useState)(""),[y,f]=(0,r.useState)("1"),g=e=>{let t={};Object.keys(e).forEach(i=>
1{"creditCardBrand"===i?t.firstCardBrand=e[i]:"parcel"===i?t.firstParcel=e[i]:t["first".concat(i.charAt(0).toUpperCase()).concat(i.slice(1))]=e[i]});let i={...c,...t};u(i),s({...i,...p})},C=e=>{let t={};Object.keys(e).forEach(i=>{"creditCardBrand"===i?t.secondCardBrand=e[i]:"parcel"===i?t.secondParcel=e[i]:t["second".concat(i.charAt(0).toUpperCase()).concat(i.slice(1))]=e[i]});let i={...p,...t};m(i),s({...c,...i})},b=e=>(parseFloat(e.replace(/\D/g,""))/100).toLocaleString("pt-BR",{style:"currency",currency:"BRL"}),x=e=>parseFloat(e.replace(/[R$\s.]/g,"").replace(",","."))||0,j=e=>{y!==e&&f(e)};if((0,r.useEffect)(()=>{t||(u({}),m({}),h(""),f("1"))},[t]),!t)return(0,n.jsx)("span",{});let N=()=>v?x(v):0,w=()=>{let e=N();return e<=0?"":new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"}).format(e)},I=()=>{let e=N(),t=Math.max(0,(parseFloat(null==d?void 0:d.raw)||0)-e);return e<=0||t<=0?"":new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"}).format(t)};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{style:{paddingLeft:"calc(1em + 1rem)"},children:(0,n.jsxs)(eI,{tabs:!0,style:{gap:"0"},children:[(0,n.jsx)(eM,{style:{margin:"0"},children:(0,n.jsxs)(eF,{className:"1"===y?"active":"",onClick:()=>j("1"),style:{cursor:"pointer",color:"1"===y?"#495057":"#6c757d"},children:[(0,n.jsx)("strong",{children:"Cart\xe3o 1"}),w()&&(0,n.jsx)("small",{className:"d-block text-muted",children:w()})]})}),(0,n.jsx)(eM,{style:{margin:"0"},children:(0,n.jsxs)(eF,{className:"2"===y?"active":"",onClick:()=>j("2"),style:{cursor:"pointer",color:"2"===y?"#495057":"#6c757d"},children:[(0,n.jsx)("strong",{children:"Cart\xe3o 2"}),I()&&(0,n.jsx)("small",{className:"d-block text-muted",children:I()})]})})]})}),(0,n.jsxs)(e_,{activeTab:y,children:[(0,n.jsxs)(eL,{tabId:"1",children:[(0,n.jsxs)(W.Z,{style:{paddingLeft:"calc(1em + 1rem)"},children:[(0,n.jsx)(V.Z,{for:"firstCardAmount",className:"mb-25 mt-1",children:(0,n.jsx)("strong",{children:"Valor a ser cobrado no Cart\xe3o 1:"})}),(0,n.jsx)(S.Z,{type:"text",id:"firstCardAmount",placeholder:"R$ 0,00",value:v,onChange:e=>{let t=b(e.target.value),i=x(t),n=parseFloat(null==d?void 0:d.raw)||0,r=Math.max(0,n-.01);i>r?(i=r,h(new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"}).format(i))):h(t);let a={firstCardAmount:i.toFixed(2)};if(d&&i>0){let e=Math.max(.01,n-i);a.secondCardAmount=e.toFixed(2)}s({...c,...p,...a})},className:"form-control"})]}),v&&(0,n.jsxs)("div",{className:"mt-1",children:[(null==i?void 0:i.maxNumParcel)&&(null==i?void 0:i.priceMinParcel)&&(0,n.jsx)("div",{style:{paddingLeft:"calc(1em + 1rem)"},children:(0,n.jsx)(er,{total:(()=>{if(!v||!d)return d;let e=N();return{...d,raw:e,formatted:w()}})(),isOpen:t,data:i,initialProps:o,currentFields:c,handleUpdateFields:g})}),(0,n.jsx)(X,{isOpen:t,needToPersonalData:a,data:i,invalidMessages:l,initialProps:o,handleUpdateFields:g})]})]}),(0,n.jsxs)(eL,{tabId:"2",children:[I()&&(0,n.jsxs)("div",{className:"mb-1 mt-1",style:{paddingLeft:"calc(1em + 1rem)"},children:[(0,n.jsx)("strong",{children:"Valor a ser cobrado no Cart\xe3o 2: "}),(0,n.jsx)("br",{}),I()]}),v?(0,n.jsxs)("div",{className:"mt-1",children:[(null==i?void 0:i.maxNumParcel)&&(null==i?void 0:i.priceMinParcel)&&(0,n.jsx)("div",{style:{paddingLeft:"calc(1em + 1rem)"},children:(0,n.jsx)(er,{total:(()=>{if(!v||!d)return d;let e=N(),t=parseFloat(d.raw)||0;return{...d,raw:Math.max(0,t-e),formatted:I()}})(),isOpen:t,data:i,initialProps:o,currentFields:p,handleUpdateFields:C})}),(0,n.jsx)(X,{isOpen:t,needToPersonalData:a,data:i,invalidMessages:l,initialProps:o,handleUpdateFields:C})]}):(0,n.jsx)("div",{className:"mt-1",style:{paddingLeft:"calc(1em + 1rem)"},children:(0,n.jsx)("p",{children:"Informe o valor do Cart\xe3o 1 para continuar"})})]})]})]})});function eW(e){let{handleUpdate:t}=e;function i(e){t(e)}function a(){t(null)}function l(){try{let e=document.getElementById("recaptcha_element");e&&window.grecaptcha&&window.grecaptcha.enterprise?window.grecaptcha.enterprise.render(e,{sitekey:"6LeYrfQrAAAAAL8dUM53ejM76UTH6uty3QAf2Ipx",callback:i,"expired-callback":a}):setTimeout(l,100)}catch(e){setTimeout(l,100),console.log("renderRecaptcha error:",e)}}return(0,r.useEffect)(()=>(window.grecaptcha&&window.grecaptcha.enterprise?l():function e(){window.grecaptcha&&window.grecaptcha.enterprise?l():setTimeout(e,100)}(),()=>{if(window.grecaptcha&&window.grecaptcha.enterprise)try{window.grecaptcha.enterprise.reset(),a()}catch(e){console.log("reCAPTCHA cleanup error:",e)}}),[]),(0,n.jsxs)("div",{className:"mb-2",children:[(0,n.jsx)(es(),{src:"https://www.google.com/recaptcha/enterprise.js?hl=pt-BR&render=explicit"}),(0,n.jsx)("div",{id:"recaptcha_element"})]})}function eV(){return(eV=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e}).apply(this,arguments)}var eU=(0,r.forwardRef)(function(e,t){var i=e.color,n=e.size,a=void 0===n?24:n,l=function(e,t){if(null==e)return{};var i,n,r=function(e,t){if(null==e)return{};var i,n,r={},a=Object.keys(e);for(n=0;n<a.length;n++)i=a[n],t.indexOf(i)>=0||(r[i]=e[i]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)i=a[n],!(t.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}(e,["color","size"]);return r.createElement("svg",eV({ref:t,xmlns:"http://www.w3.org/2000/svg",width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:void 0===i?"currentColor":i,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},l),r.createElement("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),r.createElement("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),r.createElement("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"}))});
1eU.propTypes={color:eb().string,size:eb().oneOfType([eb().string,eb().number])},eU.displayName="AlertTriangle";var eG=i(40054),eJ=i(86690),ez=i(33105),eH=i(54213),e$=i(5028),eQ=i(12484);let eY={payment_attempt_duplicate:"paymentErrorDuplicate",payment_rate_limited:"paymentErrorRateLimited",payment_cards_limit:"paymentErrorBlocked",customer_blocked:"paymentErrorBlocked"};function eX(e,t,i){let n=eY[null==e?void 0:e.code];if(!n)return(null==e?void 0:e.message)||i;let r=Number(null==e?void 0:e.retryAfterSeconds);return t(n,{minutes:Number.isFinite(r)&&r>0?Math.ceil(r/60):30})}async function eK(e){let t="";try{t=await e.text()}catch(e){return{}}if(!t)return{};try{let e=JSON.parse(t);return e&&"object"==typeof e?e:{message:t}}catch(e){return{message:t}}}let e0=["creditCardNumber","creditCardName","creditCardValid","creditCardCod","creditCardBrand","cardholderDoc","cardholderBirthDay","firstCreditCardNumber","firstCreditCardName","firstCreditCardValid","firstCreditCardCod","firstCardBrand","firstCardholderDoc","firstCardholderBirthDay","firstCardAmount","secondCreditCardNumber","secondCreditCardName","secondCreditCardValid","secondCreditCardCod","secondCardBrand","secondCardholderDoc","secondCardholderBirthDay","secondCardAmount"],e1=["erp","paypal","pagarme","cieloapi","belluno","culqi","rede","itau","getnetglobalsep","testeV2","mercadopago"],e2=B()(()=>i.e(735).then(i.bind(i,40735)),{loadableGenerated:{webpack:()=>[40735]},ssr:!1}),e3=B()(()=>i.e(7676).then(i.bind(i,77676)),{loadableGenerated:{webpack:()=>[77676]},ssr:!1}),e5=B()(()=>i.e(9436).then(i.bind(i,69436)),{loadableGenerated:{webpack:()=>[69436]},ssr:!1}),e6=B()(()=>i.e(2518).then(i.bind(i,52518)),{loadableGenerated:{webpack:()=>[52518]},ssr:!1}),e9=B()(()=>i.e(5689).then(i.bind(i,65689)),{loadableGenerated:{webpack:()=>[65689]},ssr:!1}),e4=B()(()=>i.e(317).then(i.bind(i,20317)),{loadableGenerated:{webpack:()=>[20317]},ssr:!1}),e8=B()(()=>i.e(2294).then(i.bind(i,22294)),{loadableGenerated:{webpack:()=>[22294]},ssr:!1}),e7=B()(()=>i.e(4373).then(i.bind(i,82554)),{loadableGenerated:{webpack:()=>[82554]},ssr:!1}),te={paymentMethod:"",creditCardNumber:"",creditCardName:"",creditCardValid:"",creditCardCod:"",cardholderDoc:"",cardholderBirthDay:""};var tt=(0,o.$j)(e=>({cart:e.cart}),null)(function(e){var t,i;let{initialProps:a,paymentServices:l,isOpen:o,orderData:c,isSaving:u,handleSaveData:v,...h}=e,{data:C}
1=(0,s.useSession)(),{total:b,totalWithPaymentDiscount:x,dynamicData:I,productsOnCart:T,startingAt:M,allFields:{occupation:D,email:O,name:P,lastName:E,bornDay:F,doc:q,rg:R,ie:_,tel:A,cep:B,street:W,number:V,complement:G,district:J,city:z,uf:H,additionalInfo:$,shipping:Q,sessionId:Y}}=c,{allFields:K}=c,{delegationMunicipio:ee,calle:et,estado:ei,postalCode:en}=(null==K?void 0:K.address)||{},{cart:ea}=h,{paymentMethods:{methods:ed=[]}={},dental:es,themeSettings:eu,fieldsToHide:ep}=a||{},[em,ev]=(0,r.useState)({paymentMethod:null,paymentReference:""}),ef=(null==es?void 0:es.id)==="3Qq3nylbqe0d4fLFejA1",[eg,eC]=(0,r.useState)(!1),eb=(0,r.useRef)(!1),[ex,ej]=(0,r.useState)(te),[eN,ew]=(0,r.useState)({}),[eS,eI]=(0,r.useState)([]),ek=(null==es?void 0:es.id)==="EJYt3GqeNaTP4U42Wazz",eT=e=>ek&&"bankSlip"===e.id&&(null==b?void 0:b.raw)<200,eM=(null==eN?void 0:eN.service)==="belluno"||(null==eN?void 0:eN.antiFraudService)==="totalClearSale",{t:eD}=(0,k.$G)("common"),eO={asyncToken:!1,triedGettingToken:!1,tokenIsValid:!1,creatingToken:!1},[eP,eE]=(0,r.useState)(eO),[eF,eq]=(0,r.useState)(null),{sandbox:eR}=(0,d.useRouter)().query,e_=(0,eJ.DY)({sandboxQuery:eR}),eA=(0,eG.qd)(null==es?void 0:null===(t=es.countryRules)||void 0===t?void 0:t.currency),eB=(0,r.useRef)(null),eL=(0,r.useRef)(null),eV=(0,r.useRef)(!1),eY=(0,r.useRef)(null),tt=(0,r.useRef)(null),[ti,tn]=(0,r.useState)(!1),[tr,ta]=(0,r.useState)("loading"),[tl,to]=(0,r.useState)("");async function td(e){return await (0,L.v)("".concat(p.q,"/payment"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({service:"rede",sellerId:es.id,hasRecaptchaV2:null==es?void 0:es.hasRecaptchaV2,recaptchaToken:eF,kind:em.paymentMethod,paymentReference:e,amount:th(eN),...("creditCard"===em.paymentMethod||"creditCard2"===em.paymentMethod)&&"1"!==em.parcel&&{installments:Number.parseInt(em.parcel)},...("creditCard"===em.paymentMethod||"creditCard2"===em.paymentMethod)&&{caldholderName:em.creditCardName,cardNumber:em.creditCardNumber.replace("_","").split(" ").join(""),expiration:em.creditCardValid,securityCode:em.creditCardCod}}),requestedTokenType:"user"})}async function ts(e){let t={sellerId:es.id,service:"maxipago",paymentReference:e,kind:em.paymentMethod,amount:th(eN)};if("bankSlip"===em.paymentMethod&&(t={...t,payer:{email:O,name:P,lastName:E,doc:q,tel:A,address:{cep:B,street:W,number:V,complement:G,district:J,city:z,uf:H}}}),"creditCard"===em.paymentMethod||"creditCard2"===em.paymentMethod){var i,n;(0,eQ.o)(eN)&&em.sessionId&&(t={...t,sessionId:em.sessionId}),"totalClearSale"===eN.antiFraudService&&(t={...t,sessionId:em.sessionId,brand:em.credit
1CardBrand,caldholderName:em.creditCardName,cardholderBirthDay:em.cardholderBirthDay,cardholderDoc:em.cardholderDoc,expirationMonth:tj(em.creditCardValid),expirationYear:tN(em.creditCardValid),shipping:Q,items:T.map(e=>({internalId:e.internalId,title:e.title,price:e.price,quantity:e.quantity})),payer:{...null==t?void 0:t.payer,id:C.user.id,rg:R,ie:_,address:{...null==t?void 0:null===(n=t.payer)||void 0===n?void 0:n.address,additionalInfo:$}}}),t={...t,installments:Number.parseInt(em.parcel),cardNumber:em.creditCardNumber.replace("_","").split(" ").join(""),expiration:em.creditCardValid,securityCode:em.creditCardCod,ipAddress:await tv(),antiFraudService:eN.antiFraudService,payer:{...null==t?void 0:t.payer,email:O,name:P,lastName:E,doc:q,tel:A,bornDay:F,address:{...null==t?void 0:null===(i=t.payer)||void 0===i?void 0:i.address,cep:B,street:W,number:V,complement:G,district:J,city:z,uf:H}}}}return await (0,L.v)("".concat(p.q,"/payment"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),requestedTokenType:"user"})}async function tc(e){let t={sellerId:es.id,service:"inove",paymentReference:e,kind:em.paymentMethod,amount:th(eN),items:T.map(e=>({internalId:e.internalId,title:e.title,price:e.price,quantity:e.quantity})),payer:{name:P,lastName:E,doc:q,address:{cep:B,street:W,number:V,complement:G,district:J,city:z,uf:H}}};return("creditCard"===em.paymentMethod||"creditCard2"===em.paymentMethod)&&(t={...t,installments:Number.parseInt(em.parcel),cardNumber:em.creditCardNumber.replace("_","").split(" ").join(""),caldholderName:em.creditCardName,expiration:em.creditCardValid,securityCode:em.creditCardCod,brand:em.credit
1CardBrand}),await (0,L.v)("".concat(p.q,"/payment"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),requestedTokenType:"user"})}async function tu(){let e={};return"pix"===em.paymentMethod&&(e={sellerId:es.id,service:"belluno",hasRecaptchaV2:null==es?void 0:es.hasRecaptchaV2,recaptchaToken:eF,kind:em.paymentMethod,amount:th(eN),payer:{email:O,name:P,lastName:E,doc:q,tel:A},items:T.map(e=>({title:e.title,price:e.price,quantity:e.quantity}))}),"bankSlip"===em.paymentMethod&&(e={sellerId:es.id,service:"belluno",hasRecaptchaV2:null==es?void 0:es.hasRecaptchaV2,recaptchaToken:eF,kind:em.paymentMethod,amount:th(eN),payer:{email:O,name:P,lastName:E,doc:q,tel:A,address:{cep:B,street:W,number:V}},items:T.map(e=>({title:e.title,price:e.price,quantity:e.quantity}))}),("creditCard"===em.paymentMethod||"creditCard2"===em.paymentMethod)&&(e={sellerId:es.id,service:"belluno",hasRecaptchaV2:null==es?void 0:es.hasRecaptchaV2,recaptchaToken:eF,sessionId:em.sessionId,kind:em.paymentMethod,amount:th(eN),installments:Number.parseInt(em.parcel),cardholderName:em.creditCardName,cardNumber:em.creditCardNumber.split(" ").join(""),expiration:em.creditCardValid,securityCode:em.creditCardCod,cardholderDoc:em.cardholderDoc,cardholderBirthDay:em.cardholderBirthDay,brand:em.credit
1CardBrand,ipAddress:await tv(),payer:{id:C.user.id,email:O,name:P,lastName:E,doc:q,tel:A,address:{cep:B,street:W,number:V,complement:G,city:z,uf:H}},items:T.map(e=>({title:e.title,price:e.price,quantity:e.quantity}))}),await (0,L.v)("".concat(p.q,"/payment"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),requestedTokenType:"user"})}async function tp(e){let t={};return"pix"===em.paymentMethod&&(t={paymentReference:e,productsOnCart:T,shipping:Q,sellerId:es.id,service:"bempaggo",kind:em.paymentMethod,amount:th(eN),payer:{name:P,lastName:E,doc:q}}),"bankSlip"===em.paymentMethod&&(t={paymentReference:e,productsOnCart:T,shipping:Q,sellerId:es.id,service:"bempaggo",kind:em.paymentMethod,amount:th(eN),payer:{name:P,lastName:E,doc:q,address:{cep:B,street:W,number:V,complement:G,district:J,city:z,uf:H}}}),("creditCard"===em.paymentMethod||"creditCard2"===em.paymentMethod)&&(t={paymentReference:e,productsOnCart:T,shipping:Q,sellerId:es.id,service:"bempaggo",kind:em.paymentMethod,amount:th(eN),installments:Number.parseInt(em.parcel),cardHolderName:em.creditCardName,cardNumber:em.creditCardNumber.split(" ").join(""),expiration:em.creditCardValid,securityCode:em.creditCardCod,ipAddress:await tv(),payer:{name:P,lastName:E,doc:q,email:O,tel:A,address:{cep:B,street:W,number:V,complement:G,district:J,city:z,uf:H},device:{screenWidth:window.screen.width,screenHeight:window.screen.height,timeZoneOffset:new Date().getTimezoneOffset()}}}),await (0,L.v)("".concat(p.q,"/payment"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),requestedTokenType:"user"})}async function tm(e){let t={};return("debitCard"===em.paymentMethod||"creditCard"===em.paymentMethod||"creditCard2"===em.paymentMethod)&&(t={sellerId:es.id,service:"openpay",kind:em.paymentMethod,amount:th(eN),paymentReference:e,cardholderName:em.creditCardName,cardNumber:em.creditCardNumber.split(" ").join(""),expiration:em.creditCardValid,securityCode:em.creditCardCod,ipAddress:await tv(),device_session_id:em.deviceSessionId||tt.current,installments:Number.parseInt(em.parcel),sandbox:eR,payer:{id:C.user.id,email:c.allFields.customer.email,name:c.allFields.customer.name,lastName:c.allFields.customer.lastName,doc:c.allFields.customer.doc,tel:c.allFields.customer.tel,address:{cep:en,street:et,city:ee,state:ei}},items:T.map(e=>({title:e.title,price:e.price,quantity:e.quantity}))}),("pix"===em.paymentMethod||"pix2"===em.paymentMethod)&&(t={sellerId:es.id,service:"openpay",kind:"pix",amount:th(eN),paymentReference:e,ipAddress:await tv(),sandbox:eR,payer:{id:C.user.id,email:c.allFields.customer.email,name:c.allFields.customer.name,lastName:c.allFields.customer.lastName,tel:c.allFields.customer.tel}}),await (0,L.v)("".concat(p.q,"/payment"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),requestedTokenType:"user"})}async function tv(){let e=await fetch("https://ipinfo.io/json?token=05481542f7863f",{method:"GET"});return(e=await e.json()).ip}function th(e){try{var t,i;if((null==I?void 0:null===(t=I.discounts)||void 0===t?void 0:t.some(e=>null==e?void 0:e.notCumulativeWithPixDiscount))||!(null==e?void 0:e.discount))return Number.parseFloat(b.raw.toFixed(2));return Number.parseFloat(null===(i=x.find(t=>t.id===e.id))||void 0===i?void 0:i.raw.toFixed(2))}catch(e){return 0}}async function ty(e){let t;return"pix"===em.paymentMethod&&(t={service:eN.service,sellerId:es.id,kind:em.paymentMethod,paymentReference:e,amount:th(eN),payer:{name:P,lastName:E,doc:q}}),"bankSlip"===em.paymentMethod&&(t={service:eN.service,sellerId:es.id,kind:em.paymentMethod,paymentReference:e,amount:th(eN),payer:{name:P,lastName:E,doc:q,address:{cep:B,street:W,number:V,complement:G,district:J,city:z,uf:H}}}),("creditCard"===em.paymentMethod||"creditCard2"===em.paymentMethod)&&(t="cybersource"===eN.antiFraudService?{service:eN.service,sellerId:es.id,kind:em.paymentMethod,paymentReference:e,installments:Number.parseInt(em.parcel),cardNumber:em.creditCardNumber.replace("_","").split(" ").join(""),caldholderName:em.creditCardName,expirationMonth:tj(em.credit
1CardValid),expirationYear:tN(em.creditCardValid),securityCode:em.creditCardCod,brand:em.creditCardBrand,amount:th(eN),ipAddress:await tv(),sessionId:Y,antiFraudService:eN.antiFraudService,items:T.map(e=>({internalId:e.internalId,title:e.title,price:e.price,quantity:e.quantity})),payer:{name:P,lastName:E,bornDay:F,email:O,tel:A,doc:q,address:{cep:B,street:W,number:V,complement:G,district:J,city:z,uf:H}}}:{service:eN.service,sellerId:es.id,kind:em.paymentMethod,paymentReference:e,installments:Number.parseInt(em.parcel),cardNumber:em.creditCardNumber.replace("_","").split(" ").join(""),caldholderName:em.creditCardName,expirationMonth:tj(em.creditCardValid),expirationYear:tN(em.creditCardValid),securityCode:em.creditCardCod,brand:em.creditCardBrand,amount:th(eN),payer:{name:P,lastName:E}}),await (0,L.v)("".concat(p.q,"/payment"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),requestedTokenType:"user"})}async function tf(e){let t;return"pix"===em.paymentMethod&&(t={service:"pagbank",sellerId:es.id,kind:em.paymentMethod,paymentReference:e,amount:th(eN),payer:{name:P,lastName:E,email:O,doc:q}}),"bankSlip"===em.paymentMethod&&(t={service:"pagbank",sellerId:es.id,kind:em.paymentMethod,paymentReference:e,amount:th(eN),payer:{name:P,lastName:E,email:O,doc:q,address:{cep:B,street:W,number:V,complement:G,district:J,city:z,uf:H}}}),("creditCard"===em.paymentMethod||"creditCard2"===em.paymentMethod)&&(t={service:"pagbank",sellerId:es.id,kind:em.paymentMethod,paymentReference:e,amount:th(eN),installments:Number.parseInt(em.parcel),paymentToken:em.paymentToken,payer:{name:P,lastName:E,email:O,doc:q}}),await (0,L.v)("".concat(p.q,"/payment"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),requestedTokenType:"user"})}async function tg(e){let t;return"pix"===em.paymentMethod&&(t={service:"getnet",sellerId:es.id,kind:em.paymentMethod,paymentReference:e,amount:th(eN),payer:{id:C.user.id}}),"bankSlip"===em.paymentMethod&&(t={service:"getnet",sellerId:es.id,kind:em.paymentMethod,paymentReference:e,amount:th(eN),payer:{name:P,lastName:E,doc:q,address:{cep:B,street:W,number:V,complement:G,district:J,city:z,uf:H}}}),("creditCard"===em.paymentMethod||"creditCard2"===em.paymentMethod)&&(t={service:"getnet",sellerId:es.id,kind:em.paymentMethod,paymentReference:e,ipAddress:await tv(),sessionId:em.sessionId,amount:th(eN),installments:Number.parseInt(em.parcel),caldholderName:em.creditCardName,cardNumber:em.creditCardNumber.split(" ").join(""),expiration:em.creditCardValid,securityCode:em.creditCardCod,brand:em.credit
1CardBrand,payer:{id:C.user.id,name:P,lastName:E,email:O,doc:q,tel:A,address:{cep:B,street:W,number:V,complement:G,district:J,city:z,uf:H}}}),await (0,L.v)("".concat(p.q,"/payment"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),requestedTokenType:"user"})}async function tC(e){let t;return"pix"===em.paymentMethod&&(t={service:"getnetglobalsep",sellerId:es.id,kind:em.paymentMethod,paymentReference:e,amount:th(eN),payer:{id:C.user.id}}),"bankSlip"===em.paymentMethod&&(t={service:"getnetglobalsep",sellerId:es.id,kind:em.paymentMethod,paymentReference:e,amount:th(eN),payer:{name:P,lastName:E,doc:q,address:{cep:B,street:W,number:V,complement:G,district:J,city:z,uf:H}}}),"creditCard"===em.paymentMethod&&(t={service:"getnetglobalsep",sellerId:es.id,kind:em.paymentMethod,paymentReference:e,ipAddress:await tv(),sessionId:em.getnetSessionId,antiFraudService:eN.antiFraudService,amount:th(eN),installments:Number.parseInt(em.parcel),caldholderName:em.creditCardName,cardNumber:em.creditCardNumber.split(" ").join(""),expiration:em.creditCardValid,securityCode:em.creditCardCod,brand:em.credit
1CardBrand,payer:{id:C.user.id,name:P,lastName:E,email:O,doc:q,tel:A,address:{cep:B,street:W,number:V,complement:G,district:J,city:z,uf:H}}},"totalClearSale"===eN.antiFraudService&&(t={...t,clearSaleSessionId:em.sessionId,cardholderBirthDay:em.cardholderBirthDay,cardholderDoc:em.cardholderDoc,items:T.map(e=>({internalId:e.internalId,title:e.title,price:e.price,quantity:e.quantity})),shipping:Q,payer:{...t.payer,rg:R,ie:_,address:{...t.payer.address,additionalInfo:$}}})),"creditCardCombined"===em.paymentMethod&&(t={service:"getnetglobalsep",sellerId:es.id,kind:em.paymentMethod,paymentReference:e,ipAddress:await tv(),sessionId:em.getnetSessionId,amount:th(eN),cards:[{amount:parseFloat(em.firstCardAmount)||0,caldholderName:em.firstCreditCardName,cardNumber:(em.firstCreditCardNumber||"").split(" ").join(""),expiration:em.firstCreditCardValid,securityCode:em.firstCreditCardCod,brand:em.firstCardBrand,cardholderDoc:em.firstCardholderDoc,cardholderBirthDay:em.firstCardholderBirthDay},{amount:parseFloat(em.secondCardAmount)||0,caldholderName:em.secondCreditCardName,cardNumber:(em.secondCreditCardNumber||"").split(" ").join(""),expiration:em.secondCreditCardValid,securityCode:em.secondCreditCardCod,brand:em.secondCardBrand,cardholderDoc:em.secondCardholderDoc,cardholderBirthDay:em.secondCardholderBirthDay}],payer:{id:C.user.id,name:P,lastName:E,email:O,doc:q,tel:A,address:{cep:B,street:W,number:V,complement:G,district:J,city:z,uf:H}},antiFraudService:eN.antiFraudService},"totalClearSale"===eN.antiFraudService&&(t={...t,clearSaleSessionId:em.sessionId,items:T.map(e=>({internalId:e.internalId,title:e.title,price:e.price,quantity:e.quantity})),shipping:Q,payer:{...t.payer,rg:R,ie:_,address:{...t.payer.address,additionalInfo:$}}})),await (0,L.v)("".concat(p.q,"/payment"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),requestedTokenType:"user"})}async function tb(e){let t={service:"sicoob",sellerId:es.id,kind:em.paymentMethod,paymentReference:e,amount:th(eN),payer:{name:P,lastName:E,email:O,doc:q,address:{cep:B,street:W,number:V,complement:G,district:J,city:z,uf:H}}};return await (0,L.v)("".concat(p.q,"/payment"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),requestedTokenType:"user"})}async function tx(e,t){try{let i;if("rede"===e.service&&(i=await td(t)),"braspag"===e.service&&(i=await ty(t)),"maxipago"===e.service&&(i=await ts(t)),"pagbank"===e.service&&(i=await tf(t)),"getnet"===e.service&&(i=await tg(t)),"getnetglobalsep"===e.service&&(i=await tC(t)),"inove"===e.service&&(i=await tc(t)),"sicoob"===e.service&&(i=await tb(t)),"belluno"===e.service&&(i=await tu()),"bempaggo"===e.service&&(i=await tp(t)),"openpay"===e.service&&(i=await tm(t)),(null==i?void 0:i.status)!==200){let e=await eK(i);return ej({...te,paymentMethod:eX(e,eD,"Ocorreu um erro na tentativa de pagamento. Confira os dados informados e tente novamente!")}),null}let n=await i.json();return delete n.success,n}catch(e){return console.log(e),ej({...te,paymentMethod:"Ocorreu um erro na tentativa de pagamento. Tente novamente mais tarde!"}),null}}function tj(e){return Number.parseInt(e.split("/")[0])}function tN(e){return Number.parseInt(e.split("/")[1])}async function tw(){try{await (0,L.v)("".concat(p.Y,"/setPreOrder"),{method:"POST",requestedTokenType:"user",headers:{"Content-Type":"application/json"},body:JSON.stringify({sellerId:null==es?void 0:es.id,customerId:C.user.id,preOrderId:"".concat(C.user.id,"-").concat(M),startingAt:M,email:O,stepId:"payment",amount:th(eN),discounts:function(){var e,t,i,n,r;let a=[];(null==I?void 0:null===(e=I.discounts)||void 0===e?void 0:e.length)&&a.push(...null==I?void 0:I.discounts);let l=!(null==I?void 0:null===(t=I.discounts)||void 0===t?void 0:t.some(e=>null==e?void 0:e.notCumulativeWithPixDiscount)),o=null!=ed&&null!==(i=ed.find(e=>e.id===em.paymentMethod))&&void 0!==i&&!!i.discount;if(l&&o){let e=null==I?void 0:null===(n=I.totalWithPaymentDiscount)||void 0===n?void 0:n.find(e=>e.id===em.paymentMethod),t=(null==I?void 0:null===(r=I.total)||void 0===r?void 0:r.raw)-e.raw;a.push({id:e.id,name:"Desconto ".concat(e.title," (").concat(e.discount,"%)"),total:t})}return a}()})})}catch(e){console.log(e)}}async function tS(e,t){try{var i;if(console.log("!!!service: ".concat(eN.service)),null==e||e.preventDefault(),eb.current||eg||u)return;if(eb.current=!0,eC(!0),ej(te),!em.paymentMethod&&(ej({...te,paymentMethod:"Selecione a forma de pagamento"}),1)){eb.current=!1,eC(!1);return}let n={...t&&{paymentReference:t}};
1if("pagarme"!==eN.service&&"cieloapi"!==eN.service&&"belluno"!==eN.service&&"culqi"!==eN.service&&"rede"!==eN.service&&"itau"!==eN.service&&"getnetglobalsep"!==eN.service&&"testeV2"!==eN.service&&await tw(),!function(e){var t,i,n,r;if("openpay"===e&&ec.includes(em.paymentMethod)&&!function(){let e=em.deviceSessionId||eh(null==es?void 0:es.id,e_,eN);return e?(tt.current=e,em.deviceSessionId||ev(t=>({...t,deviceSessionId:e})),!0):(ej({...te,paymentMethod:eD("paymentErrorOpenPayDevice")}),!1)}())return!1;if(!(e&&("creditCard"===em.paymentMethod||"debitCard"===em.paymentMethod)&&"paypal"!==e))return!0;if(ej(te),"culqi"===e){let e=em.sourceId;return!!e&&""!==String(e).trim()||(ej({...te,paymentMethod:'Use o bot\xe3o "Pagar com cart\xe3o", preencha o formul\xe1rio da Culqi e gere o token antes de finalizar o pedido.'}),!1)}if("creditCardCombined"===em.paymentMethod)return function(){let e=e=>{var t;let i=em["".concat(e,"CreditCardNumber")],n=em["".concat(e,"CreditCardName")],r=em["".concat(e,"CreditCardValid")],a=em["".concat(e,"CreditCardCod")],l=em["".concat(e,"CardAmount")];if(!l||0>=parseFloat(l))return ej({...te,paymentMethod:"Informe um valor v\xe1lido para o ".concat("first"===e?"primeiro":"segundo"," cart\xe3o")}),!1;if(!i||!/^(?:\d{4} ){3}\d{3}$|^(?:\d{4} ){3}\d{4}$/.test(i.replace("_","")))return ej({...te,paymentMethod:"O n\xfamero do ".concat("first"===e?"primeiro":"segundo"," cart\xe3o \xe9 inv\xe1lido")}),!1;let o=null==n?void 0:null===(t=n.split(" "))||void 0===t?void 0:t.filter(e=>e);return!o||o.length<2?(ej({...te,paymentMethod:"Digite o nome completo do ".concat("first"===e?"primeiro":"segundo"," cart\xe3o")}),!1):r&&/^(\d\/?){4}$/.test(r)?!!(a&&/\d{3}/.test(a))||(ej({...te,paymentMethod:"O c\xf3digo de seguran\xe7a do ".concat("first"===e?"primeiro":"segundo"," cart\xe3o \xe9 inv\xe1lido")}),!1):(ej({...te,paymentMethod:"A validade do ".concat("first"===e?"primeiro":"segundo"," cart\xe3o \xe9 inv\xe1lida")}),!1)},t=e("first"),i=e("second");if(!t||!i)return!1;let n=parseFloat(em.firstCardAmount)||0,r=parseFloat(em.secondCardAmount)||0;return!(Math.abs(n+r-(parseFloat(null==b?void 0:b.raw)||0))>.01)||(ej({...te,paymentMethod:"A soma dos valores dos cart\xf5es deve ser igual ao total do pedido"}),!1)}();if(eM&&!(0,Z.eR)(em.cardholderDoc))return ej({...te,cardholderDoc:"Documento inv\xe1lido"}),!1;let a=null===(r=em.cardholderBirthDay)||void 0===r?void 0:null===(n=r.split("/"))||void 0===n?void 0:null===(i=n.join(""))||void 0===i?void 0:null===(t=i.split("_"))||void 0===t?void 0:t.join("");return eM&&14===em.cardholderDoc.length&&(null==a?void 0:a.length)<8?(ej({...te,cardholderBirthDay:"Informe uma data v\xe1lida"}),!1):/^(?:\d{4} ){3}\d{3}$|^(?:\d{4} ){3}\d{4}$/.test(em.creditCardNumber.replace("_",""))?em.creditCardName.split(" ").filter(e=>e).length<2?(ej({...te,creditCardName:"Digite o Nome Completo exibido no cart\xe3o"}),!1):/^(\d\/?){4}$/.test(em.creditCardValid)?!!/\d{3}/.test(em.creditCardCod)||(ej({...te,creditCardCod:"O C\xf3digo de Seguran\xe7a geralmente cont\xe9m 3 n\xfameros"}),!1):(ej({...te,creditCardValid:"A validade do cart\xe3o \xe9 no formato MM/AA (m\xeas/ano)"}),!1):(ej({...te,creditCardNumber:"O N\xfamero do Cart\xe3o possui no m\xednimo 15 d\xedgitos"}),!1)}(eN.service)){eb.current=!1,eC(!1);return}if((0,eH.i5)({paymentDetail:eN,paymentMethod:em.paymentMethod}))try{to(""),ta("loading"),tn(!0),eY.current=new AbortController;let e=em.paymentIpAddress;if(!e)try{e=await tv()}catch(e){console.error("Failed to resolve client IP for Cielo 3DS",{error:e instanceof Error?e.message:"Unknown error"})}n=await (0,e$.b1)({paymentDetail:eN,paymentMethod:em.paymentMethod,fields:{...em,paymentIpAddress:e},orderData:c,dental:es,amount:th(eN),sandbox:"true"===eR||!0===eR,abortSignal:eY.current.signal,onChallengeStart:()=>{tn(!1)},paymentData:n}),tn(!1)}catch(e){console.error("Cielo 3DS checkout authentication failed",{retryable:null==e?void 0:e.retryable,code:null==e?void 0:e.code,message:null==e?void 0:e.message}),ta("error"),tn(!0),to("N\xe3o foi poss\xedvel concluir a autentica\xe7\xe3o banc\xe1ria. Tente novamente."),eb.current=!1,eC(!1);return}if((i=null==eN?void 0:eN.service)&&!e1.includes(i)){let e=String(new Date().getTime());if(!(n=await tx(eN,e))){eb.current=!1,eC(!1);return}}await v({...em,...n,total:th(eN),paymentDetail:eN})}catch(e){console.log(e)}finally{eb.current=!1,eC(!1)}}return(eB.current=tS,(0,r.useEffect)(()=>{(null==eS?void 0:eS.length)&&ew(eS.find(e=>e.id===em.paymentMethod))},[em.paymentMethod]),(0,r.useEffect)(()=>{let e=null==eS?void 0:eS.find(e=>e.id===em.paymentMethod);(null==e?void 0:e.service)==="culqi"&&((null==e?void 0:e.id)==="creditCard"||(null==e?void 0:e.id)==="creditCard2"||(null==e?void 0:e.id)==="debitCard")||(eL.current=null,eV.current=!1)},[em.paymentMethod,eS]),(0,r.useEffect)(()=>{var e;eV.current&&(null==eN?void 0:eN.service)==="culqi"&&em.sourceId&&(eV.current=!1,null===(e=eB.current)||void 0===e||e.call(eB))},[em.sourceId,null==eN?void 0:eN.service]),(0,r.useEffect)(()=>
1{if(ea.isLoaded)return eI(ed.filter(e=>{let t=e.sandbox;if(!0===t)return"true"===eR;if(!1===t)return null==eR||"false"===eR;if("paymentOnDelivery"===e.id){let t=Array.isArray(null==e?void 0:e.specificShipping)?e.specificShipping:[];return 0===t.length||null!=Q&&!!Q.id&&t.includes(null==Q?void 0:Q.id)}return!0}).map(e=>{let t=function(e){try{if("bankSlipWithParcel"===e.id){var t,i;return(null===(t=ea[null==es?void 0:es.id])||void 0===t?void 0:t.price)<(null==e?void 0:e.priceMinParcel)||(null===(i=ea[null==es?void 0:es.id])||void 0===i?void 0:i.price)<(null==e?void 0:e.priceMinPurchase)}return th(e)<(null==e?void 0:e.priceMinPurchase)}catch(e){return console.log(e),!1}}(e);return{...e,isDisabled:t,messageDisabled:function(e,t){if(e){if(null==t?void 0:t.priceMinParcel){let e=(0,eG.xG)(t.priceMinParcel,eA)||null;return"* Parcela m\xednima de <strong>".concat(e,"</strong> n\xe3o atingida.")}if(null==t?void 0:t.priceMinPurchase){let e=(0,eG.xG)(t.priceMinPurchase,eA)||null;return"* Compra m\xednima de <strong>".concat(e,"</strong> n\xe3o atingida.")}return"Algum crit\xe9rio n\xe3o foi atendido."}}(t,e)}}))},[ed,ea,x,null==Q?void 0:Q.id,eR]),(0,r.useEffect)(()=>{var e,t,i;if(em.paymentMethod){if("creditCard"!==em.paymentMethod||(null==eN?void 0:eN.service)!=="pagarme")return eE(eO);eE({asyncToken:!0,triedGettingToken:null!==(e=em.triedGettingToken)&&void 0!==e?e:eO.triedGettingToken,tokenIsValid:null!==(t=em.tokenIsValid)&&void 0!==t?t:eO.tokenIsValid,creatingToken:null!==(i=em.creatingToken)&&void 0!==i?i:eO.creatingToken})}},[null==em?void 0:em.triedGettingToken,null==em?void 0:em.tokenIsValid,null==em?void 0:em.creatingToken,null==em?void 0:em.paymentMethod,eN]),(0,r.useEffect)(()=>{em.paymentMethod&&ej(te)},[em.paymentMethod]),o)?(0,n.jsxs)("div",{style:{marginBottom:"4rem"},children:[(0,n.jsxs)(N.Z,{onSubmit:tS,autoComplete:"off",children:[(0,n.jsx)("input",{autoComplete:"false",name:"hidden",type:"text",style:{display:"none"}}),(0,n.jsx)("ul",{className:j().paymentMethods,children:(!D||(null==ep?void 0:ep.includes("occupation"))?eS:eS.filter(e=>(null==e?void 0:e.allowedOccupations)&&(null==e?void 0:e.allowedOccupations.length)>0?e.allowedOccupations.includes(D):e)).map((e,t)=>{var i,r,o,d;return(0,n.jsx)(n.Fragment,{children:!eT(e)&&(0,n.jsxs)("li",{className:"".concat(e.isDisabled?j().isDisabled:""," ").concat(e.hasClicked?j().hasClicked:""),onClick:()=>(function(e,t){if(e.isDisabled){let e=JSON.parse(JSON.stringify(eS));return e[t]={...e[t],hasClicked:!0},eI(e)}return e.id===em.paymentMethod?ev({...em,paymentMethod:e.id}):ev({...function(e){let t={...e};return e0.forEach(e=>{delete t[e]}),t}(em),paymentMethod:e.id})})(e,t),children:["mercadopago"===e.service&&("creditCard"===e.id||"creditCard2"===e.id)&&(0,n.jsx)(e2,{fields:em,sellerId:null==es?void 0:es.id,sandbox:e_,handleUpdateFields:e=>ev({...em,...e})}),"pagarme"===e.service&&"creditCard"===e.id&&(0,n.jsx)(e3,{fields:em,sellerId:null==es?void 0:es.id,handleUpdateFields:e=>ev({...em,...e})}),"pagbank"===e.service&&"creditCard"===e.id&&(0,n.jsx)(e5,{fields:em,sellerId:null==es?void 0:es.id,handleUpdateFields:e=>ev({...em,...e})}),"getnet"===e.service&&"creditCard"===e.id&&(0,n.jsx)(e4,{sellerId:null==es?void 0:es.id,handleUpdateFields:e=>ev({...em,...e})}),"getnetglobalsep"===e.service&&"creditCard"===e.id&&(0,n.jsx)(e8,{sellerId:null==es?void 0:es.id,handleUpdateFields:e=>ev({...em,...e})}),"getnetglobalsep"===e.service&&"creditCardCombined"===e.id&&(0,n.jsx)(e8,{sellerId:null==es?void 0:es.id,handleUpdateFields:e=>ev({...em,...e})}),(0,eQ.o)(e)&&(0,n.jsx)(e6,{sellerId:null==es?void 0:es.id,handleUpdateFields:e=>ev({...em,...e})}),"belluno"===e.service&&"creditCard"===e.id&&(0,n.jsx)(e9,{handleUpdateFields:e=>ev({...em,...e})}),(0,n.jsx)(y.Z,{children:(0,n.jsxs)(w.Z,{children:[(0,n.jsxs)("div",{className:j().label,children:[(0,n.jsx)(S.Z,{checked:em.paymentMethod===e.id,type:"radio",name:"paymentMethod",readOnly:!0}),(0,n.jsxs)("div",{children:[(null==e?void 0:e.service)==="paypal"&&(null==e?void 0:e.id)==="creditCard"?(0,n.jsxs)("div",{className:j().containerGatewayLogo,children:[(0,n.jsx)("h2",{children:eD("paymentMethod_".concat(e.id,"_paypal"))}),(null===(i=l.find(t=>t.slug===e.service))||void 0===i?void 0:i.logo)&&(0,n.jsx)("img",{src:null===(r=l.find(t=>t.slug===e.service))||void 0===r?void 0:r.logo,alt:"PayPal",className:"mercadopago"===e.service?j().isMercadopago:void 0})]}
1):(0,n.jsxs)("div",{className:j().containerGatewayLogo,children:[(0,n.jsx)("h2",{children:eD("paymentMethod_".concat(e.id))}),(null===(o=l.find(t=>t.slug===e.service))||void 0===o?void 0:o.logo)&&(0,n.jsx)("img",{src:null===(d=l.find(t=>t.slug===e.service))||void 0===d?void 0:d.logo,alt:null==e?void 0:e.id,className:"mercadopago"===e.service?j().isMercadopago:void 0})]}),e.description&&(0,n.jsx)("div",{className:e.discount&&"text-success",dangerouslySetInnerHTML:{__html:e.description}}),e.isDisabled&&e.messageDisabled&&(0,n.jsx)("span",{className:"".concat(j().messageDisabled," font-small-3 d-block mt-50"),dangerouslySetInnerHTML:{__html:e.messageDisabled}})]})]}),"bankSlipWithParcel"===e.id&&e.maxNumParcel&&e.priceMinParcel&&(0,n.jsx)(U,{isOpen:"bankSlipWithParcel"===em.paymentMethod,data:e,total:b,initialProps:a,handleUpdateFields:e=>ev({...em,...e})}),"bankSlipWithParcel"===e.id&&ef&&(0,n.jsx)(eo.Z,{className:"mt-2",initialDocType:(null==q?void 0:q.length)===14?"cpf":"cnpj",initialOccupation:D,isOpen:"bankSlipWithParcel"===em.paymentMethod,handleUpdateFields:e=>ev({...em,bankSlipWithParcel:{...em.bankSlipWithParcel,...e}})}),"creditCard"===e.id&&"paypal"!==e.service&&"culqi"!==e.service&&e.maxNumParcel&&e.priceMinParcel&&(0,n.jsx)(er,{total:b,isOpen:"creditCard"===em.paymentMethod,data:e,initialProps:a,handleUpdateFields:e=>ev({...em,...e})}),"creditCard2"===e.id&&"paypal"!==e.service&&(0,n.jsx)(er,{total:b,isOpen:"creditCard2"===em.paymentMethod,data:e,initialProps:a,handleUpdateFields:e=>ev({...em,...e})}),"creditCard"===e.id&&e.service&&"paypal"!==e.service&&"culqi"!==e.service&&e.maxNumParcel&&e.priceMinParcel&&(0,n.jsx)(X,{isOpen:"creditCard"===em.paymentMethod,needToPersonalData:eM,data:e,invalidMessages:ex,initialProps:a,handleUpdateFields:e=>ev({...em,...e})}),"creditCardCombined"===e.id&&e.service&&"getnetglobalsep"===e.service&&(0,n.jsx)(eZ,{isOpen:"creditCardCombined"===em.paymentMethod,needToPersonalData:eM,data:e,total:b,invalidMessages:ex,initialProps:a,handleUpdateFields:e=>ev({...em,...e})}),"creditCard2"===e.id&&e.service&&"paypal"!==e.service&&(0,n.jsx)(X,{isOpen:"creditCard2"===em.paymentMethod,needToPersonalData:eM,data:e,invalidMessages:ex,initialProps:a,handleUpdateFields:e=>ev({...em,...e})}),"creditCard"===e.id&&"paypal"===e.service&&(0,n.jsx)(el,{isOpen:"creditCard"===em.paymentMethod,orderData:c,sellerId:null==es?void 0:es.id,handleUpdateFields:e=>ev({...em,...e}),initialProps:a}),("debitCard"===e.id||"creditCard"===e.id||"creditCard2"===e.id)&&"openpay"===e.service&&(0,n.jsx)(ey,{isSandbox:e_,sellerId:null==es?void 0:es.id,openpayMethod:e,handleUpdateFields:e=>ev(t=>({...t,...e}))}),("debitCard"===e.id||"creditCard"===e.id||"creditCard2"===e.id)&&"culqi"===e.service&&em.paymentMethod===e.id&&(0,n.jsx)(e7,{sellerId:null==es?void 0:es.id,orderData:c,handleUpdateFields:e=>ev({...em,...e}),onTokenReady:()=>{eV.current=!0},onReady:e=>{eL.current=e},paymentMethod:e.id,isRequesting:eg,isSaving:u}),"debitCard"===e.id&&e.service&&"culqi"!==e.service&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"p-0"}),(0,n.jsx)(X,{isOpen:"debitCard"===em.paymentMethod,data:e,invalidMessages:ex,initialProps:a,handleUpdateFields:e=>ev({...em,...e})})]})]})})]},e.id)})})}),ex.paymentMethod&&(0,n.jsxs)(m.Z,{color:"danger",children:[(0,n.jsx)(eU,{color:"#da3850",style:{paddingRight:"4px"}})," ",ex.paymentMethod]}),(null==es?void 0:es.hasRecaptchaV2)&&(0,n.jsx)(eW,{handleUpdate:e=>eq(e)}),(null==eP?void 0:eP.asyncToken)&&(null==eP?void 0:eP.triedGettingToken)&&!(null==eP?void 0:eP.tokenIsValid)&&(0,n.jsx)(m.Z,{color:"warning",children:"Confira os dados do cart\xe3o e tente novamente."}),(null==eS?void 0:eS.length)>0&&(null==eN?void 0:eN.service)!=="paypal"&&(null==eN?void 0:eN.service)!=="culqi"&&(0,n.jsxs)(f.Z,{type:"submit",color:"success",disabled:u||eg||(null==eP?void 0:eP.asyncToken)&&(!(null==eP?void 0:eP.tokenIsValid)||(null==eP?void 0:eP.creatingToken)),children:["Finalizar ",(null==eu?void 0:null===(i=eu.orderText)||void 0===i?void 0:i.length)>0?null==eu?void 0:eu.orderText:"Pedido"," ",(u||eg||(null==eP?void 0:eP.asyncToken)&&(null==eP?void 0:eP.creatingToken))&&(0,n.jsx)(g.Z,{className:"ml-50",style:{width:"16px",height:"16px"}})]})]}),(0,n.jsx)(ez.Z,{isOpen:ti,status:tr,errorMessage:tl,onCancel:function(){var e;null===(e=eY.current)||void 0===e||e.abort(),(0,eH.ff)(),tn(!1),to(""),eb.current=!1,eC(!1)}})]}):(0,n.jsx)("span",{})}),ti=i(46445),tn=i(16983),tr=i(74198),ta=function(e){var t;let{initialProps:i,paymentServices:a,id:l,number:o,title:d,isComplete:s,isOpen:c,handleOpen:u,orderData:m,handleSaveData:v,isSaving:h}=e,{themeSettings:y,paymentMethods:{methods:g=[]}={},dental:C}=i||{},[b,x]=(0,r.useState)(""),{t:N}=(0,Y.$G)("common");(0,r.useEffect)(()=>{(null==C?void 0:C.id)&&!b&&g.some(e=>
1"creditCard"===e.id&&"paypal"==e.service)&&e();async function e(){try{let e=await (0,L.v)("".concat(p.Y,"/getPaypalClientId?sellerId=").concat(C.id),{method:"GET",requestedTokenType:"guest"});if(200!==e.status)return{};e=await e.json(),x(e)}catch(e){console.log(e)}}},[null==C?void 0:C.id,b]);let w={customer:(0,n.jsx)(tn.Z,{isOpen:c,initialProps:i,orderData:m,handleSaveData:v,submitLabel:N("actionContinue"),context:"checkout"}),address:(0,n.jsx)(tr.Z,{isOpen:c,initialProps:i,handleSaveData:v,submitLabel:N("actionContinue"),context:"checkout",orderData:m}),shipping:(0,n.jsx)(_,{initialProps:i,orderData:m,isOpen:c,handleSaveData:v}),payment:(0,n.jsx)(tt,{initialProps:i,paymentServices:a,orderData:m,isOpen:c,handleSaveData:v,isSaving:h})};return(0,n.jsxs)("li",{className:j().checkoutContent,id:"step".concat(o),children:[(0,n.jsxs)("div",{className:"".concat(j().target," ").concat(s?j().clickable:""," ").concat(j()[null==y?void 0:null===(t=y.components)||void 0===t?void 0:t.bgWhite]),onClick:s?u:null,children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{children:s?(0,n.jsx)(ti.Z,{}):o}),(0,n.jsx)("h2",{children:d})]}),s&&!c&&(0,n.jsx)(f.Z,{outline:!0,color:"secondary",size:"sm",className:"bg-white",children:"Editar"})]}),b&&(0,n.jsx)(es(),{type:"text/javascript",async:!0,src:"https://www.paypal.com/sdk/js?client-id=".concat(b,"&components=buttons,funding-eligibility&currency=").concat("ptbr"===P.language?"BRL":"MXN","&locale=").concat("ptbr"===P.language?"pt_BR":"es_MX","&intent=capture")}),w[l]]})},tl=i(69618),to=i(31109),td=function(e){var t,i,a;let{initialProps:l,discounts:o,setDiscounts:d,feedbackMessage:s}=e,{t:c}=(0,Y.$G)("common"),[u,p]=(0,r.useState)(""),[m,v]=(0,r.useState)(""),h=null==o?void 0:null===(i=o.data)||void 0===i?void 0:null===(t=i[0])||void 0===t?void 0:t.code,g=!!(null==o?void 0:null===(a=o.data)||void 0===a?void 0:a.length),C=m||s||"";return(0,n.jsx)(y.Z,{initialProps:l,className:"mb-2",children:(0,n.jsxs)(w.Z,{children:[(0,n.jsxs)("h4",{className:"font-small-4 mb-1",children:[(0,n.jsx)(to.Z,{className:"mr-25"})," ",(0,n.jsx)("strong",{children:c("offerTicket")})]}),(0,n.jsxs)(tl.Z,{children:[(0,n.jsx)(S.Z,{type:"text",placeholder:c("placeholderOfferTicket"),value:h||u,onChange:e=>p(e.target.value),disabled:g}),(0,n.jsx)(f.Z,{color:"secondary",onClick:function(){return(v(""),g)?d([]):(null==u?void 0:u.trim().length)?d([{code:u.trim()}]):v(c("enterCode"))},children:g?c("actionRemove"):c("actionApply")})]}),C&&(0,n.jsx)(I.Z,{className:"d-block",children:C})]})})},ts=i(86426),tc=e=>{let{sellerId:t,handleUpdateFields:i}=e,r="".concat(Math.floor(1e3*Math.random())).concat(new Date().getTime()),a="k8vif92e",l=function(){let e="";switch(t){case"SMXUl6is1vdXcwXCmjH8":e="braspag_dentalmac";break;case"YD5T3UBBUCNYqEEs6v0t":e="braspag_dentalrubisalvador"}return e}();return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(es(),{async:!0,src:"https://h.online-metrix.net/fp/tags.js?org_id=".concat(a,"&session_id=").concat(l).concat(r),onLoad:function(){console.log(">>> onLoad"),console.log({sessionId:r}),i({sessionId:r})}}),(0,n.jsx)("noscript",{children:(0,n.jsx)("iframe",{style:{width:"100px",height:"100px",border:0,position:"absolute",top:"-5000px"},src:"https://h.online-metrix.net/fp/tags?org_id=".concat(a,"&session_id=").concat(l).concat(r)})})]})},tu=i(93342),tp=i(60357),tm=i(77489),tv=i(28980);function th(){let{allFields:e,nationalities:t=[]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.includes("mx")){let t=(null==e?void 0:e.customer)||{};return{email:t.email,...t.name&&{name:t.name},...t.lastName&&{lastName:t.lastName},...t.rfc&&{rfc:t.rfc}}}return{email:null==e?void 0:e.email}}function ty(e,t){return"mercadopago"!==e&&t?{paymentReference:t}:{}}function tf(e,t){var i,n,r;if((null===(i=e.paymentDetail)||void 0===i?void 0:i.service)!=="mercadopago")return{};let a=null===(n=e.paymentMethod)||void 0===n?void 0:n.startsWith("creditCard"),l=e.creditCardBrand||e.brand,o=null!==(r=e.parcel)&&void 0!==r?r:e.installments,d="number"==typeof o?o:parseInt(o,10);return{...a&&e.paymentToken&&{paymentToken:e.paymentToken},...a&&l&&{brand:l},...a&&o&&Number.isFinite(d)&&{installments:d},payer:th({allFields:e,nationalities:t})}}let tg={scriptTags:"script-tags",httpFailure:"http-failure",missingOrderCode:"missing-order-code",exception:"exception"},tC={scriptTags:"Script tags detected in order fields.",httpFailure:"HTTP failure",missingOrderCode:"Missing order code."};async function tb(e){let{urlFunctions:t,sellerId:i,userId:n,logPayload:r}=e;try{await (0,L.v)("".concat(t,"/logCheckoutError"),{method:"POST",requestedTokenType:n?"user":"guest",headers:{"Content-Type":"application/json"},body:JSON.stringify({sellerId:i,userId:n,...r})})}catch(e){console.error("Failed to log checkout error",{sellerId:i,userId:n,error:e instanceof Error?e.message:"Unknown error"})}}var tx=i(50866);let tj=["pagarme","cieloapi","belluno","culqi","rede","itau","getnetglobalsep","mercadopago"],tN=["debitCard","credit
1Card","creditCard2"];var tw=i(13759),tS=i(76931),tI=i(14972);let tk=e=>{var t;let{data:i,orderChangesByAdmin:r,isGift:a,isStudentList:l,showFormattedValue:o}=e,{t:d}=(0,k.$G)("common");return l?(0,n.jsxs)("li",{children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:b().globalImg,children:[(0,n.jsx)(tp.Z,{color:"#CCC"}),(0,n.jsx)("div",{})]}),(0,n.jsxs)("div",{children:[a&&(0,n.jsx)("span",{children:(0,n.jsx)("strong",{children:d("gift")})}),(0,n.jsxs)("span",{children:[i.quantity," x ",i.title]}),(0,n.jsx)("span",{className:"text-muted",children:i.description})]})]}),(0,n.jsx)("span",{children:i.price.formatted})]}):(0,n.jsxs)("li",{children:[(0,n.jsxs)("div",{className:"w-100",children:[(null===(t=i.images)||void 0===t?void 0:t.length)>0&&(0,n.jsxs)("div",{className:b().globalImg,children:[(0,n.jsx)("img",{src:i.images[0]["50x50"],alt:i.title}),(0,n.jsx)("div",{})]}),(0,n.jsxs)("div",{children:[a&&(0,n.jsx)("span",{children:(0,n.jsx)("strong",{children:d("gift")})}),(0,n.jsxs)("span",{children:[i.quantity," x ",i.title]}),(0,n.jsx)("span",{className:"text-muted",children:i.brand})]})]}),(0,n.jsx)("span",{children:o(i.id,i.price)})]})};var tT=!0,tM=(0,o.$j)(e=>({cart:e.cart,discounts:e.discounts,sessionData:e.sessionData}),{setCart:c.RV,clearCart:c.LL,setDiscounts:u.h})(function(e){var t,i,a,o,c,u,C,x,j,N,w,S,I,D,O,E,R,_,A,B;let{sessionData:Z,changeQuantityOnCart:W,removeProductOnCart:V,initialProps:U,setCart:G,clearCart:J,setDiscounts:z,...H}=e,{data:$}=(0,s.useSession)(),Q=(0,d.useRouter)(),{preCart:Y,sandbox:X}=Q.query,{paymentMethods:{methods:K=[]}={},dental:ee}=U||{},{cart:et,discounts:ei,paymentServices:en}=H,[er,el]=(0,r.useState)(0),[eo,ed]=(0,r.useState)([]),{t:es}=(0,k.$G)("common"),[ec,eu]=(0,r.useState)({}),[ep,em]=(0,r.useState)({}),[ev,eh]=(0,r.useState)([]),[ey,ef]=(0,r.useState)(!1),[eg,eC]=(0,r.useState)(!0),[eb,ex]=(0,r.useState)(!1),[ej,eN]=(0,r.useState)({items:[],discounts:[],total:{}}),[ew,eS]=(0,r.useState)(""),[eI,ek]=(0,r.useState)({}),[eT,eM]=(0,r.useState)([]),eD=K.some(e=>"cybersource"===e.antiFraudService),[eO,eP]=(0,r.useState)([]),[eE,eF]=(0,r.useState)(!1),[eq,eR]=(0,r.useState)(!1),e_="3Qq3nylbqe0d4fLFejA1"===ee.id,[eA,eB]=(0,r.useState)(null),[eL,eZ]=(0,r.useState)(!1),[eW,eV]=(0,r.useState)(0),eU=(0,r.useRef)({}),ez=(0,eG.qd)(null==ee?void 0:null===(t=ee.countryRules)||void 0===t?void 0:t.currency),eH=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date;if(!e)return!1;let i=String(e).slice(0,10);if(!/^\d{4}-\d{2}-\d{2}$/.test(i))return!1;let n=new Date("".concat(i,"T23:59:59.999"));return!Number.isNaN(n.getTime())&&t.getTime()>n.getTime()}(null!==(B=null==et?void 0:null===(i=et[null==ee?void 0:ee.id])||void 0===i?void 0:i.validUntil)&&void 0!==B?B:null),e$=(0,M.Z)(null==ee?void 0:ee.whats,null==ee?void 0:null===(o=ee.countryRules)||void 0===o?void 0:null===(a=o.phone)||void 0===a?void 0:a.countryCodePrefix),eQ=e$?"https://api.whatsapp.com/send?phone=".concat(e$,"&text=").concat(encodeURIComponent((null==ee?void 0:ee.whatsMessage)||"")):null,e1=e$?"https://api.whatsapp.com/send?phone=".concat(e$,"&text=").concat(null==ee?void 0:ee.whatsMessage):null,e2=[{id:"customer",title:es("yoursData"),enabled:!0},{id:"address",title:es("addressToDelivery"),enabled:!0},{id:"shipping",title:es("freight"),enabled:(null==ee?void 0:null===(c=ee.shipping)||void 0===c?void 0:c.active)&&!(null==ei?void 0:null===(u=ei.data)||void 0===u?void 0:u.some(e=>(null==e?void 0:e.code)==="regalocongreso"))},{id:"payment",title:es("payment"),enabled:(null==ep?void 0:ep.raw)>0&&(null==ee?void 0:ee.willPayAfterCheckout)!==!0}],[e3]=(0,r.useState)(()=>Date.now());function e5(){var e;if(!(null==Z?void 0:Z.isLoggedAsCustomer))return null;let t=JSON.parse(window.localStorage.getItem("sessionData"))||{};return(null==t?void 0:null===(e=t.loggedAsCustomer[$.user.id])||void 0===e?void 0:e.adminId)||null}function e6(e){var t,i,n,r,a,l,o,d,s;let c=(null==ej?void 0:null===(i=ej.totalWithPaymentDiscount)||void 0===i?void 0:null===(t=i.find(t=>t.id===e.paymentMethod))||void 0===t?void 0:t.raw)||0,u=((null==ej?void 0:null===(n=ej.discounts)||void 0===n?void 0:n.reduce((e,t)=>
1{var i;return e+(null==t?void 0:null===(i=t.total)||void 0===i?void 0:i.raw)},0))||0)+((null==ej?void 0:null===(r=ej.discounts)||void 0===r?void 0:r.some(e=>null==e?void 0:e.notCumulativeWithPixDiscount))?0:(null==ej?void 0:null===(a=ej.total)||void 0===a?void 0:a.raw)-c);return{price:null==ej?void 0:null===(l=ej.subtotal)||void 0===l?void 0:l.raw,priceToShow:tl(null==ej?void 0:null===(o=ej.subtotal)||void 0===o?void 0:o.raw),quantity:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return null!=e?e:t.reduce((e,t)=>e+Number(t.quantity||0),0)}(null===(d=et[null==ee?void 0:ee.id])||void 0===d?void 0:d.total,eo),discounts:{raw:u,formatted:tl(u)},total:null!==(s=e.total)&&void 0!==s?s:0}}function e9(e){if(!(null==ep?void 0:ep.raw))return 0;let t=Math.floor((null==ep?void 0:ep.raw)/(null==e?void 0:e.priceMinParcel));return t<=1?0:t>(null==e?void 0:e.maxNumParcel)?null==e?void 0:e.maxNumParcel:t}function e4(e){return e8(e).map(e=>{let{id:t,name:i,total:n,gifts:r,notCumulativeWithPixDiscount:a}=e;return{id:t,name:i,total:n.raw,notCumulativeWithPixDiscount:null!=a&&a,...(null==r?void 0:r.length)&&{gifts:r.map(e=>{var t;let i=eT.find(t=>t.id===e.id);return{id:e.id,quantity:e.quantity,internalId:null!==(t=null==i?void 0:i.internalId)&&void 0!==t?t:null}})}}})}function e8(e){var t,i,n,r,a,l;let o=[];(null==ej?void 0:null===(t=ej.discounts)||void 0===t?void 0:t.length)&&o.push(...null==ej?void 0:ej.discounts);let d=!(null==ej?void 0:null===(i=ej.discounts)||void 0===i?void 0:i.some(e=>null==e?void 0:e.notCumulativeWithPixDiscount)),s=null!=K&&null!==(n=K.find(t=>t.id===e.paymentMethod))&&void 0!==n&&!!n.discount;if(d&&s){let t=null==ej?void 0:null===(r=ej.totalWithPaymentDiscount)||void 0===r?void 0:r.find(t=>t.id===e.paymentMethod),i=(null==ej?void 0:null===(a=ej.total)||void 0===a?void 0:a.raw)-t.raw;o.push({id:t.id,notCumulativeWithPixDiscount:null!==(l=null==t?void 0:t.notCumulativeWithPixDiscount)&&void 0!==l&&l,name:"Desconto ".concat(t.title," (").concat(t.discount,"%)"),total:{raw:i,formatted:tl(-i)}})}return o}function e7(e){let{price:t,total:i,quantity:n}=e6(e);return{subtotal:t,total:i,quantity:n}}function te(e,t,i){var n;!function(e){let{genericMessage:t,toastDetail:i,toastMessage:n,urlFunctions:r,sellerId:a,userId:l,logPayload:o}=e;ea.Am.error(n||"".concat(t," ").concat(i)),tb({urlFunctions:r,sellerId:a,userId:l,logPayload:o})}({genericMessage:es("errorAction"),toastDetail:e,toastMessage:i,urlFunctions:p.Y,sellerId:null==ee?void 0:ee.id,userId:null==$?void 0:null===(n=$.user)||void 0===n?void 0:n.id,logPayload:{route:"finalizar-pedido",...t}})}async function tt(e){var t,i,n,r,a,l,o,d;try{if(ex(!0),(0,tu._)(JSON.stringify(e)))return te(tC.scriptTags,{kind:tg.scriptTags,message:tC.scriptTags}),null;let o=await (0,tw.f)(null===(t=e.paymentDetail)||void 0===t?void 0:t.service,null===(i=e.paymentDetail)||void 0===i?void 0:i.antiFraudService),d=(0,eJ.DY)({sandboxQuery:X}),{url:s,payload:c}=function(e,t,i){var n,r,a,l;let o={};switch(null==t?void 0:null===(n=t.countryRules)||void 0===n?void 0:n.countryCode){case"BR":default:r=e,a=t,l=i,o=!function(e){var t;let i=null==e?void 0:null===(t=e.paymentDetail)||void 0===t?void 0:t.service;return"pagarme"===i||"cieloapi"===i||"belluno"===i||"rede"===i||"itau"===i||"getnetglobalsep"===i||"mercadopago"===i||"testeV2"===i}(r)?{url:"/api/order/setOrderV1",payload:function(e,t,i){var n,r,a,l,o,d;let{session:s,cart:c,productsOnCart:u=[],orderChangesByAdmin:p={},studentListData:m,giftsOnCart:v=[],studentListWithPricesHidden:h=[],startingAt:y,getAdminId:f,getOrderDiscounts:g,getOrderTotal:C,preCartId:b}=i,x=null==m?void 0:m.anyProductWithSpecialPrice,j={...e};e0.forEach(e=>{delete j[e]});let N=(null===(n=e.paymentMethod)||void 0===n?void 0:n.startsWith("creditCard"))?e0.reduce((t,i)=>(e[i]&&(t[i]=e[i]),t),{}):{};return{sellerId:null==t?void 0:t.id,useStockReservation:(null==t?void 0:t.useStockReservation)||!1,...(null===(r=c[null==t?void 0:t.id])||void 0===r?void 0:r.origin)&&{origin:null===(a=c[null==t?void 0:t.id])||void 0===a?void 0:a.origin},customerId:s.user.id,...b&&{preCartId:b},preOrderId:"".concat(s.user.id,"-").concat(y),adminId:f(),freightService:null==t?void 0:null===(l=t.shipping)||void 0===l?void 0:l.service,willPayAfterCheckout:(null==t?void 0:t.willPayAfterCheckout)||!1,...j,...N,...e.customer&&{...e.customer},...e.address&&{...e.address},discounts:g(e),total:C(e),...(null===(o=c[null==t?void 0:t.id])||void 0===o?void 0:o.studentListId)&&{studentListId:null===(d=c[null==t?void 0:t.id])||void 0===d?void 0:d.studentListId},products:u.map(e=>{var t,i,n,r,a,l,o,d,s,c;let u=null===(t=p[e.id])||void 0===t?void 0:t.wasChanged,v=Number(null===(i=p[e.id])||void 0===i?void 0:i.unitDiscount),h=null===(r=p[e.id])||void 0===r?void 0:null===(n=r.priceWithUnitDiscount)||void 0===n?void 0:n.raw,y=u?x?e.price-v:h:e.price;return{id:e.id,internalId:e.internalId,price:(null==e?void 0:e.useSpecialPrice)?y:(null===(l=p[e.id])||void 0===l?void 0:null===(a=l.priceWithUnitDiscount)||void 0===a?void 0:a.raw)||e.price,unitDiscount:parseFloat((null===(d=p[e.id])||void 0===d?void 0:null===(o=d.unitDiscount)||void 0===o?void 0:o.replace(",","."))||0),quantity:e.quantity,...(null==e?void 0:e.useSpecialPrice)&&{specialPriceList:{specialPrice
1:y,priceWithoutDiscount:(null===(c=p[e.id])||void 0===c?void 0:null===(s=c.priceWithUnitDiscount)||void 0===s?void 0:s.raw)||e.price,listId:null==m?void 0:m.listId}},...(null==e?void 0:e.smallStimulus)&&{smallStimulus:e.smallStimulus},...(null==e?void 0:e.stimulus)&&{stimulus:e.stimulus},...(null==e?void 0:e.branch)&&{branch:e.branch},title:e.title,...(null==e?void 0:e.useSpecialPrice)&&{useSpecialPrice:e.useSpecialPrice}}}),studentListWithPricesHidden:h.map(e=>({id:e.id,title:e.title,description:e.description,price:e.price.raw,quantity:e.quantity,products:e.products.map(e=>({id:e.id,internalId:e.internalId,quantity:e.quantity,price:e.price,stimulus:e.stimulus,smallStimulus:e.smallStimulus}))})),gifts:v,...e.salesManCode&&{salesManCode:e.salesManCode}}}(r,a,l)}:{url:"/api/order/setOrderV2",payload:function(e,t,i){var n,r,a,l,o,d,s,c,u,p,m,v;let{session:h,cart:y,productsOnCart:f=[],getFormattedOrderDiscounts:g,getFormattedOrderTotal:C,paymentIpAddress:b,preCartId:x}=i,{shipping:j,paymentMethod:N,paymentReference:w,parcel:S,paymentToken:I,creditCardNumber:k,creditCardName:T,creditCardValid:M,creditCardCod:D,cardholderBirthDay:O,cardholderDoc:P,creditCardBrand:E}=e;return{sellerId:null==t?void 0:t.id,useStockReservation:(null==t?void 0:t.useStockReservation)||!1,nationality:"br",...(null===(n=y[null==t?void 0:t.id])||void 0===n?void 0:n.origin)&&{origin:null===(r=y[null==t?void 0:t.id])||void 0===r?void 0:r.origin},...e.sessionId&&{sessionId:e.sessionId},...e.getnetSessionId&&{deviceFingerPrintId:e.getnetSessionId},...x&&{preCartId:x},customer:{id:h.user.id,name:e.name,lastName:e.lastName,email:e.email,tel:e.tel,...e.tel2&&{tel2:e.tel2},doc:e.doc,...e.occupation&&{occupation:e.occupation},...e.otherOccupation&&{otherOccupation:e.otherOccupation},...e.specialty&&{specialty:e.specialty},...e.rg&&{rg:e.rg},...e.ufRg&&{ufRg:e.ufRg},...e.bornDay&&{bornDay:e.bornDay},...e.ie&&{ie:e.ie},...e.companyName&&{companyName:e.companyName},...e.cro&&{cro:e.cro},...e.ufCro&&{ufCro:e.ufCro},...e.salesMan&&{salesMan:e.salesMan},...e.salesManCode&&{salesManCode:e.salesManCode},...e.studentNumber&&{studentNumber:e.studentNumber},...e.school&&{school:e.school},...e.period&&{period:e.period},...e.customerFileDocs&&{customerFileDocs:e.customerFileDocs}},address:{cep:e.cep,uf:e.uf,city:e.city,district:e.district,street:e.street,number:e.number,...e.complement&&{complement:e.complement},...e.additionalInfo&&{additionalInfo:e.additionalInfo}},products:f.map(e=>{let{id:t,title:i,internalId:n,price:r,quantity:a,useSpecialPrice:l,smallStimulus:o,stimulus:d}=e;return{id:t,title:i,internalId:n,price:r,quantity:a,...l&&{useSpecialPrice:l},...o&&{smallStimulus:o},...d&&{stimulus:d}}}),discounts:g(e),freight:F(j,null==t?void 0:null===(a=t.shipping)||void 0===a?void 0:a.service),payment:{paymentMethod:N,paymentService:null===(l=e.paymentDetail)||void 0===l?void 0:l.service,...(null===(c=e.paymentDetail)||void 0===c?void 0:c.service)!=="mercadopago"&&!!e.paymentReference&&{paymentReference:w},...!!e.parcel&&((null===(u=e.paymentDetail)||void 0===u?void 0:u.service)!=="mercadopago"||!!(null===(p=e.paymentMethod)||void 0===p?void 0:p.startsWith("creditCard")))&&{installments:parseInt(S,10)},...(null===(m=e.paymentDetail)||void 0===m?void 0:m.service)!=="mercadopago"?{paymentToken:e.paymentToken}:{...(null===(v=e.paymentMethod)||void 0===v?void 0:v.startsWith("creditCard"))&&e.paymentToken&&{paymentToken:e.paymentToken},payer:th({allFields:e,nationalities:["br"]})},antiFraudService:null===(o=e.paymentDetail)||void 0===o?void 0:o.antiFraudService,...e.cieloExternalAuthentication&&(null===(d=e.paymentDetail)||void 0===d?void 0:d.service)==="cieloapi"&&(null==N?void 0:N.startsWith("creditCard"))&&{cieloExternalAuthentication:e.cieloExternalAuthentication},...(null==N?void 0:N.startsWith("creditCard"))&&k&&{cardNumber:k},...(null==N?void 0:N.startsWith("creditCard"))&&T&&{cardHolderName:T},...(null==N?void 0:N.startsWith("creditCard"))&&M&&{expiration:M},...(null==N?void 0:N.startsWith("creditCard"))&&D&&{securityCode:D},...(null==N?void 0:N.startsWith("creditCard"))&&O&&{cardHolderBirthDay:O},...(null==N?void 0:N.startsWith("creditCard"))&&P&&{cardHolderDoc:P},...(null==N?void 0:N.startsWith("creditCard"))&&E&&{brand:E}
1,..."creditCardCombined"===N&&(null===(s=e.paymentDetail)||void 0===s?void 0:s.service)==="getnetglobalsep"&&{cards:[{amount:parseFloat(e.firstCardAmount)||0,cardNumber:(e.firstCreditCardNumber||"").split(" ").join(""),cardHolderName:e.firstCreditCardName,expiration:e.firstCreditCardValid,securityCode:e.firstCreditCardCod,brand:e.firstCardBrand,...e.firstCardholderDoc&&{cardHolderDoc:e.firstCardholderDoc},...e.firstCardholderBirthDay&&{cardHolderBirthDay:e.firstCardholderBirthDay}},{amount:parseFloat(e.secondCardAmount)||0,cardNumber:(e.secondCreditCardNumber||"").split(" ").join(""),cardHolderName:e.secondCreditCardName,expiration:e.secondCreditCardValid,securityCode:e.secondCreditCardCod,brand:e.secondCardBrand,...e.secondCardholderDoc&&{cardHolderDoc:e.secondCardholderDoc},...e.secondCardholderBirthDay&&{cardHolderBirthDay:e.secondCardholderBirthDay}}]},ipAddress:b},...e.isSandbox&&{isSandbox:e.isSandbox},total:C(e)}}(r,a,l)};break;case"MX":o={url:"/api/order/setOrderV2",payload:function(e,t,i){var n,r,a,l,o,d;let{session:s,cart:c,productsOnCart:u=[],getFormattedOrderDiscounts:p,getFormattedOrderTotal:m}=i,{customer:v,address:h,shipping:y,paymentMethod:f,paymentReference:g,transferData:C,openpay_3d_secure:b,isSandbox:x}=e;return{sellerId:t.id,nationality:"mx",...(null===(n=c[null==t?void 0:t.id])||void 0===n?void 0:n.origin)&&{origin:null===(r=c[null==t?void 0:t.id])||void 0===r?void 0:r.origin},customer:{id:s.user.id,needInvoice:"true"===v.needInvoice,...v.rfc&&{rfc:v.rfc},name:v.name,lastName:v.lastName,...v.birthDate&&{birthDate:v.birthDate},...v.yearOfGraduation&&{yearOfGraduation:v.yearOfGraduation},email:v.email,tel:v.tel,...v.businessActivity&&{businessActivity:v.businessActivity},...v.postalCode&&{postalCode:v.postalCode},...v.estado&&{estado:v.estado},...v.colonia&&{colonia:v.colonia},...v.calle&&{calle:v.calle},...v.numeroExterior&&{numeroExterior:v.numeroExterior},...v.fiscalRegime&&{fiscalRegime:v.fiscalRegime},...v.cfdiUse&&{cfdiUse:v.cfdiUse},...v.rfcName&&{rfcName:v.rfcName},...v.rfcLastname&&{rfcLastname:v.rfcLastname},...v.socialReason&&{socialReason:v.socialReason},...v.denominacionSocial&&{denominacionSocial:v.denominacionSocial},...v.regimenSocial&&{regimenSocial:v.regimenSocial},...v.occupation&&{occupation:v.occupation},...v.cedulaProfesional&&{cedulaProfesional:v.cedulaProfesional},...v.educationalInstitution&&{educationalInstitution:v.educationalInstitution},...v.occupationQuestion&&{occupationQuestion:v.occupationQuestion},...v.specialty&&{specialty:v.specialty}},address:{postalCode:h.postalCode,pais:h.pais,estado:h.estado,colonia:h.colonia,delegationMunicipio:h.delegationMunicipio,calle:h.calle,numeroExterior:h.numeroExterior,...h.numeroInterior&&{numeroInterior:h.numeroInterior},entreCalles:h.entreCalles,additionalInfo:h.additionalInfo},...(null==u?void 0:u.length)&&{products:u.map(e=>{let{id:t,internalId:i,price:n,quantity:r,warehouse:a,basePrice:l,tax:o,brand:d}=e;return{id:t,internalId:i,price:n,quantity:r,...l&&{basePrice:l},...a&&{warehouse:a},...o&&{tax:o},...d&&{brand:d}}})},discounts:p(e),...q(y,null==t?void 0:null===(a=t.shipping)||void 0===a?void 0:a.service),...f&&{payment:{paymentMethod:f,...(null===(l=e.paymentDetail)||void 0===l?void 0:l.service)&&{paymentService:null===(o=e.paymentDetail)||void 0===o?void 0:o.service},...ty(null===(d=e.paymentDetail)||void 0===d?void 0:d.service,g),...tf(e,["mx"])}},...C&&{transferData:{...C}},...b&&{openpay_3d_secure:{...b}},...x&&{isSandbox:x},total:m(e)}}(e,t,i)};break;case"CO":o={url:"/api/order/setOrderV2",payload:function(e,t,i){var n,r,a,l,o,d;let{session:s,cart:c,productsOnCart:u=[],getFormattedOrderDiscounts:p,getFormattedOrderTotal:m}=i,{customer:v,address:h,shipping:y,paymentMethod:f,paymentReference:g,transferData:C,openpay_3d_secure:b,isSandbox:x}=e;return{sellerId:t.id,nationality:"co",...(null===(n=c[null==t?void 0:t.id])||void 0===n?void 0:n.origin)&&{origin:null===(r=c[null==t?void 0:t.id])||void 0===r?void 0:r.origin},customer:{id:s.user.id,needInvoice:"true"===v.needInvoice,...v.nit&&{nit:v.nit},name:v.name,lastName:v.lastName,...v.birthDate&&{birthDate:v.birthDate},...v.yearOfGraduation&&{yearOfGraduation:v.yearOfGraduation},email:v.email,tel:v.tel,...v.businessActivity&&{businessActivity:v.businessActivity},...v.postalCode&&{postalCode:v.postalCode},...v.estado&&{estado:v.estado},...v.colonia&&{colonia:v.colonia},...v.calle&&{calle:v.calle},...v.numeroExterior&&{numeroExterior:v.numeroExterior},...v.fiscalRegime&&{fiscalRegime:v.fiscalRegime},...v.cfdiUse&&{cfdiUse:v.cfdiUse},...v.socialReason&&{socialReason:v.socialReason},...v.occupation&&{occupation:v.occupation},...v.educationalInstitution&&{educationalInstitution:v.educationalInstitution},...v.occupationQuestion&&{occupationQuestion:v.occupationQuestion},...v.specialty&&{specialty:v.specialty}},address:{postalCode:h.postalCode,pais:h.pais,estado:h.estado,colonia:h.colonia,delegationMunicipio:h.delegationMunicipio,calle:h.calle,numeroExterior:h.numeroExterior,...h.numeroInterior&&{numeroInterior:h.numeroInterior},entreCalles:h.entreCalles,additionalInfo:h.additionalInfo},...(null==u?void 0:u.length)&&{products:u.map(e=>{let{id:t,internalId:i,price:n,quantity:r}=e;return{id:t,internalId:i,price:n,quantity:r}})},discounts:p(e),...q(y,null==t?void 0:null===(a=t.shipping)||void 0===a?void 0:a.service),...f&&{payment:{paymentMethod:f,...(null===(l=e.paymentDetail)||void 0===l?void 0:l.service)&&{paymentService:null===(o=e.paymentDetail)||void 0===o?void 0:o.service},...ty(null===(d=e.paymentDetail)||void 0===d?void 0:d.service,g),...tf(e,["co"])}},...C&&{transferData:{...C}},...b&&{openpay_3d_secure:{...b}},...x&&{isSandbox:x},total:m(e)}}(e,t,i)};break;case"PE":o={url:"/api/order/setOrderV2",payload:function(e,t,i){var n,r,a,l,o,d,s;
1let{session:c,cart:u,productsOnCart:p=[],getFormattedOrderDiscounts:m,getFormattedOrderTotal:v}=i,{customer:h,address:y,shipping:f,paymentMethod:g,paymentReference:C,transferData:b,openpay_3d_secure:x,isSandbox:j,sourceId:N,installments:w,deviceFingerPrintId:S}=e,I=!0===h.needInvoice||"true"===h.needInvoice;return{sellerId:t.id,nationality:"pe",...(null===(n=u[null==t?void 0:t.id])||void 0===n?void 0:n.origin)&&{origin:null===(r=u[null==t?void 0:t.id])||void 0===r?void 0:r.origin},customer:{id:c.user.id,needInvoice:I,...I&&h.ruc&&{ruc:h.ruc},...!I&&h.dni&&{dni:h.dni},name:h.name,lastName:h.lastName,...h.birthDate&&{birthDate:h.birthDate},...h.yearOfGraduation&&{yearOfGraduation:h.yearOfGraduation},email:h.email,tel:h.tel,direccionFiscal:h.direccionFiscal,postalCode:h.postalCode,pais:h.pais,ciudad:h.ciudad,distrito:h.distrito,urbanizacion:h.urbanizacion,referencia:h.referencia,numeroInteriorOficina:h.numeroInteriorOficina,...h.occupation&&{occupation:h.occupation},...h.educationalInstitution&&{educationalInstitution:h.educationalInstitution},...h.occupationQuestion&&{occupationQuestion:h.occupationQuestion},...h.specialty&&{specialty:h.specialty}},address:{...y.direccionFiscal&&{direccionFiscal:y.direccionFiscal},postalCode:y.postalCode,pais:y.pais,ciudad:y.ciudad,distrito:y.distrito,urbanizacion:y.urbanizacion,referencia:y.referencia,numeroInteriorOficina:y.numeroInteriorOficina},...(null==p?void 0:p.length)&&{products:p.map(e=>{let{id:t,internalId:i,price:n,quantity:r}=e;return{id:t,internalId:i,price:n,quantity:r}})},discounts:m(e),...q(f,null==t?void 0:null===(a=t.shipping)||void 0===a?void 0:a.service),...g&&{payment:{paymentMethod:g,...(null===(l=e.paymentDetail)||void 0===l?void 0:l.service)&&{paymentService:null===(o=e.paymentDetail)||void 0===o?void 0:o.service},...ty(null===(d=e.paymentDetail)||void 0===d?void 0:d.service,C),...(null===(s=e.paymentDetail)||void 0===s?void 0:s.service)!=="mercadopago"&&w&&{installments:w},...tf(e,["pe"])}},...b&&{transferData:{...b}},...x&&{openpay_3d_secure:{...x}},...j&&{isSandbox:j},...N&&{sourceId:N},...S&&{deviceFingerPrintId:S},total:v(e)}}(e,t,i)};break;case"BO":o={url:"/api/order/setOrderV2",payload:function(e,t,i){var n,r,a,l,o,d;let{session:s,cart:c,productsOnCart:u=[],getFormattedOrderDiscounts:p,getFormattedOrderTotal:m}=i,{customer:v,address:h,shipping:y,paymentMethod:f,paymentReference:g,transferData:C,openpay_3d_secure:b,isSandbox:x}=e;return{sellerId:t.id,nationality:"bo",...(null===(n=c[null==t?void 0:t.id])||void 0===n?void 0:n.origin)&&{origin:null===(r=c[null==t?void 0:t.id])||void 0===r?void 0:r.origin},customer:{id:s.user.id,needInvoice:"true"===v.needInvoice,...v.nid&&{nid:v.nid},name:v.name,lastName:v.lastName,...v.birthDate&&{birthDate:v.birthDate},...v.yearOfGraduation&&{yearOfGraduation:v.yearOfGraduation},email:v.email,tel:v.tel,...v.occupation&&{occupation:v.occupation},...v.educationalInstitution&&{educationalInstitution:v.educationalInstitution},...v.occupationQuestion&&{occupationQuestion:v.occupationQuestion},...v.specialty&&{specialty:v.specialty}},address:{postalCode:h.postalCode,pais:h.pais,estado:h.estado,colonia:h.colonia,delegationMunicipio:h.delegationMunicipio,calle:h.calle,numeroExterior:h.numeroExterior,...h.numeroInterior&&{numeroInterior:h.numeroInterior},entreCalles:h.entreCalles,additionalInfo:h.additionalInfo},...(null==u?void 0:u.length)&&{products:u.map(e=>{let{id:t,internalId:i,price:n,quantity:r}=e;return{id:t,internalId:i,price:n,quantity:r}})},discounts:p(e),...q(y,null==t?void 0:null===(a=t.shipping)||void 0===a?void 0:a.service),...f&&{payment:{paymentMethod:f,...(null===(l=e.paymentDetail)||void 0===l?void 0:l.service)&&{paymentService:null===(o=e.paymentDetail)||void 0===o?void 0:o.service},...ty(null===(d=e.paymentDetail)||void 0===d?void 0:d.service,g),...tf(e,["bo"])}},...C&&{transferData:{...C}},...b&&{openpay_3d_secure:{...b}},...x&&{isSandbox:x},total:m(e)}}(e,t,i)}}return o}({...e,...d&&{isSandbox:d}},ee,{session:$,cart:et,productsOnCart:eo,orderChangesByAdmin:eI,studentListData:eA,giftsOnCart:eT,studentListWithPricesHidden:eO,startingAt:e3,preCartId:Y,getAdminId:e5,getOrderDiscounts:e8,getOrderTotal:e6,getFormattedOrderDiscounts:e4,getFormattedOrderTotal:e7,paymentIpAddress:o}),u=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!u.ok){let t=await eK(u),i=eY[null==t?void 0:t.code]?t.code:null;return te(tC.httpFailure,{kind:tg.httpFailure,message:tC.httpFailure,requestUrl:s,httpStatus:u.status,httpStatusText:u.statusText,...(null==t?void 0:t.code)&&{errorCode:t.code},paymentService:null!==(r=null===(n=e.paymentDetail)||void 0===n?void 0:n.service)&&void 0!==r?r:null},i?eX(t,es):void 0),null}let{orderCode:p}=await u.json();if(!p)return te(tC.missingOrderCode,{kind:tg.missingOrderCode,message:tC.missingOrderCode,requestUrl:s,paymentService:null!==(l=null===(a=e.paymentDetail)||void 0===a?void 0:a.service)&&void 0!==l?l:null}),null;return p}catch(t){return console.log(t),te(t instanceof Error?t.message:String(t),{kind:tg.exception,message:t instanceof Error?t.message:String(t),error:function e(t){if(null==t)return{message:String(t)};if(!(t instanceof Error)){if("object"==typeof t)try{return JSON.parse(JSON.stringify(t))}catch(e){}return{message:String(t)}}let i={name:t.name,message:t.message,stack:t.stack};return void 0!==t.cause&&(i.cause=e(t.cause)),Object.getOwnPropertyNames(t).forEach(e
1=>{if("name"===e||"message"===e||"stack"===e||"cause"===e)return;let n=t[e];if("function"!=typeof n)try{JSON.stringify(n),i[e]=n}catch(t){i[e]=String(n)}}),i}(t),paymentService:null!==(d=null===(o=e.paymentDetail)||void 0===o?void 0:o.service)&&void 0!==d?d:null}),null}finally{ex(!1)}}async function ti(e,t,i){try{await (0,L.v)("".concat(p.Y,"/setPreOrder"),{method:"POST",requestedTokenType:"user",headers:{"Content-Type":"application/json"},body:JSON.stringify({sellerId:null==ee?void 0:ee.id,customerId:$.user.id,preOrderId:"".concat($.user.id,"-").concat(e3),startingAt:e3,email:e,stepId:i,...t,products:null==eo?void 0:eo.map(e=>({id:e.id,internalId:e.internalId,price:e.price,quantity:e.quantity,title:e.title}))})})}catch(e){console.log(e)}}async function tn(e,t,i){var n,r;let a={...ec,...e},l=a.email||(null==a?void 0:null===(n=a.customer)||void 0===n?void 0:n.email);if(eu(a),"customer"===i&&eV(e=>e+1),await ti(l,e,i),e2.filter(e=>e.enabled).length-1===t){let e=await tt(a);if(!e)return;if(null==ee?void 0:ee.willPayAfterCheckout)return await tr(e,a);let t=function(e){let{service:t,paymentMethod:i,orderCode:n}=e;return tj.includes(t)?{href:"/sucesso/".concat(n),via:"globalLoader"}:"openpay"===t&&tN.includes(i)?{href:"/retorno?orderId=".concat(n),via:"router"}:{href:"/pedido-enviado/".concat(n),via:"router"}}({service:null===(r=a.paymentDetail)||void 0===r?void 0:r.service,paymentMethod:a.paymentMethod,orderCode:e});return"globalLoader"===t.via?(0,tx.s)(t.href):Q.push(t.href)}return el(t+1)}async function tr(e,t){let i=t.customer||t,n=await (0,L.v)("".concat(p.q,"/payment"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({service:"cielo",sellerId:null==ee?void 0:ee.id,paymentReference:e,items:eo.map(e=>{var t,i;return{title:e.title,price:(null===(i=eI[e.id])||void 0===i?void 0:null===(t=i.priceWithUnitDiscount)||void 0===t?void 0:t.raw)||e.price,quantity:e.quantity}}),payer:{email:i.email,name:i.name,lastName:i.lastName,doc:i.doc,address:{street:t.street,number:t.number,complement:t.complement,district:t.district,city:t.city,uf:t.uf}},freight:{title:t.shipping.title,price:t.shipping.price}}),requestedTokenType:"user"});return n=await n.json(),window.location.href=n.paymentUrl}function tl(e){return null==e?null:(0,eG.xG)(e,ez)}function to(e,t){var i,n,r,a;return(null==eA?void 0:eA.anyProductWithSpecialPrice)?tl(t-Number(null===(r=eI[e])||void 0===r?void 0:r.unitDiscount)):null===(n=eI[e])||void 0===n?void 0:null===(i=n.priceWithUnitDiscount)||void 0===i?void 0:i.formatted}return((0,r.useEffect)(()=>{try{var e,t,i,n;if(!(0,tI.pV)(ee)||!(null==ep?void 0:ep.raw)||!(null==eo?void 0:eo.length)||eE)return;(0,tI.L9)(ee,"begin_checkout",{currency:(null==ee?void 0:null===(t=ee.countryRules)||void 0===t?void 0:null===(e=t.currency)||void 0===e?void 0:e.code)||"BRL",value:null!==(n=null==ej?void 0:null===(i=ej.subtotal)||void 0===i?void 0:i.raw)&&void 0!==n?n:0,items:eo.map((e,t)=>{var i,n,r,a,l,o;return{index:t,item_id:e.id,item_name:e.title,affiliation:"Online Store",item_brand:e.brand,price:e.price,quantity:e.quantity,item_category:(null===(i=e.categoriesTitle)||void 0===i?void 0:i.join("~"))||"",item_category_id:(null===(n=e.categories)||void 0===n?void 0:n[0])||"",image_url:(null===(a=e.images)||void 0===a?void 0:null===(r=a[0])||void 0===r?void 0:r["300x300"])||(null===(o=e.images)||void 0===o?void 0:null===(l=o[0])||void 0===l?void 0:l["200x200"])||"",item_url:e.slug?"".concat(P.fixUrl,"/").concat(e.slug):""}})}),eF(!0)}catch(e){console.log(e)}},[ep,eo]),(0,r.useEffect)(()=>{try{var e,t,i,n,r,a,l;let o=ec.email||(null===(e=ec.customer)||void 0===e?void 0:e.email)||(null==$?void 0:null===(t=$.user)||void 0===t?void 0:t.email);if(!o)return;let d=[ec.name||(null===(i=ec.customer)||void 0===i?void 0:i.name),ec.lastName||(null===(n=ec.customer)||void 0===n?void 0:n.lastName)].filter(Boolean).join(" ")||(null==$?void 0:null===(r=$.user)||void 0===r?void 0:r.name);(0,tS.l)({email:o,name:d,mobile_phone:ec.tel||(null===(a=ec.customer)||void 0===a?void 0:a.tel),personal_phone:ec.tel2||(null===(l=ec.customer)||void 0===l?void 0:l.tel2)})}catch(e){console.log(e)}},[ec.email,null===(C=ec.customer)||void 0===C?void 0:C.email,ec.name,null===(x=ec.customer)||void 0===x?void 0:x.name,ec.lastName,null===(j=ec.customer)||void 0===j?void 0:j.lastName,ec.tel,null===(N=ec.customer)||void 0===N?void 0:N.tel,ec.tel2,null===(w=ec.customer)||void 0===w?void 0:w.tel2,null==$?void 0:null===(S=$.user)||void 0===S?void 0:S.email,null==$?void 0:null===(I=$.user)||void 0===I?void 0:I.name]),(0,r.useEffect)(()=>{try{var e,t,i,n,r,a;if(!(null==ep?void 0:ep.raw)||!(null==eo?void 0:eo.length)||eq)return;let l=eo.reduce((e,t)=>
1e+(t.quantity||0),0);(0,tS.f)("ECOMMERCE_CHECKOUT_STARTED",{identifier:"".concat(null==$?void 0:null===(e=$.user)||void 0===e?void 0:e.id,"-").concat(e3),cart_identifier:null==$?void 0:null===(t=$.user)||void 0===t?void 0:t.id,checkout_url:window.location.href,price:null!==(a=null==ej?void 0:null===(i=ej.subtotal)||void 0===i?void 0:i.raw)&&void 0!==a?a:null==ep?void 0:ep.raw,currency:(null==ee?void 0:null===(r=ee.countryRules)||void 0===r?void 0:null===(n=r.currency)||void 0===n?void 0:n.code)||"BRL",total_items:l,line_items:eo.map(e=>{let t={product_id:e.id,product_title:e.title,quantity:e.quantity,price:e.price};return e.slug&&(t.product_url="".concat(P.fixUrl,"/").concat(e.slug)),e.internalId&&(t.sku=e.internalId),Array.isArray(e.categoriesTitle)&&e.categoriesTitle.length&&(t.categories=e.categoriesTitle),t})}),eR(!0)}catch(e){console.log(e)}},[ep,eo]),(0,r.useEffect)(()=>{if((0,tI.pV)(ee)&&(null==ec?void 0:ec.shipping))try{var e,t,i,n,r,a;(0,tI.L9)(ee,"add_shipping_info",{currency:(null==ee?void 0:null===(t=ee.countryRules)||void 0===t?void 0:null===(e=t.currency)||void 0===e?void 0:e.code)||"BRL",value:null!==(r=null==ej?void 0:null===(i=ej.subtotal)||void 0===i?void 0:i.raw)&&void 0!==r?r:0,shipping_tier:null!==(a=null==ec?void 0:null===(n=ec.shipping)||void 0===n?void 0:n.titleToShow)&&void 0!==a?a:"A calcular",items:eo.map((e,t)=>({index:t,item_id:e.id,item_name:e.title,affiliation:"Online Store",item_brand:e.brand,price:e.price,quantity:e.quantity}))})}catch(e){console.log(e)}},[ec.shipping]),(0,r.useEffect)(()=>{if((0,tI.pV)(ee)&&(null==ec?void 0:ec.paymentMethod))try{var e,t,i,n;(0,tI.L9)(ee,"add_payment_info",{currency:(null==ee?void 0:null===(t=ee.countryRules)||void 0===t?void 0:null===(e=t.currency)||void 0===e?void 0:e.code)||"BRL",value:null!==(n=null==ej?void 0:null===(i=ej.subtotal)||void 0===i?void 0:i.raw)&&void 0!==n?n:0,payment_type:ec.paymentMethod,items:eo.map((e,t)=>({index:t,item_id:e.id,item_name:e.title,affiliation:"Online Store",item_brand:e.brand,price:e.price,quantity:e.quantity}))})}catch(e){console.log(e)}},[null==ec?void 0:ec.paymentMethod]),(0,r.useEffect)(()=>{z(JSON.parse(window.localStorage.getItem("discounts"))||[])},[]),(0,r.useEffect)(()=>{((null==eo?void 0:eo.length)||(null==eO?void 0:eO.length))&&eC(!1)},[eo,eO]),(0,r.useEffect)(()=>{var e;if(!eo.length&&!eO.length&&!(null==ei?void 0:null===(e=ei.data)||void 0===e?void 0:e.length)||!ei.isLoaded)return;let t=setTimeout(async()=>{var e,t,i,n,r,a,l,o;let d=null==eA?void 0:eA.anyProductWithSpecialPrice,s=await (0,L.v)("".concat(p.Y,"/getShoppingCartPricesV2"),{method:"POST",requestedTokenType:"guest",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:null==$?void 0:null===(e=$.user)||void 0===e?void 0:e.id,sellerId:null==ee?void 0:ee.id,occupation:(null==ec?void 0:ec.occupation)||(null==ec?void 0:null===(t=ec.customer)||void 0===t?void 0:t.occupation)||null,discountsCode:ei.data.length?[null===(i=ei.data[0].code)||void 0===i?void 0:i.toLowerCase()]:[],paymentMethods:K,items:eo.map(e=>{var t,i,n,r;let a=null===(t=eI[e.id])||void 0===t?void 0:t.wasChanged,l=Number(null===(i=eI[e.id])||void 0===i?void 0:i.unitDiscount),o=null===(r=eI[e.id])||void 0===r?void 0:null===(n=r.priceWithUnitDiscount)||void 0===n?void 0:n.raw,s=a?d?e.price-l:o:e.price;return{id:e.id,type:e.type,fatherId:e.fatherId,price:s,originalPrice:e.price,quantity:e.quantity,categories:e.categories,brand:e.brand}}),studentListWithPricesHidden:eO,...P.nationalities&&{nationalities:P.nationalities}})});if(200!==s.status)return eZ(!0);eN(s=await s.json());let c=eU.current,u=Object.keys(c||{}).length&&(null==c?void 0:c.price)||0;if(u>0){let e=(null===(a=s.total)||void 0===a?void 0:a.raw)+u;em({raw:e,formatted:tl(e)}),eh(null===(l=s.totalWithPaymentDiscount)||void 0===l?void 0:l.map(e=>({...e,raw:e.raw+u,formatted:tl(e.raw+u)})))}else em(s.total),eh(s.totalWithPaymentDiscount);eS(null!==(o=null===(r=s.discountsFeedback)||void 0===r?void 0:null===(n=r.find(e=>e.code))||void 0===n?void 0:n.message)&&void 0!==o?o:""),function(e){if(!e.some(e=>{var t;return(null===(t=e.gifts)||void 0===t?void 0:t.length)>0}))return eM([]);let t=e.filter(e=>{var t;return(null===(t=e.gifts)||void 0===t?void 0:t.length)>0});eM(t=Array.from(new Set((t=t.map(e=>e.gifts)).flat())))}(s.discounts)},500);return()=>clearTimeout(t)},[eo,ei,eO,eI,eW]),(0,r.useEffect)(()=>
1{if(Object.keys(ec.shipping||{}).length)try{var e,t;let i=(null===(e=ej.total)||void 0===e?void 0:e.raw)+((null===(t=ec.shipping)||void 0===t?void 0:t.price)||0);em({raw:i,formatted:tl(i)}),eh(null==ev?void 0:ev.map(e=>{var t,i,n;let r=(null==ej?void 0:null===(i=ej.totalWithPaymentDiscount)||void 0===i?void 0:null===(t=i.find(t=>t.id===e.id))||void 0===t?void 0:t.raw)+((null===(n=ec.shipping)||void 0===n?void 0:n.price)||0);return{...e,raw:r,formatted:tl(r)}}))}catch(e){return console.log(e)}},[ec.shipping]),(0,r.useEffect)(()=>{eU.current=ec.shipping||{}},[ec.shipping]),(0,r.useEffect)(()=>{(null==ee?void 0:ee.id)&&et.isLoaded&&e();async function e(){var e,t,i,n,r,a,l,o;let d=await (0,L.v)("".concat(p.Y,"/getShoppingCartProducts"),{method:"POST",requestedTokenType:"guest",headers:{"Content-Type":"application/json"},body:JSON.stringify({dentalId:null==ee?void 0:ee.id,dentalType:null==ee?void 0:ee.type,products:Object.keys((null===(e=et[null==ee?void 0:ee.id])||void 0===e?void 0:e.products)||{}),productsFromStudentListWithPricesHidden:null===(t=et[null==ee?void 0:ee.id])||void 0===t?void 0:t.productsFromStudentListWithPricesHidden,preCartPrices:null===(i=et[null==ee?void 0:ee.id])||void 0===i?void 0:i.preCartPrices,isLoggedAsCustomer:null==Z?void 0:Z.isLoggedAsCustomer,userId:null==$?void 0:null===(n=$.user)||void 0===n?void 0:n.id,...P.nationalities&&{nationalities:P.nationalities}})});if(200!==d.status)return console.log("ANY ERROR");d=await d.json();let s=await (0,tv.n)({products:null==d?void 0:d.products,cart:et,dentalId:null==ee?void 0:ee.id});eB({anyProductWithSpecialPrice:null==(s=s.lists.find(e=>{var t;return e.listId==(null===(t=et[null==ee?void 0:ee.id])||void 0===t?void 0:t.studentListId)}))?void 0:s.useSpecialPrice,salesManResponsible:(null==s?void 0:s.salesManResponsible)||null,listId:(null==s?void 0:s.listId)||null});let c=(null==s?void 0:null===(a=s.products)||void 0===a?void 0:a[null===(r=et[null==ee?void 0:ee.id])||void 0===r?void 0:r.studentListId])||{};ed(null==d?void 0:null===(l=d.products)||void 0===l?void 0:l.map(e=>{var t,i,n;let r=null!==(n=null===(i=et[null==ee?void 0:ee.id])||void 0===i?void 0:null===(t=i.products)||void 0===t?void 0:t[e.id])&&void 0!==n?n:0,a=e.price,l=e.formattedPrice,o=c[e.id];return(null==s?void 0:s.useSpecialPrice)&&o&&o.useSpecialPrice&&(a=o.priceOption.price||e.price,l=o.priceOption.formattedPrice||e.formattedPrice),{...e,quantity:r,price:a,formattedPrice:l,...o&&o.useSpecialPrice&&{useSpecialPrice:!0}}})),eP(null!==(o=d.studentListWithPricesHidden)&&void 0!==o?o:[]),ek((null==d?void 0:d.orderChangesByAdmin)||{})}},[ee,et]),(0,r.useEffect)(()=>{var e;async function t(){try{let e=await (0,L.v)("".concat(p.Y,"/getCart?userId=").concat($.user.id,"&sellerId=").concat(null==ee?void 0:ee.id,"&preCart=").concat(Y),{method:"GET",requestedTokenType:"user"});if(200!==e.status)return!1;e=await e.json(),G(e||{})}catch(e){console.log(e),G({})}}(null==ee?void 0:ee.id)&&!et.isLoaded&&(null==$?void 0:null===(e=$.user)||void 0===e?void 0:e.id)&&t()},[ee,$,et,Y]),(0,r.useEffect)(()=>{var e,t=null===(e=document.getElementById("step".concat(er+1)))||void 0===e?void 0:e.offsetTop;window.scrollTo(0,t)},[er]),(null==ee?void 0:ee.type)!=="ecommerce")?(0,n.jsx)("div",{}):$?eH?(0,n.jsxs)(ts.Z,{initialProps:U,children:[(0,n.jsxs)(l(),{children:[(0,n.jsx)("meta",{name:"robots",content:"noindex"}),(0,n.jsxs)("title",{children:[es("quoteExpiredTitle")," - ",null==ee?void 0:ee.name]})]}),(0,n.jsxs)(m.Z,{color:"danger",children:[(0,n.jsx)("h4",{className:"alert-heading",children:es("quoteExpiredTitle")}),(0,n.jsx)("p",{children:es("quoteExpiredMessage")}),eQ&&(0,n.jsxs)("p",{className:"mb-0",children:[es("quoteExpiredContact")," ",(0,n.jsxs)("a",{style:{textDecoration:"underline",fontWeight:"bold"},href:eQ,target:"_blank",rel:"noreferrer",onClick:e=>(0,T.Ec)(e,{href:eQ,dental:ee}),children:["WhatsApp: ",null==ee?void 0:ee.whats]})]})]})]}):(0,n.jsxs)(ts.Z,{initialProps:U,children:[(0,n.jsxs)(l(),{children:[(0,n.jsx)("meta",{name:"robots",content:"noindex"}),(0,n.jsxs)("title",{children:[es("checkoutPageTitle")," - ",null==ee?void 0:ee.name]})]}),eD&&(0,n.jsx)(tc,{sellerId:null==ee?void 0:ee.id,handleUpdateFields:e=>
1eu({...ec,...e})}),eL&&(0,n.jsxs)(m.Z,{color:"warning",children:[(0,n.jsx)("p",{children:"Encontramos um erro para processar o pedido."}),(0,n.jsx)("p",{children:"Por favor, tente novamente."}),e$&&(0,n.jsxs)("p",{className:"mb-0",children:["Se o problema persistir, entre em contato conosco atrav\xe9s do ",(0,n.jsxs)("a",{style:{textDecoration:"underline",fontWeight:"bold"},href:e1,target:"_blank",onClick:e=>(0,T.Ec)(e,{href:e1,dental:ee}),children:["WhatsApp: ",null==ee?void 0:ee.whats]})]})]}),!eg&&!eL&&(0,n.jsxs)(v.Z,{children:[(0,n.jsx)(h.Z,{lg:6,children:(0,n.jsx)("ul",{className:b().steps,children:e2.filter(e=>e.enabled).map((e,t)=>(0,n.jsx)(ta,{number:t+1,id:e.id,title:e.title,isComplete:er>=t,isOpen:er===t,handleOpen:()=>el(t),isSaving:eb,orderData:{allFields:ec,productsOnCart:eo,total:ep,totalWithPaymentDiscount:ev,dynamicData:ej,studentListWithPricesHidden:eO,giftsOnCart:eT,startingAt:e3,cart:et,studentListData:eA},initialProps:U,paymentServices:en,handleSaveData:i=>tn(i,t,e.id)},e.id))})}),(0,n.jsx)(h.Z,{lg:{offset:1,size:5},xl:{offset:2,size:4},children:(0,n.jsxs)(y.Z,{className:b().cart,children:[(0,n.jsxs)("div",{className:"d-flex align-items-center justify-content-between p-1",children:[(0,n.jsx)("strong",{children:es("orderOverview")}),(0,n.jsx)(f.Z,{outline:!0,onClick:()=>Q.push((0,tm.route)("cart")),color:"secondary",size:"sm",children:es("actionChangeCart")})]}),(0,n.jsxs)("ul",{children:[ey?(0,n.jsxs)(n.Fragment,{children:[eO.map(e=>(0,n.jsx)(tk,{data:e,isStudentList:!0},e.id)),eo.map(e=>(0,n.jsx)(tk,{data:e,orderChangesByAdmin:eI,showFormattedValue:to},e.id)),eT.map(e=>(0,n.jsx)(tk,{data:e,orderChangesByAdmin:eI,isGift:!0,showFormattedValue:to},e.id))]}):(0,n.jsxs)(n.Fragment,{children:[eO.filter((e,t)=>t<3).map(e=>(0,n.jsx)(tk,{data:e,isStudentList:!0},e.id)),eo.filter((e,t)=>t<3).map(e=>(0,n.jsx)(tk,{data:e,orderChangesByAdmin:eI,showFormattedValue:to},e.id)),eT.filter((e,t)=>t<3).map(e=>(0,n.jsx)(tk,{data:e,orderChangesByAdmin:eI,isGift:!0,showFormattedValue:to},e.id))]}),!ey&&((null==eo?void 0:eo.length)>3||(null==eo?void 0:eo.length)>0)&&(0,n.jsx)("li",{children:(0,n.jsx)(f.Z,{outline:!0,onClick:()=>ef(!0),color:"secondary",size:"sm",className:"w-100",children:es("actionSeeMore")})})]}),(null==ee?void 0:ee.type)==="ecommerce"&&(0,n.jsx)("div",{className:"px-1",children:(0,n.jsx)(td,{initialProps:U,discounts:ei,setDiscounts:z,feedbackMessage:ew})}),(0,n.jsxs)("div",{className:"p-1",children:[(0,n.jsxs)("div",{className:"d-flex justify-content-between align-items-center mb-50 font-small-2",children:[(0,n.jsx)("span",{children:es("subtotal")}),(0,n.jsx)("span",{children:(null==ej?void 0:null===(D=ej.subtotal)||void 0===D?void 0:D.formatted)||"-"})]}),(null==ej?void 0:ej.discounts.length)>0&&(null==ej?void 0:null===(O=ej.discounts)||void 0===O?void 0:O.filter(e=>{var t;return(null==e?void 0:null===(t=e.total)||void 0===t?void 0:t.raw)>0}).map(e=>{var t;return(0,n.jsxs)("div",{className:"d-flex justify-content-between align-items-center mb-50 font-small-2",children:[(0,n.jsx)("span",{className:"text-success",children:(null==e?void 0:e.name)||"De
1sconto"}),(0,n.jsx)("span",{className:"text-success",children:(null==e?void 0:null===(t=e.total)||void 0===t?void 0:t.formatted)||"-"})]})})),(null==ee?void 0:null===(E=ee.shipping)||void 0===E?void 0:E.active)&&(0,n.jsxs)("div",{className:"d-flex justify-content-between align-items-center mb-50 font-small-2",children:[(0,n.jsx)("span",{children:es("freight")}),(0,n.jsx)("span",{children:(null===(R=ec.shipping)||void 0===R?void 0:R.priceToShow)?null===(_=ec.shipping)||void 0===_?void 0:_.priceToShow:"A calcular"})]}),(0,n.jsxs)("div",{className:"d-flex justify-content-between align-items-center",children:[(0,n.jsx)("span",{children:es("total")}),(0,n.jsx)("span",{className:"font-medium-3",children:(0,n.jsx)("strong",{children:(null==ep?void 0:ep.formatted)||"-"})})]}),(null==ev?void 0:ev.length)>0&&(0,n.jsx)(n.Fragment,{children:null===(A=ev.filter(e=>(null==e?void 0:e.showConditionStimulusCheckout)===!0||void 0===(null==e?void 0:e.showConditionStimulusCheckout)&&e.discount))||void 0===A?void 0:A.map(e=>{var t;return(0,n.jsx)("div",{className:"d-flex justify-content-between align-items-center text-success mt-50",children:"creditCard"!==e.id||e_?(null==e?void 0:e.discount)>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("span",{children:[(0,n.jsxs)("strong",{children:[e.discount,"% OFF"]})," ","no ",e.title]}),(0,n.jsx)("span",{className:"font-medium-3 text-end",children:(0,n.jsx)("strong",{children:(null==e?void 0:e.formatted)||"-"})})]}):(0,n.jsx)(n.Fragment,{children:e9(e)>0&&(0,n.jsxs)("span",{className:"font-small-3 text-end",children:["At\xe9 ",e9(e),"x de ",(t=((null==ep?void 0:ep.raw)/e9(e)).toFixed(2),(0,eG.xG)(t,ez))," ","sem juros"]})})},e.id)})})]})]})})]}),eg&&(0,n.jsx)("div",{className:"d-flex justify-content-center mt-3",children:(0,n.jsx)(g.Z,{color:"success"})})]}):(0,n.jsx)("div",{children:"N\xe3o autorizado"})})},16218:function(e,t,i){"use strict";function n(e,t){var i;return!!(null==e?void 0:null===(i=e[t])||void 0===i?void 0:i.products)}function r(e,t){return console.warn("cart: cartUpdated com formato inv\xe1lido, ignorado e for\xe7ando refetch",{dentalId:t,cartUpdated:e}),e=>{e({type:"CHANGE_CART",data:{isLoaded:!1}})}}i.d(t,{Dr:function(){return d},LL:function(){return s},Od:function(){return o},RV:function(){return a},Xq:function(){return l},zu:function(){return c}});let a=e=>t=>{t({type:"CHANGE_CART",data:e})},l=e=>{var t,i,n,r;let{dentalId:a,productId:l,quantityToAdd:o,unitPrice:d,cartUpdated:s,studentListId:c=null}=e;if(s)return e=>{console.log(">>>HERE"),console.log(s),e({type:"CHANGE_CART",data:s})};console.log(">>>AND HERE");let u=JSON.parse(window.localStorage.getItem("cart"))||{},p=parseInt(o),m=d*o,v={...u,[a]:{products:{...null===(t=u[a])||void 0===t?void 0:t.products,[l]:(null===(i=u[a])||void 0===i?void 0:i.products)&&u[a].products[l]?u[a].products[l]+p:p},...c&&{studentListId:c},total:(null===(n=u[a])||void 0===n?void 0:n.total)?u[a].total+p:p,price:(null===(r=u[a])||void 0===r?void 0:r.price)?u[a].price+m:m}};return window.localStorage.setItem("cart",JSON.stringify(v)),e=>{e({type:"CHANGE_CART",data:v})}},o=e=>{var t;let{dentalId:i,productId:a,newQuantity:l,price:o,cartUpdated:d,studentListId:s}=e;if(d)return n(d,i)?e=>{e({type:"CHANGE_CART",data:d})}:r(d,i);let c=JSON.parse(window.localStorage.getItem("cart"))||{},u={...null===(t=c[i])||void 0===t?void 0:t.products,[a]:parseInt(l)},p=Object.values(u).reduce((e,t)=>e+t),m={...c,[i]:{products:u,total:p,price:o},...s&&{studentListId:s}};return window.localStorage.setItem("cart",JSON.stringify(m)),e=>{e({type:"CHANGE_CART",data:m})}},d=e=>{var t,i;let{dentalId:a,productId:l,listId:o,price:d,cartUpdated:s}=e;if(s)return n(s,a)?e=>{e({type:"CHANGE_CART",data:s})}:r(s,a);let c=JSON.parse(window.localStorage.getItem("cart"))||{};console.log(">>>old"),console.log(c[a]);let u=(null===(t=c[a])||void 0===t?void 0:t.products)||{},p=(null===(i=c[a])||void 0===i?void 0:i.productsFromStudentListWithPricesHidden)||{};l&&delete u[l],o&&delete p[o];let m=Object.keys(u||{}).length>0?Object.values(u).reduce((e,t)=>e+t):0,v=Object.keys(p||{}).length>0?Object.values(p).reduce((e,t)=>
1e+t):0,h={...c,[a]:{products:u,total:m+v,price:d}};return window.localStorage.setItem("cart",JSON.stringify(h)),e=>{e({type:"CHANGE_CART",data:h})}},s=e=>{let t={...JSON.parse(window.localStorage.getItem("cart"))||{},[e]:{products:{},total:0,price:0}};return window.localStorage.setItem("cart",JSON.stringify(t)),e=>{e({type:"CHANGE_CART",data:t})}},c=()=>(window.localStorage.removeItem("cart"),e=>{e({type:"CHANGE_CART",data:{isLoaded:!1}})})},6253:function(e,t,i){"use strict";i.d(t,{h:function(){return n}});let n=e=>(window.localStorage.setItem("discounts",JSON.stringify(e)),t=>{t({type:"CHANGE_SESSION_DISCOUNTS",isLoaded:!0,data:e})})},4883:function(e){e.exports={label:"CreditCardInfos_label___Wk0S"}},54981:function(e){e.exports={steps:"Checkout_steps__xxCO_",cart:"Checkout_cart__LzsyU",globalImg:"Checkout_globalImg__xi6p4"}},60357:function(e,t,i){"use strict";var n=i(67294),r=i(45697),a=i.n(r);function l(){return(l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e}).apply(this,arguments)}var o=(0,n.forwardRef)(function(e,t){var i=e.color,r=e.size,a=void 0===r?24:r,o=function(e,t){if(null==e)return{};var i,n,r=function(e,t){if(null==e)return{};var i,n,r={},a=Object.keys(e);for(n=0;n<a.length;n++)i=a[n],t.indexOf(i)>=0||(r[i]=e[i]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)i=a[n],!(t.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}(e,["color","size"]);return n.createElement("svg",l({ref:t,xmlns:"http://www.w3.org/2000/svg",width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:void 0===i?"currentColor":i,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),n.createElement("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),n.createElement("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),n.createElement("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),n.createElement("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),n.createElement("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),n.createElement("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"}))});o.propTypes={color:a().string,size:a().oneOfType([a().string,a().number])},o.displayName="List",t.Z=o},69618:function(e,t,i){"use strict";var n=i(87462),r=i(63366),a=i(67294),l=i(45697),o=i.n(l),d=i(93967),s=i.n(d),c=i(23663),u=["className","cssModule","tag","size"],p={tag:c.iC,size:o().string,className:o().string,cssModule:o().object},m=function(e){var t=e.className,i=e.cssModule,l=e.tag,o=e.size,d=(0,r.Z)(e,u),p=(0,c.mx)(s()(t,"input-group",o?"input-group-"+o:null),i);return a.createElement(l,(0,n.Z)({},d,{className:p}))};m.propTypes=p,m.defaultProps={tag:"div"},t.Z=m}},function(e){e.O(0,[3714,3996,7795,9655,2923,2143,6206,2355,8127,571,6983,8009,3466,4198,2888,9774,179],function(){return e(e.s=50342)}),_N_E=e.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.