import{a as F,b as K,c as P}from"./chunk-XEHBQAFR.mjs";var k={};K(k,{default:()=>S});var f,S,b=F(()=>{"use strict";f=function(){var e=[{defaultValue:null,kind:"LocalArgument",name:"input"}],n=[{kind:"Variable",name:"input",variableName:"input"}],t={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},a={alias:null,args:null,kind:"ScalarField",name:"body",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},u=[{alias:null,args:null,kind:"ScalarField",name:"total",storageKey:null}],i={alias:null,args:null,concreteType:"CommentsCount",kind:"LinkedField",name:"commentsCount",plural:!1,selections:u,storageKey:null},o=[{kind:"Literal",name:"first",value:5},{kind:"Literal",name:"orderBy",value:"-is_pinned,-created"}],s={alias:null,args:null,kind:"ScalarField",name:"pk",storageKey:null};return{fragment:{argumentDefinitions:e,kind:"Fragment",metadata:null,name:"CommentUpdateMutation",selections:[{alias:null,args:n,concreteType:"CommentUpdatePayload",kind:"LinkedField",name:"commentUpdate",plural:!1,selections:[{alias:null,args:null,concreteType:"Comment",kind:"LinkedField",name:"comment",plural:!1,selections:[t,a,{args:null,kind:"FragmentSpread",name:"CommentsList_comments"}],storageKey:null},r],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:e,kind:"Operation",name:"CommentUpdateMutation",selections:[{alias:null,args:n,concreteType:"CommentUpdatePayload",kind:"LinkedField",name:"commentUpdate",plural:!1,selections:[{alias:null,args:null,concreteType:"Comment",kind:"LinkedField",name:"comment",plural:!1,selections:[t,a,{kind:"InlineFragment",selections:[i,{alias:null,args:o,concreteType:"CommentConnection",kind:"LinkedField",name:"comments",plural:!1,selections:[{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"CommentEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"Comment",kind:"LinkedField",name:"node",plural:!1,selections:[t,{alias:null,args:null,kind:"ScalarField",name:"isPinned",storageKey:null},s,a,{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[t,s,{alias:null,args:null,kind:"ScalarField",name:"fullName",storageKey:null},{alias:null,args:[{kind:"Literal",name:"height",value:50},{kind:"Literal",name:"width",value:50}],concreteType:"File",kind:"LinkedField",name:"avatar",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"url",storageKey:null}],storageKey:"avatar(height:50,width:50)"}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"created",storageKey:null},i,{alias:"canChange",args:[{kind:"Literal",name:"perm",value:"change"}],kind:"ScalarField",name:"hasPerm",storageKey:'hasPerm(perm:"change")'},{alias:"canDelete",args:[{kind:"Literal",name:"perm",value:"delete"}],kind:"ScalarField",name:"hasPerm",storageKey:'hasPerm(perm:"delete")'},{alias:"canReport",args:[{kind:"Literal",name:"perm",value:"report"}],kind:"ScalarField",name:"hasPerm",storageKey:'hasPerm(perm:"report")'},{alias:"canPin",args:[{kind:"Literal",name:"perm",value:"pin"}],kind:"ScalarField",name:"hasPerm",storageKey:'hasPerm(perm:"pin")'},{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"ReactionsCount",kind:"LinkedField",name:"reactionsCount",plural:!1,selections:u,storageKey:null},{alias:null,args:null,concreteType:"Reaction",kind:"LinkedField",name:"myReaction",plural:!1,selections:[t,{alias:null,args:null,kind:"ScalarField",name:"reactionType",storageKey:null}],storageKey:null}],type:"ReactionsInterface",abstractKey:"__isReactionsInterface"},{kind:"TypeDiscriminator",abstractKey:"__isCommentsInterface"}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null}],storageKey:null}],storageKey:'comments(first:5,orderBy:"-is_pinned,-created")'},{alias:null,args:o,filters:[],handle:"connection",key:"CommentsList_comments",kind:"LinkedHandle",name:"comments"}],type:"CommentsInterface",abstractKey:"__isCommentsInterface"}],storageKey:null},r],storageKey:null}]},params:{cacheID:"516cc6fe05cec2d5539841a5d9b94dad",id:null,metadata:{},name:"CommentUpdateMutation",operationKind:"mutation",text:`mutation CommentUpdateMutation(
  $input: CommentUpdateInput!
) {
  commentUpdate(input: $input) {
    comment {
      id
      body
      ...CommentsList_comments
    }
    errors {
      field
      messages
    }
  }
}

fragment CommentItem_comment on Comment {
  id
  pk
  body
  isPinned
  user {
    id
    pk
    fullName
    avatar(width: 50, height: 50) {
      url
    }
  }
  created
  commentsCount {
    total
  }
  canChange: hasPerm(perm: "change")
  canDelete: hasPerm(perm: "delete")
  canReport: hasPerm(perm: "report")
  canPin: hasPerm(perm: "pin")
  ...ReactionButton_target
  ...CommentItem_target
}

fragment CommentItem_target on CommentsInterface {
  __isCommentsInterface: __typename
  id
}

fragment CommentsList_comments on CommentsInterface {
  __isCommentsInterface: __typename
  id
  commentsCount {
    total
  }
  comments(first: 5, orderBy: "-is_pinned,-created") {
    pageInfo {
      endCursor
      hasNextPage
    }
    edges {
      node {
        id
        isPinned
        ...CommentItem_comment
        __typename
      }
      cursor
    }
  }
  ...CommentItem_target
}

fragment ReactionButton_target on ReactionsInterface {
  __isReactionsInterface: __typename
  id
  reactionsCount {
    total
  }
  myReaction {
    id
    reactionType
  }
}
`}}}();f.hash="a65012ae50ff01b71fc9c930881f0c1a";S=f});import{useNotification as w}from"@baseapp-frontend/utils";import{useMutation as A}from"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 d;function v(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,a)}return t}function C(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};n%2?v(Object(t),!0).forEach(function(a){I(e,a,t[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):v(Object(t)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(t,a))})}return e}function I(e,n,t){return(n=L(n))in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function L(e){var n=T(e,"string");return c(n)=="symbol"?n:n+""}function T(e,n){if(c(e)!="object"||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var a=t.call(e,n||"default");if(c(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function U(e,n){return j(e)||R(e,n)||O(e,n)||M()}function M(){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 O(e,n){if(e){if(typeof e=="string")return h(e,n);var t={}.toString.call(e).slice(8,-1);return t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set"?Array.from(e):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?h(e,n):void 0}}function h(e,n){(n==null||n>e.length)&&(n=e.length);for(var t=0,a=Array(n);t<n;t++)a[t]=e[t];return a}function R(e,n){var t=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(t!=null){var a,r,u,i,o=[],s=!0,l=!1;try{if(u=(t=t.call(e)).next,n===0){if(Object(t)!==t)return;s=!1}else for(;!(s=(a=u.call(t)).done)&&(o.push(a.value),o.length!==n);s=!0);}catch(y){l=!0,r=y}finally{try{if(!s&&t.return!=null&&(i=t.return(),Object(i)!==i))return}finally{if(l)throw r}}return o}}function j(e){if(Array.isArray(e))return e}var x=(d!==void 0||(d=(b(),P(k)),d.hash&&d.hash!=="a65012ae50ff01b71fc9c930881f0c1a"&&console.error("The definition of 'CommentUpdateMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data.")),d),N=function(){var n=w(),t=n.sendToast,a=A(x),r=U(a,2),u=r[0],i=r[1],o=function(l){return u(C(C({},l),{},{onCompleted:function(p,m){var g;m?.forEach(function(_){t(_.message,{type:"error"})}),l==null||(g=l.onCompleted)===null||g===void 0||g.call(l,p,m)},onError:function(p){var m;t(p.message,{type:"error"}),l==null||(m=l.onError)===null||m===void 0||m.call(l,p)}}))};return[o,i]};export{x as a,N as b};
//# sourceMappingURL=chunk-2635KPIQ.mjs.map