"use strict";Object.defineProperty(exports, "__esModule", {value: true});

var _chunkJOU3HBLMjs = require('./chunk-JOU3HBLM.js');


var _chunkLFEO4ZPMjs = require('./chunk-LFEO4ZPM.js');


var _chunkVCFJOUM7js = require('./chunk-VCFJOUM7.js');


var _chunk37QP5MV6js = require('./chunk-37QP5MV6.js');

// tmp-babel/__shared__/web/SocialInput/index.js
var _react = require('react');
var _inputs = require('@baseapp-frontend/design-system/components/web/inputs');
var _jsxruntime = require('react/jsx-runtime');
function _typeof(o) {
  "@babel/helpers - typeof";
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
    return typeof o2;
  } : function(o2) {
    return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
  }, _typeof(o);
}
function ownKeys(e, r) {
  var t = Object.keys(e);
  if (Object.getOwnPropertySymbols) {
    var o = Object.getOwnPropertySymbols(e);
    r && (o = o.filter(function(r2) {
      return Object.getOwnPropertyDescriptor(e, r2).enumerable;
    })), t.push.apply(t, o);
  }
  return t;
}
function _objectSpread(e) {
  for (var r = 1; r < arguments.length; r++) {
    var t = null != arguments[r] ? arguments[r] : {};
    r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
      _defineProperty(e, r2, t[r2]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
      Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
    });
  }
  return e;
}
function _defineProperty(e, r, t) {
  return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
}
function _toPropertyKey(t) {
  var i = _toPrimitive(t, "string");
  return "symbol" == _typeof(i) ? i : i + "";
}
function _toPrimitive(t, r) {
  if ("object" != _typeof(t) || !t) return t;
  var e = t[Symbol.toPrimitive];
  if (void 0 !== e) {
    var i = e.call(t, r || "default");
    if ("object" != _typeof(i)) return i;
    throw new TypeError("@@toPrimitive must return a primitive value.");
  }
  return ("string" === r ? String : Number)(t);
}
var SocialInput = /* @__PURE__ */ _react.forwardRef.call(void 0, function(_ref, ref) {
  var _ref$placeholder = _ref.placeholder, placeholder = _ref$placeholder === void 0 ? "Message..." : _ref$placeholder, autoFocusInput = _ref.autoFocusInput, _ref$SocialTextField = _ref.SocialTextField, SocialTextField = _ref$SocialTextField === void 0 ? _inputs.SocialTextField : _ref$SocialTextField, _ref$SocialTextFieldP = _ref.SocialTextFieldProps, SocialTextFieldProps = _ref$SocialTextFieldP === void 0 ? {} : _ref$SocialTextFieldP, _ref$SocialUpsertActi = _ref.SocialUpsertActions, SocialUpsertActions = _ref$SocialUpsertActi === void 0 ? _chunkVCFJOUM7js.SocialUpsertActions_default : _ref$SocialUpsertActi, _ref$SubmitActions = _ref.SubmitActions, SubmitActions = _ref$SubmitActions === void 0 ? _chunkJOU3HBLMjs.SubmitActions_default : _ref$SubmitActions, _ref$SubmitActionsPro = _ref.SubmitActionsProps, SubmitActionsProps = _ref$SubmitActionsPro === void 0 ? {} : _ref$SubmitActionsPro, onKeyDown = _ref.onKeyDown, _ref$formId = _ref.formId, formId = _ref$formId === void 0 ? "text-field-form" : _ref$formId, submit = _ref.submit, isLoading = _ref.isLoading, _ref$isReply = _ref.isReply, isReply = _ref$isReply === void 0 ? false : _ref$isReply, replyTargetName = _ref.replyTargetName, onCancelReply = _ref.onCancelReply, form = _ref.form;
  var defaultKeyDown = function defaultKeyDown2(event, onSubmit) {
    if (event.key === "Enter" && event.ctrlKey) {
      event.preventDefault();
      onSubmit();
    }
  };
  var handleKeyDown = function handleKeyDown2(event) {
    if (onKeyDown) {
      onKeyDown(event, function() {
        return form.handleSubmit(submit)(event);
      });
    } else {
      defaultKeyDown(event, function() {
        return form.handleSubmit(submit)(event);
      });
    }
  };
  var isCreateButtonDisabled = isLoading || !form.formState.isValid || !form.formState.isDirty;
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLFEO4ZPMjs.Form, {
    id: formId,
    onSubmit: form.handleSubmit(submit),
    children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, SocialTextField, _objectSpread(_objectSpread({
      inputRef: ref,
      name: _chunk37QP5MV6js.SOCIAL_UPSERT_FORM.body,
      control: form.control,
      onKeyDown: handleKeyDown,
      placeholder,
      autoFocus: autoFocusInput,
      isReply,
      replyTargetName,
      onCancelReply
    }, SocialTextFieldProps), {}, {
      children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, SocialUpsertActions, {}), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SubmitActions, _objectSpread({
        formId,
        disabled: isCreateButtonDisabled
      }, SubmitActionsProps))]
    }))
  });
});
var SocialInput_default = SocialInput;



exports.SocialInput_default = SocialInput_default;
//# sourceMappingURL=chunk-2VDALES5.js.map