DeveloperInstantGamesImageUploadCard.react",["fbt","ix","AsyncRequest","AsyncResponse","DeveloperInstantGamesDetailsTabUtils","DeveloperInstantGamesImageUploadCard_DeleteMutation.graphql","DeveloperInstantGamesSaveSpinnerOverlay.react","GeoButton.react","GeoCancelButton.react","GeoCardFooter.react","GeoFileSelector.react","GeoHStack.react","GeoIcon.react","GeoImageTile.react","GeoImageTileGroup.react","GeoModalFooter.react","GeoModalHeader.react","GeoModal_DEPRECATED.react","GeoPillWithPopover.react","GeoSection.react","GeoText.react","GeoTooltip.react","GeoVStack.react","Image.react","RelayHooks","asyncToGeneratorRuntime","fbicon","lodash","react"],(function(t,n,r,o,a,i,l,s,u){"use strict";var e,c,d=c||(c=o("react")),m=c.useState,p=e!==void 0?e:e=n("DeveloperInstantGamesImageUploadCard_DeleteMutation.graphql");function _(e){var t,a=e.appId,i=e.description,l=e.dimensions,c=e.fullUrl,_=e.imageType,f=e.imageUrl,g=e.isAppIcon,h=g===void 0?!1:g,y=e.isFallback,C=y===void 0?!1:y,b=e.isInScopeForPropertyReview,v=e.isPrimaryLocale,S=e.isRequired,R=S===void 0?!1:S,L=e.locale,E=e.name,k=e.onUploadSuccess,I=e.orientation,T=e.title,D=m(!1),x=D[0],$=D[1],P=m(!1),N=P[0],M=P[1],w=m([]),A=w[0],F=w[1],O=m(null),B=O[0],W=O[1],q=m(!1),U=q[0],V=q[1],H=m(!1),G=H[0],z=H[1],j=m(null),K=j[0],Q=j[1],X=m(!1),Y=X[0],J=X[1],Z=m(!1),ee=Z[0],te=Z[1],ne=1349098,re=m(!1),oe=re[0],ae=re[1],ie=m(!1),le=ie[0],se=ie[1],ue=m(null),ce=ue[0],de=ue[1],me=m(!1),pe=me[0],_e=me[1],fe=m(!1),ge=fe[0],he=fe[1],ye=o("RelayHooks").useMutation(p),Ce=ye[0],be=(function(){var e=n("asyncToGeneratorRuntime").asyncToGenerator(function*(e){if(F(e),W(null),e.length>0){V(!0);var t=r("lodash").first(e);try{if(_==null||_===""){W(s._(/*BTDS*/"Image type is required for validation"));return}var n=yield o("DeveloperInstantGamesDetailsTabUtils").validateImageDimensions(t,_);n.isValid||W(n.error)}catch(e){W(s._(/*BTDS*/"Error validating image file"))}finally{V(!1)}}});return function(n){return e.apply(this,arguments)}})(),ve=function(){M(!1),z(!1),F([]),W(null),V(!1),Q(null),J(!1),te(!1)},Se=function(){_e(!1),ae(!1),se(!1),de(null),he(!1)},Re=function(){ae(!1),se(!1),de(null),he(!0),Ce({variables:{input:{app_id:parseInt(a,10),locale:L,image_type:_,name:E!=null?E:null}},onCompleted:function(t){var e=t.xfb_instant_games_image_delete;if(he(!1),!e)se(!0),de(s._(/*BTDS*/"The response was null"));else if(e.success===!0)ae(!0),window.setTimeout(function(){Se(),k&&k()},500);else if(e.error!==null){var n=e.error;se(!0),de(n!=null?n:s._(/*BTDS*/"Unknown error occurred the request was not successful"))}else se(!0),de(s._(/*BTDS*/"Unknown error occurred the request was not successful"))},onError:function(t){he(!1),se(!0),de(t.message)}})},Le=function(){if(A.length!==0){z(!0),Q(null);var e=r("lodash").first(A),t="image-preview-"+_+"-"+Date.now(),n=babelHelpers.extends({app_id:a,type:_,lang:L,preview_id:t,submit:"upload"},E!=null&&E!==""?{name:E}:{}),o=window.location.hostname,i=o.replace("developers","upload"),l="https://"+i+"/ajax/image/upload/resource/",u=new FormData;u.append("image_upload",e);var c=new(r("AsyncRequest"))().setAllowCrossOrigin(!0).setURI(l).setMethod("POST").setData(n).setReadOnly(!1).setRawData(u).setHandler(function(e){z(!1),J(!0),window.setTimeout(function(){ve(),k&&k()},1500)}).setErrorHandler(function(e){var t=e.getError();t===ne?Q(s._(/*BTDS*/"Invalid image dimensions for this image type")):(r("AsyncResponse").defaultErrorHandler(e),Q(s._(/*BTDS*/"Upload failed. Please try again."))),z(!1),te(!0),window.setTimeout(function(){te(!1),Q(null)},1500)});c.send()}},Ee=f!=null&&f!==""?d.jsx(r("Image.react"),{src:f}):d.jsx(r("GeoIcon.react"),{icon:o("fbicon")._(u("481805"),16)}),ke=l!=null&&l!==""?s._(/*BTDS*/"Upload {title} ({dimensions})",[s._param("title",T),s._param("dimensions",l)]):s._(/*BTDS*/"Upload {title}",[s._param("title",T)]),Ie=(t=o("DeveloperInstantGamesDetailsTabUtils").getRequiredDimensionsForImageType(_))==null?void 0:t.description,Te=l!=null&&l!==""?s._(/*BTDS*/"You can upload a JPG, GIF, or PNG file. The size of the image must be {dimensions} pixels. File size limit 5 MB.",[s._param("dimensions",Ie)]):s._(/*BTDS*/"Select an image file (JPG, GIF, or PNG). Maximum file size: 5MB.");return d.jsxs(d.Fragment,{children:[d.jsx(r("GeoHStack.react"),{children:d.jsx(r("GeoImageTileGroup.react"),{ratio:I,size:144,children:d.jsx(r("GeoImageTile.react"),{content:d.jsxs(r("GeoVStack.react"),{children:[C&&d.jsx("div",{style:{width:"100%"},children:d.jsx(r("GeoPillWithPopover.react"),{hasIcon:!0,label:"",status:"warning",tooltip:s._(/*BTDS*/"This is a placeholder image from your primary locale, shown when no locale-specific image is available."),value:s._(/*BTDS*/"Default Image")})}),!C&&R&&v&&(c===null||c==="")?d.jsx("div",{style:{width:"100%"},children:d.jsx(r("GeoPillWithPopover.react"),{hasIcon:!0,label:"",status:"error",tooltip:s._(/*BTDS*/"This version of the image is required for your game. Please upload an image."),value:s._(/*BTDS*/"Required Image")})}):null,o("DeveloperInstantGamesDetailsTabUtils").shouldHideButtons(h,b,v)?null:d.jsxs(r("GeoHStack.react"),{children:[d.jsx(r("GeoButton.react"),{grow:"fill",label:f!=null&&f!==""?s._(/*BTDS*/"Edit"):s._(/*BTDS*/"Upload Image"),onClick:function(){return M(!0)}}),f!=null&&f!==""?d.jsx(r("GeoButton.react"),{icon:o("fbicon")._(u("483828"),16),isDisabled:C,label:"",onClick:function(){_e(!0)},tooltip:C&&f!=null&&f!==""?d.jsx(r("GeoTooltip.react"),{content:s._(/*BTDS*/"Switch to the primary locale to delete this image.")}):void 0}):null]})]}),description:s._(/*BTDS*/"{description}",[s._param("description",i)]),heading:s._(/*BTDS*/"{title}",[s._param("title",T)]),isBordered:!1,isHeaderHidden:!1,media:Ee,onPress:function(){c!=null&&c!==""&&$(!0)},tooltip:o("DeveloperInstantGamesDetailsTabUtils").getTooltipForAppIconEditing(h,b,v)})})}),d.jsx(r("GeoModal_DEPRECATED.react"),{footer:d.jsx(r("GeoCardFooter.react"),{}),header:d.jsx(r("GeoModalHeader.react"),{heading:l!=null&&l!==""?s._(/*BTDS*/"{title} ({dimensions})",[s._param("title",T),s._param("dimensions",l)]):s._(/*BTDS*/"{title}",[s._param("title",T)])}),isShown:x,onHide:function(){return $(!1)},children:c!=null&&c!==""&&d.jsx("div",{style:{textAlign:"center",padding:"20px"},children:d.jsx(r("Image.react"),{src:c,style:{maxWidth:"100%",height:"auto"}})})}),d.jsxs(r("GeoModal_DEPRECATED.react"),{footer:d.jsx(r("GeoModalFooter.react"),{primaryButton:d.jsx(r("GeoButton.react"),{isDisabled:A.length===0||B!=null||U||G||Y||ee,label:s._(/*BTDS*/"Upload"),onClick:Le}),secondaryButton:d.jsx(r("GeoCancelButton.react"),{isDisabled:G||Y||ee,onClick:ve}),startContent:s._(/*BTDS*/"By uploading this file, you certify that you have the right to distribute this image and that it is not pornographic.")}),header:d.jsx(r("GeoModalHeader.react"),{heading:ke}),isShown:N,onHide:ve,children:[d.jsx(r("GeoSection.react"),{children:d.jsx(r("GeoFileSelector.react"),{allowMultiple:!1,description:Te,errorMessage:B!=null?B:void 0,fileTypes:["image/jpeg","image/jpg","image/gif","image/png"],label:s._(/*BTDS*/"Choose Image File"),maxFileSize:5*1024*1024,onChange:be,value:A,warningMessage:U?s._(/*BTDS*/"Validating image dimensions..."):null})}),d.jsx(r("DeveloperInstantGamesSaveSpinnerOverlay.react"),{borderRadius:8,bottomMargin:0,errorMessage:K,saveError:ee,saveSuccess:Y,savedMessage:s._(/*BTDS*/"Image uploaded successfully!"),saving:G})]}),d.jsx(r("GeoModal_DEPRECATED.react"),{footer:d.jsx(r("GeoModalFooter.react"),{primaryButton:d.jsx(r("GeoButton.react"),{isDisabled:ge||oe,label:s._(/*BTDS*/"Delete"),onClick:function(){Re()}}),secondaryButton:d.jsx(r("GeoCancelButton.react"),{isDisabled:ge||oe,onClick:Se})}),header:d.jsx(r("GeoModalHeader.react"),{heading:s._(/*BTDS*/"Confirm {title} Deletion",[s._param("title",T)])}),isShown:pe,onHide:Se,children:d.jsxs(r("GeoSection.react"),{children:[d.jsx(r("GeoText.react"),{children:s._(/*BTDS*/"Are you sure you want to delete this image? This action cannot be undone.")}),d.jsx(r("DeveloperInstantGamesSaveSpinnerOverlay.react"),{borderRadius:8,bottomMargin:0,errorMessage:ce,saveError:le,saveSuccess:oe,savedMessage:s._(/*BTDS*/"Image deleted successfully"),saving:ge})]})})]})}_.displayName=_.name+" [from "+i.id+"]",l.default=_}),226);
-----
DeveloperInstantGamesImageUploadCard_DeleteMutation.graphql",["DeveloperInstantGamesImageUploadCard_DeleteMutation_facebookRelayOperation"],(function(t,n,r,o,a,i){"use strict";var e=(function(){var e=[{defaultValue:null,kind:"LocalArgument",name:"input"}],t=[{alias:null,args:[{kind:"Variable",name:"data",variableName:"input"}],concreteType:"XFBInstantGamesImageDeleteResponsePayload",kind:"LinkedField",name:"xfb_instant_games_image_delete",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"success",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"error",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:e,kind:"Fragment",metadata:null,name:"DeveloperInstantGamesImageUploadCard_DeleteMutation",selections:t,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:e,kind:"Operation",name:"DeveloperInstantGamesImageUploadCard_DeleteMutation",selections:t},params:{id:n("DeveloperInstantGamesImageUploadCard_DeleteMutation_facebookRelayOperation"),metadata:{},name:"DeveloperInstantGamesImageUploadCard_DeleteMutation",operationKind:"mutation",text:null}}})();a.exports=e}),null);
-----
DeveloperInstantGamesImageUploadCard_DeleteMutation_facebookRelayOperation",[],(function(t,n,r,o,a,i){a.exports="24946657961584470"}),null);
-----