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

var _chunkBZEK64RMjs = require('./chunk-BZEK64RM.js');




var _chunkGWVQVSWBjs = require('./chunk-GWVQVSWB.js');

// tmp-babel/content-feed/web/PostForm/index.js
var _inputs = require('@baseapp-frontend/design-system/components/web/inputs');
var _lab = require('@mui/lab');
var _material = require('@mui/material');
var _reacthookform = require('react-hook-form');
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 PostForm = function PostForm2(_ref) {
  var form = _ref.form, onSubmit = _ref.onSubmit, onCancel = _ref.onCancel, isSaving = _ref.isSaving;
  var isReactionsEnabled = form.watch("isReactionsEnabled");
  var _form$formState = form.formState, isDirty = _form$formState.isDirty, isValid = _form$formState.isValid;
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGWVQVSWBjs.RootContainer, {
    children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", {
      onSubmit,
      children: [/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGWVQVSWBjs.HeaderContainer, {
        children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, {
          component: "h4",
          variant: "h4",
          children: "New Post"
        }), /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGWVQVSWBjs.ButtonContainer, {
          children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Button, {
            variant: "outlined",
            color: "inherit",
            onClick: onCancel,
            disableRipple: true,
            children: "Cancel"
          }), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lab.LoadingButton, {
            color: "inherit",
            type: "submit",
            loading: isSaving,
            disabled: !isDirty || !isValid || isSaving,
            sx: {
              maxWidth: "fit-content",
              justifySelf: "end"
            },
            children: "Publish"
          })]
        })]
      }), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBZEK64RMjs.PostImageDropzone_default, {
        form
      }), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Box, {
        children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _inputs.TextField, {
          name: "content",
          type: "text",
          placeholder: "What is on your mind?",
          multiline: true,
          rows: 4,
          control: form.control
        })
      }), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reacthookform.Controller, {
        name: "isReactionsEnabled",
        control: form.control,
        render: function render(_ref2) {
          var field = _ref2.field;
          return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.FormControlLabel, {
            control: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Switch, _objectSpread(_objectSpread({}, field), {}, {
              checked: !isReactionsEnabled,
              onChange: function onChange(e) {
                return field.onChange(!e.target.checked);
              }
            })),
            label: "Disable Reactions to this post"
          });
        }
      })]
    })
  });
};
var PostForm_default = PostForm;



exports.PostForm_default = PostForm_default;
//# sourceMappingURL=chunk-IDQWBAHK.js.map