/*! Built with http://stenciljs.com */
const{h:t}=window.webcomponents;import{b as a}from"./chunk-67be3191.js";import"./chunk-7fb7349a.js";import"./chunk-25ecf4a4.js";var s=function(t,a,s,n){return new(s||(s=Promise))(function(r,e){function i(t){try{l(n.next(t))}catch(t){e(t)}}function o(t){try{l(n.throw(t))}catch(t){e(t)}}function l(t){t.done?r(t.value):new s(function(a){a(t.value)}).then(i,o)}l((n=n.apply(t,a||[])).next())})};class n{constructor(){this.paramsJson="{}",this.transform="none",this.translate=a.instance}componentDidLoad(){this.postRender()}componentDidUpdate(){this.postRender()}postRender(){return s(this,void 0,void 0,function*(){let t=this.el.innerText.trim();if(this.language&&this.language!==this.translate.language&&(this.translationsLocation&&(this.translate.translationsLocation=this.translationsLocation),yield this.translate.use(this.language)),this.translation=this.translate.get(t),this.params&&(this.translation=this.translate.get(t,this.params)),"{}"!==this.paramsJson){let a=[t];JSON.parse(this.paramsJson).forEach(t=>{a.push(t)}),this.translation=this.translate.get.apply(this.translate,a)}this.transform&&this.transformTranslation(this.transform),this.el.innerText=this.translation})}get(t){return this.translate.get(t)}set(t,a,s){this.translation=this.translate.get(t)}transformTranslation(t){"lowercase"===t&&(this.translation=this.translation.toLowerCase()),"lowercaseFirst"===t&&(this.translation=this.translation.charAt(0).toLowerCase()+this.translation.slice(1)),"uppercase"===t&&(this.translation=this.translation.toUpperCase()),"uppercaseFirst"===t&&(this.translation=this.translation.charAt(0).toUpperCase()+this.translation.slice(1))}render(){return t("span",null,t("slot",null))}static get is(){return"ema-translate"}static get properties(){return{el:{elementRef:!0},get:{method:!0},language:{type:String,attr:"language"},params:{type:String,attr:"params"},paramsJson:{type:String,attr:"params-json"},set:{method:!0},transform:{type:String,attr:"transform"},translation:{state:!0},translationsLocation:{type:String,attr:"translations-location"}}}}export{n as EmaTranslate};