/*! Built with http://stenciljs.com */
const{h:t}=window.webcomponents;import{a as s}from"./chunk-541bf05a.js";import"./chunk-7fb7349a.js";import"./chunk-e405d082.js";var a=function(t,s,a,n){return new(a||(a=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 a(function(s){s(t.value)}).then(i,o)}l((n=n.apply(t,s||[])).next())})};class n{constructor(){this.paramsJson="{}",this.transform="none",this.translate=s.instance}componentDidLoad(){this.postRender()}componentDidUpdate(){this.postRender()}postRender(){return a(this,void 0,void 0,function*(){let t=this.el.querySelector("span").innerText.trim();if(this.string&&""!==this.string&&(t=this.string),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 s=[t];JSON.parse(this.paramsJson).forEach(t=>{s.push(t)}),this.translation=this.translate.get.apply(this.translate,s)}this.transform&&this.transformTranslation(this.transform),this.el.querySelector("span").innerText=this.translation})}get(t){return this.translate.get(t)}set(t,s,a){this.translation=this.translate.get(t),this.postRender()}setTranslateService(t){this.translate=t,this.postRender()}update(){this.postRender()}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},setTranslateService:{method:!0},string:{type:String,attr:"string"},transform:{type:String,attr:"transform"},translation:{state:!0},translationsLocation:{type:String,attr:"translations-location"},update:{method:!0}}}}export{n as EmaTranslate};