"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkXD2OIZABjs = require('./chunk-XD2OIZAB.js');var h={};_chunkXD2OIZABjs.b.call(void 0, h,{default:()=>K});var f,K,k=_chunkXD2OIZABjs.a.call(void 0, ()=>{"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},o=[{alias:null,args:null,kind:"ScalarField",name:"url",storageKey:null}];return{fragment:{argumentDefinitions:[e,n],kind:"Fragment",metadata:null,name:"UpdateChatRoomMutation",selections:[{alias:null,args:a,concreteType:"ChatRoomUpdatePayload",kind:"LinkedField",name:"chatRoomUpdate",plural:!1,selections:[{alias:null,args:null,concreteType:"ChatRoomEdge",kind:"LinkedField",name:"room",plural:!1,selections:[{alias:null,args:null,concreteType:"ChatRoom",kind:"LinkedField",name:"node",plural:!1,selections:[t,{args:null,kind:"FragmentSpread",name:"LastMessageFragment"},{args:null,kind:"FragmentSpread",name:"TitleFragment"},{args:null,kind:"FragmentSpread",name:"UnreadMessagesCountFragment"}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"ChatRoomParticipant",kind:"LinkedField",name:"removedParticipants",plural:!0,selections:[t],storageKey:null},r],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[n,e],kind:"Operation",name:"UpdateChatRoomMutation",selections:[{alias:null,args:a,concreteType:"ChatRoomUpdatePayload",kind:"LinkedField",name:"chatRoomUpdate",plural:!1,selections:[{alias:null,args:null,concreteType:"ChatRoomEdge",kind:"LinkedField",name:"room",plural:!1,selections:[{alias:null,args:null,concreteType:"ChatRoom",kind:"LinkedField",name:"node",plural:!1,selections:[t,{alias:null,args:null,kind:"ScalarField",name:"lastMessageTime",storageKey:null},{alias:null,args:null,concreteType:"Message",kind:"LinkedField",name:"lastMessage",plural:!1,selections:[t,{alias:null,args:null,kind:"ScalarField",name:"content",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"isGroup",storageKey:null},{alias:null,args:[{kind:"Literal",name:"first",value:2}],concreteType:"ChatRoomParticipantConnection",kind:"LinkedField",name:"participants",plural:!1,selections:[{alias:null,args:null,concreteType:"ChatRoomParticipantEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"ChatRoomParticipant",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,concreteType:"Profile",kind:"LinkedField",name:"profile",plural:!1,selections:[t,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:[{kind:"Literal",name:"height",value:100},{kind:"Literal",name:"width",value:100}],concreteType:"File",kind:"LinkedField",name:"image",plural:!1,selections:o,storageKey:"image(height:100,width:100)"}],storageKey:null},t],storageKey:null}],storageKey:null}],storageKey:"participants(first:2)"},{alias:null,args:[{kind:"Literal",name:"height",value:144},{kind:"Literal",name:"width",value:144}],concreteType:"File",kind:"LinkedField",name:"image",plural:!1,selections:o,storageKey:"image(height:144,width:144)"},{alias:null,args:null,kind:"ScalarField",name:"title",storageKey:null},{alias:null,args:null,concreteType:"UnreadMessageCount",kind:"LinkedField",name:"unreadMessages",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"count",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"markedUnread",storageKey:null},t],storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"ChatRoomParticipant",kind:"LinkedField",name:"removedParticipants",plural:!0,selections:[t,{alias:null,args:null,filters:null,handle:"deleteEdge",key:"",kind:"ScalarHandle",name:"id",handleArgs:[{kind:"Variable",name:"connections",variableName:"connections"}]}],storageKey:null},r],storageKey:null}]},params:{cacheID:"02ee6230858c1fc8bfc1d3cdff0ff168",id:null,metadata:{},name:"UpdateChatRoomMutation",operationKind:"mutation",text:`mutation UpdateChatRoomMutation(
  $input: ChatRoomUpdateInput!
) {
  chatRoomUpdate(input: $input) {
    room {
      node {
        id
        ...LastMessageFragment
        ...TitleFragment
        ...UnreadMessagesCountFragment
      }
    }
    removedParticipants {
      id
    }
    errors {
      field
      messages
    }
  }
}

fragment GroupTitleFragment on ChatRoom {
  id
  image(width: 144, height: 144) {
    url
  }
  title
}

fragment LastMessageFragment on ChatRoom {
  id
  lastMessageTime
  lastMessage {
    id
    content
  }
}

fragment RoomTitleFragment on ChatRoom {
  id
  participants(first: 2) {
    edges {
      node {
        profile {
          id
          name
          image(width: 100, height: 100) {
            url
          }
        }
        id
      }
    }
  }
}

fragment TitleFragment on ChatRoom {
  id
  isGroup
  ...RoomTitleFragment
  ...GroupTitleFragment
}

fragment UnreadMessagesCountFragment on ChatRoom {
  id
  unreadMessages {
    count
    markedUnread
    id
  }
}
`}}}();f.hash="814ba3e87407537b5be32eb40c45a80d";K=f});var _utils = require('@baseapp-frontend/utils');var _reactrelay = require('react-relay');function c(e){"@babel/helpers - typeof";return c=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},c(e)}var s;function b(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 v(e){for(var n=1;n<arguments.length;n++){var a=arguments[n]!=null?arguments[n]:{};n%2?b(Object(a),!0).forEach(function(t){S(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):b(Object(a)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}function S(e,n,a){return(n=U(n))in e?Object.defineProperty(e,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[n]=a,e}function U(e){var n=L(e,"string");return c(n)=="symbol"?n:n+""}function L(e,n){if(c(e)!="object"||!e)return e;var a=e[Symbol.toPrimitive];if(a!==void 0){var t=a.call(e,n||"default");if(c(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function P(e,n){return A(e)||w(e,n)||j(e,n)||O()}function O(){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 j(e,n){if(e){if(typeof e=="string")return F(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)?F(e,n):void 0}}function F(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 w(e,n){var a=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(a!=null){var t,r,o,u,d=[],m=!0,l=!1;try{if(o=(a=a.call(e)).next,n===0){if(Object(a)!==a)return;m=!1}else for(;!(m=(t=o.call(a)).done)&&(d.push(t.value),d.length!==n);m=!0);}catch(g){l=!0,r=g}finally{try{if(!m&&a.return!=null&&(u=a.return(),Object(u)!==u))return}finally{if(l)throw r}}return d}}function A(e){if(Array.isArray(e))return e}var I=(s!==void 0||(s=(k(),_chunkXD2OIZABjs.c.call(void 0, h)),s.hash&&s.hash!=="814ba3e87407537b5be32eb40c45a80d"&&console.error("The definition of 'UpdateChatRoomMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data.")),s),q= exports.b =function(){var n=_utils.useNotification.call(void 0, ),a=n.sendToast,t=_reactrelay.useMutation.call(void 0, I),r=P(t,2),o=r[0],u=r[1],d=function(l){return o(v(v({},l),{},{onCompleted:function(p,i){var y;_optionalChain([i, 'optionalAccess', _2 => _2.forEach, 'call', _3 => _3(function(R){a(R.message,{type:"error"})})]),l==null||(y=l.onCompleted)===null||y===void 0||y.call(l,p,i)},onError:function(p){var i;a(p.message,{type:"error"}),l==null||(i=l.onError)===null||i===void 0||i.call(l,p)}}))};return[d,u]};exports.a = I; exports.b = q;
//# sourceMappingURL=chunk-XYEPI42P.js.map