'use strict';

var BaseComponent = require('primevue/basecomponent');
var InputTextStyle = require('primevue/inputtext/style');
var vue = require('vue');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
var InputTextStyle__default = /*#__PURE__*/_interopDefaultLegacy(InputTextStyle);

var script$1 = {
  name: 'BaseInputText',
  "extends": BaseComponent__default["default"],
  props: {
    modelValue: null,
    size: {
      type: String,
      "default": null
    },
    invalid: {
      type: Boolean,
      "default": false
    },
    peculiarity: {
      type: String,
      "default": null
    },
    variant: {
      type: String,
      "default": 'base'
    }
  },
  style: InputTextStyle__default["default"],
  provide: function provide() {
    return {
      $parentInstance: this
    };
  }
};

var script = {
  name: 'InputText',
  "extends": script$1,
  emits: ['update:modelValue'],
  methods: {
    getPTOptions: function getPTOptions(key) {
      return this.ptm(key, {
        context: {
          filled: this.filled,
          disabled: this.$attrs.disabled || this.$attrs.disabled === ''
        }
      });
    },
    onInput: function onInput(event) {
      this.$emit('update:modelValue', event.target.value);
    }
  },
  computed: {
    filled: function filled() {
      return this.modelValue != null && this.modelValue.toString().length > 0;
    }
  }
};

var _hoisted_1 = ["value"];
function render(_ctx, _cache, $props, $setup, $data, $options) {
  return vue.openBlock(), vue.createElementBlock("input", vue.mergeProps({
    "class": _ctx.cx('root'),
    value: _ctx.modelValue,
    onInput: _cache[0] || (_cache[0] = function () {
      return $options.onInput && $options.onInput.apply($options, arguments);
    })
  }, $options.getPTOptions('root')), null, 16, _hoisted_1);
}

script.render = render;

module.exports = script;
