1import{j as t}from"./mui-CRsYZxVY.js";import{Page as K,View as r,Text as n,Document as X,StyleSheet as ee}from"./react-pdf.browser-1EhQzxMi.js";import{d6 as d,f as te,aP as oe,aR as ae,aS as J,aQ as ne,d7 as se,d3 as ie}from"./index-TALscxEc.js";import"./vendor-Dwao9eNC.js";import"./index-BNv7yOC_.js";import"./query-8ViTdhdk.js";import"./datePickers-BIJXYOKG.js";import"./icons-D8aatgQ4.js";import"./lab-DSem1Osk.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"2ad85febf9735404429b0670d4acf56a0af5a0a2"}}catch{}})();try{(function(){var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},h=new e.Error().stack;h&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[h]="8acdb200-7f60-4267-a3aa-3f86ca756234",e._sentryDebugIdIdentifier="sentry-dbid-8acdb200-7f60-4267-a3aa-3f86ca756234")})()}catch{}const m=2.8346,Y=80,Z=58,re=.6,le=(e,h,l)=>{if(!e)return 0;const s=h*re,v=Math.floor(l/s);return v<=0?1:Math.ceil(e.length/v)},W=(e,h)=>{const l=se(e);let s=`${l.logradouro}, ${l.numero}`;return l.complemento&&(s+=` - ${l.complemento}`),l.bairro&&(s+=` - ${l.bairro}`),s+=h?` - ${l.localidade}/${l.uf}`:` - ${l.localidade} - ${l.uf}`,l.cep&&(s+=` - CEP: ${ie(l.cep)}`),s},ce=(e,h,l,s,v,k)=>{var R,S,D,B;const I=(s?Z*m:Y*m)-(s?1:2)*2,T=s?8:10,$=T,C=T*1.3,q=T,O=T,w=T,P=1.4,_=$*P,L=s?3:5,V=q*P,H=s?2:3,F=O*P,A=w*P,u=(s?1:1.5)+(s?3:4)*2,E=s?3:5,i=s?2:3,x=(s?4:6)*m,b=s?2:3,p=(g,f)=>le(g,f,I)*f*P;let a=0;a+=(s?2:3)*2,a+=x,a+=p(k||"",C)+L,a+=p(`PEDIDO #${e.numero_pedido||e.pedido_id}`,C)+L,a+=u,a+=_;const z=e.cliente?d(e.cliente.nome):"";if(a+=p(`Cliente: ${z}`,$),(R=e.cliente)!=null&&R.telefone&&(a+=_),((S=e.frete_pedido)==null?void 0:S.tipo_frete)==="retirada"&&l&&(a+=p(`Endereco: ${W(l,s)}`,$)),e.frete_pedido&&(a+=_,e.frete_pedido.rastreio_codigo&&(a+=_)),e.endereco_entrega&&((D=e.frete_pedido)==null?void 0:D.tipo_frete)!=="retirada"&&(e.endereco_entrega.nome_destinatario&&(a+=_),a+=p(`Endereco: ${W(e.endereco_entrega,s)}`,$)),a+=u+F+u,e.itens_pedido.forEach(g=>{var G,M;let f=g.produto.nome?d(g.produto.nome):"";if(g.produto_variacao){const N=g.produto_variacao.produto_variacao_valor.map(Q=>s?d(Q.atributo_valor.valor):`${d(Q.atributo_valor.atributo.nome)}: ${d(Q.atributo_valor.valor)}`).join(s?"/":", ");N&&(f+=` (${N})`)}const y=((G=g.produto_variacao)==null?void 0:G.codigo_produto)||((M=g.produto)==null?void 0:M.sku)||"",U=`${y&&y+" "}${f}`;a+=p(U,$),a+=A,a+=b}),a+=u,a+=_,e.frete_pedido&&e.frete_pedido.valor_frete>0&&(a+=_),e.taxa_de_venda>0&&(a+=_),e.valor_desconto>0&&(a+=_),a+=u,a+=_+F,((B=h==null?void 0:h.parcelas)==null?void 0:B.length)>0){a+=E+u+V+H+u;let g=0;h.parcelas.forEach(f=>{f.pagamentos&&f.pagamentos.forEach(y=>{(y.status==="pago"||!y.status&&f.status_parcela==="paga")&&g++})}),g>0&&(a+=g*_+u),a+=_*2,(e.condicao_pagamento==="parcelado"||e.condicao_pagamento==="fiado")&&(a+=E+u+V+H+u,a+=h.parcelas.length*A)}return(e.observacoes_cliente||e.observacoes)&&(a+=E+u+F+u,e.observacoes_cliente&&(a+=A,a+=p(d(e.observacoes_cliente),w),a+=i),e.observacoes&&(e.observacoes_cliente&&(a+=i),a+=A,a+=p(d(e.observacoes),w))),v&&(a+=E+u,s||(a+=_),a+=p(v,$)),a+=F+E,a+=x,Math.ceil(a*1.1)},de=e=>{const h=e?Z*m:Y*m,l=e?8:10;return ee.create({page:{width:h,paddingHorizontal:e?1:2,paddingVertical:e?2:3,fontFamily:"Courier-Bold",fontSize:l,color:"#000000",backgroundColor:"#ffffff"},cutterSpacing:{height:e?4*m:6*m},headerText:{textAlign:"center",fontFamily:"Courier-Bold",fontSize:l*1.3,marginBottom:e?3:5},separator:{borderBottomWidth:e?.75:1,borderBottomColor:"#000000",marginVertical:e?3:4},separatorDashed:{borderBottomWidth:e?.5:.75,borderBottomColor:"#000000",borderBottomStyle:"dashed",marginVertical:e?2:3},row:{fontFamily:"Courier-Bold",fontSize:l},flexBetween:{flexDirection:"row",justifyContent:"space-between",fontFamily:"Courier-Bold",fontSize:l},sectionTitle:{textAlign:"center",fontFamily:"Courier-Bold",fontSize:l,marginBottom:e?2:3},totalFontSize:{fontFamily:"Courier-Bold",fontSize:l},smallFontSize:{fontSize:l},productItem:{marginBottom:e?2:3},productDetail:{marginLeft:e?3:6},spacing:{height:e?3:5},smallSpacing:{height:e?2:3},centerText:{textAlign:"center",fontFamily:"Courier-Bold"}})},j=e=>
1e.toLocaleString("pt-BR",{minimumFractionDigits:2,maximumFractionDigits:2}),pe=e=>`${e.getDate().toString().padStart(2,"0")}/${(e.getMonth()+1).toString().padStart(2,"0")}/${e.getFullYear()} ${e.getHours()}:${e.getMinutes().toString().padStart(2,"0")}`,fe=({order:e,storeName:h,storeUrl:l,paymentData:s,customerAddress:v,size:k="80mm"})=>{var F,A,u,E;const c=k==="58mm",o=de(c),I=d(h),T=e.cliente?d(e.cliente.nome):"",$=new Date(e.data_pedido),C=e.subtotal+(((F=e.frete_pedido)==null?void 0:F.valor_frete)||0)+(e.taxa_de_venda||0)-(e.valor_desconto||0),q=e.itens_pedido.reduce((i,x)=>i+x.quantidade,0),O=[];let w=0;s!=null&&s.parcelas&&s.parcelas.forEach(i=>{i.pagamentos&&i.pagamentos.length>0&&i.pagamentos.forEach(x=>{var p;if(x.status==="pago"||!x.status&&i.status_parcela==="paga"){const a=new Date(x.data_pagamento);O.push({method:d(((p=x.forma_pagamento)==null?void 0:p.nome)||"Sem metodo"),amount:x.valor,date:`${a.getDate().toString().padStart(2,"0")}/${(a.getMonth()+1).toString().padStart(2,"0")}`,installmentNumber:i.numero_parcela}),w+=x.valor}})});const _={new:"NOVO",pending_payment:c?"AGUARD. PGTO":"AGUARDANDO PAGAMENTO",paid:"APROVADO",processing:"PREPARACAO",shipped:"ENVIADO",delivered:"ENTREGUE",canceled:"CANCELADO",returned:"DEVOLVIDO"}[e.status_pedido]||e.status_pedido.toUpperCase(),L=c?{frete_gratis:"Gratis",frete_distancia:"Distancia",frete_personalizado:"Personalizado",correios:"Correios",melhor_envio:"Melhor Envio",superfrete:"SuperFrete",uber:"Uber",a_combinar:"A combinar",retirada:"Retirada"}:{frete_gratis:"Frete gratis",frete_distancia:"Frete por distância",frete_personalizado:"Frete personalizado",correios:"Correios",melhor_envio:"Melhor Envio",superfrete:"SuperFrete",uber:"Uber",a_combinar:"A combinar",retirada:"Retirada no local"},V=ce(e,s,v,c,l,I),H={width:c?Z*m:Y*m,height:V};return t.jsxs(K,{size:H,style:o.page,children:[t.jsx(r,{style:o.cutterSpacing}),t.jsx(n,{style:o.headerText,children:I}),t.jsxs(n,{style:o.headerText,children:["PEDIDO #",e.numero_pedido||e.pedido_id]}),t.jsx(r,{style:o.separatorDashed}),t.jsxs(n,{style:o.row,children:["Data: ",pe($)]}),t.jsxs(n,{style:o.row,children:["Cliente: ",T]}),((A=e.cliente)==null?void 0:A.telefone)&&t.jsxs(n,{style:o.row,children:["Tel: ",te(e.cliente.telefone)]}),((u=e.frete_pedido)==null?void 0:u.tipo_frete)==="retirada"&&v&&t.jsxs(n,{style:o.row,children:[c?"End":"Endereco",":"," ",W(v,c)]}),e.frete_pedido&&t.jsxs(t.Fragment,{children:[t.jsxs(n,{style:o.row,children:["Entrega:"," ",L[e.frete_pedido.tipo_frete]||e.frete_pedido.tipo_frete]}),e.frete_pedido.rastreio_codigo&&t.jsxs(n,{style:o.row,children:[c?"Rastr.":"Cod. Rastr.",":"," ",d(e.frete_pedido.rastreio_codigo)]})]}),e.endereco_entrega&&((E=e.frete_pedido)==null?void 0:E.tipo_frete)!=="retirada"&&t.jsxs(t.Fragment,{children:[e.endereco_entrega.nome_destinatario&&d(e.endereco_entrega.nome_destinatario)!==T&&t.jsxs(n,{style:o.row,children:["A/C: ",d(e.endereco_entrega.nome_destinatario)]}),t.jsxs(n,{style:o.row,children:[c?"End":"Endereco",":"," ",W(e.endereco_entrega,c)]})]}),t.jsx(r,{style:o.separator}),t.jsxs(r,{style:[o.flexBetween,o.totalFontSize],children:[t.jsx(n,{children:c?"PRODUTO":"COD | DESC"}),t.jsx(n,{children:c?"TOTAL":"QTD x PRECO UN | PRECO TOT"})]}),t.jsx(r,{style:o.separatorDashed}),e.itens_pedido.map((i,x)=>{var B,g;const b=((B=i.produto_variacao)==null?void 0:B.codigo_produto)||((g=i.produto)==null?void 0:g.sku)||"";let p=i.produto.nome?d(i.produto.nome):"";if(i.produto_variacao){const f=i.produto_variacao.produto_variacao_valor.map(y=>c?d(y.atributo_valor.valor):`${d(y.atributo_valor.atributo.nome)}: ${d(y.atributo_valor.valor)}`).join(c?"/":", ");f&&(p+=` (${f})`)}const a=`${b&&b+" "}${p}
1`,z=i.quantidade*i.preco_snapshot,R=`${i.quantidade}x ${j(i.preco_snapshot)}`,S=`${j(z)}`,D=i.combo_componentes??[];return t.jsxs(r,{style:o.productItem,children:[t.jsx(n,{style:o.row,children:a}),D.map((f,y)=>{var M,N;const U=d(((M=f.produto)==null?void 0:M.nome)??""),G=(N=f.produto_variacao)!=null&&N.nome?` (${d(f.produto_variacao.nome)})`:"";return t.jsx(n,{style:[o.row,o.smallFontSize],children:` ${f.quantidade}x ${U}${G}`},f.id??y)}),t.jsxs(r,{style:[o.flexBetween,o.smallFontSize,o.productDetail],children:[t.jsx(n,{children:R}),t.jsx(n,{children:S})]})]},x)}),t.jsx(r,{style:o.separator}),t.jsxs(r,{style:o.flexBetween,children:[t.jsx(n,{children:"Subtotal:"}),t.jsxs(n,{children:["R$ ",j(e.subtotal)]})]}),e.frete_pedido&&e.frete_pedido.valor_frete>0&&t.jsxs(r,{style:o.flexBetween,children:[t.jsx(n,{children:"Frete:"}),t.jsxs(n,{children:["R$ ",j(e.frete_pedido.valor_frete)]})]}),e.taxa_de_venda>0&&t.jsxs(r,{style:o.flexBetween,children:[t.jsx(n,{children:c?"Taxa:":"Taxa de venda:"}),t.jsxs(n,{children:["R$ ",j(e.taxa_de_venda)]})]}),e.valor_desconto>0&&t.jsxs(r,{style:o.flexBetween,children:[t.jsx(n,{children:"Desconto:"}),t.jsxs(n,{children:["-R$ ",j(e.valor_desconto)]})]}),t.jsx(r,{style:o.separatorDashed}),t.jsxs(r,{style:o.flexBetween,children:[t.jsx(n,{children:c?"Qtd:":"Qtd. Total:"}),t.jsx(n,{children:q})]}),t.jsxs(r,{style:[o.flexBetween,o.totalFontSize],children:[t.jsx(n,{children:"TOTAL:"}),t.jsxs(n,{children:["R$ ",j(C)]})]}),s&&s.parcelas&&s.parcelas.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(r,{style:o.spacing}),t.jsx(r,{style:o.separator}),t.jsx(n,{style:o.sectionTitle,children:"PAGAMENTO"}),t.jsx(r,{style:o.separatorDashed}),O.length>0&&t.jsxs(t.Fragment,{children:[O.map((i,x)=>t.jsxs(r,{style:o.flexBetween,children:[t.jsxs(n,{children:[i.method," (",i.date,"):"]}),t.jsxs(n,{children:["R$ ",j(i.amount)]})]},x)),t.jsx(r,{style:o.separatorDashed})]}),t.jsxs(r,{style:o.flexBetween,children:[t.jsx(n,{children:"Total pago:"}),t.jsxs(n,{children:["R$ ",j(w)]})]}),C-w>0&&t.jsxs(r,{style:o.flexBetween,children:[t.jsx(n,{children:"Pendente:"}),t.jsxs(n,{children:["R$ ",j(C-w)]})]}),s.parcelas&&s.parcelas.length>0&&(e.condicao_pagamento==="parcelado"||e.condicao_pagamento==="fiado")&&t.jsxs(t.Fragment,{children:[t.jsx(r,{style:o.spacing}),t.jsx(r,{style:o.separatorDashed}),t.jsx(n,{style:o.sectionTitle,children:e.condicao_pagamento==="parcelado"?`PARCELAS (${s.parcelas.length}x)`:e.condicao_pagamento==="fiado"?c?"A PRAZO":"PAGAMENTO A PRAZO":c?"COND. PGTO":"CONDICAO DE PAGAMENTO"}),t.jsx(r,{style:o.separatorDashed}),s.parcelas.map((i,x)=>{const b=oe((i.pagamentos??[]).filter(()=>e.condicao_pagamento==="a_vista"?i.status_parcela==="paga":!0).map(D=>D.valor)),p=new Date(i.data_vencimento),a=`${p.getDate().toString().padStart(2,"0")}/${(p.getMonth()+1).toString().padStart(2,"0")}`,z=e.condicao_pagamento==="fiado"?`${a}:`:`${i.numero_parcela}a ${a}:`,R=ae(i.valor_original,b);let S;return J(b)>0&&J(R)>0?S=`R$ ${j(b)}/${j(i.valor_original)} (parcial)`:ne(b,i.valor_original)?S=`R$ ${j(i.valor_original)} (pago)`:S=`R$ ${j(i.valor_original)} (pendente)`,t.jsxs(r,{style:[o.flexBetween,o.smallFontSize],children:[t.jsx(n,{children:z}),t.jsx(n,{children:S})]},x)})]})]}),(e.observacoes_cliente||e.observacoes)&&t.jsxs(t.Fragment,{children:[t.jsx(r,{style:o.spacing}),t.jsx(r,{style:o.separator}),t.jsx(n,{style:[o.centerText,o.totalFontSize],children:c?"OBS":"OBSERVACOES"}),t.jsx(r,{style:o.separatorDashed}),e.observacoes_cliente&&t.jsxs(t.Fragment,{children:[t.jsx(n,{style:[o.row,o.smallFontSize],children:c?"Cliente:":"Obs. Cliente:"}),t.jsx(n,{style:[o.row,o.smallFontSize],children:d(e.observacoes_cliente)}),t.jsx(r,{style:o.smallSpacing})]}),e.observacoes&&t.jsxs(t.Fragment,{children:[e.observacoes_cliente&&t.jsx(r,{style:o.smallSpacing}),t.jsx(n,{style:[o.row,o.smallFontSize],children:c?"Vendedor:":"Obs. Vendedor:"}),t.jsx(n,{style:[o.row,o.smallFontSize],children:d(e.observacoes)})]})]}),l&&t.jsxs(t.Fragment,{children:[t.jsx(r,{style:o.spacing}),t.jsx(r,{style:o.separatorDashed}),!c&&t.jsx(n,{style:o.centerText,children:"Visite nossa loja online:"}),t.jsx(n,{style:o.centerText,children:l})]}),t.jsxs(n,{style:[o.centerText,o.totalFontSize,{marginTop:c?3:6}],children:["Status: ",_]}),t.jsx(r,{style:o.cutterSpacing})]})},Se=e=>t.jsx(X,{children:t.jsx(fe,{...e})});
1export{fe as VectorizedPrintThermalReceiptPage,Se as default};
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.