1import{a9 as h,r as x,l as i,q as _,c as y,b as e,f as C,i as V,m as l,t as a,v as L,y as P,F as E,x as $,o as D,p as j}from"#entry";import"./BsqTxom4.js";const T={class:"p-6 max-w-4xl mx-auto"},k={class:"bg-white rounded-lg shadow-md p-6 mb-6"},A={class:"space-y-4"},M={class:"block text-sm font-medium text-gray-700 mb-2"},F=["disabled"],I={class:"bg-white rounded-lg shadow-md p-6 mb-6"},B={class:"space-y-4"},H={class:"flex justify-between items-center py-2 border-b"},N={class:"text-lg font-semibold"},O={class:"flex justify-between items-center py-2 border-b bg-yellow-50"},R={class:"text-lg font-semibold text-yellow-700"},q={class:"flex justify-between items-center py-2 border-b"},z={class:"text-lg font-semibold"},G={class:"flex justify-between items-center py-2 border-b"},J={class:"text-lg font-semibold"},K={class:"flex justify-between items-center py-2 border-b"},Q={class:"text-lg font-semibold text-green-600"},W={class:"flex justify-between items-center py-3 border-t-2 border-gray-800 mt-2"},X={class:"text-2xl font-bold text-blue-600"},Y={class:"bg-yellow-50 rounded-lg shadow-md p-6"},Z={class:"overflow-x-auto"},ee={class:"min-w-full bg-white border border-gray-300"},te={class:"px-4 py-2 border border-gray-300"},oe={class:"px-4 py-2 border border-gray-300"},se={class:"px-4 py-2 border border-gray-300 font-semibold"},ne=h({__name:"calculadora",setup(le){const n=x(990),s=x(0),u=x(!1),c=[{rango:"US$ 0 - 30",valorUSD:0,valorCLP:0,min:0,max:30},{rango:"US$ 30,01 - 50",valorUSD:10.3,valorCLP:10197,min:30.01,max:50},{rango:"US$ 50,01 - 70",valorUSD:19,valorCLP:18691,min:50.01,max:70},{rango:"US$ 70,01 - 100",valorUSD:26,valorCLP:25483,min:70.01,max:100},{rango:"US$ 100,01 - 200",valorUSD:32,valorCLP:31789,min:100.01,max:200},{rango:"US$ 200,01 - 400",valorUSD:47.99,valorCLP:47510,min:200.01,max:400},{rango:"US$ 400,01 - 700",valorUSD:64,valorCLP:63231,min:400.01,max:700},{rango:"US$ 700,01 - 1.000",valorUSD:72,valorCLP:71102,min:700.01,max:1e3},{rango:"US$ 1.000,01 - 2.000",valorUSD:149.24,valorCLP:147748,min:1000.01,max:2e3},{rango:"US$ 2.000,01 - 3.000",valorUSD:175.81,valorCLP:174052,min:2000.01,max:3e3}],b=i(()=>!s.value||!n.value?0:s.value*n.value),m=i(()=>{if(!s.value)return 0;const o=c.find(t=>s.value>=t.min&&s.value<=t.max);return o?o.valorCLP:0}),U=i(()=>s.value?c.findIndex(o=>s.value>=o.min&&s.value<=o.max):-1),v=i(()=>(b.value+m.value)*1.19),p=i(()=>v.value*1.4),S=i(()=>{const o=p.value-v.value,r=(b.value+m.value)*.2375;return o+r}),w=i(()=>p.value+m.value),d=o=>new Intl.NumberFormat("es-CL",{style:"currency",currency:"CLP",minimumFractionDigits:0,maximumFractionDigits:0}).format(o),f=async()=>{u.value=!0;try{try{const o=await fetch("https://api.exchangerate-api.com/v4/latest/USD",{method:"GET",headers:{Accept:"application/json"}});if(o.ok){const t=await o.json();if(t&&t.rates&&t.rates.CLP){n.value=Math.round(t.rates.CLP),u.value=!1;return}}}catch{console.log("API 1 falló, intentando siguiente...")}try{const o=await fetch("https://open.er-api.com/v6/latest/USD");if(o.ok){const t=await o.json();if(t&&t.rates&&t.rates.CLP){n.value=Math.round(t.rates.CLP),u.value=!1;return}}}catch{console.log("API 2 falló, usando valor por defecto")}console.warn("No se pudo obtener el valor actual del dólar. Usando valor por defecto.")}catch(o){console.error("Error obteniendo valor del dólar:",o)}finally{u.value=!1}};return _(()=>{f()}),(o,t)=>(D(),y("div",T,[t[16]||(t[16]=e("h1",{class:"text-3xl font-bold mb-6"},"Calculadora de Precios para Chile",-1)),e("div",k,[t[6]||(t[6]=e("h2",{class:"text-xl font-semibold mb-4"},"Datos de Entrada",-1)),e("div",A,[e("div",null,[e("label",M,[t[2]||(t[2]=V(" Valor del Dólar (CLP) ",-1)),e("button",{onClick:f,disabled:l(u),class:"ml-2 text-xs px-2 py-1 bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-50"},a(l(u)?"Obteniendo...":"Obtener Actual"),9,F)]),C(e("input",{"onUpdate:modelValue":t[0]||(t[0]=r=>P(n)?n.value=r:null),type:"number",class:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"990",min:"0",step:"0.01"},null,512),[[L,l(n),void 0,{number:!0}]]),t[3]||(t[3]=e("p",{class:"text-xs text-gray-500 mt-1"},"Valor aproximado del dólar en pesos chilenos",-1))]),e("div",null,[t[4]||(t[4]=e("label",{class:"block text-sm font-medium text-gray-700 mb-2"}," Sub Total EnvÃo (USD) ",-1)),C(e("input",{"onUpdate:modelValue":t[1]||(t[1]=r=>P(s)?s.value=r:null),type:"number",class:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"0.00",min:"0",step:"0.01"},null,512),[[L,l(s),void 0,{number:!0}]]),t[5]||(t[5]=e("p",{class:"text-xs text-gray-500 mt-1"},"Valor del repuesto más el envÃo (en dólares USD)",-1))])])]),e("div",I,[t[13]||(t[13]=e("h2",{class:"text-xl font-semibold mb-4"},"Cálculo de EnvÃo de Repuestos",-1)),e("div",B,[e("div",H,[t[7]||(t[7]=e("div",null,[e("p",{class:"font-medium"},"Sub Total EnvÃo (CLP)"),e("p",{class:"text-xs text-gray-500"},"Total valor de los repuestos más el envÃo")],-1)),e("p",N,a(d(l(b))),1)]),e("div",O,[t[8]||(t[8]=e("div",null,[e("p",{class:"font-medium"},"Valor DHL (CLP)"),e("p",{class:"text-xs text-gray-500"},"Valor que cobra DHL por custodia")],-1)),e("p",R,a(d(l(m))),1)]),e("div",q,[t[9]||(t[9]=e("div",null,[e("p",{class:"font-medium"},"Valor Impuesto (CLP)"),e("p",{class:"text-xs text-gray-500"},"Valor con el impuesto pagado en Chile")],-1)),e("p",z,a(d(l(v))),1)]),e("div",G,[t[10]||(t[10]=e("div",null,[e("p",{class:"font-medium"},"Margen (CLP)"),e("p",{class:"text-xs text-gray-500"},"Valor sin impuestos y margen")],-1)),e("p",J,a(d(l(p))),1)]),e("div",K,[t[11]||(t[11]=e("div",null,[e("p",{class:"font-medium"},"Utilidad (CLP)"),e("p",{class:"text-xs text-gray-500"},"Margen")],-1)),e("p",Q,a(d(l(S))),1)]),e("div",W,[t[12]||(t[12]=e("div",null,[e("p",{class:"text-lg font-bold"},"Total a Cobrar (CLP)")],-1)),e("p",X,a(d(l(w))),1)])])]),e("div",Y,[t[15]||(t[15]=e("h2",{class:"text-xl font-semibold mb-4"}
1,"Planilla DHL según Valor de EnvÃo",-1)),e("div",Z,[e("table",ee,[t[14]||(t[14]=e("thead",{class:"bg-gray-100"},[e("tr",null,[e("th",{class:"px-4 py-2 border border-gray-300 text-left"},"Rango USD FOB"),e("th",{class:"px-4 py-2 border border-gray-300 text-left"},"Valor (USD)"),e("th",{class:"px-4 py-2 border border-gray-300 text-left"},"Peso (CLP)")])],-1)),e("tbody",null,[(D(),y(E,null,$(c,(r,g)=>e("tr",{key:g,class:j({"bg-yellow-100":l(U)===g,"hover:bg-gray-50":!0})},[e("td",te,a(r.rango),1),e("td",oe,a(r.valorUSD),1),e("td",se,a(d(r.valorCLP)),1)],2)),64))])])])])]))}});export{ne 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.