import{L as k,M as D,N as v,O as N,P as $,e as o,s as w,I as i,E as d,_ as F,r as u,o as S,f as q,w as f,a,g as m,h as E,t as C}from"./index-a0b775e5.js";import{s as O}from"./decor-8e219cfa.js";var T=/\s/;function B(t){for(var e=t.length;e--&&T.test(t.charAt(e)););return e}var V=B,A=V,M=/^\s+/;function R(t){return t&&t.slice(0,A(t)+1).replace(M,"")}var j=R,L=j,l=k,G=D,_=0/0,P=/^[-+]0x[0-9a-f]+$/i,U=/^0b[01]+$/i,H=/^0o[0-7]+$/i,W=parseInt;function X(t){if(typeof t=="number")return t;if(G(t))return _;if(l(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=l(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=L(t);var n=U.test(t);return n||H.test(t)?W(t.slice(2),n?2:8):P.test(t)?_:+t}var g=X,Y=g,p=1/0,z=17976931348623157e292;function J(t){if(!t)return t===0?t:0;if(t=Y(t),t===p||t===-p){var e=t<0?-1:1;return e*z}return t===t?t:0}var K=J,Q=K;function Z(t){var e=Q(t),n=e%1;return e===e?n?e-n:e:0}var tt=Z,et=v,nt=tt,rt=g,h=N,st=et.isFinite,it=Math.min;function at(t){var e=Math[t];return function(n,r){if(n=rt(n),r=r==null?0:it(nt(r),292),r&&st(n)){var s=(h(n)+"e").split("e"),c=e(s[0]+"e"+(+s[1]+r));return s=(h(c)+"e").split("e"),+(s[0]+"e"+(+s[1]-r))}return e(n)}}var ot=at,ut=ot,ct=ut("round"),dt=ct;const ft=$(dt),xt=function(t){if(t==="")return"";var e=ft(t,2);if(isNaN(e))return"";if(e=e.toString(),e=="0")return"0.00";if(e.indexOf(".")==-1)return e+".00";var n=e.split(".");return n[1].length==1?e+"0":e};function kt(){try{let t;if(arguments.length===3?t=o(arguments[0],arguments[1],arguments[2]):arguments.length===2?t=o(arguments[0],arguments[1],""):arguments.length===1&&(t=arguments[0]),typeof t=="string")return t;throw console.log(arguments),new Error("A string could not be furnished from the preceeding arguments.")}catch(t){console.warn(t)}return""}const mt={components:{s_button:w,s_input:O},props:["kind","treasure"],data(){return{packages:0,found:!1,cart_details:this.empty_details(),cart:i.warehouse()}},computed:{emblem(){const t=this.treasure;return o(t,["emblem"],"")},identity(){const t=this.treasure;return o(t,["nature","identity"],"")}},methods:{empty_details(){return{packages:0}},async change_quantity(){this.emblem,this.kind;const t=parseInt(this.packages),e=this.treasure;await i.moves.change_quantity({treasure:e,packages:t})},async product_quantity(){const t=this.emblem,e=this.kind,n=this.identity;if(e==="food"){const r=await i.moves.find_FDC_ID({emblem:t,FDC_ID:n["FDC ID"]});d(r,"emblem")?(this.found=!0,this.cart_details=r):(this.found=!1,this.cart_details=this.empty_details())}else if(e==="supp"){const r=await i.moves.find_DSLD_ID({emblem:t,DSLD_ID:n["DSLD ID"]});d(r,"emblem")?(this.found=!0,this.cart_details=r):(this.found=!1,this.cart_details=this.empty_details()),this.found=!1}return this.cart_details}},created(){this.cart_monitor=i.monitor(({inaugural:t,field:e})=>{this.cart=i.warehouse(),this.product_quantity()})},async mounted(){let t=0;try{t=(await this.product_quantity()).packages}catch{}typeof t!="number"&&(t=0),this.packages=t},beforeUnmount(){this.cart_monitor.stop()}},lt=mt,_t={style:{display:"flex",alignItems:"top",justifyContent:"right"}},pt={style:{textAlign:"right",paddingRight:"4px"}};function ht(t,e,n,r,s,c){const y=u("s_input"),b=u("s_button"),I=u("lounge");return S(),q(I,null,{default:f(({palette:gt,style:yt})=>[a("div",null,[a("section",_t,[a("div",null,[m(y,{modelValue:t.packages,"onUpdate:modelValue":e[0]||(e[0]=x=>t.packages=x),type:"number",min:"0",max:"1000",styles:{input:{width:"100px",height:"30px"}}},null,8,["modelValue"])]),m(b,{ref:"button",pressable:!0,boundaries:"3px 12px 3px",clicked:t.change_quantity,style:{flexGrow:1},styles:{inside:{}}},{default:f(()=>[E("change amount")]),_:1},8,["clicked"])]),a("div",pt,"amount in grocery list: "+C(t.cart_details.packages),1)])]),_:1})}const Dt=F(lt,[["render",ht]]);export{kt as f,Dt as q,xt as r};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,[encoded data, 24424 characters]
