CometUpdateScheduleTimeDialog.react",["fbt","CometCreatorComposerScheduledPostConfig","CometErrorBoundary.react","CometErrorRoot.react","CometFormDateTimeConstraints","CometRelay","CometUpdateScheduleTimeDialogQuery.graphql","FDSDialog.react","FDSDialogButtonGroupFooter.react","FDSDialogHeader.react","FDSFormDateTimeInput.react","FDSText.react","cometPushToast","nullthrows","react","useCometUpdateScheduleTimeDialogPublishMutation","useCometUpdateScheduleTimeDialogRescheduleMutation","useServerTime"],(function(z,U,e,a,$,f,F,t){"use strict";var _,c,l=c||(c=a("react")),C=c,T=C.useCallback,R=C.useState;function h(g){var H,D,v,s=g.props,w=g.queries,r=s.onClose,n=e("useServerTime")(),q=a("CometRelay").usePreloadedQuery(_!==void 0?_:_=U("CometUpdateScheduleTimeDialogQuery.graphql"),w.CometUpdateScheduleTimeDialogQueryRef),o=q.node,Q=l.jsx(e("FDSDialogHeader.react"),{onClose:r,text:t._(/*BTDS*/""),withBackButton:!1,withCloseButton:!0,withoutDivider:!0}),k=(o==null?void 0:o.scheduled_publish_time)!=null?new Date(o.scheduled_publish_time*1e3):null,p=R(k),u=p[0],E=p[1],m=a("CometCreatorComposerScheduledPostConfig").CometCreatorComposerScheduledPostConfig.maxScheduledTimeDeltaInSec,S=a("CometCreatorComposerScheduledPostConfig").CometCreatorComposerScheduledPostConfig.minScheduledTimeDeltaInSec,i=u==null||u.getTime()n.getTime()+m*1e3,d=(o==null?void 0:o.unpublished_content_type)==="PUBLISHED",y=e("useCometUpdateScheduleTimeDialogRescheduleMutation")(e("nullthrows")(o==null||(H=o.business_pending_publish_content)==null?void 0:H.id),e("nullthrows")(u),function(){a("cometPushToast").cometPushSimpleToast(t._(/*BTDS*/"")),s.onSuccess==null||s.onSuccess()},function(){a("cometPushToast").cometPushErrorToast({message:t._(/*BTDS*/"")})}),P=y[0],b=y[1],x=e("useCometUpdateScheduleTimeDialogPublishMutation")(e("nullthrows")(o==null||(D=o.business_pending_publish_content)==null?void 0:D.id),e("nullthrows")(o==null||(v=o.feedback)==null?void 0:v.post_id),function(){a("cometPushToast").cometPushSimpleToast(t._(/*BTDS*/"")),s.onSuccess==null||s.onSuccess()},function(){a("cometPushToast").cometPushErrorToast({message:t._(/*BTDS*/"")})}),A=x[0],J=x[1],I=T(function(){r(),A()},[A,r]),j=T(function(){i||(r(),P())},[P,r,i]),M=l.jsx(e("FDSDialogButtonGroupFooter.react"),{direction:"backward",expanding:!1,primary:{disabled:d||i||b||J,label:t._(/*BTDS*/""),onPress:j,tooltip:d?t._(/*BTDS*/""):void 0},secondary:{disabled:d||b||J,label:t._(/*BTDS*/""),onPress:I,tooltip:d?t._(/*BTDS*/""):void 0}});return l.jsx(e("CometErrorBoundary.react"),{fallback:function(){return l.jsx(e("CometErrorRoot.react"),{})},children:l.jsx(e("FDSDialog.react"),{footer:M,header:Q,onClose:r,size:"small",children:l.jsxs("div",{className:"x1yrsyyn xv54qhq x10b6aqq xf7dkkf",children:[l.jsx("div",{className:"xieb3on",children:l.jsx(e("FDSText.react"),{type:"body4",children:t._(/*BTDS*/"")})}),l.jsx(e("FDSFormDateTimeInput.react"),babelHelpers.extends({constraints:[a("CometFormDateTimeConstraints").afterDateTime(new Date(n.getTime()+S*1e3)),a("CometFormDateTimeConstraints").beforeDateTime(new Date(n.getTime()+m*1e3))],date:u,dateInputProps:{validationState:i?"ERROR":null},onDateTimeChange:function(G){E(G)},timeInputProps:{hideDisabledTimes:!0,validationState:i?"ERROR":null}},i&&{helperText:t._(/*BTDS*/"",[t._plural(Math.floor(S/60),"minute"),t._plural(Math.floor(m/(3600*24)),"day")])}))]})})})}h.displayName=h.name+" [from "+f.id+"]",F.default=h}),226);
-----
CometUpdateScheduleTimeDialogQuery.graphql",["CometUpdateScheduleTimeDialogQuery_facebookRelayOperation","relay-runtime"],(function(c,a,m,y,o,g){"use strict";var l=(function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"storyID"}],i=[{kind:"Variable",name:"id",variableName:"storyID"}],e={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"scheduled_publish_time",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"unpublished_content_type",storageKey:null},u={alias:null,args:null,concreteType:"BusinessPendingPublishContent",kind:"LinkedField",name:"business_pending_publish_content",plural:!1,selections:[e,{alias:null,args:null,kind:"ScalarField",name:"infrastructure_version",storageKey:null}],storageKey:null},s={alias:null,args:null,concreteType:"Feedback",kind:"LinkedField",name:"feedback",plural:!1,selections:[e,{alias:null,args:null,kind:"ScalarField",name:"post_id",storageKey:null}],storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"CometUpdateScheduleTimeDialogQuery",selections:[{alias:null,args:i,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{kind:"InlineFragment",selections:[e,t,r,u,s],type:"Story",abstractKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"CometUpdateScheduleTimeDialogQuery",selections:[{alias:null,args:i,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},e,{kind:"InlineFragment",selections:[t,r,u,s],type:"Story",abstractKey:null}],storageKey:null}]},params:{id:a("CometUpdateScheduleTimeDialogQuery_facebookRelayOperation"),metadata:{},name:"CometUpdateScheduleTimeDialogQuery",operationKind:"query",text:null}}})();a("relay-runtime").PreloadableQueryRegistry.set(l.params.id,l),o.exports=l}),null);
-----
CometUpdateScheduleTimeDialog.entrypoint",["CometUpdateScheduleTimeDialogQuery$Parameters","JSResourceForInteraction"],(function(a,b,c,d,e,f,g){"use strict";a={getPreloadProps:function(a){return{queries:{CometUpdateScheduleTimeDialogQueryRef:{parameters:b("CometUpdateScheduleTimeDialogQuery$Parameters"),variables:{storyID:a.storyID}}}}},root:c("JSResourceForInteraction")("CometUpdateScheduleTimeDialog.react").__setRef("CometUpdateScheduleTimeDialog.entrypoint")};d=a;g["default"]=d}),98);
-----
CometUpdateScheduleTimeDialogQuery$Parameters",["CometUpdateScheduleTimeDialogQuery_facebookRelayOperation"],(function(a,b,c,d,e,f){"use strict";a={kind:"PreloadableConcreteRequest",params:{id:b("CometUpdateScheduleTimeDialogQuery_facebookRelayOperation"),metadata:{},name:"CometUpdateScheduleTimeDialogQuery",operationKind:"query",text:null}};e.exports=a}),null);
-----
CometUpdateScheduleTimeDialogQuery_facebookRelayOperation",[],(function(a,b,c,d,e,f){e.exports="9909388102496620"}),null);
-----