import{a as F,b as R,c as K}from"./chunk-XEHBQAFR.mjs";var b={};R(b,{default:()=>O});var f,O,M=F(()=>{"use strict";f=function(){var e={defaultValue:null,kind:"LocalArgument",name:"connections"},n={defaultValue:null,kind:"LocalArgument",name:"input"},a=[{kind:"Variable",name:"input",variableName:"input"}],t={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},r={alias:null,args:null,concreteType:"ErrorType",kind:"LinkedField",name:"errors",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"field",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"messages",storageKey:null}],storageKey:null},i=[t];return{fragment:{argumentDefinitions:[e,n],kind:"Fragment",metadata:null,name:"SendMessageMutation",selections:[{alias:null,args:a,concreteType:"ChatRoomSendMessagePayload",kind:"LinkedField",name:"chatRoomSendMessage",plural:!1,selections:[{alias:null,args:null,concreteType:"MessageEdge",kind:"LinkedField",name:"message",plural:!1,selections:[{alias:null,args:null,concreteType:"Message",kind:"LinkedField",name:"node",plural:!1,selections:[t,{args:null,kind:"FragmentSpread",name:"MessageItemFragment"}],storageKey:null}],storageKey:null},r],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[n,e],kind:"Operation",name:"SendMessageMutation",selections:[{alias:null,args:a,concreteType:"ChatRoomSendMessagePayload",kind:"LinkedField",name:"chatRoomSendMessage",plural:!1,selections:[{alias:null,args:null,concreteType:"MessageEdge",kind:"LinkedField",name:"message",plural:!1,selections:[{alias:null,args:null,concreteType:"Message",kind:"LinkedField",name:"node",plural:!1,selections:[t,{alias:null,args:null,kind:"ScalarField",name:"content",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"created",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"deleted",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"extraData",storageKey:null},{alias:null,args:null,concreteType:"Message",kind:"LinkedField",name:"inReplyTo",plural:!1,selections:i,storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"isRead",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"pk",storageKey:null},{alias:null,args:null,concreteType:"Profile",kind:"LinkedField",name:"profile",plural:!1,selections:i,storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"verb",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,filters:null,handle:"prependEdge",key:"",kind:"LinkedHandle",name:"message",handleArgs:[{kind:"Variable",name:"connections",variableName:"connections"}]},r],storageKey:null}]},params:{cacheID:"a487dae2ea900c81e5f2ea2b494dc41f",id:null,metadata:{},name:"SendMessageMutation",operationKind:"mutation",text:`mutation SendMessageMutation(
  $input: ChatRoomSendMessageInput!
) {
  chatRoomSendMessage(input: $input) {
    message {
      node {
        id
        ...MessageItemFragment
      }
    }
    errors {
      field
      messages
    }
  }
}

fragment MessageItemFragment on Message {
  id
  content
  created
  deleted
  extraData
  inReplyTo {
    id
  }
  isRead
  pk
  profile {
    id
  }
  verb
}
`}}}();f.hash="7fd0124ce48b9ceff7e9bf2091d0709e";O=f});import{useNotification as E}from"@baseapp-frontend/utils";import{useMutation as x}from"react-relay";function g(e){"@babel/helpers - typeof";return g=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},g(e)}var s;function v(e,n){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),a.push.apply(a,t)}return a}function S(e){for(var n=1;n<arguments.length;n++){var a=arguments[n]!=null?arguments[n]:{};n%2?v(Object(a),!0).forEach(function(t){T(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):v(Object(a)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}function T(e,n,a){return(n=j(n))in e?Object.defineProperty(e,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[n]=a,e}function j(e){var n=I(e,"string");return g(n)=="symbol"?n:n+""}function I(e,n){if(g(e)!="object"||!e)return e;var a=e[Symbol.toPrimitive];if(a!==void 0){var t=a.call(e,n||"default");if(g(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function P(e,n){return w(e)||L(e,n)||A(e,n)||_()}function _(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function A(e,n){if(e){if(typeof e=="string")return k(e,n);var a={}.toString.call(e).slice(8,-1);return a==="Object"&&e.constructor&&(a=e.constructor.name),a==="Map"||a==="Set"?Array.from(e):a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?k(e,n):void 0}}function k(e,n){(n==null||n>e.length)&&(n=e.length);for(var a=0,t=Array(n);a<n;a++)t[a]=e[a];return t}function L(e,n){var a=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(a!=null){var t,r,i,u,d=[],c=!0,l=!1;try{if(i=(a=a.call(e)).next,n===0){if(Object(a)!==a)return;c=!1}else for(;!(c=(t=i.call(a)).done)&&(d.push(t.value),d.length!==n);c=!0);}catch(y){l=!0,r=y}finally{try{if(!c&&a.return!=null&&(u=a.return(),Object(u)!==u))return}finally{if(l)throw r}}return d}}function w(e){if(Array.isArray(e))return e}var C=(s!==void 0||(s=(M(),K(b)),s.hash&&s.hash!=="7fd0124ce48b9ceff7e9bf2091d0709e"&&console.error("The definition of 'SendMessageMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data.")),s),N=function(){var n=E(),a=n.sendToast,t=x(C),r=P(t,2),i=r[0],u=r[1],d=function(l){return i(S(S({},l),{},{onCompleted:function(m,o){var p;o?.forEach(function(h){a(h.message,{type:"error"})}),l==null||(p=l.onCompleted)===null||p===void 0||p.call(l,m,o)},onError:function(m){var o;a(m.message,{type:"error"}),l==null||(o=l.onError)===null||o===void 0||o.call(l,m)}}))};return[d,u]};export{C as a,N as b};
//# sourceMappingURL=chunk-IN7LXYW5.mjs.map