DeveloperInstantGamesContentRatingUseExistingCertModal.react",["fbt","DeveloperInstantGamesContentRatingTableRelayWrapper","DeveloperInstantGamesContentRatingUseExistingCertModalMutation.graphql","DeveloperInstantGamesContentRatingUseExistingCertModal_IarcCertSubmissionMutation.graphql","GeoButton.react","GeoCancelButton.react","GeoFlexbox.react","GeoHeading.react","GeoModal.react","GeoModalFooter.react","GeoModalHeader.react","GeoSection.react","GeoText.react","GeoTextInput.react","RelayHooks","geoMargin","react","submitFormValidationHook"],(function(a,b,c,d,e,f,g,h){"use strict";var i,j,k,l=k||(k=d("react"));e=k;var m=e.useCallback,n=e.useState,o=new RegExp("^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$","i"),p=i!==void 0?i:i=b("DeveloperInstantGamesContentRatingUseExistingCertModalMutation.graphql"),q=j!==void 0?j:j=b("DeveloperInstantGamesContentRatingUseExistingCertModal_IarcCertSubmissionMutation.graphql");function r(a){var b=a.certFetched,e=a.handleCertSubmission,f=a.isFetchingCert,g=a.isSubmissionMutationInFlight,i=a.updateIARCCert;a=d("submitFormValidationHook").useFormSubmitValidation();var j=a[0];a=b?l.jsx(c("GeoButton.react"),{isDisabled:g,isLoading:g,label:h._(/*BTDS*/"Submit"),onClick:function(){e()},variant:"primary"}):l.jsx(c("GeoButton.react"),{isDisabled:f,isLoading:f,label:h._(/*BTDS*/"Search"),onClick:function(){if(!j())return;i()},variant:"primary"});return l.jsx(c("GeoModalFooter.react"),{primaryButton:a,secondaryButton:l.jsx(c("GeoCancelButton.react"),{})})}r.displayName=r.name+" [from "+f.id+"]";function s(a){var b=a.appId,e=a.iarcEmail,f=a.isShown,g=a.onHide,i=a.setIsSubmissionSuccess,j=a.setSubmissionErrorMessage,k=a.showSubmissionResponseModal;a=n("");var s=a[0],t=a[1];a=n(null);var u=a[0],v=a[1];a=n(null);var w=a[0],x=a[1];a=n(null);var y=a[0],z=a[1];a=n(null);var A=a[0],B=a[1];a=n(!1);var C=a[0],D=a[1];a=d("submitFormValidationHook").useInputValidation(m(function(){return!L(s)},[s]));a=a.showErrorState;var E=d("RelayHooks").useMutation(p),F=E[0];E=E[1];var G=d("RelayHooks").useMutation(q),H=G[0];G=G[1];function I(){if(L(s))return;var a={externalID:s,appID:b};F({variables:a,onCompleted:function(a){var b,c,d;b=a==null?void 0:(b=a.xfb_fetch_iarc_cert)==null?void 0:b.iarc_cert;c=a==null?void 0:(c=a.xfb_fetch_iarc_cert)==null?void 0:c.error;d=a==null?void 0:(d=a.xfb_fetch_iarc_cert)==null?void 0:d.date_created;a=a==null?void 0:(a=a.xfb_fetch_iarc_cert)==null?void 0:a.product_name;c?v(c):b!==null&&(x(b),B(a),z(d),D(!0))}})}function J(){var a;H({variables:{input:{iarc_email:e,app_id:b,iarc_cert_id:(a=w==null?void 0:w.external_id)!=null?a:""}},onCompleted:function(a){var b;b=(b=(b=a.xfb_submit_iarc_cert)==null?void 0:b.success)!=null?b:!1;a=(a=a.xfb_submit_iarc_cert)==null?void 0:(a=a.error)==null?void 0:a.message;if(b){window.location.reload();return}j(a);i(b);g();k()}})}function K(){if(u)return u.message}function L(a){return!o.test(a)?h._(/*BTDS*/"Please enter your certificate ID in this format: 12345678-1234-1234-1234-123456789ABC"):null}return l.jsx(c("GeoModal.react"),{footer:l.jsx(r,{certFetched:w!=null,handleCertSubmission:J,isFetchingCert:E,isSubmissionMutationInFlight:G,updateIARCCert:I}),header:l.jsx(c("GeoModalHeader.react"),{heading:h._(/*BTDS*/"Use Existing Certificate")}),isShown:f,onHide:g,children:l.jsx(c("GeoSection.react"),{children:C?l.jsxs(l.Fragment,{children:[l.jsx(c("GeoFlexbox.react"),{alignItems:"start",justifyContent:"space-between",xstyle:c("geoMargin").vert24,children:l.jsxs("div",{children:[l.jsx(c("GeoHeading.react"),{level:4,children:h._(/*BTDS*/"IARC Certificate ID")}),l.jsx(c("GeoFlexbox.react"),{alignItems:"center",children:l.jsx(c("GeoText.react"),{children:h._(/*BTDS*/"{do-not-translate}",[h._param("do-not-translate",l.jsx("code",{children:w==null?void 0:w.external_id}))])})}),l.jsx(c("GeoHeading.react"),{level:4,children:h._(/*BTDS*/"Product Name")}),l.jsx(c("GeoFlexbox.react"),{alignItems:"center",children:l.jsx(c("GeoText.react"),{children:h._(/*BTDS*/"{do-not-translate}",[h._param("do-not-translate",l.jsx("code",{children:A}))])})}),l.jsx(c("GeoHeading.react"),{level:4,children:h._(/*BTDS*/"Date Created")}),l.jsx(c("GeoFlexbox.react"),{alignItems:"center",children:l.jsx(c("GeoText.react"),{children:h._(/*BTDS*/"{do-not-translate}",[h._param("do-not-translate",l.jsx("code",{children:y}))])})})]})}),l.jsx(d("DeveloperInstantGamesContentRatingTableRelayWrapper").DeveloperInstantGamesContentRatingTableRelayWrapper,{iarcRatingList:w})]}):l.jsx(c("GeoTextInput.react"),{errorMessage:a||u?L(s)||K():void 0,label:h._(/*BTDS*/"Certificate ID"),onChange:function(a){t(a.toUpperCase()),v(null)},value:s})})})}s.displayName=s.name+" [from "+f.id+"]";function a(a){return l.jsx(d("submitFormValidationHook").FormValidationContextProvider,{children:l.jsx(s,babelHelpers["extends"]({},a))})}a.displayName=a.name+" [from "+f.id+"]";g["default"]=a}),226);
-----
DeveloperInstantGamesContentRatingUseExistingCertModalMutation_facebookRelayOperation",[],(function(a,b,c,d,e,f){e.exports="24150751967863365"}),null);
-----