import{getAllZones as e}from"@clevercloud/client/esm/api/v4/product.js";import{ONE_DAY as t}from"@clevercloud/client/esm/with-cache.js";import{sendToApi as n}from"./lib/send-to-api.js";import{defineSmartComponent as o}from"./lib/smart/define-smart-component.js";import"./cc-smart-container.js";import"./cc-pricing-header.js";o({selector:"cc-pricing-header",params:{apiConfig:{type:Object},zoneId:{type:String,optional:!0}},onContextUpdate({container:o,component:c,context:i,onEvent:r,updateComponent:a,signal:p}){const{apiConfig:s,zoneId:l="par"}=i;r("cc-pricing-zone-change",(e=>{o.context={...o.context,zoneId:e}})),r("cc-pricing-currency-change",(e=>{o.context={...o.context,currency:e}})),"loading"===c.state.type?function({apiConfig:o,signal:c}){return e().then(n({apiConfig:o,signal:c,cacheDelay:t})).then((e=>e.filter((e=>e.tags.includes("for:applications"))).map((e=>function(e){const t=e.tags.filter((e=>!e.startsWith("for:")));return{...e,tags:t}}(e)))))}({apiConfig:s,signal:p}).then((e=>{a("state",{type:"loaded",zones:e}),a("selectedZoneId",l)})).catch((e=>{a("state",{type:"error"}),console.error(e)})):a("selectedZoneId",l)}});
//# sourceMappingURL=cc-pricing-header.smart.js.map
