← Back
Editing: data.min.js
/*! For license information please see data.min.js.LICENSE.txt */ (globalThis.itsecWebpackJsonP=globalThis.itsecWebpackJsonP||[]).push([[9854],{3075:e=>{e.exports=function(){return this.wp.i18n}()},8601:e=>{e.exports=function(){return this.wp.element}()},21020:(e,t,r)=>{"use strict";var n=r(51609),o=Symbol.for("react.element"),s=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,c=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};function u(e,t,r){var n,s={},u=null,a=null;for(n in void 0!==r&&(u=""+r),void 0!==t.key&&(u=""+t.key),void 0!==t.ref&&(a=t.ref),t)i.call(t,n)&&!p.hasOwnProperty(n)&&(s[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===s[n]&&(s[n]=t[n]);return{$$typeof:o,type:e,key:u,ref:a,props:s,_owner:c.current}}t.Fragment=s,t.jsx=u,t.jsxs=u},23270:e=>{e.exports=function(){return this.itsec["user-groups"].api}()},31987:e=>{e.exports=function(){return this.wp.data}()},46627:e=>{e.exports=function(){return this.itsec.packages.data}()},51609:e=>{"use strict";e.exports=window.React},66087:e=>{"use strict";e.exports=window.lodash},68440:e=>{e.exports=function(){return this.itsec["user-groups"].ui}()},74848:(e,t,r)=>{"use strict";e.exports=r(21020)},77172:e=>{e.exports=function(){return this.wp.url}()},82284:(e,t,r)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}r.d(t,{A:()=>n})},84156:(e,t,r)=>{"use strict";var n,o;function s(e){return[e]}function i(){var e={clear:function(){e.head=null}};return e}function c(e,t,r){var n;if(e.length!==t.length)return!1;for(n=r;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function p(e,t){var r,p;function u(){r=o?new WeakMap:i()}function a(){var r,n,o,s,i,u=arguments.length;for(s=new Array(u),o=0;o<u;o++)s[o]=arguments[o];for(i=t.apply(null,s),(r=p(i)).isUniqueByDependants||(r.lastDependants&&!c(i,r.lastDependants,0)&&r.clear(),r.lastDependants=i),n=r.head;n;){if(c(n.args,s,1))return n!==r.head&&(n.prev.next=n.next,n.next&&(n.next.prev=n.prev),n.next=r.head,n.prev=null,r.head.prev=n,r.head=n),n.val;n=n.next}return n={val:e.apply(null,s)},s[0]=null,n.args=s,r.head&&(r.head.prev=n,n.next=r.head),r.head=n,n.val}return t||(t=s),p=o?function(e){var t,o,s,c,p,u=r,a=!0;for(t=0;t<e.length;t++){if(!(p=o=e[t])||"object"!=typeof p){a=!1;break}u.has(o)?u=u.get(o):(s=new WeakMap,u.set(o,s),u=s)}return u.has(n)||((c=i()).isUniqueByDependants=a,u.set(n,c)),u.get(n)}:function(){return r},a.getDependants=t,a.clear=u,u(),a}r.d(t,{A:()=>p}),n={},o="undefined"!=typeof WeakMap},88109:(e,t,r)=>{"use strict";r.r(t),r.d(t,{STORE_NAME:()=>Ze});var n={};r.r(n),r.d(n,{CREATE_EXPORT:()=>j,DELETE_EXPORT:()=>B,EDIT_IMPORT_ROLE_MAP:()=>Y,EDIT_IMPORT_SOURCES:()=>K,EDIT_IMPORT_USER_MAP:()=>Q,FINISH_EXPORT:()=>q,IMPORT_RESET:()=>Z,RECEIVE_EXPORTS:()=>H,RECEIVE_SOURCES:()=>X,SET_EXPORT_ERROR:()=>$,VALIDATED_EXPORT:()=>z,VALIDATE_EXPORT_DATA:()=>G,VALIDATE_EXPORT_FILE:()=>J,WPC_APPLICATION_APPROVED:()=>se,WPC_APPLICATION_REJECTED:()=>oe,WPC_CHECK_SUPPORT:()=>ie,WPC_CREATE_EXPORT:()=>ue,WPC_DELETE_CREDENTIALS:()=>de,WPC_DELETE_CREDENTIALS_SUCCESS:()=>Ee,WPC_DISCOVERED_REST_API:()=>ne,WPC_DISCOVER_REST_API:()=>re,WPC_ENTER_WEBSITE:()=>te,WPC_FINISH_EXPORT:()=>ae,WPC_RECEIVE_APP_PASSWORD:()=>le,WPC_RECEIVE_EXPORTS:()=>ce,WPC_RECEIVE_SOURCES:()=>pe,WPC_RESET:()=>ee,applyExportData:()=>F,completeImport:()=>V,createExport:()=>C,deleteExport:()=>m,deleteExports:()=>R,editImportRoleMap:()=>N,editImportSources:()=>L,editImportUserMap:()=>b,receiveExports:()=>h,receiveSources:()=>_,resetImport:()=>k,transformImportExportData:()=>U,validateExportData:()=>S,validateExportFile:()=>g,wpConnectApplicationApproved:()=>O,wpConnectApplicationRejected:()=>w,wpConnectCreateExport:()=>W,wpConnectDeleteCredentials:()=>M,wpConnectDiscoverRestApi:()=>I,wpConnectEnterWebsite:()=>T,wpConnectReceiveAppPassword:()=>A,wpConnectReceiveExports:()=>D,wpConnectReceiveSources:()=>v,wpConnectReset:()=>P});var o={};r.r(o),r.d(o,{areWpConnectCredentialsExpired:()=>Ge,getExports:()=>Ie,getImportExportData:()=>Ae,getImportExportRoleReplacementTargets:()=>Ue,getImportExportSource:()=>ve,getImportExportUserReplacementTargets:()=>Ne,getImportExportValidationResult:()=>De,getImportRoleMap:()=>Le,getImportSources:()=>We,getImportUserMap:()=>Me,getLastCreatedExportResult:()=>we,getSources:()=>xe,getWpConnectAppPasswordsAuthEndpoint:()=>Ye,getWpConnectCredentials:()=>Je,getWpConnectCredentialsIntrospection:()=>Ke,getWpConnectDiscoveryResult:()=>ze,getWpConnectExport:()=>Be,getWpConnectExports:()=>ke,getWpConnectRestApiEndpoint:()=>Qe,getWpConnectSiteUrl:()=>Ve,getWpConnectSources:()=>je,getWpConnectStep:()=>Fe,hasWpConnectExports:()=>Xe,hasWpConnectSources:()=>He,isCreatingExport:()=>Oe,isDeletingWpConnectCredential:()=>$e,wpConnectIsCreating:()=>qe});var s={};r.r(s),r.d(s,{getExports:()=>tt,getSources:()=>et,getWpConnectCredentialsIntrospection:()=>ot,getWpConnectExports:()=>rt,getWpConnectSources:()=>nt});var i=r(31987),c=r(46627),p=r(3075),u=r(62932);function a(e){return{type:"WP_CONNECT_FETCH",request:e}}function l(e,{url:t,path:r,headers:n,...o}){const s=e.select(Ze).getWpConnectCredentials();if(!(t=t||e.select(Ze).getWpConnectRestApiEndpoint(r)))throw{code:"not_connected",message:(0,p.__)("Solid Security is not connected to a site to fetch exports.","it-l10n-ithemes-security-pro")};if(!s)throw{code:"not_authenticated",message:(0,p.__)("Solid Security has not authenticated with the site to fetch exports.","it-l10n-ithemes-security-pro")};return{url:t,headers:{Authorization:`Basic ${window.btoa(s.username+":"+s.password)}`,...n||{}},credentials:"omit",...o}}const d={WP_CONNECT_FETCH:(0,i.createRegistryControl)((e=>({request:t})=>{try{return c.controls.API_FETCH({request:l(e,t)})}catch(e){return Promise.reject(e)}})),WP_CONNECT_FETCH_RESULT:(0,i.createRegistryControl)((e=>({request:t})=>{try{return c.controls.API_FETCH_RESULT({request:l(e,t)})}catch(e){return new u.Q7(u.Q7.ERROR,new u.AR(e.code,e.message))}}))};var E=r(66087),y=r(23270),f=r(68440);function _(e){return{type:X,sources:e}}function h(e){return{type:H,exports:e}}function*C(e){yield{type:j,export:e};const t=yield(0,c.apiFetchResult)({path:"/ithemes-security/v1/import-export/exports",method:"POST",data:e});return yield{type:q,result:t},t}function*m(e){yield(0,c.apiFetch)({path:`/ithemes-security/v1/import-export/exports/${e}`,method:"DELETE"}),yield{type:B,id:e}}function*R(e){let t;try{t=yield(0,c.apiFetch)({path:"/batch/v1",method:"POST",data:{requests:e.map((e=>({method:"DELETE",path:`/ithemes-security/v1/import-export/exports/${e}`})))}})}catch(e){return yield(0,c.createNotice)("error",e.message||(0,p.__)("Could not delete exports.","it-l10n-ithemes-security-pro")),e}for(let r=0;r<e.length;r++){const n=t.responses[r];n.status>=400?yield{type:$,id:e[r],error:n.body}:yield{type:B,id:e[r]}}}function*g(e,t="upload"){yield{type:J,file:e,source:t};const r=new window.FormData;r.append("file",e);const n=yield(0,c.apiFetchResult)({path:"ithemes-security/rpc/import/validate",method:"POST",body:r});yield{type:z,result:n}}function*S(e,t="connect"){yield{type:G,data:e,source:t};const r=yield(0,c.apiFetchResult)({path:"ithemes-security/rpc/import/validate",method:"POST",data:e});yield{type:z,result:r}}function*P(){yield(0,c.dispatch)(Ze,"wpConnectDeleteCredentials"),yield{type:ee}}function T(e){return{type:te,url:e}}function x(e){return(0,c.apiFetchResult)({path:"/ithemes-security/rpc/discover",method:"POST",data:{url:e}})}function*I(e){yield{type:re,url:e};const t=yield x(e);return yield{type:ne,result:t},t}function*O(e,t){yield{type:se,url:e,credentials:t};const r=yield x(e),n=r.isSuccess()&&r.data.itsec.routes.hasOwnProperty("/ithemes-security/v1/import-export/exports");yield{type:ie,discovery:r,hasSupport:n}}function w(){return{type:oe}}function A(e){return{type:le,introspection:e}}function D(e){return{type:ce,exports:e}}function v(e){return{type:pe,sources:e}}function*W(e){yield{type:ue,export:e};const t=yield(r={data:e,path:"/ithemes-security/v1/import-export/exports",method:"POST"},{type:"WP_CONNECT_FETCH_RESULT",request:r});var r;return yield{type:ae,result:t},t}function*M(){if(!(yield(0,c.select)(Ze,"getWpConnectCredentials")))return;yield{type:de};const e=yield(0,c.select)(Ze,"getWpConnectCredentialsIntrospection"),t=(0,E.get)(e,["_links","self",0,"href"]);if(t)try{yield a({url:t,method:"DELETE"})}catch(e){console.error(e)}yield{type:Ee}}function L(e){return{type:K,sources:e}}function b(e){return{type:Q,map:e}}function N(e){return{type:Y,map:e}}function*U(){const e=yield(0,c.select)(Ze,"getImportExportData"),t=yield(0,c.select)(Ze,"getImportSources"),r=yield(0,c.select)(Ze,"getImportUserMap"),n=yield(0,c.select)(Ze,"getImportRoleMap");return yield(0,c.apiFetch)({method:"POST",path:"/ithemes-security/rpc/import/transform",data:{export:e,sources:t,user_map:r,role_map:n}})}function*F(){yield(0,c.dispatch)(c.MODULES_STORE_NAME,"resetModuleEdits"),yield(0,c.dispatch)(c.MODULES_STORE_NAME,"resetSettingEdits"),yield(0,c.dispatch)(f.store,"resetAllEdits");const e=yield*U(),t=yield(0,c.select)(Ze,"getImportSources");for(const r of t){if(!e.sources[r])continue;const t=e.sources[r];switch(r){case"modules":for(const[e,r]of Object.entries(t))yield(0,c.dispatch)(c.MODULES_STORE_NAME,"editModule",e,{status:{selected:r}});break;case"settings":for(const[e,r]of Object.entries(t))yield(0,c.dispatch)(c.MODULES_STORE_NAME,"editSettings",e,r);break;case"user-groups":const r=yield(0,c.select)(y.store,"getSettingDefinitions",null,void 0,{skipConditions:!0}),n=yield(0,c.select)(y.store,"getMatchables");for(const e of n)"user-group"!==e.type||(0,E.find)(t,{id:e.id})||(yield(0,c.dispatch)(f.store,"markGroupForDeletion",e.id));for(const o of t)if((0,E.find)(n,{id:o.id})||(yield(0,c.dispatch)(f.store,"createLocalGroup",o.id))){yield(0,c.dispatch)(f.store,"editGroup",o.id,{...o,roles:(0,E.map)(o.roles,"slug"),users:(0,E.map)(o.users,"id")});for(const t of r)if(e.sources.settings[t.id])for(const r of Object.keys(t.settings)){const n=(0,E.get)(e.sources.settings[t.id],r);Array.isArray(n)&&(yield(0,c.dispatch)(f.store,"editGroupSetting",o.id,t.id,r,n.includes(o.id)))}}}}}function*V(){const e=yield(0,c.select)(Ze,"getImportExportData"),t=yield(0,c.select)(Ze,"getImportSources"),r=yield(0,c.select)(Ze,"getImportUserMap"),n=yield(0,c.select)(Ze,"getImportRoleMap");return yield(0,c.apiFetchResult)({path:"/ithemes-security/rpc/import/run",method:"POST",data:{export:e,user_map:r,role_map:n,sources:(0,E.difference)(t,["modules","settings","user-groups"])}})}function k(){return{type:Z}}const X="RECEIVE_SOURCES",H="RECEIVE_EXPORTS",j="CREATE_EXPORT",q="FINISH_EXPORT",B="DELETE_EXPORT",$="SET_EXPORT_ERROR",J="VALIDATE_EXPORT_FILE",G="VALIDATE_EXPORT_DATA",z="VALIDATED_EXPORT",K="EDIT_IMPORT_SOURCES",Q="EDIT_IMPORT_USER_MAP",Y="EDIT_IMPORT_ROLE_MAP",Z="IMPORT_RESET",ee="WPC_RESET",te="WPC_ENTER_WEBSITE",re="WPC_DISCOVER_REST_API",ne="WPC_DISCOVERED_REST_API",oe="WPC_APPLICATION_REJECTED",se="WPC_APPLICATION_APPROVED",ie="WPC_CHECK_SUPPORT",ce="WPC_RECEIVE_EXPORTS",pe="WPC_RECEIVE_SOURCES",ue="WPC_CREATE_EXPORT",ae="WPC_FINISH_EXPORT",le="WPC_RECEIVE_APP_PASSWORD",de="WPC_DELETE_CREDENTIALS",Ee="WPC_DELETE_CREDENTIALS_SUCCESS",ye=/(?:(?:\[(?:(?:(["'])((?:\\.|(?:(?!\1).))*)\1)|([-+]?\d+))\])|(?:\[(.?))|(?:(?:^|(?:(?!^)\.))([^\s"'\`\[\].\\]+))|(.))/g,fe=/\\(.)/g,_e=e=>{let t,r=[];for(;t=ye.exec(e);){let n,[,o,s,i,,c]=t;if(o)n=s.replace(fe,((...e)=>e[1]===o?o:e[0]));else if(i)n=+i;else{if(!c)throw ye.lastIndex=0,new SyntaxError(`Invalid step @ ${t.index}: ${JSON.stringify(e)}`);n=c}r.push(n)}return r},{isArray:he}=Array,{defineProperty:Ce,values:me}=Object,Re=Symbol(),ge=Symbol(),Se=((e={})=>{const{collect:t=me,default:r,flatMap:n="*",map:o="**",parser:s=_e,split:i=s}=e,c=!1===n?ge:n,p=!1===o?Re:o,u="string"==typeof i?e=>e.split(i):i;return Ce((function e(n,o,...s){let i;switch(typeof o){case"string":i=u(o);break;case"number":case"symbol":i=[o];break;default:if(!he(o))throw new TypeError("Invalid path: expected a string, array, number, or symbol");i=o}const a=s.length?s[0]:r,l=e=>void 0===e?a:e,d=i.length-1;for(let r=0;r<=d;++r){if(!n)return a;const o=i[r],s=o===c;if(s||o===p){const o=he(n)?n:t(n);let c;if(r===d)c=l;else{const t=i.slice(r+1);c=r=>e(r,t,a)}return s?o.flatMap(c):o.map(c)}n=Number.isInteger(o)&&he(n)?n[o<0?n.length+o:o]:n[o]}return l(n)}),"parse",{value:u})})();var Pe=r(84156);const Te=[];function xe(e){return e.sources||Te}function Ie(e){return e.exports.items||Te}function Oe(e){return e.creating.inProgress}function we(e){return e.creating.lastResult}function Ae(e){return e.import.exportData}function De(e){return e.import.validatedExport}function ve(e){return e.import.source}function We(e){return e.import.sources}function Me(e){return e.import.userMap}function Le(e){return e.import.roleMap}function be(e,t,r,n){const o=[];for(const s of e){if(!t.includes(s.slug))continue;const e=s.transform_map[n];if(e&&r.sources[s.slug])for(const t of e)o.push(...Se(r.sources[s.slug],t))}return"users"===n?(0,E.uniqBy)(o,"id"):"roles"===n?(0,E.uniqBy)(o,"slug"):o}const Ne=(0,Pe.A)((e=>be(xe(e),We(e),e.import.exportData,"users")),(e=>[xe(e),We(e),e.import.exportData])),Ue=(0,Pe.A)((e=>be(xe(e),We(e),e.import.exportData,"roles")),(e=>[xe(e),We(e),e.import.exportData]));function Fe(e){return e.wpConnect.step}function Ve(e){return e.wpConnect.siteUrl}function ke(e){return e.wpConnect.exports||Te}function Xe(e){return ke(e).length>0}function He(e){return je(e).length>0}function je(e){return e.wpConnect.sources||Te}function qe(e){return e.wpConnect.isCreating}function Be(e){return e.wpConnect.createdExport}function $e(e){return e.wpConnect.isDeleting&&!!Je(e)}function Je(e){return e.credentials}function Ge(e){return!Je(e)&&["appAuthed","hasSupport","noSupport"].includes(Fe(e))}function ze(e){return e.wpConnect.discovery}function Ke(e){return e.wpConnect.introspection}function Qe(e,t){const r=(0,E.get)(e,["wpConnect","discovery","data","itsec","routes",t,"_links","self",0,"href"]);if(r)return r;const n=(0,E.get)(e,["wpConnect","discovery","data","url"],"");if(!n.length)return;let o=t;return-1!==n.indexOf("?")&&(o=o.replace("?","&")),o=o.replace(/^\//,""),-1!==n.indexOf("?")&&(o=o.replace("?","&")),n+o}function Ye(e){return(0,E.get)(e,["wpConnect","discovery","data","index","authentication","application-passwords","endpoints","authorization"])}const Ze="ithemes-security/import-export",et={isFulfilled:e=>!!e.sources,*fulfill(){const e=yield(0,c.apiFetch)({path:"/ithemes-security/v1/import-export/sources"});yield _(e)}},tt={isFulfilled:e=>!!e.exports.items,*fulfill(){const e=yield(0,c.apiFetch)({path:"/ithemes-security/v1/import-export/exports"});yield h(e)}};function*rt(){if(!(yield i.controls.select(Ze,"hasWpConnectExports")))try{const e=yield a({path:"/ithemes-security/v1/import-export/exports"});yield D(e)}catch(e){yield D([]),yield(0,c.createNotice)("error",e.message||(0,p.__)("An unknown error occurred when fetching exports."))}}function*nt(){if(!(yield i.controls.select(Ze,"hasWpConnectSources")))try{const e=yield a({path:"/ithemes-security/v1/import-export/sources"});yield v(e)}catch(e){yield v([]),yield(0,c.createNotice)("error",e.message||(0,p.__)("An unknown error occurred when fetching export sources."))}}const ot={isFulfilled:e=>!!e.wpConnect.introspection,*fulfill(){try{const e=yield a({path:"/wp/v2/users/me/application-passwords/introspect"});yield A(e)}catch(e){yield A({}),yield(0,c.createNotice)("error",e.message||(0,p.__)("An unknown error occurred when fetching credential details."))}}},st={step:"enterWebsite",siteUrl:"",discovery:null,exports:null,sources:null,isCreating:!1,isDeleting:!1,createdExport:null,introspection:null},it={isValidating:!1,validatedExport:null,exportData:null,source:"",sources:[],userMap:{},roleMap:{}},ct=(0,i.combineReducers)({exports(e={items:null,errors:{}},t){switch(t.type){case H:return{...e,items:[...t.exports]};case q:return t.result.isSuccess()&&e.items?{...e,items:[t.result.data,...e.items]}:e;case B:return{...e,items:e.items.filter((e=>e.id!==t.id))};case $:return{...e,errors:{...e.errors,[t.id]:t.error}};default:return e}},creating(e={inProgress:!1,lastResult:null},t){switch(t.type){case j:return{...e,inProgress:!0,lastResult:null};case q:return{...e,inProgress:!1,lastResult:t.result};default:return e}},sources:(e=null,t)=>t.type===X?[...t.sources]:e,import:function(e=it,t){switch(t.type){case J:case G:return{...e,isValidating:!0,validatedExport:null,exportData:null,source:t.source};case z:const r={...e,isValidating:!1,validatedExport:t.result};return t.result.isSuccess()&&(r.exportData=t.result.data),r;case K:return{...e,sources:t.sources};case Q:return{...e,userMap:{...t.map}};case Y:return{...e,roleMap:{...t.map}};case Z:return{...it};default:return e}},wpConnect:function(e=st,t){switch(t.type){case ee:return{...st};case te:return{...st,siteUrl:t.url};case re:return{...e,step:"discovering"};case ne:return{...e,discovery:t.result,step:t.result.isSuccess()&&(0,E.has)(t.result,["data","index","authentication","application-passwords"])?"awaitingAuth":"noAppPasswords"};case oe:return{...e,step:"appRejected"};case se:const r=t.url===e.discovery.data.index.url;return{...st,discovery:r?e.discovery:null,step:"appAuthed",siteUrl:t.url};case ie:return{...e,discovery:t.discovery,step:t.hasSupport?"hasSupport":"noSupport"};case ce:return{...e,exports:t.exports};case pe:return{...e,sources:t.sources};case ue:return{...e,isCreating:!0,createdExport:null};case ae:return{...e,isCreating:!1,createdExport:t.result};case le:return{...e,introspection:t.introspection};case de:return{...e,isDeleting:!0};case Ee:return{...e,isDeleting:!1};default:return e}},credentials(e=null,t){switch(t.type){case ee:return null;case se:return t.credentials;default:return e}}});(0,i.registerStore)(Ze,{controls:{...c.controls,...d},actions:n,selectors:o,resolvers:s,reducer:ct,persist:["import","wpConnect"]}),r.p=window.itsecWebpackPublicPath}},e=>{e.O(0,[2038,2932],(()=>e(e.s=88109)));var t=e.O();((window.itsec=window.itsec||{})["import-export"]=window.itsec["import-export"]||{}).data=t}]);
Save File
Cancel