import{fetchPriceSystem as t}from"./lib/api-helpers.js";import{formatAddonCellar as n,formatAddonFsbucket as r,formatAddonPulsar as e,formatAddonHeptapod as o}from"./lib/product.js";import{defineSmartComponent as i}from"./lib/smart/define-smart-component.js";import"./cc-smart-container.js";import"./cc-pricing-product-consumption.js";i({selector:"cc-pricing-product-consumption",params:{apiConfig:{type:Object},productId:{type:String},zoneId:{type:String,optional:!0},currency:{type:String,optional:!0}},onContextUpdate({updateComponent:i,context:p,signal:c}){const{apiConfig:a,productId:s,zoneId:d="par",currency:u="EUR"}=p;i("state",{type:"loading"}),function({apiConfig:i,productId:p,zoneId:c,currency:a,signal:s}){return t({apiConfig:i,zoneId:c,currency:a,signal:s}).then((t=>{if("cellar"===p)return{name:"Cellar",...n(t)};if("fsbucket"===p)return{name:"FS Bucket",...r(t)};if("pulsar"===p)return{name:"Pulsar",...e(t)};if("heptapod"===p)return{name:"Heptapod",...o(t)};throw new Error(`Cannot find product "${p}"`)}))}({apiConfig:a,productId:s,zoneId:d,currency:u,signal:c}).then((t=>{i("state",{type:"loaded",name:t.name,sections:t.sections})})).catch((t=>{console.error(t),i("state",{type:"error"})}))}});
//# sourceMappingURL=cc-pricing-product-consumption.smart.js.map
