"use strict";(self.webpackChunkfont_awesome_admin=self.webpackChunkfont_awesome_admin||[]).push([[27],{5027:(e,t,s)=>{s.r(t),s.d(t,{CONFLICT_DETECTION_SCANNER_DURATION_MIN:()=>g,addPendingOption:()=>v,checkPreferenceConflicts:()=>W,chooseAwayFromKitConfig:()=>B,chooseIntoKitConfig:()=>$,preprocessResponse:()=>R,queryKits:()=>q,reportDetectedConflicts:()=>X,resetOptionsFormState:()=>w,resetPendingBlocklistSubmissionStatus:()=>b,resetPendingOptions:()=>A,resetUnregisteredClientsDeletionStatus:()=>U,setActiveAdminTab:()=>j,setConflictDetectionScanner:()=>V,snoozeV3DeprecationWarning:()=>H,submitPendingBlocklist:()=>L,submitPendingOptions:()=>K,submitPendingUnregisteredClientDeletions:()=>k,updateApiToken:()=>G,updatePendingBlocklist:()=>F,updatePendingUnregisteredClientsForDeletion:()=>M,userAttemptToStopScanner:()=>x});var n=s(1083),o=s(8938),r=s.n(o),a=s(7091),c=s.n(a),i=s(8156),u=s.n(i),l=s(7309),d=s.n(l),f=s(9458),_=s(2806),p=s(1448),E=s.n(p);function T(e,t=0){let s=null,n=null;if("string"!=typeof e)return null;if(t>=e.length)return null;try{return s=JSON.parse(e.slice(t)),{start:t,parsed:s}}catch(s){const o=e.indexOf("[",t+1),r=e.indexOf("{",t+1);if(-1===o&&-1===r)return null;n=-1!==o&&-1!==r?o<r?o:r:-1!==r?r:o}return null===n?null:T(e,n)}const N=function(e){if(!e||""===e)return null;const t=T(e);if(null===t)return null;{const{start:s,parsed:n}=t;return{start:s,json:e.slice(s),trimmed:e.slice(0,s),parsed:n}}},m=n.A.create(),g=10,h=1,S=(0,_.__)("Couldn't save those changes","font-awesome"),O=(0,_.__)("Changes not saved because your WordPress server does not allow this kind of request. Look for details in the browser console.","font-awesome"),y=(0,_.__)("Couldn't check preferences","font-awesome"),I=(0,_.__)("A request to your WordPress server never received a response","font-awesome"),C=(0,_.__)("A request to your WordPress server failed","font-awesome"),D=(0,_.__)("Couldn't start the scanner","font-awesome"),P=(0,_.__)("Couldn't snooze","font-awesome");function R(e){const t=E()(e,"headers.fontawesome-confirmation");if(204===e.status&&""!==e.data)return(0,f.Ay)({error:null,confirmed:t,trimmed:e.data,expectEmpty:!0}),e.data={},e;const s=u()(e,"data",null),n="string"==typeof s&&c()(s)>0,o=n?N(s):{};n&&o&&(e.data=u()(o,"parsed"));const r=u()(o,"trimmed",""),a=u()(e,"data.errors",null);if(e.status>=400){if(a)e.uiMessage=(0,f.Ay)({error:e.data,confirmed:t,trimmed:r});else{const s=u()(e,"config.method","").toUpperCase(),n=u()(e,"config.url"),o=e.status,r=u()(e,"statusText"),a=(0,f.b3)(e),c=(0,f.cA)(u()(e,"headers",{})),i=(0,f.cA)(u()(e,"config.headers",{})),l=u()(e,"data");e.uiMessage=(0,f.Ay)({confirmed:t,requestData:a,requestMethod:s,requestUrl:n,responseHeaders:c,requestHeaders:i,responseStatus:o,responseStatusText:r,responseData:l}),405===o&&(e.uiMessage=O)}return e}if(e.status<400&&e.status>=300)return t&&""===r||(e.uiMessage=(0,f.Ay)({error:null,confirmed:t,trimmed:r})),e;if(a){const s=!0;return e.falsePositive=!0,e.uiMessage=(0,f.Ay)({error:e.data,confirmed:t,falsePositive:s,trimmed:r}),e}{const s=u()(e,"data.error",null);return s?(e.uiMessage=(0,f.Ay)({error:s,ok:!0,confirmed:t,trimmed:r}),e):(t||(e.uiMessage=(0,f.Ay)({error:null,ok:!0,confirmed:t,trimmed:r})),e)}}function A(){return{type:"RESET_PENDING_OPTIONS"}}function w(){return{type:"OPTIONS_FORM_STATE_RESET"}}function v(e){return function(t,s){const{options:n}=s();for(const[s,o]of r()(e))t(n[s]===o?{type:"RESET_PENDING_OPTION",change:{[s]:o}}:{type:"ADD_PENDING_OPTION",change:{[s]:o}})}}function M(e=[]){return{type:"UPDATE_PENDING_UNREGISTERED_CLIENTS_FOR_DELETION",data:e}}function U(){return{type:"DELETE_UNREGISTERED_CLIENTS_RESET"}}function b(){return{type:"BLOCKLIST_UPDATE_RESET"}}function k(){return function(e,t){const{apiNonce:s,apiUrl:n,unregisteredClientsDeletionStatus:o}=t(),r=u()(o,"pending",null);if(!r||0===c()(r))return;e({type:"DELETE_UNREGISTERED_CLIENTS_START"});const a=({uiMessage:t})=>{e({type:"DELETE_UNREGISTERED_CLIENTS_END",success:!1,message:t||S})};return m.delete(`${n}/conflict-detection/conflicts`,{data:r,headers:{"X-WP-Nonce":s}}).then((t=>{const{status:s,data:n,falsePositive:o}=t;o?a(t):e({type:"DELETE_UNREGISTERED_CLIENTS_END",success:!0,data:204===s?null:n,message:""})})).catch(a)}}function F(e=[]){return{type:"UPDATE_PENDING_BLOCKLIST",data:e}}function L(){return function(e,t){const{apiNonce:s,apiUrl:n,blocklistUpdateStatus:o}=t(),r=u()(o,"pending",null);if(!r)return;e({type:"BLOCKLIST_UPDATE_START"});const a=({uiMessage:t})=>{e({type:"BLOCKLIST_UPDATE_END",success:!1,message:t||S})};return m.post(`${n}/conflict-detection/conflicts/blocklist`,r,{headers:{"X-WP-Nonce":s}}).then((t=>{const{status:s,data:n,falsePositive:o}=t;o?a(t):e({type:"BLOCKLIST_UPDATE_END",success:!0,data:204===s?null:n,message:""})})).catch(a)}}function W(){return function(e,t){e({type:"PREFERENCE_CHECK_START"});const{apiNonce:s,apiUrl:n,options:o,pendingOptions:r}=t(),a=({uiMessage:t})=>{e({type:"PREFERENCE_CHECK_END",success:!1,message:t||y})};return m.post(`${n}/preference-check`,{...o,...r},{headers:{"X-WP-Nonce":s}}).then((t=>{const{data:s,falsePositive:n}=t;n?a(t):e({type:"PREFERENCE_CHECK_END",success:!0,message:"",detectedConflicts:s})})).catch(a)}}function B({activeKitToken:e}){return function(t,s){const{releases:n}=s();t({type:"CHOOSE_AWAY_FROM_KIT_CONFIG",activeKitToken:e,concreteVersion:u()(n,"latest_version_6")})}}function $(){return{type:"CHOOSE_INTO_KIT_CONFIG"}}function q(){return function(e,t){const{apiNonce:s,apiUrl:n,options:o}=t(),r=u()(o,"kitToken",null);e({type:"KITS_QUERY_START"});const a=({uiMessage:t})=>{e({type:"KITS_QUERY_END",success:!1,message:t||(0,_.__)("Failed to fetch kits","font-awesome")})},c=({uiMessage:t})=>{e({type:"OPTIONS_FORM_SUBMIT_END",success:!1,message:t||(0,_.__)("Couldn't update latest kit settings","font-awesome")})};return m.post(`${n}/api`,"query { me { kits { name version technologySelected licenseSelected minified token shimEnabled autoAccessibilityEnabled status }}}",{headers:{"X-WP-Nonce":s}}).then((t=>{if(t.falsePositive)return a(t);const i=u()(t,"data.data");if(!u()(i,"me"))return e({type:"KITS_QUERY_END",success:!1,message:(0,_.__)("Failed to fetch kits. Regenerate your API Token and try again.","font-awesome")});if(e({type:"KITS_QUERY_END",data:i,success:!0}),!r)return;const l=u()(i,"me.kits",[]),f=d()(l,{token:r});if(!f)return;const p={};return o.usePro&&"pro"!==f.licenseSelected?p.usePro=!1:o.usePro||"pro"!==f.licenseSelected||(p.usePro=!0),"svg"===o.technology&&"svg"!==f.technologySelected?(p.technology="webfont",p.pseudoElements=!0):"svg"!==o.technology&&"svg"===f.technologySelected&&(p.technology="svg",p.pseudoElements=!1),o.version!==f.version&&(p.version=f.version),o.compat&&!f.shimEnabled?p.compat=!1:!o.compat&&f.shimEnabled&&(p.compat=!0),e({type:"OPTIONS_FORM_SUBMIT_START"}),m.post(`${n}/config`,{options:{...o,...p}},{headers:{"X-WP-Nonce":s}}).then((t=>{const{data:s,falsePositive:n}=t;if(n)return c(t);e({type:"OPTIONS_FORM_SUBMIT_END",data:s,success:!0,message:(0,_.__)("Kit changes saved","font-awesome")})})).catch(c)})).catch(a)}}function K(){return function(e,t){const{apiNonce:s,apiUrl:n,options:o,pendingOptions:r}=t();e({type:"OPTIONS_FORM_SUBMIT_START"});const a=({uiMessage:t})=>{e({type:"OPTIONS_FORM_SUBMIT_END",success:!1,message:t||S})};return m.post(`${n}/config`,{options:{...o,...r}},{headers:{"X-WP-Nonce":s}}).then((t=>{const{data:s,falsePositive:n}=t;n?a(t):e({type:"OPTIONS_FORM_SUBMIT_END",data:s,success:!0,message:(0,_.__)("Changes saved","font-awesome")})})).catch(a)}}function G({apiToken:e=!1,runQueryKits:t=!1}){return function(s,n){const{apiNonce:o,apiUrl:r,options:a}=n();s({type:"OPTIONS_FORM_SUBMIT_START"});const c=({uiMessage:e})=>{s({type:"OPTIONS_FORM_SUBMIT_END",success:!1,message:e||S})};return m.post(`${r}/config`,{options:{...a,apiToken:e}},{headers:{"X-WP-Nonce":o}}).then((e=>{const{data:n,falsePositive:o}=e;if(o)c(e);else if(s({type:"OPTIONS_FORM_SUBMIT_END",data:n,success:!0,message:(0,_.__)("API Token saved","font-awesome")}),t)return s(q())})).catch(c)}}function x(){return{type:"USER_STOP_SCANNER"}}function X({nodesTested:e={}}){return(t,s)=>{const{apiNonce:n,apiUrl:o,unregisteredClients:r,showConflictDetectionReporter:a}=s();if(a){if(c()(e.conflict)>0){const s=Object.keys(e.conflict).reduce((function(t,s){return t[s]=e.conflict[s],t}),{});t({type:"CONFLICT_DETECTION_SUBMIT_START",unregisteredClientsBeforeDetection:r,recentConflictsDetected:e.conflict});const a=({uiMessage:e})=>{t({type:"CONFLICT_DETECTION_SUBMIT_END",success:!1,message:e||S})};return m.post(`${o}/conflict-detection/conflicts`,s,{headers:{"X-WP-Nonce":n}}).then((e=>{const{status:s,data:n,falsePositive:o}=e;o?a(e):t({type:"CONFLICT_DETECTION_SUBMIT_END",success:!0,data:204===s||0===c()(n)?null:n})})).catch(a)}t({type:"CONFLICT_DETECTION_NONE_FOUND"})}}}function H(){return(e,t)=>{const{apiNonce:s,apiUrl:n}=t();e({type:"SNOOZE_V3DEPRECATION_WARNING_START"});const o=({uiMessage:t})=>{e({type:"SNOOZE_V3DEPRECATION_WARNING_END",success:!1,message:t||P})};return m.post(`${n}/v3deprecation`,{snooze:!0},{headers:{"X-WP-Nonce":s}}).then((t=>{const{falsePositive:s}=t;s?o(t):e({type:"SNOOZE_V3DEPRECATION_WARNING_END",success:!0,snooze:!0,message:""})})).catch(o)}}function j(e){return{type:"SET_ACTIVE_ADMIN_TAB",tab:e}}function V({enable:e=!0}){return function(t,s){const{apiNonce:n,apiUrl:o}=s(),r=e?"ENABLE_CONFLICT_DETECTION_SCANNER_END":"DISABLE_CONFLICT_DETECTION_SCANNER_END";t({type:e?"ENABLE_CONFLICT_DETECTION_SCANNER_START":"DISABLE_CONFLICT_DETECTION_SCANNER_START"});const a=({uiMessage:e})=>{t({type:r,success:!1,message:e||D})};return m.post(`${o}/conflict-detection/until`,e?Math.floor(new Date((new Date).valueOf()+1e3*g*60)/1e3):Math.floor(new Date/1e3)-h,{headers:{"X-WP-Nonce":n}}).then((e=>{const{status:s,data:n,falsePositive:o}=e;o?a(e):t({type:r,data:204===s?null:n,success:!0})})).catch(a)}}m.interceptors.response.use((e=>R(e)),(e=>{if(e.response)e.response=R(e.response),e.uiMessage=u()(e,"response.uiMessage");else if(e.request){const t="fontawesome_request_noresponse",s={errors:{[t]:[I]},error_data:{[t]:{request:e.request}}};e.uiMessage=(0,f.Ay)({error:s})}else{const t="fontawesome_request_failed",s={errors:{[t]:[C]},error_data:{[t]:{failedRequestMessage:e.message}}};e.uiMessage=(0,f.Ay)({error:s})}return Promise.reject(e)}))},9458:(e,t,s)=>{s.d(t,{Ay:()=>D,V2:()=>l,b3:()=>I,cA:()=>C});var n=s(8156),o=s.n(n),r=s(3560),a=s.n(r),c=s(7091),i=s.n(c),u=s(2806);const l=(0,u.__)("Font Awesome WordPress Plugin Error Report","font-awesome"),d=(0,u.__)("D'oh! That failed big time.","font-awesome"),f=(0,u.__)("There was an error attempting to report the error.","font-awesome"),_=(0,u.__)("Oh no! Your web browser could not reach your WordPress server.","font-awesome"),p=(0,u.__)("It looks like your web browser session expired. Try logging out and log back in to WordPress admin.","font-awesome"),E=(0,u.__)("The last request was successful, but it also returned the following error(s), which might be helpful for troubleshooting.","font-awesome"),T=(0,u.__)("Error","font-awesome"),N=(0,u.__)("WARNING: The last request contained errors, though your WordPress server reported it as a success. This usually means there's a problem with your theme or one of your other plugins emitting output that is causing problems.","font-awesome"),m=(0,u.__)("WARNING: The last response from your WordPress server did not include the confirmation header that should be in all valid Font Awesome responses. This is a clue that some code from another theme or plugin is acting badly and causing the wrong headers to be sent.","font-awesome"),g=(0,u.__)("CONFIRMED: The last response from your WordPress server included the confirmation header that is expected for all valid responses from the Font Awesome plugin's code running on your WordPress server.","font-awesome"),h=(0,u.__)("WARNING: Invalid Data Trimmed from Server Response","font-awesome"),S=(0,u.__)("WARNING: We expected the last response from the server to contain no data, but it contained something unexpected.","font-awesome"),O=(0,u.__)("Your WordPress server returned an error for that last request, but there was no information about the error.","font-awesome"),y=["requestMethod","responseStatus","responseStatusText","requestUrl","requestData","responseHeaders","responseData","requestHeaders"];function I(e={}){const t=o()(e,"config.headers.Content-Type","").toLowerCase(),s=o()(e,"config.data","");let n="";if("application/json"===t){try{const e=JSON.parse(s);"boolean"!=typeof o()(e,"options.apiToken")&&a()(e,"options.apiToken","REDACTED"),n=JSON.stringify(e)}catch(e){n=`ERROR while redacting request data: ${e.toString()}`}return n}return s}function C(e={}){const t={...e};for(const e in t)"x-wp-nonce"===e.toLowerCase()&&(t[e]="REDACTED");return t}const D=function(e){const{error:t=null,ok:s=!1,falsePositive:n=!1,confirmed:r=!1,expectEmpty:a=!1,trimmed:c=""}=e;console.group(l),s&&console.info(E),n&&console.info(N),r?console.info(g):console.info(m);const u=[];for(const t of y){const s=o()(e,t);if(void 0!==s){const e=typeof s;if("string"===e||"number"===e)u.push(`${t}: ${s}`);else if("object"===e){u.push(`${t}:`);for(const e in s)u.push(`\t${e}: ${s[e].toString()}`)}else console.info(`Unexpected report content type '${e}' for ${t}:`,s)}}i()(u)>0&&console.info(`Extra Info:\n${u.join("\n")}`),""!==c&&(console.group(h),a&&console.info(S),console.info(c),console.groupEnd());const I=null!==t?function(e={}){const t=Object.keys(e.errors||[]).map((t=>({code:t,message:o()(e,`errors.${t}.0`),data:o()(e,`error_data.${t}`)})));return 0===i()(t)&&t.push({code:"fontawesome_unknown_error",message:f}),t.reduce(((e,t)=>{console.group(T);const s=function(e){if(!o()(e,"code"))return console.info(f),d;let t=null,s="";const n=o()(e,"message");n&&(s=s.concat(`message: ${n}\n`),t=n);const r=o()(e,"code");if(r)switch(s=s.concat(`code: ${r}\n`),r){case"rest_no_route":t=_;break;case"rest_cookie_invalid_nonce":t=p;break;case"fontawesome_unknown_error":t=d}const a=o()(e,"data");if("string"==typeof a)s=s.concat(`data: ${a}\n`);else{const t=o()(e,"data.status");t&&(s=s.concat(`status: ${t}\n`));const n=o()(e,"data.trace");n&&(s=s.concat(`trace:\n${n}\n`))}s&&""!==s?console.info(s):console.info(e);const c=o()(e,"data.request");c&&console.info(c);const i=o()(e,"data.failedRequestMessage");return i&&console.info(i),t}(t);return console.groupEnd(),e||"previous_exception"===t.code?e:s}),null)}(t):null;return t&&""===c&&r&&console.info(O),console.groupEnd(),I}}}]);