UNPKG

passbolt-styleguide

Version:

Passbolt styleguide contains common styling assets used by the different sites, plugin, etc.

2 lines 1.06 MB
/*! For license information please see api-app.js.LICENSE.txt */ (()=>{"use strict";var e,t,a,n={7620(e,t,a){var n=a(6540),s=a(5556),i=a.n(s),r=a(8562);function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)({}).hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},o.apply(null,arguments)}const l=n.createContext({feedbacks:[],displaySuccess:()=>{},displayWarning:()=>{},displayError:()=>{},remove:()=>{}});class c extends n.Component{constructor(e){super(e),this.state=this.defaultState}get defaultState(){return{feedbacks:[],displaySuccess:this.displaySuccess.bind(this),displayWarning:this.displayWarning.bind(this),displayError:this.displayError.bind(this),remove:this.remove.bind(this)}}displaySuccess(e){this.setState({feedbacks:[...this.state.feedbacks,{id:(0,r.A)(),type:"success",message:e}]})}displayWarning(e){this.setState({feedbacks:[...this.state.feedbacks,{id:(0,r.A)(),type:"warning",message:e}]})}displayError(e){this.setState({feedbacks:[...this.state.feedbacks,{id:(0,r.A)(),type:"error",message:e}]})}remove(e){this.setState(t=>({feedbacks:t.feedbacks.filter(t=>e.id!==t.id)}))}render(){return n.createElement(l.Provider,{value:this.state},this.props.children)}}function m(e){return class extends n.Component{render(){return n.createElement(l.Consumer,null,t=>n.createElement(e,o({actionFeedbackContext:t},this.props)))}}}function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)({}).hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},d.apply(null,arguments)}c.displayName="ActionFeedbackContextProvider",c.propTypes={children:i().any};const u=n.createContext({dialogs:[],open:()=>{},close:()=>{}});class p extends n.Component{constructor(e){super(e),this.state=this.defaultState}get defaultState(){return{dialogs:[],open:(e,t)=>{const a=(0,r.A)();return this.setState(n=>({dialogs:[...n.dialogs,{key:a,Dialog:e,DialogProps:t}]})),a},close:e=>{this.setState(t=>({dialogs:t.dialogs.filter(t=>e!==t.key)}))},closeAll:()=>this.setState({dialogs:[]})}}render(){return n.createElement(u.Provider,{value:this.state},this.props.children)}}function h(e){return class extends n.Component{render(){return n.createElement(u.Consumer,null,t=>n.createElement(e,d({dialogContext:t},this.props)))}}}function g(){return g=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)({}).hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},g.apply(null,arguments)}p.displayName="DialogContextProvider",p.propTypes={children:i().any};const b=n.createContext({ContextualMenu:null,show:()=>{},hide:()=>{}});class y extends n.Component{constructor(e){super(e),this.state=this.defaultState}get defaultState(){return{contextualMenus:[],show:(e,t)=>this.setState({contextualMenus:[...this.state.contextualMenus,{ContextualMenuComponent:e,componentProps:t}]}),hide:e=>this.setState({contextualMenus:this.state.contextualMenus.filter((t,a)=>a!==e)})}}render(){return n.createElement(b.Provider,{value:this.state},this.props.children)}}y.displayName="ContextualMenuContextProvider",y.propTypes={children:i().any};var f=a(2389);class E extends n.Component{static get DEFAULT_WAIT_TO_CLOSE_TIME_IN_MS(){return 500}constructor(e){super(e),this.state=this.defaultState,this.bindCallbacks()}get defaultState(){return{shouldRender:!0,isPersisted:!1,timeoutId:null}}componentDidMount(){this.displayWithTimer(this.props.displayTimeInMs)}componentDidUpdate(e){const t=e&&e.feedback.id!==this.props.feedback.id,a=e&&this.props.displayTimeInMs&&e.displayTimeInMs!==this.props.displayTimeInMs;t?(this.setState({shouldRender:!0}),this.displayWithTimer(this.props.displayTimeInMs)):a&&this.updateTimer(this.props.displayTimeInMs)}componentWillUnmount(){this.state.timeoutId&&clearTimeout(this.state.timeoutId)}bindCallbacks(){this.persist=this.persist.bind(this),this.displayWithTimer=this.displayWithTimer.bind(this),this.close=this.close.bind(this)}displayWithTimer(e){this.state.timeoutId&&clearTimeout(this.state.timeoutId);const t=setTimeout(this.close,e),a=Date.now();this.setState({timeoutId:t,time:a})}updateTimer(e){const t=e-(Date.now()-this.state.time);t>0?this.displayWithTimer(t):(clearTimeout(this.state.timeoutId),this.close())}persist(){this.state.timeoutId&&!this.state.isPersisted&&(clearTimeout(this.state.timeoutId),this.setState({isPersisted:!0}))}close(){this.setState({shouldRender:!1}),setTimeout(this.props.onClose,E.DEFAULT_WAIT_TO_CLOSE_TIME_IN_MS)}render(){return n.createElement("div",{className:"notification",onMouseOver:this.persist,onMouseLeave:this.displayWithTimer,onClick:this.close},n.createElement("div",{className:`message animated ${this.state.shouldRender?"fadeInUp":"fadeOutUp"} ${this.props.feedback.type}`},n.createElement("span",{className:"content"},n.createElement("strong",null,"success"===this.props.feedback.type&&n.createElement(n.Fragment,null,n.createElement(f.x6,null,"Success"),":"," "),"error"===this.props.feedback.type&&n.createElement(n.Fragment,null,n.createElement(f.x6,null,"Error"),":"," "),"warning"===this.props.feedback.type&&n.createElement(n.Fragment,null,n.createElement(f.x6,null,"Warning"),":"," ")),this.props.feedback.message)))}}E.propTypes={feedback:i().object,onClose:i().func,displayTimeInMs:i().number};const v=(0,f.CI)("common")(E);class w extends n.Component{constructor(e){super(e),this.bindCallbacks()}static get DEFAULT_DISPLAY_TIME_IN_MS(){return 5e3}static get DEFAULT_DISPLAY_MIN_TIME_IN_MS(){return 1200}bindCallbacks(){this.close=this.close.bind(this)}get feedbackToDisplay(){return this.props.actionFeedbackContext.feedbacks[0]}get length(){return this.props.actionFeedbackContext.feedbacks.length}get hasFeedbacks(){return this.length>0}async close(e){await this.props.actionFeedbackContext.remove(e)}render(){const e=this.length>1?w.DEFAULT_DISPLAY_MIN_TIME_IN_MS:w.DEFAULT_DISPLAY_TIME_IN_MS;return n.createElement(n.Fragment,null,this.hasFeedbacks&&n.createElement("div",{className:"notification-container"},n.createElement(v,{feedback:this.feedbackToDisplay,onClose:()=>this.close(this.feedbackToDisplay),displayTimeInMs:e})))}}w.propTypes={actionFeedbackContext:i().any};const k=m(w);var x=a(4625),S=a(6347);function C(){return C=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)({}).hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},C.apply(null,arguments)}const _=n.createContext({user:null,users:null,roles:null,rememberMeOptions:{},resources:null,resource:null,shareResources:null,selectedResources:null,selectedUser:null,folders:null,resourceCommentId:null,mustRefreshComments:!1,siteSettings:null,userSettings:null,onCheckIsAuthenticatedRequested:null});function N(e){return class extends n.Component{render(){return n.createElement(_.Consumer,null,t=>n.createElement(e,C({context:t},this.props)))}}}const T=_;function A(){return A=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)({}).hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},A.apply(null,arguments)}const I=n.createContext({counter:[],add:()=>{},remove:()=>{}});class R extends n.Component{constructor(e){super(e),this.state=this.defaultState}get defaultState(){return{counter:0,add:()=>{this.setState(e=>({counter:e.counter+1}))},remove:()=>{this.setState(e=>({counter:Math.min(e.counter-1,0)}))}}}render(){return n.createElement(I.Provider,{value:this.state},this.props.children)}}R.propTypes={children:i().any};class P{}class D extends P{static execute(){return!0}}class O extends P{static execute(){return!1}}const M="Folders.use",U="Users.viewWorkspace",F="Administration.viewWorkspace",j="GroupsAdd.addPost",L="AccountRecoveryRequestsView.view",q="AccountRecoveryRequestsIndex.index",z="AccountRecoveryResponsesCreate.post",K="Allow",V="Deny",G="AllowIfGroupManagerInOneGroup",B={[K]:D,[V]:O,[G]:class extends P{static execute(e){return e.groups_users.some(e=>e.is_admin)}}},W={[M]:B[K]},H={[F]:B[V],[j]:B[V],[L]:B[V],[q]:B[V],[z]:B[V]};class ${static getByRbac(e){return B[e.controlFunction]||(console.warn(`Could not find control function for the given rbac entity (${e.id})`),O)}static getDefaultForAdminAndAction(e){return W[e]||D}static getDefaultForUserAndAction(e){return H[e]||D}}class Y extends Error{constructor(e="Collection validation error."){super(e),this.name="CollectionValidationError",this.errors=[]}addItemValidationError(e,t){if(!Number.isInteger(e))throw new TypeError('CollectionValidationError::addEntityValidationError expects "position" to be an integer.');if(!(t instanceof X||t instanceof Y))throw new TypeError('CollectionValidationError::addEntityValidationError expects "entityValidationError" to be an instance of EntityValidationError or CollectionValidationError.');this.errors[e]=t}addCollectionValidationError(e,t){if("string"!=typeof e)throw new TypeError('CollectionValidationError::addCollectionValidationError expects "rule" to be a string.');if("string"!=typeof t)throw new TypeError('CollectionValidationError::addCollectionValidationError expects "error" to be a string.');this.errors[e]=t}hasErrors(){return this.errors.some(e=>Object.keys(e.details).length>0)}get details(){const e={};for(const t in this.errors)this.errors[t]instanceof X||this.errors[t]instanceof Y?e[t]=this.errors[t].details:e[t]=this.errors[t];return e}}const Z=Y;class J extends Error{constructor(e="Entity validation error."){super(e),this.name="EntityValidationError",this.details={}}addError(e,t,a){if("string"!=typeof e)throw new TypeError("EntityValidationError addError property should be a string.");if("string"!=typeof t)throw new TypeError("EntityValidationError addError rule should be a string.");if("string"!=typeof a)throw new TypeError("EntityValidationError addError message should be a string.");Object.prototype.hasOwnProperty.call(this.details,e)||(this.details[e]={}),this.details[e][t]=a}addAssociationError(e,t){if("string"!=typeof e)throw new TypeError("EntityValidationError addAssociationError associationName should be a string.");if(!(t instanceof J||t instanceof Z))throw new TypeError("EntityValidationError addAssociationError errorDetails should be an object.");this.details[e]=t}getError(e,t){if(!this.hasError(e,t))return null;const a=this.details[e];return t?a[t]:a}hasError(e,t){if("string"!=typeof e)throw new TypeError("EntityValidationError hasError property should be a string.");const a=this.details&&Object.prototype.hasOwnProperty.call(this.details,e);if(!a)return!1;if(!t)return a;if("string"!=typeof t)throw new TypeError("EntityValidationError hasError rule should be a string.");return Object.prototype.hasOwnProperty.call(this.details[e],t)}hasErrors(){return Object.keys(this.details).length>0}getFirstRuleErrorByField(e){if(!this.hasError(e))return null;const t=this.details[e];return t[Object.keys(t)[0]]}}const X=J;var Q=a(7761),ee=a.n(Q);class te{static validateSchema(e,t){if(!t)throw new TypeError(`Could not validate entity ${e}. No schema for entity ${e}.`);if(!t.type)throw new TypeError(`Could not validate entity ${e}. Type missing.`);if("array"!==t.type){if("object"===t.type){if(!t.required||!Array.isArray(t.required))throw new TypeError(`Could not validate entity ${e}. Schema error: no required properties.`);if(!t.properties||!Object.keys(t).length)throw new TypeError(`Could not validate entity ${e}. Schema error: no properties.`);const a=t.properties;for(const e in a){if(!Object.prototype.hasOwnProperty.call(a,e)||!a[e].type&&!a[e].anyOf)throw TypeError(`Invalid schema. Type missing for ${e}...`);if(a[e].anyOf&&(!Array.isArray(a[e].anyOf)||!a[e].anyOf.length))throw new TypeError(`Invalid schema, prop ${e} anyOf should be an array`)}}}else if(!t.items)throw new TypeError(`Could not validate entity ${e}. Schema error: missing item definition.`)}static validate(e,t,a){if(!e||!t||!a)throw new TypeError(`Could not validate entity ${e}. No data provided.`);switch(a.type){case"object":return te.validateObject(e,t,a);case"array":return te.validateArray(e,t,a);default:throw new TypeError(`Could not validate entity ${e}. Unsupported type.`)}}static validateArray(e,t,a){let n;const s=te.validateProp("items",t,a);if("number"==typeof a.minItems&&(te.isGreaterThanOrEqual(t.length,a.minItems)||(n=te.handleCollectionValidationError("minItems",`The items array should contain at least ${a.minItems} item(s).`,n))),"number"==typeof a.maxItems&&(te.isLessThanOrEqual(t.length,a.maxItems)||(n=te.handleCollectionValidationError("maxItems",`The items array should contain at maximum ${a.maxItems} item(s).`,n))),n)throw n;return s}static validateObject(e,t,a){const n=a.required,s=a.properties,i={};let r;for(const a in s)if(Object.prototype.hasOwnProperty.call(s,a))if(null!==t?.[a]||!0!==s[a]?.nullable){if(n.includes(a)){if(!Object.prototype.hasOwnProperty.call(t,a)){r=te.getOrInitEntityValidationError(e,r),r.addError(a,"required",`The ${a} is required.`);continue}}else if(!Object.prototype.hasOwnProperty.call(t,a))continue;try{i[a]=te.validateProp(a,t[a],s[a])}catch(t){if(!(t instanceof X))throw t;r=te.getOrInitEntityValidationError(e,r),r.details[a]=t.details[a]}}else i[a]=null;if(r)throw r;return i}static getOrInitEntityValidationError(e,t){return t||new X(`Could not validate entity ${e}.`)}static validateProp(e,t,a){if(a.anyOf)return te.validateAnyOf(e,t,a.anyOf),t;if(!0===a.nullable&&null===t)return t;if(te.validatePropType(e,t,a),a.enum)return te.validatePropEnum(e,t,a),t;switch(a.type){case"string":te.validatePropTypeString(e,t,a);break;case"integer":case"number":te.validatePropTypeNumber(e,t,a);break;case"array":te.validatePropTypeArray(e,t,a);break;case"object":case"boolean":case"blob":case"null":break;case"x-custom":te.validatePropCustom(e,t,a);break;default:throw new TypeError(`Could not validate property ${e}. Unsupported prop type ${a.type}`)}return t}static validatePropType(e,t,a){if(!te.isValidPropType(t,a.type))throw te.handlePropertyValidationError(e,"type",`The ${e} is not a valid ${a.type}.`)}static validatePropCustom(e,t,a){try{a.validationCallback(t)}catch(t){throw te.handlePropertyValidationError(e,"custom",`The ${e} is not valid: ${t.message}`)}}static validatePropTypeString(e,t,a){let n;if(a.format&&(te.isValidStringFormat(t,a.format)||(n=te.handlePropertyValidationError(e,"format",`The ${e} is not a valid ${a.format}.`,n))),a.length&&(te.isValidStringLength(t,a.length,a.length)||(n=te.handlePropertyValidationError(e,"length",`The ${e} should be ${a.length} character in length.`,n))),a.minLength&&(te.isValidStringLength(t,a.minLength)||(n=te.handlePropertyValidationError(e,"minLength",`The ${e} should be ${a.minLength} character in length minimum.`,n))),a.maxLength&&(te.isValidStringLength(t,0,a.maxLength)||(n=te.handlePropertyValidationError(e,"maxLength",`The ${e} should be ${a.maxLength} character in length maximum.`,n))),a.pattern&&(ee().matches(t,a.pattern)||(n=te.handlePropertyValidationError(e,"pattern",`The ${e} is not valid.`,n))),a.custom&&(a.custom(t)||(n=te.handlePropertyValidationError(e,"custom",`The ${e} is not valid.`,n))),n)throw n}static handlePropertyValidationError(e,t,a,n=null){return(n=n||new X(`Could not validate property ${e}.`)).addError(e,t,a),n}static handleCollectionValidationError(e,t,a=null){return(a=a||new Z("Could not validate collection.")).addCollectionValidationError(e,t),a}static validatePropTypeNumber(e,t,a){let n;if("number"==typeof a.minimum&&(te.isGreaterThanOrEqual(t,a.minimum)||(n=te.handlePropertyValidationError(e,"minimum",`The ${e} should be greater or equal to ${a.minimum}.`,n))),"number"==typeof a.maximum&&(te.isLesserThanOrEqual(t,a.maximum)||(n=te.handlePropertyValidationError(e,"maximum",`The ${e} should be lesser or equal to ${a.maximum}.`,n))),n)throw n}static validatePropTypeArray(e,t,a){let n;if(a?.items&&"object"==typeof a.items){for(let s=0;s<t.length;s++){const i=`${e}.${s}`;try{this.validateProp(i,t[s],a.items)}catch(t){if(!(t instanceof X))throw t;{n=te.getOrInitEntityValidationError(e,n);const a=t.details[i];n.details[e]={...n.details[e],[s]:a}}}}if(n)throw n}}static validatePropEnum(e,t,a){if(!te.isPropInEnum(t,a.enum)){const t=new X(`Could not validate property ${e}.`);throw t.addError(e,"enum",`The ${e} value is not included in the supported list.`),t}}static validateAnyOf(e,t,a){for(let n=0;n<a.length;n++)try{return void te.validateProp(e,t,a[n])}catch{}const n=new X(`Could not validate property ${e}.`);throw n.addError(e,"type",`The ${e} does not match any of the supported types.`),n}static isValidPropType(e,t){if(Array.isArray(t))throw new TypeError("EntitySchema isValidPropType multiple types are not supported.");if("string"!=typeof t)throw new TypeError("EntitySchema isValidPropType type is invalid.");switch(t){case"null":return null===e;case"boolean":return"boolean"==typeof e;case"string":return"string"==typeof e;case"integer":return Number.isInteger(e);case"number":return"number"==typeof e;case"object":return"object"==typeof e;case"array":return Array.isArray(e);case"blob":return e instanceof Blob;case"x-custom":return!0;default:throw new TypeError("EntitySchema validation type not supported.")}}static isValidStringFormat(e,t){if("string"!=typeof t)throw new TypeError("EntitySchema validPropFormat format is invalid.");switch(t){case"uuid":return ee().isUUID(e);case"email":case"idn-email":return ee().isEmail(e);case"date-time":return ee().isISO8601(e);case"x-hex-color":return ee().isHexColor(e);case"x-base64":return ee().isBase64(e);default:throw new TypeError(`EntitySchema string validation format ${t} is not supported.`)}}static isValidStringLength(e,t,a){return t=t||0,ee().isLength(e,t,a)}static isPropInEnum(e,t){if(!t||!Array.isArray(t)||!t.length)throw new TypeError("EntitySchema enum schema cannot be empty.");return t.includes(e)}static isGreaterThanOrEqual(e,t){return e>=t}static isLessThanOrEqual(e,t){return e<=t}static isLesserThanOrEqual(e,t){return e<=t}}const ae=te;class ne{constructor(e,t={}){(t?.clone??!0)&&(e=JSON.parse(JSON.stringify(e))),this._props=e}toDto(){return JSON.parse(JSON.stringify(this))}toJSON(){return this._props}_hasProp(e){if(!e.includes(".")){const t=ne._normalizePropName(e);return Object.prototype.hasOwnProperty.call(this._props,t)}try{return this._getPropByPath(e),!0}catch(t){return console.error(`Failed to check if property "${e}" is set:`,t),!1}}_getPropByPath(e){return ne._normalizePropName(e).split(".").reduce((e,t)=>{if(Object.prototype.hasOwnProperty.call(e,t))return e[t];throw new Error},this._props)}static _normalizePropName(e){return e.replace(/([A-Z])/g,(e,t)=>`_${t.toLowerCase()}`).replace(/\._/,".").replace(/^_/,"").replace(/^\./,"")}}const se=ne;var ie=a(5648);const re=e=>e?.replace(/_([a-z])/g,(e,t)=>t.toUpperCase()),oe=e=>e?e.charAt(0).toLocaleUpperCase()+e.slice(1):e;class le extends Error{constructor(e,t,a){if(super(a=a||"Entity collection error."),"number"!=typeof e)throw new TypeError("EntityCollectionError requires a valid position");if(!t||"string"!=typeof t)throw new TypeError("EntityCollectionError requires a valid rule");if(!a||"string"!=typeof a)throw new TypeError("EntityCollectionError requires a valid message");this.position=e,this.rule=t}}const ce=le;class me{constructor(e=[],t={}){const a=t?.clone??!0;this._items=[],a&&(e=JSON.parse(JSON.stringify(e))),this._props=e}toDto(){return JSON.parse(JSON.stringify(this._items))}toJSON(){return this.toDto()}get items(){return this._items}get length(){return this._items.length}[Symbol.iterator](){let e=0;return{next:()=>e<this._items.length?{value:this._items[e++],done:!1}:{done:!0}}}getAll(e,t){if("string"!=typeof e)throw new TypeError("EntityCollection excludeAll expects propName to be string.");if("string"!=typeof t)throw new TypeError("EntityCollection excludeAll expects search to be string.");return this._items.filter(a=>Object.prototype.hasOwnProperty.call(a._props,e)&&a._props[e]===t)}getFirst(e,t){if("string"!=typeof e||"string"!=typeof t)throw new TypeError("EntityCollection getFirst by expect propName and search to be strings");const a=this.getAll(e,t);if(a&&a.length)return a[0]}extract(e){if("string"!=typeof e)throw new TypeError("EntityCollection extract expects propName to be a string.");return this._items.reduce((t,a)=>(void 0!==a._props[e]&&t.push(a._props[e]),t),[])}push(e){return this._items.push(e),this._items.length}unshift(e){return this._items.unshift(e),this._items.length}filterByPropertyValueIn(e,t,a=!0){if("string"!=typeof e)throw new TypeError("EntityCollection filterByPropertyValueIn expects propName to be a string.");if(!Array.isArray(t))throw new TypeError("EntityCollection filterByPropertyValueIn expects needles to be an array.");this.filterByCallback(n=>{const s=Object.prototype.hasOwnProperty.call(n._props,e);return!(a&&!s||s&&!t.includes(n._props[e]))})}filterByCallback(e){if("function"!=typeof e)throw new TypeError("EntityCollection filterByCallback expects callback to be a function.");for(let t=this._items.length-1;t>=0;t--)e(this._items[t])||this._items.splice(t,1)}assertUniqueByProperty(e,t){const a=`unique_${e}`,n=this.extract(e),s=new Set;t=t||`The collection should only contain items with unique values for the property: ${e}.`,n.forEach((e,n)=>{if(s.add(e),n!==s.size-1)throw new ce(n,a,t)})}assertNotExist(e,t,a={}){if(void 0===t)return;let n=a?.haystackSet;if(!n){const t=this.extract(e);n=new Set(t)}if(n.has(t)){const t=new X,n=a?.message||`The collection already includes an element that has a property (${e}) with an identical value.`;throw t.addError(e,"unique",n),t}}}const de=me,ue=["string","number","integer","boolean"];class pe extends se{static _cachedSchema={};constructor(e={},t={}){const a=t?.validate??!0;super(e,t),this.marshall(),a&&this.validateSchema({schema:t?.schema,skipSchemaAssociationValidation:t?.skipSchemaAssociationValidation}),this.createAssociations(t),a&&this.validateBuildRules(t?.validateBuildRules)}marshall(){}validate(e={}){try{this.validateSchema({schema:e?.schema,skipSchemaAssociationValidation:e?.skipSchemaAssociationValidation}),this.validateBuildRules(e?.validateBuildRules),this.validateAssociations(e)}catch(e){if(!(e instanceof X))throw e;return e}return null}validateSchema(e=null){let t=e?.schema??this.cachedSchema;if(e?.skipSchemaAssociationValidation){t={...t};const e=Object.keys(this.constructor.associations),a=t.required.filter(t=>!e.includes(t));t.required=a}this._props=ae.validate(this.constructor.name,this._props,t)}get cachedSchema(){return this.constructor._cachedSchema[this.constructor.name]||(this.constructor._cachedSchema[this.constructor.name]=this.constructor.getSchema()),this.constructor._cachedSchema[this.constructor.name]}static getSchema(){throw new Error("The entity class should declare its schema.")}validateBuildRules(e={}){}createAssociations(e={}){if(Object.keys(this.constructor.associations).length>0){const t=new X;for(const[a,n]of Object.entries(this.constructor.associations))try{this._props[a]&&(this[`_${re(a)}`]=new n(this._props[a],{...e,clone:!1}),delete this._props[a])}catch(e){if(!(e instanceof X))throw e;t.addAssociationError(a,e)}if(t.hasErrors())throw t}}static get associations(){return{}}get(e){(0,ie.A)(e);const t=this.constructor.getSchema().properties[e];if(!t)throw new Error(`The property "${e}" has no schema definition.`);if(!ue.includes(t?.type))throw new Error('The property "associated_entity" should reference scalar properties only.');return this._props[e]}set(e,t,a={}){(0,ie.A)(e);const n=a?.validate??!0;if(this.isAssociation(e))this.setAssociation(e,t,a);else{const s=e.split(".")[0],i=this.constructor.getSchema().properties[s];if(!i)throw new Error(`The property "${s}" has no schema definition.`);if("array"===i?.type)this.setArrayProp(e,t,a);else{if(i?.type&&!ue.includes(i?.type))throw new Error('The property "associated_entity" should reference scalar properties only.');if(i?.anyOf?.some(e=>!ue.includes(e.type)))throw new Error('The property "associated_entity" should reference scalar properties only.');n&&ae.validateProp(s,t,i),this._props[s]=t}}}setArrayProp(e,t,a){(0,ie.A)(e);const n=e.split("."),s=n[0];let i=null;const r=this.constructor.getSchema().properties[s],o=a?.validate??!0;if(2!==n.length)throw new Error(`The property "${n[0]}" has no index passed.`);{const e=n[1].match(/^(\d+)$/);if(!e)throw new Error(`The property "${n[0]}" has an invalid index format. Expected format: digits.`);i=parseInt(e[1],10)}if(!ue.includes(r.items.type))throw new Error('The property "associated_entity" with array type should reference scalar properties only.');o&&ae.validateProp(s,t,r.items),this._props[s]||(this._props[s]=[]),null!=t?this._props[s][i]=t:this._props[s].splice(i,1)}setCollection(e,t,a){(0,ie.A)(e);const n=e.split("."),s=n[0];let i=null;if(1===n.length)t instanceof this.constructor.associations[e]?this[`_${s}`]=t:this[`_${s}`]=new this.constructor.associations[e](t,a);else{if(!(n.length>1))throw new Error(`The property "${n[0]}" has no index passed.`);{const e=n[1].match(/^(\d+)$/);if(!e)throw new Error(`The property "${n[0]}" has an invalid index format. Expected format: digits.`);i=parseInt(e[1],10)}}if(!this[`_${s}`])throw new Error(`The collection "${n[0]}" has no item".`);if(null!=t)if(n.length>2){if(!this[`_${s}`]._items[i])throw new Error(`The collection "${n[0]}" has no item at the index "${n[1]}".`);const e=n.slice(2).join(".");this[`_${s}`]._items[i].set(e,t,a)}else this[`_${s}`].push(t,a,a);else this[`_${s}`].items.splice(i,1)}setAssociation(e,t,a={}){if((0,ie.A)(e),this.isAssociation(e)){const n=e.split("."),s=re(n[0]);if(n.length>1)if(this[`_${s}`]||(this[`_${s}`]=new this.constructor.associations[n[0]]({},{validate:!1})),this[`_${s}`]instanceof de){const e=n.toSpliced(0,1,s).join(".");this.setCollection(e,t,a)}else{const e=n.slice(1).join(".");this[`_${s}`].set(e,t,a)}else t instanceof this.constructor.associations[e]?this[`_${s}`]=t:this[`_${s}`]=new this.constructor.associations[e](t,a)}}validateAssociations(e={}){const t=new X;if(Object.keys(this.constructor.associations).length>0&&Object.keys(this.constructor.associations).forEach(a=>{const n=re(a);if(this[`_${n}`]){const s=this[n].validate(e);s&&t.addAssociationError(a,s)}}),t.hasErrors())throw t}diffProps(e){if(!(e instanceof pe))throw new TypeError('The property "compareEntity" should be of "EntityV2" type.');const t={},a=this.constructor.getSchema(),n=Object.keys(a.properties).filter(e=>ue.includes(a.properties[e].type));for(const a of n){const n=this.get(a),s=e.get(a);n!==s&&(t[a]=s)}return t}hasDiffProps(e){const t=this.diffProps(e);return Object.keys(t).length>0}isAssociation(e){const t=e.split(".")[0];return Boolean(this.constructor.associations?.[t])}}const he=pe;class ge extends he{static getSchema(){return{type:"object",required:["name"],properties:{id:{type:"string",format:"uuid"},name:{type:"string",minLength:1,maxLength:50},description:{type:"string",maxLength:255,nullable:!0},created:{type:"string",format:"date-time"},modified:{type:"string",format:"date-time"}}}}validateBuildRules(){this.assertNoTrailingSpaces("name",this._props.name)}get id(){return this._props.id||null}get name(){return this._props.name}isAdmin(){return this.name.toLowerCase()===ge.ROLE_ADMIN}isUser(){return this.name.toLowerCase()===ge.ROLE_USER}isGuest(){return this.name.toLowerCase()===ge.ROLE_GUEST}isAReservedRole(){return this.isAdmin()||this.isUser()||this.isGuest()}verifyHealth(){let e=null;return 50===this.name.length&&(e=new X,e.addError("name","maxLength","name reached maximum length limit")),e}assertNoTrailingSpaces(e,t){if(t.trim()!==t){const t=new X;throw t.addError(e,"trailing-spaces",`The property (${e}) contains forbidden trailing spaces.`),t}}static get ENTITY_NAME(){return"Role"}static get ROLE_ADMIN(){return"admin"}static get ROLE_USER(){return"user"}static get ROLE_GUEST(){return"guest"}static get ROLE_NAME_MAX_LENGTH(){return 50}toUpdateDto(){return{name:this.name}}}class be{static canRoleUseAction(e,t,a){if(window.chrome?.webview){const n=t.findRbacByActionName(a);if(n)return $.getByRbac(n).execute(e)}const n=new ge(e.role);if(n.isAdmin())return $.getDefaultForAdminAndAction(a).execute();const s=t.findRbacByRoleAndActionName(n,a);return this.getByRbacOrDefault(s,a,e)}static getByRbacOrDefault(e,t,a){return e?$.getByRbac(e).execute(a):$.getDefaultForUserAndAction(t).execute()}}function ye(){return ye=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)({}).hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},ye.apply(null,arguments)}const fe=n.createContext({canIUseAction:()=>{}});class Ee extends n.Component{constructor(e){super(e),this.state=this.defaultState}get defaultState(){return{canIUseAction:this.canIUseAction.bind(this)}}canIUseAction(e){return be.canRoleUseAction(this.props.context.loggedInUser,this.props.context.rbacs,e)}render(){return n.createElement(fe.Provider,{value:this.state},this.props.children)}}Ee.propTypes={context:i().any,children:i().any};const ve=N(Ee);function we(e){return class extends n.Component{render(){return n.createElement(fe.Consumer,null,t=>n.createElement(e,ye({rbacContext:t},this.props)))}}}function ke(){return ke=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)({}).hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},ke.apply(null,arguments)}const xe=n.createContext({selectedAdministration:null,can:{save:!1},must:{save:!1,editSubscriptionKey:!1,refreshSubscriptionKey:!1},administrationWorkspaceAction:null,setDisplayAdministrationWorkspaceAction:()=>{},resetDisplayAdministrationWorkspaceAction:()=>{},onUpdateSubscriptionKeyRequested:()=>{},onSaveEnabled:()=>{},onMustSaveSettings:()=>{},onMustEditSubscriptionKey:()=>{},onMustRefreshSubscriptionKey:()=>{},onResetActionsSettings:()=>{}});class Se extends n.Component{constructor(e){super(e),this.state=this.defaultState}get defaultState(){return{selectedAdministration:Te.NONE,can:{save:!1},must:{save:!1,editSubscriptionKey:!1,refreshSubscriptionKey:!1},administrationWorkspaceAction:()=>n.createElement(n.Fragment,null),setDisplayAdministrationWorkspaceAction:this.setDisplayAdministrationWorkspaceAction.bind(this),resetDisplayAdministrationWorkspaceAction:this.resetDisplayAdministrationWorkspaceAction.bind(this),onSaveEnabled:this.handleSaveEnabled.bind(this),onMustSaveSettings:this.handleMustSaveSettings.bind(this),onMustEditSubscriptionKey:this.handleMustEditSubscriptionKey.bind(this),onMustRefreshSubscriptionKey:this.handleMustRefreshSubscriptionKey.bind(this),onResetActionsSettings:this.handleResetActionsSettings.bind(this)}}componentDidMount(){this.handleAdministrationMenuRouteChange()}componentDidUpdate(e){this.handleRouteChange(e.location)}handleSaveEnabled(){this.setState({can:{...this.state.can,save:!0}})}handleMustSaveSettings(){this.setState({must:{...this.state.must,save:!0}})}handleMustEditSubscriptionKey(){this.setState({must:{...this.state.must,editSubscriptionKey:!0}})}handleMustRefreshSubscriptionKey(){this.setState({must:{...this.state.must,refreshSubscriptionKey:!0}})}handleResetActionsSettings(){this.setState({must:{save:!1,test:!1,synchronize:!1,editSubscriptionKey:!1,refreshSubscriptionKey:!1}})}handleRouteChange(e){this.props.location.key!==e.key&&this.handleAdministrationMenuRouteChange()}handleAdministrationMenuRouteChange(){const e={can:{save:!1,test:!1,synchronize:!1},must:{save:!1,test:!1,synchronize:!1,editSubscriptionKey:!1,refreshSubscriptionKey:!1}};if(!this.props.rbacContext.canIUseAction(F))return e.selectedAdministration=Te.HTTP_403_ACCESS_DENIED,void this.setState(e);const t=this.props.location.pathname,a=Ie.homePage.test(t),n=Ie.mfa.test(t),s=Ie.mfaPolicy.test(t),i=Ie.passwordPolicies.test(t),r=Ie.usersDirectory.test(t),o=Ie.emailNotification.test(t),l=Ie.subscription.test(t),c=Ie.internationalization.test(t),m=Ie.accountRecovery.test(t),d=Ie.smtpSettings.test(t),u=Ie.selfRegistration.test(t),p=Ie.sso.test(t),h=Ie.rbac.test(t),g=Ie.userPassphrasePolicies.test(t),b=Ie.passwordExpirySettings.test(t),y=Ie.healthcheck.test(t),f=Ie.contentTypesEncryptedMetadata.test(t),E=Ie.contentTypesMetadataKey.test(t),v=Ie.migrateEncryptedMetadata.test(t),w=Ie.allowContentTypes.test(t),k=Ie.gettingStarted.test(t),x=Ie.scim.test(t),S=Ie.secretHistory.test(t),C=Ie.mfaPolicyTeasing.test(t),_=Ie.passwordPoliciesTeasing.test(t),N=Ie.usersDirectoryTeasing.test(t),T=Ie.subscriptionTeasing.test(t),A=Ie.accountRecoveryTeasing.test(t),I=Ie.userPassphrasePoliciesTeasing.test(t),R=Ie.ssoTeasing.test(t),P=Ie.scimTeasing.test(t);let D;if(a?D=Te.HOME:s||C?D=Te.MFA_POLICY:i||_?D=Te.PASSWORD_POLICIES:n?D=Te.MFA:r||N?D=Te.USER_DIRECTORY:o?D=Te.EMAIL_NOTIFICATION:l||T?D=Te.SUBSCRIPTION:c?D=Te.INTERNATIONALIZATION:m||A?D=Te.ACCOUNT_RECOVERY:d?D=Te.SMTP_SETTINGS:u?D=Te.SELF_REGISTRATION:p||R?D=Te.SSO:h?D=Te.RBAC:g||I?D=Te.USER_PASSPHRASE_POLICIES:b?D=Te.PASSWORD_EXPIRY:y?D=Te.HEALTHCHECK:f?D=Te.CONTENT_TYPES_ENCRYPTED_METADATA:E?D=Te.CONTENT_TYPES_METADATA_KEY:v?D=Te.MIGRATE_METADATA:w?D=Te.ALLOW_CONTENT_TYPES:k?D=Te.METADATA_GETTING_STARTED:x||P?D=Te.SCIM:S&&(D=Te.SECRET_HISTORY),!D)return e.selectedAdministration=Te.HTTP_404_NOT_FOUND,void this.setState(e);const O=Ae?.[D];e.selectedAdministration=O&&!(this.props.context.siteSettings.canIUse(O)||Re.includes(D)&&this.props.context.siteSettings.isCommunityEdition)?Te.HTTP_404_NOT_FOUND:D,this.setState(e)}setDisplayAdministrationWorkspaceAction(e){this.setState({administrationWorkspaceAction:e})}resetDisplayAdministrationWorkspaceAction(){this.setState({administrationWorkspaceAction:()=>n.createElement(n.Fragment,null)})}render(){return n.createElement(xe.Provider,{value:this.state},this.props.children)}}Se.displayName="AdministrationWorkspaceContextProvider",Se.propTypes={context:i().object,children:i().any,location:i().object,match:i().object,history:i().object,loadingContext:i().object,rbacContext:i().object};const Ce=(0,S.withRouter)(N(we((_e=Se,class extends n.Component{render(){return n.createElement(I.Consumer,null,e=>n.createElement(_e,A({loadingContext:e},this.props)))}}))));var _e;function Ne(e){return class extends n.Component{render(){return n.createElement(xe.Consumer,null,t=>n.createElement(e,ke({administrationWorkspaceContext:t},this.props)))}}}const Te={NONE:"NONE",HOME:"HOME",MFA:"MFA",MFA_POLICY:"MFA-POLICY",PASSWORD_POLICIES:"PASSWORD-POLICIES",USER_DIRECTORY:"USER-DIRECTORY",EMAIL_NOTIFICATION:"EMAIL-NOTIFICATION",SUBSCRIPTION:"SUBSCRIPTION",INTERNATIONALIZATION:"INTERNATIONALIZATION",ACCOUNT_RECOVERY:"ACCOUNT-RECOVERY",SMTP_SETTINGS:"SMTP-SETTINGS",SELF_REGISTRATION:"SELF-REGISTRATION",SSO:"SSO",RBAC:"RBAC",USER_PASSPHRASE_POLICIES:"USER-PASSPHRASE-POLICIES",PASSWORD_EXPIRY:"PASSWORD-EXPIRY",HTTP_403_ACCESS_DENIED:"403-ACCESS-DENIED",HTTP_404_NOT_FOUND:"404-NOT-FOUND",HEALTHCHECK:"HEALTHCHECK",CONTENT_TYPES_ENCRYPTED_METADATA:"CONTENT_TYPES_ENCRYPTED_METADATA",CONTENT_TYPES_METADATA_KEY:"CONTENT_TYPES_METADATA_KEY",MIGRATE_METADATA:"MIGRATE_METADATA",ALLOW_CONTENT_TYPES:"ALLOW_CONTENT_TYPES",METADATA_GETTING_STARTED:"METADATA_GETTING_STARTED",SCIM:"SCIM",SECRET_HISTORY:"SECRET_HISTORY"},Ae={[Te.MFA]:"multiFactorAuthentication",[Te.MFA_POLICY]:"mfaPolicies",[Te.PASSWORD_POLICIES]:"passwordPoliciesUpdate",[Te.USER_DIRECTORY]:"directorySync",[Te.SUBSCRIPTION]:"ee",[Te.INTERNATIONALIZATION]:"locale",[Te.ACCOUNT_RECOVERY]:"accountRecovery",[Te.SMTP_SETTINGS]:"smtpSettings",[Te.SELF_REGISTRATION]:"selfRegistration",[Te.SSO]:"sso",[Te.RBAC]:"rbacs",[Te.USER_PASSPHRASE_POLICIES]:"userPassphrasePolicies",[Te.PASSWORD_EXPIRY]:"passwordExpiry",[Te.HEALTHCHECK]:"healthcheckUi",[Te.CONTENT_TYPES_ENCRYPTED_METADATA]:"metadata",[Te.CONTENT_TYPES_METADATA_KEY]:"metadata",[Te.MIGRATE_METADATA]:"metadata",[Te.ALLOW_CONTENT_TYPES]:"metadata",[Te.METADATA_GETTING_STARTED]:"metadata",[Te.SCIM]:"scim",[Te.SECRET_HISTORY]:"secretRevisions"},Ie={homePage:/^\/app\/administration\/?$/,mfa:/^\/app\/administration\/mfa\/?$/,mfaPolicy:/^\/app\/administration\/mfa-policy\/?$/,mfaPolicyTeasing:/^\/app\/administration\/mfa-policy-teasing\/?$/,passwordPolicies:/^\/app\/administration\/password-policies\/?$/,passwordPoliciesTeasing:/^\/app\/administration\/password-policies-teasing\/?$/,usersDirectory:/^\/app\/administration\/users-directory\/?$/,usersDirectoryTeasing:/^\/app\/administration\/users-directory-teasing\/?$/,emailNotification:/^\/app\/administration\/email-notification\/?$/,subscription:/^\/app\/administration\/subscription\/?$/,subscriptionTeasing:/^\/app\/administration\/subscription-teasing\/?$/,internationalization:/^\/app\/administration\/internationalization\/?$/,accountRecovery:/^\/app\/administration\/account-recovery\/?$/,accountRecoveryTeasing:/^\/app\/administration\/account-recovery-teasing\/?$/,smtpSettings:/^\/app\/administration\/smtp-settings\/?$/,selfRegistration:/^\/app\/administration\/self-registration\/?$/,sso:/^\/app\/administration\/sso\/?$/,ssoTeasing:/^\/app\/administration\/sso-teasing\/?$/,rbac:/^\/app\/administration\/rbacs\/?$/,userPassphrasePolicies:/^\/app\/administration\/user-passphrase-policies\/?$/,userPassphrasePoliciesTeasing:/^\/app\/administration\/user-passphrase-policies-teasing\/?$/,passwordExpirySettings:/^\/app\/administration\/password-expiry\/?$/,healthcheck:/^\/app\/administration\/healthcheck\/?$/,contentTypesEncryptedMetadata:/^\/app\/administration\/content-types\/metadata\/?$/,contentTypesMetadataKey:/^\/app\/administration\/content-types\/metadata-key\/?$/,migrateEncryptedMetadata:/^\/app\/administration\/migrate-metadata\/?$/,allowContentTypes:/^\/app\/administration\/allow-content-types\/?$/,gettingStarted:/^\/app\/administration\/content-types\/metadata-getting-started\/?$/,scim:/^\/app\/administration\/user-provisionning\/scim\/?$/,scimTeasing:/^\/app\/administration\/scim-teasing\/?$/,secretHistory:/^\/app\/administration\/secret-history\/?$/},Re=[Te.SUBSCRIPTION,Te.PASSWORD_POLICIES,Te.USER_PASSPHRASE_POLICIES,Te.ACCOUNT_RECOVERY,Te.SSO,Te.MFA_POLICY,Te.USER_DIRECTORY,Te.SCIM];function Pe(){return Pe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)({}).hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Pe.apply(null,arguments)}class De extends n.Component{constructor(e){super(e),this.bindCallback()}bindCallback(){this.close=this.close.bind(this)}async close(e){const t=this.props.dialogContext.dialogs.find(({key:t})=>t===e);t?.DialogProps?.onClose&&t.DialogProps.onClose(),this.props.dialogContext.close(e)}render(){return n.createElement(n.Fragment,null,this.props.dialogContext.dialogs.map(({key:e,Dialog:t,DialogProps:a})=>n.createElement(t,Pe({key:e},a,{onClose:()=>this.close(e)}))),this.props.children)}}De.propTypes={dialogContext:i().any,children:i().any};const Oe=h(De);function Me(){return Me=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)({}).hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Me.apply(null,arguments)}class Ue extends n.Component{constructor(e){super(e),this.createRefs(),this.bindCallback()}bindCallback(){this.handleHide=this.handleHide.bind(this)}createRefs(){this.elementRef=n.createRef()}handleHide(e){this.props.contextualMenuContext.hide(e)}render(){return n.createElement("div",{ref:this.elementRef},this.props.contextualMenuContext.contextualMenus.map((e,t)=>n.createElement(e.ContextualMenuComponent,Me({key:t,hide:()=>this.handleHide(t)},e.componentProps))))}}Ue.propTypes={contextualMenuContext:i().any};const Fe=function(e){return class extends n.Component{render(){return n.createElement(b.Consumer,null,t=>n.createElement(e,g({contextualMenuContext:t},this.props)))}}}(Ue);function je(){return je=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)({}).hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},je.apply(null,arguments)}const Le=n.createContext({onGoToAdministrationRequested:()=>{},onGoToAdministrationSelfRegistrationRequested:()=>{},onGoToAdministrationMfaRequested:()=>{},onGoToAdministrationUsersDirectoryRequested:()=>{},onGoToAdministrationEmailNotificationsRequested:()=>{},onGoToAdministrationSubscriptionRequested:()=>{},onGoToAdministrationInternationalizationRequested:()=>{},onGoToAdministrationAccountRecoveryRequested:()=>{},onGoToAdministrationSmtpSettingsRequested:()=>{},onGoToAdministrationSsoRequested:()=>{},onGoToAdministrationPasswordPoliciesRequested:()=>{},onGoToAdministrationSecretHistoryRequested:()=>{},onGoToAdministrationUserPassphrasePoliciesRequested:()=>{},onGoToAdministrationPasswordExpirySettingsRequested:()=>{},onGoToAdministrationHealthcheckRequested:()=>{},onGoToPasswordsRequested:()=>{},onGoToUsersRequested:()=>{},onGoToHelpRequested:()=>{},onGoToUserSettingsProfileRequested:()=>{},onGoToUserSettingsPassphraseRequested:()=>{},onGoToUserSettingsSecurityTokenRequested:()=>{},onGoToUserSettingsThemeRequested:()=>{},onGoToUserSettingsMfaRequested:()=>{},onGoToUserSettingsKeysRequested:()=>{},onGoToUserSettingsMobileRequested:()=>{},onGoToUserSettingsDesktopRequested:()=>{},onGoToUserSettingsAccountRecoveryRequested:()=>{},onGoToNewTab:()=>{},onGoToAdministrationRbacsRequested:()=>{},onGoToAdministrationMigrateMetadataRequested:()=>{},onGoToAdministrationAllowContentTypesRequested:()=>{},onGoToAdministrationMetadataGettingStartedRequested:()=>{},onGoToAdministrationSubscriptionRequestedTeasing:()=>{},onGoToAdministrationPasswordPoliciesRequestedTeasing:()=>{},onGoToAdministrationUserPassphrasePoliciesRequestedTeasing:()=>{},onGoToAdministrationAccountRecoveryRequestedTeasing:()=>{},onGoToAdministrationSsoRequestedTeasing:()=>{},onGoToAdministrationMfaPolicyRequestedTeasing:()=>{},onGoToAdministrationUsersDirectoryRequestedTeasing:()=>{},onGoToAdministrationScimRequestedTeasing:()=>{},onGoToAdministrationScimRequested:()=>{}});class qe extends n.Component{constructor(e){super(e),this.state=this.defaultState}get defaultState(){return{onGoToNewTab:this.onGoToNewTab.bind(this),onGoToAdministrationRequested:this.onGoToAdministrationRequested.bind(this),onGoToAdministrationMfaRequested:this.onGoToAdministrationMfaRequested.bind(this),onGoToAdministrationUsersDirectoryRequested:this.onGoToAdministrationUsersDirectoryRequested.bind(this),onGoToAdministrationEmailNotificationsRequested:this.onGoToAdministrationEmailNotificationsRequested.bind(this),onGoToAdministrationSubscriptionRequested:this.onGoToAdministrationSubscriptionRequested.bind(this),onGoToAdministrationInternationalizationRequested:this.onGoToAdministrationInternationalizationRequested.bind(this),onGoToAdministrationAccountRecoveryRequested:this.onGoToAdministrationAccountRecoveryRequested.bind(this),onGoToAdministrationSmtpSettingsRequested:this.onGoToAdministrationSmtpSettingsRequested.bind(this),onGoToAdministrationSelfRegistrationRequested:this.onGoToAdministrationSelfRegistrationRequested.bind(this),onGoToAdministrationSsoRequested:this.onGoToAdministrationSsoRequested.bind(this),onGoToAdministrationMfaPolicyRequested:this.onGoToAdministrationMfaPolicyRequested.bind(this),onGoToAdministrationPasswordPoliciesRequested:this.onGoToAdministrationPasswordPoliciesRequested.bind(this),onGoToAdministrationSecretHistoryRequested:this.onGoToAdministrationSecretHistoryRequested.bind(this),onGoToAdministrationUserPassphrasePoliciesRequested:this.onGoToAdministrationUserPassphrasePoliciesRequested.bind(this),onGoToAdministrationPasswordExpirySettingsRequested:this.onGoToAdministrationPasswordExpirySettingsRequested.bind(this),onGoToAdministrationHealthcheckRequested:this.onGoToAdministrationHealthcheckRequested.bind(this),onGoToAdministrationContentTypesEncryptedMetadataRequested:this.onGoToAdministrationContentTypesEncryptedMetadataRequested.bind(this),onGoToAdministrationContentTypesMetadataKeyRequested:this.onGoToAdministrationContentTypesMetadataKeyRequested.bind(this),onGoToAdministrationMigrateMetadataRequested:this.onGoToAdministrationMigrateMetadataRequested.bind(this),onGoToAdministrationAllowContentTypesRequested:this.onGoToAdministrationAllowContentTypesRequested.bind(this),onGoToPasswordsRequested:this.onGoToPasswordsRequested.bind(this),onGoToUsersRequested:this.onGoToUsersRequested.bind(this),onGoToHelpRequested:this.onGoToHelpRequested.bind(this),onGoToUserSettingsProfileRequested:this.onGoToUserSettingsProfileRequested.bind(this),onGoToUserSettingsPassphraseRequested:this.onGoToUserSettingsPassphraseRequested.bind(this),onGoToUserSettingsSecurityTokenRequested:this.onGoToUserSettingsSecurityTokenRequested.bind(this),onGoToUserSettingsThemeRequested:this.onGoToUserSettingsThemeRequested.bind(this),onGoToUserSettingsMfaRequested:this.onGoToUserSettingsMfaRequested.bind(this),onGoToUserSettingsKeysRequested:this.onGoToUserSettingsKeysRequested.bind(this),onGoToUserSettingsMobileRequested:this.onGoToUserSettingsMobileRequested.bind(this),onGoToUserSettingsDesktopRequested:this.onGoToUserSettingsDesktopRequested.bind(this),onGoToUserSettingsAccountRecoveryRequested:this.onGoToUserSettingsAccountRecoveryRequested.bind(this),onGoToAdministrationRbacsRequested:this.onGoToAdministrationRbacsRequested.bind(this),onGoToAdministrationMetadataGettingStartedRequested:this.onGoToAdministrationMetadataGettingStartedRequested.bind(this),onGoToAdministrationSubscriptionRequestedTeasing:this.onGoToAdministrationSubscriptionRequestedTeasing.bind(this),onGoToAdministrationPasswordPoliciesRequestedTeasing:this.onGoToAdministrationPasswordPoliciesRequestedTeasing.bind(this),onGoToAdministrationUserPassphrasePoliciesRequestedTeasing:this.onGoToAdministrationUserPassphrasePoliciesRequestedTeasing.bind(this),onGoToAdministrationAccountRecoveryRequestedTeasing:this.onGoToAdministrationAccountRecoveryRequestedTeasing.bind(this),onGoToAdministrationSsoRequestedTeasing:this.onGoToAdministrationSsoRequestedTeasing.bind(this),onGoToAdministrationMfaPolicyRequestedTeasing:this.onGoToAdministrationMfaPolicyRequestedTeasing.bind(this),onGoToAdministrationUsersDirectoryRequestedTeasing:this.onGoToAdministrationUsersDirectoryRequestedTeasing.bind(this),onGoToAdministrationScimRequestedTeasing:this.onGoToAdministrationScimRequestedTeasing.bind(this),onGoToAdministrationScimRequested:this.onGoToAdministrationScimRequested.bind(this)}}async goTo(e,t){if(e===this.props.context.name)return void await this.props.history.push({pathname:t});if("api"===e)return void await this.props.context.port.request("passbolt.tabs.open-admin-page",t);const a=`${this.props.context.userSettings?this.props.context.userSettings.getTrustedDomain():this.props.context.trustedDomain}${t}`;window.open(a,"_parent","noopener,noreferrer")}onGoToNewTab(e){window.open(e,"_blank","noopener,noreferrer")}async onGoToAdministrationRequested(){await this.goTo("browser-extension","/app/administration")}async onGoToAdministrationMfaRequested(){await this.goTo("api","/app/administration/mfa")}async onGoToAdministrationMfaPolicyRequested(){await this.goTo("api","/app/administration/mfa-policy")}async onGoToAdministrationPasswordPoliciesRequested(){await this.goTo("browser-extension","/app/administration/password-policies")}async onGoToAdministrationSecretHistoryRequested(){await this.goTo("browser-extension","/app/administration/secret-history")}async onGoToAdministrationSelfRegistrationRequested(){await this.goTo("api","/app/administration/self-registration")}async onGoToAdministrationUsersDirectoryRequested(){await this.goTo("api","/app/administration/users-directory")}async onGoToAdministrationHealthcheckRequested(){await this.goTo("api","/app/administration/healthcheck")}async onGoToAdministrationEmailNotificationsRequested(){await this.goTo("api","/app/administration/email-notification")}async onGoToAdministrationSmtpSettingsRequested(){await this.goTo("api","/app/administration/smtp-settings")}async onGoToAdministrationSubscriptionRequested(){await this.goTo("browser-extension","/app/administration/subscription")}async onGoToAdministrationInternationalizationRequested(){await this.goTo("api","/app/administration/internationalization")}async onGoToAdministrationAccountRecoveryRequested(){await this.goTo("browser-extension","/app/administration/account-recovery")}async onGoToAdministrationSsoRequested(){await this.goTo("browser-extension","/app/administration/sso")}async onGoToAdministrationRbacsRequested(){await this.goTo("api","/app/administration/rbacs")}async onGoToAdministrationMetadataGettingStartedRequested(){await this.goTo("browser-extension","/app/administration/content-types/metadata-getting-started")}async onGoToAdministrationScimRequested(){await this.goTo("browser-extension","/app/administration/user-provisionning/scim")}async onGoToAdministrationUserPassphrasePoliciesRequested(){await this.goTo("browser-extension","/app/administration/user-passphrase-policies")}async onGoToAdministrationPasswordExpirySettingsRequested(){await this.goTo("browser-extension","/app/administration/password-expiry")}async onGoToAdministrationContentTypesEncryptedMetadataRequested(){await this.goTo("browser-extension","/app/administration/content-types/metadata")}async onGoToAdministrationContentTypesMetadataKeyRequested(){await this.goTo("browser-extension","/app/administration/content-types/metadata-key")}async onGoToAdministrationMigrateMetadataRequested(){await this.goTo("browser-extension","/app/administration/migrate-metadata")}async onGoToAdministrationAllowContentTypesRequested(){await this.goTo("browser-extension","/app/administration/allow-content-types")}async onGoToAdministrationSubscriptionRequestedTeasing(){await this.goTo("browser-extension","/app/administration/subscription-teasing")}async onGoToAdministrationPasswordPoliciesRequestedTeasing(){await this.goTo("browser-extension","/app/administration/password-policies-teasing")}async onGoToAdministrationUserPassphrasePoliciesReq