import{a as p,b as f,c as m}from"./chunk-XEHBQAFR.mjs";var h={};f(h,{default:()=>K});var R,K,T=p(()=>{"use strict";R=function(){var e={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"ReactionButton_target",selections:[e,{alias:null,args:null,concreteType:"ReactionsCount",kind:"LinkedField",name:"reactionsCount",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"total",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"Reaction",kind:"LinkedField",name:"myReaction",plural:!1,selections:[e,{alias:null,args:null,kind:"ScalarField",name:"reactionType",storageKey:null}],storageKey:null}],type:"ReactionsInterface",abstractKey:"__isReactionsInterface"}}();R.hash="c3861c327bdc15c2a59dfbfe2ce2ed12";K=R});var v={};f(v,{default:()=>B});var k,B,b=p(()=>{"use strict";k=function(){var e=[{defaultValue:null,kind:"LocalArgument",name:"input"}],t=[{kind:"Variable",name:"input",variableName:"input"}],n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},a=[n,{alias:null,args:null,kind:"ScalarField",name:"reactionType",storageKey:null}],r={alias:null,args:null,concreteType:"ReactionEdge",kind:"LinkedField",name:"reaction",plural:!1,selections:[{alias:null,args:null,concreteType:"Reaction",kind:"LinkedField",name:"node",plural:!1,selections:a,storageKey:null}],storageKey:null},l={alias:null,args:null,kind:"ScalarField",name:"reactionDeletedId",storageKey:null};return{fragment:{argumentDefinitions:e,kind:"Fragment",metadata:null,name:"ReactionButtonMutation",selections:[{alias:null,args:t,concreteType:"ReactionTogglePayload",kind:"LinkedField",name:"reactionToggle",plural:!1,selections:[r,l,{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"target",plural:!1,selections:[n,{args:null,kind:"FragmentSpread",name:"ReactionButton_target"}],storageKey:null}],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:e,kind:"Operation",name:"ReactionButtonMutation",selections:[{alias:null,args:t,concreteType:"ReactionTogglePayload",kind:"LinkedField",name:"reactionToggle",plural:!1,selections:[r,l,{alias:null,args:null,filters:null,handle:"deleteRecord",key:"",kind:"ScalarHandle",name:"reactionDeletedId"},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"target",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},n,{kind:"TypeDiscriminator",abstractKey:"__isReactionsInterface"},{alias:null,args:null,concreteType:"ReactionsCount",kind:"LinkedField",name:"reactionsCount",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"total",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"Reaction",kind:"LinkedField",name:"myReaction",plural:!1,selections:a,storageKey:null}],storageKey:null}],storageKey:null}]},params:{cacheID:"10b1f38991c6795cddbb1a4cf30f2286",id:null,metadata:{},name:"ReactionButtonMutation",operationKind:"mutation",text:`mutation ReactionButtonMutation(
  $input: ReactionToggleInput!
) {
  reactionToggle(input: $input) {
    reaction {
      node {
        id
        reactionType
      }
    }
    reactionDeletedId
    target {
      __typename
      id
      ...ReactionButton_target
    }
  }
}

fragment ReactionButton_target on ReactionsInterface {
  __isReactionsInterface: __typename
  id
  reactionsCount {
    total
  }
  myReaction {
    id
    reactionType
  }
}
`}}}();k.hash="3c678770713154c56e2c50d7d9bc17f4";B=k});import{useFragment as A,useMutation as C}from"react-relay";var c,d;function S(e,t){return $(e)||x(e,t)||L(e,t)||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 L(e,t){if(e){if(typeof e=="string")return F(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?F(e,t):void 0}}function F(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}function x(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var a,r,l,o,i=[],u=!0,s=!1;try{if(l=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;u=!1}else for(;!(u=(a=l.call(n)).done)&&(i.push(a.value),i.length!==t);u=!0);}catch(g){s=!0,r=g}finally{try{if(!u&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(s)throw r}}return i}}function $(e){if(Array.isArray(e))return e}var D=(c!==void 0||(c=(T(),m(h)),c.hash&&c.hash!=="c3861c327bdc15c2a59dfbfe2ce2ed12"&&console.error("The definition of 'ReactionButton_target' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data.")),c),E=(d!==void 0||(d=(b(),m(v)),d.hash&&d.hash!=="3c678770713154c56e2c50d7d9bc17f4"&&console.error("The definition of 'ReactionButtonMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data.")),d),j=function(t){var n=t.target,a=t.reactionType,r=t.children,l=t.handleSuccess,o=t.handleError,i=A(D,n),u=C(E),s=S(u,2),g=s[0],y=s[1],_=function(){y||g({variables:{input:{targetObjectId:i.id,reactionType:a}},onCompleted:function(){l?.()},onError:function(){o?.()}})};return r({handleReaction:_,isLoading:y,target:i})},H=j;export{H as a};
//# sourceMappingURL=chunk-GIGXCAJ2.mjs.map