import{s as h,K as a,e as r,E as c,_ as f,r as o,o as y,f as g,w as l,a as i,g as d,h as k,t as b}from"./1.10.0_index.js";import{s as D}from"./1.10.0_decor14.js";const x={components:{s_button:h,s_input:D},props:["kind","treasure"],data(){return{packages:0,found:!1,cart_details:this.empty_details(),cart:a.warehouse()}},computed:{emblem(){const t=this.treasure;return r(t,["emblem"],"")},identity(){const t=this.treasure;return r(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 a.moves.change_quantity({treasure:e,packages:t})},async product_quantity(){const t=this.emblem,e=this.kind,n=this.identity;if(e==="food"){const s=await a.moves.find_FDC_ID({emblem:t,FDC_ID:n["FDC ID"]});c(s,"emblem")?(this.found=!0,this.cart_details=s):(this.found=!1,this.cart_details=this.empty_details())}else if(e==="supp"){const s=await a.moves.find_DSLD_ID({emblem:t,DSLD_ID:n["DSLD ID"]});c(s,"emblem")?(this.found=!0,this.cart_details=s):(this.found=!1,this.cart_details=this.empty_details()),this.found=!1}return this.cart_details}},created(){this.cart_monitor=a.monitor(({inaugural:t,field:e})=>{this.cart=a.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()}},w=x,q={style:{display:"flex",alignItems:"top",justifyContent:"right"}},I={style:{textAlign:"right",paddingRight:"4px"}};function v(t,e,n,s,C,V){const u=o("s_input"),p=o("s_button"),_=o("lounge");return y(),g(_,null,{default:l(({palette:S,style:$})=>[i("div",null,[i("section",q,[i("div",null,[d(u,{modelValue:t.packages,"onUpdate:modelValue":e[0]||(e[0]=m=>t.packages=m),type:"number",min:"0",max:"1000",styles:{input:{width:"100px",height:"30px"}}},null,8,["modelValue"])]),d(p,{ref:"button",pressable:!0,boundaries:"3px 12px 3px",clicked:t.change_quantity,style:{flexGrow:1},styles:{inside:{}}},{default:l(()=>[k("change amount")]),_:1},8,["clicked"])]),i("div",I,"amount in grocery list: "+b(t.cart_details.packages),1)])]),_:1})}const L=f(w,[["render",v]]);export{L as q};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,[encoded data, 9180 characters]
