(()=>{function e(n,i,a){var e,l=this;function t(){var e=jQuery(i).find(".text-sizer"),n=jQuery(i).find("input"),t=l.value||n.attr("placeholder")||n.val()||"";e.text(t.trim()),a(function(){n.css("width",e.width()+34),n.focus()})}function o(){return l.editMode=!1,l.value=e,l.onCancel(),n.reject()}_.assign(l,{editMode:!1,edit:function(){l.disabled||(e=l.value,l.editMode=!0,a(t))},onValueChange:t,save:function(){var e=l.onSave({value:l.value});l.editMode=!1,n.when(e).catch(o)},cancel:o})}e.$inject=["$q","$element","$timeout"],angular.module("c8y.ui").component("c8yInplaceInput",{bindings:{id:"<",placeholder:"<",maxlength:"<",required:"<",disabled:"<",value:"<",onSave:"&",onCancel:"&"},transclude:{view:"?view",edit:"?edit",buttons:"?buttons"},templateUrl:":::PLUGIN_PATH:::/ui/components/inplaceInput.html",controller:e,controllerAs:"vm"})})();